Home

Awesome

This is an example testbench using the cocotb framework with cocotb-coverage extension for the apbi2c controller verification from FreeCores. The intention is to present advanced metric-driven and constrained-random functional verification techniques using a pure Python-based implementation. No support of hardware verification languages such as e or SystemVerilog is required, which enables the use of an arbitrary basic HDL simulator for the entire verification process.

This testbench is used as an example in the Article published in Journal of Electronic Testing.

To run the example you need to install the cocotb and cocotb-coverage pip packages. You also need cocotb-checkpoint to be linked to your Python environment.

To download the example code with the apbi2c controller submodule, use

git clone --recurse-submodules https://github.com/mciepluc/apbi2c_cocotb_example.git

The testbench contains all important parts of an advanced verification environment:

Additionally, the testbench presents the idea of checkpointing, which is storing a specific simulation state of the DUT, to be used later as a new starting point of the following test sequences. This option can be disabled (global variables ENABLE_CHECKPOINTS and CHECKPOINTS_TREE_STRUCTURE in tb/test_i2c.py) as it may not work properly under all simulation platforms.

There are a number of issues with the apbi2c controller, discovered with this testbench. The test completes successfully only with the checkpointing option enabled, as this prevents from continuing operation of the DUT at lock-up state. There are a number of errors discovered, such as: