Get started

Docker setup

Manual setup

1. OS requirements

To use X-HEEP, first make sure you have the following apt packages, or install them as:

sudo apt install lcov libelf1 libelf-dev libftdi1-2 libftdi1-dev libncurses5 libssl-dev libudev-dev libusb-1.0-0 lsb-release texinfo autoconf cmake flex bison libexpat-dev gawk tree xterm python3-venv python3-dev

In general, have a look at the Install required software section of the OpenTitan documentation.

2. Python

We rely on either (a) miniconda, or (b) virtual environment enviroment.

Choose between 2.a or 2.b to setup your enviroment.

2.a Miniconda

Install Miniconda python 3.8 version as described in the link, and create the Conda enviroment:

make conda

You need to do it only the first time, then just activate the environment everytime you work with X-HEEP as

conda activate core-v-mini-mcu

2.b Virtual Environment

Install the python virtual environment just as:

make venv

You need to do it only the first time, then just activate the environment everytime you work with X-HEEP as

source .venv/bin/activate

3. Install the RISC-V Compiler:

git clone --branch 2022.01.17 --recursive https://github.com/riscv/riscv-gnu-toolchain
cd riscv-gnu-toolchain
./configure --prefix=/home/$USER/tools/riscv --with-abi=ilp32 --with-arch=rv32imc --with-cmodel=medlow
make

Then, set the RISCV env variable as:

export RISCV=/home/$USER/tools/riscv

Optionally you can also compile with clang/LLVM instead of gcc. For that you must install the clang compiler into the same RISCV path. The binaries of gcc and clang do not collide so you can have both residing in the same RISCV directory. For this you can set the -DCMAKE_INSTALL_PREFIX cmake variable to $RISCV when building LLVM. This can be accomplished by doing the following:

git clone https://github.com/llvm/llvm-project.git
cd llvm-project
git checkout llvmorg-14.0.0
mkdir build && cd build
cmake -G "Unix Makefiles" -DLLVM_ENABLE_PROJECTS=clang -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$RISCV -DLLVM_TARGETS_TO_BUILD="RISCV" ../llvm
cmake --build . --target install

4. Install Verilator:

export VERILATOR_VERSION=4.210

git clone https://github.com/verilator/verilator.git
cd verilator
git checkout v$VERILATOR_VERSION

autoconf
./configure --prefix=/home/$USER/tools/verilator/$VERILATOR_VERSION
make
make install

Then, set the PATH env variable to as:

export PATH=/home/$USER/tools/verilator/$VERILATOR_VERSION/bin:$PATH

In general, have a look at the Install Verilator section of the OpenTitan documentation.

If you want to see the vcd waveforms generated by the Verilator simulation, install GTKWAVE:

sudo apt install libcanberra-gtk-module libcanberra-gtk3-module
sudo apt-get install -y gtkwave

Files are formatted with Verible

We use version v0.0-1824-ga3b5bedf

See: Install Verible

To format your RTL code type:

make verible

Compilation Flow and Package Manager

We use FuseSoC for all the tools we use.

The fusesoc commands are inside the Makefile.