OSVVM Simulation with GHDL

In this post, we will run a minimal OSVVM test bench with the free and open-source simulator GHDL.

In previous posts, we compiled and ran one of the OSVVM built-in tests before creating our own minimal verification environment using AXI-Stream verification components. In both cases, we used Questa to run our simulations.

In this post, we will replace Questa with GHDL, a free and open-source VHDL simulator. We will compile the OSVVM libraries before creating a GHDL script to simulate our minimal OSVVM test bench.

Compiling the OSVVM Libraries in GHDL

We start by opening a terminal and changing to the directory where we want to run our simulation. Once there, we start a Tcl console. In macOS, we enter the following command:

rlwrap tclsh

We then initialize the OSVVM environment by calling the OSVVM start-up script.

source ../../OsvvmLibraries/Scripts/StartUp.tcl

The terminal confirms that the environment has been initialized.

Note: Putting setting in directory OsvvmLibraries/Scripts
OSVVM Script Version:  2025.06
Simulator Version:     GHDL-5.1.1

We can now build the OSVVM Libraries.

build  ../../OsvvmLibraries

We can check that the libraries have been compiled and saved to the VHDL_LIBS/GHDL-5.1.1 folder.

% ls -la VHDL_LIBS/GHDL-5.1.1
total 24
drwxr-xr-x@ 15 isaacverdu  staff    480 Sep 28 07:06 .
drwxr-xr-x@  4 isaacverdu  staff    128 Sep 28 07:06 ..
-rw-r--r--@  1 isaacverdu  staff  10244 Sep 28 07:06 .DS_Store
drwxr-xr-x@  3 isaacverdu  staff     96 Sep 28 07:05 defaultlib
drwxr-xr-x@  3 isaacverdu  staff     96 Sep 28 07:05 osvvm
drwxr-xr-x@  3 isaacverdu  staff     96 Sep 28 07:05 osvvm_axi4
drwxr-xr-x@  3 isaacverdu  staff     96 Sep 28 07:05 osvvm_common
drwxr-xr-x@  3 isaacverdu  staff     96 Sep 28 07:05 osvvm_cosim
drwxr-xr-x@  3 isaacverdu  staff     96 Sep 28 07:05 osvvm_dpram
drwxr-xr-x@  3 isaacverdu  staff     96 Sep 28 07:05 osvvm_dpram_pt
drwxr-xr-x@  3 isaacverdu  staff     96 Sep 28 07:05 osvvm_ethernet
drwxr-xr-x@  3 isaacverdu  staff     96 Sep 28 07:05 osvvm_spi
drwxr-xr-x@  3 isaacverdu  staff     96 Sep 28 07:05 osvvm_uart
drwxr-xr-x@  3 isaacverdu  staff     96 Sep 28 07:05 osvvm_videobus
drwxr-xr-x@  3 isaacverdu  staff     96 Sep 28 07:05 osvvm_wishbone

Simulation Process with GHDL

A GHDL simulation requires three steps: Analysis, Elaboration, and Run.

In the Analysis step, GHDL compiles each VHDL source file. In the Elaboration step, GHDL builds the design hierarchy and creates the simulation object. Finally, in the Run step, GHDL runs the simulation.

Each of these steps is executed by calling GHDL with a single-letter argument: -a for analysis, -e for elaboration, and -r for running the simulation.

ghdl -a <[options...] file...>
ghdl -e <[options...] [library.]top_unit [arch]>
ghdl -r <[options...] [library.]top_unit [arch] [simulation_options...]>

Running our minimal OSVVM Tesbench

Now that we have compiled the OSSVM libraries and understood the simulation process with GHDL, we are ready to create our simulation script.

Our script will include the three commands for analysis, elaboration, and simulation that we discussed earlier. We will also include two options for each command:

  • The --std=08 option enables VHDL-2008 support for our test bench.
  • The -Poption includes the OSSVM libraries used in our test bench. These need to be referenced in all three steps.

The --vcd option in the simulation step creates a waveform file in VCD format with all the signals in our design.

ghdl -a --std=08 -P=./VHDL_LIBS/GHDL-5.1.1/osvvm/v08/ -P=./VHDL_LIBS/GHDL-5.1.1/osvvm_common/v08/ -P=./VHDL_LIBS/GHDL-5.1.1/osvvm_AXI4/v08/ osvvm_axi_stream_tb.vhd
ghdl -e --std=08 -P=./VHDL_LIBS/GHDL-5.1.1/osvvm/v08/ -P=./VHDL_LIBS/GHDL-5.1.1/osvvm_common/v08/ -P=./VHDL_LIBS/GHDL-5.1.1/osvvm_AXI4/v08/ osvvm_axi_stream_tb
ghdl -r --std=08 -P=./VHDL_LIBS/GHDL-5.1.1/osvvm/v08/ -P=./VHDL_LIBS/GHDL-5.1.1/osvvm_common/v08/ -P=./VHDL_LIBS/GHDL-5.1.1/osvvm_AXI4/v08/ osvvm_axi_stream_tb --vcd=wave.vcd

Finally, the waveform shows the results of our simulation.

Cheers,

Isaac