UVM Configuration Database

UVMkit » 1800.2-2017
Summary
UVM Configuration Database
IntroThe <uvm_config_db> class provides a convenience interface on top of the uvm_resource_db to simplify the basic interface that is used for configuring uvm_component instances.
Methods
getGet the value for field_name in inst_name, using component cntxt as the starting search point.
setCreate a new or update an existing configuration setting for field_name in inst_name from cntxt.
existsCheck if a value for field_name is available in inst_name, using component cntxt as the starting search point.
wait_modifiedWait for a configuration setting to be set for field_name in cntxt and inst_name.

Intro

The <uvm_config_db> class provides a convenience interface on top of the uvm_resource_db to simplify the basic interface that is used for configuring uvm_component instances.

If the run-time +UVM_CONFIG_DB_TRACE command line option is specified, all configuration DB accesses (read and write) are displayed.

get

static function bit get( uvm_component  cntxt,
string  inst_name,
string  field_name,
inout  value )

Get the value for field_name in inst_name, using component cntxt as the starting search point.  inst_name is an explicit instance name relative to cntxt and may be an empty string if the cntxt is the instance that the configuration object applies to.  field_name is the specific field in the scope that is being searched for.

The basic get_config_* methods from uvm_component are mapped to this function as:

get_config_int(...) => uvm_config_db#(uvm_bitstream_t)::get(cntxt,...)
get_config_string(...) => uvm_config_db#(string)::get(cntxt,...)
get_config_object(...) => uvm_config_db#(uvm_object)::get(cntxt,...)

set

static function void set( uvm_component  cntxt,
string  inst_name,
string  field_name,
value )

Create a new or update an existing configuration setting for field_name in inst_name from cntxt.  The setting is made at cntxt, with the full scope of the set being {cntxt,”.”,~inst_name~}.  If cntxt is null then inst_name provides the complete scope information of the setting.  field_name is the target field.  Both inst_name and field_name may be glob style or regular expression style expressions.

If a setting is made at build time, the cntxt hierarchy is used to determine the setting’s precedence in the database.  Settings from hierarchically higher levels have higher precedence.  Settings from the same level of hierarchy have a last setting wins semantic.  A precedence setting of uvm_resource_base::default_precedence is used for uvm_top, and each hierarchical level below the top is decremented by 1.

After build time, all settings use the default precedence and thus have a last wins semantic.  So, if at run time, a low level component makes a runtime setting of some field, that setting will have precedence over a setting from the test level that was made earlier in the simulation.

The basic set_config_* methods from uvm_component are mapped to this function as:

set_config_int(...) => uvm_config_db#(uvm_bitstream_t)::set(cntxt,...)
set_config_string(...) => uvm_config_db#(string)::set(cntxt,...)
set_config_object(...) => uvm_config_db#(uvm_object)::set(cntxt,...)

exists

static function bit exists( uvm_component  cntxt,   
string  inst_name,   
string  field_name,   
bit  spell_chk  =  )

Check if a value for field_name is available in inst_name, using component cntxt as the starting search point.  inst_name is an explicit instance name relative to cntxt and may be an empty string if the cntxt is the instance that the configuration object applies to.  field_name is the specific field in the scope that is being searched for.  The spell_chk arg can be set to 1 to turn spell checking on if it is expected that the field should exist in the database.  The function returns 1 if a config parameter exists and 0 if it doesn’t exist.

wait_modified

static task wait_modified( uvm_component  cntxt,
string  inst_name,
string  field_name )

Wait for a configuration setting to be set for field_name in cntxt and inst_name.  The task blocks until a new configuration setting is applied that effects the specified field.

Types

Summary
Types
uvm_config_intConvenience type for uvm_config_db#(uvm_bitstream_t)
uvm_config_stringConvenience type for uvm_config_db#(string)
uvm_config_objectConvenience type for uvm_config_db#(uvm_object)
uvm_config_wrapperConvenience type for uvm_config_db#(uvm_object_wrapper)

uvm_config_int

Convenience type for uvm_config_db#(uvm_bitstream_t)

typedef uvm_config_db#(uvm_bitstream_t) uvm_config_int;

uvm_config_string

Convenience type for uvm_config_db#(string)

typedef uvm_config_db#(string) uvm_config_string;

uvm_config_object

Convenience type for uvm_config_db#(uvm_object)

typedef uvm_config_db#(uvm_object) uvm_config_object;

uvm_config_wrapper

Convenience type for uvm_config_db#(uvm_object_wrapper)

typedef uvm_config_db#(uvm_object_wrapper) uvm_config_wrapper;

uvm_config_db_options

This class contains static functions for manipulating and retrieving options that control the behavior of the configuration DB facility.

@uvm-accellera The details of this API are specific to the Accellera implementation, and are not being considered for contribution to 1800.2

Summary
uvm_config_db_options
This class contains static functions for manipulating and retrieving options that control the behavior of the configuration DB facility.
Class Declaration
class uvm_config_db_options
Methods
turn_on_tracingTurn tracing on for the configuration database.
turn_off_tracingTurn tracing off for the configuration database.
is_tracingReturns 1 if the tracing facility is on and 0 if it is off.

turn_on_tracing

static function void turn_on_tracing()

Turn tracing on for the configuration database.  This causes all reads and writes to the database to display information about the accesses.  Tracing is off by default.

This method is implicitly called by the +UVM_CONFIG_DB_TRACE.

@uvm-accellera The details of this API are specific to the Accellera implementation, and are not being considered for contribution to 1800.2

turn_off_tracing

static function void turn_off_tracing()

Turn tracing off for the configuration database.

@uvm-accellera The details of this API are specific to the Accellera implementation, and are not being considered for contribution to 1800.2

is_tracing

static function bit is_tracing()

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

@uvm-accellera The details of this API are specific to the Accellera implementation, and are not being considered for contribution to 1800.2

class uvm_resource_db #( type  T  =  uvm_object )
Implementation of uvm_resource_db, as defined in section C.3.2.1 of 1800.2-2017.
virtual class uvm_component extends uvm_report_object
The library implements the following public API beyond what is documented in 1800.2.
static function bit get( uvm_component  cntxt,
string  inst_name,
string  field_name,
inout  value )
Get the value for field_name in inst_name, using component cntxt as the starting search point.
static function void set( uvm_component  cntxt,
string  inst_name,
string  field_name,
value )
Create a new or update an existing configuration setting for field_name in inst_name from cntxt.
static function bit exists( uvm_component  cntxt,   
string  inst_name,   
string  field_name,   
bit  spell_chk  =  )
Check if a value for field_name is available in inst_name, using component cntxt as the starting search point.
static task wait_modified( uvm_component  cntxt,
string  inst_name,
string  field_name )
Wait for a configuration setting to be set for field_name in cntxt and inst_name.
static int unsigned default_precedence = 1000
The default precedence for an resource that has been created.
class uvm_config_db_options
This class contains static functions for manipulating and retrieving options that control the behavior of the configuration DB facility.
static function void turn_on_tracing()
Turn tracing on for the configuration database.
static function void turn_off_tracing()
Turn tracing off for the configuration database.
static function bit is_tracing()
Returns 1 if the tracing facility is on and 0 if it is off.