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

Subversion Repositories s1_core

[/] [s1_core/] [trunk/] [hdl/] [rtl/] [sparc_core/] [lsu_stb_ctl.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_stb_ctl.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:    Control for STB of LSU
29
//                              - Contains control for a single STB currently.
30
*/
31
////////////////////////////////////////////////////////////////////////
32
// Global header file includes
33
////////////////////////////////////////////////////////////////////////
34 113 albert.wat
`include        "sys.h" // system level definition file which contains the 
35 95 fafa1971
                                        // time scale definition
36
 
37 113 albert.wat
`include "iop.h"
38 95 fafa1971
////////////////////////////////////////////////////////////////////////
39
// Local header file includes / local defines
40
////////////////////////////////////////////////////////////////////////
41
 
42
module lsu_stb_ctl (/*AUTOARG*/
43
   // Outputs
44
   so, stb_clk_en_l, stb_crnt_ack_id, lsu_stb_empty, stb_l2bnk_addr,
45
   stb_atm_rq_type, stb_wrptr, stb_rd_for_pcx, stb_pcx_rptr,
46
   stb_wrptr_prev, stb_state_ced_mod, stb_state_vld_out,
47
   lsu_stbcnt, stb_rmo_st_issue, stb_full, st_pcx_rq_kill_w2,
48
   // Inputs
49
   rclk, grst_l, arst_l, si, se, thrd_en_g, cpx_st_ack_tid,
50
   pcx_rq_for_stb, st_ack_dq_stb, stb_flush_st_g, stb_cam_wvld_m,
51
   lsu_blk_st_m, tlb_pgnum_g, pcx_req_squash, flshinst_rst,
52
   lsu_stbctl_flush_pipe_w, flsh_inst_m, stb_state_si_0,
53
   stb_state_si_1, stb_state_si_2, stb_state_si_3, stb_state_si_4,
54
   stb_state_si_5, stb_state_si_6, stb_state_si_7, stb_state_rtype_0,
55
   stb_state_rtype_1, stb_state_rtype_2, stb_state_rtype_3,
56
   stb_state_rtype_4, stb_state_rtype_5, stb_state_rtype_6,
57
   stb_state_rtype_7, stb_state_rmo, stb_alt_sel, stb_alt_addr,
58
   lsu_dtlb_bypass_e, tlb_cam_hit, lsu_outstanding_rmo_st_max,
59
   st_dtlb_perr_g
60
   ) ;
61
 
62
 
63
   input rclk ;
64
   input grst_l;
65
   input arst_l;
66
 
67
   input si;
68
   input se;
69
   output so;
70
 
71
input           thrd_en_g ;
72
input           cpx_st_ack_tid ;        // st ack for given thread
73
input           pcx_rq_for_stb ;        // stb's st selected for read for pcx
74
input           st_ack_dq_stb ;         // store dequeued from stb
75
input           stb_flush_st_g ;        // flush stb write in cycle g
76
input           stb_cam_wvld_m ;        // stb write in cycle m
77
 
78
input           lsu_blk_st_m ;          // blk st wr
79
 
80
//input  [7:6]    lsu_ldst_va_m ;         // staging purposes
81
//input  [2:1]    lsu_st_rq_type_m ;    // st request type
82
//input         lsu_st_rmo_m ;          // rmo store in m-stage
83
 
84
input  [39:37]  tlb_pgnum_g ;           // ldst access to io 
85
input           pcx_req_squash ;        // pcx req is squashed
86
 
87
input           flshinst_rst ;          // reset by flush inst on return
88
input           lsu_stbctl_flush_pipe_w ;
89
 
90
   input flsh_inst_m;
91
 
92
 
93
//from stb_ctldp
94
   input [3:2] stb_state_si_0;
95
   input [3:2] stb_state_si_1;
96
   input [3:2] stb_state_si_2;
97
   input [3:2] stb_state_si_3;
98
   input [3:2] stb_state_si_4;
99
   input [3:2] stb_state_si_5;
100
   input [3:2] stb_state_si_6;
101
   input [3:2] stb_state_si_7;
102
 
103
   input [2:1] stb_state_rtype_0;
104
   input [2:1] stb_state_rtype_1;
105
   input [2:1] stb_state_rtype_2;
106
   input [2:1] stb_state_rtype_3;
107
   input [2:1] stb_state_rtype_4;
108
   input [2:1] stb_state_rtype_5;
109
   input [2:1] stb_state_rtype_6;
110
   input [2:1] stb_state_rtype_7;
111
 
112
   //input [7:0] stb_state_io;
113
   input [7:0] stb_state_rmo;
114
 
115
   input       stb_alt_sel ;
116
   input [2:0] stb_alt_addr ;
117
 
118
input          lsu_dtlb_bypass_e;
119
input          tlb_cam_hit;             // m-cycle
120
 
121
input           st_dtlb_perr_g ;        // enabled st dtlb parity err.
122
 
123
   //output      stb_non_l2bnk;
124
   output [7:0] stb_clk_en_l;
125
 
126
output  [2:0]   stb_crnt_ack_id ;       // ackid for current outstanding st.
127
 
128
output          lsu_stb_empty ;         // stb is empty
129
 
130
output  [2:0]    stb_l2bnk_addr ;        // l2bank address.      
131
output  [2:1]   stb_atm_rq_type ;       // identify atomic transaction
132
 
133
output  [2:0]    stb_wrptr ;             // write ptr - per thread
134
//output        [2:0]   stb_dfq_rptr ;          // rptr for dfq - per thread
135
output          stb_rd_for_pcx ;        // rd vld for pcx - per thread
136
output  [2:0]    stb_pcx_rptr ;          // rptr for pcx - per thread
137
output  [2:0]    stb_wrptr_prev ;
138
output  [7:0]   stb_state_ced_mod ;
139
output  [7:0]   stb_state_vld_out ;
140
 
141
output  [3:0]    lsu_stbcnt ;    // # of vld entries
142
 
143
output          stb_rmo_st_issue ;              // rmo store issued from thread's stb.
144
 
145
output          stb_full ;
146
output          st_pcx_rq_kill_w2 ;
147
 
148
   input  lsu_outstanding_rmo_st_max;
149
 
150
   wire [7:0] stb_state_rst;
151
 
152
   wire [7:0] stb_state_vld;
153
   wire [7:0] stb_state_vld_din;
154
   wire [7:0] stb_state_vld_set;
155
 
156
   wire [7:0] stb_state_ced;
157
   wire [7:0] stb_state_ced_din;
158
   wire [7:0] stb_state_ced_set;
159
 
160
   wire [7:0] stb_state_ack;
161
   wire [7:0] stb_state_ack_din;
162
   wire [7:0] stb_state_ack_set;
163
 
164
   wire [3:2] stb_state_si_0;   // removed 8x4 bits
165
   wire [3:2] stb_state_si_1;
166
   wire [3:2] stb_state_si_2;
167
   wire [3:2] stb_state_si_3;
168
   wire [3:2] stb_state_si_4;
169
   wire [3:2] stb_state_si_5;
170
   wire [3:2] stb_state_si_6;
171
   wire [3:2] stb_state_si_7;
172
/*
173
   wire [3:2] stb_state_si_0_din;
174
   wire [3:2] stb_state_si_1_din;
175
   wire [3:2] stb_state_si_2_din;
176
   wire [3:2] stb_state_si_3_din;
177
   wire [3:2] stb_state_si_4_din;
178
   wire [3:2] stb_state_si_5_din;
179
   wire [3:2] stb_state_si_6_din;
180
   wire [3:2] stb_state_si_7_din;
181
*/
182
   wire [7:0] stb_state_io;
183
   wire [7:0] stb_state_io_din;
184
 
185
   wire [7:0] stb_state_rmo;
186
//   wire [7:0] stb_state_rmo_din;
187
 
188
   wire [2:1] stb_state_rtype_0; // rm 8x1 bits
189
   wire [2:1] stb_state_rtype_1;
190
   wire [2:1] stb_state_rtype_2;
191
   wire [2:1] stb_state_rtype_3;
192
   wire [2:1] stb_state_rtype_4;
193
   wire [2:1] stb_state_rtype_5;
194
   wire [2:1] stb_state_rtype_6;
195
   wire [2:1] stb_state_rtype_7;
196
/*
197
   wire [2:1] stb_state_rtype_0_din;
198
   wire [2:1] stb_state_rtype_1_din;
199
   wire [2:1] stb_state_rtype_2_din;
200
   wire [2:1] stb_state_rtype_3_din;
201
   wire [2:1] stb_state_rtype_4_din;
202
   wire [2:1] stb_state_rtype_5_din;
203
   wire [2:1] stb_state_rtype_6_din;
204
   wire [2:1] stb_state_rtype_7_din;
205
*/
206
   wire [2:0] stb_l2bnk_addr;
207
   wire [2:1] stb_atm_rq_type;
208
 
209
/*AUTOWIRE*/
210
// Beginning of automatic wires (for undeclared instantiated-module outputs)
211
// End of automatics
212
wire    [3:0]    stb_wptr_prev ;
213
wire            stb_rptr_dfq_en ;
214
wire            update_stb_wptr ;
215
//wire  [1:0]   st_enc_set_way ;
216
wire    [3:0]    stb_rptr_dfq_new, stb_rptr_dfq ;
217
wire    valid_entry_for_pcx ;
218
wire    [7:0]    dec_wptr_g, dec_rptr_dfq, dec_rptr_pcx, dec_ackptr ;
219
wire    [7:0]    dec_wptr_m ;
220
//wire          stb_wvld_g ;
221
//wire  [5:0]   stb_inv_set0,stb_inv_set1;
222
//wire  [5:0]   stb_inv_set2,stb_inv_set3;
223
 
224
wire            ack_vld ;
225
wire    [3:0]    stb_wptr_new, stb_wptr ;
226
wire            stb_cam_wvld_g ;
227
wire    [7:0]    inflight_vld_g ;
228
wire            dq_vld_d1,dq_vld_d2 ;
229
wire    [7:0]    dqptr_d1,dqptr_d2;
230
wire            pcx_rq_for_stb_d1 ;
231
wire            pcx_rq_for_stb_d2,pcx_req_squash_d2 ;
232
 
233
   wire       clk;
234
   assign     clk = rclk;
235
 
236
   wire       rst_l;
237
   wire       stb_ctl_rst_l;
238
 
239
   dffrl_async rstff(.din (grst_l),
240
                     .q   (stb_ctl_rst_l),
241 113 albert.wat
                     .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so(),
242 95 fafa1971
                     .rst_l (arst_l));
243
   assign     rst_l = stb_ctl_rst_l;
244
 
245
//=========================================================================================
246
//      RESET
247
//=========================================================================================
248
 
249
// A flush will reset the vld bit in the stb - it should be the only one as
250
// the stb has drained.
251
 
252
   wire   reset;
253
   //waiting int 3.0
254
   //assign rst_l = stb_ctl_rst_l;
255
 
256
   assign reset = ~rst_l | flshinst_rst ;
257
 
258
//=========================================================================================
259
//      STB READ FOR PCX
260
//=========================================================================================
261
 
262
// Assumes that an entry can be sent to the pcx iff the next oldest
263
// entry has received its ack. This pointer will not look for L2Bank
264
// overlap as the ptr calculation is much more complicated.
265
 
266
// (1)--> Entry must be valid and not already sent to pcx.
267
//              Includes squashing of speculative req
268
// (2)--> Previous in linked list must be valid and acked (or invalid)
269
// (3)--> This is to break the deadlock between oldest and youngest
270
// entries when queue is full. Oldest entry can always exit to pcx.
271
 
272
// This vector is one-hot. Assumption is that stb is a circular queue.
273
// deadlock has to be broken between oldest and youngest entry when the
274
// queue is full. The dfq ptr is used to mark oldest
275
 
276 113 albert.wat
dff_s #(2)  rq_stgd1       (
277 95 fafa1971
        .din    ({pcx_rq_for_stb_d1,pcx_req_squash}),
278
        .q      ({pcx_rq_for_stb_d2,pcx_req_squash_d2}),
279
        .clk    (clk),
280 113 albert.wat
        .se     (se), `SIMPLY_RISC_SCANIN, .so ()
281 95 fafa1971
        );
282
 
283
wire    ffu_bst_wr_g ;
284 113 albert.wat
dff_s #(1)  ff_bstg       (
285 95 fafa1971
        .din    (lsu_blk_st_m),
286
        .q      (ffu_bst_wr_g),
287
        .clk    (clk),
288 113 albert.wat
        .se     (se), `SIMPLY_RISC_SCANIN, .so ()
289 95 fafa1971
        );
