OpenCores
URL https://opencores.org/ocsvn/s1_core/s1_core/trunk

Subversion Repositories s1_core

[/] [s1_core/] [trunk/] [hdl/] [rtl/] [sparc_core/] [sparc_ifu_invctl.v] - Blame information for rev 113

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 95 fafa1971
// ========== Copyright Header Begin ==========================================
2
// 
3
// OpenSPARC T1 Processor File: sparc_ifu_invctl.v
4
// Copyright (c) 2006 Sun Microsystems, Inc.  All Rights Reserved.
5
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
6
// 
7
// The above named program is free software; you can redistribute it and/or
8
// modify it under the terms of the GNU General Public
9
// License version 2 as published by the Free Software Foundation.
10
// 
11
// The above named program is distributed in the hope that it will be 
12
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
// General Public License for more details.
15
// 
16
// You should have received a copy of the GNU General Public
17
// License along with this work; if not, write to the Free Software
18
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19
// 
20
// ========== Copyright Header End ============================================
21 113 albert.wat
`ifdef SIMPLY_RISC_TWEAKS
22
`define SIMPLY_RISC_SCANIN .si(0)
23
`else
24
`define SIMPLY_RISC_SCANIN .si()
25
`endif
26 95 fafa1971
///////////////////////////////////////////////////////////////////////
27
/*
28
//  Module Name: sparc_ifu_invctl
29
//  Description:
30
//  Control logic for handling invalidations to the icache
31
//
32
*/
33
 
34
////////////////////////////////////////////////////////////////////////
35
// Global header file includes
36
////////////////////////////////////////////////////////////////////////
37
 
38 113 albert.wat
`include "iop.h"
39
`include "ifu.h"
40 95 fafa1971
 
41
module sparc_ifu_invctl(/*AUTOARG*/
42
   // Outputs
43
   so, inv_ifc_inv_pending, ifq_icv_wrindex_bf, ifq_icv_wren_bf,
44
   ifq_ict_dec_wrway_bf, ifq_fcl_invreq_bf, ifq_erb_asiway_f,
45
   // Inputs
46
   rclk, se, si, const_cpuid, mbist_icache_write,
47
   lsu_ifu_ld_icache_index, lsu_ifu_ld_pcxpkt_vld,
48
   lsu_ifu_ld_pcxpkt_tid, ifc_inv_ifqadv_i2, ifc_inv_asireq_i2,
49
   ifq_icd_index_bf, ifd_inv_ifqop_i2, ifd_inv_wrway_i2
50
   );
51
 
52
   input        rclk,
53
                se,
54
                si;
55
 
56
 
57
   input [2:0]  const_cpuid;
58
   input        mbist_icache_write;
59
 
60 113 albert.wat
   input [`IC_IDX_HI:5]   lsu_ifu_ld_icache_index;
61 95 fafa1971
   input                  lsu_ifu_ld_pcxpkt_vld;
62
   input [1:0]            lsu_ifu_ld_pcxpkt_tid;
63
 
64
   input                  ifc_inv_ifqadv_i2;
65
   input                  ifc_inv_asireq_i2;
66
 
67 113 albert.wat
   input [`IC_IDX_HI:5]   ifq_icd_index_bf;
68
   input [`CPX_WIDTH-1:0] ifd_inv_ifqop_i2;
69 95 fafa1971
   input [1:0]            ifd_inv_wrway_i2;
70
 
71
 
72
   output                 so;
73
 
74
   output                 inv_ifc_inv_pending;
75
 
