unitbench
is a (WIP!) hardware unit testing library for
Migen modules.
The goal is to be able to unit test small parts of a design directely on hardware (FPGA).
The tests are described with JSON
files. Here is an example:
{ "name": "example", "tests": [ { "tag": "first-test", "ticks_before_next_input": 1, "ticks_before_checking": 2, "rounds": [ { "inputs": { "i_first": 1, "i_second": "0b0001" }, "outputs": { "o_first": 1, "o_second": "0b0001" } }, { "inputs": { "i_first": 2, "i_second": "0b0010" }, "outputs": { "o_first": 2, "o_second": "0b0010" } }, { "inputs": { "i_first": 3, "i_second": "0b0011" }, "outputs": { "o_first": 3, "o_second": null } } ] }, { "tag": "second-test", "ticks_before_next_input": 1, "ticks_before_checking": 2, "rounds": [ { "inputs": { "i_first": 3, "i_second": "0b0011" }, "outputs": { "o_first": 3, "o_second": "0b0011" } }, { "inputs": { "i_first": 4, "i_second": "0b0100" }, "outputs": { "o_first": 4, "o_second": "0b0100" } } ] } ] }
The tests are built by wrapping a dynamicly designed test module around the module under test that applies test inputs and check outputs.
python setup.py install
pip install -r requirements.txt pytest
[X] Add null
support for declarations.
[X] Add simulation support.
[ ] Test on hardware.
[ ] Add support for external memory.
[ ] Enable multi-module testing.