Connecting interface files to internal modules of a DUT

I am looking for a clean solution to connect interfaces (and thereby monitors) to internal modules of a DUT. My env looks close to this -

  1. An instance of DUT (dut_inst) has multiple sub-blocks within it. Let’s say we have one such block - blk_a

  2. Let us say blk_a has 3 ports - inputs port1 and port2; output port3

  3. There’s an equivalent interface file defined for blk_a -


interface blk_a_intf (input clk, input rst);

  logic port1;
  logic [1:0] port2;
  logic [2:0] port3;

  clocking drv @(posedge clk);
    input port1;
    input port2;
    output port3;
  endclocking

  clocking mon @(posedge clk);
    input port1;
    input port2;
    input port3;
  endclocking

  modport driver (clocking drv, input clk, rst);
  modport monitor (clocking mon, input clk, rst);

endinterface

  1. The rtl does not use the above interface files. So these get used only in the verification environment to connect properly to the rtl signals.

  2. The modport ‘monitor’ gets used inside the monitor for getting the transaction data. I would like to hook this monitor to the internal block’s (blk_a) ports. Something like -

    blk_a_intf.monitor.mon.port1 gets connected to dut.blk_a.port1
    blk_a_intf.monitor.mon.port2 gets connected to dut.blk_a.port2

What’s the best way to do this?

In reply to tpan:

I think you can use a System Verilog bind to bind the interface with your DUT. Here are some links that explains how you can use it :

https://verificationacademy.com/forums/systemverilog/bind-interface-instance-rtl-top
https://www.doulos.com/knowhow/sysverilog/SNUG09_SanJose/SNUG09_paper.pdf

In reply to yasaswi93:

In order to use bind wouldn’t I need to have my port declarations as an input/output of the interface? Would I be able to access the ports declared as ‘logic’?

In reply to tpan:

You should create a wrapper module that has all of your ports as inputs. You instantiate the interface inside the wrapper module, connecting the module inputs to the interface signals using assign statements.

You can then bind the wrapper module into your DUT.

In reply to tpan:

See The Missing Link: The Testbench to DUT Connection | Technical Paper | Verification Academy

In reply to tpan:

Hi,
How did you implement this? I have to similar implementation now for monitor connections and couldn’t find a way.