Resources

A resource is a parameterized container that holds arbitrary data.  Resources can be used to configure components, supply data to sequences, or enable sharing of information across disparate parts of a testbench.  They are stored using scoping information so their visibility can be constrained to certain parts of the testbench.  Resource containers can hold any type of data, constrained only by the data types available in SystemVerilog.  Resources can contain scalar objects, class handles, queues, lists, or even virtual interfaces.

Resources are stored in a resource database so that each resource can be retrieved by name or by type.  The databse has both a name table and a type table and each resource is entered into both.  The database is globally accessible.

Each resource has a set of scopes over which it is visible.  The set of scopes is represented as a regular expression.  When a resource is looked up the scope of the entity doing the looking up is supplied to the lookup function.  This is called the current scope.  If the current scope is in the set of scopes over which a resource is visible then the resource can be retuned in the lookup.

Resources can be looked up by name or by type.  To support type lookup each resource has a static type handle that uniquely identifies the type of each specialized resource container.

Mutliple resources that have the same name are stored in a queue.  Each resource is pushed into a queue with the first one at the front of the queue and each subsequent one behind it.  The same happens for multiple resources that have the same type.  The resource queues are searched front to back, so those placed earlier in the queue have precedence over those placed later.

The precedence of resources with the same name or same type can be altered.  One way is to set the precedence member of the resource container to any arbitrary value.  The search algorithm will return the resource with the highest precedence.  In the case where there are multiple resources that match the search criteria and have the same (highest) precedence, the earliest one located in the queue will be one returned.  Another way to change the precedence is to use the set_priority function to move a resource to either the front or back of the queue.

The classes defined here form the low level layer of the resource database.  The classes include the resource container and the database that holds the containers.  The following set of classes are defined here:

uvm_resource_types: A class without methods or members, only typedefs and enums.  These types and enums are used throughout the resources facility.  Putting the types in a class keeps them confined to a specific name space.

uvm_resource_options: policy class for setting options, such as auditing, which effect resources.

uvm_resource_base: the base (untyped) resource class living in the resource database.  This class includes the interface for locking, setting a resource as read-only, notification, scope management, altering search priority, and managing auditing.

uvm_resource#(T): parameterized resource container.  This class includes the interfaces for reading and writing each resource.  Because the class is parameterized, all the access functions are type sace.

uvm_resource_pool: the resource database.  This is a singleton class object.

Contents
ResourcesA resource is a parameterized container that holds arbitrary data.
uvm_resource_typesProvides typedefs and enums used throughout the resources facility.
uvm_resource_optionsProvides a namespace for managing options for the resources facility.
uvm_resource_baseNon-parameterized base class for resources.
uvm_resource_poolThe global (singleton) resource database.
uvm_resource #(T)Parameterized resource.

uvm_resource_types

Provides typedefs and enums used throughout the resources facility.  This class has no members or methods, only typedefs.  It’s used in lieu of package-scope types.  When needed, other classes can use these types by prefixing their usage with uvm_resource_types::.  E.g.

uvm_resource_types::rsrc_q_t queue;
Summary
uvm_resource_types
Provides typedefs and enums used throughout the resources facility.
Class Declaration
class uvm_resource_types

uvm_resource_options

Provides a namespace for managing options for the resources facility.  The only thing allowed in this class is static local data members and static functions for manipulating and retrieving the value of the data members.  The static local data members represent options and settings that control the behavior of the resources facility.

Summary
uvm_resource_options
Provides a namespace for managing options for the resources facility.
Methods
turn_on_auditingTurn auditing on for the resource database.
turn_off_auditingTurn auditing off for the resource database.
is_auditingReturns 1 if the auditing facility is on and 0 if it is off.

turn_on_auditing

static function void turn_on_auditing()

Turn auditing on for the resource database.  This causes all reads and writes to the database to store information about the accesses.

turn_off_auditing

static function void turn_off_auditing()

Turn auditing off for the resource database.  If auditing is it is not possible to get extra information about resource database accesses.

is_auditing

static function bit is_auditing()

Returns 1 if the auditing facility is on and 0 if it is off.

uvm_resource_base

Non-parameterized base class for resources.  Supports interfaces for locking/unlocking, scope matching, and virtual functions for printing the resource and for printing the accessor list

