source: XOpenSparcT1/trunk/T1-CPU/tlu/tlu_mmu_dp.v @ 6

Revision 6, 53.3 KB checked in by pntsvt00, 13 years ago (diff)

versione iniziale opensparc

Line 
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T1 Processor File: tlu_mmu_dp.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///////////////////////////////////////////////////////////////////////
22/*
23//      Description:    MMU Datapath - I & D.
24*/
25////////////////////////////////////////////////////////////////////////
26// Global header file includes
27////////////////////////////////////////////////////////////////////////
28`include        "sys.h" // system level definition file which contains the
29                                        // time scale definition
30
31////////////////////////////////////////////////////////////////////////
32// Local header file includes / local defines
33////////////////////////////////////////////////////////////////////////
34
35`include "tlu.h"
36
37//FPGA_SYN enables all FPGA related modifications
38`ifdef FPGA_SYN 
39`define FPGA_SYN_CLK_EN
40`define FPGA_SYN_CLK_DFF
41`endif
42
43module tlu_mmu_dp ( /*AUTOARG*/
44   // Outputs
45   tlu_dtsb_split_w2, tlu_dtsb_size_w2, tlu_dtag_access_w2,
46   tlu_itsb_split_w2, tlu_itsb_size_w2,
47   tlu_itlb_tte_tag_w2, tlu_itlb_tte_data_w2, tlu_dtlb_tte_tag_w2, 
48   tlu_dtlb_tte_data_w2, tlu_idtlb_dmp_key_g, tlu_dsfsr_flt_vld, 
49   tlu_isfsr_flt_vld, mra_wdata, tlu_ctxt_cfg_w2, tlu_tag_access_ctxt_g, 
50   lsu_exu_ldxa_data_g, so, tlu_tsb_base_w2_d1,
51   // Inputs
52   tlu_addr_msk_g, dmmu_any_sfsr_wr, dmmu_sfsr_wr_en_l, dmmu_sfar_wr_en_l, 
53   immu_any_sfsr_wr, immu_sfsr_wr_en_l, tlu_lng_ltncy_en_l,
54   lsu_tlu_dside_ctxt_m, lsu_tlu_pctxt_m, tlu_tag_access_ctxt_sel_m, 
55   lsu_tlu_st_rs3_data_b63t59_g, lsu_tlu_st_rs3_data_b47t0_g,
56   exu_lsu_ldst_va_e, tlu_idtsb_8k_ptr,lsu_tlu_tlb_dmp_va_m, ifu_tlu_pc_m, 
57   tlu_slxa_thrd_sel, 
58   tlu_tte_tag_g, tlu_dmp_key_vld_g, tlb_access_rst_l, 
59   tag_access_wdata_sel, mra_rdata, tlu_admp_key_sel, 
60   tlu_isfsr_din_g, tlu_dsfsr_din_g, 
61   tlu_tte_wr_pid_g, tlu_tte_real_g, tlu_ldxa_l1mx1_sel, 
62   tlu_ldxa_l1mx2_sel, tlu_ldxa_l2mx1_sel, rclk, grst_l, arst_l,
63   tlu_tlb_tag_invrt_parity, tlu_tlb_data_invrt_parity, tlu_sun4r_tte_g,
64   tlu_tsb_rd_ps0_sel, si, se, tlu_tlb_access_en_l_d1
65   ) ; 
66
67/*AUTOINPUT*/
68// Beginning of automatic inputs (from unused autoinst inputs)
69// End of automatics
70
71input                   tlu_addr_msk_g ;        // address masking active for thread in pipe.
72input                   dmmu_any_sfsr_wr ; 
73input   [3:0]           dmmu_sfsr_wr_en_l ; 
74input   [3:0]           dmmu_sfar_wr_en_l ; 
75input                   immu_any_sfsr_wr ;
76input   [3:0]           immu_sfsr_wr_en_l ;
77input   [12:0]          lsu_tlu_dside_ctxt_m ;
78input   [12:0]          lsu_tlu_pctxt_m ;
79input   [2:0]           tlu_tag_access_ctxt_sel_m ;     
80// rs3_data split for vlint purposes.
81input   [63:59]         lsu_tlu_st_rs3_data_b63t59_g ;
82input   [47:0]          lsu_tlu_st_rs3_data_b47t0_g ;
83input   [47:0]          exu_lsu_ldst_va_e ;
84input   [47:0]          tlu_idtsb_8k_ptr ;
85input   [47:13]         lsu_tlu_tlb_dmp_va_m ;
86input   [47:13]         ifu_tlu_pc_m ;
87input   [3:0]           tlu_slxa_thrd_sel ;
88//input         [63:0]          int_tlu_asi_data;
89//input                 int_tlu_asi_data_vld;
90input   [2:0]           tlu_tte_tag_g ;
91input   [4:0]           tlu_dmp_key_vld_g ;
92//input                 tlb_access_en_l ;
93input                   tlu_tlb_access_en_l_d1 ;
94input                   tlb_access_rst_l ;
95
96input   [2:0]           tag_access_wdata_sel ;
97input   [155:6]         mra_rdata ;
98
99input                   tlu_admp_key_sel ;
100
101input   [23:0]          tlu_isfsr_din_g ;
102input   [23:0]          tlu_dsfsr_din_g ;
103
104input   [2:0]           tlu_tte_wr_pid_g ;      // thread selected pid
105input                   tlu_tte_real_g ;        // tte is real         
106
107input   [3:0]           tlu_ldxa_l1mx1_sel ;    // mmu ldxa level1 mx1 sel
108input   [3:0]           tlu_ldxa_l1mx2_sel ;    // mmu ldxa level1 mx2 sel
109input   [2:0]           tlu_ldxa_l2mx1_sel ;    // mmu ldxa level2 mx1 sel
110input                   tlu_tlb_tag_invrt_parity ;      // invert parity for tag write
111input                   tlu_tlb_data_invrt_parity ;     // invert parity for data write
112input                   tlu_sun4r_tte_g ;       // sun4r vs. sun4v tte.
113
114input                  tlu_lng_ltncy_en_l ;
115
116input                  tlu_tsb_rd_ps0_sel ;
117
118input                 rclk ;
119input                 arst_l ;
120input                 grst_l ;
121input                 si ;
122input                 se ;
123
124output                        so ;
125
126//output  [47:13]         tlu_dtsb_base_w2 ;    // represents ps0
127output                  tlu_dtsb_split_w2 ;
128output  [3:0]           tlu_dtsb_size_w2 ;
129output  [47:13]         tlu_dtag_access_w2 ;    // used to represent both i/d.
130//output  [47:13]         tlu_itsb_base_w2 ;    // represents ps1
131output                  tlu_itsb_split_w2 ;
132output  [3:0]           tlu_itsb_size_w2 ;
133//output  [32:13]               tlu_itag_access_w2 ;    // to be obsoleted.
134output  [58:0]          tlu_itlb_tte_tag_w2 ;
135output  [42:0]          tlu_itlb_tte_data_w2 ;
136output  [58:0]          tlu_dtlb_tte_tag_w2 ;
137output  [42:0]          tlu_dtlb_tte_data_w2 ;
138//output        [63:0]          tlu_lsu_ldxa_data_w2 ;
139output  [5:0]           tlu_ctxt_cfg_w2 ;       // i/d context zero/non-zero config.
140output  [40:0]          tlu_idtlb_dmp_key_g ;
141
142
143output  [3:0]           tlu_dsfsr_flt_vld ;
144output  [3:0]           tlu_isfsr_flt_vld ;
145
146output  [12:0]          tlu_tag_access_ctxt_g ;
147output  [63:0]          lsu_exu_ldxa_data_g ;
148
149output  [47:13]         tlu_tsb_base_w2_d1 ;
150
151///output       tlu_tag_access_nctxt_g ;                // tag-access contains nucleus context.
152
153output  [155:0]         mra_wdata ;
154
155wire    [47:0]          ldst_va_m,ldst_va_g ;
156// st_rs3_data partitioned for vlint.
157//wire  [63:0]          st_rs3_data_g ;
158wire    [63:59]         st_rs3_data_b63t59_g ;
159wire    [39:8]          st_rs3_data_b39t8_g ;
160wire    [6:1]           st_rs3_data_b6t1_g ;
161wire    [63:0]          tag_target ;
162wire    [47:13]         dtag_access_w2 ;
163wire    [23:0]          dsfsr,isfsr ;
164wire    [23:0]          dsfsr0,isfsr0 ;
165wire    [23:0]          dsfsr1,isfsr1 ;
166wire    [23:0]          dsfsr2,isfsr2 ;
167wire    [23:0]          dsfsr3,isfsr3 ;
168wire    [47:0]          dsfar ;
169wire    [47:0]          dsfar0,dsfar1 ;
170wire    [47:0]          dsfar2,dsfar3 ;
171wire    [23:0]          dsfsr_din ;
172wire    [23:0]          isfsr_din ;
173//wire  [39:22]         tte_relocated_pa ;
174wire    [40:0]          dmp_key ;
175wire    [47:0]          tag_access_w2 ;
176wire    [41:0]          idtte_data_w2 ; 
177wire                    tlb_access0_clk, tlb_access1_clk ;
178wire    [40:0]          idtlb_dmp_key_pend ; 
179wire    [47:0]          tag_access_wdata ;
180wire    [12:0]          tag_access_ctxt_m,tag_access_ctxt_g ;
181// buses split for vlint purposes.
182wire    [58:55]         idtte_tag_b58t55_g ;
183wire    [53:0]          idtte_tag_b53t0_g ;
184wire    [58:55]         idtte_tag_b58t55_w2 ;
185wire    [53:0]          idtte_tag_b53t0_w2 ;
186wire    [41:0]          idtte_data_g ;
187wire    [47:13]         tlb_dmp_va_g ;
188wire    [47:0]  ldxa_l1mx1_dout_e ;
189wire    [47:0]  ldxa_l1mx1_dout_m ;
190
191 //=========================================================================================
192 //    RESET/CLK
193 //=========================================================================================
194 
195    wire       clk;
196    assign     clk = rclk;
197 
198    wire       rst_l;
199   
200    dffrl_async rstff(.din (grst_l),
201                      .q   (rst_l),
202                      .clk (clk), .se(se), .si(), .so(),
203                      .rst_l (arst_l));
204
205
206//=========================================================================================
207//      Staging
208//=========================================================================================
209
210// Stage
211wire [47:13] pc_g ;     
212dff_s  #(35) stg_w (
213        .din    (ifu_tlu_pc_m[47:13]),
214        .q      (pc_g[47:13]),
215        .clk    (clk),
216        .se     (1'b0),       .si (),          .so ()
217        );
218
219//assign        pc_g[47:13] = ifu_tlu_pc_w[47:13] ;
220
221// Stage va
222dff_s  #(48) stg_m (
223        .din    (exu_lsu_ldst_va_e[47:0]),
224        .q      (ldst_va_m[47:0]),
225        .clk    (clk),
226        .se     (1'b0),       .si (),          .so ()
227        );
228
229dff_s  #(48) stg_g (
230        .din    (ldst_va_m[47:0]),
231        .q      (ldst_va_g[47:0]),
232        .clk    (clk),
233        .se     (1'b0),       .si (),          .so ()
234        );
235
236dff_s  #(35) dstg_g (
237        .din    (lsu_tlu_tlb_dmp_va_m[47:13]),
238        .q      (tlb_dmp_va_g[47:13]),
239        .clk    (clk),
240        .se     (1'b0),       .si (),          .so ()
241        );
242
243//=========================================================================================
244
245wire [4:0] tlu_dmp_key_vld_d1 ;
246wire [47:13] tlb_dmp_va_d1 ;
247dff_s  #(40) dstg_d1 (
248        .din    ({tlb_dmp_va_g[47:13],tlu_dmp_key_vld_g[4:0]}),
249        .q      ({tlb_dmp_va_d1[47:13],tlu_dmp_key_vld_d1[4:0]}),
250        .clk    (clk),
251        .se     (1'b0),       .si (),          .so ()
252        );
253
254wire    [2:0]   tlu_tte_tag_d1,tlu_tte_wr_pid_d1 ;
255wire            tlu_tte_real_d1,tlu_tlb_tag_invrt_parity_d1 ;
256wire    [47:13] dmp_va_d1 ;
257wire    [5:0]   dmp_key_vld_d1 ;
258dp_mux2es #(41) dmp_key_sel (
259                .in0    ({tlb_dmp_va_d1[47:13],tlu_dmp_key_vld_d1[4:0],tlu_tte_real_d1}),
260                .in1    ({tag_access_w2[47:13],1'b1,tlu_tte_tag_d1[2:0],tlu_tte_real_d1,tlu_tte_real_d1}),
261                //.in1  ({tag_access_w2[47:13],1'b1,tlu_tte_tag_d1[2:0],1'b0,tlu_tte_real_d1}), // Bug 3754
262                .sel    (tlu_admp_key_sel),
263                .dout   ({dmp_va_d1[47:13],dmp_key_vld_d1[5:0]})
264        );
265
266assign  dmp_key[40:0] =
267        {
268        dmp_va_d1[47:28],        // (20b)
269        dmp_key_vld_d1[5],       // (1b)
270        dmp_va_d1[27:22],        // (6b)
271        dmp_key_vld_d1[4],       // (1b)
272        dmp_va_d1[21:16],        // (6b)
273        dmp_key_vld_d1[3],       // (1b)
274        dmp_va_d1[15:13],        // (3b)
275        dmp_key_vld_d1[2],       // (1b)
276        dmp_key_vld_d1[1],       // (1b)
277        dmp_key_vld_d1[0]        // (1b)
278        } ;
279
280
281//wire  tlb_access_en_l_d1 ;
282wire    tlb_access2_clk ;
283`ifdef FPGA_SYN_CLK_EN
284`else
285`ifdef FPGA_SYN_CLK_EN
286`else
287clken_buf clkbf_dmpky (
288                .rclk   (clk),
289                .enb_l  (tlu_tlb_access_en_l_d1),
290                .tmb_l  (~se),
291                .clk    (tlb_access2_clk)
292                ) ;
293`endif
294`endif
295
296// Advance by a cycle. Do not have to reset state.
297`ifdef FPGA_SYN_CLK_DFF
298dffrle_s  #(41) stg_w2 (
299        .din    (dmp_key[40:0]),
300        .q      (idtlb_dmp_key_pend[40:0]),
301        .rst_l  (tlb_access_rst_l),
302        .en (~(tlu_tlb_access_en_l_d1)), .clk(clk),
303        .se     (1'b0),       .si (),          .so ()
304        );
305`else
306`ifdef FPGA_SYN_CLK_DFF
307dffrle_s  #(41) stg_w2 (
308        .din    (dmp_key[40:0]),
309        .q      (idtlb_dmp_key_pend[40:0]),
310        .rst_l  (tlb_access_rst_l),
311        .en (~(tlu_tlb_access_en_l_d1)), .clk(clk),
312        .se     (1'b0),       .si (),          .so ()
313        );
314`else
315dffrl_s  #(41) stg_w2 (
316        .din    (dmp_key[40:0]),
317        .q      (idtlb_dmp_key_pend[40:0]),
318        .rst_l  (tlb_access_rst_l),
319        .clk    (tlb_access2_clk),
320        .se     (1'b0),       .si (),          .so ()
321        );
322`endif
323`endif
324
325assign  tlu_idtlb_dmp_key_g[40:0] = idtlb_dmp_key_pend[40:0] ;
326
327
328//=========================================================================================
329//      WR DATA FOR MRA
330//=========================================================================================
331
332// Format for each entry of MRA on a per thread basis.
333// Current :
334//      |       dtsb(48b)       |       dtag_access(48b)        |       dsfar(48b)      |       
335//      |       itsb(48b)       |       itag_access(48b)        |                       |       
336// New(Hyp,Legacy) : 8 tsb per thread instead of 2. dsfar removed.
337// -This allows tag-access to be lined up with simultaneous reads of tsb
338// -zero-ctxt and non-zero-ctxt tag-access will have to be distinguished either
339// by doing a zero-detect on the lower 13b of the write-data or using a disinct asi.
340//      |       zcps0_dtsb(48b) |       zcps1_dtsb(48b) |       zctxt_dtag_acc(48b) | dzctxt_cfg(6b) |
341//      |       zcps0_itsb(48b) |       zcps1_itsb(48b) |       zctxt_itag_acc(48b) | izctxt_cfg(6b) |
342//      |       nzcps0_dtsb(48b)|       nzcps1_dtsb(48b)|       nzctxt_dtag_acc(48b)| dnzctxt_cfg(6b)|
343//      |       nzcps0_itsb(48b)|       nzcps1_itsb(48b)|       nzctxt_itag_acc(48b)| inzctxt_cfg(6b)|
344
345mux3ds #(13)    tag_acc_ctxtmx(
346                .in0    (lsu_tlu_pctxt_m[12:0]), // iside selects primary ctxt
347                .in1    (13'd0),                 // iside selects nucleus ctxt
348                .in2    (lsu_tlu_dside_ctxt_m[12:0]), // otherwise select dside ctxt
349                .sel0   (tlu_tag_access_ctxt_sel_m[0]),
350                .sel1   (tlu_tag_access_ctxt_sel_m[1]),
351                .sel2   (tlu_tag_access_ctxt_sel_m[2]),
352                .dout   (tag_access_ctxt_m[12:0])
353        );
354
355/*assign        tag_access_ctxt_m[12:0] =
356        tlu_tag_access_ctxt_sel_m[0] ?  lsu_tlu_pctxt_m[12:0] :         // iside selects primary ctxt
357                tlu_tag_access_ctxt_sel_m[1] ?  13'd0  :                // iside selects nucleus ctxt
358                        tlu_tag_access_ctxt_sel_m[2] ? lsu_tlu_dside_ctxt_m[12:0] : 13'bx_xxxx_xxxx_xxxx ;                      // otherwise select dside ctxt
359*/
360
361dff_s  #(13) ctxt_stgg (
362        .din    (tag_access_ctxt_m[12:0]),
363        .q      (tag_access_ctxt_g[12:0]),
364        .clk    (clk),
365        .se     (1'b0),       .si (),          .so ()
366        ); 
367
368// pstate.am masking
369wire    [15:0]  ldst_va_masked_g ;
370assign  ldst_va_masked_g[15:0] = ldst_va_g[47:32] & {16{~tlu_addr_msk_g}} ;
371
372mux3ds #(48)    dtag_access_dsel(
373                .in0    ({ldst_va_masked_g[15:0],ldst_va_g[31:13],tag_access_ctxt_g[12:0]}), // dside hardware
374                .in1    ({pc_g[47:13],tag_access_ctxt_g[12:0]}), // iside hardware
375                .in2    (lsu_tlu_st_rs3_data_b47t0_g[47:0]),    // stxa,tsb write as an example.
376                .sel0   (tag_access_wdata_sel[0]),
377                .sel1   (tag_access_wdata_sel[1]),
378                .sel2   (tag_access_wdata_sel[2]),
379                .dout   (tag_access_wdata[47:0])
380        );
381
382// Determine whether context is nucleus or not.
383//assign tlu_tag_access_nctxt_g = (tag_access_wdata[12:0] == 13'd0) ;
384assign        tlu_tag_access_ctxt_g[12:0] = tag_access_ctxt_g[12:0] ;
385
386wire    [47:0]  dsfar_wdata ;
387dp_mux2es #(48) dsfar_dsel(
388                .in0    ({ldst_va_masked_g[15:0],ldst_va_g[31:0]}), // dsfar;trap
389                .in1    (lsu_tlu_st_rs3_data_b47t0_g[47:0]), // asi write
390                .sel    (dmmu_any_sfsr_wr),
391                .dout   (dsfar_wdata[47:0])
392        );
393
394// Warning for Grape Mapper - the number of bits may have to be changed to
395// map implementation.
396assign  mra_wdata[155:0] = 
397        // Bug 4676 - tsb rsrved field
398        {lsu_tlu_st_rs3_data_b47t0_g[47:12],8'd0,       
399                lsu_tlu_st_rs3_data_b47t0_g[3:0],       //ps0 zctxt,nzctxt tsb
400         lsu_tlu_st_rs3_data_b47t0_g[47:12],8'd0,       
401                lsu_tlu_st_rs3_data_b47t0_g[3:0],       //ps1 zctxt,nzctxt tsb
402         tag_access_wdata[47:0],                //i/d tag-access
403         lsu_tlu_st_rs3_data_b47t0_g[10:8],     //ps1 page size
404         lsu_tlu_st_rs3_data_b47t0_g[2:0],      //ps0 page size
405         6'd0};
406
407
408//=========================================================================================
409//      D-TAG ACCESS
410//=========================================================================================
411
412// 4 registers for the 4 threads.
413// 35b of VA || 13b Ctxt.
414// ** Ctxt is to be read as zero if there is no context associated with the access **
415// VA will be sing-extended based on bit 47.
416
417// Update in w2.
418assign  dtag_access_w2[47:13] = mra_rdata[`MRA_TACCESS_HI:`MRA_TACCESS_LO+13] ;
419
420// Can this be shared with the i-side ?
421assign  tlu_dtag_access_w2[47:13] = dtag_access_w2[47:13] ;
422
423
424//=========================================================================================
425//      I-TAG ACCESS
426//=========================================================================================
427
428// 4 registers for the 4 threads.
429// 35b of VA || 13b Ctxt.
430// ** Ctxt is to be read as zero if there is no context associated with the access **
431// VA will be sing-extended based on bit 47.
432
433// Update in w2.
434// SPARC_HPV_EN - This needs to be obsoleted. Common tag-access will be superimposed
435// on dta_access bus.
436
437//assign        itag_access_w2[32:13] = mra_rdata[`MRA_TACCESS_HI-15:`MRA_TACCESS_LO+13] ;
438//assign        itag_access_w2[47:0] = mra_rdata[`MRA_TACCESS_HI:`MRA_TACCESS_LO] ;
439
440//assign        tlu_itag_access_w2[32:13] = itag_access_w2[32:13] ;
441
442
443//=========================================================================================
444//      D-TAG TARGET
445//=========================================================================================
446
447// Tag Target is based on currently selected thread.
448
449// Thread0,1,2,3
450assign tag_target[63:0] =
451        {3'b000,
452        ldxa_l1mx1_dout_m[12:0],        // Context
453        //tag_access_w2[12:0],          // Context
454        6'b000000,
455        {16{ldxa_l1mx1_dout_m[47]}},    // Sign-extend VA[47]
456        //{16{tag_access_w2[47]}},      // Sign-extend VA[47]
457        ldxa_l1mx1_dout_m[47:22]};      // VA // Bug 3975.
458        //tag_access_w2[47:22]};        // VA
459
460//=========================================================================================
461//      D-TSB
462//=========================================================================================
463
464// Note : on interface, dtsb represents ps0 tsbs, itsb represents ps1 tsbs.
465
466wire    [47:0]  tsb_ps0, tsb_ps1 ;
467assign  tsb_ps0[47:0] = mra_rdata[`MRA_TSB_PS0_HI:`MRA_TSB_PS0_LO] ;
468assign  tsb_ps1[47:0] = mra_rdata[`MRA_TSB_PS1_HI:`MRA_TSB_PS1_LO] ;
469
470assign  tlu_dtsb_split_w2 = tsb_ps0[12] ;
471// SPARC_HPV_EN - extend tsb_size by 1b.
472assign  tlu_dtsb_size_w2[3:0] = tsb_ps0[3:0] ;
473
474//=========================================================================================
475//      CTXT CONFIG
476//=========================================================================================
477
478wire    [5:0]   ptr_ctxt_cfg ;
479assign  tlu_ctxt_cfg_w2[5:0] =  mra_rdata[`MRA_CTXTCFG_HI:`MRA_CTXTCFG_LO] ;
480
481dff_s  #(6) pctxt_stgm (
482        .din    (mra_rdata[`MRA_CTXTCFG_HI:`MRA_CTXTCFG_LO]),
483        .q      (ptr_ctxt_cfg[5:0]),
484        .clk    (clk),
485        .se     (1'b0),       .si (),          .so ()
486        ); 
487
488//=========================================================================================
489//      I-TSB
490//=========================================================================================
491
492assign  tlu_itsb_split_w2 = tsb_ps1[12] ;
493assign  tlu_itsb_size_w2[3:0] = tsb_ps1[3:0] ;
494
495//=========================================================================================
496//      STAGE TSB BASE FOR USE IN PTR CALCULATION
497//=========================================================================================
498
499wire    [47:13] tsb_base ;
500assign  tsb_base[47:13] =
501        tlu_tsb_rd_ps0_sel ? tsb_ps0[47:13] : tsb_ps1[47:13] ;
502        //tlu_tsb_rd_ps0_sel ? dtsb[47:13] : itsb[47:13] ;
503
504dff_s  #(35) tsbbase_stgm (
505        .din    (tsb_base[47:13]),
506        .q      (tlu_tsb_base_w2_d1[47:13]),
507        .clk    (clk),
508        .se     (1'b0),       .si (),          .so ()
509        ); 
510
511//=========================================================================================
512//      8K and 64K Ptr
513//=========================================================================================
514
515// In MMU Control.
516
517//=========================================================================================
518//      Direct Ptr
519//=========================================================================================
520
521//=========================================================================================
522//      I-/D TLB Fill : TTE Tag and Data.
523//=========================================================================================
524
525
526// TTE Tag is formed from Tag Access.
527// TTE Data is formed from rs3_data for store.
528
529// Timing needs to be fixed !!! Partition mode will add one more cycle
530// to path. tlb write will occur in w3.
531
532// partitioned for vlint purposes.
533//assign        st_rs3_data_g[63:0] = lsu_tlu_st_rs3_data_g[63:0] ;
534assign  st_rs3_data_b63t59_g[63:59] = lsu_tlu_st_rs3_data_b63t59_g[63:59] ; 
535assign  st_rs3_data_b39t8_g[39:8] = lsu_tlu_st_rs3_data_b47t0_g[39:8] ; 
536assign  st_rs3_data_b6t1_g[6:1] = lsu_tlu_st_rs3_data_b47t0_g[6:1] ; 
537
538assign  tag_access_w2[47:0] = mra_rdata[`MRA_TACCESS_HI:`MRA_TACCESS_LO] ;
539
540wire idtte_tag_vld_g,idtte_tag_vld_d1 ;
541assign  idtte_tag_vld_g =
542        st_rs3_data_b63t59_g[63] ;
543wire idtte_tag_lock_g,idtte_tag_lock_d1 ;
544assign  idtte_tag_lock_g =
545        tlu_sun4r_tte_g ? st_rs3_data_b6t1_g[6] : st_rs3_data_b63t59_g[61] ;
546
547`ifdef FPGA_SYN_CLK_EN
548`else
549`ifdef FPGA_SYN_CLK_EN
550`else
551clken_buf clkbf_idttetg (
552                .rclk   (clk),
553                .enb_l  (tlu_lng_ltncy_en_l),
554                .tmb_l  (~se),
555                .clk    (tlb_access3_clk)
556                ) ;   
557`endif
558`endif
559
560// Stage some bits to match posedge rd for lng-lat reads of mra.
561`ifdef FPGA_SYN_CLK_DFF
562dffe_s  #(10) stgd1_idttetg (
563        .din    ({idtte_tag_vld_g,idtte_tag_lock_g,tlu_tte_tag_g[2:0],
564                tlu_tte_wr_pid_g[2:0],tlu_tte_real_g,tlu_tlb_tag_invrt_parity}),
565        .q      ({idtte_tag_vld_d1,idtte_tag_lock_d1,tlu_tte_tag_d1[2:0],
566                tlu_tte_wr_pid_d1[2:0],tlu_tte_real_d1,tlu_tlb_tag_invrt_parity_d1}),
567        .en (~(tlu_lng_ltncy_en_l)), .clk(clk),
568        .se     (1'b0),       .si (),          .so ()
569        ); 
570`else
571`ifdef FPGA_SYN_CLK_DFF
572dffe_s  #(10) stgd1_idttetg (
573        .din    ({idtte_tag_vld_g,idtte_tag_lock_g,tlu_tte_tag_g[2:0],
574                tlu_tte_wr_pid_g[2:0],tlu_tte_real_g,tlu_tlb_tag_invrt_parity}),
575        .q      ({idtte_tag_vld_d1,idtte_tag_lock_d1,tlu_tte_tag_d1[2:0],
576                tlu_tte_wr_pid_d1[2:0],tlu_tte_real_d1,tlu_tlb_tag_invrt_parity_d1}),
577        .en (~(tlu_lng_ltncy_en_l)), .clk(clk),
578        .se     (1'b0),       .si (),          .so ()
579        ); 
580`else
581dff_s  #(10) stgd1_idttetg (
582        .din    ({idtte_tag_vld_g,idtte_tag_lock_g,tlu_tte_tag_g[2:0],
583                tlu_tte_wr_pid_g[2:0],tlu_tte_real_g,tlu_tlb_tag_invrt_parity}),
584        .q      ({idtte_tag_vld_d1,idtte_tag_lock_d1,tlu_tte_tag_d1[2:0],
585                tlu_tte_wr_pid_d1[2:0],tlu_tte_real_d1,tlu_tlb_tag_invrt_parity_d1}),
586        .clk    (tlb_access3_clk),
587        .se     (1'b0),       .si (),          .so ()
588        ); 
589`endif
590`endif
591
592// assumption is that tag_access_w2 gets delayed by a cycle because
593// the rd is now posedge.
594assign idtte_tag_b53t0_g[53:0] =
595        {tag_access_w2[47:22],          // VA_tag       (26b)
596        tlu_tte_tag_d1[2],              // 27:22 are valid (1b)
597        idtte_tag_vld_d1,               // V            (1b) can be 0 or 1
598        idtte_tag_lock_d1,              // L            (1b)
599        1'b1,                           // U            (1b) : must be set on write
600        tag_access_w2[21:16],           // VA_tag       (6b)
601        tlu_tte_tag_d1[1],              // 21:16 are valid (1b)
602        tag_access_w2[15:13],           // VA_tag       (3b)
603        tlu_tte_tag_d1[0],              // 15:13 are valid (1b)
604        tag_access_w2[12:0]             // Ctxt b12:0   (13b)
605                        };             
606
607assign  idtte_tag_b58t55_g[58:55] = {tlu_tte_wr_pid_d1[2:0],tlu_tte_real_d1};
608// V and U bit omitted from tag as it can change once in tlb
609// assign       idtte_tag_g[54] =
610// tlu_tlb_tag_invrt_parity_d1^(^{idtte_tag_g[58:55],idtte_tag_g[53:27],idtte_tag_g[25],idtte_tag_g[23:0]}) ;
611
612// Additional page size bit does not have to be included. EP ?
613// SUN4R TTE
614wire    [41:0]  idtte_data_sun4r_g ;
615assign idtte_data_sun4r_g[41:0] =
616        {st_rs3_data_b39t8_g[39:22],    // PA           (18b)
617        ~tlu_tte_tag_g[2],              // 27:20 - mx sel (1b) : active-low
618        st_rs3_data_b39t8_g[21:16],     // PA           (6b)
619        ~tlu_tte_tag_g[1],              // 21:16 - mx sel (1b) : active-low
620        st_rs3_data_b39t8_g[15:13],     // PA           (3b)
621        ~tlu_tte_tag_g[0],              // 15:13 - mx sel (1b) : active-low
622        st_rs3_data_b63t59_g[63],       // V            (1b)
623        st_rs3_data_b63t59_g[60],       // NFO          (1b)
624        st_rs3_data_b63t59_g[59],       // IE           (1b)
625        st_rs3_data_b6t1_g[6],          // L            (1b)
626        st_rs3_data_b6t1_g[5:4],        // CP/CV        (2b)
627        st_rs3_data_b6t1_g[3],          // E            (1b)
628        st_rs3_data_b6t1_g[2],          // P            (1b)
629        st_rs3_data_b6t1_g[1],          // W            (1b)
630        3'b000};                        // Spare        (3b)
631// SUN4V TTE
632wire    [41:0]  idtte_data_sun4v_g ;
633assign idtte_data_sun4v_g[41:0] =
634        {st_rs3_data_b39t8_g[39:22],    // PA           (18b)
635        ~tlu_tte_tag_g[2],              // 27:20 - mx sel (1b) : active-low
636        st_rs3_data_b39t8_g[21:16],     // PA           (6b)
637        ~tlu_tte_tag_g[1],              // 21:16 - mx sel (1b) : active-low
638        st_rs3_data_b39t8_g[15:13],     // PA           (3b)
639        ~tlu_tte_tag_g[0],              // 15:13 - mx sel (1b) : active-low
640        st_rs3_data_b63t59_g[63],       // V            (1b) // 4->63. Bug 2977
641        st_rs3_data_b63t59_g[62],       // NFO          (1b) // 10->62
642        st_rs3_data_b39t8_g[12],        // IE           (1b)
643        st_rs3_data_b63t59_g[61],       // L            (1b)
644        //1'b0,                         //// L(none)    (1b)
645        st_rs3_data_b39t8_g[10:9],      // CP/CV        (2b) // 9:8 -> 10:9
646        st_rs3_data_b39t8_g[11],        // E            (1b)
647        st_rs3_data_b39t8_g[8],         // P            (1b) // 7->8
648        st_rs3_data_b6t1_g[6],          // W            (1b) // 5->6
649        3'b000};                        // Spare        (3b)
650assign  idtte_data_g[41:0] =
651        tlu_sun4r_tte_g ? idtte_data_sun4r_g[41:0] : idtte_data_sun4v_g[41:0];
652
653// Generate Parity for tte data. Match to DP Macro.
654//assign idtte_data_g[42] = tlu_tlb_data_invrt_parity^(^idtte_data_g[41:0]) ;
655
656/*dff  #(1) stgd1_tlbacc (
657        .din    (tlb_access_en_l),
658        .q      (tlb_access_en_l_d1),
659        .clk    (clk),
660        .se     (1'b0),       .si (),          .so ()
661        );*/
662
663// flopping of tte-tag is delayed by a cycle,tte-data
664// is not. wr-vld will match tte-tag.
665`ifdef FPGA_SYN_CLK_EN
666`else
667`ifdef FPGA_SYN_CLK_EN
668`else
669clken_buf clkbf_ttetg (
670                .rclk   (clk),
671                .enb_l  (tlu_tlb_access_en_l_d1),
672                .tmb_l  (~se),
673                .clk    (tlb_access0_clk)
674                ) ;   
675`endif
676`endif
677
678// Ship for write to TLB. Doesn't have to be resettable.
679// Shorten by a bit, as parity will be generated based on output.
680// Instead of removing the bit, use it for parity-invrt bit
681// in section below.
682/*dff  #(59) stgw2_ttetg (
683        .din    (idtte_tag_g[58:0]),
684        .q      (idtte_tag_w2[58:0]),
685        .clk    (tlb_access0_clk),
686        .se     (1'b0),       .si (),          .so ()
687        ); */
688
689`ifdef FPGA_SYN_CLK_DFF
690dffe_s  #(58) stgw2_ttetg (
691        .din    ({idtte_tag_b58t55_g[58:55],idtte_tag_b53t0_g[53:0]}),
692        .q      ({idtte_tag_b58t55_w2[58:55],idtte_tag_b53t0_w2[53:0]}),
693        .en (~(tlu_tlb_access_en_l_d1)), .clk(clk),
694        .se     (1'b0),       .si (),          .so ()
695        ); 
696`else
697`ifdef FPGA_SYN_CLK_DFF
698dffe_s  #(58) stgw2_ttetg (
699        .din    ({idtte_tag_b58t55_g[58:55],idtte_tag_b53t0_g[53:0]}),
700        .q      ({idtte_tag_b58t55_w2[58:55],idtte_tag_b53t0_w2[53:0]}),
701        .en (~(tlu_tlb_access_en_l_d1)), .clk(clk),
702        .se     (1'b0),       .si (),          .so ()
703        ); 
704`else
705dff_s  #(58) stgw2_ttetg (
706        .din    ({idtte_tag_b58t55_g[58:55],idtte_tag_b53t0_g[53:0]}),
707        .q      ({idtte_tag_b58t55_w2[58:55],idtte_tag_b53t0_w2[53:0]}),
708        .clk    (tlb_access0_clk),
709        .se     (1'b0),       .si (),          .so ()
710        ); 
711`endif
712`endif
713
714`ifdef FPGA_SYN_CLK_EN
715`else
716`ifdef FPGA_SYN_CLK_EN
717`else
718clken_buf clkbf_ttedt (
719                .rclk   (clk),
720                .enb_l  (tlu_lng_ltncy_en_l),
721                //.enb_l  (tlb_access_en_l),
722                .tmb_l  (~se),
723                .clk    (tlb_access1_clk)
724                ) ;   
725`endif
726`endif
727
728// Shorten by a bit, as parity will be generated based on output.
729// Instead of removing the bit, use it for parity-invrt bit
730// in section below.
731/*dff  #(43) stgw2_ttedt (
732        .din    (idtte_data_g[42:0]),
733        .q      (idtte_data_w2[42:0]),
734        .clk    (tlb_access1_clk),
735        .se     (1'b0),       .si (),          .so ()
736        );*/ 
737
738`ifdef FPGA_SYN_CLK_DFF
739dffe_s  #(42) stgw2_ttedt (
740        .din    (idtte_data_g[41:0]),
741        .q      (idtte_data_w2[41:0]),
742        .en (~(tlu_lng_ltncy_en_l)), .clk(clk),
743        .se     (1'b0),       .si (),          .so ()
744        );
745`else
746`ifdef FPGA_SYN_CLK_DFF
747dffe_s  #(42) stgw2_ttedt (
748        .din    (idtte_data_g[41:0]),
749        .q      (idtte_data_w2[41:0]),
750        .en (~(tlu_lng_ltncy_en_l)), .clk(clk),
751        .se     (1'b0),       .si (),          .so ()
752        );
753`else
754dff_s  #(42) stgw2_ttedt (
755        .din    (idtte_data_g[41:0]),
756        .q      (idtte_data_w2[41:0]),
757        .clk    (tlb_access1_clk),
758        .se     (1'b0),       .si (),          .so ()
759        );
760`endif
761`endif
762
763wire    parity_tag,parity_data ;
764wire    parity_tag_d1,parity_data_d1 ;
765assign tlu_dtlb_tte_tag_w2[58:0] = {idtte_tag_b58t55_w2[58:55],parity_tag_d1,idtte_tag_b53t0_w2[53:0]} ;
766assign tlu_itlb_tte_tag_w2[58:0] = {idtte_tag_b58t55_w2[58:55],parity_tag_d1,idtte_tag_b53t0_w2[53:0]} ;
767assign tlu_dtlb_tte_data_w2[42:0] = {parity_data_d1,idtte_data_w2[41:0]} ;
768assign tlu_itlb_tte_data_w2[42:0] = {parity_data_d1,idtte_data_w2[41:0]} ;
769
770//=========================================================================================
771//      PARITY GEN FOR TTE TAG & DATA
772//=========================================================================================
773
774// Timing Change : Since parity is not required until the write, and the write
775// is preceeded by a auto-demap, the parity generation can be hidden in the
776// cycle of auto-demap.
777
778wire    tlu_tlb_tag_invrt_parity_d2,tlu_tlb_data_invrt_parity_d1 ;
779
780`ifdef FPGA_SYN_CLK_DFF
781dffe_s  #(1) stgw2_ttetgpar (
782        .din    (tlu_tlb_tag_invrt_parity_d1),
783        .q      (tlu_tlb_tag_invrt_parity_d2),
784        .en (~(tlu_tlb_access_en_l_d1)), .clk(clk),
785        .se     (1'b0),       .si (),          .so ()
786        ); 
787`else
788`ifdef FPGA_SYN_CLK_DFF
789dffe_s  #(1) stgw2_ttetgpar (
790        .din    (tlu_tlb_tag_invrt_parity_d1),
791        .q      (tlu_tlb_tag_invrt_parity_d2),
792        .en (~(tlu_tlb_access_en_l_d1)), .clk(clk),
793        .se     (1'b0),       .si (),          .so ()
794        ); 
795`else
796dff_s  #(1) stgw2_ttetgpar (
797        .din    (tlu_tlb_tag_invrt_parity_d1),
798        .q      (tlu_tlb_tag_invrt_parity_d2),
799        .clk    (tlb_access0_clk),
800        .se     (1'b0),       .si (),          .so ()
801        ); 
802`endif
803`endif
804
805`ifdef FPGA_SYN_CLK_DFF
806dffe_s  #(1) stgw2_ttedtpar (
807        .din    (tlu_tlb_data_invrt_parity),
808        .q      (tlu_tlb_data_invrt_parity_d1),
809        .en (~(tlu_lng_ltncy_en_l)), .clk(clk),
810        .se     (1'b0),       .si (),          .so ()
811        ); 
812`else
813`ifdef FPGA_SYN_CLK_DFF
814dffe_s  #(1) stgw2_ttedtpar (
815        .din    (tlu_tlb_data_invrt_parity),
816        .q      (tlu_tlb_data_invrt_parity_d1),
817        .en (~(tlu_lng_ltncy_en_l)), .clk(clk),
818        .se     (1'b0),       .si (),          .so ()
819        ); 
820`else
821dff_s  #(1) stgw2_ttedtpar (
822        .din    (tlu_tlb_data_invrt_parity),
823        .q      (tlu_tlb_data_invrt_parity_d1),
824        .clk    (tlb_access1_clk),
825        .se     (1'b0),       .si (),          .so ()
826        ); 
827`endif
828`endif
829
830assign  parity_tag =
831tlu_tlb_tag_invrt_parity_d2^(^{idtte_tag_b58t55_w2[58:55],
832        idtte_tag_b53t0_w2[53:27],idtte_tag_b53t0_w2[25],idtte_tag_b53t0_w2[23:0]}) ;
833assign parity_data = tlu_tlb_data_invrt_parity_d1^(^idtte_data_w2[41:0]) ;
834//assign        idtte_tag_w2[54] =
835//tlu_tlb_tag_invrt_parity_d2^(^{idtte_tag_w2[58:55],idtte_tag_w2[53:27],idtte_tag_w2[25],idtte_tag_w2[23:0]}) ;
836//assign idtte_data_w2[42] = tlu_tlb_data_invrt_parity_d1^(^idtte_data_w2[41:0]) ;
837
838dff_s  #(2) stg_partd (
839        .din    ({parity_tag,parity_data}),
840        .q      ({parity_tag_d1,parity_data_d1}),
841        .clk    (clk),
842        .se     (1'b0),       .si (),          .so ()
843        ); 
844
845//=========================================================================================
846//      D-SFAR
847//=========================================================================================
848
849// dsfar is written into mra for pre SPARC_HPV_EN changes. It will be written into flops
850// for SPARC_HPV_EN.
851
852wire    [47:0]          dsfar_din ;
853   
854assign  dsfar_din[47:0] = dsfar_wdata[47:0] ;
855
856wire    dsfar0_clk ;
857`ifdef FPGA_SYN_CLK_EN
858`else
859`ifdef FPGA_SYN_CLK_EN
860`else
861clken_buf clkbf_dsfar0 (
862                .rclk   (clk),
863                .enb_l  (dmmu_sfar_wr_en_l[0]),
864                .tmb_l  (~se),
865                .clk    (dsfar0_clk)
866                ) ;   
867`endif
868`endif
869
870// Thread0
871`ifdef FPGA_SYN_CLK_DFF
872dffe_s  #(48) dsfar0_ff (
873        .din    (dsfar_din[47:0]),
874        .q      (dsfar0[47:0]),
875        .en (~(dmmu_sfar_wr_en_l[0])), .clk(clk),
876        .se     (1'b0),       .si (),          .so ()
877        ); 
878`else
879`ifdef FPGA_SYN_CLK_DFF
880dffe_s  #(48) dsfar0_ff (
881        .din    (dsfar_din[47:0]),
882        .q      (dsfar0[47:0]),
883        .en (~(dmmu_sfar_wr_en_l[0])), .clk(clk),
884        .se     (1'b0),       .si (),          .so ()
885        ); 
886`else
887dff_s  #(48) dsfar0_ff (
888        .din    (dsfar_din[47:0]),
889        .q      (dsfar0[47:0]),
890        .clk    (dsfar0_clk),
891        .se     (1'b0),       .si (),          .so ()
892        ); 
893`endif
894`endif
895
896
897wire    dsfar1_clk ;
898`ifdef FPGA_SYN_CLK_EN
899`else
900`ifdef FPGA_SYN_CLK_EN
901`else
902clken_buf clkbf_dsfar1 (
903                .rclk   (clk),
904                .enb_l  (dmmu_sfar_wr_en_l[1]),
905                .tmb_l  (~se),
906                .clk    (dsfar1_clk)
907                ) ;   
908`endif
909`endif
910
911// Thread1
912`ifdef FPGA_SYN_CLK_DFF
913dffe_s  #(48) dsfar1_ff (
914        .din    (dsfar_din[47:0]),
915        .q      (dsfar1[47:0]),
916        .en (~(dmmu_sfar_wr_en_l[1])), .clk(clk),
917        .se     (1'b0),       .si (),          .so ()
918        ); 
919`else
920`ifdef FPGA_SYN_CLK_DFF
921dffe_s  #(48) dsfar1_ff (
922        .din    (dsfar_din[47:0]),
923        .q      (dsfar1[47:0]),
924        .en (~(dmmu_sfar_wr_en_l[1])), .clk(clk),
925        .se     (1'b0),       .si (),          .so ()
926        ); 
927`else
928dff_s  #(48) dsfar1_ff (
929        .din    (dsfar_din[47:0]),
930        .q      (dsfar1[47:0]),
931        .clk    (dsfar1_clk),
932        .se     (1'b0),       .si (),          .so ()
933        ); 
934`endif
935`endif
936
937wire    dsfar2_clk ;
938`ifdef FPGA_SYN_CLK_EN
939`else
940`ifdef FPGA_SYN_CLK_EN
941`else
942clken_buf clkbf_dsfar2 (
943                .rclk   (clk),
944                .enb_l  (dmmu_sfar_wr_en_l[2]),
945                .tmb_l  (~se),
946                .clk    (dsfar2_clk)
947                ) ;   
948`endif
949`endif
950
951// Thread2
952`ifdef FPGA_SYN_CLK_DFF
953dffe_s  #(48) dsfar2_ff (
954        .din    (dsfar_din[47:0]),
955        .q      (dsfar2[47:0]),
956        .en (~(dmmu_sfar_wr_en_l[2])), .clk(clk),
957        .se     (1'b0),       .si (),          .so ()
958        ); 
959`else
960`ifdef FPGA_SYN_CLK_DFF
961dffe_s  #(48) dsfar2_ff (
962        .din    (dsfar_din[47:0]),
963        .q      (dsfar2[47:0]),
964        .en (~(dmmu_sfar_wr_en_l[2])), .clk(clk),
965        .se     (1'b0),       .si (),          .so ()
966        ); 
967`else
968dff_s  #(48) dsfar2_ff (
969        .din    (dsfar_din[47:0]),
970        .q      (dsfar2[47:0]),
971        .clk    (dsfar2_clk),
972        .se     (1'b0),       .si (),          .so ()
973        ); 
974`endif
975`endif
976
977
978wire    dsfar3_clk ;
979`ifdef FPGA_SYN_CLK_EN
980`else
981`ifdef FPGA_SYN_CLK_EN
982`else
983clken_buf clkbf_dsfar3 (
984                .rclk   (clk),
985                .enb_l  (dmmu_sfar_wr_en_l[3]),
986                .tmb_l  (~se),
987                .clk    (dsfar3_clk)
988                ) ;   
989`endif
990`endif
991
992// Thread3
993`ifdef FPGA_SYN_CLK_DFF
994dffe_s  #(48) dsfar3_ff (
995        .din    (dsfar_din[47:0]),
996        .q      (dsfar3[47:0]),
997        .en (~(dmmu_sfar_wr_en_l[3])), .clk(clk),
998        .se     (1'b0),       .si (),          .so ()
999        ); 
1000`else
1001`ifdef FPGA_SYN_CLK_DFF
1002dffe_s  #(48) dsfar3_ff (
1003        .din    (dsfar_din[47:0]),
1004        .q      (dsfar3[47:0]),
1005        .en (~(dmmu_sfar_wr_en_l[3])), .clk(clk),
1006        .se     (1'b0),       .si (),          .so ()
1007        ); 
1008`else
1009dff_s  #(48) dsfar3_ff (
1010        .din    (dsfar_din[47:0]),
1011        .q      (dsfar3[47:0]),
1012        .clk    (dsfar3_clk),
1013        .se     (1'b0),       .si (),          .so ()
1014        ); 
1015`endif
1016`endif
1017
1018mux4ds #(48) dsfar_mx(
1019        .in0(dsfar0[47:0]),
1020        .in1(dsfar1[47:0]),
1021        .in2(dsfar2[47:0]),
1022        .in3(dsfar3[47:0]),
1023        .sel0 (tlu_slxa_thrd_sel[0]),
1024        .sel1 (tlu_slxa_thrd_sel[1]),
1025        .sel2 (tlu_slxa_thrd_sel[2]),
1026        .sel3 (tlu_slxa_thrd_sel[3]),
1027        .dout(dsfar[47:0])
1028);
1029
1030
1031//=========================================================================================
1032//      D-SFSR
1033//=========================================================================================
1034
1035
1036dp_mux2es #(24) dsfsr_wdsel(
1037                .in0    (tlu_dsfsr_din_g[23:0]),
1038                .in1    ({lsu_tlu_st_rs3_data_b47t0_g[23:16],   // stxa
1039                         2'b00,lsu_tlu_st_rs3_data_b47t0_g[13:0]}),
1040                // .in1 (lsu_tlu_st_rs3_data_b47t0_g[23:0]),    // Bug 4283
1041                .sel    (dmmu_any_sfsr_wr),
1042                .dout   (dsfsr_din[23:0])
1043        );
1044
1045wire    dsfsr0_clk ;
1046`ifdef FPGA_SYN_CLK_EN
1047`else
1048`ifdef FPGA_SYN_CLK_EN
1049`else
1050clken_buf clkbf_dsfsr0 (
1051                .rclk   (clk),
1052                .enb_l  (dmmu_sfsr_wr_en_l[0]),
1053                .tmb_l  (~se),
1054                .clk    (dsfsr0_clk)
1055                ) ;   
1056`endif
1057`endif
1058
1059// Thread0
1060`ifdef FPGA_SYN_CLK_DFF
1061dffe_s  #(23) dsfsr0_ff (
1062        .din    (dsfsr_din[23:1]),
1063        .q      (dsfsr0[23:1]),
1064        .en (~(dmmu_sfsr_wr_en_l[0])), .clk(clk),
1065        .se     (1'b0),       .si (),          .so ()
1066        ); 
1067`else
1068`ifdef FPGA_SYN_CLK_DFF
1069dffe_s  #(23) dsfsr0_ff (
1070        .din    (dsfsr_din[23:1]),
1071        .q      (dsfsr0[23:1]),
1072        .en (~(dmmu_sfsr_wr_en_l[0])), .clk(clk),
1073        .se     (1'b0),       .si (),          .so ()
1074        ); 
1075`else
1076dff_s  #(23) dsfsr0_ff (
1077        .din    (dsfsr_din[23:1]),
1078        .q      (dsfsr0[23:1]),
1079        .clk    (dsfsr0_clk),
1080        .se     (1'b0),       .si (),          .so ()
1081        ); 
1082`endif
1083`endif
1084
1085`ifdef FPGA_SYN_CLK_DFF
1086dffrle_s  #(1) dsfsr0vld_ff (
1087        .din    (dsfsr_din[0]),
1088        .q      (dsfsr0[0]),
1089        .rst_l  (rst_l),
1090        .en (~(dmmu_sfsr_wr_en_l[0])), .clk(clk),
1091        .se     (1'b0),       .si (),          .so ()
1092        ); 
1093`else
1094`ifdef FPGA_SYN_CLK_DFF
1095dffrle_s  #(1) dsfsr0vld_ff (
1096        .din    (dsfsr_din[0]),
1097        .q      (dsfsr0[0]),
1098        .rst_l  (rst_l),
1099        .en (~(dmmu_sfsr_wr_en_l[0])), .clk(clk),
1100        .se     (1'b0),       .si (),          .so ()
1101        ); 
1102`else
1103dffrl_s  #(1) dsfsr0vld_ff (
1104        .din    (dsfsr_din[0]),
1105        .q      (dsfsr0[0]),
1106        .rst_l  (rst_l),
1107        .clk    (dsfsr0_clk),
1108        .se     (1'b0),       .si (),          .so ()
1109        ); 
1110`endif
1111`endif
1112
1113assign  tlu_dsfsr_flt_vld[0] = dsfsr0[0] ;
1114
1115wire    dsfsr1_clk ;
1116`ifdef FPGA_SYN_CLK_EN
1117`else
1118`ifdef FPGA_SYN_CLK_EN
1119`else
1120clken_buf clkbf_dsfsr1 (
1121                .rclk   (clk),
1122                .enb_l  (dmmu_sfsr_wr_en_l[1]),
1123                .tmb_l  (~se),
1124                .clk    (dsfsr1_clk)
1125                ) ;   
1126`endif
1127`endif
1128
1129// Thread1
1130`ifdef FPGA_SYN_CLK_DFF
1131dffe_s  #(23) dsfsr1_ff (
1132        .din    (dsfsr_din[23:1]),
1133        .q      (dsfsr1[23:1]),
1134        .en (~(dmmu_sfsr_wr_en_l[1])), .clk(clk),
1135        .se     (1'b0),       .si (),          .so ()
1136        ); 
1137`else
1138`ifdef FPGA_SYN_CLK_DFF
1139dffe_s  #(23) dsfsr1_ff (
1140        .din    (dsfsr_din[23:1]),
1141        .q      (dsfsr1[23:1]),
1142        .en (~(dmmu_sfsr_wr_en_l[1])), .clk(clk),
1143        .se     (1'b0),       .si (),          .so ()
1144        ); 
1145`else
1146dff_s  #(23) dsfsr1_ff (
1147        .din    (dsfsr_din[23:1]),
1148        .q      (dsfsr1[23:1]),
1149        .clk    (dsfsr1_clk),
1150        .se     (1'b0),       .si (),          .so ()
1151        ); 
1152`endif
1153`endif
1154
1155`ifdef FPGA_SYN_CLK_DFF
1156dffrle_s  #(1) dsfsr1vld_ff (
1157        .din    (dsfsr_din[0]),
1158        .q      (dsfsr1[0]),
1159        .rst_l  (rst_l),
1160        .en (~(dmmu_sfsr_wr_en_l[1])), .clk(clk),
1161        .se     (1'b0),       .si (),          .so ()
1162        ); 
1163`else
1164`ifdef FPGA_SYN_CLK_DFF
1165dffrle_s  #(1) dsfsr1vld_ff (
1166        .din    (dsfsr_din[0]),
1167        .q      (dsfsr1[0]),
1168        .rst_l  (rst_l),
1169        .en (~(dmmu_sfsr_wr_en_l[1])), .clk(clk),
1170        .se     (1'b0),       .si (),          .so ()
1171        ); 
1172`else
1173dffrl_s  #(1) dsfsr1vld_ff (
1174        .din    (dsfsr_din[0]),
1175        .q      (dsfsr1[0]),
1176        .rst_l  (rst_l),
1177        .clk    (dsfsr1_clk),
1178        .se     (1'b0),       .si (),          .so ()
1179        ); 
1180`endif
1181`endif
1182
1183assign  tlu_dsfsr_flt_vld[1] = dsfsr1[0] ;
1184
1185wire    dsfsr2_clk ;
1186`ifdef FPGA_SYN_CLK_EN
1187`else
1188`ifdef FPGA_SYN_CLK_EN
1189`else
1190clken_buf clkbf_dsfsr2 (
1191                .rclk   (clk),
1192                .enb_l  (dmmu_sfsr_wr_en_l[2]),
1193                .tmb_l  (~se),
1194                .clk    (dsfsr2_clk)
1195                ) ;   
1196`endif
1197`endif
1198
1199// Thread2
1200`ifdef FPGA_SYN_CLK_DFF
1201dffe_s  #(23) dsfsr2_ff (
1202        .din    (dsfsr_din[23:1]),
1203        .q      (dsfsr2[23:1]),
1204        .en (~(dmmu_sfsr_wr_en_l[2])), .clk(clk),
1205        .se     (1'b0),       .si (),          .so ()
1206        ); 
1207`else
1208`ifdef FPGA_SYN_CLK_DFF
1209dffe_s  #(23) dsfsr2_ff (
1210        .din    (dsfsr_din[23:1]),
1211        .q      (dsfsr2[23:1]),
1212        .en (~(dmmu_sfsr_wr_en_l[2])), .clk(clk),
1213        .se     (1'b0),       .si (),          .so ()
1214        ); 
1215`else
1216dff_s  #(23) dsfsr2_ff (
1217        .din    (dsfsr_din[23:1]),
1218        .q      (dsfsr2[23:1]),
1219        .clk    (dsfsr2_clk),
1220        .se     (1'b0),       .si (),          .so ()
1221        ); 
1222`endif
1223`endif
1224
1225`ifdef FPGA_SYN_CLK_DFF
1226dffrle_s  #(1) dsfsr2vld_ff (
1227        .din    (dsfsr_din[0]),
1228        .q      (dsfsr2[0]),
1229        .rst_l  (rst_l),
1230        .en (~(dmmu_sfsr_wr_en_l[2])), .clk(clk),
1231        .se     (1'b0),       .si (),          .so ()
1232        ); 
1233`else
1234`ifdef FPGA_SYN_CLK_DFF
1235dffrle_s  #(1) dsfsr2vld_ff (
1236        .din    (dsfsr_din[0]),
1237        .q      (dsfsr2[0]),
1238        .rst_l  (rst_l),
1239        .en (~(dmmu_sfsr_wr_en_l[2])), .clk(clk),
1240        .se     (1'b0),       .si (),          .so ()
1241        ); 
1242`else
1243dffrl_s  #(1) dsfsr2vld_ff (
1244        .din    (dsfsr_din[0]),
1245        .q      (dsfsr2[0]),
1246        .rst_l  (rst_l),
1247        .clk    (dsfsr2_clk),
1248        .se     (1'b0),       .si (),          .so ()
1249        ); 
1250`endif
1251`endif
1252
1253assign  tlu_dsfsr_flt_vld[2] = dsfsr2[0] ;
1254
1255wire    dsfsr3_clk ;
1256`ifdef FPGA_SYN_CLK_EN
1257`else
1258`ifdef FPGA_SYN_CLK_EN
1259`else
1260clken_buf clkbf_dsfsr3 (
1261                .rclk   (clk),
1262                .enb_l  (dmmu_sfsr_wr_en_l[3]),
1263                .tmb_l  (~se),
1264                .clk    (dsfsr3_clk)
1265                ) ;   
1266`endif
1267`endif
1268
1269// Thread3
1270`ifdef FPGA_SYN_CLK_DFF
1271dffe_s  #(23) dsfsr3_ff (
1272        .din    (dsfsr_din[23:1]),
1273        .q      (dsfsr3[23:1]),
1274        .en (~(dmmu_sfsr_wr_en_l[3])), .clk(clk),
1275        .se     (1'b0),       .si (),          .so ()
1276        ); 
1277`else
1278`ifdef FPGA_SYN_CLK_DFF
1279dffe_s  #(23) dsfsr3_ff (
1280        .din    (dsfsr_din[23:1]),
1281        .q      (dsfsr3[23:1]),
1282        .en (~(dmmu_sfsr_wr_en_l[3])), .clk(clk),
1283        .se     (1'b0),       .si (),          .so ()
1284        ); 
1285`else
1286dff_s  #(23) dsfsr3_ff (
1287        .din    (dsfsr_din[23:1]),
1288        .q      (dsfsr3[23:1]),
1289        .clk    (dsfsr3_clk),
1290        .se     (1'b0),       .si (),          .so ()
1291        ); 
1292`endif
1293`endif
1294
1295`ifdef FPGA_SYN_CLK_DFF
1296dffrle_s  #(1) dsfsr3vld_ff (
1297        .din    (dsfsr_din[0]),
1298        .q      (dsfsr3[0]),
1299        .rst_l  (rst_l),
1300        .en (~(dmmu_sfsr_wr_en_l[3])), .clk(clk),
1301        .se     (1'b0),       .si (),          .so ()
1302        ); 
1303`else
1304`ifdef FPGA_SYN_CLK_DFF
1305dffrle_s  #(1) dsfsr3vld_ff (
1306        .din    (dsfsr_din[0]),
1307        .q      (dsfsr3[0]),
1308        .rst_l  (rst_l),
1309        .en (~(dmmu_sfsr_wr_en_l[3])), .clk(clk),
1310        .se     (1'b0),       .si (),          .so ()
1311        ); 
1312`else
1313dffrl_s  #(1) dsfsr3vld_ff (
1314        .din    (dsfsr_din[0]),
1315        .q      (dsfsr3[0]),
1316        .rst_l  (rst_l),
1317        .clk    (dsfsr3_clk),
1318        .se     (1'b0),       .si (),          .so ()
1319        ); 
1320`endif
1321`endif
1322
1323assign  tlu_dsfsr_flt_vld[3] = dsfsr3[0] ;
1324
1325dp_mux4ds #(24) dsfsr_msel(
1326                .in0    (dsfsr0[23:0]),
1327                .in1    (dsfsr1[23:0]),
1328                .in2    (dsfsr2[23:0]),
1329                .in3    (dsfsr3[23:0]),
1330                .sel0_l (~tlu_slxa_thrd_sel[0]),
1331                .sel1_l (~tlu_slxa_thrd_sel[1]),
1332                .sel2_l (~tlu_slxa_thrd_sel[2]),
1333                .sel3_l (~tlu_slxa_thrd_sel[3]),
1334                .dout   (dsfsr[23:0])
1335        );
1336
1337//=========================================================================================
1338//      I-SFSR
1339//=========================================================================================
1340
1341// Should be able to reduce the width of these regs !!!
1342
1343
1344dp_mux2es #(24) isfsr_wdsel(
1345                .in0    (tlu_isfsr_din_g[23:0]),
1346                .in1    ({lsu_tlu_st_rs3_data_b47t0_g[23:16],   // stxa
1347                         2'b00,lsu_tlu_st_rs3_data_b47t0_g[13:0]}),     
1348                //.in1  (lsu_tlu_st_rs3_data_b47t0_g[23:0]),    // Bug 4283
1349                .sel    (immu_any_sfsr_wr),
1350                .dout   (isfsr_din[23:0])
1351        );
1352
1353wire    isfsr0_clk ;
1354`ifdef FPGA_SYN_CLK_EN
1355`else
1356`ifdef FPGA_SYN_CLK_EN
1357`else
1358clken_buf clkbf_isfsr0 (
1359                .rclk   (clk),
1360                .enb_l  (immu_sfsr_wr_en_l[0]),
1361                .tmb_l  (~se),
1362                .clk    (isfsr0_clk)
1363                ) ;   
1364`endif
1365`endif
1366
1367// Thread0
1368`ifdef FPGA_SYN_CLK_DFF
1369dffe_s  #(23) isfsr0_ff (
1370        .din    (isfsr_din[23:1]),
1371        .q      (isfsr0[23:1]),
1372        .en (~(immu_sfsr_wr_en_l[0])), .clk(clk),
1373        .se     (1'b0),       .si (),          .so ()
1374        ); 
1375`else
1376`ifdef FPGA_SYN_CLK_DFF
1377dffe_s  #(23) isfsr0_ff (
1378        .din    (isfsr_din[23:1]),
1379        .q      (isfsr0[23:1]),
1380        .en (~(immu_sfsr_wr_en_l[0])), .clk(clk),
1381        .se     (1'b0),       .si (),          .so ()
1382        ); 
1383`else
1384dff_s  #(23) isfsr0_ff (
1385        .din    (isfsr_din[23:1]),
1386        .q      (isfsr0[23:1]),
1387        .clk    (isfsr0_clk),
1388        .se     (1'b0),       .si (),          .so ()
1389        ); 
1390`endif
1391`endif
1392
1393// Chandra - This has changed.
1394`ifdef FPGA_SYN_CLK_DFF
1395dffrle_s  #(1) isfsrvld0_ff (
1396        .din    (isfsr_din[0]),
1397        .q      (isfsr0[0]),
1398        .rst_l  (rst_l),      .en (~(immu_sfsr_wr_en_l[0])), .clk(clk),
1399        .se     (1'b0),       .si (),          .so ()
1400        ); 
1401`else
1402`ifdef FPGA_SYN_CLK_DFF
1403dffrle_s  #(1) isfsrvld0_ff (
1404        .din    (isfsr_din[0]),
1405        .q      (isfsr0[0]),
1406        .rst_l  (rst_l),      .en (~(immu_sfsr_wr_en_l[0])), .clk(clk),
1407        .se     (1'b0),       .si (),          .so ()
1408        ); 
1409`else
1410dffrl_s  #(1) isfsrvld0_ff (
1411        .din    (isfsr_din[0]),
1412        .q      (isfsr0[0]),
1413        .rst_l  (rst_l),      .clk      (isfsr0_clk),
1414        .se     (1'b0),       .si (),          .so ()
1415        ); 
1416`endif
1417`endif
1418
1419assign  tlu_isfsr_flt_vld[0] = isfsr0[0] ;
1420
1421wire    isfsr1_clk ;
1422`ifdef FPGA_SYN_CLK_EN
1423`else
1424`ifdef FPGA_SYN_CLK_EN
1425`else
1426clken_buf clkbf_isfsr1 (
1427                .rclk   (clk),
1428                .enb_l  (immu_sfsr_wr_en_l[1]),
1429                .tmb_l  (~se),
1430                .clk    (isfsr1_clk)
1431                ) ;   
1432`endif
1433`endif
1434
1435// Thread1
1436`ifdef FPGA_SYN_CLK_DFF
1437dffe_s  #(23) isfsr1_ff (
1438        .din    (isfsr_din[23:1]),
1439        .q      (isfsr1[23:1]),
1440        .en (~(immu_sfsr_wr_en_l[1])), .clk(clk),
1441        .se     (1'b0),       .si (),          .so ()
1442        ); 
1443`else
1444`ifdef FPGA_SYN_CLK_DFF
1445dffe_s  #(23) isfsr1_ff (
1446        .din    (isfsr_din[23:1]),
1447        .q      (isfsr1[23:1]),
1448        .en (~(immu_sfsr_wr_en_l[1])), .clk(clk),
1449        .se     (1'b0),       .si (),          .so ()
1450        ); 
1451`else
1452dff_s  #(23) isfsr1_ff (
1453        .din    (isfsr_din[23:1]),
1454        .q      (isfsr1[23:1]),
1455        .clk    (isfsr1_clk),
1456        .se     (1'b0),       .si (),          .so ()
1457        ); 
1458`endif
1459`endif
1460
1461// Chandra - This has changed.
1462`ifdef FPGA_SYN_CLK_DFF
1463dffrle_s  #(1) isfsrvld1_ff (
1464        .din    (isfsr_din[0]),
1465        .q      (isfsr1[0]),
1466        .rst_l  (rst_l),                .en (~(immu_sfsr_wr_en_l[1])), .clk(clk),
1467        .se     (1'b0),       .si (),          .so ()
1468        ); 
1469`else
1470`ifdef FPGA_SYN_CLK_DFF
1471dffrle_s  #(1) isfsrvld1_ff (
1472        .din    (isfsr_din[0]),
1473        .q      (isfsr1[0]),
1474        .rst_l  (rst_l),                .en (~(immu_sfsr_wr_en_l[1])), .clk(clk),
1475        .se     (1'b0),       .si (),          .so ()
1476        ); 
1477`else
1478dffrl_s  #(1) isfsrvld1_ff (
1479        .din    (isfsr_din[0]),
1480        .q      (isfsr1[0]),
1481        .rst_l  (rst_l),                .clk    (isfsr1_clk),
1482        .se     (1'b0),       .si (),          .so ()
1483        ); 
1484`endif
1485`endif
1486
1487assign  tlu_isfsr_flt_vld[1] = isfsr1[0] ;
1488
1489wire    isfsr2_clk ;
1490`ifdef FPGA_SYN_CLK_EN
1491`else
1492`ifdef FPGA_SYN_CLK_EN
1493`else
1494clken_buf clkbf_isfsr2 (
1495                .rclk   (clk),
1496                .enb_l  (immu_sfsr_wr_en_l[2]),
1497                .tmb_l  (~se),
1498                .clk    (isfsr2_clk)
1499                ) ;   
1500`endif
1501`endif
1502
1503// Thread2
1504`ifdef FPGA_SYN_CLK_DFF
1505dffe_s  #(23) isfsr2_ff (
1506        .din    (isfsr_din[23:1]),
1507        .q      (isfsr2[23:1]),
1508        .en (~(immu_sfsr_wr_en_l[2])), .clk(clk),
1509        .se     (1'b0),       .si (),          .so ()
1510        ); 
1511`else
1512`ifdef FPGA_SYN_CLK_DFF
1513dffe_s  #(23) isfsr2_ff (
1514        .din    (isfsr_din[23:1]),
1515        .q      (isfsr2[23:1]),
1516        .en (~(immu_sfsr_wr_en_l[2])), .clk(clk),
1517        .se     (1'b0),       .si (),          .so ()
1518        ); 
1519`else
1520dff_s  #(23) isfsr2_ff (
1521        .din    (isfsr_din[23:1]),
1522        .q      (isfsr2[23:1]),
1523        .clk    (isfsr2_clk),
1524        .se     (1'b0),       .si (),          .so ()
1525        ); 
1526`endif
1527`endif
1528
1529// Chandra - This has changed.
1530`ifdef FPGA_SYN_CLK_DFF
1531dffrle_s  #(1) isfsrvld2_ff (
1532        .din    (isfsr_din[0]),
1533        .q      (isfsr2[0]),
1534        .rst_l  (rst_l),        .en (~(immu_sfsr_wr_en_l[2])), .clk(clk),
1535        .se     (1'b0),       .si (),          .so ()
1536        ); 
1537`else
1538`ifdef FPGA_SYN_CLK_DFF
1539dffrle_s  #(1) isfsrvld2_ff (
1540        .din    (isfsr_din[0]),
1541        .q      (isfsr2[0]),
1542        .rst_l  (rst_l),        .en (~(immu_sfsr_wr_en_l[2])), .clk(clk),
1543        .se     (1'b0),       .si (),          .so ()
1544        ); 
1545`else
1546dffrl_s  #(1) isfsrvld2_ff (
1547        .din    (isfsr_din[0]),
1548        .q      (isfsr2[0]),
1549        .rst_l  (rst_l),        .clk    (isfsr2_clk),
1550        .se     (1'b0),       .si (),          .so ()
1551        ); 
1552`endif
1553`endif
1554
1555assign  tlu_isfsr_flt_vld[2] = isfsr2[0] ;
1556
1557wire    isfsr3_clk ;
1558`ifdef FPGA_SYN_CLK_EN
1559`else
1560`ifdef FPGA_SYN_CLK_EN
1561`else
1562clken_buf clkbf_isfsr3 (
1563                .rclk   (clk),
1564                .enb_l  (immu_sfsr_wr_en_l[3]),
1565                .tmb_l  (~se),
1566                .clk    (isfsr3_clk)
1567                ) ;   
1568`endif
1569`endif
1570
1571// Thread3
1572`ifdef FPGA_SYN_CLK_DFF
1573dffe_s  #(23) isfsr3_ff (
1574        .din    (isfsr_din[23:1]),
1575        .q      (isfsr3[23:1]),
1576        .en (~(immu_sfsr_wr_en_l[3])), .clk(clk),
1577        .se     (1'b0),       .si (),          .so ()
1578        ); 
1579`else
1580`ifdef FPGA_SYN_CLK_DFF
1581dffe_s  #(23) isfsr3_ff (
1582        .din    (isfsr_din[23:1]),
1583        .q      (isfsr3[23:1]),
1584        .en (~(immu_sfsr_wr_en_l[3])), .clk(clk),
1585        .se     (1'b0),       .si (),          .so ()
1586        ); 
1587`else
1588dff_s  #(23) isfsr3_ff (
1589        .din    (isfsr_din[23:1]),
1590        .q      (isfsr3[23:1]),
1591        .clk    (isfsr3_clk),
1592        .se     (1'b0),       .si (),          .so ()
1593        ); 
1594`endif
1595`endif
1596
1597// Chandra - This has changed.
1598`ifdef FPGA_SYN_CLK_DFF
1599dffrle_s  #(1) isfsrvld3_ff (
1600        .din    (isfsr_din[0]),
1601        .q      (isfsr3[0]),
1602        .rst_l  (rst_l),        .en (~(immu_sfsr_wr_en_l[3])), .clk(clk),
1603        .se     (1'b0),       .si (),          .so ()
1604        ); 
1605`else
1606`ifdef FPGA_SYN_CLK_DFF
1607dffrle_s  #(1) isfsrvld3_ff (
1608        .din    (isfsr_din[0]),
1609        .q      (isfsr3[0]),
1610        .rst_l  (rst_l),        .en (~(immu_sfsr_wr_en_l[3])), .clk(clk),
1611        .se     (1'b0),       .si (),          .so ()
1612        ); 
1613`else
1614dffrl_s  #(1) isfsrvld3_ff (
1615        .din    (isfsr_din[0]),
1616        .q      (isfsr3[0]),
1617        .rst_l  (rst_l),        .clk    (isfsr3_clk),
1618        .se     (1'b0),       .si (),          .so ()
1619        ); 
1620`endif
1621`endif
1622
1623assign  tlu_isfsr_flt_vld[3] = isfsr3[0] ;
1624
1625dp_mux4ds #(24) isfsr_msel(
1626                .in0    (isfsr0[23:0]),
1627                .in1    (isfsr1[23:0]),
1628                .in2    (isfsr2[23:0]),
1629                .in3    (isfsr3[23:0]),
1630                .sel0_l (~tlu_slxa_thrd_sel[0]),
1631                .sel1_l (~tlu_slxa_thrd_sel[1]),
1632                .sel2_l (~tlu_slxa_thrd_sel[2]),
1633                .sel3_l (~tlu_slxa_thrd_sel[3]),
1634                .dout   (isfsr[23:0])
1635        );
1636
1637//=========================================================================================
1638//      D-SFAR
1639//=========================================================================================
1640/*
1641`ifdef SPARC_HPV_EN
1642`else
1643assign  dsfar[47:0] = mra_rdata[`MRA_DSFAR_HI:`MRA_DSFAR_LO];
1644`endif
1645*/
1646
1647//=========================================================================================
1648//      Muxing for ldxa read
1649//=========================================================================================
1650
1651// Note - collapse dtsb/itsb into one leg of the mux. Similar for
1652// dtag_access/itag_access.
1653// read of zcps1_itsb,zcps1_dtsb collapsed into read of dtsb.
1654// read of nzcps0_dtsb,nzcps0_itsb collapsed into read of dtag_access.
1655// read of nzcps1_dtsb,nzcps1_itsb collapsed into read of dsfar.
1656
1657// use rs3 to return data.
1658
1659//*****************************************************************
1660//      SPARC_HPV_EN
1661//*****************************************************************
1662
1663// Warning for Grape Mapper : Be careful about loading on replicated
1664// msb.
1665
1666// First Level, Mux 1
1667// This is done in Estage to save on flops.
1668// !!! The sels except b0 are also Estage !!! b0 is delayed by a cycle.
1669mux3ds #(48) ldxa_l1mx1_e(
1670                .in0(tsb_ps0[47:0]), // becomes ps0 tsb with SPARC_HPV_EN
1671                .in1(tsb_ps1[47:0]), // becomes ps1 tsb with SPARC_HPV_EN
1672                .in2(tag_access_w2[47:0]),
1673                .sel0(tlu_ldxa_l1mx1_sel[1]),
1674                .sel1(tlu_ldxa_l1mx1_sel[2]),
1675                .sel2(tlu_ldxa_l1mx1_sel[3]),
1676                .dout(ldxa_l1mx1_dout_e[47:0])
1677);
1678
1679// New
1680dff_s  #(48) l1mx1_ff (
1681        .din    (ldxa_l1mx1_dout_e[47:0]),
1682        .q      (ldxa_l1mx1_dout_m[47:0]),
1683        .clk    (clk),
1684        .se     (1'b0),       .si (),          .so ()
1685        ); 
1686
1687wire [63:0] ldxa_l1mx1_dout_final ;
1688
1689// New
1690assign  ldxa_l1mx1_dout_final[63:0] =
1691                // Note : this bit of the mx sel is stage delayed relative to the others.
1692                tlu_ldxa_l1mx1_sel[0] ? 
1693                tag_target[63:0] : // tag_target.
1694                {{16{ldxa_l1mx1_dout_m[47]}},ldxa_l1mx1_dout_m[47:0]} ; // tsb_ps0/ps1,tag_access
1695
1696/*mux4ds #(64) ldxa_l1mx1(
1697                .in0(tag_target[63:0]),
1698                .in1({{16{tsb_ps0[47]}},tsb_ps0[47:0]}), // becomes ps0 tsb with SPARC_HPV_EN
1699                .in2({{16{tsb_ps1[47]}},tsb_ps1[47:0]}), // becomes ps1 tsb with SPARC_HPV_EN
1700                .in3({{16{tag_access_w2[47]}},tag_access_w2[47:0]}),
1701                .sel0(tlu_ldxa_l1mx1_sel[0]),
1702                .sel1(tlu_ldxa_l1mx1_sel[1]),
1703                .sel2(tlu_ldxa_l1mx1_sel[2]),
1704                .sel3(tlu_ldxa_l1mx1_sel[3]),
1705                .dout(ldxa_l1mx1_dout[63:0])
1706);*/
1707
1708wire    [47:0]  ldxa_l1mx2_dout ;
1709// First Level, Mux 2 - This is done in M stage.
1710mux4ds #(48) ldxa_l1mx2(
1711                .in0({24'd0,dsfsr[23:0]}),
1712                .in1(dsfar[47:0]),
1713                .in2({24'd0,isfsr[23:0]}),
1714                .in3({37'd0,ptr_ctxt_cfg[5:3],5'd0,ptr_ctxt_cfg[2:0]}),
1715                .sel0(tlu_ldxa_l1mx2_sel[0]),
1716                .sel1(tlu_ldxa_l1mx2_sel[1]),
1717                .sel2(tlu_ldxa_l1mx2_sel[2]),
1718                .sel3(tlu_ldxa_l1mx2_sel[3]),
1719                .dout(ldxa_l1mx2_dout[47:0])
1720);
1721
1722wire    [63:0]  tlu_ldxa_data_m ;
1723mux3ds #(64)    ldxa_fmx (
1724                .in0    (ldxa_l1mx1_dout_final[63:0]),
1725                //.in0  (ldxa_l1mx1_dout[63:0]),
1726                .in1    ({{16{ldxa_l1mx2_dout[47]}},ldxa_l1mx2_dout[47:0]}),
1727                .in2    ({{16{tlu_idtsb_8k_ptr[47]}},tlu_idtsb_8k_ptr[47:0]}),
1728                .sel0   (tlu_ldxa_l2mx1_sel[0]),
1729                .sel1   (tlu_ldxa_l2mx1_sel[1]),
1730                .sel2   (tlu_ldxa_l2mx1_sel[2]),
1731                .dout   (tlu_ldxa_data_m[63:0])
1732                //.dout (tlu_ldxa_data_e[63:0])
1733        );
1734
1735dff_s  #(64) stgg_eldxa (
1736        .din    (tlu_ldxa_data_m[63:0]),
1737        .q      (lsu_exu_ldxa_data_g[63:0]),
1738        .clk    (clk),
1739        .se     (1'b0),       .si (),          .so ()
1740        ); 
1741
1742endmodule
1743
1744
Note: See TracBrowser for help on using the repository browser.