# "Undefined module: \<interface\> was used. Port connection rules will not be checked at such instantiations."

**URL:** <https://verificationacademy.com/forums/t/undefined-module-interface-was-used-port-connection-rules-will-not-be-checked-at-such-instantiations/46587>\
**Category:** UVM\
**Tags:** virtual-interface, UVM, SystemVerilog, configuration, interface\
**Created:** [March 26, 2024, 10:31am UTC](https://verificationacademy.com/forums/t/undefined-module-interface-was-used-port-connection-rules-will-not-be-checked-at-such-instantiations/46587 "2024-03-26T10:31:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![GGN1912](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/g/77aa72/32.png) [@GGN1912](https://verificationacademy.com/forums/u/GGN1912)\
**Post date:** [March 26, 2024, 10:31am UTC](https://verificationacademy.com/forums/t/undefined-module-interface-was-used-port-connection-rules-will-not-be-checked-at-such-instantiations/46587/1 "2024-03-26T10:31:56Z")

</div>

Below is the snippet of my code

Module top:

```auto
module top_tb;
  bit pclk;
  always #5 pclk = ~pclk;
  
  apb_intf apb_vif(pclk);
  port_intf port_vif();
  
  initial begin
    pclk = 0;
  end
  
  top dt(/*signal connections to dut*/);
  
  initial begin
    uvm_config_db#(virtual apb_intf.m1)::set(null, "*", "vif1", apb_vif.m1);
    uvm_config_db#(virtual apb_intf.m2)::set(null, "*", "vif2", apb_vif.m2);
    uvm_config_db#(virtual port_intf)::set(null, "*", "vif", port_vif);
  end
  
  initial begin
       run_test("my_test");
  end
endmodule

```

apb\_interface:

```auto
interface apb_intf(input logic pclk);
  //signals
  
  clocking block1 @(posedge pclk);
    ///signals for driver
  endclocking 
  
  clocking block2 @(posedge pclk);
    ////signals for monitor 
  endclocking 
  
  modport m1(clocking block1);
  modport m2(clocking block2);
endinterface

```

port\_interface:

```auto
interface port_intf;
//signals
//no clocking blocks and modports used
endinterface

```

test:

```auto
class my_test extends uvm_test;
  `uvm_component_utils(my_test)
  
  function new(string name = "my_test", uvm_component parent = null);
    super.new(name, parent);
  endfunction
  
// sequence handle
  
  env en;
  env_config en_cfg;
  apb_agent_config	apb_agt_cfg;
  port_agent_config port_agt_cfg;
  
  function void build_phase (uvm_phase phase);
    super.build_phase(phase);
    en_cfg = env_config::type_id::create("en_cfg");
    apb_agt_cfg = apb_agent_config::type_id::create("apb_agt_cfg");
    port_agt_cfg	= port_agent_config::type_id::create("port_agt_cfg");
    
    if(!uvm_config_db #(virtual abp_intf.m1)::get( this, "", "vif1", apb_agt_cfg.vif1))
      `uvm_error(get_type_name(),("cannot get virtual apb_intf.m1"));
    if(!uvm_config_db #(virtual abp_intf.m2)::get( this, "", "vif2", apb_agt_cfg.vif2))
      `uvm_error(get_type_name(),("cannot get virtual apb_intf.m2"));
    if(!uvm_config_db #(virtual port_intf)::get( this, "", "vif", port_agt_cfg.vif))
      `uvm_error(get_type_name(),("cannot get virtual port_intf"));
    
    en_cfg.apb_agt_cfg	= apb_agt_cfg;
    en_cfg.port_agt_cfg	= port_agt_cfg;
    
    uvm_config_db #(env_config)::set( this, "*", "en_cfg", en_cfg);
    
    en = env::type_id::create("en",this);
// seq creation
  endfunction
  
  
  task run_phase(uvm_phase phase);
    super.run_phase(phase);
    phase.raise_objection(this, "RAL Test start");
   //starting seq on seqr
    phase.drop_objection(this, "RAL Test end");
  endtask  
endclass: my_test

```

apb\_agent\_config:

```auto
class apb_agent_config extends uvm_object;
   `uvm_object_utils(apb_agent_config)
 
   uvm_active_passive_enum active = UVM_ACTIVE;
  
  virtual apb_intf.m1 vif1;
  virtual abp_intf.m2 vif2;
   
   function new( string name = "apb_agent_config" );
      super.new(name);
   endfunction
endclass

```

port\_agent\_config:

```auto
class port_agent_config extends uvm_object;
   `uvm_object_utils(port_agent_config)
 
   uvm_active_passive_enum active = UVM_ACTIVE;
 
     virtual port_intf vif;
 
   function new( string name = "port_agent_config" );
      super.new(name);
   endfunction
endclass

```

env\_config:

```auto
class env_config extends uvm_object;
  `uvm_object_utils(env_config)
  
  function new(string name = "env_config");
    super.new(name);
  endfunction
  
//switches
  
  apb_agent_config	apb_agt_cfg;
  port_agent_config	port_agt_cfg;
  
endclass

```

env:

```auto
class env extends uvm_env;
  `uvm_component_utils(env)
  
  apb_agent apb_agt;
  port_agent port_agt;
  env_config	en_cfg;
  
  // other component handles
  
  function new(string name="env",uvm_component parent=null);
    super.new(name,parent);
  endfunction 
  
  // BUILD PHASE
  function void build_phase(uvm_phase phase);
    super.build_phase(phase);
    if(!uvm_config_db #(env_config)::get(this,"","en_cfg", en_cfg))
      `uvm_fatal(get_type_name(),("cannot get virtual en_cfg"));
    
      uvm_config_db#(apb_agent_config)::set( this, "*", "apb_agt_cfg", en_cfg.apb_agt_cfg);
      apb_agt = apb_agent::type_id::create("apb_agt",this);      
      uvm_config_db#(port_agent_config)::set( this, "*", "port_agt_cfg", en_cfg.port_agt_cfg);
      port_agt	= port_agent::type_id::create("port_agt",this);    
//other component creations
  endfunction 
  
  ////CONNECT PHASE
  function void connect_phase(uvm_phase phase);
    // connections
  endfunction 
endclass

```

apb\_driver:

```auto
class apb_driver extends uvm_driver#(apb_seq_item);
  `uvm_component_utils(apb_driver)
  
  virtual apb_intf.m1 vif;
  
  apb_agent_config apb_agt_cfg;
  
  function new(string name="apb_driver",uvm_component parent=null);
    super.new(name,parent);
  endfunction 
  
  // BUILD PHASE
  function void build_phase(uvm_phase phase);
    super.build_phase(phase);
    if(!uvm_config_db#(apb_agent_config)::get(this, "", "apb_agt_cfg", apb_agt_cfg))
      `uvm_fatal(get_type_name(),("cannot get apb_agt_cfg"));
  endfunction 
  
  // CONNECT PHASE
  function void connect_phase(uvm_phase phase);
    super.connect_phase(phase);
    vif	= apb_agt_cfg.vif1;
  endfunction
  
  
  // RUN PHASE
  task run_phase(uvm_phase phase);
    super.run_phase(phase);
    //driving
  endtask 
  
endclass 

```

apb\_monitor:

```auto
class apb_monitor extends uvm_monitor;
  `uvm_component_utils(apb_monitor)
    //seq item handle
    //port

  virtual apb_intf.m2 vif;
  apb_agent_config apb_agt_cfg;

  function new(string name = "apb_monitor", uvm_component parent = null);
    super.new(name, parent);
  endfunction
  
  // BUILD PHASE
  function void build_phase(uvm_phase phase);
    super.build_phase(phase);
    if(!uvm_config_db#(apb_agent_config)::get(this, "", "apb_agt_cfg", apb_agt_cfg))
      `uvm_fatal(get_type_name(),("cannot get apb_agt_cfg"));
 ///..   
  endfunction
  
  // CONNECT PHASE
  function void connect_phase(uvm_phase phase);
    super.connect_phase(phase);
    vif	= apb_agt_cfg.vif2;
  endfunction
    
  // RUN_PHASE
  task run_phase(uvm_phase phase);
    super.run_phase(phase);
    //capture
  endtask 
endclass

```

similar for port\_driver and monitor. only difference is I am getting the apb\_intf in port driver and monitor to use its clock.

I am getting the following errors and warnings:  
WARNING VCP2515 “Undefined module: abp\_intf was used. Port connection rules will not be checked at such instantiations.” “apb\_agent\_config.sv” 7 28  
WARNING VCP2515 “Undefined module: abp\_intf.abp\_intf.m2 was used. Port connection rules will not be checked at such instantiations.” “apb\_agent\_config.sv” 7 28  
WARNING VCP2515 “Undefined module: abp\_intf.abp\_intf.m1 was used. Port connection rules will not be checked at such instantiations.” “test.sv” 27 45  
ERROR VCP2852 “Incompatible types at assignment: .apbvif ← this.apb\_agt\_cfg.vif2.” “port\_monitor.sv” 33 31  
ERROR VCP2852 “Incompatible types at assignment: .vif ← this.apb\_agt\_cfg.vif2.” “apb\_monitor.sv” 27 27

I am not able debugg this. please help!

---

<div class="post-metadata">

**Author:** ![cgales](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/c/ccd318/32.png) [@cgales](https://verificationacademy.com/forums/u/cgales)\
**Post date:** [March 26, 2024, 1:57pm UTC](https://verificationacademy.com/forums/t/undefined-module-interface-was-used-port-connection-rules-will-not-be-checked-at-such-instantiations/46587/2 "2024-03-26T13:57:57Z")

</div>

Don’t use modports. They are design constructs and shouldn’t be used for verification.

Always use the interface instance handle when referencing the interface.

No: virtual apb\_intf.m1 vif1;  
Yes: virtual apb\_intf vif1;

No: uvm\_config\_db#(virtual apb\_intf.m1)::set(null, “_“, “vif1”, apb\_vif.m1);  
Yes: uvm\_config\_db#(virtual apb\_intf)::set(null,”_”,“vif1”,apb\_vif);

---

<div class="post-metadata">

**Author:** ![GGN1912](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/g/77aa72/32.png) [@GGN1912](https://verificationacademy.com/forums/u/GGN1912)\
**Post date:** [March 27, 2024, 5:49am UTC](https://verificationacademy.com/forums/t/undefined-module-interface-was-used-port-connection-rules-will-not-be-checked-at-such-instantiations/46587/3 "2024-03-27T05:49:03Z")

</div>

Thank you chuck. It helped me.
