Uvm_config_db usage a big confusion

In reply to karunani:

Hi Prasanna,

After observing your code, I want to suggest you some thing :

 uvm_config_db #(virtual bus_if)::set(uvm_root::get(), "*","vif_cfg_top", vif) ;

Here you are setting the bus_if to all the below hierarchy components of uvm_root with field name "vif_cfg_top" . So in order to get the bus_if in some component

you should get it by using same field name “vif_cfg_top” only.
In my_test, you are getting the bus_if correctly by using same field name “vif_cfg_top” that used while setting.

But,
In driver ,
if (!uvm_config_db #(virtual bus_if)::get(this, “”, “vif_cfg_drv”, drv_cfg.vif)) begin
`uvm_error(“@Driver”,“Virtul interface not configured!”)
end
you are using field name as “vif_cfg_drv” instead of using “vif_cfg_top” to get the bus_if. Here you should use “vif_cfg_top” in driver also while
getting the bus_if.

It is recommended to use common field name while setting some thing to multiple components using uvm_config_db, so that we can use same field name
commonly in all components to get the thing that is set.

I hope this will solve UVM_ERRORs that you are getting in simulation.