UVM : Fatal Error when i am trying to get intf

Hi Friends,
I have created 8 interfaces for 8 agents.

top.sv (code) :


 //Flit interface instances
 flit_intf flit_if_0(i_we_clk,rstn);
 flit_intf flit_if_1(i_we_clk,rstn);
 flit_intf flit_if_2(i_we_clk,rstn);
 flit_intf flit_if_3(i_we_clk,rstn);
 flit_intf flit_if_4(i_we_clk,rstn);
 flit_intf flit_if_5(i_we_clk,rstn);
 flit_intf flit_if_6(i_we_clk,rstn);
 flit_intf flit_if_7(i_we_clk,rstn);

initial begin

   //put in the database the interface used by FLIT Slave agent0
   uvm_config_db#(virtual flit_intf)::set(null, "uvm_test_top.env.flit_slv_agnt[0]", "slv_if", flit_if_0);
   //put in the database the interface used by FLIT Slave agent1
   uvm_config_db#(virtual flit_intf)::set(null, "uvm_test_top.env.flit_slv_agnt[1]", "slv_if", flit_if_1);
   //put in the database the interface used by FLIT Slave agent2
   uvm_config_db#(virtual flit_intf)::set(null, "uvm_test_top.env.flit_slv_agnt[2]", "slv_if", flit_if_2);
   //put in the database the interface used by FLIT Slave agent3
   uvm_config_db#(virtual flit_intf)::set(null, "uvm_test_top.env.flit_slv_agnt[3]", "slv_if", flit_if_3);
   //put in the database the interface used by FLIT Master agent0
   uvm_config_db#(virtual flit_intf)::set(null, "uvm_test_top.env.flit_mst_agnt[0]*", "mst_if", flit_if_4);
   //put in the database the interface used by FLIT Master agent1
   uvm_config_db#(virtual flit_intf)::set(null, "uvm_test_top.env.flit_mst_agnt[1]*", "mst_if", flit_if_5);
   //put in the database the interface used by FLIT Master agent2
   uvm_config_db#(virtual flit_intf)::set(null, "uvm_test_top.env.flit_mst_agnt[2]*", "mst_if", flit_if_6);
   //put in the database the interface used by FLIT Master agent3
   uvm_config_db#(virtual flit_intf)::set(null, "uvm_test_top.env.flit_mst_agnt[3]*", "mst_if", flit_if_7);
end

When i am trying to get flit_if_4 in master driver class it is giving below fatal error.
FATAL ERROR:

UVM_FATAL …/…/…/…/…/tb/UVM/inoc_flit_agent/master_driver.sv(22) @ 0: uvm_test_top.env.flit_mst_agnt0.inoc_flit_master_driver_inst [uvm_test_top.env.flit_mst_agnt0.master_driver_inst] No virtual interface named flit_intf in the environment

Master Driver code :