290
 
291
wire    full_flush_st_g ;
292
// flush_pipe does not apply to blk st wr.
293
assign  full_flush_st_g = (stb_flush_st_g | (lsu_stbctl_flush_pipe_w & ~ffu_bst_wr_g)) & stb_cam_wvld_g ;
294
 
295
// timing fix: 5/6 -  begin
296
// qual dec_rptr_pcx w/ tlb camhit and in qctl1 move kill qual after store pick
297
wire      tlb_cam_hit_g, tlb_hit_g;
298
wire      dtlb_bypass_m, dtlb_bypass_g ;
299
 
300 113 albert.wat
dff_s #(1)  ff_dtlb_bypass_m       (
301 95 fafa1971
        .din    (lsu_dtlb_bypass_e),
302
        .q      (dtlb_bypass_m),
303
        .clk    (clk),
304 113 albert.wat
        .se     (se), `SIMPLY_RISC_SCANIN, .so ()
305 95 fafa1971
        );
306
 
307 113 albert.wat
dff_s #(1)  ff_dtlb_bypass_g       (
308 95 fafa1971
        .din    (dtlb_bypass_m),
309
        .q      (dtlb_bypass_g),
310
        .clk    (clk),
311 113 albert.wat
        .se     (se), `SIMPLY_RISC_SCANIN, .so ()
312 95 fafa1971
        );
313
 
314 113 albert.wat
dff_s #(1)  ff_tlb_cam_hit_g       (
315 95 fafa1971
        .din    (tlb_cam_hit),
316
        .q      (tlb_cam_hit_g),
317
        .clk    (clk),
