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

Subversion Repositories s1_core

[/] [s1_core/] [trunk/] [hdl/] [rtl/] [sparc_core/] [lsu_qctl2.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_qctl2.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
////////////////////////////////////////////////////////////////////////
35
// header file includes
36
////////////////////////////////////////////////////////////////////////
37 113 albert.wat
`include  "sys.h" // system level definition file which contains the 
38 95 fafa1971
                  // time scale definition
39 113 albert.wat
`include  "iop.h"
40 95 fafa1971
 
41 113 albert.wat
`include  "lsu.h"
42 95 fafa1971
 
43
////////////////////////////////////////////////////////////////////////
44
// Local header file includes / local defines
45
////////////////////////////////////////////////////////////////////////
46
 
47
module lsu_qctl2 ( /*AUTOARG*/
48
   // Outputs
49
   so, lsu_fwd_rply_sz1_unc, lsu_dcache_iob_rd_w, ldd_in_dfq_out,
50
   lsu_dfq_rd_vld_d1, dfq_byp_ff_en, lsu_dfill_data_sel_hi,
51
   lsu_ifill_pkt_vld, cpx_fwd_pkt_en_cx, lsu_cpxpkt_type_dcd_cx,
52
   lsu_cpu_dcd_sel, lsu_cpu_uhlf_sel, lsu_iobrdge_rply_data_sel,
53
   lsu_iobrdge_fwd_pkt_vld, lsu_tlu_cpx_vld, lsu_tlu_cpx_req,
54
   lsu_tlu_intpkt, ld_sec_active, dfq_byp_sel,
55
   lsu_cpx_ld_dtag_perror_e, lsu_cpx_ld_dcache_perror_e,
56
   lsu_exu_rd_m, lsu_spu_strm_ack_cmplt, lsu_atm_st_cmplt_e,
57
   dva_svld_e, dfq_wptr_vld, dfq_wptr, lsu_dfq_flsh_cmplt,
58
   dfq_rptr_vld, dfq_rptr, lsu_ifu_stallreq, dva_snp_addr_e,
59
   lsu_st_ack_dq_stb, lsu_cpx_rmo_st_ack, lsu_st_wr_dcache,
60
   cpx_st_ack_tid0, cpx_st_ack_tid1, cpx_st_ack_tid2,
61
   cpx_st_ack_tid3, lsu_tlu_l2_dmiss, lsu_l2fill_vld,
62
   lsu_byp_ldd_oddrd_m, lsu_pcx_fwd_reply, lsu_fwdpkt_vld,
63
   lsu_dcfill_active_e, lsu_dfq_ld_vld, lsu_fldd_vld_en,
64
   lsu_dfill_dcd_thrd, lsu_fwdpkt_dest, dva_snp_bit_wr_en_e,
65
   lsu_cpx_spc_inv_vld, lsu_cpx_thrdid, lsu_cpx_stack_dcfill_vld,
66
   lsu_dfq_vld_entry_w, lsu_cpx_stack_icfill_vld, lsu_dfq_st_vld,
67
   lsu_dfq_ldst_vld, lsu_qdp2_dfq_ld_vld, lsu_qdp2_dfq_st_vld,
68
   lsu_cpx_stack_dcfill_vld_b130, lsu_dfq_vld, lsu_dfq_byp_ff_en,
69
   // Inputs
70
   rclk, grst_l, arst_l, si, se, rst_tri_en, ld_inst_vld_e,
71
   ifu_pcx_pkt_b51, ifu_pcx_pkt_b41t40, ifu_pcx_pkt_b10t5,
72
   lsu_dfq_rdata_flush_bit, lsu_dfq_rdata_b17_b0,
73
   cpx_spc_data_cx_b144to140, cpx_spc_data_cx_b138,
74
   cpx_spc_data_cx_b135to134,
75
   cpx_spc_data_cx_b133, cpx_spc_data_cx_b130, cpx_spc_data_cx_b129,
76
   cpx_spc_data_cx_b128, cpx_spc_data_cx_b125,
77
   cpx_spc_data_cx_b124to123, cpx_spc_data_cx_b120to118,
78
   cpx_spc_data_cx_b71to70, cpx_spc_data_cx_b0, cpx_spc_data_cx_b4,
79
   cpx_spc_data_cx_b8, cpx_spc_data_cx_b12, cpx_spc_data_cx_b16,
80
   cpx_spc_data_cx_b20, cpx_spc_data_cx_b24, cpx_spc_data_cx_b28,
81
   cpx_spc_data_cx_b32, cpx_spc_data_cx_b35, cpx_spc_data_cx_b38,
82
   cpx_spc_data_cx_b41, cpx_spc_data_cx_b44, cpx_spc_data_cx_b47,
83
   cpx_spc_data_cx_b50, cpx_spc_data_cx_b53, cpx_spc_data_cx_b56,
84
   cpx_spc_data_cx_b60, cpx_spc_data_cx_b64, cpx_spc_data_cx_b68,
85
   cpx_spc_data_cx_b72, cpx_spc_data_cx_b76, cpx_spc_data_cx_b80,
86
   cpx_spc_data_cx_b84, cpx_spc_data_cx_b88, cpx_spc_data_cx_b91,
87
   cpx_spc_data_cx_b94, cpx_spc_data_cx_b97, cpx_spc_data_cx_b100,
88
   cpx_spc_data_cx_b103, cpx_spc_data_cx_b106, cpx_spc_data_cx_b109,
89
   cpx_spc_data_cx_b1, cpx_spc_data_cx_b5, cpx_spc_data_cx_b9,
90
   cpx_spc_data_cx_b13, cpx_spc_data_cx_b17, cpx_spc_data_cx_b21,
91
   cpx_spc_data_cx_b25, cpx_spc_data_cx_b29, cpx_spc_data_cx_b57,
92
   cpx_spc_data_cx_b61, cpx_spc_data_cx_b65, cpx_spc_data_cx_b69,
93
   cpx_spc_data_cx_b73, cpx_spc_data_cx_b77, cpx_spc_data_cx_b81,
94
   cpx_spc_data_cx_b85, ifu_lsu_rd_e, lmq_ld_rd1, lmq_ldd_vld,
95
   dfq_tid, const_cpuid, lmq_ld_addr_b3, ifu_lsu_ibuf_busy,
96
   ifu_lsu_inv_clear, lsu_byp_misc_sz_e, lsu_dfq_byp_tid,
97
   lsu_cpx_pkt_atm_st_cmplt, lsu_cpx_pkt_l2miss, lsu_cpx_pkt_tid,
98
   lsu_cpx_pkt_invwy, lsu_dfq_byp_flush, lsu_dfq_byp_type,
99
   lsu_dfq_byp_invwy_vld, lsu_cpu_inv_data_b13to9,
100
   lsu_cpu_inv_data_b7to2, lsu_cpu_inv_data_b0, lsu_cpx_pkt_inv_pa,
101
   lsu_cpx_pkt_ifill_type, lsu_cpx_pkt_atomic, lsu_cpx_pkt_binit_st,
102
   lsu_cpx_pkt_prefetch, lsu_dfq_byp_binit_st, lsu_tlbop_force_swo,
103
   lsu_iobrdge_tap_rq_type, lsu_dcache_tag_perror_g,
104
   lsu_dcache_data_perror_g, lsu_cpx_pkt_perror_iinv,
105
   lsu_cpx_pkt_perror_dinv, lsu_cpx_pkt_perror_set,
106
   lsu_l2fill_fpld_e, lsu_cpx_pkt_strm_ack, ifu_lsu_memref_d,
107
   lsu_fwdpkt_pcx_rq_sel, lsu_imiss_pcx_rq_sel_d1,
108
   lsu_dfq_byp_cpx_inv, lsu_dfq_byp_stack_adr_b54,
109
   lsu_dfq_byp_stack_wrway, lsu_dfq_rdata_st_ack_type,
110
   lsu_dfq_rdata_stack_dcfill_vld, lsu_dfq_rdata_stack_iinv_vld,
111
   lsu_dfq_rdata_cpuid, lsu_dfq_byp_atm, lsu_ld_inst_vld_g,
112
   lsu_dfq_rdata_type, lsu_dfq_rdata_invwy_vld, ifu_lsu_fwd_data_vld,
113
   ifu_lsu_fwd_wr_ack, lsu_dfq_rdata_rq_type, lsu_dfq_rdata_b103,
114
   sehold
115
   ) ;
116
 
117
 
118
input     rclk ;
119
input     grst_l;
120
input     arst_l;
121
input     si;
122
input     se;
123
input     rst_tri_en;
124
output    so;
125
 
126
input                   ld_inst_vld_e;        // valid ld inst; d-stage
127
input                   ifu_pcx_pkt_b51;        // pcx pkt from ifu on imiss
128
input [1:0]             ifu_pcx_pkt_b41t40;     // pcx pkt from ifu on imiss
129
input [5:0]             ifu_pcx_pkt_b10t5;      // pcx pkt from ifu on imiss
130
//input                   cpx_spc_data_rdy_cx ;   // data ready to processor
131
//input [`CPX_WIDTH-1:71] cpx_spc_data_cx ;       // cpx to processor packet
132
//input [`CPX_WIDTH-1:0] cpx_spc_data_cx ;       // cpx to processor packet
133
//input [17:0]            cpx_spc_data_b17t0_cx ; // cpx to processor packet
134
   input                lsu_dfq_rdata_flush_bit;
135
   input [17:0]         lsu_dfq_rdata_b17_b0;
136
 
