Hi Forum,
I notice the following code in uvm_root which looks for certain run-time args
uvm_cmdline_processor clp;
// Within constructor of uvm_root it's initialized
clp = uvm_cmdline_processor::get_inst();
// Function 'm_do_config_settings() is called from uvm_root::build_phase()
function void uvm_root::m_do_config_settings();
string args[$];
void'(clp.get_arg_matches("/^\\+(UVM_SET_CONFIG_INT|uvm_set_config_int)=/",args));
foreach(args[i]) begin
m_process_config(args[i].substr(20, args[i].len()-1), 1);
end
void'(clp.get_arg_matches("/^\\+(UVM_SET_CONFIG_STRING|uvm_set_config_string)=/",args));
foreach(args[i]) begin
m_process_config(args[i].substr(23, args[i].len()-1), 0);
end
void'(clp.get_arg_matches("/^\\+(UVM_SET_DEFAULT_SEQUENCE|uvm_set_default_sequence)=/", args));
foreach(args[i]) begin
m_process_default_sequence(args[i].substr(26, args[i].len()-1));
end
endfunction
I am not clear on the presence of prefix /^\\+ and suffix / as well as the opening and closing parenthesis within argument to get_arg_matches.
User would provide run-time arg. as +uvm_set_config_int=uvm_test_top.env,test_variable,7.
The actual run-time arg. is not prefixed with /^\\+( or suffixed with )=/ at the end.
The enclosing "/string/" means to search the argument for a matching regular expression, whereas "string" would be looking for an argument with an entire exact match.
The ^ symbol indicates that the regular expression must be at the beginning of the argument. In SystemVerilog strings, the backslash \\ is interpreted as a single backslash \ in the actual regular expression. Additionally, the \+ character in POSIX Extended Regular Expressions (ERE) represents a literal plus sign +.
Parentheses are used to group alternatives that match expressions. For instance, (string1|string2) indicates that there must be a match of either string1 or string2. And that must be followed by a = symbol.