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.

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.

Example

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
Summary
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.

uvm_process_guard#(T)

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

Summary
uvm_process_guard#(T)
Ensures that processes are not killed in unexpected ways.
Class Hierarchy
uvm_object
uvm_process_guard#(T)
Class Declaration
class uvm_process_guard#(
    type  T  =  int
) extends uvm_process_guard_base
Types
this_type@uvm-contrib This API is being considered for potential contribution to 1800.2
Methods
newConstructor
get_contextReturns the context with which the process guard was initialized.
do_triggerHook called when the guarded process transitions to either the `FINISHED` or `KILLED` state.

this_type

@uvm-contrib This API is being considered for potential contribution to 1800.2

new

function new(
    string  name,
    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

get_context

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

do_trigger

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

virtual class uvm_process_guard_base extends uvm_object
Non-parameterized base class for uvm_process_guard#(T).
class uvm_process_guard#(
    type  T  =  int
) extends uvm_process_guard_base
Ensures that processes are not killed in unexpected ways.
function new(
    string  name,
    ctxt
)
Constructor
function T get_context()
Returns the context with which the process guard was initialized.
virtual function void do_trigger()
Hook called when the guarded process transitions to either the `FINISHED` or `KILLED` state.