An interface is a group of signals. A modport allows you to connect a sub-set (or all) of these signals with directionality as a group instead of each individual signal. The signals still remain independent, so req and data are not connected.
The module ‘primary’ has access to req, and ‘secondary’ has access to data, but they are not interconnected.
Hi @jamal , I suppose what you want to do is connecting data and req in the interface. Then, you can use modport expressions for that purpose.
interface chip_bus ();
logic [31 :0] address;
logic [63:0] signal;
// The two modports use different signals
modport master (input address, output .req (signal));
modport slave (output address, input .data(signal));
endinterface
The following also works.
interface chip_bus ();
logic [31 :0] address;
logic [63:0] data;
// The two modports use different signals
modport master (input address, output .req(data));
modport slave (output address, input data);
endinterface
The signal names pins.req and pins.data are referred in primary and secondary respectively.
You can look up the term “modport expressions” of SystemVerilog interface.