The quick and complete tool setup for FPGA and ASIC design
"Why does Vivado have to be this painful to install. Let alone use!!!"
The above is statement most of us FPGA designers have made at some point in our journey in digital logic design before we hopelessly admitted defeat and bowed to the supremacy (or the lack of it?) of vendor supplied toolchains, only to keep saying it once in a while.
The setup and scripts presented in this article change all of it. With a click of a button (well more like 5 clicks) you can have a fully open source design, simulation and verification toolchain up and running on any platform that you might be using. Including a Mac with Apple Silicon. Yes you read that right.
When I starting out, I was asked to install vivado on my machine to simulate my RTL designs. Very unlucky I was at that time, I had just purchased a brand new Mac because it was so cool, only to be faced with the horrifying fact that most vendor supplied EDA tool don't work on ios and probably won't anytime soon.
I had to wipe my tears off while I borrowed an old windows pc from my friend and tried installing the Gazzilion Byte large package I had to download painstakingly. The installation was not a cakewalk either, but I think I have ranted enough. Stories like this are quite common across FPGA and EDA forumns like this (TODO) one.
However, we live in very interesting times becase some very smart people are spending their days building some amazing open source alternatives for these monstrosities.
While some of these tools have been around for a while now, in the last 5 years, some of the more advanced tools for simulation and synthesis had been perfected. To be fully honest, these tools are not as powerful or complete as the vendor supplied ones, but as hobbyists and students you will find every capability you can possibly ask for in them.
This article gives you a wrapper over the oss-cad-suite pre-built binary that makes it a simple push button activity to install and run the toolchain.
The Setup
The any platform setup has been made possible due to advancements like Docker, which lets you run a lightweight virtual environment on your machine. The Dockerfile, which is a script that sets up the environment let's you pre-program everything you want on this container for your project. Once this container is ruuning, you can access it via any means like SSH or a VNC Viewer.
I have created the required raw sources for all the above steps. You just have to perform the following few steps to have your toolchain up and running.
- Install Docker desktop for your OS.
- Download and extract the toolchain tarbaal from one of the below links.
- Do a docker build.
- Run the docker container.
- Connect via SSH or VNC and instantly access all the tools.
Let's go into the details of each of these steps below:
The details
Step1: Install Docker desktop for your OS.
You can do that from the links here.
Step2: Clone the toolchain repository from thedatabus github
Job | Tool |
---|---|
Simulator | - Icarus Verilog, Verilator ,GHDL |
Waveform Viewer | - GTKWave |
Synthesis | - Yosys |
Simulation Frameworks | - cocotb |
Formal Verification | - sby |
Access | - SSH,VNC |
Apart from the commonly used ones listed above, you can find the complete list of other tools like Place and route tools, FPGA board programming tools etc in this image. The original git repository contains the complete list.
Upcoming additions to this setup
- IDE support eg. VS Code
- Surfer Waveform Viewer
- RISCV Toolchain
- OpenROAD Toolchain for ASIC flows
- Jenkins
git clone https://github.com/thedatabusdotio/tdbtools-basic.git
Step3: cd into the repository and do a docker build step
cd tdbtools-basic
sudo docker build -t edatools .
Step4: Run the docker container
docker run -d -p 5901:5901 -p 2222:22 edatools
You can quickly verify that your container is running by glancing at the containers tab on your Docker desktop.
One other helpful thing you could do is to attach a shared folder as a volume to your docker container. This will allow seamless communication and sharing of any files between the host machine and the docker container. Also, if you shutdown the container, you lose all state. A volume like this can enable you to store your progress for the future.
mkdir my_local_folder
docker run -d -p 5901:5901 -p 2222:22 -v /path/to/my_local_shrd_folder:/shrd edatools
Step5: Connect to your container
For most people the VNC would be the simpler option because it comes with a fully funcioning GUI and feels like a regular native environment.
You can install any VNC viewer you like. I use this one.
Once you have it installed, just connect to your container at the address localhost:5901
SSH is also a good option and is likely to be preferred more by purists like me To connect via ssh
ssh -X -p 2222 dev@localhost
In case you have troubles with conecting to your VNC session and need to have a look at the logs, you can use the ssh to gain access to the container.
NOTE: We use the -X flag here so that we can launch GUI based applications like GTKWAVE. Now some environments might have trouble allowing this natively. On my mac I had to install the XQuartz application to allow GUI launches over ssh.
Test all the tools with the available setup
-
Copy the tests directory from the repository to the shared folder of your running container
cp -r tests /path/to/my_local_shrd_folder
-
Now inside your running container, if you go to /shrd , you'll see this folder. Go to this directory
cd /shrd/tests/
-
Test icarus verilog
make iverilog-test
-
Test verilator
make verilator-test
-
Test synthesis flow of yosys
make ys-synth-test
-
Test equivalence checking flow of yosys
make ys-eqv-test
-
Test cocotb with icarus
make cocotb-test SIM=icarus
-
Test cocotb with verilator
make cocotb-test SIM=verilator
-
Cleanup
make clean
If you were able to view the output properly in each case, you now have a working installation along with examples of commands to get you started
FAQs (TODO)
-
Can I directly use the pre-built tools from oss-cad-suite repository? Yes, You can, if that works for you. For me, a bunch of things broke like the gtkwave not being supported on native mac followed by my native verilator installation conflicting with the one in the pre-built one causing hours of pain.
Also, quite a few more tools are going to get added to this setup.
- I want to change the aspect ratio of the VNC window. How do I do that? You can change that in the supervisord.conf where the vnc launch command is present
- I installed some new packages and made some modifications to the container. How do I save this container as a re-usable image?
- Can I contribute towards improving this toolset further? Absolutely. Please test your Dockerfile and submit a pull request for this addition