Setting up the computer (Ubuntu Linux)— My journey with the Amaranth HDL
Where I tell what I did to be able to work
[ADDENDUM : For using yosys (sby) and nextpnr, there is a simpler way, described in this supplemental article.]
[ERRATUM, 24 nov. 2023 : For performing formal verification, yices2 is required, the description is updated.]
Note : I am working on a computer using Ubuntu Linux. I expect the reader to be at ease with linux, bash, ubuntu tools, etc… For other OSes, one will have to adapt the steps described here.
[This is a part of my series about Amaranth HDL.]
A temporary setup with OSS CAD Suite
At first, I found out about amaranth as a part of the OSS CAD Suite. This is a project that provide a “ready to use” temporary environment : download the latest release archive, unpack, source the environment file (each time you start a new bash session), and you are ready to go.
Please note that OSS CAD Suite provides its own Python environment, thus once one source the environment file, the system Python environment is overridden.
A setup allowing formal verification and trace visualization
Once I wanted to seriously work with amaranth, I found it better to install directly the required components, to avoid the confusion between what would be available only once I source the environment file from the OSS CAD Suite.
The downside being that some parts will be build manually.
Amaranth is a python library, thus it will require Python 3.9 or 3.10, that is already installed with a recent enough version of Ubuntu, so there is nothing more to do for that.
To watch traces obtained with a simulation or a failed formal verification, I installed gtkwave through the package manager :
sudo apt install gtkwave
To perform formal verifications, I just followed the installation guide of https://symbiyosys.readthedocs.io/en/latest/install.html to install the required components (yosys and sby) and one of the recommended components (boolector).
[Update 24 nov. 2023] Formal verification requires yices2, that is installed through the package manager.
sudo apt install yices2
A supplemental setup for an Lattice ECP5 based fpga board
Recently, I finally got an FPGA board, powered with a Lattice ECP5. In order to upload my designs on this board, I had to install another set of tools : prjtrellis, nextpnr, and openFPGALoader.
This step was the less straightforward, so I will give more details.
Following the various installation instructions, I had to install a bunch of dependencies through the package manager :
sudo apt install openocd libboost-all-dev libeigen3-dev git gzip libftdi1–2 libftdi1-dev libhidapi-hidraw0 libhidapi-dev libudev-dev zlib1g-dev cmake pkg-config make g++
Then I could get a working copy of prjtrellis and follow the build and install instructions :
git clone — recursive https://github.com/YosysHQ/prjtrellis
cd prjtrellis/libtrellis
cmake -DCMAKE_INSTALL_PREFIX=/usr/local .
make
sudo make install
It went the same for nextpnr, I followed the part to get the version supporting the Lattice ECP5 :
git clone — recursive https://github.com/YosysHQ/nextpnr.git
cd nextpnr
cmake . -DARCH=ecp5 -DTRELLIS_INSTALL_PREFIX=/usr/local
make -j$(nproc)
sudo make install
Finally one more time for openFPGALoader :
git clone https://github.com/trabucayre/openFPGALoader.git
cd openFPGALoader
mkdir build
cd build
cmake ..
make -j$(nproc)
sudo make install
cd ..
sudo cp 99-openfpgaloader.rules /etc/udev/rules.d/
sudo udevadm control — reload-rules && sudo udevadm trigger # force udev to take new rule
sudo usermod -a $USER -G plugdev # add user to plugdev group
And that’s all I need for now.
Next time, I will start making a python project that will serve as a fundation library for my other projects…