76 113 albert.wat
   output [`IC_IDX_HI:5]  ifq_icv_wrindex_bf;
77 95 fafa1971
   output [15:0]          ifq_icv_wren_bf;
78
   output [3:0]           ifq_ict_dec_wrway_bf;
79
   output                 ifq_fcl_invreq_bf;
80
   output [1:0]           ifq_erb_asiway_f;
81
 
82
 
83
//----------------------------------------------------------------------
84
//  Local Signals
85
//----------------------------------------------------------------------
86
 
87
   wire [3:0]  cpu_sel,
88
               invcpu21_sel_i2;
89
   wire        invcpu0_sel_i2;
90
 
91
   wire [1:0]  inv_vec0,
92
                           inv_vec1;
93
   wire [1:0]  inv_way0_p1_i2,
94
                           inv_way0_p0_i2,
95
                           inv_way1_p1_i2,
96
                           inv_way1_p0_i2,
97
               invwd0_way_i2,
98
               invwd1_way_i2,
99
               inv0_way_i2,
100
               inv1_way_i2;
101
 
102
   wire [1:0]  asi_way_f;
103
 
104
   wire        word0_inv_i2,
105
               word1_inv_i2;
106
 
107
   wire        ldinv_i2,
108
               ldpkt_i2,
109
               evpkt_i2,
110
               stpkt_i2,
111
               strmack_i2,
112
               imissrtn_i2;
113
 
114
   wire        invreq_i2,
115
               invalidate_i2,
116
               invalidate_f;
117
 
118
   wire        invall_i2,
119
               invpa5_i2;
120
 
121
   wire [1:0]  cpxthrid_i2;
122
   wire [3:0]  dcpxthr_i2;
123
 
124
   wire [1:0]  ldinv_way_i2;
125
   wire [1:0]  w0_way_i2,
126
               w1_way_i2,
127
               w0_way_f,
128
               w1_way_f;
129
 
130
   wire        pick_wr;
131
   wire        icv_wrreq_i2;
132
 
133
   wire [3:0]  wrt_en_wd_i2,
134
               wrt_en_wd_bf,
135
               wrt_en_wd_f;
136
 
137
   wire [3:0]  w0_dec_way_i2,
138
               w1_dec_way_i2;
139
 
140
   wire [3:0]  dec_wrway;
141
 
142
   wire        icvidx_sel_wr_i2,
143
               icvidx_sel_ld_i2,
144
               icvidx_sel_inv_i2;
145
 
146
   wire [15:0] wren_i2;
147
 
148
 
149 113 albert.wat
   wire [`IC_IDX_HI:6] inv_addr_i2;
150
   wire [`IC_IDX_HI:5] icaddr_i2;
151 95 fafa1971
 
152
   wire                missaddr5_i2;
153
   wire                missaddr6_i2;
154
 
155
 
156
   wire [3:0]          ldthr,
157
                       ldidx_sel_new;
158
 
159 113 albert.wat
   wire [`IC_IDX_HI:5] ldinv_addr_i2,
160 95 fafa1971
                       ldindex0,
161
                       ldindex1,
162
                       ldindex2,
163
                       ldindex3,
164
                       ldindex0_nxt,
165
                       ldindex1_nxt,
166
                       ldindex2_nxt,
167
                       ldindex3_nxt;
168
 
169
   wire                clk;
170
 
171
 
172
//
173
// Code Begins Here
174
//
175
   assign              clk = rclk;
176
 
177
   //----------------------------------------------------------------------
178
   // Extract Invalidate Packet For This Core
179
   //----------------------------------------------------------------------
180
 
181
   // mux the invalidate vector down to get this processors inv vector
182
 
183
   // First ecode cpu id
184
   assign cpu_sel[0] = ~const_cpuid[2] & ~const_cpuid[1];
185
   assign cpu_sel[1] = ~const_cpuid[2] &  const_cpuid[1];
186
   assign cpu_sel[2] =  const_cpuid[2] & ~const_cpuid[1];
187
   assign cpu_sel[3] =  const_cpuid[2] &  const_cpuid[1];
188
 
189
   // 4:1 follwed by 2:1 to get 8:1, to get invalidate way selects
190
   assign invcpu21_sel_i2 = cpu_sel;
191
   assign invcpu0_sel_i2 = const_cpuid[0];
192
 
193
   // First do word 0 for even processors
194
   mux4ds #(1)  v0p0_mux(.dout  (inv_vec0[0]),
195
                                           .in0   (ifd_inv_ifqop_i2[1]),
196
                                           .in1   (ifd_inv_ifqop_i2[9]),
197
                                           .in2   (ifd_inv_ifqop_i2[17]),
198
                                           .in3   (ifd_inv_ifqop_i2[25]),
199
                                           .sel0 (invcpu21_sel_i2[0]),
200
                                           .sel1 (invcpu21_sel_i2[1]),
201
                                           .sel2 (invcpu21_sel_i2[2]),
202
                                           .sel3 (invcpu21_sel_i2[3]));
203
 
204
   mux4ds #(2)  w0p0_mux(.dout (inv_way0_p0_i2[1:0]),
205
                                           .in0  (ifd_inv_ifqop_i2[3:2]),
206
                                           .in1  (ifd_inv_ifqop_i2[11:10]),
207
                                           .in2  (ifd_inv_ifqop_i2[19:18]),
