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

Subversion Repositories s1_core

[/] [s1_core/] [trunk/] [hdl/] [rtl/] [sparc_core/] [sparc_ifu_errctl.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_errctl.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_errctl
29
*/
30
////////////////////////////////////////////////////////////////////////
31
// Global header file includes
32
////////////////////////////////////////////////////////////////////////
33
 
34 113 albert.wat
`include "lsu.h"
35 95 fafa1971
 
36
module sparc_ifu_errctl(/*AUTOARG*/
37
   // Outputs
38
   erc_erd_pgsz_b0, erc_erd_pgsz_b1, ifu_lsu_asi_rd_unc,
39
   ifu_lsu_ldxa_tid_w2, ifu_lsu_ldxa_data_vld_w2,
40
   ifu_lsu_fwd_data_vld, ifu_lsu_error_inj, ifu_exu_ecc_mask,
41
   ifu_exu_inj_irferr, ifu_ffu_inj_frferr, ifu_exu_nceen_e,
42
   ifu_lsu_nceen, ifu_spu_nceen, erb_fcl_spu_uetrap,
43
   erb_ifq_itlberr_s1, erb_ifq_ifeterr_d1, erb_dtu_ifeterr_d1,
44
   erb_fcl_itlb_ce_d1, erb_fcl_ce_trapvec, erb_fcl_ue_trapvec,
45
   erb_fcl_ifet_uevec_d1, erc_erd_errstat_asidata,
46
   erc_erd_errinj_asidata, erc_erd_erren_asidata,
47
   erc_erd_eadr0_sel_irf_l, erc_erd_eadr0_sel_itlb_l,
48
   erc_erd_eadr0_sel_frf_l, erc_erd_eadr0_sel_lsu_l,
49
   erc_erd_asiway_s1_l, erc_erd_eadr1_sel_pcd1_l,
50
   erc_erd_eadr1_sel_l1pa_l, erc_erd_eadr1_sel_l2pa_l,
51
   erc_erd_eadr1_sel_other_l, erc_erd_eadr2_sel_mx1_l,
52
   erc_erd_eadr2_sel_wrt_l, erc_erd_eadr2_sel_mx0_l,
53
   erc_erd_eadr2_sel_old_l, erc_erd_asi_thr_l,
54
   erc_erd_asisrc_sel_icd_s_l, erc_erd_asisrc_sel_misc_s_l,
55
   erc_erd_asisrc_sel_err_s_l, erc_erd_asisrc_sel_itlb_s_l,
56
   erc_erd_errasi_sel_en_l, erc_erd_errasi_sel_stat_l,
57
   erc_erd_errasi_sel_inj_l, erc_erd_errasi_sel_addr_l,
58
   erc_erd_miscasi_sel_ict_l, erc_erd_miscasi_sel_imask_l,
59
   erc_erd_miscasi_sel_other_l, erc_erd_ld_imask, erb_reset, so,
60
   // Inputs
61
   rclk, se, si, arst_l, grst_l, erd_erc_tte_pgsz, icv_itlb_valid_f,
62
   fcl_erb_ievld_s1, fcl_erb_tevld_s1, fcl_erb_immuevld_s1,
63
   fcl_erb_inst_issue_d, fcl_erb_inst_vld_d1, ifu_tlu_inst_vld_w,
64
   ifu_lsu_thrid_s, fcl_erb_asi_tid_f, ifq_fcl_asi_tid_bf,
65
   fcl_erb_clear_iferr, fcl_erb_itlbrd_vld_s, fcl_erb_itlbrd_data_s,
66
   erd_erc_tagpe_s1, erd_erc_nirpe_s1, erd_erc_fetpe_s1,
67
   erd_erc_tlbt_pe_s1, erd_erc_tlbd_pe_s1, tlu_lsu_pstate_priv, tlu_hpstate_priv,
68
   lsu_ifu_dtlb_data_su, lsu_ifu_dtlb_data_ue, lsu_ifu_dtlb_tag_ue,
69
   lsu_ifu_dcache_data_perror, lsu_ifu_dcache_tag_perror,
70
   lsu_ifu_l2_unc_error, lsu_ifu_l2_corr_error, lsu_ifu_io_error,
71
   lsu_ifu_error_tid, spu_ifu_unc_err_w1, spu_ifu_mamem_err_w1,
72
   spu_ifu_corr_err_w2, spu_ifu_int_w2, spu_ifu_ttype_tid_w2,
73
   lsu_ifu_inj_ack, ffu_ifu_ecc_ce_w2, ffu_ifu_ecc_ue_w2,
74
   ffu_ifu_inj_ack, ffu_ifu_tid_w2, exu_ifu_ecc_ce_m,
75
   exu_ifu_ecc_ue_m, exu_ifu_inj_ack, ifq_erb_ue_rep, ifq_erb_ce_rep,
76
   ifq_erb_l2_ue, ifq_erb_io_ue, ifq_erb_ifet_ce, ifq_erb_l2err_tid,
77
   ifq_erb_rdtag_f, ifq_erb_rdinst_f, ifq_erb_asi_erren_i2,
78
   ifq_erb_asi_errstat_i2, ifq_erb_asi_errinj_i2,
79
   ifq_erb_asi_erraddr_i2, ifq_erb_asi_imask_i2, ifq_erb_asiwr_i2,
80
   ifq_fcl_asird_bf, ifq_erb_fwdrd_bf, ifq_erb_asidata_i2,
81
   ifq_erb_asiway_f
82
   );
83
 
84
   input        rclk,
85
                se,
86
                si,
87
                arst_l,
88
                grst_l;
89
 
90
   input [2:0]  erd_erc_tte_pgsz;
91
 
92
   input [3:0]  icv_itlb_valid_f;
93
 
94
   input        fcl_erb_ievld_s1,
95
                            fcl_erb_tevld_s1,
96
                            fcl_erb_immuevld_s1;
97
 
98
   input        fcl_erb_inst_issue_d;
99
   input        fcl_erb_inst_vld_d1;
100
 
101
   input        ifu_tlu_inst_vld_w;
102
 
103
   input [1:0]  ifu_lsu_thrid_s,
104
                            fcl_erb_asi_tid_f,
105
                            ifq_fcl_asi_tid_bf;
106
 
107
   input [3:0]  fcl_erb_clear_iferr;
108
 
109
   input        fcl_erb_itlbrd_vld_s,
110
                            fcl_erb_itlbrd_data_s;
111
 
112
   input [3:0]  erd_erc_tagpe_s1;
113
   input        erd_erc_nirpe_s1,
114
                            erd_erc_fetpe_s1;
115
   input [1:0]  erd_erc_tlbt_pe_s1,
116
                            erd_erc_tlbd_pe_s1;
117
 
118
   input [3:0]  tlu_lsu_pstate_priv;
119
   input [3:0]  tlu_hpstate_priv;
120
 
121
   input        lsu_ifu_dtlb_data_su,
122
                            lsu_ifu_dtlb_data_ue,
123
                            lsu_ifu_dtlb_tag_ue,
124
                            lsu_ifu_dcache_data_perror,
125
                            lsu_ifu_dcache_tag_perror,
126
                            lsu_ifu_l2_unc_error,
127
                            lsu_ifu_l2_corr_error,
128
                            lsu_ifu_io_error;
129
   input [1:0]  lsu_ifu_error_tid;
130
 
131
   input        spu_ifu_unc_err_w1,  // 1 cycle earlier for timing reasons
132
                spu_ifu_mamem_err_w1,// 1 cycle earlier for timing reasons
133
                spu_ifu_corr_err_w2,
134
                spu_ifu_int_w2;
135
 
136
   input [1:0]  spu_ifu_ttype_tid_w2;
137
 
138
   input [3:0]  lsu_ifu_inj_ack;
139
 
140
   input        ffu_ifu_ecc_ce_w2;
141
   input        ffu_ifu_ecc_ue_w2;
142
   input        ffu_ifu_inj_ack;
143
   input [1:0]  ffu_ifu_tid_w2;
144
 
145
   input        exu_ifu_ecc_ce_m,
146
                            exu_ifu_ecc_ue_m;
147
   input        exu_ifu_inj_ack;
148
 
149
   input        ifq_erb_ue_rep;
150
   input        ifq_erb_ce_rep;
151
   input        ifq_erb_l2_ue;
152
   input        ifq_erb_io_ue;
153
   input        ifq_erb_ifet_ce;
154
   input [1:0]  ifq_erb_l2err_tid;
155
 
156
   input        ifq_erb_rdtag_f;
157
   input        ifq_erb_rdinst_f;
158
   input        ifq_erb_asi_erren_i2;
159
   input        ifq_erb_asi_errstat_i2;
160
   input        ifq_erb_asi_errinj_i2;
161
   input        ifq_erb_asi_erraddr_i2;
162
   input        ifq_erb_asi_imask_i2;
163
   input        ifq_erb_asiwr_i2;
164
   input        ifq_fcl_asird_bf;
165
   input        ifq_erb_fwdrd_bf;
166
   input [31:0] ifq_erb_asidata_i2;
167
   input [1:0]  ifq_erb_asiway_f;
168
 
169
   output       erc_erd_pgsz_b0;
170
   output       erc_erd_pgsz_b1;
171
 
172
   output       ifu_lsu_asi_rd_unc;
173
   output [1:0] ifu_lsu_ldxa_tid_w2;
174
   output       ifu_lsu_ldxa_data_vld_w2;
175
   output       ifu_lsu_fwd_data_vld;
176
   output [3:0] ifu_lsu_error_inj;
177
 
178
   output [7:0] ifu_exu_ecc_mask;
179
   output       ifu_exu_inj_irferr;
180
   output       ifu_ffu_inj_frferr;
181
 
182
   output       ifu_exu_nceen_e;
183
   output [3:0] ifu_lsu_nceen;
184
   output [3:0] ifu_spu_nceen;  //  copy going north
185
 
186
   output [3:0] erb_fcl_spu_uetrap;
187
 
188
   output       erb_ifq_itlberr_s1;
189
   output       erb_ifq_ifeterr_d1;
190
   output       erb_dtu_ifeterr_d1;
191
   output       erb_fcl_itlb_ce_d1;
192
   output [3:0] erb_fcl_ce_trapvec;
193
   output [3:0] erb_fcl_ue_trapvec;
194
   output [3:0] erb_fcl_ifet_uevec_d1;
195
 
196
   output [22:0] erc_erd_errstat_asidata;
197
   output [31:0] erc_erd_errinj_asidata;
198
   output [1:0]  erc_erd_erren_asidata;
199
 
200
   // mux selects
201
   output [3:0]  erc_erd_eadr0_sel_irf_l,
202
                             erc_erd_eadr0_sel_itlb_l,
203
                             erc_erd_eadr0_sel_frf_l,
204
                             erc_erd_eadr0_sel_lsu_l;
205
 
206
   output [3:0]  erc_erd_asiway_s1_l;
207
 
208
   output [3:0]  erc_erd_eadr1_sel_pcd1_l,
209
                             erc_erd_eadr1_sel_l1pa_l,
210
                             erc_erd_eadr1_sel_l2pa_l,
211
                             erc_erd_eadr1_sel_other_l;
212
 
213
   output [3:0]  erc_erd_eadr2_sel_mx1_l,
214
                             erc_erd_eadr2_sel_wrt_l,
215
                             erc_erd_eadr2_sel_mx0_l,
216
                             erc_erd_eadr2_sel_old_l;
217
 
218
   output [3:0]  erc_erd_asi_thr_l;
219
 
220
   output        erc_erd_asisrc_sel_icd_s_l,
221
                             erc_erd_asisrc_sel_misc_s_l,
222
                             erc_erd_asisrc_sel_err_s_l,
223
                             erc_erd_asisrc_sel_itlb_s_l;
224
 
225
   output        erc_erd_errasi_sel_en_l,
226
                             erc_erd_errasi_sel_stat_l,
227
                             erc_erd_errasi_sel_inj_l,
228
                             erc_erd_errasi_sel_addr_l;
229
 
230
   output        erc_erd_miscasi_sel_ict_l,
231
                             erc_erd_miscasi_sel_imask_l,
232
                             erc_erd_miscasi_sel_other_l;
233
 
234
   output        erc_erd_ld_imask;
235
   output        erb_reset,
236
                 so;
237
 
238
   // Local Signals
239
 
240
   wire          spu_unc_err_w2,
241
                 spu_mamem_err_w2;
242
 
243
   wire          lsu_dtlb_data_su,
244
                             lsu_dtlb_data_ue,
245
                             lsu_dtlb_tag_ue,
246
                             lsu_dcache_data_perror,
247
                             lsu_dcache_tag_perror,
248
                             lsu_l2_unc_error,
249
                             lsu_l2_corr_error,
250
                             lsu_io_error;
251
   wire [1:0]    lsu_error_tid;
252
 
253
   wire [3:0]    valid_s1;
254
 
255
   wire [1:0]    tid_d,
256
                 ffu_tid_w3,
257
                 l2ierr_tid,
258
                 spu_tid_w2,
259
                 asi_tid_w2,
260
                             asi_tid_s1;
261
 
262
   wire [3:0]    thr_e,
263
                 thr_d,
264
                             thr_d1,
265
                             thr_m,
266
                             thr_w,
267
                 ffu_thr_w3,
268
                             asi_thr_s,
269
                 asi_thr_w2,
270
                             asi_thr_i2,
271
                             thr_lsu_err,
272
                 thr_spu_err,
273
                             thr_l2ie;
274
 
275
   wire          itlb_feterr_s1,
276
                             tlb_feterr_d1,
277
                 itlb_errtr_s1_l,
278
                 itlb_errtr_d1_l;
279
 
280
   wire          tlb_fet_ce_d1,
281
                             tlb_fet_ue_d1;
282
 
283
   wire [3:0]    alltag_err_s1;
284
 
285
   wire          itlb_tagerr_s1,
286
                             itlb_dataerr_s1,
287
                             insterr_d1,
288
                 insterr_s1,
289
                             insterr_qual_d1,
290
                             ictagerr_s1,
291
                             ictagerr_d1,
292
                             ictagerr_qual_d1;
293
 
294
   wire          asi_daterr_d1,
295
                             asi_tagerr_d1,
296
                             asi_rd_err_d1;
297
 
298
   wire          asi_ttevld_s1,
299
                             asi_tdevld_s1;
300
 
301
   wire [3:0]    any_tlbasi_err;
302
 
303
   wire [3:0]    dmdu,
304
                             dmdu_nxt,
305
                             dmsu,
306
                             dmsu_nxt,
307
                             dmt,
308
                             dmt_nxt,
309
                             ddc,
310
                             ddc_nxt,
311
                             dtc,
312
                             dtc_nxt,
313
                             ldau,
314
                             ldau_nxt,
315
                             ncu,
316
                             ncu_nxt,
317
                 mau,
318
                 mau_nxt,
319
                             any_lsu_err,
320
                             any_lsu_ue,
321
                             any_lsu_ce,
322
                 any_spu_ce,
323
                 any_spu_ue,
324
                             imt,
325
                             imt_nxt,
326
                             frc,
327
                             frc_nxt,
328
                             irc,
329
                             irc_nxt,
330
                             fru,
331
                             fru_nxt,
332
                             iru,
333
                             iru_nxt,
334
                             any_rf_err,
335
                             any_rf_ce,
336
                             any_rf_ue,
337
                             any_irf_err,
338
                             any_frf_err,
339
                             idc,
340
                             idc_nxt,
341
                             itc,
342
                             itc_nxt,
343
                             imdu,
344
                             imdu_nxt,
345
                             any_err_vld,
346
                             any_ue_vld,
347
//                           any_ce_vld,
348
                             early_idc,
349
                             early_idc_nxt,
350
                             early_itc,
351
                             early_itc_nxt,
352
                             early_imdu,
353
                             early_imdu_nxt,
354
                             early_ldau,
355
                             early_ldau_nxt,
356
                             early_ncu,
357
                             early_ncu_nxt,
358
                             early_l2ce,
359
                             early_l2ce_nxt,
360
                             any_ifu_ce,
361
                             any_ifu_ue,
362
                             any_ifu_err,
363
                             any_iferr_vld;
364
 
365
   wire [3:0]    meu,
366
                             meu_nxt,
367
                             mec,
368
                             mec_nxt,
369
                             priv,
370
                             priv_nxt,
371
                             early_meu,
372
                             early_meu_nxt,
373
                             early_mec,
374
                             early_mec_nxt,
375
                             early_priv,
376
                             early_priv_nxt;
377
 
378
   wire [22:0]   err_stat0,
379
                             err_stat1,
380
                             err_stat2,
381
                             err_stat3;
382
 
383
   wire [3:0]    ifet_ce_vld,
384
                 ifet_ue_vld;
385
 
386
   wire [3:0]    l2if_unc_err,
387
                             l2if_corr_err;
388
 
389
   wire [3:0]    ce_trapvec,
390
                             ue_trapvec,
391
                             ifu_ce_trap;
392
 
393
   wire          wrt_errinj_i2;
394
   wire [7:0]    ecc_mask,
395
                             ecc_mask_nxt;
396
 
397
   wire [1:0]    errinj_ctl,
398
                             errinj_ctl_nxt;
399
   wire [5:0]    errinj_vec,
400
                             errinj_vec_nxt,
401
                             corr_errinj_vec;
402
 
403
//   wire [3:0]    icache_pa_err_d1;
404
 
405
   wire          irf_ce_w,
406
                 irf_ce_unq,
407
                             irf_ue_w,
408
                 irf_ue_unq;
409
 
410
   wire [3:0]    sel_lsu_err,
411
                             sel_ifuspu_err,
412
                             sel_rftlb_err;
413
 
414
   wire          clr_err_qual_e,
415
                 clr_elyff_e,
416
                 clr_elyff_m,
417
                 clr_elyff_w;
418
 
419
   wire [3:0]    early_err_vec_e,
420
                             clear_ely_reg_w,
421
                             mov_ely_reg_w;
422
 
423
   wire [3:0]    clear_iferr_d1;
424
 
425
   wire [1:0]    asi_way_s1;
426
   wire [3:0]    dec_asiway_s1;
427
 
428
   wire [3:0]    asi_wrt_err_stat,
429
                             asi_wrt_err_en,
430
//                           asi_wrt_err_inj,
431
                             asi_wrt_err_addr;
432
 
433
   wire          dmdu_wrt_data,
434
                             dmsu_wrt_data,
435
                             imdu_wrt_data,
436
                             idc_wrt_data,
437
                             itc_wrt_data,
438
                             ddc_wrt_data,
439
                             dtc_wrt_data,
440
                             imt_wrt_data,
441
                             dmt_wrt_data,
442
                             ldau_wrt_data,
443
                             ncu_wrt_data,
444
                 mau_wrt_data,
445
                             fru_wrt_data,
446
                             frc_wrt_data,
447
                             iru_wrt_data,
448
                             irc_wrt_data,
449
                             meu_wrt_data,
450
                             mec_wrt_data,
451
                             priv_wrt_data;
452
 
453
   wire          nceen_wrt_data,
454
                             ceen_wrt_data;
455
 
456
   wire [3:0]    ceen,
457
                             ceen_nxt,
458
                             nceen,
459
                             nceen_nxt;
460
 
461
   wire          nceen_d;
462
 
463
   wire          rdtag_s,
464
                             rdinst_s,
465
                             asi_erren_f,
466
                             asi_errstat_f,
467
                             asi_errinj_f,
468
                             asi_erraddr_f,
469
                             asi_imask_f,
470
                             asi_erren_s,
471
                             asi_errstat_s,
472
                             asi_errinj_s,
473
                             asi_erraddr_s,
474
                             asi_imask_s;
475
 
476
   wire          asird_f,
477
                             asird_s;
478
   wire          fwdrd_f,
479
                 fwdrd_s,
480
                 asifwd_rd_s,
481
                 rdinst_f,
482
                 fwdrd_d;
483
 
484
   wire          ldxa_data_vld_s,
485
                 ldxa_data_vld_d;
486
 
487
   wire          err_asi_s;
488
   wire          erb_reset_l;
489
 
490
   wire          ffu_ce_w3;
491
   wire          ffu_ue_w3;
492
 
493
   wire [3:0]     any_lsu_ue_priv_state;
494
   wire [3:0]     any_priv_state;
495
 
496
   wire          clk;
497
 
498
 
499
//   
500
// Code Begins Here
501
//
502
   assign        clk = rclk;
503
 
504
   // reset buffer
505
   dffrl_async rstff(.din (grst_l),
506
                     .q   (erb_reset_l),
507 113 albert.wat
                     .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so(),
508 95 fafa1971
                     .rst_l (arst_l));
509
 
510
   assign       erb_reset = ~erb_reset_l;
511
 
512
 
513
 
514
   // need to encode page size before sending it back
515
   assign erc_erd_pgsz_b0 = (erd_erc_tte_pgsz[2] |
516
                                    erd_erc_tte_pgsz[1] |
517
                              erd_erc_tte_pgsz[0]);
518
 
519
   assign erc_erd_pgsz_b1 = (~erd_erc_tte_pgsz[2] &
520
                                   erd_erc_tte_pgsz[1]);
521
 
522
 
523
   // Don't need this with SPARC_HPV_EN
524
   // default to tte_lock_d1 = 0
525
   // 05/30/03: tlb correctible errors disabled.
526
   // so treat as if lock = 1 and force ue.
527
//   dff #(1) lk_ff(.din (erd_erc_tte_lock_s1),
528
//                            .q   (tte_lock_d1),
529 113 albert.wat
//                            .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
530 95 fafa1971
 
531
//-----------------------
532
// Basic pipeline signals
533
//-----------------------
534
   // thr_s1 also contains asi tid
535 113 albert.wat
   dff_s #(2) tidd_reg(.din (ifu_lsu_thrid_s),
536 95 fafa1971
                                 .q   (tid_d),
537 113 albert.wat
                                 .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
538 95 fafa1971
 
539
   assign thr_d[0] = ~tid_d[1] & ~tid_d[0];
540
   assign thr_d[1] = ~tid_d[1] &  tid_d[0];
541
   assign thr_d[2] =  tid_d[1] & ~tid_d[0];
542
   assign thr_d[3] =  tid_d[1] &  tid_d[0];
543
 
544 113 albert.wat
   dff_s #(4) thre_reg(.din (thr_d),
545 95 fafa1971
                                 .q   (thr_e),
546 113 albert.wat
                                 .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
547 95 fafa1971
   assign thr_d1 = thr_e;
548
 
549 113 albert.wat
   dff_s #(4) thrm_reg(.din (thr_e),
550 95 fafa1971
                                 .q   (thr_m),
551 113 albert.wat
                                 .clk (clk),  .se(se), `SIMPLY_RISC_SCANIN, .so());
