]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/lx-rocon.git/blob - hw/lx-rocon_tumbl/lx_rocon_dmem.vhd
Multiple changes in FPGA, include Tumbl coprocessor
[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
25                 -- Memory wiring for Master CPU
26                 clk_m  : in std_logic;
27     en_m   : in std_logic;
28     we_m   : in std_logic_vector(3 downto 0);
29     addr_m : in std_logic_vector(9 downto 0);
30     din_m  : in std_logic_vector(31 downto 0);
31     dout_m : out std_logic_vector(31 downto 0)
32
33         );
34 end lx_rocon_dmem;
35
36 architecture rtl of lx_rocon_dmem is
37
38         signal wre_i_s : std_logic_vector(3 downto 0);
39
40 begin
41
42         wre_i_s <= bsel_i when (wre_i = '1') else "0000";
43
44         I_RAMB: xilinx_dualport_bram
45         generic map
46         (
47                 we_width => 4,
48                 byte_width => 8,
49                 address_width => 10
50         )
51         port map
52         (
53                 -- Tumblr port
54                 clka => clk_i,
55                 rsta => '0',
56                 ena => ce_i,
57                 wea => wre_i_s,
58                 addra => adr_i(11 downto 2),
59                 dina => dat_i,
60                 douta => dat_o,
61
62                 -- Master CPU port
63                 clkb => clk_m,
64                 rstb => '0',
65                 enb => en_m,
66                 web => we_m,
67                 addrb => addr_m,
68                 dinb => din_m,
69                 doutb => dout_m
70         );
71
72 end rtl;