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

Subversion Repositories s1_core

[/] [s1_core/] [trunk/] [hdl/] [rtl/] [sparc_core/] [lsu_qctl1.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: lsu_qctl1.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
//  Description:  LSU Queue Control for Sparc Core
29
//      - includes monitoring for pcx queues
30
//      - control for lsu datapath
31
//      - rd/wr control of dfq
32
*/
33
////////////////////////////////////////////////////////////////////////
34
// header file includes
35
////////////////////////////////////////////////////////////////////////
36 113 albert.wat
`include  "sys.h" // system level definition file which contains the 
37 95 fafa1971
                  // time scale definition
38 113 albert.wat
`include  "iop.h"
39 95 fafa1971
 
40 113 albert.wat
`include  "lsu.h"
41 95 fafa1971
 
42
////////////////////////////////////////////////////////////////////////
43
// Local header file includes / local defines
44
////////////////////////////////////////////////////////////////////////
45
 
46
module lsu_qctl1 ( /*AUTOARG*/
47
   // Outputs
48
   lsu_bld_helper_cmplt_m, lsu_bld_cnt_m, lsu_bld_reset,
49
   lsu_pcx_rq_sz_b3, lsu_ramtest_rd_w, ld_stb_full_raw_w2,
50
   lsu_ld_pcx_rq_sel_d2, spc_pcx_req_pq, spc_pcx_atom_pq,
51
   lsu_ifu_pcxpkt_ack_d, pcx_pkt_src_sel, lmq_enable,
52
   imiss_pcx_mx_sel, fwd_int_fp_pcx_mx_sel, lsu_ffu_bld_cnt_w,
53
   lsu_ld_pcx_rq_mxsel, ld_pcx_thrd, lsu_spu_ldst_ack,
54
   pcx_rq_for_stb, pcx_rq_for_stb_d1, lsu_ffu_ack,
55
   lsu_ifu_ld_pcxpkt_vld, lsu_pcx_req_squash0, lsu_pcx_req_squash1,
56
   lsu_pcx_req_squash2, lsu_pcx_req_squash3, lsu_pcx_req_squash_d1,
57
   lsu_pcx_ld_dtag_perror_w2, lsu_tlu_dcache_miss_w2, lsu_bld_pcx_rq,
58
   lsu_bld_rq_addr, lsu_fwdpkt_pcx_rq_sel, lsu_imiss_pcx_rq_sel_d1,
59
   lsu_tlu_pcxpkt_ack, lsu_intrpt_cmplt, lsu_lmq_byp_misc_sel,
60
   lsu_sscan_data, so, lsu_dfq_byp_tid_d1_sel, lmq0_pcx_pkt_way,
61
   lmq1_pcx_pkt_way, lmq2_pcx_pkt_way, lmq3_pcx_pkt_way,
62
   lsu_st_pcx_rq_pick, lsu_stb_pcx_rvld_d1, lsu_stb_rd_tid,
63
   lsu_ld0_spec_vld_kill_w2, lsu_ld1_spec_vld_kill_w2,
64
   lsu_ld2_spec_vld_kill_w2, lsu_ld3_spec_vld_kill_w2,
65
   lsu_st_pcx_rq_vld,
66
   // Inputs
67
   rclk, si, se, sehold, grst_l, arst_l, lsu_quad_word_access_g,
68
   pcx_spc_grant_px, ld_inst_vld_e, lsu_ldst_va_m, stb0_l2b_addr,
69
   stb1_l2b_addr, stb2_l2b_addr, stb3_l2b_addr, lsu_ld_miss_g,
70
   ifu_lsu_ldst_fp_e, ld_rawp_st_ced_w2, ld_rawp_st_ackid_w2,
71
   stb0_crnt_ack_id, stb1_crnt_ack_id, stb2_crnt_ack_id,
72
   stb3_crnt_ack_id, ifu_tlu_thrid_e, ldxa_internal,
73
   spu_lsu_ldst_pckt, spu_lsu_ldst_pckt_vld, ifu_tlu_inst_vld_m,
74
   ifu_lsu_flush_w, ifu_lsu_casa_e, lsu_ldstub_g, lsu_swap_g,
75
   stb0_atm_rq_type, stb1_atm_rq_type, stb2_atm_rq_type,
76
   stb3_atm_rq_type, tlb_pgnum_g, stb_rd_for_pcx, ffu_lsu_data,
77
   ffu_lsu_fpop_rq_vld, ifu_lsu_ldst_dbl_e, ifu_lsu_pcxreq_d,
78
   ifu_lsu_destid_s, ifu_lsu_pref_inst_e, tlb_cam_hit_g,
79
   lsu_blk_asi_m, stb_cam_hit_bf, lsu_fwdpkt_vld,
80
   lsu_dcfill_active_e, dfq_byp_sel, lsu_dfq_ld_vld, lsu_fldd_vld_en,
81
   lsu_dfill_dcd_thrd, lsu_fwdpkt_dest, tlu_lsu_pcxpkt_tid,
82
   lsu_stb_empty, tlu_lsu_pcxpkt_vld, tlu_lsu_pcxpkt_l2baddr,
83
   ld_sec_hit_thrd0, ld_sec_hit_thrd1, ld_sec_hit_thrd2,
84
   ld_sec_hit_thrd3, ld_thrd_byp_sel_e, lsu_st_pcx_rq_kill_w2,
85
   ifu_lsu_alt_space_e, lsu_dfq_byp_tid, dfq_byp_ff_en,
86
   stb_ld_full_raw, stb_ld_partial_raw, stb_cam_mhit,
87
   lsu_ldquad_inst_m, stb_cam_wr_no_ivld_m, lsu_ldst_va_way_g,
88
   lsu_dcache_rand, lsu_encd_way_hit, lsu_way_hit_or, dc_direct_map,
89
   lsu_tlb_perr_ld_rq_kill_w, lsu_dcache_tag_perror_g,
90
   lsu_ld_inst_vld_g, asi_internal_m, ifu_lsu_pcxpkt_e_b50,
91
   lda_internal_m, atomic_m, lsu_dcache_iob_rd_w,
92
   ifu_lsu_fwd_data_vld, rst_tri_en, lsu_no_spc_pref,
93
   tlu_early_flush_pipe2_w, lsu_ttype_vld_m2
94
   );
95
 
96
 
97
input     rclk ;
98
input                   si;
99
input                   se;
100
input                   sehold;
101
input                   grst_l;
102
input                   arst_l;
103
 
104
//input [1:0]           ld_pcx_pkt_wy_g ;
105
input                   lsu_quad_word_access_g ;
106
 
107
// LSU <- PCX
108
// bit5 - FP, bit4 - IO.
109
input [4:0]             pcx_spc_grant_px ;    // pcx grants packet to destination.
110
input                   ld_inst_vld_e;        // valid ld inst; d-stage
111
input [7:6]             lsu_ldst_va_m ;           // Virt. Addr. of ld/st/atomic.
112
 
113
input [2:0]             stb0_l2b_addr ;         // st's addr for pcx - thread0.
114
input [2:0]             stb1_l2b_addr ;         // st's addr for pcx - thread1.
115
input [2:0]             stb2_l2b_addr ;         // st's addr for pcx - thread2.
116
input [2:0]             stb3_l2b_addr ;         // st's addr for pcx - thread3.
117
input                   lsu_ld_miss_g ;         // load misses in dcache.
118
//input                   lsu_ld_hit_g ;          // load hits in dcache.
119
input                   ifu_lsu_ldst_fp_e ;     // fp load/store.
120
 
121
//input                   ld_stb_full_raw_g ;    // full raw for load - thread0
122
//input                   ld_stb_partial_raw_g ; // partial raw for load - thread0
123
input                   ld_rawp_st_ced_w2 ;      // store has been acked - thread0
124
//input                   ld_rawp_st_ced_g ;      // store has been acked - thread0
125
input   [2:0]           ld_rawp_st_ackid_w2 ;    // ackid for acked store - thread0
126
input [2:0]             stb0_crnt_ack_id ;      // ackid for crnt outstanding st. 
127
input [2:0]             stb1_crnt_ack_id ;      // ackid for crnt outstanding st. 
128
input [2:0]             stb2_crnt_ack_id ;      // ackid for crnt outstanding st. 
129
input [2:0]             stb3_crnt_ack_id ;      // ackid for crnt outstanding st. 
130
input [1:0]             ifu_tlu_thrid_e ;       // thread-id
131
input                   ldxa_internal ;         // internal ldxa, stg g 
132
 
133 113 albert.wat
input [`PCX_AD_LO+7:`PCX_AD_LO+6] spu_lsu_ldst_pckt ;  // addr bits
134 95 fafa1971
input                   spu_lsu_ldst_pckt_vld ; // vld
135
input                   ifu_tlu_inst_vld_m ;    // inst is vld - wstage
136
 
137
input                   ifu_lsu_flush_w ;       // ifu's flush
138
input                   ifu_lsu_casa_e ;        // compare-swap instr
139
input                   lsu_ldstub_g ;          // ldstub(a) instruction
140
input                   lsu_swap_g ;            // swap(a) instruction 
141
input  [2:1]            stb0_atm_rq_type ;      // stb pcx rq type - atomic
142
input  [2:1]            stb1_atm_rq_type ;      // stb pcx rq type - atomic
143
input  [2:1]            stb2_atm_rq_type ;      // stb pcx rq type - atomic
144
input  [2:1]            stb3_atm_rq_type ;      // stb_pcx_rq_type - atomic
145
input [39:37]           tlb_pgnum_g ;           // ldst access to io 
146
input [3:0]             stb_rd_for_pcx ;        // rd for pcx can be scheduled
147
input [80:79]           ffu_lsu_data ;
148
input                   ffu_lsu_fpop_rq_vld ;   // ffu dispatches fpop issue request.
149
input                   ifu_lsu_ldst_dbl_e ;    // ld/st double
150
input                   ifu_lsu_pcxreq_d ;
151
input   [2:0]           ifu_lsu_destid_s ;
152
input                   ifu_lsu_pref_inst_e ;      // prefetch inst
153
input                   tlb_cam_hit_g ;            // tlb cam hit ; error included
154
input                   lsu_blk_asi_m ;
155
//input                   stb_cam_wptr_vld;
156
input                   stb_cam_hit_bf;
157
 
158
input                   lsu_fwdpkt_vld;
159
//input  [3:0]            lsu_error_rst;
160
input                   lsu_dcfill_active_e;
161
input  [3:0]            dfq_byp_sel ;
162
//input  [3:0]            lsu_dfq_byp_mxsel ;   
163
//input  [3:0]            lsu_st_ack_rq_stb ;
164
input                   lsu_dfq_ld_vld;
165
input                   lsu_fldd_vld_en;
166
input  [3:0]            lsu_dfill_dcd_thrd ;
167
input  [4:0]            lsu_fwdpkt_dest ;
168
 
169
input [19:18]           tlu_lsu_pcxpkt_tid ;
170
input   [3:0]           lsu_stb_empty ;
171
input                   tlu_lsu_pcxpkt_vld ;
172
input [11:10]           tlu_lsu_pcxpkt_l2baddr ;
173
input                   ld_sec_hit_thrd0 ;      // ld has sec. hit against th0
174
input                   ld_sec_hit_thrd1 ;      // ld has sec. hit against th1
175
input                   ld_sec_hit_thrd2 ;      // ld has sec. hit against th2
176
input                   ld_sec_hit_thrd3 ;      // ld has sec. hit against th3
177
input [2:0]             ld_thrd_byp_sel_e ;       // stb,ldxa thread byp sel
178
input   [3:0]    lsu_st_pcx_rq_kill_w2 ;
179
 
180
input                   ifu_lsu_alt_space_e ;
181
input   [1:0]           lsu_dfq_byp_tid;
182
 
183
input                   dfq_byp_ff_en;
184
 
185
//input [3:0]           lsu_dtag_perror_w2 ;
186
 
187
input [7:0]              stb_ld_full_raw ;
188
input [7:0]              stb_ld_partial_raw ;
189
 
190
input                   stb_cam_mhit ;          // multiple hits in stb
191
input                   lsu_ldquad_inst_m ; // ldquad inst
192
 
193
input                   stb_cam_wr_no_ivld_m ;
194
 
195
input  [1:0]            lsu_ldst_va_way_g ;          // 12:11 for direct map
196
input  [1:0]            lsu_dcache_rand;
197
input  [1:0]            lsu_encd_way_hit;
198
input                   lsu_way_hit_or;
199
input                   dc_direct_map;
200
//input                   lsu_quad_asi_g;
201
 
202
input                   lsu_tlb_perr_ld_rq_kill_w ;
203
 
204
input                   lsu_dcache_tag_perror_g ;  // dcache tag parity error
205
input   [3:0]           lsu_ld_inst_vld_g ;
206
//input                  lsu_pcx_ld_dtag_perror_w2 ;    // from qctl2
207
 
208
input                   asi_internal_m ;
209
 
210
input                   ifu_lsu_pcxpkt_e_b50 ;
211
 
212
input                   lda_internal_m ;
213
input                   atomic_m ;
214
 
215
input                   lsu_dcache_iob_rd_w ;
216
input                   ifu_lsu_fwd_data_vld ;
217
 
218
input                   rst_tri_en ;
219
 
220
output                  lsu_bld_helper_cmplt_m ;
221
output  [2:0]            lsu_bld_cnt_m ;
222
output                  lsu_bld_reset ;
223
 
224
output                  lsu_pcx_rq_sz_b3 ;
225
 
226
output                  lsu_ramtest_rd_w ;
227
 
228
 
229
output                  ld_stb_full_raw_w2 ;
230
 
231
output  [3:0]            lsu_ld_pcx_rq_sel_d2 ;
232
 
233
output  [4:0]           spc_pcx_req_pq;         // request destination for packet.
234
              // FPU, IO, L2_BANK[3:0].
235
              // 1-hot - create monitor !
236
output                  spc_pcx_atom_pq ;       // atomic packet. 
237
output                  lsu_ifu_pcxpkt_ack_d ;  // ack for I$ fill request.
238
output  [3:0]           pcx_pkt_src_sel ;        // - qdp1
239
output  [3:0]           lmq_enable ;     // - qdp1
240
output                  imiss_pcx_mx_sel ;      // - qdp1
241
output  [2:0]           fwd_int_fp_pcx_mx_sel ;  // - qdp1
242
output  [2:0]            lsu_ffu_bld_cnt_w ;
243
//output  [3:0]           ld_pcx_rq_sel ;       // - qctl2
244
output  [3:0]           lsu_ld_pcx_rq_mxsel ;    // - qdp1
245
output  [1:0]           ld_pcx_thrd ;    // - qdp1
246
output                  lsu_spu_ldst_ack ;  // strm ld/st ack to spu
247
//output                  strm_sldst_cam_vld; // strm ld/st xslate rq
248
//output                  strm_sld_dc_rd_vld; // strm alloc. ld xslate rq.
249
//output                  strm_sldst_cam_d2;  // strm ld/st xslate rq-d2
250
output  [3:0]           pcx_rq_for_stb ;      // pcx demands rd for store - stb_ctl
251
output  [3:0]           pcx_rq_for_stb_d1 ;  // pcx demands rd for store - qdp2
252
output                  lsu_ffu_ack ;         // ack to ffu.
253
output                  lsu_ifu_ld_pcxpkt_vld ;
254
//output  [3:0]           lsu_iobrdge_rply_data_sel ;   // - qdp1
255
//output                  lsu_pcx_req_squash ;
256
output                  lsu_pcx_req_squash0 ;
257
output                  lsu_pcx_req_squash1 ;
258
output                  lsu_pcx_req_squash2 ;
259
output                  lsu_pcx_req_squash3 ;
260
output                  lsu_pcx_req_squash_d1 ;
261
output                  lsu_pcx_ld_dtag_perror_w2 ;     // - qdp1
262
output  [3:0]            lsu_tlu_dcache_miss_w2 ;
263
output                  lsu_bld_pcx_rq ;        // cycle after request  // - qdp1
264
output [1:0]             lsu_bld_rq_addr ;       // cycle after request  // - qdp1
265
//output                        lsu_ifu_flush_ireg ;
266
 
267
output                 lsu_fwdpkt_pcx_rq_sel ;
268
//output                 lsu_ld0_pcx_rq_sel_d1, lsu_ld1_pcx_rq_sel_d1 ;
269
//output                 lsu_ld2_pcx_rq_sel_d1, lsu_ld3_pcx_rq_sel_d1 ;
270
output                 lsu_imiss_pcx_rq_sel_d1 ;
271
output                 lsu_tlu_pcxpkt_ack;
272
output  [3:0]           lsu_intrpt_cmplt ;      // intrpt can restart thread
273
//output                  lsu_ld_sec_hit_l2access_g ;
274
//output  [1:0]           lsu_ld_sec_hit_wy_g ;
275
output  [3:0]           lsu_lmq_byp_misc_sel ;    // select g-stage lmq source
276
 
277
output  [12:0]           lsu_sscan_data ;
278
 
279
output                  so;
280
output  [3:0]           lsu_dfq_byp_tid_d1_sel;
281
 
282
 
283
   input [3:0]          lsu_no_spc_pref;
284
 
285
//output  [1:0]           lsu_lmq_pkt_way_g;
286
output  [1:0]           lmq0_pcx_pkt_way;
287
output  [1:0]           lmq1_pcx_pkt_way;
288
output  [1:0]           lmq2_pcx_pkt_way;
289
output  [1:0]           lmq3_pcx_pkt_way;
290
output  [3:0]           lsu_st_pcx_rq_pick;
291
 
292
// signals related to logic moved from stb_rwctl
293
output                  lsu_stb_pcx_rvld_d1;
294
output  [1:0]           lsu_stb_rd_tid;
295
 
296
output                  lsu_ld0_spec_vld_kill_w2 ;
297
output                  lsu_ld1_spec_vld_kill_w2 ;
298
output                  lsu_ld2_spec_vld_kill_w2 ;
299
output                  lsu_ld3_spec_vld_kill_w2 ;
300
 
301
output                  lsu_st_pcx_rq_vld ;
302
 
303
 
304
   input                tlu_early_flush_pipe2_w;
305
   input                lsu_ttype_vld_m2;
306
 
307
/*AUTOWIRE*/
308
// Beginning of automatic wires (for undeclared instantiated-module outputs)
309 113 albert.wat
`ifdef SIMPLY_RISC_TWEAKS
310
wire ld0_inst_vld_m;
311
wire ld1_inst_vld_m;
312
wire ld2_inst_vld_m;
313
wire ld3_inst_vld_m;
314
wire ldst_fp_m;
315
wire ldst_dbl_m;
316
wire ld0_inst_vld_unflushed;
317
wire ld1_inst_vld_unflushed;
318
wire ld2_inst_vld_unflushed;
319
wire ld3_inst_vld_unflushed;
320
wire ldst_fp_g;
321
wire thread0_m;
322
wire thread1_m;
323
wire thread2_m;
324
wire thread3_m;
325
wire thread0_g;
326
wire thread1_g;
327
wire thread2_g;
328
wire thread3_g;
329
wire blk_asi_g;
330
wire bld_reset;
331
wire atomic_w2;
332
wire atomic_or_ldxa_internal_rq_g;
333
`endif
334 95 fafa1971
// End of automatics
335
 
336
wire  thread0_e,thread1_e,thread2_e,thread3_e;
337
wire  thread0_w2,thread1_w2,thread2_w2,thread3_w2;
338
wire    ld0_inst_vld_e,ld1_inst_vld_e,ld2_inst_vld_e,ld3_inst_vld_e ;
339
wire    ld0_inst_vld_g,ld1_inst_vld_g,ld2_inst_vld_g,ld3_inst_vld_g ;
340
wire    ld0_inst_vld_w2,ld1_inst_vld_w2,ld2_inst_vld_w2,ld3_inst_vld_w2 ;
341
//wire    st_inst_vld_m,st_inst_vld_g;
342
wire  imiss_pcx_rq_sel_d1, strm_pcx_rq_sel_d1 ;
343
wire  imiss_pcx_rq_sel_d2 ;
344
wire    fpop_pcx_rq_sel_d1, fpop_pcx_rq_sel_d2 ;
345
wire        imiss_pcx_rq_sel ;
346
wire        imiss_pkt_vld ;
347
wire  [2:0]     imiss_l2bnk_addr ;
348
wire  [4:0]     imiss_l2bnk_dest ;
349
wire    fpst_vld_m, fpst_vld_g ;
350
wire    fpop_vld_reset ;
351
wire    fpop_pcx_rq_sel ;
352
wire    fpop_pcx_rq_sel_tmp ;
353
wire    fpop_vld_en ;
354
wire    fpop_pkt1 ;
355
wire    fpop_pkt_vld,fpop_pkt_vld_unmasked ;
356
wire    fpop_atom_req, fpop_atom_rq_pq ;
357
wire  [4:0] fpop_l2bnk_dest ;
358
wire        pcx_req_squash ;
359
wire  [4:0] strm_l2bnk_dest ;
360
wire    strm_pkt_vld;
361
wire        st0_pkt_vld ;
362
wire        st1_pkt_vld ;
363
wire        st2_pkt_vld ;
364
wire        st3_pkt_vld ;
365
wire    st0_pcx_rq_sel_d1, st1_pcx_rq_sel_d1;
366
wire    st2_pcx_rq_sel_d1, st3_pcx_rq_sel_d1;
367
wire    st0_pcx_rq_sel_d2, st1_pcx_rq_sel_d2;
368
wire    st2_pcx_rq_sel_d2, st3_pcx_rq_sel_d2;
369
wire    st0_pcx_rq_sel_d3, st1_pcx_rq_sel_d3;
370
wire    st2_pcx_rq_sel_d3, st3_pcx_rq_sel_d3;
371
wire    st0_cas_vld, st1_cas_vld, st2_cas_vld, st3_cas_vld ;
372
wire    st0_atomic_vld, st1_atomic_vld, st2_atomic_vld, st3_atomic_vld ;
373
wire  [4:0]     st0_l2bnk_dest,st1_l2bnk_dest ;
374
wire  [4:0]     st2_l2bnk_dest,st3_l2bnk_dest ;
375
wire    bld_helper_cmplt_e, bld_helper_cmplt_m, bld_helper_cmplt_g ;
376
wire    bld_din,bld_dout ;
377
wire    bld_g ;
378
wire    bld_en ;
379
wire    [1:0]    bld_cnt ;
380
wire    [1:0]    bcnt_din ;
381
wire    [2:0]    bld_rd_din, bld_rd_dout, bld_rd_dout_m ;
382
wire    [3:0]    bld_annul,bld_annul_d1 ;
383
wire    bld_rd_en ;
384
wire    casa_m, casa_g ;
385
wire        ld0_vld_reset, ld0_pkt_vld ;
386
wire        ld0_pcx_rq_sel_d2, ld1_pcx_rq_sel_d2 ;
387
wire        ld2_pcx_rq_sel_d2, ld3_pcx_rq_sel_d2 ;
388
wire    ld0_fill_reset, ld1_fill_reset,ld2_fill_reset,ld3_fill_reset;
389
wire    ld0_fill_reset_d1,ld1_fill_reset_d1,ld2_fill_reset_d1,ld3_fill_reset_d1;
390
wire    ld0_fill_reset_d2,ld1_fill_reset_d2,ld2_fill_reset_d2,ld3_fill_reset_d2;
391
wire    ld0_fill_reset_d2_tmp,ld1_fill_reset_d2_tmp,ld2_fill_reset_d2_tmp,ld3_fill_reset_d2_tmp;
392
wire  [4:0]     ld0_l2bnk_dest, ld1_l2bnk_dest ;
393
wire  [4:0]     ld2_l2bnk_dest, ld3_l2bnk_dest ;
394
wire        ld1_vld_reset, ld1_pkt_vld ;
395
wire        ld2_vld_reset, ld2_pkt_vld ;
396
wire        ld3_vld_reset, ld3_pkt_vld ;
397
//wire    casa0_g, casa1_g, casa2_g, casa3_g;
398
wire    ld0_rawp_reset,ld0_rawp_en,ld0_rawp_disabled;
399
wire    ld1_rawp_reset,ld1_rawp_en,ld1_rawp_disabled;
400
wire    ld2_rawp_reset,ld2_rawp_en,ld2_rawp_disabled;
401
wire    ld3_rawp_reset,ld3_rawp_en,ld3_rawp_disabled;
402
wire  [2:0] ld0_rawp_ackid,ld1_rawp_ackid ;
403
wire  [2:0] ld2_rawp_ackid,ld3_rawp_ackid ;
404
wire        ld0_pcx_rq_vld, ld1_pcx_rq_vld ;
405
wire        ld2_pcx_rq_vld, ld3_pcx_rq_vld ;
406
wire  [4:0]     queue_write ;
407
wire    mcycle_squash_d1 ;
408
//wire        ld_pcx_rq_vld, st_pcx_rq_vld ;
409
wire  [4:0] st0_q_wr,st1_q_wr,st2_q_wr,st3_q_wr ;
410
wire  [4:0]     sel_qentry0 ;
411
wire    st0_atom_rq,st1_atom_rq,st2_atom_rq,st3_atom_rq ;
412
wire    st0_atom_rq_d1,st1_atom_rq_d1,st2_atom_rq_d1,st3_atom_rq_d1 ;
413
wire    st0_cas_vld_d1,st1_cas_vld_d1,st2_cas_vld_d1,st3_cas_vld_d1 ;
414
wire    st0_atom_rq_d2,st1_atom_rq_d2,st2_atom_rq_d2,st3_atom_rq_d2 ;
415
wire    st0_cas_vld_d2,st1_cas_vld_d2,st2_cas_vld_d2,st3_cas_vld_d2 ;
416
//wire    st_cas_rq_d2,st_quad_rq_d2;
417
wire    st_cas_rq_d2 ;
418
wire        st0_pcx_rq_vld, st1_pcx_rq_vld;
419
wire        st2_pcx_rq_vld, st3_pcx_rq_vld;
420
wire    st_atom_rq ;
421
wire    st_atom_rq_d1 ;
422
wire        imiss_pcx_rq_vld ;
423
wire  [4:0] spc_pcx_req_update_g,spc_pcx_req_update_w2 ;
424
wire    strm_pcx_rq_vld ;
425
wire    fwdpkt_rq_vld ;
426
wire    intrpt_pcx_rq_vld ;
427
wire    fpop_pcx_rq_vld ;
428
wire    [4:0]    pre_qwr ;
429
wire        ld0_pcx_rq_sel, ld1_pcx_rq_sel ;
430
wire        ld2_pcx_rq_sel, ld3_pcx_rq_sel ;
431
wire    strm_pcx_rq_sel ;
432
wire    intrpt_pcx_rq_sel ;
433
//wire    imiss_strm_pcx_rq_sel ;
434
//wire  [2:0]     dest_pkt_sel ;
435
wire  [4:0] spc_pcx_req_g ;
436
wire  [1:0]   strm_l2bnk_addr ;
437
wire  [2:0]     ld0_l2bnk_addr, ld1_l2bnk_addr ;
438
wire  [2:0]     ld2_l2bnk_addr, ld3_l2bnk_addr ;
439
wire  [4:0]     current_pkt_dest ;
440
wire  [7:6]      ldst_va_m, ldst_va_g ;
441
wire  [4:0]     ld_pkt_dest ;
442
wire  [4:0] st_pkt_dest  ;
443
 
444
 
445
wire  [4:0]            intrpt_l2bnk_dest ;
446
wire                   pcx_req_squash_d1, pcx_req_squash_d2 ;
447
wire                   intrpt_pcx_rq_sel_d1 ;
448
wire  [2:0] intrpt_l2bnk_addr ;
449
//wire                  st0_stq_vld,st1_stq_vld,st2_stq_vld,st3_stq_vld ;
450
wire        st0_pcx_rq_sel, st1_pcx_rq_sel;
451
wire        st2_pcx_rq_sel, st3_pcx_rq_sel;
452
//wire    ld0_sec_hit_g,ld1_sec_hit_g,ld2_sec_hit_g,ld3_sec_hit_g;
453
wire    ld0_sec_hit_w2,ld1_sec_hit_w2,ld2_sec_hit_w2,ld3_sec_hit_w2;
454
//wire  [3:0] dfq_byp_sel_m, dfq_byp_sel_g ;
455
//wire  [3:0] dfq_byp_sel_m;
456
wire                 ld0_unfilled,ld1_unfilled,ld2_unfilled,ld3_unfilled;
457
wire                 ld0_unfilled_tmp,ld1_unfilled_tmp,ld2_unfilled_tmp,ld3_unfilled_tmp;
458
wire  [1:0]          ld0_unfilled_wy,ld1_unfilled_wy,ld2_unfilled_wy,ld3_unfilled_wy ;
459
wire        ld0_l2cache_rq,ld1_l2cache_rq ;
460
wire        ld2_l2cache_rq,ld3_l2cache_rq ;
461
wire                 ld0_pcx_rq_sel_d1, ld1_pcx_rq_sel_d1 ;
462
wire                 ld2_pcx_rq_sel_d1, ld3_pcx_rq_sel_d1 ;
463
wire         intrpt_pkt_vld;
464
wire                 fwdpkt_pcx_rq_sel;
465
wire            fwdpkt_pcx_rq_sel_d1,fwdpkt_pcx_rq_sel_d2,fwdpkt_pcx_rq_sel_d3 ;
466
wire         reset,dbb_reset_l;
467
wire         clk;
468
//wire         st_inst_vld_unflushed;
469
wire         ldst_dbl_g;
470
//wire                  lsu_ld_sec_hit_l2access_g ;
471
wire                  lsu_ld_sec_hit_l2access_w2 ;
472
//wire  [1:0]           lsu_ld_sec_hit_wy_g ;
473
wire  [1:0]           lsu_ld_sec_hit_wy_w2 ;
474
//wire  [1:0]  ld_way;
475
//wire [1:0]          ld_pcx_pkt_wy_g ;
476
 
477
wire    [3:0]            lsu_dtag_perror_w2 ;
478
 
479
wire    [3:0]            lmq_enable_w2 ;
480
wire  ld0_spec_pick_vld_g ,
481
      ld0_spec_pick_vld_w2 ;
482
wire  ld1_spec_pick_vld_g ,
483
      ld1_spec_pick_vld_w2 ;
484
wire  ld2_spec_pick_vld_g ,
485
      ld2_spec_pick_vld_w2 ;
486
wire  ld3_spec_pick_vld_g ,
487
      ld3_spec_pick_vld_w2 ;
488
wire  non_l2bnk_mx0_d1 ;
489
wire  non_l2bnk_mx1_d1 ;
490
wire  non_l2bnk_mx2_d1 ;
491
wire  non_l2bnk_mx3_d1 ;
492
wire  lsu_pcx_req_squash ;
493
wire  spc_pcx_atom_pq_buf2 ;
494
wire  [4:0]  spc_pcx_req_pq_buf2 ;
495
wire         lsu_ld0_pcx_rq_sel_d1, lsu_ld1_pcx_rq_sel_d1 ;
496
wire         lsu_ld2_pcx_rq_sel_d1, lsu_ld3_pcx_rq_sel_d1 ;
497
 
498
wire  [3:0]  ld_thrd_force_d1 ;
499
wire  [3:0]  st_thrd_force_d1 ;
500
wire  [3:0]  misc_thrd_force_d1 ;
501
wire  [3:0]  ld_thrd_force_vld ;
502
wire  [3:0]  st_thrd_force_vld ;
503
wire  [3:0]  misc_thrd_force_vld ;
504
wire  [3:0]  all_thrd_force_vld ;
505
wire  [3:0]  ld_thrd_pick_din ;
506
wire  [3:0]  st_thrd_pick_din ;
507
wire  [3:0]  misc_thrd_pick_din ;
508
wire  [3:0]  ld_thrd_pick_status_din ;
509
wire  [3:0]  st_thrd_pick_status_din ;
510
wire  [3:0]  misc_thrd_pick_status_din ;
511
wire  [3:0]  ld_thrd_pick_status ;
512
wire  [3:0]  st_thrd_pick_status ;
513
wire  [3:0]  misc_thrd_pick_status ;
514
wire         ld_thrd_pick_rst ;
515
wire         st_thrd_pick_rst ;
516
wire         misc_thrd_pick_rst ;
517
wire         all_thrd_pick_rst ;
518
 
519
 
520
 
521
 
522
assign  clk = rclk;
523
 
524
    dffrl_async rstff(.din (grst_l),
525
                        .q   (dbb_reset_l),
526 113 albert.wat
                        .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so(),
527 95 fafa1971
                        .rst_l (arst_l));
528
 
529
assign  reset  =  ~dbb_reset_l;
530
 
531
 
532
//assign        lsu_ifu_flush_ireg = 1'b0 ;
533
//=================================================================================================
534
// TEMP !! rm from vlin.filter also !!
535
//=================================================================================================
536
 
537
wire atm_in_stb_g ;
538
assign atm_in_stb_g = 1'b0 ;
539
 
540
//=================================================================================================
541
// LOGIC MOVED FROM STB_RWCTL
542
//=================================================================================================
543
 
544
// pcx is making request for data in current cycle. Can be multi-hot.
545
//assign  pcx_any_rq_for_stb = |pcx_rq_for_stb[3:0] ;
546
//assign  pcx_any_rq_for_stb = 
547
//        (pcx_rq_for_stb[0] & ~lsu_st_pcx_rq_kill_w2[0]) | 
548
//        (pcx_rq_for_stb[1] & ~lsu_st_pcx_rq_kill_w2[1]) | 
549
//        (pcx_rq_for_stb[2] & ~lsu_st_pcx_rq_kill_w2[2]) | 
550
//        (pcx_rq_for_stb[3] & ~lsu_st_pcx_rq_kill_w2[3]) ; 
551
//
552
//dff #(1)  prvld_stgd1 (
553
//  .din  (pcx_any_rq_for_stb), 
554
//  .q  (lsu_stb_pcx_rvld_d1),
555
//  .clk  (clk), 
556 113 albert.wat
//  .se (1'b0), `SIMPLY_RISC_SCANIN, .so ()
557 95 fafa1971
//  );
558
 
559
// replacement for above logic - pcx_rq_for_stb is already qual'ed w/ lsu_st_pcx_rq_kill_w2
560
// this signal is used in qdp1 and qdp2 as pcx paket valids.
561
assign  lsu_stb_pcx_rvld_d1  =  st3_pcx_rq_sel_d1 |
562
                                st2_pcx_rq_sel_d1 |
563
                                st1_pcx_rq_sel_d1 |
564
                                st0_pcx_rq_sel_d1 ;
565
 
566
 
567
//assign  stb_rd_tid[0] = pcx_rq_for_stb[1] | pcx_rq_for_stb[3] ;
568
//assign  stb_rd_tid[1] = pcx_rq_for_stb[2] | pcx_rq_for_stb[3] ;
569
//
570
//dff #(2) stbtid_stgd1 (
571
//  .din    (stb_rd_tid[1:0]),  .q  (lsu_stb_rd_tid[1:0]),
572
//  .clk    (clk),
573 113 albert.wat
//  .se   (1'b0), `SIMPLY_RISC_SCANIN, .so ()
574 95 fafa1971
//  );
575
 
576
assign  lsu_stb_rd_tid[0]  =  st1_pcx_rq_sel_d1 | st3_pcx_rq_sel_d1;
577
assign  lsu_stb_rd_tid[1]  =  st2_pcx_rq_sel_d1 | st3_pcx_rq_sel_d1;
578
 
579
//=================================================================================================
580
 
581
assign  lsu_ramtest_rd_w = lsu_dcache_iob_rd_w | ifu_lsu_fwd_data_vld ;
582
 
583
//=================================================================================================
584
// LD PCX PKT WAY
585
//=================================================================================================
586
 
587
 
588
// For direct-map mode, assume that addition set-index bits 12:11 are
589
// used to file line in set.
590
// timing fix: 5/19/03: move secondary hit way generation to w2
591
//assign  ld_way[1:0] = 
592
//    lsu_way_hit_or ? lsu_encd_way_hit[1:0]: 
593
//                lsu_ld_sec_hit_l2access_g ? lsu_ld_sec_hit_wy_g[1:0] :
594
//                        (dc_direct_map ? lsu_ldst_va_way_g[1:0] : lsu_dcache_rand[1:0]) ;
595
//
596
//assign  lsu_lmq_pkt_way_g[1:0] = 
597
//(ldst_dbl_g & st_inst_vld_unflushed & lsu_quad_asi_g) ? 2'b01 :
598
//        casa_g ? 2'b00 : ld_way[1:0] ;
599
//
600
//assign  ld_pcx_pkt_wy_g[1:0] = lsu_lmq_pkt_way_g[1:0];
601
wire  [1:0]  ld_way_mx1_g , ld_way_mx2_g , ld_way_mx2_w2;
602
 
603
assign  ld_way_mx1_g[1:0] =
604
    lsu_way_hit_or ? lsu_encd_way_hit[1:0]:
605
                        (dc_direct_map ? lsu_ldst_va_way_g[1:0] : lsu_dcache_rand[1:0]) ;
606
 
607
assign  ld_way_mx2_g[1:0] =
608
//(ldst_dbl_g & st_inst_vld_unflushed & lsu_quad_asi_g) ? 2'b01 :  //quad st, obsolete
609
        casa_g ? 2'b00 : ld_way_mx1_g[1:0] ;
610
 
611 113 albert.wat
dff_s #(2)  ff_ld_way_mx2_w2 (
612 95 fafa1971
        .din    (ld_way_mx2_g[1:0]),
613
        .q      (ld_way_mx2_w2[1:0]),
614
        .clk    (clk),
615 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
616 95 fafa1971
        );