137 113 albert.wat
input [`CPX_WIDTH-1:140] cpx_spc_data_cx_b144to140 ;       // vld, req type
138 95 fafa1971
input                   cpx_spc_data_cx_b138 ;
139
//input                   cpx_spc_data_cx_b136 ;  
140 113 albert.wat
input [`CPX_TH_HI:`CPX_TH_LO] cpx_spc_data_cx_b135to134 ;  // thread id
141 95 fafa1971
input                   cpx_spc_data_cx_b133 ;
142
input                   cpx_spc_data_cx_b130 ;
143
input                   cpx_spc_data_cx_b129 ;
144
input                   cpx_spc_data_cx_b128 ;
145
input                   cpx_spc_data_cx_b125 ;
146 113 albert.wat
input [`CPX_PERR_DINV+1:`CPX_PERR_DINV] cpx_spc_data_cx_b124to123 ;  // inv packet iinv,dinv
147
input [`CPX_INV_CID_HI:`CPX_INV_CID_LO] cpx_spc_data_cx_b120to118 ;  // inv packet cpu id
148 95 fafa1971
input [1:0]             cpx_spc_data_cx_b71to70 ;
149
 
150
input        cpx_spc_data_cx_b0 ;
151
input        cpx_spc_data_cx_b4 ;
152
input        cpx_spc_data_cx_b8 ;
153
input        cpx_spc_data_cx_b12 ;
154
input        cpx_spc_data_cx_b16 ;
155
input        cpx_spc_data_cx_b20 ;
156
input        cpx_spc_data_cx_b24 ;
157
input        cpx_spc_data_cx_b28 ;
158
 
159
input        cpx_spc_data_cx_b32 ;
160
input        cpx_spc_data_cx_b35 ;
161
input        cpx_spc_data_cx_b38 ;
162
input        cpx_spc_data_cx_b41 ;
163
input        cpx_spc_data_cx_b44 ;
164
input        cpx_spc_data_cx_b47 ;
165
input        cpx_spc_data_cx_b50 ;
166
input        cpx_spc_data_cx_b53 ;
167
 
168
input        cpx_spc_data_cx_b56 ;
169
input        cpx_spc_data_cx_b60 ;
170
input        cpx_spc_data_cx_b64 ;
171
input        cpx_spc_data_cx_b68 ;
172
input        cpx_spc_data_cx_b72 ;
173
input        cpx_spc_data_cx_b76 ;
174
input        cpx_spc_data_cx_b80 ;
175
input        cpx_spc_data_cx_b84 ;
176
 
177
input        cpx_spc_data_cx_b88 ;
178
input        cpx_spc_data_cx_b91 ;
179
input        cpx_spc_data_cx_b94 ;
180
input        cpx_spc_data_cx_b97 ;
181
input        cpx_spc_data_cx_b100 ;
182
input        cpx_spc_data_cx_b103 ;
183
input        cpx_spc_data_cx_b106 ;
184
input        cpx_spc_data_cx_b109 ;
185
 
186
input        cpx_spc_data_cx_b1 ;
187
input        cpx_spc_data_cx_b5 ;
188
input        cpx_spc_data_cx_b9 ;
189
input        cpx_spc_data_cx_b13 ;
190
input        cpx_spc_data_cx_b17 ;
191
input        cpx_spc_data_cx_b21 ;
192
input        cpx_spc_data_cx_b25 ;
193
input        cpx_spc_data_cx_b29 ;
194
 
195
input        cpx_spc_data_cx_b57 ;
196
input        cpx_spc_data_cx_b61 ;
197
input        cpx_spc_data_cx_b65 ;
198
input        cpx_spc_data_cx_b69 ;
199
input        cpx_spc_data_cx_b73 ;
200
input        cpx_spc_data_cx_b77 ;
201
input        cpx_spc_data_cx_b81 ;
202
input        cpx_spc_data_cx_b85 ;
203
 
204
input [4:0]             ifu_lsu_rd_e ;          // rd for current load request.
205
//input                   lsu_ld_miss_g ;         // load misses in dcache.
206
input  [4:0]            lmq_ld_rd1 ;            // rd for all loads
207
input                   lmq_ldd_vld ;           // ld double   
208
//input                   ld_stb_full_raw_g ;    // full raw for load - thread0
209
//input                   ld_stb_partial_raw_g ; // partial raw for load - thread0
210
/*
211
input                   ld_sec_hit_thrd0 ;      // ld has sec. hit against th0
212
input                   ld_sec_hit_thrd1 ;      // ld has sec. hit against th1
213
input                   ld_sec_hit_thrd2 ;      // ld has sec. hit against th2
214
input                   ld_sec_hit_thrd3 ;      // ld has sec. hit against th3
215
*/
216
input   [1:0]           dfq_tid ;               // thread-id for load at head of DFQ. 
217
//input   [1:0]           dfq_byp_tid ;           // in-flight thread-id for load at head of DFQ. 
218
//input                   ldxa_internal ;         // internal ldxa, stg g 
219
//input [3:0]             ld_thrd_byp_sel ;       // stb,ldxa thread byp sel
220
input [2:0]             const_cpuid ;           // cpu id
221
input                   lmq_ld_addr_b3 ;        // bit3 of addr at head of queue.
222
//input                   ifu_tlu_inst_vld_m ;    // inst is vld - wstage
223
//input                   tlu_ifu_flush_pipe_w ;  // flush event in wstage
224
//input                   lsu_ldstub_g ;          // ldstub(a) instruction
225
//input                   lsu_swap_g ;            // swap(a) instruction 
226
//input                   tlu_lsu_pcxpkt_vld ;
227
//input [11:10]           tlu_lsu_pcxpkt_l2baddr ;
228
//input [19:18]           tlu_lsu_pcxpkt_tid ;
229
input                   ifu_lsu_ibuf_busy ;
230
input                   ifu_lsu_inv_clear ;
231
input   [1:0]           lsu_byp_misc_sz_e ;     // size for ldxa/raw etc
232
input   [1:0]           lsu_dfq_byp_tid ;
233
input                   lsu_cpx_pkt_atm_st_cmplt ;
234
input                   lsu_cpx_pkt_l2miss ;
235
input   [1:0]           lsu_cpx_pkt_tid ;
236
input   [1:0]           lsu_cpx_pkt_invwy ;     // invalidate way
237
input                   lsu_dfq_byp_flush ;
238
input   [5:0]           lsu_dfq_byp_type ;
239
input                   lsu_dfq_byp_invwy_vld ;
240
//input   [13:0]          lsu_cpu_inv_data ;
241
input   [13:9]          lsu_cpu_inv_data_b13to9 ;
242
input   [7:2]           lsu_cpu_inv_data_b7to2 ;
243
input                   lsu_cpu_inv_data_b0 ;
244
//input   [2:0]           lsu_dfq_byp_cpuid ;
245
input   [4:0]           lsu_cpx_pkt_inv_pa ;    // invalidate pa [10:6]
246
input                   lsu_cpx_pkt_ifill_type ;
247
//input                   stb_cam_hit ; REMOVED
248
input                   lsu_cpx_pkt_atomic ;
249
//input                   lsu_dfq_byp_stquad_pkt2 ;
250
//input                   lsu_cpx_pkt_stquad_pkt2 ;
251
input                   lsu_cpx_pkt_binit_st ;
252
input                   lsu_cpx_pkt_prefetch ;
253
input                   lsu_dfq_byp_binit_st ;
254
//input   [3:0]           lsu_stb_empty ;
255
input                   lsu_tlbop_force_swo ;
256
input   [7:3]           lsu_iobrdge_tap_rq_type ;
257
input                   lsu_dcache_tag_perror_g ;  // dcache tag parity error
258
input                   lsu_dcache_data_perror_g ; // dcache data parity error
259
//input                   lsu_dfq_byp_perror_dinv ;  // dtag perror corr. st ack
260
//input                   lsu_dfq_byp_perror_iinv ;  // itag perror corr. st ack
261
 
262
 
263
input                   lsu_cpx_pkt_perror_iinv ;   // itag perror corr. st ack
264
input                   lsu_cpx_pkt_perror_dinv ;   // dtag perror corr. st ack
265
input   [1:0]           lsu_cpx_pkt_perror_set ;   // dtag perror - spec. b54
266
//input                   lsu_diagnstc_wr_src_sel_e ;// dcache/dtag/vld
267
input                   lsu_l2fill_fpld_e ;      // fp load
268
input                   lsu_cpx_pkt_strm_ack ;
269
 
270
input                   ifu_lsu_memref_d ;
271
//input   [3:0]           lmq_enable;
272
//input   [3:0]           ld_pcx_rq_sel ;
273
input                   lsu_fwdpkt_pcx_rq_sel ;
274
//input                   lsu_ld0_pcx_rq_sel_d1, lsu_ld1_pcx_rq_sel_d1 ;
275
//input                   lsu_ld2_pcx_rq_sel_d1, lsu_ld3_pcx_rq_sel_d1 ;
276
input                   lsu_imiss_pcx_rq_sel_d1 ;
277
 
278
//input                   lsu_dc_iob_access_e;
279
 
280
//   input                mbist_dcache_write;
281
//   input                mbist_dcache_read;
282
 
283
 
284
input                   lsu_dfq_byp_cpx_inv ;
285
//input                 lsu_dfq_byp_stack_dcfill_vld ;
286
input  [1:0]            lsu_dfq_byp_stack_adr_b54;
287
input  [1:0]            lsu_dfq_byp_stack_wrway;
288
 
289
input                   lsu_dfq_rdata_st_ack_type;
290
input                   lsu_dfq_rdata_stack_dcfill_vld;
291
 
292
input                   lsu_dfq_rdata_stack_iinv_vld;
293
 
294
input  [2:0]            lsu_dfq_rdata_cpuid;
295
 
296
input                   lsu_dfq_byp_atm;
297
 
298
input   [3:0]            lsu_ld_inst_vld_g ;
299
 
300
input   [5:0]            lsu_dfq_rdata_type ;
301
input                   lsu_dfq_rdata_invwy_vld ;
302
 
303
input                   ifu_lsu_fwd_data_vld ; // icache ramtest read cmplt
304
input                   ifu_lsu_fwd_wr_ack ;   // icache ramtest wr cmplt
305
 
306
input   [3:0]            lsu_dfq_rdata_rq_type ;
307
input                   lsu_dfq_rdata_b103 ;
308
 
309
input                   sehold ;
310
 
311
output                  lsu_fwd_rply_sz1_unc ;
312
output                  lsu_dcache_iob_rd_w ;
313
 
314
output                  ldd_in_dfq_out;
315
 
316
output                  lsu_dfq_rd_vld_d1 ;
317
output                  dfq_byp_ff_en ;
318
output                  lsu_dfill_data_sel_hi;// select hi or low order 8B. 
319
output                  lsu_ifill_pkt_vld ;   // ifill pkt vld
320
output                  cpx_fwd_pkt_en_cx ;
321
output  [5:0]           lsu_cpxpkt_type_dcd_cx ;
322
output  [7:0]           lsu_cpu_dcd_sel ;
323
output                  lsu_cpu_uhlf_sel ;
324
//output                  lsu_st_wr_sel_e ;
325
//output  [1:0]           lsu_st_ack_addr_b54 ;
326
//output  [1:0]           lsu_st_ack_wrwy ;       // cache set way to write to.
327
 
328
output  [2:0]           lsu_iobrdge_rply_data_sel ;
329
output                  lsu_iobrdge_fwd_pkt_vld ;
330
output                  lsu_tlu_cpx_vld;    // cpx pkt vld
331
output  [3:0]           lsu_tlu_cpx_req;    // cpx pkt rq type
332
output  [17:0]          lsu_tlu_intpkt;     // cpx interrupt pkt
333
//output                  lsu_tlu_pcxpkt_ack; // ack for intr pkt.
334
//output  [3:0]           lsu_intrpt_cmplt ;      // intrpt can restart thread
335
//output                  lsu_ld_sec_hit_l2access_g ;
336
//output  [1:0]           lsu_ld_sec_hit_wy_g ;
337
output                  ld_sec_active ;     // secondary bypassing
338
output  [3:0]           dfq_byp_sel ;
339
//output  [3:0]           lsu_dfq_byp_mxsel ; // to qdp1
340
//output  [3:0]           lmq_byp_misc_sel ;    // select g-stage lmq source
341
//output                  lsu_pcx_ld_dtag_perror_w2 ;
342
output                  lsu_cpx_ld_dtag_perror_e ;
343
output                  lsu_cpx_ld_dcache_perror_e ;
344
//output  [1:0]           lsu_cpx_atm_st_err ;
345
//output                  lsu_ignore_fill ;
346
//output  [4:0]           lsu_exu_rd_w2 ;
347
output  [4:0]           lsu_exu_rd_m ;
348
output  [1:0]           lsu_spu_strm_ack_cmplt ;
349
output                  lsu_atm_st_cmplt_e ;  // atm st ack will restart thread
350
output                  dva_svld_e ;        // snoop is valid
351
output                  dfq_wptr_vld ;          // write pointer valid
352
output  [4:0]           dfq_wptr ;              // encoded write pointer
353
output  [3:0]           lsu_dfq_flsh_cmplt ;
354
output                  dfq_rptr_vld ;          // read pointer valid
355
output  [4:0]           dfq_rptr ;              // encoded read pointer
356
output                  lsu_ifu_stallreq ;      // cfq has crossed high-water mark
357
output  [4:0]           dva_snp_addr_e;         // Upper 5b of cache set index PA[10:6]
358
//output  [3:0]           dva_snp_set_vld_e;      // Lower 2b of cache set index - decoded
359
//output  [1:0]           dva_snp_wy0_e ;         // way for addr<5:4>=00
360
//output  [1:0]           dva_snp_wy1_e ;         // way for addr<5:4>=01
361
//output  [1:0]           dva_snp_wy2_e ;         // way for addr<5:4>=10
362
//output  [1:0]           dva_snp_wy3_e ;         // way for addr<5:4>=11
363
//output  [3:0]           lsu_st_ack_rq_stb ;
364
output  [3:0]           lsu_st_ack_dq_stb ;
365
output  [3:0]           lsu_cpx_rmo_st_ack ;    // rmo ack clears
366
output                  lsu_st_wr_dcache ;
367
output                  cpx_st_ack_tid0 ;   // st ack for thread0
368
output                  cpx_st_ack_tid1 ;   // st ack for thread1
369
output                  cpx_st_ack_tid2 ;   // st ack for thread2
370
output                  cpx_st_ack_tid3 ;   // st ack for thread3
371
output  [3:0]           lsu_tlu_l2_dmiss ;       // performance cntr
372
//output  [3:0]           lsu_ifu_stq_busy ;         // thread is busy with 1 stq - not used
373
output                  lsu_l2fill_vld ;        // dfill data vld
374
output                  lsu_byp_ldd_oddrd_m ; // rd fill for non-alt ldd
375
output                  lsu_pcx_fwd_reply ;   // fwd reply on pcx pkt
376
//output                  lsu_intrpt_pkt_vld ;
377
output                  lsu_fwdpkt_vld;
378
//output  [3:0]           lsu_error_rst ;
379
output                  lsu_dcfill_active_e;    // not same as dcfill_active_e; qual'ed w/ ignore_fill
380
//output                  lsu_dfq_byp_vld ;
381
output                  lsu_dfq_ld_vld;
382
output                  lsu_fldd_vld_en;
383
output  [3:0]           lsu_dfill_dcd_thrd ;
384
output  [4:0]           lsu_fwdpkt_dest ;
385
//output                  dcfill_src_dfq_sel ;    // ld-inv is src
386
output [15:0]        dva_snp_bit_wr_en_e;
387
 
388
//output [3:0]         lsu_dcfill_mx_sel_e;
389
//output               lsu_dcfill_addr_mx_sel_e;
390
//output               lsu_dcfill_data_mx_sel_e;
391
//output               lsu_dcfill_size_mx_sel_e;
392
 
393
output               lsu_cpx_spc_inv_vld;  // dfq write data in[152]
394
output [3:0]         lsu_cpx_thrdid;
395
output               lsu_cpx_stack_dcfill_vld ;
396
 
397
//output        [3:0]           lsu_dtag_perror_w2 ;
398
 
399
output                  lsu_dfq_vld_entry_w ;
400
 
401
output                  lsu_cpx_stack_icfill_vld ;
402
 
403
output                  lsu_dfq_st_vld;
404
output                  lsu_dfq_ldst_vld;
405
   //pref counter
406
//   output [3:0] lsu_cpx_pref_ack;
407
 
408
output                  lsu_qdp2_dfq_ld_vld;
409
output                  lsu_qdp2_dfq_st_vld;
410
 
411
output                  lsu_cpx_stack_dcfill_vld_b130;
412
 
413
output                  lsu_dfq_vld ;
414
 
415
output                  lsu_dfq_byp_ff_en ;
416
 
417
/*AUTOWIRE*/
418
// Beginning of automatic wires (for undeclared instantiated-module outputs)
419 113 albert.wat
`ifdef SIMPLY_RISC_TWEAKS
420
wire dbb_reset_l;
421
wire clk;
422
wire fwd_reply_vld;
423
wire fwd_req_vld;
424
wire dcache_perror0;
425
wire dcache_perror1;
426
wire dcache_perror2;
427
wire dcache_perror3;
428
wire ldd_in_dfq_out_d1;
429
wire dfq_vld_entry_exists_d1;
430
`endif
431 95 fafa1971
// End of automatics
432
 
433
 
434
wire        cpx_local_st_ack_type ;
435
wire  [3:0] cpx_pkt_thrd_sel ;
436
//wire  [3:0] tap_thread ;
437
wire      cpx_reverse_req , cpx_reverse_req_d1 ;
438
wire    cpx_fwd_req,cpx_fwd_reply;
439
wire    fwdpkt_reset ;
440
wire        dfq_inv_vld ;
441
//wire    intrpt_vld_reset ;
442
//wire    intrpt_vld_en ;
443
//wire    ld0_sec_hit_g,ld1_sec_hit_g,ld2_sec_hit_g,ld3_sec_hit_g;
444
//wire  [3:0] intrpt_thread ;
445
wire    dfq_byp_ld_vld ;
446
//wire    intrpt_clr ;
447
wire    dfq_rptr_vld_d1 ;
448
wire    dfq_rd_advance ;
449
wire        dfq_wr_en, dfq_byp_full, dcfill_active_e ;
450
wire    dfq_thread0,dfq_thread1,dfq_thread2,dfq_thread3;
451
//wire    ld_any_thrd_byp_sel ;
452
wire    stwr_active_e,stdq_active_e ;
453
wire  [3:0] error_en ;
454
wire        ldd_vld_reset, ldd_vld_en, ldd_in_dfq_out ;
455
wire    ldd_non_alt_space ;
456
wire    ldd_oddrd_e ;
457
wire        inv_active_e ;
458
wire    dfq_st_vld ;
459
//wire    local_inv ;
460
wire    dfq_local_inv ;
461
//wire    st_ack_rq_stb_d1 ;
462
//wire    cpx_inv ;
463
wire    dfq_byp_inv_vld ;
464
wire    dfq_invwy_vld;
465
wire    local_pkt ;
466
wire    dfq_byp_st_vld ;
467
wire        dfq_vld_reset, dfq_vld_en ;
468
//wire  [3:0] st_wrwy_sel ;
469
//wire  [13:0]  cpx_cpu_inv_data ;
470
wire        dfq_vld_entry_exists ;
471
wire    cpx_st_ack_type,cpx_strm_st_ack_type,cpx_int_type;
472
wire    cpx_ld_type,cpx_ifill_type,cpx_evict_type;
473
wire  [5:0]     dfq_wptr_new_w_wrap ;   // 5b ptr with wrap bit.
474
wire  [5:0]     dfq_rptr_new_w_wrap ;   // 5b ptr with wrap bit.
475
wire  [5:0]     dfq_wptr_w_wrap ;   // 5b ptr with wrap bit.
476
//wire    i_and_d_codepend ;
477
wire    dfq_ld_type,dfq_ifill_type,dfq_evict_type ;
478
wire    dfq_st_ack_type,dfq_strm_st_ack_type,dfq_int_type;
479
wire  [5:0]     dfq_rptr_w_wrap ;   // 3b ptr with wrap bit.
480
wire  [3:0]   imiss_dcd_b54 ;
481
//wire    st_ack_rq_stb ;
482
//wire  [1:0] st_ack_tid ;
483
wire  [3:0] cpu_sel ;
484
wire  [1:0] fwdpkt_l2bnk_addr ;
485
//wire  [2:0] intrpt_l2bnk_addr ;
486
//wire  [3:0] dfq_byp_sel_m, dfq_byp_sel_g ;
487
//wire  [1:0] ld_error0,ld_error1,ld_error2,ld_error3 ;
488
//wire  [4:0] ld_l1hit_rd_m,ld_l1hit_rd_g;
489
wire  [4:0] ld_l1hit_rd_m;
490
//wire  [13:0]  dfq_inv_data ;
491
wire  [13:9]  dfq_inv_data_b13to9 ;
492
wire  [7:2]   dfq_inv_data_b7to2 ;
493
wire          dfq_inv_data_b0 ;
494
wire          fwdpkt_vld;
495
wire  [3:0]   dfill_dcd_thrd ;
496
wire  [3:0]   error_rst ;
497
wire          dfq_ld_vld;
498
wire          dfq_byp_vld ;
499
wire          reset;
500
wire          st_rd_advance;
501
wire    vld_dfq_pkt ;
502
wire          dfq_vld_entry_exists_w;
503
wire          dfq_rdata_local_pkt;
504
wire          dfq_st_cmplt ;
505
wire          cpx_fp_type ;
506
wire    dfq_stall, dfq_stall_d1 ;
507
wire          cpx_error_type ;
508
wire          dfq_error_type ;
509
wire          cpx_fwd_req_ic ;
510
wire          dfq_fwd_req_ic_type ;
511
wire          dfq_rd_vld_d1 ;
512
 
513
 
514
    dffrl_async rstff(.din (grst_l),
515
                        .q   (dbb_reset_l),
516 113 albert.wat
                        .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so(),
517 95 fafa1971
                        .rst_l (arst_l));
518
 
519
assign  reset  =  ~dbb_reset_l;
520
assign  clk = rclk;
521
 
522
 
523
 
524
//wire                   lsu_bist_wvld_e;
525
//wire                   lsu_bist_rvld_e;
526
 
527
//dff #(2) mbist_stge (
528
//   .din ({mbist_dcache_write, mbist_dcache_read}),
529
//   .q   ({lsu_bist_wvld_e,    lsu_bist_rvld_e  }),
530
//   .clk (clk),
531 113 albert.wat
//   .se  (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
532 95 fafa1971
//);   
533
 
534
//=================================================================================================
535
// SHADOW SCAN
536
//=================================================================================================
537
 
538
// Monitors whether there is a valid entry in the dfq.
539
assign  lsu_dfq_vld_entry_w = dfq_vld_entry_exists_w ;
540
// Monitors whether dfq_byp flop remains full
541
//assign        lsu_sscan_data[?] = dfq_byp_full ;
542
 
543
//=================================================================================================
544
//
545
// QDP2 Specific Control
546
//
547
//=================================================================================================
548
 
549
// Need to be careful. This may prevent stores
550
//assign  dcfill_src_dfq_sel = dcfill_active_e ;
551
 
552
 
553
 
554
 
555
 
556
//=================================================================================================
557
//  IMISS X-INVALIDATION
558
//=================================================================================================
559
 
560
// Assume all imisses are alligned to a 32B boundary in L2 ?
561
 
562
wire  imiss0_inv_en, imiss1_inv_en ;
563
wire  imiss2_inv_en, imiss3_inv_en ;
564
wire  [10:5] imiss0_set_index,imiss1_set_index ;
565
wire  [10:5] imiss2_set_index,imiss3_set_index ;
566
//8/28/03 - vlint cleanup
567
//wire  [10:4] imiss0_set_index,imiss1_set_index ;
568
//wire  [10:4] imiss2_set_index,imiss3_set_index ;
569
 
570
assign  imiss0_inv_en = ifu_pcx_pkt_b51 & ~ifu_pcx_pkt_b41t40[1] & ~ifu_pcx_pkt_b41t40[0] & lsu_imiss_pcx_rq_sel_d1 ;
571
assign  imiss1_inv_en = ifu_pcx_pkt_b51 & ~ifu_pcx_pkt_b41t40[1] &  ifu_pcx_pkt_b41t40[0] & lsu_imiss_pcx_rq_sel_d1 ;
572
assign  imiss2_inv_en = ifu_pcx_pkt_b51 &  ifu_pcx_pkt_b41t40[1] & ~ifu_pcx_pkt_b41t40[0] & lsu_imiss_pcx_rq_sel_d1 ;
573
assign  imiss3_inv_en = ifu_pcx_pkt_b51 &  ifu_pcx_pkt_b41t40[1] &  ifu_pcx_pkt_b41t40[0] & lsu_imiss_pcx_rq_sel_d1 ;
574
 
575 113 albert.wat
dffe_s #(6) imiss_inv0 (
576 95 fafa1971
        .din    ({ifu_pcx_pkt_b10t5[5:0]}),
577
        .q      ({imiss0_set_index[10:5]}),
578
        .en (imiss0_inv_en),
579
        .clk  (clk),
580 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
581 95 fafa1971
        );
582
 
583 113 albert.wat
dffe_s #(6) imiss_inv1 (
584 95 fafa1971
        .din    ({ifu_pcx_pkt_b10t5[5:0]}),
585
        .q      ({imiss1_set_index[10:5]}),
586
        .en (imiss1_inv_en),
587
        .clk  (clk),
588 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
589 95 fafa1971
        );
590
 
591 113 albert.wat
dffe_s #(6) imiss_inv2 (
592 95 fafa1971
        .din    ({ifu_pcx_pkt_b10t5[5:0]}),
593
        .q      ({imiss2_set_index[10:5]}),
594
        .en (imiss2_inv_en),
595
        .clk  (clk),
596 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
597 95 fafa1971
        );
598
 
599 113 albert.wat
dffe_s #(6) imiss_inv3 (
600 95 fafa1971
        .din    ({ifu_pcx_pkt_b10t5[5:0]}),
601
        .q      ({imiss3_set_index[10:5]}),
602
        .en (imiss3_inv_en),
603
        .clk  (clk),
604 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
605 95 fafa1971
        );
606
 
607
assign  cpx_pkt_thrd_sel[0] = ~lsu_cpx_pkt_tid[1] & ~lsu_cpx_pkt_tid[0] ;
608
assign  cpx_pkt_thrd_sel[1] = ~lsu_cpx_pkt_tid[1] &  lsu_cpx_pkt_tid[0] ;
609
assign  cpx_pkt_thrd_sel[2] =  lsu_cpx_pkt_tid[1] & ~lsu_cpx_pkt_tid[0] ;
610
assign  cpx_pkt_thrd_sel[3] =  lsu_cpx_pkt_tid[1] &  lsu_cpx_pkt_tid[0] ;
611
// This needs to be included once the change for the stb bug is complete
612
wire  [6:1] imiss_inv_set_index ;
613
assign  imiss_inv_set_index[6:1] =
614
  cpx_pkt_thrd_sel[0] ? imiss0_set_index[10:5] :
615
    cpx_pkt_thrd_sel[1] ? imiss1_set_index[10:5] :
616
      cpx_pkt_thrd_sel[2] ? imiss2_set_index[10:5] :
617
        cpx_pkt_thrd_sel[3] ? imiss3_set_index[10:5] : 6'bxx_xxxx ;
618
 
619
 
620
 
621
//=================================================================================================
622
//  FWD REPLY/REQUEST
623
//=================================================================================================
624
 
625
// cpx pkt decode. fwd req/reply do not go into dfq.
626
 
627
 
628
//assign  tap_thread[0] = ~lsu_iobrdge_tap_rq_type[1] & ~lsu_iobrdge_tap_rq_type[0] ;
629
//assign  tap_thread[1] = ~lsu_iobrdge_tap_rq_type[1] &  lsu_iobrdge_tap_rq_type[0] ;
630
//assign  tap_thread[2] =  lsu_iobrdge_tap_rq_type[1] & ~lsu_iobrdge_tap_rq_type[0] ;
631
//assign  tap_thread[3] =  lsu_iobrdge_tap_rq_type[1] &  lsu_iobrdge_tap_rq_type[0] ;
632
 
633
// This is the pkt from the TAP to be returned to the TAP
634
//assign  cpx_reverse_req = cpx_spc_data_cx[130] ;
635
assign  cpx_reverse_req = cpx_spc_data_cx_b130;
636
 
637
// removed tap_rq_type[2] from the data_sel logic
638
assign  lsu_iobrdge_rply_data_sel[0] =  // defeature, margin, bist
639
  (|lsu_iobrdge_tap_rq_type[5:3]) & cpx_reverse_req_d1 ;
640
assign  lsu_iobrdge_rply_data_sel[1] =  // i/dcache
641
  (|lsu_iobrdge_tap_rq_type[7:6] & ~(|lsu_iobrdge_tap_rq_type[5:3])) & cpx_reverse_req_d1 ;
642
// regular fwd pkt
643
//  - sothea - 0in bug - can be 0-hot
644
//assign  lsu_iobrdge_rply_data_sel[2] = ~((|lsu_iobrdge_tap_rq_type[7:3]) & cpx_reverse_req_d1) ;
645
assign  lsu_iobrdge_rply_data_sel[2] = ~|lsu_iobrdge_rply_data_sel[1:0] ;
646
 
647
wire dcache_iob_rd,dcache_iob_rd_e, dcache_iob_rd_m, dcache_iob_rd_w ;
648
assign  dcache_iob_rd = lsu_iobrdge_tap_rq_type[6] & lsu_iobrdge_fwd_pkt_vld ;
649
 
650 113 albert.wat
dff_s  dciob_rd_e (
651 95 fafa1971
        .din    (dcache_iob_rd),
652
        .q      (dcache_iob_rd_e),
653
        .clk    (clk),
654 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
655 95 fafa1971
        );
656
 
657 113 albert.wat
dff_s  dciob_rd_m (
658 95 fafa1971
        .din    (dcache_iob_rd_e),
659
        .q      (dcache_iob_rd_m),
660
        .clk    (clk),
661 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
662 95 fafa1971
        );
663
 
664 113 albert.wat
dff_s  dciob_rd_w (
665 95 fafa1971
        .din    (dcache_iob_rd_m),
666
        .q      (dcache_iob_rd_w),
667
        .clk    (clk),
668 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
669 95 fafa1971
        );
670
 
671
assign  lsu_dcache_iob_rd_w = dcache_iob_rd_w ;
672
 
673
wire  cpx_fwd_rq_type ;
674
assign  cpx_fwd_rq_type =
675 113 albert.wat
        cpx_spc_data_cx_b144to140[`CPX_RQ_HI]   & ~cpx_spc_data_cx_b144to140[`CPX_RQ_LO+2] & // fwd req
676
        cpx_spc_data_cx_b144to140[`CPX_RQ_LO+1] & ~cpx_spc_data_cx_b144to140[`CPX_RQ_LO];
677 95 fafa1971
wire  cpx_fwd_rply_type ;
678
assign  cpx_fwd_rply_type =
679 113 albert.wat
        cpx_spc_data_cx_b144to140[`CPX_RQ_HI]   & ~cpx_spc_data_cx_b144to140[`CPX_RQ_LO+2] & // fwd reply
680
        cpx_spc_data_cx_b144to140[`CPX_RQ_LO+1] &  cpx_spc_data_cx_b144to140[`CPX_RQ_LO] ;
681 95 fafa1971
 
682
// cpx pkt decode. fwd req/reply do not go into dfq.
683
assign  cpx_fwd_req =
684 113 albert.wat
         cpx_spc_data_cx_b144to140[`CPX_VLD] & ~cpx_reverse_req & cpx_fwd_rq_type ;
