The rstb - Rust Test Bench - library aims to provide an easy to use Rust interface to HDL simulators which implement a VPI or VHPI interface.
It is heavily inspired by, the awesome and feature rich cocotb which uses Python to the same purpose.
So why bother? Turns out Rust is ideally suited for this task. It * interfaces easily with C, * since end of 2019, it supports zero-cost futures with async/await syntax, which makes writing testbenches very "ergonomic" and easy to reason about, * has an extensive and fast growing ecosysem of open source packages, * and on top is a blazingly fast compiled language with no runtime required.
When comparing to Python, tests in Rust are more verbose and writing them is a bit more of a hassle because of the static typing and borrow checking, but test execution is a lot faster (~80x speedup with simple D-Flipflop example).
Trigger
s)crate-type = ["cdylib"]
to Cargo.toml
as with the examples using cargo build --release
.run_questa.sh
/run_icarus.sh
/run_cadence.sh
)Run it on gitpod (using Icarus Verilog): https://gitpod.io/#https://github.com/benbr8/rstb_examples