Getting started
To get more familiar with CVA6 architecture, a partial documentation is available:
https://cva6.readthedocs.io/en/latest/
Checkout the repository and initialize all submodules:
$ git clone --recursive https://github.com/ThalesGroup/cva6-softcore-contest.git
CoreMark application has been customized for the contest, for using CoreMark application, run:
$ cd cva6-softcore-contest
$ git apply 0001-coremark-modification.patch
And finally, do not forget to check all the details of the contest at https://github.com/sjthales/cva6-softcore-contest/blob/master/Annonce RISC-V contest v4.pdf.
Prerequisites
RISC-V tool chain setting up
The tool chain is available to this link: https://github.com/riscv/riscv-gnu-toolchain At first, you have to get the sources of the RISCV GNU toolchain:
$ git clone --recursive https://github.com/riscv/riscv-gnu-toolchain
$ cd riscv-gnu-toolchain
$ git checkout ed53ae7a71dfc6df1940c2255aea5bf542a9c422
Next, you have to install all standard packages needed to build the toolchain depending on your Linux distribution. Before installing the tool chain, it is important to define the environment variable RISCV=”path where the tool chain will be installed”. Then, you have to set up the compiler by running the following command:
$ export RISCV=/path/to/install/riscv/compilators
$ ./configure --prefix=$RISCV --disable-linux --with-cmodel=medany --with-arch=rv32ima
$ make newlib
When the installation is achieved, do not forget to add $RISCV/bin to your PATH.
$ export PATH=$PATH:$RISCV/bin
Questa tool
Questa Prime version 10.7 has been used for simulations. Other simulation tools and versions can be used but will receive no support from the organization team.
Performances must be measured using the Questa simulator.
Vitis/Vivado setting up
This section will be completed in a next release (planned early December 2020). For the contest, the CVA6 processor will be implemented on Zybo Z7-20 board from Digilent. This board integrates a Zynq 7000 FPGA from Xilinx. To do so, Vitis 2020.1 environment from Xilinx need to be installed.
Furthermore, Digilent provides board files for each development board.
This files ease the creation of new projects with automated configuration of several complicated components such as Zynq Processing System and memory interfaces.
All guidelines to install vitis 2020.1 and Zybo Z7-20 board files are explained to the following link: https://reference.digilentinc.com/reference/programmable-logic/guides/installation
be careful about your linux distribution and the supported version of Vitis 2020.1 environment
Hardware
If you have not yet done so, start provisioning the following:
Reference | URL | List price | Remark |
---|---|---|---|
Zybo Z7-20 | https://store.digilentinc.com/zybo-z7-zynq-7000-arm-fpga-soc-development-board/ | $299.00 | Zybo Z7-10 is too small for CVA6. |
Pmod USBUART | https://store.digilentinc.com/pmod-usbuart-usb-to-uart-interface/ | $9.99 | Used for the console output |
JTAG-HS2 Programming Cable | https://store.digilentinc.com/jtag-hs2-programming-cable/ | $59.00 | |
Connectors | https://store.digilentinc.com/pmod-cable-kit-2x6-pin-and-2x6-pin-to-dual-6-pin-pmod-splitter-cable/ | $5.99 | At least a 6-pin connector Pmod is necessary; other references may offer it. |
OpenOCD
To be able to run and debug software applications on CVA6, you need to install the OpenOCD tool. OpenOCD is a free and open-source software distributed under the GPL-2.0 license. It provides on-chip programming and debugging support with a layered architecture of JTAG interface and TAP support.
Global documentation on OpenOCD is available at https://github.com/ThalesGroup/pulpino-compliant-debug/tree/pulpino-dbg/doc/riscv-debug-notes/pdfs
These documents aim at providing help about OpenOCD and RISC-V debug.
Before setting up OpenOCD, other tools are needed:
- make
- libtool
- pkg-congfig > 0.23
- autoconf > 2.64
- automake > 1.14
- texinfo
On Ubuntu, ensure that everything is installed with:
$ sudo apt install make libtool pkg-config autoconf automake texinfo
Furthermore, you need to set up libusb and libftdi libraries. On Ubuntu:
$ sudo apt install libusb-1.0-0-dev libftdi1-dev
Once all dependencies are installed, OpenOCD can be set up.
- Download sources:
$ git clone https://github.com/riscv/riscv-openocd
$ cd riscv-openocd
- Prepare a build directory:
$ mkdir build
- Launch the bootstrap script:
$ ./bootstrap
- Launch configure:
$ ./configure --enable-ftdi --prefix=<absolute path>/build --exec-prefix=<absolute path>/build
- Compile and install files:
$ make
$ make install
When the installation is achieved, do not forget to add riscv-openocd/build/bin to your PATH.
$ export PATH=$PATH:<path to riscv-openocd>/build/bin
HS2 cable
It is necessary to add a udev rule to use the cable. OpenOCD provides a file containing the rule we need. Copy it into /etc/udev/rules.d/
$ sudo cp <path to riscv-openocd>/build/share/openocd/contrib/60-openocd.rules /etc/udev/rules.d
The file is also available here: https://github.com/riscv/riscv-openocd/blob/riscv/contrib/60-openocd.rules The particular entry about the HS2 cable is :
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6014", MODE="660", GROUP="plugdev", TAG+="uaccess"
Then either reboot your system or reload the udev configuration with :
$ sudo udevadm control --reload
To check if the cable is recognized, run lsusb. There should be a line like this:
$ lsusb
Bus 005 Device 003: ID 0403:6014 Future Technology Devices International, Ltd FT232HSingle HS USB-UART/FIFO IC
Simulation get started
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:
$ make sim APP=’application to run’
For instance, if you want to run the CoreMark application, you will have to run :
$ make sim APP=coremark
For instance, if you want to run Dhrystone application, you will have to run :
$ make sim APP=dhrystone
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.
For Dhrystone application, at the end of the simulation, Dhrystone result is diplayed as following:
Dhrystones per Second:
and for coremark application, result at the end of simulation is displayed as following:
CoreMark 1.0 :
CVA6 software environment is detailed into sw/app
directory.