685 95 fafa1971
 
686
//8/25/03: add fwd req to L1I$ for RAMTEST to dfq_wr_en, dfq_rd_dvance
687
//bug4293 - set fwd_req_ic based on cpx_fwd_req_type and not based on cpx_fwd_req. this causes the request to 
688
//          de dropped i.e. not written into dfq 'cos cpx_fwd_req_ic is not set
689
//assign  cpx_fwd_req_ic =  cpx_fwd_req & cpx_spc_data_cx_b103 ;
690
 
691 113 albert.wat
assign  cpx_fwd_req_ic =  cpx_spc_data_cx_b144to140[`CPX_VLD] & cpx_fwd_rq_type &
692 95 fafa1971
                          cpx_reverse_req & cpx_spc_data_cx_b103 ;
693
 
694
assign  cpx_fwd_pkt_en_cx = cpx_fwd_req | cpx_fwd_reply ;
695
 
696
assign  cpx_fwd_reply =
697 113 albert.wat
         cpx_spc_data_cx_b144to140[`CPX_VLD] & (cpx_fwd_rply_type | (cpx_fwd_rq_type & cpx_reverse_req)) ;
698 95 fafa1971
 
699 113 albert.wat
dff_s #(1) fwdpkt_stgd1 (
700 95 fafa1971
        .din    (fwd_reply_vld),
701
        .q      (lsu_pcx_fwd_reply),
702
        .clk    (clk),
703 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
704 95 fafa1971
        );
705
 
706
 
707
// Requests from iobrdge will not be speculative as core is expected to be quiescent.
708
assign  fwdpkt_reset =
709
  (reset | lsu_fwdpkt_pcx_rq_sel) ;
710
  // (reset | (lsu_fwdpkt_pcx_rq_sel & ~pcx_req_squash)) ; 
711
wire    fwdpkt_vld_unmasked,fwdpkt_vld_unmasked_d1 ;
712
wire    fwd_unc_err ;
713
// There can be only one outstanding fwd reply or request.
714 113 albert.wat
dffre_s #(7)  fwdpkt_ff (
715 95 fafa1971
        .din    ({cpx_fwd_pkt_en_cx,cpx_fwd_req,cpx_fwd_reply,
716
                cpx_spc_data_cx_b138,cpx_spc_data_cx_b71to70[1:0], cpx_reverse_req}),
717
        .q      ({fwdpkt_vld_unmasked,fwd_req_vld,fwd_reply_vld,
718
                fwd_unc_err,fwdpkt_l2bnk_addr[1:0],cpx_reverse_req_d1}),
719
  .rst  (fwdpkt_reset), .en (cpx_fwd_pkt_en_cx),
720
        .clk  (clk),
721 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
722 95 fafa1971
        );
723
 
724
wire    fwd_rply_sz1_unc ; // Either size[1] for fwd-rq or unc-err for fwd-rply.
725
assign  fwd_rply_sz1_unc = fwd_reply_vld ? fwd_unc_err : 1'b1 ;
726
 
727 113 albert.wat
dff_s  fpktunc_d1 (
728 95 fafa1971
        .din    (fwd_rply_sz1_unc),
729
        .q      (lsu_fwd_rply_sz1_unc),
730
        .clk    (clk),
731 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
732 95 fafa1971
        );
733
 
734 113 albert.wat
dff_s  fpktv_d1 (
735 95 fafa1971
        .din    (fwdpkt_vld_unmasked),
736
        .q      (fwdpkt_vld_unmasked_d1),
737
        .clk    (clk),
738 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
739 95 fafa1971
        );
740
 
741
 
742
wire icache_rd_done,icache_wr_done ;
743 113 albert.wat
dff_s #(2) ifwd_d1 (
744 95 fafa1971
        .din    ({ifu_lsu_fwd_data_vld,ifu_lsu_fwd_wr_ack}),
745
        .q      ({icache_rd_done,icache_wr_done}),
746
        .clk    (clk),
747 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
748 95 fafa1971
        );
749
 
750
// make one-shot : read data may be off.
751
assign  lsu_iobrdge_fwd_pkt_vld = fwdpkt_vld_unmasked & ~fwdpkt_vld_unmasked_d1 & cpx_reverse_req_d1 ;
752
//assign  lsu_iobrdge_fwd_pkt_vld = fwdpkt_vld ;
753
assign  fwdpkt_vld =
754
        // immediate for all but dcache rd.
755
        (fwdpkt_vld_unmasked & ~((|lsu_iobrdge_tap_rq_type[7:6]) & cpx_reverse_req_d1)) |
756
        // dcache rd - wait until w.
757
        (fwdpkt_vld_unmasked &  lsu_iobrdge_tap_rq_type[6] & cpx_reverse_req_d1 &
758
                ~(dcache_iob_rd | dcache_iob_rd_e | dcache_iob_rd_m | dcache_iob_rd_w)) |
759
        // icache rd - wait for rd & wr 
760
        (fwdpkt_vld_unmasked &  lsu_iobrdge_tap_rq_type[7] & cpx_reverse_req_d1 &
761
                        (icache_rd_done | icache_wr_done)) ;
762
 
763
assign  lsu_fwdpkt_vld  =  fwdpkt_vld;
764
 
765
assign  lsu_fwdpkt_dest[0] = fwd_req_vld & ~fwdpkt_l2bnk_addr[1] & ~fwdpkt_l2bnk_addr[0] ; // l2bank=0
766
assign  lsu_fwdpkt_dest[1] = fwd_req_vld & ~fwdpkt_l2bnk_addr[1] &  fwdpkt_l2bnk_addr[0] ; // l2bank=1
767
assign  lsu_fwdpkt_dest[2] = fwd_req_vld &  fwdpkt_l2bnk_addr[1] & ~fwdpkt_l2bnk_addr[0] ; // l2bank=2
768
assign  lsu_fwdpkt_dest[3] = fwd_req_vld &  fwdpkt_l2bnk_addr[1] &  fwdpkt_l2bnk_addr[0] ; // l2bank=3
769
assign  lsu_fwdpkt_dest[4] = fwd_reply_vld ; // reply always goes back to IO Bridge
770
 
771
//=================================================================================================
772
//  INTERRUPT CPX PKT REQ CTL
773
//=================================================================================================
774
 
775
//bug6322
776
//assign  lsu_tlu_cpx_vld = cpx_spc_data_cx_b144to140[`CPX_VLD] & ~cpx_spc_data_cx_b136 ;
777
//assign  lsu_tlu_cpx_req[3:0] = cpx_spc_data_cx_b144to140[`CPX_RQ_HI:`CPX_RQ_LO] ;
778
//assign  lsu_tlu_intpkt[17:0] = cpx_spc_data_b17t0_cx[17:0] ;
779
 
780
   wire lsu_tlu_cpx_vld_din_l;
781
   wire [17:0] lsu_tlu_intpkt_din;
782
   wire [3:0]  lsu_tlu_cpx_req_din_l;
783
 
784
assign  lsu_tlu_cpx_vld_din_l = ~(dfq_int_type & ~lsu_dfq_rdata_flush_bit & dfq_rd_advance) ;
785
assign  lsu_tlu_intpkt_din[17:0] = lsu_dfq_rdata_b17_b0[17:0] ;
786
assign  lsu_tlu_cpx_req_din_l[3:0] = ~ lsu_dfq_rdata_rq_type[3:0];
787
 
788
   wire lsu_tlu_cpx_vld_l;
789
   wire [3:0] lsu_tlu_cpx_req_l;
790
 
791 113 albert.wat
dff_s  #(23) lsu_tlu_stg (
792 95 fafa1971
        .din    ({lsu_tlu_cpx_vld_din_l, lsu_tlu_intpkt_din[17:0], lsu_tlu_cpx_req_din_l[3:0]}),
793
        .q      ({lsu_tlu_cpx_vld_l,     lsu_tlu_intpkt[17:0], lsu_tlu_cpx_req_l[3:0]}),
794
        .clk    (clk),
795 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
796 95 fafa1971
        );
797
 
798
   assign     lsu_tlu_cpx_vld = ~lsu_tlu_cpx_vld_l;
799
   assign     lsu_tlu_cpx_req[3:0] = ~lsu_tlu_cpx_req_l[3:0];
800
 
801
//=================================================================================================
802
//  STQUAD PKT CONTROL
803
//=================================================================================================
804
 
805
 
806
 
807
 
808
 
809
//=================================================================================================
810
// SECONDARY VS. PRIMARY LOADS
811
//=================================================================================================
812
 
813
 
814
// NOT USED
815
//wire  [1:0] dfq_sel_tid ;
816
//assign  dfq_sel_tid[1:0] = 
817
//  // select byp tid if ld from cfq or cpx will be latched in byp ff next cycle
818
//  (dfq_byp_ld_vld & ((dfq_rptr_vld_d1 & dfq_rd_advance) | (cpx_spc_data_cx_b144to140[`CPX_VLD] & ~dfq_wr_en))) ? 
819
//  dfq_byp_tid[1:0] : dfq_tid[1:0] ;
820
 
821
//temp, send to dctl, phase 2     
822
assign  ld_sec_active = 1'b0 ;
823
 
824
assign  dfq_thread0 = ~dfq_tid[1] & ~dfq_tid[0] ;
825
assign  dfq_thread1 = ~dfq_tid[1] &  dfq_tid[0] ;
826
assign  dfq_thread2 =  dfq_tid[1] & ~dfq_tid[0] ;
827
assign  dfq_thread3 =  dfq_tid[1] &  dfq_tid[0] ;
828
 
829
// NOT USED
830
//assign  ld_any_thrd_byp_sel = |(ld_thrd_byp_sel[3:0]);
831
 
832
// phase 2 change   
833
// L2$ sends response for both prim and sec requests. Both will go into DFQ
834
// and fill D$
835
// can we eliminate dcfill_active_e ?
836
 
837
//11/7/03 - add rst_tri_en
838
wire  [3:0]  dfq_byp_sel_tmp ;
839
   assign dfq_byp_sel_tmp[0]  = dfq_thread0  & dcfill_active_e & ~lsu_cpx_pkt_prefetch;
840
   assign dfq_byp_sel_tmp[1]  = dfq_thread1  & dcfill_active_e & ~lsu_cpx_pkt_prefetch;
841
   assign dfq_byp_sel_tmp[2]  = dfq_thread2  & dcfill_active_e & ~lsu_cpx_pkt_prefetch;
842
   assign dfq_byp_sel_tmp[3]  = dfq_thread3  & dcfill_active_e & ~lsu_cpx_pkt_prefetch;
843
 
844
   assign dfq_byp_sel[2:0]  =  dfq_byp_sel_tmp[2:0]  & {3{~rst_tri_en}} ;
845
   assign dfq_byp_sel[3]    =  dfq_byp_sel_tmp[3]    | rst_tri_en ;
846
 
847
//   assign lsu_dfq_byp_mxsel[0]  = dfq_thread0  & dcfill_active_e;
848
//   assign lsu_dfq_byp_mxsel[1]  = dfq_thread1  & dcfill_active_e;
849
//   assign lsu_dfq_byp_mxsel[2]  = dfq_thread2  & dcfill_active_e;
850
//   assign lsu_dfq_byp_mxsel[3]  = ~|lsu_dfq_byp_mxsel[2:0];
851
 
852
// includes store cmplt tid also. 
853
assign  dfill_dcd_thrd[0] =   dfq_byp_sel[0] |    // for load
854
        (dfq_thread0 & stdq_active_e)  ;// for store
855
assign  dfill_dcd_thrd[1] =   dfq_byp_sel[1] |    // for load
856
        (dfq_thread1 & stdq_active_e)  ;// for store
857
assign  dfill_dcd_thrd[2] =   dfq_byp_sel[2] |    // for load
858
        (dfq_thread2 & stdq_active_e)  ;// for store
859
assign  dfill_dcd_thrd[3] =   dfq_byp_sel[3] |    // for load
860
        (dfq_thread3 & stdq_active_e)  ;// for store
861
 
862
assign  lsu_dfill_dcd_thrd[3:0]  =  dfill_dcd_thrd[3:0];
863
 
864
//=================================================================================================
865
//  Error Related Logic
866
//=================================================================================================
867
 
868
// Equivalent of lmq but lmq has run out of bits
869
// Following bits need to be logged.
870
// Dtag parity error 
871
//  - output on bit 130 of equivalent ld pkt
872
//  - when cpx pkt is at head of cfq, then log error
873
//  and take corresponding trap synchronous to pipe.
874
// DCache parity error
875
//  - when cpx pkt is at head of cfq, then log error
876
//  and take corresponding trap synchronous to pipe.
877
 
878
 
879
// The load component of the cpx response for an atomic will
880
// save it's error info for the store component. The store
881
// component will take the trap in the g stage, depending
882
// on the error information from the ld. However, it can
883
// always override the parity error info initially written,
884
// as atomics do not lookup the cache or tag.
885
 
886
 
887
//assign  error_en[0] = lmq_enable[0] | (lsu_cpx_pkt_atm_st_cmplt & dcfill_active_e & dfq_byp_sel[0]);
888
assign  error_en[0] =
889
        //lsu_ld_inst_vld_g[0] | (lsu_cpx_pkt_atm_st_cmplt & dcfill_active_e & dfq_byp_sel[0]); // Bug 3624
890
        lsu_ld_inst_vld_g[0] ;
891
assign  error_en[1] =
892
        lsu_ld_inst_vld_g[1] ;
893
assign  error_en[2] =
894
        lsu_ld_inst_vld_g[2] ;
895
assign  error_en[3] =
896
        lsu_ld_inst_vld_g[3] ;
897
 
898
// 10/15/03: error reset is set only by reset. lsu_ld[0-3]_pcx_rq_sel_d1 is not needed because the
899
//           the flop is used only for reporting error to ifu. Also, the error_en is set for new requests.
900
//tmp fix for reset
901
//wire              lsu_pcx_ld_dtag_perror_w2 ;
902
//assign lsu_pcx_ld_dtag_perror_w2  = 1'b0;
903
 
904
//assign  error_rst[0] = reset | (lsu_ld0_pcx_rq_sel_d1 & lsu_pcx_ld_dtag_perror_w2) ;
905
//assign  error_rst[1] = reset | (lsu_ld1_pcx_rq_sel_d1 & lsu_pcx_ld_dtag_perror_w2) ;
906
//assign  error_rst[2] = reset | (lsu_ld2_pcx_rq_sel_d1 & lsu_pcx_ld_dtag_perror_w2) ;
907
//assign  error_rst[3] = reset | (lsu_ld3_pcx_rq_sel_d1 & lsu_pcx_ld_dtag_perror_w2) ;
908
 
909
assign  error_rst[0] = reset ;
910
assign  error_rst[1] = reset ;
911
assign  error_rst[2] = reset ;
912
assign  error_rst[3] = reset ;
913
 
914
//assign  lsu_error_rst[3:0]  =  error_rst[3:0];
915
 
916
wire    dtag_perror3,dtag_perror2,dtag_perror1,dtag_perror0;
917
 
918
// Thread 0
919 113 albert.wat
dffre_s  #(2) error_t0 (
920 95 fafa1971
        .din    ({lsu_dcache_tag_perror_g,lsu_dcache_data_perror_g}),
921
    //lsu_cpx_pkt_ld_err[1:0]}),
922
        .q      ({dtag_perror0,dcache_perror0}),
923
        //.q      ({dtag_perror0,dcache_perror0,ld_error0[1:0]}),
924
        .rst  (error_rst[0]), .en     (error_en[0]),
925
        .clk    (clk),
926 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
927 95 fafa1971
        );
928
 
929
// Thread 1
930 113 albert.wat
dffre_s  #(2) error_t1 (
931 95 fafa1971
        .din    ({lsu_dcache_tag_perror_g,lsu_dcache_data_perror_g}),
932
    //lsu_cpx_pkt_ld_err[1:0]}),
933
        .q      ({dtag_perror1,dcache_perror1}),
934
        //.q      ({dtag_perror1,dcache_perror1,ld_error1[1:0]}),
935
        .rst  (error_rst[1]), .en     (error_en[1]),
936
        .clk    (clk),
937 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
938 95 fafa1971
        );
939
 
940
// Thread 2
941 113 albert.wat
dffre_s  #(2) error_t2 (
942 95 fafa1971
        .din    ({lsu_dcache_tag_perror_g,lsu_dcache_data_perror_g}),
943
    //lsu_cpx_pkt_ld_err[1:0]}),
944
        .q      ({dtag_perror2,dcache_perror2}),
945
        //.q      ({dtag_perror2,dcache_perror2,ld_error2[1:0]}),
946
        .rst  (error_rst[2]), .en     (error_en[2]),
947
        .clk    (clk),
948 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
949 95 fafa1971
        );
950
 
951
// Thread 3
952 113 albert.wat
dffre_s  #(2) error_t3 (
953 95 fafa1971
        .din    ({lsu_dcache_tag_perror_g,lsu_dcache_data_perror_g}),
954
    //lsu_cpx_pkt_ld_err[1:0]}),
955
        .q      ({dtag_perror3,dcache_perror3}),
956
        //.q      ({dtag_perror3,dcache_perror3,ld_error3[1:0]}),
957
        .rst  (error_rst[3]), .en     (error_en[3]),
958
        .clk    (clk),
959 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
960 95 fafa1971
        );
961
 
962
//assign        lsu_dtag_perror_w2[3] = dtag_perror3 ;
963
//assign        lsu_dtag_perror_w2[2] = dtag_perror2 ;
964
//assign        lsu_dtag_perror_w2[1] = dtag_perror1 ;
965
//assign        lsu_dtag_perror_w2[0] = dtag_perror0 ;
966
 
