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

Subversion Repositories s1_core

[/] [s1_core/] [trunk/] [hdl/] [rtl/] [sparc_core/] [sparc_ifu_errdp.v] - Blame information for rev 113

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 95 fafa1971
// ========== Copyright Header Begin ==========================================
2
// 
3
// OpenSPARC T1 Processor File: sparc_ifu_errdp.v
4
// Copyright (c) 2006 Sun Microsystems, Inc.  All Rights Reserved.
5
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
6
// 
7
// The above named program is free software; you can redistribute it and/or
8
// modify it under the terms of the GNU General Public
9
// License version 2 as published by the Free Software Foundation.
10
// 
11
// The above named program is distributed in the hope that it will be 
12
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
// General Public License for more details.
15
// 
16
// You should have received a copy of the GNU General Public
17
// License along with this work; if not, write to the Free Software
18
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19
// 
20
// ========== Copyright Header End ============================================
21 113 albert.wat
`ifdef SIMPLY_RISC_TWEAKS
22
`define SIMPLY_RISC_SCANIN .si(0)
23
`else
24
`define SIMPLY_RISC_SCANIN .si()
25
`endif
26 95 fafa1971
////////////////////////////////////////////////////////////////////////
27
/*
28
//  Module Name:  sparc_ifu_errdp
29
*/
30
////////////////////////////////////////////////////////////////////////
31
// Global header file includes
32
////////////////////////////////////////////////////////////////////////
33
 
34 113 albert.wat
`include "lsu.h"
35
`include "ifu.h"
36 95 fafa1971
 
37
module sparc_ifu_errdp(/*AUTOARG*/
38
   // Outputs
39
   so, ifu_lsu_ldxa_data_w2, erb_dtu_imask, erd_erc_tlbt_pe_s1,
40
   erd_erc_tlbd_pe_s1, erd_erc_tagpe_s1, erd_erc_nirpe_s1,
41
   erd_erc_fetpe_s1, erd_erc_tte_pgsz,
42
   // Inputs
43
   rclk, se, si, erb_reset, itlb_rd_tte_data, itlb_rd_tte_tag,
44
   itlb_ifq_paddr_s, wsel_fdp_fetdata_s1, wsel_fdp_topdata_s1,
45
   wsel_erb_asidata_s, ict_itlb_tags_f, icv_itlb_valid_f,
46
   lsu_ifu_err_addr, spu_ifu_err_addr_w2, fdp_erb_pc_f,
47
   exu_ifu_err_reg_m, exu_ifu_err_synd_m, ffu_ifu_err_reg_w2,
48
   ffu_ifu_err_synd_w2, tlu_itlb_rw_index_g, erc_erd_pgsz_b0,
49
   erc_erd_pgsz_b1, erc_erd_erren_asidata, erc_erd_errstat_asidata,
50
   erc_erd_errinj_asidata, ifq_erb_asidata_i2, ifq_erb_wrtag_f,
51
   ifq_erb_wrindex_f, erc_erd_asiway_s1_l, fcl_erb_itlbrd_data_s,
52
   erc_erd_ld_imask, erc_erd_asisrc_sel_icd_s_l,
53
   erc_erd_asisrc_sel_misc_s_l, erc_erd_asisrc_sel_err_s_l,
54
   erc_erd_asisrc_sel_itlb_s_l, erc_erd_errasi_sel_en_l,
55
   erc_erd_errasi_sel_stat_l, erc_erd_errasi_sel_inj_l,
56
   erc_erd_errasi_sel_addr_l, erc_erd_miscasi_sel_ict_l,
57
   erc_erd_miscasi_sel_imask_l, erc_erd_miscasi_sel_other_l,
58
   erc_erd_asi_thr_l, erc_erd_eadr0_sel_irf_l,
59
   erc_erd_eadr0_sel_itlb_l, erc_erd_eadr0_sel_frf_l,
60
   erc_erd_eadr0_sel_lsu_l, erc_erd_eadr1_sel_pcd1_l,
61
   erc_erd_eadr1_sel_l1pa_l, erc_erd_eadr1_sel_l2pa_l,
62
   erc_erd_eadr1_sel_other_l, erc_erd_eadr2_sel_mx1_l,
63
   erc_erd_eadr2_sel_wrt_l, erc_erd_eadr2_sel_mx0_l,
64
   erc_erd_eadr2_sel_old_l
65
   );
66
 
67
   input       rclk,
68
               se,
69
               si,
70
               erb_reset;
71
 
72
   input [42:0] itlb_rd_tte_data;   // this is in s1
73
   input [58:0] itlb_rd_tte_tag;    // this is in s1
74
   input [39:10] itlb_ifq_paddr_s;
75
   input [33:0] wsel_fdp_fetdata_s1,
76
                            wsel_fdp_topdata_s1;
77
   input [33:0] wsel_erb_asidata_s;
78
 
79 113 albert.wat
   input [`IC_TAG_ALL_HI:0] ict_itlb_tags_f;
80 95 fafa1971
   input [3:0]              icv_itlb_valid_f;
81
 
82
   input [47:4]  lsu_ifu_err_addr;
83
   input [39:4]  spu_ifu_err_addr_w2;
84
   input [47:0]  fdp_erb_pc_f;
85
 
86
   input [7:0]   exu_ifu_err_reg_m;
