c2d3cdd21c640bdbf32b0d4664684c01f9ba7b50
[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 ( ADDR_WIDTH : integer range 1 to integer'high);
48         port(clk : in std_logic;
49                 addr : in std_logic_vector(ADDR_WIDTH-1 downto 0);
50                 be : in std_logic_vector(3 downto 0);
51                 we : in std_logic; -- dummy :/
52                 wdata : in std_logic_vector(31 downto 0);
53                 q : out std_logic_vector(31 downto 0)
54         );
55         end component ram_xilinx;
56
57         component rom is
58         generic (
59                                 ADDR_WIDTH : integer range 1 to integer'high;
60                                 DATA_WIDTH : integer range 1 to integer'high
61                         );
62         port(
63                 --System inputs
64                         clk : in std_logic;
65                 --Input
66                         rd_addr : in std_logic_vector(ADDR_WIDTH-1 downto 0);                   
67                 --Output
68                         data_out : out std_logic_vector(DATA_WIDTH-1 downto 0)
69                 );
70         end component rom;
71         
72         component r2_w_ram is
73         generic (
74                                 ADDR_WIDTH : integer range 1 to integer'high;
75                                 DATA_WIDTH : integer range 1 to integer'high
76                         );
77         port(
78                 --System inputs
79                         clk : in std_logic;
80                 --Input
81                         wr_addr, rd_addr1, rd_addr2 : in std_logic_vector(ADDR_WIDTH-1 downto 0);
82                         
83                         wr_en : in std_logic;
84                         data_in : in std_logic_vector(DATA_WIDTH-1 downto 0);
85                         
86                 --Output
87                         data_out1, data_out2: out std_logic_vector(DATA_WIDTH-1 downto 0)
88                 );
89         end component r2_w_ram;
90         
91         component rw_r_ram is
92         generic (
93                                 ADDR_WIDTH : integer range 1 to integer'high;
94                                 DATA_WIDTH : integer range 1 to integer'high
95                         );
96         port(
97                 --System inputs
98                         clk : in std_logic;
99                 --Input
100                         rw_addr, rd_addr : in std_logic_vector(ADDR_WIDTH-1 downto 0);
101                         
102                         wr_en : in std_logic;
103                         data_in : in std_logic_vector(DATA_WIDTH-1 downto 0);
104                         
105                 --Output
106                         rw_out, rd_out: out std_logic_vector(DATA_WIDTH-1 downto 0)
107                 );
108         end component rw_r_ram;
109
110 end package mem_pkg;