iam new in uvm , here in top_module iam implementing empty interface just for understanding
here in this 2 pieces of codes
- top →
interface intf ();
endinterface
module top;
import uvm_pkg::*;
import pack1::*;
intf in1();
initial begin
uvm_config_db #(virtual intf)::set(null,"uvm_test_top","my_vif",in1);
run_test("my_test");
factory.print();
end
endmodule
// the error happens at this line when i pass the interface to the test class
2) test class
class my_test extends uvm_test;
`uvm_component_utils(my_test)
my_env env ;
my_env_confg env_confg_1;
virtual intf local_virtual;
function new(string name = "my_test", uvm_component parent = null);
super.new(name, parent);
endfunction
/////
function void build_phase(uvm_phase phase);
super.build_phase(phase);
env = my_env::type_id::create("env", this);
env_confg_1 = my_env_confg::type_id::create("env_confg_1", this);
if (!uvm_config_db#(virtual intf)::get(this, "", "my_vif", local_virtual));
`uvm_fatal(get_full_name(), "Error") <----------------------
env_confg_1.config_virtual = local_virtual;
uvm_config_db#(virtual intf)::set(this, "env", "my_vif", env_confg_1.config_virtual);
$display("this is test");
endfunction
function void connect_phase(uvm_phase phase);
super.connect_phase(phase);
endfunction
task run_phase(uvm_phase phase);
super.run_phase(phase);
endtask
endclass