# uvm_cmdline_processor

This class provides an interface to the command line arguments that were provided for the given simulation. The class is intended to be used as a singleton, but that isn’t required. The generation of the data structures which hold the command line argument information happens during construction of the class object. A global variable called uvm_cmdline_proc is created at initialization time and may be used to access command line information.

The uvm_cmdline_processor class also provides support for setting various UVM variables from the command line such as components’ verbosities and configuration settings for integral types and strings. Each of these capabilities is described in the Built-in UVM Aware Command Line Arguments section.

Summary

uvm_cmdline_processor
This class provides an interface to the command line arguments that were provided for the given simulation.
Class Hierarchy
uvm_void
uvm_object
uvm_report_object
uvm_cmdline_processor
Class Declaration
> class uvm_cmdline_processor extends uvm_report_object
Singleton |
get_inst | Returns the singleton instance of the UVM command line processor.
Basic Arguments |
get_args | This function returns a queue with all of the command line arguments that were used to start the simulation.
get_plusargs | This function returns a queue with all of the plus arguments that were used to start the simulation.
get_uvmargs | This function returns a queue with all of the uvm arguments that were used to start the simulation.
get_arg_matches | This function loads a queue with all of the arguments that match the input expression and returns the number of items that matched.
Argument Values |
get_arg_value | This function finds the first argument which matches the match arg and returns the suffix of the argument.
get_arg_values | This function finds all the arguments which matches the match arg and returns the suffix of the arguments in a list of values.
Tool information |
get_tool_name | Returns the simulation tool that is executing the simulation.
get_tool_version | Returns the version of the simulation tool that is executing the simulation.
Command Line Debug |
+UVM_DUMP_CMDLINE_ARGS | +UVM_DUMP_CMDLINE_ARGS allows the user to dump all command line arguments to the reporting mechanism.
Built-in UVM Aware Command Line Arguments |
+UVM_TESTNAME | +UVM_TESTNAME=<class name> allows the user to specify which uvm_test (or uvm_component) should be created via the factory and cycled through the UVM phases.
+UVM_VERBOSITY | +UVM_VERBOSITY=<verbosity> allows the user to specify the initial verbosity for all components.
+uvm_set_verbosity | +uvm_set_verbosity=<comp>,<id>,<verbosity>,<phase> and +uvm_set_verbosity=<comp>,<id>,<verbosity>,time,<time> allow the users to manipulate the verbosity of specific components at specific phases (and times during the “run” phases) of the simulation.
+uvm_set_action | +uvm_set_action=<comp>,<id>,<severity>,<action> provides the equivalent of various uvm_report_object’s set_report_*_action APIs.
+uvm_set_severity | +uvm_set_severity=<comp>,<id>,<current severity>,<new severity> provides the equivalent of the various uvm_report_object’s set_report_*_severity_override APIs.
+UVM_TIMEOUT | +UVM_TIMEOUT=<timeout>,<overridable> allows users to change the global timeout of the UVM framework.
+UVM_MAX_QUIT_COUNT | +UVM_MAX_QUIT_COUNT=<count>,<overridable> allows users to change max quit count for the report server.
+UVM_PHASE_TRACE | +UVM_PHASE_TRACE turns on tracing of phase executions.
+UVM_OBJECTION_TRACE | +UVM_OBJECTION_TRACE turns on tracing of objection activity.
+UVM_RESOURCE_DB_TRACE | +UVM_RESOURCE_DB_TRACE turns on tracing of resource DB access.
+UVM_CONFIG_DB_TRACE | +UVM_CONFIG_DB_TRACE turns on tracing of configuration DB access.
+uvm_set_inst_override |
+uvm_set_type_override | +uvm_set_inst_override=<req_type>,<override_type>,<full_inst_path> and +uvm_set_type_override=<req_type>,<override_type>[,<replace>] work like the name based overrides in the factory--factory.set_inst_override_by_name() and factory.set_type_override_by_name().
+uvm_set_config_int |
+uvm_set_config_string | +uvm_set_config_int=<comp>,<field>,<value> and +uvm_set_config_string=<comp>,<field>,<value> work like their procedural counterparts: set_config_int() and set_config_string().
+uvm_set_default_sequence | The +uvm_set_default_sequence=<seqr>,<phase>,<type> plusarg allows the user to define a default sequence from the command line, using the typename of that sequence.

### Singleton

### get_inst

> static function uvm_cmdline_processor get_inst()

Returns the singleton instance of the UVM command line processor.

### Basic Arguments

### get_args

> function void get_args (
> | output | string | args[$]
> )

This function returns a queue with all of the command line arguments that were used to start the simulation. Note that element 0 of the array will always be the name of the executable which started the simulation.

### get_plusargs

> function void get_plusargs (
> | output | string | args[$]
> )

This function returns a queue with all of the plus arguments that were used to start the simulation. Plusarguments may be used by the simulator vendor, or may be specific to a company or individual user. Plusargs never have extra arguments (i.e. if there is a plusarg as the second argument on the command line, the third argument is unrelated); this is not necessarily the case with vendor specific dash arguments.

