Vectors are multiple bit widths net
or reg data type variables
that can be declared by specifying their range.
net_type [msb:lsb] list_of_net_identifiers;
reg [msb:lsb] list_of_register_identifiers;
Vector range specification contains two constant expressions: the msb
(most significant bit) constant expression, which is the left-hand
value of the range and the lsb (least significant bit) constant
expression, which is the right-hand value of the range. The msb and
lsb constant expressions should be separated by a colon.
Both the msb constant expression and the lsb constant expression can
be any value - positive, negative, or zero. The lsb constant
expression can be greater, equal or less than the msb constant expression.
Vectors can be declared for all types of net
data types and for reg data
types. Specifying vectors for integer,
and time data types is illegal.
Vector nets and registers are treated as unsigned values (see:
Arithmetic expressions with registers and integers for more explanations).
reg [3:0] addr;
The 'addr' variable is a 4-bit vector register made up of addr
(the most significant bit), addr, addr, and addr (the least
wire [-3:4] d;
The d variable is 8-bit vector net made up of d[-3] (msb), d[-2],
d[-1], d, d, d, d, d (lsb).
tri [5:0] x, y, z;
The above line declares three 6-bit vectors.
Both the msb and the lsb expressions should be constant expressions.
The msb and the lsb constant expressions may be positive, negative,
The lsb constant expression may be greater, equal or less than the
msb constant expression.
Vectors can be declared only for nets
and reg data types.
Vector declaration for integer,
and time data types are illegal.