Simulation

Simulating with Generics

generic sets a top-level generic for the next simulate or RunTest. It takes the generic’s name and value. OSVVMOpen Source VHDL Verification Methodology passes the generics the way each simulator needs them.

The square brackets are required: TclTool Command Language calls generic and passes its result as argument.

The generics become part of the test case’s file names, so runs with different values keep separate reports: <TestCaseName>_<Generic>_<Value>.html.

library  default
RunTest  Tb_xMii1.vhd [generic MII_INTERFACE RGMII] [generic MII_BPS BPS_1G]
simulate Tb_xMii1     [generic MII_INTERFACE MII]   [generic MII_BPS BPS_10M]
  • reports/<TestSuite>
    • Tb_xMii1_MII_INTERFACE_RGMII_MII_BPS_BPS_1G.html
    • Tb_xMii1_MII_INTERFACE_MII_MII_BPS_BPS_10M.html

Second Top Level

Some testbenches need a second design unit at the top level of the simulation, for example a configuration of timing checks or a Verilog glbl module. SetSecondSimulationTopLevel names it as <Library>.<DesignUnit> before simulate; an empty value removes it.

Supported by the Aldec and Siemens simulators, DSim and XSIM.

SetSecondSimulationTopLevel work.glbl
simulate TbSystem
SetSecondSimulationTopLevel ""

Waveforms

Wave Files

DoWaves adds wave files to a simulation; like generic, it’s called in square brackets in the call of simulate. A wave file not in the simulation directory needs its path.

The Aldec and Siemens simulators run them when the simulation starts. A file named wave.do doesn’t need DoWaves: it runs automatically (see Scripts that Run with Each Simulation).

library  default
simulate Tb [DoWaves wave1.do]
simulate Tb [DoWaves wave1.do wave2.do]

Saving Waveforms with GHDL and NVC

GHDLG Hardware Design Language and NVC run in batch mode, but can save waveforms for a separate viewer like GTKWave or Surfer. SetSaveWaves turns it on; without an argument, it means true. The default is false.

The waveform file is written next to the test case’s report: <BuildName>/reports/<TestSuite>/.

The Siemens scripts use the setting too, to keep the simulator’s waveform database.

SetSaveWaves
build ../RunExample.pro
<BuildName>/reports/<TestSuite>/<DesignUnit>.ghw

Signals can be selected with a file <DesignUnit>.ghdl (GHDL’s --read-wave-opt).

<BuildName>/reports/<TestSuite>/<DesignUnit>.fst