### get_uvmargs

This function returns a queue with all of the uvm arguments that were used to start the simulation. A UVM argument is taken to be any argument that starts with a - or + and uses the keyword UVM (case insensitive) as the first three letters of the argument.

### get_arg_matches

> function int get_arg_matches (
> |  | string | match,
> | ref | string | args[$]
> )

This function loads a queue with all of the arguments that match the input expression and returns the number of items that matched. If the input expression is bracketed with //, then it is taken as an extended regular expression otherwise, it is taken as the beginning of an argument to match. For example:

>     string myargs[$]
>     initial begin
>        void'(uvm_cmdline_proc.get_arg_matches("+foo",myargs)); //matches +foo, +foobar
>                                                                //doesn't match +barfoo
>        void'(uvm_cmdline_proc.get_arg_matches("/foo/",myargs)); //matches +foo, +foobar,
>                                                                 //foo.sv, barfoo, etc.
>        void'(uvm_cmdline_proc.get_arg_matches("/^foo.*\.sv",myargs)); //matches foo.sv
>                                                                       //and foo123.sv,
>                                                                       //not barfoo.sv.

### Argument Values

### get_arg_value

> function int get_arg_value (
> |  | string | match,
> | ref | string | value
> )

This function finds the first argument which matches the match arg and returns the suffix of the argument. This is similar to the $value$plusargs system task, but does not take a formatting string. The return value is the number of command line arguments that match the match string, and value is the value of the first match.

### get_arg_values

> function int get_arg_values (
> |  | string | match,
> | ref | string | values[$]
> )

This function finds all the arguments which matches the match arg and returns the suffix of the arguments in a list of values. The return value is the number of matches that were found (it is the same as values.size() ). For example if ‘+foo=1,yes,on +foo=5,no,off’ was provided on the command line and the following code was executed:

>     string foo_values[$]
>     initial begin
>        void'(uvm_cmdline_proc.get_arg_values("+foo=",foo_values));

The foo_values queue would contain two entries. These entries are shown here:

0 | ”1,yes,on”
1 | ”5,no,off”

Splitting the resultant string is left to user but using the uvm_split_string() function is recommended.

### Tool information

### get_tool_name

> function string get_tool_name ()

Returns the simulation tool that is executing the simulation. This is a vendor specific string.

### get_tool_version

> function string get_tool_version ()

Returns the version of the simulation tool that is executing the simulation. This is a vendor specific string.

### Command Line Debug

### +UVM_DUMP_CMDLINE_ARGS

+UVM_DUMP_CMDLINE_ARGS allows the user to dump all command line arguments to the reporting mechanism. The output in is tree format.

### Built-in UVM Aware Command Line Arguments

### +UVM_TESTNAME

+UVM_TESTNAME=<class name> allows the user to specify which uvm_test (or uvm_component) should be created via the factory and cycled through the UVM phases. If multiple of these settings are provided, the first occurrence is used and a warning is issued for subsequent settings. For example:

>     <sim command> +UVM_TESTNAME=read_modify_write_test

### +UVM_VERBOSITY

+UVM_VERBOSITY=<verbosity> allows the user to specify the initial verbosity for all components. If multiple of these settings are provided, the first occurrence is used and a warning is issued for subsequent settings. For example:

>     <sim command> +UVM_VERBOSITY=UVM_HIGH

### +uvm_set_verbosity

+uvm_set_verbosity=<comp>,<id>,<verbosity>,<phase> and +uvm_set_verbosity=<comp>,<id>,<verbosity>,time,<time> allow the users to manipulate the verbosity of specific components at specific phases (and times during the “run” phases) of the simulation. The id argument can be either ALL for all IDs or a specific message id. Wildcarding is not supported for id due to performance concerns. Settings for non-”run” phases are executed in order of occurrence on the command line. Settings for “run” phases (times) are sorted by time and then executed in order of occurrence for settings of the same time. For example:

>     <sim command> +uvm_set_verbosity=uvm_test_top.env0.agent1.*,_ALL_,UVM_FULL,time,800

### +uvm_set_action

+uvm_set_action=<comp>,<id>,<severity>,<action> provides the equivalent of various uvm_report_object’s set_report_*_action APIs. The special keyword, ALL, can be provided for both/either the id and/or severity arguments. The action can be UVM_NO_ACTION or a | separated list of the other UVM message actions. For example:

>     <sim command> +uvm_set_action=uvm_test_top.env0.*,_ALL_,UVM_ERROR,UVM_NO_ACTION

### +uvm_set_severity

+uvm_set_severity=<comp>,<id>,<current severity>,<new severity> provides the equivalent of the various uvm_report_object’s set_report_*_severity_override APIs. The special keyword, ALL, can be provided for both/either the id and/or current severity arguments. For example:

