I want to restrict the accessibility of the interface to the agent component only.
I have used the get method to access the interface inside the test class but it is giving me the shown error.
below is the code where the set method is called.
`include "extended_uvm_test.sv"
`include "interface.sv"
module tb;
logic clk;
always #1 clk=~clk;
//---------------------------------------
//interface instance
//---------------------------------------
intf intf_h(clk);
initial
begin
clk=0;
#50 $finish;
end
//---------------------------------------
//passing the interface handle to lower heirarchy using set method
//---------------------------------------
initial
begin
uvm_config_db#(virtual intf)::set(null,"*.agent_h","intf_h",intf_h); // I have tried with uvm_root::get() also,but no change.
end
//----------------------------
//calling test
//----------------------------
initial
begin
run_test("extended_uvm_test");
end
endmodule:tb
below is the test code where get method is called(inside build phase).
`include "extended_uvm_env.sv"
class extended_uvm_test extends uvm_test;
//------------------------------------------
//register class to factory
//------------------------------------------
`uvm_component_utils(extended_uvm_test);
//---------------------------------------
//interface instance
//---------------------------------------
virtual intf intf_h;
//------------------------------------------
//environment handle instance
//------------------------------------------
extended_uvm_env env_h;
//------------------------------------------
//transactor method
//------------------------------------------
function new(string name="dextended_uvm_test", uvm_component parent=null);
super.new(name, parent);
endfunction
//------------------------------------------
//build phase
//------------------------------------------
function void build_phase(uvm_phase phase);
super.build_phase(phase);
//create the environment
env_h=extended_uvm_env::type_id::create("env_h",this);
if(!uvm_config_db#(virtual intf)::get(this,"","intf_h",intf_h))
begin
`uvm_fatal("NO_VIF",{"virtual interface must be set for: ",get_full_name(),".vif"});
end
`uvm_info(get_type_name(),$sformatf("\t TEST::BUILD_PHASE time=%0t",$time),UVM_LOW);
endfunction:build_phase
//------------------------------------------------
//connect phase
//------------------------------------------------
function void connect_phase(uvm_phase phase);
super.connect_phase(phase);
`uvm_info(get_type_name(),$sformatf("\t TEST::CONNECT_PHASE time=%0t",$time),UVM_LOW);
endfunction:connect_phase
//------------------------------------------------
//run phase
//------------------------------------------------
virtual task run_phase(uvm_phase phase);
super.run_phase(phase);
phase.raise_objection(this);
@(posedge intf_h.clk);
run_display();
phase.drop_objection(this);
endtask:run_phase
//------------------------------------------------
//display the comment
//------------------------------------------------
virtual task run_display();
@(posedge intf_h.clk);
`uvm_info(get_type_name(),$sformatf("\t MONITOR::RUN_PHASE time=%0t",$time),UVM_LOW);
endtask:run_display
endclass:extended_uvm_test
I am getting the following error.
UVM_FATAL extended_uvm_test.sv(35) @ 0: uvm_test_top [NO_VIF] virtual interface must be set for: uvm_test_top.vif
what could be the issue? i guess, it is due to the execution time.
please help me out.
Thanks & Regards
jj_bukhari