apb modules for cocotb
Project description
APB interface modules for Cocotb
GitHub repository: https://github.com/daxzio/cocotbext-apb
Introduction
APB simulation models for cocotb.
Installation
Installation from pip (release version, stable):
$ pip install cocotbext-apb
Installation from git (latest development version, potentially unstable):
$ pip install https://github.com/daxzio/cocotbext-apb/archive/main.zip
Installation for active development:
$ git clone https://github.com/daxzio/cocotbext-apb
$ pip install -e cocotbext-apb
Documentation and usage examples
See the tests directory for complete testbenches using these modules.
APB Bus
The APBBus is used to map to a JTAG interface on the dut. Class methods from_entity and from_prefix are provided to facilitate signal default name matching.
Required:
- psel
- pwrite
- paddr
- pwdata
- pready
- prdata
Optional:
- pstrb
- pprot
- pslverr
APB Master
The ApbMaster class implement a APB driver and is capable of generating read and write operations against APB slaves.
To use these modules, import the one you need and connect it to the DUT:
from cocotbext.apb import ApbMaster, ApbBus
bus = ApbBus.from_prefix(dut, "s_apb")
apb_driver = ApbMaster(bus, dut.clk)
The first argument to the constructor accepts an ApbBus 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 ApbMaster
- period: Clock frequency period of
tck, default100 - units: Clock units, default
ns - logging_enabled: Logging enable, default
True
Methods
add_device(device): Add device to jtag chain, must be of typeJTAGDeviceset_reset(num): Reset for num if trst is present inJTAGBus, raise warning if trst is not presentreset_finished(): Asyn wait until reset is finishedreset_fsm(): Send 5 tck pulses while tms is held high inJTAGBus, this resets the finite state machine inside a JTAG TAPsend_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 Falsewrite_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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file cocotbext_apb-0.2.0.tar.gz.
File metadata
- Download URL: cocotbext_apb-0.2.0.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c409936a181d269c27f73782644791799fe94c223e7c047cb92bd3a517b2d7a4
|
|
| MD5 |
735fc72495df7abed4c2de9c851aead4
|
|
| BLAKE2b-256 |
1ff2336d4530d6ec9510767ed61a65bc6a38a2ddaf0fc6b8167e188aa78a828d
|