mirror of
https://github.com/olofk/serv.git
synced 2026-03-02 09:36:27 +00:00
74 lines
4.3 KiB
Markdown
74 lines
4.3 KiB
Markdown
# SERV Verification using RISCOF
|
||
SERV uses the [RISCOF](https://riscof.readthedocs.io/en/stable/index.html) which is python-based standard RISC-V Architectural Compliance Test Framework. This framework runs the Compliance tests in real-time on DUT and Reference and compare the signature results generated by both to decide if the tests are passed.
|
||
In our case, DUT is SERV core and reference is the [sail-riscv](https://github.com/riscv/sail-riscv), which is the golden model for the formal specification of RISC-V architecture.
|
||
|
||
|
||
## Prerequisites
|
||
|
||
> :warning: Make sure to complete all the steps described in [Getting Started](/README.md). Once it's done, start setting up the following tools.
|
||
|
||
- [RISC-V GCC Toolchain](https://github.com/riscv-collab/riscv-gnu-toolchain) - Install toolchain by running following command.
|
||
|
||
|
||
sudo apt-get install -y gcc-riscv64-unknown-elf
|
||
> :bulb: By default, RISCOF plugins uses [RV32](https://github.com/riscv-collab/riscv-gnu-toolchain#:~:text=To%20build%20the%2032%2Dbit%20RV32GC%20toolchain%2C%20use%3A) toolchain for compiling native `rv32` code. For SERV, this dependency has been removed from the plugin as RV64 is sufficient for 32-bit systems as well.
|
||
|
||
- [SAIL-RISCV](https://github.com/riscv/sail-riscv) - The reference model can be build by following [these](https://riscof.readthedocs.io/en/stable/installation.html#install-plugin-models) instructions. The pre-built binaries of sail-riscv is available in [`bin`](/verif/bin/) directory.
|
||
|
||
- [riscv-arch-tests](https://github.com/riscv-non-isa/riscv-arch-test) - Compliance tests are added as a submodule in `$SERV/verif`. Run the following commands from the `$SERV`.
|
||
|
||
$ git submodule init
|
||
$ git submodule update
|
||
This will clone the arch-tests repository into the `$SERV/verif/riscv-arch-tests`.
|
||
- [RISCOF](https://riscof.readthedocs.io/en/stable/installation.html#install-python) - If you have installed [Python](https://riscof.readthedocs.io/en/stable/installation.html#install-python), run the folllowing command to [install RISCOF](https://riscof.readthedocs.io/en/stable/installation.html#).
|
||
|
||
pip3 install git+https://github.com/riscv/riscof.git
|
||
|
||
> :warning: Make sure to export the root directory as `$WORKSPACE` and also make sure to have the directory structure that looks like this.
|
||
|
||
|
||
|
||
.
|
||
$WORKSPACE
|
||
|
|
||
├── build
|
||
│ └── ...
|
||
├── fusesoc.conf
|
||
└── fusesoc_libraries
|
||
├── fusesoc_cores
|
||
│ └── ...
|
||
├── mdu
|
||
│ └── ...
|
||
└── serv
|
||
├── ...
|
||
├── verif
|
||
| ├── bin
|
||
| | └── ...
|
||
| ├── config.ini
|
||
| ├── plugin-sail_cSim
|
||
| | └── ...
|
||
| ├── plugin-serv
|
||
| | └── ...
|
||
| ├── Readme.md
|
||
| ├── riscv-arch-test
|
||
| | └── ...
|
||
| └── sim
|
||
| └── ...
|
||
└── ...
|
||
|
||
## Running Compliance tests
|
||
After completing all the steps in [Getting started](/README.md) followed by the [Prerequisites](##Prerequisites), we are all set to run the complaince tests.
|
||
|
||
:o: All the RISCOF commands will be run from `$SERV/verif`
|
||
|
||
riscof run --config=config.ini \
|
||
--suite=riscv-arch-test/riscv-test-suite/rv32i_m/I \
|
||
--env=riscv-arch-test/riscv-test-suite/env
|
||
|
||
- `--config` - Configuration file is passed using this flag which contains the paths and the names of DUT and Reference plugins.
|
||
- `--suite` - The arch-tests are passed to RISCOF using this flag. In the above command, it points `I` test directory. We can change path to `M`, `C`, `privilege` or `Zifencei` directories to run the respective tests..
|
||
- `--env` - The header files of test framework are passed using this flag.
|
||
|
||
> :bulb: Other optional arguments of RISCOF command can be found [here](https://riscof.readthedocs.io/en/stable/commands.html#run)
|
||
|
||
When RISCOF run command successfully executed: an `html` report is generated which depicts the results of the tests. And a directory named `riscof_work` is created inside `$SERV/verif/` which contains all the log files, signatures, executeables for Reference model and/or DUT. |