uvm_set_before_get_dap

Provides a ‘Set Before Get’ Data Access Policy.

The ‘Set Before Get’ Data Access Policy enforces that the value must be written at least once before it is read.  This DAP can be used to pass shared information to multiple components during standard configuration, even if that information hasn’t yet been determined.

Such DAP objects can be useful for passing a ‘placeholder’ reference, before the information is actually available.  A good example of this would be the virtual sequencer:

typedef uvm_set_before_get_dap#(uvm_sequencer_base) seqr_dap_t;
virtual_seqeuncer_type virtual_sequencer;
agent_type my_agent;
seqr_dap_t seqr_dap;

function void my_env::build_phase(uvm_phase phase);
  seqr_dap = seqr_dap_t::type_id::create("seqr_dap");
  // Pass the DAP, because we don't have a reference to the
  // real sequencer yet...
  uvm_config_db#(seqr_dap_t)::set(this, "virtual_sequencer", "seqr_dap", seqr_dap);

  // Create the virtual sequencer
  virtual_sequencer = virtual_sequencer_type::type_id::create("virtual_sequencer", this);

  // Create the agent
  agent = agent_type::type_id::create("agent", this);
endfunction

function void my_env::connect_phase(uvm_phase phase);
  // Now that we know the value is good, we can set it
  seqr_dap.set(agent.sequencer);
endfunction

In the example above, the environment didn’t have a reference to the agent’s sequencer yet, because the agent hadn’t executed its build_phase.  The environment needed to give the virtual sequencer a “Set before get” DAP so that the virtual sequencer (and any sequences one it), could eventually see the agent’s sequencer, when the reference was finally available.  If the virtual sequencer (or any sequences on it) attempted to ‘get’ the reference to the agent’s sequencer prior to the environment assigning it, an error would have been reported.

Summary
uvm_set_before_get_dap
Provides a ‘Set Before Get’ Data Access Policy.
Class Hierarchy
uvm_set_get_dap_base#(T)
uvm_set_before_get_dap
Class Declaration
class uvm_set_before_get_dap#(
    type  T  =  int
) extends uvm_set_get_dap_base#(T)
newConstructor
Set/ Get Interface
setUpdates the value stored within the DAP.
try_setAttempts to update the value stored within the DAP.
getReturns the current value stored within the DAP.
try_getAttempts to retrieve the current value stored within the DAP
IntrospectionThe uvm_set_before_get_dap cannot support the standard UVM instrumentation methods (copy, clone, pack and unpack), due to the fact that they would potentially violate the access policy.

new

function new(
    string  name  =  "unnamed-uvm_set_before_get_dap#(T)"
)

Constructor

set

virtual function void set(
    value
)

Updates the value stored within the DAP.

try_set

virtual function bit try_set(
    value
)

Attempts to update the value stored within the DAP.

try_set will always return a 1.

get

virtual function T get()

Returns the current value stored within the DAP.

If ‘get’ is called before a call to set or try_set, then an error will be reported.

try_get

virtual function bit try_get(
    output  value
)

Attempts to retrieve the current value stored within the DAP

If the value has not been ‘set’, then try_get will return a 0, otherwise it will return a 1, and set value to the current value stored within the DAP.

Introspection

The uvm_set_before_get_dap cannot support the standard UVM instrumentation methods (copy, clone, pack and unpack), due to the fact that they would potentially violate the access policy.

A call to any of these methods will result in an error.

class uvm_set_before_get_dap#(
    type  T  =  int
) extends uvm_set_get_dap_base#(T)
Provides a ‘Set Before Get’ Data Access Policy.
function new(
    string  name  =  "unnamed-uvm_set_before_get_dap#(T)"
)
Constructor
virtual function void set(
    value
)
Updates the value stored within the DAP.
virtual function bit try_set(
    value
)
Attempts to update the value stored within the DAP.
virtual function T get()
Returns the current value stored within the DAP.
virtual function bit try_get(
    output  value
)
Attempts to retrieve the current value stored within the DAP