This posts explains how +UVM_TIMEOUT
works.
Starting with how it is used
<sim command> +UVM_TIMEOUT=200000,NO
UVM_TIMEOUT
is read in uvm_root.svh
which parses the value and override strings and calls set_timeout
.
timeout_count = clp.get_arg_values("+UVM_TIMEOUT=", timeout_settings);
if (timeout_count == 0)
return;
else begin
timeout = timeout_settings[0];
if (timeout_count > 1) begin
string timeout_list;
string sep;
for (int i = 0; i < timeout_settings.size(); i++) begin
if (i != 0)
sep = "; ";
timeout_list = {timeout_list, sep, timeout_settings[i]};
end
uvm_report_warning("MULTTIMOUT",
$sformatf("Multiple (%0d) +UVM_TIMEOUT arguments provided on the command line. '%s' will be used. Provided list: %s.",
timeout_count, timeout, timeout_list), UVM_NONE);
end
uvm_report_info("TIMOUTSET",
$sformatf("'+UVM_TIMEOUT=%s' provided on the command line is being applied.", timeout), UVM_NONE);
void'($sscanf(timeout,"%d,%s",timeout_int,override_spec));
case(override_spec)
"YES" : set_timeout(timeout_int, 1);
"NO" : set_timeout(timeout_int, 0);
default : set_timeout(timeout_int, 1);
endcase
end
set_timeout
sets the phase_timeout in uvm_root
function void uvm_root::set_timeout(time timeout, bit overridable=1);
static bit m_uvm_timeout_overridable = 1;
if (m_uvm_timeout_overridable == 0) begin
uvm_report_info("NOTIMOUTOVR",
$sformatf("The global timeout setting of %0d is not overridable to %0d due to a previous setting.",
phase_timeout, timeout), UVM_NONE);
return;
end
m_uvm_timeout_overridable = overridable;
phase_timeout = timeout;
endfunction
then eventually when task uvm_phase::execute_phase()
is called, it waits until for that timeout
if (m_phase_trace)
`UVM_PH_TRACE("PH/TRC/TO_WAIT", $sformatf("STARTING PHASE TIMEOUT WATCHDOG (timeout == %t)", top.phase_timeout), this, UVM_HIGH)
`uvm_delay(top.phase_timeout)
`define uvm_delay(TIME) #(TIME);
Side note, UVM_DEFAULT_TIMEOUT
is set to 2900s by default which sounds like arbitrary number. Who chose it?
`define UVM_DEFAULT_TIMEOUT 9200s