87
   input [7:0]   exu_ifu_err_synd_m;
88
   input [5:0]   ffu_ifu_err_reg_w2;
89
   input [13:0]  ffu_ifu_err_synd_w2;
90
   input [5:0]   tlu_itlb_rw_index_g;
91
 
92
   input         erc_erd_pgsz_b0,
93
                 erc_erd_pgsz_b1;
94
 
95
   input [1:0]   erc_erd_erren_asidata;
96
   input [22:0]  erc_erd_errstat_asidata;
97
   input [31:0]  erc_erd_errinj_asidata;
98
   input [47:0]  ifq_erb_asidata_i2;
99
 
100 113 albert.wat
   input [`IC_TAG_SZ-1:0] ifq_erb_wrtag_f;
101
   input [`IC_IDX_HI:4]   ifq_erb_wrindex_f;
102 95 fafa1971
 
103
   // mux selects
104
   input [3:0]  erc_erd_asiway_s1_l;
105
   input        fcl_erb_itlbrd_data_s;
106
   input        erc_erd_ld_imask;
107
 
108
   input        erc_erd_asisrc_sel_icd_s_l,
109
                            erc_erd_asisrc_sel_misc_s_l,
110
                            erc_erd_asisrc_sel_err_s_l,
111
                            erc_erd_asisrc_sel_itlb_s_l;
112
 
113
   input        erc_erd_errasi_sel_en_l,
114
                            erc_erd_errasi_sel_stat_l,
115
                            erc_erd_errasi_sel_inj_l,
116
                            erc_erd_errasi_sel_addr_l;
117
 
118
   input        erc_erd_miscasi_sel_ict_l,
119
                            erc_erd_miscasi_sel_imask_l,
120
                            erc_erd_miscasi_sel_other_l;
121
 
122
   input [3:0]  erc_erd_asi_thr_l;
123
 
124
   input [3:0]  erc_erd_eadr0_sel_irf_l,
125
                            erc_erd_eadr0_sel_itlb_l,
126
                            erc_erd_eadr0_sel_frf_l,
127
                            erc_erd_eadr0_sel_lsu_l;
128
 
129
   input [3:0]  erc_erd_eadr1_sel_pcd1_l,
130
                            erc_erd_eadr1_sel_l1pa_l,
131
                            erc_erd_eadr1_sel_l2pa_l,
132
                            erc_erd_eadr1_sel_other_l;
133
 
134
   input [3:0]  erc_erd_eadr2_sel_mx1_l,
135
                            erc_erd_eadr2_sel_wrt_l,
136
                            erc_erd_eadr2_sel_mx0_l,
137
                            erc_erd_eadr2_sel_old_l;
138
 
139
 
140
   output       so;
141
   output [63:0] ifu_lsu_ldxa_data_w2;
142
   output [38:0] erb_dtu_imask;
143
//   output [9:0]  erb_ifq_paddr_s;
144
 
145
   output [1:0]  erd_erc_tlbt_pe_s1,
146
                             erd_erc_tlbd_pe_s1;
147
   output [3:0]  erd_erc_tagpe_s1;
148
   output        erd_erc_nirpe_s1,
149
                             erd_erc_fetpe_s1;
150
 
151
   output [2:0]  erd_erc_tte_pgsz;
152
 
153
 
154
//   
155
// local signals   
156
//
157
 
158
   wire [47:4]   lsu_err_addr;
159
 
160 113 albert.wat
   wire [`IC_TAG_ALL_HI:0]  ictags_s1;
161 95 fafa1971
   wire [3:0]               icv_data_s1;
162
   wire [31:0]              tag_asi_data;
163
 
164
   wire [47:4]              t0_eadr_mx0_out,
165
                                        t1_eadr_mx0_out,
166
                                        t2_eadr_mx0_out,
167
                                        t3_eadr_mx0_out,
168
                                        t0_eadr_mx1_out,
169
                                        t1_eadr_mx1_out,
170
                                        t2_eadr_mx1_out,
171
                                        t3_eadr_mx1_out;
172
 
173
   wire [47:4]              t0_err_addr_nxt,
174
                                        t0_err_addr,
175
                                        t1_err_addr_nxt,
176
                                        t1_err_addr,
177
                                        t2_err_addr_nxt,
178
                                        t2_err_addr,
179
                                        t3_err_addr_nxt,
180
                                        t3_err_addr;
181
 
182
   wire [47:4]              err_addr_asidata;
183
 
184
   wire [63:0]              formatted_tte_data,
185
                                        formatted_tte_tag,
186
                                        tlb_asi_data,
187
                                        misc_asi_data,
188
                                        err_asi_data,
189
                            ldxa_data_s,
190
                            ldxa_data_d;
191
 
192
   wire [39:4]              paddr_s1,
193
                                        paddr_d1;
194
 
195
   wire [39:4]              ifet_addr_f;
196
 
197
   wire [47:0]              pc_s1;
198
   wire [47:4]              pc_d1;
199
   wire [7:0]               irfaddr_w,
200
                            irfsynd_w;
201
   wire                     irfaddr_4_w;
202
   wire [5:0]               itlb_asi_index;
203
 
204
   wire [38:0]              imask_next;
205
 
206
   wire                     clk;
207
 
208
 
209
//
210
// Code Begins Here
211
//
212
   assign                   clk = rclk;
213
 
214
//-------------
215
// Tags
216
//-------------   
217 113 albert.wat
   dff_s #(`IC_TAG_ALL) tags_reg(.din (ict_itlb_tags_f),
218 95 fafa1971
                                           .q   (ictags_s1),
219
                                           .clk (clk),
220 113 albert.wat
                                           .se  (se), `SIMPLY_RISC_SCANIN, .so());
221 95 fafa1971
 
222 113 albert.wat
   dff_s #(4) vbits_reg(.din (icv_itlb_valid_f[3:0]),
223 95 fafa1971
                                  .q   (icv_data_s1),
224 113 albert.wat
                                  .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
225 95 fafa1971
 
226
   // check parity
227 113 albert.wat
   sparc_ifu_par32  tag_par0(.in  ({3'b0, ictags_s1[`IC_TAG_SZ:0]}),
