Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

stnolting/neorv32-riscof

Repository files navigation

Important

The RISC-V architecture compatibility test has been integrated into the main NEORV32 repository.

NEORV32 Core Verification using RISCOF

neorv32-riscof License

This repository is a port of the "RISCOF RISC-V Architecture Test Framework" to test the NEORV32 RISC-V Processor for compatibility to the RISC-V ISA specifications. Currently, the following tests are supported:

  • rv32i_m\A - atomic memory operations (Zaamo only)
  • rv32i_m\B - bit-manipulation (Zba + Zbb + Zbs)
  • rv32i_m\C - compressed instructions (Zca + Zcb)
  • rv32i_m\I - base integer ISA
  • rv32i_m\K - scalar cryptography, Zkn and Zks (Zbkb + Zbkc + Zbkx + Zknd + Zkne + Zknh + Zksed + Zksh)
  • rv32i_m\M - hardware integer multiplication and division
  • rv32i_m\Zicond - conditional operations
  • rv32i_m\Zifencei - instruction stream synchronization
  • rv32i_m\Zimop - may-be-operation
  • rv32i_m\hints - hint instructions
  • rv32i_m\pmp - physical memory protection (M + U modes)
  • rv32i_m\privilege - privileged machine-mode architecture

Setup

Several tools and submodules are required to run this port of the architecture test framework. The repository's GitHub Actions workflow takes care of installing all the required packages.

RISCOF is configured by a config.ini that defines the the plugins to be used: the device-under-test (NEORV32) and the reference model (Sail RISC-V). Each plugin provides target-specific ISA definitions, environment files like linker scripts and low-level code for interaction with the platform, and Python scripts for the target-specific test runs (compiling tests, invoking the DUT simulator and the reference model's executable, etc.).

A full test run is triggered by a shell script (run.sh) that returns 0 if all tests were executed successfully or 1 if there were any errors. The exit code of this script is used to determine the overall success of the according GitHub Actions workflow. The CSS-flavored HTML test report is available as GitHib actions artifact.

Device-Under-Test (DUT)

The specific NEORV32 rvtest_tb.vhd testbench implements a memory subsystem attached to the core's external bus interface. This subsystem provides main memory and environment control mechanisms:

Address Description
0x80000000 .. 0x803FFFFF main memory (RAM), max 4MB; pre-initialized with the application executable; this memory will also contain the test results/signature
0xF0000000 signature start address (absolute 32-bit address)
0xF0000004 signature end address (absolute 32-bit address)
0xF0000008 write any value to dump the test results to the signature file and terminate simulation
0xF000000C bit 11 controls the CPU's machine external interrupt signal

Important

The Python scripts of both plugins override the default SET_REL_TVAL_MSK macro from riscv-arch-test/riscv-test-suite/env/arch_test.h to exclude the BREAK exception cause from the relocation list as the NEORV32 sets mtval to zero for this type of exception. This is explicitly permitted by the RISC-V priv. spec.