Skip to content
hw.dev
hw.dev/signal/rtl-bench-cocotb-exact-test-count-2026
Signalrtl-bench

A Logic Benchmark Fails When Cocotb Runs the Wrong Number of Tests

rtl-bench checks the exact Cocotb pass count, so an empty or partial test selection cannot look green.

Thesis connection

Automated chip tests now prove that the intended cases ran, not merely that no reported case failed.

#eda#testing#verification#software
Read Original

rtl-bench can now run Cocotb, a Python framework for testing digital logic, against a design in the Verilator simulator. Each workload names the test functions it expects and the exact number that must pass. The runner reads Cocotb's results file and rejects a run if any case failed or if the pass count is wrong.

Exact counting closes a common false-green path. A renamed test, a bad filter, or a discovery error can select zero cases and still leave a clean process exit. By putting the expected functions and count in the workload schema, rtl-bench makes test selection part of the benchmark definition and checks it beside the hardware result.

The new path still depends on authors updating the count when they add a legitimate test. That small maintenance cost is preferable to treating an empty run as evidence. Other register-transfer-level (RTL) test harnesses should copy the rule: a green job must say how many cases it meant to run and prove that it ran exactly those cases.