967
// Determine if ld pkt requires correction due to dtag parity error.
968
//5/22/03: moved to qctl1
969
//assign  lsu_pcx_ld_dtag_perror_w2 =
970
//  ld_pcx_rq_sel[0] ? dtag_perror0 :
971
//    ld_pcx_rq_sel[1] ? dtag_perror1 :
972
//      ld_pcx_rq_sel[2] ? dtag_perror2 : dtag_perror3 ;
973
 
974
// Now post sparc related errors and take traps
975
// error is reset after it is sent to pcx. the logic below will never be set!!
976
assign  lsu_cpx_ld_dtag_perror_e =
977
  dfq_byp_sel[0] ? dtag_perror0 :
978
    dfq_byp_sel[1] ? dtag_perror1 :
979
      dfq_byp_sel[2] ? dtag_perror2 : (dfq_byp_sel[3] & dtag_perror3) ; // Bug 4655
980
 
981
assign  lsu_cpx_ld_dcache_perror_e =
982
  dfq_byp_sel[0] ? dcache_perror0 :
983
    dfq_byp_sel[1] ? dcache_perror1 :
984
      dfq_byp_sel[2] ? dcache_perror2 : (dfq_byp_sel[3] & dcache_perror3) ; // Bug 4655
985
 
986
//Bug 3624
987
/*
988
assign  lsu_cpx_atm_st_err[1:0] =
989
  cpx_pkt_thrd_sel[0] ? ld_error0[1:0] :
990
    cpx_pkt_thrd_sel[1] ? ld_error1[1:0] :
991
      cpx_pkt_thrd_sel[2] ? ld_error2[1:0] : ld_error3[1:0] ;*/
992
 
993
//===
994
wire memref_e;
995
 
996 113 albert.wat
dff_s #(1) stge_ad_e (
997 95 fafa1971
  .din (ifu_lsu_memref_d),
998
  .q   (memref_e),
999
  .clk (clk),
1000 113 albert.wat
  .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1001 95 fafa1971
);
1002
 
1003
 
1004
 
1005
 
1006
//=================================================================================================
1007
//  LDD HANDLING
1008
//=================================================================================================
1009
 
1010
assign ldd_vld_reset =
1011
        (reset | (dcfill_active_e & ldd_in_dfq_out));
1012
 
1013
// prefetch qual is required for case where prefetch may get interference
1014
// from lmq contents set by a later load that issues before the prefetch
1015
// is returned.
1016
// integer
1017
assign ldd_vld_en = lmq_ldd_vld & ~lsu_cpx_pkt_prefetch & dcfill_active_e ;
1018
// fp
1019
assign lsu_fldd_vld_en = lmq_ldd_vld & ~lsu_cpx_pkt_prefetch & lsu_l2fill_fpld_e & dcfill_active_e ;
1020
 
1021
 
1022 113 albert.wat
dffre_s   ldd_in_dfq_ff (
1023 95 fafa1971
        .din    (lmq_ldd_vld), .q  (ldd_in_dfq_out),
1024
        .rst    (ldd_vld_reset),        .en     (ldd_vld_en),
1025
        .clk  (clk),
1026 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1027 95 fafa1971
        );
1028
 
1029
 
1030
wire lsu_ignore_fill;
1031
//dfq_ld_vld is redundant   
1032
assign lsu_ignore_fill = dfq_ld_vld & lmq_ldd_vld & ~ldd_in_dfq_out & dcfill_active_e ;
1033
 
1034
 
1035 113 albert.wat
dff_s #(5)   dfq_rd_m (
1036 95 fafa1971
        .din    (ifu_lsu_rd_e[4:0]), .q  (ld_l1hit_rd_m[4:0]),
1037
        .clk  (clk),
1038 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1039 95 fafa1971
        );
1040
 
1041
//dff #(5)   dfq_rd_g (
1042
//        .din    (ld_l1hit_rd_m[4:0]), .q  (ld_l1hit_rd_g[4:0]),
1043
//        .clk  (clk),
1044 113 albert.wat
//        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1045 95 fafa1971
//        ); 
1046
 
1047
 
1048 113 albert.wat
dff_s #(1)   stgd1_lrd (
1049 95 fafa1971
        .din    (ldd_in_dfq_out),
1050
  .q    (ldd_in_dfq_out_d1),
1051
        .clk  (clk),
1052 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1053 95 fafa1971
        );
1054
 
1055
//dff #(1)   stgd2_lrd (
1056
//        .din    (ldd_in_dfq_out_d1), 
1057
//  .q    (ldd_in_dfq_out_d2),
1058
//        .clk  (clk),
1059 113 albert.wat
//        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1060 95 fafa1971
//        ); 
1061
 
1062
 
1063
//wire [4:0] lmq_ld_rd1_g;   
1064
//dff #(5) ff_lmq_ld_rd1 (
1065
//        .din  (lmq_ld_rd1[4:0]), 
1066
//        .q    (lmq_ld_rd1_g[4:0]),
1067
//        .clk  (clk),
1068 113 albert.wat
//        .se   (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1069 95 fafa1971
//        ); 
1070
 
1071
 
