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

Subversion Repositories riscv_vhdl

[/] [riscv_vhdl/] [trunk/] [rtl/] [misclib/] [nasti_romimage.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     Firmware ROM image with the AXI4 interface
6
------------------------------------------------------------------------------
7
 
8
library ieee;
9
use ieee.std_logic_1164.all;
10
library techmap;
11
use techmap.gencomp.all;
12
use techmap.types_mem.all;
13
library commonlib;
14
use commonlib.types_common.all;
15
--! AMBA system bus specific library.
16
library ambalib;
17
--! AXI4 configuration constants.
18
use ambalib.types_amba4.all;
19
 
20
 
21
entity nasti_romimage is
22
  generic (
23
    memtech  : integer := inferred;
24
    xaddr    : integer := 0;
25
    xmask    : integer := 16#fffff#;
26
    sim_hexfile : string
27
  );
28
  port (
29
    clk  : in std_logic;
30
    nrst : in std_logic;
31
    cfg  : out nasti_slave_config_type;
32
    i    : in  nasti_slave_in_type;
33
    o    : out nasti_slave_out_type
34
  );
35
end;
36
 
37
architecture arch_nasti_romimage of nasti_romimage is
38
 
39
  constant xconfig : nasti_slave_config_type := (
40
     descrtype => PNP_CFG_TYPE_SLAVE,
41
     descrsize => PNP_CFG_SLAVE_DESCR_BYTES,
42
     irq_idx => 0,
43
     xaddr => conv_std_logic_vector(xaddr, CFG_NASTI_CFG_ADDR_BITS),
44
     xmask => conv_std_logic_vector(xmask, CFG_NASTI_CFG_ADDR_BITS),
45
     vid => VENDOR_GNSSSENSOR,
46
     did => GNSSSENSOR_FWIMAGE
47
  );
48
 
49
  type registers is record
50
    bank_axi : nasti_slave_bank_type;
51
  end record;
52
 
53
signal r, rin : registers;
54
 
55
signal raddr_mux : global_addr_array_type;
56
signal rdata_mux : std_logic_vector(CFG_NASTI_DATA_BITS-1 downto 0);
57
 
58
begin
59
 
60
  comblogic : process(nrst, i, r, rdata_mux)
61
    variable v : registers;
62
    variable rdata : std_logic_vector(CFG_NASTI_DATA_BITS-1 downto 0);
63
  begin
64
 
65
    v := r;
66
 
67
    procedureAxi4(i, xconfig, r.bank_axi, v.bank_axi);
68
 
69
    raddr_mux <= functionAddressReorder(v.bank_axi.raddr(0)(3 downto 2),
70
                                        v.bank_axi.raddr);
71
 
72
    rdata := functionDataRestoreOrder(r.bank_axi.raddr(0)(3 downto 2),
73
                                          rdata_mux);
74
 
75
    o <= functionAxi4Output(r.bank_axi, rdata);
76
 
77
    if nrst = '0' then
78
       v.bank_axi := NASTI_SLAVE_BANK_RESET;
79
    end if;
80
 
81
    rin <= v;
82
  end process;
83
 
84
  cfg  <= xconfig;
85
 
86
  tech0 : RomImage_tech generic map (
87
    memtech     => memtech,
88
    sim_hexfile => sim_hexfile
89
  ) port map (
90
    clk     => clk,
91
    address => raddr_mux,
92
    data    => rdata_mux
93
  );
94
 
95
  -- registers:
96
  regs : process(clk)
97
  begin
98
     if rising_edge(clk) then
99
        r <= rin;
100
     end if;
101
  end process;
102
 
103
end;

powered by: WebSVN 2.1.0

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