617
 
618
wire  [1:0]  lsu_lmq_pkt_way_w2;
619
assign  lsu_lmq_pkt_way_w2[1:0] =  lsu_ld_sec_hit_l2access_w2 ? lsu_ld_sec_hit_wy_w2[1:0] :
620
                                         ld_way_mx2_w2[1:0];
621
 
622
//bug2705 - add mx for way in w2-cycle
623
wire  [1:0]  lmq0_pcx_pkt_way_tmp, lmq1_pcx_pkt_way_tmp, lmq2_pcx_pkt_way_tmp, lmq3_pcx_pkt_way_tmp ;
624
 
625
assign  lmq0_pcx_pkt_way[1:0] =  ld0_spec_pick_vld_w2 ? lsu_lmq_pkt_way_w2[1:0] : lmq0_pcx_pkt_way_tmp[1:0] ;
626
assign  lmq1_pcx_pkt_way[1:0] =  ld1_spec_pick_vld_w2 ? lsu_lmq_pkt_way_w2[1:0] : lmq1_pcx_pkt_way_tmp[1:0] ;
627
assign  lmq2_pcx_pkt_way[1:0] =  ld2_spec_pick_vld_w2 ? lsu_lmq_pkt_way_w2[1:0] : lmq2_pcx_pkt_way_tmp[1:0] ;
628
assign  lmq3_pcx_pkt_way[1:0] =  ld3_spec_pick_vld_w2 ? lsu_lmq_pkt_way_w2[1:0] : lmq3_pcx_pkt_way_tmp[1:0] ;
629
 
630
wire    qword_access0,qword_access1,qword_access2,qword_access3;
631
 
632
// Extend by 1-b to add support for 3rd size bit for iospace.
633
// move the flops from qdp1 to qctl1
634 113 albert.wat
dffe_s #(2)  ff_lmq0_pcx_pkt_way (
635 95 fafa1971
           .din    (lsu_lmq_pkt_way_w2[1:0]),
636
           .q      (lmq0_pcx_pkt_way_tmp[1:0]),
637
           .en     (lmq_enable_w2[0]),
638
           .clk    (clk),
639 113 albert.wat
           .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
640 95 fafa1971
           );
641 113 albert.wat
dffe_s #(2)  ff_lmq1_pcx_pkt_way (
642 95 fafa1971
           .din    (lsu_lmq_pkt_way_w2[1:0]),
643
           .q      (lmq1_pcx_pkt_way_tmp[1:0]),
644
           .en     (lmq_enable_w2[1]),
645
           .clk    (clk),
646 113 albert.wat
           .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
647 95 fafa1971
           );
648 113 albert.wat
dffe_s #(2)  ff_lmq2_pcx_pkt_way (
649 95 fafa1971
           .din    (lsu_lmq_pkt_way_w2[1:0]),
650
           .q      (lmq2_pcx_pkt_way_tmp[1:0]),
651
           .en     (lmq_enable_w2[2]),
652
           .clk    (clk),
653 113 albert.wat
           .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
654 95 fafa1971
           );
655 113 albert.wat
dffe_s #(2)  ff_lmq3_pcx_pkt_way (
656 95 fafa1971
           .din    (lsu_lmq_pkt_way_w2[1:0]),
657
           .q      (lmq3_pcx_pkt_way_tmp[1:0]),
658
           .en     (lmq_enable_w2[3]),
659
           .clk    (clk),
660 113 albert.wat
           .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
661 95 fafa1971
           );
662
 
663
// Q Word Access to IO
664 113 albert.wat
dffe_s   ff_lmq0_qw (
665 95 fafa1971
           .din    (lsu_quad_word_access_g),
666
           .q      (qword_access0),
667
           .en     (lmq_enable[0]),
668
           .clk    (clk),
669 113 albert.wat
           .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
670 95 fafa1971
           );
671 113 albert.wat
dffe_s   ff_lmq1_qw (
672 95 fafa1971
           .din    (lsu_quad_word_access_g),
673
           .q      (qword_access1),
674
           .en     (lmq_enable[1]),
675
           .clk    (clk),
676 113 albert.wat
           .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
677 95 fafa1971
           );
678 113 albert.wat
dffe_s   ff_lmq2_qw(
679 95 fafa1971
           .din    (lsu_quad_word_access_g),
680
           .q      (qword_access2),
681
           .en     (lmq_enable[2]),
682
           .clk    (clk),
683 113 albert.wat
           .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
684 95 fafa1971
           );
685 113 albert.wat
dffe_s   ff_lmq3_qw (
686 95 fafa1971
           .din    (lsu_quad_word_access_g),
687
           .q      (qword_access3),
688
           .en     (lmq_enable[3]),
689
           .clk    (clk),
690 113 albert.wat
           .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
691 95 fafa1971
           );
692
 
693
assign  lsu_pcx_rq_sz_b3 =
694
        (ld0_pcx_rq_sel_d1 & qword_access0) |
695
        (ld1_pcx_rq_sel_d1 & qword_access1) |
696
        (ld2_pcx_rq_sel_d1 & qword_access2) |
697
        (ld3_pcx_rq_sel_d1 & qword_access3) ;
698
 
699
//=================================================================================================
700
// SHADOW SCAN
701
//=================================================================================================
702
 
703
 
704
// Monitors outstanding loads. This would hang a thread.
705
assign  lsu_sscan_data[3:0] =
706
                {ld0_pcx_rq_vld, ld1_pcx_rq_vld , ld2_pcx_rq_vld , ld3_pcx_rq_vld} ;
707
// Monitors outstanding loads. This would hang issue from stb
708
assign  lsu_sscan_data[7:4] =
709
                {st0_pcx_rq_vld, st1_pcx_rq_vld, st2_pcx_rq_vld, st3_pcx_rq_vld} ;
710
assign  lsu_sscan_data[8] = imiss_pcx_rq_vld ;  // imiss
711
assign  lsu_sscan_data[9] = strm_pcx_rq_vld ;   // strm
712
assign  lsu_sscan_data[10] = fwdpkt_rq_vld ;    // fwd rply/rq 
713
assign  lsu_sscan_data[11] = intrpt_pcx_rq_vld ; // intrpt
714
assign  lsu_sscan_data[12] = fpop_pcx_rq_vld ;  // fpop
715
 
716
 
717
//=================================================================================================
718
// QDP1 selects
719
//=================================================================================================
720
 
721
wire [3:0] dfq_byp_tid_sel;
722
 
723
assign dfq_byp_tid_sel[0]  =  (lsu_dfq_byp_tid[1:0]==2'b00);
724
assign dfq_byp_tid_sel[1]  =  (lsu_dfq_byp_tid[1:0]==2'b01);
725
assign dfq_byp_tid_sel[2]  =  (lsu_dfq_byp_tid[1:0]==2'b10);
726
assign dfq_byp_tid_sel[3]  =  (lsu_dfq_byp_tid[1:0]==2'b11);
727
//assign dfq_byp_tid__sel[3]  =  ~|(lsu_dfq_byp_d1_sel[2:0]);
728
 
729
wire  [3:0]  lsu_dfq_byp_tid_d1_sel_tmp ;
730
 
731 113 albert.wat
dffe_s #(4)  dfq_byp_tid_sel_ff (
732 95 fafa1971
           .din    (dfq_byp_tid_sel[3:0]),
733
           .q      (lsu_dfq_byp_tid_d1_sel_tmp[3:0]),
734
           .en     (dfq_byp_ff_en),
735
           .clk    (clk),
736 113 albert.wat
           .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
737 95 fafa1971
           );
738
 
739
//11/21/03 - add rst_tri_en to lsu_dfq_byp_tid_d1_sel[3:0] going to qdp1 as dfq_byp_sel[3:0]
740
 
741
assign  lsu_dfq_byp_tid_d1_sel[2:0]  =  lsu_dfq_byp_tid_d1_sel_tmp[2:0]  & {3{~rst_tri_en}};
742
assign  lsu_dfq_byp_tid_d1_sel[3]    =  lsu_dfq_byp_tid_d1_sel_tmp[3]    | rst_tri_en;
743
 
744
 
745
//=================================================================================================
746
// INST_VLD_W GENERATION
747
//=================================================================================================
748
 
749
 
750
wire [1:0] thrid_m, thrid_g ;
751 113 albert.wat
dff_s #(2)  stgm_thrid (
752 95 fafa1971
        .din    (ifu_tlu_thrid_e[1:0]),
753
        .q      (thrid_m[1:0]),
754
        .clk    (clk),
755 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
756 95 fafa1971
        );
757
 
758 113 albert.wat
dff_s  #(2) stgg_thrid (
759 95 fafa1971
        .din    (thrid_m[1:0]),
760
        .q      (thrid_g[1:0]),
761
        .clk    (clk),
762 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
763 95 fafa1971
        );
764
 
765
wire    flush_w_inst_vld_m ;
766
wire    lsu_inst_vld_w,lsu_inst_vld_tmp ;
767
wire    other_flush_pipe_w ;
768
wire  qctl1_flush_pipe_w;
769
 
770
assign  flush_w_inst_vld_m =
771
        ifu_tlu_inst_vld_m &
772
        ~(qctl1_flush_pipe_w & (thrid_m[1:0] == thrid_g[1:0])) ; // really lsu_flush_pipe_w
773
 
774 113 albert.wat
dff_s  stgw_ivld (
775 95 fafa1971
        .din    (flush_w_inst_vld_m),
776
        .q      (lsu_inst_vld_tmp),
777
        .clk    (clk),
778 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
779 95 fafa1971
        );
780
 
781
 
782
assign  other_flush_pipe_w = tlu_early_flush_pipe2_w | (lsu_ttype_vld_m2 & lsu_inst_vld_tmp);
783
assign  qctl1_flush_pipe_w = other_flush_pipe_w | ifu_lsu_flush_w ;
784
 
785
assign  lsu_inst_vld_w = lsu_inst_vld_tmp & ~qctl1_flush_pipe_w ;
786
 
787
 
788
//=================================================================================================
789
// SECONDARY VS. PRIMARY LOADS
790
//=================================================================================================
791
 
792
// An incoming load can hit can match addresses with an outstanding load request
793
// from another thread. In this case, the secondary load must wait until the primary
794
// load returns and then it will bypass (but not fill). There can only be one primary
795
// load but multiple secondary loads. The secondary loads will not enter the dfq.
796
// The primary load will however be recirculated until all secondary loads have bypassed.
797
 
798
// Could have multiple secondary hits. Only one thread can be chosen
799
// as primary though.
800
 
801
//An incoming load can match addresses with any outstanding load request from other threads.
802
//can be multiple hits
803
// timing fix: 5/19/03: move secondary hit way generation to w2
804
//
805
//assign  ld0_sec_hit_g = ld_sec_hit_thrd0 & ld0_unfilled  ;
806
//assign  ld1_sec_hit_g = ld_sec_hit_thrd1 & ld1_unfilled  ;
807
//assign  ld2_sec_hit_g = ld_sec_hit_thrd2 & ld2_unfilled  ;
808
//assign  ld3_sec_hit_g = ld_sec_hit_thrd3 & ld3_unfilled  ;
809
//
810
//
811
// Fix for Bug1606
812
//assign  lsu_ld_sec_hit_l2access_g =
813
//         ld0_sec_hit_g | ld1_sec_hit_g | ld2_sec_hit_g | ld3_sec_hit_g ;
814
//
815
//phase 2
816
//since can be multiple hits, it isn't one-hot mux, but fix priority-sel mux
817
//assign  lsu_ld_sec_hit_wy_g[1:0] =
818
//    ld0_sec_hit_g ? ld0_unfilled_wy[1:0] :
819
//      ld1_sec_hit_g ? ld1_unfilled_wy[1:0] :
820
//        ld2_sec_hit_g ? ld2_unfilled_wy[1:0] :
821
//          ld3_sec_hit_g ? ld3_unfilled_wy[1:0] : 2'bxx ;
822
 
823
wire  ld_sec_hit_thrd0_w2,ld_sec_hit_thrd1_w2,ld_sec_hit_thrd2_w2,ld_sec_hit_thrd3_w2;
824
 
825 113 albert.wat
dff_s #(4) ff_ld_sec_hit_thrd0to3_d1 (
826 95 fafa1971
        .din    ({ld_sec_hit_thrd0,ld_sec_hit_thrd1,ld_sec_hit_thrd2,ld_sec_hit_thrd3}),
827
        .q      ({ld_sec_hit_thrd0_w2,ld_sec_hit_thrd1_w2,ld_sec_hit_thrd2_w2,ld_sec_hit_thrd3_w2}),
828
        .clk    (clk),
829 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
830 95 fafa1971
        );
831
 
832
assign  ld0_sec_hit_w2 = ld_sec_hit_thrd0_w2 & ld0_unfilled  ;
833
assign  ld1_sec_hit_w2 = ld_sec_hit_thrd1_w2 & ld1_unfilled  ;
834
assign  ld2_sec_hit_w2 = ld_sec_hit_thrd2_w2 & ld2_unfilled  ;
835
assign  ld3_sec_hit_w2 = ld_sec_hit_thrd3_w2 & ld3_unfilled  ;
836
 
837
// Fix for Bug1606
838
assign  lsu_ld_sec_hit_l2access_w2 =
839
         ld0_sec_hit_w2 | ld1_sec_hit_w2 | ld2_sec_hit_w2 | ld3_sec_hit_w2 ;
840
 
841
//phase 2
842
//since can be multiple hits, it isn't one-hot mux, but fix priority-sel mux
843
assign  lsu_ld_sec_hit_wy_w2[1:0] =
844
    ld0_sec_hit_w2 ? ld0_unfilled_wy[1:0] :
845
      ld1_sec_hit_w2 ? ld1_unfilled_wy[1:0] :
846
        ld2_sec_hit_w2 ? ld2_unfilled_wy[1:0] :
847
          ld3_sec_hit_w2 ? ld3_unfilled_wy[1:0] : 2'bxx ;
848
 
849
//dff #(4)  stgm_dbypsel (
850
//        .din    (dfq_byp_sel[3:0]),
851
//        .q      (dfq_byp_sel_m[3:0]),
852
//        .clk    (clk),
853 113 albert.wat
//        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
854 95 fafa1971
//        );
855
 
856
//dff #(4)  stgg_dbypsel (
857
//        .din    (dfq_byp_sel_m[3:0]),
858
//        .q      (dfq_byp_sel_g[3:0]),
859
//        .clk    (clk),
860 113 albert.wat
//        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
861 95 fafa1971
//        );
862
 
863
// select g-stage lmq source.
864
// Selects for lmq contents shared by fill/hit and alternate sources such as ldxa/raw.
865
// Is qualification of dfq_byp_sel_g by ld_thrd_byp_sel necessary ???
866
 
867
wire    [3:0] lmq_byp_misc_sel_e ;
868
 
869
assign  lmq_byp_misc_sel_e[0] = ld_thrd_byp_sel_e[0]  |        // select for ldxa/raw.
870
                                dfq_byp_sel[0]  ;              // select for dfq.
871
assign  lmq_byp_misc_sel_e[1] = ld_thrd_byp_sel_e[1]  |        // select for ldxa/raw.
872
                                dfq_byp_sel[1] ;               // select for dfq.
873
assign  lmq_byp_misc_sel_e[2] = ld_thrd_byp_sel_e[2]  |        // select for ldxa/raw.
874
                                dfq_byp_sel[2] ;               // select for dfq.
875
assign  lmq_byp_misc_sel_e[3] = ~|lmq_byp_misc_sel_e[2:0];
876
                                //ld_thrd_byp_sel_e[3]  |        // select for ldxa/raw.
877
                                //dfq_byp_sel[3] ;               // select for dfq.
878
 
879
/*
880
assign  lmq_byp_misc_sel_e[0] = ld_thrd_byp_sel_e[0]  |        // select for ldxa/raw.
881
          (dfq_byp_sel[0] & ~ld_thrd_byp_sel_e[0]) ;  // select for dfq.
882
assign  lmq_byp_misc_sel_e[1] = ld_thrd_byp_sel_e[1]  |        // select for ldxa/raw.
883
          (dfq_byp_sel[1] & ~ld_thrd_byp_sel_e[1]) ; // select for dfq.
884
assign  lmq_byp_misc_sel_e[2] = ld_thrd_byp_sel_e[2]  |        // select for ldxa/raw.
885
          (dfq_byp_sel[2] & ~ld_thrd_byp_sel_e[2]) ; // select for dfq.
886
assign  lmq_byp_misc_sel_e[3] = ld_thrd_byp_sel_e[3]  |        // select for ldxa/raw.
887
          (dfq_byp_sel[3] & ~ld_thrd_byp_sel_e[3]) ; // select for dfq.
888
*/
889
 
890
// M-Stage 
891
//10/27/03 - add rst_tri_en for the select - lsu_lmq_byp_misc_sel to qdp1
892
wire  [3:0]  lsu_lmq_byp_misc_sel_tmp ;
893 113 albert.wat
dff_s #(4)  stgg_lbsel (
894 95 fafa1971
        .din    (lmq_byp_misc_sel_e[3:0]),
895
        .q      (lsu_lmq_byp_misc_sel_tmp[3:0]),
896
        .clk    (clk),
897 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
898 95 fafa1971
        );
899
 
900
assign lsu_lmq_byp_misc_sel[2:0]=  lsu_lmq_byp_misc_sel_tmp[2:0] & {3{~rst_tri_en}} ;
901
assign lsu_lmq_byp_misc_sel[3]  =  lsu_lmq_byp_misc_sel_tmp[3] | rst_tri_en ;
902
 
903
 
904
/*
905
assign  lsu_lmq_byp_misc_sel[0] = ld_thrd_byp_sel[0]  |        // select for ldxa/raw.
906
          (dfq_byp_sel_g[0] & ~ld_thrd_byp_sel[0]) ;  // select for dfq.
907
assign  lsu_lmq_byp_misc_sel[1] = ld_thrd_byp_sel[1]  |        // select for ldxa/raw.
908
          (dfq_byp_sel_g[1] & ~ld_thrd_byp_sel[1]) ; // select for dfq.
909
assign  lsu_lmq_byp_misc_sel[2] = ld_thrd_byp_sel[2]  |        // select for ldxa/raw.
910
          (dfq_byp_sel_g[2] & ~ld_thrd_byp_sel[2]) ; // select for dfq.
911
assign  lsu_lmq_byp_misc_sel[3] = ld_thrd_byp_sel[3]  |        // select for ldxa/raw.
912
          (dfq_byp_sel_g[3] & ~ld_thrd_byp_sel[3]) ; // select for dfq.
913
*/
914
 
915
 
916
 
917
//=================================================================================================
918
//  Miscellaneous Staging
919
//=================================================================================================
920
 
921
 
922
assign  thread0_e = ~ifu_tlu_thrid_e[1] & ~ifu_tlu_thrid_e[0] ;
923
assign  thread1_e = ~ifu_tlu_thrid_e[1] &  ifu_tlu_thrid_e[0] ;
924
assign  thread2_e =  ifu_tlu_thrid_e[1] & ~ifu_tlu_thrid_e[0] ;
925
assign  thread3_e =  ifu_tlu_thrid_e[1] &  ifu_tlu_thrid_e[0] ;
926
 
927
assign  ld0_inst_vld_e = ld_inst_vld_e & thread0_e ;
928
assign  ld1_inst_vld_e = ld_inst_vld_e & thread1_e ;
929
assign  ld2_inst_vld_e = ld_inst_vld_e & thread2_e ;
930
assign  ld3_inst_vld_e = ld_inst_vld_e & thread3_e ;
931
 
932
assign ldst_va_m[7:6] = lsu_ldst_va_m[7:6];
933
 
934 113 albert.wat
dff_s  #(6) stgm_ad_m (
935 95 fafa1971
        .din    ({ld0_inst_vld_e,ld1_inst_vld_e,
936
    ld2_inst_vld_e,ld3_inst_vld_e,ifu_lsu_ldst_fp_e,
937
    ifu_lsu_ldst_dbl_e}),
938
        .q      ({ld0_inst_vld_m,ld1_inst_vld_m,
939
    ld2_inst_vld_m,ld3_inst_vld_m,ldst_fp_m,
940
    ldst_dbl_m}),
941
        .clk  (clk),
942 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
943 95 fafa1971
        );
944
 
945
 
946 113 albert.wat
dff_s  #(8) stgm_ad_g (
947 95 fafa1971
        .din    ({ldst_va_m[7:6],ld0_inst_vld_m,ld1_inst_vld_m,
948
        //.din    ({ldst_va_m[8:6],ld0_inst_vld_m,ld1_inst_vld_m,
949
    ld2_inst_vld_m,ld3_inst_vld_m,ldst_fp_m,
950
    //ld2_inst_vld_m,ld3_inst_vld_m,st_inst_vld_m,ldst_fp_m,
951
    ldst_dbl_m}),
952
        .q      ({ldst_va_g[7:6],ld0_inst_vld_unflushed,ld1_inst_vld_unflushed,
953
        //.q      ({ldst_va_g[8:6],ld0_inst_vld_unflushed,ld1_inst_vld_unflushed,
954
    ld2_inst_vld_unflushed,ld3_inst_vld_unflushed,
955
    //ld2_inst_vld_unflushed,ld3_inst_vld_unflushed,st_inst_vld_unflushed,
956
    ldst_fp_g,ldst_dbl_g}),
957
        .clk  (clk),
958 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
959 95 fafa1971
  );
960
 
961
assign  ld0_inst_vld_g = ld0_inst_vld_unflushed & lsu_inst_vld_w ;
962
assign  ld1_inst_vld_g = ld1_inst_vld_unflushed & lsu_inst_vld_w ;
963
assign  ld2_inst_vld_g = ld2_inst_vld_unflushed & lsu_inst_vld_w ;
964
assign  ld3_inst_vld_g = ld3_inst_vld_unflushed & lsu_inst_vld_w ;
965
//assign  st_inst_vld_g  = st_inst_vld_unflushed & lsu_inst_vld_w  ;
966
 
967 113 albert.wat
dff_s  #(4) ivld_stgw2 (
968 95 fafa1971
        .din    ({ld0_inst_vld_g,ld1_inst_vld_g,ld2_inst_vld_g,ld3_inst_vld_g}),
969
        .q      ({ld0_inst_vld_w2,ld1_inst_vld_w2,ld2_inst_vld_w2,ld3_inst_vld_w2}),
970
        .clk  (clk),
971 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
972 95 fafa1971
  );
973
 
974 113 albert.wat
dff_s  #(4) th_stgm (
975 95 fafa1971
        .din    ({thread0_e,thread1_e,thread2_e,thread3_e}),
976
        .q      ({thread0_m,thread1_m,thread2_m,thread3_m}),
977
        .clk  (clk),
978 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
979 95 fafa1971
  );
980
 
981 113 albert.wat
dff_s  #(4) th_stgg (
982 95 fafa1971
        .din    ({thread0_m,thread1_m,thread2_m,thread3_m}),
983
        .q      ({thread0_g,thread1_g,thread2_g,thread3_g}),
984
        .clk  (clk),
985 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
986 95 fafa1971
  );
987
 
988 113 albert.wat
dff_s  #(4) th_stgw2 (
989 95 fafa1971
        .din    ({thread0_g,thread1_g,thread2_g,thread3_g}),
990
        .q      ({thread0_w2,thread1_w2,thread2_w2,thread3_w2}),
991
        .clk  (clk),
992 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
993 95 fafa1971
  );
994
 
995
 
996
 
997
//=================================================================================================
998
//
999
// IMISS PCX PKT REQ CTL
1000
//
1001
//=================================================================================================
1002
 
1003
 
1004
// ** ifu request packet should be sent out in e-stage **
1005
// ** Prefer not to make dfq dual-ported **
1006
 
1007
// Format of IFU pcx packet (50b) :
1008
//  b49 - valid
1009
//  b48:44 - req type
1010
//  b43:42 - rep way (for "eviction" - maintains directory consistency )
1011
//  b41:40 - mil id
1012
//  b39:0  - imiss address
1013
// *
1014
// destid :
1015
//  b2  - b39 of pa
1016
//  b1  - b8  of pa
1017
//  b0  - b7  of pa 
1018
// pcxpkt :
1019
//  b51 - valid
1020
//  b50 - reserved
1021
//  b49 - NC
1022
//  b48:44 - req type
1023
//  b43:42 - rep way (for "eviction" - maintains directory consistency )
1024
//  b41:40 - mil id
1025
//  b39:0  - imiss address
1026
 
1027
// IMISS REQUEST CONTROL
1028
// Vld is reset if imiss pkt requests and request is not subsequently
1029
// squashed and new imiss pkt unavailable.
1030
 
1031
// Request rate is 1/3 cycles.
1032
 
1033
/*dff  iack_stg (
1034
        .din    (imiss_pcx_rq_sel),
1035
        .q      (lsu_ifu_pcxpkt_ack_d),
1036
        .clk    (clk),
1037 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1038 95 fafa1971
        ); */
1039
 
1040
assign  lsu_ifu_pcxpkt_ack_d = imiss_pcx_rq_sel_d2 & ~pcx_req_squash_d1 ;
1041
 
1042
assign  imiss_pkt_vld =  ifu_lsu_pcxreq_d & ~(imiss_pcx_rq_sel_d1 | imiss_pcx_rq_sel_d2) ;
1043
 
1044
//timing fix: 5/21/03 - ifu sends destid 1 cycle early
1045
//assign  imiss_l2bnk_addr[2:0] = ifu_lsu_destid_d[2:0] ;
1046
 
1047
wire  ifu_destid_en ;
1048
assign  ifu_destid_en  =  ~ifu_lsu_pcxreq_d | (lsu_ifu_pcxpkt_ack_d & ~ifu_lsu_pcxpkt_e_b50);
1049
 
1050
wire  [2:0]  ifu_destid_d;
1051 113 albert.wat
dffe_s #(3)  ff_ifu_destid_d (
1052 95 fafa1971
           .din    (ifu_lsu_destid_s[2:0]),
1053
           .q      (ifu_destid_d[2:0]),
1054
           .en     (ifu_destid_en),
1055
           .clk    (clk),
1056 113 albert.wat
           .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1057 95 fafa1971
           );
1058
assign  imiss_l2bnk_addr[2:0] = ifu_destid_d[2:0] ;
1059
 
1060
assign imiss_l2bnk_dest[0] =
1061
~imiss_l2bnk_addr[2] & ~imiss_l2bnk_addr[1] & ~imiss_l2bnk_addr[0] ;
1062
assign imiss_l2bnk_dest[1] =
1063
~imiss_l2bnk_addr[2] & ~imiss_l2bnk_addr[1] &  imiss_l2bnk_addr[0] ;
1064
assign imiss_l2bnk_dest[2] =
1065
~imiss_l2bnk_addr[2] & imiss_l2bnk_addr[1] & ~imiss_l2bnk_addr[0] ;
1066
assign imiss_l2bnk_dest[3] =
1067
~imiss_l2bnk_addr[2] & imiss_l2bnk_addr[1] &  imiss_l2bnk_addr[0] ;
1068
assign imiss_l2bnk_dest[4] = imiss_l2bnk_addr[2] ;
1069
 
1070
 
1071
//=================================================================================================
1072
//  FPOP PCX RQ CTL
1073
//=================================================================================================
1074
 
1075
 
1076
assign  fpst_vld_m = ffu_lsu_data[80] & ffu_lsu_data[79] ;
1077
 
1078 113 albert.wat
dff_s  fpst_stg (
1079 95 fafa1971
        .din    (fpst_vld_m),
1080
        .q      (fpst_vld_g),
1081
        .clk  (clk),
1082 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1083 95 fafa1971
        );
1084
 
1085
// ffu req is  never speculative as it must always begin with the queue empty 
1086
assign  lsu_ffu_ack =
1087
        fpop_pcx_rq_sel_d1 |   // fpop needs to wait until selected;d1 for timing
1088
        //fpop_pcx_rq_sel |   // fpop needs to wait until selected
1089
        fpst_vld_g ;    // fpst responds immediately.
1090
 
1091
// req_squash needs to match up with rq_sel_d1 !!!
1092
// keep vld around for two cycles.
1093
assign fpop_vld_reset =
1094
  (reset | fpop_pcx_rq_sel) ;
1095
  //(reset | fpop_pcx_rq_sel_d1) ; 
1096
 
1097
assign fpop_vld_en = ffu_lsu_fpop_rq_vld ;
1098
 
1099
// fpop valid
1100 113 albert.wat
dffre_s #(1)  fpop_vld (
1101 95 fafa1971
        .din  (ffu_lsu_fpop_rq_vld),
1102
        .q    (fpop_pkt_vld_unmasked),
1103
        .rst  (fpop_vld_reset), .en (fpop_vld_en),
1104
        .clk  (clk),
1105 113 albert.wat
        .se   (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1106 95 fafa1971
        );
1107
 
1108
// ** fpop_pkt1 should not be required.
1109
assign  fpop_pkt1 = fpop_pkt_vld_unmasked & ~fpop_pcx_rq_sel_d1 ;
1110
 
1111
assign  fpop_pkt_vld = fpop_pkt_vld_unmasked ; // & ~ffu_lsu_kill_fpop_rq ;
1112
 
1113
assign  fpop_atom_req = fpop_pkt1 & fpop_pcx_rq_sel ;
1114
 
1115 113 albert.wat
dff_s  fpatm_stg (
1116 95 fafa1971
        .din    (fpop_atom_req),
1117
        .q      (fpop_atom_rq_pq),
1118
        .clk  (clk),
1119 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1120 95 fafa1971
        );
1121
 
1122
assign fpop_l2bnk_dest[4:0]   = 5'b10000 ;
1123
 
1124
 
1125
 
1126
//=================================================================================================
1127
//  SPU PCX PKT REQ CONTROL
1128
//=================================================================================================
1129
 
1130
// If ack is sent in a given cycle, then the earliest the spu can send
1131
// a response is in the same cycle. 
1132
 
1133
wire    strm_pcx_rq_sel_d2 ;
1134
assign  lsu_spu_ldst_ack =
1135
  strm_pcx_rq_sel_d2 & ~pcx_req_squash_d1 ;  // spu request sent to pcx.
1136
  //strm_pcx_rq_sel_d1 & ~pcx_req_squash ;  // spu request sent to pcx.
1137
 
1138 113 albert.wat
dff_s #(1) rqsel_d2 (
1139 95 fafa1971
  .din (strm_pcx_rq_sel_d1),
1140
  .q   (strm_pcx_rq_sel_d2),
1141
  .clk (clk),
1142 113 albert.wat
  .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1143 95 fafa1971
);
1144
 
1145
wire spu_ack_d1 ;
1146 113 albert.wat
dff_s #(1) spuack_d1 (
1147 95 fafa1971
  .din (lsu_spu_ldst_ack),
1148
  .q   (spu_ack_d1),
1149
  .clk (clk),
1150 113 albert.wat
  .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1151 95 fafa1971
);
1152
 
1153 113 albert.wat
dff_s #(2) ff_spu_lsu_ldst_pckt_d1 (
1154
  .din (spu_lsu_ldst_pckt[`PCX_AD_LO+7:`PCX_AD_LO+6]),
1155 95 fafa1971
  .q   (strm_l2bnk_addr[1:0]),
1156
  .clk (clk),
1157 113 albert.wat
  .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1158 95 fafa1971
);
1159
 
