Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

neorv32_boot_rom.vhd:69:12: index not within bounds #30

Closed
tmeissner opened this issue May 20, 2021 · 2 comments
Closed

neorv32_boot_rom.vhd:69:12: index not within bounds #30

tmeissner opened this issue May 20, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@tmeissner
Copy link
Collaborator

With the latest commits a bug was introduced in neorv32_boot_rom unit:

../../rtl/core/neorv32_boot_rom.vhd:69:12: index not within bounds
      mem_v(i) := init(i)
           ^

It seems that the range of mem_v is smaller than the range of init in the following code snippet. If type boot_img_trange is increased by one, it works.

  -- local types --
  type boot_img_t is array (0 to BOOTROM_SIZE/4-1) of std_ulogic_vector(31 downto 0);

  -- init function --
  -- impure function: returns NOT the same result every time it is evaluated with the same arguments since the source file might have changed
  impure function init_boot_rom(init : bootloader_init_image_t) return boot_img_t is
    variable mem_v : boot_img_t;
  begin
    mem_v := (others => (others => '0'));
    for i in 0 to init'length-1 loop -- init only in range of source data array
      mem_v(i) := init(i);
    end loop; -- i
    return mem_v;
  end function init_boot_rom;

I'm not a git expert, but I assume there is some magic git command to find out which commit introduced the bug.

@stnolting
Copy link
Owner

stnolting commented May 20, 2021

Oh crap! 😄
I had this problem way too often! The bootloader code occupies exactly 4096 bytes - so it fits into the boot ROM. But the "image" file - basically a case with 4096 when entries - also provides an others entry. I really need to fix the image generator...
As a dirty workaround, I will remove a nop from crt0 making the bootloader image 4092 bytes large.

@stnolting stnolting added the bug Something isn't working label May 20, 2021
@stnolting stnolting reopened this May 20, 2021
@stnolting
Copy link
Owner

Should be fixed now. 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants