# Pool Classes

This section defines the uvm_pool #(KEY, T) class and derivative.

Contents

Pool Classes | This section defines the uvm_pool #(KEY, T) class and derivative.
uvm_pool #(KEY,T) | Implements a class-based dynamic associative array.
uvm_object_string_pool #(T) | This provides a specialization of the generic uvm_pool #(KEY,T) class for an associative array of uvm_object-based objects indexed by string.

## uvm_pool #(KEY,T)

Implements a class-based dynamic associative array. Allows sparse arrays to be allocated on demand, and passed and stored by reference.

Summary

uvm_pool #(KEY,T)
Implements a class-based dynamic associative array.
Class Hierarchy
uvm_void
uvm_object
uvm_pool#(KEY,T)
Class Declaration
> class uvm_pool #(
> | type | KEY | = | int,
> |  | T | = | uvm_void
> ) extends uvm_object
Methods |
new | Creates a new pool with the given name.
get_global_pool | Returns the singleton global pool for the item type, T.
get_global | Returns the specified item instance from the global item pool.
get | Returns the item with the given key.
add | Adds the given (key, item) pair to the pool.
num | Returns the number of uniquely keyed items stored in the pool.
delete | Removes the item with the given key from the pool.
exists | Returns 1 if an item with the given key exists in the pool, 0 otherwise.
first | Returns the key of the first item stored in the pool.
last | Returns the key of the last item stored in the pool.
next | Returns the key of the next item in the pool.
prev | Returns the key of the previous item in the pool.

### Methods

### new

> function new (
> | string | name | = | ""
> )

Creates a new pool with the given name.

### get_global_pool

> static function this_type get_global_pool ()

Returns the singleton global pool for the item type, T.

This allows items to be shared amongst components throughout the verification environment.

### get_global

> static function T get_global (
> | KEY | key
> )

Returns the specified item instance from the global item pool.

### get

> virtual function T get (
> | KEY | key
> )

Returns the item with the given key.

If no item exists by that key, a new item is created with that key and returned.

### add

> virtual function void add (
> | KEY | key,
> | T | item
> )

Adds the given (key, item) pair to the pool. If an item already exists at the given key it is overwritten with the new item.

### num

> virtual function int num ()

Returns the number of uniquely keyed items stored in the pool.

### delete

> virtual function void delete (
> | KEY | key
> )

Removes the item with the given key from the pool.

### exists

> virtual function int exists (
> | KEY | key
> )

Returns 1 if an item with the given key exists in the pool, 0 otherwise.

### first

> virtual function int first (
> | ref | KEY | key
> )

Returns the key of the first item stored in the pool.

If the pool is empty, then key is unchanged and 0 is returned.

If the pool is not empty, then key is key of the first item and 1 is returned.

### last

> virtual function int last (
> | ref | KEY | key
> )

Returns the key of the last item stored in the pool.

If the pool is empty, then 0 is returned and key is unchanged.

If the pool is not empty, then key is set to the last key in the pool and 1 is returned.

### next

> virtual function int next (
> | ref | KEY | key
> )

Returns the key of the next item in the pool.

If the input key is the last key in the pool, then key is left unchanged and 0 is returned.

If a next key is found, then key is updated with that key and 1 is returned.

### prev

> virtual function int prev (
> | ref | KEY | key
> )

Returns the key of the previous item in the pool.

If the input key is the first key in the pool, then key is left unchanged and 0 is returned.

If a previous key is found, then key is updated with that key and 1 is returned.

## uvm_object_string_pool #(T)

This provides a specialization of the generic uvm_pool #(KEY,T) class for an associative array of uvm_object-based objects indexed by string. Specializations of this class include the uvm_event_pool (a uvm_object_string_pool storing uvm_event#(uvm_object)) and uvm_barrier_pool (a uvm_obejct_string_pool storing uvm_barrier).

Summary

uvm_object_string_pool #(T)
This provides a specialization of the generic uvm_pool #(KEY,T) class for an associative array of uvm_object-based objects indexed by string.
Class Hierarchy
uvm_pool#(string,T)
uvm_object_string_pool#(T)
Class Declaration
> class uvm_object_string_pool #(
> | type | T | = | uvm_object
> ) extends uvm_pool #(string,T)
Methods |
new | Creates a new pool with the given name.
get_type_name | Returns the type name of this object.
get_global_pool | Returns the singleton global pool for the item type, T.
get_global | Returns the specified item instance from the global item pool.
get | Returns the object item at the given string key.
delete | Removes the item with the given string key from the pool.

### Methods

### new

> function new (
> | string | name | = | ""
> )

Creates a new pool with the given name.

### get_type_name

> virtual function string get_type_name()

Returns the type name of this object.

### get_global_pool

> static function this_type get_global_pool ()

Returns the singleton global pool for the item type, T.

This allows items to be shared amongst components throughout the verification environment.

### get_global

> static function T get_global (
> | string | key
> )

Returns the specified item instance from the global item pool.

### get

> virtual function T get (
> | string | key
> )

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.

### delete

> virtual function void delete (
> | string | key
> )

Removes the item with the given string key from the pool.

> class uvm_pool #(
> | type | KEY | = | int,
> |  | T | = | uvm_void
> ) extends uvm_object

Implements a class-based dynamic associative array.

> class uvm_object_string_pool #(
> | type | T | = | uvm_object
> ) extends uvm_pool #(string,T)

This provides a specialization of the generic uvm_pool #(KEY,T) class for an associative array of uvm_object-based objects indexed by string.

> virtual class uvm_object extends uvm_void

The uvm_object class is the base class for all UVM data and hierarchical classes.

> virtual class uvm_void

The uvm_void class is the base class for all UVM classes.

> function new (
> | string | name | = | ""
> )

Creates a new pool with the given name.

> static function this_type get_global_pool ()

Returns the singleton global pool for the item type, T.

> static function T get_global (
> | KEY | key
> )

Returns the specified item instance from the global item pool.

> virtual function T get (
> | KEY | key
> )

Returns the item with the given key.

> virtual function void add (
> | KEY | key,
> | T | item
> )

Adds the given (key, item) pair to the pool.

> virtual function int num ()

Returns the number of uniquely keyed items stored in the pool.

> virtual function void delete (
> | KEY | key
> )

Removes the item with the given key from the pool.

> virtual function int exists (
> | KEY | key
> )

Returns 1 if an item with the given key exists in the pool, 0 otherwise.

> virtual function int first (
> | ref | KEY | key
> )

Returns the key of the first item stored in the pool.

> virtual function int last (
> | ref | KEY | key
> )

Returns the key of the last item stored in the pool.

> virtual function int next (
> | ref | KEY | key
> )

Returns the key of the next item in the pool.

> virtual function int prev (
> | ref | KEY | key
> )

Returns the key of the previous item in the pool.

> function new (
> | string | name | = | ""
> )

Creates a new pool with the given name.

> virtual function string get_type_name()

Returns the type name of this object.

> static function this_type get_global_pool ()

Returns the singleton global pool for the item type, T.

> static function T get_global (
> | string | key
> )

Returns the specified item instance from the global item pool.

> virtual function T get (
> | string | key
> )

Returns the object item at the given string key.

> virtual function void delete (
> | string | key
> )

Removes the item with the given string key from the pool.

> class uvm_barrier extends uvm_object

The uvm_barrier class provides a multiprocess synchronization mechanism.