Summary
uvm_resource_base
Non-parameterized base class for resources.
Class Hierarchy
uvm_resource_base
Class Declaration
virtual class uvm_resource_base extends uvm_object
precedenceThis variable is used to associate a precedence that a resource has with respect to other resources which match the same scope and name.
default_precedenceThe default precedence for an resource that has been created.
newconstructor for uvm_resource_base.
get_type_handlePure virtual function that returns the type handle of the resource container.
Locking InterfaceThe task lock and the functions try_lock and unlock form a locking interface for resources.
lockRetrieves a lock for this resource.
try_lockRetrives the lock for this resource.
unlockReleases the lock held by this semaphore.
Read-only Interface
set_read_onlyEstablishes this resource as a read-only resource.
is_read_onlyRetruns one if this resource has been set to read-only, zero otherwise
Notification
wait_modifiedThis task blocks until the resource has been modified -- that is, a uvm_resource#(T)::write operation has been performed.
Scope InterfaceEach resource has a name, a value and a set of scopes over which it is visible.
set_scopeSet the value of the regular expression that identifies the set of scopes over which this resource is visible.
get_scopeRetrieve the regular expression string that identifies the set of scopes over which this resource is visible.
match_scopeUsing the regular expression facility, determine if this resource is visible in a scope.
PriorityFunctions for manipulating the search priority of resources.
set priorityChange the search priority of the resource based on the value of the priority enum argument.
Utility Functions
do_printImplementation of do_print which is called by print().
Audit TrailTo find out what is happening as the simulation proceeds, an audit trail of each read and write is kept.
print_accessorsDump the access records for this resource
init_access_recordInitalize a new access record

precedence

int unsigned precedence

This variable is used to associate a precedence that a resource has with respect to other resources which match the same scope and name.  Resources are set to the default_precedence initially, and may be set to a higher or lower precedence as desired.

default_precedence

static int unsigned default_precedence = 1000

The default precedence for an resource that has been created.  When two resources have the same precedence, the first resource found has precedence.

new

function new( string  name  =  "",
string  s  =  "*" )

constructor for uvm_resource_base.  The constructor takes two arguments, the name of the resource and a resgular expression which represents the set of scopes over which this resource is visible.

get_type_handle

pure virtual function uvm_resource_base get_type_handle()

Pure virtual function that returns the type handle of the resource container.

Locking Interface

The task lock and the functions try_lock and unlock form a locking interface for resources.  These can be used for thread-safe reads and writes.  The interface methods write_with_lock and read_with_lock and their nonblocking counterparts in uvm_resource#(T) (a family of resource subclasses) obey the lock when reading and writing.  See documentation in uvm_resource#(T) for more information on put/get.  The lock interface is a wrapper around a local semaphore.

lock

task lock()

Retrieves a lock for this resource.  The task blocks until the lock is obtained.

try_lock

function bit try_lock()

Retrives the lock for this resource.  The function is nonblocking, so it will return immediately.  If it was successfull in retrieving the lock then a one is returned, otherwise a zero is returned.

unlock

function void unlock()

Releases the lock held by this semaphore.

set_read_only

function void set_read_only()

Establishes this resource as a read-only resource.  An attempt to call uvm_resource#(T)::write on the resource will cause an error.

is_read_only

function bit is_read_only()

Retruns one if this resource has been set to read-only, zero otherwise

wait_modified

task wait_modified()

This task blocks until the resource has been modified -- that is, a uvm_resource#(T)::write operation has been performed.  When a uvm_resource#(T)::write is performed the modified bit is set which releases the block.  Wait_modified() then clears the modified bit so it can be called repeatedly.

Scope Interface

Each resource has a name, a value and a set of scopes over which it is visible.  A scope is a hierarchical entity or a context.  A scope name is a multi-element string that identifies a scope.  Each element refers to a scope context and the elements are separated by dots (.).

top.env.agent.monitor

Consider the example above of a scope name.  It consists of four elements: “top”, “env”, “agent”, and “monitor”.  The elements are strung together with a dot separating each element.  top.env.agent is the parent of top.env.agent.monitor, top.env is the parent of top.env.agent, and so on.  A set of scopes can be represented by a set of scope name strings.  A very straightforward way to represent a set of strings is to use regular expressions.  A regular expression is a special string that contains placeholders which can be substituted in various ways to generate or recognize a particular set of strings.  Here are a few simple examples:

 top\..*                   all of the scopes whose top-level component
                        is top
