Skip to main content

A direct substition for PYNQ library, to seamlessly allow simulation of PL region + PS-PL interface

Project description

Use python3 -m cocotbpynq.sample to see sample

cocotbpynq

cocotbpynq is an extension of cocotb that allows for your PYNQ code to be seamlessly used for simulation. This allows you to debug the AXI transactions that occur between the PL and PS. Currently, there is support for the Pynq Z1 board, although it shouldn't be much different, (if at all), to adapt this code to other PYNQ-compatible FPGAs.

Installation

Once Python is installed, install cocotbpynq using the following:

pip install cocotbpynq

Alternatively, clone the repo and use it as an install directory for the most up-to-date version:

https://github.com/watcag/cocotb-pynq

cocotbpynq.sample

How to use cocotbpynq

There is a sample directory, src/cocotbpynq/sample that shows everything needed make use cocotbpynq yourself. It even includes a hardware hand-off file. Specifically, you will want to reference cocotb_runner.py and adapted.py for development of your own tests.

Running the sample

You can run this sample project mentioned above (after installing cocotbpynq) with:

python3 -m cocotbpynq.sample

Note that verilator is used in the sample project, so you will need verilator installed for this to work out of the box.

Adaptation from PYNQ code

The original.py and original_vs_adapted.diff files are there to illustrate how few changes are needed to adapt PYNQ code ALSO be simulation ready. The adaptation should allow you to either run the cocotb_runner.py file to run a simulation, or continue to run the adapted file on a PYNQ-compatible board.

Verilog Description

The sample is meant to illustrate a simple example with one AXI-Lite port(MMIO), one AXI-Stream read port (DMA send), and one AXI-Stream write port (DMA recv). The circuit performs a simple y = ax²+bx+c operation, where a, b, and c are all constants that can be modified/read using the MMIO port at addresses 0x10, 0x18, and 0x20 respectively, and x and y are AXI-Stream write/read ports respectively.

HWH Generation

HWH file can be generated independantly of bitstream using the following Vivado CLI command:

generate_target all <block design file>

This can be used to circumvent the need to ever to bitstream generation. Unlike bitstream generation, this command only needs to be run if the block diagram is updated.

Paper

Our paper was presented at the 35th International Conference on Field-Programmable Logic and Applications(FPL 2025). The conference paper can be found here: < Proceedings not available yet >

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

cocotbpynq-0.0.1.tar.gz (23.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cocotbpynq-0.0.1-py3-none-any.whl (28.5 kB view details)

Uploaded Python 3

File details

Details for the file cocotbpynq-0.0.1.tar.gz.

File metadata

  • Download URL: cocotbpynq-0.0.1.tar.gz
  • Upload date:
  • Size: 23.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for cocotbpynq-0.0.1.tar.gz
Algorithm Hash digest
SHA256 fe5f17a7adb803ded5f64097337c08b061c5b8b3b96fc74638da6cee571d9caa
MD5 05ddcece6823638076a5fc0b8f8807c9
BLAKE2b-256 f8231f2ceb9e2891a5bb4d520a5506c1756dbff48056af4e0f20394e11d8c2d2

See more details on using hashes here.

File details

Details for the file cocotbpynq-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: cocotbpynq-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 28.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for cocotbpynq-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f060d0196da03d04c721aa000b76d2f0d187f66198a95467f5ae411e4112c36b
MD5 180018265fa3cdd7232d94d95548cf48
BLAKE2b-256 fe73f258983f6b938d43cee2dd18b53f660651d1a4285a73e5330acf4177c4c2

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