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 on | filelist (the sources) and flatten (the list naming them) |
| Input | Each source in dut.dpi |
| Command | xrun -64bit -sv -licqueue -elaborate -snapshot snapshot -l build.log ... -f flatten/filelist.f -top <dut.top>, run in build/ |
| Output | build/xcelium.d/, the library holding the snapshot |
| Debug output | build/build.log, Xcelium’s log of the build. Kept, and cached, only in a run with --debug |
| Prechecks | xrun on PATH |
| Key tools | xcelium, by the version xrun -version prints |
| Passes when | xrun exits 0, and build/xcelium.d/ and build/build.log exist |
The arguments between -l build.log and -f, in order:
| Argument | From |
|---|---|
-uvm | dut.uvm |
-coverage functional | dut.coverage.functional |
-covdut <scope> for each | dut.coverage.scopes |
-covworkdir cov_work -covoverwrite | Any dut.coverage section |
-access +r | dut.waves |
+define+XCELIUM | Always |
+define+<name> for each | dut.defines |
-defparam <dut.top>.<name>=<value> for each | dut.parameters |
| The arguments as given | tools.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 on | filelist (the sources), flatten and instrument (the list naming them) |
| Input | Each source in dut.dpi |
| Command | verilator --binary --timing -j <threads> --Mdir obj_dir -o sim ... -f instrument/filelist.f --top-module <dut.top>, run in build/ |
| Output | build/obj_dir/sim, the simulation binary |
| Prechecks | verilator and make on PATH. With dut.uvm: UVM_HOME is set |
| Key tools | verilator, by the version verilator --version prints and the value of UVM_HOME |
| Passes when | Verilator 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:
| Argument | From |
|---|---|
+define+UVM_NO_DPI +incdir+$UVM_HOME/src $UVM_HOME/src/uvm_pkg.sv | dut.uvm |
--coverage-user -Wno-COVERIGN | dut.coverage.functional |
--trace-fst | dut.waves |
+define+<name> for each | dut.defines |
-G<name>=<value> for each | dut.parameters |
| The arguments as given | tools.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.