Skip to content
Rivoryxa Technologies

A Python testbench that checks itself

A reference model, random stimulus, and a coverage count per operation.

Checks passed

Public demonstration

This is not a client result. The recorded command and check status appear below.

Recorded outcome

2 tests, 0 failures, with every operation exercised. No commercial licence involved.

What was checked

Problem
A testbench that only checks that something happened will pass while a whole class of inputs goes untested, and nothing in the run says so.
Scope
One arithmetic and logic unit (ALU) with eight operations.
Approach
A Python reference model predicts the right answer. Directed tests hit the corner cases, random stimulus runs on top, and the test counts how often each operation was exercised and checks that count at the end.
Evidence
The run log reports the test results and the count for each operation.

Scope and limits

What these checks do not establish.

  • The block is small and has no internal state, so it is a simple case for a testbench.
  • The coverage is a count per operation, not a full functional coverage model with cross coverage.
Reproduce and inspect

Recorded verification status

We reran this on 13 September 2026 with cocotb 2.1.0 and Icarus Verilog 13.0: 2 tests, 0 failures, all eight operations exercised.

Recorded commandcocotb-alu-verification
pip install cocotb
apt install iverilog   # or: brew install icarus-verilog
make
Filesrtl/alu.vadd, sub, and, or, xor, sll, srl, slttb/test_alu.pydirected, random, coverage count

Want this method on your design?

Share the problem in a few lines. We will discuss the scope before any confidential project material changes hands.

Discuss a verification problem