Files
PeakRDL-regblock/tests
sbaillou d69af23be5 Error response for unmapped address or forbidden read/write access (#168)
* feat: add ability to enable error output on the cpuif, when decoding errors occur (generate_cpuif_err in API).

* fix: move signal to new place (after automatic vers)

* feat: add info about new api (generate_cpuif_err)

* fix: repair readback with latency

* Adding generate_cpuif_err argument to peakrdl-regblock to generate cpuif error response, when the address is decoded incorrectly

* add sw rd or/and wr attribure error response related and add error respone for external mem

* add sw rd or/and wr error response test

* add sw rd or/and wr error response for external register test and fix generation of rtl logic for external register

* add sw rd or/and wr error response for external mem test

* add sw rd or/and wr error response for apb3 imterfaces driver

* add error response test for APB4, AXI4Lite and Avalon interfaces

* rename --generate_cpuif_err to --generate-cpuif-err

* style: minor typo fixes and test clean-up

* refactor: move expected error check inside write/read functions

* feat: add error response check to OBI testbench interface

* feat: split generate-cpuif-err option into err-if-bad-addr and err-if-bad-rw options

* feat: add err_if_bad_addr/rw to cfg_schema

* feat: extend cpuif_err_rsp test to cover all combinations of bad_addr/bad_rw

* style: lint fixes

* fix: removed redundant if node.external condition to help coverage

* Fix dangling hwif_in signals in testcase

---------

Co-authored-by: Denis Trifonov <d.trifonov@yadro.com>
Co-authored-by: Dominik Tanous <tanous@kandou.com>
Co-authored-by: Sebastien Baillou <baillou@kandou.com>
Co-authored-by: Alex Mykyta <amykyta3@users.noreply.github.com>
2025-10-25 18:22:15 -07:00
..
2022-10-29 22:02:04 -07:00
2023-10-22 20:43:34 -07:00
2025-03-03 21:37:07 -08:00
2025-10-13 22:42:40 -07:00
2024-12-18 20:29:17 -08:00
2025-10-13 22:42:40 -07:00

Test Dependencies

Questa

Testcases require an installation of the Questa simulator, and for vlog & vsim commands to be visible via the PATH environment variable.

Questa - Intel FPGA Starter Edition can be downloaded for free from Intel:

Vivado (optional)

To run synthesis tests, Vivado needs to be installed and visible via the PATH environment variable.

Vivado can be downloaded for free from: https://www.xilinx.com/support/download.html

Python Packages

Install dependencies required for running tests

python3 -m pip install -r tests/requirements.txt

Running tests

Tests can be launched from the test directory using pytest. Use pytest --workers auto to run tests in parallel.

To run all tests:

python3 setup.py install
pytest tests

You can also run a specific testcase. For example:

pytest tests/test_hw_access

Command-line arguments can be used to explicitly select which simulator/synthesis tools are used If unspecified, the tool will be selected automatically based on what you have installed.

pytest --sim-tool questa --synth-tool vivado

Alternatively, launch tests using the helper script. This handles installing dependencies into a virtual environment automatically.

cd tests
./run.sh

Test organization

The goal for this test infrastructure is to make it easy to add small-standalone testcases, with minimal repetition/boilerplate code that is usually present in SystemVerilog testbenches.

To accomplish this, Jinja templates are used extensively to generate the resulting tb.sv file, as well as assist in dynamic testcase parameterization.

CPU Interfaces

Each CPU interface type is described in its own folder as follows:

lib/cpuifs/<type>/__init__.py
Definitions for CPU Interface test mode classes.
lib/cpuifs/<type>/tb_inst.sv
Jinja template that defines how the CPU interface is declared & instantiated in the testbench file.
lib/cpuifs/<type>/*.sv
Any other files required for compilation.

Testcase

Each testcase group has its own folder and contains the following:

test_*/__init__.py
Empty file required for test discovery.
test_*/regblock.rdl
Testcase RDL file. Testcase infrastructure will automatically compile this and generate the regblock output SystemVerilog.
test_*/tb_template.sv
Jinja template that defines the testcase-specific sequence.
test_*/testcase.py
Defines Python unittest testcase entry point.

Parameterization

Testcase classes can be parameterized using the parameterized extension. This allows the same testcase to be run against multiple permutations of regblock export modes such as CPU interfaces, retiming flop stages, or even RDL parameterizations.