Part-select

Formal Definition

Part-select gives an access to contiguous bits of vectors.

Simplified Syntax

vector_identifier[msb:lsb];

Description

Part-select returns a part of a vector. The range is specified by two, separated by colon, constant expressions: the most significant bit (msb) in an expression and the least significant bit (lsb) in an expression. Both the msb expression and the lsb expression should be constant expressions.

The part-select operation can be applied to any net vector type, as well as reg, integers and time registers. The part-select of a register declared as real or realtime is illegal.

Part-select of a vector should be done in the same direction as the range of the declared vector.

Examples

Example 1

reg [3:0] vect;
vect = 4'b0001;

If the address expression is [3:1] then returned value is 000 (vect[3:1] = 3'b000).

If the address expression is [1:0] then returned value is 01 (vect[1:0] = 2'b01).

Important Notes

  • Part-select on memories, real registers, or realtime registers is illegal.


No comments:

Post a Comment