Config_db - parameters for set/get method

In reply to Lina.Lin:

In reply to verif_learner:
uvm_config_db::get() will get the value for field_name in inst_name, using component cntxt as the starting search point.
In the example below, cnxt is this and inst_name is empty “”, this keyword refers to the component’s current instance. so get()will loop up fld_name setting by using the component’s current instance as the starting point. If fld_name setting is found, get its setting to my_val.


uvm_config_db#(int)::get(this,"","fld_name", my_val);

In the example below, get() will search fld_name setting by using top.module_a.instance_a as the starting point.


uvm_config_db#(int)::get("top",".module_a.instance_a","fld_name", my_val);

Hi Lina Lin,

What is the difference between the following 3 statements:

uvm_config_db#(int)::set("", "top.module_a.instance_a", "fld_name", a_val);


uvm_config_db#(int)::set("top", ".module_a.instance_a", "fld_name", a_val);

uvm_config_db#(int)::set("top.module_a", ".instance_a", "fld_name", a_val);

Also, if I have set as follows:

uvm_config_db#(int)::set("top", "", "fld_name", a_val);

and I using get as follows as top.instance_a:

uvm_config_db#(int)::get("this","","fld_name", my_val);

will the get be successful?
if this is not successful, how can a lower component get value set at the upper hierarchy level such as above?

After reading multiple articles on this topic, I somehow get a feeling that match is just based on field name alone. Where context and instance name help is, to return appropriate value when multiple entries with the same name are present. I am not sure if I am going in the correct direction.