An open API service indexing awesome lists of open source software.

https://github.com/intellabs/chisel-cocotb-examples

This project contains generic example hardware modules and their testbenches written in Chisel and cocotb to demonstrate an agile hardware development methodology.
https://github.com/intellabs/chisel-cocotb-examples

Last synced: 9 months ago
JSON representation

This project contains generic example hardware modules and their testbenches written in Chisel and cocotb to demonstrate an agile hardware development methodology.

Awesome Lists containing this project

README

          

# PROJECT NOT UNDER ACTIVE MANAGEMENT #
This project will no longer be maintained by Intel.
Intel has ceased development and contributions including, but not limited to, maintenance, bug fixes, new releases, or updates, to this project.
Intel no longer accepts patches to this project.
If you have an ongoing need to use this project, are interested in independently developing it, or would like to maintain patches for the open source software community, please create your own fork of this project.

# Chisel and cocotb Examples

Example designs of [Chisel](https://www.chisel-lang.org/) and [cocotb](https://www.cocotb.org/) for Agile Hardware Design and Verification.

## Requirements

This repository requires sbt, g++, and verilator (see below). User can use gtkwave to view vcd files.

## Installation of verilator > 5.*
```bash
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.

## Install the following Python packages for cocotb
```bash
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
```

## Execute Chisel tests
- Build and test Chisel modules using sbt:
```bash
sbt compile
sbt run
sbt test
```

## Execute cocotb tests:
```bash
cd tests_cocotb/acc_component/
cocotb-clean
pytest -vv
```

# Alternate execution environment using a container:

## Build a container:
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:

1. `cd docker/`
2. `spython recipe Dockerfile &> Singularity.def`
3. `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.

## Activate the container
Execute the following command to open a terminal using the `.sif` file:

`apptainer shell -B /path/to/this/repo/:/mnt `

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`.