UVM Links

The uvm_link_base class, and its extensions, are provided as a mechanism to allow for compile-time safety when trying to establish links between records within a uvm_tr_database.

Contents
UVM LinksThe uvm_link_base class, and its extensions, are provided as a mechanism to allow for compile-time safety when trying to establish links between records within a uvm_tr_database.
uvm_link_baseThe uvm_link_base class presents a simple API for defining a link between any two objects.
uvm_parent_child_linkThe uvm_parent_child_link is used to represent a Parent/Child relationship between two objects.
uvm_cause_effect_linkThe uvm_cause_effect_link is used to represent a Cause/Effect relationship between two objects.
uvm_related_linkThe uvm_related_link is used to represent a generic “is related” link between two objects.

uvm_link_base

The uvm_link_base class presents a simple API for defining a link between any two objects.

Using extensions of this class, a uvm_tr_database can determine the type of links being passed, without relying on “magic” string names.

For example

virtual function void do_establish_link(uvm_link_base link);
  uvm_parent_child_link pc_link;
  uvm_cause_effect_link ce_link;

  if ($cast(pc_link, link)) begin
     // Record the parent-child relationship
  end
  else if ($cast(ce_link, link)) begin
     // Record the cause-effect relationship
  end
  else begin
     // Unsupported relationship!
  end
endfunction : do_establish_link
Summary
uvm_link_base
The uvm_link_base class presents a simple API for defining a link between any two objects.
Class Hierarchy
uvm_link_base
Class Declaration
virtual class uvm_link_base extends uvm_object
newConstructor
Accessors
set_lhsSets the left-hand-side of the link
get_lhsGets the left-hand-side of the link
set_rhsSets the right-hand-side of the link
get_rhsGets the right-hand-side of the link
setConvenience method for setting both sides in one call.
Implementation Callbacks
do_set_lhsCallback for setting the left-hand-side
do_get_lhsCallback for retrieving the left-hand-side
do_set_rhsCallback for setting the right-hand-side
do_get_rhsCallback for retrieving the right-hand-side

new

function new(
    string  name  =  "unnamed-uvm_link_base"
)

Constructor

Parameters

nameInstance name

set_lhs

function void set_lhs(
    uvm_object  lhs
)

Sets the left-hand-side of the link

Triggers the do_set_lhs callback.

get_lhs

function uvm_object get_lhs()

Gets the left-hand-side of the link

Triggers the do_get_lhs callback

set_rhs

function void set_rhs(
    uvm_object  rhs
)

Sets the right-hand-side of the link

Triggers the do_set_rhs callback.

get_rhs

function uvm_object get_rhs()

Gets the right-hand-side of the link

Triggers the do_get_rhs callback

set

function void set(
    uvm_object  lhs,
      rhs
)

Convenience method for setting both sides in one call.

Triggers both the do_set_rhs and do_set_lhs callbacks.

do_set_lhs

pure virtual function void do_set_lhs(
    uvm_object  lhs
)

Callback for setting the left-hand-side

do_get_lhs

pure virtual function uvm_object do_get_lhs()

Callback for retrieving the left-hand-side

do_set_rhs

pure virtual function void do_set_rhs(
    uvm_object  rhs
)

Callback for setting the right-hand-side

do_get_rhs

pure virtual function uvm_object do_get_rhs()

Callback for retrieving the right-hand-side

uvm_parent_child_link

The uvm_parent_child_link is used to represent a Parent/Child relationship between two objects.

Summary
uvm_parent_child_link
The uvm_parent_child_link is used to represent a Parent/Child relationship between two objects.
Class Hierarchy
uvm_parent_child_link
Class Declaration
class uvm_parent_child_link extends uvm_link_base
newConstructor
get_linkConstructs a pre-filled link
Implementation Callbacks
do_set_lhsSets the left-hand-side (Parent)
do_get_lhsRetrieves the left-hand-side (Parent)
do_set_rhsSets the right-hand-side (Child)
do_get_rhsRetrieves the right-hand-side (Child)