1160
// Streaming does not access io space.
1161
assign strm_l2bnk_dest[0] =
1162
~strm_l2bnk_addr[1] & ~strm_l2bnk_addr[0] ;
1163
assign strm_l2bnk_dest[1] =
1164
~strm_l2bnk_addr[1] &  strm_l2bnk_addr[0] ;
1165
assign strm_l2bnk_dest[2] =
1166
strm_l2bnk_addr[1] & ~strm_l2bnk_addr[0] ;
1167
assign strm_l2bnk_dest[3] =
1168
strm_l2bnk_addr[1] &  strm_l2bnk_addr[0] ;
1169
assign strm_l2bnk_dest[4] = 1'b0 ;
1170
 
1171
wire  strm_pkt_vld_unmasked ;
1172
 
1173 113 albert.wat
dff_s #(1) spu_pkt_vld_d1 (
1174 95 fafa1971
        .din    (spu_lsu_ldst_pckt_vld),
1175
        .q      (strm_pkt_vld_unmasked),
1176
        .clk    (clk),
1177 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1178 95 fafa1971
        );
1179
 
1180
assign  strm_pkt_vld =
1181
        strm_pkt_vld_unmasked & ~(strm_pcx_rq_sel_d1 | lsu_spu_ldst_ack | spu_ack_d1);
1182
 
1183
// temp = remove strming interface
1184
//assign strm_sldst_cam_vld = 1'b0 ;
1185
//assign strm_sld_dc_rd_vld = 1'b0 ;
1186
//assign strm_sldst_cam_d2 = 1'b0 ;
1187
// temp = remove strming interface
1188
 
1189
 
1190
//=================================================================================================
1191
//  STORE PCX PKT REQ CONTROL
1192
//=================================================================================================
1193
 
1194
// Stage by a cycle.
1195
 
1196
// Thread0
1197
wire    [2:1]   stb0_rqtype ;
1198
wire    [2:0]    stb0_rqaddr ;
1199 113 albert.wat
dff_s #(5) stgd1_s0rq (
1200 95 fafa1971
        .din    ({stb0_atm_rq_type[2:1], stb0_l2b_addr[2:0]}),
1201
        .q      ({stb0_rqtype[2:1],stb0_rqaddr[2:0]}),
1202
        .clk    (clk),
1203 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1204 95 fafa1971
        );
1205
 
1206
// Thread1
1207
wire    [2:1]   stb1_rqtype ;
1208
wire    [2:0]    stb1_rqaddr ;
1209 113 albert.wat
dff_s #(5) stgd1_s1rq (
1210 95 fafa1971
        .din    ({stb1_atm_rq_type[2:1], stb1_l2b_addr[2:0]}),
1211
        .q      ({stb1_rqtype[2:1],stb1_rqaddr[2:0]}),
1212
        .clk    (clk),
1213 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1214 95 fafa1971
        );
1215
 
1216
// Thread2
1217
wire    [2:1]   stb2_rqtype ;
1218
wire    [2:0]    stb2_rqaddr ;
1219 113 albert.wat
dff_s #(5) stgd1_s2rq (
1220 95 fafa1971
        .din    ({stb2_atm_rq_type[2:1], stb2_l2b_addr[2:0]}),
1221
        .q      ({stb2_rqtype[2:1],stb2_rqaddr[2:0]}),
1222
        .clk    (clk),
1223 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1224 95 fafa1971
        );
1225
 
1226
// Thread3
1227
wire    [2:1]   stb3_rqtype ;
1228
wire    [2:0]    stb3_rqaddr ;
1229 113 albert.wat
dff_s #(5) stgd1_s3rq (
1230 95 fafa1971
        .din    ({stb3_atm_rq_type[2:1], stb3_l2b_addr[2:0]}),
1231
        .q      ({stb3_rqtype[2:1],stb3_rqaddr[2:0]}),
1232
        .clk    (clk),
1233 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1234 95 fafa1971
        );
1235
 
1236
wire    stb0_rd_for_pcx,stb1_rd_for_pcx,stb2_rd_for_pcx,stb3_rd_for_pcx ;
1237
wire    stb0_rd_for_pcx_tmp,stb1_rd_for_pcx_tmp,stb2_rd_for_pcx_tmp,stb3_rd_for_pcx_tmp ;
1238 113 albert.wat
dff_s #(4) stgd1_rdpcx (
1239 95 fafa1971
        .din    (stb_rd_for_pcx[3:0]),
1240
        .q      ({stb3_rd_for_pcx_tmp,stb2_rd_for_pcx_tmp,stb1_rd_for_pcx_tmp,stb0_rd_for_pcx_tmp}),
1241
        .clk    (clk),
1242 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1243 95 fafa1971
        );
1244
 
1245
// timing fix: 5/6 - move kill qual after store pick
1246
//assign        stb0_rd_for_pcx = stb0_rd_for_pcx_tmp & ~lsu_st_pcx_rq_kill_w2[0] ;
1247
//assign        stb1_rd_for_pcx = stb1_rd_for_pcx_tmp & ~lsu_st_pcx_rq_kill_w2[1] ;
1248
//assign        stb2_rd_for_pcx = stb2_rd_for_pcx_tmp & ~lsu_st_pcx_rq_kill_w2[2] ;
1249
//assign        stb3_rd_for_pcx = stb3_rd_for_pcx_tmp & ~lsu_st_pcx_rq_kill_w2[3] ;
1250
 
1251
assign  stb0_rd_for_pcx = stb0_rd_for_pcx_tmp;
1252
assign  stb1_rd_for_pcx = stb1_rd_for_pcx_tmp;
1253
assign  stb2_rd_for_pcx = stb2_rd_for_pcx_tmp;
1254
assign  stb3_rd_for_pcx = stb3_rd_for_pcx_tmp;
1255
 
1256
// STORE REQUEST CONTROL
1257
// ** Data must come from bypass mux output.
1258
// THREAD0
1259
 
1260
// Reads for stores will have to be made non-speculative ????
1261
// or delay when ced bit is set such that there is no need
1262
// to replay store.
1263
// The size of atm_rq_type can be reduced in stb_ctl etc !!!
1264
assign  st0_pkt_vld = stb0_rd_for_pcx & ~st0_pcx_rq_sel_d1 ;
1265
assign  st0_cas_vld = ~stb0_rqtype[2] & stb0_rqtype[1] ;
1266
// stquad not supported.
1267
//assign  st0_stq_vld = 1'b0 ;
1268
assign  st0_atomic_vld = st0_cas_vld ;
1269
  //st0_stq_vld |               // stq(1)
1270
  //(~stb0_rqtype[2] & stb0_rqtype[1] & ~stb0_rqtype[0]) ; // cas(1)
1271
 
1272
assign  st1_pkt_vld = stb1_rd_for_pcx & ~st1_pcx_rq_sel_d1 ;
1273
assign  st1_cas_vld = ~stb1_rqtype[2] & stb1_rqtype[1] ;
1274
//assign  st1_stq_vld = 1'b0 ;
1275
assign  st1_atomic_vld = st1_cas_vld ;
1276
 
1277
assign  st2_pkt_vld = stb2_rd_for_pcx & ~st2_pcx_rq_sel_d1 ;
1278
assign  st2_cas_vld = ~stb2_rqtype[2] & stb2_rqtype[1] ;
1279
//assign  st2_stq_vld = 1'b0 ;
1280
assign  st2_atomic_vld = st2_cas_vld ;
1281
 
1282
assign  st3_pkt_vld = stb3_rd_for_pcx & ~st3_pcx_rq_sel_d1 ;
1283
assign  st3_cas_vld = ~stb3_rqtype[2] & stb3_rqtype[1] ;
1284
//assign  st3_stq_vld = 1'b0 ;
1285
assign  st3_atomic_vld = st3_cas_vld ;
1286
 
1287
// Can this be based on st0_pcx_rq_vld instead to ease critical path.
1288
 
1289
//assign  pcx_rq_for_stb[0] = st_pcx_rq_mhot_sel[0] ;
1290
//assign  pcx_rq_for_stb[1] = st_pcx_rq_mhot_sel[1] ;
1291
//assign  pcx_rq_for_stb[2] = st_pcx_rq_mhot_sel[2] ;
1292
//assign  pcx_rq_for_stb[3] = st_pcx_rq_mhot_sel[3] ;
1293
 
1294
 
1295
assign st0_l2bnk_dest[0] =
1296
~stb0_rqaddr[2] & ~stb0_rqaddr[1] & ~stb0_rqaddr[0] ;
1297
assign st0_l2bnk_dest[1] =
1298
~stb0_rqaddr[2] & ~stb0_rqaddr[1] &  stb0_rqaddr[0] ;
1299
assign st0_l2bnk_dest[2] =
1300
~stb0_rqaddr[2] &  stb0_rqaddr[1] & ~stb0_rqaddr[0] ;
1301
assign st0_l2bnk_dest[3] =
1302
~stb0_rqaddr[2] &  stb0_rqaddr[1] &  stb0_rqaddr[0] ;
1303
assign st0_l2bnk_dest[4] =  stb0_rqaddr[2] ;
1304
 
1305
assign st1_l2bnk_dest[0] =
1306
~stb1_rqaddr[2] & ~stb1_rqaddr[1] & ~stb1_rqaddr[0] ;
1307
assign st1_l2bnk_dest[1] =
1308
~stb1_rqaddr[2] & ~stb1_rqaddr[1] &  stb1_rqaddr[0] ;
1309
assign st1_l2bnk_dest[2] =
1310
~stb1_rqaddr[2] &  stb1_rqaddr[1] & ~stb1_rqaddr[0] ;
1311
assign st1_l2bnk_dest[3] =
1312
~stb1_rqaddr[2] &  stb1_rqaddr[1] &  stb1_rqaddr[0] ;
1313
assign st1_l2bnk_dest[4] =  stb1_rqaddr[2] ;
1314
 
1315
assign st2_l2bnk_dest[0] =
1316
~stb2_rqaddr[2] & ~stb2_rqaddr[1] & ~stb2_rqaddr[0] ;
1317
assign st2_l2bnk_dest[1] =
1318
~stb2_rqaddr[2] & ~stb2_rqaddr[1] &  stb2_rqaddr[0] ;
1319
assign st2_l2bnk_dest[2] =
1320
~stb2_rqaddr[2] &  stb2_rqaddr[1] & ~stb2_rqaddr[0] ;
1321
assign st2_l2bnk_dest[3] =
1322
~stb2_rqaddr[2] &  stb2_rqaddr[1] &  stb2_rqaddr[0] ;
1323
assign st2_l2bnk_dest[4] =  stb2_rqaddr[2] ;
1324
 
1325
assign st3_l2bnk_dest[0] =
1326
~stb3_rqaddr[2] & ~stb3_rqaddr[1] & ~stb3_rqaddr[0] ;
1327
assign st3_l2bnk_dest[1] =
1328
~stb3_rqaddr[2] & ~stb3_rqaddr[1] &  stb3_rqaddr[0] ;
1329
assign st3_l2bnk_dest[2] =
1330
~stb3_rqaddr[2] &  stb3_rqaddr[1] & ~stb3_rqaddr[0] ;
1331
assign st3_l2bnk_dest[3] =
1332
~stb3_rqaddr[2] &  stb3_rqaddr[1] &  stb3_rqaddr[0] ;
1333
assign st3_l2bnk_dest[4] =  stb3_rqaddr[2] ;
1334
 
1335
//=================================================================================================
1336
//      BLK-LOAD TRACKING
1337
//=================================================================================================
1338
 
1339
// The 64B load request is divided into 4 16B requests, i.e., 4 pcx pkts.
1340
// The last bld request to the pcx must be marked as so. 
1341
// Only one bld can be processed at any time.
1342
 
1343
   wire [1:0] bld_thrd_din;
1344
   wire [1:0] bld_thrd_dout;
1345
   wire [3:0] bld_dcd_thrd;
1346
   wire       ld_03_inst_vld_g;
1347
   wire       bld_pcx_rq_sel_d1;
1348
 
1349 113 albert.wat
dff_s  stgg_blkasi (
1350 95 fafa1971
        .din    (lsu_blk_asi_m),
1351
        .q      (blk_asi_g),
1352
        .clk    (clk),
1353 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1354 95 fafa1971
        );
1355
 
1356
assign  bld_helper_cmplt_e = lsu_fldd_vld_en & bld_dout & (
1357
                             bld_dcd_thrd[0] & lsu_dfill_dcd_thrd[0] |
1358
                             bld_dcd_thrd[1] & lsu_dfill_dcd_thrd[1] |
1359
                             bld_dcd_thrd[2] & lsu_dfill_dcd_thrd[2] |
1360
                             bld_dcd_thrd[3] & lsu_dfill_dcd_thrd[3] );
1361
 
1362
 
1363 113 albert.wat
dff_s #(1) stgm_bldhlpr (
1364 95 fafa1971
        .din    (bld_helper_cmplt_e),
1365
        .q      (bld_helper_cmplt_m),
1366
        .clk    (clk),
1367 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1368 95 fafa1971
        );
1369
 
1370
assign  lsu_bld_helper_cmplt_m = bld_helper_cmplt_m ;
1371
 
1372 113 albert.wat
dff_s #(1) stgg_bldhlpr (
1373 95 fafa1971
        .din    (bld_helper_cmplt_m),
1374
        .q      (bld_helper_cmplt_g),
1375
        .clk    (clk),
1376 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1377 95 fafa1971
        );
1378
 
1379
wire    alt_space_m, alt_space_g, alt_space_w2 ;
1380 113 albert.wat
dff_s stg_aspacem(
1381 95 fafa1971
        .din    (ifu_lsu_alt_space_e),
1382
        .q      (alt_space_m),
1383
        .clk    (clk),
1384 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1385 95 fafa1971
        );
1386
 
1387 113 albert.wat
dff_s stg_aspaceg(
1388 95 fafa1971
        .din    (alt_space_m),
1389
        .q      (alt_space_g),
1390
        .clk    (clk),
1391 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1392 95 fafa1971
        );
1393
 
1394 113 albert.wat
dff_s stg_aspacew2 (
1395 95 fafa1971
        .din    (alt_space_g),
1396
        .q      (alt_space_w2),
1397
        .clk    (clk),
1398 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1399 95 fafa1971
        );
1400
 
1401
 
1402
// PCX bld helper issue :
1403
// 00-1st->01-2nd->10-3rd->11-4th->00
1404
 
1405
   assign     bld_thrd_din[0] = ld1_inst_vld_unflushed | ld3_inst_vld_unflushed;
1406
   assign     bld_thrd_din[1] = ld2_inst_vld_unflushed | ld3_inst_vld_unflushed;
1407
 
1408
 
1409
   assign ld_03_inst_vld_g =  lsu_inst_vld_w & (
1410
                              ld0_inst_vld_unflushed | ld1_inst_vld_unflushed |
1411
                              ld2_inst_vld_unflushed | ld3_inst_vld_unflushed );
1412
 
1413
   assign       bld_g = blk_asi_g & ldst_fp_g & ldst_dbl_g & alt_space_g & ld_03_inst_vld_g ;
1414
                //~lsu_tlb_perr_ld_rq_kill_w ; // Bug 4645
1415
 
1416
wire    bld_w2 ;
1417 113 albert.wat
dff_s #(1) bldstg (
1418 95 fafa1971
        .din    (bld_g),
1419
        .q      (bld_w2),
1420
        .clk  (clk),
1421 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1422 95 fafa1971
        );
1423
 
1424
wire    perr_ld_rq_kill_w2 ;
1425
wire    bld_perr_kill_w2 ;
1426
assign  bld_perr_kill_w2 = bld_w2 & perr_ld_rq_kill_w2 ;
1427
 
1428 113 albert.wat
dffre_s #(2) bld_thrd (
1429 95 fafa1971
        .din  (bld_thrd_din[1:0] ),
1430
        .q    (bld_thrd_dout[1:0]),
1431
        .rst  (bld_reset), .en (bld_g),
1432
        .clk  (clk),
1433 113 albert.wat
        .se   (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1434 95 fafa1971
        );
1435
   assign bld_dcd_thrd[0] = ~bld_thrd_dout[1] & ~bld_thrd_dout[0];
1436
   assign bld_dcd_thrd[1] = ~bld_thrd_dout[1] &  bld_thrd_dout[0];
1437
   assign bld_dcd_thrd[2] =  bld_thrd_dout[1] & ~bld_thrd_dout[0];
1438
   assign bld_dcd_thrd[3] =  bld_thrd_dout[1] &  bld_thrd_dout[0];
1439
 
1440
//bug 2757    
1441
   assign bld_pcx_rq_sel_d1 = ld0_pcx_rq_sel_d1 & bld_dcd_thrd[0] |
1442
                              ld1_pcx_rq_sel_d1 & bld_dcd_thrd[1] |
1443
                              ld2_pcx_rq_sel_d1 & bld_dcd_thrd[2] |
1444
                              ld3_pcx_rq_sel_d1 & bld_dcd_thrd[3];
1445
 
1446
   //wire   bld_pcx_rq_sel_d2, bld_pcx_rq_sel;
1447
   wire    bld_pcx_rq_sel;
1448
   //bug 3322
1449
//   assign bld_pcx_rq_sel = bld_pcx_rq_sel_d2 & ~pcx_req_squash_d1;
1450
 
1451
//dff #(1) ff_bld_pcx_rq_sel_d2 (
1452
//        .din  (bld_pcx_rq_sel_d1),
1453
//        .q    (bld_pcx_rq_sel_d2),
1454
//        .clk  (clk),
1455 113 albert.wat
//        .se   (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1456 95 fafa1971
//        );                  
1457
 
1458
  assign bld_pcx_rq_sel = (ld0_pcx_rq_sel_d2 & bld_dcd_thrd[0] |
1459
                           ld1_pcx_rq_sel_d2 & bld_dcd_thrd[1] |
1460
                           ld2_pcx_rq_sel_d2 & bld_dcd_thrd[2] |
1461
                           ld3_pcx_rq_sel_d2 & bld_dcd_thrd[3] ) &
1462
                           ~pcx_req_squash_d1;
1463
 
1464
  assign        bld_en = bld_g |  (bld_pcx_rq_sel & bld_dout & ~(bld_cnt[1] & bld_cnt[0])) ;
1465
  assign        bld_din = bld_g | bld_dout ;
1466
  assign        bcnt_din[1:0] = bld_cnt[1:0] + {1'b0,(bld_pcx_rq_sel & bld_dout)} ;
1467
 
1468
// Reset by last completing bld helper.  
1469
  assign        bld_reset =
1470
        reset | bld_perr_kill_w2 |
1471
        (bld_rd_dout[2] & bld_rd_dout[1] & bld_rd_dout[0] & bld_helper_cmplt_g) ;
1472
 
1473
assign  lsu_bld_reset = bld_reset ;
1474
 
1475
wire    bld_dout_tmp ;
1476 113 albert.wat
dffre_s #(3)   bld_pcx_cnt (
1477 95 fafa1971
        .din  ({bcnt_din[1:0],bld_din}),
1478
        .q    ({bld_cnt[1:0], bld_dout_tmp}),
1479
        .rst  (bld_reset), .en (bld_en),
1480
        .clk  (clk),
1481 113 albert.wat
        .se   (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1482 95 fafa1971
        );
1483
 
1484
assign  bld_dout = bld_dout_tmp & ~bld_perr_kill_w2 ;
1485
 
1486
// Last one allows ld-rq-vld to be reset.
1487
assign  bld_annul[0] =  bld_dcd_thrd[0] & (bld_dout & ~(bld_cnt[1] & bld_cnt[0])) ;
1488
assign  bld_annul[1] =  bld_dcd_thrd[1] & (bld_dout & ~(bld_cnt[1] & bld_cnt[0])) ;
1489
assign  bld_annul[2] =  bld_dcd_thrd[2] & (bld_dout & ~(bld_cnt[1] & bld_cnt[0])) ;
1490
assign  bld_annul[3] =  bld_dcd_thrd[3] & (bld_dout & ~(bld_cnt[1] & bld_cnt[0])) ;
1491
 
1492 113 albert.wat
dff_s #(4) bannul_d1 (
1493 95 fafa1971
        .din    (bld_annul[3:0]),
1494
        .q      (bld_annul_d1[3:0]),
1495
        .clk  (clk),
1496 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1497 95 fafa1971
        );
1498
 
1499
// Maintain rd (cpx return pkt counter). This is based on when the blk ld helper completes.
1500
// lower 3b of rd have to start out as zero.
1501
// Should be asserted 8 times for the entire bld.
1502
assign  bld_rd_en = (bld_helper_cmplt_m & bld_dout) ;
1503
assign  bld_rd_din[2:0] = bld_rd_dout_m[2:0] + {2'b00,(bld_helper_cmplt_m & bld_dout)} ;
1504
//assign        bld_rd_en = (bld_helper_cmplt_g & bld_dout) ;
1505
//assign        bld_rd_din[2:0] = bld_rd_dout[2:0] + {2'b00,(bld_helper_cmplt_g & bld_dout)} ;
1506
 
1507 113 albert.wat
dffre_s #(3)   bld_cpx_cnt (
1508 95 fafa1971
        .din  (bld_rd_din[2:0]),
1509
        .q    (bld_rd_dout_m[2:0]),
1510
            .rst  (bld_reset), .en   (bld_rd_en),
1511
        .clk  (clk),
1512 113 albert.wat
        .se   (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1513 95 fafa1971
        );
1514
 
1515 113 albert.wat
dff_s #(3) bld_cnt_stg (
1516 95 fafa1971
        .din    (bld_rd_dout_m[2:0]),
1517
        .q      (bld_rd_dout[2:0]),
1518
        .clk  (clk),
1519 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1520 95 fafa1971
        );
1521
 
1522
// Select appr. rd. (cpx return pkt counter)
1523
assign  lsu_ffu_bld_cnt_w[2:0] = bld_rd_dout[2:0] ;
1524
assign  lsu_bld_cnt_m[2:0] = bld_rd_dout_m[2:0] ;
1525
 
1526
// pcx pkt address cntrl.
1527
wire    [1:0]    addr_b54 ;
1528
assign   addr_b54[1:0] = bld_cnt[1:0];
1529
 
1530
/*wire bld_rq_w2 ;
1531
assign bld_rq_w2 = bld_dout; */
1532
 
1533 113 albert.wat
dff_s #(2) blkrq_d1 (
1534 95 fafa1971
        .din    ({addr_b54[1:0]}),
1535
        .q      ({lsu_bld_rq_addr[1:0]}),
1536
        .clk  (clk),
1537 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1538 95 fafa1971
        );
1539
 
1540
assign  lsu_bld_pcx_rq = bld_pcx_rq_sel_d1 & bld_dout ;
1541
 
1542
/*dff #(3) blkrq_d1 (
1543
        .din    ({addr_b54[1:0],bld_rq_w2}),
1544
        .q      ({lsu_bld_rq_addr[1:0],lsu_bld_pcx_rq}),
1545
        .clk  (clk),
1546 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1547 95 fafa1971
        );*/
1548
 
1549
 
1550
//=================================================================================================
1551
//      LOAD PCX PKT REQ CONTROL
1552
//=================================================================================================
1553
 
1554
// Staging pref.
1555
wire pref_inst_m, pref_inst_g ;
1556
 
1557 113 albert.wat
dff_s  stgm_prf (
1558 95 fafa1971
        .din    (ifu_lsu_pref_inst_e),
1559
        .q      (pref_inst_m),
1560
        .clk  (clk),
1561 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1562 95 fafa1971
        );
1563
 
1564 113 albert.wat
dff_s  stgg_prf (
1565 95 fafa1971
        .din    (pref_inst_m),
1566
        .q      (pref_inst_g),
1567
        .clk  (clk),
1568 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1569 95 fafa1971
        );
1570
 
1571
// Performance Ctr Info
1572 113 albert.wat
dff_s #(4)  stgg_dmiss (
1573 95 fafa1971
        .din    ({ld3_l2cache_rq,ld2_l2cache_rq,ld1_l2cache_rq,ld0_l2cache_rq}),
1574
        .q      (lsu_tlu_dcache_miss_w2[3:0]),
1575
        .clk  (clk),
1576 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1577 95 fafa1971
        );
1578
 
1579
wire  ld0_l2cache_rq_w2, ld1_l2cache_rq_w2, ld2_l2cache_rq_w2, ld3_l2cache_rq_w2 ;
1580
 
1581
assign ld0_l2cache_rq_w2  =  lsu_tlu_dcache_miss_w2[0];
1582
assign ld1_l2cache_rq_w2  =  lsu_tlu_dcache_miss_w2[1];
1583
assign ld2_l2cache_rq_w2  =  lsu_tlu_dcache_miss_w2[2];
1584
assign ld3_l2cache_rq_w2  =  lsu_tlu_dcache_miss_w2[3];
1585
 
1586
wire    pref_vld0_g, pref_vld1_g, pref_vld2_g, pref_vld3_g ;
1587
wire    pref_rq_vld0_g, pref_rq_vld1_g, pref_rq_vld2_g, pref_rq_vld3_g ;
1588
wire    pref_vld_g ;
1589
assign  pref_vld_g = pref_inst_g & ~tlb_pgnum_g[39] & tlb_cam_hit_g ; // Bug 4318. 
1590
assign  pref_rq_vld0_g = pref_vld_g & thread0_g & lsu_inst_vld_w ;
1591
assign  pref_rq_vld1_g = pref_vld_g & thread1_g & lsu_inst_vld_w ;
1592
assign  pref_rq_vld2_g = pref_vld_g & thread2_g & lsu_inst_vld_w ;
1593
assign  pref_rq_vld3_g = pref_vld_g & thread3_g & lsu_inst_vld_w ;
1594
assign  pref_vld0_g = pref_inst_g & thread0_g ;
1595
assign  pref_vld1_g = pref_inst_g & thread1_g ;
1596
assign  pref_vld2_g = pref_inst_g & thread2_g ;
1597
assign  pref_vld3_g = pref_inst_g & thread3_g ;
1598
 
1599
//=========================================================================================
1600
// Shift full-raw/partial-raw logic from rw_ctl to qctl1
1601
 
1602
wire    ldquad_inst_g ;
1603 113 albert.wat
dff_s  ldq_stgg (
1604 95 fafa1971
  .din    (lsu_ldquad_inst_m), .q (ldquad_inst_g),
1605
  .clk    (clk),
1606 113 albert.wat
  .se   (1'b0), `SIMPLY_RISC_SCANIN, .so ()
1607 95 fafa1971
  );
1608
 
1609
wire    io_ld,io_ld_w2 ;
1610
assign  io_ld = tlb_pgnum_g[39] ; // Bug 4362
1611
//assign  io_ld = tlb_pgnum_g[39]  & ~(~tlb_pgnum_g[38]  & tlb_pgnum_g[37]) ;
1612
 
1613
wire    stb_not_empty ;
1614
assign  stb_not_empty  =
1615
  thread0_g ? ~lsu_stb_empty[0] :
1616
    thread1_g ? ~lsu_stb_empty[1] :
1617
      thread2_g ? ~lsu_stb_empty[2] :
1618
                        ~lsu_stb_empty[3] ;
1619
 
1620
wire    ldq_hit_g,ldq_hit_w2 ;
1621
wire    ldq_stb_cam_hit ;
1622
assign  ldq_stb_cam_hit = stb_cam_hit_bf & ldquad_inst_g ;
1623
// Terms can be made common.
1624
assign  ldq_hit_g = ldq_stb_cam_hit ;
1625
 
1626
wire    full_raw_g,partial_raw_g ;
1627
wire    full_raw_w2,partial_raw_w2 ;
1628
assign  full_raw_g = |stb_ld_full_raw[7:0] ;
1629
assign  partial_raw_g = |stb_ld_partial_raw[7:0] ;
1630
 
1631
wire    stb_cam_mhit_w2 ;
1632
wire    stb_not_empty_w2 ;
1633 113 albert.wat
dff_s #(6) stgw2_rawcond (
1634 95 fafa1971
        .din    ({full_raw_g,partial_raw_g,stb_cam_mhit,ldq_hit_g,io_ld,stb_not_empty}),
1635
        .q      ({full_raw_w2,partial_raw_w2,stb_cam_mhit_w2,ldq_hit_w2,io_ld_w2,
1636
                stb_not_empty_w2}),
1637
        .clk    (clk),
1638 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1639 95 fafa1971
        );
1640
 
1641
// BEGIN !!! ld_stb_full_raw_g for SAS support only !!!
1642
//wire  ld_stb_full_raw_g ;
1643
//wire  ld_stb_partial_raw_g ;
1644
 
1645
// END !!! ld_stb_full_raw_g for SAS support only !!!
1646
assign  ld_stb_full_raw_w2 =
1647
        (full_raw_w2 & ~(stb_cam_mhit_w2 | ldq_hit_w2 | io_ld_w2)) ;
1648
        //(full_raw_w2 & ~(stb_cam_mhit_w2 | ldq_hit_w2 | io_ld_w2)) ; // Bug 3624
1649
wire    ld_stb_partial_raw_w2 ;
1650
wire    stb_cam_hit_w2 ;
1651
assign  ld_stb_partial_raw_w2 =
1652
        (partial_raw_w2 | stb_cam_mhit_w2 | ldq_hit_w2 |
1653
        (io_ld_w2 & stb_not_empty_w2)) ;
1654
        //(partial_raw_w2 | stb_cam_mhit_w2 | ldq_hit_w2 | (io_ld_w2 & stb_not_empty_w2)) ;
1655
 
1656
//=========================================================================================
1657
 
1658
/*wire  ld_stb_full_raw_w2 ;
1659 113 albert.wat
dff_s #(1) stgw2_fraw (
1660 95 fafa1971
        .din    (ld_stb_full_raw_g),
1661
        .q      (ld_stb_full_raw_w2),
1662
        .clk  (clk),
1663 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1664 95 fafa1971
        ); */
1665
 
1666
// THREAD0 LOAD PCX REQUEST CONTROL
1667
 
1668
//=====
1669
// For delayed ld0,1,2,3_l2cache_rq, we need to delay certain
1670
// inputs to flops enabled by ld0,1,2,3_l2cache_rq.
1671
 
1672
wire    ld0_ldbl_rq_w2 ;
1673
wire    ld1_ldbl_rq_w2 ;
1674
wire    ld2_ldbl_rq_w2 ;
1675
wire    ld3_ldbl_rq_w2 ;
1676
// wire [1:0]   ld_pcx_pkt_wy_w2 ;
1677
 wire           pref_rq_vld0_w2,pref_rq_vld1_w2,pref_rq_vld2_w2,pref_rq_vld3_w2 ;
1678
 wire           non_l2bnk ;
1679
 wire           non_l2bnk_w2 ;
1680
 wire [7:6]     ldst_va_w2 ;
1681
 
1682 113 albert.wat
dff_s #(7) stgw2_l2crqmx (
1683 95 fafa1971
        .din    ({
1684
                //ld_pcx_pkt_wy_g[1:0],
1685
                pref_rq_vld0_g,pref_rq_vld1_g,pref_rq_vld2_g,pref_rq_vld3_g,
1686
                non_l2bnk,
1687
                ldst_va_g[7:6]}),
1688
        .q      ({
1689
                //ld_pcx_pkt_wy_w2[1:0],
1690
                pref_rq_vld0_w2,pref_rq_vld1_w2,pref_rq_vld2_w2,pref_rq_vld3_w2,
1691
                non_l2bnk_w2,
1692
                ldst_va_w2[7:6]}),
1693
        .clk  (clk),
1694 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1695 95 fafa1971
        );
1696
 
1697
// wire [1:0]   ld_pcx_pkt_wy_mx0,ld_pcx_pkt_wy_mx1,ld_pcx_pkt_wy_mx2,ld_pcx_pkt_wy_mx3 ;
1698
 wire           pref_rq_vld0_mx,pref_rq_vld1_mx,pref_rq_vld2_mx,pref_rq_vld3_mx ;
1699
 wire           non_l2bnk_mx0,non_l2bnk_mx1,non_l2bnk_mx2,non_l2bnk_mx3 ;
1700
 wire [7:6]     ldst_va_mx0,ldst_va_mx1,ldst_va_mx2,ldst_va_mx3 ;
1701
 
1702
// timing fix: 5/19/03: move secondary hit way generation to w2
1703
//                      remove ld_pcx_pkt_wy_mx[0-3] and replace w/ lsu_lmq_pkt_way_w2
1704
// assign       ld_pcx_pkt_wy_mx0[1:0] = 
1705
//      ld0_ldbl_rq_w2 ? ld_pcx_pkt_wy_w2[1:0] : ld_pcx_pkt_wy_g[1:0] ;
1706
// assign       ld_pcx_pkt_wy_mx1[1:0] = 
1707
//      ld1_ldbl_rq_w2 ? ld_pcx_pkt_wy_w2[1:0] : ld_pcx_pkt_wy_g[1:0] ;
1708
// assign       ld_pcx_pkt_wy_mx2[1:0] = 
1709
//      ld2_ldbl_rq_w2 ? ld_pcx_pkt_wy_w2[1:0] : ld_pcx_pkt_wy_g[1:0] ;
1710
// assign       ld_pcx_pkt_wy_mx3[1:0] = 
1711
//      ld3_ldbl_rq_w2 ? ld_pcx_pkt_wy_w2[1:0] : ld_pcx_pkt_wy_g[1:0] ;
1712
 
1713
 
1714
 assign pref_rq_vld0_mx =
1715
        ld0_ldbl_rq_w2 ? pref_rq_vld0_w2 : pref_rq_vld0_g ;
1716
 assign pref_rq_vld1_mx =
1717
        ld1_ldbl_rq_w2 ? pref_rq_vld1_w2 : pref_rq_vld1_g ;
1718
 assign pref_rq_vld2_mx =
1719
        ld2_ldbl_rq_w2 ? pref_rq_vld2_w2 : pref_rq_vld2_g ;
1720
 assign pref_rq_vld3_mx =
1721
        ld3_ldbl_rq_w2 ? pref_rq_vld3_w2 : pref_rq_vld3_g ;
1722
 assign non_l2bnk_mx0 =
1723
        ld0_ldbl_rq_w2 ? non_l2bnk_w2 : non_l2bnk ;
1724
 assign non_l2bnk_mx1 =
1725
        ld1_ldbl_rq_w2 ? non_l2bnk_w2 : non_l2bnk ;
1726
 assign non_l2bnk_mx2 =
1727
        ld2_ldbl_rq_w2 ? non_l2bnk_w2 : non_l2bnk ;
1728
 assign non_l2bnk_mx3 =
1729
        ld3_ldbl_rq_w2 ? non_l2bnk_w2 : non_l2bnk ;
1730
 
