Search code examples
vhdlfpga

Error: indexed name is not a integer


I got an error when I synthesized my project. I have an error in this line:

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

and I got this error:

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

I would appreciate if you could help me.


Solution

  • You have declared an array type:

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

    You would normally access elements in this array like this:

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

    As you can see, the array is indexed with an integer. If you have a bitfield:

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

    Then it is an error to index your array directly using this:

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

    You probably want to convert your bitfield, so that it is interpreted as an integer:

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

    These conversion functions are available when using the numeric_std package.