Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

build

Compiles and elaborates a testbench into a simulation snapshot. Used by TestRIG. The simulators are Xcelium and Verilator, and the step differs for each.

Xcelium

Depends onfilelist (the sources) and flatten (the list naming them)
InputEach source in dut.dpi
Commandxrun -64bit -sv -licqueue -elaborate -snapshot snapshot -l build.log ... -f flatten/filelist.f -top <dut.top>, run in build/
Outputbuild/xcelium.d/, the library holding the snapshot
Debug outputbuild/build.log, Xcelium’s log of the build. Kept, and cached, only in a run with --debug
Prechecksxrun on PATH
Key toolsxcelium, by the version xrun -version prints
Passes whenxrun exits 0, and build/xcelium.d/ and build/build.log exist

The arguments between -l build.log and -f, in order:

ArgumentFrom
-uvmdut.uvm
-coverage functionaldut.coverage.functional
-covdut <scope> for eachdut.coverage.scopes
-covworkdir cov_work -covoverwriteAny dut.coverage section
-access +rdut.waves
+define+XCELIUMAlways
+define+<name> for eachdut.defines
-defparam <dut.top>.<name>=<value> for eachdut.parameters
The arguments as giventools.xcelium.build.args

Each source in dut.dpi comes after the filelist, before -top: xrun compiles the C and C++ sources it is given with the design.

-elaborate stops after elaboration, so nothing is simulated. -licqueue waits for a licence rather than failing. DPI C++, in the filelist or from dut.dpi, is compiled here, by Xcelium’s bundled g++. doris puts /usr/lib64 and /lib64 in front of LD_LIBRARY_PATH, where they exist, so the DPI code links against the host’s system libraries.

-access +r gives read access to every object, which the run needs to record waves. The -access and -defparam arguments, and dut.dpi sources, have unit tests only: they have not yet been run in a real Xcelium.

To check by hand

A build that passed leaves only build/xcelium.d/. Run with --debug to keep the files named here (see What is left in a step’s directory). build.log is a debug output, so a debug run also keeps it in the cache.

build/build.log ends with the design hierarchy summary and no *E or *F lines. Read its *W warnings once: doris does not. build/build.history records the exact xrun command line Xcelium saw. build/xmsc.log shows the DPI compile.

Verilator

Depends onfilelist (the sources), flatten and instrument (the list naming them)
InputEach source in dut.dpi
Commandverilator --binary --timing -j <threads> --Mdir obj_dir -o sim ... -f instrument/filelist.f --top-module <dut.top>, run in build/
Outputbuild/obj_dir/sim, the simulation binary
Prechecksverilator and make on PATH. With dut.uvm: UVM_HOME is set
Key toolsverilator, by the version verilator --version prints and the value of UVM_HOME
Passes whenVerilator exits 0 and build/obj_dir/sim exists

verilator is tools.verilator.command if the config sets it, for the command and for the version. The arguments between -o sim and -f, in order:

ArgumentFrom
+define+UVM_NO_DPI +incdir+$UVM_HOME/src $UVM_HOME/src/uvm_pkg.svdut.uvm
--coverage-user -Wno-COVERIGNdut.coverage.functional
--trace-fstdut.waves
+define+<name> for eachdut.defines
-G<name>=<value> for eachdut.parameters
The arguments as giventools.verilator.build.args

Each source in dut.dpi comes after the filelist, before --top-module: Verilator compiles the C and C++ sources it is given into the binary.

--binary makes Verilator write a main() and compile everything, with make and the C++ compiler on the path. -j <threads> gives both the threads the step holds, which resources.build.threads can set. --timing is needed for delays and event controls. DPI C++, in the filelist or from dut.dpi, is compiled into the binary, as is the support source doris adds.

$UVM_HOME is passed as written: Verilator puts the variable’s value in itself. So the plan is the same on every machine. Which library it names does change the build, so Verilator as a simulator names UVM_HOME as a host variable that is part of the cache key: its value, or that it is not set. That holds for every Verilator build, with dut.uvm or without, so changing the variable rebuilds a testbench that does not use UVM too. A build with dut.uvm has a precheck that the variable is set, so a run without it stops before any step starts, and doris check lists it.

Verilator defines VERILATOR itself. Nothing like +define+XCELIUM is added.

--trace-fst builds the simulation so that it can write waves in FST format. The waves source the instrument step adds starts the dump when the run asks for it. A build with --trace-fst has been run in a real Verilator, 5.040. -G and dut.dpi sources have unit tests only: they have not yet been run in a real Verilator.

Warnings stop a Verilator build unless they are turned off. A testbench is not written to be lint clean, so its config usually passes -Wno-fatal in tools.verilator.build.args. A few checks are errors that need their own option, such as -Wno-IMPURE for an interface task that is called through a virtual interface and uses the interface’s variables.

To check by hand

A build that passed leaves only build/obj_dir/sim. Run with --debug to keep its logs and the rest of obj_dir/ (see What is left in a step’s directory).

build/stderr.log has no %Error. build/stdout.log ends with Verilator’s report of the build: its wall time and the memory it took.