318 113 albert.wat
        .se     (se), `SIMPLY_RISC_SCANIN, .so ()
319 95 fafa1971
        );
320
 
321
assign  tlb_hit_g  =  tlb_cam_hit_g | dtlb_bypass_g | ffu_bst_wr_g; //bug6406/eco6610
322
// timing fix: 5/6 -  end
323
 
324
// st rq can now speculate on flush
325
assign  inflight_vld_g[7:0] =
326
        dec_wptr_g[7:0] & {8{stb_cam_wvld_g & thrd_en_g}} ;
327
        // the later term is for an inflight ld which gets squashed. It
328
        // should not effect dec_rptr_pcx. This is related to a timing fix
329
        // where the flush is taken out of inflight_vld_g.
330
//assign        inflight_vld_g[7:0] = dec_wptr_g[7:0] & {8{stb_wvld_g & thrd_en_g}} ;
331
 
332
//timing fix: 5/6/03 - kill inflight vld if tlb_hit_g=0; dec_rptr_pcx will be 0 and hence kill_w2 will be 0
333
// leave inflight_vld_g as is, since it is used to set squash - which eventually reset state_vld
334
wire [7:0] inflight_issue_g_tmp ;
335
 
336
assign  inflight_issue_g_tmp[7:0]  =  inflight_vld_g[7:0] & {8{tlb_hit_g}};
337
 
338
wire [7:0] inflight_issue_g ;
339
assign  inflight_issue_g[7:0] =
340
        inflight_issue_g_tmp[7:0] & {8{~(|(stb_state_vld[7:0] & ~stb_state_ack[7:0]))}};
341
        //inflight_vld_g[7:0] & {8{~(|(stb_state_vld[7:0] & ~stb_state_ack[7:0]))}};  // timing fix : 5/6
342
 
343
 
344
// Modified state ced includes in-flight pcx sel which is not squashed.
345
// Timing : pcx_req_squash delayed. A st that is squashed can then make a request 3-cycles
346
// later.
347
wire    skid_ced, st_vld_rq_d2 ;
348
assign  st_vld_rq_d2 = pcx_rq_for_stb_d2 & ~pcx_req_squash_d2 ;
349
assign  skid_ced = pcx_rq_for_stb_d1 | st_vld_rq_d2 ;
350
// For squashing rawp.
351
assign  stb_state_ced_mod[7:0] =
352
        ((dec_ackptr[7:0] & {8{st_vld_rq_d2}}) | stb_state_ced[7:0]) ;
353
 
354
//RMO st counter satuated
355
 
356
wire  rmo_st_satuated;
357
//dff #(1) rmo_st_satuated_ff  (
358
//    .din (lsu_outstanding_rmo_st_max),
359
//    .q   (rmo_st_satuated),
360
//    .clk    (clk),
361 113 albert.wat
//    .se     (se), `SIMPLY_RISC_SCANIN, .so ()
362 95 fafa1971
//);
363
 
364
   assign rmo_st_satuated  =  lsu_outstanding_rmo_st_max;
365
 
366
wire    [7:0]    stb_state_ced_spec ;
367
assign  stb_state_ced_spec[7:0] =
368
        ((dec_ackptr[7:0] & {8{skid_ced}}) | stb_state_ced[7:0]) |
369
   (stb_state_rmo[7:0] & {8{rmo_st_satuated}});
370
 
371
assign  dec_rptr_pcx[7:0] =
372
                 (inflight_issue_g[7:0] | stb_state_vld[7:0])
373
                 //(inflight_vld_g[7:0] | stb_state_vld[7:0]) 
374
                        & ~stb_state_ced_spec[7:0] &     // -->(1)
375
                (({stb_state_vld[6:0],stb_state_vld[7]} &        // 
376
                  {stb_state_ack[6:0],stb_state_ack[7]}) // 
377
                | ~{stb_state_vld[6:0],stb_state_vld[7]} // -->(2)
378
                | dec_rptr_dfq[7:0]) ;                           // -->(3)
379
 
380
 
381
// There should be only one such entry i.e., the vector is 1-hot.
382
// Incorporate st dtlb parity error. It should not propagate to memory.
383
// Tracing full_flush_st_g, note that the pointers will not be restored
384
// correctly for timing reasons - anyway, this is considered unrecoverable.
385
// Monitor !
386
assign valid_entry_for_pcx = |dec_rptr_pcx[7:0] ;
387
 
388
wire    any_inflight_iss_g,any_inflight_iss_w2 ;
389
assign  any_inflight_iss_g = |inflight_vld_g[7:0] ;
390
wire    pick_inflight_iss_g,pick_inflight_iss_w2 ;
391
assign  pick_inflight_iss_g = |(dec_rptr_pcx[7:0] & inflight_issue_g[7:0]) ;
392
 
393
wire    st_pcx_rq_kill_g ;
394
assign  st_pcx_rq_kill_g = pick_inflight_iss_g & full_flush_st_g ;
395
//assign        st_pcx_rq_kill_g = (|(dec_rptr_pcx[7:0] & inflight_issue_g[7:0])) & full_flush_st_g ;
396
 
397
wire    st_vld_squash_g,st_vld_squash_w2 ;
398
assign  st_vld_squash_g = any_inflight_iss_g & full_flush_st_g ;
399
//assign        st_vld_squash_g = (|inflight_vld_g[7:0]) & full_flush_st_g ;
400
 
401
wire st_pcx_rq_kill_tmp,st_vld_squash_tmp ;
402
wire st_dtlb_perr_w2 ;
403 113 albert.wat
dff_s #(5)  stkill_stgd1       (
404 95 fafa1971
        .din    ({st_pcx_rq_kill_g,st_vld_squash_g,
405
                any_inflight_iss_g,pick_inflight_iss_g,st_dtlb_perr_g}),
406
        .q      ({st_pcx_rq_kill_tmp,st_vld_squash_tmp,
407
                any_inflight_iss_w2,pick_inflight_iss_w2,st_dtlb_perr_w2}),
408
        .clk    (clk),