virtual flit_intf inoc_flit_vif;
 function void build_phase(uvm_phase phase);

        super.build_phase(phase);

        if(!uvm_config_db #(virtual flit_intf)::get(this,"","mst_if",inoc_flit_vif))
            `uvm_fatal(get_full_name(), "No virtual interface named flit_intf in the environment")
    endfunction // build_phase

Agents creation Code in build_phase task(env.sv):

    foreach(flit_mst_agnt[i]) begin
       flit_mst_agnt[i] = inoc_flit_master_agent::type_id::create ($sformatf("flit_mst_agnt%0d",i), this);
    end

Can some one help me to fix this issue.

Regards,
Rajani

In reply to rajanikanthd:

Your problem is here:

   uvm_config_db#(virtual flit_intf)::set(null, "uvm_test_top.env.flit_slv_agnt[0]", "slv_if", flit_if_0);
   //put in the database the interface used by FLIT Slave agent1
   uvm_config_db#(virtual flit_intf)::set(null, "uvm_test_top.env.flit_slv_agnt[1]", "slv_if", flit_if_1);
   //put in the database the interface used by FLIT Slave agent2
   uvm_config_db#(virtual flit_intf)::set(null, "uvm_test_top.env.flit_slv_agnt[2]", "slv_if", flit_if_2);

You are passing the same interface type using the same name “slv_if”, for different instances of your interface.
You have to differntiate like this:

   uvm_config_db#(virtual flit_intf)::set(null, "uvm_test_top.env.flit_slv_agnt[0]", "slv_if0", flit_if_0);
   //put in the database the interface used by FLIT Slave agent1
   uvm_config_db#(virtual flit_intf)::set(null, "uvm_test_top.env.flit_slv_agnt[1]", "slv_if1", flit_if_1);
   //put in the database the interface used by FLIT Slave agent2
   uvm_config_db#(virtual flit_intf)::set(null, "uvm_test_top.env.flit_slv_agnt[2]", "slv_if2", flit_if_2);

In reply to rajanikanthd:


   uvm_config_db#(virtual flit_intf)::set(null, "uvm_test_top.env.flit_mst_agnt[0]*", "mst_if", flit_if_4);


    foreach(flit_mst_agnt[i]) begin
       flit_mst_agnt[i] = inoc_flit_master_agent::type_id::create ($sformatf("flit_mst_agnt%0d",i), this);
    end

You create the agent by string “flit_mst_agnt0”, but you use a path “flit_mst_agnt[0]” in the config_db. I think that’s the problem.

In reply to chris90:

After changing also seeing same problem.
uvm_config_db#(virtual flit_intf)::set(null, “uvm_test_top.env.flit_mst_agnt0”, “mst_if”, flit_if_4);
uvm_config_db#(virtual flit_intf)::set(null, “uvm_test_top.env.flit_mst_agnt1”, “mst_if_1”, flit_if_5);
uvm_config_db#(virtual flit_intf)::set(null, “uvm_test_top.env.flit_mst_agnt2”, “mst_if_2”, flit_if_6);
uvm_config_db#(virtual flit_intf)::set(null, “uvm_test_top.env.flit_mst_agnt3”, “mst_if_3”, flit_if_7);
uvm_config_db#(virtual flit_intf)::set(null, “uvm_test_top.env.flit_slv_agnt0”, “slv_if”, flit_if_0);
uvm_config_db#(virtual flit_intf)::set(null, “uvm_test_top.env.flit_slv_agnt1”, “slv_if_1”, flit_if_1);
uvm_config_db#(virtual flit_intf)::set(null, “uvm_test_top.env.flit_slv_agnt2”, “slv_if_2”, flit_if_2);
uvm_config_db#(virtual flit_intf)::set(null, “uvm_test_top.env.flit_slv_agnt3”, “slv_if_3”, flit_if_3);

I want to use master driver and slave driver for 4 agents because all are having same interface signals.

DUT has 4 interfaces
Each interface has below signals with different name but width is same
//outgoing data
logic [1:0] o_out_flit_valid;
logic[`FLIT_WIDTH-1:0] o_out_flit;
logic [1:0] i_out_flit_ready;

// Incoming data
logic [1:0] i_in_flit_valid;
logic[`FLIT_WIDTH-1:0] i_in_flit;
logic [1:0] o_in_flit_ready;

So instead of creating 4 master & slave drivers i have created 1 agent and created 4 instances

If i change interface type to different name as you said like slv_if0,slv_if1…
in this case need to create 4 drivers then only i can get seperately .
What could be the problem.

Regards,
Rajani

In reply to rajanikanthd:

Where are you getting the interface? If you are getting it from driver component which is under the agent, you need to use wildcard “*” when you set config db.


uvm_config_db#(virtual flit_intf)::set(null, "uvm_test_top.env.flit_mst_agnt0*", "mst_if", flit_if_4);

In reply to chris90:

I am getting in driver class.
virtual flit_intf inoc_flit_vif;

    if(!uvm_config_db #(virtual flit_intf)::get(this,"","mst_if",inoc_flit_vif))
        `uvm_fatal(get_full_name(), "No virtual interface named flit_intf in the environment")

Thanks chris …it is working …