552
   dff_s #(4) thrw_reg(.din (thr_m),
553 95 fafa1971
                                 .q   (thr_w),
554 113 albert.wat
                                 .clk (clk),  .se(se), `SIMPLY_RISC_SCANIN, .so());
555 95 fafa1971
 
556
 
557
//-----------------------------
558
// lsu flops (added for timing)
559
//-----------------------------
560
   // all the lsu signals go to the final mux in the errdp, to help
561
   // with timing.  This is no longer necessary, in fact it is no
562
   // longer desired, since we have added the flop below to stage all
563
   // the lsu signals.  However, the design is not changed, to save
564
   // the extra effort in physical composition to rip up the errdp.
565 113 albert.wat
   dff_s #(10) lspipe_reg(.din ({lsu_ifu_dtlb_data_su,
566 95 fafa1971
                               lsu_ifu_dtlb_data_ue,
567
                               lsu_ifu_dtlb_tag_ue,
568
                               lsu_ifu_dcache_data_perror,
569
                               lsu_ifu_dcache_tag_perror,
570
                               lsu_ifu_l2_unc_error,
571
                               lsu_ifu_l2_corr_error,
572
                               lsu_ifu_io_error,
573
                               lsu_ifu_error_tid[1:0]}),
574
                        .q   ({lsu_dtlb_data_su,
575
                               lsu_dtlb_data_ue,
576
                               lsu_dtlb_tag_ue,
577
                               lsu_dcache_data_perror,
578
                               lsu_dcache_tag_perror,
579
                               lsu_l2_unc_error,
580
                               lsu_l2_corr_error,
581
                               lsu_io_error,
582
                               lsu_error_tid[1:0]}),
583 113 albert.wat
                        .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
584 95 fafa1971
 
585
   assign any_priv_state = tlu_lsu_pstate_priv | tlu_hpstate_priv;
586
 
587
   //Bug 6821: added so that lsu ue's errors pickup the delayed priv level
588 113 albert.wat
   dff_s #(4) lsu_priv_reg(.din (any_priv_state),
589 95 fafa1971
                        .q   (any_lsu_ue_priv_state),
590 113 albert.wat
                        .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
591 95 fafa1971
 
592
   // thread from lsu
593
   assign thr_lsu_err[0] = ~lsu_error_tid[1] & ~lsu_error_tid[0];
594
   assign thr_lsu_err[1] = ~lsu_error_tid[1] &  lsu_error_tid[0];
595
   assign thr_lsu_err[2] =  lsu_error_tid[1] & ~lsu_error_tid[0];
596
   assign thr_lsu_err[3] =  lsu_error_tid[1] &  lsu_error_tid[0];
597
 
598
   // thread from spu
599
   // From Farnad: tid is ready several cycles before everything else.
600
   // In the ifu, I will assume 1 cycle before
601 113 albert.wat
   dff_s #(2) sptid_reg(.din (spu_ifu_ttype_tid_w2),
602 95 fafa1971
                      .q   (spu_tid_w2),
603 113 albert.wat
                      .clk (clk), .se(se), .so(), `SIMPLY_RISC_SCANIN);
