Isle runs Verilog tests using cocotb and two simulators:
- Icarus Verilog (iverilog)
- Verilator
Before you run tests, follow the installation instructions (below).
I'm still learning cocotb, so I'm sure there'll be some mistakes and approaches that strike experienced hands as strange. Please open an issue if you have corrections or suggestions for improvement.
Ensure you've installed simulators and cocotb and sourced the Python venv if appropriate:
cd isle/hardware/tests
source .venv/bin/activateRun tests using make within your chosen directory. For example, to test the TMDS encoder:
cd gfx
make tmds_encoderUse WAVES=1 (case sensitive) to generate FST waveform files.
For example, the following creates sim_build/clut/clut.fst:
cd mem
make WAVES=1 clutSurfer (recommended) and GTKWave support FST waveforms.
Many Isle tests generate random data. Ensure you include the value of COCOTB_RANDOM_SEED (from cocotb output) in your test failure report, otherwise it might be impossible to reproduce your test failure.
FPGAs, such as Xilinx XC7 and Lattice ECP5, reset registers (flip-flops) to zero when configured at power-on. However, simulators such as Icarus Verilog do not. This isn't usually a problem for Isle, but there are a few cases where this breaks simulation. To handle these cases, Isle Verilog modules may include conditional initial values with BENCH, for example (from xd.v):
`ifdef BENCH // play nicely in sim without reset
initial begin
toggle_src = 0;
shr_dst = 0;
end
`endifIsle test bench makefiles enable this with:
COMPILE_ARGS += -DBENCHI recommend defining BENCH if you're doing your own simulation of Isle Verilog modules.
There is a Verilator lint script in each hardware/book chapter directory that checks the complete design.
For example, to lint chapter 1 designs:
cd isle/hardware/book/ch01
./lint.shYou can lint hardware tests from within the isle/hardware directory.
cd isle/hardware
pylint tests/gfx/tmds_encoder.py
pylint tests/book/ch03.pyInstall Icarus Verilog using the official instructions or run brew install icarus-verilog on macOS.
Install Verilator using the official instructions or run brew install verilator on macOS.
See boards/verilator for advice on using Verilator to run the full Isle simulation.
Isle requires cocotb 2. I recommend installing cocotb inside a venv using the hardware test requirements.txt:
cd isle/hardware/tests
python3 -m venv .venv
source .venv/bin/activate
pip3 install -r requirements.txtTroubleshooting:
- The latest version of Python isn't necessarily supported by cocotb - check supported python versions (cocotb.org)
- If you're having issues running cocotb on macOS, try using brew Python instead of the system one.
- I don't recommend using the version of cocotb from OSS CAD Suite because it's not a stable release.