GHDL on Windows
Posted on December 28, 2021 in Hardware
Installing MSYS2 :
Installing GHDL :
GHDL can be installed in two different ways.
Using the MSYS2 package :
To install the 64-bit version of GHDL use the following command :
pacman -S mingw64/mingw-w64-x86_64-ghdl-llvm
Done.
Updates will be done with the command pacman -Syu , command that updates the whole MSYS2 system.The MSYS2 GHDL package is updated regularly, but not very often.Using a "nightly package" generated by the GHDL project :
Personally, I prefer this method which has the advantage of sticking to the GHDL development, and of having a much faster and lighter update process (we don't update the whole MSYS2 system).
To do this, enter the following commands (preferably in a dedicated directory):
wget -O mingw-w64-x86_64-ghdl-llvm-ci-1-any.pkg.tar.zst https://github.com/ghdl/ghdl/releases/download/nightly/mingw-w64-x86_64-ghdl-llvm-ci-1-any.pkg.tar.zstpacman -U mingw-w64-x86_64-ghdl-llvm-ci-1-any.pkg.tar.zstThe same commands are used to update the package.Put these two lines in a bash file to facilitate updates.
Installing GtkWave :
GHDL allows to save the state of the signals of a simulation in a file. It is possible to choose the VCD format, which is widely used and is part of the verilog standard. With this format, you will have the choice of the waveform visualization tool, integrated to a development environment or not.
To install GtkWave, we have 3 possibilities :
Using the MSYS2 package :
To install the 64-bit version of GtkWave the command is :
pacman -S mingw64/mingw-w64-x86_64-gtkwave
Using a "nightly package" generated by the GtkWave project :
It is possible to choose between a Gtk2 and a Gtk3 version. It is recommended to use the Gtk3 version, the Gtk2 version should disappear in the long term [2] .
The commands are :wget -O mingw-w64-x86_64-gtkwave-gtk3-ci-1-any.pkg.tar.zst https://github.com/gtkwave/gtkwave/releases/download/nightly/mingw-w64-x86_64-gtkwave-gtk3-ci-1-any.pkg.tar.zstpacman -U mingw-w64-x86_64-gtkwave-gtk3-ci-1-any.pkg.tar.zstUsing a Windows native package (prefered solution) :
With this method, we get a zip from the GtkWave project's github and unzip it into a folder.And that's it.You can find the zip files here .The files whose name starts with gtkwave_ are the ones we are interested in. In the screenshot below, we can see that we have the choice between a 64-bit Gtk2 version and two Gtk3 versions (32-bit and 64-bit). The actual list can be different.
The GHW file format is not fixed. It happens (rarely) that an evolution of GHDL requires a modification of the data structure of this file format. It will then be necessary to update GtkWave (the import of GHW files into GtkWave is managed by the GHDL developers).
Using GHDL :
There are two ways to use GHDL.
The first is to use the MSYS2 MinGW 64-bit console
In this console, all GHDL commands work directly. It is possible to access Windows files directly. For example, if your project is in D:\my_project , you just have to do cd /d/my_project to get to the right folder.
The second way is to use a standard Windows command line and modify the PATH accordingly with the following command:
PATH=C:\msys64\mingw64\bin;%PATH%
It is also possible to run GHDL commands directly from other tools, such as an Integrated Development Environment, as long as the PATH is properly modified.
Using GtkWave :
If you have chosen an integrated version of MSYS2, it is possible to create a shortcut on the desktop :
To view a GHW file, simply Drag & Drop the file onto the shortcut icon.
[1] | To generate files in GHW format, the option --wave=my_waveform.ghw must be used during the simulation phase. |
[2] | At the time of writing, the Gtk3 version has display performance problems. |
Translated with the help of www.DeepL.com/Translator (free version)