con'high
是对con
数组的high
属性的引用,并返回con
数组范围的最高(最大)索引值。
所以对于x_array
的2 * con'high - 2
是为了定义基于con
的x_array
范围用作索引范围'x_array'的一部分。
con'high
的实际值取决于const_array
的声明,或者取决于const_array
范围的类型。的const_array
所以对于各种声明:
type const_array is array(positive range <>) of signed(7 downto 0);
-- Range is 1 to 4, and con'high = 4
type const_array is array(natural range <>) of signed(7 downto 0);
-- Range is 0 to 3, and con'high = 3
type const_array is array(integer range <>) of signed(7 downto 0);
-- Range is integer'low to integer'low + 3, and con'high = integer'low + 3,
-- e.g. -2147483645 for 32-bit integer
以上的奇数,如:
subtype const_array_range is natural range 17 downto 14;
type const_array is array(const_array_range) of std_logic_vector(7 downto 0);
-- Range is 17 to 14, and con'high = 17
或者甚至可以在一个枚举类型像声明的值:
type const_array_range is (ALFA, BRAVO, CHARLIE, DELTA, ECHO);
type const_array is array(const_array_range range <>) of std_logic_vector(7 downto 0);
-- Range is ALFA to DELTA, and con'high = DELTA
最后如果在2 * con'high - 2
中使用con'high
,当然会导致错误,但是值又取决于const_array
的声明。
你应该为你的问题添加更多细节,我们怎么知道con'high可能意味着什么 –
package --- is type const_array是signed(7 downto)的数组(正数组) 封装; –