UVM Resource Database

UVMkit » 1800.2-2020
Summary
UVM Resource Database
IntroThe uvm_resource_db class provides a convenience interface for the resources facility.

Intro

The uvm_resource_db class provides a convenience interface for the resources facility.  In many cases basic operations such as creating and setting a resource or getting a resource could take multiple lines of code using the interfaces in uvm_resource_base or uvm_resource#(T).  The convenience layer in uvm_resource_db reduces many of those operations to a single line of code.

If the run-time +UVM_RESOURCE_DB_TRACE command line option is specified, all resource DB accesses (read and write) are displayed.

uvm_resource_db

Implementation of uvm_resource_db, as defined in section C.3.2.1 of 1800.2-2020.

class uvm_resource_db#(type T=uvm_object)
Summary
uvm_resource_db
Implementation of uvm_resource_db, as defined in section C.3.2.1 of 1800.2-2020.
Class Declaration
class uvm_resource_db #( type  T  =  uvm_object )
Methods
get_by_typeGet a resource by type.
get_by_nameImports a resource by name.
set_defaultadd a new item into the resources database.
dumpDump all the resources in the resource pool.

get_by_type

static function rsrc_t get_by_type( string  scope )

Get a resource by type.  The type is specified in the db class parameter so the only argument to this function is the scope.

get_by_name

static function rsrc_t get_by_name( string  scope,   
string  name,   
bit  rpterr  =  1 )

Imports a resource by name.  The first argument is the current scope of the resource to be retrieved and the second argument is the name.  The rpterr flag indicates whether or not to generate a warning if no matching resource is found.

set_default

static function rsrc_t set_default( string  scope,
string  name )

add a new item into the resources database.  The item will not be written to so it will have its default value.  The resource is created using name and scope as the lookup parameters.

dump

static function void dump()

Dump all the resources in the resource pool.  This is useful for debugging purposes.  This function does not use the parameter T, so it will dump the same thing -- the entire database -- no matter the value of the parameter.

class uvm_resource_db #( type  T  =  uvm_object )
Implementation of uvm_resource_db, as defined in section C.3.2.1 of 1800.2-2020.
Non-parameterized base class for resources.
class uvm_resource #( type  T  =  int ) extends uvm_resource_base
Implementation of uvm_resource#(T) as defined in section C.2.5.1 of 1800.2-2020.
static function rsrc_t get_by_type( string  scope )
Get a resource by type.
static function rsrc_t get_by_name( string  scope,   
string  name,   
bit  rpterr  =  1 )
Imports a resource by name.
static function rsrc_t set_default( string  scope,
string  name )
add a new item into the resources database.
static function void dump()
Dump all the resources in the resource pool.