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 105

Go to most recent revision | 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
////////////////////////////////////////////////////////////////////////
22
/*
23
//  Module Name:  sparc_ifu_errdp
24
*/
25
////////////////////////////////////////////////////////////////////////
26
// Global header file includes
27
////////////////////////////////////////////////////////////////////////
28
 
29
/*
30
/* ========== Copyright Header Begin ==========================================
31
*
32
* OpenSPARC T1 Processor File: lsu.h
33
* Copyright (c) 2006 Sun Microsystems, Inc.  All Rights Reserved.
34
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
35
*
36
* The above named program is free software; you can redistribute it and/or
37
* modify it under the terms of the GNU General Public
38
* License version 2 as published by the Free Software Foundation.
39
*
40
* The above named program is distributed in the hope that it will be
41
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
42
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
43
* General Public License for more details.
44
*
45
* You should have received a copy of the GNU General Public
46
* License along with this work; if not, write to the Free Software
47
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
48
*
49
* ========== Copyright Header End ============================================
50
*/
51
 
52
 
53
 
54
 
55
 
56
 
57
 
58
 
59
//`define STB_PCX_WY_HI   107
60
//`define STB_PCX_WY_LO   106
61
 
62
 
63
 
64
 
65
 
66
 
67
 
68
 
69
 
70
 
71
 
72
 
73
 
74
 
75
 
76
 
77
 
78
 
79
 
80
 
81
 
82
 
83
 
84
 
85
 
86
 
87
 
88
 
89
 
90
 
91
 
92
 
93
 
94
 
95
 
96
 
97
 
98
 
99
 
100
 
101
 
102
 
103
 
104
 
105
 
106
 
107
 
108
 
109
 
110
 
111
 
112
 
113
 
114
 
115
 
116
 
117
 
118
 
119
 
120
 
121
 
122
 
123
 
124
 
125
 
126
 
127
 
128
 
129
 
130
 
131
 
132
 
133
 
134
 
135
 
136
 
137
 
138
 
139
 
140
 
141
 
142
 
143
 
144
// TLB Tag and Data Format
145
 
146
 
147
 
148
 
149
 
150
 
151
 
152
 
153
 
154
 
155
 
156
 
157
 
158
 
159
 
160
 
161
 
162
 
163
 
164
 
165
 
166
 
167
 
168
 
169
 
170
 
171
 
172
 
173
 
174
 
175
 
176
 
177
 
178
 
179
 
180
 
181
 
182
 
183
 
184
 
185
 
186
 
187
 
188
 
189
 
190
 
191
 
192
 
193
 
194
 
195
 
196
 
197
 
198
 
199
 
200
 
201
 
202
 
203
 
204
 
205
 
206
// I-TLB version - lsu_tlb only.
207
 
208
 
209
 
210
 
211
 
212
 
213
 
214
 
215
 
216
 
217
 
218
 
219
 
220
 
221
 
222
 
223
 
224
 
225
 
226
 
227
 
228
 
229
 
230
 
231
// Invalidate Format
232
//addr<5:4>=00
233
 
234
 
235
 
236
 
237
 
238
 
239
 
240
 
241
 
242
 
243
 
244
 
245
 
246
 
247
 
248
 
249
 
250
//addr<5:4>=01
251
 
252
 
253
 
254
 
255
 
256
 
257
 
258
 
259
 
260
 
261
 
262
 
263
 
264
 
265
 
266
 
267
 
268
//addr<5:4>=10
269
 
270
 
271
 
272
 
273
 
274
 
275
 
276
 
277
 
278
 
279
 
280
 
281
 
282
 
283
 
284
 
285
 
286
//addr<5:4>=11
287
 
288
 
289
 
290
 
291
 
292
 
293
 
294
 
295
 
296
 
297
 
298
 
299
 
300
 
301
 
302
 
303
 
304
// cpuid - 4b
305
 
306
 
307
 
308
// CPUany, addr<5:4>=00,10
309
 
310
 
311
 
312
 
313
 
314
// CPUany, addr<5:4>=01,11
315
 
316
 
317
 
318
 
319
// CPUany, addr<5:4>=01,11
320
 
321
 
322
 
323
 
324
// DTAG parity error Invalidate
325
 
326
 
327
 
328
 
329
// CPX BINIT STORE
330
 
331
/*
332
/* ========== Copyright Header Begin ==========================================
333
*
334
* OpenSPARC T1 Processor File: ifu.h
335
* Copyright (c) 2006 Sun Microsystems, Inc.  All Rights Reserved.
336
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
337
*
338
* The above named program is free software; you can redistribute it and/or
339
* modify it under the terms of the GNU General Public
340
* License version 2 as published by the Free Software Foundation.
341
*
342
* The above named program is distributed in the hope that it will be
343
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
344
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
345
* General Public License for more details.
346
*
347
* You should have received a copy of the GNU General Public
348
* License along with this work; if not, write to the Free Software
349
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
350
*
351
* ========== Copyright Header End ============================================
352
*/
353
////////////////////////////////////////////////////////////////////////
354
/*
355
//
356
//  Module Name: ifu.h
357
//  Description:
358
//  All ifu defines
359
*/
360
 
361
//--------------------------------------------
362
// Icache Values in IFU::ICD/ICV/ICT/FDP/IFQDP
363
//--------------------------------------------
364
// Set Values
365
 
366
// IC_IDX_HI = log(icache_size/4ways) - 1
367
 
368
 
369
// !!IMPORTANT!! a change to IC_LINE_SZ will mean a change to the code as
370
//   well.  Unfortunately this has not been properly parametrized.
371
//   Changing the IC_LINE_SZ param alone is *not* enough.
372
 
373
 
