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: cachemem
|
20 |
|
|
-- File: cachemem.vhd
|
21 |
|
|
-- Author: Jiri Gaisler - Gaisler Research
|
22 |
|
|
-- Description: Contains ram cells for both instruction and data caches
|
23 |
|
|
------------------------------------------------------------------------------
|
24 |
|
|
|
25 |
|
|
library ieee;
|
26 |
|
|
use ieee.std_logic_1164.all;
|
27 |
|
|
library gaisler;
|
28 |
|
|
use gaisler.libiu.all;
|
29 |
|
|
use gaisler.libcache.all;
|
30 |
|
|
use gaisler.mmuconfig.all;
|
31 |
|
|
library grlib;
|
32 |
|
|
use grlib.stdlib.all;
|
33 |
|
|
library techmap;
|
34 |
|
|
use techmap.gencomp.all;
|
35 |
|
|
|
36 |
|
|
entity cachemem is
|
37 |
|
|
generic (
|
38 |
|
|
tech : integer range 0 to NTECH := 0;
|
39 |
|
|
icen : integer range 0 to 1 := 0;
|
40 |
|
|
irepl : integer range 0 to 2 := 0;
|
41 |
|
|
isets : integer range 1 to 4 := 1;
|
42 |
|
|
ilinesize : integer range 4 to 8 := 4;
|
43 |
|
|
isetsize : integer range 1 to 256 := 1;
|
44 |
|
|
isetlock : integer range 0 to 1 := 0;
|
45 |
|
|
dcen : integer range 0 to 1 := 0;
|
46 |
|
|
drepl : integer range 0 to 2 := 0;
|
47 |
|
|
dsets : integer range 1 to 4 := 1;
|
48 |
|
|
dlinesize : integer range 4 to 8 := 4;
|
49 |
|
|
dsetsize : integer range 1 to 256 := 1;
|
50 |
|
|
dsetlock : integer range 0 to 1 := 0;
|
51 |
|
|
dsnoop : integer range 0 to 6 := 0;
|
52 |
|
|
ilram : integer range 0 to 1 := 0;
|
53 |
|
|
ilramsize : integer range 1 to 512 := 1;
|
54 |
|
|
dlram : integer range 0 to 1 := 0;
|
55 |
|
|
dlramsize : integer range 1 to 512 := 1;
|
56 |
|
|
mmuen : integer range 0 to 1 := 0
|
57 |
|
|
);
|
58 |
|
|
port (
|
59 |
|
|
clk : in std_ulogic;
|
60 |
|
|
crami : in cram_in_type;
|
61 |
|
|
cramo : out cram_out_type;
|
62 |
|
|
sclk : in std_ulogic
|
63 |
|
|
);
|
64 |
|
|
end;
|
65 |
|
|
|
66 |
|
|
architecture rtl of cachemem is
|
67 |
|
|
constant DSNOOPMMU : boolean := (dsnoop > 3);
|
68 |
|
|
constant ILINE_BITS : integer := log2(ilinesize);
|
69 |
|
|
constant IOFFSET_BITS : integer := 8 +log2(isetsize) - ILINE_BITS;
|
70 |
|
|
constant DLINE_BITS : integer := log2(dlinesize);
|
71 |
|
|
constant DOFFSET_BITS : integer := 8 +log2(dsetsize) - DLINE_BITS;
|
72 |
|
|
constant ITAG_BITS : integer := TAG_HIGH - IOFFSET_BITS - ILINE_BITS - 2 + ilinesize + 1;
|
73 |
|
|
constant DTAG_BITS : integer := TAG_HIGH - DOFFSET_BITS - DLINE_BITS - 2 + dlinesize + 1;
|
74 |
|
|
constant IPTAG_BITS : integer := TAG_HIGH - IOFFSET_BITS - ILINE_BITS - 2 + 1;
|
75 |
|
|
constant DPTAG_BITS : integer := TAG_HIGH - DOFFSET_BITS - DLINE_BITS - 2 + 1;
|
76 |
|
|
constant ILRR_BIT : integer := creplalg_tbl(irepl);
|
77 |
|
|
constant DLRR_BIT : integer := creplalg_tbl(drepl);
|
78 |
|
|
constant ITAG_LOW : integer := IOFFSET_BITS + ILINE_BITS + 2;
|
79 |
|
|
constant DTAG_LOW : integer := DOFFSET_BITS + DLINE_BITS + 2;
|
80 |
|
|
constant ICLOCK_BIT : integer := isetlock;
|
81 |
|
|
constant DCLOCK_BIT : integer := dsetlock;
|
82 |
|
|
constant ILRAM_BITS : integer := log2(ilramsize) + 10;
|
83 |
|
|
constant DLRAM_BITS : integer := log2(dlramsize) + 10;
|
84 |
|
|
|
85 |
|
|
|
86 |
|
|
constant ITDEPTH : natural := 2**IOFFSET_BITS;
|
87 |
|
|
constant DTDEPTH : natural := 2**DOFFSET_BITS;
|
88 |
|
|
constant MMUCTX_BITS : natural := 8*mmuen;
|
89 |
|
|
|
90 |
|
|
-- i/d tag layout
|
91 |
|
|
-- +-----+----------+--------+-----+-------+
|
92 |
|
|
-- | LRR | LOCK_BIT | MMUCTX | TAG | VALID |
|
93 |
|
|
-- +-----+----------+--------+-----+-------+
|
94 |
|
|
|
95 |
|
|
constant ITWIDTH : natural := ITAG_BITS + ILRR_BIT + isetlock + MMUCTX_BITS;
|
96 |
|
|
constant DTWIDTH : natural := DTAG_BITS + DLRR_BIT + dsetlock + MMUCTX_BITS;
|
97 |
|
|
constant IDWIDTH : natural := 32;
|
98 |
|
|
constant DDWIDTH : natural := 32;
|
99 |
|
|
|
100 |
|
|
subtype dtdatain_vector is std_logic_vector(DTWIDTH downto 0);
|
101 |
|
|
type dtdatain_type is array (0 to MAXSETS-1) of dtdatain_vector;
|
102 |
|
|
subtype itdatain_vector is std_logic_vector(ITWIDTH downto 0);
|
103 |
|
|
type itdatain_type is array (0 to MAXSETS-1) of itdatain_vector;
|
104 |
|
|
|
105 |
|
|
subtype itdataout_vector is std_logic_vector(ITWIDTH-1 downto 0);
|
106 |
|
|
type itdataout_type is array (0 to MAXSETS-1) of itdataout_vector;
|
107 |
|
|
subtype iddataout_vector is std_logic_vector(IDWIDTH -1 downto 0);
|
108 |
|
|
type iddataout_type is array (0 to MAXSETS-1) of iddataout_vector;
|
109 |
|
|
subtype dtdataout_vector is std_logic_vector(DTWIDTH-1 downto 0);
|
110 |
|
|
type dtdataout_type is array (0 to MAXSETS-1) of dtdataout_vector;
|
111 |
|
|
subtype dddataout_vector is std_logic_vector(DDWIDTH -1 downto 0);
|
112 |
|
|
type dddataout_type is array (0 to MAXSETS-1) of dddataout_vector;
|
113 |
|
|
|
114 |
|
|
|
115 |
|
|
signal itaddr : std_logic_vector(IOFFSET_BITS + ILINE_BITS -1 downto ILINE_BITS);
|
116 |
|
|
signal idaddr : std_logic_vector(IOFFSET_BITS + ILINE_BITS -1 downto 0);
|
117 |
|
|
signal ildaddr : std_logic_vector(ILRAM_BITS-3 downto 0);
|
118 |
|
|
|
119 |
|
|
signal itdatain : itdatain_type;
|
120 |
|
|
signal itdataout : itdataout_type;
|
121 |
|
|
signal iddatain : std_logic_vector(IDWIDTH -1 downto 0);
|
122 |
|
|
signal iddataout : iddataout_type;
|
123 |
|
|
signal ildataout : std_logic_vector(31 downto 0);
|
124 |
|
|
|
125 |
|
|
signal itenable : std_ulogic;
|
126 |
|
|
signal idenable : std_ulogic;
|
127 |
|
|
signal itwrite : std_logic_vector(0 to MAXSETS-1);
|
128 |
|
|
signal idwrite : std_logic_vector(0 to MAXSETS-1);
|
129 |
|
|
|
130 |
|
|
signal dtaddr : std_logic_vector(DOFFSET_BITS + DLINE_BITS -1 downto DLINE_BITS);
|
131 |
|
|
signal dtaddr2 : std_logic_vector(DOFFSET_BITS + DLINE_BITS -1 downto DLINE_BITS);
|
132 |
|
|
signal ddaddr : std_logic_vector(DOFFSET_BITS + DLINE_BITS -1 downto 0);
|
133 |
|
|
signal ldaddr : std_logic_vector(DLRAM_BITS-1 downto 2);
|
134 |
|
|
|
135 |
|
|
signal dtdatain : dtdatain_type;
|
136 |
|
|
signal dtdatain2 : dtdatain_type;
|
137 |
|
|
signal dtdatain3 : dtdatain_type;
|
138 |
|
|
signal dtdatainu : dtdatain_type;
|
139 |
|
|
signal dtdataout : dtdataout_type;
|
140 |
|
|
signal dtdataout2: dtdataout_type;
|
141 |
|
|
signal dtdataout3: dtdataout_type;
|
142 |
|
|
signal dddatain : cdatatype;
|
143 |
|
|
signal dddataout : dddataout_type;
|
144 |
|
|
signal lddatain, ldataout : std_logic_vector(31 downto 0);
|
145 |
|
|
|
146 |
|
|
signal dtenable : std_logic_vector(0 to MAXSETS-1);
|
147 |
|
|
signal dtenable2 : std_logic_vector(0 to MAXSETS-1);
|
148 |
|
|
signal ddenable : std_logic_vector(0 to MAXSETS-1);
|
149 |
|
|
signal dtwrite : std_logic_vector(0 to MAXSETS-1);
|
150 |
|
|
signal dtwrite2 : std_logic_vector(0 to MAXSETS-1);
|
151 |
|
|
signal dtwrite3 : std_logic_vector(0 to MAXSETS-1);
|
152 |
|
|
signal ddwrite : std_logic_vector(0 to MAXSETS-1);
|
153 |
|
|
|
154 |
|
|
signal vcc, gnd : std_ulogic;
|
155 |
|
|
|
156 |
|
|
begin
|
157 |
|
|
|
158 |
|
|
vcc <= '1'; gnd <= '0';
|
159 |
|
|
itaddr <= crami.icramin.address(IOFFSET_BITS + ILINE_BITS -1 downto ILINE_BITS);
|
160 |
|
|
idaddr <= crami.icramin.address(IOFFSET_BITS + ILINE_BITS -1 downto 0);
|
161 |
|
|
ildaddr <= crami.icramin.address(ILRAM_BITS-3 downto 0);
|
162 |
|
|
|
163 |
|
|
itinsel : process(crami, dtdataout2, dtdataout3)
|
164 |
|
|
|
165 |
|
|
variable viddatain : std_logic_vector(IDWIDTH -1 downto 0);
|
166 |
|
|
variable vdddatain : cdatatype;
|
167 |
|
|
variable vitdatain : itdatain_type;
|
168 |
|
|
variable vdtdatain : dtdatain_type;
|
169 |
|
|
variable vdtdatain2 : dtdatain_type;
|
170 |
|
|
variable vdtdatain3 : dtdatain_type;
|
171 |
|
|
variable vdtdatainu : dtdatain_type;
|
172 |
|
|
begin
|
173 |
|
|
viddatain := (others => '0');
|
174 |
|
|
vdddatain := (others => (others => '0'));
|
175 |
|
|
|
176 |
|
|
viddatain(31 downto 0) := crami.icramin.data;
|
177 |
|
|
|
178 |
|
|
for i in 0 to DSETS-1 loop
|
179 |
|
|
vdtdatain(i) := (others => '0');
|
180 |
|
|
if mmuen = 1 then
|
181 |
|
|
vdtdatain(i)((DTWIDTH - (DLRR_BIT+dsetlock+1)) downto (DTWIDTH - (DLRR_BIT+dsetlock+M_CTX_SZ))) := crami.dcramin.ctx(i);
|
182 |
|
|
end if;
|
183 |
|
|
vdtdatain(i)(DTWIDTH-(DCLOCK_BIT + dsetlock)) := crami.dcramin.tag(i)(CTAG_LOCKPOS);
|
184 |
|
|
vdtdatain(i)(DTWIDTH-DLRR_BIT) := crami.dcramin.tag(i)(CTAG_LRRPOS);
|
185 |
|
|
vdtdatain(i)(DTAG_BITS-1 downto 0) := crami.dcramin.tag(i)(TAG_HIGH downto DTAG_LOW) & crami.dcramin.tag(i)(dlinesize-1 downto 0);
|
186 |
|
|
if (DSETS > 1) and (crami.dcramin.flush = '1') then
|
187 |
|
|
vdtdatain(i)(dlinesize+1 downto dlinesize) := conv_std_logic_vector(i,2);
|
188 |
|
|
end if;
|
189 |
|
|
end loop;
|
190 |
|
|
|
191 |
|
|
vdtdatain2 := (others => (others => '0'));
|
192 |
|
|
for i in 0 to DSETS-1 loop
|
193 |
|
|
if (DSETS > 1) then
|
194 |
|
|
vdtdatain2(i)(dlinesize+1 downto dlinesize) := conv_std_logic_vector(i,2);
|
195 |
|
|
end if;
|
196 |
|
|
end loop;
|
197 |
|
|
vdddatain := crami.dcramin.data;
|
198 |
|
|
|
199 |
|
|
vdtdatainu := (others => (others => '0'));
|
200 |
|
|
vdtdatain3 := (others => (others => '0'));
|
201 |
|
|
for i in 0 to DSETS-1 loop
|
202 |
|
|
vdtdatain3(i) := (others => '0');
|
203 |
|
|
vdtdatain3(i)(DTAG_BITS-1 downto DTAG_BITS-DPTAG_BITS) := crami.dcramin.ptag(i)(TAG_HIGH downto DTAG_LOW);
|
204 |
|
|
end loop;
|
205 |
|
|
|
206 |
|
|
for i in 0 to ISETS-1 loop
|
207 |
|
|
vitdatain(i) := (others => '0');
|
208 |
|
|
if mmuen = 1 then
|
209 |
|
|
vitdatain(i)((ITWIDTH - (ILRR_BIT+isetlock+1)) downto (ITWIDTH - (ILRR_BIT+isetlock+M_CTX_SZ))) := crami.icramin.ctx;
|
210 |
|
|
end if;
|
211 |
|
|
vitdatain(i)(ITWIDTH-(ICLOCK_BIT + isetlock)) := crami.icramin.tag(i)(CTAG_LOCKPOS);
|
212 |
|
|
vitdatain(i)(ITWIDTH-ILRR_BIT) := crami.icramin.tag(i)(CTAG_LRRPOS);
|
213 |
|
|
vitdatain(i)(ITAG_BITS-1 downto 0) := crami.icramin.tag(i)(TAG_HIGH downto ITAG_LOW) & crami.icramin.tag(i)(ilinesize-1 downto 0);
|
214 |
|
|
if (ISETS > 1) and (crami.icramin.flush = '1') then
|
215 |
|
|
vitdatain(i)(ilinesize+1 downto ilinesize) := conv_std_logic_vector(i,2);
|
216 |
|
|
end if;
|
217 |
|
|
end loop;
|
218 |
|
|
|
219 |
|
|
itdatain <= vitdatain; iddatain <= viddatain;
|
220 |
|
|
dtdatain <= vdtdatain; dtdatain2 <= vdtdatain2; dtdatain3 <= vdtdatain3; dtdatainu <= vdtdatainu; dddatain <= vdddatain;
|
221 |
|
|
|
222 |
|
|
end process;
|
223 |
|
|
|
224 |
|
|
|
225 |
|
|
itwrite <= crami.icramin.twrite;
|
226 |
|
|
idwrite <= crami.icramin.dwrite;
|
227 |
|
|
itenable <= crami.icramin.tenable;
|
228 |
|
|
idenable <= crami.icramin.denable;
|
229 |
|
|
|
230 |
|
|
dtaddr <= crami.dcramin.address(DOFFSET_BITS + DLINE_BITS -1 downto DLINE_BITS);
|
231 |
|
|
dtaddr2 <= crami.dcramin.saddress(DOFFSET_BITS-1 downto 0);
|
232 |
|
|
ddaddr <= crami.dcramin.address(DOFFSET_BITS + DLINE_BITS -1 downto 0);
|
233 |
|
|
ldaddr <= crami.dcramin.ldramin.address(DLRAM_BITS-1 downto 2);
|
234 |
|
|
dtwrite <= crami.dcramin.twrite;
|
235 |
|
|
dtwrite2 <= crami.dcramin.swrite;
|
236 |
|
|
dtwrite3 <= crami.dcramin.tpwrite;
|
237 |
|
|
ddwrite <= crami.dcramin.dwrite;
|
238 |
|
|
dtenable <= crami.dcramin.tenable;
|
239 |
|
|
dtenable2 <= crami.dcramin.senable;
|
240 |
|
|
ddenable <= crami.dcramin.denable;
|
241 |
|
|
|
242 |
|
|
|
243 |
|
|
ime : if icen = 1 generate
|
244 |
|
|
im0 : for i in 0 to ISETS-1 generate
|
245 |
|
|
itags0 : syncram generic map (tech, IOFFSET_BITS, ITWIDTH)
|
246 |
|
|
port map ( clk, itaddr, itdatain(i)(ITWIDTH-1 downto 0), itdataout(i)(ITWIDTH-1 downto 0), itenable, itwrite(i));
|
247 |
|
|
idata0 : syncram generic map (tech, IOFFSET_BITS+ILINE_BITS, IDWIDTH)
|
248 |
|
|
port map (clk, idaddr, iddatain, iddataout(i), idenable, idwrite(i));
|
249 |
|
|
end generate;
|
250 |
|
|
ind0 : for i in ISETS to MAXSETS-1 generate
|
251 |
|
|
itdataout(i) <= (others => '0');
|
252 |
|
|
iddataout(i) <= (others => '0');
|
253 |
|
|
end generate;
|
254 |
|
|
end generate;
|
255 |
|
|
|
256 |
|
|
imd : if icen = 0 generate
|
257 |
|
|
ind0 : for i in 0 to ISETS-1 generate
|
258 |
|
|
itdataout(i) <= (others => '0');
|
259 |
|
|
iddataout(i) <= (others => '0');
|
260 |
|
|
end generate;
|
261 |
|
|
end generate;
|
262 |
|
|
|
263 |
|
|
ild0 : if ilram = 1 generate
|
264 |
|
|
ildata0 : syncram
|
265 |
|
|
generic map (tech, ILRAM_BITS-2, 32)
|
266 |
|
|
port map (clk, ildaddr, iddatain, ildataout,
|
267 |
|
|
crami.icramin.ldramin.enable, crami.icramin.ldramin.write);
|
268 |
|
|
end generate;
|
269 |
|
|
|
270 |
|
|
dme : if dcen = 1 generate
|
271 |
|
|
dtags0 : if DSNOOP = 0 generate
|
272 |
|
|
dt0 : for i in 0 to DSETS-1 generate
|
273 |
|
|
dtags0 : syncram
|
274 |
|
|
generic map (tech, DOFFSET_BITS, DTWIDTH)
|
275 |
|
|
port map (clk, dtaddr, dtdatain(i)(DTWIDTH-1 downto 0),
|
276 |
|
|
dtdataout(i)(DTWIDTH-1 downto 0), dtenable(i), dtwrite(i));
|
277 |
|
|
end generate;
|
278 |
|
|
end generate;
|
279 |
|
|
|
280 |
|
|
dtags1 : if DSNOOP /= 0 generate
|
281 |
|
|
dt1 : if ((MMUEN = 0) or not DSNOOPMMU) generate
|
282 |
|
|
dt0 : for i in 0 to DSETS-1 generate
|
283 |
|
|
dtags0 : syncram_dp
|
284 |
|
|
generic map (tech, DOFFSET_BITS, DTWIDTH) port map (
|
285 |
|
|
clk, dtaddr, dtdatain(i)(DTWIDTH-1 downto 0),
|
286 |
|
|
dtdataout(i)(DTWIDTH-1 downto 0), dtenable(i), dtwrite(i),
|
287 |
|
|
sclk, dtaddr2, dtdatain2(i)(DTWIDTH-1 downto 0),
|
288 |
|
|
dtdataout2(i)(DTWIDTH-1 downto 0), dtenable2(i), dtwrite2(i));
|
289 |
|
|
end generate;
|
290 |
|
|
end generate;
|
291 |
|
|
mdt1 : if not ((MMUEN = 0) or not DSNOOPMMU) generate
|
292 |
|
|
dt0 : for i in 0 to DSETS-1 generate
|
293 |
|
|
dtags0 : syncram_dp
|
294 |
|
|
generic map (tech, DOFFSET_BITS, DTWIDTH) port map (
|
295 |
|
|
clk, dtaddr, dtdatain(i)(DTWIDTH-1 downto 0),
|
296 |
|
|
dtdataout(i)(DTWIDTH-1 downto 0), dtenable(i), dtwrite(i),
|
297 |
|
|
sclk, dtaddr2, dtdatain2(i)(DTWIDTH-1 downto 0),
|
298 |
|
|
dtdataout2(i)(DTWIDTH-1 downto 0), dtenable2(i), dtwrite2(i));
|
299 |
|
|
dtags1 : syncram_dp
|
300 |
|
|
generic map (tech, DOFFSET_BITS, DPTAG_BITS) port map (
|
301 |
|
|
clk, dtaddr, dtdatain3(i)(DTAG_BITS-1 downto DTAG_BITS-DPTAG_BITS),
|
302 |
|
|
open, dtwrite3(i), dtwrite3(i),
|
303 |
|
|
sclk, dtaddr2, dtdatainu(i)(DTAG_BITS-1 downto DTAG_BITS-DPTAG_BITS),
|
304 |
|
|
dtdataout3(i)(DTAG_BITS-1 downto DTAG_BITS-DPTAG_BITS), dtenable2(i), dtwrite2(i));
|
305 |
|
|
end generate;
|
306 |
|
|
end generate;
|
307 |
|
|
end generate;
|
308 |
|
|
nodtags1 : if DSNOOP = 0 generate
|
309 |
|
|
dt0 : for i in 0 to DSETS-1 generate
|
310 |
|
|
dtdataout2(i)(DTWIDTH-1 downto 0) <= zero64(DTWIDTH-1 downto 0);
|
311 |
|
|
dtdataout3(i)(DTWIDTH-1 downto 0) <= zero64(DTWIDTH-1 downto 0);
|
312 |
|
|
end generate;
|
313 |
|
|
end generate;
|
314 |
|
|
|
315 |
|
|
dd0 : for i in 0 to DSETS-1 generate
|
316 |
|
|
ddata0 : syncram
|
317 |
|
|
generic map (tech, DOFFSET_BITS+DLINE_BITS, DDWIDTH)
|
318 |
|
|
port map (clk, ddaddr, dddatain(i), dddataout(i), ddenable(i), ddwrite(i));
|
319 |
|
|
end generate;
|
320 |
|
|
dnd0 : for i in DSETS to MAXSETS-1 generate
|
321 |
|
|
dtdataout(i) <= (others => '0');
|
322 |
|
|
dtdataout2(i) <= (others => '0');
|
323 |
|
|
dtdataout3(i) <= (others => '0');
|
324 |
|
|
dddataout(i) <= (others => '0');
|
325 |
|
|
end generate;
|
326 |
|
|
end generate;
|
327 |
|
|
|
328 |
|
|
dmd : if dcen = 0 generate
|
329 |
|
|
dnd0 : for i in 0 to DSETS-1 generate
|
330 |
|
|
dtdataout(i) <= (others => '0');
|
331 |
|
|
dtdataout2(i) <= (others => '0');
|
332 |
|
|
dtdataout3(i) <= (others => '0');
|
333 |
|
|
dddataout(i) <= (others => '0');
|
334 |
|
|
end generate;
|
335 |
|
|
end generate;
|
336 |
|
|
|
337 |
|
|
ldxs0 : if not ((dlram = 1) and (DSETS > 1)) generate
|
338 |
|
|
lddatain <= dddatain(0);
|
339 |
|
|
end generate;
|
340 |
|
|
|
341 |
|
|
ldxs1 : if (dlram = 1) and (DSETS > 1) generate
|
342 |
|
|
lddatain <= dddatain(1);
|
343 |
|
|
end generate;
|
344 |
|
|
|
345 |
|
|
|
346 |
|
|
|
347 |
|
|
ld0 : if dlram = 1 generate
|
348 |
|
|
ldata0 : syncram
|
349 |
|
|
generic map (tech, DLRAM_BITS-2, 32)
|
350 |
|
|
port map (clk, ldaddr, lddatain, ldataout, crami.dcramin.ldramin.enable,
|
351 |
|
|
crami.dcramin.ldramin.write);
|
352 |
|
|
end generate;
|
353 |
|
|
|
354 |
|
|
itx : for i in 0 to ISETS-1 generate
|
355 |
|
|
cramo.icramo.tag(i)(TAG_HIGH downto ITAG_LOW) <= itdataout(i)(ITAG_BITS-1 downto (ITAG_BITS-1) - (TAG_HIGH - ITAG_LOW));
|
356 |
|
|
--(ITWIDTH-1-(ILRR_BIT+ICLOCK_BIT) downto ITWIDTH-(TAG_HIGH-ITAG_LOW)-(ILRR_BIT+ICLOCK_BIT)-1);
|
357 |
|
|
cramo.icramo.tag(i)(ilinesize-1 downto 0) <= itdataout(i)(ilinesize-1 downto 0);
|
358 |
|
|
cramo.icramo.tag(i)(CTAG_LRRPOS) <= itdataout(i)(ITWIDTH - (1+ICLOCK_BIT));
|
359 |
|
|
cramo.icramo.tag(i)(CTAG_LOCKPOS) <= itdataout(i)(ITWIDTH-1);
|
360 |
|
|
ictx : if mmuen = 1 generate
|
361 |
|
|
cramo.icramo.ctx(i) <= itdataout(i)((ITWIDTH - (ILRR_BIT+ICLOCK_BIT+1)) downto (ITWIDTH - (ILRR_BIT+ICLOCK_BIT+M_CTX_SZ)));
|
362 |
|
|
end generate;
|
363 |
|
|
cramo.icramo.data(i) <= ildataout when (ilram = 1) and ((ISETS = 1) or (i = 1)) and (crami.icramin.ldramin.read = '1') else iddataout(i)(31 downto 0);
|
364 |
|
|
itv : if ilinesize = 4 generate
|
365 |
|
|
cramo.icramo.tag(i)(7 downto 4) <= (others => '0');
|
366 |
|
|
end generate;
|
367 |
|
|
ite : for j in 10 to ITAG_LOW-1 generate
|
368 |
|
|
cramo.icramo.tag(i)(j) <= '0';
|
369 |
|
|
end generate;
|
370 |
|
|
end generate;
|
371 |
|
|
|
372 |
|
|
itx2 : for i in ISETS to MAXSETS-1 generate
|
373 |
|
|
cramo.icramo.tag(i) <= (others => '0');
|
374 |
|
|
cramo.icramo.data(i) <= (others => '0');
|
375 |
|
|
end generate;
|
376 |
|
|
|
377 |
|
|
|
378 |
|
|
itd : for i in 0 to DSETS-1 generate
|
379 |
|
|
cramo.dcramo.tag(i)(TAG_HIGH downto DTAG_LOW) <= dtdataout(i)(DTAG_BITS-1 downto (DTAG_BITS-1) - (TAG_HIGH - DTAG_LOW));
|
380 |
|
|
--(DTWIDTH-1-(DLRR_BIT+DCLOCK_BIT) downto DTWIDTH-(TAG_HIGH-DTAG_LOW)-(DLRR_BIT+DCLOCK_BIT)-1);
|
381 |
|
|
--cramo.dcramo.tag(i)(TAG_HIGH downto DTAG_LOW) <= dtdataout(i)(DTWIDTH-1-(DLRR_BIT+DCLOCK_BIT) downto DTWIDTH-(TAG_HIGH-DTAG_LOW)-(DLRR_BIT+DCLOCK_BIT)-1);
|
382 |
|
|
cramo.dcramo.tag(i)(dlinesize-1 downto 0) <= dtdataout(i)(dlinesize-1 downto 0);
|
383 |
|
|
cramo.dcramo.tag(i)(CTAG_LRRPOS) <= dtdataout(i)(DTWIDTH - (1+DCLOCK_BIT));
|
384 |
|
|
cramo.dcramo.tag(i)(CTAG_LOCKPOS) <= dtdataout(i)(DTWIDTH-1);
|
385 |
|
|
ictx : if mmuen /= 0 generate
|
386 |
|
|
cramo.dcramo.ctx(i) <= dtdataout(i)((DTWIDTH - (DLRR_BIT+DCLOCK_BIT+1)) downto (DTWIDTH - (DLRR_BIT+DCLOCK_BIT+M_CTX_SZ)));
|
387 |
|
|
end generate;
|
388 |
|
|
|
389 |
|
|
stagv : if not ((MMUEN = 0) or not DSNOOPMMU) generate
|
390 |
|
|
cramo.dcramo.stag(i)(TAG_HIGH downto DTAG_LOW) <= dtdataout3(i)(DTAG_BITS-1 downto (DTAG_BITS-1) - (TAG_HIGH - DTAG_LOW));
|
391 |
|
|
end generate;
|
392 |
|
|
stagp : if ((MMUEN = 0) or not DSNOOPMMU) generate
|
393 |
|
|
cramo.dcramo.stag(i)(TAG_HIGH downto DTAG_LOW) <= dtdataout2(i)(DTAG_BITS-1 downto (DTAG_BITS-1) - (TAG_HIGH - DTAG_LOW));
|
394 |
|
|
end generate;
|
395 |
|
|
|
396 |
|
|
-- cramo.dcramo.stag(i)(TAG_HIGH downto DTAG_LOW) <= dtdataout2(i)(DTWIDTH-1 downto DTWIDTH-(TAG_HIGH-DTAG_LOW)-1);
|
397 |
|
|
cramo.dcramo.stag(i)(dlinesize-1 downto 0) <= dtdataout2(i)(dlinesize-1 downto 0);
|
398 |
|
|
cramo.dcramo.stag(i)(CTAG_LRRPOS) <= dtdataout2(i)(DTWIDTH - (1+DCLOCK_BIT));
|
399 |
|
|
cramo.dcramo.stag(i)(CTAG_LOCKPOS) <= dtdataout2(i)(DTWIDTH-1);
|
400 |
|
|
cramo.dcramo.data(i) <= ldataout when (dlram = 1) and ((DSETS = 1) or (i = 1)) and (crami.dcramin.ldramin.read = '1')
|
401 |
|
|
else dddataout(i)(31 downto 0);
|
402 |
|
|
dtv : if dlinesize = 4 generate
|
403 |
|
|
cramo.dcramo.tag(i)(7 downto 4) <= (others => '0');
|
404 |
|
|
cramo.dcramo.stag(i)(7 downto 4) <= (others => '0');
|
405 |
|
|
end generate;
|
406 |
|
|
dte : for j in 10 to DTAG_LOW-1 generate
|
407 |
|
|
cramo.dcramo.tag(i)(j) <= '0';
|
408 |
|
|
cramo.dcramo.stag(i)(j) <= '0';
|
409 |
|
|
end generate;
|
410 |
|
|
end generate;
|
411 |
|
|
|
412 |
|
|
itd2 : for i in DSETS to MAXSETS-1 generate
|
413 |
|
|
cramo.dcramo.tag(i) <= (others => '0');
|
414 |
|
|
cramo.dcramo.stag(i) <= (others => '0');
|
415 |
|
|
cramo.dcramo.data(i) <= (others => '0');
|
416 |
|
|
end generate;
|
417 |
|
|
|
418 |
|
|
nodrv : for i in 0 to MAXSETS-1 generate
|
419 |
|
|
cramo.dcramo.tpar(i) <= (others => '0');
|
420 |
|
|
cramo.dcramo.dpar(i) <= (others => '0');
|
421 |
|
|
cramo.dcramo.spar(i) <= '0';
|
422 |
|
|
cramo.icramo.tpar(i) <= (others => '0');
|
423 |
|
|
cramo.icramo.dpar(i) <= (others => '0');
|
424 |
|
|
nommu : if mmuen = 0 generate
|
425 |
|
|
cramo.icramo.ctx(i) <= (others => '0');
|
426 |
|
|
cramo.dcramo.ctx(i) <= (others => '0');
|
427 |
|
|
end generate;
|
428 |
|
|
end generate;
|
429 |
|
|
|
430 |
|
|
end ;
|
431 |
|
|
|