228 95 fafa1971
                                               .out (erd_erc_tagpe_s1[0]));
229 113 albert.wat
   sparc_ifu_par32  tag_par1(.in  ({3'b0, ictags_s1[((2*`IC_TAG_SZ) + 1):(`IC_TAG_SZ+1)]}),
230 95 fafa1971
                                               .out (erd_erc_tagpe_s1[1]));
231 113 albert.wat
   sparc_ifu_par32  tag_par2(.in  ({3'b0, ictags_s1[((3*`IC_TAG_SZ) + 2):(2*(`IC_TAG_SZ)+2)]}),
232 95 fafa1971
                                               .out (erd_erc_tagpe_s1[2]));
233 113 albert.wat
   sparc_ifu_par32  tag_par3(.in  ({3'b0, ictags_s1[((4*`IC_TAG_SZ) + 3):(3*(`IC_TAG_SZ)+3)]}),
234 95 fafa1971
                                               .out (erd_erc_tagpe_s1[3]));
235
 
236
   dp_mux4ds #(32) asitag_mux(.dout (tag_asi_data[31:0]),
237
                         .in0  ({icv_data_s1[0], 1'b0, ictags_s1[28], 1'b0, ictags_s1[27:0]}),
238
                         .in1  ({icv_data_s1[1], 1'b0, ictags_s1[57], 1'b0, ictags_s1[56:29]}),
239
                         .in2  ({icv_data_s1[2], 1'b0, ictags_s1[86], 1'b0, ictags_s1[85:58]}),
240
                         .in3  ({icv_data_s1[3], 1'b0, ictags_s1[115], 1'b0, ictags_s1[114:87]}),
241
                         .sel0_l (erc_erd_asiway_s1_l[0]),
242
                         .sel1_l (erc_erd_asiway_s1_l[1]),
243
                         .sel2_l (erc_erd_asiway_s1_l[2]),
244
                         .sel3_l (erc_erd_asiway_s1_l[3]));
245
 
246
//------------------
247
// Data
248
//------------------
249
   // parity check on instruction
250
   // This may have to be done in the next stage (at least partially)
251
 
252
   sparc_ifu_par34 nir_par(.in  (wsel_fdp_topdata_s1[33:0]),
253
                                             .out (erd_erc_nirpe_s1));
254
   sparc_ifu_par34 inst_par(.in  (wsel_fdp_fetdata_s1[33:0]),
255
                                              .out (erd_erc_fetpe_s1));
256
 
257
//----------------------------------------------------------------------
258
// TLB read data
259
//----------------------------------------------------------------------
260
 
261
//`ifdef SPARC_HPV_EN
262
   // don't include v(26) and u(24) bits in parity   
263
   sparc_ifu_par32 tt_tag_par0(.in  ({itlb_rd_tte_tag[33:27],
264
                                                              itlb_rd_tte_tag[25],
265
                                                              itlb_rd_tte_tag[23:0]}),
266
                                                 .out (erd_erc_tlbt_pe_s1[0]));
267
//`else
268
//   // don't include v(28) and u(26) bits in parity
269
//   sparc_ifu_par32 tt_tag_par0(.in  ({itlb_rd_tte_tag[33:29],
270
//                                                            itlb_rd_tte_tag[27],
271
//                                                            itlb_rd_tte_tag[25:0]}),
272
//                                               .out (erd_erc_tlbt_pe_s1[0]));
273
//`endif // !`ifdef SPARC_HPV_EN
274
 
275
 
276
   sparc_ifu_par32 tt_tag_par1(.in  ({7'b0, itlb_rd_tte_tag[58:34]}),
277
                                                 .out (erd_erc_tlbt_pe_s1[1]));
278
 
279
   sparc_ifu_par32 tt_data_par0(.in  (itlb_rd_tte_data[31:0]),
280
                                                        .out (erd_erc_tlbd_pe_s1[0]));
281
   sparc_ifu_par16 tt_data_par1(.in  ({5'b0, itlb_rd_tte_data[42:32]}),
282
                                                        .out (erd_erc_tlbd_pe_s1[1]));
283
 
284
//   assign erd_erc_tte_lock_s1 = itlb_rd_tte_data[`STLB_DATA_L];
285
 
286
 
287
//`ifdef        SPARC_HPV_EN
288 113 albert.wat
   assign erd_erc_tte_pgsz[2:0] = {itlb_rd_tte_data[`STLB_DATA_27_22_SEL],
289
                                                           itlb_rd_tte_data[`STLB_DATA_21_16_SEL],
290
                                                           itlb_rd_tte_data[`STLB_DATA_15_13_SEL]};
291 95 fafa1971
 
292
   assign formatted_tte_tag[63:0] =
293
          {
294
//           `ifdef SUN4V_TAG_RD
295
           // implement this!
296
           itlb_rd_tte_tag[58:55],
297
//           `else
298
//         {4{itlb_rd_tte_tag[53]}},                                     // 4b
299
//           `endif
300
 
301 113 albert.wat
           itlb_rd_tte_tag[`STLB_TAG_PARITY],     // Parity                 1b
302
           itlb_rd_tte_tag[`STLB_TAG_VA_27_22_V], // mxsel2 - b27:22 vld    1b
303
           itlb_rd_tte_tag[`STLB_TAG_VA_21_16_V], // mxsel1 - b21:16 vld    1b
304
           itlb_rd_tte_tag[`STLB_TAG_VA_15_13_V], // mxsel0 - b15:13 vld    1b
305 95 fafa1971
 
306
           {8{itlb_rd_tte_tag[53]}},                                     // 8b
307 113 albert.wat
           itlb_rd_tte_tag[`STLB_TAG_VA_47_28_HI:`STLB_TAG_VA_47_28_LO], // 20b
308
           itlb_rd_tte_tag[`STLB_TAG_VA_27_22_HI:`STLB_TAG_VA_27_22_LO], // 6b
309
           itlb_rd_tte_tag[`STLB_TAG_VA_21_16_HI:`STLB_TAG_VA_21_16_LO], // 6b
310
           itlb_rd_tte_tag[`STLB_TAG_VA_15_13_HI:`STLB_TAG_VA_15_13_LO], // 3b
311
           itlb_rd_tte_tag[`STLB_TAG_CTXT_12_0_HI:`STLB_TAG_CTXT_12_0_LO]// 13b
312 95 fafa1971
           } ;
313
//`else
314
//   assign erd_erc_tte_pgsz[2:0] = {itlb_rd_tte_data[`STLB_DATA_21_19_SEL],
315
//                                                         itlb_rd_tte_data[`STLB_DATA_18_16_SEL],
316
//                                                         itlb_rd_tte_data[`STLB_DATA_15_13_SEL]};
317
//
318
//   assign formatted_tte_tag[63:0] =
319
//          {
320
//           {16{itlb_rd_tte_tag[54]}},                                    // 16b
321
//           itlb_rd_tte_tag[`STLB_TAG_VA_47_22_HI:`STLB_TAG_VA_47_22_LO], // 26b
322
//           itlb_rd_tte_tag[`STLB_TAG_VA_21_20_HI:`STLB_TAG_VA_21_20_LO], // 3b
323
//           itlb_rd_tte_tag[`STLB_TAG_VA_19],
324
//           itlb_rd_tte_tag[`STLB_TAG_VA_18_17_HI:`STLB_TAG_VA_18_17_LO], // 3b
325
//           itlb_rd_tte_tag[`STLB_TAG_VA_16],
326
//           itlb_rd_tte_tag[`STLB_TAG_VA_15_14_HI:`STLB_TAG_VA_15_14_LO], // 3b
327
//           itlb_rd_tte_tag[`STLB_TAG_VA_13],
328
//           itlb_rd_tte_tag[`STLB_TAG_CTXT_12_7_HI:`STLB_TAG_CTXT_12_7_LO],//13b
329
//           itlb_rd_tte_tag[`STLB_TAG_CTXT_6_0_HI:`STLB_TAG_CTXT_6_0_LO]
330
//           } ;
331
//`endif // !`ifdef SPARC_HPV_EN
332
 
333
 
334
//`ifdef        SPARC_HPV_EN
335
   assign formatted_tte_data[63:0] =
336
          {
337 113 albert.wat
           itlb_rd_tte_tag[`STLB_TAG_V],           // V    (1b)
338 95 fafa1971
           erc_erd_pgsz_b1,                        // pg SZ msb 4m or 512k
339
           erc_erd_pgsz_b0,                        // pg sz lsb 4m or 64k
340 113 albert.wat
           itlb_rd_tte_data[`STLB_DATA_NFO],       // NFO  (1b)
341
           itlb_rd_tte_data[`STLB_DATA_IE],        // IE   (1b)
342 95 fafa1971
           10'b0,                                  // soft2 
343 113 albert.wat
           itlb_rd_tte_data[`STLB_DATA_27_22_SEL], // pgsz b2
344
           itlb_rd_tte_tag[`STLB_TAG_U],
345 95 fafa1971
 
346 113 albert.wat
           itlb_rd_tte_data[`STLB_DATA_PARITY],      // Parity   (1b)
347
           itlb_rd_tte_data[`STLB_DATA_27_22_SEL],   // mxsel2_l (1b)
348
           itlb_rd_tte_data[`STLB_DATA_21_16_SEL],   // mxsel1_l (1b)
349
           itlb_rd_tte_data[`STLB_DATA_15_13_SEL],   // mxsel0_l (1b)
350 95 fafa1971
 
351
           2'b0,                                   // unused diag 2b
352
           1'b0,                                   // ?? PA   (28b)
353 113 albert.wat
           itlb_rd_tte_data[`STLB_DATA_PA_39_28_HI:`STLB_DATA_PA_39_28_LO],
354
           itlb_rd_tte_data[`STLB_DATA_PA_27_22_HI:`STLB_DATA_PA_27_22_LO],
355
           itlb_rd_tte_data[`STLB_DATA_PA_21_16_HI:`STLB_DATA_PA_21_16_LO],
356
           itlb_rd_tte_data[`STLB_DATA_PA_15_13_HI:`STLB_DATA_PA_15_13_LO],
357 95 fafa1971
           6'b0,                                   // ?? 12-7 (6b)
358 113 albert.wat
           itlb_rd_tte_data[`STLB_DATA_L],         // L    (1b)
359
           itlb_rd_tte_data[`STLB_DATA_CP],        // CP   (1b)
360
           itlb_rd_tte_data[`STLB_DATA_CV],        // CV   (1b)
361
           itlb_rd_tte_data[`STLB_DATA_E],         // E    (1b)
362
           itlb_rd_tte_data[`STLB_DATA_P],         // P    (1b)
363
           itlb_rd_tte_data[`STLB_DATA_W],         // W    (1b)
364 95 fafa1971
                 1'b0
365
        } ;
366
//`else // !`ifdef SPARC_HPV_EN
367
//
368
//   assign formatted_tte_data[63:0] =
369
//          {      
370
//           itlb_rd_tte_tag[`STLB_TAG_V],           // V    (1b)
371
//           erc_erd_pgsz_b1,                        // pg SZ msb 4m or 512k
372
//           erc_erd_pgsz_b0,                        // pg sz lsb 4m or 64k
373
//           itlb_rd_tte_data[`STLB_DATA_NFO],       // NFO  (1b)
374
//           itlb_rd_tte_data[`STLB_DATA_IE],        // IE   (1b)
375
//           9'b0,                                   // soft2 58-42 (17b)
376
//           8'b0,                                   // diag 8b
377
//               itlb_rd_tte_tag[`STLB_TAG_U],           // U    (1b)
378
//           1'b0,                                   // ?? PA   (28b)
379
//           itlb_rd_tte_data[`STLB_DATA_PA_39_22_HI:`STLB_DATA_PA_39_22_LO],
380
//           itlb_rd_tte_data[`STLB_DATA_PA_21_19_HI:`STLB_DATA_PA_21_19_LO],
381
//           itlb_rd_tte_data[`STLB_DATA_PA_18_16_HI:`STLB_DATA_PA_18_16_LO],
382
//           itlb_rd_tte_data[`STLB_DATA_PA_15_13_HI:`STLB_DATA_PA_15_13_LO],
383
//           6'b0,                                   // ?? 12-7 (6b)
384
//           itlb_rd_tte_data[`STLB_DATA_L],         // L    (1b)
385
//           itlb_rd_tte_data[`STLB_DATA_CP],        // CP   (1b)
386
//           itlb_rd_tte_data[`STLB_DATA_CV],        // CV   (1b)
387
//           itlb_rd_tte_data[`STLB_DATA_E],         // E    (1b)
388
//           itlb_rd_tte_data[`STLB_DATA_P],         // P    (1b)
389
//           itlb_rd_tte_data[`STLB_DATA_W],         // W    (1b)
390
//           itlb_rd_tte_data[`STLB_DATA_G]          // G    (1b)
391
//        } ;
392
//`endif // !`ifdef SPARC_HPV_EN
393
 
394
 
395
 
396
   // mux in all asi values
397
   dp_mux2es #(64) itlbrd_mux(.dout (tlb_asi_data[63:0]),
398
                            .in0  (formatted_tte_tag[63:0]),
399
                            .in1  (formatted_tte_data[63:0]),
400
                            .sel  (fcl_erb_itlbrd_data_s));
401
 
402
   dp_mux4ds #(64) err_mux(.dout (err_asi_data[63:0]),
403
                         .in0  ({62'b0, erc_erd_erren_asidata}),
404
                         .in1  ({32'b0, erc_erd_errstat_asidata, 9'b0}),
405
                         .in2  ({32'b0, erc_erd_errinj_asidata}),
406
                         .in3  ({16'b0, err_addr_asidata, 4'b0}),
407
                         .sel0_l (erc_erd_errasi_sel_en_l),
408
                         .sel1_l (erc_erd_errasi_sel_stat_l),
409
                         .sel2_l (erc_erd_errasi_sel_inj_l),
410
                         .sel3_l (erc_erd_errasi_sel_addr_l));
411
 
412
   dp_mux3ds #(64) misc_asi_mux(.dout (misc_asi_data[63:0]),
413
                              .in0  ({29'b0,
414
                                            tag_asi_data[31:28],
415
                                            3'b0,
416
                                            tag_asi_data[27:0]}),
417
                              .in1  ({25'b0, erb_dtu_imask}),
418
                              .in2  (64'b0),
419
                              .sel0_l (erc_erd_miscasi_sel_ict_l),
420
                              .sel1_l (erc_erd_miscasi_sel_imask_l),
421
                              .sel2_l (erc_erd_miscasi_sel_other_l));
422
 
423
   // Final asi data
424
   // May need to add a flop to this mux output before sending it to the LSU
425
   dp_mux4ds #(64) final_asi_mux(.dout (ldxa_data_s),
426
                               .in0  (tlb_asi_data[63:0]),
427
                               .in1  (err_asi_data),
428
                               .in2  (misc_asi_data),
429
                               .in3  ({30'b0,
430
                                             wsel_erb_asidata_s[0],
431
                                             wsel_erb_asidata_s[33:1]}),
432
                               .sel0_l (erc_erd_asisrc_sel_itlb_s_l),
433
                               .sel1_l (erc_erd_asisrc_sel_err_s_l),
434
                               .sel2_l (erc_erd_asisrc_sel_misc_s_l),
435
                               .sel3_l (erc_erd_asisrc_sel_icd_s_l));
436
 
437 113 albert.wat
   dff_s #(64) ldxa_reg(.din (ldxa_data_s),
438 95 fafa1971
                      .q   (ldxa_data_d),
439 113 albert.wat
                      .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
440 95 fafa1971
   assign ifu_lsu_ldxa_data_w2 = ldxa_data_d;
441
 
442
 
443
//----------------------------------------
444
// Error Address
445
//----------------------------------------   
446
 
447 113 albert.wat
   assign ifet_addr_f = {ifq_erb_wrtag_f[`IC_TAG_SZ-1:0],
448
                         ifq_erb_wrindex_f[`IC_IDX_HI:4]};
449 95 fafa1971
 
450
   // pc of latest access
451 113 albert.wat
   dff_s #(48) pcs1_reg(.din (fdp_erb_pc_f[47:0]),
452 95 fafa1971
                                  .q   (pc_s1[47:0]),
453 113 albert.wat
                                  .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
454 95 fafa1971
 
455
   // Physical address
456
   assign paddr_s1[39:10] = itlb_ifq_paddr_s[39:10];
457
   assign paddr_s1[9:4]   = pc_s1[9:4];
458 113 albert.wat
   dff_s #(36) padd_reg(.din (paddr_s1[39:4]),
459 95 fafa1971
                                  .q   (paddr_d1[39:4]),
460 113 albert.wat
                                  .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
461 95 fafa1971
 
462
//   assign erb_ifq_paddr_s[9:0] = pc_s1[9:0];
463
 
464
   // stage PC one more cycle
465 113 albert.wat
   dff_s #(44) pcd1_reg(.din (pc_s1[47:4]),
466 95 fafa1971
                                  .q   (pc_d1[47:4]),
467 113 albert.wat
                                  .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
468 95 fafa1971
 
469
   // IRF address
470 113 albert.wat
   dff_s #(16) irf_reg(.din ({exu_ifu_err_reg_m[7:0],
471 95 fafa1971
                            exu_ifu_err_synd_m[7:0]}),
472
                                 .q   ({irfaddr_w[7:5],
473
                            irfaddr_4_w,
474
                            irfaddr_w[3:0],
475
                            irfsynd_w[7:0]}),
476 113 albert.wat
                                 .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
477 95 fafa1971
 
478
   // fix for bug 5594
479
   // nand2 + xnor
480
   assign irfaddr_w[4] = irfaddr_4_w ^ (irfaddr_w[5] & irfaddr_w[3]);
481
 
482
   // itlb asi address
483 113 albert.wat
   dff_s #(6) itlbidx_reg(.din (tlu_itlb_rw_index_g),
484 95 fafa1971
                        .q   (itlb_asi_index),
485 113 albert.wat
                        .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
486 95 fafa1971
 
487
 
488
   // lsu error address
489 113 albert.wat
   dff_s #(44) lsadr_reg(.din (lsu_ifu_err_addr),
490 95 fafa1971
                       .q   (lsu_err_addr),
491 113 albert.wat
                       .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
492 95 fafa1971
 
493
 
494
   // mux in the different error addresses
495
   // thread 0
496
   dp_mux4ds #(44) t0_eadr_mx0(.dout  (t0_eadr_mx0_out),
497
                             .in0   ({24'b0, irfsynd_w[7:0], 4'b0, irfaddr_w[7:0]}),
498
                             .in1   ({38'b0, itlb_asi_index}),
499
                             .in2   ({17'b0, ffu_ifu_err_synd_w2[13:7],
500
                    1'b0, ffu_ifu_err_synd_w2[6:0],
501
                    6'b0, ffu_ifu_err_reg_w2[5:0]}),
502
                             .in3   (lsu_err_addr),
503
                             .sel0_l (erc_erd_eadr0_sel_irf_l[0]),
504
                             .sel1_l (erc_erd_eadr0_sel_itlb_l[0]),
505
                             .sel2_l (erc_erd_eadr0_sel_frf_l[0]),
506
                             .sel3_l (erc_erd_eadr0_sel_lsu_l[0]));
507
 
508
   dp_mux4ds #(44) t0_eadr_mx1(.dout  (t0_eadr_mx1_out),
509
                             .in0   (pc_d1[47:4]),
510
                             .in1   ({8'b0, paddr_d1[39:4]}),
511
                             .in2   ({8'b0, ifet_addr_f}),
512
                             .in3   ({8'b0, spu_ifu_err_addr_w2[39:4]}),
513
                             .sel0_l (erc_erd_eadr1_sel_pcd1_l[0]),
514
                             .sel1_l (erc_erd_eadr1_sel_l1pa_l[0]),
515
                             .sel2_l (erc_erd_eadr1_sel_l2pa_l[0]),
516
                             .sel3_l (erc_erd_eadr1_sel_other_l[0]));
517
 
518
   dp_mux4ds #(44) t0_eadr_mx2(.dout  (t0_err_addr_nxt),
519
                             .in0   (t0_eadr_mx0_out),
520
                             .in1   (t0_eadr_mx1_out),
521
                             .in2   (ifq_erb_asidata_i2[47:4]),
522
                             .in3   (t0_err_addr),
523
                             .sel0_l (erc_erd_eadr2_sel_mx0_l[0]),
524
                             .sel1_l (erc_erd_eadr2_sel_mx1_l[0]),
525
                             .sel2_l (erc_erd_eadr2_sel_wrt_l[0]),
526
                             .sel3_l (erc_erd_eadr2_sel_old_l[0]));
527
 
528 113 albert.wat
   dff_s #(44) t0_eadr_reg(.din (t0_err_addr_nxt),
529 95 fafa1971
                       .q   (t0_err_addr),
530 113 albert.wat
                       .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
531 95 fafa1971
 
532 113 albert.wat
`ifdef FPGA_SYN_1THREAD
533
        assign err_addr_asidata = t0_err_addr;
534
`else
535 95 fafa1971
   // thread 1
536
   dp_mux4ds #(44) t1_eadr_mx0(.dout  (t1_eadr_mx0_out),
537
                             .in0   ({24'b0, irfsynd_w[7:0], 4'b0, irfaddr_w[7:0]}),
538
                             .in1   ({38'b0, itlb_asi_index}),
539
                             .in2   ({17'b0, ffu_ifu_err_synd_w2[13:7],
540
                    1'b0, ffu_ifu_err_synd_w2[6:0],
541
                    6'b0, ffu_ifu_err_reg_w2[5:0]}),
542
                             .in3   (lsu_err_addr),
543
                             .sel0_l (erc_erd_eadr0_sel_irf_l[1]),
544
                             .sel1_l (erc_erd_eadr0_sel_itlb_l[1]),
545
                             .sel2_l (erc_erd_eadr0_sel_frf_l[1]),
546
                             .sel3_l (erc_erd_eadr0_sel_lsu_l[1]));
547
 
548
   dp_mux4ds #(44) t1_eadr_mx1(.dout  (t1_eadr_mx1_out),
549
                             .in0   (pc_d1[47:4]),
550
                             .in1   ({8'b0, paddr_d1[39:4]}),
551
                             .in2   ({8'b0, ifet_addr_f}),
552
                             .in3   ({8'b0, spu_ifu_err_addr_w2[39:4]}),
553
//                           .in3   ({44'b0}),
554
                             .sel0_l (erc_erd_eadr1_sel_pcd1_l[1]),
555
                             .sel1_l (erc_erd_eadr1_sel_l1pa_l[1]),
556
                             .sel2_l (erc_erd_eadr1_sel_l2pa_l[1]),
557
                             .sel3_l (erc_erd_eadr1_sel_other_l[1]));
558
 
559
   dp_mux4ds #(44) t1_eadr_mx2(.dout  (t1_err_addr_nxt),
560
                             .in0   (t1_eadr_mx0_out),
561
                             .in1   (t1_eadr_mx1_out),
562
                             .in2   (ifq_erb_asidata_i2[47:4]),
563
                             .in3   (t1_err_addr),
564
                             .sel0_l (erc_erd_eadr2_sel_mx0_l[1]),
565
                             .sel1_l (erc_erd_eadr2_sel_mx1_l[1]),
566
                             .sel2_l (erc_erd_eadr2_sel_wrt_l[1]),
567
                             .sel3_l (erc_erd_eadr2_sel_old_l[1]));
568
 
569 113 albert.wat
   dff_s #(44) t1_eadr_reg(.din (t1_err_addr_nxt),
570 95 fafa1971
                       .q   (t1_err_addr),
571 113 albert.wat
                       .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
572 95 fafa1971
 
573
   // thread 2
574
   dp_mux4ds #(44) t2_eadr_mx0(.dout  (t2_eadr_mx0_out),
575
                             .in0   ({24'b0, irfsynd_w[7:0], 4'b0, irfaddr_w[7:0]}),
576
                             .in1   ({38'b0, itlb_asi_index}),
577
                             .in2   ({17'b0, ffu_ifu_err_synd_w2[13:7],
578
                    1'b0, ffu_ifu_err_synd_w2[6:0],
579
                    6'b0, ffu_ifu_err_reg_w2[5:0]}),
580
                             .in3   (lsu_err_addr),
581
                             .sel0_l (erc_erd_eadr0_sel_irf_l[2]),
582
                             .sel1_l (erc_erd_eadr0_sel_itlb_l[2]),
583
                             .sel2_l (erc_erd_eadr0_sel_frf_l[2]),
584
                             .sel3_l (erc_erd_eadr0_sel_lsu_l[2]));
585
 
586
   dp_mux4ds #(44) t2_eadr_mx1(.dout  (t2_eadr_mx1_out),
587
                             .in0   (pc_d1[47:4]),
588
                             .in1   ({8'b0, paddr_d1[39:4]}),
589
                             .in2   ({8'b0, ifet_addr_f}),
590
                             .in3   ({8'b0, spu_ifu_err_addr_w2[39:4]}),
591
//                           .in3   ({44'b0}),
592
                             .sel0_l (erc_erd_eadr1_sel_pcd1_l[2]),
593
                             .sel1_l (erc_erd_eadr1_sel_l1pa_l[2]),
594
                             .sel2_l (erc_erd_eadr1_sel_l2pa_l[2]),
595
                             .sel3_l (erc_erd_eadr1_sel_other_l[2]));
596
 
597
   dp_mux4ds #(44) t2_eadr_mx2(.dout  (t2_err_addr_nxt),
598
                             .in0   (t2_eadr_mx0_out),
599
                             .in1   (t2_eadr_mx1_out),
600
                             .in2   (ifq_erb_asidata_i2[47:4]),
601
                             .in3   (t2_err_addr),
602
                             .sel0_l (erc_erd_eadr2_sel_mx0_l[2]),
603
                             .sel1_l (erc_erd_eadr2_sel_mx1_l[2]),
604
                             .sel2_l (erc_erd_eadr2_sel_wrt_l[2]),
605
                             .sel3_l (erc_erd_eadr2_sel_old_l[2]));
606
 
607 113 albert.wat
   dff_s #(44) t2_eadr_reg(.din (t2_err_addr_nxt),
608 95 fafa1971
                       .q   (t2_err_addr),
609 113 albert.wat
                       .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
610 95 fafa1971
 
611
   // thread 3
612
   dp_mux4ds #(44) t3_eadr_mx0(.dout  (t3_eadr_mx0_out),
613
                             .in0   ({24'b0, irfsynd_w[7:0], 4'b0, irfaddr_w[7:0]}),
614
                             .in1   ({38'b0, itlb_asi_index}),
615
                             .in2   ({17'b0, ffu_ifu_err_synd_w2[13:7],
616
                    1'b0, ffu_ifu_err_synd_w2[6:0],
617
                    6'b0, ffu_ifu_err_reg_w2[5:0]}),
618
                             .in3   (lsu_err_addr),
619
                             .sel0_l (erc_erd_eadr0_sel_irf_l[3]),
620
                             .sel1_l (erc_erd_eadr0_sel_itlb_l[3]),
621
                             .sel2_l (erc_erd_eadr0_sel_frf_l[3]),
622
                             .sel3_l (erc_erd_eadr0_sel_lsu_l[3]));
623
 
624
   dp_mux4ds #(44) t3_eadr_mx1(.dout  (t3_eadr_mx1_out),
625
                             .in0   (pc_d1[47:4]),
626
                             .in1   ({8'b0, paddr_d1[39:4]}),
627
                             .in2   ({8'b0, ifet_addr_f}),
628
                             .in3   ({8'b0, spu_ifu_err_addr_w2[39:4]}),
629
//                           .in3   ({44'b0}),
630
                             .sel0_l (erc_erd_eadr1_sel_pcd1_l[3]),
631
                             .sel1_l (erc_erd_eadr1_sel_l1pa_l[3]),
632
                             .sel2_l (erc_erd_eadr1_sel_l2pa_l[3]),
633
                             .sel3_l (erc_erd_eadr1_sel_other_l[3]));
634
 
635
   dp_mux4ds #(44) t3_eadr_mx2(.dout  (t3_err_addr_nxt),
636
                             .in0   (t3_eadr_mx0_out),
637
                             .in1   (t3_eadr_mx1_out),
638
                             .in2   (ifq_erb_asidata_i2[47:4]),
639
                             .in3   (t3_err_addr),
640
                             .sel0_l (erc_erd_eadr2_sel_mx0_l[3]),
641
                             .sel1_l (erc_erd_eadr2_sel_mx1_l[3]),
642
                             .sel2_l (erc_erd_eadr2_sel_wrt_l[3]),
643
                             .sel3_l (erc_erd_eadr2_sel_old_l[3]));
644
 
645 113 albert.wat
   dff_s #(44) t3_eadr_reg(.din (t3_err_addr_nxt),
646 95 fafa1971
                       .q   (t3_err_addr),
647 113 albert.wat
                       .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
648 95 fafa1971
 
649
 
650
   // asi read
651
   dp_mux4ds #(44) asi_eadr_mx(.dout (err_addr_asidata),
652
                             .in0  (t0_err_addr),
653
                             .in1  (t1_err_addr),
654
                             .in2  (t2_err_addr),
655
                             .in3  (t3_err_addr),
656
                             .sel0_l (erc_erd_asi_thr_l[0]),
657
                             .sel1_l (erc_erd_asi_thr_l[1]),
658
                             .sel2_l (erc_erd_asi_thr_l[2]),
659
                             .sel3_l (erc_erd_asi_thr_l[3]));
660 113 albert.wat
`endif
661 95 fafa1971
 
662
   // Instruction Mask
663
   dp_mux2es #(39) imask_en_mux(.dout (imask_next),
664
                              .in0  (erb_dtu_imask),
665
                              .in1  (ifq_erb_asidata_i2[38:0]),
666
                              .sel  (erc_erd_ld_imask));
667
 
668
   // need to reset top 7 bits only
669 113 albert.wat
   dffr_s #(39) imask_reg(.din (imask_next),
670 95 fafa1971
                      .q   (erb_dtu_imask),
671
                      .rst (erb_reset),
672 113 albert.wat
                      .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
673 95 fafa1971
 
674
   sink #(4) s0(.in (pc_s1[3:0]));
675
 
676
endmodule // sparc_ifu_erb
677
 

powered by: WebSVN 2.1.0

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