A virtual interface element is not allowed in a sensitivity list

Hi,

As in my testbench env i am making all warnings into errorduring compile, I am passing -warning error in mti_simulator.py file , but after this I am facing the below error, any idea about this ? I dont see anything wrong in the below code

@(vif.monitor_cb);
| ** Error (suppressible): (vlog-13262) A virtual interface element is not allowed in a sensitivity list.

In reply to Ritika:

Please show some more context where this code fragment is located.

Hi Dev,

Please find the code below

task etm_waypoint_monitor::monitor_viewinst();
forever
begin
@(vif.monitor_cb);
if (vif.monitor_cb.etm_enabled)
begin
trace_session_cycle_count++;
// If Viewinst is high
if (vif.monitor_cb.viewinst)
begin
viewinst_cycle_count++;
end
end
end
endtask

And below is the clocking block from intf->

clocking monitor_cb @(posedge clk);
default input #1step output #0;
input viewinst;
input etm_enabled;
endclocking : monitor_cb

In reply to Ritika:

The following complete example worked for me:

interface itf;
   bit clk, viewinst;
   bit etm_enabled=1;
   initial repeat(10) #1 clk++;
   clocking monitor_cb @(posedge clk);
      default input #1step output #0;
      input viewinst; 
      input etm_enabled;
   endclocking : monitor_cb
endinterface
class monitor;
   virtual  itf vif;
   extern task monitor_viewinst;
endclass
task monitor::monitor_viewinst;
   forever begin
      @(vif.monitor_cb)
	if (vif.monitor_cb.etm_enabled)
	  $display("hello");
   end
endtask
module top;
   itf i();
   monitor m = new();
   initial begin
      m.vif = i;
      m.monitor_viewinst();
   end
endmodule

If you can’t provide a minimal example, you may need to work with your tool vendor for support.

l get this error in questa only if the ‘pedanticerrors’ flag is set

Dave’s code will also flag this if compiled with this flag.

However, I still think it’s a bug in Questa
The Questa help for this error cites

“LRM Section 25.9: ‘they [virtual interface elements] cannot be used in continuous assignments or sensitivity lists’.”

as the reason for enforcing this check. However, in that section it then goes on to say that the way to do it properly is via a clocking block!

I pulled the example from the LRM section almost verbatim (with one tweak to actually make it valid)

This also fails in Questa but again only with the ‘pedanticerror’ flag
To be fair to Questa it was the only one to actually compile and run the example in its entirety at all!

To reiterate Dave a little working example goes a long way. However, I think you may have inspired this helpful post from him a few days later.