← ProblemsVerilog Language / Modules: Hierarchy

Connecting ports by position

64%hierarchy

This time mod_a has six ports. Its port list, in order, is:

out1, out2, in1, in2, in3, in4

(In this self-contained version, out1 is the AND of the four inputs and out2 is their OR.)

Instantiate mod_a once inside top_module and connect ports by position so that:

  • mod_a's 1st port (out1) drives out1
  • mod_a's 2nd port (out2) drives out2
  • mod_a's four inputs receive a, b, c, d in that order

With positional connection, the signals you list are matched to the module's ports purely by their order — so get the order right.