ci (sourcehut): alu
Remote #ci is the way to go in #modernhw digital design testing. In this #ciseries, let’s see how to implement it with detail using sourcehut and a real world example.
Sourcehut is a lightweight #gitforge where I host my #git repositories. Not only it is based on a paradigm perfectly adapted to #modernhw, but also its builds service includes support for guix (x86_64) images. This means that we will be able to execute all of our testing online inside guix profiles, shells or natively on top of the bare-bones image.
Alu
Let’s consider now a variant of the previous example with open-logic. Here, we concentrate on a toy design only for demonstration purposes, a dummy alu emulator, which uses #osvvm as verification framework and relies on a few #openlogic blocs. In this case, its dependencies are defined in a manifest.scm file, including both fw-open-logic
and osvvm
, among other dependencies.
Install dependencies locally, in a new profile with
cd alu
mkdir _deps
export GUIX_PROFILE=open-logic/_deps
guix install -P $GUIX_PROFILE -m .builds/manifest.scm
. $GUIX_PROFILE/etc/profile
In this case, we will test the design using, first, a custom made makefile. Secondly, we will use hdlmake to automatically produce our makefile. Similarly to previous #openlogic example, two build manifest are used:
You’ll realise how some of the tasks are common with the case of previous #openlogic example (update channels, auth and update profile).
osvvm
In this case, we also need to compile osvvm libraries
compile__osvvm, produce a compiled version of #osvvm verification libraries; this is necessary as we are using here the tcl
scripts included in the library itself to follow the correct order of compilation. Libraries will appear within the local profile under $GUIX_PROFILE/VHDL_LIBS/GHDL-X.Y.Z
test
test, for a fully custom made testing pipeline; in this case, using a Makefile
Just simply, source the .envrc
file where the local $GUIX_PROFILE
variable is defined, cd to the ghdl
directory and call make to compile the design and run the simulation in two steps: first, clean all and include sources in its corresponding libraries with
sh
make __clean_all __include
Then, produce a new Makefile
using ghdl
.
sh
./makefile.sh # ghdl --gen-makefile ...
Finally, run the simulation with
sh
make GHDLRUNFLAGS="--stop-time=4us --disp-time --ieee-asserts=enable" run
This will produce a executable file before running it with the provided parameters.
You may notice that, in this case, you need to produce somehow your own Makefile
, or equivalent pipeline, right ?
hdlmake
Wouldn’t it be nice if we had a tool to deploy online which produces makefiles for us ? It exists, and its name is #hdlmake.
test__hdlmake
Source the .envrc
file where the local $GUIX_PROFILE
variable is defined, cd to the .builds/hdlmake
directory where all Manifest.py
files are located, and call hdlmake
to produce the Makefile
. Finally, just run make to compile the design, produce an executable and run it.
Check the resulting logs inline here, for example.