查了一下,verilog-2001支持这种语法,IEEE standard上的:
big_vect[lsb_base_expr +: width_expr]
little_vect[msb_base_expr +: width_expr]
big_vect[msb_base_expr -: width_expr]
little_vect[lsb_base_expr -: width_expr]
The width_expr shall be a constant expression. It also shall not be affected by run-time parameter assignments.
The lsb_base_expr and msb_base_expr can vary at run-time. The first two examples select
bits starting at the base and ascending the bit range. The number of bits selected is equal to the width expression.
The second two examples select bits starting at the base and descending the bit range. Part-selects that
address a range of bits that are completely out of the address bounds of the net, reg, integer, or time,
or when the part-select is x or z, shall yield the value x when read, and shall have no effect on the data
stored when written. Part-selects that are partially out of range shall when read return x for the bits that are
out of range, and when written shall only affect the bits that are in range. |