2c66fb34d5b60d52f9e9888ea8e63186dd757f43
[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 rom is
47         generic (
48                                 ADDR_WIDTH : integer range 1 to integer'high;
49                                 DATA_WIDTH : integer range 1 to integer'high
50                         );
51         port(
52                 --System inputs
53                         clk : in std_logic;
54                 --Input
55                         wr_addr, rd_addr : in std_logic_vector(ADDR_WIDTH-1 downto 0);
56                         
57                         wr_en : in std_logic;
58                         data_in : in std_logic_vector(DATA_WIDTH-1 downto 0);
59                         
60                 --Output
61                         data_out: out std_logic_vector(DATA_WIDTH-1 downto 0)
62                 );
63         end component rom;
64         
65         component r2_w_ram 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                         wr_addr, rd_addr1, rd_addr2 : in std_logic_vector(ADDR_WIDTH-1 downto 0);
75                         
76                         wr_en : in std_logic;
77                         data_in : in std_logic_vector(DATA_WIDTH-1 downto 0);
78                         
79                 --Output
80                         data_out1, data_out2: out std_logic_vector(DATA_WIDTH-1 downto 0)
81                 );
82         end component r2_w_ram;
83         
84         component rw_r_ram is
85         generic (
86                                 ADDR_WIDTH : integer range 1 to integer'high;
87                                 DATA_WIDTH : integer range 1 to integer'high
88                         );
89         port(
90                 --System inputs
91                         clk : in std_logic;
92                 --Input
93                         rw_addr, rd_addr : in std_logic_vector(ADDR_WIDTH-1 downto 0);
94                         
95                         wr_en : in std_logic;
96                         data_in : in std_logic_vector(DATA_WIDTH-1 downto 0);
97                         
98                 --Output
99                         rw_out, rd_out: out std_logic_vector(DATA_WIDTH-1 downto 0)
100                 );
101         end component rw_r_ram;
102
103 end package mem_pkg;