new

function new(
    string  name  =  "unnamed-uvm_parent_child_link"
)

Constructor

Parameters

nameInstance name

get_link

static function uvm_parent_child_link get_link(
    uvm_object  lhs,   
    uvm_object  rhs,   
    string  name  =  "pc_link"
)

Constructs a pre-filled link

This allows for simple one-line link creations.

my_db.establish_link(uvm_parent_child_link::get_link(record1, record2));

Parameters

lhsLeft hand side reference
rhsRight hand side reference
nameOptional name for the link object

do_set_lhs

virtual function void do_set_lhs(
    uvm_object  lhs
)

Sets the left-hand-side (Parent)

do_get_lhs

virtual function uvm_object do_get_lhs()

Retrieves the left-hand-side (Parent)

do_set_rhs

virtual function void do_set_rhs(
    uvm_object  rhs
)

Sets the right-hand-side (Child)

do_get_rhs

virtual function uvm_object do_get_rhs()

Retrieves the right-hand-side (Child)

uvm_cause_effect_link

The uvm_cause_effect_link is used to represent a Cause/Effect relationship between two objects.

Summary
uvm_cause_effect_link
The uvm_cause_effect_link is used to represent a Cause/Effect relationship between two objects.
Class Hierarchy
uvm_cause_effect_link
Class Declaration
class uvm_cause_effect_link extends uvm_link_base
newConstructor
get_linkConstructs a pre-filled link
Implementation Callbacks
do_set_lhsSets the left-hand-side (Cause)
do_get_lhsRetrieves the left-hand-side (Cause)
do_set_rhsSets the right-hand-side (Effect)
do_get_rhsRetrieves the right-hand-side (Effect)

new

function new(
    string  name  =  "unnamed-uvm_cause_effect_link"
)

Constructor

Parameters

nameInstance name

get_link

static function uvm_cause_effect_link get_link(
    uvm_object  lhs,   
    uvm_object  rhs,   
    string  name  =  "ce_link"
)

Constructs a pre-filled link

This allows for simple one-line link creations.

my_db.establish_link(uvm_cause_effect_link::get_link(record1, record2));

Parameters

lhsLeft hand side reference
rhsRight hand side reference
nameOptional name for the link object

do_set_lhs

virtual function void do_set_lhs(
    uvm_object  lhs
)

Sets the left-hand-side (Cause)

do_get_lhs

virtual function uvm_object do_get_lhs()

Retrieves the left-hand-side (Cause)

do_set_rhs

virtual function void do_set_rhs(
    uvm_object  rhs
)

Sets the right-hand-side (Effect)

do_get_rhs

virtual function uvm_object do_get_rhs()

Retrieves the right-hand-side (Effect)

uvm_related_link

The uvm_related_link is used to represent a generic “is related” link between two objects.

Summary
uvm_related_link
The uvm_related_link is used to represent a generic “is related” link between two objects.
Class Hierarchy
uvm_related_link
Class Declaration
class uvm_related_link extends uvm_link_base
newConstructor
get_linkConstructs a pre-filled link
Implementation Callbacks
do_set_lhsSets the left-hand-side
do_get_lhsRetrieves the left-hand-side
do_set_rhsSets the right-hand-side
do_get_rhsRetrieves the right-hand-side

new

function new(
    string  name  =  "unnamed-uvm_related_link"
)

Constructor

Parameters

nameInstance name

get_link

static function uvm_related_link get_link(
    uvm_object  lhs,   
    uvm_object  rhs,   
    string  name  =  "ce_link"
)

Constructs a pre-filled link

This allows for simple one-line link creations.

my_db.establish_link(uvm_related_link::get_link(record1, record2));

Parameters

lhsLeft hand side reference
rhsRight hand side reference
nameOptional name for the link object

do_set_lhs

virtual function void do_set_lhs(
    uvm_object  lhs
)

Sets the left-hand-side

do_get_lhs

