1 |
2 |
dimamali |
------------------------------------------------------------------------------
|
2 |
|
|
-- This file is a part of the GRLIB VHDL IP LIBRARY
|
3 |
|
|
-- Copyright (C) 2003, Gaisler Research
|
4 |
|
|
--
|
5 |
|
|
-- This program is free software; you can redistribute it and/or modify
|
6 |
|
|
-- it under the terms of the GNU General Public License as published by
|
7 |
|
|
-- the Free Software Foundation; either version 2 of the License, or
|
8 |
|
|
-- (at your option) any later version.
|
9 |
|
|
--
|
10 |
|
|
-- This program is distributed in the hope that it will be useful,
|
11 |
|
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
|
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
|
|
-- GNU General Public License for more details.
|
14 |
|
|
--
|
15 |
|
|
-- You should have received a copy of the GNU General Public License
|
16 |
|
|
-- along with this program; if not, write to the Free Software
|
17 |
|
|
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
18 |
|
|
-----------------------------------------------------------------------------
|
19 |
|
|
-- Entity: various
|
20 |
|
|
-- File: memory_eclipse.vhd
|
21 |
|
|
-- Author: Jiri Gaisler Gaisler Research
|
22 |
|
|
-- Description: Memory generators for Quicklogic Eclipse rams
|
23 |
|
|
------------------------------------------------------------------------------
|
24 |
|
|
|
25 |
|
|
library ieee;
|
26 |
|
|
use ieee.std_logic_1164.all;
|
27 |
|
|
-- translate_off
|
28 |
|
|
library eclipsee;
|
29 |
|
|
use eclipsee.all;
|
30 |
|
|
-- translate_on
|
31 |
|
|
|
32 |
|
|
entity eclipse_syncram_2p is
|
33 |
|
|
generic ( abits : integer := 8; dbits : integer := 32);
|
34 |
|
|
port (
|
35 |
|
|
rclk : in std_ulogic;
|
36 |
|
|
rena : in std_ulogic;
|
37 |
|
|
raddr : in std_logic_vector (abits -1 downto 0);
|
38 |
|
|
dout : out std_logic_vector (dbits -1 downto 0);
|
39 |
|
|
wclk : in std_ulogic;
|
40 |
|
|
waddr : in std_logic_vector (abits -1 downto 0);
|
41 |
|
|
din : in std_logic_vector (dbits -1 downto 0);
|
42 |
|
|
write : in std_ulogic);
|
43 |
|
|
end;
|
44 |
|
|
|
45 |
|
|
architecture rtl of eclipse_syncram_2p is
|
46 |
|
|
component RAM128X18_25um is
|
47 |
|
|
port (WA, RA : in std_logic_vector (6 downto 0);
|
48 |
|
|
WD : in std_logic_vector (17 downto 0);
|
49 |
|
|
WE, RE, WCLK, RCLK, ASYNCRD : in std_logic;
|
50 |
|
|
RD : out std_logic_vector (17 downto 0) );
|
51 |
|
|
end component;
|
52 |
|
|
|
53 |
|
|
component RAM256X9_25um is
|
54 |
|
|
port (WA, RA : in std_logic_vector (7 downto 0);
|
55 |
|
|
WD : in std_logic_vector (8 downto 0);
|
56 |
|
|
WE, RE, WCLK, RCLK, ASYNCRD : in std_logic;
|
57 |
|
|
RD : out std_logic_vector (8 downto 0) );
|
58 |
|
|
end component;
|
59 |
|
|
|
60 |
|
|
component RAM512X4_25um
|
61 |
|
|
port (WA, RA : in std_logic_vector (8 downto 0);
|
62 |
|
|
WD : in std_logic_vector (3 downto 0);
|
63 |
|
|
WE, RE, WCLK, RCLK, ASYNCRD : in std_logic;
|
64 |
|
|
RD : out std_logic_vector (3 downto 0));
|
65 |
|
|
end component;
|
66 |
|
|
|
67 |
|
|
component RAM1024X2_25um is
|
68 |
|
|
port (WA, RA : in std_logic_vector (9 downto 0);
|
69 |
|
|
WD : in std_logic_vector (1 downto 0);
|
70 |
|
|
WE, RE, WCLK, RCLK, ASYNCRD : in std_logic;
|
71 |
|
|
RD : out std_logic_vector (1 downto 0) );
|
72 |
|
|
end component;
|
73 |
|
|
|
74 |
|
|
constant dlen : integer := dbits + 18;
|
75 |
|
|
signal di1, q2, gnd : std_logic_vector(dlen downto 0);
|
76 |
|
|
signal a1, a2 : std_logic_vector(12 downto 0);
|
77 |
|
|
begin
|
78 |
|
|
|
79 |
|
|
gnd <= (others => '0');
|
80 |
|
|
di1(dbits-1 downto 0) <= din; di1(dlen downto dbits) <= (others => '0');
|
81 |
|
|
a1(abits-1 downto 0) <= waddr; a1(12 downto abits) <= (others => '0');
|
82 |
|
|
a2(abits-1 downto 0) <= raddr; a2(12 downto abits) <= (others => '0');
|
83 |
|
|
dout <= q2(dbits-1 downto 0); q2(dlen downto dbits) <= (others => '0');
|
84 |
|
|
a7 : if (abits <= 7) generate
|
85 |
|
|
x : for i in 0 to (dbits-1)/18 generate
|
86 |
|
|
u0 : RAM128X18_25um port map (
|
87 |
|
|
a1(6 downto 0), a2(6 downto 0), di1(i*18+17 downto i*18),
|
88 |
|
|
write, rena, wclk, rclk, gnd(0), q2(i*18+17 downto i*18));
|
89 |
|
|
end generate;
|
90 |
|
|
end generate;
|
91 |
|
|
a8 : if (abits = 8) generate
|
92 |
|
|
x : for i in 0 to (dbits-1)/9 generate
|
93 |
|
|
u0 : RAM256X9_25um port map (
|
94 |
|
|
a1(7 downto 0), a2(7 downto 0), di1(i*9+8 downto i*9),
|
95 |
|
|
write, rena, wclk, rclk, gnd(0), q2(i*9+8 downto i*9));
|
96 |
|
|
end generate;
|
97 |
|
|
end generate;
|
98 |
|
|
a9 : if (abits = 9) generate
|
99 |
|
|
x : for i in 0 to (dbits-1)/4 generate
|
100 |
|
|
u0 : RAM512X4_25um port map (
|
101 |
|
|
a1(8 downto 0), a2(8 downto 0), di1(i*4+3 downto i*4),
|
102 |
|
|
write, rena, wclk, rclk, gnd(0), q2(i*4+3 downto i*4));
|
103 |
|
|
end generate;
|
104 |
|
|
end generate;
|
105 |
|
|
a10 : if (abits = 10) generate
|
106 |
|
|
x : for i in 0 to (dbits-1)/2 generate
|
107 |
|
|
u0 : RAM1024X2_25um port map (
|
108 |
|
|
a1(9 downto 0), a2(9 downto 0), di1(i*2+1 downto i*2),
|
109 |
|
|
write, rena, wclk, rclk, gnd(0), q2(i*2+1 downto i*2));
|
110 |
|
|
end generate;
|
111 |
|
|
end generate;
|
112 |
|
|
-- pragma translate_off
|
113 |
|
|
unsup : if abits > 10 generate
|
114 |
|
|
x : process
|
115 |
|
|
begin
|
116 |
|
|
assert false
|
117 |
|
|
report "Address depth larger than 10 is not supported for Eclipse rams"
|
118 |
|
|
severity failure;
|
119 |
|
|
wait;
|
120 |
|
|
end process;
|
121 |
|
|
end generate;
|
122 |
|
|
-- pragma translate_on
|
123 |
|
|
end;
|