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

Subversion Repositories s1_core

[/] [s1_core/] [trunk/] [hdl/] [rtl/] [sparc_core/] [sparc_ifu_ifqdp.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_ifqdp.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_ifqdp
29
//  Description:
30
//  The IFQ is the icache fill queue.  This communicates between the
31
//  IFU and the outside world.  It handles icache misses and
32
//  invalidate requests from the crossbar.
33
//
34
*/
35
 
36
//FPGA_SYN enables all FPGA related modifications
37 113 albert.wat
`ifdef FPGA_SYN
38
`define FPGA_SYN_CLK_EN
39
`define FPGA_SYN_CLK_DFF
40
`endif
41 95 fafa1971
 
42
////////////////////////////////////////////////////////////////////////
43
// Global header file includes
44
////////////////////////////////////////////////////////////////////////
45
 
46 113 albert.wat
`include "iop.h"
47
`include "ifu.h"
48 95 fafa1971
 
49
////////////////////////////////////////////////////////////////////////
50
// Local header file includes / local defines
51
////////////////////////////////////////////////////////////////////////
52
 
53
module sparc_ifu_ifqdp(/*AUTOARG*/
54
   // Outputs
55
   so, ifu_lsu_pcxpkt_e, ifq_fdp_fill_inst, ifq_erb_asidata_i2,
56
   ifd_inv_ifqop_i2, ifq_icd_index_bf, ifq_icd_wrdata_i2,
57
   ifq_ict_wrtag_f, ifq_erb_wrindex_f, ifq_icd_wrway_bf,
58
   ifd_ifc_milhit_s, ifd_ifc_instoffset0, ifd_ifc_instoffset1,
59
   ifd_ifc_instoffset2, ifd_ifc_instoffset3, ifd_ifc_cpxthr_nxt,
60
   ifd_ifc_cpxreq_nxt, ifd_ifc_cpxreq_i1, ifd_ifc_destid0,
61
   ifd_ifc_destid1, ifd_ifc_destid2, ifd_ifc_destid3,
62
   ifd_ifc_newdestid_s, ifd_ifc_pcxline_d, ifd_ifc_asi_vachklo_i2,
63
   ifd_ifc_cpxvld_i2, ifd_ifc_asiaddr_i2, ifd_ifc_iobpkt_i2,
64
   ifd_ifc_fwd2ic_i2, ifd_ifc_4bpkt_i2, ifd_ifc_cpxnc_i2,
65
   ifd_ifc_cpxce_i2, ifd_ifc_cpxue_i2, ifd_ifc_cpxms_i2,
66
   ifd_ifc_miladdr4_i2, ifd_inv_wrway_i2,
67
   // Inputs
68
   rclk, se, si, lsu_ifu_cpxpkt_i1, lsu_ifu_asi_addr,
69
   lsu_ifu_stxa_data, itlb_ifq_paddr_s, fdp_ifq_paddr_f,
70
   ifc_ifd_reqvalid_e, ifc_ifd_filladdr4_i2, ifc_ifd_repway_s,
71
   ifc_ifd_uncached_e, ifc_ifd_thrid_e, ifc_ifd_pcxline_adj_d,
72
   ifc_ifd_errinv_e, ifc_ifd_ldmil_sel_new, ifc_ifd_ld_inq_i1,
73
   ifc_ifd_idx_sel_fwd_i2, ifc_ifd_milreq_sel_d_l,
74
   ifc_ifd_milfill_sel_i2_l, ifc_ifd_finst_sel_l,
75
   ifc_ifd_ifqbyp_sel_fwd_l, ifc_ifd_ifqbyp_sel_inq_l,
76
   ifc_ifd_ifqbyp_sel_asi_l, ifc_ifd_ifqbyp_sel_lsu_l,
77
   ifc_ifd_ifqbyp_en_l, ifc_ifd_addr_sel_bist_i2_l,
78
   ifc_ifd_addr_sel_asi_i2_l, ifc_ifd_addr_sel_old_i2_l,
79
   ifc_ifd_addr_sel_fill_i2_l, mbist_icache_way, mbist_icache_word,
80
   mbist_icache_index
81
   );
82
 
83
   input         rclk,
84
           se,
85
           si;
86
 
87 113 albert.wat
   input [`CPX_WIDTH-1:0] lsu_ifu_cpxpkt_i1;
88 95 fafa1971
   input [17:0]   lsu_ifu_asi_addr;
89
   input [47:0]   lsu_ifu_stxa_data;
90
 
91
   input [39:10]  itlb_ifq_paddr_s;
92
   input [9:2]    fdp_ifq_paddr_f;
93
 
94
   // from ifqctl
95
   input         ifc_ifd_reqvalid_e;
96
   input         ifc_ifd_filladdr4_i2;
97
   input [1:0]   ifc_ifd_repway_s;
98
   input         ifc_ifd_uncached_e;
99
   input [1:0]   ifc_ifd_thrid_e;
100
   input [4:2]   ifc_ifd_pcxline_adj_d;
101
 
102
   input         ifc_ifd_errinv_e;
103
 
104
   // 2:1 mux selects
105
   input [3:0]   ifc_ifd_ldmil_sel_new;  // mil load enable
106
 
107
   input        ifc_ifd_ld_inq_i1;        // ld new cpxreq to in buffer
108
   input        ifc_ifd_idx_sel_fwd_i2;
109
 
110
   // other mux selects
111
   input [3:0]  ifc_ifd_milreq_sel_d_l,   // selects outgoing mil_req
112
                            ifc_ifd_milfill_sel_i2_l; // selects the mil entry just
113
         // returned from the fill
114
         // port
115
   input [3:0]  ifc_ifd_finst_sel_l;    // address to load to thr IR
116
 
117
   input        ifc_ifd_ifqbyp_sel_fwd_l, // select next input to process
118
                            ifc_ifd_ifqbyp_sel_inq_l,
119
                            ifc_ifd_ifqbyp_sel_asi_l,
120
                            ifc_ifd_ifqbyp_sel_lsu_l;
121
         input        ifc_ifd_ifqbyp_en_l;
122
 
123
   input        ifc_ifd_addr_sel_bist_i2_l,
124
                            ifc_ifd_addr_sel_asi_i2_l,
125
                ifc_ifd_addr_sel_old_i2_l,
126
                            ifc_ifd_addr_sel_fill_i2_l;
127
 
128
   input [1:0]  mbist_icache_way;
129
   input        mbist_icache_word;
130
   input [7:0]  mbist_icache_index;
131
 
132
   output       so;
133
 
134
   output [51:0] ifu_lsu_pcxpkt_e;
135
 
136
   output [32:0] ifq_fdp_fill_inst;
137
   output [47:0] ifq_erb_asidata_i2;
138
 
139 113 albert.wat
   output [`CPX_WIDTH-1:0] ifd_inv_ifqop_i2;
140 95 fafa1971
 
141 113 albert.wat
   output [`IC_IDX_HI:2]  ifq_icd_index_bf;   // index for wr and bist
142 95 fafa1971
 
143
   output [135:0]         ifq_icd_wrdata_i2;
144 113 albert.wat
   output [`IC_TAG_SZ:0]  ifq_ict_wrtag_f;      // fill tag
145 95 fafa1971
//   output [`IC_TAG_SZ-1:0] ifq_erb_wrtag_f;      // tag w/o parity
146 113 albert.wat
   output [`IC_IDX_HI:4]   ifq_erb_wrindex_f;
147 95 fafa1971
   output [1:0]            ifq_icd_wrway_bf;     // fill data way
148
 
149
   output [3:0]           ifd_ifc_milhit_s;     // if an Imiss hits in MIL
150
//   output [7:0]           ifd_ifc_mil_repway_s;
151
 
152
   output [1:0]           ifd_ifc_instoffset0;   // to select inst to TIR
153
   output [1:0]           ifd_ifc_instoffset1;   // to select inst to TIR
154
   output [1:0]           ifd_ifc_instoffset2;   // to select inst to TIR
155
   output [1:0]           ifd_ifc_instoffset3;   // to select inst to TIR
156
 
157
   output [1:0]            ifd_ifc_cpxthr_nxt;
158
   output [3:0]            ifd_ifc_cpxreq_nxt;    // cpx reqtype + vbit
159 113 albert.wat
   output [`CPX_RQ_SIZE:0] ifd_ifc_cpxreq_i1;    // cpx reqtype + vbit
160 95 fafa1971
 
161
 
162
   output [2:0]            ifd_ifc_destid0,
163
                                       ifd_ifc_destid1,
164
                                       ifd_ifc_destid2,
165
                                       ifd_ifc_destid3,
166
                                       ifd_ifc_newdestid_s;
167
 
168
   output [4:2]            ifd_ifc_pcxline_d;
169
 
170
   output                  ifd_ifc_asi_vachklo_i2;
171
 
172
   output                  ifd_ifc_cpxvld_i2;
173
   output [3:2]            ifd_ifc_asiaddr_i2;
174
   output                  ifd_ifc_iobpkt_i2;
175
   output                  ifd_ifc_fwd2ic_i2;
176
   output                  ifd_ifc_4bpkt_i2;
177
   output                  ifd_ifc_cpxnc_i2;
178
   output                  ifd_ifc_cpxce_i2,
179
                                       ifd_ifc_cpxue_i2,
180
                           ifd_ifc_cpxms_i2;
181
 
182
   output [3:0]            ifd_ifc_miladdr4_i2;
183
 
184
   output [1:0]            ifd_inv_wrway_i2;
185
 
186
 
187
 
188
   //----------------------------------------------------------------------
189
   // Declarations
190
   //----------------------------------------------------------------------   
191
 
192
   // local signals
193
   wire [39:0]             imiss_paddr_s;
194
   wire [9:2]              lcl_paddr_s;
195
 
196
   wire [42:2]             mil_entry0,         // mil entries
197
                                       mil_entry1,
198
                                       mil_entry2,
199
                                       mil_entry3;
200
 
201
//   wire [42:2]             mil0_in_s,          // inputs to mil
202
//                                     mil1_in_s,
203
//                                     mil2_in_s,
204
//                                     mil3_in_s;
205
 
206
   wire                    tag_par_s,
207
                                       tag_par_i2;
208
 
209
   wire [42:2]             newmil_entry_s;
210
 
211
   wire [42:2]             mil_pcxreq_d,        // outgoing request from mil
212
                                       pcxreq_d,            // mil or direct ic or prev req
213
                                       pcxreq_e;          // outgoing request to lsu
214
 
215
   wire [42:2]             fill_addr_i2,
216
                                       fill_addr_adj,
217
                                       icaddr_i2,
218
                                       asi_addr_i2,
219
                                       bist_addr_i2;
220
 
221
   wire [42:4]             wraddr_f;
222
 
223
 
224 113 albert.wat
   wire [`CPX_WIDTH-1:0]   inq_cpxpkt_i1,   // output from inq
225 95 fafa1971
//                                           inq_cpxpkt_nxt,
226
                                             stxa_data_pkt,
227
                           fwd_data_pkt,
228
                                             ifqop_i1,
229
                                             ifqop_i2;        // ifq op currently being processed
230
 
231
   wire [3:0]              swc_i2;
232
 
233
   wire [135:0]            icdata_i2;
234
 
235
   wire [3:0]              parity_i2,
236
                                       par_i2;
237
 
238
   wire [17:0]             asi_va_i2,
239
                           asi_va_i1;
240
   wire [13:2]             asi_fwd_index;
241
   wire                    clk;
242
 
243
 
244
//   wire [`IC_IDX_HI:6]     inv_addr_i2;
245
 
246
   //
247
   // Code start here 
248
   //
249
 
250
   assign                  clk = rclk;
251
 
252
   //----------------------------------------------------------------------
253
   // Instruction Miss - Fill Request Datapath
254
   //----------------------------------------------------------------------
255
 
256
   // new set of flops
257 113 albert.wat
   dff_s #(8) pcs_reg(.din (fdp_ifq_paddr_f[9:2]),
258 95 fafa1971
                    .q   (lcl_paddr_s[9:2]),
259 113 albert.wat
                    .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
260 95 fafa1971
 
261
 
262
   // bits 1:0 are floating
263
   assign  imiss_paddr_s = {itlb_ifq_paddr_s[39:10],
264
                            lcl_paddr_s[9:2],
265
                            2'b0};
266
 
267
   // Check for hit in MIL
268
   // Should we enable the comps to save power? -- timing problem
269
 
270
   // compare only top 35 bits (bot 5 bits are line offset of 32B line)
271
   sparc_ifu_cmp35 milcmp0 (.hit (ifd_ifc_milhit_s[0]),
272
                                              .a (imiss_paddr_s[39:5]),
273
                                              .b (mil_entry0[39:5]),
274
                                              .valid (1'b1)
275
                                              );
276
 
277
   sparc_ifu_cmp35 milcmp1 (.hit (ifd_ifc_milhit_s[1]),
278
                                              .a (imiss_paddr_s[39:5]),
279
                                              .b (mil_entry1[39:5]),
280
                                              .valid (1'b1)
281
                                              );
282
 
283
   sparc_ifu_cmp35 milcmp2 (.hit (ifd_ifc_milhit_s[2]),
284
                                              .a (imiss_paddr_s[39:5]),
285
                                              .b (mil_entry2[39:5]),
286
                                              .valid (1'b1)
287
                                              );
288
   sparc_ifu_cmp35 milcmp3 (.hit (ifd_ifc_milhit_s[3]),
289
                                              .a (imiss_paddr_s[39:5]),
290
                                              .b (mil_entry3[39:5]),
291
                                              .valid (1'b1)
292
                                              );
293
 
294
   // Send replacement way to ctl logic
295
//   assign  ifd_ifc_mil_repway_s =  {mil_entry3[41:40],
296
//                                        mil_entry2[41:40],
297
//                                        mil_entry1[41:40],
298
//                                        mil_entry0[41:40]};
299
 
300
 
301
   // calculate tag parity
302 113 albert.wat
   sparc_ifu_par32 tag_par(.in  ({{`ICT_FILL_BITS{1'b0}},
303
                                  imiss_paddr_s[`IC_TAG_HI:`IC_TAG_LO]}),
304 95 fafa1971
                                             .out (tag_par_s));
305
 
306
 
307
   // Missed Instruction List
308
   // 43    - NOT cacheable
309
   // 42    - tag parity
310
   // 41:40 - repl way
311
   // 39:0  - paddr
312
 
313
   // Prepare Missed Instruction List entry
314
   assign  newmil_entry_s = {tag_par_s,
315
                                               ifc_ifd_repway_s,
316
                                               imiss_paddr_s[39:2]};
317
 
318
   // ldmil_sel is thr_s[3:0] & imiss_s
319
//   dp_mux2es  #(41)    milin_mux0(.dout (mil0_in_s),
320
//                                                        .in0  (mil_entry0), 
321
//                                                        .in1  (newmil_entry_s),
322
//                                                        .sel  (ifc_ifd_ldmil_sel_new[0]));
323
//   dp_mux2es  #(41)    milin_mux1(.dout (mil1_in_s),
324
//                                                      .in0  (mil_entry1), 
325
//                                                      .in1  (newmil_entry_s),
326
//                                                      .sel  (ifc_ifd_ldmil_sel_new[1]));
327
//   dp_mux2es  #(41)    milin_mux2(.dout (mil2_in_s),
328
//                                                      .in0  (mil_entry2), 
329
//                                                      .in1  (newmil_entry_s),
330
//                                                      .sel  (ifc_ifd_ldmil_sel_new[2]));
331
//   dp_mux2es  #(41)    milin_mux3(.dout (mil3_in_s),
332
//                                                      .in0  (mil_entry3), 
333
//                                                      .in1  (newmil_entry_s),
334
//                                                      .sel  (ifc_ifd_ldmil_sel_new[3]));
335
 
336
   wire    clk_mil0;
337 113 albert.wat
`ifdef FPGA_SYN_CLK_EN
338
`else
339
   bw_u1_ckenbuf_6x  ckenmil0(.rclk (rclk),
340
                              .clk  (clk_mil0),
341
                              .en_l (~ifc_ifd_ldmil_sel_new[0]),
342
                              .tm_l (~se));
343
`endif
344 95 fafa1971
   wire    clk_mil1;
345 113 albert.wat
`ifdef FPGA_SYN_CLK_EN
346
`else
347
   bw_u1_ckenbuf_6x  ckenmil1(.rclk (rclk),
348
                              .clk  (clk_mil1),
349
                              .en_l (~ifc_ifd_ldmil_sel_new[1]),
350
                              .tm_l (~se));
351
`endif
352 95 fafa1971
   wire    clk_mil2;
353 113 albert.wat
`ifdef FPGA_SYN_CLK_EN
354
`else
355
   bw_u1_ckenbuf_6x  ckenmil2(.rclk (rclk),
356
                              .clk  (clk_mil2),
357
                              .en_l (~ifc_ifd_ldmil_sel_new[2]),
358
                              .tm_l (~se));
359
`endif
360 95 fafa1971
   wire    clk_mil3;
361 113 albert.wat
`ifdef FPGA_SYN_CLK_EN
362
`else
363
   bw_u1_ckenbuf_6x  ckenmil3(.rclk (rclk),
364
                              .clk  (clk_mil3),
365
                              .en_l (~ifc_ifd_ldmil_sel_new[3]),
366
                              .tm_l (~se));
367
`endif
368 95 fafa1971
 
369
 
370 113 albert.wat
`ifdef FPGA_SYN_CLK_DFF
371
   dffe_s #(41)   mil0(.din  (newmil_entry_s),
372 95 fafa1971
                                .en (~(~ifc_ifd_ldmil_sel_new[0])), .clk(rclk),
373
                                .q    (mil_entry0),
374 113 albert.wat
                                .se   (se), `SIMPLY_RISC_SCANIN, .so());
375
`else
376
   dff_s #(41)   mil0(.din  (newmil_entry_s),
377
                                .clk  (clk_mil0),
378
                                .q    (mil_entry0),
379
                                .se   (se), `SIMPLY_RISC_SCANIN, .so());
380
`endif
381 95 fafa1971
 
382 113 albert.wat
`ifdef FPGA_SYN_CLK_DFF
383
   dffe_s #(41)   mil1(.din (newmil_entry_s),
384 95 fafa1971
                                .en (~(~ifc_ifd_ldmil_sel_new[1])), .clk(rclk),
385
                                .q   (mil_entry1),
386 113 albert.wat
                                .se  (se), `SIMPLY_RISC_SCANIN, .so());
387
`else
388
   dff_s #(41)   mil1(.din (newmil_entry_s),
389
                                .clk (clk_mil1),
390
                                .q   (mil_entry1),
391
                                .se  (se), `SIMPLY_RISC_SCANIN, .so());
392
`endif
393 95 fafa1971
 
394 113 albert.wat
`ifdef FPGA_SYN_CLK_DFF
395
   dffe_s #(41)   mil2(.din (newmil_entry_s),
396 95 fafa1971
                                .en (~(~ifc_ifd_ldmil_sel_new[2])), .clk(rclk),
397
                                .q   (mil_entry2),
398 113 albert.wat
                                .se  (se), `SIMPLY_RISC_SCANIN, .so());
399
`else
400
   dff_s #(41)   mil2(.din (newmil_entry_s),
401
                                .clk (clk_mil2),
402
                                .q   (mil_entry2),
403
                                .se  (se), `SIMPLY_RISC_SCANIN, .so());
404
`endif
405 95 fafa1971
 
406 113 albert.wat
`ifdef FPGA_SYN_CLK_DFF
407
   dffe_s #(41)   mil3(.din (newmil_entry_s),
408 95 fafa1971
                                .en (~(~ifc_ifd_ldmil_sel_new[3])), .clk(rclk),
409
                                .q   (mil_entry3),
410 113 albert.wat
                                .se  (se), `SIMPLY_RISC_SCANIN, .so());
411
`else
412
   dff_s #(41)   mil3(.din (newmil_entry_s),
413
                                .clk (clk_mil3),
414
                                .q   (mil_entry3),
415
                                .se  (se), `SIMPLY_RISC_SCANIN, .so());
416
`endif
417 95 fafa1971
 
418
   assign  ifd_ifc_newdestid_s = {imiss_paddr_s[39],
419 113 albert.wat
                                                          imiss_paddr_s[`BANK_ID_HI:`BANK_ID_LO]};
420 95 fafa1971
   assign  ifd_ifc_destid0 = {mil_entry0[39],
421 113 albert.wat
                                                mil_entry0[`BANK_ID_HI:`BANK_ID_LO]};
422 95 fafa1971
   assign  ifd_ifc_destid1 = {mil_entry1[39],
423 113 albert.wat
                                                mil_entry1[`BANK_ID_HI:`BANK_ID_LO]};
424 95 fafa1971
   assign  ifd_ifc_destid2 = {mil_entry2[39],
425 113 albert.wat
                                                mil_entry2[`BANK_ID_HI:`BANK_ID_LO]};
426 95 fafa1971
   assign  ifd_ifc_destid3 = {mil_entry3[39],
427 113 albert.wat
                                                mil_entry3[`BANK_ID_HI:`BANK_ID_LO]};
428 95 fafa1971
 
429
   assign  ifd_ifc_instoffset0 = mil_entry0[3:2];
430
   assign  ifd_ifc_instoffset1 = mil_entry1[3:2];
431
   assign  ifd_ifc_instoffset2 = mil_entry2[3:2];
432
   assign  ifd_ifc_instoffset3 = mil_entry3[3:2];
433
 
434
 
435
   // MIL Request Out mux
436
   dp_mux4ds  #(41)  milreq_mux (.dout (mil_pcxreq_d),
437
                                                 .in0  ({mil_entry0[42:2]}),
438
                                                 .in1  ({mil_entry1[42:2]}),
439
                                                 .in2  ({mil_entry2[42:2]}),
440
                                                 .in3  ({mil_entry3[42:2]}),
441
                                                 .sel0_l  (ifc_ifd_milreq_sel_d_l[0]),
442
                                                 .sel1_l  (ifc_ifd_milreq_sel_d_l[1]),
443
                                                 .sel2_l  (ifc_ifd_milreq_sel_d_l[2]),
444
                                                 .sel3_l  (ifc_ifd_milreq_sel_d_l[3]));
445
 
446
   // Next PCX Request Mux
447
//   dp_mux3ds  #(44)  nxtpcx_mux (.dout  (pcxreq_d),
448
//                                               .in0   (mil_pcxreq_d), 
449
//                                               .in1   (44'bx),
450
//                                               .in2   (pcxreq_e),
451
//                                               .sel0_l  (ifc_ifd_nxtpcx_sel_new_d_l),
452
//                                               .sel1_l  (ifc_ifd_nxtpcx_sel_err_d_l),
453
//                                               .sel2_l  (ifc_ifd_nxtpcx_sel_prev_d_l));
454
 
455
 
456
   // TBD: If destid == any L2 bank, need to zero out bit 4 for Rams
457
   //    -- done
458
   assign  ifd_ifc_pcxline_d[4:2] = mil_pcxreq_d[4:2];
459
 
460
   assign  pcxreq_d[42:5] = mil_pcxreq_d[42:5];
461
   assign  pcxreq_d[4:2] = ifc_ifd_pcxline_adj_d[4:2];
462
//   assign  pcxreq_d[1:0] = mil_pcxreq_d[1:0];  // dont need this
463
 
464 113 albert.wat
   dff_s #(41) pcxreq_reg (.din  (pcxreq_d),
465 95 fafa1971
                                            .clk  (clk),
466
                                            .q    (pcxreq_e),
467 113 albert.wat
                                            .se   (se), `SIMPLY_RISC_SCANIN, .so());
468 95 fafa1971
 
469
// CHANGE to regular dff   
470
//   dffe #(44) pcxreq_reg (.din  (pcxreq_d),
471
//                                          .clk  (clk),
472
//                                          .q    (pcxreq_e),
473
//                          .en   (ifc_ifd_nxtpcx_sel_new_d),
474 113 albert.wat
//                                          .se   (se), `SIMPLY_RISC_SCANIN, .so());
475 95 fafa1971
 
476
   // PCX Req Reg -- req type is 5 bits
477
   assign   ifu_lsu_pcxpkt_e = {ifc_ifd_reqvalid_e,   // 51    - valid
478
                                                  ifc_ifd_errinv_e,     // 50 - inv all ways
479
                                ifc_ifd_uncached_e,   // 49 - not cacheable
480 113 albert.wat
                                                  {`IMISS_RQ},          // 48:44 - req type
481 95 fafa1971
                                                  pcxreq_e[41:40],      // 43:42 - rep way
482
                                                  ifc_ifd_thrid_e[1:0], // 41:40 - thrid
483
                                                  pcxreq_e[39:2],       // 39:2  - word address
484
                                                  2'b0};                // force to zero
485
 
486
 
487
   //----------------------------------------------------------------------
488
   // Fill Return Address
489
   //----------------------------------------------------------------------
490
 
491
   // MIL Fill Return Mux
492
   dp_mux4ds  #(41)  milfill_mux(.dout (fill_addr_i2),
493
                                                 .in0 ( mil_entry0),
494
                                                 .in1 ( mil_entry1),
495
                                                 .in2 ( mil_entry2),
496
                                                 .in3 ( mil_entry3),
497
                                                 .sel0_l (ifc_ifd_milfill_sel_i2_l[0]),
498
                                                 .sel1_l (ifc_ifd_milfill_sel_i2_l[1]),
499
                                                 .sel2_l (ifc_ifd_milfill_sel_i2_l[2]),
500
                                                 .sel3_l (ifc_ifd_milfill_sel_i2_l[3]));
501
 
502
   assign   ifd_ifc_miladdr4_i2[3:0]  = {mil_entry3[4],
503
                                         mil_entry2[4],
504
                                         mil_entry1[4],
505
                                         mil_entry0[4]};
506
 
507
   assign   ifd_ifc_iobpkt_i2 = fill_addr_i2[39];
508
   assign   fill_addr_adj = {fill_addr_i2[42:5],
509
                                               ifc_ifd_filladdr4_i2,
510
                                               fill_addr_i2[3:2]};
511
   // determine if this is cacheable in I$
512
   // moved to ifqctl
513
//   assign   ifd_ifc_uncached_i2 = fill_addr_i2[43];
514
 
515
   // merged with addren mux to save some timing
516
   dp_mux4ds #(41) icadr_mux(.dout (icaddr_i2),
517
                                               .in0  (fill_addr_adj),
518
                                               .in1  (asi_addr_i2),
519
                                               .in2  (bist_addr_i2),
520
                             .in3  ({wraddr_f[42:4], 2'b0}),
521
                                               .sel0_l (ifc_ifd_addr_sel_fill_i2_l),
522
                                               .sel1_l (ifc_ifd_addr_sel_asi_i2_l),
523
                                               .sel2_l (ifc_ifd_addr_sel_bist_i2_l),
524
                             .sel3_l (ifc_ifd_addr_sel_old_i2_l));
525
 
526
   // way, 32B line sel
527
   assign ifd_inv_wrway_i2 =  icaddr_i2[41:40];
528
 
529
//   dp_mux2es  #(39)  addren_mux(.dout (wraddr_i2),
530
//                                              .in0  (wraddr_f),
531
//                                              .in1  (icaddr_i2[42:4]),
532
//                                              .sel  (ifc_ifd_ifqadv_i2));
533
 
534
 
535 113 albert.wat
   dff_s #(39) wraddr_reg(.din  (icaddr_i2[42:4]),
536 95 fafa1971
                                    .clk  (clk),
537
                                    .q    (wraddr_f[42:4]),
538 113 albert.wat
                                    .se   (se), `SIMPLY_RISC_SCANIN, .so());
539 95 fafa1971
 
540
   // tag = parity bit + `IC_TAG_SZ bits of address
541 113 albert.wat
   assign  ifq_erb_wrindex_f = wraddr_f[`IC_IDX_HI:4];
542
   assign  ifq_ict_wrtag_f = {wraddr_f[42], wraddr_f[`IC_TAG_HI:`IC_TAG_LO]};
543 95 fafa1971
 
544 113 albert.wat
   assign  ifq_icd_index_bf = icaddr_i2[`IC_IDX_HI:2];
545 95 fafa1971
   assign  ifq_icd_wrway_bf = icaddr_i2[41:40];
546
 
547
   //----------------------------------------------------------------------
548
   // Fill Return Data
549
   //----------------------------------------------------------------------
550
   // IFQ-IBUF
551
   // inq is the same size as the cpx_width
552
   // inq is replaced with a single flop, ibuf
553
 
554
   // ibuf enable mux
555
//   dp_mux2es  #(`CPX_WIDTH)  ifqen_mux(.dout (inq_cpxpkt_nxt),
556
//                                                           .in0 (inq_cpxpkt_i1),
557
//                                                           .in1 (lsu_ifu_cpxpkt_i1), 
558
//                                                           .sel (ifc_ifd_ld_inq_i1));
559
 
560
   wire    clk_ibuf1;
561 113 albert.wat
`ifdef FPGA_SYN_CLK_EN
562
`else
563
   bw_u1_ckenbuf_6x  ckenibuf(.rclk (rclk),
564
                              .clk  (clk_ibuf1),
565
                              .en_l (~ifc_ifd_ld_inq_i1),
566
                              .tm_l (~se));
567
`endif
568 95 fafa1971
 
569 113 albert.wat
`ifdef FPGA_SYN_CLK_DFF
570
   dffe_s #(`CPX_WIDTH) ibuf(.din (lsu_ifu_cpxpkt_i1),
571 95 fafa1971
                                          .q   (inq_cpxpkt_i1),
572
                                          .en (~(~ifc_ifd_ld_inq_i1)), .clk(rclk),
573 113 albert.wat
                                          .se  (se), `SIMPLY_RISC_SCANIN, .so());
574
`else
575
   dff_s #(`CPX_WIDTH) ibuf(.din (lsu_ifu_cpxpkt_i1),
576
                                          .q   (inq_cpxpkt_i1),
577
                                          .clk (clk_ibuf1),
578
                                          .se  (se), `SIMPLY_RISC_SCANIN, .so());
579
`endif
580 95 fafa1971
 
581 113 albert.wat
   assign  ifd_ifc_cpxreq_i1 = {inq_cpxpkt_i1[`CPX_VLD],
582
                                                  inq_cpxpkt_i1[`CPX_REQFIELD]};
583 95 fafa1971
 
584
   // ifq operand bypass mux
585
   // fill pkt is 128d+2w+2t+3iw+1v+1nc+4r = 140
586 113 albert.wat
   dp_mux4ds  #(`CPX_WIDTH)  ifq_bypmux(.dout (ifqop_i1),
587 95 fafa1971
                                                              .in0 (fwd_data_pkt),
588
                                                              .in1 (inq_cpxpkt_i1),
589
                                                              .in2 (stxa_data_pkt),
590
                                                              .in3 (lsu_ifu_cpxpkt_i1),
591
                                                              .sel0_l (ifc_ifd_ifqbyp_sel_fwd_l),
592
                                                              .sel1_l (ifc_ifd_ifqbyp_sel_inq_l),
593
                                                              .sel2_l (ifc_ifd_ifqbyp_sel_asi_l),
594
                                                              .sel3_l (ifc_ifd_ifqbyp_sel_lsu_l));
595
 
596
   wire    clk_ifqop;
597 113 albert.wat
`ifdef FPGA_SYN_CLK_EN
598
`else
599
   bw_u1_ckenbuf_6x  ckenifop(.rclk (rclk),
600
                              .clk  (clk_ifqop),
601
                              .en_l (ifc_ifd_ifqbyp_en_l),
602
                              .tm_l (~se));
603
`endif
604 95 fafa1971
 
605 113 albert.wat
`ifdef FPGA_SYN_CLK_DFF
606
   dffe_s #(`CPX_WIDTH)  ifqop_reg(.din (ifqop_i1),
607 95 fafa1971
                                                .q   (ifqop_i2),
608
                                                .en (~(ifc_ifd_ifqbyp_en_l)), .clk(rclk),
609 113 albert.wat
                                                .se  (se), `SIMPLY_RISC_SCANIN, .so());
610
`else
611
   dff_s #(`CPX_WIDTH)  ifqop_reg(.din (ifqop_i1),
612
                                                .q   (ifqop_i2),
613
                                                .clk (clk_ifqop),
614
                                                .se  (se), `SIMPLY_RISC_SCANIN, .so());
615
`endif
616 95 fafa1971
   assign  ifd_inv_ifqop_i2 = ifqop_i2;
617
 
618
   // switch condition pre decode
619
   sparc_ifu_swpla  swpla0(.in  (ifqop_i2[31:0]),
620
                                             .out (swc_i2[0]));
621
   sparc_ifu_swpla  swpla1(.in  (ifqop_i2[63:32]),
622
                                             .out (swc_i2[1]));
623
   sparc_ifu_swpla  swpla2(.in  (ifqop_i2[95:64]),
624
                                             .out (swc_i2[2]));
625
   sparc_ifu_swpla  swpla3(.in  (ifqop_i2[127:96]),
626
                                             .out (swc_i2[3]));
627
 
628
   // Add Parity to each inst.
629
   sparc_ifu_par32 par0(.in  (ifqop_i2[31:0]),
630
                                          .out (par_i2[0]));
631
   sparc_ifu_par32 par1(.in  (ifqop_i2[63:32]),
632
                                          .out (par_i2[1]));
633
   sparc_ifu_par32 par2(.in  (ifqop_i2[95:64]),
634
                                          .out (par_i2[2]));
635
   sparc_ifu_par32 par3(.in  (ifqop_i2[127:96]),
636
                                          .out (par_i2[3]));
637
 
638
   // add 8 xor gates in the dp
639
   //   assign parity_i2 = par_i2 ^ swc_i2 ^ {4{ifc_ifd_insert_pe}};
640
   //   assign tag_par_i2 = par_i2[0] ^ ifc_ifd_insert_pe;
641
 
642
   // Make the par32 cell above, par33 and include cpxue_i2
643
   assign   parity_i2 = par_i2 ^ swc_i2 ^ {4{ifd_ifc_cpxue_i2}};
644
   assign   tag_par_i2 = par_i2[0] ^ ifd_ifc_cpxue_i2;
645
 
646
   // parity, swc, inst[31:0]
647
   assign   icdata_i2 = {parity_i2[3], ifqop_i2[127:96], swc_i2[3],
648
                                     parity_i2[2], ifqop_i2[95:64],  swc_i2[2],
649
                                     parity_i2[1], ifqop_i2[63:32],  swc_i2[1],
650
                                     parity_i2[0], ifqop_i2[31:0],   swc_i2[0]};
651
 
652
   // write data to icache
653
   assign ifq_icd_wrdata_i2 = icdata_i2;
654
 
655
 
656
   // very critical
657 113 albert.wat
   assign ifd_ifc_cpxreq_nxt   = ifqop_i1[`CPX_REQFIELD];
658
   assign ifd_ifc_cpxthr_nxt   = ifqop_i1[`CPX_THRFIELD];
659 95 fafa1971
 
660 113 albert.wat
   assign ifd_ifc_cpxvld_i2   = ifqop_i2[`CPX_VLD];
661
   assign ifd_ifc_4bpkt_i2    = ifqop_i2[`CPX_IF4B];
662
   assign ifd_ifc_cpxce_i2    = ifqop_i2[`CPX_ERR_LO];
663
   assign ifd_ifc_cpxue_i2    = ifqop_i2[(`CPX_ERR_LO + 1)];
664
   assign ifd_ifc_cpxms_i2    = ifqop_i2[(`CPX_ERR_LO + 2)];
665
   assign ifd_ifc_cpxnc_i2    = ifqop_i2[`CPX_NC];
666 95 fafa1971
   assign ifd_ifc_fwd2ic_i2   = ifqop_i2[103];
667
 
668
   // instr sel mux to write to thread inst regsiter in S stage
669
   // instr is always BIG ENDIAN
670
   dp_mux4ds  #(33)  fillinst_mux(.dout (ifq_fdp_fill_inst),
671
                                                        .in0 (icdata_i2[134:102]),
672
                                                        .in1 (icdata_i2[100:68]),
673
                                                        .in2 (icdata_i2[66:34]),
674
                                                        .in3 (icdata_i2[32:0]),
675
                                                        .sel0_l (ifc_ifd_finst_sel_l[0]),
676
                                                        .sel1_l (ifc_ifd_finst_sel_l[1]),
677
                                                        .sel2_l (ifc_ifd_finst_sel_l[2]),
678
                                                        .sel3_l (ifc_ifd_finst_sel_l[3]));
679
 
680
   // synopsys translate_off
681
//`ifdef DEFINE_0IN
682
//`else
683
//   always @ (ifq_fdp_fill_inst or ifd_ifc_cpxreq_i2)
684
//     if (((^ifq_fdp_fill_inst[32:0]) == 1'bx) && (ifd_ifc_cpxreq_i2 == `CPX_IFILLPKT))
685
//       begin
686
//          $display("ifqdp.v: Imiss Return val = %h\n", ifqop_i2);
687 113 albert.wat
//          $error("IFQCPX", "Error: X's detected in Imiss Return Inst %h", 
688 95 fafa1971
//                 ifq_fdp_fill_inst[31:0]);
689
//       end
690
//`endif
691
   // synopsys translate_on
692
 
693
 
694
   // TBD: 1. inv way in fill pkt -- DONE
695
   //      2. inv packet -- DONE
696
   //      3. DFT pkt from TAP -- NO NEED
697
   //      4. Ld pkt to invalidate i$  -- DONE
698
 
699
   //----------------------------------------------------------------------
700
   // ASI Access
701
   //----------------------------------------------------------------------
702
   // mux stxa pkt into the cpx
703 113 albert.wat
   assign  stxa_data_pkt[`CPX_VLD] = 1'b0;
704 95 fafa1971
   // vbits and parity are muxed into the cpxreq
705 113 albert.wat
   assign  stxa_data_pkt[`CPX_REQFIELD] = {1'b1, lsu_ifu_stxa_data[34:32]};
706 95 fafa1971
//   assign  stxa_data_pkt[`CPX_THRFIELD] = lsu_ifu_asi_thrid[1:0];
707 113 albert.wat
   assign  stxa_data_pkt[`CPX_THRFIELD] = 2'b0;
708 95 fafa1971
   // use parity to insert error in icache inst or tag
709 113 albert.wat
   assign  stxa_data_pkt[(`CPX_ERR_LO + 1)] = lsu_ifu_stxa_data[32];
710 95 fafa1971
   assign  stxa_data_pkt[127:0] = {4{lsu_ifu_stxa_data[31:0]}};
711
 
712
   // other bits need to be tied off
713
   assign  stxa_data_pkt[133:128] = 6'b0;
714
   assign  stxa_data_pkt[137:136] = 2'b0;
715
   assign  stxa_data_pkt[139] = 1'b0;
716
 
717
   // format fwd data pkt in a similar way
718 113 albert.wat
   assign  fwd_data_pkt[`CPX_VLD:(`CPX_ERR_LO + 2)] = ifqop_i2[`CPX_VLD:(`CPX_ERR_LO + 2)];
719
   assign  fwd_data_pkt[(`CPX_ERR_LO + 1)] = ifqop_i2[32];
720
   assign  fwd_data_pkt[`CPX_ERR_LO:128] = ifqop_i2[`CPX_ERR_LO:128];
721 95 fafa1971
   assign  fwd_data_pkt[127:0] = {4{ifqop_i2[31:0]}};
722
 
723
 
724
 
725 113 albert.wat
   dff_s #(16) stxa_ff(.din (lsu_ifu_stxa_data[47:32]),
726 95 fafa1971
                                 .q   (ifq_erb_asidata_i2[47:32]),
727 113 albert.wat
                                 .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
728 95 fafa1971
   assign  ifq_erb_asidata_i2[31:0] = ifqop_i2[31:0];
729
 
730
   // va[63:32] is truncated
731
   // In this architecture we only need va[17:0]
732
   // rest of the bits ar ehere only for the address range check
733
   // 12 new muxes (10 for addr, 2 for way)
734
   // CHANGE: this mux has been moved before the asi_addr_reg, rather
735
   // than after.
736
   // Use mux flop soffm2?
737
   dp_mux2es #(12) asifwd_mx(.dout (asi_fwd_index[13:2]),
738
                             .in0  ({lsu_ifu_asi_addr[17:16],   // asi way
739
                                     lsu_ifu_asi_addr[12:3]}),  // asi addr
740
                             .in1  ({ifqop_i2[81:80],    // fwd rq way
741
                                     ifqop_i2[76:67]}),  // fwd rq addr
742
                             .sel  (ifc_ifd_idx_sel_fwd_i2));
743
 
744
   assign asi_va_i1 = {asi_fwd_index[13:12],
745
                       lsu_ifu_asi_addr[15:13],
746
                       asi_fwd_index[11:2],
747
                       lsu_ifu_asi_addr[2:0]};
748
 
749 113 albert.wat
   dff_s #(18) asi_addr_reg(.din (asi_va_i1[17:0]),  // 15:13 is not used
750 95 fafa1971
                                            .q   (asi_va_i2[17:0]),
751
                                            .clk (clk),
752 113 albert.wat
                                            .se  (se), `SIMPLY_RISC_SCANIN, .so());
753 95 fafa1971
 
754
   // 16b zero cmp: leave out bit 3!! (imask is 0x8)
755
   assign  ifd_ifc_asi_vachklo_i2 = (|asi_va_i2[16:4]) | (|asi_va_i2[2:0]);
756
 
757
   // mux in ifqop and asi_va_i2 to create new asi va?
758
   // asi va is shifted by 1 bit to look like 64b op
759
   assign    ifd_ifc_asiaddr_i2[3:2] = asi_va_i2[4:3];
760
 
761
   assign    asi_addr_i2 = {tag_par_i2,           // tag parity 42
762
                                              asi_va_i2[17:16],     // way 41:40
763
                                              ifqop_i2[27:0],       // tag 39:12
764
                                              asi_va_i2[12:3]       // index 11:2
765
                            };
766
 
767
   // bist has to go to icache in the same cycle
768
   // cannot flop it
769
   assign    bist_addr_i2 = {1'b0,                    // par
770
                                               mbist_icache_way[1:0],   // way 41:40
771
                                               28'b0,                   // tag 39:12
772
                                               mbist_icache_index[7:0], // index 11:4
773
                             mbist_icache_word,       // 3
774
                                               1'b0
775
                                               };
776
 
777
   // floating signals
778
   sink #(2) s0(.in (imiss_paddr_s[1:0]));
779
   sink s1(.in (pcxreq_e[42]));
780
   sink s2(.in (fill_addr_i2[4]));
781
 
782
 
783
endmodule // sparc_ifu_ifqdp
784
 
785
 
786
 

powered by: WebSVN 2.1.0

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