Skip to main content

apb modules for cocotb

Project description

APB interface modules for Cocotb

Build Status codecov PyPI version Downloads

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, 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

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_apb-0.1.1.tar.gz (9.5 kB view details)

Uploaded Source

File details

Details for the file cocotbext_apb-0.1.1.tar.gz.

File metadata

  • Download URL: cocotbext_apb-0.1.1.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

Hashes for cocotbext_apb-0.1.1.tar.gz
Algorithm Hash digest
SHA256 586db936a009c3c311266d6a6cb38ee0ec182f82df62f5b9cb61ef2f8ba85bfa
MD5 e6a35b791688ece3a6f3ca7a7aa06ca4
BLAKE2b-256 e475f5eade213587c99be7680ce182b8d0958423e3f48e17d414f36b51ca13e1

See more details on using hashes here.

Supported by

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