User guide

24-207
SystemVerilog Testbench Constructs
success at 125 in test.tbpb1.e3
Virtual Interfaces
A Virtual Interface (VI) allows a variable to be a dynamic reference
to an actual instance of an interface. VCS classifies such a variable
with the Virtual Interface data type. Here is an example:
interface SBus;
logic req, grant;
endinterface
module m;
SBus sbus1();
SBus sbus2();
.
.
.
endmodule
program P;
virtual SBus bus;
initial
begin
bus = m.sbus1; // setting the reference to a real
// instance of Sbus
$display(bus.grant); // displaying m.sbus1.grant
bus.req <= 1; // setting m.sbus1.req to 1
#1 bus = m.sbus2;
bus.req <= 1;
end
endprogram