• A bit select can be an integer, a constant, a net, a variable or an expression.
• A constant part select is a group of bits from within the Vector
• The part select must be contiguous bits.
• The bit numbers must be a literal number or a constant.
• The Order of the part select must be consistent with the declaration of Vector (e.g. If the LSB is the lowest Bit number in the declaration, then The lsb of the part select must also be the lowest Bit number ).
• Variable part selects can vary the starting point of the part select, but Width of the part select must be a literal number, a constant or a call to Constant function. variable part selects were added in Verilog-2001.
• +: Indicates the part select increases from the starting point.
• -: Indicates the part select decreases from the starting point.
Examples:
Reg [31: 0] big_vect;
Reg [0: 31] little_vect;
Reg [63: 0] DWORD;
Integer sel;
The specified rst four if statements show the identity between the two part select constructs. The last one shows Indexable nature.
Initial begin
If (big_vect [0 +: 8] = big_vect [7: 0]) Begin end
If (little_vect [0 +: 8] = little_vect [0: 7]) Begin end
If (big_vect [15-: 8] = big_vect [15: 8]) Begin end
If (little_vect [15-: 8] = little_vect [8: 15]) Begin end
If (SEL> 0 & sel <8) DWORD [8 * sel +: 8] = big_vect [7:0];
// Replace the byte selected.