In reply to chr_sue:
In reply to UVM_LOVE:
You should do the get on the config_db where you are need this interface. Looking to your env you do nothing with the virtual interface. But the env is a good place to perform the get to retrieve the virtual interface from the config_db, because from there you can connect this to your driver and your monitor. Then you have to make the get only ones.
BTW the get on the config_db should be made in the connect_phase. Then you can be sure all components are existing.
the connect-_phase could look like:
function void connect_phase();
if(! uvm_config_db#(virtual my_interface)::get(this, "", "vintf_my_interface", vintf))
`uvm_error("", "!!uvm_config_db get fail!!!!")
p_driver.vintf = vintf;
p_monitor.vintf = vintf;
endfunction
Dear @chr_sue Thanks! But I’ve got some question.
Q1)
What If I got the uvm_test class then Do I need it into the uvm_test class instead uvm_env class?
I’m trying to understand your recommend and implement as the below,
Q2)
But I’ve got error
p_driver.vintf = vintf;
|
ncelab: *E,CUVUNF (./testbench.sv,81|15): Hierarchical name component lookup failed at 'p_driver'.
As I understand from your answer, I can connect all virtual interface at top level class.
So I declared it into uvm_test class. If I right why do I got the error? What am I supposed to do to resolve this problem?