1731
//timing fix: 10/13/03 - ldst_va_mx[0-3] is used in the same cycle 'cos of perf bug fix-bug2705
1732
//            this delays the ld request valid which in turn delays pcx_rq_for_stb
1733
//            fix is to isolate this mux and the following l2bank addr mux from ld?_ldbl_rq_w2;
1734
//            use ld[0-3]_inst_vld_w2 instead of ld[0-3]_ldbl_rq_w2 as select
1735
 assign ldst_va_mx0[7:6] =
1736
        ld0_inst_vld_w2 ? ldst_va_w2[7:6] : ldst_va_g[7:6] ;
1737
 assign ldst_va_mx1[7:6] =
1738
        ld1_inst_vld_w2 ? ldst_va_w2[7:6] : ldst_va_g[7:6] ;
1739
 assign ldst_va_mx2[7:6] =
1740
        ld2_inst_vld_w2 ? ldst_va_w2[7:6] : ldst_va_g[7:6] ;
1741
 assign ldst_va_mx3[7:6] =
1742
        ld3_inst_vld_w2 ? ldst_va_w2[7:6] : ldst_va_g[7:6] ;
1743
 
1744
//=====
1745
 
1746
wire    atomic_g ;
1747
assign  atomic_g = casa_g | lsu_swap_g | lsu_ldstub_g ;
1748
 
1749
   wire dbl_force_l2access_g;
1750
   wire dbl_force_l2access_w2;
1751
   assign dbl_force_l2access_g = ldst_dbl_g & ~(ldst_fp_g & ~(alt_space_g & blk_asi_g));
1752
 
1753 113 albert.wat
dff_s #(2) stgw2_atm (
1754 95 fafa1971
        .din    ({atomic_g, dbl_force_l2access_g}),
1755
        .q      ({atomic_w2,dbl_force_l2access_w2}),
1756
        .clk  (clk),
1757 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1758 95 fafa1971
        );
1759
 
1760 113 albert.wat
dff_s #(1) stgw2_perrkill (
1761 95 fafa1971
        .din    (lsu_tlb_perr_ld_rq_kill_w),
1762
        .q      (perr_ld_rq_kill_w2),
1763
        .clk  (clk),
1764 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1765 95 fafa1971
        );
1766
 
1767
wire    asi_internal_g,asi_internal_w2;
1768 113 albert.wat
dff_s #(1) stgg_intasi (
1769 95 fafa1971
        .din    (asi_internal_m),
1770
        .q      (asi_internal_g),
1771
        .clk  (clk),
1772 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1773 95 fafa1971
        );
1774
 
1775 113 albert.wat
dff_s #(1) stgw2_intasi (
1776 95 fafa1971
        .din    (asi_internal_g),
1777
        .q      (asi_internal_w2),
1778
        .clk  (clk),
1779 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1780 95 fafa1971
        );
1781
 
1782
wire    ld0_l2cache_rq_kill ;
1783
assign  ld0_l2cache_rq_kill =
1784
        ld0_inst_vld_w2 & ((ld_stb_full_raw_w2 & ~dbl_force_l2access_w2) | perr_ld_rq_kill_w2) ;
1785
                                                // full-raw which looks like partial
1786
assign  ld0_ldbl_rq_w2 =
1787
                ((ld_stb_full_raw_w2 & dbl_force_l2access_w2) | ld_stb_partial_raw_w2)
1788
                        & ~atomic_w2 & ~perr_ld_rq_kill_w2 & ~(asi_internal_w2 & alt_space_w2)
1789
                        & ld0_inst_vld_w2 ;
1790
 
1791
//bug:2877 - dtag parity error 2nd packet request; dont reset if dtag parity error 2nd pkt valid
1792
//           dtag error is reset 1 cycle after 1st pkt sent
1793
//----------------------------------------------------------------------------------------------------------
1794
// |       1       |        2       |         3          |        4       |        5        |        6    |
1795
//  spc_pcx_rq_pq=1   ld_err-pkt1                                           spc_pcx_rq_pq=1   ld_err-pkt2
1796
//                                     ld0_vld_reset=0       pick 2nd pkt
1797
//                                     error_rst=1
1798
//----------------------------------------------------------------------------------------------------------
1799
 
1800
wire   [3:0]  dtag_perr_pkt2_vld_d1 ;
1801
assign ld0_vld_reset =
1802
  (reset | (ld0_pcx_rq_sel_d2 & ~(pcx_req_squash_d1 | ld0_inst_vld_g | bld_annul_d1[0] | dtag_perr_pkt2_vld_d1[0]))) |
1803
  ld0_l2cache_rq_kill ;
1804
  //(reset | (ld0_pcx_rq_sel_d2 & ~(pcx_req_squash_d1 | ld0_inst_vld_g | bld_annul_d1[0]))) |
1805
 
1806
// The equation for partial raw has redundancy !! Change it.
1807
// prefetch will not bypass from stb
1808
/* prim vs sec phase 2 change
1809
assign ld0_l2cache_rq =
1810
        (((lsu_ld_miss_g & ~ld_stb_full_raw_g  & ~ld_sec_hit_g & ~ldxa_internal) |
1811
        ((lsu_ld_hit_g | lsu_ld_miss_g) & (ld_stb_partial_raw_g | (ld_stb_full_raw_g & ldst_dbl_g))))
1812
        & ~atomic_g & ld0_inst_vld_g) |
1813
        | (pref_inst_g & tlb_cam_hit_g & thread0_g) ;
1814
*/
1815
 
1816
 
1817
wire  ld0_l2cache_rq_g;
1818
 
1819
assign ld0_l2cache_rq_g =
1820
        (((lsu_ld_miss_g & ~ldxa_internal))
1821
        //((lsu_ld_hit_g | lsu_ld_miss_g) & (ld_stb_partial_raw_g)))
1822
        & ~atomic_g & ld0_inst_vld_g)
1823
        | pref_rq_vld0_g;
1824
 
1825
assign ld0_l2cache_rq = ld0_l2cache_rq_g | ld0_ldbl_rq_w2 ;
1826
 
1827
wire  ld0_pkt_vld_unmasked ;
1828
wire  ld1_pkt_vld_unmasked ;
1829
wire  ld2_pkt_vld_unmasked ;
1830
wire  ld3_pkt_vld_unmasked ;
1831
 
1832
// ld valid until request made.
1833
wire pref_rq_vld0;
1834 113 albert.wat
dffre_s #(2)  ld0_vld (
1835 95 fafa1971
        .din    ({ld0_l2cache_rq, pref_rq_vld0_mx}    ),
1836
        .q      ({ld0_pkt_vld_unmasked, pref_rq_vld0}),
1837
  .rst  (ld0_vld_reset),  .en (ld0_l2cache_rq),
1838
        .clk  (clk),
1839 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1840 95 fafa1971
        );
1841
 
1842
// bug2705 - speculative pick in w-cycle -begin
1843
// dbl_force_l2access_g is set for ldd(f),std(f),ldq,stq
1844
//perf fix: 7/29/03 - kill spec vld if other thread non-spec valids are set
1845
//timing fix: 8/29/03 - flop atomic_m and ldxa_internal_m from dctl for spec req
1846
wire    atomic_or_ldxa_internal_rq_m ;
1847
assign  atomic_or_ldxa_internal_rq_m  =  atomic_m | lda_internal_m ;
1848
 
1849 113 albert.wat
dff_s #(1) ff_atomic_or_ldxa_internal_rq_g (
1850 95 fafa1971
        .din    (atomic_or_ldxa_internal_rq_m),
1851
        .q      (atomic_or_ldxa_internal_rq_g),
1852
        .clk  (clk),
1853 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1854 95 fafa1971
        );
1855
 
1856
wire    ld0_spec_vld_g ;
1857
assign  ld0_spec_vld_g  =  ld0_inst_vld_unflushed & lsu_inst_vld_tmp & ~dbl_force_l2access_g & tlb_cam_hit_g &
1858
                           ~atomic_or_ldxa_internal_rq_g &
1859
                           ~(ld1_pkt_vld_unmasked | ld2_pkt_vld_unmasked | ld3_pkt_vld_unmasked);
1860
//assign  ld0_spec_vld_g  =  ld0_inst_vld_unflushed & lsu_inst_vld_tmp & ~dbl_force_l2access_g & tlb_cam_hit_g ;
1861
 
1862 113 albert.wat
dff_s #(1) ff_ld0_spec_pick_vld_w2 (
1863 95 fafa1971
        .din    (ld0_spec_pick_vld_g),
1864
        .q      (ld0_spec_pick_vld_w2),
1865
        .clk  (clk),
1866 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1867 95 fafa1971
        );
1868
 
1869
// kill packet valid if spec req is picked in w and stb hits in w2
1870
// cannot use ld0_ldbl_rawp_en_w2 because it is late signal instead use ld0_ldbl_rq_w2
1871
//timing fix: 7/21/03 - kill pkt vld if spec pick in w-cycle was to non$ address
1872
//timing fix: 8/6/03 - kill pkt_vld if ld?_l2cache_rq_g=0 in w-cycle but spec_pick=1
1873
wire    ld0_pkt_vld_tmp ;
1874
//bug 3964 - replace ld0_pkt_vld_unmasked w/ ld0_l2cache_rq_w2
1875
//assign lsu_ld0_spec_vld_kill_w2  =  ld0_spec_pick_vld_w2 & (~ld0_pkt_vld_unmasked | ld0_l2cache_rq_kill | ld0_ldbl_rq_w2 | non_l2bnk_mx0_d1) ;
1876
assign lsu_ld0_spec_vld_kill_w2  =  ld0_spec_pick_vld_w2 & (~ld0_l2cache_rq_w2 | ld0_l2cache_rq_kill | ld0_ldbl_rq_w2 | non_l2bnk_mx0_d1) ;
1877
 
1878
assign  ld0_pkt_vld_tmp =  ld0_pkt_vld_unmasked & ~(ld0_pcx_rq_sel_d1 | ld0_pcx_rq_sel_d2) &
1879
                      ~(ld0_l2cache_rq_kill | ld0_ldbl_rq_w2) &
1880
                      ~(pref_rq_vld0 & lsu_no_spc_pref[0]) ;  // prefetch pending 
1881
 
1882
assign  ld0_pkt_vld = ld0_pkt_vld_tmp | ld0_spec_vld_g ;
1883
// bug2705 - speculative pick in w-cycle -end
1884
 
1885
//assign  ld0_pkt_vld = ld0_pkt_vld_unmasked & ~ld0_pcx_rq_sel_d1 ; 
1886
 
1887
assign  ld0_fill_reset = reset | (lsu_dfq_ld_vld & lsu_dcfill_active_e & dfq_byp_sel[0]) ;
1888
 
1889
 
1890 113 albert.wat
dff_s #(4) stgm_lduwyd1 (
1891 95 fafa1971
        .din    ({ld0_fill_reset,ld1_fill_reset,ld2_fill_reset,ld3_fill_reset}),
1892
        .q      ({ld0_fill_reset_d1,ld1_fill_reset_d1,ld2_fill_reset_d1,ld3_fill_reset_d1}),
1893
        .clk  (clk),
1894 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1895 95 fafa1971
        );
1896
 
1897 113 albert.wat
dff_s #(4) stgm_lduwyd2 (
1898 95 fafa1971
        .din    ({ld0_fill_reset_d1,ld1_fill_reset_d1,ld2_fill_reset_d1,ld3_fill_reset_d1}),
1899
        .q      ({ld0_fill_reset_d2_tmp,ld1_fill_reset_d2_tmp,ld2_fill_reset_d2_tmp,ld3_fill_reset_d2_tmp}),
1900
        .clk  (clk),
1901 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1902 95 fafa1971
        );
1903
 
1904
wire  ld0_l2cache_rq_w2_tmp;
1905
wire  ld0_l2cache_rq_g_tmp;
1906
 
1907
assign ld0_l2cache_rq_g_tmp  =  ld0_l2cache_rq_g & ~pref_inst_g ;
1908
 
1909 113 albert.wat
dff_s #(1) ff_ld0_l2cache_rq_w2 (
1910 95 fafa1971
        .din    (ld0_l2cache_rq_g_tmp),
1911
        .q      (ld0_l2cache_rq_w2_tmp),
1912
        .clk  (clk),
1913 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1914 95 fafa1971
        );
1915
 
1916
 
1917
//wire ld0_unfilled_en ;
1918
//assign        ld0_unfilled_en = ld0_l2cache_rq & ~pref_inst_g ;
1919
wire ld0_unfilled_wy_en ;
1920
assign  ld0_unfilled_wy_en = ld0_l2cache_rq_w2_tmp | ld0_ldbl_rq_w2 ;
1921
 
1922
wire  ld0_l2cache_rq_tmp;
1923
assign ld0_l2cache_rq_tmp  = ld0_unfilled_wy_en & ~ld0_l2cache_rq_kill;
1924
 
1925
// ld valid until fill occur.
1926 113 albert.wat
dffre_s #(1)  ld0out_state (
1927 95 fafa1971
        //.din    (ld0_l2cache_rq),
1928
        .din    (ld0_l2cache_rq_tmp),
1929
        .q      (ld0_unfilled_tmp),
1930
        .rst    (ld0_fill_reset_d2),  .en     (ld0_unfilled_wy_en),
1931
        .clk    (clk),
1932 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1933 95 fafa1971
        );
1934
 
1935 113 albert.wat
dffre_s #(2)  ld0out_state_way (
1936 95 fafa1971
        //.din    (ld_pcx_pkt_wy_mx0[1:0]}),
1937
        .din    (lsu_lmq_pkt_way_w2[1:0]),
1938
        .q      (ld0_unfilled_wy[1:0]),
1939
        .rst    (ld0_fill_reset_d2),  .en     (ld0_unfilled_wy_en),
1940
        .clk    (clk),
1941 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1942 95 fafa1971
        );
1943
 
1944
assign  ld0_fill_reset_d2 = ld0_fill_reset_d2_tmp | ld0_l2cache_rq_kill ;
1945
//assign        ld0_unfilled = ld0_unfilled_tmp & ~ld0_l2cache_rq_kill ;
1946
assign  ld0_unfilled = ld0_unfilled_tmp ;
1947
 
1948
//bug3516
1949
//assign  non_l2bnk = tlb_pgnum_g[39] & tlb_pgnum_g[38] ;
1950
assign  non_l2bnk = tlb_pgnum_g[39]  & ~(~tlb_pgnum_g[38]  & tlb_pgnum_g[37]) ;
1951
 
1952
// ld l2bank address
1953 113 albert.wat
dffe_s  #(3) ld0_l2bnka (
1954 95 fafa1971
        .din    ({non_l2bnk_mx0,ldst_va_mx0[7:6]}),
1955
        .q      (ld0_l2bnk_addr[2:0]),
1956
  .en (ld0_l2cache_rq),
1957
        .clk  (clk),
1958 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1959 95 fafa1971
        );
1960
 
1961
//bug2705 - add byp for address to be available in w-cycle
1962
//7/21/03: timing fix - non_l2bnk_mx0 (uses tlb_pgnum_g[39:37] which arrives in qctl1 ~400ps)
1963
//         this will cause timing paths in spec pick in w-cycle; hence assume $able access for
1964
//         spec pick and kill pkt vld in w2 if non_l2bnk_mx0=1 (non$ access)
1965
wire  [2:0]  ld0_l2bnk_addr_mx ;
1966
assign  ld0_l2bnk_addr_mx[2:0]  =  ld0_pkt_vld_unmasked ? ld0_l2bnk_addr[2:0] :
1967
                                                          {1'b0,ldst_va_mx0[7:6]} ;             // assume $able access for spec pick
1968
 
1969
//assign  ld0_l2bnk_addr_mx[2:0]  =  (ld0_inst_vld_unflushed  & lsu_inst_vld_tmp) ? 
1970
//                                        {1'b0,ldst_va_mx0[7:6]} :             // assume $able access for spec pick
1971
//                                        //{non_l2bnk_mx0,ldst_va_mx0[7:6]} : 
1972
//                                           ld0_l2bnk_addr[2:0] ;
1973
 
1974
//7/21/03: timing fix - non_l2bnk_mx0 (uses tlb_pgnum_g[39:37] which arrives in qctl1 ~400ps)
1975
//         this will cause timing paths in spec pick in w-cycle; hence assume $able access for
1976
//         spec pick and kill pkt vld in w2
1977 113 albert.wat
dff_s #(1) ff_non_l2bnk_mx0_d1 (
1978 95 fafa1971
        .din    (non_l2bnk_mx0),
1979
        .q      (non_l2bnk_mx0_d1),
1980
        .clk  (clk),
1981 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1982 95 fafa1971
        );
1983
 
1984
//bug2705 - change ld0_l2bnk_addr[2:0] to ld0_l2bnk_addr_mx[2:0]
1985
assign ld0_l2bnk_dest[0] = ~ld0_l2bnk_addr_mx[2] & ~ld0_l2bnk_addr_mx[1] & ~ld0_l2bnk_addr_mx[0] ;
1986
assign ld0_l2bnk_dest[1] = ~ld0_l2bnk_addr_mx[2] & ~ld0_l2bnk_addr_mx[1] &  ld0_l2bnk_addr_mx[0] ;
1987
assign ld0_l2bnk_dest[2] = ~ld0_l2bnk_addr_mx[2] &  ld0_l2bnk_addr_mx[1] & ~ld0_l2bnk_addr_mx[0] ;
1988
assign ld0_l2bnk_dest[3] = ~ld0_l2bnk_addr_mx[2] &  ld0_l2bnk_addr_mx[1] &  ld0_l2bnk_addr_mx[0] ;
1989
assign ld0_l2bnk_dest[4] =  ld0_l2bnk_addr_mx[2] ;
1990
 
1991
// THREAD1 LOAD PCX REQUEST CONTROL
1992
 
1993
wire    ld1_l2cache_rq_kill ;
1994
assign  ld1_l2cache_rq_kill =
1995
        ld1_inst_vld_w2 & ((ld_stb_full_raw_w2 & ~dbl_force_l2access_w2) | perr_ld_rq_kill_w2) ;
1996
                                        // full-raw which looks like partial
1997
assign  ld1_ldbl_rq_w2 =
1998
                ((ld_stb_full_raw_w2 & dbl_force_l2access_w2) | ld_stb_partial_raw_w2)
1999
                        & ~atomic_w2 & ~perr_ld_rq_kill_w2 & ~(asi_internal_w2 & alt_space_w2) &
2000
                        ld1_inst_vld_w2 ;
2001
 
2002
assign ld1_vld_reset =
2003
  (reset | (ld1_pcx_rq_sel_d2 & ~(pcx_req_squash_d1 | ld1_inst_vld_g | bld_annul_d1[1] | dtag_perr_pkt2_vld_d1[1]))) |
2004
  ld1_l2cache_rq_kill ;
2005
  //(reset | (ld1_pcx_rq_sel_d2 & ~(pcx_req_squash_d1 | ld1_inst_vld_g | bld_annul_d1[1]))) | // bug2877
2006
  //(reset | (ld1_pcx_rq_sel_d1 & ~(pcx_req_squash | ld1_inst_vld_g | bld_annul[1]))) ;
2007
 
2008
wire  ld1_l2cache_rq_g;
2009
assign ld1_l2cache_rq_g =
2010
        (((lsu_ld_miss_g & ~ldxa_internal))
2011
        //((lsu_ld_hit_g | lsu_ld_miss_g) & (ld_stb_partial_raw_g))) // ldst_dbl always rqs
2012
        & ~atomic_g & ld1_inst_vld_g)
2013
        | pref_rq_vld1_g ;
2014
 
2015
assign ld1_l2cache_rq =  ld1_l2cache_rq_g | ld1_ldbl_rq_w2 ;
2016
 
2017
 
2018
// ld valid
2019
wire pref_rq_vld1;
2020 113 albert.wat
dffre_s #(2)  ld1_vld (
2021 95 fafa1971
        .din    ({ld1_l2cache_rq, pref_rq_vld1_mx}),
2022
        .q      ({ld1_pkt_vld_unmasked, pref_rq_vld1}),
2023
  .rst  (ld1_vld_reset),  .en (ld1_l2cache_rq),
2024
        .clk  (clk),
2025 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2026 95 fafa1971
        );
2027
 
2028
// bug2705 - speculative pick in w-cycle-begin
2029
wire    ld1_spec_vld_g ;
2030
assign  ld1_spec_vld_g  =  ld1_inst_vld_unflushed & lsu_inst_vld_tmp & ~dbl_force_l2access_g & tlb_cam_hit_g  &
2031
                           ~atomic_or_ldxa_internal_rq_g &
2032
                           ~(ld0_pkt_vld_unmasked | ld2_pkt_vld_unmasked | ld3_pkt_vld_unmasked);
2033
//assign  ld1_spec_vld_g  =  ld1_inst_vld_unflushed & lsu_inst_vld_tmp & ~dbl_force_l2access_g & tlb_cam_hit_g ;
2034
 
2035 113 albert.wat
dff_s #(1) ff_ld1_spec_pick_vld_w2 (
2036 95 fafa1971
        .din    (ld1_spec_pick_vld_g),
2037
        .q      (ld1_spec_pick_vld_w2),
2038
        .clk  (clk),
2039 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2040 95 fafa1971
        );
2041
 
2042
// kill packet valid if spec req is picked in w and stb hits in w2
2043
wire    ld1_pkt_vld_tmp ;
2044
assign lsu_ld1_spec_vld_kill_w2  =  ld1_spec_pick_vld_w2 & (~ld1_l2cache_rq_w2 | ld1_l2cache_rq_kill | ld1_ldbl_rq_w2 | non_l2bnk_mx1_d1) ;
2045
 
2046
assign  ld1_pkt_vld_tmp =  ld1_pkt_vld_unmasked & ~(ld1_pcx_rq_sel_d1 | ld1_pcx_rq_sel_d2) &
2047
                      ~(ld1_l2cache_rq_kill | ld1_ldbl_rq_w2) &
2048
                      ~(pref_rq_vld1 & lsu_no_spc_pref[1]) ;
2049
 
2050
assign  ld1_pkt_vld = ld1_pkt_vld_tmp | ld1_spec_vld_g ;
2051
// bug2705 - speculative pick in w-cycle-end
2052
 
2053
//assign  ld1_pkt_vld = ld1_pkt_vld_unmasked & ~ld1_pcx_rq_sel_d1 ; 
2054
 
2055
 
2056
assign  ld1_fill_reset = reset | (lsu_dfq_ld_vld & lsu_dcfill_active_e & dfq_byp_sel[1]) ;
2057
 
2058
wire  ld1_l2cache_rq_g_tmp;
2059
wire  ld1_l2cache_rq_w2_tmp;
2060
 
2061
assign ld1_l2cache_rq_g_tmp  =  ld1_l2cache_rq_g & ~pref_inst_g ;
2062
 
2063 113 albert.wat
dff_s #(1) ff_ld1_l2cache_rq_w2 (
2064 95 fafa1971
         .din    (ld1_l2cache_rq_g_tmp),
2065
         .q      (ld1_l2cache_rq_w2_tmp),
2066
         .clk  (clk),
2067 113 albert.wat
         .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2068 95 fafa1971
         );
2069
 
2070
//wire ld1_unfilled_en ;
2071
//assign        ld1_unfilled_en = ld1_l2cache_rq & ~pref_inst_g ;
2072
wire ld1_unfilled_wy_en ;
2073
assign  ld1_unfilled_wy_en = ld1_l2cache_rq_w2_tmp | ld1_ldbl_rq_w2 ;
2074
 
2075
wire  ld1_l2cache_rq_tmp;
2076
assign ld1_l2cache_rq_tmp  = ld1_unfilled_wy_en & ~ld1_l2cache_rq_kill;
2077
 
2078
// ld valid until fill occur.
2079 113 albert.wat
dffre_s  #(1)  ld1out_state (
2080 95 fafa1971
        //.din    (ld1_l2cache_rq),
2081
        .din    (ld1_l2cache_rq_tmp),
2082
        .q      (ld1_unfilled_tmp),
2083
        .rst    (ld1_fill_reset_d2),  .en     (ld1_unfilled_wy_en),
2084
        .clk    (clk),
2085 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2086 95 fafa1971
  );
2087 113 albert.wat
dffre_s  #(2)  ld1out_state_way (
2088 95 fafa1971
        //.din    (ld_pcx_pkt_wy_mx1[1:0]),
2089
        .din    (lsu_lmq_pkt_way_w2[1:0]),
2090
        .q      (ld1_unfilled_wy[1:0]),
2091
        .rst    (ld1_fill_reset_d2),  .en     (ld1_unfilled_wy_en),
2092
        .clk    (clk),
2093 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2094 95 fafa1971
  );
2095
 
2096
 
2097
assign  ld1_fill_reset_d2 = ld1_fill_reset_d2_tmp | ld1_l2cache_rq_kill ;
2098
//assign        ld1_unfilled = ld1_unfilled_tmp & ~ld1_l2cache_rq_kill ;
2099
assign  ld1_unfilled = ld1_unfilled_tmp ;
2100
 
2101
// ld l2bank address
2102 113 albert.wat
dffe_s  #(3) ld1_l2bnka (
2103 95 fafa1971
        .din    ({non_l2bnk_mx1,ldst_va_mx1[7:6]}),
2104
        .q      (ld1_l2bnk_addr[2:0]),
2105
  .en (ld1_l2cache_rq),
2106
        .clk  (clk),
2107 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2108 95 fafa1971
        );
2109
 
2110
//bug2705 - add byp for address to be available in w-cycle
2111
//7/21/03: timing fix - non_l2bnk_mx0 (uses tlb_pgnum_g[39:37] which arrives in qctl1 ~400ps)
2112
//         this will cause timing paths in spec pick in w-cycle; hence assume $able access for
2113
//         spec pick and kill pkt vld in w2 if non_l2bnk_mx0=1 (non$ access)
2114
 
2115
wire  [2:0]  ld1_l2bnk_addr_mx ;
2116
assign  ld1_l2bnk_addr_mx[2:0]  =  ld1_pkt_vld_unmasked  ? ld1_l2bnk_addr[2:0] :
2117
                                           {1'b0,ldst_va_mx1[7:6]} ;
2118
 
2119
//assign  ld1_l2bnk_addr_mx[2:0]  =  (ld1_inst_vld_unflushed  & lsu_inst_vld_tmp) ? 
2120
//                                         {1'b0,ldst_va_mx1[7:6]} : 
2121
//                                         //{non_l2bnk_mx1,ldst_va_mx1[7:6]} : 
2122
//                                              ld1_l2bnk_addr[2:0] ;
2123
 
2124
//7/21/03: timing fix - non_l2bnk_mx0 (uses tlb_pgnum_g[39:37] which arrives in qctl1 ~400ps)
2125
//         this will cause timing paths in spec pick in w-cycle; hence assume $able access for
2126
//         spec pick and kill pkt vld in w2
2127 113 albert.wat
dff_s #(1) ff_non_l2bnk_mx1_d1 (
2128 95 fafa1971
        .din    (non_l2bnk_mx1),
2129
        .q      (non_l2bnk_mx1_d1),
2130
        .clk  (clk),
2131 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2132 95 fafa1971
        );
2133
 
2134
//bug2705 - change ld1_l2bnk_addr[2:0] to ld1_l2bnk_addr_mx[2:0]
2135
assign ld1_l2bnk_dest[0] = ~ld1_l2bnk_addr_mx[2] & ~ld1_l2bnk_addr_mx[1] & ~ld1_l2bnk_addr_mx[0] ;
2136
assign ld1_l2bnk_dest[1] = ~ld1_l2bnk_addr_mx[2] & ~ld1_l2bnk_addr_mx[1] &  ld1_l2bnk_addr_mx[0] ;
2137
assign ld1_l2bnk_dest[2] = ~ld1_l2bnk_addr_mx[2] &  ld1_l2bnk_addr_mx[1] & ~ld1_l2bnk_addr_mx[0] ;
2138
assign ld1_l2bnk_dest[3] = ~ld1_l2bnk_addr_mx[2] &  ld1_l2bnk_addr_mx[1] &  ld1_l2bnk_addr_mx[0] ;
2139
assign ld1_l2bnk_dest[4] =  ld1_l2bnk_addr_mx[2] ;
2140
 
2141
 
2142
// THREAD2 LOAD PCX REQUEST CONTROL
2143
 
2144
wire    ld2_l2cache_rq_kill ;
2145
assign  ld2_l2cache_rq_kill =
2146
        ld2_inst_vld_w2 & ((ld_stb_full_raw_w2 & ~dbl_force_l2access_w2) | perr_ld_rq_kill_w2) ;
2147
                                                // full-raw which looks like partial
2148
assign  ld2_ldbl_rq_w2 =
2149
                ((ld_stb_full_raw_w2 & dbl_force_l2access_w2) | ld_stb_partial_raw_w2)
2150
                        & ~atomic_w2 & ~perr_ld_rq_kill_w2 & ~(asi_internal_w2 & alt_space_w2) &
2151
                        ld2_inst_vld_w2 ;
2152
//assign        ld2_l2cache_rq_kill = ld2_inst_vld_w2 & ld_stb_full_raw_w2 & ~dbl_force_l2access_w2 ;
2153
//assign        ld2_ldbl_rq_w2 = ld_stb_full_raw_w2 & dbl_force_l2access_w2 & ~atomic_w2 & ld2_inst_vld_w2 ;
2154
 
2155
assign ld2_vld_reset =
2156
  (reset | (ld2_pcx_rq_sel_d2 & ~(pcx_req_squash_d1 | ld2_inst_vld_g | bld_annul_d1[2] | dtag_perr_pkt2_vld_d1[2]))) |
2157
  ld2_l2cache_rq_kill ;
2158
  //(reset | (ld2_pcx_rq_sel_d2 & ~(pcx_req_squash_d1 | ld2_inst_vld_g | bld_annul_d1[2]))) | // bug2877
2159
  //(reset | (ld2_pcx_rq_sel_d1 & ~(pcx_req_squash | ld2_inst_vld_g | bld_annul[2]))) ;
2160
 
2161
wire  ld2_l2cache_rq_g;
2162
 
2163
assign ld2_l2cache_rq_g =
2164
        (((lsu_ld_miss_g & ~ldxa_internal))
2165
        //((lsu_ld_hit_g | lsu_ld_miss_g) & (ld_stb_partial_raw_g))) // ldst_dbl always rqs
2166
        & ~atomic_g & ld2_inst_vld_g )
2167
        | pref_rq_vld2_g ;
2168
 
2169
assign ld2_l2cache_rq = ld2_l2cache_rq_g | ld2_ldbl_rq_w2 ;
2170
 
2171
 
2172
// ld valid
2173
wire pref_rq_vld2;
2174 113 albert.wat
dffre_s #(2) ld2_vld (
2175 95 fafa1971
        .din    ({ld2_l2cache_rq, pref_rq_vld2_mx}),
2176
        .q      ({ld2_pkt_vld_unmasked, pref_rq_vld2} ),
2177
  .rst  (ld2_vld_reset),  .en (ld2_l2cache_rq),
2178
        .clk  (clk),
2179 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2180 95 fafa1971
        );
2181
 
2182
// bug2705 - speculative pick in w-cycle - begin
2183
wire    ld2_spec_vld_g ;
2184
assign  ld2_spec_vld_g  =  ld2_inst_vld_unflushed & lsu_inst_vld_tmp & ~dbl_force_l2access_g & tlb_cam_hit_g  &
2185
                           ~atomic_or_ldxa_internal_rq_g &
2186
                           ~(ld0_pkt_vld_unmasked | ld1_pkt_vld_unmasked | ld3_pkt_vld_unmasked);
2187
//assign  ld2_spec_vld_g  =  ld2_inst_vld_unflushed & lsu_inst_vld_tmp & ~dbl_force_l2access_g & tlb_cam_hit_g ;
2188
 
2189 113 albert.wat
dff_s #(1) ff_ld2_spec_pick_vld_w2 (
2190 95 fafa1971
        .din    (ld2_spec_pick_vld_g),
2191
        .q      (ld2_spec_pick_vld_w2),
2192
        .clk  (clk),
2193 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2194 95 fafa1971
        );
2195
 
2196
// kill packet valid if spec req is picked in w and stb hits in w2
2197
wire    ld2_pkt_vld_tmp ;
2198
assign lsu_ld2_spec_vld_kill_w2  =  ld2_spec_pick_vld_w2 & (~ld2_l2cache_rq_w2 | ld2_l2cache_rq_kill | ld2_ldbl_rq_w2 | non_l2bnk_mx2_d1) ;
2199
 
2200
assign  ld2_pkt_vld_tmp = ld2_pkt_vld_unmasked & ~(ld2_pcx_rq_sel_d1 | ld2_pcx_rq_sel_d2) &
2201
                      ~(ld2_l2cache_rq_kill | ld2_ldbl_rq_w2) &
2202
                      ~(pref_rq_vld2 & lsu_no_spc_pref[2]) ;
2203
 
2204
assign  ld2_pkt_vld = ld2_pkt_vld_tmp | ld2_spec_vld_g ;
2205
// bug2705 - speculative pick in w-cycle - end
2206
 
2207
//assign  ld2_pkt_vld = ld2_pkt_vld_unmasked & ~ld2_pcx_rq_sel_d1 ; 
2208
 
2209
 
2210
assign  ld2_fill_reset = reset | (lsu_dfq_ld_vld & lsu_dcfill_active_e & dfq_byp_sel[2]) ;
2211
 
2212
wire  ld2_l2cache_rq_g_tmp;
2213
wire  ld2_l2cache_rq_w2_tmp;
2214
 
2215
assign ld2_l2cache_rq_g_tmp  =  ld2_l2cache_rq_g & ~pref_inst_g ;
2216
 
2217 113 albert.wat
dff_s #(1) ff_ld2_l2cache_rq_w2 (
2218 95 fafa1971
         .din    (ld2_l2cache_rq_g_tmp),
2219
         .q      (ld2_l2cache_rq_w2_tmp),
2220
         .clk  (clk),
2221 113 albert.wat
         .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2222 95 fafa1971
         );
2223
 
2224
//wire ld2_unfilled_en ;
2225
//assign        ld2_unfilled_en = ld2_l2cache_rq & ~pref_inst_g ;
2226
wire ld2_unfilled_wy_en ;
2227
assign  ld2_unfilled_wy_en = ld2_l2cache_rq_w2_tmp | ld2_ldbl_rq_w2 ;
2228
 
2229
wire  ld2_l2cache_rq_tmp;
2230
assign ld2_l2cache_rq_tmp  = ld2_unfilled_wy_en & ~ld2_l2cache_rq_kill;
2231
 
2232
// ld valid until fill occur.
2233 113 albert.wat
dffre_s  #(1) ld2out_state (
2234 95 fafa1971
        //.din    (ld2_l2cache_rq),
2235
        .din    (ld2_l2cache_rq_tmp),
