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

Subversion Repositories riscv_vhdl

[/] [riscv_vhdl/] [trunk/] [rtl/] [techmap/] [mem/] [bootrom_inferred.vhd] - Blame information for rev 5

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 sergeykhbr
----------------------------------------------------------------------------
2
--  INFORMATION:  http://www.GNSS-sensor.com
3
--  PROPERTY:     GNSS Sensor Ltd
4
--  E-MAIL:       sergey.khabarov@gnss-sensor.com
5
--  DESCRIPTION:  This file contains copy of the firmware image
6
------------------------------------------------------------------------------
7
--  WARNING:      
8
------------------------------------------------------------------------------
9
library ieee;
10
use ieee.std_logic_1164.all;
11
use ieee.numeric_std.ALL;
12
use IEEE.STD_LOGIC_TEXTIO.ALL;
13
use std.textio.all;
14
library commonlib;
15
use commonlib.types_common.all;
16
--! AMBA system bus specific library.
17
library ambalib;
18
--! AXI4 configuration constants.
19
use ambalib.types_amba4.all;
20
 
21
entity BootRom_inferred is
22
  generic (
23
    hex_filename : string
24
  );
25
  port (
26
    clk     : in  std_ulogic;
27
    address : in global_addr_array_type;
28
    data    : out std_logic_vector(CFG_NASTI_DATA_BITS-1 downto 0)
29
  );
30
end;
31
 
32
architecture rtl of BootRom_inferred is
33
 
34
constant ROM_ADDR_WIDTH : integer := 13;
35
constant ROM_LENGTH : integer := 2**(ROM_ADDR_WIDTH - log2(CFG_NASTI_DATA_BYTES));
36
 
37
type rom_block is array (0 to ROM_LENGTH-1) of std_logic_vector(31 downto 0);
38
type rom_type is array (0 to CFG_WORDS_ON_BUS-1) of rom_block;
39
 
40
type local_addr_arr is array (0 to CFG_WORDS_ON_BUS-1) of integer;
41
 
42
impure function init_rom(file_name : in string) return rom_type is
43
    file rom_file : text open read_mode is file_name;
44
    variable rom_line : line;
45
    variable temp_bv : std_logic_vector(CFG_NASTI_DATA_BITS-1 downto 0);
46
    variable temp_mem : rom_type;
47
begin
48
    for i in 0 to (ROM_LENGTH-1) loop
49
        readline(rom_file, rom_line);
50
        hread(rom_line, temp_bv);
51
        for n in 0 to (CFG_WORDS_ON_BUS-1) loop
52
          temp_mem(n)(i) := temp_bv((n+1)*32-1 downto 32*n);
53
        end loop;
54
    end loop;
55
    return temp_mem;
56
end function;
57
 
58
constant rom : rom_type := init_rom(hex_filename);
59
 
60
begin
61
 
62
  reg : process (clk)
63
    variable t_adr : local_addr_arr;
64
  begin
65
    if rising_edge(clk) then
66
        for n in 0 to CFG_WORDS_ON_BUS-1 loop
67
            t_adr(n) := conv_integer(address(n)(ROM_ADDR_WIDTH-1 downto log2(CFG_NASTI_DATA_BYTES)));
68
            data(32*(n+1)-1 downto 32*n) <= rom(n)(t_adr(n));
69
        end loop;
70
    end if;
71
  end process;
72
 
73
end;

powered by: WebSVN 2.1.0

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