2 use ieee.std_logic_1164.all;
3 use ieee.numeric_std.all;
7 IMEM_BASE : std_ulogic_vector(31 downto 0) := x"00000000";
8 IMEM_SIZE : natural := 4*1024
11 clk_i : in std_ulogic;
12 rden_i : in std_ulogic;
13 wren_i : in std_ulogic;
14 ben_i : in std_ulogic_vector(03 downto 0);
15 addr_i : in std_ulogic_vector(31 downto 0);
16 data_i : in std_ulogic_vector(31 downto 0);
17 data_o : out std_ulogic_vector(31 downto 0);
18 ack_o : out std_ulogic
22 architecture ok of imem is
23 signal addr : std_ulogic_vector(15 downto 0);
24 type ram_t is array(0 to 2**15-1) of std_ulogic_vector(31 downto 0);
25 signal acc_en : std_ulogic;
26 constant abb_c : std_logic_vector(31 downto 16) := (others=>'0');
28 addr <= addr_i(addr'left+2 downto 2); -- word aligned
29 acc_en <= addr_i(abb_c'range) ?= IMEM_BASE(abb_c'range);
31 variable memory : ram_t;
33 if rising_edge(clk_i) then
35 ack_o <= rden_i or wren_i;
37 if acc_en and wren_i then
40 memory(to_integer(unsigned(addr)))((x+1)*8-1 downto x*8) := data_i((x+1)*8-1 downto x*8);
44 if acc_en and rden_i then
45 data_o <= memory(to_integer(unsigned(addr)));
51 architecture notok of imem is
52 signal addr : std_ulogic_vector(15 downto 0);
53 type ram_t is array(0 to 2**15-1) of std_ulogic_vector(31 downto 0);
54 signal acc_en : std_ulogic;
55 constant abb_c : std_logic_vector(31 downto 16) := (others=>'0');
57 addr <= addr_i(addr'left+2 downto 2); -- word aligned
58 acc_en <= addr_i(abb_c'range) ?= IMEM_BASE(abb_c'range);
60 variable memory : ram_t;
62 if rising_edge(clk_i) and acc_en='1' then
63 ack_o <= rden_i or wren_i;
67 memory(to_integer(unsigned(addr)))((x+1)*8-1 downto x*8) := data_i((x+1)*8-1 downto x*8);
72 data_o <= memory(to_integer(unsigned(addr)));
78 architecture neitherok of imem is
79 signal addr : std_ulogic_vector(15 downto 0);
80 type ram_t is array(0 to 2**15-1) of std_ulogic_vector(31 downto 0);
81 signal acc_en : std_ulogic;
82 constant abb_c : std_logic_vector(31 downto 16) := (others=>'0');
84 addr <= addr_i(addr'left+2 downto 2); -- word aligned
85 acc_en <= addr_i(abb_c'range) ?= IMEM_BASE(abb_c'range);
87 variable memory : ram_t;
89 if rising_edge(clk_i) then
91 ack_o <= rden_i or wren_i;
95 memory(to_integer(unsigned(addr)))((x+1)*8-1 downto x*8) := data_i((x+1)*8-1 downto x*8);
100 data_o <= memory(to_integer(unsigned(addr)));