374
// !!IMPORTANT!! a change to IC_TAG_HI will mean a change to the code as
375
//   well.  Changing the IC_TAG_HI param alone is *not* enough to
376
//   change the PA range. 
377
// highest bit of PA
378
 
379
 
380
 
381
// Derived Values
382
// 4095
383
 
384
 
385
// number of entries - 1 = 511
386
 
387
 
388
// 12
389
 
390
 
391
// 28
392
 
393
 
394
// 7
395
 
396
 
397
// tags for all 4 ways + parity
398
// 116
399
 
400
 
401
// 115
402
 
403
 
404
 
405
//----------------------------------------------------------------------
406
// For thread scheduler in IFU::DTU::SWL
407
//----------------------------------------------------------------------
408
// thread states:  (thr_state[4:0])
409
 
410
 
411
 
412
 
413
 
414
 
415
 
416
 
417
 
418
// thread configuration register bit fields
419
 
420
 
421
 
422
 
423
 
424
 
425
 
426
//----------------------------------------------------------------------
427
// For MIL fsm in IFU::IFQ
428
//----------------------------------------------------------------------
429
 
430
 
431
 
432
 
433
 
434
 
435
 
436
 
437
 
438
 
439
 
440
//---------------------------------------------------
441
// Interrupt Block
442
//---------------------------------------------------
443
 
444
 
445
 
446
 
447
 
448
 
449
 
450
//-------------------------------------
451
// IFQ
452
//-------------------------------------
453
// valid bit plus ifill
454
 
455
 
456
 
457
 
458
 
459
 
460
 
461
 
462
 
463
 
464
 
465
 
466
 
467
//`ifdef SPARC_L2_64B
468
 
469
 
470
//`else
471
//`define BANK_ID_HI 8
472
//`define BANK_ID_LO 7
473
//`endif
474
 
475
//`define CPX_INV_PA_HI  116
476
//`define CPX_INV_PA_LO  112
477
 
478
 
479
 
480
 
481
 
482
 
483
 
484
//----------------------------------------
485
// IFU Traps
486
//----------------------------------------
487
// precise
488
 
489
 
490
 
491
 
492
 
493
 
494
 
495
 
496
 
497
 
498
 
499
 
500
 
501
 
502
 
503
// disrupting
504
 
505
 
506
 
507
 
508
 
509
 
510
 
511
 
512
module sparc_ifu_errdp(/*AUTOARG*/
513
   // Outputs
514
   so, ifu_lsu_ldxa_data_w2, erb_dtu_imask, erd_erc_tlbt_pe_s1,
515
   erd_erc_tlbd_pe_s1, erd_erc_tagpe_s1, erd_erc_nirpe_s1,
516
   erd_erc_fetpe_s1, erd_erc_tte_pgsz,
517
   // Inputs
518
   rclk, se, si, erb_reset, itlb_rd_tte_data, itlb_rd_tte_tag,
519
   itlb_ifq_paddr_s, wsel_fdp_fetdata_s1, wsel_fdp_topdata_s1,
520
   wsel_erb_asidata_s, ict_itlb_tags_f, icv_itlb_valid_f,
521
   lsu_ifu_err_addr, spu_ifu_err_addr_w2, fdp_erb_pc_f,
522
   exu_ifu_err_reg_m, exu_ifu_err_synd_m, ffu_ifu_err_reg_w2,
523
   ffu_ifu_err_synd_w2, tlu_itlb_rw_index_g, erc_erd_pgsz_b0,
524
   erc_erd_pgsz_b1, erc_erd_erren_asidata, erc_erd_errstat_asidata,
525
   erc_erd_errinj_asidata, ifq_erb_asidata_i2, ifq_erb_wrtag_f,
526
   ifq_erb_wrindex_f, erc_erd_asiway_s1_l, fcl_erb_itlbrd_data_s,
527
   erc_erd_ld_imask, erc_erd_asisrc_sel_icd_s_l,
528
   erc_erd_asisrc_sel_misc_s_l, erc_erd_asisrc_sel_err_s_l,
529
   erc_erd_asisrc_sel_itlb_s_l, erc_erd_errasi_sel_en_l,
530
   erc_erd_errasi_sel_stat_l, erc_erd_errasi_sel_inj_l,
531
   erc_erd_errasi_sel_addr_l, erc_erd_miscasi_sel_ict_l,
532
   erc_erd_miscasi_sel_imask_l, erc_erd_miscasi_sel_other_l,
533
   erc_erd_asi_thr_l, erc_erd_eadr0_sel_irf_l,
534
   erc_erd_eadr0_sel_itlb_l, erc_erd_eadr0_sel_frf_l,
535
   erc_erd_eadr0_sel_lsu_l, erc_erd_eadr1_sel_pcd1_l,
536
   erc_erd_eadr1_sel_l1pa_l, erc_erd_eadr1_sel_l2pa_l,
537
   erc_erd_eadr1_sel_other_l, erc_erd_eadr2_sel_mx1_l,
538
   erc_erd_eadr2_sel_wrt_l, erc_erd_eadr2_sel_mx0_l,
539
   erc_erd_eadr2_sel_old_l
540
   );
541
 
542
   input       rclk,
543
               se,
544
               si,
545
               erb_reset;
546
 
547
   input [42:0] itlb_rd_tte_data;   // this is in s1
548
   input [58:0] itlb_rd_tte_tag;    // this is in s1
549
   input [39:10] itlb_ifq_paddr_s;
550
   input [33:0] wsel_fdp_fetdata_s1,
551
                            wsel_fdp_topdata_s1;
552
   input [33:0] wsel_erb_asidata_s;
553
 
554
   input [(((39 - 11) * 4) + 3):0] ict_itlb_tags_f;
555
   input [3:0]              icv_itlb_valid_f;
556
 
557
   input [47:4]  lsu_ifu_err_addr;
558
   input [39:4]  spu_ifu_err_addr_w2;
