Please use code tags making your code easier to read. I have added them for you.
You cannot bind a module inside in interphase, so you need to make them both modules or both interfaces.
The port definitions of trace_file do not match the bind instantiation. Does trace_file really need to be underneath trace_interface, or can they both be bound into the dut?
I will explain my requirement. I want to get the two signals in DUT to my trace_file module through an interface. SO what I was thinking is that first I will bind the DUT with my interface and then the bind the same interface with trace_file module. Is this possible?
Also I referred one earlier post in verification academy and I tried to create like this and its not working in my case.
As I said before, you cannot put an instance of a module inside the instance of an interface. It doesn’t matter if you directly instantiate it or use bind to instantiate. From what little code you have shown, I don’t see why you don’t just find your module and interface directly into the dut. It would help if you could explain what “not working” means. Are you getting a compiler error, or getting results different from what you were expected?
Not working means I am not getting the signal values in DUT to my interface signals.
Actually this DUT is an instance which is inside mydesign like eg, instance1.fsm.DUT
from this hierarchy I need to get some port signal values to my interface . That is my aim.Then use it inside trace_file module.
I can directly probe like instance1.fsm.DUT.clk, but I think its not a good way of accessing signals which lies inside another module
As I said before, you cannot put an instance of a module inside the instance of an interface. It doesn’t matter if you directly instantiate it or use bind to instantiate >> But in LRM page 741 I am seeing binding interface in module as like below
Binding of a module instance or an interface instance works the same way as described for the previous
programs.
interface range (input clk, enable, input var int minval, expr);
property crange_en;
@(posedge clk) enable |-> (minval <= expr);
endproperty
range_chk: assert property (crange_en);
endinterface
bind cr_unit range r1(c_clk,c_en,v_low,(in1&&in2));
In this example, interface range is instantiated in the module cr_unit. Effectively, every instance of
module cr_unit shall contain the interface instance r1.