User guide

22-66
SystemVerilog Design Constructs
Using Modports
A modport specifies direction for a signal from a “point of view.” With
these two signals in the interface we can specify two modports or
“points of view” and the two modules connected by the interface will
use different modports, and have different points of view.
Let’s modify the interface definition by adding two modports.
interface intf;
logic [7:0] send,receive;
modport sendmode (output send, input receive);
modport receivemode (input send, output receive);
endinterface
Modules that use modport sendmode, have an output port named
send and an input port named receive. Modules that use modport
receivemode, have an input port named send and an output port
named receive.
The data type is also changed. This isn’t done to enable the modport.
It’s to enable the modules connected by this interface, that we will
also modify, to make procedural assignments to the signals.