906f175f8ca9d552899f45225cd24042a05a48fe
[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                         rd_addr : in std_logic_vector(ADDR_WIDTH-1 downto 0);                   
56                 --Output
57                         data_out : out std_logic_vector(DATA_WIDTH-1 downto 0)
58                 );
59         end component rom;
60         
61         component r2_w_ram is
62         generic (
63                                 ADDR_WIDTH : integer range 1 to integer'high;
64                                 DATA_WIDTH : integer range 1 to integer'high
65                         );
66         port(
67                 --System inputs
68                         clk : in std_logic;
69                 --Input
70                         wr_addr, rd_addr1, rd_addr2 : in std_logic_vector(ADDR_WIDTH-1 downto 0);
71                         
72                         wr_en : in std_logic;
73                         data_in : in std_logic_vector(DATA_WIDTH-1 downto 0);
74                         
75                 --Output
76                         data_out1, data_out2: out std_logic_vector(DATA_WIDTH-1 downto 0)
77                 );
78         end component r2_w_ram;
79         
80         component rw_r_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                         rw_addr, rd_addr : 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                         rw_out, rd_out: out std_logic_vector(DATA_WIDTH-1 downto 0)
96                 );
97         end component rw_r_ram;
98
99 end package mem_pkg;