208
                                           .in3  (ifd_inv_ifqop_i2[27:26]),
209
                                           .sel0 (invcpu21_sel_i2[0]),
210
                                           .sel1 (invcpu21_sel_i2[1]),
211
                                           .sel2 (invcpu21_sel_i2[2]),
212
                                           .sel3 (invcpu21_sel_i2[3]));
213
 
214
   // word 0 for odd processors
215
   mux4ds #(1)  v0p1_mux(.dout  (inv_vec0[1]),
216
                                           .in0   (ifd_inv_ifqop_i2[5]),
217
                                           .in1   (ifd_inv_ifqop_i2[13]),
218
                                           .in2   (ifd_inv_ifqop_i2[21]),
219
                                           .in3   (ifd_inv_ifqop_i2[29]),
220
                                           .sel0 (invcpu21_sel_i2[0]),
221
                                           .sel1 (invcpu21_sel_i2[1]),
222
                                           .sel2 (invcpu21_sel_i2[2]),
223
                                           .sel3 (invcpu21_sel_i2[3]));
224
 
225
   mux4ds #(2)  w0p1_mux(.dout (inv_way0_p1_i2[1:0]),
226
                                           .in0  (ifd_inv_ifqop_i2[7:6]),
227
                                           .in1  (ifd_inv_ifqop_i2[15:14]),
228
                                           .in2  (ifd_inv_ifqop_i2[23:22]),
229
                                           .in3  (ifd_inv_ifqop_i2[31:30]),
230
                                           .sel0 (invcpu21_sel_i2[0]),
231
                                           .sel1 (invcpu21_sel_i2[1]),
232
                                           .sel2 (invcpu21_sel_i2[2]),
233
                                           .sel3 (invcpu21_sel_i2[3]));
234
 
235
 
236
   // Word 1
237
   // word 1 for even processors
238
   mux4ds #(1)  v1p0_mux(.dout  (inv_vec1[0]),
239
                                           .in0   (ifd_inv_ifqop_i2[57]),
240
                                           .in1   (ifd_inv_ifqop_i2[65]),
241
                                           .in2   (ifd_inv_ifqop_i2[73]),
242
                                           .in3   (ifd_inv_ifqop_i2[81]),
243
                                           .sel0 (invcpu21_sel_i2[0]),
244
                                           .sel1 (invcpu21_sel_i2[1]),
245
                                           .sel2 (invcpu21_sel_i2[2]),
246
                                           .sel3 (invcpu21_sel_i2[3]));
247
 
248
   mux4ds #(2)  w1p0_mux(.dout (inv_way1_p0_i2[1:0]),
249
                                           .in0  (ifd_inv_ifqop_i2[59:58]),
250
                                           .in1  (ifd_inv_ifqop_i2[67:66]),
251
                                           .in2  (ifd_inv_ifqop_i2[75:74]),
252
                                           .in3  (ifd_inv_ifqop_i2[83:82]),
253
                                           .sel0 (invcpu21_sel_i2[0]),
254
                                           .sel1 (invcpu21_sel_i2[1]),
255
                                           .sel2 (invcpu21_sel_i2[2]),
256
                                           .sel3 (invcpu21_sel_i2[3]));
257
 
258
   // word 1 for odd processors
259
   mux4ds #(1)  inv_v1p1_mux(.dout  (inv_vec1[1]),
260
                                               .in0   (ifd_inv_ifqop_i2[61]),
261
                                               .in1   (ifd_inv_ifqop_i2[69]),
262
                                               .in2   (ifd_inv_ifqop_i2[77]),
263
                                               .in3   (ifd_inv_ifqop_i2[85]),
264
                                               .sel0 (invcpu21_sel_i2[0]),
265
                                               .sel1 (invcpu21_sel_i2[1]),
266
                                               .sel2 (invcpu21_sel_i2[2]),
267
                                               .sel3 (invcpu21_sel_i2[3]));
268
 
269
   mux4ds #(2)  w1p1_mux(.dout (inv_way1_p1_i2[1:0]),
270
                                           .in0  (ifd_inv_ifqop_i2[63:62]),
271
                                           .in1  (ifd_inv_ifqop_i2[71:70]),
272
                                           .in2  (ifd_inv_ifqop_i2[79:78]),
273
                                           .in3  (ifd_inv_ifqop_i2[87:86]),
274
                                           .sel0 (invcpu21_sel_i2[0]),