559
   input [47:0]  fdp_erb_pc_f;
560
 
561
   input [7:0]   exu_ifu_err_reg_m;
562
   input [7:0]   exu_ifu_err_synd_m;
563
   input [5:0]   ffu_ifu_err_reg_w2;
564
   input [13:0]  ffu_ifu_err_synd_w2;
565
   input [5:0]   tlu_itlb_rw_index_g;
566
 
567
   input         erc_erd_pgsz_b0,
568
                 erc_erd_pgsz_b1;
569
 
570
   input [1:0]   erc_erd_erren_asidata;
571
   input [22:0]  erc_erd_errstat_asidata;
572
   input [31:0]  erc_erd_errinj_asidata;
573
   input [47:0]  ifq_erb_asidata_i2;
574
 
575
   input [(39 - 11)-1:0] ifq_erb_wrtag_f;
576
   input [11:4]   ifq_erb_wrindex_f;
577
 
578
   // mux selects
579
   input [3:0]  erc_erd_asiway_s1_l;
580
   input        fcl_erb_itlbrd_data_s;
581
   input        erc_erd_ld_imask;
582
 
583
   input        erc_erd_asisrc_sel_icd_s_l,
584
                            erc_erd_asisrc_sel_misc_s_l,
585
                            erc_erd_asisrc_sel_err_s_l,
586
                            erc_erd_asisrc_sel_itlb_s_l;
587
 
588
   input        erc_erd_errasi_sel_en_l,
589
                            erc_erd_errasi_sel_stat_l,
590
                            erc_erd_errasi_sel_inj_l,
591
                            erc_erd_errasi_sel_addr_l;
592
 
593
   input        erc_erd_miscasi_sel_ict_l,
594
                            erc_erd_miscasi_sel_imask_l,
595
                            erc_erd_miscasi_sel_other_l;
596
 
597
   input [3:0]  erc_erd_asi_thr_l;
598
 
599
   input [3:0]  erc_erd_eadr0_sel_irf_l,
600
                            erc_erd_eadr0_sel_itlb_l,
601
                            erc_erd_eadr0_sel_frf_l,
602
                            erc_erd_eadr0_sel_lsu_l;
603
 
604
   input [3:0]  erc_erd_eadr1_sel_pcd1_l,
605
                            erc_erd_eadr1_sel_l1pa_l,
606
                            erc_erd_eadr1_sel_l2pa_l,
607
                            erc_erd_eadr1_sel_other_l;
608
 
609
   input [3:0]  erc_erd_eadr2_sel_mx1_l,
610
                            erc_erd_eadr2_sel_wrt_l,
611
                            erc_erd_eadr2_sel_mx0_l,
612
                            erc_erd_eadr2_sel_old_l;
613
 
614
 
615
   output       so;
616
   output [63:0] ifu_lsu_ldxa_data_w2;
617
   output [38:0] erb_dtu_imask;
618
//   output [9:0]  erb_ifq_paddr_s;
619
 
620
   output [1:0]  erd_erc_tlbt_pe_s1,
621
                             erd_erc_tlbd_pe_s1;
622
   output [3:0]  erd_erc_tagpe_s1;
623
   output        erd_erc_nirpe_s1,
624
                             erd_erc_fetpe_s1;
625
 
626
   output [2:0]  erd_erc_tte_pgsz;
627
 
628
 
629
//   
630
// local signals   
631
//
632
 
633
   wire [47:4]   lsu_err_addr;
634
 
635
   wire [(((39 - 11) * 4) + 3):0]  ictags_s1;
636
   wire [3:0]               icv_data_s1;
637
   wire [31:0]              tag_asi_data;
638
 
639
   wire [47:4]              t0_eadr_mx0_out,
640
                                        t1_eadr_mx0_out,
641
                                        t2_eadr_mx0_out,
642
                                        t3_eadr_mx0_out,
643
                                        t0_eadr_mx1_out,
644
                                        t1_eadr_mx1_out,
645
                                        t2_eadr_mx1_out,
646
                                        t3_eadr_mx1_out;
647
 
648
   wire [47:4]              t0_err_addr_nxt,
649
                                        t0_err_addr,
650
                                        t1_err_addr_nxt,
651
                                        t1_err_addr,
652
                                        t2_err_addr_nxt,
653
                                        t2_err_addr,
654
                                        t3_err_addr_nxt,
655
                                        t3_err_addr;
656
 
657
   wire [47:4]              err_addr_asidata;
658
 
659
   wire [63:0]              formatted_tte_data,
660
                                        formatted_tte_tag,
661
                                        tlb_asi_data,
662
                                        misc_asi_data,
663
                                        err_asi_data,
664
                            ldxa_data_s,
665
                            ldxa_data_d;
666
 
667
   wire [39:4]              paddr_s1,
668
                                        paddr_d1;
669
 
670
   wire [39:4]              ifet_addr_f;
671
 
672
   wire [47:0]              pc_s1;
673
   wire [47:4]              pc_d1;
674
   wire [7:0]               irfaddr_w,
675
                            irfsynd_w;
676
   wire                     irfaddr_4_w;
677
   wire [5:0]               itlb_asi_index;
678
 
679
   wire [38:0]              imask_next;
680
 
681
   wire                     clk;
682
 
683
 
684
//
685
// Code Begins Here
686
//
687
   assign                   clk = rclk;
688
 
689
//-------------
690
// Tags
691
//-------------   
692
   dff #((((39 - 11) * 4) + 4)) tags_reg(.din (ict_itlb_tags_f),
693
                                           .q   (ictags_s1),
694
                                           .clk (clk),
695
                                           .se  (se), .si(), .so());
696
 
697
   dff #(4) vbits_reg(.din (icv_itlb_valid_f[3:0]),
698
                                  .q   (icv_data_s1),