top\.env\..*\.monitor  all of the scopes in env that end in monitor;
                        i.e. all the monitors two levels down from env
.*\.monitor                all of the scopes that end in monitor; i.e.
                        all the monitors (assuming a naming convention
                        was used where all monitors are named "monitor")
top\.u[1-5]\.*         all of the scopes rooted and named u1, u2, u3,

u4, or u5, and any of their subscopes.

The examples above use posix regular expression notation.  This is a very general and expressive notation.  It is not always the case that so much expressiveness is required.  Sometimes an expression syntax that is easy to read and easy to write is useful, even if the syntax is not as expressive as the full power of posix regular expressions.  A popular substitute for regular expressions is globs.  A glob is a simplified regular expression.  It only has three metacharacters -- *, +, and ?.  Character ranges are not allowed and dots are not a metacharacter in globs as they are in regular expressions.  The following table shows glob metacharacters.

char meaning                 regular expression
                              equivalent
*        0 or more characters    .*
+        1 or more characters    .+
?        exactly one character   .

Of the examples above, the first three can easily be translated into globs.  The last one cannot.  It relies on notation that is not available in glob syntax.

regular expression     glob equivalent
---------------------      ------------------
top\..*                top.*
top\.env\..*\.monitor      top.env.*.monitor
.*\.monitor                *.monitor

The resource facility supports both regular expression and glob syntax.  Regular expressions are identified as such when they surrounded by ‘/’ characters.  For example, /^top\.*/ is interpreted as the regular expression ^top\.*, where the surrounding ‘/’ characters have been removed.  All other expressions are treated as glob expressions.  They are converted from glob notation to regular expression notation internally.  Regular expression compilation and matching as well as glob-to-regular expression conversion are handled by three DPI functions:

function int uvm_re_match(string re, string str);
function void uvm_dump_re_cache();
function string uvm_glob_to_re(string glob);

uvm_re_match both compiles and matches the regular expression.  It uses internal caching of compiled information so that each match does not necessarily require a new compilation of the regular expression string.  All of the matching is done using regular expressions, so globs are converted to regular expressions and then processed.

set_scope

function void set_scope( string  s )

Set the value of the regular expression that identifies the set of scopes over which this resource is visible.  If the supplied argument is a glob it will be converted to a regular expression before it is stored.

get_scope

function string get_scope()

Retrieve the regular expression string that identifies the set of scopes over which this resource is visible.

match_scope

function bit match_scope( string  s )

Using the regular expression facility, determine if this resource is visible in a scope.  Return one if it is, zero otherwise.

Priority

Functions for manipulating the search priority of resources.  The function definitions here are pure virtual and are implemented in derived classes.  The definitons serve as a priority management interface.

set priority

Change the search priority of the resource based on the value of the priority enum argument.

do_print

function void do_print ( uvm_printer  printer )

Implementation of do_print which is called by print().

Audit Trail

To find out what is happening as the simulation proceeds, an audit trail of each read and write is kept.  The read and write methods in uvm_resource#(T) each take an accessor argument.  This is a handle to the object that performed that resource access.

function T read(uvm_object accessor = null);
function void write(T t, uvm_object accessor = null);

The accessor can by anything as long as it is derived from uvm_object.  The accessor object can be a component or a sequence or whatever object from which a read or write was invoked.  Typically the this handle is used as the accessor.  For example:

uvm_resource#(int) rint;
int i;
...
rint.write(7, this);
i = rint.read(this);

The accessor’s get_full_name() is stored as part of the audit trail.  This way you can find out what object performed each resource access.  Each audit record also includes the time of the access (simulation time) and the particular operation performed (read or write).

Auditting is controlled through the uvm_resource_options class.

print_accessors

virtual function void print_accessors()

Dump the access records for this resource

init_access_record

function void init_access_record (
    inout uvm_resource_types:: access_t  access_record
)

Initalize a new access record

uvm_resource_pool

The global (singleton) resource database.

Each resource is stored both by primary name and by type handle.  The resource pool contains two associative arrays, one with name as the key and one with the type handle as the key.  Each associative array contains a queue of resources.  Each resource has a regular expression that represents the set of scopes over with it is visible.