604 95 fafa1971
 
605 113 albert.wat
   dff_s #(2) spe1_reg(.din ({spu_ifu_unc_err_w1,
606 95 fafa1971
                            spu_ifu_mamem_err_w1}),
607
                      .q   ({spu_unc_err_w2,
608
                             spu_mamem_err_w2}),
609 113 albert.wat
                      .clk (clk), .se(se), .so(), `SIMPLY_RISC_SCANIN);
610 95 fafa1971
 
611
   assign thr_spu_err[0] = ~spu_tid_w2[1] & ~spu_tid_w2[0];
612
   assign thr_spu_err[1] = ~spu_tid_w2[1] &  spu_tid_w2[0];
613
   assign thr_spu_err[2] =  spu_tid_w2[1] & ~spu_tid_w2[0];
614
   assign thr_spu_err[3] =  spu_tid_w2[1] &  spu_tid_w2[0];
615
 
616
   // thread from ifq
617 113 albert.wat
   dff_s #(2) ifqthr_reg(.din (ifq_erb_l2err_tid),
618 95 fafa1971
                       .q   (l2ierr_tid),
619 113 albert.wat
                       .clk (clk), .se(se), .so(), `SIMPLY_RISC_SCANIN);
620 95 fafa1971
 
621
   assign thr_l2ie[0] = ~l2ierr_tid[1] & ~l2ierr_tid[0];
622
   assign thr_l2ie[1] = ~l2ierr_tid[1] &  l2ierr_tid[0];
623
   assign thr_l2ie[2] =  l2ierr_tid[1] & ~l2ierr_tid[0];
624
   assign thr_l2ie[3] =  l2ierr_tid[1] &  l2ierr_tid[0];
625
 
626
 
627
//---------------------------------------
628
// Error Detection -- icache errors
629
//---------------------------------------
630
   // itlb inst fetch errors
631
   assign itlb_feterr_s1 = (erd_erc_tlbd_pe_s1[0] ^ erd_erc_tlbd_pe_s1[1]) &
632
                                               fcl_erb_immuevld_s1;
633
   assign erb_ifq_itlberr_s1 = itlb_feterr_s1 & nceen_d;
634 113 albert.wat
   dff_s #(1) itfete_ff(.din (itlb_feterr_s1),
635 95 fafa1971
                                  .q   (tlb_feterr_d1),
636 113 albert.wat
                                  .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
637 95 fafa1971
 
638
   assign itlb_errtr_s1_l = ~erb_ifq_itlberr_s1;
639 113 albert.wat
   dff_s #(1) itume_ff(.din (itlb_errtr_s1_l),
640 95 fafa1971
                                 .q   (itlb_errtr_d1_l),
641 113 albert.wat
                                 .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
642 95 fafa1971
 
643
//   assign tlb_fet_ce_d1 = tlb_feterr_d1 & ~tte_lock_d1;
644
//   assign tlb_fet_ue_d1 = tlb_feterr_d1 & tte_lock_d1;
645
   assign tlb_fet_ce_d1 = 1'b0;
646
   assign tlb_fet_ue_d1 = tlb_feterr_d1;
647
 
648
 
649
   // instruction errors
650
//   assign insterr_s1 = (erd_erc_nirpe_s1 | erd_erc_fetpe_s1) & 
651
//                                         fcl_erb_ievld_s1;
652
//   dff #(1)  inserr_ff(.din (insterr_s1),
653
//                                 .q   (insterr_d1),
654 113 albert.wat
//                                 .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
655 95 fafa1971
 