275
                                           .sel1 (invcpu21_sel_i2[1]),
276
                                           .sel2 (invcpu21_sel_i2[2]),
277
                                           .sel3 (invcpu21_sel_i2[3]));
278
 
279
   // Mux odd and even values down to a single value for word0 and word1
280
//   dp_mux2es #(1) v0_mux (.dout (word0_inv_i2),
281
//                                          .in0  (inv_vec0[0]),
282
//                                          .in1  (inv_vec0[1]),
283
//                                          .sel  (invcpu0_sel_i2));
284
   assign word0_inv_i2 = invcpu0_sel_i2 ? inv_vec0[1] : inv_vec0[0];
285
 
286
//   dp_mux2es #(2) w0_mux (.dout (invwd0_way_i2[1:0]),
287
//                                          .in0  (inv_way0_p0_i2[1:0]),
288
//                                          .in1  (inv_way0_p1_i2[1:0]),
289
//                                          .sel  (invcpu0_sel_i2));
290
   assign invwd0_way_i2 = invcpu0_sel_i2 ? inv_way0_p1_i2[1:0] :
291
                                           inv_way0_p0_i2[1:0];
292
 
293
   // word1
294
//   dp_mux2es #(1) v1_mux (.dout (word1_inv_i2),
295
//                                          .in0  (inv_vec1[0]),
296
//                                          .in1  (inv_vec1[1]),
297
//                                          .sel  (invcpu0_sel_i2));
298
   assign word1_inv_i2 = invcpu0_sel_i2 ? inv_vec1[1] : inv_vec1[0];
299
 
300
//   dp_mux2es #(2) w1_mux (.dout (invwd1_way_i2[1:0]),
301
//                                          .in0  (inv_way1_p0_i2[1:0]),
302
//                                          .in1  (inv_way1_p1_i2[1:0]),
303
//                                          .sel  (invcpu0_sel_i2));
304
   assign invwd1_way_i2 = invcpu0_sel_i2 ? inv_way1_p1_i2[1:0] :
305
                                           inv_way1_p0_i2[1:0];
306
 
307
   //-----------------------------
308
   // Decode CPX Packet
309
   //-----------------------------
310
   // load
311 113 albert.wat
   assign ldpkt_i2 = ({ifd_inv_ifqop_i2[`CPX_VLD],
312
                       ifd_inv_ifqop_i2[`CPX_REQFIELD]} == `CPX_LDPKT) ?
313 95 fafa1971
                       1'b1 : 1'b0;
314 113 albert.wat
   assign ldinv_i2 = ldpkt_i2 & ifd_inv_ifqop_i2[`CPX_WYVLD];
315
   assign ldinv_way_i2= ifd_inv_ifqop_i2[`CPX_WY_HI:`CPX_WY_LO];
316 95 fafa1971
 
317
   // ifill
318 113 albert.wat
   assign imissrtn_i2 = ({ifd_inv_ifqop_i2[`CPX_VLD],
319
                          ifd_inv_ifqop_i2[`CPX_REQFIELD]} == `CPX_IFILLPKT) ?
320 95 fafa1971
                          1'b1 : 1'b0;
321
 
322
   // store ack
323 113 albert.wat
   assign stpkt_i2 = ({ifd_inv_ifqop_i2[`CPX_VLD],
324
                       ifd_inv_ifqop_i2[`CPX_REQFIELD]} == `CPX_STRPKT) ?
325 95 fafa1971
                       1'b1 : 1'b0;
326 113 albert.wat
   assign strmack_i2 = ({ifd_inv_ifqop_i2[`CPX_VLD],
327
                         ifd_inv_ifqop_i2[`CPX_REQFIELD]} == `CPX_STRMACK) ?
328 95 fafa1971
                         1'b1 : 1'b0;
329 113 albert.wat
   assign invall_i2 = stpkt_i2 & ifd_inv_ifqop_i2[`CPX_IINV] &
330 95 fafa1971
                      ifc_inv_ifqadv_i2;
331 113 albert.wat
   assign invpa5_i2 = ifd_inv_ifqop_i2[`CPX_INVPA5];
332 95 fafa1971
 
333
   // evict 
334 113 albert.wat
   assign evpkt_i2 = ({ifd_inv_ifqop_i2[`CPX_VLD],
335
                       ifd_inv_ifqop_i2[`CPX_REQFIELD]} == `CPX_EVPKT) ?
