uvm_cmdline_processor

Group: Command Line Debug

This section lists most of the plusargs available for command line usage. Note that when used with cocotb, arguments are usually passed with SIM_ARGS=”…”. cocotb also supports PLUSARGS=”…”, so that can be used instead. For example:

SIM=icarus make SIM_ARGS="+UVM_TESTNAME=reg_test"

Variable: +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.

The implementation of this is in UVMRoot.

Group: Built-in UVM Aware Command Line Arguments

Variable: +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

The implementation of this is in uvm_root since this is procedurally invoked via UVMRoot.run_test.

Variable: +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

The implementation of this is in UVMRoot since this is procedurally invoked via UVMRoot.__init__.

Variable: +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

Variable: +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

Variable: +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

Variable: +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. For example:

<sim command> +UVM_TIMEOUT=200000,NO

The implementation of this is in uvm_root.

Variable: +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. For example:

<sim command> +UVM_MAX_QUIT_COUNT=5,NO
class uvm.base.uvm_cmdline_processor.UVMCmdLineVerb[source]

Bases: object

uvm.base.uvm_cmdline_processor.uvm_dpi_get_tool_name()[source]

Return the simulator name, as reported by VPI

Returns

Simulator name.

Return type

str

uvm.base.uvm_cmdline_processor.uvm_dpi_get_tool_version()[source]

Return the simulator version, as reported by VPI

uvm.base.uvm_cmdline_processor.uvm_dpi_regcomp(match)[source]

Tries to recompile given string into regular expression.

Return type

Regex|None

uvm.base.uvm_cmdline_processor.uvm_dpi_regexec(exp_h, elem)[source]
class uvm.base.uvm_cmdline_processor.UVMCmdlineProcessor(name='')[source]

Bases: UVMReportObject

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.

m_inst: Optional[UVMCmdlineProcessor] = <uvm.base.uvm_cmdline_processor.UVMCmdlineProcessor object>
uvm_cmdline_proc = <uvm.base.uvm_cmdline_processor.UVMCmdlineProcessor object>
m_test_mode = False
m_test_plusargs = {}
m_test_argv = []
classmethod get_inst() UVMCmdlineProcessor[source]

Returns the singleton instance of the UVM command line processor.

Returns

Singleton instance of UVM command line processor.

Return type

UVMCmdlineProcessor

get_args() List[str][source]

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.

Returns

Queue of all the command line arguments.

Return type

list

get_plusargs()[source]

This function returns a list 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.

Returns

List of all used plusargs.

Return type

list

get_uvm_args()[source]

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.

Returns

List of used UVM arguments, including name and value

Return type

list

get_arg_matches(match, args)[source]

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:

myargs = []
  uvm_cmdline_proc.get_arg_matches("+foo",myargs))  #matches +foo, +foobar
                                                    #doesn't match +barfoo
  uvm_cmdline_proc.get_arg_matches("/foo/",myargs)) #matches +foo, +foobar,
                                                    #foo.sv, barfoo, etc.
  uvm_cmdline_proc.get_arg_matches("/^foo.*\.sv",myargs)) #matches foo.sv
                                                          #and foo123.sv,
                                                          #not barfoo.sv.
Parameters
  • match (str) – String to match.

  • args (list) – List into which matches are appended.

Returns

Number of matches found.

Return type

int

get_arg_value(match, value)[source]

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

Parameters
  • match (str) – String/pattern to match.

  • value (list) – List into which matches are appended.

Returns

Number of cmd line args matching given match.

Return type

int

get_arg_values(match, values)[source]

This function finds all the arguments which matches the The match statement 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:

foo_values = []
cmd_line_proc = UVMCmdlineProcessor()
cmd_line_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. :param match: Argument to be matched. :type match: str :param values: Values of matching arguments. :type values: list

Returns

Number of arguments that match.

Return type

int

get_tool_name()[source]

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

Returns

Toolname.

Return type

str

get_tool_version()[source]

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

Returns

Tool version.

Return type

str

extract_args(argv)[source]

Extracts simulation arguments from given array. Stores results into 3 different internal arrays: All args, plusargs and UVM args.

Parameters

argv (list) – List of arguments.

m_convert_verb(verb_str)[source]

Converts given verbosity string into a number representing that verbosity level.

Parameters

verb_str (str) – Verbosity string.

Returns

Verbosity level matching one in UVM_VERBOSITY_LIST.

Return type

int