Virtual Interface Issue !?!?

In reply to mperyer:

Thanks mperyer for your clarifications.

1st argument - This is expected to be a uvm_component handle, none exist in the tb module, so this should be null - “YES”
2nd argument - This is the auto-generated name of the top level component in the testbench - i.e. the test class
I thought it was module top or module, where the type is defined. uvm_test_top makes sense but I’m getting error with uvm_test_top .
3rd argument - Any string you like, but it’s the one you’ll use to look up the handle
- Not sure, string which is type defined as interface or just any string
uvm_config_db #(virtual my_if)::set(null, “uvm_test_top”, “anystring”, dut_port_if);
do you think that this work?

4th argument - The virtual interface handle - “YES”

I tried as below and getting error…

initial begin
uvm_config_db#(virtual mem_if)::set(uvm_root::get(),"uvm_test_top","memif", memif); //did not work
uvm_config_db#(virtual mem_if)::set(uvm_root::get(),"*","memif", memif); //Works
run_test();
end
// build_phase
function void build_phase(uvm_phase phase);
super.build_phase(phase);
if(!uvm_config_db#(virtual mem_if)::get(this, "", "memif", vif))
 `uvm_fatal("NOVIF",{"virtual interface must be set for: ",get_full_name(),".vif"});

UVM_INFO @ 0: reporter [RNTST] Running test mem_test…
UVM_FATAL mem_env.sv(42) @ 0: uvm_test_top.memtb.memenv [NOVIF] virtual
interface must be set for: uvm_test_top.memtb.memenv.vif