| uvm_init_macros.svh | |
| Macros | |
| `uvm_post_init_decl | This macro is used to declare an ACTION to be taken after the UVM core service has been initialized, but before the uvm_test_runner::run_test method is called. |
| `uvm_pre_run_decl | This macro is used to declare an ACTION to be taken after the uvm_test_runner::run_test method has been called, but before the uvm_phase_hopper::run_phases method is called. |
This macro is used to declare an ACTION to be taken after the UVM core service has been initialized, but before the uvm_test_runner::run_test method is called.
`uvm_post_init_decl(ACTION, SUFFIX= )
The ACTION expression shall be any valid non-time consuming `void` expression.
package pkg;
int my_value;
static function void init_my_value();
uvm_cmdline_processor clp;
string my_value_str;
clp = uvm_cmdline_processor::get_inst();
if (clp.get_arg_value("+MY_VALUE=", my_value_str)) begin
my_value = my_value_str.atoi();
end
else begin
my_value = 10;
end
endfunction
`uvm_post_init_decl(init_my_value())
endpackageThe optional SUFFIX argument provides the ability to uniquify the underlying code, if necessary. This allows for the macro to be called multiple times in the same scope.
Note: As uvm_init may be triggered during static initialization, it is unsafe to fork off a new process within ACTION. For ~ACTION~s that require time, use the <`uvm_pre_run_decl macro instead.
@uvm-contrib Potential contribution to a future 1800.2 standard
This macro is used to declare an ACTION to be taken after the uvm_test_runner::run_test method has been called, but before the uvm_phase_hopper::run_phases method is called.
Like the `uvm_post_init_decl macro, this macro avoids causing static initialization race conditions and accepts a `void` ACTION expression. However, unlike `uvm_post_init_decl, this macro is called in the event region of the uvm_test_runner::run_test task, and therefore may consume time and fork off new processes.
`uvm_pre_run_decl(ACTION, SUFFIX= )
Note: As uvm_test_runner::run_test may be invoked within either a module or a program context, i.e. the ACTIVE or REACTIVE event regions, care must be taken to ensure behavior that is correct in both contexts.
@uvm-contrib Potential contribution to a future 1800.2 standard
Executes the test.
virtual task run_test( string test_name = "" )
Runs all phases associated with a test.
virtual task run_phases()