656
   assign insterr_s1 = (erd_erc_fetpe_s1 | erd_erc_nirpe_s1) &
657
                         fcl_erb_ievld_s1;
658
 
659 113 albert.wat
   dff_s #(1)  feterr_ff(.din (insterr_s1),
660 95 fafa1971
                                   .q   (insterr_d1),
661 113 albert.wat
                                   .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
662 95 fafa1971
//   dff #(1)  nirerr_ff(.din (erd_erc_nirpe_s1),
663
//                                 .q   (nirpe_d1),
664 113 albert.wat
//                                 .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
665 95 fafa1971
//   dff #(1)  ievld1_ff(.din (fcl_erb_ievld_s1),
666
//                                 .q   (ievld_d1),
667 113 albert.wat
//                                 .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
668 95 fafa1971
 
669
   assign insterr_qual_d1 = insterr_d1 & ~tlb_feterr_d1;
670
 
671
   // tag errors
672 113 albert.wat
   dff_s #(4)  vld_reg(.din (icv_itlb_valid_f),
673 95 fafa1971
                                 .q   (valid_s1),
674 113 albert.wat
                                 .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
675 95 fafa1971
   assign alltag_err_s1 = erd_erc_tagpe_s1 & valid_s1;
676
 
677
   assign ictagerr_s1 = (|alltag_err_s1[3:0]) & fcl_erb_tevld_s1;
678 113 albert.wat
   dff_s #(1)  itagerr_ff(.din (ictagerr_s1),
679 95 fafa1971
                                    .q   (ictagerr_d1),
680 113 albert.wat
                                    .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
681 95 fafa1971
 
682
   assign  ictagerr_qual_d1 = ictagerr_d1 & ~insterr_d1 &
683
                                    ~tlb_feterr_d1;
684
 
685
   // Corrective action for IFU errors
686
   // force an imiss if there is a inst/tag parity error
687
   assign  erb_ifq_ifeterr_d1 = (ictagerr_d1 | insterr_d1) & itlb_errtr_d1_l;
688
 
689
   // moved qualification with inst_vld_d1 to the dtu.
690
   assign  erb_dtu_ifeterr_d1 = erb_ifq_ifeterr_d1;
691
   //assign  erb_dtu_ifeterr_d1 = erb_ifq_ifeterr_d1 & fcl_erb_inst_vld_d1;
692
//   assign  icache_pa_err_d1 = {4{ictagerr_d1 | insterr_d1}} & thr_d1;
693
 
694
   // force a tlbmiss if there is a correctible tlb data parity error
695
   assign  erb_fcl_itlb_ce_d1 = tlb_fet_ce_d1;
696
 
697
   // take a precise trap if there is an uncorrectible error
698
   assign  erb_fcl_ifet_uevec_d1 = ({4{tlb_fet_ue_d1 & fcl_erb_inst_vld_d1}} &
699
                                                            thr_d1  |
700
                                                            {4{ifq_erb_l2_ue | ifq_erb_io_ue}} &
701
                                                            thr_l2ie) & nceen;
702
 
703
   // errors in ifetch to l2 or iob
704
   assign  l2if_unc_err = {4{ifq_erb_l2_ue | ifq_erb_io_ue}} & thr_l2ie;
705
   assign  l2if_corr_err = {4{ifq_erb_ifet_ce}} & thr_l2ie;
706
 
707
 
708
//-------------------------------------
709
// Error Detection -- itlb asi errors
710
//-------------------------------------   
711
   assign  itlb_tagerr_s1 = (erd_erc_tlbt_pe_s1[0] ^ erd_erc_tlbt_pe_s1[1]) &
712
                                                asi_ttevld_s1;
713
   assign  itlb_dataerr_s1 = (erd_erc_tlbd_pe_s1[0] ^ erd_erc_tlbd_pe_s1[1]) &
714
                                                 asi_tdevld_s1;
715
 
716 113 albert.wat
   dff_s #(1) itdate_ff(.din (itlb_dataerr_s1),
717 95 fafa1971
                                  .q   (asi_daterr_d1),
718 113 albert.wat
                                  .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
719
   dff_s #(1) ittage_ff(.din (itlb_tagerr_s1),
720 95 fafa1971
                                  .q   (asi_tagerr_d1),
721 113 albert.wat
                                  .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
722 95 fafa1971
 
723
   assign  asi_rd_err_d1 = asi_daterr_d1 | asi_tagerr_d1;
724
   assign  ifu_lsu_asi_rd_unc = asi_rd_err_d1;
725
 
726
   assign  any_tlbasi_err = {4{asi_rd_err_d1}} & asi_thr_w2;
727
 
728
 
729
//------------------------------
730
// RF errors
731
//------------------------------   
732 113 albert.wat
   dff_s #(1) irfu_ff(.din (exu_ifu_ecc_ue_m),
733 95 fafa1971
                                .q   (irf_ue_unq),
734 113 albert.wat
                                .clk (clk), .se (se), `SIMPLY_RISC_SCANIN, .so());
735
   dff_s #(1) irfc_ff(.din (exu_ifu_ecc_ce_m),
736 95 fafa1971
                                .q   (irf_ce_unq),
737 113 albert.wat
                                .clk (clk), .se (se), `SIMPLY_RISC_SCANIN, .so());
738 95 fafa1971
   assign  irf_ce_w = irf_ce_unq & ifu_tlu_inst_vld_w;
739
   assign  irf_ue_w = irf_ue_unq & ifu_tlu_inst_vld_w;
740
 
741
//------------------
742
// Error Logging
743
//------------------
744
   // List of all logged errors
745
   // itlbt  u
746
   // itlbd  u/c
747
   // ict  c
748
   // icd  c
749
   // irf  c/u
750
   // frf  c/u
751
   // dtlb d/t u
752
   // dct  c
753
   // dcd  c
754
   // mau  u
755
   // l2-d u
756
   // l2-i u
757
   // dram u -- not any more
758
   // io   u
759
   //
760
   // Errors not logged but causing a trap
761
   // l2-d c
762
   // l2-i c
763
   // l2-s c
764
   // 
765
 
766
   // latest errors have highest priority
767
   // lsu is latest and sometimes asynchronous
768
   // spu has low priority
769
   // irf/frf are always "current"
770
   // ifu errors are speculative ("early")
771
   // All lsu errors are prioritised at the source
772
   assign  dmdu_nxt =  {4{lsu_dtlb_data_ue & ~erb_reset}} & thr_lsu_err &
773
                                    ~any_ue_vld |
774
                              dmdu & ~({4{dmdu_wrt_data}} & asi_wrt_err_stat);
775
   // 6310
776
   assign  dmsu_nxt =  {4{lsu_dtlb_data_su & ~erb_reset}} & thr_lsu_err &
777
                                   ~any_ue_vld |
778
                             dmsu & ~({4{dmsu_wrt_data}} & asi_wrt_err_stat);
779
   assign  dmt_nxt =  {4{lsu_dtlb_tag_ue & ~erb_reset}} & thr_lsu_err &
780
                                  ~any_ue_vld |
781
                            dmt & ~({4{dmt_wrt_data}} & asi_wrt_err_stat);
782
   assign  ddc_nxt =  {4{lsu_dcache_data_perror & ~erb_reset}} & thr_lsu_err &
783
                                  ~any_err_vld |
784
                            ddc & ~({4{ddc_wrt_data}} & asi_wrt_err_stat);
785
   assign  dtc_nxt =  {4{lsu_dcache_tag_perror & ~erb_reset}} & thr_lsu_err &
786
                                  ~any_err_vld |
787
                            dtc & ~({4{dtc_wrt_data}} & asi_wrt_err_stat);
788
 
789
   assign  ldau_nxt = (mov_ely_reg_w & early_ldau |
790
                             {4{lsu_l2_unc_error}} & thr_lsu_err |
791
                             {4{spu_unc_err_w2}} & thr_spu_err) &
792
                                    ~any_ue_vld |
793
                             ldau & ~({4{ldau_wrt_data}} & asi_wrt_err_stat);
794
 
795
   assign  ncu_nxt = (mov_ely_reg_w & early_ncu |
796
                            {4{lsu_io_error}} & thr_lsu_err) &
797
                                   ~any_ue_vld |
798
                           ncu & ~({4{ncu_wrt_data}} & asi_wrt_err_stat);
799
 
800
   assign  any_lsu_ue = thr_lsu_err & {4{lsu_dtlb_data_ue |
801
                                         lsu_dtlb_data_su |
802
                                                                       lsu_dtlb_tag_ue |
803
                                                                       lsu_l2_unc_error |
804
                                                                       lsu_io_error}};
805
 
806
   assign  any_lsu_ce = thr_lsu_err &
807
                              {4{(lsu_dcache_data_perror |
808
                                              lsu_dcache_tag_perror |
809
                                              lsu_l2_corr_error) &
810
                           ~lsu_dtlb_data_ue &
811
                           ~lsu_dtlb_data_su}};
812
 
813
   assign  any_lsu_err = (any_lsu_ue |
814
                                            thr_lsu_err & {4{lsu_dcache_data_perror |
815
                                                                         lsu_dcache_tag_perror}});
816
 
817
   // MAmem parity error
818
   assign mau_nxt = {4{spu_mamem_err_w2}} & thr_spu_err &
819
                    ~any_ue_vld |
820
                    mau &  ~({4{mau_wrt_data}} & asi_wrt_err_stat);
821
 
822
   assign any_spu_ce = {4{spu_ifu_corr_err_w2 & ~spu_unc_err_w2}} & thr_spu_err;
823
   assign any_spu_ue = {4{spu_unc_err_w2 |
824
                          spu_mamem_err_w2}} & thr_spu_err;
825
 
826
   // tlb asi read error