409 113 albert.wat
        .se     (se), `SIMPLY_RISC_SCANIN, .so ()
410 95 fafa1971
        );
411
 
412
assign  st_pcx_rq_kill_w2 =
413
                st_pcx_rq_kill_tmp |
414
                (pick_inflight_iss_w2 & st_dtlb_perr_w2);
415
 
416
assign  st_vld_squash_w2  =
417
                st_vld_squash_tmp  |
418
                (any_inflight_iss_w2 & st_dtlb_perr_w2);
419
 
420
 
421
// Encode pcx rptr
422
// ** Timing : Could put flop in rwctl. 
423
assign stb_pcx_rptr[0] = dec_rptr_pcx[1] | dec_rptr_pcx[3] | dec_rptr_pcx[5] | dec_rptr_pcx[7] ;
424
assign stb_pcx_rptr[1] = dec_rptr_pcx[2] | dec_rptr_pcx[3] | dec_rptr_pcx[6] | dec_rptr_pcx[7] ;
425
assign stb_pcx_rptr[2] = dec_rptr_pcx[4] | dec_rptr_pcx[5] | dec_rptr_pcx[6] | dec_rptr_pcx[7] ;
426
 
427
// This is used in qctl.
428
// Timing : flopped in qctl before use.
429
assign  stb_rd_for_pcx = valid_entry_for_pcx ;
430
 
431
//=========================================================================================
432
//      STB READ FOR DFQ
433
//=========================================================================================
434
 
435
 
436
// Read Pointer to generate the next available entry for the dfq.
437
// Timing : This should be fine as st_ack_dq_stb is decode out of dfq byp flop.
438
wire    incr_dfq_ptr ;
439
// stb_rmo_st_issue added for rmo st bug - if critical then add flop.
440
 
441
// bug2983: incr_dfq_ptr is set by both st_ack_dq_stb and stb_rmo_st_issue
442
//          in the same cycle. this results in losing a dequeue.
443
//
444
//          fix is to detect rmo store after regular store. issue the rmo
445
//          store and dont reset the rmo store vld until the dequeue of the older
446
//          regular store.
447
 
448
wire    stb_dq_rmo ;
449
 
450
//assign        incr_dfq_ptr = st_ack_dq_stb | stb_rmo_st_issue ; //bug 2983
451
assign  incr_dfq_ptr = st_ack_dq_stb | stb_dq_rmo ;
452
 
453
assign  stb_rptr_dfq_new[3:0]    =       stb_rptr_dfq[3:0]  + {3'b0, incr_dfq_ptr} ;
454
//assign        stb_rptr_dfq_new[3:0]   =       stb_rptr_dfq[3:0]  + {3'b0, st_ack_dq_stb} ;
455
 
456
assign stb_rptr_dfq_en = st_ack_dq_stb | incr_dfq_ptr ;
457
 
458 113 albert.wat
dffre_s #(4)  rptr_d    (
459 95 fafa1971
        .din            (stb_rptr_dfq_new[3:0]),.q       (stb_rptr_dfq[3:0]),
460
        .en             (stb_rptr_dfq_en),      .rst    (reset),
461
        .clk            (clk),
462 113 albert.wat
        .se             (se),   `SIMPLY_RISC_SCANIN, .so        ()
463 95 fafa1971
        );
464
 
465
//assign        stb_dfq_rptr[2:0] = stb_rptr_dfq_new[2:0] ;
466
 
467
// Decode Read Ptr
468
// Generated cycle before actual read.
469
assign  dec_rptr_dfq[0]  = ~stb_rptr_dfq[2] & ~stb_rptr_dfq[1] & ~stb_rptr_dfq[0] ;
470
assign  dec_rptr_dfq[1] = ~stb_rptr_dfq[2] & ~stb_rptr_dfq[1] &  stb_rptr_dfq[0] ;
471
assign  dec_rptr_dfq[2] = ~stb_rptr_dfq[2] &  stb_rptr_dfq[1] & ~stb_rptr_dfq[0] ;
472
assign  dec_rptr_dfq[3] = ~stb_rptr_dfq[2] &  stb_rptr_dfq[1] &  stb_rptr_dfq[0] ;
473
assign  dec_rptr_dfq[4] =  stb_rptr_dfq[2] & ~stb_rptr_dfq[1] & ~stb_rptr_dfq[0] ;
474
assign  dec_rptr_dfq[5] =  stb_rptr_dfq[2] & ~stb_rptr_dfq[1] &  stb_rptr_dfq[0] ;
475
assign  dec_rptr_dfq[6] =  stb_rptr_dfq[2] &  stb_rptr_dfq[1] & ~stb_rptr_dfq[0] ;
476
assign  dec_rptr_dfq[7] =  stb_rptr_dfq[2] &  stb_rptr_dfq[1] &  stb_rptr_dfq[0] ;
477
 
478
// Stge dfq ptr and dq vld by 2-cycles to appropriate invalidation pt
479 113 albert.wat
dff_s #(9)  dq_stgd1       (
480 95 fafa1971
        .din    ({dec_rptr_dfq[7:0],st_ack_dq_stb}),
481
        .q      ({dqptr_d1[7:0],dq_vld_d1}),
482
        .clk    (clk),
483 113 albert.wat
        .se     (se), `SIMPLY_RISC_SCANIN, .so ()
484 95 fafa1971
        );
485
 
486 113 albert.wat
dff_s #(9)  dq_stgd2       (
487 95 fafa1971
        .din    ({dqptr_d1[7:0],dq_vld_d1}),
488
        .q      ({dqptr_d2[7:0],dq_vld_d2}),
489
        .clk    (clk),
490 113 albert.wat
        .se     (se), `SIMPLY_RISC_SCANIN, .so ()
491 95 fafa1971
        );
492
 
493
//=========================================================================================
494
//      WPTR FOR STB
495
//=========================================================================================
496
 
497
// It is assumed that if there is a store in the pipe, there is a
498
// free entry in the corresponding stb. Otherwise, the pipe would've
499
// have stalled for the thread. This is maintained locally instead of in
500
// stb rw ctl.
501
 
502
// 00(flush,wr) - no update,01 - +1,10 - d1,11 - no update 
503
// cam or data wr ptr would do. 
504
//assign  update_stb_wptr         =       stb_cam_wvld_m |  stb_flush_st_g ;
505
assign  update_stb_wptr         =       stb_cam_wvld_m ^  (full_flush_st_g | st_dtlb_perr_g);
506
 
507
assign  stb_wptr_new[3:0]       =       (full_flush_st_g | st_dtlb_perr_g) ?
508
                                                        stb_wptr_prev[3:0] :
509
                                                        stb_wptr[3:0] + {3'b0, stb_cam_wvld_m} ;
510
 
511 113 albert.wat
dff_s  wvld_stgg       (
512 95 fafa1971
        .din    (stb_cam_wvld_m), .q      (stb_cam_wvld_g),
513
        .clk    (clk),
514 113 albert.wat
        .se     (se), `SIMPLY_RISC_SCANIN, .so ()
515 95 fafa1971
        );
516
 
517
 
518
//assign        stb_wvld_g = stb_cam_wvld_g & ~full_flush_st_g ;
519
 
520 113 albert.wat
dffre_s #(4)  wptr_new    (
521 95 fafa1971
        .din            (stb_wptr_new[3:0]),    .q      (stb_wptr[3:0]),
522
        .en             (update_stb_wptr),    .rst    (reset),
523
        .clk            (clk),
524 113 albert.wat
        .se             (se), `SIMPLY_RISC_SCANIN, .so ()
525 95 fafa1971
        );
526
 
527
assign  stb_wrptr[2:0]   = stb_wptr[2:0] ;
528
 
529
wire [2:0] stb_wptr_m ;
530
// flush should not be required. If the previous st is flushed then
531
// the current st should be invalid.
532
assign  stb_wptr_m[2:0]       =      stb_wptr[2:0] ;
533
/*assign  stb_wptr_m[3:0]       =       (full_flush_st_g) ?
534
                                                        stb_wptr_prev[3:0] :
535
                                                        stb_wptr[3:0] ;*/
536
 
537
// Decode wptr
538
assign  dec_wptr_m[0] = ~stb_wptr_m[2] & ~stb_wptr_m[1] & ~stb_wptr_m[0] ;
539
assign  dec_wptr_m[1] = ~stb_wptr_m[2] & ~stb_wptr_m[1] &  stb_wptr_m[0] ;
540
assign  dec_wptr_m[2] = ~stb_wptr_m[2] &  stb_wptr_m[1] & ~stb_wptr_m[0] ;
541
assign  dec_wptr_m[3] = ~stb_wptr_m[2] &  stb_wptr_m[1] &  stb_wptr_m[0] ;
542
assign  dec_wptr_m[4] =  stb_wptr_m[2] & ~stb_wptr_m[1] & ~stb_wptr_m[0] ;
543
assign  dec_wptr_m[5] =  stb_wptr_m[2] & ~stb_wptr_m[1] &  stb_wptr_m[0] ;
544
assign  dec_wptr_m[6] =  stb_wptr_m[2] &  stb_wptr_m[1] & ~stb_wptr_m[0] ;
545
assign  dec_wptr_m[7] =  stb_wptr_m[2] &  stb_wptr_m[1] &  stb_wptr_m[0] ;
546
 
547 113 albert.wat
dff_s #(8)  dwptr_stgg       (
548 95 fafa1971
        .din    (dec_wptr_m[7:0]), .q      (dec_wptr_g[7:0]),
549
        .clk    (clk),
550 113 albert.wat
        .se     (se), `SIMPLY_RISC_SCANIN, .so ()
551 95 fafa1971
        );
552
 
553
// stb_wptr_prev represents the latest valid entry in stb
554
/*dffre #(4)  wptr_prev   (
555
        .din            (stb_wptr[3:0]),        .q      (stb_wptr_prev[3:0]),
556
        .en             (update_stb_wptr),      .rst    (reset),
557
        .clk            (clk),
558 113 albert.wat
        .se             (se), `SIMPLY_RISC_SCANIN, .so ()
559 95 fafa1971
        );*/
