Thursday, 11 February 2016

uvm_config_db

The uvm_config_db class is the recommended way to access the resource database.
A resource is any piece of information that is shared between more than one component or object.
We use uvm_config_db::set to put something into the database and uvm_config_db::get to retrieve information from the database.
The uvm_config_db class is parameterized, so the database behaves as if it is partitioned into many type-specific "mini databases."
There are no limitations on the the type - it could be a class, a uvm_object, a built in type such as a bit, byte, or a virtual interface.
There are two typical uses for uvm_config_db. The first is to pass virtual interfaces from the DUT to the test, and the second is to pass configuration classes down through the testbench.

----------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------

/*****************ARGUMENTS*****************/
T is the type of the element being configured - usually a virtual interface or a configuration object.

cntxt and inst_name together form a scope that is used to locate the resource within the database.
The scope is formed by appending the instance name to the full hierarchical name of the context.
{cntxt, ".", inst_name}. or {cntxt.get_full_name(),".",inst_name}. //need to confirm
If cntxt is null then inst_name provides the complete scope information of the setting.

field_name is the key through which you can store and get that particular object.
field_name must be same during get & set, because while getting from uvm_databse it will find for field_name.

value is the thing or resource which is actually going to be put into the database.
value name can be different but value type must be same for get and set.
Both inst_name and field_name may be glob style or regular expression style expressions.

----------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------

Precedence:

Build Phase:
----------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------
Example1:
----------------------------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------------------------
 Example2:

----------------------------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------------------------


Run Phase:
----------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------

Example1:
----------------------------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------------------------
 Example2:
----------------------------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------------------------



/*********************Guideline**************************/
1. Before set anything into database first allocates memory to them and then put into database using set method.

3 comments:

  1. Is it possible to use uvm_config_db#(uvm_component)::set(this,"","component_object_name",component_handle) ?

    Does uvm_config_db involve usage of a new function ? or is it the difference between uvm_config_db and type_id::create ? as in, create is used for components, whereas config_db is only used for uvm_objects or any other resources/variables of our choice ?

    ReplyDelete
    Replies
    1. type_id::create is basically used to create (construct) uvm_object/uvm_component. It is a wrapper above new (constructor) of uvm_object/uvm_component which enables the functionality of class override feature of UVM.

      While uvm_config_db is used to share any information or resource between more than one component or object.

      Delete
  2. How can i use uvm config db in test to start sequence on sequencer using uvm wraper?

    ReplyDelete