The process guard classes, uvm_process_guard_base and uvm_process_guard#(T), are used to detect and potentially recover from unexpected termination of a SystemVerilog process.
For example, if a process calls sequence.start() and is then killed via a disable fork before the sequence has completed executing, then the sequence and sequencer could potentially be in an unexpected state.
The UVM library monitors process guards using an independent process, allowing callbacks when the guarded processes fail.
class my_sequence extends uvm_sequence; ... constructor, etc ... typedef uvm_process_guard#(my_sequence) guard_t; guard_t body_guard; virtual task body(); // Start the guard body_guard = new("my_sequence::body_guard", this); ...time consuming tasks... // Important tasks complete, clear the guard. We // can cast the return to void because we no longer // require it. void'(body_guard.clear()); endtask : body function void process_guard_triggered(guard_t guard); // Recover if the process has terminated unexpectedly this.kill(); endfunction : process_guard_triggered
Process Guards | |
The process guard classes, uvm_process_guard_base and uvm_process_guard#(T), are used to detect and potentially recover from unexpected termination of a SystemVerilog process. |
Ensures that processes are not killed in unexpected ways.
The uvm_process_guard#(T) class provides a safe mechanism for triggering a callback when a process is unexpectedly terminated during execution.
@uvm-contrib This API is being considered for potential contribution to 1800.2
uvm_process_guard#(T) | |||||||||||||||||
Ensures that processes are not killed in unexpected ways. | |||||||||||||||||
Class Hierarchy | |||||||||||||||||
| |||||||||||||||||
Class Declaration | |||||||||||||||||
| |||||||||||||||||
Types | |||||||||||||||||
this_type | @uvm-contrib This API is being considered for potential contribution to 1800.2 | ||||||||||||||||
Methods | |||||||||||||||||
new | Constructor | ||||||||||||||||
get_context | Returns the context with which the process guard was initialized. | ||||||||||||||||
do_trigger | Hook called when the guarded process transitions to either the `FINISHED` or `KILLED` state. |
@uvm-contrib This API is being considered for potential contribution to 1800.2
function new( string name, T ctxt )
Constructor
The name argument is the name of the process guard, while ctxt is the class that implements the process_guard_triggered hook. An error shall be generated if ctxt is null.
@uvm-contrib This API is being considered for potential contribution to 1800.2
function T get_context()
Returns the context with which the process guard was initialized.
@uvm-contrib This API is being considered for potential contribution to 1800.2
virtual function void do_trigger()
Hook called when the guarded process transitions to either the `FINISHED` or `KILLED` state.
The default implementation calls the `process_guard_triggered` hook on the context.
@uvm-contrib This API is being considered for potential contribution to 1800.2
Non-parameterized base class for uvm_process_guard#(T).
virtual class uvm_process_guard_base extends uvm_object
Ensures that processes are not killed in unexpected ways.
class uvm_process_guard#( type T = int ) extends uvm_process_guard_base
Constructor
function new( string name, T ctxt )
Returns the context with which the process guard was initialized.
function T get_context()
Hook called when the guarded process transitions to either the `FINISHED` or `KILLED` state.
virtual function void do_trigger()