Patronus is a just-in-time (JIT) compiler that consumes BTOR2 inputs lowered from hardward description frontends, such as Verilog and FIRRTL emitted by Chisel,
and can serve as an alternative to existing RTL simulation tools. Patronus features fast compilation while preserving simulation speed within acceptable ranges.
designs: Pre-generated Verilog files for different rocket-chip configspatronus:PatronusRust crateresources: Verilog resources used indesignsand C++ resources for simulation
- riscv-toolchain: riscv cross-compiler and libc
- riscv-tests: test and benchmark program
- yosys: used to translate Verilog into Btor. Please build it from our forked version, which includes a few extensions to support translation of large chip designs.
- git-lfs: used to download large precompiled Verilog and BTOR files for uploaded chip designs.
$ make all
$ ./resources/emulator <rocket-chip-btor-file> <test-elf>
make allgenerates btor file from rocket-chip's Verilog, compilesPatronusas a shared library and links it against the top test driver compiled fromresources/cxx/emulator.cc.<rocket-chip-btor-file>can be found indesigns/<config>/TestHarness.btor.<test-elf>is compiled from riscv-tests.
We recommend starting with tests under riscv-tests/isa for a quick demonstration of Patronus.
User may also try out bench programs under riscv-tests/benchmarks, which might take several minutes to finish.
Example run:
$ ./resources/emulator -c designs/rocket20/TestHarness.btor $RISCV_TESTS/isa/rv64ui-p-add
By default, Patronus uses the JIT backend. It also provides an interpreter backend, which can be configured by setting RUST_DRIVER_FEATURE = interpreter in Makefile,
but it is somewhat discouraged for RocketChip due to its slow speed.
For a more comprehensive comparison between Patronus and other existing RLT simulation tools over multiple metrics, including simulator generation, simulator compilation time and simulation performance, please check out our benchmarking repo!