I know 'HIGH its a data attribute, that return the upper array index, but the vector out side the parentheses i dont get it. Its the same as vector'HIGH??
Tell me if someone need more info or something
Let's go by parts:
vector'high
: if used on an array, the attribute 'high returns the highest value that can be used to index into that array. A more formal definition is: it's the highest subscript of array A or constrained array type. So if vector
has range (7 downto 0), vector'high
equals 7vector( X )
: returns the value of the element at position X in vector
(this is trivial array indexing)vector( vector'high )
returns the value of the element with the highest subscript in vector
vector(vector'high)='1'
is comparing that element's value against the literal bit value '1'. To give a concrete example, if you have:
constant vector: standard_logic_vector(7 downto 0) = "1000_000X";
then:
vector(vector'high)
will be equal '1'
Personally, I think it would be great if we had a predefined attribute for that (returning the value of the element with the highest subscript).
Finally, for the sake of completeness, 'high
can be used with constrained arrays (seems to be your case) or with types. If used on a type identifier, it will provide the highest value of that type. For example: bit'high
--> '1'
, std_logic'high
--> '-'
.