827
   assign imt_nxt =  {4{asi_tagerr_d1 & ~erb_reset}} & asi_thr_w2 &
828
                                 ~any_ue_vld |
829
                           imt & ~({4{imt_wrt_data}} & asi_wrt_err_stat);
830
 
831 113 albert.wat
   dff_s #(2) ffu_err_reg(.din ({ffu_ifu_ecc_ce_w2,
832 95 fafa1971
                               ffu_ifu_ecc_ue_w2}),
833
                        .q   ({ffu_ce_w3,
834
                               ffu_ue_w3}),
835 113 albert.wat
                        .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
836 95 fafa1971
 
837 113 albert.wat
   dff_s #(2) fptid_reg(.din (ffu_ifu_tid_w2[1:0]),
838 95 fafa1971
                                  .q   (ffu_tid_w3[1:0]),
839 113 albert.wat
                                  .clk (clk),  .se(se), `SIMPLY_RISC_SCANIN, .so());
840 95 fafa1971
 
841
   assign ffu_thr_w3[0] = ~ffu_tid_w3[1] & ~ffu_tid_w3[0];
842
   assign ffu_thr_w3[1] = ~ffu_tid_w3[1] &  ffu_tid_w3[0];
843
   assign ffu_thr_w3[2] =  ffu_tid_w3[1] & ~ffu_tid_w3[0];
844
   assign ffu_thr_w3[3] =  ffu_tid_w3[1] &  ffu_tid_w3[0];
845
 
846
 
847
   // regfile error
848
   //Bug6420: log frc and irc bits as well when fru and iru are detected simulatneously
849
   assign frc_nxt =  {4{ffu_ce_w3 & ~erb_reset}} &
850
                      ffu_thr_w3 & ~any_err_vld & ~any_lsu_err |
851
                      frc & ~({4{frc_wrt_data}} & asi_wrt_err_stat);
852
 
853
   assign fru_nxt =  {4{ffu_ue_w3 & ~erb_reset}} & ffu_thr_w3 &
854
                            ~any_ue_vld & ~any_lsu_ue |
855
                      fru & ~({4{fru_wrt_data}} & asi_wrt_err_stat);
856
 
857
   //Bug6420
858
   assign irc_nxt =  {4{irf_ce_w & ~erb_reset}} & thr_w &
859
                                ~any_err_vld & ~any_lsu_err |
860
                          irc & ~({4{irc_wrt_data}} & asi_wrt_err_stat);
861
 
862
   assign iru_nxt =  {4{irf_ue_w & ~erb_reset}} & thr_w &
863
                               ~any_ue_vld & ~any_lsu_ue |
864
                         iru & ~({4{iru_wrt_data}} & asi_wrt_err_stat);
865
 
866
   assign any_irf_err = thr_w & {4{irf_ce_w | irf_ue_w}};
867
   assign any_frf_err = ffu_thr_w3 & {4{ffu_ce_w3 | ffu_ue_w3}};
868
 
869
   //Bug6420
870
   assign any_rf_ce = thr_w & {4{irf_ce_w}} |
871
                            ffu_thr_w3 & {4{ffu_ce_w3}};
872
   assign any_rf_ue = thr_w & {4{irf_ue_w}} |
873
                            ffu_thr_w3 & {4{ffu_ue_w3}};
874
   assign any_rf_err = any_irf_err | any_frf_err;
875
 
876
 
877
   // ifu errors
878
   assign idc_nxt =  mov_ely_reg_w & ~any_err_vld & early_idc |
879
                      idc & ~({4{idc_wrt_data}} & asi_wrt_err_stat);
880
 
881
   assign itc_nxt =  mov_ely_reg_w & ~any_err_vld & early_itc |
882
                     itc & ~({4{itc_wrt_data}} & asi_wrt_err_stat);
883
 
884
   // bug 6310
885
   assign imdu_nxt =  (mov_ely_reg_w & early_imdu |
886
                                   {4{asi_daterr_d1 & ~erb_reset}} & asi_thr_w2) &
887
                        ~any_ue_vld |
888
                            imdu & ~({4{imdu_wrt_data}} & asi_wrt_err_stat);
889
 
890
//   assign imdc_nxt =  mov_ely_reg_w & ~any_err_vld & early_imdc |
891
//                          imdc & ~({4{imdc_wrt_data}} & asi_wrt_err_stat);
892
 
893 113 albert.wat
   dff_s #(64) errvec_reg(.din ({imt_nxt, imdu_nxt, idc_nxt, itc_nxt,
894 95 fafa1971
                                                 iru_nxt, irc_nxt, fru_nxt, frc_nxt,
895
                                   dmt_nxt, dmdu_nxt, dmsu_nxt, ddc_nxt, dtc_nxt,
896
                                                 ldau_nxt, ncu_nxt, mau_nxt}),
897
                                    .q   ({imt, imdu, idc, itc,
898
                                                 iru, irc, fru, frc,
899
                                   dmt, dmdu, dmsu, ddc, dtc,
900
                                                 ldau, ncu, mau}),
901
                                    .clk (clk),
902 113 albert.wat
                                    .se  (se), `SIMPLY_RISC_SCANIN, .so());
903 95 fafa1971
 
904
   assign any_err_vld = imt | imdu | idc | itc | iru | irc | fru | frc |
905
                            dmt | dmdu | dmsu | ddc | dtc | ldau | ncu | mau;
906
 
907
   assign any_ue_vld =  imt | imdu | iru | fru |
908
                            dmt | dmdu | dmsu | ldau | ncu | mau;
909
 
910
//   assign any_ce_vld =  imdc | idc | itc | irc | frc |
911
//                      dmdc | ddc | dtc;
912
 
913
   // IFU errors
914
   assign any_ifu_ue = {4{(ifq_erb_l2_ue | ifq_erb_io_ue) & ~erb_reset}} &
915
                             thr_l2ie |
916
                             {4{tlb_fet_ue_d1 & ~erb_reset}} & thr_d1;
917
 
918
   assign any_ifu_ce = {4{ifq_erb_ifet_ce & ~erb_reset}} & thr_l2ie |
919
                             {4{(tlb_fet_ce_d1 | insterr_qual_d1 |
920
                                             ictagerr_qual_d1) & ~erb_reset}} &
921
                       thr_d1;
922
 
923
   assign any_ifu_err = any_ifu_ce | any_ifu_ue;
924
 
925
 
926
   assign ifet_ce_vld = early_idc | early_itc | early_l2ce;
927
   assign ifet_ue_vld = early_imdu | early_ldau | early_ncu;
928
 
929
   // l2ce's are not logged in sparc, so leave them out
930
   assign any_iferr_vld = ifet_ue_vld | early_idc | early_itc;
931
 
932
   // Early errors
933
   assign early_idc_nxt = {4{insterr_qual_d1}} & thr_d1 &
934
                          ~any_iferr_vld & ~any_rf_err & ~any_lsu_err |
935
                          early_idc & ~clear_iferr_d1 &
936
                          ~mov_ely_reg_w;
937
 
938
   assign early_itc_nxt =  {4{ictagerr_qual_d1}} & thr_d1 &
939
                                ~any_iferr_vld & ~any_rf_err & ~any_lsu_err |
940
                          early_itc & ~clear_iferr_d1 &
941
                          ~mov_ely_reg_w;
942
 
943
   assign early_imdu_nxt =  {4{tlb_fet_ue_d1}} & thr_d1 &
944
                                 ~ifet_ue_vld & ~any_rf_ue & ~any_lsu_ue |
945
                           early_imdu & ~clear_iferr_d1 &
946
                           ~mov_ely_reg_w;
947
 
948
//   assign early_imdc_nxt =  {4{tlb_fet_ce_d1}} & thr_d1 &
949
//                               ~any_iferr_vld & ~any_rf_err & ~any_lsu_err |
950
//                         early_imdc & ~clear_iferr_d1 &
951
//                         ~mov_ely_reg_w;
952
 
953
   assign early_ldau_nxt = {4{ifq_erb_l2_ue & ~erb_reset}} & thr_l2ie &
954
                           ~ifet_ue_vld & ~any_rf_ue & ~any_lsu_ue |
955
                           early_ldau & ~clear_iferr_d1 &
956
                           ~mov_ely_reg_w;
957
 
958
   assign early_ncu_nxt = {4{ifq_erb_io_ue & ~erb_reset}} & thr_l2ie &
959
                           ~ifet_ue_vld & ~any_rf_ue & ~any_lsu_ue |
960
                           early_ncu & ~clear_iferr_d1 &
961
                           ~mov_ely_reg_w;
962
 
963
   assign early_l2ce_nxt =  {4{ifq_erb_ifet_ce}} & thr_l2ie &
964
                                 ~any_iferr_vld & ~any_rf_err & ~any_lsu_err |
965
                           early_l2ce & ~clear_iferr_d1 &
966
                           ~mov_ely_reg_w;
967
 
968 113 albert.wat
   dffr_s #(24) elyerr_reg(.din ({early_idc_nxt,
969 95 fafa1971
                                                  early_itc_nxt,
970
                                                  early_imdu_nxt,
971
                                                  early_ldau_nxt,
972
                                                  early_ncu_nxt,
973
                                                  early_l2ce_nxt}),
974
                                     .q   ({early_idc,
975
                                                  early_itc,
976
                                                  early_imdu,
977
                                                  early_ldau,
978
                                                  early_ncu,
979
                                                  early_l2ce}),
980
                                     .clk (clk),
981
                                     .rst (erb_reset),