2236
        .q      (ld2_unfilled_tmp),
2237
        .rst    (ld2_fill_reset_d2),  .en     (ld2_unfilled_wy_en),
2238
        .clk    (clk),
2239 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2240 95 fafa1971
        );
2241 113 albert.wat
dffre_s  #(2) ld2out_state_way (
2242 95 fafa1971
        .din    (lsu_lmq_pkt_way_w2[1:0]),
2243
        .q      (ld2_unfilled_wy[1:0]),
2244
        .rst    (ld2_fill_reset_d2),  .en     (ld2_unfilled_wy_en),
2245
        .clk    (clk),
2246 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2247 95 fafa1971
        );
2248
 
2249
 
2250
assign  ld2_fill_reset_d2 = ld2_fill_reset_d2_tmp | ld2_l2cache_rq_kill ;
2251
//assign        ld2_unfilled = ld2_unfilled_tmp & ~ld2_l2cache_rq_kill ;
2252
assign  ld2_unfilled = ld2_unfilled_tmp ;
2253
 
2254
// ld l2bank address
2255 113 albert.wat
dffe_s  #(3) ld2_l2bnka (
2256 95 fafa1971
        .din    ({non_l2bnk_mx2,ldst_va_mx2[7:6]}),
2257
        .q      (ld2_l2bnk_addr[2:0]),
2258
  .en (ld2_l2cache_rq),
2259
        .clk  (clk),
2260 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2261 95 fafa1971
        );
2262
 
2263
//bug2705 - add byp for address to be available in w-cycle
2264
//7/21/03: timing fix - non_l2bnk_mx0 (uses tlb_pgnum_g[39:37] which arrives in qctl1 ~400ps)
2265
//         this will cause timing paths in spec pick in w-cycle; hence assume $able access for
2266
//         spec pick and kill pkt vld in w2 if non_l2bnk_mx0=1 (non$ access)
2267
 
2268
wire  [2:0]  ld2_l2bnk_addr_mx ;
2269
assign  ld2_l2bnk_addr_mx[2:0]  =  ld2_pkt_vld_unmasked ? ld2_l2bnk_addr[2:0] :
2270
                                        {1'b0,ldst_va_mx2[7:6]} ;
2271
 
2272
//assign  ld2_l2bnk_addr_mx[2:0]  =  (ld2_inst_vld_unflushed  & lsu_inst_vld_tmp) ? 
2273
//                                      {1'b0,ldst_va_mx2[7:6]} : 
2274
//                                      //{non_l2bnk_mx2,ldst_va_mx2[7:6]} : 
2275
//                                              ld2_l2bnk_addr[2:0] ;
2276
 
2277
//7/21/03: timing fix - non_l2bnk_mx0 (uses tlb_pgnum_g[39:37] which arrives in qctl1 ~400ps)
2278
//         this will cause timing paths in spec pick in w-cycle; hence assume $able access for
2279
//         spec pick and kill pkt vld in w2
2280 113 albert.wat
dff_s #(1) ff_non_l2bnk_mx2_d1 (
2281 95 fafa1971
        .din    (non_l2bnk_mx2),
2282
        .q      (non_l2bnk_mx2_d1),
2283
        .clk  (clk),
2284 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2285 95 fafa1971
        );
2286
 
2287
//bug2705 - change ld2_l2bnk_addr[2:0] to ld2_l2bnk_addr_mx[2:0]
2288
assign ld2_l2bnk_dest[0] = ~ld2_l2bnk_addr_mx[2] & ~ld2_l2bnk_addr_mx[1] & ~ld2_l2bnk_addr_mx[0] ;
2289
assign ld2_l2bnk_dest[1] = ~ld2_l2bnk_addr_mx[2] & ~ld2_l2bnk_addr_mx[1] &  ld2_l2bnk_addr_mx[0] ;
2290
assign ld2_l2bnk_dest[2] = ~ld2_l2bnk_addr_mx[2] &  ld2_l2bnk_addr_mx[1] & ~ld2_l2bnk_addr_mx[0] ;
2291
assign ld2_l2bnk_dest[3] = ~ld2_l2bnk_addr_mx[2] &  ld2_l2bnk_addr_mx[1] &  ld2_l2bnk_addr_mx[0] ;
2292
assign ld2_l2bnk_dest[4] =  ld2_l2bnk_addr_mx[2] ;
2293
 
2294
// THREAD3 LOAD PCX REQUEST CONTROL
2295
 
2296
wire    ld3_l2cache_rq_kill ;
2297
assign  ld3_l2cache_rq_kill =
2298
        ld3_inst_vld_w2 & ((ld_stb_full_raw_w2 & ~dbl_force_l2access_w2) | perr_ld_rq_kill_w2) ;
2299
                                                // full-raw which looks like partial
2300
assign  ld3_ldbl_rq_w2 =
2301
                ((ld_stb_full_raw_w2 & dbl_force_l2access_w2) | ld_stb_partial_raw_w2)
2302
                        & ~atomic_w2 & ~perr_ld_rq_kill_w2 & ~(asi_internal_w2 & alt_space_w2) &
2303
                        ld3_inst_vld_w2 ;
2304
//assign        ld3_l2cache_rq_kill = ld3_inst_vld_w2 & ld_stb_full_raw_w2 & ~dbl_force_l2access_w2 ;
2305
//assign        ld3_ldbl_rq_w2 = ld_stb_full_raw_w2 & dbl_force_l2access_w2 & ~atomic_w2 & ld3_inst_vld_w2 ;
2306
 
2307
assign ld3_vld_reset =
2308
  (reset | (ld3_pcx_rq_sel_d2 & ~(pcx_req_squash_d1 | ld3_inst_vld_g | bld_annul_d1[3] | dtag_perr_pkt2_vld_d1[3]))) |
2309
  ld3_l2cache_rq_kill ;
2310
  //(reset | (ld3_pcx_rq_sel_d2 & ~(pcx_req_squash_d1 | ld3_inst_vld_g | bld_annul_d1[3]))) | // bug 2877
2311
  //(reset | (ld3_pcx_rq_sel_d1 & ~(pcx_req_squash | ld3_inst_vld_g | bld_annul[3]))) ;
2312
 
2313
wire  ld3_l2cache_rq_g;
2314
assign ld3_l2cache_rq_g =
2315
        (((lsu_ld_miss_g & ~ldxa_internal))
2316
        //((lsu_ld_hit_g | lsu_ld_miss_g) & (ld_stb_partial_raw_g))) // ldst_dbl always rqs
2317
        & ~atomic_g & ld3_inst_vld_g)
2318
        | pref_rq_vld3_g ;
2319
 
2320
assign  ld3_l2cache_rq =  ld3_l2cache_rq_g | ld3_ldbl_rq_w2 ;
2321
 
2322
 
2323
// ld valid
2324
wire pref_rq_vld3;
2325 113 albert.wat
dffre_s  #(2) ld3_vld (
2326 95 fafa1971
        .din    ({ld3_l2cache_rq, pref_rq_vld3_mx} ),
2327
        .q      ({ld3_pkt_vld_unmasked, pref_rq_vld3}),
2328
  .rst  (ld3_vld_reset),  .en (ld3_l2cache_rq),
2329
        .clk  (clk),
2330 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2331 95 fafa1971
        );
2332
 
2333
// bug2705 - speculative pick in w-cycle - begin
2334
wire    ld3_spec_vld_g ;
2335
assign  ld3_spec_vld_g  =  ld3_inst_vld_unflushed & lsu_inst_vld_tmp & ~dbl_force_l2access_g & tlb_cam_hit_g  &
2336
                           ~atomic_or_ldxa_internal_rq_g &
2337
                           ~(ld0_pkt_vld_unmasked | ld1_pkt_vld_unmasked | ld2_pkt_vld_unmasked);
2338
//assign  ld3_spec_vld_g  =  ld3_inst_vld_unflushed & lsu_inst_vld_tmp & ~dbl_force_l2access_g & tlb_cam_hit_g ;
2339
 
2340
 
2341 113 albert.wat
dff_s #(1) ff_ld3_spec_pick_vld_w2 (
2342 95 fafa1971
        .din    (ld3_spec_pick_vld_g),
2343
        .q      (ld3_spec_pick_vld_w2),
2344
        .clk  (clk),
2345 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2346 95 fafa1971
        );
2347
 
2348
// kill packet valid if spec req is picked in w and stb hits in w2
2349
wire    ld3_pkt_vld_tmp ;
2350
assign lsu_ld3_spec_vld_kill_w2  =  ld3_spec_pick_vld_w2 & (~ld3_l2cache_rq_w2 | ld3_l2cache_rq_kill | ld3_ldbl_rq_w2 | non_l2bnk_mx3_d1) ;
2351
 
2352
assign  ld3_pkt_vld_tmp = ld3_pkt_vld_unmasked & ~(ld3_pcx_rq_sel_d1 | ld3_pcx_rq_sel_d2) &
2353
                      ~(ld3_l2cache_rq_kill | ld3_ldbl_rq_w2) &
2354
                      ~(pref_rq_vld3 & lsu_no_spc_pref[3]) ;
2355
 
2356
assign  ld3_pkt_vld = ld3_pkt_vld_tmp | ld3_spec_vld_g ;
2357
// bug2705 - speculative pick in w-cycle - end
2358
 
2359
//assign  ld3_pkt_vld = ld3_pkt_vld_unmasked & ~ld3_pcx_rq_sel_d1 ; 
2360
 
2361
assign  ld3_fill_reset = reset | (lsu_dfq_ld_vld & lsu_dcfill_active_e & dfq_byp_sel[3]) ;
2362
 
2363
wire  ld3_l2cache_rq_g_tmp;
2364
wire  ld3_l2cache_rq_w2_tmp;
2365
 
2366
assign ld3_l2cache_rq_g_tmp  =  ld3_l2cache_rq_g & ~pref_inst_g ;
2367
 
2368 113 albert.wat
dff_s #(1) ff_ld3_l2cache_rq_w2 (
2369 95 fafa1971
         .din    (ld3_l2cache_rq_g_tmp),
2370
         .q      (ld3_l2cache_rq_w2_tmp),
2371
         .clk  (clk),
2372 113 albert.wat
         .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2373 95 fafa1971
         );
2374
 
2375
//wire ld3_unfilled_en ;
2376
//assign        ld3_unfilled_en = ld3_l2cache_rq & ~pref_inst_g ;
2377
wire ld3_unfilled_wy_en ;
2378
assign  ld3_unfilled_wy_en = ld3_l2cache_rq_w2_tmp | ld3_ldbl_rq_w2 ;
2379
 
2380
wire  ld3_l2cache_rq_tmp;
2381
assign ld3_l2cache_rq_tmp  = ld3_unfilled_wy_en & ~ld3_l2cache_rq_kill;
2382
 
2383
// ld valid until fill occur.
2384 113 albert.wat
dffre_s #(1)  ld3out_state (
2385 95 fafa1971
        //.din    (ld3_l2cache_rq),
2386
        .din    (ld3_l2cache_rq_tmp),
2387
        .q      (ld3_unfilled_tmp),
2388
        .rst    (ld3_fill_reset_d2),  .en     (ld3_unfilled_wy_en),
2389
        .clk    (clk),
2390 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2391 95 fafa1971
        );
2392 113 albert.wat
dffre_s #(2)  ld3out_state_way (
2393 95 fafa1971
        .din    (lsu_lmq_pkt_way_w2[1:0]),
2394
        .q      (ld3_unfilled_wy[1:0]),
2395
        .rst    (ld3_fill_reset_d2),  .en     (ld3_unfilled_wy_en),
2396
        .clk    (clk),
2397 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2398 95 fafa1971
        );
2399
 
2400
 
2401
assign  ld3_fill_reset_d2 = ld3_fill_reset_d2_tmp | ld3_l2cache_rq_kill ;
2402
//assign        ld3_unfilled = ld3_unfilled_tmp & ~ld3_l2cache_rq_kill ;
2403
assign  ld3_unfilled = ld3_unfilled_tmp;
2404
 
2405
// ld l2bank address
2406 113 albert.wat
dffe_s  #(3) ld3_l2bnka (
2407 95 fafa1971
        .din    ({non_l2bnk_mx3,ldst_va_mx3[7:6]}),
2408
        .q      (ld3_l2bnk_addr[2:0]),
2409
  .en (ld3_l2cache_rq),
2410
        .clk  (clk),
2411 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2412 95 fafa1971
        );
2413
 
2414
//bug2705 - add byp for address to be available in w-cycle
2415
//7/21/03: timing fix - non_l2bnk_mx0 (uses tlb_pgnum_g[39:37] which arrives in qctl1 ~400ps)
2416
//         this will cause timing paths in spec pick in w-cycle; hence assume $able access for
2417
//         spec pick and kill pkt vld in w2 if non_l2bnk_mx0=1 (non$ access)
2418
 
2419
wire  [2:0]  ld3_l2bnk_addr_mx ;
2420
assign  ld3_l2bnk_addr_mx[2:0]  =  ld3_pkt_vld_unmasked ? ld3_l2bnk_addr[2:0] :
2421
                                        {1'b0,ldst_va_mx3[7:6]} ;
2422
 
2423
//assign  ld3_l2bnk_addr_mx[2:0]  =  (ld3_inst_vld_unflushed  & lsu_inst_vld_tmp) ? 
2424
//                                      {1'b0,ldst_va_mx3[7:6]} : 
2425
//                                      //{non_l2bnk_mx3,ldst_va_mx3[7:6]} : 
2426
//                                              ld3_l2bnk_addr[2:0] ;
2427
 
2428
//7/21/03: timing fix - non_l2bnk_mx0 (uses tlb_pgnum_g[39:37] which arrives in qctl1 ~400ps)
2429
//         this will cause timing paths in spec pick in w-cycle; hence assume $able access for
2430
//         spec pick and kill pkt vld in w2
2431 113 albert.wat
dff_s #(1) ff_non_l2bnk_mx3_d1 (
2432 95 fafa1971
        .din    (non_l2bnk_mx3),
2433
        .q      (non_l2bnk_mx3_d1),
2434
        .clk  (clk),
2435 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2436 95 fafa1971
        );
2437
 
2438
 
2439
//bug2705 - change ld3_l2bnk_addr[2:0] to ld3_l2bnk_addr_mx[2:0]
2440
assign ld3_l2bnk_dest[0] = ~ld3_l2bnk_addr_mx[2] & ~ld3_l2bnk_addr_mx[1] & ~ld3_l2bnk_addr_mx[0] ;
2441
assign ld3_l2bnk_dest[1] = ~ld3_l2bnk_addr_mx[2] & ~ld3_l2bnk_addr_mx[1] &  ld3_l2bnk_addr_mx[0] ;
2442
assign ld3_l2bnk_dest[2] = ~ld3_l2bnk_addr_mx[2] &  ld3_l2bnk_addr_mx[1] & ~ld3_l2bnk_addr_mx[0] ;
2443
assign ld3_l2bnk_dest[3] = ~ld3_l2bnk_addr_mx[2] &  ld3_l2bnk_addr_mx[1] &  ld3_l2bnk_addr_mx[0] ;
2444
assign ld3_l2bnk_dest[4] =  ld3_l2bnk_addr_mx[2] ;
2445
 
2446
//=================================================================================================
2447
//  LMQ Miscellaneous Control
2448
//=================================================================================================
2449
 
2450 113 albert.wat
dff_s #(1) stgm_cas (
2451 95 fafa1971
        .din    (ifu_lsu_casa_e),
2452
        .q      (casa_m),
2453
        .clk  (clk),
2454 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2455 95 fafa1971
        );
2456
 
2457 113 albert.wat
dff_s  #(1) stgg_cas (
2458 95 fafa1971
        .din    (casa_m),
2459
        .q      (casa_g),
2460
        .clk  (clk),
2461 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2462 95 fafa1971
        );
2463
 
2464
//assign  casa0_g = casa_g & thread0_g ;
2465
//assign  casa1_g = casa_g & thread1_g ;
2466
//assign  casa2_g = casa_g & thread2_g ;
2467
//assign  casa3_g = casa_g & thread3_g ;
2468
 
2469
// PARTIAL RAW BYPASSING.
2470
 
2471
// Partial raw of load in stb. Even if the load hits in the dcache, it must follow
2472
// the st to the pcx, obtain merged data to bypass to the pipeline. This load will 
2473
// also fill the dcache. i.e., once the store is received it looks like a normal load.
2474
 
2475
// This path is also used for 2nd cas pkt. rs1(addr) and rs2(cmp data) are in 1st
2476
// pkt which is written to stb. rd(swap value) is written to lmq as 2nd pkt. The
2477
// 2nd pkt will wait in the lmq until the 1st pkt is sent.
2478
 
2479
// *** Atomics need to switch out the thread ***
2480
 
2481
// THREAD0
2482
 
2483
// timing fix: 9/15/03 - reduce loading on pcx_rq_for_stb[3:0] to stb_clt[0-3]. it had FO2 (stb_ctl,qdp2 - cap=0.5-0.8)
2484
//             move the flop from qdp2 to qctl1
2485
 
2486 113 albert.wat
dff_s #(4)  ff_pcx_rq_for_stb_d1 (
2487 95 fafa1971
        .din    (pcx_rq_for_stb[3:0]),
2488
        .q      (pcx_rq_for_stb_d1[3:0]),
2489
        .clk    (clk),
2490 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2491 95 fafa1971
        );
2492
 
2493 113 albert.wat
dff_s #(4)  srqsel_d1 (
2494 95 fafa1971
        .din    (pcx_rq_for_stb[3:0]),
2495
        //.q      ({st3_pcx_rq_tmp, st2_pcx_rq_tmp,st1_pcx_rq_tmp, st0_pcx_rq_tmp}),
2496
        .q      ({st3_pcx_rq_sel_d1, st2_pcx_rq_sel_d1,st1_pcx_rq_sel_d1, st0_pcx_rq_sel_d1}),
2497
        .clk    (clk),
2498 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2499 95 fafa1971
        );
2500
 
2501 113 albert.wat
dff_s #(4)  srqsel_d2 (
2502 95 fafa1971
        .din      ({st3_pcx_rq_sel_d1, st2_pcx_rq_sel_d1,st1_pcx_rq_sel_d1, st0_pcx_rq_sel_d1}),
2503
        .q      ({st3_pcx_rq_sel_d2, st2_pcx_rq_sel_d2,st1_pcx_rq_sel_d2, st0_pcx_rq_sel_d2}),
2504
        .clk    (clk),
2505 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2506 95 fafa1971
        );
2507
 
2508 113 albert.wat
dff_s #(4)  srqsel_d3 (
2509 95 fafa1971
        .din    ({st3_pcx_rq_sel_d2, st2_pcx_rq_sel_d2,st1_pcx_rq_sel_d2, st0_pcx_rq_sel_d2}),
2510
        .q      ({st3_pcx_rq_sel_d3, st2_pcx_rq_sel_d3,st1_pcx_rq_sel_d3, st0_pcx_rq_sel_d3}),
2511
        .clk    (clk),
2512 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2513 95 fafa1971
        );
2514
 
2515
wire    ld0_ldbl_rawp_en_w2 ;
2516
assign  ld0_ldbl_rawp_en_w2 = ld0_ldbl_rq_w2 & ~ld_rawp_st_ced_w2 & ~ld0_rawp_reset ;
2517
 
2518
/*assign        st3_pcx_rq_sel_d1 = st3_pcx_rq_tmp & ~pcx_req_squash ;
2519
assign  st2_pcx_rq_sel_d1 = st2_pcx_rq_tmp & ~pcx_req_squash ;
2520
assign  st1_pcx_rq_sel_d1 = st1_pcx_rq_tmp & ~pcx_req_squash ;
2521
assign  st0_pcx_rq_sel_d1 = st0_pcx_rq_tmp & ~pcx_req_squash ;*/
2522
 
2523
assign ld0_rawp_reset =
2524
        (reset | (st0_pcx_rq_sel_d3 & ~pcx_req_squash_d2 & ld0_rawp_disabled & (ld0_rawp_ackid[2:0] == stb0_crnt_ack_id[2:0])));
2525
        //(reset | (st0_pcx_rq_sel_d2 & ~pcx_req_squash_d1 & ld0_rawp_disabled & (ld0_rawp_ackid[2:0] == stb0_crnt_ack_id[2:0])));
2526
 
2527
// TO BE REMOVED ALONG WITH defines !!!
2528
//wire  ld_rawp_st_ced_g ;
2529
//assign        ld_rawp_st_ced_g = 1'b0 ;
2530
 
2531
// reset needs to be dominant in case ack comes on fly.
2532
// atomics will not set rawp_disabled
2533
assign ld0_rawp_en =
2534
        //(((ld_stb_partial_raw_g) & ~ld_rawp_st_ced_g & ~ld0_rawp_reset)     // partial_raw
2535
        //& ~atomic_g & ld0_inst_vld_g) |          // cas inst - 2nd pkt
2536
        ld0_ldbl_rawp_en_w2 ;
2537
 
2538
// ack-id and wait-for-ack disable - Thread 0
2539 113 albert.wat
dffre_s #(1)  ldrawp0_dis (
2540 95 fafa1971
        .din    (ld0_rawp_en),
2541
        .q      (ld0_rawp_disabled),
2542
        .rst    (ld0_rawp_reset),  .en     (ld0_rawp_en),
2543
        .clk    (clk),
2544 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2545 95 fafa1971
        );
2546
 
2547 113 albert.wat
dffe_s #(3)  ldrawp0_ackid (
2548 95 fafa1971
        .din    (ld_rawp_st_ackid_w2[2:0]),
2549
        .q      (ld0_rawp_ackid[2:0]),
2550
        .en     (ld0_inst_vld_w2),
2551
        .clk    (clk),
2552 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2553 95 fafa1971
        );
2554
 
2555
// THREAD1
2556
 
2557
wire    ld1_ldbl_rawp_en_w2 ;
2558
assign  ld1_ldbl_rawp_en_w2 = ld1_ldbl_rq_w2 & ~ld_rawp_st_ced_w2 & ~ld1_rawp_reset ;
2559
 
2560
// 1st st ack for st-quad will not cause ack.
2561
 
2562
assign ld1_rawp_reset =
2563
        (reset | (st1_pcx_rq_sel_d3 & ~pcx_req_squash_d2 & ld1_rawp_disabled &
2564
        //(reset | (st1_pcx_rq_sel_d2 & ~pcx_req_squash_d1 & ld1_rawp_disabled & 
2565
                        (ld1_rawp_ackid[2:0] == stb1_crnt_ack_id[2:0])));
2566
 
2567
// reset needs to be dominant in case ack comes on fly.
2568
// atomics will not set rawp_disabled
2569
assign ld1_rawp_en =
2570
        //(((ld_stb_partial_raw_g) & ~ld_rawp_st_ced_g & ~ld1_rawp_reset) // partial raw
2571
        //(((ld_stb_partial_raw_g | (ld_stb_full_raw_g & ldst_dbl_g)) & ~ld_rawp_st_ced_g & ~ld1_rawp_reset) // partial raw
2572
        //& ~atomic_g  & ld1_inst_vld_g)  |                // cas inst - 2nd pkt
2573
        ld1_ldbl_rawp_en_w2 ;
2574
 
2575
// ack-id and wait-for-ack disable - Thread 0
2576 113 albert.wat
dffre_s #(1)  ldrawp1_dis (
2577 95 fafa1971
        .din    (ld1_rawp_en),
2578
        .q      (ld1_rawp_disabled),
2579
        .rst    (ld1_rawp_reset),  .en     (ld1_rawp_en),
2580
        .clk    (clk),
2581 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2582 95 fafa1971
        );
2583
 
2584 113 albert.wat
dffe_s #(3)  ldrawp1_ackid (
2585 95 fafa1971
        .din    (ld_rawp_st_ackid_w2[2:0]),
2586
        .q      (ld1_rawp_ackid[2:0]),
2587
        .en     (ld1_inst_vld_w2),
2588
        .clk    (clk),
2589 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2590 95 fafa1971
        );
2591
 
2592
// THREAD2
2593
 
2594
wire    ld2_ldbl_rawp_en_w2 ;
2595
assign  ld2_ldbl_rawp_en_w2 = ld2_ldbl_rq_w2 & ~ld_rawp_st_ced_w2 & ~ld2_rawp_reset ;
2596
 
2597
assign ld2_rawp_reset =
2598
        (reset | (st2_pcx_rq_sel_d3 & ~pcx_req_squash_d2 & ld2_rawp_disabled &
2599
        //(reset | (st2_pcx_rq_sel_d2 & ~pcx_req_squash_d1 & ld2_rawp_disabled & 
2600
                        (ld2_rawp_ackid[2:0] == stb2_crnt_ack_id[2:0])));
2601
 
2602
// reset needs to be dominant in case ack comes on fly.
2603
// atomics will not set rawp_disabled
2604
assign ld2_rawp_en =
2605
        //(((ld_stb_partial_raw_g) & ~ld_rawp_st_ced_g & ~ld2_rawp_reset) // partial raw
2606
        //& ~atomic_g & ld2_inst_vld_g) |          // cas inst - 2nd pkt
2607
        ld2_ldbl_rawp_en_w2 ;
2608
 
2609
// ack-id and wait-for-ack disable - Thread 0
2610 113 albert.wat
dffre_s #(1)  ldrawp2_dis (
2611 95 fafa1971
        .din    (ld2_rawp_en),
2612
        .q      (ld2_rawp_disabled),
2613
        .rst    (ld2_rawp_reset),  .en     (ld2_rawp_en),
2614
        .clk    (clk),
2615 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2616 95 fafa1971
        );
2617
 
2618 113 albert.wat
dffe_s #(3)  ldrawp2_ackid (
2619 95 fafa1971
        .din    (ld_rawp_st_ackid_w2[2:0]),
2620
        .q      (ld2_rawp_ackid[2:0]),
2621
        .en     (ld2_inst_vld_w2),
2622
        .clk    (clk),
2623 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2624 95 fafa1971
        );
2625
 
2626
// THREAD3
2627
 
2628
wire    ld3_ldbl_rawp_en_w2 ;
2629
assign  ld3_ldbl_rawp_en_w2 = ld3_ldbl_rq_w2 & ~ld_rawp_st_ced_w2 & ~ld3_rawp_reset ;
2630
 
2631
assign ld3_rawp_reset =
2632
        (reset | (st3_pcx_rq_sel_d3 & ~pcx_req_squash_d2 & ld3_rawp_disabled &
2633
        //(reset | (st3_pcx_rq_sel_d2 & ~pcx_req_squash_d1 & ld3_rawp_disabled & 
2634
                                (ld3_rawp_ackid[2:0] == stb3_crnt_ack_id[2:0])));
2635
 
2636
// reset needs to be dominant in case ack comes on fly.
2637
// atomics will not set rawp_disabled
2638
assign ld3_rawp_en =
2639
        //(((ld_stb_partial_raw_g) & ~ld_rawp_st_ced_g & ~ld3_rawp_reset) // partial raw
2640
        //& ~atomic_g & ld3_inst_vld_g) |          // cas inst - 2nd pkt
2641
        ld3_ldbl_rawp_en_w2 ;
2642
 
2643
// ack-id and wait-for-ack disable - Thread 0
2644 113 albert.wat
dffre_s #(1)  ldrawp3_dis (
2645 95 fafa1971
        .din    (ld3_rawp_en),
2646
        .q      (ld3_rawp_disabled),
2647
        .rst    (ld3_rawp_reset),  .en     (ld3_rawp_en),
2648
        .clk    (clk),
2649 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2650 95 fafa1971
        );
2651
 
2652 113 albert.wat
dffe_s #(3)  ldrawp3_ackid (
2653 95 fafa1971
        .din    (ld_rawp_st_ackid_w2[2:0]),
2654
        .q      (ld3_rawp_ackid[2:0]),
2655
        .en     (ld3_inst_vld_w2),
2656
        .clk    (clk),
2657 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2658 95 fafa1971
        );
2659
 
2660
 
2661
 
2662
//=================================================================================================
2663
//  INTERRUPT PCX PKT REQ CTL
2664
//=================================================================================================
2665
 
2666
wire    intrpt_pcx_rq_sel_d2 ;
2667
wire    intrpt_vld_reset;
2668
wire    intrpt_vld_en ;
2669
wire  [3:0] intrpt_thread ;
2670
wire    intrpt_clr ;
2671
 
2672
 
2673
assign  lsu_tlu_pcxpkt_ack = intrpt_pcx_rq_sel_d2 & ~pcx_req_squash_d1 ;
2674
 
2675
assign intrpt_vld_reset =
2676
        reset | lsu_tlu_pcxpkt_ack ;
2677
        //reset | (intrpt_pcx_rq_sel_d1 & ~pcx_req_squash);
2678
wire    intrpt_pkt_vld_unmasked ;
2679
// assumption is that pkt vld cannot be turned around in same cycle
2680
assign intrpt_vld_en = ~intrpt_pkt_vld_unmasked ;
2681
//assign intrpt_vld_en = ~lsu_intrpt_pkt_vld ;
2682
 
2683 113 albert.wat
dff_s #(1) intpkt_stgd2 (
2684 95 fafa1971
        .din    (intrpt_pcx_rq_sel_d1),
2685
        .q      (intrpt_pcx_rq_sel_d2),
2686
        .clk    (clk),
2687 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2688 95 fafa1971
        );
2689
 
2690
// intrpt valid
2691 113 albert.wat
dffre_s  intrpt_vld (
2692 95 fafa1971
        .din    (tlu_lsu_pcxpkt_vld),
2693
        .q      (intrpt_pkt_vld_unmasked),
2694
        .rst    (intrpt_vld_reset),     .en     (intrpt_vld_en),
2695
        .clk    (clk),
2696 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2697 95 fafa1971
        );
2698
 
2699
assign  intrpt_thread[0] = ~tlu_lsu_pcxpkt_tid[19] & ~tlu_lsu_pcxpkt_tid[18] ;
2700
assign  intrpt_thread[1] = ~tlu_lsu_pcxpkt_tid[19] &  tlu_lsu_pcxpkt_tid[18] ;
2701
assign  intrpt_thread[2] =  tlu_lsu_pcxpkt_tid[19] & ~tlu_lsu_pcxpkt_tid[18] ;
2702
assign  intrpt_thread[3] =  tlu_lsu_pcxpkt_tid[19] &  tlu_lsu_pcxpkt_tid[18] ;
2703
 
2704
assign  intrpt_clr =
2705
  (intrpt_thread[0] & lsu_stb_empty[0]) |
2706
  (intrpt_thread[1] & lsu_stb_empty[1]) |
2707
  (intrpt_thread[2] & lsu_stb_empty[2]) |
2708
  (intrpt_thread[3] & lsu_stb_empty[3]) ;
2709
 
2710
wire    intrpt_clr_d1 ;
2711 113 albert.wat
dff_s #(1) intclr_stgd1 (
2712 95 fafa1971
        .din    (intrpt_clr),
2713
        .q      (intrpt_clr_d1),
2714
        .clk    (clk),
2715 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2716 95 fafa1971
        );
2717
 
2718
wire    [3:0]    intrpt_cmplt ;
2719
 
2720
assign  intrpt_cmplt[0] = lsu_tlu_pcxpkt_ack & intrpt_thread[0] ;
2721
assign  intrpt_cmplt[1] = lsu_tlu_pcxpkt_ack & intrpt_thread[1] ;
2722
assign  intrpt_cmplt[2] = lsu_tlu_pcxpkt_ack & intrpt_thread[2] ;
2723
assign  intrpt_cmplt[3] = lsu_tlu_pcxpkt_ack & intrpt_thread[3] ;
2724
 
2725 113 albert.wat
dff_s #(4) intrpt_stg (
2726 95 fafa1971
        .din    (intrpt_cmplt[3:0]),
2727
        .q      (lsu_intrpt_cmplt[3:0]),
2728
        .clk    (clk),
2729 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2730 95 fafa1971
        );
2731
 
2732
assign  intrpt_pkt_vld =
2733
intrpt_pkt_vld_unmasked & ~(intrpt_pcx_rq_sel_d1 | intrpt_pcx_rq_sel_d2) & intrpt_clr_d1 ;
2734
 
2735
// ** enabled flop should not be required !!
2736
// intrpt l2bank address
2737
// ?? Can interrupt requests go to io-bridge ??
2738
// Using upper 3b of 5b thread field of INTR_W to address 4 l2 banks
2739 113 albert.wat
dffe_s #(3) intrpt_l2bnka (
2740 95 fafa1971
        .din    ({1'b0,tlu_lsu_pcxpkt_l2baddr[11:10]}),
2741
        .q      (intrpt_l2bnk_addr[2:0]),
2742
        .en     (intrpt_vld_en),
2743
        .clk    (clk),
2744 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2745 95 fafa1971
        );
2746
 
2747
// IO Requests should not go to iobrdge.
2748
assign intrpt_l2bnk_dest[0] =
2749
~intrpt_l2bnk_addr[2] & ~intrpt_l2bnk_addr[1] & ~intrpt_l2bnk_addr[0] ;
2750
assign intrpt_l2bnk_dest[1] =
2751
~intrpt_l2bnk_addr[2] & ~intrpt_l2bnk_addr[1] &  intrpt_l2bnk_addr[0] ;
2752
assign intrpt_l2bnk_dest[2] =
2753
~intrpt_l2bnk_addr[2] & intrpt_l2bnk_addr[1] & ~intrpt_l2bnk_addr[0] ;
2754
assign intrpt_l2bnk_dest[3] =
2755
~intrpt_l2bnk_addr[2] & intrpt_l2bnk_addr[1] &  intrpt_l2bnk_addr[0] ;
2756
assign intrpt_l2bnk_dest[4] = intrpt_l2bnk_addr[2] ;
2757
 
2758
//=================================================================================================
2759
//
2760
// QDP Specific Control
2761
//
2762
//=================================================================================================
2763
 
2764
 
2765
// Qualify with thread.
2766
// Write cas pckt 2 to lmq
2767
// Timing Change : ld0_l2cache_rq guarantees validity.
2768
//assign lmq_enable[0] = lsu_ld_miss_g & thread0_g ;
2769
//assign lmq_enable[0] = ld0_inst_vld_g | pref_vld0_g ;
2770
 
2771
//assign lmq_enable[0] = (ld0_inst_vld_unflushed & lsu_inst_vld_w) | pref_vld0_g ;
2772
//assign lmq_enable[1] = (ld1_inst_vld_unflushed & lsu_inst_vld_w) | pref_vld1_g ;
2773
//assign lmq_enable[2] = (ld2_inst_vld_unflushed & lsu_inst_vld_w) | pref_vld2_g ;
2774
//assign lmq_enable[3] = (ld3_inst_vld_unflushed & lsu_inst_vld_w) | pref_vld3_g ;
2775
 
2776
//bug 2771; timing path - remove flush-pipe, add ifu's flush signal
2777
//assign lmq_enable[0] = (ld0_inst_vld_unflushed | pref_vld0_g) & lsu_inst_vld_w ;
2778
assign lmq_enable[0] = (ld0_inst_vld_unflushed | pref_vld0_g) & lsu_inst_vld_tmp & ~ifu_lsu_flush_w ;
2779
assign lmq_enable[1] = (ld1_inst_vld_unflushed | pref_vld1_g) & lsu_inst_vld_tmp & ~ifu_lsu_flush_w ;
2780
assign lmq_enable[2] = (ld2_inst_vld_unflushed | pref_vld2_g) & lsu_inst_vld_tmp & ~ifu_lsu_flush_w ;
2781
assign lmq_enable[3] = (ld3_inst_vld_unflushed | pref_vld3_g) & lsu_inst_vld_tmp & ~ifu_lsu_flush_w ;
2782
 
2783
// timing fix: 5/19/03: move secondary hit way generation to w2
2784 113 albert.wat
dff_s #(4) ff_lmq_enable_w2 (
2785 95 fafa1971
        .din    (lmq_enable[3:0]),
2786
        .q      (lmq_enable_w2[3:0]),
2787
        .clk    (clk),
2788 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2789 95 fafa1971
        );
