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

Subversion Repositories riscv_vhdl

[/] [riscv_vhdl/] [trunk/] [rtl/] [misclib/] [nasti_bootrom.vhd] - Blame information for rev 5

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 sergeykhbr
-----------------------------------------------------------------------------
2
--! @file
3
--! @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
4
--! @author    Sergey Khabarov - sergeykhbr@gmail.com
5
--! @brief     ROM storage with the boot image (4KB default = 16 x 256)
6
------------------------------------------------------------------------------
7
 
8
library ieee;
9
use ieee.std_logic_1164.all;
10
 
11
library techmap;
12
use techmap.gencomp.all;
13
use techmap.types_mem.all;
14
 
15
library commonlib;
16
use commonlib.types_common.all;
17
 
18
--! AMBA system bus specific library
19
library ambalib;
20
--! AXI4 configuration constants.
21
use ambalib.types_amba4.all;
22
 
23
 
24
entity nasti_bootrom is
25
  generic (
26
    memtech  : integer := inferred;
27
    xaddr    : integer := 0;
28
    xmask    : integer := 16#fffff#;
29
    sim_hexfile : string
30
  );
31
  port (
32
    clk  : in std_logic;
33
    nrst : in std_logic;
34
    cfg  : out nasti_slave_config_type;
35
    i    : in  nasti_slave_in_type;
36
    o    : out nasti_slave_out_type
37
  );
38
end;
39
 
40
architecture arch_nasti_bootrom of nasti_bootrom is
41
 
42
  constant xconfig : nasti_slave_config_type := (
43
     descrtype => PNP_CFG_TYPE_SLAVE,
44
     descrsize => PNP_CFG_SLAVE_DESCR_BYTES,
45
     irq_idx => 0,
46
     xaddr => conv_std_logic_vector(xaddr, CFG_NASTI_CFG_ADDR_BITS),
47
     xmask => conv_std_logic_vector(xmask, CFG_NASTI_CFG_ADDR_BITS),
48
     vid => VENDOR_GNSSSENSOR,
49
     did => GNSSSENSOR_BOOTROM
50
  );
51
 
52
  type registers is record
53
    bank_axi : nasti_slave_bank_type;
54
  end record;
55
 
56
 
57
 
58
signal r, rin : registers;
59
 
60
signal raddr_mux : global_addr_array_type;
61
signal rdata_mux : std_logic_vector(CFG_NASTI_DATA_BITS-1 downto 0);
62
 
63
begin
64
 
65
  comblogic : process(i, nrst, r, rdata_mux)
66
    variable v : registers;
67
    variable rdata : std_logic_vector(CFG_NASTI_DATA_BITS-1 downto 0);
68
  begin
69
 
70
    v := r;
71
 
72
    procedureAxi4(i, xconfig, r.bank_axi, v.bank_axi);
73
 
74
    raddr_mux <= functionAddressReorder(v.bank_axi.raddr(0)(3 downto 2),
75
                                        v.bank_axi.raddr);
76
 
77
    rdata := functionDataRestoreOrder(r.bank_axi.raddr(0)(3 downto 2),
78
                                          rdata_mux);
79
 
80
    o <= functionAxi4Output(r.bank_axi, rdata);
81
 
82
    if nrst = '0' then
83
       v.bank_axi := NASTI_SLAVE_BANK_RESET;
84
    end if;
85
 
86
    rin <= v;
87
  end process;
88
 
89
  cfg  <= xconfig;
90
 
91
  tech0 : BootRom_tech generic map (
92
    memtech     => memtech,
93
    sim_hexfile => sim_hexfile
94
  ) port map (
95
    clk     => clk,
96
    address => raddr_mux,
97
    data    => rdata_mux
98
  );
99
 
100
  -- registers:
101
  regs : process(clk)
102
  begin
103
     if rising_edge(clk) then
104
        r <= rin;
105
     end if;
106
  end process;
107
 
108
end;

powered by: WebSVN 2.1.0

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