I have an IP for Digilent's Zybo Z7-20 which segments the image. The segmentation is done based on histogram. The segmentation module takes 4 32-bit wide inputs which contain the threshold values. In addition the module takes one input which represents the enable. My problem is that when I had only 3 thresholds (R, G, B), the module worked, but when I add the thresholds for channel A, it stops working. So it accepted 4 registers but not 5.

I get this error message

[Synth 8-97] array index 4 out of range ["c:/Users/suvi1/Documents/icat3170/segmente_modified/vivado_proj/Zybo-Z7-20-DMA.srcs/sources_1/bd/system/ipshared/073f/hdl/segmenter_modified_v1_0_S00_AXI.vhd":232]

The row 232 reads as follows:

loc_addr := axi_awaddr(ADDR_LSB + OPT_MEM_ADDR_BITS downto ADDR_LSB);

The signal axi_awaddr is defined earlier as

signal axi_awaddr    : std_logic_vector(C_S_AXI_ADDR_WIDTH-1 downto 0);


    C_S_AXI_ADDR_WIDTH    : integer    := 5

How can I get "array index 4 out of range" when the size of the vector is 5?!

Other variables used on that row are defined:

constant ADDR_LSB  : integer := (C_S_AXI_DATA_WIDTH/32)+ 1;
C_S_AXI_DATA_WIDTH    : integer    := 32;
constant OPT_MEM_ADDR_BITS : integer := 2;

If you want to test it, here are the files.

My IP repo: https://www.dropbox.com/s/2gqp0hoc0ws8lqp/new_ip_repo.zip?dl=0 From there I use segmenter_modified.

The Xilinx Vivado project which uses the abovementioned IP segmenter_modified. https://www.dropbox.com/s/s51skutnj9a74i8/segm_mod.zip?dl=0


  1. Download the zip packages and unzip them.

  2. Open the Vivado project of the second link. Project name is Zybo-Z7-20-DMA.

  3. (I'm not sure if this is needed : Make sure the IP Catalog contains the path to where you downloaded and unzipped the IP repo, in my case it's C:\Users\suvi1\Downloads\new_ip_repo\new_ip_repo\ip_repo)

  4. Try to generate the bitstream and you see the errors.

  • \$\begingroup\$ The Vivado project in dropbox vivado_proj/Zybo-Z7-20-DMA.srcs/sources_1/bd/system/ipshared/ doesn't contain a folder 073f so it seems there is some version confusion. Maybe what you're compiling isn't what you think you're compiling, and the error message refers to a version where 4 is indeed out of range. OR since one of these values is a GENERIC, what value has it been instantiated with? \$\endgroup\$
    – user16324
    Commented Nov 2, 2021 at 15:55
  • \$\begingroup\$ What is 073f? I checked the GENERIC instantiation, it was indeed 4. I fixed it but it did not help. \$\endgroup\$
    – Suvi
    Commented Nov 2, 2021 at 17:52
  • \$\begingroup\$ It's in the error message you posted; in the path to the file that's actually being compiled. I could trace from vivado_proj as far as ipshared, but no further. \$\endgroup\$
    – user16324
    Commented Nov 2, 2021 at 17:54
  • \$\begingroup\$ I created another IP from scratch, and copied the correct codes there. No help. \$\endgroup\$
    – Suvi
    Commented Nov 2, 2021 at 18:32
  • \$\begingroup\$ So, follow the new path in the new error message, and inspect the actually compiled file. Also, add ASSERT/REPORTs on the relevant constants, generics, and array index attributes. \$\endgroup\$
    – user16324
    Commented Nov 2, 2021 at 18:42

1 Answer 1


There were 4's in two places where there should have been 5.

In file segmenter_modified_v1_0 I had to change the row 15 to

    C_S00_AXI_ADDR_WIDTH    : integer   := 5;

and the row 80 to

    C_S_AXI_ADDR_WIDTH  : integer   := 5;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.