336 95 fafa1971
                       1'b1 : 1'b0;
337
 
338
   // get thread id and decode
339 113 albert.wat
   assign  cpxthrid_i2 = ifd_inv_ifqop_i2[`CPX_THRFIELD];
340 95 fafa1971
 
341
   assign  dcpxthr_i2[0] = ~cpxthrid_i2[1] & ~cpxthrid_i2[0];
342
   assign  dcpxthr_i2[1] = ~cpxthrid_i2[1] &  cpxthrid_i2[0];
343
   assign  dcpxthr_i2[2] =  cpxthrid_i2[1] & ~cpxthrid_i2[0];
344
   assign  dcpxthr_i2[3] =  cpxthrid_i2[1] &  cpxthrid_i2[0];
345
 
346
   //-----------------------------------------------
347
   // Generate Write Way and Write Enables
348
   //-----------------------------------------------
349
 
350
   // decode way for tags
351
   assign  dec_wrway[0] = ~ifd_inv_wrway_i2[1] & ~ifd_inv_wrway_i2[0];
352
   assign  dec_wrway[1] = ~ifd_inv_wrway_i2[1] & ifd_inv_wrway_i2[0];
353
   assign  dec_wrway[2] = ifd_inv_wrway_i2[1] & ~ifd_inv_wrway_i2[0];
354
   assign  dec_wrway[3] = ifd_inv_wrway_i2[1] & ifd_inv_wrway_i2[0];
355
 
356
   assign  ifq_ict_dec_wrway_bf = dec_wrway;
357
 
358
   // way for asi
359 113 albert.wat
   dff_s #(2) asiwayf_reg(.din (ifd_inv_wrway_i2),
360 95 fafa1971
                                    .q   (asi_way_f),
361 113 albert.wat
                                    .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
362 95 fafa1971
 
363
   assign  ifq_erb_asiway_f = asi_way_f;
364
 
365
 
366
   // Select which index/way to invalidate
367
   assign icv_wrreq_i2 = imissrtn_i2 | ifc_inv_asireq_i2 | mbist_icache_write;
368
 
369
   assign inv0_way_i2 = ~ifc_inv_ifqadv_i2 ? w0_way_f :
370
                        ldinv_i2           ? ldinv_way_i2 :
371
                                             invwd0_way_i2;
372
   assign inv1_way_i2 = ~ifc_inv_ifqadv_i2 ? w1_way_f :
373
                        ldinv_i2           ? ldinv_way_i2 :
374
                                             invwd1_way_i2;
375
 
376
   assign pick_wr = (imissrtn_i2 | ifc_inv_asireq_i2) & ifc_inv_ifqadv_i2 |
377
                     mbist_icache_write;
378
   assign w0_way_i2 = pick_wr ? ifd_inv_wrway_i2 :
379
                                inv0_way_i2;
380
   assign w1_way_i2 = pick_wr ? ifd_inv_wrway_i2 :
381
                                inv1_way_i2;
382
 
383 113 albert.wat
   dff_s #(4) wrway_reg(.din ({w0_way_i2, w1_way_i2}),
384 95 fafa1971
                      .q   ({w0_way_f, w1_way_f}),
385 113 albert.wat
                      .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
386 95 fafa1971
 
387
   // determine the way in the ICV we are writing to
388
//   mux3ds #(2) w0_waymux(.dout  (w0_way_i2),
389
//                                   .in0   (ifd_inv_wrway_i2[1:0]),
390
//                                   .in1   (invwd0_way_i2[1:0]),
391
//                                   .in2   (ldinv_way_i2[1:0]),
392
//                                   .sel0  (icvidx_sel_wr_i2),
393
//                                   .sel1  (icvidx_sel_inv_i2),
394
//                                   .sel2  (icvidx_sel_ld_i2));
395
 
396
//   mux3ds #(2) w1_waymux(.dout  (w1_way_i2),
397
//                                   .in0   (ifd_inv_wrway_i2[1:0]),
398
//                                   .in1   (invwd1_way_i2[1:0]),
399
//                                   .in2   (ldinv_way_i2[1:0]),
400
//                                   .sel0  (icvidx_sel_wr_i2),
401
//                                   .sel1  (icvidx_sel_inv_i2),
402
//                                   .sel2  (icvidx_sel_ld_i2));
403
 
404
   // decode write way
405
   assign w0_dec_way_i2[0] = ~w0_way_i2[1] & ~w0_way_i2[0];
406
   assign w0_dec_way_i2[1] = ~w0_way_i2[1] &  w0_way_i2[0];
407
   assign w0_dec_way_i2[2] =  w0_way_i2[1] & ~w0_way_i2[0];
408
   assign w0_dec_way_i2[3] =  w0_way_i2[1] &  w0_way_i2[0];
409
 
410
   assign w1_dec_way_i2[0] = ~w1_way_i2[1] & ~w1_way_i2[0];
411
   assign w1_dec_way_i2[1] = ~w1_way_i2[1] &  w1_way_i2[0];
412
   assign w1_dec_way_i2[2] =  w1_way_i2[1] & ~w1_way_i2[0];
413
   assign w1_dec_way_i2[3] =  w1_way_i2[1] &  w1_way_i2[0];
414
 
415
 
416
   // determine if valid bit write to top 32B, bot 32B or both
417
   assign wrt_en_wd_i2[0] = word0_inv_i2 & (stpkt_i2 | evpkt_i2 |strmack_i2) &
418
                                           ~inv_addr_i2[6] |
419
                          ldinv_i2 & ~ldinv_addr_i2[5] & ~ldinv_addr_i2[6] |
420
                                      icv_wrreq_i2 & ~missaddr5_i2 & ~missaddr6_i2;
421
 
422
   assign wrt_en_wd_i2[1] = word1_inv_i2 & (stpkt_i2 | evpkt_i2 |strmack_i2) &
423
                                           ~inv_addr_i2[6] |
424
                                              ldinv_i2 & ldinv_addr_i2[5] & ~ldinv_addr_i2[6] |
425
                                        icv_wrreq_i2 & missaddr5_i2 & ~missaddr6_i2;
426
 
427
   assign wrt_en_wd_i2[2] = word0_inv_i2 & (stpkt_i2 | evpkt_i2 |strmack_i2) &
428
                                           inv_addr_i2[6] |
429
                          ldinv_i2 & ~ldinv_addr_i2[5] & ldinv_addr_i2[6] |
430
                                      icv_wrreq_i2 & ~missaddr5_i2 & missaddr6_i2;
431
 
432
   assign wrt_en_wd_i2[3] = word1_inv_i2 & (stpkt_i2 | evpkt_i2 |strmack_i2) &
433
                                           inv_addr_i2[6] |
434
                                              ldinv_i2 & ldinv_addr_i2[5] & ldinv_addr_i2[6] |
435
                                        icv_wrreq_i2 & missaddr5_i2 & missaddr6_i2;
436
 
437
   assign wrt_en_wd_bf = ifc_inv_ifqadv_i2 ? wrt_en_wd_i2 :
438
                                              wrt_en_wd_f;
439 113 albert.wat
   dff_s #(4) wrten_reg(.din (wrt_en_wd_bf),
440 95 fafa1971
                      .q   (wrt_en_wd_f),
441 113 albert.wat
                      .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
442 95 fafa1971
 
443
 
444
   // Final Write Enable to ICV
445
   assign wren_i2[3:0] = (w0_dec_way_i2 & {4{wrt_en_wd_bf[0]}}) |
446
                           {4{invall_i2 & ~invpa5_i2 & ~inv_addr_i2[6]}};
447
 
448
   assign wren_i2[7:4] = (w1_dec_way_i2 & {4{wrt_en_wd_bf[1]}}) |
449
                           {4{invall_i2 & invpa5_i2 & ~inv_addr_i2[6]}};
450
 
451
   assign wren_i2[11:8] = (w0_dec_way_i2 & {4{wrt_en_wd_bf[2]}}) |
452
                            {4{invall_i2 & ~invpa5_i2 & inv_addr_i2[6]}};
453
 
454
   assign wren_i2[15:12] = (w1_dec_way_i2 & {4{wrt_en_wd_bf[3]}}) |
455
                             {4{invall_i2 & invpa5_i2 & inv_addr_i2[6]}};
456
 
457
   assign ifq_icv_wren_bf = wren_i2;
458
 
459
   // advance the wr way for the ICV array
460
//   mux2ds #(8) wren_mux(.dout  (next_wren_i2),
461
//                                  .in0   (wren_f),
462
//                                  .in1   (wren_i2),
463
//                                  .sel0  (~ifc_ifd_ifqadv_i2),
464
//                                  .sel1  (ifc_ifd_ifqadv_i2));
465
 
466
//   assign wren_bf = ifc_inv_ifqadv_i2 ? wren_i2 : wren_f;
467
//   dff #(8) icv_weff(.din  (wren_bf),
468
//                               .q    (wren_f),
469
//                               .clk  (clk),
470 113 albert.wat
//                               .se   (se), `SIMPLY_RISC_SCANIN, .so());
471 95 fafa1971
 
