OpenCores
URL https://opencores.org/ocsvn/neorv32/neorv32/trunk

Subversion Repositories neorv32

[/] [neorv32/] [trunk/] [rtl/] [core/] [neorv32_boot_rom.vhd] - Diff between revs 22 and 23

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 22 Rev 23
Line 39... Line 39...
library neorv32;
library neorv32;
use neorv32.neorv32_package.all;
use neorv32.neorv32_package.all;
use neorv32.neorv32_bootloader_image.all; -- this file is generated by the image generator
use neorv32.neorv32_bootloader_image.all; -- this file is generated by the image generator
 
 
entity neorv32_boot_rom is
entity neorv32_boot_rom is
 
  generic (
 
    BOOTROM_BASE : std_ulogic_vector(31 downto 0) := x"FFFF0000"; -- boot ROM base address
 
    BOOTROM_SIZE : natural := 4*1024  -- processor-internal boot ROM memory size in bytes
 
  );
  port (
  port (
    clk_i  : in  std_ulogic; -- global clock line
    clk_i  : in  std_ulogic; -- global clock line
    rden_i : in  std_ulogic; -- read enable
    rden_i : in  std_ulogic; -- read enable
    addr_i : in  std_ulogic_vector(31 downto 0); -- address
    addr_i : in  std_ulogic_vector(31 downto 0); -- address
    data_o : out std_ulogic_vector(31 downto 0); -- data out
    data_o : out std_ulogic_vector(31 downto 0); -- data out
Line 51... Line 55...
end neorv32_boot_rom;
end neorv32_boot_rom;
 
 
architecture neorv32_boot_rom_rtl of neorv32_boot_rom is
architecture neorv32_boot_rom_rtl of neorv32_boot_rom is
 
 
  -- local types --
  -- local types --
  type boot_img_t is array (0 to boot_size_c/4-1) of std_ulogic_vector(31 downto 0);
  type boot_img_t is array (0 to BOOTROM_SIZE/4-1) of std_ulogic_vector(31 downto 0);
 
 
  -- init function --
  -- 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: 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
  impure function init_boot_rom(init : bootloader_init_image_t) return boot_img_t is
    variable mem_v : boot_img_t;
    variable mem_v : boot_img_t;
Line 69... Line 73...
 
 
  -- local signals --
  -- local signals --
  signal acc_en : std_ulogic;
  signal acc_en : std_ulogic;
  signal rden   : std_ulogic;
  signal rden   : std_ulogic;
  signal rdata  : std_ulogic_vector(31 downto 0);
  signal rdata  : std_ulogic_vector(31 downto 0);
  signal addr   : std_ulogic_vector(index_size_f(boot_size_c/4)-1 downto 0);
  signal addr   : std_ulogic_vector(index_size_f(BOOTROM_SIZE/4)-1 downto 0);
 
 
  -- bootloader image --
  -- bootloader image --
  constant boot_img : boot_img_t := init_boot_rom(bootloader_init_image);
  constant boot_img : boot_img_t := init_boot_rom(bootloader_init_image);
 
 
begin
begin
 
 
  -- Access Control -------------------------------------------------------------------------
  -- Access Control -------------------------------------------------------------------------
  -- -------------------------------------------------------------------------------------------
  -- -------------------------------------------------------------------------------------------
  acc_en <= '1' when (addr_i >= boot_base_c) and (addr_i < std_ulogic_vector(unsigned(boot_base_c) + boot_size_c)) else '0';
  acc_en <= '1' when (addr_i >= BOOTROM_BASE) and (addr_i < std_ulogic_vector(unsigned(BOOTROM_BASE) + BOOTROM_SIZE)) else '0';
  addr   <= addr_i(index_size_f(boot_size_c/4)+1 downto 2); -- word aligned
  addr   <= addr_i(index_size_f(BOOTROM_SIZE/4)+1 downto 2); -- word aligned
 
 
 
 
  -- Memory Access --------------------------------------------------------------------------
  -- Memory Access --------------------------------------------------------------------------
  -- -------------------------------------------------------------------------------------------
  -- -------------------------------------------------------------------------------------------
  mem_file_access: process(clk_i)
  mem_file_access: process(clk_i)

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.