>     <sim command> +uvm_set_severity=uvm_test_top.env0.*,BAD_CRC,UVM_ERROR,UVM_WARNING

### +UVM_TIMEOUT

+UVM_TIMEOUT=<timeout>,<overridable> allows users to change the global timeout of the UVM framework. The <overridable> argument (‘YES’ or ‘NO’) specifies whether user code can subsequently change this value. If set to ‘NO’ and the user code tries to change the global timeout value, an warning message will be generated.

>     <sim command> +UVM_TIMEOUT=200000,NO

### +UVM_MAX_QUIT_COUNT

+UVM_MAX_QUIT_COUNT=<count>,<overridable> allows users to change max quit count for the report server. The <overridable> argument (‘YES’ or ‘NO’) specifies whether user code can subsequently change this value. If set to ‘NO’ and the user code tries to change the max quit count value, an warning message will be generated.

>     <sim command> +UVM_MAX_QUIT_COUNT=5,NO

### +UVM_PHASE_TRACE

+UVM_PHASE_TRACE turns on tracing of phase executions. Users simply need to put the argument on the command line.

### +UVM_OBJECTION_TRACE

+UVM_OBJECTION_TRACE turns on tracing of objection activity. Users simply need to put the argument on the command line.

### +UVM_RESOURCE_DB_TRACE

+UVM_RESOURCE_DB_TRACE turns on tracing of resource DB access. Users simply need to put the argument on the command line.

### +UVM_CONFIG_DB_TRACE

+UVM_CONFIG_DB_TRACE turns on tracing of configuration DB access. Users simply need to put the argument on the command line.

### +uvm_set_inst_override

### +uvm_set_type_override

+uvm_set_inst_override=<req_type>,<override_type>,<full_inst_path> and +uvm_set_type_override=<req_type>,<override_type>[,<replace>] work like the name based overrides in the factory--factory.set_inst_override_by_name() and factory.set_type_override_by_name(). For uvm_set_type_override, the third argument is 0 or 1 (the default is 1 if this argument is left off); this argument specifies whether previous type overrides for the type should be replaced. For example:

>     <sim command> +uvm_set_type_override=eth_packet,short_eth_packet

### +uvm_set_config_int

### +uvm_set_config_string

+uvm_set_config_int=<comp>,<field>,<value> and +uvm_set_config_string=<comp>,<field>,<value> work like their procedural counterparts: set_config_int() and set_config_string(). For the value of int config settings, ‘b (0b), ‘o, ‘d, ‘h (‘x or 0x) as the first two characters of the value are treated as base specifiers for interpreting the base of the number. Size specifiers are not used since SystemVerilog does not allow size specifiers in string to value conversions. For example:

>     <sim command> +uvm_set_config_int=uvm_test_top.soc_env,mode,5

No equivalent of set_config_object() exists since no way exists to pass a uvm_object into the simulation via the command line.

### +uvm_set_default_sequence

The +uvm_set_default_sequence=<seqr>,<phase>,<type> plusarg allows the user to define a default sequence from the command line, using the typename of that sequence. For example:

>     <sim command> +uvm_set_default_sequence=path.to.sequencer,main_phase,seq_type

This is functionally equivalent to calling the following in your test:

>     uvm_coreservice_t cs = uvm_coreservice_t::get();
>     uvm_factory f = cs.get_factory();
>     uvm_config_db#(uvm_object_wrapper)::set(this,
>                                             "path.to.sequencer.main_phase",
>                                             "default_sequence",
>                                             f.find_wrapper_by_name("seq_type"));

> virtual class uvm_void

The uvm_void class is the base class for all UVM classes.

> virtual class uvm_object extends uvm_void

The uvm_object class is the base class for all UVM data and hierarchical classes.

> class uvm_report_object extends uvm_object

The uvm_report_object provides an interface to the UVM reporting facility.

> class uvm_cmdline_processor extends uvm_report_object

This class provides an interface to the command line arguments that were provided for the given simulation.

> static function uvm_cmdline_processor get_inst()

Returns the singleton instance of the UVM command line processor.

> function void get_args (
> | output | string | args[$]
> )

This function returns a queue with all of the command line arguments that were used to start the simulation.

> function void get_plusargs (
> | output | string | args[$]
> )

This function returns a queue with all of the plus arguments that were used to start the simulation.

> function int get_arg_matches (
> |  | string | match,
> | ref | string | args[$]
> )

This function loads a queue with all of the arguments that match the input expression and returns the number of items that matched.

> function int get_arg_value (
> |  | string | match,
> | ref | string | value
> )

This function finds the first argument which matches the match arg and returns the suffix of the argument.

> function int get_arg_values (
> |  | string | match,
> | ref | string | values[$]
> )

This function finds all the arguments which matches the match arg and returns the suffix of the arguments in a list of values.

> function string get_tool_name ()

Returns the simulation tool that is executing the simulation.

> function string get_tool_version ()

Returns the version of the simulation tool that is executing the simulation.