2790
 
2791
 
2792
// needs to be 1-hot always.
2793
assign imiss_pcx_mx_sel = imiss_pcx_rq_sel_d1 ;
2794
//assign imiss_pcx_mx_sel[1] = strm_pcx_rq_sel_d1 ;
2795
//assign imiss_pcx_mx_sel[2] = intrpt_pcx_rq_sel_d1 ;
2796
//assign imiss_pcx_mx_sel[3] = fpop_pcx_rq_sel_d1 ;
2797
 
2798
//11/7/03: add rst_tri_en
2799
wire  [2:0]  fwd_int_fp_pcx_mx_sel_tmp ;
2800
 
2801
assign fwd_int_fp_pcx_mx_sel_tmp[0]= ~fwd_int_fp_pcx_mx_sel[1] & ~fwd_int_fp_pcx_mx_sel[2];
2802
assign fwd_int_fp_pcx_mx_sel_tmp[1]=  intrpt_pcx_rq_sel_d1 ;
2803
assign fwd_int_fp_pcx_mx_sel_tmp[2]=  fpop_pcx_rq_sel_d1 | fpop_pcx_rq_sel_d2 ;
2804
 
2805
assign fwd_int_fp_pcx_mx_sel[1:0] = fwd_int_fp_pcx_mx_sel_tmp[1:0] & ~{2{rst_tri_en}} ;
2806
assign fwd_int_fp_pcx_mx_sel[2]   = fwd_int_fp_pcx_mx_sel_tmp[2] | rst_tri_en ;
2807
 
2808
 
2809
//*************************************************************************************************
2810
//                      PCX REQUEST GENERATION (BEGIN)
2811
 
2812
//=================================================================================================
2813
//  PCX REQUEST SELECTION CONTROL
2814
//=================================================================================================
2815
 
2816
// LOAD
2817
// fpops have to squash other rqs in the 2nd cycle also.
2818
//timing fix: 05/20/03 - move mycle_squash_d1 after pick instead of before pick
2819
assign ld0_pcx_rq_vld =
2820
  (|(queue_write[4:0] & ld0_l2bnk_dest[4:0])) &
2821
    ld0_pkt_vld & ~ld0_rawp_disabled;
2822
    //ld0_pkt_vld & ~ld0_rawp_disabled & ~mcycle_squash_d1;
2823
    //ld0_pkt_vld & ~ld0_rawp_disabled & ~st_atom_rq_d1 ;
2824
assign ld1_pcx_rq_vld =
2825
  (|(queue_write[4:0] & ld1_l2bnk_dest[4:0])) &
2826
    ld1_pkt_vld & ~ld1_rawp_disabled;
2827
    //ld1_pkt_vld & ~ld1_rawp_disabled & ~mcycle_squash_d1;
2828
    //ld1_pkt_vld & ~ld1_rawp_disabled & ~st_atom_rq_d1 ;
2829
assign ld2_pcx_rq_vld =
2830
  (|(queue_write[4:0] & ld2_l2bnk_dest[4:0])) &
2831
    ld2_pkt_vld & ~ld2_rawp_disabled ;
2832
    //ld2_pkt_vld & ~ld2_rawp_disabled & ~mcycle_squash_d1;
2833
    //ld2_pkt_vld & ~ld2_rawp_disabled & ~st_atom_rq_d1 ;
2834
assign ld3_pcx_rq_vld =
2835
  (|(queue_write[4:0] & ld3_l2bnk_dest[4:0])) &
2836
    ld3_pkt_vld & ~ld3_rawp_disabled;
2837
    //ld3_pkt_vld & ~ld3_rawp_disabled & ~mcycle_squash_d1;
2838
    //ld3_pkt_vld & ~ld3_rawp_disabled & ~st_atom_rq_d1 ;
2839
 
2840
//assign  ld_pcx_rq_vld = ld0_pcx_rq_vld | ld1_pcx_rq_vld 
2841
//      | ld2_pcx_rq_vld | ld3_pcx_rq_vld ;
2842
 
2843
wire    st0_atomic_pend_d1, st1_atomic_pend_d1, st2_atomic_pend_d1, st3_atomic_pend_d1 ;
2844
 
2845
assign  st0_q_wr[4:0] = st0_atomic_pend_d1 ? pre_qwr[4:0] : queue_write[4:0] ;
2846
assign  st1_q_wr[4:0] = st1_atomic_pend_d1 ? pre_qwr[4:0] : queue_write[4:0] ;
2847
assign  st2_q_wr[4:0] = st2_atomic_pend_d1 ? pre_qwr[4:0] : queue_write[4:0] ;
2848
assign  st3_q_wr[4:0] = st3_atomic_pend_d1 ? pre_qwr[4:0] : queue_write[4:0] ;
2849
 
2850
assign  st0_atom_rq = (st0_pcx_rq_sel & st0_atomic_vld) ;
2851
assign  st1_atom_rq = (st1_pcx_rq_sel & st1_atomic_vld) ;
2852
assign  st2_atom_rq = (st2_pcx_rq_sel & st2_atomic_vld) ;
2853
assign  st3_atom_rq = (st3_pcx_rq_sel & st3_atomic_vld) ;
2854
 
2855 113 albert.wat
dff_s #(8)  avlds_d1 (
2856 95 fafa1971
        .din    ({st0_atom_rq,st1_atom_rq,st2_atom_rq,st3_atom_rq,
2857
    st0_cas_vld,st1_cas_vld,st2_cas_vld,st3_cas_vld}),
2858
        .q      ({st0_atom_rq_d1,st1_atom_rq_d1,st2_atom_rq_d1,st3_atom_rq_d1,
2859
    st0_cas_vld_d1,st1_cas_vld_d1,st2_cas_vld_d1,st3_cas_vld_d1}),
2860
        .clk  (clk),
2861 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2862 95 fafa1971
        );
2863
 
2864 113 albert.wat
dff_s #(8)  avlds_d2 (
2865 95 fafa1971
        .din    ({st0_atom_rq_d1,st1_atom_rq_d1,st2_atom_rq_d1,st3_atom_rq_d1,
2866
    st0_cas_vld_d1,st1_cas_vld_d1,st2_cas_vld_d1,st3_cas_vld_d1}),
2867
        .q      ({st0_atom_rq_d2,st1_atom_rq_d2,st2_atom_rq_d2,st3_atom_rq_d2,
2868
    st0_cas_vld_d2,st1_cas_vld_d2,st2_cas_vld_d2,st3_cas_vld_d2}),
2869
        .clk  (clk),
2870 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2871 95 fafa1971
        );
2872
 
2873
//timing fix : 7/28/03 - move the OR before flop
2874
assign st_atom_rq = st0_atom_rq | st1_atom_rq | st2_atom_rq | st3_atom_rq ;
2875
//assign st_atom_rq_d1 = st0_atom_rq_d1 | st1_atom_rq_d1 | st2_atom_rq_d1 | st3_atom_rq_d1 ; 
2876
 
2877
// timing fix: 7/28/03 - move the OR before flop
2878 113 albert.wat
dff_s #(1)  ff_st_atom_pq (
2879 95 fafa1971
  .din (st_atom_rq),
2880
  .q   (st_atom_rq_d1),
2881
  .clk (clk),
2882 113 albert.wat
  .se  (1'b0), `SIMPLY_RISC_SCANIN, .so ()
2883 95 fafa1971
  );
2884
 
2885
 
2886
assign st_cas_rq_d2 =
2887
  (st0_atom_rq_d2 & st0_cas_vld_d2)  |
2888
  (st1_atom_rq_d2 & st1_cas_vld_d2)  |
2889
  (st2_atom_rq_d2 & st2_cas_vld_d2)  |
2890
  (st3_atom_rq_d2 & st3_cas_vld_d2)  ;
2891
//assign st_quad_rq_d2 = 
2892
//  (st0_atom_rq_d2 & ~st0_cas_vld_d2)  | 
2893
//  (st1_atom_rq_d2 & ~st1_cas_vld_d2)  | 
2894
//  (st2_atom_rq_d2 & ~st2_cas_vld_d2)  | 
2895
//  (st3_atom_rq_d2 & ~st3_cas_vld_d2)  ; 
2896
 
2897
//timing fix: 9/17/03 - move the OR to previous cycle and add flop for spc_pcx_atom_pq
2898
//                      instantiate buf30 for flop output
2899
//assign  spc_pcx_atom_pq = 
2900
//    st_atom_rq_d1 |  
2901
//    fpop_atom_rq_pq ;
2902
 
2903
wire  spc_pcx_atom_w, spc_pcx_atom_pq_tmp ;
2904
assign spc_pcx_atom_w  =  st_atom_rq | fpop_atom_req ;
2905
 
2906 113 albert.wat
dff_s #(1)  ff_spc_pcx_atom_pq (
2907 95 fafa1971
  .din (spc_pcx_atom_w),
2908
  .q   (spc_pcx_atom_pq_tmp),
2909
  .clk (clk),
2910 113 albert.wat
  .se  (1'b0), `SIMPLY_RISC_SCANIN, .so ()
2911 95 fafa1971
  );
2912
 
2913
bw_u1_buf_30x UZfix_spc_pcx_atom_pq_buf1 ( .a(spc_pcx_atom_pq_tmp), .z(spc_pcx_atom_pq) );
2914
bw_u1_buf_30x UZsize_spc_pcx_atom_pq_buf2 ( .a(spc_pcx_atom_pq_tmp), .z(spc_pcx_atom_pq_buf2) );
2915
 
2916
// STORE
2917
// st will wait in pcx bypass until previous st in chain is acked !!!!
2918
//timing fix: 05/20/03 - move mycle_squash_d1 after pick instead of before pick
2919
assign st0_pcx_rq_vld =
2920
  (|(st0_q_wr[4:0] & st0_l2bnk_dest[4:0])) & st0_pkt_vld ;
2921
  //(|(st0_q_wr[4:0] & st0_l2bnk_dest[4:0])) & st0_pkt_vld & ~mcycle_squash_d1;
2922
  //(|(st0_q_wr[4:0] & st0_l2bnk_dest[4:0])) & st0_pkt_vld & ~st_atom_rq_d1 ;
2923
assign st1_pcx_rq_vld =
2924
  (|(st1_q_wr[4:0] & st1_l2bnk_dest[4:0])) & st1_pkt_vld ;
2925
  //(|(st1_q_wr[4:0] & st1_l2bnk_dest[4:0])) & st1_pkt_vld & ~mcycle_squash_d1;
2926
  //(|(st1_q_wr[4:0] & st1_l2bnk_dest[4:0])) & st1_pkt_vld & ~st_atom_rq_d1 ;
2927
assign st2_pcx_rq_vld =
2928
  (|(st2_q_wr[4:0] & st2_l2bnk_dest[4:0])) & st2_pkt_vld ;
2929
  //(|(st2_q_wr[4:0] & st2_l2bnk_dest[4:0])) & st2_pkt_vld & ~mcycle_squash_d1;
2930
  //(|(st2_q_wr[4:0] & st2_l2bnk_dest[4:0])) & st2_pkt_vld & ~st_atom_rq_d1 ;
2931
assign st3_pcx_rq_vld =
2932
  (|(st3_q_wr[4:0] & st3_l2bnk_dest[4:0])) & st3_pkt_vld ;
2933
  //(|(st3_q_wr[4:0] & st3_l2bnk_dest[4:0])) & st3_pkt_vld & ~mcycle_squash_d1;
2934
  //(|(st3_q_wr[4:0] & st3_l2bnk_dest[4:0])) & st3_pkt_vld & ~st_atom_rq_d1 ;
2935
 
2936
// IMISS
2937
// imiss requests will not speculate - ** change !!!
2938
//timing fix: 05/20/03 - move mycle_squash_d1 after pick instead of before pick
2939
assign imiss_pcx_rq_vld =
2940
  (|(queue_write[4:0] & imiss_l2bnk_dest[4:0])) & imiss_pkt_vld ;
2941
  //(|(queue_write[4:0] & imiss_l2bnk_dest[4:0])) & imiss_pkt_vld & ~mcycle_squash_d1;
2942
  //(|((queue_write[4:0] & (sel_qentry0[4:0] | (~sel_qentry0[4:0] & ~spc_pcx_req_update_w2[4:0]))) & imiss_l2bnk_dest[4:0])) & imiss_pkt_vld & ~mcycle_squash_d1;
2943
 
2944
// SPU
2945
//timing fix: 05/20/03 - move mycle_squash_d1 after pick instead of before pick
2946
assign strm_pcx_rq_vld =
2947
  (|(queue_write[4:0] & strm_l2bnk_dest[4:0])) & strm_pkt_vld ;
2948
  //(|(queue_write[4:0] & strm_l2bnk_dest[4:0])) & strm_pkt_vld & ~mcycle_squash_d1;
2949
 
2950
wire lsu_fwdpkt_vld_d1 ;
2951
wire    [4:0]    fwdpkt_dest_d1 ;
2952
// This delay is to compensate for the 1-cycle delay for internal rd/wr.
2953 113 albert.wat
dff_s #(6)  fvld_stgd1 (
2954 95 fafa1971
  .din ({lsu_fwdpkt_vld,lsu_fwdpkt_dest[4:0]}),
2955
  .q   ({lsu_fwdpkt_vld_d1,fwdpkt_dest_d1[4:0]}),
2956
  .clk (clk),
2957 113 albert.wat
  .se  (1'b0), `SIMPLY_RISC_SCANIN, .so ()
2958 95 fafa1971
  );
2959
 
2960
// FWD PKT
2961
//timing fix: 05/20/03 - move mycle_squash_d1 after pick instead of before pick
2962
assign fwdpkt_rq_vld =
2963
  (|(queue_write[4:0] & fwdpkt_dest_d1[4:0])) &
2964
        lsu_fwdpkt_vld_d1 &
2965
        ~(fwdpkt_pcx_rq_sel_d1 | fwdpkt_pcx_rq_sel_d2 |  // screen vld until reset can be sent.
2966
        fwdpkt_pcx_rq_sel_d3) ; // extra cycle since fwdpkt_vld is now flop delayed.
2967
        //~mcycle_squash_d1;
2968
 
2969
// This to reset state. It must thus take into account speculative requests.
2970
assign lsu_fwdpkt_pcx_rq_sel =  fwdpkt_pcx_rq_sel_d2 & ~pcx_req_squash_d1 ;
2971
 
2972
// INTERRUPT
2973
//timing fix: 05/20/03 - move mycle_squash_d1 after pick instead of before pick
2974
assign intrpt_pcx_rq_vld =
2975
  (|(queue_write[4:0] & intrpt_l2bnk_dest[4:0])) & intrpt_pkt_vld ;
2976
  //(|(queue_write[4:0] & intrpt_l2bnk_dest[4:0])) & intrpt_pkt_vld & ~mcycle_squash_d1;
2977
 
2978
// FFU
2979
// fpop will never get squashed.
2980
// ** Should be able to simplify equation.
2981
//timing fix: 05/20/03 - move mycle_squash_d1 after pick instead of before pick
2982
//for fpop pre_qwr is good enough to qual 'cos there are no ld/st atomics to IOB
2983
wire [4:0]  fpop_q_wr ;
2984
assign fpop_pcx_rq_vld =
2985
  //sel_qentry0[4] & fpop_l2bnk_dest[4] & fpop_pkt_vld ;
2986
  //(|(queue_write[4:0] & fpop_l2bnk_dest[4:0])) & 
2987
  //(|(pre_qwr[4:0] & fpop_l2bnk_dest[4:0])) &
2988
  (|(fpop_q_wr[4:0] & fpop_l2bnk_dest[4:0])) &
2989
        // change sel_qentry0[5] to sel_qentry0[4] for fpio merge
2990
      fpop_pkt_vld ;
2991
      //fpop_pkt_vld & ((sel_qentry0[4] & fpop_pkt1) | ~fpop_pkt1) ;
2992
        //~mcycle_squash_d1 ;
2993
 
2994
 
2995
//=================================================================================================
2996
// HIERARCHICAL PICKER FOR PCX REQ GENERATION
2997
//=================================================================================================
2998
 
2999
// 13 requests to choose from :
3000
// - imiss, 4 ld, 4 st, (intrpt,strm,fpop,fwdpkt).
3001
// - 4 categories are thus formed, each with equal weight.
3002
// - As a consequence, imiss has the highest priority (because it is one vs. 4 in others)
3003
// - Fair scheduling thru round-robin is ensured between and within categories.
3004
// - Starvation for 2-cycle b2b ops (cas/fpop) is prevented.
3005
// - strm requests, even though they lie in the misc category, will get good 
3006
// thruput as the other misc requests will be infrequent.
3007
 
3008
// LEVEL ONE - PICK WITHIN CATEGORIES
3009
 
3010
// Note : picker defaults to 1-hot.
3011
 
3012
wire    [3:0]    all_pcx_rq_pick ;
3013
wire    [3:0]    ld_events_raw ;
3014
//wire  [3:0]   ld_events_final ;
3015
wire    ld3_pcx_rq_pick,ld2_pcx_rq_pick,ld1_pcx_rq_pick,ld0_pcx_rq_pick ;
3016
 
3017
//bug6807 - kill load events raw when partial raw is detected.
3018
assign ld_events_raw[0]  =  (ld0_pkt_vld_unmasked & ~ld0_rawp_disabled) | ld0_pcx_rq_sel_d1 | ld0_pcx_rq_sel_d2 ;
3019
assign ld_events_raw[1]  =  (ld1_pkt_vld_unmasked & ~ld1_rawp_disabled) | ld1_pcx_rq_sel_d1 | ld1_pcx_rq_sel_d2 ;
3020
assign ld_events_raw[2]  =  (ld2_pkt_vld_unmasked & ~ld2_rawp_disabled) | ld2_pcx_rq_sel_d1 | ld2_pcx_rq_sel_d2 ;
3021
assign ld_events_raw[3]  =  (ld3_pkt_vld_unmasked & ~ld3_rawp_disabled) | ld3_pcx_rq_sel_d1 | ld3_pcx_rq_sel_d2 ;
3022
 
3023
//bug4814 - change rrobin_picker1 to rrobin_picker2
3024
// Choose one among 4 loads.
3025
//lsu_rrobin_picker1 ld4_rrobin  (
3026
//    .events             ({ld3_pcx_rq_vld,ld2_pcx_rq_vld,
3027
//                  ld1_pcx_rq_vld,ld0_pcx_rq_vld}),
3028
//    .events_raw   ({ld3_pkt_vld_unmasked,ld2_pkt_vld_unmasked,
3029
//                  ld1_pkt_vld_unmasked,ld0_pkt_vld_unmasked}),
3030
//    .pick_one_hot ({ld3_pcx_rq_pick,ld2_pcx_rq_pick,
3031
//                  ld1_pcx_rq_pick,ld0_pcx_rq_pick}),
3032
//    .events_final (ld_events_final[3:0]),
3033
//    .rclk         (rclk),
3034
//    .grst_l       (grst_l),
3035
//    .arst_l       (arst_l),
3036 113 albert.wat
//    `SIMPLY_RISC_SCANIN,
3037 95 fafa1971
//    .se(se),
3038
//    .so()
3039
//  );
3040
 
