spartan3e: BRAM gehaxe. lesbarer und wird auch richtig(er) instanziert
[calu.git] / cpu / src / mem_pkg.vhd
1 library IEEE;
2
3 use IEEE.std_logic_1164.all;
4 use IEEE.numeric_std.all;
5
6 package mem_pkg is
7
8         component r_w_ram is
9         generic (
10                                 ADDR_WIDTH : integer range 1 to integer'high;
11                                 DATA_WIDTH : integer range 1 to integer'high
12                         );
13         port(
14                 --System inputs
15                         clk : in std_logic;
16                 --Input
17                         wr_addr, rd_addr : in std_logic_vector(ADDR_WIDTH-1 downto 0);
18                         
19                         wr_en : in std_logic;
20                         data_in : in std_logic_vector(DATA_WIDTH-1 downto 0);
21                         
22                 --Output
23                         data_out: out std_logic_vector(DATA_WIDTH-1 downto 0)
24                 );
25         end component r_w_ram;
26
27         component r_w_ram_be is
28         generic (
29                                 ADDR_WIDTH : integer range 1 to integer'high
30                         );
31         port(
32                 clk : in std_logic;
33
34                 waddr, raddr : in std_logic_vector(ADDR_WIDTH-1 downto 0);
35
36                 be : in std_logic_vector (3 downto 0);
37                 
38                 we : in std_logic;
39
40                 wdata : in std_logic_vector(31 downto 0);
41                 
42                 q : out std_logic_vector(31 downto 0)
43         );
44         end component r_w_ram_be;
45
46         component ram_xilinx is
47         generic (
48                                 ADDR_WIDTH : integer range 1 to integer'high
49                         );
50         port(
51                 clk : in std_logic;
52
53                 waddr, raddr : in std_logic_vector(ADDR_WIDTH-1 downto 0);
54
55                 be : in std_logic_vector (3 downto 0);
56                 
57                 we : in std_logic;
58
59                 wdata : in std_logic_vector(31 downto 0);
60                 
61                 q : out std_logic_vector(31 downto 0)
62         );
63         end component ram_xilinx;
64
65         component rom is
66         generic (
67                                 ADDR_WIDTH : integer range 1 to integer'high;
68                                 DATA_WIDTH : integer range 1 to integer'high
69                         );
70         port(
71                 --System inputs
72                         clk : in std_logic;
73                 --Input
74                         rd_addr : in std_logic_vector(ADDR_WIDTH-1 downto 0);                   
75                 --Output
76                         data_out : out std_logic_vector(DATA_WIDTH-1 downto 0)
77                 );
78         end component rom;
79         
80         component r2_w_ram is
81         generic (
82                                 ADDR_WIDTH : integer range 1 to integer'high;
83                                 DATA_WIDTH : integer range 1 to integer'high
84                         );
85         port(
86                 --System inputs
87                         clk : in std_logic;
88                 --Input
89                         wr_addr, rd_addr1, rd_addr2 : in std_logic_vector(ADDR_WIDTH-1 downto 0);
90                         
91                         wr_en : in std_logic;
92                         data_in : in std_logic_vector(DATA_WIDTH-1 downto 0);
93                         
94                 --Output
95                         data_out1, data_out2: out std_logic_vector(DATA_WIDTH-1 downto 0)
96                 );
97         end component r2_w_ram;
98         
99         component rw_r_ram is
100         generic (
101                                 ADDR_WIDTH : integer range 1 to integer'high;
102                                 DATA_WIDTH : integer range 1 to integer'high
103                         );
104         port(
105                 --System inputs
106                         clk : in std_logic;
107                 --Input
108                         rw_addr, rd_addr : in std_logic_vector(ADDR_WIDTH-1 downto 0);
109                         
110                         wr_en : in std_logic;
111                         data_in : in std_logic_vector(DATA_WIDTH-1 downto 0);
112                         
113                 --Output
114                         rw_out, rd_out: out std_logic_vector(DATA_WIDTH-1 downto 0)
115                 );
116         end component rw_r_ram;
117
118 end package mem_pkg;