contributed by < st10740
>
Targets :
OpenSBI is an open-source implementation of the RISC-V Supervisor Binary Interface (SBI) specifications, which is system call style calling convention between Supervisor (S-mode OS) and Supervisor Execution Environment (SEE).
Prerequisites (Ubuntu)
Building
Configure the environment variable
Source .bashrc
at the first time to run the script. The script will be ran everytime starting a new terminal.
Check riscv32-unknown-linux-gnu-gcc
Expected output
The file fw_jump.bin
needed to build RVVM can be found in the directory build/platform/generic/firmware
.
Building
The linux kernel image is generated at arch/riscv/boot/Image
.
However, using this method to build Linux kernel will generate RV64I
kernel image, leeding to booting kernel failed while running RVVM because of incompatible. So I use make menuconfig
to change Platform type > Base ISA
to RV32I
and build it using make
again.
This time, I can successfully boot the Linux kernel but still encounter the same problem as fewletter and the solution given by the developer team is to download config_tiny_6.2 file, which includes everything needed to function on RVVM. Next, change its name to .config
, put it into linux
directory. And don't forget to use make menuconfig
to enter configuration page to change the Platform type > Base IS
to RV32I
. Finally, build linux kernel using make
again.
We will enter the configuration page. Go to Target options
page. Setting the Target Architecture
to RISCV
, and Architecture Size
to 32-bit
.
Setting the Filesystem images
to ext2/3/4 root filesystem
.
Building
Build using GNU Make
Copy the needed file for building into release.linux.riscv
directory
Run
I use RISCOF framework to test RVVM with riscv-arch-test.
RISCOF is the python based RISC-V Compatibility Framework which enables testing of a RISC-V target (hard or soft implementations) against a standard RISC-V golden reference model using a suite of RISC-V architectural assembly tests.
First, I follow the Quickstart page of RISCOF document to learn how to use RISCOF framework. In this case, spike is DUT and SAIL-RISCV is reference model. The goal is to perform a validation check between them and output the report.
Since I have installed python3
before, I just check the version of it.
Because the recommended version of python is 3.6
in the RISCOF documentation, I use pyenv
to install python3.6, which prevents other software from breaking while switching between multiple python versions.
Installing pyenv
and setting environment variables.
Installing python3.6.
However, I encounter Segmentation fault
while installing it on Ubunbu 22.04.
I follow the issue comment to first install clang
and install again.
Unfortunately, another error pops up which is The Python ssl extension was not compiled. Missing the OpenSSL lib?
. It seems like I encounter some problems about OpenSSL. So, I follow Common build problems collected by pyenv team to install the missing OpenSSL and its headers, and install Python3.6 again.
Finally, Python3.6 is installed successfully. Checking the version of it in the same shell.
Installing
Add the path to RISCOF executable file to PATH
by adding the following line to .bashrc
You can get your path to RISCOF executable file by using command line pip show riscof
. And my output is
The path behind Location
is what you need.
Source .bashrc
I have installed it previously at here.
Install 2 RISC-V reference models: Spike and SAIL.
Installing
Configure the environment variable
Execute spike
to check it installed successfully
First, I follow sail install document to install sail
via opam
.
We need to install OCaml
with version 4.08.1
or newer according to sail install document, however, the online document of RISCOF hasn't been updated, which leeds us to install version 4.06.1
, generating building problem later.
Next, I follow sail-riscv Getting started section and RISCOF document to build sail
.
The above command will generate the following files and directories in the /demoRISCOF
:
config.ini
riscof_spike.py
Change GUN Toolchain from riscv32-unknown-elf-gcc
to riscv32-unknown-linux-gnu-gcc
, which is used in this project.
riscof_sail_cSim.py
Again, Change GUN Toolchain from riscv32-unknown-elf-gcc
to riscv32-unknown-linux-gnu-gcc
.
If we follow the RISCOF document to typo riscof --verbose info arch-tests --clone
, there will be an error Error: No such command 'arch-tests'.
pops up. According to this issue, we need to use riscof --verbose info arch-test --clone
instead.
This step internally calls the riscv-config
on both the isa
and platform
yaml files indicated in the config.ini
file.
The output
The output
The tests are listed in the file: riscof_work/test_list.yaml
.
The last step is to run the tests on the each of the models and compare the signature values to guarantee correctness.
Unfortunately, when following the RISCOF document to install Python 3.6
, the error AttributeError: 'Token' object has no attribute 'test'
appears. Then, I opt to use pyenv
to install Python 3.8
and riscof
, running the command again, the program functions properly.
Finally, The report is generated and opened as below:
The report is about validation check between spike (DUT in this case) and SAIL-RISCV (Reference model in this case). The ISA is RV32IMCZicsr_Zifencei
. It passes all the 90 tests, which include RV32IMC
, Zifencei
and privilege
test.
After reading the Understanding RISCOF Inputs, Building your Model Plugin and Running RISCV-ARCH-TESTS sections, I have comprehensive understanding about how to execute riscv-arch-test
on my own DUT using RISCOF.
In this case, I will generate report about validation check between RVVM
(DUT) and SAIL-RISCV
(Reference model).
There are one file config.ini
and two directories rvvm
and sail_cSim
generated under rvvm-riscof
. The rvvm-riscof/rvvm
directory has the following structure:
config.ini
config.ini
file generated by riscof
is correct.SAIL binaries
and path to the RVVM binaries
to the config because they are not in the $PATH
.rvvm/riscof_rvvm.py
& sail_cSim/riscof_sail_cSim.py
Change the name of executable file from rvvm
to the correct name rvvm_riscv
. This is in the __init__
function of rvvm
class.
Change GUN Toolchain from riscv32-unknown-elf-gcc
to riscv32-unknown-linux-gnu-gcc
, which is required by RVVM
. This is in the initialise
function of rvvm
class.
In riscof_sail_cSim.py
, We also need to change GUN Toolchain from riscv32-unknown-elf-gcc
to riscv32-unknown-linux-gnu-gcc
.
The following code is in the initialise
function of sail_cSim
class.
The following code is in the unknown
function of sail_cSim
class.
rvvm/env/model_test.h