4.0 Module Port Declerations




port_direction [port_size] port_name, port_name, ... ;

port_direction is declared as:

  • input for scalar or vector input ports.
  • output for scalar or vector output ports.
  • inout for scalar or vector bi-directional ports.

port_size is a range from [ msb : lsb ] (most-significant-bit to least-significant-bit).

  • The msb and lsb must be literal integers, integer parameters, or an expression that resolves to an integer constant.
  • Either little-endian convention (the lsb is the smallest bit number) or big-endian convention (the lsb is the largest bit number) may be used.
  • The maximum port size may be limited, but will be at least 256 bits.




input a,b,sel; 3 scalar ports
output [7:0] result; little endian convention
inout [0:15] data_bus; big endian convention
input [15:12] addr; msb:lsb may be any integer
parameter word = 32;
input [word-1:0] addr;
constant expressions may be used