CONFIG DB

Hi , I am trying to retrieve value using config db but i can’t.
can anyone tell me the Issue.

In the environment build phase, I have set the value.
int value = 10;
uvm_config_db#(int)::set(null,“*”,value,value);

In the Agent build phase , I am trying to get the value but it is showing error
int value;
if(!uvm_config_db#(int)::get(null,“”,value,value))
uvm_error(get_type_name(),$sformatf("value in config db is not set : %d ",value)) else uvm_info(get_type_name(),$sformatf(“value in config db is set : %d”,value),UVM_LOW)

Thanks,
Sandeep Gaur

In reply to Sandeep Gaur:

Please note the 3rd argument of the set/get command has to be a string like this:

uvm_config_db#(int)::set(null,"*","value",value);

In reply to chr_sue:
Also, the first argument of get() should be this, not null.

In reply to chr_sue:

Thanks it is working now.

In reply to dave_59:

But it is working with the Null argument.
Is there any particular reason to use “this” and not “Null” ?

Thanks in Advance!!!

In reply to Sandeep Gaur:

In the class while getting the variable, we use “this” as the first argument in CONFIG_DB.

In reply to Sandeep Gaur:

In your case, it does matter because you are using “*” as a wildcard for set().

The reason you should use “this” instead of “null” is because there will come a time when you want to be selective on which agent you want to configure. “this” provides context for the get().

In reply to dave_59:

Got it Dave…!!!
Thanks