Skip to content

A unit-test framework for testing Migen modules directely on hardware.

License

Notifications You must be signed in to change notification settings

MaxenceCaronLasne/unitbench

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

unitbench

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.

Install

python setup.py install

Launch testsuite

pip install -r requirements.txt
pytest

TODOs

[X] Add null support for declarations.

[X] Add simulation support.

[ ] Test on hardware.

[ ] Add support for external memory.

[ ] Enable multi-module testing.

About

A unit-test framework for testing Migen modules directely on hardware.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages