Error: indexed name is not a integer

Error: indexed name is not a integer

我在合成项目时遇到错误。我在这一行中有一个错误:

axi_rdata <= patternCount(axi_awaddr(ADDR_LSB+OPT_MEM_ADDR_BITS downto ADDR_LSB));

我收到了这个错误:

[Synth 8-2234] indexed name is not a integer

如果你能帮助我,我将不胜感激。

您声明了一个数组类型:

type PatternCount_memory is array (31 to 0) of std_logic_vector(4 downto 0);
signal patternCount : PatternCount_memory;

您通常会像这样访问此数组中的元素:

a <= patternCount(3);
b <= patternCount(0);

如您所见,该数组使用整数进行索引。如果你有位域:

signal bit_field : std_logic_vector(4 downto 0) := "01010";

那么直接用这个索引你的数组是错误的:

a <= patternCount(bit_field);  -- Error, indexed name is not an integer

您可能想要转换位域,以便将其解释为整数:

a <= patternCount(to_integer(unsigned(bit_field)));  -- OK, we have converted our bitfield

这些转换函数在使用 numeric_std 包时可用。