How to install ghdl on Windows and Linux - tomas-fryza/vhdl-course GitHub Wiki

Installation on Windows

  1. Download and install GtkWave waveform viewer to C:\APPZ\VHDL\. Do NOT use accented symbols and spaces in the path to install folder!

  2. Download and install ghdl-0.29.1 compiler to C:\APPZ\VHDL\. Note that, actual version can be found here.

Installation on Linux

  1. Start Terminal (typically Ctrl+Alt+T) and install ghdl compiler and GtkWave waveform viewer.

    sudo apt-get install ghdl gtkwave
    

Create a new project and simulate it

Note: Description and example of ghdl usage is also here.

  1. Create a new project folder gates on your local disk. Do NOT use accented symbols and spaces in the path to project folder!

  2. Create a design VHDL file gates/gates.vhd. Open the Example of basic gates and copy/paste the design.vhd code to your local gates/gates.vhd file.

  3. Create a simulation VHDL file gates/tb_gates.vhd and copy/paste the testbench.vhd to this file.

  4. Create a script file gates/RUN.sh and copy/paste this content to it. In this file:

    • set the TOP_ENTITY according to your testbench

    • set path to your gtkwave installation on Windows or Linux

      TOP_ENTITY=tb_gates
      
      # For Windows
      GTK=C:/APPZ/VHDL/gtkwave/bin
      
      # For Linux
      # GTK=/usr/bin
      
  5. Run Git Bash, Command Prompt (Windows) of Terminal (Linux), navigate to your project folder, and run the script.

    # Windows Git Bash or Linux:
    sh RUN.sh
    

    gtkwave gates

Tested on

Version Result (yyyy-mm-dd) Note
Windows 10 OK (2023-04-01) HomeOffice
Linux Mint 20.3 (Una) OK (2022-02-24) Laptop
# FYI: How to check OS version in Linux
$ cat /etc/os-release

# Or by Neofetch
$ neofetch