virtual function uvm_object do_get_lhs()

Retrieves the left-hand-side

do_set_rhs

virtual function void do_set_rhs(
    uvm_object  rhs
)

Sets the right-hand-side

do_get_rhs

virtual function uvm_object do_get_rhs()

Retrieves the right-hand-side

virtual class uvm_link_base extends uvm_object
The uvm_link_base class presents a simple API for defining a link between any two objects.
virtual class uvm_tr_database extends uvm_object
The uvm_tr_database class is intended to hide the underlying database implementation from the end user, as these details are often vendor or tool-specific.
class uvm_parent_child_link extends uvm_link_base
The uvm_parent_child_link is used to represent a Parent/Child relationship between two objects.
class uvm_cause_effect_link extends uvm_link_base
The uvm_cause_effect_link is used to represent a Cause/Effect relationship between two objects.
class uvm_related_link extends uvm_link_base
The uvm_related_link is used to represent a generic “is related” link between two objects.
virtual class uvm_void
The uvm_void class is the base class for all UVM classes.
virtual class uvm_object extends uvm_void
The uvm_object class is the base class for all UVM data and hierarchical classes.
function new(
    string  name  =  "unnamed-uvm_link_base"
)
Constructor
function void set_lhs(
    uvm_object  lhs
)
Sets the left-hand-side of the link
function uvm_object get_lhs()
Gets the left-hand-side of the link
function void set_rhs(
    uvm_object  rhs
)
Sets the right-hand-side of the link
function uvm_object get_rhs()
Gets the right-hand-side of the link
function void set(
    uvm_object  lhs,
      rhs
)
Convenience method for setting both sides in one call.
pure virtual function void do_set_lhs(
    uvm_object  lhs
)
Callback for setting the left-hand-side
pure virtual function uvm_object do_get_lhs()
Callback for retrieving the left-hand-side
pure virtual function void do_set_rhs(
    uvm_object  rhs
)
Callback for setting the right-hand-side
pure virtual function uvm_object do_get_rhs()
Callback for retrieving the right-hand-side
function new(
    string  name  =  "unnamed-uvm_parent_child_link"
)
Constructor
static function uvm_parent_child_link get_link(
    uvm_object  lhs,   
    uvm_object  rhs,   
    string  name  =  "pc_link"
)
Constructs a pre-filled link
virtual function void do_set_lhs(
    uvm_object  lhs
)
Sets the left-hand-side (Parent)
virtual function uvm_object do_get_lhs()
Retrieves the left-hand-side (Parent)
virtual function void do_set_rhs(
    uvm_object  rhs
)
Sets the right-hand-side (Child)
virtual function uvm_object do_get_rhs()
Retrieves the right-hand-side (Child)
function new(
    string  name  =  "unnamed-uvm_cause_effect_link"
)
Constructor
static function uvm_cause_effect_link get_link(
    uvm_object  lhs,   
    uvm_object  rhs,   
    string  name  =  "ce_link"
)
Constructs a pre-filled link
virtual function void do_set_lhs(
    uvm_object  lhs
)
Sets the left-hand-side (Cause)
virtual function uvm_object do_get_lhs()
Retrieves the left-hand-side (Cause)
virtual function void do_set_rhs(
    uvm_object  rhs
)
Sets the right-hand-side (Effect)
virtual function uvm_object do_get_rhs()
Retrieves the right-hand-side (Effect)
function new(
    string  name  =  "unnamed-uvm_related_link"
)
Constructor
static function uvm_related_link get_link(
    uvm_object  lhs,   
    uvm_object  rhs,   
    string  name  =  "ce_link"
)
Constructs a pre-filled link
virtual function void do_set_lhs(
    uvm_object  lhs
)
Sets the left-hand-side
virtual function uvm_object do_get_lhs()
Retrieves the left-hand-side
virtual function void do_set_rhs(
    uvm_object  rhs
)
Sets the right-hand-side
virtual function uvm_object do_get_rhs()
Retrieves the right-hand-side