+------+------------+                          +------------+------+
| name | rsrc queue |                          | rsrc queue | type |
+------+------------+                          +------------+------+
|      |            |                          |            |      |
+------+------------+                  +-+-+   +------------+------+
|      |            |                  | | |<--+---*        |  T   |
+------+------------+   +-+-+          +-+-+   +------------+------+
|  A   |        *---+-->| | |           |      |            |      |
+------+------------+   +-+-+           |      +------------+------+
|      |            |      |            |      |            |      |
+------+------------+      +-------+  +-+      +------------+------+
|      |            |              |  |        |            |      |
+------+------------+              |  |        +------------+------+
|      |            |              V  V        |            |      |
+------+------------+            +------+      +------------+------+
|      |            |            | rsrc |      |            |      |
+------+------------+            +------+      +------------+------+

The above diagrams illustrates how a resource whose name is A and type is T is stored in the pool.  The pool contains an entry in the type map for type T and an entry in the name map for name A.  The queues in each of the arrays each contain an entry for the resource A whose type is T.  The name map can contain in its queue other resources whose name is A which may or may not have the same type as our resource A.  Similarly, the type map can contain in its queue other resources whose type is T and whose name may or may not be A.

Resources are added to the pool by calling set; they are retrieved from the pool by calling get_by_name or get_by_type.  When an object creates a new resource and calls set the resource is made available to be retrieved by other objects outside of itsef; an object gets a resource when it wants to access a resource not currently available in its scope.

The scope is stored in the resource itself (not in the pool) so whether you get by name or by type the resource’s visibility is the same.

As an auditing capability, the pool contains a history of gets.  A record of each get, whether by get_by_type or get_by_name, is stored in the audit record.  Both successful and failed gets are recorded.  At the end of simulation, or any time for that matter, you can dump the history list.  This will tell which resources were successfully located and which were not.  You can use this information to determine if there is some error in name, type, or scope that has caused a resource to not be located or to be incorrrectly located (i.e. the wrong resource is located).

Summary
uvm_resource_pool
The global (singleton) resource database.
Class Declaration
class uvm_resource_pool
getReturns the singleton handle to the resource pool
spell_checkInvokes the spell checker for a string s.
Set
setAdd a new resource to the resource pool.
set_overrideThe resource provided as an argument will be entered into the pool and will override both by name and type.
set_name_overrideThe resource provided as an argument will entered into the pool using normal precedence in the type map and will override the name.
set_type_overrideThe resource provided as an argument will be entered into the pool using noraml precedence in the name map and will override the type.
LookupThis group of functions is for finding resources in the resource database.
lookup_nameLookup resources by name.
get_highest_precedenceTraverse a queue, q, of resources and return the one with the highest precedence.
get_by_nameLookup a resource by name and scope.
lookup_typeLookup resources by type.
get_by_typeLookup a resource by type_handle and scope.
lookup_regex_namesThis utility function answers the question, for a given name and scope, what are all of the resources with a matching name (where the resource name may be a regular expression) and a matching scope (where the resoucre scope may be a regular expression).
lookup_regexLooks for all the resources whose name matches the regular expression argument and whose scope matches the current scope.
lookup_scopeThis is a utility function that answers the question: For a given scope, what resources are visible to it? 
Set PriorityFunctions for altering the search priority of resources.
set_priority_typeChange the priority of the rsrc based on the value of pri, the priority enum argument.
set_priority_nameChange the priority of the rsrc based on the value of pri, the priority enum argument.
set_priorityChange the search priority of the rsrc based on the value of pri, the priority enum argument.
Debug
find_unused_resourcesLocate all the resources that have at least one write and no reads
print_resourcesPrint the resources that are in a single queue, rq.
dumpdump the entire resource pool.

get

static function uvm_resource_pool get()

Returns the singleton handle to the resource pool

spell_check

function bit spell_check( string  s )

Invokes the spell checker for a string s.  The universe of correctly spelled strings -- i.e. the dictionary -- is the name map.

set

