Skip to main content

jtag modules for cocotb

Project description

JTAG interface modules for Cocotb

Build Status codecov PyPI version Downloads

GitHub repository: https://github.com/daxzio/cocotbext-jtag

Introduction

JTAG simulation models for cocotb.

Installation

Installation from pip (release version, stable):

$ pip install cocotbext-jtag

Installation from git (latest development version, potentially unstable):

$ pip install https://github.com/daxzio/cocotbext-jtag/archive/main.zip

Installation for active development:

$ git clone https://github.com/daxzio/cocotbext-jtag
$ pip install -e cocotbext-jtag

Documentation and usage examples

See the tests directory for complete testbenches using these modules.

JTAG Bus

The JTAGBus is used to map to a JTAG interface on the dut. These hold instances of bus objects for the individual channels, which are currently extensions of cocotb_bus.bus.Bus. Class methods from_entity and from_prefix are provided to facilitate signal default name matching.

Required:

  • tck
  • tms
  • tdi
  • tdo

Optional:

  • trst

JTAG Driver

The JTAGDriver class implement a JTAG driver and is capable of generating read and write operations against JTAG devices, either singularly or in a chain.

To use these modules, import the one you need and connect it to the DUT:

from cocotbext.jtag import JTAGDriver, JTAGBus

bus = JTAGBus(dut)
jtag_driver = JTAGDriver(bus)

The first argument to the constructor accepts an JTAGBus object. These objects are containers for the interface signals and include class methods to automate connections.

Once the module is instantiated, read and write operations can be initiated in a couple of different ways.

Additional optional arguments for JTAGDriver

  • period: Clock frequency period of tck, default 100
  • units: Clock units, default ns
  • logging_enabled: Logging enable, default True

Methods

  • add_device(device): Add device to jtag chain, must be of type JTAGDevice
  • set_reset(num): Reset for num if trst is present in JTAGBus, raise warning if trst is not present
  • reset_finished(): Asyn wait until reset is finished
  • reset_fsm(): Send 5 tck pulses while tms is held high in JTAGBus, this resets the finite state machine inside a JTAG TAP
  • send_val(addr, val, device, write): Send addr to device (default: 0). The val is used to write if write is True or verify against if write is False
  • write_val(addr, val, device=0): Write val to addr of device (default: 0).
  • read_val(addr, val=None, device=0): Read from addr of device (default: 0). If val present verify against returned value.
  • read_idcode(device): Read device number device and confirm it matched the IDCODE set for that device

JTAG Device

from cocotbext.jtag import JTAGDevice

class J1JTAGDevice(JTAGDevice):
    def __init__(self, name='jtaglet1', idcode=0x53817905, ir_len=5):
        super().__init__(name, idcode, ir_len)
        self.add_jtag_reg('USERDATA', 32, 0x8)
        self.add_jtag_reg('USEROP', 8, 0x9)

from cocotbext.jtag import JTAGDriver
from cocotbext.jtag import JTAGBus

class testbench:
    def __init__(self, dut):
        bus = JTAGBus(dut)
        self.jtag = JTAGDriver(bus)
        self.jtag.add_device(J1JTAGDevice())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cocotbext-jtag-0.0.9.tar.gz (13.8 kB view details)

Uploaded Source

File details

Details for the file cocotbext-jtag-0.0.9.tar.gz.

File metadata

  • Download URL: cocotbext-jtag-0.0.9.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for cocotbext-jtag-0.0.9.tar.gz
Algorithm Hash digest
SHA256 a53939bad2cc56c8b3e42ba1c279e1ce2a9a725277d75827539d4119b97b355e
MD5 6ec7b39e3f9395a529fc3f4d263335bc
BLAKE2b-256 05d9ae0c1314169207bb58831c92cc7d75a17ff86a040c2d26e18f29a0aadcb9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page