In reply to narendravk28:
//Inside the testbench top create the instantiate inside and pass it
typedef virtual my_interface my_vif;
my_interface u_intf (clock, resetn);
initial begin
uvm_config_db#(virtual my_interface)::set(null, "*", "vif", u_intf);
run_test();
end
//Inside the driver/monitor
if(!uvm_config_db#(virtual my_interface)::get(this, "", "vif", vif)) begin
`uvm_error("", "uvm_config_db::get failed")
end
//you don't need to create the config class inside testbench top and pass
//create config class inside the base test / environment and pass to lower components
env_cfg = my_env_cfg::type_id::create("env_cfg");
uvm_config_db#(my_env_cfg)::set(this, "env*", "env_cfg", env_cfg);
//get the config in lower components
if(!uvm_config_db#(my_env_cfg)::get(this, "", "env_cfg", env_cfg)) begin
`uvm_error("", "uvm_config_db::get failed")
end