Example designs of Chisel and cocotb for Agile Hardware Design and Verification.
This repository requires sbt, g++, and verilator (see below). User can use gtkwave to view vcd files.
curl -L -O https://github.com/YosysHQ/oss-cad-suite-build/releases/download/2023-08-01/oss-cad-suite-linux-x64-20230801.tgz
tar xzf oss-cad-suite-linux-x64-20230801.tgz
Add oss-cad-suite/bin
to your PATH.
python3 -m venv .venv # create a Python3 virtual environment (preferably > python 3.9.x)
source .venv/bin/activate # activate virtual environment
pip install --upgrade pip # required packages
pip install pytest
pip install cocotb
pip install cocotb-test
- Build and test Chisel modules using sbt:
sbt compile
sbt run
sbt test
cd tests_cocotb/acc_component/
cocotb-clean
pytest -vv
The container recipe is given in docker/Dockerfile
. It enumerates all the required packages and libraries for this project.
Install apptainer
on a machine where you have root access. See instructions at the following link:
https://apptainer.org/docs/admin/main/installation.html#install-ubuntu-packages
Also install Singularity Python: https://singularityhub.github.io/singularity-cli/ which will help convert Docker recipes into Singularity recipes and vice versa.
Execute the following commands to build the container:
cd docker/
spython recipe Dockerfile &> Singularity.def
sudo apptainer build mycontainer.sif Singularity.def
The generated mycontainer.sif
file should be between 512 MB - 1 GB in size. It can be moved to a different machine and run even without root access.
Execute the following command to open a terminal using the .sif
file:
apptainer shell -B /path/to/this/repo/:/mnt <path-to-mycontainer.sif>
This will create an Apptainer
prompt. cd /mnt
to access and execute Chisel and cocotb tests within the container.
Run exit
to exit from the container prompt.
Note: Inside the container environemnt, if you see a java FileSystemException issue, unset XDG_RUNTIME_DIR
.