UVM Plusargs
Use simulator command-line arguments to choose a test, tune reporting, and investigate a failing run without editing the testbench.
A plusarg starts with +. UVM recognizes options such as +UVM_TESTNAME=smoke_test; your testbench can read custom options with $value$plusargs.
Common UVM plusargs
Put these arguments after the simulator command. The examples use one option at a time so you can see what each one changes.
| Argument | What it does | Example |
|---|---|---|
+UVM_TESTNAME=<test> |
Selects the UVM test to run. The test must be registered with the factory. | +UVM_TESTNAME=smoke_test |
+UVM_VERBOSITY=<level> |
Sets the default report verbosity. Higher levels show more messages. | +UVM_VERBOSITY=UVM_HIGH |
+UVM_MAX_QUIT_COUNT=<n> |
Sets how many reports at the configured quit severity are allowed before UVM ends the run. | +UVM_MAX_QUIT_COUNT=1 |
+UVM_TIMEOUT=<time> |
Sets a simulation timeout, useful for catching tests that never finish. | +UVM_TIMEOUT=100000ns |
+UVM_PHASE_TRACE |
Prints UVM phase transitions to help diagnose phase-flow problems. | +UVM_PHASE_TRACE |
+UVM_OBJECTION_TRACE |
Traces objection raises and drops when a test does not end as expected. | +UVM_OBJECTION_TRACE |
+UVM_CONFIG_DB_TRACE |
Traces configuration database activity when a component receives an unexpected setting. | +UVM_CONFIG_DB_TRACE |
+UVM_COMPONENT_TRACE |
Prints component creation information while the testbench hierarchy is built. | +UVM_COMPONENT_TRACE |
+UVM_REPORT_DISABLE_FILE_LINE |
Omits source file and line details from UVM report messages. | +UVM_REPORT_DISABLE_FILE_LINE |
Verbosity levels
UVM_NONE, UVM_LOW, UVM_MEDIUM, UVM_HIGH, UVM_FULL, and UVM_DEBUG go from fewer messages to more detail. Start with UVM_MEDIUM; raise it when you need more logging.
Run a test with plusargs
For example, a VCS simulation executable can be started like this. Keep the plusargs after the executable; compile options belong to the earlier compile step.
./simv \
+UVM_TESTNAME=smoke_test \
+UVM_VERBOSITY=UVM_HIGH \
+UVM_MAX_QUIT_COUNT=1
Simulator executable names and random-seed switches vary by tool. Check your simulator's documentation before copying a command to a different simulator.
Read a custom plusarg
Use $value$plusargs when your testbench needs a run-time value that is not one of UVM's built-in options. This small example defaults to 10 transactions and replaces that value when +NUM_TXN is supplied.
module tb;
int num_txn = 10;
initial begin
if ($value$plusargs("NUM_TXN=%d", num_txn))
$display("NUM_TXN set from command line");
$display("NUM_TXN=%0d", num_txn);
end
endmodule
Run it and check the output
Append +NUM_TXN=100 to the simulator command. The %d format reads a decimal integer into num_txn.
NUM_TXN set from command line
NUM_TXN=100Without the plusarg, the initial value remains in place and the output is NUM_TXN=10.
Debugging and random seeds
Use trace options only for the failing run because they can produce large logs. For example, combine +UVM_OBJECTION_TRACE with a short test to find an objection that was never dropped.
Random-seed argument names are simulator-specific. Some flows use +ntb_random_seed=42; use the syntax supported by your simulator and save the seed with the failing test name and log.
Try it
Change the command to use +NUM_TXN=25, then run once without a NUM_TXN argument. Check that the two outputs are 25 and the default 10.