Aller au contenu

Lab Software

Get the Thales CVA6 contest project

Warning

Depending on where your homedirectory is hosted (Brest or Nantes) you can experience very slow compilations. In any case, you can use the local disk of the computer but at your own risk (no data redundancy), and the data will not be accessible simply from another computer.

If you decide to work on the local disk, do not forget to copy the folder in your homedir at the end of sessions.

Open a terminal Ctrl+Alt+T then create the folder for the project with one of the methods below:

1
2
mkdir -p /homes/$USER/AIRV
cd /homes/$USER/AIRV
1
2
mkdir -p /users/local/$USER/AIRV
cd /users/local/$USER/AIRV

Clone the 2023-2024 git version :

1
2
3
4
5
git clone --single-branch --branch cv32a6_contest_23_24 https://github.com/ThalesGroup/cva6-softcore-contest.git
cd cva6-softcore-contest
git submodule update --init --recursive

export PROJECTROOT=$(pwd)

Installing the RISC-V toolchain in the util folder

1
2
3
4
5
export RISCV=riscv_toolchain
cd $PROJECTROOT/util/gcc-toolchain-builder

bash ./get-toolchain.sh
bash ./build-toolchain.sh $RISCV

Info

Note : This step may take around 50 minutes.

Clone Coremark in the app folder

The Coremark app is missing on the git repository:

1
2
3
cd $PROJECTROOT/sw/app
git clone https://github.com/eembc/coremark.git
export PATH="$PATH:$PROJECTROOT/util/gcc-toolchain-builder/riscv_toolchain/bin/"

Compiling mnist application

We will run mnist later so let's compile it now:

With a text editor modify the first line of the files bin2mem.py and mem2coe.py:

1
2
3
#!/usr/bin/env python
should become :
#!/usr/bin/env python3

For example you can use nano in the terminal :

  • nano $PROJECTROOT/sw/utils/bin2mem.py
  • nano $PROJECTROOT/sw/utils/mem2coe.py

Use Ctrl+X to save and close

Then compile mnist

1
2
3
make mnist

# For other application to compile you can replace mnist by the application to run : make ’application to compile’

At the end of the compilation the mnist.riscv executable file must be created.

Simulation

When the development environment is set up, it is now possible to run a simulation. Some software applications are available into the sw/app directory. Especially, there are benchmark applications such as Dhrystone and CoreMark and other test applications.

To simulate a software application on CVA6 processor, run the following command:

1
2
3
4
5
6
cd $PROJECTROOT
SETUP MEE_QUESTA10.7d

make sim APP=mnist

# For other application you can replace mnist by the application to run : make sim APP=’application to run’

This command:

  • Compiles CVA6 architecture and testbench with Questa Sim tool.
  • Compiles the software application to be run on CVA6 with RISCV tool chain.
  • Runs the simulation.

Questa tool will open with waveform window. Some signals will be displayed; you are free to add as many signals as you want.

Moreover, all printf used in software application will be displayed into the transcript window of Questa Sim and save into uart file to the root directory.

Simulation may take lot of time, so you need to be patient to have results.

Simulation is programmed to run 10000000 cycles but the result is displayed before the end of simulation.

/!\ It will generate the vsim.wlf file of several GB. For mnist application, at the end of the simulation, result is diplayed as following:

1
2
3
4
5
6
Expected  = 4
Predicted = 4
Result : 1/1
credence: 82
image env0003: 1731593 instructions
image env0003: 2316653 cycles

CVA6 software environment is detailed into sw/app directory.