This guide explains how to compile and simulate VHDL code using GHDL and view the results with GTKWave on a Unix-like system (Linux/macOS). The example code used here is for a simple 4-to-1 multiplexer, but the process is similar for other VHDL code.
-
Install GHDL and GTKWave:
Ensure you have GHDL and GTKWave installed on your system. You can install them using package managers such as Homebrew (on macOS), apt-get (on Ubuntu), or dnf (on Fedora).
# Install GHDL brew install ghdl # macOS sudo apt-get install ghdl # Ubuntu sudo dnf install ghdl # Fedora # Install GTKWave brew install gtkwave # macOS sudo apt-get install gtkwave # Ubuntu sudo dnf install gtkwave # Fedora
ghdl -a your_file.vhdl
ghdl -e entity_name
ghdl -r entity_name --vcd=waveform.vcd
gtkwave waveform.vcd