560
 
561
assign  stb_wptr_prev[3:0] = stb_wptr[3:0] - {4'b0001} ;
562
 
563
// Bug 2419 - In case this is a critical path, a flop can be inserted.
564
assign  stb_wrptr_prev[2:0]      = stb_wptr_prev[2:0] ;
565
 
566
//=========================================================================================
567
//      # OF STORES IN STB
568
//=========================================================================================
569
 
570
wire    [3:0]    stb_wptr_w2 ;
571
 
572
// Count should not include stores in pipe-stages 'g' or before.
573 113 albert.wat
dff_s #(4)  wptr_stgw2       (
574 95 fafa1971
        .din    (stb_wptr[3:0]), .q      (stb_wptr_w2[3:0]),
575
        .clk    (clk),
576 113 albert.wat
        .se     (se), `SIMPLY_RISC_SCANIN, .so ()
577 95 fafa1971
        );
578
 
579
assign  lsu_stbcnt[3:0] =  (stb_wptr_w2[3:0] - stb_rptr_dfq[3:0]) ;
580
 
581
// Performance Cntr Info
582
wire    stb_full_w2 ;
583
assign  stb_full_w2 = lsu_stbcnt[2] & lsu_stbcnt[1] & lsu_stbcnt[0] ;
584 113 albert.wat
dff_s   sfull (
585 95 fafa1971
        .din    (stb_full_w2), .q      (stb_full),
586
        .clk    (clk),
587 113 albert.wat
        .se     (se), `SIMPLY_RISC_SCANIN, .so ()
588 95 fafa1971
        );
589
 
590
//=========================================================================================
591
//      CONTROL STATE
592
//=========================================================================================
593
 
594
// (V)  -       Valid State. Initialized by write and cleared once entry
595
//              has written DFQ and then written the cache. If the store
596
//              will only bypass then it still needs to enter DFQ but 
597
//              can be deallocated immediately on entry into DFQ. (1b)
598
// (A)  -       (NA) Allocate. Determined on read of cache. May be modified by
599
//              invalidate or st mv'ing to DFQ. The load woust have to
600
//              have same set index and same replacement way to clear A bit. (1b)
601
// (SI) -       cache set index for invalidate/load cam'ing. (6b)
602
// (WY) -       (NA) Allocate way for store. (2b)
603
// (CED) -      Committed to SKB. Entry written to SKB. (1b)
604
// (ACK) -      Ack for store received from L2. (1b)
605
// (UPD) -      (NA) Entry mv'ed to DFQ. (1b)
606
// (W)   -      (NA) Wrap bit. (1b) <--- Not used
607
// * All state needs to be reset when entry is freed.
608
//
609
// Total - 14b.
610
 
611
// ack_id is internally tracked. 
612
// There can only be one outstanding
613 113 albert.wat
dffre_s #(8)  ackptr_ff (
614 95 fafa1971
        .din            (dec_rptr_pcx[7:0]), .q  (dec_ackptr[7:0]),
615
        .en             (pcx_rq_for_stb), .rst (reset),
616
        .clk            (clk),
617 113 albert.wat
        .se             (se),   `SIMPLY_RISC_SCANIN, .so        ()
618 95 fafa1971
        );
619
 
620
 
621
assign  ack_vld = cpx_st_ack_tid ;
622
//assign        st_dc_hit_g = lsu_st_hit_g ;
623
 
624
assign  stb_crnt_ack_id[0] = dec_ackptr[1] | dec_ackptr[3] |
625
                                dec_ackptr[5] | dec_ackptr[7] ;
626
assign  stb_crnt_ack_id[1] = dec_ackptr[2] | dec_ackptr[3] |
627
                                dec_ackptr[6] | dec_ackptr[7] ;
628
assign  stb_crnt_ack_id[2] = dec_ackptr[4] | dec_ackptr[5] |
629
                                dec_ackptr[6] | dec_ackptr[7] ;
630
 
631
// Decode valid dequeue ids arriving from dfq.
632
 
633
// pa[39:36] 
634
// 0x00-0x7f  dram
635
// 0xa0-0xbf  l2csr
636
// others as non l2 accsess = b39 & ~(~b38 & b37)   
637
// timing fix: stb_non_l2bnk is delayed 1 cycle - gen in w/g cycle
638
//assign        stb_non_l2bnk = stb_alt_sel ?
639
//      stb_alt_addr[2] & ~(~stb_alt_addr[1] & stb_alt_addr[0]) :
640
//      tlb_pgnum_m[39]  & ~(~tlb_pgnum_m[38]  & tlb_pgnum_m[37])  & ~flsh_inst_m;
641
 
642
wire   [2:0]  stb_alt_addr_g;
643
wire          stb_alt_sel_g;
644
 
645 113 albert.wat
dff_s #(4) ff_alt_addr_g       (
646 95 fafa1971
        .din    ({stb_alt_sel,stb_alt_addr[2:0]}),
647
        .q      ({stb_alt_sel_g,stb_alt_addr_g[2:0]}),
648
        .clk    (clk),
649 113 albert.wat
        .se     (se), `SIMPLY_RISC_SCANIN, .so ()
650 95 fafa1971
        );
651
 
652
wire  flsh_inst_g;
653 113 albert.wat
dff_s #(1) ff_flsh_inst_g       (
654 95 fafa1971
        .din    (flsh_inst_m),
655
        .q      (flsh_inst_g),
656
        .clk    (clk),