982 113 albert.wat
                                     .se  (se), `SIMPLY_RISC_SCANIN, .so());
983 95 fafa1971
 
984
   // Multipl errors
985
   assign meu_nxt = any_ue_vld & (any_lsu_ue | any_rf_ue | any_tlbasi_err |
986
                                  any_spu_ue |
987
                                              mov_ely_reg_w & ifet_ue_vld) |
988
// known bug - wontfix                            
989
//                                    mov_ely_reg_w & early_meu |
990
                    meu & ~({4{meu_wrt_data}} & asi_wrt_err_stat);
991
 
992
   assign mec_nxt = any_err_vld & (any_lsu_ce | any_rf_ce |
993
                                               mov_ely_reg_w & ifet_ce_vld) |
994
// known bug - wontfix                     
995
//                     mov_ely_reg_w & early_mec |
996
                          mec & ~({4{mec_wrt_data}} & asi_wrt_err_stat);
997
 
998
   //Bug6821
999
   assign priv_nxt =      ~any_err_vld & (any_lsu_ue_priv_state & any_lsu_ue |
1000
                                          any_priv_state & (any_lsu_ce | any_rf_err | any_tlbasi_err) |
1001
                                          mov_ely_reg_w & early_priv) |
1002
                          priv & ~({4{priv_wrt_data}} & asi_wrt_err_stat);
1003
 
1004 113 albert.wat
   dffr_s #(12) me_reg(.din ({meu_nxt,
1005 95 fafa1971
                                              mec_nxt,
1006
                                              priv_nxt}),
1007
                                 .q   ({meu,
1008
                                              mec,
1009
                                              priv}),
1010
                                 .clk (clk),
1011
                                 .rst (erb_reset),
1012 113 albert.wat
                                 .se  (se), `SIMPLY_RISC_SCANIN, .so());
1013 95 fafa1971
 
1014
   // Early multiple errors
1015
   assign early_meu_nxt = any_ifu_ue & ifet_ue_vld |
1016
                          early_meu & ~clear_iferr_d1 & ~mov_ely_reg_w;
1017
 
1018
   assign early_mec_nxt = any_ifu_ce & any_iferr_vld |
1019
                          early_mec & ~clear_iferr_d1 & ~mov_ely_reg_w;
1020
 
1021
   // bug 6155 & 6821
1022
   assign early_priv_nxt = any_priv_state & ~any_iferr_vld & ~any_rf_err & ~any_lsu_err & any_ifu_err |
1023
                           early_priv & ~clear_iferr_d1 & ~mov_ely_reg_w;
1024
 
1025 113 albert.wat
   dffr_s #(12) elyme_reg(.din ({early_meu_nxt,
1026 95 fafa1971
                                                 early_mec_nxt,
1027
                                                 early_priv_nxt}),
1028
                                    .q   ({early_meu,
1029
                                                 early_mec,
1030
                                                 early_priv}),
1031
                                    .clk (clk),
1032
                                    .rst (erb_reset),
1033 113 albert.wat
                                    .se  (se), `SIMPLY_RISC_SCANIN, .so());
1034 95 fafa1971
 
1035
   // pipeline progress
1036 113 albert.wat
   dff_s #(1) clre_ff(.din (fcl_erb_inst_issue_d),
1037 95 fafa1971
                    .q   (clr_elyff_e),
1038 113 albert.wat
                    .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
1039 95 fafa1971
   assign early_err_vec_e = (any_iferr_vld | early_l2ce) & thr_e;
1040
   assign clr_err_qual_e = (|early_err_vec_e[3:0]) & clr_elyff_e;
1041
 
1042 113 albert.wat
   dff_s #(1) clrm_ff(.din (clr_err_qual_e),
1043 95 fafa1971
                    .q   (clr_elyff_m),
1044 113 albert.wat
                    .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
1045
   dff_s #(1) clrw_ff(.din (clr_elyff_m),
1046 95 fafa1971
                    .q   (clr_elyff_w),
1047 113 albert.wat
                    .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
1048 95 fafa1971
 
1049
   // fix for 6142 and 6159
1050
   // delay err reg clear by one cycle to prevent clearing your own errors
1051 113 albert.wat
   dff_s #(4) clree_reg(.din (fcl_erb_clear_iferr),
1052 95 fafa1971
                      .q   (clear_iferr_d1),
1053 113 albert.wat
                      .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
1054 95 fafa1971
 
1055
 
1056
   assign clear_ely_reg_w = {4{clr_elyff_w}} & thr_w &
1057
                                  (any_iferr_vld | early_l2ce);  // why again?
1058
   assign mov_ely_reg_w = clear_ely_reg_w &
1059
                          {4{ifu_tlu_inst_vld_w & ~erb_reset}};
1060
 
1061
 
1062
   // asi error status output
1063
   assign err_stat0 = {meu[0], mec[0], priv[0],
1064
                                   3'b100,                    // rw, enc, ma
1065
                                   imdu[0], imt[0],
1066
                                   dmdu[0], dmt[0],
1067
                                   idc[0], itc[0], ddc[0], dtc[0],
1068
                                   irc[0], iru[0], frc[0], fru[0],
1069
                                   ldau[0], ncu[0],
1070
                       dmsu[0], 1'b0, mau[0]};
1071
 
1072
   assign err_stat1 = {meu[1], mec[1], priv[1],
1073
                                   3'b100,
1074
                                   imdu[1], imt[1],
1075
                                   dmdu[1], dmt[1],
1076
                                   idc[1], itc[1], ddc[1], dtc[1],
1077
                                   irc[1], iru[1], frc[1], fru[1],
1078
                                   ldau[1], ncu[1],
1079
                       dmsu[1], 1'b0, mau[1]};
1080
 
1081
   assign err_stat2 = {meu[2], mec[2], priv[2],
1082
                                   3'b100,
1083
                                   imdu[2], imt[2],
1084
                                   dmdu[2], dmt[2],
1085
                                   idc[2], itc[2], ddc[2], dtc[2],
1086
                                   irc[2], iru[2], frc[2], fru[2],
1087
                                   ldau[2], ncu[2],
1088
                       dmsu[2], 1'b0, mau[2]};
1089
 
1090
   assign err_stat3 = {meu[3], mec[3], priv[3],
1091
                                   3'b100,
1092
                                   imdu[3], imt[3],
1093
                                   dmdu[3], dmt[3],
1094
                                   idc[3], itc[3], ddc[3], dtc[3],
1095
                                   irc[3], iru[3], frc[3], fru[3],
1096
                                   ldau[3], ncu[3],
1097
                       dmsu[3], 1'b0, mau[3]};
1098
 
1099
   mux4ds #(23) err_stat_asi(.dout (erc_erd_errstat_asidata),
1100
                                               .in0  (err_stat0),
1101
                                               .in1  (err_stat1),
1102
                                               .in2  (err_stat2),
1103
                                               .in3  (err_stat3),
1104
                                               .sel0 (asi_thr_s[0]),
1105
                                               .sel1 (asi_thr_s[1]),
1106
                                               .sel2 (asi_thr_s[2]),
1107
                                               .sel3 (asi_thr_s[3]));
1108
 
1109
//----------------------------------
1110
// Error Address Selection   
1111
//----------------------------------
1112
 
1113
   // TBD: Uncorrectible errors have to overwrite correctible errors
1114
   // mux 0
1115
   // FRF errors are mutex with everything else
1116
   // ITLB asi errors are mutex with everything else
1117
   // ASI writes are mutex with everything else
1118
   // only one of these errors could occur at a given time
1119
   assign  erc_erd_eadr0_sel_lsu_l = ~(sel_lsu_err);
1120
 
1121
   assign  erc_erd_eadr0_sel_irf_l =  ~(~sel_lsu_err & any_irf_err);
1122
 
1123
   assign  erc_erd_eadr0_sel_itlb_l = ~(~sel_lsu_err & ~any_irf_err &
1124
                                                                      any_tlbasi_err);
1125
 
1126
   assign  erc_erd_eadr0_sel_frf_l = ~(~sel_lsu_err & ~any_irf_err &
1127
                                                               ~any_tlbasi_err);
1128
 
1129
   // mux 1
1130
   // l1 pa and tlb feterr can be simultaneous
1131
   // TBD: need to reorder and make spu lower priority?
1132
   assign  erc_erd_eadr1_sel_other_l = ~(any_spu_ue);
1133
 
1134
   assign  erc_erd_eadr1_sel_l2pa_l = ~(~any_spu_ue &
1135
                                        (l2if_unc_err | l2if_corr_err));
1136
 
1137
   assign  erc_erd_eadr1_sel_pcd1_l = ~(~l2if_unc_err & ~l2if_corr_err &
1138
                                                                      ~any_spu_ue &
1139
                                        thr_d1 & {4{tlb_feterr_d1}});
1140
 
1141
   assign  erc_erd_eadr1_sel_l1pa_l = ~(~l2if_unc_err & ~l2if_corr_err &
1142
                                                                      ({4{~tlb_feterr_d1}} | ~thr_d1) &
1143
                                        ~any_spu_ue);
1144
 
1145
//   assign  erc_erd_eadr1_sel_other_l = ~(~l2if_unc_err & ~l2if_corr_err & 
1146
//                                                                 {4{~tlb_feterr_d1}} & ~icache_pa_err_d1);
1147
 
1148
 
1149
   // mux2
1150
   assign sel_lsu_err = ~any_err_vld & any_lsu_err |
1151
                              ~any_ue_vld & any_lsu_ue;
1152
 
1153
   assign sel_ifuspu_err = (~any_err_vld & ~any_iferr_vld & any_ifu_err |
1154
                            ~any_ue_vld & any_spu_ue |
1155
                                              ~any_ue_vld & ~ifet_ue_vld & any_ifu_ue);
1156
 
1157
   assign sel_rftlb_err = ~any_ue_vld & (any_rf_ue |
1158
                                                                       any_tlbasi_err) |
1159
                                            ~any_err_vld & any_rf_ce;
1160
 
1161
 
1162
   assign  erc_erd_eadr2_sel_wrt_l = ~(asi_wrt_err_addr);
1163
 
1164
   assign  erc_erd_eadr2_sel_mx0_l = ~(~asi_wrt_err_addr &
1165
                                                               (sel_lsu_err |
1166
                                                                      sel_rftlb_err));
1167
 
1168
   assign  erc_erd_eadr2_sel_mx1_l = ~(~sel_lsu_err &
1169
                                                               ~asi_wrt_err_addr &
1170
                                                               ~sel_rftlb_err &
1171
                                                               sel_ifuspu_err);
1172
 
1173
   assign  erc_erd_eadr2_sel_old_l = ~(~sel_lsu_err &
1174
                                                               ~asi_wrt_err_addr &
1175
                                                               ~sel_rftlb_err &
1176
                                                               ~sel_ifuspu_err);
1177
 
1178
//-----------------------------
1179
// Error Enable Reg
1180
//-----------------------------
1181
   assign nceen_nxt = asi_wrt_err_en & {4{nceen_wrt_data}} |
1182
                            ~asi_wrt_err_en & nceen;
1183
 
1184
   assign ceen_nxt = asi_wrt_err_en & {4{ceen_wrt_data}} |
1185
                           ~asi_wrt_err_en & ceen;
1186
 
1187 113 albert.wat
   dffr_s #(8) err_en_reg(.din ({nceen_nxt, ceen_nxt}),
1188 95 fafa1971
                                    .q   ({nceen, ceen}),
1189
                                    .rst (erb_reset),
1190 113 albert.wat
                                    .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
1191 95 fafa1971
 
1192
   assign nceen_d = (thr_d[0] & nceen[0] |
1193
                     thr_d[1] & nceen[1] |
1194
                     thr_d[2] & nceen[2] |
1195
                     thr_d[3] & nceen[3]);
1196
 
1197 113 albert.wat
   dff_s #(1) nce_ff(.din (nceen_d),
1198 95 fafa1971
                   .q   (ifu_exu_nceen_e),
1199 113 albert.wat
                   .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
1200 95 fafa1971
 
1201
   assign ifu_lsu_nceen = nceen;
1202
   assign ifu_spu_nceen = nceen;
1203
 
1204
   assign ifu_ce_trap = mov_ely_reg_w & ifet_ce_vld;
1205
   assign ce_trapvec =  (ifu_ce_trap |
1206
                                           any_rf_ce |
1207
                                           {4{ifq_erb_ce_rep}} & thr_l2ie |
1208
                         any_spu_ce |
1209
                                           any_lsu_ce) & ceen;
1210
 
1211 113 albert.wat
   dff_s #(4) ceint_reg(.din (ce_trapvec),
1212 95 fafa1971
                                  .q   (erb_fcl_ce_trapvec),
1213 113 albert.wat
                                  .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
1214 95 fafa1971
 
1215
   assign ue_trapvec =  ({4{ifq_erb_ue_rep}} & thr_l2ie |
1216
                         any_spu_ue & {4{spu_ifu_int_w2}}) & nceen;
1217
 
1218
   assign erb_fcl_spu_uetrap = any_spu_ue & nceen;
1219
 
1220 113 albert.wat
   dff_s #(4) ueint_reg(.din (ue_trapvec),
1221 95 fafa1971
                                  .q   (erb_fcl_ue_trapvec),
1222 113 albert.wat
                                  .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
1223 95 fafa1971
 
1224
 
1225
   mux4ds #(2) err_en_asi(.dout (erc_erd_erren_asidata),
1226
                                            .in0  ({nceen[0], ceen[0]}),
1227
                                            .in1  ({nceen[1], ceen[1]}),
1228
                                            .in2  ({nceen[2], ceen[2]}),
1229
                                            .in3  ({nceen[3], ceen[3]}),
1230
                                            .sel0 (asi_thr_s[0]),
1231
                                            .sel1 (asi_thr_s[1]),
1232
                                            .sel2 (asi_thr_s[2]),
1233
                                            .sel3 (asi_thr_s[3]));
1234
 
1235
//-------------------------
1236
// Error Inject
1237
//-------------------------
1238
   assign wrt_errinj_i2 = (ifq_erb_asi_errinj_i2 & ifq_erb_asiwr_i2);
1239
   assign ecc_mask_nxt =  wrt_errinj_i2 ?  ifq_erb_asidata_i2[7:0] :
1240
                                           ecc_mask[7:0];
1241
 
1242
   assign errinj_ctl_nxt[1:0] = wrt_errinj_i2 ? ifq_erb_asidata_i2[31:30] :
1243
                                                      errinj_ctl[1:0];
1244
 
1245
   // correct for single shot
1246
   assign errinj_vec_nxt[5:0] = wrt_errinj_i2 ? ifq_erb_asidata_i2[29:24] :
1247
                                      errinj_ctl[0] ? corr_errinj_vec :
1248
                                                      errinj_vec;
1249
 
1250 113 albert.wat
   dffr_s #(16) errinj_reg(.din ({errinj_ctl_nxt,
1251 95 fafa1971
                                                  errinj_vec_nxt,
1252
                                                  ecc_mask_nxt}),
1253
                                     .q   ({errinj_ctl,
1254
                                                  errinj_vec,
1255
                                                  ecc_mask}),
1256
                                     .rst (erb_reset),
1257 113 albert.wat
                                     .clk (clk), .se (se), `SIMPLY_RISC_SCANIN, .so());
