Class uvm_pkg::uvm_resource_pool
Name |
Type |
Description |
---|---|---|
rtab |
||
ttab |
||
get_record |
history of gets |
Functions
- get()
Function
get
Returns the singleton handle to the resource pool
- Return type:
- spell_check(string s)
Function
spell_check
Invokes the spell checker for a string s. The universe of correctly spelled strings -- i.e. the dictionary -- is the name map.
- Parameters:
s (string)
- set(uvm_resource_base rsrc, uvm_resource_types::override_t override = 0)
Function
set
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 parameter directly, rather they use the set_override, set_name_override, or set_type_override functions.
- Parameters:
rsrc (uvm_resource_base)
override (uvm_resource_types::override_t)
- set_override(uvm_resource_base rsrc)
Function
set_override
The resource provided as an argument will be entered into the pool and will override both by name and type.
- Parameters:
rsrc (uvm_resource_base)
- set_name_override(uvm_resource_base rsrc)
Function
set_name_override
The resource provided as an argument will entered into the pool using normal precedence in the type map and will override the name.
- Parameters:
rsrc (uvm_resource_base)
- set_type_override(uvm_resource_base rsrc)
Function
set_type_override
The resource provided as an argument will be entered into the pool using normal precedence in the name map and will override the type.
- Parameters:
rsrc (uvm_resource_base)
- push_get_record(string name, string scope, uvm_resource_base rsrc)
-
function
-
push_get_record
- Parameters:
name (string)
scope (string)
rsrc (uvm_resource_base)
-
- dump_get_records()
-
function
-
dump_get_records
-
- lookup_name(string scope = "", string name, uvm_resource_base type_handle = null, bit rpterr = 1)
Function
lookup_name
Lookup resources by name . Returns a queue of resources that match the name , scope , and type_handle . 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 . If type_handle is null then a type check is not made and resources are returned that match only name and scope .
- Parameters:
scope (string)
name (string)
type_handle (uvm_resource_base)
rpterr (bit)
- Return type:
- get_highest_precedence(uvm_resource_types::rsrc_q_t q)
Function
get_highest_precedence
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.
- Parameters:
- Return type:
- sort_by_precedence(uvm_resource_types::rsrc_q_t q)
Function
sort_by_precedence
Given a list of resources, obtained for example from lookup_scope, sort the resources in precedence order. The highest precedence resource will be first in the list and the lowest precedence will be last. Resources that have the same precedence and the same name will be ordered by most recently set first.
- Parameters:
- get_by_name(string scope = "", string name, uvm_resource_base type_handle, bit rpterr = 1)
Function
get_by_name
Lookup a resource by name , scope , and type_handle . 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.
- Parameters:
scope (string)
name (string)
type_handle (uvm_resource_base)
rpterr (bit)
- Return type:
- lookup_type(string scope = "", uvm_resource_base type_handle)
Function
lookup_type
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.
- Parameters:
scope (string)
type_handle (uvm_resource_base)
- Return type:
- get_by_type(string scope = "", uvm_resource_base type_handle)
Function
get_by_type
Lookup a resource by type_handle and scope . Insert a record into the get history list whether or not the get succeeded.
- Parameters:
scope (string)
type_handle (uvm_resource_base)
- Return type:
- lookup_regex_names(string scope, string name, uvm_resource_base type_handle = null)
Function
lookup_regex_names
This utility function answers the question, for a given name , scope , and type_handle , what are all of the resources with requested name, a matching scope (where the resource scope may be a regular expression), and a matching type? name and scope are explicit values.
- Parameters:
scope (string)
name (string)
type_handle (uvm_resource_base)
- Return type:
- lookup_regex(string re, string scope)
Function
lookup_regex
Looks for all the resources whose name matches the regular expression argument and whose scope matches the current scope.
- Parameters:
re (string)
scope (string)
- Return type:
- lookup_scope(string scope)
Function
lookup_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.
- Parameters:
scope (string)
- Return type:
- set_priority_type(uvm_resource_base rsrc, uvm_resource_types::priority_e pri)
Function
set_priority_type
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, leaving the name map untouched.
- Parameters:
rsrc (uvm_resource_base)
- set_priority_name(uvm_resource_base rsrc, uvm_resource_types::priority_e pri)
Function
set_priority_name
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.
- Parameters:
rsrc (uvm_resource_base)
- set_priority(uvm_resource_base rsrc, uvm_resource_types::priority_e pri)
Function
set_priority
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.
- Parameters:
rsrc (uvm_resource_base)
- find_unused_resources()
Function
find_unused_resources
Locate all the resources that have at least one write and no reads
- Return type:
- print_resources(uvm_resource_types::rsrc_q_t rq, bit audit = 0)
Function
print_resources
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.
- Parameters:
audit (bit)
- dump(bit audit = 0)
Function
dump
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.
- Parameters:
audit (bit)
Class
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 which it is visible.
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 itself; 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 incorrectly located (i.e. the wrong resource is located).