3041
lsu_rrobin_picker2 ld4_rrobin  (
3042
    .events       ({ld3_pcx_rq_vld,ld2_pcx_rq_vld,ld1_pcx_rq_vld,ld0_pcx_rq_vld}),
3043
    .thread_force (ld_thrd_force_vld[3:0]),
3044
    .pick_one_hot ({ld3_pcx_rq_pick,ld2_pcx_rq_pick,ld1_pcx_rq_pick,ld0_pcx_rq_pick}),
3045
    .events_picked({ld3_pcx_rq_sel,ld2_pcx_rq_sel,ld1_pcx_rq_sel,ld0_pcx_rq_sel}),
3046
    .rclk         (rclk),
3047
    .grst_l       (grst_l),
3048
    .arst_l       (arst_l),
3049 113 albert.wat
    `SIMPLY_RISC_SCANIN,
3050 95 fafa1971
    .se(se),
3051
    .so()
3052
  );
3053
 
3054
 
3055
 
3056
 
3057
//timing fix: 05/20/03 - move mcycle_squash_d1 after pick instead of before pick
3058
//assign        ld3_pcx_rq_sel = ld3_pcx_rq_pick & ld3_pcx_rq_vld & all_pcx_rq_pick[1] ;
3059
//assign        ld2_pcx_rq_sel = ld2_pcx_rq_pick & ld2_pcx_rq_vld & all_pcx_rq_pick[1] ;
3060
//assign        ld1_pcx_rq_sel = ld1_pcx_rq_pick & ld1_pcx_rq_vld & all_pcx_rq_pick[1] ;
3061
//assign        ld0_pcx_rq_sel = ld0_pcx_rq_pick & ld0_pcx_rq_vld & all_pcx_rq_pick[1] ;
3062
//bug2705 - add spec valid qualification
3063
//assign        ld3_pcx_rq_sel = ld3_pcx_rq_pick & ld3_pcx_rq_vld & all_pcx_rq_pick[1] & ~mcycle_squash_d1 ;
3064
//timing fix: 08/06/03 - tag_rdata->gen tag_parity_err->lsu_ld_miss_g arrives @625 in qctl1
3065
//                       cache_way_hit ->lsu_ld_miss_g arrives @525 in qctl1
3066
//                       cache_way_hit ->lsu_way_hit_or arrives @510 in qctl1
3067
//                       625ps + ld?_l2cache_rq_g (130ps) + urq_stgpq flop logic(100ps) (slack=-100ps)
3068
//assign  ld0_spec_pick_vld_g  =   ld0_spec_vld_g & ld0_l2cache_rq_g & ld0_pcx_rq_pick & ld0_pcx_rq_vld & all_pcx_rq_pick[1] & ~mcycle_squash_d1 ;
3069
wire    ld0_nspec_pick_vld ,
3070
        ld1_nspec_pick_vld ,
3071
        ld2_nspec_pick_vld ,
3072
        ld3_nspec_pick_vld ;
3073
 
3074
assign  ld0_spec_pick_vld_g  =   ld0_spec_vld_g & ~lsu_way_hit_or & ld0_pcx_rq_pick & ld0_pcx_rq_vld & all_pcx_rq_pick[1] & ~mcycle_squash_d1 ;
3075
assign  ld0_nspec_pick_vld   =  ~ld0_spec_vld_g &                   ld0_pcx_rq_pick & ld0_pcx_rq_vld & all_pcx_rq_pick[1] & ~mcycle_squash_d1 ;
3076
 
3077
assign  ld1_spec_pick_vld_g  =   ld1_spec_vld_g & ~lsu_way_hit_or & ld1_pcx_rq_pick & ld1_pcx_rq_vld & all_pcx_rq_pick[1] & ~mcycle_squash_d1 ;
3078
assign  ld1_nspec_pick_vld   =  ~ld1_spec_vld_g &                   ld1_pcx_rq_pick & ld1_pcx_rq_vld & all_pcx_rq_pick[1] & ~mcycle_squash_d1 ;
3079
 
3080
assign  ld2_spec_pick_vld_g  =   ld2_spec_vld_g & ~lsu_way_hit_or & ld2_pcx_rq_pick & ld2_pcx_rq_vld & all_pcx_rq_pick[1] & ~mcycle_squash_d1 ;
3081
assign  ld2_nspec_pick_vld   =  ~ld2_spec_vld_g &                   ld2_pcx_rq_pick & ld2_pcx_rq_vld & all_pcx_rq_pick[1] & ~mcycle_squash_d1 ;
3082
 
3083
assign  ld3_spec_pick_vld_g  =   ld3_spec_vld_g & ~lsu_way_hit_or & ld3_pcx_rq_pick & ld3_pcx_rq_vld & all_pcx_rq_pick[1] & ~mcycle_squash_d1 ;
3084
assign  ld3_nspec_pick_vld   =  ~ld3_spec_vld_g &                   ld3_pcx_rq_pick & ld3_pcx_rq_vld & all_pcx_rq_pick[1] & ~mcycle_squash_d1 ;
3085
 
3086
 
3087
assign  ld0_pcx_rq_sel = (ld0_spec_pick_vld_g | ld0_nspec_pick_vld) ;
3088
assign  ld1_pcx_rq_sel = (ld1_spec_pick_vld_g | ld1_nspec_pick_vld) ;
3089
assign  ld2_pcx_rq_sel = (ld2_spec_pick_vld_g | ld2_nspec_pick_vld) ;
3090
assign  ld3_pcx_rq_sel = (ld3_spec_pick_vld_g | ld3_nspec_pick_vld) ;
3091
 
3092
//bug3506: set mask in the level1 pick in w3-cycle if picked by pcx
3093
//assign  ld_events_final[3] = ld3_pcx_rq_sel_d2 & ~pcx_req_squash_d1 ;
3094
//assign  ld_events_final[2] = ld2_pcx_rq_sel_d2 & ~pcx_req_squash_d1 ;
3095
//assign  ld_events_final[1] = ld1_pcx_rq_sel_d2 & ~pcx_req_squash_d1 ;
3096
//assign  ld_events_final[0] = ld0_pcx_rq_sel_d2 & ~pcx_req_squash_d1 ;
3097
 
3098
 
3099
 
3100
wire    st3_pcx_rq_pick,st2_pcx_rq_pick,st1_pcx_rq_pick,st0_pcx_rq_pick ;
3101
 
3102
// Choose one among 4 st.
3103
 
3104
wire   pcx_rq_for_stb_en;
3105
//wire [3:0]  st_events_final ;
3106
wire [3:0]  st_events_raw ;
3107
 
3108
//8/20/03: bug3506 fix is incomplete - vld may not be held until d2 cycle
3109
assign st_events_raw[0]  =  stb0_rd_for_pcx | st0_pcx_rq_sel_d1 | st0_pcx_rq_sel_d2 ;
3110
assign st_events_raw[1]  =  stb1_rd_for_pcx | st1_pcx_rq_sel_d1 | st1_pcx_rq_sel_d2 ;
3111
assign st_events_raw[2]  =  stb2_rd_for_pcx | st2_pcx_rq_sel_d1 | st2_pcx_rq_sel_d2 ;
3112
assign st_events_raw[3]  =  stb3_rd_for_pcx | st3_pcx_rq_sel_d1 | st3_pcx_rq_sel_d2 ;
3113
 
3114
//bug4814 - change rrobin_picker1 to rrobin_picker2
3115
//lsu_rrobin_picker1 st4_rrobin  (
3116
//    .events             ({st3_pcx_rq_vld,st2_pcx_rq_vld,
3117
//                              st1_pcx_rq_vld,st0_pcx_rq_vld}),
3118
//    .events_raw         (st_events_raw[3:0]),
3119
//    .pick_one_hot ({st3_pcx_rq_pick,st2_pcx_rq_pick,
3120
//                              st1_pcx_rq_pick,st0_pcx_rq_pick}),
3121
//    //.en           (pcx_rq_for_stb_en),                                                                
3122
//    .events_final (st_events_final[3:0]),
3123
//    .rclk         (rclk),
3124
//    .grst_l       (grst_l),
3125
//    .arst_l       (arst_l),
3126 113 albert.wat
//    `SIMPLY_RISC_SCANIN,
3127 95 fafa1971
//    .se(se),
3128
//    .so()
3129
//
3130
//  );
3131
 
3132
lsu_rrobin_picker2 st4_rrobin  (
3133
    .events       ({st3_pcx_rq_vld,st2_pcx_rq_vld,st1_pcx_rq_vld,st0_pcx_rq_vld}),
3134
    .thread_force(st_thrd_force_vld[3:0]),
3135
    .pick_one_hot ({st3_pcx_rq_pick,st2_pcx_rq_pick,st1_pcx_rq_pick,st0_pcx_rq_pick}),
3136
 
3137
    .events_picked(pcx_rq_for_stb[3:0]),
3138
    .rclk         (rclk),
3139
    .grst_l       (grst_l),
3140
    .arst_l       (arst_l),
3141 113 albert.wat
    `SIMPLY_RISC_SCANIN,
3142 95 fafa1971
    .se(se),
3143
    .so()
3144
  );
3145
 
3146
 
3147
 
3148
assign lsu_st_pcx_rq_pick[3:0]  =  {st3_pcx_rq_pick,st2_pcx_rq_pick,st1_pcx_rq_pick,st0_pcx_rq_pick};
3149
//timing fix: 9/2/03 - reduce fanout in stb_rwctl for lsu_st_pcx_rq_pick - gen separate signal for
3150
//                     stb_cam_rptr_vld and stb_data_rptr_vld
3151
assign lsu_st_pcx_rq_vld  =  st0_pcx_rq_vld | st1_pcx_rq_vld | st2_pcx_rq_vld | st3_pcx_rq_vld ;
3152
 
3153
//wire        st0_pcx_rq_sel_tmp, st1_pcx_rq_sel_tmp;
3154
//wire        st2_pcx_rq_sel_tmp, st3_pcx_rq_sel_tmp;
3155
 
3156
 
3157
   wire stb_cam_hit_w;
3158
 
3159
//bug3503
3160
assign stb_cam_hit_w  =  stb_cam_hit_bf & lsu_inst_vld_w ;
3161
 
3162 113 albert.wat
dff_s #(1)  stb_cam_hit_stg_w2  (
3163 95 fafa1971
  .din (stb_cam_hit_w),
3164
  .q   (stb_cam_hit_w2),
3165
  .clk (clk),
3166 113 albert.wat
  .se  (1'b0), `SIMPLY_RISC_SCANIN, .so ()
3167 95 fafa1971
  );
3168
 
3169
 
3170
//RAW read STB at W3 (not W2), so stb_cam_hit_w2 isn't critical   
3171
//assign pcx_rq_for_stb_en = ~(|lsu_st_ack_rq_stb[3:0]) &   ~stb_cam_hit_w2 & ~stb_cam_wptr_vld;
3172
//timing fix: 05/20/03 - move mycle_squash_d1 after pick instead of before pick
3173
assign pcx_rq_for_stb_en = ~stb_cam_hit_w2 & ~stb_cam_wr_no_ivld_m & ~mcycle_squash_d1 ;
3174
 
3175
//timing fix : 5/6 - move kill_w2 after store pick
3176
//assign        pcx_rq_for_stb[3] = st3_pcx_rq_pick & st3_pcx_rq_vld & all_pcx_rq_pick[2] & pcx_rq_for_stb_en;
3177
//assign        pcx_rq_for_stb[2] = st2_pcx_rq_pick & st2_pcx_rq_vld & all_pcx_rq_pick[2] & pcx_rq_for_stb_en;
3178
//assign        pcx_rq_for_stb[1] = st1_pcx_rq_pick & st1_pcx_rq_vld & all_pcx_rq_pick[2] & pcx_rq_for_stb_en;
3179
//assign        pcx_rq_for_stb[0] = st0_pcx_rq_pick & st0_pcx_rq_vld & all_pcx_rq_pick[2] & pcx_rq_for_stb_en;
3180
 
3181
//timing fix: 05/20/03 - move mcycle_squash_d1 after pick instead of before pick
3182
//bug4513 - kill pcx_rq_for_stb if atomic request is picked and 2 entries to the l2bank are not available
3183
 
3184
wire  [3:0]  pcx_rq_for_stb_tmp ;
3185
wire   st0_qmon_2entry_avail,st1_qmon_2entry_avail,st2_qmon_2entry_avail,st3_qmon_2entry_avail ;
3186
 
3187
assign  pcx_rq_for_stb_tmp[3] =
3188
        st3_pcx_rq_pick & st3_pcx_rq_vld & all_pcx_rq_pick[2] & pcx_rq_for_stb_en & ~lsu_st_pcx_rq_kill_w2[3] & ~mcycle_squash_d1 ;
3189
        //st3_pcx_rq_pick & st3_pcx_rq_vld & all_pcx_rq_pick[2] & pcx_rq_for_stb_en & ~lsu_st_pcx_rq_kill_w2[3];
3190
 
3191
assign  pcx_rq_for_stb_tmp[2] =
3192
        st2_pcx_rq_pick & st2_pcx_rq_vld & all_pcx_rq_pick[2] & pcx_rq_for_stb_en & ~lsu_st_pcx_rq_kill_w2[2] & ~mcycle_squash_d1 ;
3193
        //st2_pcx_rq_pick & st2_pcx_rq_vld & all_pcx_rq_pick[2] & pcx_rq_for_stb_en & ~lsu_st_pcx_rq_kill_w2[2];
3194
 
3195
assign  pcx_rq_for_stb_tmp[1] =
3196
        st1_pcx_rq_pick & st1_pcx_rq_vld & all_pcx_rq_pick[2] & pcx_rq_for_stb_en & ~lsu_st_pcx_rq_kill_w2[1] & ~mcycle_squash_d1 ;
3197
        //st1_pcx_rq_pick & st1_pcx_rq_vld & all_pcx_rq_pick[2] & pcx_rq_for_stb_en & ~lsu_st_pcx_rq_kill_w2[1];
3198
 
3199
assign  pcx_rq_for_stb_tmp[0] =
3200
        st0_pcx_rq_pick & st0_pcx_rq_vld & all_pcx_rq_pick[2] & pcx_rq_for_stb_en & ~lsu_st_pcx_rq_kill_w2[0] & ~mcycle_squash_d1 ;
3201
        //st0_pcx_rq_pick & st0_pcx_rq_vld & all_pcx_rq_pick[2] & pcx_rq_for_stb_en & ~lsu_st_pcx_rq_kill_w2[0];
3202
 
3203
//bug4513 - kill pcx_rq_for_stb if atomic request is picked and 2 entries to the l2bank are not available
3204
assign  pcx_rq_for_stb[3] = ((st3_atomic_vld & st3_qmon_2entry_avail) | ~st3_atomic_vld) & pcx_rq_for_stb_tmp[3] ;
3205
assign  pcx_rq_for_stb[2] = ((st2_atomic_vld & st2_qmon_2entry_avail) | ~st2_atomic_vld) & pcx_rq_for_stb_tmp[2] ;
3206
assign  pcx_rq_for_stb[1] = ((st1_atomic_vld & st1_qmon_2entry_avail) | ~st1_atomic_vld) & pcx_rq_for_stb_tmp[1] ;
3207
assign  pcx_rq_for_stb[0] = ((st0_atomic_vld & st0_qmon_2entry_avail) | ~st0_atomic_vld) & pcx_rq_for_stb_tmp[0] ;
3208
 
3209
//assign        st3_pcx_rq_sel_tmp = st3_pcx_rq_pick & st3_pcx_rq_vld & all_pcx_rq_pick[2] ;
3210
//assign        st2_pcx_rq_sel_tmp = st2_pcx_rq_pick & st2_pcx_rq_vld & all_pcx_rq_pick[2] ;
3211
//assign        st1_pcx_rq_sel_tmp = st1_pcx_rq_pick & st1_pcx_rq_vld & all_pcx_rq_pick[2] ;
3212
//assign        st0_pcx_rq_sel_tmp = st0_pcx_rq_pick & st0_pcx_rq_vld & all_pcx_rq_pick[2] ;
3213
 
3214
//bug3506: set mask in the level1 pick in w3-cycle if picked by pcx
3215
//assign  st_events_final[3] = st3_pcx_rq_sel_d2 & ~pcx_req_squash_d1 ;
3216
//assign  st_events_final[2] = st2_pcx_rq_sel_d2 & ~pcx_req_squash_d1 ;
3217
//assign  st_events_final[1] = st1_pcx_rq_sel_d2 & ~pcx_req_squash_d1 ;
3218
//assign  st_events_final[0] = st0_pcx_rq_sel_d2 & ~pcx_req_squash_d1 ;
3219
 
3220
 
3221
 
3222
wire    strm_pcx_rq_pick,fpop_pcx_rq_pick,intrpt_pcx_rq_pick,fwdpkt_pcx_rq_pick;
3223
//wire [3:0]  misc_events_final ;
3224
wire [3:0]  misc_events_raw ;
3225
 
3226
//8/20/03: bug3506 fix is incomplete - vld may not be held until d2 cycle
3227
assign  misc_events_raw[0]   =  lsu_fwdpkt_vld_d1 | fwdpkt_pcx_rq_sel_d1 | fwdpkt_pcx_rq_sel_d2 ;
3228
//bug6807 - kill interrupt events raw when store buffer is not empty i.e. interrupt clear=0
3229
assign  misc_events_raw[1]   =  (intrpt_pkt_vld_unmasked & intrpt_clr_d1) | intrpt_pcx_rq_sel_d1 | intrpt_pcx_rq_sel_d2 ;
3230
assign  misc_events_raw[2]   =  fpop_pkt_vld_unmasked | fpop_pcx_rq_sel_d1 | fpop_pcx_rq_sel_d2 ;
3231
assign  misc_events_raw[3]   =  strm_pkt_vld_unmasked | strm_pcx_rq_sel_d1 | strm_pcx_rq_sel_d2 ;
3232
 
3233
 
3234
//bug4814 - change rrobin_picker1 to rrobin_picker2
3235
//lsu_rrobin_picker1 misc4_rrobin  (
3236
//    .events             ({strm_pcx_rq_vld,fpop_pcx_rq_vld,
3237
//                  intrpt_pcx_rq_vld,fwdpkt_rq_vld}),
3238
//    .events_raw   (misc_events_raw[3:0]),
3239
//    .pick_one_hot ({strm_pcx_rq_pick,fpop_pcx_rq_pick,
3240
//                  intrpt_pcx_rq_pick,fwdpkt_pcx_rq_pick}),
3241
//    .events_final (misc_events_final[3:0]),
3242
//    .rclk         (rclk),
3243
//    .grst_l       (grst_l),
3244
//    .arst_l       (arst_l),
3245 113 albert.wat
//    `SIMPLY_RISC_SCANIN,
3246 95 fafa1971
//    .se(se),
3247
//    .so()
3248
//  );
3249
 
3250
lsu_rrobin_picker2 misc4_rrobin  (
3251
    .events       ({strm_pcx_rq_vld,fpop_pcx_rq_vld,intrpt_pcx_rq_vld,fwdpkt_rq_vld}),
3252
    .thread_force(misc_thrd_force_vld[3:0]),
3253
    .pick_one_hot ({strm_pcx_rq_pick,fpop_pcx_rq_pick,intrpt_pcx_rq_pick,fwdpkt_pcx_rq_pick}),
3254
 
3255
    .events_picked({strm_pcx_rq_sel,fpop_pcx_rq_sel,intrpt_pcx_rq_sel,fwdpkt_pcx_rq_sel}),
3256
    .rclk         (rclk),
3257
    .grst_l       (grst_l),
3258
    .arst_l       (arst_l),
3259 113 albert.wat
    `SIMPLY_RISC_SCANIN,
3260 95 fafa1971
    .se(se),
3261
    .so()
3262
  );
3263
 
3264
 
3265
//timing fix: 05/20/03 - move mcycle_squash_d1 after pick instead of before pick
3266
//assign        strm_pcx_rq_sel = strm_pcx_rq_pick & strm_pcx_rq_vld & all_pcx_rq_pick[3] ;
3267
//assign        fpop_pcx_rq_sel = fpop_pcx_rq_pick & fpop_pcx_rq_vld & all_pcx_rq_pick[3] ;
3268
//assign        intrpt_pcx_rq_sel = intrpt_pcx_rq_pick & intrpt_pcx_rq_vld & all_pcx_rq_pick[3] ;
3269
//assign        fwdpkt_pcx_rq_sel = fwdpkt_pcx_rq_pick & fwdpkt_rq_vld & all_pcx_rq_pick[3] ;
3270
assign  strm_pcx_rq_sel = strm_pcx_rq_pick & strm_pcx_rq_vld & all_pcx_rq_pick[3] & ~mcycle_squash_d1 ;
3271
 
3272
//11/15/03 - change fpop atomic to be same as store atomic (bug4513)
3273
//assign        fpop_pcx_rq_sel = fpop_pcx_rq_pick & fpop_pcx_rq_vld & all_pcx_rq_pick[3] & ~mcycle_squash_d1 ;
3274
wire    fpop_qmon_2entry_avail ;
3275
assign  fpop_pcx_rq_sel_tmp = fpop_pcx_rq_pick & fpop_pcx_rq_vld & all_pcx_rq_pick[3] & ~mcycle_squash_d1 ;
3276
assign  fpop_pcx_rq_sel = fpop_pcx_rq_sel_tmp & fpop_qmon_2entry_avail ;
3277
 
3278
assign  intrpt_pcx_rq_sel = intrpt_pcx_rq_pick & intrpt_pcx_rq_vld & all_pcx_rq_pick[3] & ~mcycle_squash_d1 ;
3279
assign  fwdpkt_pcx_rq_sel = fwdpkt_pcx_rq_pick & fwdpkt_rq_vld & all_pcx_rq_pick[3] & ~mcycle_squash_d1 ;
3280
 
3281
 
3282
//bug3506: set mask in the level1 pick in w3-cycle if picked by pcx
3283
//assign  misc_events_final[3] = lsu_spu_ldst_ack ;
3284
//assign  misc_events_final[2] = lsu_tlu_pcxpkt_ack ;
3285
//assign  misc_events_final[1] = lsu_fwdpkt_pcx_rq_sel ;
3286
//assign  misc_events_final[0] = fpop_pcx_rq_sel_d2 & ~pcx_req_squash_d1 ;
3287
 
3288
 
3289
 
3290
 
3291
// LEVEL TWO - PICK AMONG CATEGORIES
3292
// In parallel with level one
3293
 
3294
wire    ld_pcx_rq_all, st_pcx_rq_all, misc_pcx_rq_all ;
3295
assign  ld_pcx_rq_all = ld3_pcx_rq_vld | ld2_pcx_rq_vld | ld1_pcx_rq_vld | ld0_pcx_rq_vld ;
3296
assign  st_pcx_rq_all = st3_pcx_rq_vld | st2_pcx_rq_vld | st1_pcx_rq_vld | st0_pcx_rq_vld ;
3297
assign  misc_pcx_rq_all = strm_pcx_rq_vld | fpop_pcx_rq_vld | intrpt_pcx_rq_vld | fwdpkt_rq_vld ;
3298
 
3299
//bug3506- raw valid used in resetting pick status
3300
//8/20/03: bug3506 fix is incomplete - vld may not be held until d2 cycle
3301
 
3302
//wire all4_rrobin_en;
3303
//timing fix: 5/20/03 - pcx_rq_for_stb will be independent of ifu_lsu_pcxreq_d
3304
//assign all4_rrobin_en = ~(all_pcx_rq_pick[2] & ~pcx_rq_for_stb_en) ;
3305
//timing fix: 05/20/03 - move mycle_squash_d1 after pick instead of before pick
3306
//assign all4_rrobin_en = ~((all_pcx_rq_pick[2] & ~pcx_rq_for_stb_en) | imiss_pcx_rq_vld );
3307
//bug3348 - setting history moved from w-stage to w3-stage(1-cycle after spc_pcx_req_pq)
3308
//          and hence there are no cases to disable logging of history
3309
//assign all4_rrobin_en = ~((all_pcx_rq_pick[2] & ~pcx_rq_for_stb_en) | imiss_pcx_rq_vld | mcycle_squash_d1);
3310
//wire   spc_pcx_req_vld_pq1 ;
3311
//assign all4_rrobin_en =  spc_pcx_req_vld_pq1 ;
3312
 
3313
//wire  [3:1]  all_pcx_rq_pick_no_iqual;
3314
wire  [3:0]  all_pcx_rq_pick_no_iqual;
3315
//wire  [3:0]  all_pcx_pick_status_d2;  // bug 3348
3316
//wire  [3:0]  all_pick_status_rst_d2;    //bug 3506
3317
wire  [3:0]  all_pick_status_set;
3318
 
3319
//bug3506: set pick status in the same cycle
3320
assign  all_pick_status_set[3]  =  |{ strm_pcx_rq_sel, intrpt_pcx_rq_sel,fpop_pcx_rq_sel, fwdpkt_pcx_rq_sel} ;
3321
assign  all_pick_status_set[2]  =  |pcx_rq_for_stb[3:0] ;
3322
assign  all_pick_status_set[1]  =  |{ld0_pcx_rq_sel,ld1_pcx_rq_sel,ld2_pcx_rq_sel,ld3_pcx_rq_sel} ;
3323
assign  all_pick_status_set[0]  =  1'b0 ;
3324
 
3325
 
3326
 
3327
lsu_rrobin_picker2 all4_rrobin  (
3328
    .events       ({misc_pcx_rq_all,st_pcx_rq_all,ld_pcx_rq_all,1'b0}),
3329
    .thread_force(all_thrd_force_vld[3:0]),
3330
    .pick_one_hot (all_pcx_rq_pick_no_iqual[3:0]),
3331
 
3332
    .events_picked(all_pick_status_set[3:0]),
3333
    //.en           (all4_rrobin_en),      // bug 3348
3334
    .rclk         (rclk),
3335
    .grst_l       (grst_l),
3336
    .arst_l       (arst_l),
3337 113 albert.wat
    `SIMPLY_RISC_SCANIN,
3338 95 fafa1971
    .se(se),
3339
    .so()
3340
  );
3341
 
3342
 
3343
// 5/22/03: cmp1_regr fail - qual all pick w/  ~mcycle_squash_d1; not doing this causes multi-hot select to
3344
//          pcx_pkt mux
3345
assign all_pcx_rq_pick[0]    =  imiss_pcx_rq_vld & ~mcycle_squash_d1;
3346
assign all_pcx_rq_pick[3:1]  =  all_pcx_rq_pick_no_iqual[3:1] & ~{3{imiss_pcx_rq_vld | mcycle_squash_d1}};
3347
 
3348
wire   all_pcx_rq_dest_sel3 ;
3349
assign all_pcx_rq_dest_sel3  =  ~|all_pcx_rq_pick[2:0];
3350
 
3351
//timing fix: 5/20/03 - pcx_rq_for_stb will be independent of ifu_lsu_pcxreq_d
3352
//assign        imiss_pcx_rq_sel = imiss_pcx_rq_vld & all_pcx_rq_pick[0] ;
3353
//timing fix: 05/20/03 - move mcycle_squash_d1 after pick instead of before pick
3354
//assign        imiss_pcx_rq_sel = imiss_pcx_rq_vld;
3355
assign  imiss_pcx_rq_sel = imiss_pcx_rq_vld & ~mcycle_squash_d1 ;
3356
 
3357
//=================================================================================================
3358
 
3359
// Select appr. load. Need a scheme which allows threads to
3360
// make fwd progress.
3361
/*assign  ld0_pcx_rq_sel = ld0_pcx_rq_vld ;
3362
assign  ld1_pcx_rq_sel = ld1_pcx_rq_vld & ~ld0_pcx_rq_vld ;
3363
assign  ld2_pcx_rq_sel = ld2_pcx_rq_vld & ~(ld0_pcx_rq_vld | ld1_pcx_rq_vld);
3364
assign  ld3_pcx_rq_sel = ld3_pcx_rq_vld & ~(ld0_pcx_rq_vld | ld1_pcx_rq_vld | ld2_pcx_rq_vld)   ; */
3365
 
3366 113 albert.wat
dff_s #(4)  lrsel_stgd1 (
3367 95 fafa1971
        .din    ({ld0_pcx_rq_sel, ld1_pcx_rq_sel, ld2_pcx_rq_sel, ld3_pcx_rq_sel}),
3368
        .q      ({ld0_pcx_rq_sel_d1, ld1_pcx_rq_sel_d1, ld2_pcx_rq_sel_d1, ld3_pcx_rq_sel_d1}),
3369
        .clk  (clk),
3370 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
3371 95 fafa1971
        );
3372
 
3373
//bug2705- kill pcx pick if spec vld kill is set
3374
assign  lsu_ld0_pcx_rq_sel_d1  =  ld0_pcx_rq_sel_d1 & ~lsu_ld0_spec_vld_kill_w2 ;
3375
assign  lsu_ld1_pcx_rq_sel_d1  =  ld1_pcx_rq_sel_d1 & ~lsu_ld1_spec_vld_kill_w2 ;
3376
assign  lsu_ld2_pcx_rq_sel_d1  =  ld2_pcx_rq_sel_d1 & ~lsu_ld2_spec_vld_kill_w2 ;
3377
assign  lsu_ld3_pcx_rq_sel_d1  =  ld3_pcx_rq_sel_d1 & ~lsu_ld3_spec_vld_kill_w2 ;
3378
 
3379
 
3380 113 albert.wat
dff_s #(4)  lrsel_stgd2 (
3381 95 fafa1971
        .din    ({lsu_ld0_pcx_rq_sel_d1, lsu_ld1_pcx_rq_sel_d1, lsu_ld2_pcx_rq_sel_d1, lsu_ld3_pcx_rq_sel_d1}),
3382
        .q      ({ld0_pcx_rq_sel_d2, ld1_pcx_rq_sel_d2, ld2_pcx_rq_sel_d2, ld3_pcx_rq_sel_d2}),
3383
        .clk  (clk),
3384 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
3385 95 fafa1971
        );
3386
 
3387
// Used to complete prefetch. Be careful ! ld could be squashed. Add pcx_req_squash.
3388
assign  lsu_ld_pcx_rq_sel_d2[3] = ld3_pcx_rq_sel_d2 ;
3389
assign  lsu_ld_pcx_rq_sel_d2[2] = ld2_pcx_rq_sel_d2 ;
3390
assign  lsu_ld_pcx_rq_sel_d2[1] = ld1_pcx_rq_sel_d2 ;
3391
assign  lsu_ld_pcx_rq_sel_d2[0] = ld0_pcx_rq_sel_d2 ;
3392
 
3393
//bug2705- kill pcx pick if spec vld kill is set
3394
wire    ld_pcxpkt_vld ;
3395
assign  ld_pcxpkt_vld =
3396
  lsu_ld0_pcx_rq_sel_d1 | lsu_ld1_pcx_rq_sel_d1 | lsu_ld2_pcx_rq_sel_d1 | lsu_ld3_pcx_rq_sel_d1 ;
3397
  //ld0_pcx_rq_sel_d1 | ld1_pcx_rq_sel_d1 | ld2_pcx_rq_sel_d1 | ld3_pcx_rq_sel_d1 ;
3398
 
3399 113 albert.wat
dff_s #(1)  icindx_stgd1 (
3400 95 fafa1971
        .din    (ld_pcxpkt_vld),
3401
        .q      (lsu_ifu_ld_pcxpkt_vld),
3402
        .clk    (clk),
3403 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
3404 95 fafa1971
        );
3405
 
3406
wire  [3:0]           ld_pcx_rq_sel ;
3407
 
3408
assign  ld_pcx_rq_sel[0] =  ld0_pcx_rq_sel_d1 | st0_atom_rq_d2 ;
3409
assign  ld_pcx_rq_sel[1] =  ld1_pcx_rq_sel_d1 | st1_atom_rq_d2 ;
3410
assign  ld_pcx_rq_sel[2] =  ld2_pcx_rq_sel_d1 | st2_atom_rq_d2 ;
3411
assign  ld_pcx_rq_sel[3] =  ld3_pcx_rq_sel_d1 | st3_atom_rq_d2 ;
3412
 
3413
//11/7/03: add rst_tri_en
3414
assign  lsu_ld_pcx_rq_mxsel[2:0]  =    ld_pcx_rq_sel[2:0] & {3{~rst_tri_en}} ;
3415
assign  lsu_ld_pcx_rq_mxsel[3]    =  (~|ld_pcx_rq_sel[2:0]) | rst_tri_en ;
3416
 
3417
assign ld_pcx_thrd[0] = ld_pcx_rq_sel[1] | ld_pcx_rq_sel[3] ;
3418
assign ld_pcx_thrd[1] = ld_pcx_rq_sel[2] | ld_pcx_rq_sel[3] ;
3419
 
3420
// Assume a simple priority based scheme for now.
3421
// This should not be prioritized at this point. 
3422
//assign st_pcx_rq_mhot_sel[0] = st0_pcx_rq_sel_tmp ;
3423
//assign st_pcx_rq_mhot_sel[1] = st1_pcx_rq_sel_tmp ;
3424
//assign st_pcx_rq_mhot_sel[2] = st2_pcx_rq_sel_tmp ;
3425
//assign st_pcx_rq_mhot_sel[3] = st3_pcx_rq_sel_tmp ;
3426
 
3427
/*assign st_pcx_rq_mhot_sel[0] =
3428
  ~ld_pcx_rq_vld  & st0_pcx_rq_vld ;
3429
assign st_pcx_rq_mhot_sel[1] =
3430
  ~ld_pcx_rq_vld  & st1_pcx_rq_vld ;
3431
assign st_pcx_rq_mhot_sel[2] =
3432
  ~ld_pcx_rq_vld  & st2_pcx_rq_vld ;
3433
assign st_pcx_rq_mhot_sel[3] =
3434
  ~ld_pcx_rq_vld  & st3_pcx_rq_vld ;*/
3435
 
3436
 
3437
assign  st0_pcx_rq_sel = pcx_rq_for_stb[0] ;
3438
assign  st1_pcx_rq_sel = pcx_rq_for_stb[1] ;
3439
assign  st2_pcx_rq_sel = pcx_rq_for_stb[2] ;
3440
assign  st3_pcx_rq_sel = pcx_rq_for_stb[3] ;
3441
 
3442
//assign  st_pcx_rq_vld =  (|pcx_rq_for_stb[3:0]);
3443
 
3444
// Temporary.
3445
//assign  st0_pcx_rq_sel = stb_rd_for_pcx_sel[0] ;
3446
//assign  st1_pcx_rq_sel = stb_rd_for_pcx_sel[1] ;
3447
//assign  st2_pcx_rq_sel = stb_rd_for_pcx_sel[2] ;
3448
//assign  st3_pcx_rq_sel = stb_rd_for_pcx_sel[3] ;
3449
 
3450
// This will be on a critical path. Massage !!!
3451
// Allows for speculative requests.
3452
//assign  st_pcx_rq_vld = 
3453
//    (st0_pcx_rq_sel & stb_rd_for_pcx_sel[0]) | 
3454
//    (st1_pcx_rq_sel & stb_rd_for_pcx_sel[1]) | 
3455
//    (st2_pcx_rq_sel & stb_rd_for_pcx_sel[2]) | 
3456
//    (st3_pcx_rq_sel & stb_rd_for_pcx_sel[3])  ;
3457
 
3458
 
3459
 
3460
/*assign imiss_pcx_rq_sel =
3461
  imiss_pcx_rq_vld & ~(ld_pcx_rq_vld | st_pcx_rq_vld) ;
3462
assign strm_pcx_rq_sel =
3463
  strm_pcx_rq_vld & ~(ld_pcx_rq_vld | st_pcx_rq_vld | imiss_pcx_rq_sel) ;
3464
assign fpop_pcx_rq_sel =
3465
  fpop_pcx_rq_vld & ~(ld_pcx_rq_vld | st_pcx_rq_vld | imiss_pcx_rq_vld | strm_pcx_rq_vld) ;
3466
assign intrpt_pcx_rq_sel =
3467
  intrpt_pcx_rq_vld & ~(ld_pcx_rq_vld | st_pcx_rq_vld | imiss_pcx_rq_vld | strm_pcx_rq_vld | fpop_pcx_rq_sel) ;
3468
assign fwdpkt_pcx_rq_sel =
3469
  fwdpkt_rq_vld & ~(ld_pcx_rq_vld | st_pcx_rq_vld | imiss_pcx_rq_vld | strm_pcx_rq_vld | intrpt_pcx_rq_vld
3470
                        | fpop_pcx_rq_sel) ; */
3471
 
3472
 
3473
//assign imiss_strm_pcx_rq_sel = imiss_pcx_rq_sel | strm_pcx_rq_sel ;
3474
 
3475
// request was made with the queues full but not grant. 
3476
assign  pcx_req_squash =
3477
  (|(spc_pcx_req_pq_buf2[4:0] & ~pre_qwr[4:0] & ~pcx_spc_grant_px[4:0])) ;
3478
//(|(spc_pcx_req_pq[4:0] & ~queue_write[4:0] & ~pcx_spc_grant_px[4:0])) ;
3479
//  (|lsu_error_rst[3:0]) | // dtag parity error requires two ld pkts
3480
//  (st_atom_rq_d1) ; // cas,stq - 2 pkt requests
3481
 
3482
//bug:2877 - dtag parity error 2nd packet request;
3483
//wire  error_rst ;
3484
 
3485
//assign        error_rst =
3486
//      (ld0_pcx_rq_sel_d1 & lsu_dtag_perror_w2[0]) |
3487
//      (ld1_pcx_rq_sel_d1 & lsu_dtag_perror_w2[1]) |
3488
//      (ld2_pcx_rq_sel_d1 & lsu_dtag_perror_w2[2]) |
3489
//      (ld3_pcx_rq_sel_d1 & lsu_dtag_perror_w2[3]) ;
3490
 
3491
//wire  error_rst_d1 ;
3492
//dff #(1)  erst_stgd1 (
3493
//        .din    (error_rst), 
3494
//      .q      (error_rst_d1),
3495
//        .clk          (clk),
3496 113 albert.wat
//        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
3497 95 fafa1971
//        ); 
3498
 
3499
wire   [3:0]  dtag_perr_pkt2_vld ;
3500
assign  dtag_perr_pkt2_vld[0] =  lsu_ld0_pcx_rq_sel_d1 & lsu_dtag_perror_w2[0];
3501
assign  dtag_perr_pkt2_vld[1] =  lsu_ld1_pcx_rq_sel_d1 & lsu_dtag_perror_w2[1];
3502
assign  dtag_perr_pkt2_vld[2] =  lsu_ld2_pcx_rq_sel_d1 & lsu_dtag_perror_w2[2];
3503
assign  dtag_perr_pkt2_vld[3] =  lsu_ld3_pcx_rq_sel_d1 & lsu_dtag_perror_w2[3];
3504
 
3505
//bug:2877 - dtag parity error 2nd packet request; flop to sync w/ ld?_pcx_rq_sel_d2
3506 113 albert.wat
dff_s #(4) ff_dtag_perr_pkt2_vld_d1 (
3507 95 fafa1971
        .din    (dtag_perr_pkt2_vld[3:0]),
3508
        .q      (dtag_perr_pkt2_vld_d1[3:0]),
3509
        .clk    (clk),
3510 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
3511 95 fafa1971
        );
3512
 
3513
 
3514
 
3515
//bug:2877 - dtag parity error 2nd packet request; error_rst can be removed from mcycle_mask_d1 since
3516
//           it does not behave like an atomic i.e. it is sent as 2 separate packets.
3517
assign  mcycle_squash_d1 =
3518
 // error_rst | // dtag parity error requires two ld pkts
3519
  //(|lsu_error_rst[3:0]) | // dtag parity error requires two ld pkts
3520
  spc_pcx_atom_pq_buf2 ;   // cas/fpop
3521
 
3522 113 albert.wat
dff_s #(1)  sqsh_stgd1 (
3523 95 fafa1971
        .din    (pcx_req_squash),
3524
        .q      (pcx_req_squash_d1),
3525
        .clk    (clk),
3526 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
3527 95 fafa1971
        );
3528
 
3529 113 albert.wat
dff_s #(1)  sqsh_stgd2 (
3530 95 fafa1971
        .din    (pcx_req_squash_d1),
3531
        .q      (pcx_req_squash_d2),
3532
        .clk    (clk),
3533 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
3534 95 fafa1971
        );
3535
//timing fix: 9/19/03 - split the lsu_pcx_req_squash to 4 signals to stb_ctl[0-3] to reduce loading
3536
assign  lsu_pcx_req_squash = pcx_req_squash & ~st_atom_rq_d1 ;
3537
assign  lsu_pcx_req_squash0 = lsu_pcx_req_squash ;
3538
assign  lsu_pcx_req_squash1 = lsu_pcx_req_squash ;
3539
assign  lsu_pcx_req_squash2 = lsu_pcx_req_squash ;
3540
assign  lsu_pcx_req_squash3 = lsu_pcx_req_squash ;
3541
 
3542
assign  lsu_pcx_req_squash_d1 = pcx_req_squash_d1 ;
3543
 
3544 113 albert.wat
dff_s #(5)  rsel_stgd1 (
3545 95 fafa1971
        //.din    ({imiss_strm_pcx_rq_sel,
3546
        .din    ({
3547
    imiss_pcx_rq_sel, strm_pcx_rq_sel, intrpt_pcx_rq_sel, fpop_pcx_rq_sel,
3548
    fwdpkt_pcx_rq_sel}),
3549
        //.q      ({imiss_strm_pcx_rq_sel_d1,
3550
        .q      ({
3551
    imiss_pcx_rq_sel_d1, strm_pcx_rq_sel_d1, intrpt_pcx_rq_sel_d1,fpop_pcx_rq_sel_d1,
3552
    fwdpkt_pcx_rq_sel_d1}),
3553
        .clk  (clk),
3554 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
3555 95 fafa1971
        );
3556
 
3557
assign  lsu_imiss_pcx_rq_sel_d1  =  imiss_pcx_rq_sel_d1;
3558
 
3559 113 albert.wat
dff_s  imrqs_stgd2 (
3560 95 fafa1971
        .din    (imiss_pcx_rq_sel_d1),
3561
        .q      (imiss_pcx_rq_sel_d2),
3562
        .clk    (clk),
3563 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
3564 95 fafa1971
        );
3565
 
3566 113 albert.wat
dff_s  fwdrqs_stgd2 (
3567 95 fafa1971
        .din    (fwdpkt_pcx_rq_sel_d1),
3568
        .q      (fwdpkt_pcx_rq_sel_d2),
3569
        .clk    (clk),
3570 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
3571 95 fafa1971
        );
3572
 
3573 113 albert.wat
dff_s  fwdrqs_stgd3 (
3574 95 fafa1971
        .din    (fwdpkt_pcx_rq_sel_d2),
3575
        .q      (fwdpkt_pcx_rq_sel_d3),
3576
        .clk    (clk),
3577 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
3578 95 fafa1971
        );
3579
 
3580 113 albert.wat
dff_s  fpop_stgd2 (
3581 95 fafa1971
        .din    (fpop_pcx_rq_sel_d1), .q  (fpop_pcx_rq_sel_d2),
3582
        .clk    (clk),
3583 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
3584 95 fafa1971
        );
3585
 
3586
//bug4665: add sehold to pcx_pkt_src_sel[1]
3587
//wire  ld_pcx_rq_sel_d1,st_pcx_rq_sel_d1,misc_pcx_rq_sel_d1;
3588
wire    ld_pcx_rq_sel_d1,st_pcx_rq_sel_d1;
3589
wire    all_pcx_rq_pick_b2 ;
3590
assign  all_pcx_rq_pick_b2  =  sehold ? st_pcx_rq_sel_d1 : all_pcx_rq_pick[2] ;
3591
 
3592 113 albert.wat
dff_s #(2)  pick_stgd1 (
3593 95 fafa1971
        .din    ({all_pcx_rq_pick_b2, all_pcx_rq_pick[1]}),
3594
        .q      ({st_pcx_rq_sel_d1,ld_pcx_rq_sel_d1}),
3595
        //.din    ({all_pcx_rq_pick[3], all_pcx_rq_pick_b2, all_pcx_rq_pick[1]}), 
3596
        //.q      ({misc_pcx_rq_sel_d1,st_pcx_rq_sel_d1,ld_pcx_rq_sel_d1}),
3597
        //.din    (all_pcx_rq_pick[2:1]), .q      ({st_pcx_rq_sel_d1,ld_pcx_rq_sel_d1}),
3598
        .clk  (clk),
3599 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
3600 95 fafa1971
        );
3601
 
3602
// add other sources in such as interrupt and fpop.
3603
//bug:2877 - dtag parity error 2nd packet request; remove error_rst_d1 since dtag parity error does not
3604
//           behave as an atomic
3605
//assign pcx_pkt_src_sel[0] = ld_pcx_rq_sel_d1 | st_cas_rq_d2 | error_rst_d1 ;
3606
 
3607
//11/7/03 - add rst_tri_en
3608
wire  [3:0]  pcx_pkt_src_sel_tmp ;
3609
assign pcx_pkt_src_sel_tmp[0] = ld_pcx_rq_sel_d1 | st_cas_rq_d2 ;
3610
assign pcx_pkt_src_sel_tmp[1] = st_pcx_rq_sel_d1 ;
3611
assign pcx_pkt_src_sel_tmp[2] = ~|{pcx_pkt_src_sel[3],pcx_pkt_src_sel[1:0]};
3612
                                //imiss_strm_pcx_rq_sel_d1  ;
3613
assign pcx_pkt_src_sel_tmp[3] = fpop_pcx_rq_sel_d1 | fpop_pcx_rq_sel_d2 |
3614
                                fwdpkt_pcx_rq_sel_d1 | intrpt_pcx_rq_sel_d1 ;
3615
 
3616
//bug4888 -  change rst_tri_en to select b[1] instead of b[3]
3617
 
3618
assign pcx_pkt_src_sel[3:2]  =  pcx_pkt_src_sel_tmp[3:2] & {2{~rst_tri_en}} ;
3619
assign pcx_pkt_src_sel[1]    =  pcx_pkt_src_sel_tmp[1] | rst_tri_en ;
3620
assign pcx_pkt_src_sel[0]    =  pcx_pkt_src_sel_tmp[0] & ~rst_tri_en ;
3621
 
3622
//assign  dest_pkt_sel[0] = ld_pcx_rq_vld ;
3623
//assign  dest_pkt_sel[1] = st_pcx_rq_vld ;
3624
//assign  dest_pkt_sel[2] = ~(ld_pcx_rq_vld | st_pcx_rq_vld);
3625
 
3626
//=================================================================================================
3627
//              SELECT DESTINATION
3628
//=================================================================================================
3629
 
3630
// Select dest for load.
3631
mux4ds  #(5) ldsel_dest (
3632
  .in0  (ld0_l2bnk_dest[4:0]),
3633
  .in1  (ld1_l2bnk_dest[4:0]),
3634
  .in2  (ld2_l2bnk_dest[4:0]),
3635
  .in3  (ld3_l2bnk_dest[4:0]),
3636
  .sel0 (ld0_pcx_rq_pick),
3637
  .sel1 (ld1_pcx_rq_pick),
3638
  .sel2 (ld2_pcx_rq_pick),
3639
  .sel3 (ld3_pcx_rq_pick),
3640
  .dout (ld_pkt_dest[4:0])
3641
);
3642
 
3643
// Select dest for store
3644
mux4ds  #(5) stsel_dest (
3645
  .in0  (st0_l2bnk_dest[4:0]),
3646
  .in1  (st1_l2bnk_dest[4:0]),
3647
  .in2  (st2_l2bnk_dest[4:0]),
3648
  .in3  (st3_l2bnk_dest[4:0]),
3649
  .sel0 (st0_pcx_rq_pick),
3650
  .sel1 (st1_pcx_rq_pick),
3651
  .sel2 (st2_pcx_rq_pick),
3652
  .sel3 (st3_pcx_rq_pick),
3653
  .dout (st_pkt_dest[4:0])
3654
);
3655
 
3656
wire    [4:0]    misc_pkt_dest ;
3657
mux4ds  #(5) miscsel_dest (
3658
  .in0  (strm_l2bnk_dest[4:0]),
3659
  .in1  (fpop_l2bnk_dest[4:0]),
3660
  .in2  (intrpt_l2bnk_dest[4:0]),
3661
  .in3  (fwdpkt_dest_d1[4:0]),
3662
  .sel0 (strm_pcx_rq_pick),
3663
  .sel1 (fpop_pcx_rq_pick),
3664
  .sel2 (intrpt_pcx_rq_pick),
