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

UVMPool

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:

add(key: KEY, item: VAL) None[source]
num() int[source]
keys()[source]
key_list() List[KEY][source]
delete(key=None) None[source]
exists(key: KEY) bool[source]
last()[source]
has_first() bool[source]
has_last() bool[source]
first()[source]
has_next() bool[source]
next() Optional[KEY][source]
has_prev() bool[source]
prev() Optional[KEY][source]
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 by print and sprint 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 correct print and sprint operation, and to ensure a consistent output format, the printer must be used by all do_print implementations. That is, instead of using ~$display~ or string concatenations directly, a do_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 of UVMObject-based objects indexed by string. Specializations of this class include the UVMEventPool (a UVMObjectStringPool storing UVMEvent and UVMBarrierPool (a UVMObjectStringPool storing UVMBarrier).

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

str

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

UVMObjectStringPool

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