For everybody: from a fresh clone to a first cook.py command. The other
tutorials assume this page is done.
cook.py is the single entry point of the CVA6 flows. Each command is a
recipe. The options of every recipe are in the reference,
flows/README.md.
Prerequisites: a Linux workstation with Git and Python 3.12 or later
(or uv, which downloads it).
git clone https://github.com/openhwgroup/cva6.git
cd cva6
git submodule update --init --recursivecook.py needs Python 3.12 or later and the packages of
flows/requirements.txt, in a virtual environment.
uv downloads the interpreter for you:
pip3 install --user uv
uv venv -p 3.12 .venv && . .venv/bin/activate
uv pip install -r flows/requirements.txtWith a Python 3.12 already installed, python3.12 -m venv .venv then
pip3 install -r flows/requirements.txt do the same. Details:
Python Environment.
./cook.py git-dependenciesThis step is mandatory, after the clone and after every git pull.
It does two things:
- it applies the patches of the submodules listed under
submodule_patchesin flows/config/dependencies.yml. The patch files are inverif/patches/; today they patchverif/core-v-verifand the HPDcache (core/cache_subsystem/hpdcache); - it clones the external test suites (riscv-tests, riscv-arch-test, riscv-compliance) at a pinned commit.
cook.py refuses to run any other recipe while a submodule patch is not
applied, and prints the missing patches. Running it again is harmless.
The proxy kernel and Zephyr are cloned by the same recipe:
./cook.py git-dependencies --repo riscv-pk or --repo zephyr. See
git-dependencies.
The configuration lives in the directory named by $CONFIG_DIR (default:
flows/config/):
| File | Content |
|---|---|
setenv.sh |
puts the tools in PATH (simulators, Verilator, Verible, Yosys...) and activates the virtual environment |
compiler.yml |
the RISC-V toolchains, by name (gcc-15, llvm-22, zephyr-sdk...): the -c option of the recipes |
techno.yml |
the technology libraries for synthesis (optional) |
The files of flows/config/ are examples with placeholder paths. Copy
them to a directory of your own, edit them, then, from the root of the
checkout:
export CONFIG_DIR=/path/to/your/config
source $CONFIG_DIR/setenv.shThe format of each file: cook.py configuration. To build a RISC-V toolchain, see util/toolchain-builder/README.md.
Spike is the reference model of the tandem comparison. The TestHarness
also needs its libraries. It is built from verif/core-v-verif and
installed in tools/spike:
sudo apt-get install cmake help2man device-tree-compiler # Debian based
export NUM_JOBS=8
./verif/regress/install-spike.shVerilator v5.050 is needed for the TestHarness and for rtl-lint. The
script installs it in tools/verilator-v5.050. Point
VERILATOR_INSTALL_DIR of setenv.sh at it:
./verif/regress/install-verilator.sh./cook.py self-checkIt lists the tools found in PATH with their versions, the Spike
install, the submodules, the test suites and the configuration files. A
missing optional tool is only a warning. It also warns when the Verilator
of PATH is not the one of install-verilator.sh: the OSS CAD Suite of
Yosys ships its own, so put $VERILATOR_INSTALL_DIR/bin before
YOSYS_PATH in PATH. See self-check.
Shell completion of the recipes, options and target names:
./cook.py --install-completion
./cook.py --help # all recipes
./cook.py <recipe> --help # options of one recipeAlways run cook.py from the root of the checkout. It refuses any other
directory.
./cook.py hello-world -t cv32a60x -c gcc-15-t is the target, a directory of config/target/ (see
config/README.md). -c is a toolchain name of
your compiler.yml.
Every recipe writes in its own directory under build/<target>/, or
under build/<recipe>/ when it has no target. For example:
| Recipe | Directory |
|---|---|
hello-world, sw-compile |
build/<target>/compile/<test>/ |
vcs-uvm-comp |
build/<target>/elab/sim_rtl/ |
vcs-uvm-run |
build/<target>/simulation/sim_rtl/<test>/ |
The whole tree: Build directory organization.
Each of these directories holds a cook_report.yml: the verdict of the
recipe. Read it rather than the console:
status:passorfail;fail_kind:environmentwhen a tool, a licence or a prerequisite is missing (fix the setup),testwhen the design or the program is at fault;metricsandkpi: what was measured (cycles, area, test results).
A failing recipe exits with code 1, but only the report says what failed and where. The fields: What every recipe leaves behind.
- Tutorials index: pick the next page by use
- simulation/testharness.md: a first simulation without licence
- flows/QUICKSTART.md: worked sequences to copy
- flows/README.md: the reference of every recipe
- config/README.md: the targets