Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

GHDL Open-Source Simulator by Tristan Gingold

$ cat /etc/os-release
$ sudo apt update
$ sudo apt install gtkwave
$ sudo apt install git make gnat zlib1g-dev
$ git clone https://github.com/ghdl/ghdl
$ cd ghdl
$ ./configure --prefix=/usr/local
$ make
$ sudo make install
  • Download Notepad++ Installer: Current Version
  • Download GHDL
    • ghdl-0.37-mingw32-mcode.zip
    • Extract All... > ghdl-0.37-mingw32-mcode
  • Download GTKWave
    • gtkwave-3.3.100-bin-win32.zip
    • Extract All... > gtkwave-3.3.100-bin-win32
  • File Explorer > This PC > OS (C:) > New folder > eda
    • Rename the subfolder "This PC > Downloads > ghdl-0.37-mingw32-mcode > GHDL > 0.37-mingw32-mcode" as ghdl and move it to C:\eda
    • Move the subfolder "This PC > Downloads > gtkwave-3.3.100-bin-win32 > gtkwave" to C:\eda
  • Edit Environment Variables > Path > New
    • C:\eda\ghdl\bin
    • C:\eda\gtkwave\bin

On macOS, download GHDL and GTKWave

Use Homebrew to install GTKWave
Compatibility issue
Fliplot is an alternative to GTKWave, implemented in HTML, JavaScript, and Python

  • Open a Terminal
$ cd Downloads
$ sudo mv ghdl-0.37-macosx-mcode /usr/local
$ cd
$ sudo nano /etc/paths
  • Go to the bottom of the file, and enter
/usr/local/ghdl-0.37-macosx-mcode/bin
  • Hit control-x to quit
  • Enter “Y” to save the modified buffer
  • Close the Terminal

Open GTKWave Wave Viewer on macOS

GTKWave > File > Open New Tab > Select a folder and a VCD file to load
  • Open a Terminal on macOS or GNU/Linux, or Windows Terminal on Windows
  • Clone 'dsd' repository, make and change directory to a new 'vhdl' directory, copy vhdl code to the current directory '.'
$ git clone https://github.com/kevinwlu/dsd.git
$ mkdir vhdl
$ cd vhdl
$ cp ~/dsd/ghdl/*vhdl .
  • GHDL can run on a Terminal on macOS or GNU/Linux, or on Windows with Windows Terminal, Git Bash, PowerShell, or Command Prompt
    • Apple menu > System Preferences > Security & Privacy > General > Allow ghdl
  • GHDL options: help, version, analyze, elaborate, run
  • Value change dump (VCD) is a format for files generated by simulation tools for logging signal strength and directionality
$ ghdl -h
$ ghdl -v
$ ghdl -a hello.vhdl
$ ghdl -e hello_world
$ ghdl -r hello_world
Hello world!

Half Adder

$ ghdl -a ha.vhdl
$ ghdl -a ha_tb.vhdl
$ ghdl -e ha_tb
$ ghdl -r ha_tb --vcd=ha.vcd
ha_tb.vhdl:47:5:@5ns:(assertion error): Reached end of test
$ gtkwave ha.vcd

ha.png

$ ghdl -a adder.vhdl
$ ghdl -a adder_tb.vhdl
$ ghdl -e adder_tb
$ ghdl -r adder_tb --vcd=adder.vcd
adder_tb.vhdl:54:5:@8ns(assertion note): end of test
$ gtkwave adder.vcd

adder.png

$ ghdl -a dff.vhdl
$ ghdl -a dff_tb.vhdl
$ ghdl -e dff_tb
$ ghdl -r dff_tb --vcd=dff.vcd
$ gtkwave dff.vcd

dff.png

$ ghdl -a tff.vhdl
$ ghdl -a tff_tb.vhdl
$ ghdl -e tff_tb
$ ghdl -r tff_tb --vcd=tff.vcd
$ gtkwave tff.vcd

tff.png

$ ghdl -a mux.vhdl
$ ghdl -a mux_tb.vhdl
$ ghdl -e mux_tb
$ ghdl -r mux_tb --vcd=mux.vcd
$ gtkwave mux.vcd

mux.png

$ ghdl -a demux.vhdl
$ ghdl -a demux_tb.vhdl
$ ghdl -e demux_tb
$ ghdl -r demux_tb --vcd=demux.vcd
$ gtkwave demux.vcd

demux.png

SR Flip-flop

$ ghdl -a --ieee=synopsys sr_ff.vhdl
$ ghdl -a --ieee=synopsys sr_ff_tb.vhdl
$ ghdl -e --ieee=synopsys sr_ff_tb
$ ghdl -r --ieee=synopsys sr_ff_tb --stop-time=100ns --vcd=sr_ff.vcd

8-Bit Square Root

$ ghdl -a --ieee=synopsys sqrt8.vhdl
$ ghdl -e --ieee=synopsys sqrt8
$ ghdl -r --ieee=synopsys sqrt8 --stop-time=512ns > sqrt8.out
$ cat sqrt8.out
$ ghdl -r --ieee=synopsys sqrt8 --stop-time=512ns --vcd=sqrt8.vcd