3.4 KiB
Ibex simulation for RISC-V Compliance Testing
This directory contains a compiled simulation of Ibex to be used as target in the RISC-V Compliance Test. In addition to Ibex itself, it contains a 64 kB RAM and a memory-mapped helper module to interact with the software, e.g. to dump out the test signature and to end the simulation.
The simulation is designed for Verilator, but can be adapted to other simulators if needed.
How to run RISC-V Compliance on Ibex
-
Check your prerequisites To compile the simulation and run the compliance test suite you need to have the following tools installed:
- Verilator
- fusesoc
- srecord (for
srec_cat
) - A RV32 compiler
On Ubuntu/Debian, install the required tools like this:
sudo apt-get install srecord python3-pip pip3 install --user -U fusesoc
We recommend installing Verilator from source as versions from Linux distributions are often outdated. See https://www.veripool.org/projects/verilator/wiki/Installing for installation instructions.
-
Build a simulation of Ibex
cd $IBEX_REPO_BASE fusesoc --cores-root=. run --target=sim --setup --build lowrisc:ibex:ibex_riscv_compliance --RV32M=0 --RV32E=0
You can use the two compile-time options
--RV32M
and--RV32E
to enable/disable the M and E ISA extensions, respectively.You can now find the compiled simulation at
build/lowrisc_ibex_ibex_riscv_compliance_0.1/sim-verilator/Vibex_riscv_compliance
. -
Get the RISC-V Compliance test suite
The compliance test suite currently needs workarounds for Ibex. Get a modified version of it.
git clone https://github.com/imphil/riscv-compliance.git cd riscv-compliance git checkout ibex
-
Run the test suite
cd $RISCV_COMPLIANCE_REPO_BASE export RISCV_TARGET=ibex export RISCV_ISA=rv32i export RISCV_PREFIX=riscv32-unknown-elf- export TARGET_SIM=path/to/your/Vibex_riscv_compliance make clean make
Compliance test suite system
This directory contains a system designed especially to run the compliance test suite. The system consists of
- an Ibex core,
- a bus,
- a single-port memory for data and instructions,
- a bus-attached test utility.
The CPU core boots from SRAM at address 0x0.
The test utility is used by the software to end the simulation, and to inform the simulator of the memory region where the test signature is stored. The bus host reads the test signature from memory.
The memory map of the whole system is as follows:
Start | End | Size | Device |
---|---|---|---|
0x0 | 0xFFFF | 64 kB | shared instruction/data memory |
0x20000 | 0x203FF | 1 kB | test utility |
The test utility provides the following registers relative to the base address.
Address | R/W | Description |
---|---|---|
0x0 | W | Write any value to dump the test signature and terminate simulation |
0x4 | W | Start address of the test signature |
0x8 | W | End address of the test signature |