uvm_config_db¶
Title: UVM Configuration Database
Topic: Intro
Avoid using UVMConfigDb if possible. Instead, group the configuration values
into configuration objects (object per agent), and use hierarchical
configuration objects for passing the configuration from test-level to
env-level, and from there to agents and other sub-components.
The UVMConfigDb class provides a convenience interface
on top of the UVMResourceDb to simplify the basic interface
that is used for configuring UVMComponent instances.
If the run-time +UVM_CONFIG_DB_TRACE command line option is specified,
all configuration DB accesses (read and write) are displayed.
NOTE: UVMConfigDb is not required for passing interfaces to the verification
components. In uvm-python, you can use run_test(..., dut=dut) inside your @cocotb.test()
function instead.
- class uvm.base.uvm_config_db.UVMConfigDb(T=None)[source]¶
Bases:
UVMResourceDbAll of the functions in UVMConfigDb are static, so they must be called using the classname. For example:
UVMConfigDb.set(self, “*”, “A”);
The parameter value “int” identifies the configuration type as an int property.
The
UVMConfigDb.setandUVMConfigDb.getmethods provide the same API and semantics as the set/get_config_* functions inUVMComponent.- m_rsc = {}¶
- m_waiters = {}¶
- classmethod get(cntxt, inst_name, field_name, value, T=None)[source]¶
Get the value for
field_nameininst_name, using componentcntxtas the starting search point.inst_nameis an explicit instance name relative tocntxtand may be an empty string if thecntxtis the instance that the configuration object applies to.field_nameis the specific field in the scope that is being searched for.The basic ~get_config_*~ methods from
UVMComponentare 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,...) @classmethod def bit get(cls, cntxt, inst_name, field_name, value):
- Parameters
cntxt –
inst_name –
field_name –
value –
T –
Returns: Raises:
- classmethod set(cntxt, inst_name, field_name, value, T=None)[source]¶
Create a new or update an existing configuration setting for
field_nameininst_namefromcntxt. The setting is made atcntxt, with the full scope of the set being {cntxt,”.”,`inst_name`}. Ifcntxtisnulltheninst_nameprovides the complete scope information of the setting.field_nameis the target field. Bothinst_nameandfield_namemay be glob style or regular expression style expressions.If a setting is made at build time, the
cntxthierarchy 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
UVMComponentare 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,...)
- Parameters
cntxt –
inst_name –
field_name –
value –
T –
- classmethod exists(cntxt, inst_name, field_name, spell_chk=False)[source]¶
Check if a value for
field_nameis available ininst_name, using componentcntxtas the starting search point.inst_nameis an explicit instance name relative tocntxtand may be an empty string if thecntxtis the instance that the configuration object applies to.field_nameis the specific field in the scope that is being searched for. Thespell_chkarg 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.- Parameters
cntxt –
inst_name –
field_name –
spell_chk –
Returns:
- class uvm.base.uvm_config_db.UVMConfigDbOptions[source]¶
Bases:
objectClass: UVMConfigDbOptions
Provides a namespace for managing options for the configuration DB facility. The only thing allowed in this class is static local data members and static functions for manipulating and retrieving the value of the data members. The static local data members represent options and settings that control the behavior of the configuration DB facility.
Options include:
tracing: on/off
The default for tracing is off.
- ready = False¶
- tracing = False¶