1258 95 fafa1971
 
1259
   assign ifu_exu_ecc_mask = ecc_mask;
1260
   assign ifu_exu_inj_irferr = errinj_vec[1] & errinj_ctl[1];
1261
   assign ifu_ffu_inj_frferr = errinj_vec[0] & errinj_ctl[1];
1262
   assign ifu_lsu_error_inj[3:0] = errinj_vec[5:2] & {4{errinj_ctl[1]}};
1263
 
1264
   assign corr_errinj_vec[5:0] = errinj_vec[5:0] & ~{lsu_ifu_inj_ack[3:0],
1265
                                                                                         exu_ifu_inj_ack,
1266
                                                                                         ffu_ifu_inj_ack};
1267
   assign erc_erd_errinj_asidata = {errinj_ctl,
1268
                                                            errinj_vec,
1269
                                                            16'b0,
1270
                                                            ecc_mask};
1271
 
1272
//--------------------------
1273
//  ASI Stuff
1274
//--------------------------
1275
 
1276 113 albert.wat
   dff_s #(2) asiways_reg(.din (ifq_erb_asiway_f),
1277 95 fafa1971
                                    .q   (asi_way_s1),
1278 113 albert.wat
                                    .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
1279 95 fafa1971
 
1280
   assign dec_asiway_s1[0] = ~asi_way_s1[1] & ~asi_way_s1[0];
1281
   assign dec_asiway_s1[1] = ~asi_way_s1[1] &  asi_way_s1[0];
1282
   assign dec_asiway_s1[2] =  asi_way_s1[1] & ~asi_way_s1[0];
1283
   assign dec_asiway_s1[3] =  asi_way_s1[1] &  asi_way_s1[0];
1284
 
1285
   assign erc_erd_asiway_s1_l = ~dec_asiway_s1;
1286
 
1287
   assign asi_thr_i2[0] = ~ifq_fcl_asi_tid_bf[1] & ~ifq_fcl_asi_tid_bf[0];
1288
   assign asi_thr_i2[1] = ~ifq_fcl_asi_tid_bf[1] &  ifq_fcl_asi_tid_bf[0];
1289
   assign asi_thr_i2[2] =  ifq_fcl_asi_tid_bf[1] & ~ifq_fcl_asi_tid_bf[0];
1290
   assign asi_thr_i2[3] =  ifq_fcl_asi_tid_bf[1] &  ifq_fcl_asi_tid_bf[0];
1291
 
1292 113 albert.wat
   dff_s #(2) asi_tids_reg(.din (fcl_erb_asi_tid_f),
1293 95 fafa1971
                                            .q   (asi_tid_s1),
1294 113 albert.wat
                                            .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
1295
   dff_s #(2) asi_tidw2_reg(.din (asi_tid_s1),
1296 95 fafa1971
                                            .q   (asi_tid_w2),
1297 113 albert.wat
                                            .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
1298 95 fafa1971
   assign ifu_lsu_ldxa_tid_w2 = asi_tid_w2;
1299
 
1300
   assign erc_erd_asi_thr_l = ~asi_thr_s;
1301
 
1302
   assign asi_thr_s[0] = ~asi_tid_s1[1] & ~asi_tid_s1[0];
1303
   assign asi_thr_s[1] = ~asi_tid_s1[1] &  asi_tid_s1[0];
1304
   assign asi_thr_s[2] =  asi_tid_s1[1] & ~asi_tid_s1[0];
1305
   assign asi_thr_s[3] =  asi_tid_s1[1] &  asi_tid_s1[0];
1306
 
1307
   assign asi_thr_w2[0] = ~asi_tid_w2[1] & ~asi_tid_w2[0];
1308
   assign asi_thr_w2[1] = ~asi_tid_w2[1] &  asi_tid_w2[0];
1309
   assign asi_thr_w2[2] =  asi_tid_w2[1] & ~asi_tid_w2[0];
1310
   assign asi_thr_w2[3] =  asi_tid_w2[1] &  asi_tid_w2[0];
1311
 
1312
 
1313
   // F stage flops
1314 113 albert.wat
   dff_s #(1) asi_en_ff(.din (ifq_erb_asi_erren_i2),
1315 95 fafa1971
                                  .q   (asi_erren_f),
1316 113 albert.wat
                                  .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
1317 95 fafa1971
 
1318 113 albert.wat
   dff_s #(1) asi_stat_ff(.din (ifq_erb_asi_errstat_i2),
1319 95 fafa1971
                                    .q   (asi_errstat_f),
1320 113 albert.wat
                                    .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
1321 95 fafa1971
 