699
                                  .clk (clk), .se(se), .si(), .so());
700
 
701
   // check parity
702
   sparc_ifu_par32  tag_par0(.in  ({3'b0, ictags_s1[(39 - 11):0]}),
703
                                               .out (erd_erc_tagpe_s1[0]));
704
   sparc_ifu_par32  tag_par1(.in  ({3'b0, ictags_s1[((2*(39 - 11)) + 1):((39 - 11)+1)]}),
705
                                               .out (erd_erc_tagpe_s1[1]));
706
   sparc_ifu_par32  tag_par2(.in  ({3'b0, ictags_s1[((3*(39 - 11)) + 2):(2*((39 - 11))+2)]}),
707
                                               .out (erd_erc_tagpe_s1[2]));
708
   sparc_ifu_par32  tag_par3(.in  ({3'b0, ictags_s1[((4*(39 - 11)) + 3):(3*((39 - 11))+3)]}),
709
                                               .out (erd_erc_tagpe_s1[3]));
710
 
711
   dp_mux4ds #(32) asitag_mux(.dout (tag_asi_data[31:0]),
712
                         .in0  ({icv_data_s1[0], 1'b0, ictags_s1[28], 1'b0, ictags_s1[27:0]}),
713
                         .in1  ({icv_data_s1[1], 1'b0, ictags_s1[57], 1'b0, ictags_s1[56:29]}),
714
                         .in2  ({icv_data_s1[2], 1'b0, ictags_s1[86], 1'b0, ictags_s1[85:58]}),
715
                         .in3  ({icv_data_s1[3], 1'b0, ictags_s1[115], 1'b0, ictags_s1[114:87]}),
716
                         .sel0_l (erc_erd_asiway_s1_l[0]),
717
                         .sel1_l (erc_erd_asiway_s1_l[1]),
718
                         .sel2_l (erc_erd_asiway_s1_l[2]),
719
                         .sel3_l (erc_erd_asiway_s1_l[3]));
720
 
721
//------------------
722
// Data
723
//------------------
724
   // parity check on instruction
725
   // This may have to be done in the next stage (at least partially)
726
 
727
   sparc_ifu_par34 nir_par(.in  (wsel_fdp_topdata_s1[33:0]),
728
                                             .out (erd_erc_nirpe_s1));
729
   sparc_ifu_par34 inst_par(.in  (wsel_fdp_fetdata_s1[33:0]),
730
                                              .out (erd_erc_fetpe_s1));
731
 
732
//----------------------------------------------------------------------
733
// TLB read data
734
//----------------------------------------------------------------------
735
 
736
//`ifdef SPARC_HPV_EN
737
   // don't include v(26) and u(24) bits in parity   
738
   sparc_ifu_par32 tt_tag_par0(.in  ({itlb_rd_tte_tag[33:27],
739
                                                              itlb_rd_tte_tag[25],
740
                                                              itlb_rd_tte_tag[23:0]}),
741
                                                 .out (erd_erc_tlbt_pe_s1[0]));
742
//`else
743
//   // don't include v(28) and u(26) bits in parity
744
//   sparc_ifu_par32 tt_tag_par0(.in  ({itlb_rd_tte_tag[33:29],
745
//                                                            itlb_rd_tte_tag[27],
746
//                                                            itlb_rd_tte_tag[25:0]}),
747
//                                               .out (erd_erc_tlbt_pe_s1[0]));
748
//`endif // !`ifdef SPARC_HPV_EN
749
 
750
 
751
   sparc_ifu_par32 tt_tag_par1(.in  ({7'b0, itlb_rd_tte_tag[58:34]}),
752
                                                 .out (erd_erc_tlbt_pe_s1[1]));
753
 
754
   sparc_ifu_par32 tt_data_par0(.in  (itlb_rd_tte_data[31:0]),
755
                                                        .out (erd_erc_tlbd_pe_s1[0]));
756
   sparc_ifu_par16 tt_data_par1(.in  ({5'b0, itlb_rd_tte_data[42:32]}),
757
                                                        .out (erd_erc_tlbd_pe_s1[1]));
758
 
759
//   assign erd_erc_tte_lock_s1 = itlb_rd_tte_data[`STLB_DATA_L];
760
 
761
 
762
//`ifdef        SPARC_HPV_EN
763
   assign erd_erc_tte_pgsz[2:0] = {itlb_rd_tte_data[23],
764
                                                           itlb_rd_tte_data[16],
765
                                                           itlb_rd_tte_data[12]};
766
 
767
   assign formatted_tte_tag[63:0] =
768
          {
769
//           `ifdef SUN4V_TAG_RD
770
           // implement this!
771
           itlb_rd_tte_tag[58:55],
772
//           `else
773
//         {4{itlb_rd_tte_tag[53]}},                                     // 4b
774
//           `endif
775
 
776
           itlb_rd_tte_tag[54],     // Parity                 1b
777
           itlb_rd_tte_tag[27], // mxsel2 - b27:22 vld    1b
778
           itlb_rd_tte_tag[17], // mxsel1 - b21:16 vld    1b
779
           itlb_rd_tte_tag[13], // mxsel0 - b15:13 vld    1b
780
 
781
           {8{itlb_rd_tte_tag[53]}},                                     // 8b
782
           itlb_rd_tte_tag[53:34], // 20b
783
           itlb_rd_tte_tag[33:28], // 6b
784
           itlb_rd_tte_tag[23:18], // 6b
785
           itlb_rd_tte_tag[16:14], // 3b
786
           itlb_rd_tte_tag[12:0]// 13b
787
           } ;
788
//`else
789
//   assign erd_erc_tte_pgsz[2:0] = {itlb_rd_tte_data[`STLB_DATA_21_19_SEL],
790
//                                                         itlb_rd_tte_data[`STLB_DATA_18_16_SEL],
791
//                                                         itlb_rd_tte_data[`STLB_DATA_15_13_SEL]};
792
//
793
//   assign formatted_tte_tag[63:0] =
794
//          {
795
//           {16{itlb_rd_tte_tag[54]}},                                    // 16b
796
//           itlb_rd_tte_tag[`STLB_TAG_VA_47_22_HI:`STLB_TAG_VA_47_22_LO], // 26b
797
//           itlb_rd_tte_tag[`STLB_TAG_VA_21_20_HI:`STLB_TAG_VA_21_20_LO], // 3b
798
//           itlb_rd_tte_tag[`STLB_TAG_VA_19],
799
//           itlb_rd_tte_tag[`STLB_TAG_VA_18_17_HI:`STLB_TAG_VA_18_17_LO], // 3b
800
//           itlb_rd_tte_tag[`STLB_TAG_VA_16],
801
//           itlb_rd_tte_tag[`STLB_TAG_VA_15_14_HI:`STLB_TAG_VA_15_14_LO], // 3b
802
//           itlb_rd_tte_tag[`STLB_TAG_VA_13],
803
//           itlb_rd_tte_tag[`STLB_TAG_CTXT_12_7_HI:`STLB_TAG_CTXT_12_7_LO],//13b
804
//           itlb_rd_tte_tag[`STLB_TAG_CTXT_6_0_HI:`STLB_TAG_CTXT_6_0_LO]
805
//           } ;
806
//`endif // !`ifdef SPARC_HPV_EN
807
 
808
 
809
//`ifdef        SPARC_HPV_EN
810
   assign formatted_tte_data[63:0] =
811
          {
812
           itlb_rd_tte_tag[26],           // V    (1b)
813
           erc_erd_pgsz_b1,                        // pg SZ msb 4m or 512k
814
           erc_erd_pgsz_b0,                        // pg sz lsb 4m or 64k
815
           itlb_rd_tte_data[10],       // NFO  (1b)
816
           itlb_rd_tte_data[9],        // IE   (1b)
817
           10'b0,                                  // soft2 
818
           itlb_rd_tte_data[23], // pgsz b2
819
           itlb_rd_tte_tag[24],
820
 
821
           itlb_rd_tte_data[42],      // Parity   (1b)
822
           itlb_rd_tte_data[23],   // mxsel2_l (1b)
823
           itlb_rd_tte_data[16],   // mxsel1_l (1b)
824
           itlb_rd_tte_data[12],   // mxsel0_l (1b)
825
 
826
           2'b0,                                   // unused diag 2b
827
           1'b0,                                   // ?? PA   (28b)
828
           itlb_rd_tte_data[41:30],
829
           itlb_rd_tte_data[29:24],
830
           itlb_rd_tte_data[22:17],
831
           itlb_rd_tte_data[15:13],
832
           6'b0,                                   // ?? 12-7 (6b)
833
           itlb_rd_tte_data[8],         // L    (1b)
834
           itlb_rd_tte_data[7],        // CP   (1b)
835
           itlb_rd_tte_data[6],        // CV   (1b)
836
           itlb_rd_tte_data[5],         // E    (1b)
837
           itlb_rd_tte_data[4],         // P    (1b)
838
           itlb_rd_tte_data[3],         // W    (1b)
839
                 1'b0
840
        } ;
841
//`else // !`ifdef SPARC_HPV_EN
842
//
843
//   assign formatted_tte_data[63:0] =
844
//          {      
845
//           itlb_rd_tte_tag[`STLB_TAG_V],           // V    (1b)
846
//           erc_erd_pgsz_b1,                        // pg SZ msb 4m or 512k
847
//           erc_erd_pgsz_b0,                        // pg sz lsb 4m or 64k
848
//           itlb_rd_tte_data[`STLB_DATA_NFO],       // NFO  (1b)
849
//           itlb_rd_tte_data[`STLB_DATA_IE],        // IE   (1b)
850
//           9'b0,                                   // soft2 58-42 (17b)
851
//           8'b0,                                   // diag 8b
852
//               itlb_rd_tte_tag[`STLB_TAG_U],           // U    (1b)
853
//           1'b0,                                   // ?? PA   (28b)
854
//           itlb_rd_tte_data[`STLB_DATA_PA_39_22_HI:`STLB_DATA_PA_39_22_LO],
855
//           itlb_rd_tte_data[`STLB_DATA_PA_21_19_HI:`STLB_DATA_PA_21_19_LO],
856
//           itlb_rd_tte_data[`STLB_DATA_PA_18_16_HI:`STLB_DATA_PA_18_16_LO],
857
//           itlb_rd_tte_data[`STLB_DATA_PA_15_13_HI:`STLB_DATA_PA_15_13_LO],
858
//           6'b0,                                   // ?? 12-7 (6b)
859
//           itlb_rd_tte_data[`STLB_DATA_L],         // L    (1b)
860
//           itlb_rd_tte_data[`STLB_DATA_CP],        // CP   (1b)
861
//           itlb_rd_tte_data[`STLB_DATA_CV],        // CV   (1b)
862
//           itlb_rd_tte_data[`STLB_DATA_E],         // E    (1b)
863
//           itlb_rd_tte_data[`STLB_DATA_P],         // P    (1b)
864
//           itlb_rd_tte_data[`STLB_DATA_W],         // W    (1b)
865
//           itlb_rd_tte_data[`STLB_DATA_G]          // G    (1b)
866
//        } ;
867
//`endif // !`ifdef SPARC_HPV_EN
868
 
869
 
870
 
871
   // mux in all asi values
872
   dp_mux2es #(64) itlbrd_mux(.dout (tlb_asi_data[63:0]),
873
                            .in0  (formatted_tte_tag[63:0]),
874
                            .in1  (formatted_tte_data[63:0]),
875
                            .sel  (fcl_erb_itlbrd_data_s));
876
 
877
   dp_mux4ds #(64) err_mux(.dout (err_asi_data[63:0]),
878
                         .in0  ({62'b0, erc_erd_erren_asidata}),
879
                         .in1  ({32'b0, erc_erd_errstat_asidata, 9'b0}),
880
                         .in2  ({32'b0, erc_erd_errinj_asidata}),
881
                         .in3  ({16'b0, err_addr_asidata, 4'b0}),
882
                         .sel0_l (erc_erd_errasi_sel_en_l),
883
                         .sel1_l (erc_erd_errasi_sel_stat_l),
884
                         .sel2_l (erc_erd_errasi_sel_inj_l),
885
                         .sel3_l (erc_erd_errasi_sel_addr_l));
886
 
887
   dp_mux3ds #(64) misc_asi_mux(.dout (misc_asi_data[63:0]),
888
                              .in0  ({29'b0,
889
                                            tag_asi_data[31:28],
890
                                            3'b0,
891
                                            tag_asi_data[27:0]}),
892
                              .in1  ({25'b0, erb_dtu_imask}),
893
                              .in2  (64'b0),
894
                              .sel0_l (erc_erd_miscasi_sel_ict_l),
895
                              .sel1_l (erc_erd_miscasi_sel_imask_l),
896
                              .sel2_l (erc_erd_miscasi_sel_other_l));
897
 
898
   // Final asi data
899
   // May need to add a flop to this mux output before sending it to the LSU
900
   dp_mux4ds #(64) final_asi_mux(.dout (ldxa_data_s),
901
                               .in0  (tlb_asi_data[63:0]),
902
                               .in1  (err_asi_data),
903
                               .in2  (misc_asi_data),
904
                               .in3  ({30'b0,
905
                                             wsel_erb_asidata_s[0],
906
                                             wsel_erb_asidata_s[33:1]}),
907
                               .sel0_l (erc_erd_asisrc_sel_itlb_s_l),
908
                               .sel1_l (erc_erd_asisrc_sel_err_s_l),
909
                               .sel2_l (erc_erd_asisrc_sel_misc_s_l),
910
                               .sel3_l (erc_erd_asisrc_sel_icd_s_l));
911
 
912
   dff #(64) ldxa_reg(.din (ldxa_data_s),
913
                      .q   (ldxa_data_d),
914
                      .clk (clk), .se(se), .si(), .so());
915
   assign ifu_lsu_ldxa_data_w2 = ldxa_data_d;
916
 
917
 
918
//----------------------------------------
919
// Error Address
920
//----------------------------------------   
921
 
922
   assign ifet_addr_f = {ifq_erb_wrtag_f[(39 - 11)-1:0],
923
                         ifq_erb_wrindex_f[11:4]};
924
 
925
   // pc of latest access
926
   dff #(48) pcs1_reg(.din (fdp_erb_pc_f[47:0]),
927
                                  .q   (pc_s1[47:0]),
928
                                  .clk (clk), .se(se), .si(), .so());
929
 
930
   // Physical address
931
   assign paddr_s1[39:10] = itlb_ifq_paddr_s[39:10];
932
   assign paddr_s1[9:4]   = pc_s1[9:4];
933
   dff #(36) padd_reg(.din (paddr_s1[39:4]),
934
                                  .q   (paddr_d1[39:4]),
935
                                  .clk (clk), .se(se), .si(), .so());
936
 
937
//   assign erb_ifq_paddr_s[9:0] = pc_s1[9:0];
938
 
939
   // stage PC one more cycle
940
   dff #(44) pcd1_reg(.din (pc_s1[47:4]),
941
                                  .q   (pc_d1[47:4]),
942
                                  .clk (clk), .se(se), .si(), .so());
943
 
944
   // IRF address
945
   dff #(16) irf_reg(.din ({exu_ifu_err_reg_m[7:0],
946
                            exu_ifu_err_synd_m[7:0]}),
947
                                 .q   ({irfaddr_w[7:5],
948
                            irfaddr_4_w,
949
                            irfaddr_w[3:0],
950
                            irfsynd_w[7:0]}),
951
                                 .clk (clk), .se(se), .si(), .so());
952
 
953
   // fix for bug 5594
954
   // nand2 + xnor
955
   assign irfaddr_w[4] = irfaddr_4_w ^ (irfaddr_w[5] & irfaddr_w[3]);
956
 
957
   // itlb asi address
958
   dff #(6) itlbidx_reg(.din (tlu_itlb_rw_index_g),
959
                        .q   (itlb_asi_index),
960
                        .clk (clk), .se(se), .si(), .so());
961
 
962
 
963
   // lsu error address
964
   dff #(44) lsadr_reg(.din (lsu_ifu_err_addr),
965
                       .q   (lsu_err_addr),
966
                       .clk (clk), .se(se), .si(), .so());
967
 
968
 
969
   // mux in the different error addresses
970
   // thread 0
971
   dp_mux4ds #(44) t0_eadr_mx0(.dout  (t0_eadr_mx0_out),
972
                             .in0   ({24'b0, irfsynd_w[7:0], 4'b0, irfaddr_w[7:0]}),
973
                             .in1   ({38'b0, itlb_asi_index}),
974
                             .in2   ({17'b0, ffu_ifu_err_synd_w2[13:7],
975
                    1'b0, ffu_ifu_err_synd_w2[6:0],
976
                    6'b0, ffu_ifu_err_reg_w2[5:0]}),
977
                             .in3   (lsu_err_addr),
978
                             .sel0_l (erc_erd_eadr0_sel_irf_l[0]),
979
                             .sel1_l (erc_erd_eadr0_sel_itlb_l[0]),
980
                             .sel2_l (erc_erd_eadr0_sel_frf_l[0]),
981
                             .sel3_l (erc_erd_eadr0_sel_lsu_l[0]));
982
 
983
   dp_mux4ds #(44) t0_eadr_mx1(.dout  (t0_eadr_mx1_out),
984
                             .in0   (pc_d1[47:4]),
985
                             .in1   ({8'b0, paddr_d1[39:4]}),
986
                             .in2   ({8'b0, ifet_addr_f}),
987
                             .in3   ({8'b0, spu_ifu_err_addr_w2[39:4]}),
988
                             .sel0_l (erc_erd_eadr1_sel_pcd1_l[0]),
989
                             .sel1_l (erc_erd_eadr1_sel_l1pa_l[0]),
990
                             .sel2_l (erc_erd_eadr1_sel_l2pa_l[0]),
991
                             .sel3_l (erc_erd_eadr1_sel_other_l[0]));
992
 
993
   dp_mux4ds #(44) t0_eadr_mx2(.dout  (t0_err_addr_nxt),
994
                             .in0   (t0_eadr_mx0_out),
995
                             .in1   (t0_eadr_mx1_out),
996
                             .in2   (ifq_erb_asidata_i2[47:4]),
997
                             .in3   (t0_err_addr),
998
                             .sel0_l (erc_erd_eadr2_sel_mx0_l[0]),
999
                             .sel1_l (erc_erd_eadr2_sel_mx1_l[0]),
1000
                             .sel2_l (erc_erd_eadr2_sel_wrt_l[0]),
1001
                             .sel3_l (erc_erd_eadr2_sel_old_l[0]));
1002
 
1003
   dff #(44) t0_eadr_reg(.din (t0_err_addr_nxt),
1004
                       .q   (t0_err_addr),
1005
                       .clk (clk), .se(se), .si(), .so());
1006
 
1007
 
1008
 
1009
 
1010
   // thread 1
1011
   dp_mux4ds #(44) t1_eadr_mx0(.dout  (t1_eadr_mx0_out),
1012
                             .in0   ({24'b0, irfsynd_w[7:0], 4'b0, irfaddr_w[7:0]}),
1013
                             .in1   ({38'b0, itlb_asi_index}),
1014
                             .in2   ({17'b0, ffu_ifu_err_synd_w2[13:7],
1015
                    1'b0, ffu_ifu_err_synd_w2[6:0],
1016
                    6'b0, ffu_ifu_err_reg_w2[5:0]}),
1017
                             .in3   (lsu_err_addr),
1018
                             .sel0_l (erc_erd_eadr0_sel_irf_l[1]),
1019
                             .sel1_l (erc_erd_eadr0_sel_itlb_l[1]),
1020
                             .sel2_l (erc_erd_eadr0_sel_frf_l[1]),
1021
                             .sel3_l (erc_erd_eadr0_sel_lsu_l[1]));
1022
 
1023
   dp_mux4ds #(44) t1_eadr_mx1(.dout  (t1_eadr_mx1_out),
1024
                             .in0   (pc_d1[47:4]),
1025
                             .in1   ({8'b0, paddr_d1[39:4]}),
1026
                             .in2   ({8'b0, ifet_addr_f}),
1027
                             .in3   ({8'b0, spu_ifu_err_addr_w2[39:4]}),
1028
//                           .in3   ({44'b0}),
1029
                             .sel0_l (erc_erd_eadr1_sel_pcd1_l[1]),
1030
                             .sel1_l (erc_erd_eadr1_sel_l1pa_l[1]),
1031
                             .sel2_l (erc_erd_eadr1_sel_l2pa_l[1]),
1032
                             .sel3_l (erc_erd_eadr1_sel_other_l[1]));
1033
 
1034
   dp_mux4ds #(44) t1_eadr_mx2(.dout  (t1_err_addr_nxt),
1035
                             .in0   (t1_eadr_mx0_out),
1036
                             .in1   (t1_eadr_mx1_out),
1037
                             .in2   (ifq_erb_asidata_i2[47:4]),
1038
                             .in3   (t1_err_addr),
1039
                             .sel0_l (erc_erd_eadr2_sel_mx0_l[1]),
1040
                             .sel1_l (erc_erd_eadr2_sel_mx1_l[1]),
1041
                             .sel2_l (erc_erd_eadr2_sel_wrt_l[1]),
1042
                             .sel3_l (erc_erd_eadr2_sel_old_l[1]));
1043
 
1044
   dff #(44) t1_eadr_reg(.din (t1_err_addr_nxt),
1045
                       .q   (t1_err_addr),
1046
                       .clk (clk), .se(se), .si(), .so());
1047
 
1048
   // thread 2
1049
   dp_mux4ds #(44) t2_eadr_mx0(.dout  (t2_eadr_mx0_out),
1050
                             .in0   ({24'b0, irfsynd_w[7:0], 4'b0, irfaddr_w[7:0]}),
1051
                             .in1   ({38'b0, itlb_asi_index}),
1052
                             .in2   ({17'b0, ffu_ifu_err_synd_w2[13:7],
1053
                    1'b0, ffu_ifu_err_synd_w2[6:0],
1054
                    6'b0, ffu_ifu_err_reg_w2[5:0]}),
1055
                             .in3   (lsu_err_addr),
1056
                             .sel0_l (erc_erd_eadr0_sel_irf_l[2]),
1057
                             .sel1_l (erc_erd_eadr0_sel_itlb_l[2]),
1058
                             .sel2_l (erc_erd_eadr0_sel_frf_l[2]),
1059
                             .sel3_l (erc_erd_eadr0_sel_lsu_l[2]));
1060
 
1061
   dp_mux4ds #(44) t2_eadr_mx1(.dout  (t2_eadr_mx1_out),
1062
                             .in0   (pc_d1[47:4]),
1063
                             .in1   ({8'b0, paddr_d1[39:4]}),
1064
                             .in2   ({8'b0, ifet_addr_f}),
1065
                             .in3   ({8'b0, spu_ifu_err_addr_w2[39:4]}),
1066
//                           .in3   ({44'b0}),
1067
                             .sel0_l (erc_erd_eadr1_sel_pcd1_l[2]),
1068
                             .sel1_l (erc_erd_eadr1_sel_l1pa_l[2]),
1069
                             .sel2_l (erc_erd_eadr1_sel_l2pa_l[2]),
1070
                             .sel3_l (erc_erd_eadr1_sel_other_l[2]));
1071
 
1072
   dp_mux4ds #(44) t2_eadr_mx2(.dout  (t2_err_addr_nxt),
1073
                             .in0   (t2_eadr_mx0_out),
1074
                             .in1   (t2_eadr_mx1_out),
1075
                             .in2   (ifq_erb_asidata_i2[47:4]),
1076
                             .in3   (t2_err_addr),
1077
                             .sel0_l (erc_erd_eadr2_sel_mx0_l[2]),
1078
                             .sel1_l (erc_erd_eadr2_sel_mx1_l[2]),
1079
                             .sel2_l (erc_erd_eadr2_sel_wrt_l[2]),
1080
                             .sel3_l (erc_erd_eadr2_sel_old_l[2]));
1081
 
1082
   dff #(44) t2_eadr_reg(.din (t2_err_addr_nxt),
1083
                       .q   (t2_err_addr),
1084
                       .clk (clk), .se(se), .si(), .so());
1085
 
1086
   // thread 3
1087
   dp_mux4ds #(44) t3_eadr_mx0(.dout  (t3_eadr_mx0_out),
1088
                             .in0   ({24'b0, irfsynd_w[7:0], 4'b0, irfaddr_w[7:0]}),
1089
                             .in1   ({38'b0, itlb_asi_index}),
1090
                             .in2   ({17'b0, ffu_ifu_err_synd_w2[13:7],
1091
                    1'b0, ffu_ifu_err_synd_w2[6:0],
1092
                    6'b0, ffu_ifu_err_reg_w2[5:0]}),
1093
                             .in3   (lsu_err_addr),
1094
                             .sel0_l (erc_erd_eadr0_sel_irf_l[3]),
1095
                             .sel1_l (erc_erd_eadr0_sel_itlb_l[3]),
1096
                             .sel2_l (erc_erd_eadr0_sel_frf_l[3]),
1097
                             .sel3_l (erc_erd_eadr0_sel_lsu_l[3]));
1098
 
1099
   dp_mux4ds #(44) t3_eadr_mx1(.dout  (t3_eadr_mx1_out),
1100
                             .in0   (pc_d1[47:4]),
1101
                             .in1   ({8'b0, paddr_d1[39:4]}),
1102
                             .in2   ({8'b0, ifet_addr_f}),
1103
                             .in3   ({8'b0, spu_ifu_err_addr_w2[39:4]}),
1104
//                           .in3   ({44'b0}),
1105
                             .sel0_l (erc_erd_eadr1_sel_pcd1_l[3]),
1106
                             .sel1_l (erc_erd_eadr1_sel_l1pa_l[3]),
1107
                             .sel2_l (erc_erd_eadr1_sel_l2pa_l[3]),
1108
                             .sel3_l (erc_erd_eadr1_sel_other_l[3]));
1109
 
1110
   dp_mux4ds #(44) t3_eadr_mx2(.dout  (t3_err_addr_nxt),
1111
                             .in0   (t3_eadr_mx0_out),
1112
                             .in1   (t3_eadr_mx1_out),
1113
                             .in2   (ifq_erb_asidata_i2[47:4]),
1114
                             .in3   (t3_err_addr),
1115
                             .sel0_l (erc_erd_eadr2_sel_mx0_l[3]),
1116
                             .sel1_l (erc_erd_eadr2_sel_mx1_l[3]),
1117
                             .sel2_l (erc_erd_eadr2_sel_wrt_l[3]),
1118
                             .sel3_l (erc_erd_eadr2_sel_old_l[3]));
1119
 
1120
   dff #(44) t3_eadr_reg(.din (t3_err_addr_nxt),
1121
                       .q   (t3_err_addr),
1122
                       .clk (clk), .se(se), .si(), .so());
1123
 
1124
 
1125
   // asi read
1126
   dp_mux4ds #(44) asi_eadr_mx(.dout (err_addr_asidata),
1127
                             .in0  (t0_err_addr),
1128
                             .in1  (t1_err_addr),
1129
                             .in2  (t2_err_addr),
1130
                             .in3  (t3_err_addr),
1131
                             .sel0_l (erc_erd_asi_thr_l[0]),
1132
                             .sel1_l (erc_erd_asi_thr_l[1]),
1133
                             .sel2_l (erc_erd_asi_thr_l[2]),
1134
                             .sel3_l (erc_erd_asi_thr_l[3]));
1135
 
1136
 
1137
   // Instruction Mask
1138
   dp_mux2es #(39) imask_en_mux(.dout (imask_next),
1139
                              .in0  (erb_dtu_imask),
1140
                              .in1  (ifq_erb_asidata_i2[38:0]),
1141
                              .sel  (erc_erd_ld_imask));
1142
 
1143
   // need to reset top 7 bits only
1144
   dffr #(39) imask_reg(.din (imask_next),
1145
                      .q   (erb_dtu_imask),
1146
                      .rst (erb_reset),
1147
                      .clk (clk), .se(se), .si(), .so());
1148
 
1149
   sink #(4) s0(.in (pc_s1[3:0]));
1150
 
1151
endmodule // sparc_ifu_erb
1152
 

powered by: WebSVN 2.1.0

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