657 113 albert.wat
        .se     (se), `SIMPLY_RISC_SCANIN, .so ()
658 95 fafa1971
        );
659
 
660
wire   stb_alt_io_g , tlb_pgnum_io_g ;
661
 
662
assign  stb_alt_io_g  =
663
        stb_alt_addr_g[2] & ~(~stb_alt_addr_g[1] & stb_alt_addr_g[0]);
664
assign  tlb_pgnum_io_g  =
665
        tlb_pgnum_g[39]  & ~(~tlb_pgnum_g[38]  & tlb_pgnum_g[37])  & ~flsh_inst_g;
666
 
667
// used as input to state_io in stb_ctldp
668
wire   stb_non_l2bnk_g;
669
assign  stb_non_l2bnk_g  =
670
        stb_alt_sel_g ? stb_alt_io_g :
671
                        tlb_pgnum_io_g ;
672
 
673
// used as output to qctl1 - this has to be qual'ed w/dec_rptr_pcx so no x's propagate
674
//alt_sel_g  state_vld  comment
675
// 0         0          select tlb_pgnum_io_g(bypass)
676
// 0         1          select stb_state_io
677
// 1         0          select stb_alt_io_g
678
// 1         1          select stb_alt_io_g
679
 
680
wire  [7:0]  stb_l2bnk_addr_b2;
681
 
682
//  inflight (stb_alt / tlb)
683
//  stb
684
//  bug3875       
685
assign  stb_l2bnk_addr_b2[0]  =
686
     stb_state_vld[0] ? stb_state_io[0] :
687
        stb_alt_sel_g ? stb_alt_io_g :
688
                        tlb_pgnum_io_g ;
689
 
690
assign  stb_l2bnk_addr_b2[1]  =
691
     stb_state_vld[1] ? stb_state_io[1] :
692
        stb_alt_sel_g ? stb_alt_io_g :
693
                        tlb_pgnum_io_g ;
694
 
695
assign  stb_l2bnk_addr_b2[2]  =
696
     stb_state_vld[2] ? stb_state_io[2] :
697
        stb_alt_sel_g ? stb_alt_io_g :
698
                        tlb_pgnum_io_g ;
699
 
700
assign  stb_l2bnk_addr_b2[3]  =
701
     stb_state_vld[3] ? stb_state_io[3] :
702
        stb_alt_sel_g ? stb_alt_io_g :
703
                        tlb_pgnum_io_g ;
704
 
705
assign  stb_l2bnk_addr_b2[4]  =
706
     stb_state_vld[4] ? stb_state_io[4] :
707
        stb_alt_sel_g ? stb_alt_io_g :
708
                        tlb_pgnum_io_g ;
709
 
710
assign  stb_l2bnk_addr_b2[5]  =
711
     stb_state_vld[5] ? stb_state_io[5] :
712
        stb_alt_sel_g ? stb_alt_io_g :
713
                        tlb_pgnum_io_g ;
714
 
715
assign  stb_l2bnk_addr_b2[6]  =
716
     stb_state_vld[6] ? stb_state_io[6] :
717
        stb_alt_sel_g ? stb_alt_io_g :
718
                        tlb_pgnum_io_g ;
719
 
720
assign  stb_l2bnk_addr_b2[7]  =
721
     stb_state_vld[7] ? stb_state_io[7] :
722
        stb_alt_sel_g ? stb_alt_io_g :
723
                        tlb_pgnum_io_g ;
724
 
725
 
726 113 albert.wat
dff_s  rqsel_stgg       (
727 95 fafa1971
        .din    (pcx_rq_for_stb), .q      (pcx_rq_for_stb_d1),
728
        .clk    (clk),
729 113 albert.wat
        .se     (se), `SIMPLY_RISC_SCANIN, .so ()
730 95 fafa1971
        );
731
 
732
// Use of tlb_pgnum_m will be critical !!! 
733
 
734
//always @( posedge clk)
735
//      begin
736
//      for (i=0;i<8;i=i+1)     
737
//              begin
738
//                      if (reset                                                 // reset
739
//                                | (dqptr_d2[i] & dq_vld_d2)                     // dequeue from stb
740
//                                | (dec_ackptr[i] & pcx_rq_for_stb_d1 & 
741
//                                              ~pcx_req_squash & stb_state_rmo[i])) 
742
//                              // write will be visible in cache.
743
//                              begin
744
//                                      stb_state_vld[i] <= 1'b0 ;
745
//                                      stb_state_ced[i] <= 1'b0 ;
746
//                                      stb_state_ack[i] <= 1'b0 ;
747
//                              end
748
//                      if (dec_wptr_g[i] & stb_wvld_g & thrd_en_g )
749
//                              begin
750
//                                      stb_state_vld[i] <= 1'b1 ;
751
//                                      stb_state_wy[i] <=  st_enc_set_way[1:0];
752
//                              end
753
//                      if (dec_wptr_m[i] & stb_cam_wvld_m)     // spec. write
754
//                              begin
755
//                                      stb_state_si[i] <=  lsu_ldst_va_m[9:4] ;
756
//                                      stb_state_rtype[i] <= lsu_st_rq_type_m[2:0] ;
757
//                                      stb_state_io[i] <=  non_l2bnk ;
758
//                                      stb_state_rmo[i] <= lsu_st_rmo_m ;
759
//                              end
760
//                      // atomic will not write to cache even if it hits.
761
//                      // rd_for_pcx needs to be gated for a cycle.
762
//                      // This is delayed by a cycle to take into account
763
//                      // squashing of speculative requests.
764
//                      // rmo's will dequeue entry immediately.
765
//                      if (dec_ackptr[i] & pcx_rq_for_stb_d1 & ~pcx_req_squash & ~stb_state_rmo[i]) 
766
//                              stb_state_ced[i] = 1'b1 ;
767
//                      if (dec_ackptr[i] & ack_vld)
768
//                              stb_state_ack[i] = 1'b1 ;
769
 
770
//              end
771
//      end
772
 
773
// UNIFY : mux select destination address of pcx pkt
774
 
775
// always->dff translation begin
776
 
777
   // =================================
778
   // rst  set  din
779
   // 0    0    q
780
   // 1    0    0 (reset)
781
   // x    1    1 (set)
782
   // ==================================
783
   // din = set | (~r & q)
784
 
785
   //vld 
786
   wire [7:0]    stb_issue_rmo ;
787
   wire [7:0]    flush_vld_w2 ;
788
   // Timing 
789
   assign       stb_issue_rmo[7:0] =
790
        (dec_ackptr[7:0] & {8{st_vld_rq_d2}} & stb_state_rmo[7:0]) ;
791
        // (dec_ackptr[7:0] & {8{pcx_rq_for_stb_d1}} & 
792
        //      {8{~pcx_req_squash}} & stb_state_rmo[7:0]) ;
793
   assign       stb_rmo_st_issue = |stb_issue_rmo[7:0] ;
794
 
795
   //bug2983 - begin
796
   wire        rmo_pend,rmo_pend_d1;
797
   wire [7:0]  rmo_pend_ackptr , stb_dq_rmo_dfq_ptr;
798
   // this will set 1 cycle after pcx_rq_for_stb and before the corresponding ced is set(which is 2 cycles
799
   // after pcx_rq_for_stb
800
   //bug3249: dec_rptr_dfq catches up w/ dec_ackptr; i.e. dec_ackptr entry is the oldset. rmo_pend should not
801
   //         be set in this case based on previuos entry (since it will be the youngest)