1322 113 albert.wat
   dff_s #(1) asi_addr_ff(.din (ifq_erb_asi_erraddr_i2),
1323 95 fafa1971
                                    .q   (asi_erraddr_f),
1324 113 albert.wat
                                    .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
1325 95 fafa1971
 
1326 113 albert.wat
   dff_s #(1) asi_inj_ff(.din (ifq_erb_asi_errinj_i2),
1327 95 fafa1971
                                   .q   (asi_errinj_f),
1328 113 albert.wat
                                   .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
1329 95 fafa1971
 
1330 113 albert.wat
   dff_s #(1) asi_im_ff(.din (ifq_erb_asi_imask_i2),
1331 95 fafa1971
                                  .q   (asi_imask_f),
1332 113 albert.wat
                                  .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
1333 95 fafa1971
 
1334
   // S stage Flops
1335 113 albert.wat
   dff_s #(1) asi_ens_ff(.din (asi_erren_f),
1336 95 fafa1971
                                   .q   (asi_erren_s),
1337 113 albert.wat
                                   .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
1338 95 fafa1971
 
1339 113 albert.wat
   dff_s #(1) asi_stats_ff(.din (asi_errstat_f),
1340 95 fafa1971
                                     .q   (asi_errstat_s),
1341 113 albert.wat
                                     .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
1342 95 fafa1971
 
1343 113 albert.wat
   dff_s #(1) asi_addrs_ff(.din (asi_erraddr_f),
1344 95 fafa1971
                                     .q   (asi_erraddr_s),
1345 113 albert.wat
                                     .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
1346 95 fafa1971
 
1347 113 albert.wat
   dff_s #(1) asi_injs_ff(.din (asi_errinj_f),
1348 95 fafa1971
                                    .q   (asi_errinj_s),
1349 113 albert.wat
                                    .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
1350 95 fafa1971
 
1351 113 albert.wat
   dff_s #(1) asi_ims_ff(.din (asi_imask_f),
1352 95 fafa1971
                                   .q   (asi_imask_s),
1353 113 albert.wat
                                   .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
1354 95 fafa1971
 
1355
   // ASI Reads
1356
   // All ASI reads except TLB
1357 113 albert.wat
   dff_s #(1) asi_rdf_ff(.din (ifq_fcl_asird_bf),
1358 95 fafa1971
                                   .q   (asird_f),
1359 113 albert.wat
                                   .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
1360
   dff_s #(1) asi_rds_ff(.din (asird_f),
1361 95 fafa1971
                                   .q   (asird_s),
1362 113 albert.wat
                                   .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
1363 95 fafa1971
 
1364
   // fwd reads
1365 113 albert.wat
   dff_s #(1) fwd_rdf_ff(.din (ifq_erb_fwdrd_bf),
1366 95 fafa1971
                                   .q   (fwdrd_f),
1367 113 albert.wat
                                   .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
1368
   dff_s #(1) fwd_rds_ff(.din (fwdrd_f),
1369 95 fafa1971
                                   .q   (fwdrd_s),
1370 113 albert.wat
                                   .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
1371
   dff_s #(1) fwd_rdd_ff(.din (fwdrd_s),
1372 95 fafa1971
                                   .q   (fwdrd_d),
1373 113 albert.wat
                                   .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
1374 95 fafa1971
 
1375
   assign ifu_lsu_fwd_data_vld = fwdrd_d;
1376
   assign asifwd_rd_s = asird_s | fwdrd_s;
1377
 
1378
 
1379
   // asi reads from icache
1380 113 albert.wat
   dff_s #(1) ic_rdts_ff(.din (ifq_erb_rdtag_f),
1381 95 fafa1971
                                   .q   (rdtag_s),
1382 113 albert.wat
                                   .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
1383 95 fafa1971
 
1384
   // forward requests also read instruction memory
1385
   assign rdinst_f = fwdrd_f | ifq_erb_rdinst_f;
1386
 
1387 113 albert.wat
   dff_s #(1) ic_rdds_ff(.din (rdinst_f),
1388 95 fafa1971
                                   .q   (rdinst_s),
1389 113 albert.wat
                                   .clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
1390 95 fafa1971
 
1391
 
1392
//   assign rst_tri_en = 1'b0;
1393
 
1394
   // pick err asi source
1395
   assign erc_erd_errasi_sel_en_l   = ~asi_erren_s;
1396
   assign erc_erd_errasi_sel_stat_l = ~asi_errstat_s | asi_erren_s;
1397
   assign erc_erd_errasi_sel_inj_l  = ~asi_errinj_s | asi_errstat_s |
1398
                                       asi_erren_s;
1399
   assign erc_erd_errasi_sel_addr_l =  asi_erren_s | asi_errstat_s |
1400
                                             asi_errinj_s;
1401
 
1402
   assign err_asi_s = (asi_erren_s | asi_errstat_s | asi_errinj_s |
1403
                             asi_erraddr_s);
1404
 
1405
   // pick other asi source
1406
   assign erc_erd_miscasi_sel_ict_l = ~rdtag_s;
1407
   assign erc_erd_miscasi_sel_imask_l = ~asi_imask_s | rdtag_s;
1408
   assign erc_erd_miscasi_sel_other_l = rdtag_s | asi_imask_s;
1409
 
1410
   // pick source for final asi loads
1411
   assign erc_erd_asisrc_sel_icd_s_l = ~(asifwd_rd_s & rdinst_s);
1412
   assign erc_erd_asisrc_sel_err_s_l = ~(asifwd_rd_s & ~rdinst_s & err_asi_s);
1413
   assign erc_erd_asisrc_sel_misc_s_l = ~(asifwd_rd_s & ~rdinst_s & ~err_asi_s);
1414
   assign erc_erd_asisrc_sel_itlb_s_l = ~(~asifwd_rd_s);
1415
 
1416
   // is this asi read valid (for checking parity)
1417
   assign asi_ttevld_s1 = fcl_erb_itlbrd_vld_s & ~fcl_erb_itlbrd_data_s;
1418
   assign asi_tdevld_s1 = fcl_erb_itlbrd_vld_s & fcl_erb_itlbrd_data_s;
1419
 
1420
   assign ldxa_data_vld_s = fcl_erb_itlbrd_vld_s | asird_s;
1421
//   assign ifu_lsu_ldxa_data_vld_w1 = ldxa_data_vld_s;
1422
 
1423 113 albert.wat
   dff_s #(1) asirdd_ff(.din (ldxa_data_vld_s),
1424 95 fafa1971
                      .q   (ldxa_data_vld_d),
1425
                      .clk (clk),
1426 113 albert.wat
                      .se  (se), `SIMPLY_RISC_SCANIN, .so());
1427 95 fafa1971
 
1428
   assign ifu_lsu_ldxa_data_vld_w2 = ldxa_data_vld_d;
1429
 
1430
 
1431
   // ASI Writes
1432
   assign asi_wrt_err_en = asi_thr_i2 & {4{ifq_erb_asiwr_i2 &
1433
                                                                         ifq_erb_asi_erren_i2}};
1434
   assign asi_wrt_err_stat = asi_thr_i2 & {4{ifq_erb_asiwr_i2 &
1435
                                                                           ifq_erb_asi_errstat_i2}};
1436
   // err inj is common to the core
1437
//   assign asi_wrt_err_inj = asi_thr_i2 & {4{ifq_erb_asiwr_i2 &
1438
//                                                                        ifq_erb_asi_errinj_i2}};
1439
   assign asi_wrt_err_addr = asi_thr_i2 & {4{ifq_erb_asiwr_i2 &
1440
                                                                           ifq_erb_asi_erraddr_i2}};
1441
 
1442
   assign erc_erd_ld_imask = ifq_erb_asiwr_i2 & ifq_erb_asi_imask_i2;
1443
 
1444
 
1445
   // ASI Write Data
1446
   assign  meu_wrt_data  = ifq_erb_asidata_i2[31];
1447
   assign  mec_wrt_data  = ifq_erb_asidata_i2[30];
1448
   assign  priv_wrt_data = ifq_erb_asidata_i2[29];
1449
 
1450
   assign  imdu_wrt_data = ifq_erb_asidata_i2[25];
1451
   assign  imt_wrt_data  = ifq_erb_asidata_i2[24];
1452
   assign  dmdu_wrt_data = ifq_erb_asidata_i2[23];
1453
   assign  dmt_wrt_data  = ifq_erb_asidata_i2[22];
1454
   assign  idc_wrt_data  = ifq_erb_asidata_i2[21];
1455
   assign  itc_wrt_data  = ifq_erb_asidata_i2[20];
1456
   assign  ddc_wrt_data  = ifq_erb_asidata_i2[19];
1457
   assign  dtc_wrt_data  = ifq_erb_asidata_i2[18];
1458
   assign  irc_wrt_data  = ifq_erb_asidata_i2[17];
1459
   assign  iru_wrt_data  = ifq_erb_asidata_i2[16];
1460
   assign  frc_wrt_data  = ifq_erb_asidata_i2[15];
1461
   assign  fru_wrt_data  = ifq_erb_asidata_i2[14];
1462
   assign  ldau_wrt_data = ifq_erb_asidata_i2[13];
1463
   assign  ncu_wrt_data  = ifq_erb_asidata_i2[12];
1464
   assign  dmsu_wrt_data = ifq_erb_asidata_i2[11];
1465
   assign  mau_wrt_data  = ifq_erb_asidata_i2[9];
1466
 
1467
   assign nceen_wrt_data = ifq_erb_asidata_i2[1];
1468
   assign ceen_wrt_data  = ifq_erb_asidata_i2[0];
1469
 
1470
   //
1471
   sink s0(.in (ifq_erb_asidata_i2[8]));
1472
   sink s1(.in (ifq_erb_asidata_i2[10]));
1473
 
1474
endmodule
1475
 

powered by: WebSVN 2.1.0

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