472
//   assign ifq_icv_wren_bf[7:0] = wren_bf[7:0] & {8{~icvaddr6_i2}};
473
//   assign ifq_icv_wren_bf[15:8] = wren_bf[7:0] & {8{icvaddr6_i2}};
474
 
475
 
476
   //--------------------------
477
   // Invalidates
478
   //--------------------------
479
   assign invalidate_i2 = (stpkt_i2 | evpkt_i2 | strmack_i2) &
480
                                              (word0_inv_i2 |
481
                             word1_inv_i2 |
482 113 albert.wat
                                               ifd_inv_ifqop_i2[`CPX_IINV]) |  // all ways
483 95 fafa1971
                                             ldinv_i2;
484
 
485
   mux2ds #(1) invf_mux(.dout (invreq_i2),
486
                                    .in0  (invalidate_f),
487
                                    .in1  (invalidate_i2),
488
                                    .sel0  (~ifc_inv_ifqadv_i2),
489
                                    .sel1  (ifc_inv_ifqadv_i2));
490
 
491 113 albert.wat
   dff_s #(1) invf_ff(.din  (invreq_i2),
492 95 fafa1971
                                .q    (invalidate_f),
493
                                .clk  (clk),
494 113 albert.wat
                                .se   (se), `SIMPLY_RISC_SCANIN, .so());
495 95 fafa1971
 
496
   // auto invalidate is done during bist
497
   // no need to qualify bist_write with ifqadv_i2 since bist is done
498
   // before anything else. 
499
   assign ifq_fcl_invreq_bf = invreq_i2 | mbist_icache_write;
500
 
501
   // don't really need to OR with invalidate_f, since this will be
502
   // gone in a cycle 
503
//   assign inv_ifc_inv_pending = invalidate_i2 | invalidate_f;
504
   assign inv_ifc_inv_pending = invalidate_i2;
505
 
506
   //---------------------------------
507
   // Get the ifill/invalidation index
508
   //---------------------------------
509
 
510
   // ifill index
511 113 albert.wat
   assign icaddr_i2[`IC_IDX_HI:5] = ifq_icd_index_bf[`IC_IDX_HI:5];
512 95 fafa1971
   assign missaddr5_i2 = ifq_icd_index_bf[5];
513
   assign missaddr6_i2 = ifq_icd_index_bf[6];
514
 
515
   // evict invalidate index
516
   //   assign    inv_addr_i2 = ifqop_i2[117:112];
517 113 albert.wat
   assign inv_addr_i2 = ifd_inv_ifqop_i2[`CPX_INV_IDX_HI:`CPX_INV_IDX_LO];
518 95 fafa1971
 
519
   // index for invalidates caused by a load
520
   // store dcache index when a load req is made
521
 
522
   assign ldthr[0] = ~lsu_ifu_ld_pcxpkt_tid[1] & ~lsu_ifu_ld_pcxpkt_tid[0];
523
   assign ldthr[1] = ~lsu_ifu_ld_pcxpkt_tid[1] &  lsu_ifu_ld_pcxpkt_tid[0];
524
   assign ldthr[2] =  lsu_ifu_ld_pcxpkt_tid[1] & ~lsu_ifu_ld_pcxpkt_tid[0];
525
   assign ldthr[3] =  lsu_ifu_ld_pcxpkt_tid[1] &  lsu_ifu_ld_pcxpkt_tid[0];
526
 
527
   assign ldidx_sel_new = ldthr & {4{lsu_ifu_ld_pcxpkt_vld}};
528
 
529
//   dp_mux2es  #(`IC_IDX_SZ) t0_ldidx_mux(.dout (ldindex0_nxt),
530
//                                                         .in0  (ldindex0),
531
//                                                         .in1  (lsu_ifu_ld_icache_index),
532
//                                                         .sel  (ldidx_sel_new[0]));
533
   assign ldindex0_nxt = ldidx_sel_new[0] ? lsu_ifu_ld_icache_index :
534
                                            ldindex0;
535
 
536
//   dp_mux2es  #(`IC_IDX_SZ) t1_ldidx_mux(.dout (ldindex1_nxt),
537
//                                                         .in0  (ldindex1),
538
//                                                         .in1  (lsu_ifu_ld_icache_index),
539
//                                                         .sel  (ldidx_sel_new[1]));
540
   assign ldindex1_nxt = ldidx_sel_new[1] ? lsu_ifu_ld_icache_index :
541
                                            ldindex1;
542
 
543
//   dp_mux2es  #(`IC_IDX_SZ) t2_ldidx_mux(.dout (ldindex2_nxt),
544
//                                                         .in0  (ldindex2),
545
//                                                         .in1  (lsu_ifu_ld_icache_index),
546
//                                                         .sel  (ldidx_sel_new[2]));
547
   assign ldindex2_nxt = ldidx_sel_new[2] ? lsu_ifu_ld_icache_index :
548
                                            ldindex2;
549
 
550
//   dp_mux2es  #(`IC_IDX_SZ) t3_ldidx_mux(.dout (ldindex3_nxt),
551
//                                                         .in0  (ldindex3),
552
//                                                         .in1  (lsu_ifu_ld_icache_index),
553
//                                                         .sel  (ldidx_sel_new[3]));
554
   assign ldindex3_nxt = ldidx_sel_new[3] ? lsu_ifu_ld_icache_index :
555
                                            ldindex3;
556
 
557
 
558 113 albert.wat
   dff_s #(`IC_IDX_SZ)  ldix0_reg(.din (ldindex0_nxt),
559 95 fafa1971
                                            .q   (ldindex0),
560 113 albert.wat
                                            .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
561
   dff_s #(`IC_IDX_SZ)  ldix1_reg(.din (ldindex1_nxt),
562 95 fafa1971
                                            .q   (ldindex1),
563 113 albert.wat
                                            .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
564
   dff_s #(`IC_IDX_SZ)  ldix2_reg(.din (ldindex2_nxt),
565 95 fafa1971
                                            .q   (ldindex2),
566 113 albert.wat
                                            .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
567
   dff_s #(`IC_IDX_SZ)  ldix3_reg(.din (ldindex3_nxt),
568 95 fafa1971
                                            .q   (ldindex3),
569 113 albert.wat
                                            .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
570 95 fafa1971
 
571
   // Pick dcache index corresponding to current thread
572 113 albert.wat
   mux4ds #(`IC_IDX_SZ) ldinv_mux(.dout (ldinv_addr_i2),
573 95 fafa1971
                                                    .in0  (ldindex0),
574
                                                    .in1  (ldindex1),
575
                                                    .in2  (ldindex2),
576
                                                    .in3  (ldindex3),
577
                                                    .sel0 (dcpxthr_i2[0]),
578
                                                    .sel1 (dcpxthr_i2[1]),
579
                                                    .sel2 (dcpxthr_i2[2]),
580
                                                    .sel3 (dcpxthr_i2[3]));