3665
  .sel3 (fwdpkt_pcx_rq_pick),
3666
  .dout (misc_pkt_dest[4:0])
3667
);
3668
 
3669
// This is temporary until the req/ack path is restructured
3670
/*assign  imiss_strm_pkt_dest[4:0] =
3671
  imiss_pcx_rq_sel ? imiss_l2bnk_dest[4:0] :
3672
    strm_pcx_rq_sel ? strm_l2bnk_dest[4:0] :
3673
      fpop_pcx_rq_sel ? fpop_l2bnk_dest[4:0] :
3674
        intrpt_pcx_rq_sel ? intrpt_l2bnk_dest[4:0] :
3675
                lsu_fwdpkt_dest[4:0] ;  */
3676
 
3677
/*
3678
// This needs to be replaced with structural mux once rq/ack resolved.
3679
mux4ds  #(5) istrmsel_dest (
3680
  .in0  (imiss_l2bnk_dest[4:0]),
3681
  .in1  (strm_l2bnk_dest[4:0]),
3682
  .in2  (fpop_l2bnk_dest[4:0]),
3683
  .in3  (intrpt_l2bnk_dest[4:0]),
3684
  .sel0 (imiss_pcx_rq_sel),
3685
  .sel1   (strm_pcx_rq_sel),
3686
  .sel2   (fpop_pcx_rq_sel),
3687
  .sel3   (intrpt_pcx_rq_sel),
3688
  .dout (imiss_strm_pkt_dest[4:0])
3689
);
3690
*/
3691
 
3692
mux4ds  #(5) sel_final_dest (
3693
  .in0  (imiss_l2bnk_dest[4:0]),
3694
  .in1  (ld_pkt_dest[4:0]),
3695
  .in2  (st_pkt_dest[4:0]),
3696
  .in3  (misc_pkt_dest[4:0]),
3697
  .sel0 (all_pcx_rq_pick[0]),
3698
  .sel1 (all_pcx_rq_pick[1]),
3699
  .sel2 (all_pcx_rq_pick[2]),
3700
  .sel3 (all_pcx_rq_dest_sel3),
3701
  //.sel3 (all_pcx_rq_pick[3]), 
3702
  .dout (current_pkt_dest[4:0])
3703
);
3704
 
3705
/*mux3ds  #(5) sel_dest (
3706
  .in0  (ld_pkt_dest[4:0]),
3707
  .in1  (st_pkt_dest[4:0]),
3708
  .in2    (imiss_strm_pkt_dest[4:0]),
3709
  .sel0 (dest_pkt_sel[0]),
3710
  .sel1   (dest_pkt_sel[1]),
3711
  .sel2   (dest_pkt_sel[2]),
3712
  .dout (current_pkt_dest[4:0])
3713
);*/
3714
 
3715
wire    pcx_rq_sel ;
3716
assign  pcx_rq_sel =
3717
  ld0_pcx_rq_sel | ld1_pcx_rq_sel | ld2_pcx_rq_sel | ld3_pcx_rq_sel |
3718
  st0_pcx_rq_sel | st1_pcx_rq_sel | st2_pcx_rq_sel | st3_pcx_rq_sel |
3719
  imiss_pcx_rq_sel | strm_pcx_rq_sel | fpop_pcx_rq_sel | intrpt_pcx_rq_sel |
3720
  fwdpkt_pcx_rq_sel ;
3721
 
3722
assign spc_pcx_req_g[4:0] =
3723
  (current_pkt_dest[4:0] & {5{pcx_rq_sel}}) ;
3724
  //(current_pkt_dest[4:0] & 
3725
  //{5{(ld_pcx_rq_vld | st_pcx_rq_vld | imiss_pcx_rq_vld | strm_pcx_rq_vld | intrpt_pcx_rq_vld | fpop_atom_req | fwdpkt_rq_vld)}}) ;
3726
 
3727
//timing fix: 9/19/03 - instantiate buffer for spc_pcx_req_pq
3728
wire  [4:0]  spc_pcx_req_pq_tmp ;
3729 113 albert.wat
dff_s #(5)  rq_stgpq (
3730 95 fafa1971
        .din    (spc_pcx_req_g[4:0]), .q  (spc_pcx_req_pq_tmp[4:0]),
3731
        .clk  (clk),
3732 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
3733 95 fafa1971
        );
3734
 
3735
 
3736
bw_u1_buf_30x UZfix_spc_pcx_req_pq0_buf1 ( .a(spc_pcx_req_pq_tmp[0]), .z(spc_pcx_req_pq[0]) );
3737
bw_u1_buf_30x UZfix_spc_pcx_req_pq1_buf1 ( .a(spc_pcx_req_pq_tmp[1]), .z(spc_pcx_req_pq[1]) );
3738
bw_u1_buf_30x UZfix_spc_pcx_req_pq2_buf1 ( .a(spc_pcx_req_pq_tmp[2]), .z(spc_pcx_req_pq[2]) );
3739
bw_u1_buf_30x UZfix_spc_pcx_req_pq3_buf1 ( .a(spc_pcx_req_pq_tmp[3]), .z(spc_pcx_req_pq[3]) );
3740
bw_u1_buf_30x UZfix_spc_pcx_req_pq4_buf1 ( .a(spc_pcx_req_pq_tmp[4]), .z(spc_pcx_req_pq[4]) );
3741
 
3742
bw_u1_buf_30x UZsize_spc_pcx_req_pq0_buf2 ( .a(spc_pcx_req_pq_tmp[0]), .z(spc_pcx_req_pq_buf2[0]) );
3743
bw_u1_buf_30x UZsize_spc_pcx_req_pq1_buf2 ( .a(spc_pcx_req_pq_tmp[1]), .z(spc_pcx_req_pq_buf2[1]) );
3744
bw_u1_buf_30x UZsize_spc_pcx_req_pq2_buf2 ( .a(spc_pcx_req_pq_tmp[2]), .z(spc_pcx_req_pq_buf2[2]) );
3745
bw_u1_buf_30x UZsize_spc_pcx_req_pq3_buf2 ( .a(spc_pcx_req_pq_tmp[3]), .z(spc_pcx_req_pq_buf2[3]) );
3746
bw_u1_buf_30x UZsize_spc_pcx_req_pq4_buf2 ( .a(spc_pcx_req_pq_tmp[4]), .z(spc_pcx_req_pq_buf2[4]) );
3747
 
3748
//bug3348 - not needed
3749
//wire   spc_pcx_req_vld_pq ;
3750
//assign spc_pcx_req_vld_pq =  |spc_pcx_req_pq[4:0];
3751
//
3752
//dff #(1)  rq_stgpq1 (
3753
//        .din    (spc_pcx_req_vld_pq), .q  (spc_pcx_req_vld_pq1),
3754
//        .clk  (clk),
3755 113 albert.wat
//        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
3756 95 fafa1971
//        ); 
3757
 
3758
assign spc_pcx_req_update_g[4:0] =
3759
        (st_atom_rq_d1 | fpop_atom_rq_pq) ?
3760
        spc_pcx_req_pq_buf2[4:0] :           // Recirculate same request if back to back case - stda, cas etc
3761
        (current_pkt_dest[4:0] &
3762
        {5{pcx_rq_sel}}) ;
3763
        //{5{(ld_pcx_rq_vld | st_pcx_rq_vld | imiss_pcx_rq_vld | strm_pcx_rq_vld | intrpt_pcx_rq_vld | fpop_pcx_rq_vld | fwdpkt_rq_vld)}}) ;
3764
                                        // Standard request
3765
 
3766 113 albert.wat
dff_s #(5)  urq_stgpq (
3767 95 fafa1971
        .din    (spc_pcx_req_update_g[4:0]), .q  (spc_pcx_req_update_w2[4:0]),
3768
        .clk  (clk),
3769 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
3770 95 fafa1971
        );
3771
 
3772
//=================================================================================================
3773
//      2-CYCLE OP HANDLING
3774
//=================================================================================================
3775
 
3776
// cas,fpop,dtag-error pkt. dtag-error pkt does not have to be b2b.
3777
// prevent starvation, ensure requests are b2b.
3778
// fpop can only request to fpu.(bit4) cas can only request to L2 (b3:0) 
3779
// ** error rst needs to be handled correctly.
3780
 
3781
// ** This needs to be massaged for timing.
3782
// timing fix: 5/7/03 - delay the mask 1 cycle for stores.
3783
wire    [3:0]    mcycle_mask_qwr ;
3784
wire    [4:0]    mcycle_mask_qwr_d1 ;
3785
//assign        mcycle_mask_qwr[3:0] =
3786
//      ({4{(stb0_rd_for_pcx & st0_atomic_vld)}} & st0_l2bnk_dest[3:0]) |
3787
//      ({4{(stb1_rd_for_pcx & st1_atomic_vld)}} & st1_l2bnk_dest[3:0]) |
3788
//      ({4{(stb2_rd_for_pcx & st2_atomic_vld)}} & st2_l2bnk_dest[3:0]) |
3789
//      ({4{(stb3_rd_for_pcx & st3_atomic_vld)}} & st3_l2bnk_dest[3:0]) ;
3790
 
3791
 
3792
//bug4513- kill the atomic store pcx req in this cycle if only 1 entry is available -
3793
//         atomic packets have to be sent b2bto pcx.
3794
//
3795
// ex. thread0 to l2 bank0 atomic store - w/ only 1 bank0 entry available
3796
//---------------------------------------------------------------------------------
3797
//                              1       2       3       4       5       6       7
3798
//---------------------------------------------------------------------------------
3799
// st0_atomic_vld-------------->1
3800
// pcx_rq_for_stb_tmp[0]------->1
3801
// pcx_rq_for_stb[0]----------->0                               1
3802
// st0_qmon_2entry_avail------->0                               1
3803
//---------------------------------------------------------------------------------
3804
// st0_atomic_pend------------->1                               0
3805
// st0_atomic_pend_d1------------------>1                               0
3806
// mcycle_mask_qwr_d1[0]--------------->1                               0
3807
//---------------------------------------------------------------------------------
3808
 
3809
 
3810
assign  st0_qmon_2entry_avail =  |(st0_l2bnk_dest[3:0] & sel_qentry0[3:0]) ;
3811
assign  st1_qmon_2entry_avail =  |(st1_l2bnk_dest[3:0] & sel_qentry0[3:0]) ;
3812
assign  st2_qmon_2entry_avail =  |(st2_l2bnk_dest[3:0] & sel_qentry0[3:0]) ;
3813
assign  st3_qmon_2entry_avail =  |(st3_l2bnk_dest[3:0] & sel_qentry0[3:0]) ;
3814
assign  fpop_qmon_2entry_avail =  fpop_l2bnk_dest[4] & sel_qentry0[4] ;
3815
 
3816
 
3817
//bug4513 - when atomic is picked, if 2 entries are not free, kill all requests until 2entries are free
3818
wire    st0_atomic_pend, st1_atomic_pend, st2_atomic_pend, st3_atomic_pend ;
3819
 
3820
assign  st0_atomic_pend  =  (pcx_rq_for_stb_tmp[0] & st0_atomic_vld & ~st0_qmon_2entry_avail) |  //set
3821
                            (st0_atomic_pend_d1 & ~st0_qmon_2entry_avail) ;                  //recycle/reset
3822
 
3823
assign  st1_atomic_pend  =  (pcx_rq_for_stb_tmp[1] & st1_atomic_vld & ~st1_qmon_2entry_avail) |  //set
3824
                            (st1_atomic_pend_d1 & ~st1_qmon_2entry_avail) ;                  //recycle/reset
3825
 
3826
assign  st2_atomic_pend  =  (pcx_rq_for_stb_tmp[2] & st2_atomic_vld & ~st2_qmon_2entry_avail) |  //set
3827
                            (st2_atomic_pend_d1 & ~st2_qmon_2entry_avail) ;                  //recycle/reset
3828
 
3829
assign  st3_atomic_pend  =  (pcx_rq_for_stb_tmp[3] & st3_atomic_vld & ~st3_qmon_2entry_avail) |  //set
3830
                            (st3_atomic_pend_d1 & ~st3_qmon_2entry_avail) ;                  //recycle/reset
3831
 
3832 113 albert.wat
dff_s #(4)  ff_st0to3_atomic_pend_d1 (
3833 95 fafa1971
        .din ({st3_atomic_pend,st2_atomic_pend,st1_atomic_pend,st0_atomic_pend}),
3834
        .q   ({st3_atomic_pend_d1,st2_atomic_pend_d1,st1_atomic_pend_d1,st0_atomic_pend_d1}),
3835
        .clk  (clk),
3836 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
3837 95 fafa1971
        );
3838
 
3839
//bug4513 - kill all requests after atomic if 2 entries to the bank are not available
3840
assign  mcycle_mask_qwr[3:0] =
3841
        ({4{st0_atomic_pend}} & st0_l2bnk_dest[3:0]) |
3842
        ({4{st1_atomic_pend}} & st1_l2bnk_dest[3:0]) |
3843
        ({4{st2_atomic_pend}} & st2_l2bnk_dest[3:0]) |
3844
        ({4{st3_atomic_pend}} & st3_l2bnk_dest[3:0]) ;
3845
 
3846
//11/15/03 - change fpop atomic to be same as store atomic (bug4513)
3847
//assign        mcycle_mask_qwr[4] = fpop_pkt_vld | fpop_pcx_rq_sel_d1 ;
3848
 
3849
wire    fpop_atomic_pend, fpop_atomic_pend_d1 ;
3850
 
3851
 
3852
assign fpop_atomic_pend = (fpop_pcx_rq_sel_tmp & ~fpop_qmon_2entry_avail) |
3853
                          (fpop_atomic_pend_d1 & ~fpop_qmon_2entry_avail) ;
3854
 
3855
assign  fpop_q_wr[4:0] = fpop_atomic_pend_d1 ? pre_qwr[4:0] : queue_write[4:0] ;
3856
 
3857 113 albert.wat
dff_s #(1)  ff_fpop_atomic_pend_d1 (
3858 95 fafa1971
        .din (fpop_atomic_pend),
3859
        .q   (fpop_atomic_pend_d1),
3860
        .clk  (clk),
3861 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
3862 95 fafa1971
        );
3863
 
3864
 
3865 113 albert.wat
dff_s #(5)  ff_mcycle_mask_qwr_b4to0 (
3866 95 fafa1971
        .din ({fpop_atomic_pend,mcycle_mask_qwr[3:0]}),
3867
        .q   (mcycle_mask_qwr_d1[4:0]),
3868
        .clk  (clk),
3869 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
3870 95 fafa1971
        );
3871
 
3872
 
3873
//                      PCX REQUEST GENERATION (END)
3874
//*************************************************************************************************
3875
 
3876
//=================================================================================================
3877
//
3878
// CPX Packet Processing
3879
//
3880
//=================================================================================================
3881
 
3882
 
3883
// D-SIDE PROCESSING
3884
 
3885
/*input  [3:0]   lsu_cpx_pkt_rqtype ;
3886
input          lsu_cpx_pkt_vld ;*/
3887
 
3888
// non-cacheables are processed at the head of the dfq.
3889
// cpx_ld_type may not have to factor in strm load.
3890
 
3891
//=================================================================================================
3892
//
3893
// PCX Queue Control
3894
//
3895
//=================================================================================================
3896
 
3897
//timing fix: 5/7/03 - delay mask 1 cycle for stores
3898
//11/15/03 - change fpop atomic to be same as store atomic (bug4513)
3899
//assign        queue_write[4:0] = pre_qwr[4:0] & ~{mcycle_mask_qwr[4],mcycle_mask_qwr_d1[3:0]} ;
3900
assign  queue_write[4:0] = pre_qwr[4:0] & ~mcycle_mask_qwr_d1[4:0] ;
3901
 
3902
//bug4513 - mcycle_mask_qwr will kill all requests other than stores. stores can be killed
3903
//          by fpop atomics
3904
//11/14/03- fox for bug4513 was incorrect ; st_queue_write[3:0] not needed 'cos st[0-3]_q_wr 
3905
//          has been changed to use st0_atomic_pend instead of st0_atomic_vld
3906
//assign        st_queue_write[4] = pre_qwr[4] & ~mcycle_mask_qwr[4] ;
3907
//assign        st_queue_write[3:0] = pre_qwr[3:0] ;
3908
 
3909
//assign        queue_write[4:0] = pre_qwr[4:0] & ~mcycle_mask_qwr[4:0] ; // timing fix
3910
// assign       queue_write[4:0] = pre_qwr[4:0] ;
3911
 
3912
// PCX Queue Control
3913
// - qctl tracks 2-input queue state for each of 6 destinations
3914
// through grant signals available from pcx.
3915
 
3916
// L2 Bank0 Queue Monitor
3917
lsu_pcx_qmon  l2bank0_qmon (
3918
    .rclk         (rclk),
3919
    .grst_l       (grst_l),
3920
    .arst_l       (arst_l),
3921 113 albert.wat
    `SIMPLY_RISC_SCANIN,
3922 95 fafa1971
    .se(se),
3923
    .so(),
3924
  .send_by_pcx  (pcx_spc_grant_px[0]),
3925
  .send_to_pcx  (spc_pcx_req_update_w2[0]),
3926
  //.qwrite   (queue_write[0]),
3927
  .qwrite   (pre_qwr[0]),
3928
  .sel_qentry0  (sel_qentry0[0])
3929
);
3930
 
3931
// L2 Bank1 Queue Monitor
3932
lsu_pcx_qmon  l2bank1_qmon (
3933
    .rclk         (rclk),
3934
    .grst_l       (grst_l),
3935
    .arst_l       (arst_l),
3936 113 albert.wat
    `SIMPLY_RISC_SCANIN,
3937 95 fafa1971
    .se(se),
3938
    .so(),
3939
  .send_by_pcx  (pcx_spc_grant_px[1]),
3940
  .send_to_pcx  (spc_pcx_req_update_w2[1]),
3941
  //.qwrite   (queue_write[1]),
3942
  .qwrite   (pre_qwr[1]),
3943
  .sel_qentry0  (sel_qentry0[1])
3944
);
3945
 
3946
// L2 Bank2 Queue Monitor
3947
lsu_pcx_qmon  l2bank2_qmon (
3948
    .rclk         (rclk),
3949
    .grst_l       (grst_l),
3950
    .arst_l       (arst_l),
3951 113 albert.wat
    `SIMPLY_RISC_SCANIN,
3952 95 fafa1971
    .se(se),
3953
    .so(),
3954
  .send_by_pcx  (pcx_spc_grant_px[2]),
3955
  .send_to_pcx  (spc_pcx_req_update_w2[2]),
3956
  //.qwrite   (queue_write[2]),
3957
  .qwrite   (pre_qwr[2]),
3958
  .sel_qentry0  (sel_qentry0[2])
3959
);
3960
 
3961
// L2 Bank3 Queue Monitor
3962
lsu_pcx_qmon  l2bank3_qmon (
3963
    .rclk         (rclk),
3964
    .grst_l       (grst_l),
3965
    .arst_l       (arst_l),
3966 113 albert.wat
    `SIMPLY_RISC_SCANIN,
3967 95 fafa1971
    .se(se),
3968
    .so(),
3969
  .send_by_pcx  (pcx_spc_grant_px[3]),
3970
  .send_to_pcx  (spc_pcx_req_update_w2[3]),
3971
  //.qwrite   (queue_write[3]),
3972
  .qwrite   (pre_qwr[3]),
3973
  .sel_qentry0  (sel_qentry0[3])
3974
);
3975
 
3976
// FP/IO Bridge Queue Monitor
3977
lsu_pcx_qmon  fpiobridge_qmon (
3978
    .rclk         (rclk),
3979
    .grst_l       (grst_l),
3980
    .arst_l       (arst_l),
3981 113 albert.wat
    `SIMPLY_RISC_SCANIN,
3982 95 fafa1971
    .se(se),
3983
    .so(),
3984
  .send_by_pcx  (pcx_spc_grant_px[4]),
3985
  .send_to_pcx  (spc_pcx_req_update_w2[4]),
3986
  //.qwrite   (queue_write[4]),
3987
  .qwrite   (pre_qwr[4]),
3988
  .sel_qentry0  (sel_qentry0[4])
3989
);
3990
 
3991
 
3992
 
3993
 
3994
// 5/13/03: timing fix for lsu_dtag_perror_w2 thru st_pick
3995
wire  [3:0]  error_en;
3996
wire  [3:0]  error_rst_thrd;
3997
 
3998
//assign  error_en[0] = lmq_enable[0] | (lsu_cpx_pkt_atm_st_cmplt & dcfill_active_e & dfq_byp_sel[0]);
3999
assign  error_en[0] = lsu_ld_inst_vld_g[0];
4000
assign  error_en[1] = lsu_ld_inst_vld_g[1];
4001
assign  error_en[2] = lsu_ld_inst_vld_g[2];
4002
assign  error_en[3] = lsu_ld_inst_vld_g[3];
4003
 
4004
//assign  error_rst_thrd[0] = reset | (lsu_ld0_pcx_rq_sel_d1 & lsu_pcx_ld_dtag_perror_w2) ;
4005
//assign  error_rst_thrd[1] = reset | (lsu_ld1_pcx_rq_sel_d1 & lsu_pcx_ld_dtag_perror_w2) ;
4006
//assign  error_rst_thrd[2] = reset | (lsu_ld2_pcx_rq_sel_d1 & lsu_pcx_ld_dtag_perror_w2) ;
4007
//assign  error_rst_thrd[3] = reset | (lsu_ld3_pcx_rq_sel_d1 & lsu_pcx_ld_dtag_perror_w2) ;
4008
 
4009
// reset moved to d2 'cos if 1st pkt is speculative and grant=0, error should not be reset.
4010
//bug4512 - stb_full_raw has to be qual w/ ld[0-3] inst_vld_w2
4011
//          also, need to qualify stb_full_raw w/ fp loads i.e. dont reset error if full raw is for fp double loads
4012
assign  error_rst_thrd[0] = reset | (ld0_pcx_rq_sel_d2 & ~pcx_req_squash_d1)
4013
                                | (ld0_inst_vld_w2 & ld_stb_full_raw_w2 & ~dbl_force_l2access_w2 & thread0_w2) ; // Bug4512
4014
                                //| (ld_stb_full_raw_w2 & thread0_w2) ; // Bug 4361
4015
 
4016
assign  error_rst_thrd[1] = reset | (ld1_pcx_rq_sel_d2 & ~pcx_req_squash_d1)
4017
                                | (ld1_inst_vld_w2 & ld_stb_full_raw_w2 & ~dbl_force_l2access_w2 & thread1_w2) ;
4018
 
4019
assign  error_rst_thrd[2] = reset | (ld2_pcx_rq_sel_d2 & ~pcx_req_squash_d1)
4020
                                | (ld2_inst_vld_w2 & ld_stb_full_raw_w2 & ~dbl_force_l2access_w2 & thread2_w2) ;
4021
 
4022
assign  error_rst_thrd[3] = reset | (ld3_pcx_rq_sel_d2 & ~pcx_req_squash_d1)
4023
                                | (ld3_inst_vld_w2 & ld_stb_full_raw_w2 & ~dbl_force_l2access_w2 & thread3_w2) ;
4024
 
4025
//assign  lsu_error_rst[3:0]  =  error_rst[3:0];
4026
 
4027
wire    dtag_perror3,dtag_perror2,dtag_perror1,dtag_perror0;
4028
 
4029
// Thread 0
4030 113 albert.wat
dffre_s  #(1) error_t0 (
4031 95 fafa1971
        .din    (lsu_dcache_tag_perror_g),
4032
        .q      (dtag_perror0),
4033
        .rst  (error_rst_thrd[0]), .en     (error_en[0]),
4034
        .clk    (clk),
4035 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
4036 95 fafa1971
        );
4037
 
4038
// Thread 1
4039 113 albert.wat
dffre_s  #(1) error_t1 (
4040 95 fafa1971
        .din    (lsu_dcache_tag_perror_g),
4041
        .q      (dtag_perror1),
4042
        .rst  (error_rst_thrd[1]), .en     (error_en[1]),
4043
        .clk    (clk),
4044 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
4045 95 fafa1971
        );
4046
 
4047
// Thread 2
4048 113 albert.wat
dffre_s  #(1) error_t2 (
4049 95 fafa1971
        .din    (lsu_dcache_tag_perror_g),
4050
        .q      (dtag_perror2),
4051
        .rst  (error_rst_thrd[2]), .en     (error_en[2]),
4052
        .clk    (clk),
4053 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
4054 95 fafa1971
        );
4055
 
4056
// Thread 3
4057 113 albert.wat
dffre_s  #(1) error_t3 (
4058 95 fafa1971
        .din    (lsu_dcache_tag_perror_g),
4059
        .q      (dtag_perror3),
4060
        .rst  (error_rst_thrd[3]), .en     (error_en[3]),
4061
        .clk    (clk),
4062 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
4063 95 fafa1971
        );
4064
 
4065
assign  lsu_dtag_perror_w2[3] = dtag_perror3 ;
4066
assign  lsu_dtag_perror_w2[2] = dtag_perror2 ;
4067
assign  lsu_dtag_perror_w2[1] = dtag_perror1 ;
4068
assign  lsu_dtag_perror_w2[0] = dtag_perror0 ;
4069
 
4070
// Determine if ld pkt requires correction due to dtag parity error.
4071
assign  lsu_pcx_ld_dtag_perror_w2 =
4072
  ld_pcx_rq_sel[0] ? dtag_perror0 :
4073
    ld_pcx_rq_sel[1] ? dtag_perror1 :
4074
      ld_pcx_rq_sel[2] ? dtag_perror2 : dtag_perror3 ;
4075
 
4076
 
4077
//=================================================================================================
4078
//
4079
// THREAD RETRY DETECTION (picker related logic)
4080
//
4081
//=================================================================================================
4082
 
4083
//bug4814 - move pick_staus out of picker and reset pick status when all 12 valid requests have
4084
//          is picked and not squashed.
4085
 
4086
assign  ld_thrd_pick_din[0]  =  ld_thrd_pick_status[0] | (ld0_pcx_rq_sel_d2 & ~pcx_req_squash_d1) ;
4087
assign  ld_thrd_pick_din[1]  =  ld_thrd_pick_status[1] | (ld1_pcx_rq_sel_d2 & ~pcx_req_squash_d1) ;
4088
assign  ld_thrd_pick_din[2]  =  ld_thrd_pick_status[2] | (ld2_pcx_rq_sel_d2 & ~pcx_req_squash_d1) ;
4089
assign  ld_thrd_pick_din[3]  =  ld_thrd_pick_status[3] | (ld3_pcx_rq_sel_d2 & ~pcx_req_squash_d1) ;
4090
 
4091
assign  ld_thrd_pick_rst  =  ~|(ld_events_raw[3:0] & ~ld_thrd_pick_din[3:0]) ;
4092
 
4093
assign  ld_thrd_pick_status_din[3:0] =  ld_thrd_pick_din[3:0] & ~{4{all_thrd_pick_rst}} ;
4094
//assign  ld_thrd_pick_status_din[3:0]  =  ld_thrd_pick_din[3:0] & ~{4{ld_thrd_pick_rst}} ;
4095
 
4096
assign  st_thrd_pick_din[0] = st_thrd_pick_status[0] | (st0_pcx_rq_sel_d2 & ~pcx_req_squash_d1) ;
4097
assign  st_thrd_pick_din[1] = st_thrd_pick_status[1] | (st1_pcx_rq_sel_d2 & ~pcx_req_squash_d1) ;
4098
assign  st_thrd_pick_din[2] = st_thrd_pick_status[2] | (st2_pcx_rq_sel_d2 & ~pcx_req_squash_d1) ;
4099
assign  st_thrd_pick_din[3] = st_thrd_pick_status[3] | (st3_pcx_rq_sel_d2 & ~pcx_req_squash_d1) ;
4100
 
4101
assign  st_thrd_pick_rst  =  ~|(st_events_raw[3:0] & ~st_thrd_pick_din[3:0]) ;
4102
assign  st_thrd_pick_status_din[3:0]  =  st_thrd_pick_din[3:0] & ~{4{all_thrd_pick_rst}} ;
4103
//assign  st_thrd_pick_status_din[3:0]  =  st_thrd_pick_din[3:0] & ~{4{st_thrd_pick_rst}} ;
4104
 
4105
assign  misc_thrd_pick_din[3] = misc_thrd_pick_status[3] | lsu_spu_ldst_ack ;
4106
assign  misc_thrd_pick_din[2] = misc_thrd_pick_status[2] | (fpop_pcx_rq_sel_d2 & ~pcx_req_squash_d1) ;
4107
assign  misc_thrd_pick_din[1] = misc_thrd_pick_status[1] | lsu_tlu_pcxpkt_ack ;
4108
assign  misc_thrd_pick_din[0] = misc_thrd_pick_status[0] | lsu_fwdpkt_pcx_rq_sel ;
4109
 
4110
assign  misc_thrd_pick_rst  =  ~|(misc_events_raw[3:0] & ~misc_thrd_pick_din[3:0]) ;
4111
 
4112
assign  misc_thrd_pick_status_din[3:0]  =  misc_thrd_pick_din[3:0] & ~{4{all_thrd_pick_rst}} ;
4113
//assign  misc_thrd_pick_status_din[3:0]  =  misc_thrd_pick_din[3:0] & ~{4{misc_thrd_pick_rst}} ;
4114
 
4115
assign  all_thrd_pick_rst  =  ld_thrd_pick_rst & st_thrd_pick_rst & misc_thrd_pick_rst ;
4116
 
4117
 
4118 113 albert.wat
dff_s    #(4) ff_ld_thrd_force(
4119 95 fafa1971
        .din    (ld_thrd_pick_status_din[3:0]),
4120
        .q      (ld_thrd_pick_status[3:0]),
4121
        .clk    (clk),
4122 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
4123 95 fafa1971
        );
4124
 
4125 113 albert.wat
dff_s    #(4) ff_st_thrd_force(
4126 95 fafa1971
        .din    (st_thrd_pick_status_din[3:0]),
4127
        .q      (st_thrd_pick_status[3:0]),
4128
        .clk    (clk),
4129 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
4130 95 fafa1971
        );
4131
 
4132 113 albert.wat
dff_s    #(4) ff_misc_thrd_force(
4133 95 fafa1971
        .din    (misc_thrd_pick_status_din[3:0]),
4134
        .q      (misc_thrd_pick_status[3:0]),
4135
        .clk    (clk),
4136 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
4137 95 fafa1971
        );
4138
 
4139
assign  ld_thrd_force_d1[3:0]  =  ~ld_thrd_pick_status[3:0] ;
4140
assign  st_thrd_force_d1[3:0]  =  ~st_thrd_pick_status[3:0] ;
4141
assign  misc_thrd_force_d1[3:0]  =  ~misc_thrd_pick_status[3:0] ;
4142
 
4143
assign ld_thrd_force_vld[0]  =  ld_thrd_force_d1[0] &
4144
                               ~(ld0_pcx_rq_sel_d1 | ld0_pcx_rq_sel_d2) ;
4145
 
4146
assign ld_thrd_force_vld[1]  =  ld_thrd_force_d1[1] &
4147
                               ~(ld1_pcx_rq_sel_d1 | ld1_pcx_rq_sel_d2) ;
4148
 
4149
assign ld_thrd_force_vld[2]  =  ld_thrd_force_d1[2] &
4150
                               ~(ld2_pcx_rq_sel_d1 | ld2_pcx_rq_sel_d2) ;
4151
 
4152
assign ld_thrd_force_vld[3]  =  ld_thrd_force_d1[3] &
4153
                               ~(ld3_pcx_rq_sel_d1 | ld3_pcx_rq_sel_d2) ;
4154
 
4155
 
4156
// force valid to store picker if 1 entry is free and if it not picked in d1/d2
4157
assign st_thrd_force_vld[0]  =  st_thrd_force_d1[0] &
4158
                               ~(st0_pcx_rq_sel_d1 | st0_pcx_rq_sel_d2) ;
4159
 
4160
assign st_thrd_force_vld[1]  =  st_thrd_force_d1[1] &
4161
                               ~(st1_pcx_rq_sel_d1 | st1_pcx_rq_sel_d2) ;
4162
 
4163
assign st_thrd_force_vld[2]  =  st_thrd_force_d1[2] &
4164
                               ~(st2_pcx_rq_sel_d1 | st2_pcx_rq_sel_d2) ;
4165
 
4166
assign st_thrd_force_vld[3]  =  st_thrd_force_d1[3] &
4167
                               ~(st3_pcx_rq_sel_d1 | st3_pcx_rq_sel_d2) ;
4168
 
4169
 
4170
 
4171
// force valid to misc picker if 1 entry is free and if it is not picked in d1/d2
4172
assign misc_thrd_force_vld[0]  =  misc_thrd_force_d1[0] &
4173
                                 ~(fwdpkt_pcx_rq_sel_d1 | fwdpkt_pcx_rq_sel_d2) ;
4174
 
4175
assign misc_thrd_force_vld[1]  =  misc_thrd_force_d1[1] &
4176
                                 ~(intrpt_pcx_rq_sel_d1 | intrpt_pcx_rq_sel_d2);
4177
 
4178
assign misc_thrd_force_vld[2]  =  misc_thrd_force_d1[2] &
4179
                                 ~(fpop_pcx_rq_sel_d1 | fpop_pcx_rq_sel_d2) ;
4180
 
4181
assign misc_thrd_force_vld[3]  =  misc_thrd_force_d1[3] &
4182
                                 ~(strm_pcx_rq_sel_d1 | strm_pcx_rq_sel_d2) ;
4183
 
4184
//2nd level pick thread force - force only req are valid and l2bnk is free
4185
assign all_thrd_force_vld[0]  =  1'b0 ;
4186
 
4187
assign all_thrd_force_vld[1]  =
4188
                    |(ld_thrd_force_vld[3:0] &
4189
                     {ld3_pcx_rq_vld,ld2_pcx_rq_vld,ld1_pcx_rq_vld,ld0_pcx_rq_vld}) ;
4190
 
4191
assign all_thrd_force_vld[2]  =
4192
                    |(st_thrd_force_vld[3:0] &
4193
                     {st3_pcx_rq_vld,st2_pcx_rq_vld,st1_pcx_rq_vld,st0_pcx_rq_vld}) ;
4194
 
4195
assign all_thrd_force_vld[3]  =
4196
                    |(misc_thrd_force_vld[3:0] &
4197
                     {strm_pcx_rq_vld,fpop_pcx_rq_vld,intrpt_pcx_rq_vld,fwdpkt_rq_vld}) ;
4198
 
4199
 
4200
endmodule

powered by: WebSVN 2.1.0

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