function void set ( uvm_resource_base  rsrc,

Add a new resource to the resource pool.  The resource is inserted into both the name map and type map so it can be located by either.

An object creates a resources and sets it into the resource pool.  Later, other objects that want to access the resource must get it from the pool

Overrides can be specified using this interface.  Either a name override, a type override or both can be specified.  If an override is specified then the resource is entered at the front of the queue instead of at the back.  It is not recommended that users specify the override paramterer directly, rather they use the set_override, set_name_override, or set_type_override functions.

set_override

function void set_override( uvm_resource_base  rsrc )

The resource provided as an argument will be entered into the pool and will override both by name and type.

set_name_override

function void set_name_override( uvm_resource_base  rsrc )

The resource provided as an argument will entered into the pool using normal precedence in the type map and will override the name.

set_type_override

function void set_type_override( uvm_resource_base  rsrc )

The resource provided as an argument will be entered into the pool using noraml precedence in the name map and will override the type.

Lookup

This group of functions is for finding resources in the resource database.

lookup_name and lookup_type locate the set of resources that matches the name or type (respectively) and is visible in the current scope.  These functions return a queue of resources.

get_highest_precedence traverese a queue of resources and returns the one with the highest precedence -- i.e. the one whose precedence member has the highest value.

get_by_name and get_by_type use lookup_name and lookup_type (respectively) and get_highest_precedence to find the resource with the highest priority that matches the other search criteria.

lookup_name

function uvm_resource_types::rsrc_q_t lookup_name( string  scope  =  "",
string  name,   
bit  rpterr  =  1 )

Lookup resources by name.  Returns a queue of resources that match the name and scope.  If no resources match the queue is returned empty.  If rpterr is set then a warning is issued if no matches are found, and the spell checker is invoked on name.

get_highest_precedence

function uvm_resource_base get_highest_precedence(
    ref uvm_resource_types:: rsrc_q_t  q
)

Traverse a queue, q, of resources and return the one with the highest precedence.  In the case where there exists more than one resource with the highest precedence value, the first one that has that precedence will be the one that is returned.

get_by_name

function uvm_resource_base get_by_name( string  scope  =  "",
string  name,   
bit  rpterr  =  1 )

Lookup a resource by name and scope.  Whether the get succeeds or fails, save a record of the get attempt.  The rpterr flag indicates whether to report errors or not.  Essentially, it serves as a verbose flag.  If set then the spell checker will be invoked and warnings about multiple resources will be produced.

lookup_type

function uvm_resource_types::rsrc_q_t lookup_type( string  scope  =  "",
uvm_resource_base  type_handle    )

Lookup resources by type.  Return a queue of resources that match the type_handle and scope.  If no resources match then the returned queue is empty.

get_by_type

function uvm_resource_base get_by_type( string  scope  =  "",
uvm_resource_base  type_handle    )

Lookup a resource by type_handle and scope.  Insert a record into the get history list whether or not the get succeeded.

lookup_regex_names

function uvm_resource_types::rsrc_q_t lookup_regex_names( string  scope,
string  name )

This utility function answers the question, for a given name and scope, what are all of the resources with a matching name (where the resource name may be a regular expression) and a matching scope (where the resoucre scope may be a regular expression).  name and scope are explicit values.

lookup_regex

function uvm_resource_types::rsrc_q_t lookup_regex( string  re,
  scope )

Looks for all the resources whose name matches the regular expression argument and whose scope matches the current scope.

lookup_scope

function uvm_resource_types::rsrc_q_t lookup_scope( string  scope )

This is a utility function that answers the question: For a given scope, what resources are visible to it?  Locate all the resources that are visible to a particular scope.  This operation could be quite expensive, as it has to traverse all of the resources in the database.

Set Priority

Functions for altering the search priority of resources.  Resources are stored in queues in the type and name maps.  When retrieving resoures, either by type or by name, the resource queue is search from front to back.  The first one that matches the search criteria is the one that is returned.  The set_priority functions let you change the order in which resources are searched.  For any particular resource, you can set its priority to UVM_HIGH, in which case the resource is moved to the front of the queue, or to UVM_LOW in which case the resource is moved to the back of the queue.

set_priority_type

function void set_priority_type( uvm_resource_base  rsrc,
uvm_resource_types:: priority_e  pri )

Change the priority of the rsrc based on the value of pri, the priority enum argument.  This function changes the priority only in the type map, leavint the name map untouched.

set_priority_name

function void set_priority_name( uvm_resource_base  rsrc,
uvm_resource_types:: priority_e  pri )

Change the priority of the rsrc based on the value of pri, the priority enum argument.  This function changes the priority only in the name map, leaving the type map untouched.

set_priority

function void set_priority ( uvm_resource_base  rsrc,
uvm_resource_types:: priority_e  pri )

Change the search priority of the rsrc based on the value of pri, the priority enum argument.  This function changes the priority in both the name and type maps.

find_unused_resources

function uvm_resource_types::rsrc_q_t find_unused_resources()

Locate all the resources that have at least one write and no reads

print_resources

function void print_resources( uvm_resource_types:: rsrc_q_t  rq,   
bit  audit  =  0 )

Print the resources that are in a single queue, rq.  This is a utility function that can be used to print any collection of resources stored in a queue.  The audit flag determines whether or not the audit trail is printed for each resource along with the name, value, and scope regular expression.

dump

function void dump( bit  audit  =  0 )

dump the entire resource pool.  The resource pool is traversed and each resource is printed.  The utility function print_resources() is used to initiate the printing.  If the audit bit is set then the audit trail is dumped for each resource.

uvm_resource #(T)

Parameterized resource.  Provides essential access methods to read from and write to the resource database.  Also provides locking access methods including.

Summary
uvm_resource #(T)
Parameterized resource.
Class Hierarchy
Class Declaration
class uvm_resource #(
    type  T  =  int
) extends uvm_resource_base
Type InterfaceResources can be identified by type using a static type handle.
get_typeStatic function that returns the static type handle.
get_type_handleReturns the static type handle of this resource in a polymorphic fashion.
Set/ Get Interfaceuvm_resource#(T) provides an interface for setting and getting a resources.
setSimply put this resource into the global resource pool
set_overridePut a resource into the global resource pool as an override.
get_by_namelooks up a resource by name in the name map.
get_by_typelooks up a resource by type_handle in the type map.
Read/ Write Interfaceread and write provide a type-safe interface for getting and setting the object in the resource container.
readReturn the object stored in the resource container.
writeModify the object stored in this resource container.
PriorityFunctions for manipulating the search priority of resources.
set priorityChange the search priority of the resource based on the value of the priority enum argument, pri.
Locking InterfaceThis interface is optional, you can choose to lock a resource or not.
read_with_loc;Locking version of read().
try_read_with_lockNonblocking form of read_with_lock().
write_with_lockLocking form of write().
try_write_with_lockNonblocking form of write_with_lock().
get_highest_precedenceIn a queue of resources, locate the first one with the highest precedence whose type is T.

