Force ports of interface which has many instances

Hi All,

I have a port of an interface, which I would like to force to a value for all instances of interface.

Do we have an efficient way to implement this, rather than adding force for each interface’s instance.

Thanks in Advance

In reply to g8gretchen588:

You can use the bind construct to insert any kind of behavior into all instance of a particualt interface or module.

interface my_interface;
  wire my_signal;
  
  always_comb  $display("%m my_signal is %b @%0d", my_signal, $realtime);
endinterface

module hdl_top;
  
  my_interface i1();
  my_interface i2();
  my_interface i3();
  // DUT might go here
endmodule

interface my_force(ref event trig, 
                   input wire value);
  initial @trig force my_interface.my_signal = value;
endinterface

module tb_top;
  
  event trigger;
  logic data;
  
  // note that tb_top. is required in the port connections because the instance
  // is from the perspecive of the binding location. 
  bind my_interface my_force bind_inst (tb_top.trigger,tb_top.data);
  
  initial begin
    data = 1;
    #10 ->trigger;
    #10 data = 0;
    #10; 
  end
endmodule

This is a very simple triggering mechanism; there are more elegant ways of doing this if you have a class based testbench

In reply to dave_59:

This is exactly what I was looking for. Thanks Dave.