1072
// Stage l2fill vld
1073
//wire  l2fill_vld_m, l2fill_vld_g ;
1074
wire    l2fill_vld_e,l2fill_vld_m ;
1075 113 albert.wat
dff_s           l2fv_stgm (
1076 95 fafa1971
        .din  (l2fill_vld_e),
1077
        .q    (l2fill_vld_m),
1078
        .clk  (clk),
1079 113 albert.wat
        .se   (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1080 95 fafa1971
        );
1081
 
1082
//dff           l2fv_stgg (
1083
//        .din  (l2fill_vld_m), 
1084
//      .q    (l2fill_vld_g),
1085
//        .clk  (clk),
1086 113 albert.wat
//        .se   (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1087 95 fafa1971
//        ); 
1088
 
1089
wire    ld_inst_vld_m ;
1090 113 albert.wat
dff_s           lvld_stgm (
1091 95 fafa1971
        .din  (ld_inst_vld_e),
1092
        .q    (ld_inst_vld_m),
1093
        .clk  (clk),
1094 113 albert.wat
        .se   (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1095 95 fafa1971
        );
1096
 
1097
//wire  ld_inst_vld_g ;
1098
//dff           lvld_stgg (
1099
//        .din  (ld_inst_vld_m), 
1100
//      .q    (ld_inst_vld_g),
1101
//        .clk  (clk),
1102 113 albert.wat
//        .se   (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1103 95 fafa1971
//        ); 
1104
 
1105
wire    ldd_in_dfq_out_vld ;
1106
assign  ldd_in_dfq_out_vld = ldd_in_dfq_out_d1 & l2fill_vld_m ;
1107
assign lsu_exu_rd_m[4:0] =
1108
  ld_inst_vld_m ? ld_l1hit_rd_m[4:0] :
1109
                ldd_in_dfq_out_vld ?  {lmq_ld_rd1[4:1],~lmq_ld_rd1[0]}
1110
                                                : lmq_ld_rd1[4:0];
1111
/*wire  ldd_in_dfq_out_vld ;
1112
assign  ldd_in_dfq_out_vld = ldd_in_dfq_out_d2 & l2fill_vld_g ;
1113
assign lsu_exu_rd_w2[4:0] =
1114
  ld_inst_vld_g ? ld_l1hit_rd_g[4:0] :
1115
                ldd_in_dfq_out_vld ?  {lmq_ld_rd1_g[4:1],~lmq_ld_rd1_g[0]}
1116
                                                : lmq_ld_rd1_g[4:0];*/
1117
 
1118
 
1119
// Generate data select for 128b. ldd will cause hi-order 8B followed by low order
1120
// 8B to be selected.
1121
 
1122
// ldd will select from same 64b dw.
1123
assign  lsu_dfill_data_sel_hi = ~lmq_ld_addr_b3 ^ (ldd_in_dfq_out & ~ldd_non_alt_space) ;
1124
 
1125
// ldd non-alternate space. sz distinguishes between quad, fp ldd and int ldd.
1126
// quad ldd, fp ldd sz = 2'b11, int ldd sz = 2'b10   
1127
assign  ldd_non_alt_space = lsu_byp_misc_sz_e[1] & ~lsu_byp_misc_sz_e[0] ;
1128
 
1129
assign  ldd_oddrd_e = ldd_in_dfq_out & ldd_non_alt_space ;
1130
 
1131 113 albert.wat
dff_s   ldd_stgm (
1132 95 fafa1971
        .din    (ldd_oddrd_e),
1133
  .q    (lsu_byp_ldd_oddrd_m),
1134
        .clk  (clk),
1135 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1136 95 fafa1971
        );
1137
 
1138
// all incoming ld and inv packets must be written to dfq or its bypass flop.
1139
// wrt ptr must be updated in cycle that cpx pkt is sent.
1140
 
1141
// invalidate does not need bubble, only ld bypass and/or fill.
1142
// fill bypass can only occur if bubble is in pipeline.
1143
 
1144
//------
1145
// strm ack cmplt - needs to be visible in dcache
1146
//------
1147
 
1148
//bug4460 - qualify stream store ack w/ local packet
1149
//Bug4969
1150
wire    dfq_local_pkt ;
1151
wire    strmack_cmplt1, strmack_cmplt2, strmack_cmplt3 ;
1152
wire    strmack_cmplt1_d1, strmack_cmplt2_d1, strmack_cmplt3_d1 ;
1153
//wire  strm_ack_cmplt ;
1154
assign  strmack_cmplt1 =
1155
        // check inflight, no inv. if inv, write to dfq_byp.
1156
        (cpx_strm_st_ack_type & ~(dfq_wr_en | lsu_cpx_spc_inv_vld) &
1157 113 albert.wat
         (const_cpuid[2:0] == cpx_spc_data_cx_b120to118[`CPX_INV_CID_HI:`CPX_INV_CID_LO])) ;
1158 95 fafa1971
assign  strmack_cmplt2 =
1159
        // check dfq-rd - no inv, gets dropped.
1160
        (lsu_dfq_byp_type[1] & dfq_rd_advance & ~lsu_dfq_byp_cpx_inv & local_pkt) ;
1161
assign  strmack_cmplt3 =
1162
        // check dfq-rd - inv, and thus process from dfq_bypass.
1163
        (lsu_cpx_pkt_strm_ack & inv_active_e & dfq_inv_vld & dfq_local_pkt) ;
1164
 
1165
/*assign        strm_ack_cmplt =
1166
        // check inflight, no inv. if inv, write to dfq_byp.
1167
        (cpx_strm_st_ack_type & ~(dfq_wr_en | lsu_cpx_spc_inv_vld) &
1168
         (const_cpuid[2:0] == cpx_spc_data_cx_b120to118[`CPX_INV_CID_HI:`CPX_INV_CID_LO])) |
1169
        // check dfq-rd - no inv, gets dropped.
1170
        (lsu_dfq_byp_type[1] & dfq_rd_advance & ~lsu_dfq_byp_cpx_inv & local_pkt) |
1171
        // check dfq-rd - inv, and thus process from dfq_bypass.
1172
        (lsu_cpx_pkt_strm_ack & inv_active_e & dfq_inv_vld & dfq_local_pkt) ;*/
1173
 
1174 113 albert.wat
dff_s #(3)   strmackcnt_stg (
1175 95 fafa1971
        .din    ({strmack_cmplt3,strmack_cmplt2,strmack_cmplt1}),
1176
        .q      ({strmack_cmplt3_d1,strmack_cmplt2_d1,strmack_cmplt1_d1}),
1177
        .clk    (clk),
1178 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1179 95 fafa1971
        );
1180
 
1181
assign  lsu_spu_strm_ack_cmplt[0] =      // lsb  of cnt, 1 or 3.
1182
        (~strmack_cmplt1_d1 & ~strmack_cmplt2_d1 &  strmack_cmplt3_d1) | //001
1183
        (~strmack_cmplt1_d1 &  strmack_cmplt2_d1 & ~strmack_cmplt3_d1) | //010
1184
        ( strmack_cmplt1_d1 &  strmack_cmplt2_d1 &  strmack_cmplt3_d1) | //111
1185
        ( strmack_cmplt1_d1 & ~strmack_cmplt2_d1 & ~strmack_cmplt3_d1) ; //100
1186
 
1187
assign  lsu_spu_strm_ack_cmplt[1] =     // msb  of cnt, 2 or 3.
1188
        (strmack_cmplt1_d1 & strmack_cmplt2_d1) |
1189
        (strmack_cmplt2_d1 & strmack_cmplt3_d1) |
1190
        (strmack_cmplt1_d1 & strmack_cmplt3_d1) ;
1191
 
1192
/*dff   strmack_d1 (
1193
        .din  (strm_ack_cmplt),
1194
        .q    (lsu_spu_strm_ack_cmplt),
1195
        .clk  (clk),
1196 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1197 95 fafa1971
        ); */
1198
 
1199
// Active as soon as it is visible in dfq byp ff.
1200
assign  inv_active_e = dfq_inv_vld ;      // evict/icache/strm-st
1201
//wire  st_atm_err ;
1202
// An atomic st is forced to punch a bubble in the pipe if
1203
// an error is encountered on the load. error en is not checked
1204
// at this point.
1205
/*assign  st_atm_err =
1206
  ((|lsu_cpx_atm_st_err[1:0]) & lsu_cpx_pkt_atm_st_cmplt) ;*/
1207
 
1208
assign  stwr_active_e =
1209
  dfq_st_vld & dfq_local_inv  & ~memref_e &
1210
  ~lsu_cpx_pkt_atm_st_cmplt & ~lsu_cpx_pkt_binit_st ;
1211
// & ~lsu_cpx_pkt_stquad_pkt2 ;  // fix for ifill_pkt_vld -b[130]
1212
//  dfq_st_vld & local_inv & ~st_ack_rq_stb_d1 & ~memref_e & //st ack timing fix
1213
//  ~lsu_cpx_pkt_stquad_pkt2 // bug 2942
1214
 
1215
assign  stdq_active_e =
1216
  dfq_st_vld &
1217
  //((~dfq_local_inv & (~st_atm_err | (st_atm_err & ~memref_e))) | //Bug 3624
1218
  ((~dfq_local_inv) |
1219
   (dfq_local_inv & ~memref_e)) ;
1220
//  ((~local_inv & (~st_atm_err | (st_atm_err & ~memref_e))) | 
1221
//   (local_inv & (~st_ack_rq_stb_d1 & ~memref_e))) ;
1222
 
1223
 
1224
assign  dfq_st_cmplt = stdq_active_e | (inv_active_e & dfq_st_vld) ;
1225
 
1226
wire    atm_st_cmplt ;
1227
assign  atm_st_cmplt = dfq_st_cmplt & lsu_cpx_pkt_atm_st_cmplt ;
1228
assign  lsu_atm_st_cmplt_e = atm_st_cmplt ;
1229
 
1230
assign  dcfill_active_e = dfq_ld_vld & ~memref_e ;
1231
 
1232
//bug3753 - qualify ld*_fill_reset w/ dcfill_active & ~ignore_fill
1233
//          in qctl1 this is qual'ed w/ dfq_ld_vld
1234
assign  lsu_dcfill_active_e  =  dcfill_active_e & ~lsu_ignore_fill;
1235
//assign  lsu_dcfill_active_e  =  dcfill_active_e;
1236
 
1237
assign  dva_svld_e =
1238
  inv_active_e |      // evict/icache/strm-st
1239
  (dfq_st_vld & lsu_cpx_pkt_perror_dinv) |      // dtag parity error invalidation.
1240
  (dfq_local_inv & dfq_st_vld & // local st - atomic
1241
  lsu_cpx_pkt_atomic ) ;
1242
  //lsu_cpx_pkt_atomic & ~lsu_cpx_pkt_stquad_pkt2) ; // store quad pkt not present - cmp1_regr fail
1243
  //(local_inv & dfq_st_vld & // local st - stquad/atomic
1244
assign  l2fill_vld_e  = dcfill_active_e &
1245
                        ~lsu_cpx_pkt_prefetch ; // prefetch will not fill
1246
 
1247
assign  lsu_l2fill_vld = dcfill_active_e ;
1248
 
1249
//=================================================================================================
1250
//  DFQ RD/WR CONTROL
1251
//=================================================================================================
1252
 
1253
//assign  cpx_inv =
1254
//  lsu_cpu_inv_data[`CPX_AX0_INV_DVLD]   |   // line 0
1255
//  lsu_cpu_inv_data[`CPX_AX1_INV_DVLD+4] |   // line 1
1256
//  lsu_cpu_inv_data[`CPX_AX0_INV_DVLD+7] |   // line 2
1257
//  lsu_cpu_inv_data[`CPX_AX1_INV_DVLD+11] ;  // line 3
1258
 
1259
// All invalidates go into byp buffer
1260
assign  dfq_byp_ld_vld = lsu_dfq_byp_type[5] ;
1261
// local store inv path is separate.
1262
assign  dfq_byp_inv_vld =
1263
       (lsu_dfq_byp_type[4] & dfq_invwy_vld)    | // icache x-inv
1264
       (lsu_dfq_byp_type[3]                     | // evict
1265
       (lsu_dfq_byp_type[2] & ~local_pkt)       | // sparc st-ack - non-local
1266
        lsu_dfq_byp_type[1]                     | // strm st-ack
1267
        (lsu_dfq_byp_type[2] & local_pkt & lsu_dfq_byp_binit_st)) &
1268
                                // blk init st invalidates L1
1269
        lsu_dfq_byp_cpx_inv ;         // local invalidate
1270
        //cpx_inv ;         // local invalidate
1271
 
1272
// Local store which writes to cache
1273
//timing fix: 7/14/03 - to improve setup of dfq_st_vld and dfq_ld_vld and move the flop to qdp2 -
1274
//            to eventually improve dcache_fill_data timing
1275
//            add byp mux for cpuid in qctl2
1276
wire  [2:0]  dfq_byp_cpuid ;
1277
assign  dfq_byp_cpuid[2:0]  =  dfq_rd_vld_d1 ? lsu_dfq_rdata_cpuid[2:0] :
1278 113 albert.wat
                                   cpx_spc_data_cx_b120to118[`CPX_INV_CID_HI:`CPX_INV_CID_LO] ;
1279 95 fafa1971
 
1280
//assign  local_pkt =  &(const_cpuid[2:0] ~^ lsu_dfq_byp_cpuid[2:0]) ;
1281
assign  local_pkt =  &(const_cpuid[2:0] ~^ dfq_byp_cpuid[2:0]) ;
1282
assign  dfq_rdata_local_pkt =  &(const_cpuid[2:0] ~^ lsu_dfq_rdata_cpuid[2:0]) ;
1283
assign  dfq_byp_st_vld = lsu_dfq_byp_type[2] & local_pkt ;
1284
 
1285
// Add ifill invalidate
1286
// screen cpx data which gets written to dfq
1287
assign  dfq_byp_vld =
1288
(dfq_byp_ld_vld | dfq_byp_inv_vld | dfq_byp_st_vld) &
1289
(dfq_rd_vld_d1 | (~dfq_rd_vld_d1 & ~dfq_wr_en))  ;
1290
 
1291
//assign  lsu_dfq_byp_vld  =  dfq_byp_vld;
1292
 
1293
/*assign dfq_vld_reset =
1294
        reset | ((dcfill_active_e | inv_active_e | stdq_active_e) &
1295
    ~dfq_vld_en & // dside pkt in waiting
1296
    ~lsu_ignore_fill &  // ldd
1297
    ~ld_ignore_sec  // secondary loads
1298
    ) ; */
1299
 
1300
/*wire  ld_sec_rst, ld_sec_rst_d1 ;
1301
assign  ld_sec_rst = dcfill_active_e & ld_ignore_sec_last ;
1302 113 albert.wat
dff_s   secl_d1 (
1303 95 fafa1971
        .din    (ld_sec_rst), .q  (ld_sec_rst_d1),
1304
        .clk  (clk),
1305 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1306 95 fafa1971
        ); */
1307
 
1308
/* phase 2 change
1309
assign dfq_vld_reset =
1310
    // dside pkt in waiting, ldd, secondary loads
1311
        reset | (dcfill_active_e & ~(dfq_vld_en | lsu_ignore_fill | (ld_ignore_sec & ~ld_ignore_sec_last))) |
1312
    // dside pkt in waiting
1313
          ((inv_active_e | stdq_active_e) & ~dfq_vld_en) ;
1314
*/
1315
 
1316
assign dfq_vld_reset =
1317
    // dside pkt in waiting, ldd, no need secondary loads waiting
1318
        reset | (dcfill_active_e & ~(dfq_vld_en | (lsu_ignore_fill & ~lsu_cpx_pkt_prefetch))) |
1319
    // dside pkt in waiting
1320
          ((inv_active_e | stdq_active_e) & ~dfq_vld_en) ;
1321
 
1322
// vld is enabled only if both i and d side buffers are clear
1323
// for co-dependent events. co-dependent events are rare.
1324
wire    dfq_rd_advance_buf1 ;
1325
assign dfq_vld_en = dfq_byp_vld &
1326
                (dfq_rd_advance_buf1 |
1327 113 albert.wat
                (cpx_spc_data_cx_b144to140[`CPX_VLD] & vld_dfq_pkt & ~dfq_wr_en)) ;
1328 95 fafa1971
 
1329
/* phase 2 change
1330
assign  dfq_byp_ff_en =
1331
  (~dfq_byp_full |
1332
  ( dfq_byp_full & ((dcfill_active_e & ~(lsu_ignore_fill | ld_ignore_sec)) |
1333
       (inv_active_e | stdq_active_e)))) ;
1334
*/
1335
 
1336
assign  dfq_byp_ff_en =
1337
  (~dfq_byp_full |
1338
  ( dfq_byp_full & ((dcfill_active_e & ~lsu_ignore_fill) |
1339
       (inv_active_e | stdq_active_e)))) ;
1340
 
1341
//bug4576: add sehold to the flop enable in qdp2
1342
assign lsu_dfq_byp_ff_en  =  sehold | dfq_byp_ff_en ;
1343
 
1344
   // i.e., byp currently filling.
1345
 
1346
/*
1347
assign  dfq_byp_ff_en =
1348
  (~dfq_byp_full |
1349
  (dfq_byp_full & (dcfill_active_e | inv_active_e | stdq_active_e) & ~(lsu_ignore_fill | ld_ignore_sec))) ;
1350
  // i.e., byp currently filling.
1351
*/
1352
 
1353
// dfq bypass valid
1354
//timing fix: 6/6/03: add duplicate flop for dfq_byp_ld_vld and dfq_byp_st_vld
1355
//timing fix: 10/3/03 - add separate flop for lsu_dfq_vld lsu_dfq_st_vld to dctl
1356
//bug4460:  qualify stream store ack w/ local packet - add local pkt flop
1357 113 albert.wat
dffre_s  #(10) dfq_vld (
1358 95 fafa1971
        .din({local_pkt,dfq_byp_st_vld,dfq_byp_vld,dfq_byp_vld,
1359
              dfq_byp_ld_vld,dfq_byp_inv_vld,dfq_byp_st_vld,
1360
              lsu_dfq_byp_cpx_inv,dfq_byp_ld_vld,dfq_byp_st_vld}),
1361
        .q  ({dfq_local_pkt,lsu_dfq_st_vld,lsu_dfq_vld,dfq_byp_full,
1362
              dfq_ld_vld,dfq_inv_vld,dfq_st_vld,
1363
              dfq_local_inv,lsu_qdp2_dfq_ld_vld,lsu_qdp2_dfq_st_vld}),
1364
//.din    ({dfq_byp_vld,dfq_byp_ld_vld,dfq_byp_inv_vld,dfq_byp_st_vld,cpx_inv,lsu_dfq_byp_cpx_inv}),
1365
//.q      ({dfq_byp_full,dfq_ld_vld,dfq_inv_vld,dfq_st_vld,local_inv,dfq_local_inv}),
1366
        .rst    (dfq_vld_reset),        .en     (dfq_vld_en),
1367
        .clk    (clk),
1368 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1369 95 fafa1971
        );
1370
 
1371
//bug4057: kill diagnostic write if dfq has valid requests to l1d$
1372
//timing fix: 10/3/03 - add separate flop for lsu_dfq_vld
1373
//assign  lsu_dfq_vld  =  dfq_byp_full ;
1374
 
1375
assign  lsu_dfq_ld_vld  =  dfq_ld_vld;
1376
//timing fix: 9/29/03 - instantiate buffer for dfq_st_vld to dctl
1377
//timing fix: 10/3/03 - remove buffer and add separate flop
1378
//assign  lsu_dfq_st_vld  =  dfq_st_vld;
1379
//bw_u1_buf_30x UZsize_lsu_dfq_st_vld_buf1 ( .a(dfq_st_vld), .z(lsu_dfq_st_vld) );
1380
assign  lsu_dfq_ldst_vld  =  lsu_qdp2_dfq_ld_vld | lsu_qdp2_dfq_st_vld;
1381
 
1382
 
1383
// Flop invalidate bits
1384 113 albert.wat
dffe_s  #(12) dfq_inv (
1385 95 fafa1971
        .din    ({lsu_cpu_inv_data_b13to9,lsu_cpu_inv_data_b7to2,lsu_cpu_inv_data_b0}),
1386
        .q    ({dfq_inv_data_b13to9,dfq_inv_data_b7to2,dfq_inv_data_b0}),
1387
        //.din    (lsu_cpu_inv_data[13:0]),
1388
        //.q      (dfq_inv_data[13:0]),
1389
        .en     (dfq_vld_en),
1390
        .clk    (clk),
1391 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1392 95 fafa1971
        );
1393
 
1394
 
1395
/*
1396
assign  lsu_st_ack_addr_b54[0] = dfq_inv_data[4] | dfq_inv_data[11] ;
1397
assign  lsu_st_ack_addr_b54[1] = dfq_inv_data[7] | dfq_inv_data[11] ;
1398
 
1399
 
1400
assign  st_wrwy_sel[0] = ~lsu_st_ack_addr_b54[1] & ~lsu_st_ack_addr_b54[0] ;
1401
assign  st_wrwy_sel[1] = ~lsu_st_ack_addr_b54[1] &  lsu_st_ack_addr_b54[0] ;
1402
assign  st_wrwy_sel[2] =  lsu_st_ack_addr_b54[1] & ~lsu_st_ack_addr_b54[0] ;
1403
assign  st_wrwy_sel[3] =  lsu_st_ack_addr_b54[1] &  lsu_st_ack_addr_b54[0] ;
1404
 
1405
assign  lsu_st_ack_wrwy[1:0]   =
1406
st_wrwy_sel[0] ? dfq_inv_data[`CPX_AX0_INV_WY_HI:`CPX_AX0_INV_WY_LO] :
1407
  st_wrwy_sel[1] ? dfq_inv_data[`CPX_AX1_INV_WY_HI+4:`CPX_AX1_INV_WY_LO+4] :
1408
    st_wrwy_sel[2] ? dfq_inv_data[`CPX_AX0_INV_WY_HI+7:`CPX_AX0_INV_WY_LO+7] :
1409
      st_wrwy_sel[3] ? dfq_inv_data[`CPX_AX1_INV_WY_HI+11:`CPX_AX1_INV_WY_LO+11] :
1410
            2'bxx ;
1411
*/
1412
 
1413
// cpx invalidate data obtained via the cfq.
1414
// b[8[ and b[1] are unused
1415
//8/28/03: vlint cleanup - remove cpx_cpu_inv_data and use dfq_inv_data directly
1416
//assign  cpx_cpu_inv_data[13:0] =  {dfq_inv_data_b13to9,1'b0,dfq_inv_data_b7to2,1'b0,dfq_inv_data_b0} ;
1417
//assign  cpx_cpu_inv_data[13:0] =  dfq_inv_data[13:0] ;
1418
 
1419
// write control set up.   
1420
// All cpx pkts are written.
1421
// - unwanted pkts are explicity overwritten by next incoming pkt.
1422
 
1423
   /*wire stb_cam_hit_w2;
1424
 
1425 113 albert.wat
dff_s #(1)  stb_cam_hit_stg_w2  (
1426 95 fafa1971
  .din (stb_cam_hit),
1427
  .q   (stb_cam_hit_w2),
1428
  .clk (clk),
1429 113 albert.wat
  .se  (1'b0), `SIMPLY_RISC_SCANIN, .so ()
1430 95 fafa1971
  ); */
1431
 
1432
// Need to include error pkt !!
1433
//8/25/03: add error type to dfq_wr_en, dfq_rd_advance
1434
//8/25/03: add fwd req to L1I$ for RAMTEST to dfq_wr_en, dfq_rd_dvance
1435
assign  vld_dfq_pkt =
1436
cpx_int_type | cpx_ld_type | cpx_ifill_type | cpx_evict_type | cpx_st_ack_type | cpx_strm_st_ack_type | cpx_error_type | cpx_fwd_req_ic ;
1437
 
1438
//NOTE: restore cpx_inv qualification after adding cpx_inv part of dfq read - done
1439
 
1440
assign  dfq_wr_en =
1441
  // local st wr which writes to cache is put in dfq if cam-hit occurs.
1442
  //(cpx_local_st_ack_type & stb_cam_hit_w2 & cpx_inv) |
1443
  //(cpx_local_st_ack_type & stb_cam_hit_w2 & lsu_dfq_byp_cpx_inv) |
1444
  //(cpx_local_st_ack_type) |  //bug2623
1445
  (cpx_st_ack_type) |
1446
  // always write under these conditions
1447
  //(vld_dfq_pkt & (dfq_vld_entry_exists | dfq_rptr_vld_d1)) | 
1448
  (vld_dfq_pkt & (dfq_vld_entry_exists_w | dfq_rptr_vld_d1)) |
1449
  //(cpx_spc_data_cx_b144to140[`CPX_VLD] & (dfq_vld_entry_exists | dfq_rptr_vld_d1)) | 
1450
  // interrupts always write to queue
1451
    cpx_int_type |
1452
  // error type or forward request to l1i$ - bypass
1453
   ((cpx_error_type | cpx_fwd_req_ic) & ifu_lsu_ibuf_busy)  |
1454
  // selectively write under these conditions
1455
   ((cpx_ld_type & ~dfq_byp_ff_en)          |
1456
    (cpx_ld_type &  cpx_spc_data_cx_b133 & ifu_lsu_ibuf_busy)  |
1457
    (cpx_ifill_type & ifu_lsu_ibuf_busy)          |
1458
    (cpx_ifill_type & cpx_spc_data_cx_b133 & ~dfq_byp_ff_en) |
1459
    // the evictions/acks will wr to the dfq if any buffer is full
1460
    ((cpx_evict_type | cpx_st_ack_type | cpx_strm_st_ack_type) & (ifu_lsu_ibuf_busy | ~dfq_byp_ff_en))) ;
1461
 
1462
assign  dfq_wptr_new_w_wrap[5:0]  = dfq_wptr_w_wrap[5:0] + {5'b00000, dfq_wr_en} ;
1463
//assign  dfq_wptr_vld = dfq_wr_en ;
1464
// every pkt is to be written to dfq. The pkt may be rejected by not updating
1465
// write ptr based on certain conditions.
1466 113 albert.wat
assign  dfq_wptr_vld = cpx_spc_data_cx_b144to140[`CPX_VLD] ;
1467 95 fafa1971
 
1468 113 albert.wat
dffre_s  #(6) dfq_wptr_ff (
1469 95 fafa1971
        .din    (dfq_wptr_new_w_wrap[5:0]), .q  (dfq_wptr_w_wrap[5:0]),
1470
        .rst    (reset), .en (dfq_wr_en), .clk (clk),
1471 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1472 95 fafa1971
        );
1473
 
1474
//1/20/04: mintime fix - add minbuf to dfq_wptr
1475
//assign  dfq_wptr[4:0] = dfq_wptr_w_wrap[4:0] ;
1476
 
1477
wire  [4:0]  dfq_wptr_minbuf ;
1478
bw_u1_minbuf_5x UZfix_dfq_wptr_b0_minbuf (.a(dfq_wptr_w_wrap[0]), .z(dfq_wptr_minbuf[0]));
1479
bw_u1_minbuf_5x UZfix_dfq_wptr_b1_minbuf (.a(dfq_wptr_w_wrap[1]), .z(dfq_wptr_minbuf[1]));
1480
bw_u1_minbuf_5x UZfix_dfq_wptr_b2_minbuf (.a(dfq_wptr_w_wrap[2]), .z(dfq_wptr_minbuf[2]));
1481
bw_u1_minbuf_5x UZfix_dfq_wptr_b3_minbuf (.a(dfq_wptr_w_wrap[3]), .z(dfq_wptr_minbuf[3]));
1482
bw_u1_minbuf_5x UZfix_dfq_wptr_b4_minbuf (.a(dfq_wptr_w_wrap[4]), .z(dfq_wptr_minbuf[4]));
1483
 
1484
bw_u1_buf_10x UZsize_dfq_wptr_b0_buf2 ( .a(dfq_wptr_minbuf[0]), .z(dfq_wptr[0]) );
1485
bw_u1_buf_10x UZsize_dfq_wptr_b1_buf2 ( .a(dfq_wptr_minbuf[1]), .z(dfq_wptr[1]) );
1486
bw_u1_buf_10x UZsize_dfq_wptr_b2_buf2 ( .a(dfq_wptr_minbuf[2]), .z(dfq_wptr[2]) );
1487
bw_u1_buf_10x UZsize_dfq_wptr_b3_buf2 ( .a(dfq_wptr_minbuf[3]), .z(dfq_wptr[3]) );
1488
bw_u1_buf_10x UZsize_dfq_wptr_b4_buf2 ( .a(dfq_wptr_minbuf[4]), .z(dfq_wptr[4]) );
1489
 
1490
// Bit3 of both pointers is a wrap bit. Including this in the compare
1491
// will tell us whether the queue is empty or not. It is assumed that
1492
// the wptr will never runover the rptr because of flow control.
1493
// This will have to be fine-tuned once dfq is accurate !!!
1494
assign  dfq_vld_entry_exists = (dfq_rptr_new_w_wrap[5:0] != dfq_wptr_w_wrap[5:0]) ;
1495
 
1496
assign  dfq_vld_entry_exists_w = (dfq_rptr_w_wrap[5:0] != dfq_wptr_w_wrap[5:0]) ;
1497
 
1498
// dfq is read iff bypass flop is empty and valid entry in dfq available. 
1499
// i.e., we need to initialize bypass ff such that it always contains
1500
// latest entry.
1501
//  (dfq_rptr_vld_d1 & (~i_and_d_codepend | (i_and_d_codepend & dfq_rd_advance))) |
1502
 
1503
//assign  lsu_ifill_pkt_vld =   
1504
//  (dfq_rptr_vld_d1 & ~(dfq_st_ack_type & lsu_dfq_byp_stack_dcfill_vld) & (~i_and_d_codepend | (i_and_d_codepend & dfq_byp_ff_en))) |
1505
//        (cpx_spc_data_cx[`CPX_VLD] & ~dfq_wr_en) ;
1506
//
1507
//  (dfq_rptr_vld_d1 & ~(dfq_st_ack_type & lsu_dfq_byp_stack_dcfill_vld) & ~ifill_pkt_fwd_done_d1) |
1508
//
1509
//  (dfq_rptr_vld_d1 & ~(lsu_dfq_rdata_st_ack_type & lsu_dfq_rdata_stack_dcfill_vld) & ~ifill_pkt_fwd_done_d1) | // bug:2767
1510
//  change lsu_dfq_rdata_stack_dcfill_vld from b[87] to b[151] in the top level 
1511
//
1512
//timing fix: 6/16/03 - fix for ifill_pkt_vld - use b130 if store_ack_dcfill_vld=1
1513
//            change lsu_dfq_rdata_stack_dcfill_vld from b[151] to b[130] in the top level 
1514
//  (dfq_rptr_vld_d1 & ~(lsu_dfq_rdata_st_ack_type & dfq_rdata_local_pkt & lsu_dfq_rdata_stack_dcfill_vld) & ~ifill_pkt_fwd_done_d1) |
1515
//
1516
//bug3657 - kill ifill vld in bypass path when cpxtype=fp/fwd_reply
1517
//NOTE: stream loads should also be included
1518
//bug5080 - kill ifill vld in bypass path when cpxtype=strm load - similar to bug3657
1519
//          kill bypass when dfq_rptr_vld_d1=1
1520
//  (cpx_spc_data_cx_b144to140[`CPX_VLD] & ~(dfq_wr_en | cpx_fwd_rply_type | cpx_fp_type)) ;
1521
//
1522
//bug6372: ifill dcache x-inv causes incorrect dcache index to be invalidated.
1523
//         - this occurs 'cos the imiss index gets overwritten by another imiss to the same thread.
1524
//           the dcache x-inv(head of dfq) is stalled in dfq 'cos of load in bypass flop being stalled by memref_e=1
1525
//           but the ifill pkt vld is set to 1 and ifu starts issuing the next imiss for same thread
1526
//         
1527
//  (dfq_rptr_vld_d1 & ~(lsu_dfq_rdata_st_ack_type & lsu_dfq_rdata_stack_dcfill_vld) & ~ifill_pkt_fwd_done_d1) |
1528
 
1529
wire   ifill_pkt_fwd_done,ifill_pkt_fwd_done_d1;
1530
wire   ifill_dinv_head_of_dfq_pend ;
1531
 
1532
 
1533
assign  ifill_dinv_head_of_dfq_pend  =  lsu_dfq_rdata_type[4] & lsu_dfq_rdata_invwy_vld & ~dfq_byp_ff_en ;
1534
 
1535
assign  lsu_ifill_pkt_vld =
1536
  (dfq_rptr_vld_d1 & ~(lsu_dfq_rdata_st_ack_type & lsu_dfq_rdata_stack_dcfill_vld) &
1537
                     ~ifill_dinv_head_of_dfq_pend &
1538
                     ~ifill_pkt_fwd_done_d1 ) |
1539 113 albert.wat
  (~dfq_rptr_vld_d1 & cpx_spc_data_cx_b144to140[`CPX_VLD] & ~(dfq_wr_en | cpx_fwd_rply_type | cpx_fp_type)) ;
1540 95 fafa1971
 
1541
// this signal acts as a mask i.e. fill valid will be asserted until the ifu_lsu_ibuf_busy=0. But certain packets need
1542
// both busy=0 and memref_e=0 - in which case it is safer to mask until the dfq_rd_advance=1.
1543
 
1544
//bug5309: add reset to the flop; x's get recycled from flop o/p until a dfq_rd_advance occurs i.e. flop reset
1545
//         after first ifill; failed in cmp1.92 cmp8 regression w/ vcs7.1
1546
 
1547
assign  ifill_pkt_fwd_done  =  ~reset &
1548
                               (((dfq_rptr_vld_d1 & ~ifu_lsu_ibuf_busy & ~ifill_dinv_head_of_dfq_pend) |
1549
                                ifill_pkt_fwd_done_d1)   // set|hold
1550
                                & ~dfq_rd_advance);                                               // reset
1551
 
1552 113 albert.wat
dff_s  #(1) ifill_pkt_fwd_done_ff (
1553 95 fafa1971
        .din    (ifill_pkt_fwd_done),
1554
        .q      (ifill_pkt_fwd_done_d1),
1555
        .clk    (clk),
1556 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1557 95 fafa1971
        );
1558
 
1559
 
1560
 
1561
// Note that this becomes valid in cycle of read. Flush will be continuously read
1562
// out of dfq until all intermmediate buffers are clear.
1563
 
1564
// timing fix: 06/04/03: dfq_rd_advance uses byp_mux output; instead use dfq read output
1565
//             i.e. dfq_rd_advance is valid only when there is a valid entry in dfq
1566
//             it is already qual'ed w/ dfq_rd_vld_d1 to determine this.
1567
 
1568
//assign  dfq_ld_type     = lsu_dfq_byp_type[5] ;
1569
//assign  dfq_ifill_type    = lsu_dfq_byp_type[4] ;
1570
//assign  dfq_evict_type    = lsu_dfq_byp_type[3] ;
1571
//assign  dfq_st_ack_type   = lsu_dfq_byp_type[2] ;
1572
//assign  dfq_strm_st_ack_type  = lsu_dfq_byp_type[1] ;
1573
//assign  dfq_int_type    = lsu_dfq_byp_type[0] ;
1574
 
1575
assign  dfq_ld_type     = lsu_dfq_rdata_type[5] ;
1576
assign  dfq_ifill_type    = lsu_dfq_rdata_type[4] ;
1577
assign  dfq_evict_type    = lsu_dfq_rdata_type[3] ;
1578
assign  dfq_st_ack_type   = lsu_dfq_rdata_type[2] ;
1579
assign  dfq_strm_st_ack_type  = lsu_dfq_rdata_type[1] ;
1580
assign  dfq_int_type    = lsu_dfq_rdata_type[0] ;
1581
 
1582
//8/25/03: add error type to dfq_wr_en, dfq_rd_advance
1583
assign  dfq_error_type    = (lsu_dfq_rdata_rq_type[3:0]==4'b1100) ;
1584
//8/25/03: add fwd req to L1I$ for RAMTEST to dfq_wr_en, dfq_rd_dvance
1585
assign  dfq_fwd_req_ic_type  = (lsu_dfq_rdata_rq_type[3:0]==4'b1010) & lsu_dfq_rdata_b103;
1586
 
1587
assign  dfq_invwy_vld     = lsu_dfq_byp_invwy_vld ;
1588
 
1589
// if the there is a co-dependent event, then the ifu will not
1590
// be signalled vld until rd_advance is asserted.
1591
//assign  i_and_d_codepend = 
1592
//    ((dfq_ld_type | dfq_ifill_type) &  dfq_invwy_vld)   |
1593
//    (dfq_evict_type | dfq_st_ack_type | dfq_strm_st_ack_type) |
1594
//    dfq_int_type ;
1595
 
1596
//NOTE: restore cpx_inv qualification after adding cpx_inv part of dfq read - done
1597
//assign  st_rd_advance  =  dfq_byp_st_vld & (~lsu_dfq_byp_cpx_inv | (lsu_dfq_byp_cpx_inv & ~stb_cam_hit_w2)) & dfq_byp_ff_en;
1598
//assign  st_rd_advance  =  dfq_byp_st_vld & dfq_byp_ff_en; // bug:2770
1599
//                          (dfq_byp_st_vld &  lsu_dfq_rdata_stack_iinv_vld & ~ifu_lsu_ibuf_busy) ; // bug:2775
1600
 
1601
// timing fix: 06/04/03: dfq_rd_advance uses byp_mux output; instead use dfq read output
1602
//             i.e. dfq_rd_advance is valid only when there is a valid entry in dfq
1603
//             it is already qual'ed w/ dfq_rd_vld_d1 to determine this.
1604
 
1605
 
1606
assign  st_rd_advance  =
1607
        (dfq_st_ack_type & dfq_rdata_local_pkt & ~lsu_dfq_rdata_stack_iinv_vld & dfq_byp_ff_en) |
1608
        (dfq_st_ack_type & dfq_rdata_local_pkt &  lsu_dfq_rdata_stack_iinv_vld & ~ifu_lsu_ibuf_busy & dfq_byp_ff_en) ;
1609
 
1610
// The pointer is advanced based on pre-flop bypass data.
1611
 
1612
wire inv_clear_d1 ;
1613 113 albert.wat
dff_s  #(1) invclr_d1 (
1614 95 fafa1971
        .din    (ifu_lsu_inv_clear),
1615
        .q      (inv_clear_d1),
1616
        .clk    (clk),
1617 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1618 95 fafa1971
        );
1619
 
1620
//---
1621
// Dealing with skid involving invalidate clear.
1622
// 1. No stall asserted. If the int is immed. preceeded by an inv,
1623
// then the the inv will not be visible thru inv_clear. For this
1624
// reason, int will always wait an additional cycle before examining
1625
// inv_clear.
1626
// 2. In case int has been dispatched to the ifu with stall asserted,
1627
// stalls are conditionally inserted. 
1628
// Note : interrupts are always written into dfq.
1629
//---
1630
 
1631
wire    dfq_rd_advance_d1 ;
1632 113 albert.wat
dff_s   rda_d1 (
1633 95 fafa1971
        .din    (dfq_rd_advance),
1634
        .q      (dfq_rd_advance_d1),
1635
        .clk    (clk),
1636 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1637 95 fafa1971
        );
1638
 
1639
 
1640
// Begin Bug 5583
1641
wire    dfq_int_type_d1 ;
1642
wire    int_skid_c1,int_skid_c2;
1643
wire    int_skid_stall ;
1644 113 albert.wat
dff_s   itype_d1 (
1645 95 fafa1971
        .din    (dfq_int_type),
1646
        .q      (dfq_int_type_d1),
1647
        .clk    (clk),
1648 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1649 95 fafa1971
        );
1650
 
1651
// decision made to issue intrpt from dfq even though 
1652
// intr-clear was not high, thus introduce stall for
1653
// 2 more cycles.
1654
assign int_skid_c1 =
1655
        dfq_int_type_d1 & dfq_rd_advance_d1 & ~inv_clear_d1 ;
1656
 
1657 113 albert.wat
dff_s   iskid_c2 (
1658 95 fafa1971
        .din    (int_skid_c1),
1659
        .q      (int_skid_c2),
1660
        .clk    (clk),
1661 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1662 95 fafa1971
        );
1663
 
1664
assign  int_skid_stall = int_skid_c1 | int_skid_c2 ;
1665
 
1666
// End Bug 5583
1667
 
1668
// timing fix: 06/04/03: dfq_rd_advance uses byp_mux output; instead use dfq read output
1669
//             i.e. dfq_rd_advance is valid only when there is a valid entry in dfq
1670
//             it is already qual'ed w/ dfq_rd_vld_d1 to determine this.
1671
//8/25/03: add error type to dfq_wr_en, dfq_rd_advance
1672
//8/25/03: add fwd req to L1I$ for RAMTEST to dfq_wr_en, dfq_rd_dvance
1673
 
1674
assign  dfq_rd_advance   =
1675
  // local st which writes to cache cannot advance if simultaneous cam hit. 
1676
  //((dfq_byp_st_vld & (~cpx_inv | (cpx_inv & ~stb_cam_hit_w2)) & dfq_byp_ff_en)  | 
1677
  (st_rd_advance |
1678
  // advance beyond a dside ld if it can be written to the byp ff
1679
  (dfq_ld_type & ~lsu_dfq_rdata_invwy_vld & dfq_byp_ff_en) |
1680
  // advance beyond a dside & iside ld if it can be written to the byp ff/ibuf clr
1681
  (dfq_ld_type &  lsu_dfq_rdata_invwy_vld & (dfq_byp_ff_en & ~ifu_lsu_ibuf_busy))   |
1682
  // advance beyond a iside ifill if it can be written to the ibuf
1683
  (dfq_ifill_type & ~lsu_dfq_rdata_invwy_vld & ~ifu_lsu_ibuf_busy)      |
1684
  // advance beyond a dside & iside ifill if it can be written to the byp ff/ibuf clr
1685
  (dfq_ifill_type &  lsu_dfq_rdata_invwy_vld & (dfq_byp_ff_en & ~ifu_lsu_ibuf_busy))  |
1686
  // any form of invalidate could invalidate both i and dside.
1687
  ((dfq_evict_type | (dfq_st_ack_type & ~dfq_rdata_local_pkt) | dfq_strm_st_ack_type) &
1688
        (dfq_byp_ff_en & ~ifu_lsu_ibuf_busy)) |
1689
  // interrupts and flushes have to ensure invalidates are visible in caches.
1690
  // interrupts do not enter d-side byp buffer.  flush needs to look at inv clear.
1691
  (dfq_int_type & (dfq_byp_ff_en & ~ifu_lsu_ibuf_busy & ((inv_clear_d1 & ~dfq_rd_advance_d1) | dfq_stall_d1))) | // Bug 3820.
1692
  //(dfq_int_type & (dfq_byp_ff_en & ~ifu_lsu_ibuf_busy & ((inv_clear_d1 & ~dfq_rd_advance_d1) | dfq_stall_d2))) | // Bug 3820.
1693
  ((dfq_error_type | dfq_fwd_req_ic_type) & ~ifu_lsu_ibuf_busy))
1694
    & dfq_rptr_vld_d1 & ~reset ;
1695
 
1696
//timing fix: 9/16/03 - dfq_rd_advance is late signal; use it as mux select to pick the correct read pointer
1697
//            add duplicate signal for dfq_rd_advance - has FO16 - adds 3inv to this path
1698
//            fix for dfq_read -> dfq_rd_advance -> dfq_rptr to dfq
1699
wire   dfq_rd_advance_dup ;
1700
assign dfq_rd_advance_dup =  dfq_rd_advance ;
1701
 
1702
//timing fix: 9/29/03 - instantiate buffer for dfq_rd_advance to dfq_vld_en
1703
bw_u1_buf_30x UZsize_dfq_rd_advance_buf1 ( .a(dfq_rd_advance), .z(dfq_rd_advance_buf1) );
1704
 
1705
wire    local_flush ;
1706
assign  local_flush = lsu_dfq_byp_type[0] & lsu_dfq_byp_flush & local_pkt & dfq_rd_advance ;
1707
 
1708
wire    [3:0]    dfq_flsh_cmplt ;
1709
assign  dfq_flsh_cmplt[0] = local_flush & ~lsu_dfq_byp_tid[1] & ~lsu_dfq_byp_tid[0] ;
1710
assign  dfq_flsh_cmplt[1] = local_flush & ~lsu_dfq_byp_tid[1] &  lsu_dfq_byp_tid[0] ;
1711
assign  dfq_flsh_cmplt[2] = local_flush &  lsu_dfq_byp_tid[1] & ~lsu_dfq_byp_tid[0] ;
1712
assign  dfq_flsh_cmplt[3] = local_flush &  lsu_dfq_byp_tid[1] &  lsu_dfq_byp_tid[0] ;
1713
 
1714 113 albert.wat
dff_s  #(4) flshcmplt (
1715 95 fafa1971
        .din    (dfq_flsh_cmplt[3:0]),
1716
        .q      (lsu_dfq_flsh_cmplt[3:0]),
1717
        .clk    (clk),
1718 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1719 95 fafa1971
        );
1720
 
1721
 
1722
// Check for extra bubbles in pipeline.
1723
//timing fix: 10/3/03 - use dfq_rd_advance as mux select
1724
//assign  dfq_rptr_new_w_wrap[5:0] =  dfq_rptr_w_wrap[5:0] + {5'b00000, dfq_rd_advance} ;
1725
wire  [5:0]  dfq_rptr_new_w_wrap_inc ;
1726
assign  dfq_rptr_new_w_wrap_inc[5:0] =  dfq_rptr_w_wrap[5:0] + 6'b000001 ;
1727
assign  dfq_rptr_new_w_wrap[5:0]  =  dfq_rd_advance ? dfq_rptr_new_w_wrap_inc[5:0] : dfq_rptr_w_wrap[5:0] ;
1728
 
1729
// The dfq will always read as long as there is a valid entry.
1730
// ** Design note : If dfq output is held at latches, this is not longer required !! **
1731
//assign  dfq_rptr_vld  =   dfq_vld_entry_exists ;
1732
assign  dfq_rptr_vld  =   dfq_vld_entry_exists_w ;
1733
 
1734
wire   dfq_rptr_vld_w_d1;
1735
 
1736
 
1737 113 albert.wat
dff_s   rvld_stgd1_new (
1738 95 fafa1971
        .din    (dfq_vld_entry_exists), .q  (dfq_vld_entry_exists_d1),
1739
        .clk  (clk),
1740 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1741 95 fafa1971
        );
1742 113 albert.wat
dff_s   rvld_stgd1 (
1743 95 fafa1971
        .din    (dfq_rptr_vld), .q  (dfq_rptr_vld_w_d1),
1744
        //.din    (dfq_rptr_vld), .q  (dfq_rptr_vld_d1),
1745
        .clk  (clk),
1746 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1747 95 fafa1971
        );
1748
//dff   rdad_stgd1 (
1749
//        .din    (dfq_rd_advance), .q  (dfq_rd_advance_d1),
1750
//        .clk  (clk),
1751 113 albert.wat
//        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1752 95 fafa1971
//        ); 
1753
 
1754 113 albert.wat
dffre_s  #(6) dfq_rptr_ff (
1755 95 fafa1971
        .din    (dfq_rptr_new_w_wrap[5:0]), .q  (dfq_rptr_w_wrap[5:0]),
1756
        .rst    (reset), .en (dfq_rd_advance), .clk (clk),
1757 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1758 95 fafa1971
        );
1759
 
1760
assign  dfq_rptr_vld_d1 = dfq_rptr_vld_w_d1 & dfq_vld_entry_exists_d1;
1761
assign  dfq_rd_vld_d1 = dfq_rptr_vld_d1 ;
1762
//bug4576: add sehold to the dfq_rdata mux select
1763
assign  lsu_dfq_rd_vld_d1 = sehold | dfq_rptr_vld_d1 ;
1764
 
1765
//timing fix: 9/16/03 - dfq_rd_advance is late signal; use it as mux select to pick the correct read pointer
1766
//            add duplicate signal for dfq_rd_advance - has FO16 - adds 3inv to this path
1767
//            fix for dfq_read -> dfq_rd_advance -> dfq_rptr to dfq
1768
//assign  dfq_rptr[4:0] = dfq_rptr_w_wrap[4:0] + {4'b0000, dfq_rd_advance} ;
1769
 
1770
//1/20/04: mintime fix - add minbuf to dfq_rptr_w_wrap in dfq_rptr
1771
wire  [4:0]  dfq_rptr_w_wrap_minbuf ;
1772
 
1773
bw_u1_minbuf_5x UZfix_dfq_rptr_b0 (.a(dfq_rptr_w_wrap[0]), .z(dfq_rptr_w_wrap_minbuf[0]));
1774
bw_u1_minbuf_5x UZfix_dfq_rptr_b1 (.a(dfq_rptr_w_wrap[1]), .z(dfq_rptr_w_wrap_minbuf[1]));
1775
bw_u1_minbuf_5x UZfix_dfq_rptr_b2 (.a(dfq_rptr_w_wrap[2]), .z(dfq_rptr_w_wrap_minbuf[2]));
1776
bw_u1_minbuf_5x UZfix_dfq_rptr_b3 (.a(dfq_rptr_w_wrap[3]), .z(dfq_rptr_w_wrap_minbuf[3]));
1777
bw_u1_minbuf_5x UZfix_dfq_rptr_b4 (.a(dfq_rptr_w_wrap[4]), .z(dfq_rptr_w_wrap_minbuf[4]));
1778
 
1779
wire  [4:0]  dfq_rptr_inc ;
1780
assign dfq_rptr_inc[4:0]  =  dfq_rptr_w_wrap[4:0] + 5'b00001 ;
1781
assign  dfq_rptr[4:0] = dfq_rd_advance_dup ? dfq_rptr_inc[4:0] : dfq_rptr_w_wrap_minbuf[4:0] ;
1782
//assign  dfq_rptr[4:0] = dfq_rd_advance_dup ? dfq_rptr_inc[4:0] : dfq_rptr_w_wrap[4:0] ;
1783
 
1784
// Determine whether cfq has crossed high-water mark. IFU must switchout all threads
1785
// for every cycle that this is valid.
1786
// Need to change wptr size once new cfq array description incorporated.
1787
// Wrap bit may not be needed !!!
1788
wire  [5:0] dfq_vld_entries ;
1789
assign  dfq_vld_entries[5:0] = (dfq_wptr_w_wrap[5:0] - dfq_rptr_w_wrap[5:0]) ;
1790
/*assign  dfq_vld_entries[3:0] =
1791
  (dfq_rptr_w_wrap[4] ^ dfq_wptr_w_wrap[4]) ?
1792
  (dfq_rptr_w_wrap[3:0] - dfq_wptr_w_wrap[3:0]) : (dfq_wptr_w_wrap[3:0] - dfq_rptr_w_wrap[3:0]) ;*/
1793
 
1794
// High water mark conservatively put at 16-4 = 12
1795
assign  dfq_stall = (dfq_vld_entries[5:0] >= 6'd4) ;
1796
assign  lsu_ifu_stallreq =
1797
        dfq_stall |  int_skid_stall | lsu_tlbop_force_swo ;
1798
        //dfq_stall | dfq_stall_d1 | dfq_stall_d2 | int_skid_stall | lsu_tlbop_force_swo ; 
1799
 
1800 113 albert.wat
dff_s   dfqst_d1 (
1801 95 fafa1971
        .din  (dfq_stall), .q  (dfq_stall_d1),
1802
        .clk  (clk),
1803 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1804 95 fafa1971
        );
1805
 
1806
//=================================================================================================
1807
//  INVALIDATE PROCESSING
1808
//=================================================================================================
1809
 
1810
assign  dva_snp_addr_e[4:0]  =
1811
  lsu_cpx_pkt_ifill_type ? imiss_inv_set_index[6:2] : {lsu_cpx_pkt_inv_pa[4:0]} ;
1812
 
1813
//bug3356 - b4 never changed to invalidate the 2nd offset of the i$ fill.
1814
//          l2 now generates b4 in b129 of cpx ifill packet. for ifill pkt
1815
//          b[129] = 0 for 1st ifill packet, b[129]=1 for 2nd ifill packet.
1816
 
1817
wire    cpxpkt_ifill_b4 ;
1818
assign  cpxpkt_ifill_b4  =  lsu_cpx_pkt_atm_st_cmplt & lsu_cpx_pkt_ifill_type ;
1819
 
1820
assign  imiss_dcd_b54[0] = ~imiss_inv_set_index[1] & ~cpxpkt_ifill_b4 ;
1821
assign  imiss_dcd_b54[1] = ~imiss_inv_set_index[1] &  cpxpkt_ifill_b4 ;
1822
assign  imiss_dcd_b54[2] =  imiss_inv_set_index[1] & ~cpxpkt_ifill_b4 ;
1823
assign  imiss_dcd_b54[3] =  imiss_inv_set_index[1] &  cpxpkt_ifill_b4 ;
1824
 
1825
wire  [3:0] perror_dcd_b54 ;
1826
assign  perror_dcd_b54[0] = ~lsu_cpx_pkt_perror_set[1] & ~lsu_cpx_pkt_perror_set[0] ;
1827
assign  perror_dcd_b54[1] = ~lsu_cpx_pkt_perror_set[1] &  lsu_cpx_pkt_perror_set[0] ;
1828
assign  perror_dcd_b54[2] =  lsu_cpx_pkt_perror_set[1] & ~lsu_cpx_pkt_perror_set[0] ;
1829
assign  perror_dcd_b54[3] =  lsu_cpx_pkt_perror_set[1] &  lsu_cpx_pkt_perror_set[0] ;
1830
 
1831
wire   [3:0]           dva_snp_set_vld_e;      // Lower 2b of cache set index - decoded
1832
wire   [1:0]           dva_snp_wy0_e ;         // way for addr<5:4>=00
1833
wire   [1:0]           dva_snp_wy1_e ;         // way for addr<5:4>=01
1834
wire   [1:0]           dva_snp_wy2_e ;         // way for addr<5:4>=10
1835
wire   [1:0]           dva_snp_wy3_e ;         // way for addr<5:4>=11
1836
 
1837
 
1838
 
1839
/*
1840
assign  dva_snp_set_vld_e[0] =
1841
lsu_cpx_pkt_ifill_type ? imiss_dcd_b54[0] :
1842
  lsu_cpx_pkt_perror_dinv ? perror_dcd_b54[0] : cpx_cpu_inv_data[`CPX_AX0_INV_DVLD] ;
1843
assign  dva_snp_set_vld_e[1] =
1844
lsu_cpx_pkt_ifill_type ? imiss_dcd_b54[1] :
1845
  lsu_cpx_pkt_perror_dinv ? perror_dcd_b54[1] : cpx_cpu_inv_data[`CPX_AX1_INV_DVLD+4] ;
1846
assign  dva_snp_set_vld_e[2] =
1847
lsu_cpx_pkt_ifill_type ? imiss_dcd_b54[2] :
1848
  lsu_cpx_pkt_perror_dinv ? perror_dcd_b54[2] : cpx_cpu_inv_data[`CPX_AX0_INV_DVLD+7] ;
1849
assign  dva_snp_set_vld_e[3] =
1850
lsu_cpx_pkt_ifill_type ? imiss_dcd_b54[3] :
1851
  lsu_cpx_pkt_perror_dinv ? perror_dcd_b54[3] : cpx_cpu_inv_data[`CPX_AX1_INV_DVLD+11] ;
1852
 
1853
assign  dva_snp_wy0_e[1:0]   =
1854
lsu_cpx_pkt_ifill_type ? lsu_cpx_pkt_invwy[1:0] : cpx_cpu_inv_data[`CPX_AX0_INV_WY_HI:`CPX_AX0_INV_WY_LO];
1855
assign  dva_snp_wy1_e[1:0]   =
1856
lsu_cpx_pkt_ifill_type ? lsu_cpx_pkt_invwy[1:0] : cpx_cpu_inv_data[`CPX_AX1_INV_WY_HI+4:`CPX_AX1_INV_WY_LO+4];
1857
assign  dva_snp_wy2_e[1:0]   =
1858
lsu_cpx_pkt_ifill_type ? lsu_cpx_pkt_invwy[1:0] : cpx_cpu_inv_data[`CPX_AX0_INV_WY_HI+7:`CPX_AX0_INV_WY_LO+7];
1859
assign  dva_snp_wy3_e[1:0]   =
1860
lsu_cpx_pkt_ifill_type ? lsu_cpx_pkt_invwy[1:0] : cpx_cpu_inv_data[`CPX_AX1_INV_WY_HI+11:`CPX_AX1_INV_WY_LO+11];
1861
*/
1862
 
1863
wire    stack_type_dcfill_vld,
1864
        stack_type_dcfill_vld_d1;
1865
//assign  stack_type_dcfill_vld  =  dfq_st_ack_type & lsu_dfq_byp_stack_dcfill_vld; // bug 2767
1866
//--------------------------------------------------------------
1867
// st_ack_type  local_pkt   b[87]  dcfill_vld==b[151]
1868
//--------------------------------------------------------------
1869
//   1           0          0          -      pkt not modified
1870
//   1           0          1          -      pkt not modified
1871
//--------------------------------------------------------------
1872
//   1           1          0          0      pkt not modified
1873
//   1           1          0          1      pkt modified
1874
//--------------------------------------------------------------
1875
//   1           1          1          0      pkt not modified  <---using b[87] will fail even w/ local pkt qual; hence use b[151]
1876
//   1           1          1          1      pkt modified 
1877
//--------------------------------------------------------------
1878
 
1879
// 4/7/03: set dcfill_vld only for local dcache data write and not for invalidate
1880
//         atomic and bis do not write dcache and hence dont set dcfill_vld
1881
assign  stack_type_dcfill_vld  =  lsu_dfq_byp_type[2] & local_pkt & lsu_dfq_byp_cpx_inv & ~(lsu_dfq_byp_atm | lsu_dfq_byp_binit_st) ;
1882
 
1883
wire  [1:0]  lsu_dfq_byp_stack_adr_b54_d1,
1884
             lsu_dfq_byp_stack_wrway_d1;
1885
 
1886
// bug3375: add enable to this flop - dfq_vld_en
1887 113 albert.wat
dffe_s #(5)  dfq_by_wrway_ad54_ff (
1888 95 fafa1971
        .din    ({stack_type_dcfill_vld,lsu_dfq_byp_stack_adr_b54[1:0],lsu_dfq_byp_stack_wrway[1:0]}),
1889
        .q      ({stack_type_dcfill_vld_d1,lsu_dfq_byp_stack_adr_b54_d1[1:0],lsu_dfq_byp_stack_wrway_d1[1:0]}),
1890
        .en     (dfq_vld_en),
1891
        .clk  (clk),
1892 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
1893 95 fafa1971
        );
1894
 
1895
//cpx_cpu_inv_data[13:0] =  {dfq_inv_data_b13to9,1'b0,dfq_inv_data_b7to2,1'b0,dfq_inv_data_b0} 
1896
//CPX_AX0_INV_DVLD 0
1897
//CPX_AX0_INV_WY_LO 2
1898
//CPX_AX0_INV_WY_HI 3
1899
//CPX_AX1_INV_DVLD 0
1900
//CPX_AX1_INV_WY_LO 1
1901
//CPX_AX1_INV_WY_HI 2
1902
 
1903
assign  dva_snp_set_vld_e[0] =
1904
lsu_cpx_pkt_ifill_type ? imiss_dcd_b54[0] :
1905
  lsu_cpx_pkt_perror_dinv ? perror_dcd_b54[0] :
1906
     stack_type_dcfill_vld_d1 ? (lsu_dfq_byp_stack_adr_b54_d1[1:0]==2'b00) : dfq_inv_data_b0 ;
1907
     //stack_type_dcfill_vld_d1 ? (lsu_dfq_byp_stack_adr_b54_d1[1:0]==2'b00) : cpx_cpu_inv_data[`CPX_AX0_INV_DVLD] ;
1908
assign  dva_snp_set_vld_e[1] =
1909
lsu_cpx_pkt_ifill_type ? imiss_dcd_b54[1] :
1910
  lsu_cpx_pkt_perror_dinv ? perror_dcd_b54[1] :
1911
     stack_type_dcfill_vld_d1 ? (lsu_dfq_byp_stack_adr_b54_d1[1:0]==2'b01) : dfq_inv_data_b7to2[4] ;
1912
     //stack_type_dcfill_vld_d1 ? (lsu_dfq_byp_stack_adr_b54_d1[1:0]==2'b01) : cpx_cpu_inv_data[`CPX_AX1_INV_DVLD+4] ;
1913
assign  dva_snp_set_vld_e[2] =
1914
lsu_cpx_pkt_ifill_type ? imiss_dcd_b54[2] :
1915
  lsu_cpx_pkt_perror_dinv ? perror_dcd_b54[2] :
1916
     stack_type_dcfill_vld_d1 ? (lsu_dfq_byp_stack_adr_b54_d1[1:0]==2'b10) : dfq_inv_data_b7to2[7] ;
1917
     //stack_type_dcfill_vld_d1 ? (lsu_dfq_byp_stack_adr_b54_d1[1:0]==2'b10) : cpx_cpu_inv_data[`CPX_AX0_INV_DVLD+7] ;
1918
assign  dva_snp_set_vld_e[3] =
1919
lsu_cpx_pkt_ifill_type ? imiss_dcd_b54[3] :
1920
  lsu_cpx_pkt_perror_dinv ? perror_dcd_b54[3] :
1921
      stack_type_dcfill_vld_d1 ? (lsu_dfq_byp_stack_adr_b54_d1[1:0]==2'b11) : dfq_inv_data_b13to9[11] ;
1922
      //stack_type_dcfill_vld_d1 ? (lsu_dfq_byp_stack_adr_b54_d1[1:0]==2'b11) : cpx_cpu_inv_data[`CPX_AX1_INV_DVLD+11] ; 
1923
 
1924
assign  dva_snp_wy0_e[1:0]   =
1925
lsu_cpx_pkt_ifill_type ? lsu_cpx_pkt_invwy[1:0] :
1926
   stack_type_dcfill_vld_d1 ? lsu_dfq_byp_stack_wrway_d1[1:0] : dfq_inv_data_b7to2[3:2] ;
1927
   //stack_type_dcfill_vld_d1 ? lsu_dfq_byp_stack_wrway_d1[1:0] : cpx_cpu_inv_data[`CPX_AX0_INV_WY_HI:`CPX_AX0_INV_WY_LO] ;
1928
assign  dva_snp_wy1_e[1:0]   =
1929
lsu_cpx_pkt_ifill_type ? lsu_cpx_pkt_invwy[1:0] :
1930
   stack_type_dcfill_vld_d1 ? lsu_dfq_byp_stack_wrway_d1[1:0] : dfq_inv_data_b7to2[6:5] ;
1931
   //stack_type_dcfill_vld_d1 ? lsu_dfq_byp_stack_wrway_d1[1:0] : cpx_cpu_inv_data[`CPX_AX1_INV_WY_HI+4:`CPX_AX1_INV_WY_LO+4] ;
1932
assign  dva_snp_wy2_e[1:0]   =
1933
lsu_cpx_pkt_ifill_type ? lsu_cpx_pkt_invwy[1:0] :
1934
   stack_type_dcfill_vld_d1 ? lsu_dfq_byp_stack_wrway_d1[1:0] : dfq_inv_data_b13to9[10:9] ;
1935
   //stack_type_dcfill_vld_d1 ? lsu_dfq_byp_stack_wrway_d1[1:0] : cpx_cpu_inv_data[`CPX_AX0_INV_WY_HI+7:`CPX_AX0_INV_WY_LO+7] ;
1936
assign  dva_snp_wy3_e[1:0]   =
1937
lsu_cpx_pkt_ifill_type ? lsu_cpx_pkt_invwy[1:0] :
1938
   stack_type_dcfill_vld_d1 ? lsu_dfq_byp_stack_wrway_d1[1:0] : dfq_inv_data_b13to9[13:12] ;
1939
   //stack_type_dcfill_vld_d1 ? lsu_dfq_byp_stack_wrway_d1[1:0] : cpx_cpu_inv_data[`CPX_AX1_INV_WY_HI+11:`CPX_AX1_INV_WY_LO+11] ;
1940
 
1941
 
1942
 
1943
//   wire [1:0] dva_snp_way_e;
1944
//assign dva_snp_way_e[1:0] =  
1945
//  dva_snp_set_vld_e[0] ?  dva_snp_wy0_e[1:0]:
1946
//  dva_snp_set_vld_e[1] ?  dva_snp_wy1_e[1:0]:
1947
//  dva_snp_set_vld_e[2] ?  dva_snp_wy2_e[1:0]:
1948
//  dva_snp_set_vld_e[3] ?  dva_snp_wy3_e[1:0]: 2'bxx;
1949
 
1950
//bug 2333 fix
1951
//06/09/03: bug 3420 - add logic for dtag parity error invalidate - inv all 4 ways of the index that had error
1952
//bug 3608 - qualify perror_dinv w/ dfq_st_vld
1953
wire     derror_inv_vld ;
1954
assign   derror_inv_vld  =  dfq_st_vld & lsu_cpx_pkt_perror_dinv ;
1955
 
1956
   assign dva_snp_bit_wr_en_e [15] =  dva_snp_set_vld_e[3] &  (( dva_snp_wy3_e [1] &  dva_snp_wy3_e[0]) | derror_inv_vld ) ;
1957
   assign dva_snp_bit_wr_en_e [14] =  dva_snp_set_vld_e[3] &  (( dva_snp_wy3_e [1] & ~dva_snp_wy3_e[0]) | derror_inv_vld );
1958
   assign dva_snp_bit_wr_en_e [13] =  dva_snp_set_vld_e[3] &  ((~dva_snp_wy3_e [1] &  dva_snp_wy3_e[0]) | derror_inv_vld );
1959
   assign dva_snp_bit_wr_en_e [12] =  dva_snp_set_vld_e[3] &  ((~dva_snp_wy3_e [1] & ~dva_snp_wy3_e[0]) | derror_inv_vld );
1960
 
1961
   assign dva_snp_bit_wr_en_e [11] =  dva_snp_set_vld_e[2] &  (( dva_snp_wy2_e [1] &  dva_snp_wy2_e[0]) | derror_inv_vld );
1962
   assign dva_snp_bit_wr_en_e [10] =  dva_snp_set_vld_e[2] &  (( dva_snp_wy2_e [1] & ~dva_snp_wy2_e[0]) | derror_inv_vld );
1963
   assign dva_snp_bit_wr_en_e [09] =  dva_snp_set_vld_e[2] &  ((~dva_snp_wy2_e [1] &  dva_snp_wy2_e[0]) | derror_inv_vld );
1964
   assign dva_snp_bit_wr_en_e [08] =  dva_snp_set_vld_e[2] &  ((~dva_snp_wy2_e [1] & ~dva_snp_wy2_e[0]) | derror_inv_vld );
1965
 
1966
   assign dva_snp_bit_wr_en_e [07] =  dva_snp_set_vld_e[1] &  (( dva_snp_wy1_e [1] &  dva_snp_wy1_e[0]) | derror_inv_vld );
1967
   assign dva_snp_bit_wr_en_e [06] =  dva_snp_set_vld_e[1] &  (( dva_snp_wy1_e [1] & ~dva_snp_wy1_e[0]) | derror_inv_vld );
1968
   assign dva_snp_bit_wr_en_e [05] =  dva_snp_set_vld_e[1] &  ((~dva_snp_wy1_e [1] &  dva_snp_wy1_e[0]) | derror_inv_vld );
1969
   assign dva_snp_bit_wr_en_e [04] =  dva_snp_set_vld_e[1] &  ((~dva_snp_wy1_e [1] & ~dva_snp_wy1_e[0]) | derror_inv_vld );
1970
 
1971
   assign dva_snp_bit_wr_en_e [03] =  dva_snp_set_vld_e[0] &  (( dva_snp_wy0_e [1] &  dva_snp_wy0_e[0]) | derror_inv_vld );
1972
   assign dva_snp_bit_wr_en_e [02] =  dva_snp_set_vld_e[0] &  (( dva_snp_wy0_e [1] & ~dva_snp_wy0_e[0]) | derror_inv_vld );
1973
   assign dva_snp_bit_wr_en_e [01] =  dva_snp_set_vld_e[0] &  ((~dva_snp_wy0_e [1] &  dva_snp_wy0_e[0]) | derror_inv_vld );
1974
   assign dva_snp_bit_wr_en_e [00] =  dva_snp_set_vld_e[0] &  ((~dva_snp_wy0_e [1] & ~dva_snp_wy0_e[0]) | derror_inv_vld );
1975
 
1976
 
1977
//=================================================================================================
1978
//  LOCAL ST ACK PROCESSING
1979
//=================================================================================================
1980
 
1981
// st-ack at head of cfq may write to cache if not indicated as invalid 
1982
// L2.
1983
 
1984
//wire  byp_tag_perror ;
1985
//assign        byp_tag_perror = lsu_dfq_byp_perror_dinv | lsu_dfq_byp_perror_iinv ;
1986
 
1987
// one-shot rd-enable for stb for st data.
1988
// st-quad pkt2 will not rd stb
1989
//NOTE: restore cpx_inv qualification after adding cpx_inv part of dfq read - done
1990
/*
1991
assign  st_ack_rq_stb =
1992
   (dfq_byp_st_vld & st_rd_advance & ~byp_tag_perror)   // local st ack from dfq
1993
  & lsu_dfq_byp_cpx_inv ;
1994
*/
1995
  //((cpx_local_st_ack_type & ~dfq_wr_en & ~(|cpx_spc_data_cx[`CPX_PERR_DINV+1:`CPX_PERR_DINV])) | // local st ack from cpx
1996
  //(dfq_byp_st_vld & dfq_rd_advance & ~byp_tag_perror))   // local st ack from dfq
1997
  //(dfq_byp_st_vld & dfq_rd_advance_d1)) // local st ack from dfq
1998
 
1999
/*assign  st_ack_rq_stb =
2000
  ((cpx_local_st_ack_type & ~dfq_wr_en & ~cpx_spc_data_cx[107]) | // local st ack from cpx
2001
  (dfq_byp_st_vld & dfq_rd_advance & ~lsu_dfq_byp_stquad_pkt2))   // local st ack from dfq
2002
  //(dfq_byp_st_vld & dfq_rd_advance_d1)) // local st ack from dfq
2003
  & cpx_inv ; */
2004
 
2005
/*
2006 113 albert.wat
dff_s #(1)  stackr_d1 (
2007 95 fafa1971
        .din    (st_ack_rq_stb),
2008
        .q      (st_ack_rq_stb_d1),
2009
        .clk  (clk),
2010 113 albert.wat
        .se     (1'b0),       `SIMPLY_RISC_SCANIN,          .so ()
2011 95 fafa1971
        );
2012
*/
2013
 
2014
// Mux's control signal can be flipped - TIMING
2015
//assign  st_ack_tid[1:0] =
2016
//  (dfq_byp_st_vld & dfq_rd_advance) ?  
2017
//      lsu_dfq_byp_tid[1:0] : cpx_spc_data_cx[`CPX_TH_HI:`CPX_TH_LO] ;
2018
 
2019
// This can be critical !!!
2020
//assign  lsu_st_ack_rq_stb[0] = ~st_ack_tid[1] & ~st_ack_tid[0] & st_ack_rq_stb ;
2021
//assign  lsu_st_ack_rq_stb[1] = ~st_ack_tid[1] &  st_ack_tid[0] & st_ack_rq_stb ;
2022
//assign  lsu_st_ack_rq_stb[2] =  st_ack_tid[1] & ~st_ack_tid[0] & st_ack_rq_stb ;
2023
//assign  lsu_st_ack_rq_stb[3] =  st_ack_tid[1] &  st_ack_tid[0] & st_ack_rq_stb ;
2024
 
2025
// the ack decode can be combined with the above (grape)
2026
 
2027
assign  lsu_st_ack_dq_stb[0] =
2028
        cpx_pkt_thrd_sel[0] & dfq_st_cmplt &
2029
        ~(lsu_cpx_pkt_perror_dinv | lsu_cpx_pkt_perror_iinv | lsu_cpx_pkt_binit_st) ;
2030
assign  lsu_st_ack_dq_stb[1] =
2031
        cpx_pkt_thrd_sel[1] & dfq_st_cmplt &
2032
        ~(lsu_cpx_pkt_perror_dinv | lsu_cpx_pkt_perror_iinv | lsu_cpx_pkt_binit_st) ;
2033
assign  lsu_st_ack_dq_stb[2] =
2034
        cpx_pkt_thrd_sel[2] & dfq_st_cmplt &
2035
        ~(lsu_cpx_pkt_perror_dinv | lsu_cpx_pkt_perror_iinv | lsu_cpx_pkt_binit_st) ;
2036
assign  lsu_st_ack_dq_stb[3] =
2037
        cpx_pkt_thrd_sel[3] & dfq_st_cmplt &
2038
        ~(lsu_cpx_pkt_perror_dinv | lsu_cpx_pkt_perror_iinv | lsu_cpx_pkt_binit_st) ;
2039
 
2040
// Signal rmo ack completion.
2041
assign  lsu_cpx_rmo_st_ack[0] =
2042
        cpx_pkt_thrd_sel[0] & dfq_st_cmplt  & lsu_cpx_pkt_binit_st ;
2043
assign  lsu_cpx_rmo_st_ack[1] =
2044
        cpx_pkt_thrd_sel[1] & dfq_st_cmplt  & lsu_cpx_pkt_binit_st ;
2045
assign  lsu_cpx_rmo_st_ack[2] =
2046
        cpx_pkt_thrd_sel[2] & dfq_st_cmplt  & lsu_cpx_pkt_binit_st ;
2047
assign  lsu_cpx_rmo_st_ack[3] =
2048
        cpx_pkt_thrd_sel[3] & dfq_st_cmplt  & lsu_cpx_pkt_binit_st ;
2049
 
2050
assign  lsu_st_wr_dcache = stwr_active_e ;
2051
 
2052
//assign  lsu_st_wr_sel_e = stwr_active_e |  lsu_diagnstc_wr_src_sel_e ;
2053
 
2054
//=================================================================================================
2055
//  CPX PKT DECODE
2056
//=================================================================================================
2057
 
2058
// The decode is meant to qualify writes into the dfq.
2059
// These values are also stored in the dfq to save on decode at the head of the queue.
2060
 
2061
assign lsu_cpxpkt_type_dcd_cx[5:0] =
2062
{cpx_ld_type,cpx_ifill_type,cpx_evict_type,cpx_st_ack_type,cpx_strm_st_ack_type,cpx_int_type};
2063
 
2064
assign  cpx_ld_type =
2065 113 albert.wat
         cpx_spc_data_cx_b144to140[`CPX_VLD] &
2066
        ((~cpx_spc_data_cx_b144to140[`CPX_RQ_HI]   & ~cpx_spc_data_cx_b144to140[`CPX_RQ_LO+2] & // 0000
2067
          ~cpx_spc_data_cx_b144to140[`CPX_RQ_LO+1] & ~cpx_spc_data_cx_b144to140[`CPX_RQ_LO]));
2068 95 fafa1971
 
2069
assign  cpx_ifill_type =
2070 113 albert.wat
         cpx_spc_data_cx_b144to140[`CPX_VLD] &
2071
        ((~cpx_spc_data_cx_b144to140[`CPX_RQ_HI]   & ~cpx_spc_data_cx_b144to140[`CPX_RQ_LO+2] & // 0001
2072
          ~cpx_spc_data_cx_b144to140[`CPX_RQ_LO+1] &  cpx_spc_data_cx_b144to140[`CPX_RQ_LO]));
2073 95 fafa1971
 
2074
assign  cpx_evict_type =
2075 113 albert.wat
         cpx_spc_data_cx_b144to140[`CPX_VLD] &
2076
        ((~cpx_spc_data_cx_b144to140[`CPX_RQ_HI]   & ~cpx_spc_data_cx_b144to140[`CPX_RQ_LO+2] & // 0011
2077
           cpx_spc_data_cx_b144to140[`CPX_RQ_LO+1] &  cpx_spc_data_cx_b144to140[`CPX_RQ_LO]));
2078 95 fafa1971
 
2079
assign  cpx_st_ack_type =
2080 113 albert.wat
         cpx_spc_data_cx_b144to140[`CPX_VLD] &
2081
        ((~cpx_spc_data_cx_b144to140[`CPX_RQ_HI]  &   cpx_spc_data_cx_b144to140[`CPX_RQ_LO+2] & // 0100
2082
          ~cpx_spc_data_cx_b144to140[`CPX_RQ_LO+1] & ~cpx_spc_data_cx_b144to140[`CPX_RQ_LO]));
2083 95 fafa1971
         //~cpx_spc_data_cx[108] ;  // 1st stquad ack is rejected
2084
 
2085
assign  cpx_strm_st_ack_type =
2086 113 albert.wat
         cpx_spc_data_cx_b144to140[`CPX_VLD] &
2087
        ((~cpx_spc_data_cx_b144to140[`CPX_RQ_HI]   &  cpx_spc_data_cx_b144to140[`CPX_RQ_LO+2] & // 0110
2088
           cpx_spc_data_cx_b144to140[`CPX_RQ_LO+1] & ~cpx_spc_data_cx_b144to140[`CPX_RQ_LO]));
2089 95 fafa1971
 
2090
assign  cpx_int_type =
2091 113 albert.wat
         cpx_spc_data_cx_b144to140[`CPX_VLD] &
2092
        ((~cpx_spc_data_cx_b144to140[`CPX_RQ_HI]   &  cpx_spc_data_cx_b144to140[`CPX_RQ_LO+2] & // 0111
2093
           cpx_spc_data_cx_b144to140[`CPX_RQ_LO+1] &  cpx_spc_data_cx_b144to140[`CPX_RQ_LO]));
2094 95 fafa1971
 
2095
//bug3657  - kill ifill vld in bypass path when cpxtype=fp/fwd_reply
2096
 
2097
assign  cpx_fp_type =
2098 113 albert.wat
         cpx_spc_data_cx_b144to140[`CPX_VLD] &
2099
        (( cpx_spc_data_cx_b144to140[`CPX_RQ_HI]   & ~cpx_spc_data_cx_b144to140[`CPX_RQ_LO+2] & // 1000
2100
          ~cpx_spc_data_cx_b144to140[`CPX_RQ_LO+1] & ~cpx_spc_data_cx_b144to140[`CPX_RQ_LO]));
2101 95 fafa1971
 
2102
//8/25/03: add error type to dfq_wr_en, dfq_rd_advance
2103
assign  cpx_error_type =
2104 113 albert.wat
         cpx_spc_data_cx_b144to140[`CPX_VLD] &
2105
        (( cpx_spc_data_cx_b144to140[`CPX_RQ_HI]   &  cpx_spc_data_cx_b144to140[`CPX_RQ_LO+2] & // 1100
2106
          ~cpx_spc_data_cx_b144to140[`CPX_RQ_LO+1] & ~cpx_spc_data_cx_b144to140[`CPX_RQ_LO]));
2107 95 fafa1971
 
2108
// Miscellaneous cpu based decode
2109
 
2110
assign  lsu_cpu_dcd_sel[7:0]  = {cpu_sel[3:0],cpu_sel[3:0]} ;
2111
assign  lsu_cpu_uhlf_sel  = const_cpuid[2] ;
2112
 
2113
// removed cpu_id[2] qual in the eqn.
2114
assign  cpu_sel[0] =  ~const_cpuid[1] & ~const_cpuid[0] ;
2115
assign  cpu_sel[1] =  ~const_cpuid[1] &  const_cpuid[0] ;
2116
assign  cpu_sel[2] =   const_cpuid[1] & ~const_cpuid[0] ;
2117
assign  cpu_sel[3] =   const_cpuid[1] &  const_cpuid[0] ;
2118
 
2119
 
2120
// st ack to respective stb's. will not be generated for blk init stores
2121
// as such stores have already been deallocated.
2122
 
2123
assign  cpx_local_st_ack_type =
2124 113 albert.wat
  cpx_st_ack_type & (const_cpuid[2:0] == cpx_spc_data_cx_b120to118[`CPX_INV_CID_HI:`CPX_INV_CID_LO]) ;
2125 95 fafa1971
 // & ~(cpx_spc_data_cx[`CPX_BINIT_STACK] | (|cpx_spc_data_cx[`CPX_PERR_DINV+1:`CPX_PERR_DINV])) ;
2126
 
2127
wire    squash_ack ;
2128
assign squash_ack =
2129 113 albert.wat
(cpx_spc_data_cx_b125 | (|cpx_spc_data_cx_b124to123[`CPX_PERR_DINV+1:`CPX_PERR_DINV])) ;
2130 95 fafa1971
 
2131
assign  cpx_st_ack_tid0 = cpx_local_st_ack_type & ~squash_ack &
2132 113 albert.wat
                        ~cpx_spc_data_cx_b135to134[`CPX_TH_HI] & ~cpx_spc_data_cx_b135to134[`CPX_TH_LO] ;
2133 95 fafa1971
                        //~cpx_spc_data_cx[125] ; // rmo st will not ack
2134
                        //~cpx_spc_data_cx[`CPX_WY_LO] ; // stquad1 will not ack - just invalidate.
2135
                                                      // b131 of cpx pkt used.  
2136
 
2137
assign  cpx_st_ack_tid1 = cpx_local_st_ack_type & ~squash_ack &
2138 113 albert.wat
                        ~cpx_spc_data_cx_b135to134[`CPX_TH_HI] &  cpx_spc_data_cx_b135to134[`CPX_TH_LO] ;
2139 95 fafa1971
                        //~cpx_spc_data_cx[125] ; // rmo st will not ack
2140
                        //~cpx_spc_data_cx[`CPX_WY_LO] ; // stquad1 will not ack - just invalidate.
2141
                                                      // b131 of cpx pkt used.
2142
 
2143
assign  cpx_st_ack_tid2 = cpx_local_st_ack_type & ~squash_ack &
2144 113 albert.wat
                         cpx_spc_data_cx_b135to134[`CPX_TH_HI] & ~cpx_spc_data_cx_b135to134[`CPX_TH_LO] ;
2145 95 fafa1971
                        //~cpx_spc_data_cx[125] ; // rmo st will not ack
2146
                        //~cpx_spc_data_cx[`CPX_WY_LO] ; // stquad1 will not ack - just invalidate.
2147
                                                      // b131 of cpx pkt used. 
2148
 
2149
assign  cpx_st_ack_tid3 = cpx_local_st_ack_type & ~squash_ack &
2150 113 albert.wat
                         cpx_spc_data_cx_b135to134[`CPX_TH_HI] & cpx_spc_data_cx_b135to134[`CPX_TH_LO] ;
2151 95 fafa1971
                        //~cpx_spc_data_cx[125] ; // rmo st will not ack
2152
                        //~cpx_spc_data_cx[`CPX_WY_LO] ; // stquad1 will not ack - just invalidate.
2153
                                                      // b131 of cpx pkt used.
2154
 
2155
// Performance Ctr Info
2156
//assign lsu_tlu_l2_dmiss[0] =  dfill_dcd_thrd[0] & dcfill_active_e & lsu_cpx_pkt_l2miss ;
2157
assign lsu_tlu_l2_dmiss[0] =  dfq_thread0 & dcfill_active_e & lsu_cpx_pkt_l2miss ;
2158
assign lsu_tlu_l2_dmiss[1] =  dfq_thread1 & dcfill_active_e & lsu_cpx_pkt_l2miss ;
2159
assign lsu_tlu_l2_dmiss[2] =  dfq_thread2 & dcfill_active_e & lsu_cpx_pkt_l2miss ;
2160
assign lsu_tlu_l2_dmiss[3] =  dfq_thread3 & dcfill_active_e & lsu_cpx_pkt_l2miss ;
2161
 
2162
//=================================================================================================
2163
//  GENERATE b[151] of DFQ WRITE DATA
2164
//=================================================================================================
2165
wire  [7:0]  cpx_inv_vld;
2166
wire  [7:0]  cpu_sel_dcd;
2167
 
2168
assign  cpx_inv_vld[0] = cpx_spc_data_cx_b88 |
2169
                         cpx_spc_data_cx_b56 |
2170
                         cpx_spc_data_cx_b32 |
2171
                         cpx_spc_data_cx_b0 ;
2172
 
2173
assign  cpx_inv_vld[1] = cpx_spc_data_cx_b91 |
2174
                         cpx_spc_data_cx_b60 |
2175
                         cpx_spc_data_cx_b35 |
2176
                         cpx_spc_data_cx_b4 ;
2177
 
2178
assign  cpx_inv_vld[2] = cpx_spc_data_cx_b94 |
2179
                         cpx_spc_data_cx_b64 |
2180
                         cpx_spc_data_cx_b38 |
2181
                         cpx_spc_data_cx_b8 ;
2182
 
2183
assign  cpx_inv_vld[3] = cpx_spc_data_cx_b97 |
2184
                         cpx_spc_data_cx_b68 |
2185
                         cpx_spc_data_cx_b41 |
2186
                         cpx_spc_data_cx_b12 ;
2187
 
2188
assign  cpx_inv_vld[4] = cpx_spc_data_cx_b100 |
2189
                         cpx_spc_data_cx_b72  |
2190
                         cpx_spc_data_cx_b44  |
2191
                         cpx_spc_data_cx_b16  ;
2192
 
2193
assign  cpx_inv_vld[5] = cpx_spc_data_cx_b103 |
2194
                         cpx_spc_data_cx_b76  |
2195
                         cpx_spc_data_cx_b47  |
2196
                         cpx_spc_data_cx_b20  ;
2197
 
2198
assign  cpx_inv_vld[6] = cpx_spc_data_cx_b106 |
2199
                         cpx_spc_data_cx_b80  |
2200
                         cpx_spc_data_cx_b50  |
2201
                         cpx_spc_data_cx_b24  ;
2202
 
2203
assign  cpx_inv_vld[7] = cpx_spc_data_cx_b109 |
2204
                         cpx_spc_data_cx_b84  |
2205
                         cpx_spc_data_cx_b53  |
2206
                         cpx_spc_data_cx_b28  ;
2207
 
2208
assign cpu_sel_dcd[7:4] =  ({4{ lsu_cpu_uhlf_sel}} & cpu_sel[3:0]);
2209
assign cpu_sel_dcd[3:0] =  ({4{~lsu_cpu_uhlf_sel}} & cpu_sel[3:0]);
2210
 
2211
assign lsu_cpx_spc_inv_vld  =  |(cpx_inv_vld[7:0] & cpu_sel_dcd[7:0]);
2212
 
2213
//=================================================================================================
2214
//  GENERATE ICACHE INVALIDATE VALID (bug:2770)
2215
//=================================================================================================
2216
 
2217
wire  [7:0]  cpx_iinv_vld;
2218
wire         cpx_spc_iinv_vld;
2219
 
2220
assign  cpx_iinv_vld[0] = cpx_spc_data_cx_b57 |
2221
                          cpx_spc_data_cx_b1  ;
2222
 
2223
assign  cpx_iinv_vld[1] = cpx_spc_data_cx_b61 |
2224
                          cpx_spc_data_cx_b5  ;
2225
 
2226
assign  cpx_iinv_vld[2] = cpx_spc_data_cx_b65 |
2227
                          cpx_spc_data_cx_b9  ;
2228
 
2229
assign  cpx_iinv_vld[3] = cpx_spc_data_cx_b69 |
2230
                          cpx_spc_data_cx_b13 ;
2231
 
2232
assign  cpx_iinv_vld[4] = cpx_spc_data_cx_b73 |
2233
                          cpx_spc_data_cx_b17 ;
2234
 
2235
assign  cpx_iinv_vld[5] = cpx_spc_data_cx_b77 |
2236
                          cpx_spc_data_cx_b21 ;
2237
 
2238
assign  cpx_iinv_vld[6] = cpx_spc_data_cx_b81 |
2239
                          cpx_spc_data_cx_b25 ;
2240
 
2241
assign  cpx_iinv_vld[7] = cpx_spc_data_cx_b85 |
2242
                          cpx_spc_data_cx_b29 ;
2243
 
2244
//bug3701 - include i$ parity error invalidate - b[124]
2245 113 albert.wat
assign cpx_spc_iinv_vld  =  |( (cpx_iinv_vld[7:0] | {8{cpx_spc_data_cx_b124to123[`CPX_PERR_DINV+1]}}) & cpu_sel_dcd[7:0] )  ;
2246 95 fafa1971
 
2247
 
2248
// dfq_rd_advance - local st ack not qualified w/ ifu_lsu_ibuf_busy
2249
// qualify ifu_busy w/ local_st_ack=1 and iinv=1
2250
 
2251
assign lsu_cpx_stack_icfill_vld  =
2252
                  ( cpx_local_st_ack_type & cpx_spc_iinv_vld) |        //if local st_ack=1, b[128]=iinv
2253
                  (~cpx_local_st_ack_type & cpx_spc_data_cx_b128) ;    //if local st_ack=0, b[128]=cpx_data[128]
2254
 
2255
//=================================================================================================
2256
//  MISC QDP2 MUX SELECTS
2257
//=================================================================================================
2258
 
2259
//assign  lsu_dcfill_mx_sel_e[0]  =  lsu_dc_iob_access_e;
2260
//assign  lsu_dcfill_mx_sel_e[1]  =  lsu_bist_wvld_e | lsu_bist_rvld_e;
2261
//assign  lsu_dcfill_mx_sel_e[2]  =  lsu_diagnstc_wr_src_sel_e;
2262
//assign  lsu_dcfill_mx_sel_e[3]  =  ~|lsu_dcfill_mx_sel_e[2:0];
2263
 
2264
//assign  lsu_dcfill_addr_mx_sel_e  =  ~|lsu_dcfill_mx_sel_e[1:0];
2265
 
2266
//assign  lsu_dcfill_data_mx_sel_e  =  lsu_dc_iob_access_e | lsu_bist_wvld_e;
2267
 
2268 113 albert.wat
assign lsu_cpx_thrdid[0]  =  ~cpx_spc_data_cx_b135to134[`CPX_TH_HI] & ~cpx_spc_data_cx_b135to134[`CPX_TH_LO] ;
2269
assign lsu_cpx_thrdid[1]  =  ~cpx_spc_data_cx_b135to134[`CPX_TH_HI] &  cpx_spc_data_cx_b135to134[`CPX_TH_LO] ;
2270
assign lsu_cpx_thrdid[2]  =   cpx_spc_data_cx_b135to134[`CPX_TH_HI] & ~cpx_spc_data_cx_b135to134[`CPX_TH_LO] ;
2271
assign lsu_cpx_thrdid[3]  =   cpx_spc_data_cx_b135to134[`CPX_TH_HI] &  cpx_spc_data_cx_b135to134[`CPX_TH_LO] ;
2272 95 fafa1971
 
2273
// modify cpx packet only if dcache update from stb has to be made. 
2274
// lsu_cpx_spc_inv_vld = 1 => invalidate dcache for atomic- b[129] and bst- b[125]
2275
//                            update dcache for other requests
2276
//
2277
// i.e. cpx_pkt==st_ack and local and dcfill_vld=1; if dcfill_vld==0, ifill info
2278
// has to be left as is. hence no pkt modification
2279
 
2280
assign lsu_cpx_stack_dcfill_vld  =
2281
                       (cpx_local_st_ack_type & ~(cpx_spc_data_cx_b129 | cpx_spc_data_cx_b125))  &
2282
                       lsu_cpx_spc_inv_vld ;
2283
 
2284
//timing fix: 6/16/03 - fix for ifill_pkt_vld - use b130 if store_ack_dcfill_vld=1
2285
//bug3582 - b[130] for store ack is a dont-care i.e. capture b[130] only if packet type is not store ack
2286
assign lsu_cpx_stack_dcfill_vld_b130  =  // if lsu_cpx_stack_dcfill_vld=1 b[130]=lsu_cpx_stack_dcfill_vld
2287
                                         // if cpx_st_ack=0 b[130]=cpx_data[130]
2288
                                       lsu_cpx_stack_dcfill_vld |
2289
                                       (~cpx_st_ack_type & cpx_spc_data_cx_b130) ;
2290
endmodule

powered by: WebSVN 2.1.0

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