]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/lx-rocon.git/blob - hw/lx-rocon_tumbl/lx_rocon_dmem.vhd
2315529a49b49deb0adeb7d97f834cb31c3cd20a
[fpga/lx-cpu1/lx-rocon.git] / hw / lx-rocon_tumbl / lx_rocon_dmem.vhd
1 library ieee;
2
3 use ieee.std_logic_1164.all;
4 use ieee.std_logic_arith.all;
5 use ieee.std_logic_unsigned.all;
6 use ieee.numeric_std.all;
7 use work.mbl_Pkg.all;
8 use work.lx_rocon_pkg.all;
9
10 -- 4 kB data memory for Thumbl core
11 -- To be flashed from the Master CPU
12
13 entity lx_rocon_dmem is
14         port
15         (
16                 -- Memory wiring for Tumbl
17                 clk_i  : in std_logic;
18                 ce_i   : in std_logic;
19                 adr_i  : in std_logic_vector(11 downto 2);
20                 wre_i  : in std_logic;
21                 bsel_i : in std_logic_vector(3 downto 0);
22                 dat_i  : in std_logic_vector(31 downto 0);
23                 dat_o  : out std_logic_vector(31 downto 0);
24                 -- Memory wiring for Master CPU
25                 clk_m  : in std_logic;
26     en_m   : in std_logic;
27     we_m   : in std_logic_vector(3 downto 0);
28     addr_m : in std_logic_vector(9 downto 0);
29     din_m  : in std_logic_vector(31 downto 0);
30     dout_m : out std_logic_vector(31 downto 0)
31         );
32 end lx_rocon_dmem;
33
34 architecture rtl of lx_rocon_dmem is
35
36         signal wre_i_s : std_logic_vector(3 downto 0);
37
38 begin
39
40         wre_i_s <= bsel_i when (wre_i = '1') else "0000";
41
42         I_RAMB: xilinx_dualport_bram_write_first
43         generic map
44         (
45                 we_width => 4,
46                 byte_width => 8,
47                 address_width => 10
48         )
49         port map
50         (
51                 -- Tumblr port
52                 clka => clk_i,
53                 rsta => '0',
54                 ena => ce_i,
55                 wea => wre_i_s,
56                 addra => adr_i(11 downto 2),
57                 dina => dat_i,
58                 douta => dat_o,
59
60                 -- Master CPU port
61                 clkb => clk_m,
62                 rstb => '0',
63                 enb => en_m,
64                 web => we_m,
65                 addrb => addr_m,
66                 dinb => din_m,
67                 doutb => dout_m
68         );
69
70 end rtl;