Skip to content

Latest commit

 

History

History
42 lines (29 loc) · 1.97 KB

README.rst

File metadata and controls

42 lines (29 loc) · 1.97 KB

ghdl

Heartbeat module

Although Hello world <QuickStart:hello> illustrates that VHDL is supported as a general purpose language, the main use case of GHDL is to simulate hardware descriptions. The following block, which is saved in a file named heartbeat.vhdl, is an example of how to generate a 100 MHz clock signal with non-synthesisable VHDL:

heartbeat.vhdl

It can be analysed <Analysis:command>, elaborated <Elaboration:command> and run <Run:command>, as you already know:

ghdl -a heartbeat.vhdl
ghdl -e heartbeat
ghdl -r heartbeat

However, execution of the design does not terminate. At the same time, no output is shown on screen. This is because, traditionally, hardware designs are continuously running devices which do not have a screen where to print. In this context, inspection and verification of the behaviour is done through waveforms, which is supported by GHDL (see export_waves). You can use either --wave, --vcd, --vcdgz or --fst to save the signals of the simulation to a file. Then, terminate the execution (C-c) and you can inspect the wave with a viewer, such as GtkWave. As explained in the manual, GtkWave 'relies on a post-mortem approach through the use of dumpfiles'. Therefore, you should first simulate your design and dump a waveform file, say GHW:

ghdl -r heartbeat --wave=wave.ghw

Then, you can view the dump:

gtkwave wave.ghw

Of course, manually terminating the simulation is for illustration purposes only. In Full adder <QuickStart:adder> and QuickStart:DLX, you will see how to write a testbench to terminate the simulation programmatically.