581
 
582
   // Final Mux for Index
583
   assign icvidx_sel_wr_i2 = imissrtn_i2 | ifc_inv_asireq_i2 |
584
                             mbist_icache_write | ~ifc_inv_ifqadv_i2;
585
   assign icvidx_sel_ld_i2 = ldinv_i2 & ifc_inv_ifqadv_i2;
586
   assign icvidx_sel_inv_i2 = ~imissrtn_i2 & ~ldinv_i2 &
587
                              ~ifc_inv_asireq_i2 & ifc_inv_ifqadv_i2 &
588
                              ~mbist_icache_write;
589
 
590 113 albert.wat
   mux3ds #(`IC_IDX_SZ) icv_idx_mux(
591
                            .dout  (ifq_icv_wrindex_bf[`IC_IDX_HI:5]),
592
                                              .in0   (icaddr_i2[`IC_IDX_HI:5]),
593
                                              .in1   ({inv_addr_i2[`IC_IDX_HI:6], 1'b0}),
594
                                              .in2   (ldinv_addr_i2[`IC_IDX_HI:5]),
595 95 fafa1971
                                              .sel0  (icvidx_sel_wr_i2),
596
                                              .sel1  (icvidx_sel_inv_i2),
597
                                              .sel2  (icvidx_sel_ld_i2));
598
 
599 113 albert.wat
   sink #(`CPX_WIDTH) s0(.in (ifd_inv_ifqop_i2));
600 95 fafa1971
 
601
 
602
endmodule // sparc_ifu_invctl

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.