802
   //         fix - kill pend if issue and dq ptr are same (~{8{|(dec_ackptr[7:0] & dec_rptr_dfq[7:0])}})
803
   assign rmo_pend_ackptr[7:0]  =
804
          // is the current req RMO store
805
          //(dec_ackptr[7:0] & stb_state_rmo[7:0]) &  //bug3249
806
          //(dec_ackptr[7:0] & stb_state_rmo[7:0] & ~dec_rptr_dfq[7:0]) &    //bug7100 new fix, bug7117
807
          (dec_ackptr[7:0] & stb_state_rmo[7:0] & ~dqptr_d2[7:0]) &
808
          // is the older store a regular store
809
          ({stb_state_vld[6:0],stb_state_vld[7]} & ~{stb_state_rmo[6:0],stb_state_rmo[7]});
810
 
811
   assign rmo_pend = |rmo_pend_ackptr[7:0];
812
 
813
   wire   rmo_pend_rst;
814
   assign rmo_pend_rst  =  reset | stb_dq_rmo;
815
 
816 113 albert.wat
   dffre_s #(1)  ff_rmo_pend      (
817 95 fafa1971
         .din  (rmo_pend),
818
         .q    (rmo_pend_d1),
819
         .en   (st_vld_rq_d2),
820
         .rst  (rmo_pend_rst),
821
         .clk  (clk),
822 113 albert.wat
         .se   (se), `SIMPLY_RISC_SCANIN, .so ()
823 95 fafa1971
         );
824
 
825
   // ok to use either dec_ackptr[7:0] OR dec_rptr_dfq[7:0] 'cos the stores younger to 1st RMO store
826
   // are not issued ('cos vld of RMO store is not reset). Hence ackptr and rptr_dfq will be the same
827
   // when rmo_pend=0.
828
   //
829
   // has to qual'ed w/ st_vld_rq_d2. otherwise can result in vld reset before ced is set. the next
830
   // time the entry is used it will have ced=1 and not issue.
831
   //
832
   // cannot use rmo_pend_ackptr[7:0] instead of dec_ackptr[7:0] 'cos the former will be reset when
833
   // rmo_pend=0 and will not dequeue the rmo stb entry. i.e if rmo_pend=1 when st_vld_rq_d2=1, use
834
   // dec_ackptr[7:0]
835
 
836
   //------------------------------------------------------------------------------------------------
837
   // Case 1: NO older regular store vld dequeue pending
838
   //------------------------------------------------------------------------------------------------
839
   // |        1           |    2    |    3    |    4     |     5    |          |          |
840
   // stb_state_vld=8'h1------------------------------------->8'h0
841
   // stb_state_rmo=8'h1
842
   //
843
   // pcx_rq_for_stb=1-------->0                     
844
   //
845
   // dec_ackptr=8'h0--------->8'h1
846
   //
847
   // st_vld_rq_d2=0--------------------->1           0
848
   // stb_issue_rmo=8'h0-------------->8'h1        8'h0
849
   // stb_dq_rmo_dfq_ptr=8'h0--------->8'h1       8'h0
850
   //
851
   // rmo_pend=0
852
   // rmo_pend_d1=0
853
   //
854
   // dq_vld_d2=0
855
   // dqptr_d2=8'h0
856
   //------------------------------------------------------------------------------------------------
857
   // Case 2: older regular store vld dequeue pending(entry0-older reg store; entry1-rmo younger store)
858
   //------------------------------------------------------------------------------------------------
859
   // |        1              |    2     |   3    |    4    |    5    |    6    |          | 
860
   // stb_state_vld=8'h3-------------------------------------->8'h2      8'h0
861
   // stb_state_rmo=8'h2
862
   // stb_state_ack=8'h1-------------------------------------->8'h0
863
   //
864
   // pcx_rq_for_stb=1-------------->0                     
865
   //
866
   // dec_ackptr=8'h1------------>8'h2
867
   //
868
   // st_vld_rq_d2=0-------------------------->1        0
869
   // stb_issue_rmo=8'h0------------------->8'h1     8'h0
870
   // stb_dq_rmo_dfq_ptr=8'h0--------------------------------->8'h2      8'h0 (dequeue rmo store)
871
   //
872
   // rmo_pend=0-------------------->1                           0
873
   // rmo_pend_d1=0--------------------------->1                            0
874
   //
875
   // dq_vld_d2=0-------------------------------------->1        0
876
   // dqptr_d2=8'h0--------------------------------->8'h1     8'h0 (dequeue regular store)
877
   //------------------------------------------------------------------------------------------------
878
 
879
   assign stb_dq_rmo_dfq_ptr[7:0] =
880
          (stb_issue_rmo[7:0]   & ~rmo_pend_ackptr[7:0]) |         // if rmo_pend=0 when st_vld_rq_d2=1
881
          (dec_ackptr[7:0]      & {8{rmo_pend_d1 & ~rmo_pend}});   // if rmo_pend=1 when st_vld_rq_d2=1
882
 
883
   assign stb_dq_rmo  =  |stb_dq_rmo_dfq_ptr[7:0];
884
   //bug2983 - end
885
 
886
   assign stb_state_rst[7:0] =
887
        {8{reset}} | (dqptr_d2[7:0] & {8{dq_vld_d2}})
888
        // reset vld,ced,ack immed. on issue to pcx for rmo store.
889
        | stb_dq_rmo_dfq_ptr[7:0] |  // fix for bug2983
890
        // | stb_issue_rmo[7:0] |  // bug2983
891
        flush_vld_w2[7:0] ;      // because of trap
892
 
893
   // vld is now speculatively written
894
   assign stb_state_vld_set[7:0] = dec_wptr_g[7:0] & {8{stb_cam_wvld_g & thrd_en_g}} ;
895
   //assign stb_state_vld_set[7:0] = dec_wptr_g[7:0] & {8{stb_wvld_g & thrd_en_g}} ;
896
   assign stb_state_vld_din[7:0] = stb_state_vld_set[7:0] |
897
                                  (~stb_state_rst[7:0] & stb_state_vld[7:0]);
898
 
899
   wire [7:0] stb_state_vld_tmp ;
900 113 albert.wat
   dff_s #(8)  ff_stb_state_vld       (
901 95 fafa1971
        .din    (stb_state_vld_din[7:0]),
902
        .q      (stb_state_vld_tmp[7:0]    ),
903
        .clk    (clk),
904 113 albert.wat
        .se     (se), `SIMPLY_RISC_SCANIN, .so ()
905 95 fafa1971
        );
906
 
907
   assign stb_state_vld[7:0] = stb_state_vld_tmp[7:0] & ~flush_vld_w2[7:0] ;
908
 
909
   wire [7:0] stb_state_vld_set_w2 ;
910 113 albert.wat
   dff_s #(8)  ff_stb_state_vld_set       (
911 95 fafa1971
        .din    (stb_state_vld_set[7:0]),
912
        .q      (stb_state_vld_set_w2[7:0]    ),
913
        .clk    (clk),
