# 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. Extract the tarball somewhere and add the directory containing `riscv_sim_RV32` to your PATH - [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 riscof - [riscv-arch-tests](https://github.com/riscv-non-isa/riscv-arch-test) - Compliance tests are installed into the workspace by running: $ riscof arch-test --clone or alternatively $ riscof arch-test --update if the tests are already installed and just needs to be updated. > Make sure to have the directory structure that looks like this. . | ├── fusesoc.conf ├── fusesoc_libraries | ├── fusesoc_cores | │   └── ... | ├── mdu | │   └── ... | └── serv | ├── ... | ├── verif | | ├── bin | | | └── ... | |   ├── config.ini | |   ├── plugin-sail_cSim | | | └── ... | |   ├── plugin-serv | | | └── ... | └── ... ├── riscv-arch-test └── ... ## 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 the workspace riscof run --config=$SERV/verif/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 in the workspace which contains all the log files, signatures, executeables for Reference model and/or DUT.