run
Starts the reference model and the design in its simulator, runs QCVEngine against them, and collects what they wrote. Used by TestRIG, where its outcome is the test result.
| Depends on | model, engine, build |
| Input | Replay mode only: the replay trace directory |
| Services | reference (the model) and dut (the simulator) |
| Command | engine/bin/QCVEngine, run in run/ |
| Outputs | run/stats.txt, run/stdout.log, the simulator’s log, run/counterexamples/, the coverage data, the waves |
| Prechecks | For an Xcelium job: xrun and gcc on PATH. In replay mode: the replay trace directory exists |
| Key tools | xcelium for an Xcelium job, by the version xrun -version prints. The model and a Verilator binary are keyed as outputs of the steps that built them |
| Timeout | timeout from the config. None by default |
| Cached | Yes. In generate mode the seed is part of the key |
Sequence
sequenceDiagram
participant D as doris
participant R as reference (Sail)
participant S as dut (xrun)
participant Q as QCVEngine
D->>D: allocate two free ports
D->>R: start, -r PORT
D->>S: start, RVFI_DII_PORT=PORT
D->>D: wait until both ports are listening
D->>Q: start, -a REFERENCE_PORT -b DUT_PORT
Q->>R: connect (implementation A)
Q->>S: connect (implementation B)
loop each test
Q->>R: reset, then instructions
Q->>S: reset, then instructions
R-->>Q: trace packets
S-->>Q: trace packets
Q->>Q: compare, then shrink and save on a mismatch
end
Q->>D: exit with the number of failing tests
D->>R: SIGTERM
D->>S: SIGTERM
D->>D: completion checks, then the verdict
The reference service
model/src/c_emulator/cheri_riscv_rvfi_RV64 [-C] [-m] <run args> -r <port> -i # in run/reference/
| Argument | When | Meaning |
|---|---|---|
-C | arch has no c extension | Disable compressed instructions |
-m | support_misaligned: true | Allow misaligned accesses |
<run args> | tools.sail.run.args is set | The arguments as given |
-r <port> | Always | Serve RVFI-DII on this port |
-i | Always | Store illegal instruction bits in mtval |
Its stdout and stderr go to run/reference.log: one line per executed instruction, with register and memory writes. That log is not an output of the step, so it is deleted when the step passes: it is there after a failure, or a run with --debug. It must be listening within 60 seconds. It is stopped with SIGTERM as soon as QCVEngine exits, and it is a step error if it has to be killed.
The dut service
The service declares what the simulator writes as its own outputs, which are outputs of the step named dut.log, dut.coverage and dut.waves. They are checked once the service has stopped, since the simulator writes its coverage as it stops. The simulator’s log, dut.log, is run/dut/run.log for Xcelium and run/dut.log for Verilator. The coverage data, dut.coverage, is run/dut/cov_work/ for Xcelium and run/dut/coverage.dat for Verilator, and the coverage step reads it. The waves, dut.waves, are run/dut/waves.shm/ for Xcelium and run/dut/waves.fst for Verilator.
Xcelium
RVFI_DII_PORT=<port> xrun -64bit -R -licqueue -snapshot snapshot -l run.log \
-coverage functional -covworkdir cov_work -covoverwrite -covtest <dut.test> \
+UVM_TESTNAME=<dut.test> -input '@run; finish' <run args> # in run/dut/
xrun -R runs a snapshot from the library in its working directory, so doris links run/dut/xcelium.d to build/xcelium.d. Logs and coverage are then written in run/dut/, not in the build. The coverage arguments are present when dut.coverage.functional is set. With no dut.test, +UVM_TESTNAME is left out and the coverage test is test. <run args> is tools.xcelium.run.args, as given. The testbench reads its port from RVFI_DII_PORT. doris also puts the host’s libstdc++.so.6, found with gcc -print-file-name, in front of LD_PRELOAD, so DPI code doesn’t load the older copy bundled with Xcelium.
Its stdout and stderr go to run/dut.log. run/dut/run.log is Xcelium’s own log of the same run, and is the one the step keeps: run/dut.log is deleted when the step passes. The testbench writes its traces next to it. It must be listening within 30 minutes, which allows for a licence queue.
The testbench does not finish by itself: after QCVEngine disconnects it keeps listening for another connection. So doris stops it with SIGTERM as soon as QCVEngine exits, as testrig.py does. Xcelium ends the simulation on SIGTERM and writes the coverage database before it exits, but the UVM report summary and final phases do not run. If it is still running 10 seconds after the signal it is killed and the step is a step error, because the coverage may be incomplete.
Verilator
RVFI_DII_PORT=<port> build/obj_dir/sim +UVM_TESTNAME=<dut.test> [+doris_waves] <run args> # in run/dut/
The binary the build step made is run from run/dut/, where the testbench writes its traces. <run args> is tools.verilator.run.args, as given. Its stdout and stderr go to run/dut.log, and it has no other log. It needs no licence, so it is listening at once. With no dut.test, +UVM_TESTNAME is left out.
It is stopped with SIGTERM in the same way. The support source doris builds into the binary then writes run/dut/coverage.dat and exits. final blocks and the UVM report summary do not run.
Waves
With dut.waves the simulator records the waves of the run, and they are an output of the dut service, and so of the step, named dut.waves.
| Simulator | What changes in the command | Waves |
|---|---|---|
| Xcelium | The -input script is @database -open waves -shm -default; probe -create -all -depth all; run; finish | run/dut/waves.shm/ |
| Verilator | +doris_waves is passed, and the waves source built into the binary starts the dump | run/dut/waves.fst |
Xcelium’s script opens an SHM database, which SimVision reads, and probes every object below the top to any depth. The build gave read access to them with -access +r. Verilator’s file is in FST format, which GTKWave reads.
The waves must exist for the step to pass. The Verilator path has been run for real, in Verilator 5.040: the file is written though the simulation is stopped with SIGTERM. The Xcelium path has unit tests of the command line only, and whether Xcelium has written all of its waves when doris stops it has not been checked.
The QCVEngine command
engine/bin/QCVEngine -a <reference port> -b <dut port> -r <arch> -v 1 \
-s run/counterexamples --statsFile run/stats.txt <mode arguments> [-L <length>]
| Argument | Meaning |
|---|---|
-a, -b | Ports of implementation A (reference) and B (dut) |
-r <arch> | ISA string. QCVEngine skips test groups the architecture doesn’t support |
-v 1 | Verbosity |
-s <dir> | Save counterexamples here. Without it QCVEngine asks on stdin for a file name |
--statsFile <file> | Write the per-instruction counts here at the end |
-n <count> | Generate mode: tests per test group |
-I <regex>, -x <regex> | Generate mode: test groups to include and exclude |
--seed <seed> | Generate mode: the seed the tests are generated from |
-d <dir> | Replay mode: run the traces in this directory instead of generating |
-L <length> | Maximum test length |
tests.count is per test group. With 19 groups enabled, count: 100 runs 1900 tests. Where the count and the seed come from, and how the two modes differ, is on the flow’s page.
What passed means
The step’s outcome is decided in this order:
| Check | If it fails |
|---|---|
| Both services started and were listening in time | setup error |
| No service exited while QCVEngine ran | step error |
| QCVEngine finished within the timeout | step error |
| No service was killed by something else, or ignored SIGTERM for 10 s | step error |
| QCVEngine was not killed by a signal | step error |
stats.txt, stdout.log, counterexamples/, and the simulator’s log, coverage data and waves (see The dut service) exist | step error |
run/stdout.log contains Written coverage stats to | step error |
| QCVEngine’s exit code is 0 | failed |
QCVEngine exits with the number of failing tests, so any exit code completes the step. The pass pattern is what tells a run that reached the end from a crash that happened to exit non-zero: QCVEngine prints that line last.
So passed means: QCVEngine ran to the end, reported no failing test, and both implementations stayed up. It does not mean:
- A minimum number of tests ran. Groups skipped for the architecture, or a regex that matches nothing, lower the count without failing.
tests_requestedin the result is the number asked for, not a measurement.testsin the result, and the test table in the report, list what each group did, read from the verdict lines QCVEngine prints inrun/stdout.log: check there that the groups you expect ran. - The simulator log is clean. The simulator’s log is not scanned: the step has no fail pattern. Assertion failures, UVM errors and
*Emessages that leave the simulation running do not change the outcome. A service’s exit code is not checked either. - The UVM test passed. The outcome comes from QCVEngine’s comparison alone.
- Coverage was collected. The coverage data must exist, but its content is not checked here. The
coveragestep loads it, whether this step passed or failed. - The two sides compared everything. What is compared is whatever both sides put in their trace packets, in the trace version both support.
To check by hand
The flow’s page has the full list. For this step: run/stdout.log starts with connected to implementation-A and connected to implementation-B, each group that ran prints +++ OK, passed N tests., and for Xcelium run/dut/run.log ends with Simulation received SIGTERM and the coverage files being written. For Verilator, run/dut/coverage.dat is not empty.
Those files are outputs of the step, so they are there after any run. run/reference.log, run/stderr.log and, for Xcelium, run/dut.log are not: a step that passed has them only after a run with --debug (see What is left in a step’s directory).