# Using modports to restrict access to interface signals

**URL:** <https://verificationacademy.com/forums/t/using-modports-to-restrict-access-to-interface-signals/30644>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog, modport, interface\
**Created:** [May 14, 2015, 2:45pm UTC](https://verificationacademy.com/forums/t/using-modports-to-restrict-access-to-interface-signals/30644 "2015-05-14T14:45:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Manning\_Aalsma](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/manning_aalsma/32/1297_2.png) [@Manning\_Aalsma](https://verificationacademy.com/forums/u/Manning_Aalsma)\
**Post date:** [May 14, 2015, 2:45pm UTC](https://verificationacademy.com/forums/t/using-modports-to-restrict-access-to-interface-signals/30644/1 "2015-05-14T14:45:52Z")

</div>

I have a question that I seem to be having a hard time finding the answer for in the standard. If I define a modport that specifies a subset of the signals in the interface, does that mean that if I use it to connect modules, then only that subset should physically exist at that connection? What if I try to access a signal from a modport instance where that signal is not part of its subset?

TIA

---

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [May 14, 2015, 4:52pm UTC](https://verificationacademy.com/forums/t/using-modports-to-restrict-access-to-interface-signals/30644/2 "2015-05-14T16:52:04Z")

</div>

That is the whole point of a modport - they define a subset signals that become ports of the module. The signals that are not part of the modport do not get connected and thus you have no access to them. Once defined, odports are only referenced in the port connection.

```verilog
interface my_intf;
  wire a;
  wire b;
  wire c;
modport sub1(input a, output c);
endinterface
module my_mod(my_intf.sub1 p); // this is effectively replaced with input p.a, output p.c
  always @(p.a)
    p.c <= p.b; // this will be a compilation error - no access to p.b
endmodule
module top;

 my_intf i1();
 my_mod m1(i1.sub1); // this is effectively replaced with i1.a, i1.c

endmodule

```