Type Interface

Resources can be identified by type using a static type handle.  The parent class provides the virtual function interface get_type_handle.  Here we implement it by returning the static type handle.

get_type

static function this_type get_type()

Static function that returns the static type handle.  The return type is this_type, which is the type of the parameterized class.

get_type_handle

function uvm_resource_base get_type_handle()

Returns the static type handle of this resource in a polymorphic fashion.  The return type of get_type_handle() is uvm_resource_base.  This function is not static and therefore can only be used by instances of a parameterized resource.

Set/ Get Interface

uvm_resource#(T) provides an interface for setting and getting a resources.  Specifically, a resource can insert itself into the resource pool.  It doesn’t make sense for a resource to get itself, since you can’t call a funtion on a handle you don’t have.  However, a static get interface is provided as a convenience.  This obviates the need for the user to get a handle to the global resource pool as this is done for him here.

set

function void set()

Simply put this resource into the global resource pool

set_override

function void set_override(

Put a resource into the global resource pool as an override.  This means it gets put at the head of the list and is searched before other existing resources that occupy the same position in the name map or the type map.  The default is to override both the name and type maps.  However, using the override argument you can specify that either the name map or type map is overridden.

get_by_name

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

looks up a resource by name in the name map.  The first resource with the specified name that is visible in the specified scope is returned, if one exists.  The rpterr flag indicates whether or not an error should be reported if the search fails.  If rpterr is set to one then a failure message is issued, including suggested spelling alternatives, based on resource names that exist in the database, gathered by the spell checker.

get_by_type

static function this_type get_by_type( string  scope  =  "",
uvm_resource_base  type_handle    )

looks up a resource by type_handle in the type map.  The first resource with the specified type_handle that is visible in the specified scope is returned, if one exists.  Null is returned if there is no resource matching the specifications.

Read/ Write Interface

read and write provide a type-safe interface for getting and setting the object in the resource container.  The interface is type safe because the value argument for write and the return value of read are T, the type supplied in the class parameter.  If either of these functions is used in an incorrect type context the compiler will complain.

read

function T read( uvm_object  accessor  =  null )

Return the object stored in the resource container.  If an accessor object is supplied then also update the accessor record for this resource.

write

function void write( t,   
uvm_object  accessor  =  null )

Modify the object stored in this resource container.  If the resource is read-only then issue an error message and return without modifying the object in the container.  If the resource is not read-only and an accessor object has been supplied then also update the accessor record.  Lastly, replace the object value in the container with the value supplied as the argument, t, and release any processes blocked on uvm_resource_base::wait_modified.

Priority

Functions for manipulating the search priority of resources.  These implementations of the interface defined in the base class delegate to the resource pool.

set priority

Change the search priority of the resource based on the value of the priority enum argument, pri.

Locking Interface

This interface is optional, you can choose to lock a resource or not.  These methods are wrappers around the read/write interface.  The difference between read/write interface and the locking interface is the use of a semaphore to guarantee exclusive access.

read_with_loc;

Locking version of read().  Like read(), this returns the contents of the resource container.  In addtion it obeys the lock.

try_read_with_lock

function bit try_read_with_lock( output  t,   
input  uvm_object  accessor  =  null )

Nonblocking form of read_with_lock().  If the lock is availble it grabs the lock and returns one.  If the lock is not available then it returns a 0.  In either case the return is immediate with no blocking.

write_with_lock

task write_with_lock ( input  t,   
uvm_object  accessor  =  null )

Locking form of write().  Like write(), write_with_lock() sets the contents of the resource container.  In addition it locks the resource before doing the write and unlocks it when the write is complete.  If the lock is currently not available write_with_lock() will block until it is.

try_write_with_lock

function bit try_write_with_lock( input  t,   
uvm_object  accessor  =  null )

Nonblocking form of write_with_lock().  If the lock is available then the write() occurs immediately and a one is returned.  If the lock is not available then the write does not occur and a zero is returned.  IN either case try_write_with_lock() returns immediately with no blocking.

get_highest_precedence

static function this_type get_highest_precedence(
    ref uvm_resource_types:: rsrc_q_t  q
)

In a queue of resources, locate the first one with the highest precedence whose type is T.  This function is static so that it can be called from anywhere.

class uvm_resource_types
Provides typedefs and enums used throughout the resources facility.
virtual class uvm_resource_base extends uvm_object
Non-parameterized base class for resources.
class uvm_resource_pool
The global (singleton) resource database.
class uvm_resource #( type  T  =  int ) extends uvm_resource_base
Parameterized resource.
Provides a namespace for managing options for the resources facility.
static function void turn_on_auditing()
Turn auditing on for the resource database.
static function void turn_off_auditing()
Turn auditing off for the resource database.
static function bit is_auditing()
Returns 1 if the auditing facility is on and 0 if it is off.
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.
int unsigned precedence
This variable is used to associate a precedence that a resource has with respect to other resources which match the same scope and name.
static int unsigned default_precedence = 1000
The default precedence for an resource that has been created.
function new( string  name  =  "",
string  s  =  "*" )
constructor for uvm_resource_base.
pure virtual function uvm_resource_base get_type_handle()
Pure virtual function that returns the type handle of the resource container.
task lock()
Retrieves a lock for this resource.
function bit try_lock()
Retrives the lock for this resource.
function void unlock()
Releases the lock held by this semaphore.
function void set_read_only()
Establishes this resource as a read-only resource.
function bit is_read_only()
Retruns one if this resource has been set to read-only, zero otherwise
task wait_modified()
This task blocks until the resource has been modified -- that is, a uvm_resource#(T)::write operation has been performed.
function void write( t,   
uvm_object  accessor  =  null )
Modify the object stored in this resource container.
function void set_scope( string  s )
Set the value of the regular expression that identifies the set of scopes over which this resource is visible.
function string get_scope()
Retrieve the regular expression string that identifies the set of scopes over which this resource is visible.
function bit match_scope( string  s )
Using the regular expression facility, determine if this resource is visible in a scope.
function void do_print ( uvm_printer  printer )
Implementation of do_print which is called by print().
virtual function void print_accessors()
Dump the access records for this resource
function void init_access_record (
    inout uvm_resource_types:: access_t  access_record
)
Initalize a new access record
static function uvm_resource_pool get()
Returns the singleton handle to the resource pool
function bit spell_check( string  s )
Invokes the spell checker for a string s.
function void set ( uvm_resource_base  rsrc,
Add a new resource to the resource pool.
function void set_override( uvm_resource_base  rsrc )
The resource provided as an argument will be entered into the pool and will override both by name and type.
function void set_name_override( uvm_resource_base  rsrc )
The resource provided as an argument will entered into the pool using normal precedence in the type map and will override the name.
function void set_type_override( uvm_resource_base  rsrc )
The resource provided as an argument will be entered into the pool using noraml precedence in the name map and will override the type.
function uvm_resource_types::rsrc_q_t lookup_name( string  scope  =  "",
string  name,   
bit  rpterr  =  1 )
Lookup resources by name.
function uvm_resource_base get_highest_precedence(
    ref uvm_resource_types:: rsrc_q_t  q
)
Traverse a queue, q, of resources and return the one with the highest precedence.
function uvm_resource_base get_by_name( string  scope  =  "",
string  name,   
bit  rpterr  =  1 )
Lookup a resource by name and scope.
function uvm_resource_types::rsrc_q_t lookup_type( string  scope  =  "",
uvm_resource_base  type_handle    )
Lookup resources by type.
function uvm_resource_base get_by_type( string  scope  =  "",
uvm_resource_base  type_handle    )
Lookup a resource by type_handle and scope.
function uvm_resource_types::rsrc_q_t lookup_regex_names( string  scope,
string  name )
This utility function answers the question, for a given name and scope, what are all of the resources with a matching name (where the resource name may be a regular expression) and a matching scope (where the resoucre scope may be a regular expression).
function uvm_resource_types::rsrc_q_t lookup_regex( string  re,
  scope )
Looks for all the resources whose name matches the regular expression argument and whose scope matches the current scope.
function uvm_resource_types::rsrc_q_t lookup_scope( string  scope )
This is a utility function that answers the question: For a given scope, what resources are visible to it? 
function void set_priority_type( uvm_resource_base  rsrc,
uvm_resource_types:: priority_e  pri )
Change the priority of the rsrc based on the value of pri, the priority enum argument.
function void set_priority_name( uvm_resource_base  rsrc,
uvm_resource_types:: priority_e  pri )
Change the priority of the rsrc based on the value of pri, the priority enum argument.
function void set_priority ( uvm_resource_base  rsrc,
uvm_resource_types:: priority_e  pri )
Change the search priority of the rsrc based on the value of pri, the priority enum argument.
function uvm_resource_types::rsrc_q_t find_unused_resources()
Locate all the resources that have at least one write and no reads
function void print_resources( uvm_resource_types:: rsrc_q_t  rq,   
bit  audit  =  0 )
Print the resources that are in a single queue, rq.
function void dump( bit  audit  =  0 )
dump the entire resource pool.
static function this_type get_type()
Static function that returns the static type handle.
function uvm_resource_base get_type_handle()
Returns the static type handle of this resource in a polymorphic fashion.
function void set()
Simply put this resource into the global resource pool
function void set_override(
Put a resource into the global resource pool as an override.
static function this_type get_by_name( string  scope,   
string  name,   
bit  rpterr  =  1 )
looks up a resource by name in the name map.
static function this_type get_by_type( string  scope  =  "",
uvm_resource_base  type_handle    )
looks up a resource by type_handle in the type map.
function T read( uvm_object  accessor  =  null )
Return the object stored in the resource container.
function bit try_read_with_lock( output  t,   
input  uvm_object  accessor  =  null )
Nonblocking form of read_with_lock().
task write_with_lock ( input  t,   
uvm_object  accessor  =  null )
Locking form of write().
function bit try_write_with_lock( input  t,   
uvm_object  accessor  =  null )
Nonblocking form of write_with_lock().
static function this_type get_highest_precedence(
    ref uvm_resource_types:: rsrc_q_t  q
)
In a queue of resources, locate the first one with the highest precedence whose type is T.