| Argument | Description | Example |
|---|---|---|
+UVM_TESTNAME |
Selects the test class to run. | +UVM_TESTNAME=my_smoke_test |
+UVM_VERBOSITY |
Sets the global reporting verbosity. | +UVM_VERBOSITY=UVM_HIGH |
+UVM_TIMEOUT |
Sets the global watchdog timer. | +UVM_TIMEOUT=2000000,YES |
+uvm_set_config_int |
Overrides an integer in the config DB. | (See below) |
Command Line Interface (CLI)
Change tests, verbosity, and variables at runtime. No recompile needed.
Common Arguments
Overrides from CLI
You can inject values into your testbench straight from the terminal command line without recompiling. This is like using a remote control for your testbench. Want to change the error rate? Just pass a flag!
Imagine you have a test that runs for 1 hour. If you want to run it again with slightly different settings (like enabled=0 instead of 1), you don't want to wait 20 minutes to recompile code. CLI args let you change it instantly!
+uvm_set_config_int=<comp>,<field>,<value>
# Force the 'num_packets' field in 'uvm_test_top.env' to 50
./simv +UVM_TESTNAME=base_test +uvm_set_config_int=uvm_test_top.env,num_packets,50
Debugging via CLI
Forgotten where a component is in the hierarchy? Use the topology printer.
# Print the entire component hierarchy at start of simulation
+UVM_CONFIG_DB_TRACE
+UVM_PHASE_TRACE
Advanced: Custom Arguments
Beyond the standard UVM arguments, you often need to pass custom values to your testbench
(e.g., +NUM_PKTS=500).
The uvm_cmdline_processor singleton is the standard way to handle this.
1. Getting the Handler
uvm_cmdline_processor clp;
clp = uvm_cmdline_processor::get_inst();
2. Reading Arguments
Use get_arg_value to fetch values for keys like +KEY=VALUE.
string value_str;
int num_packets;
// Command line: +NUM_PKTS=100
if(clp.get_arg_value("+NUM_PKTS=", value_str)) begin
num_packets = value_str.atoi();
`uvm_info("CLI", $sformatf("Packets set to %0d", num_packets), UVM_LOW)
end
3. Checking Flags
Use get_arg_matches to check for simple flags like
+ENABLE_COVERAGE.
string args[$];
if(clp.get_arg_matches("+ENABLE_COVERAGE", args)) begin
// Enable coverage...
end