uvm_pool¶
- class uvm.base.uvm_pool.UVMPool(name='', T=None)[source]¶
Bases:
UVMObject
,Generic
[KEY
,VAL
]Implements a class-based dynamic associative array. Allows sparse arrays to be allocated on demand, and passed and stored by reference.
- type_name = 'uvm_pool'¶
- m_global_pool = None¶
- classmethod get_global_pool() UVMPool [source]¶
Returns the singleton global pool. Unlike in SV, uvm-python has only one global pool.
This allows items to be shared amongst components throughout the verification environment.
- Returns
Single global pool
- Return type
- classmethod get_global(key) Any [source]¶
Returns the specified item instance from the global item pool.
- Parameters
key (str) –
- Returns
Item matching the given key.
- Return type
any
- get(key: KEY) VAL [source]¶
Function: get
Returns the item with the given
key
.If no item exists by that key, a new item is created with that key and returned. :param key:
Returns:
- create(name='') UVMPool [source]¶
Group: Creation
The
create
method allocates a new object of the same type as this object and returns it via a base uvm_object handle. Every class deriving from uvm_object, directly or indirectly, must implement the create method.A typical implementation is as follows:
class mytype (UVMObject): ... def create(self, name=""): mytype t = mytype(name) return t
- Parameters
name (str) – Name of the created object.
- Returns
New object.
- Return type
obj
- do_print(printer) None [source]¶
The
do_print
method is the user-definable hook called byprint
andsprint
that allows users to customize what gets printed or sprinted beyond the field information provided by the `uvm_field_* macros, <Utility and Field Macros for Components and Objects>.The
printer
argument is the policy object that governs the format and content of the output. To ensure correctprint
andsprint
operation, and to ensure a consistent output format, theprinter
must be used by alldo_print
implementations. That is, instead of using ~$display~ or string concatenations directly, ado_print
implementation must call through the ~printer’s~ API to add information to be printed or sprinted.An example implementation of
do_print
is as follows:class mytype (UVMObject): data_obj data int f1 virtual function void do_print (uvm_printer printer) super.do_print(printer) printer.print_field_int("f1", f1, $bits(f1), UVM_DEC) printer.print_object("data", data) endfunction
Then, to print and sprint the object, you could write:
t = mytype() t.print() uvm_report_info("Received",t.sprint())
See
UVMPrinter
for information about the printer API.- Parameters
printer (UVMPrinter) – Printer that is used in printing.
- class uvm.base.uvm_pool.UVMObjectStringPool(name='', Constr=<class 'uvm.base.uvm_object.UVMObject'>)[source]¶
Bases:
UVMPool
[str
,UVMObject
]This provides a specialization of the generic
UVMPool
class for an associative array ofUVMObject
-based objects indexed by string. Specializations of this class include theUVMEventPool
(aUVMObjectStringPool
storingUVMEvent
andUVMBarrierPool
(aUVMObjectStringPool
storingUVMBarrier
).- m_global_pool = None¶
- type_name = 'uvm_obj_str_pool'¶
- get_type_name() str [source]¶
Returns the type name of this object.
- Returns
Type name of this object.
- Return type
- classmethod get_global_pool() UVMObjectStringPool [source]¶
Returns the singleton global pool.
This allows objects to be shared amongst components throughout the verification environment.
- Returns
Global pool
- Return type
- classmethod get_global(key: str) UVMObject [source]¶
Returns the specified item instance from the global item pool.
- Parameters
key (str) – Key used for getting the item from global pool.
- Returns
Object matching the key in the global pool.
- Return type
any
- get(key: str) UVMObject [source]¶
Returns the object item at the given string
key
.If no item exists by the given
key
, a new item is created for that key and returned.- Parameters
key (str) – Key used for getting the item.
- Returns
Item matching the key. If no match, returns new object.
- Return type
any
- delete(key: str) None [source]¶
Removes the item with the given string
key
from the pool.- Parameters
key (str) – Key used for removing the item.
- do_print(printer) None [source]¶
Function- do_print
- Parameters
printer (UVMPrinter) – Printer used for printing
- class uvm.base.uvm_pool.UVMEventPool(name='')[source]¶
Bases:
UVMObjectStringPool
- class uvm.base.uvm_pool.UVMBarrierPool(name='')[source]¶
Bases:
UVMObjectStringPool