914 113 albert.wat
        .se     (se), `SIMPLY_RISC_SCANIN, .so ()
915 95 fafa1971
        );
916
 
917
   assign flush_vld_w2[7:0] = stb_state_vld_set_w2[7:0] & {8{st_vld_squash_w2}} ;
918
 
919
   // The stb valids for the scm need not include the intermediate flush condition
920
   // (flush_vld_w2). It is assumed that the flush of the store will invalidate 
921
   // a subsequent ld. (8 extra flops).
922
   // Bug 3201 - rmo st are made invisible to loads.
923
 
924
   wire [7:0]  st_scm_vld ;
925
   assign st_scm_vld[7:0] = stb_state_vld_din[7:0] & ~stb_state_rmo[7:0] ;
926
 
927 113 albert.wat
   dff_s #(8)  ff_st_scm_vld       (
928 95 fafa1971
        .din    (st_scm_vld[7:0]),
929
        .q      (stb_state_vld_out[7:0]    ),
930
        .clk    (clk),
931 113 albert.wat
        .se     (se), `SIMPLY_RISC_SCANIN, .so ()
932 95 fafa1971
        );
933
 
934
   //ced
935
   assign stb_state_ced_set[7:0] = dec_ackptr[7:0] & {8{st_vld_rq_d2}} ;
936
   // Timing fix.
937
   //assign stb_state_ced_set[7:0] = dec_ackptr[7:0] & {8{pcx_rq_for_stb_d1 & ~pcx_req_squash}};
938
   // make reset dominant - specifically for coincident set and reset by rmo st.
939
   assign stb_state_ced_din[7:0] = ~stb_state_rst[7:0] &
940
                                        (stb_state_ced_set[7:0] | stb_state_ced[7:0]);
941
   //assign stb_state_ced_din[7:0] = stb_state_ced_set[7:0] | 
942
   //                               (~stb_state_rst[7:0] & stb_state_ced[7:0]);
943
 
944 113 albert.wat
   dff_s #(8)  ff_stb_state_ced       (
945 95 fafa1971
        .din    (stb_state_ced_din[7:0]),
946
        .q      (stb_state_ced[7:0]    ),
947
        .clk    (clk),
948 113 albert.wat
        .se     (se), `SIMPLY_RISC_SCANIN, .so ()
949 95 fafa1971
        );
950
 
951
   //ack
952
   assign stb_state_ack_set[7:0] = dec_ackptr[7:0] & {8{ack_vld}};
953
   assign stb_state_ack_din[7:0] = stb_state_ack_set[7:0] |
954
                                  (~stb_state_rst[7:0] & stb_state_ack[7:0]);
955
 
956 113 albert.wat
   dff_s #(8)  ff_stb_state_ack       (
957 95 fafa1971
        .din    (stb_state_ack_din[7:0]),
958
        .q      (stb_state_ack[7:0]    ),
959
        .clk    (clk),
960 113 albert.wat
        .se     (se), `SIMPLY_RISC_SCANIN, .so ()
961 95 fafa1971
        );
962
 
963
   //spec. write
964
   wire [7:0] spec_wrt;
965
   assign     spec_wrt [7:0] = dec_wptr_m[7:0] & {8{stb_cam_wvld_m}};
966
   assign     stb_clk_en_l [7:0] = ~spec_wrt[7:0];
967
 
968
  //spec write Ffs move to lsu_stb_ctldp to save area      
969
 
970
 
971
  // moved state_io logic from ctldp 
972
 
973
  assign stb_state_io_din[7:0]  =  (stb_state_vld_set[7:0] & {8{stb_non_l2bnk_g}}) |
974
                                   (~stb_state_rst[7:0] & stb_state_io[7:0]);
975
 
976 113 albert.wat
   dff_s #(8)  ff_stb_state_io       (
977 95 fafa1971
        .din    (stb_state_io_din[7:0]),
978
        .q      (stb_state_io[7:0]    ),
979
        .clk    (clk),
980 113 albert.wat
        .se     (se), `SIMPLY_RISC_SCANIN, .so ()
981 95 fafa1971
        );
982
 
983
// always->dff translation end    
984
// streaming unit does not have to care about outstanding rmo sparc-stores.
985
// membar will take care of that. spu must insert appr. delay in sampling signal.
986
assign  lsu_stb_empty = ~(|stb_state_vld[7:0]);
987
 
988
//=========================================================================================
989
//      SELECT L2BANK ADDRESS
990
//=========================================================================================
991
 
992
//reg [5:0] temp ;
993
//reg [2:0] stb_l2bnk_addr ;
994
 
995
//// This is modelling a mux. 
996
//always @(/*AUTOSENSE*/ /*memory or*/ dec_rptr_pcx)
997
//      begin
998
//              for (j=0;j<8;j=j+1)     
999
//                      if (dec_rptr_pcx[j])    // 1-hot
1000
//                              begin
1001
//                              temp[5:0]               = stb_state_si[j] ;
1002
//                              stb_l2bnk_addr[2:0]     = {stb_state_io[j],temp[4:3]} ;
1003
//                              stb_atm_rq_type[2:0]    = stb_state_rtype[j] ;
1004
//                              end
1005
//      end
1006
 
1007
 
1008
//always->and-or translation begin
1009
   assign stb_l2bnk_addr[2:0] = {3{dec_rptr_pcx[0]}} & {stb_l2bnk_addr_b2[0], stb_state_si_0[3:2]} |
1010
                                {3{dec_rptr_pcx[1]}} & {stb_l2bnk_addr_b2[1], stb_state_si_1[3:2]} |
1011
                                {3{dec_rptr_pcx[2]}} & {stb_l2bnk_addr_b2[2], stb_state_si_2[3:2]} |
1012
                                {3{dec_rptr_pcx[3]}} & {stb_l2bnk_addr_b2[3], stb_state_si_3[3:2]} |
1013
                                {3{dec_rptr_pcx[4]}} & {stb_l2bnk_addr_b2[4], stb_state_si_4[3:2]} |
1014
                                {3{dec_rptr_pcx[5]}} & {stb_l2bnk_addr_b2[5], stb_state_si_5[3:2]} |
1015
                                {3{dec_rptr_pcx[6]}} & {stb_l2bnk_addr_b2[6], stb_state_si_6[3:2]} |
1016
                                {3{dec_rptr_pcx[7]}} & {stb_l2bnk_addr_b2[7], stb_state_si_7[3:2]} ;
1017
 
1018
   assign stb_atm_rq_type[2:1]= {2{dec_rptr_pcx[0]}} &  stb_state_rtype_0[2:1] |
1019
                                {2{dec_rptr_pcx[1]}} &  stb_state_rtype_1[2:1] |
1020
                                {2{dec_rptr_pcx[2]}} &  stb_state_rtype_2[2:1] |
1021
                                {2{dec_rptr_pcx[3]}} &  stb_state_rtype_3[2:1] |
1022
                                {2{dec_rptr_pcx[4]}} &  stb_state_rtype_4[2:1] |
1023
                                {2{dec_rptr_pcx[5]}} &  stb_state_rtype_5[2:1] |
1024
                                {2{dec_rptr_pcx[6]}} &  stb_state_rtype_6[2:1] |
1025
                                {2{dec_rptr_pcx[7]}} &  stb_state_rtype_7[2:1] ;
1026
 
1027
//always->and-or translation end
1028
 
1029
 
1030
endmodule
1031
 

powered by: WebSVN 2.1.0

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