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

Subversion Repositories sparc64soc

[/] [sparc64soc/] [trunk/] [T1-CPU/] [exu/] [sparc_exu_ecl_eccctl.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dmitryr
// ========== Copyright Header Begin ==========================================
2
// 
3
// OpenSPARC T1 Processor File: sparc_exu_ecl_eccctl.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_exu_ecl_eccctl
24
//      Description:  Implements the control logic for ecc checking.
25
//              This includes picking which error to fix (only one fixed per instruction),
26
//              enabling the checks, and signalling the errors.
27
*/
28
 
29
module sparc_exu_ecl_eccctl (/*AUTOARG*/
30
   // Outputs
31
   ue_trap_m, ecl_ecc_sel_rs1_m_l, ecl_ecc_sel_rs2_m_l,
32
   ecl_ecc_sel_rs3_m_l, ecl_ecc_log_rs1_m, ecl_ecc_log_rs2_m,
33
   ecl_ecc_log_rs3_m, ecl_byp_sel_ecc_m, ecl_ecc_rs1_use_rf_e,
34
   ecl_ecc_rs2_use_rf_e, ecl_ecc_rs3_use_rf_e, eccctl_wb_rd_m,
35
   exu_ifu_ecc_ce_m, exu_ifu_ecc_ue_m, exu_ifu_err_reg_m,
36
   ecl_byp_ecc_mask_m_l, exu_ifu_inj_ack, exu_ifu_err_synd_7_m,
37
   // Inputs
38
   clk, se, rst_tri_en, ecc_ecl_rs1_ce, ecc_ecl_rs1_ue,
39
   ecc_ecl_rs2_ce, ecc_ecl_rs2_ue, ecc_ecl_rs3_ce, ecc_ecl_rs3_ue,
40
   ecl_byp_rcc_mux2_sel_rf, ecl_byp_rs2_mux2_sel_rf,
41
   ecl_byp_rs3_mux2_sel_rf, rs1_vld_e, rs2_vld_e, rs3_vld_e,
42
   ifu_exu_rs1_m, ifu_exu_rs2_m, ifu_exu_rs3_m, rml_ecl_cwp_d,
43
   ifu_exu_ecc_mask, ifu_exu_inj_irferr, ifu_exu_disable_ce_e,
44
   wb_eccctl_spec_wen_next, ifu_exu_nceen_e, ifu_exu_inst_vld_e,
45
   rml_ecl_gl_e, cancel_rs3_ecc_e
46
   ) ;
47
   input clk;
48
   input se;
49
   input rst_tri_en;
50
   input       ecc_ecl_rs1_ce;
51
   input       ecc_ecl_rs1_ue;
52
   input       ecc_ecl_rs2_ce;
53
   input       ecc_ecl_rs2_ue;
54
   input       ecc_ecl_rs3_ce;
55
   input       ecc_ecl_rs3_ue;
56
   input       ecl_byp_rcc_mux2_sel_rf;
57
   input       ecl_byp_rs2_mux2_sel_rf;
58
   input       ecl_byp_rs3_mux2_sel_rf;
59
   input       rs1_vld_e;
60
   input       rs2_vld_e;
61
   input       rs3_vld_e;
62
   input [4:0] ifu_exu_rs1_m;
63
   input [4:0] ifu_exu_rs2_m;
64
   input [4:0] ifu_exu_rs3_m;
65
   input [2:0] rml_ecl_cwp_d;
66
   input [7:0] ifu_exu_ecc_mask;
67
   input       ifu_exu_inj_irferr;
68
   input       ifu_exu_disable_ce_e;
69
   input       wb_eccctl_spec_wen_next;
70
   input       ifu_exu_nceen_e;
71
   input       ifu_exu_inst_vld_e;
72
   input [1:0] rml_ecl_gl_e;
73
   input       cancel_rs3_ecc_e;
74
 
75
   output      ue_trap_m;
76
   output      ecl_ecc_sel_rs1_m_l;
77
   output      ecl_ecc_sel_rs2_m_l;
78
   output      ecl_ecc_sel_rs3_m_l;
79
   output      ecl_ecc_log_rs1_m;
80
   output      ecl_ecc_log_rs2_m;
81
   output      ecl_ecc_log_rs3_m;
82
   output      ecl_byp_sel_ecc_m;
83
   output      ecl_ecc_rs1_use_rf_e;
84
   output      ecl_ecc_rs2_use_rf_e;
85
   output      ecl_ecc_rs3_use_rf_e;
86
   output [4:0] eccctl_wb_rd_m;
87
   output       exu_ifu_ecc_ce_m;
88
   output       exu_ifu_ecc_ue_m;
89
   output [7:0] exu_ifu_err_reg_m;
90
   output [7:0] ecl_byp_ecc_mask_m_l;
91
   output       exu_ifu_inj_ack;
92
   output    exu_ifu_err_synd_7_m;
93
 
94
   wire      sel_rs1_e;
95
   wire      sel_rs2_e;
96
   wire      sel_rs3_e;
97
   wire        sel_rs1_m;
98
   wire        sel_rs2_m;
99
   wire        sel_rs3_m;
100
   wire        safe_sel_rs1_m;
101
   wire        safe_sel_rs2_m;
102
   wire        safe_sel_rs3_m;
103
   wire [2:0]  cwp_e;
104
   wire [2:0]  cwp_m;
105
   wire [1:0]  gl_m;
106
   wire        inj_irferr_m;
107
   wire        inj_irferr_w;
108
   wire        detect_ce_e;
109
   wire        detect_ue_e;
110
   wire        flag_ecc_ce_e;
111
   wire        flag_ecc_ue_e;
112
   wire [4:0]  log_rs_m;
113
   wire        rs1_ce_m;
114
   wire        rs1_ue_m;
115
   wire        rs2_ce_m;
116
   wire        rs2_ue_m;
117
   wire        rs3_ue_m;
118
   wire        rs1_sel_rf_e;
119
   wire        rs2_sel_rf_e;
120
   wire        rs3_sel_rf_e;
121
   wire        vld_rs3_ce_e;
122
   wire        vld_rs3_ue_e;
123
 
124
   // Store whether rf value was used for ecc checking
125
   assign      ecl_ecc_rs1_use_rf_e = rs1_sel_rf_e & rs1_vld_e & ifu_exu_inst_vld_e;
126
   assign      ecl_ecc_rs2_use_rf_e = rs2_sel_rf_e & rs2_vld_e & ifu_exu_inst_vld_e;
127
   assign      ecl_ecc_rs3_use_rf_e = rs3_sel_rf_e & rs3_vld_e & ifu_exu_inst_vld_e;
128
 
129
   dff_s rs1_rf_dff(.din(ecl_byp_rcc_mux2_sel_rf), .clk(clk),
130
                  .q(rs1_sel_rf_e), .se(se), .si(), .so());
131
   dff_s rs2_rf_dff(.din(ecl_byp_rs2_mux2_sel_rf), .clk(clk),
132
                  .q(rs2_sel_rf_e), .se(se), .si(), .so());
133
   dff_s rs3_rf_dff(.din(ecl_byp_rs3_mux2_sel_rf), .clk(clk),
134
                  .q(rs3_sel_rf_e), .se(se), .si(), .so());
135
 
136
   assign      vld_rs3_ce_e = ecc_ecl_rs3_ce & ~cancel_rs3_ecc_e;
137
   assign      vld_rs3_ue_e = ecc_ecl_rs3_ue & ~cancel_rs3_ecc_e;
138
   assign    detect_ce_e = (ecc_ecl_rs1_ce | ecc_ecl_rs2_ce | vld_rs3_ce_e);
139
   assign    detect_ue_e = (ecc_ecl_rs1_ue | ecc_ecl_rs2_ue | vld_rs3_ue_e);
140
   // Generate trap signals
141
   assign    flag_ecc_ue_e = (detect_ue_e |
142
                                    detect_ce_e & ifu_exu_disable_ce_e); // convert ce to ue
143
   assign    flag_ecc_ce_e = detect_ce_e & ~ifu_exu_disable_ce_e;
144
 
145
   // Pass along signal to fix errors
146
   dff_s byp_sel_ecc_e2m(.din(flag_ecc_ce_e), .clk(clk), .q(ecl_byp_sel_ecc_m),
147
                       .se(se), .si(), .so());
148
   dff_s ecc_ue_e2m(.din(flag_ecc_ue_e), .clk(clk), .q(exu_ifu_ecc_ue_m),
149
                  .se(se), .si(), .so());
150
   dff_s nceen_e2m(.din(ifu_exu_nceen_e), .clk(clk), .q(nceen_m), .se(se), .si(), .so());
151
   assign    ue_trap_m = exu_ifu_ecc_ue_m & nceen_m;
152
   // only report ce (and replay) if no ue
153
   assign      exu_ifu_ecc_ce_m = ecl_byp_sel_ecc_m & ~exu_ifu_ecc_ue_m;
154
   // if globals then report %gl.  otherwise log %cwp
155
   assign      exu_ifu_err_reg_m[7:5] = (~log_rs_m[4] & ~log_rs_m[3])? {1'b0,gl_m[1:0]}: cwp_m[2:0];
156
   assign      exu_ifu_err_reg_m[4:0] = log_rs_m[4:0];
157
 
158
   // Control for mux to ecc decoder (just ce)
159
   assign      sel_rs1_e = ecc_ecl_rs1_ce;
160
   assign      sel_rs2_e = ~ecc_ecl_rs1_ce & ecc_ecl_rs2_ce;
161
   assign      sel_rs3_e = ~(ecc_ecl_rs1_ce | ecc_ecl_rs2_ce);
162
 
163
   dff_s ecc_sel_rs1_dff(.din(sel_rs1_e), .clk(clk), .q(sel_rs1_m),
164
                       .se(se), .si(), .so());
165
   dff_s ecc_sel_rs2_dff(.din(sel_rs2_e), .clk(clk), .q(sel_rs2_m),
166
                       .se(se), .si(), .so());
167
   dff_s ecc_sel_rs3_dff(.din(sel_rs3_e), .clk(clk), .q(sel_rs3_m),
168
                       .se(se), .si(), .so());
169
   // Make selects one hot
170
   assign      safe_sel_rs1_m = sel_rs1_m | rst_tri_en;
171
   assign      safe_sel_rs2_m = sel_rs2_m & ~rst_tri_en;
172
   assign      safe_sel_rs3_m = sel_rs3_m & ~rst_tri_en;
173
   assign      ecl_ecc_sel_rs1_m_l = ~safe_sel_rs1_m;
174
   assign      ecl_ecc_sel_rs2_m_l = ~safe_sel_rs2_m;
175
   assign      ecl_ecc_sel_rs3_m_l = ~safe_sel_rs3_m;
176
 
177
   // Mux to generate the rd for fixed value
178
   mux3ds #(5) ecc_rd_mux(.dout(eccctl_wb_rd_m[4:0]),
179
                          .in0(ifu_exu_rs1_m[4:0]),
180
                          .in1(ifu_exu_rs2_m[4:0]),
181
                          .in2(ifu_exu_rs3_m[4:0]),
182
                          .sel0(safe_sel_rs1_m),
183
                          .sel1(safe_sel_rs2_m),
184
                          .sel2(safe_sel_rs3_m));
185
 
186
   // Control for muxes for logging errors
187
   assign      ecl_ecc_log_rs1_m = rs1_ue_m | (rs1_ce_m & ~rs2_ue_m & ~rs3_ue_m);
188
   assign      ecl_ecc_log_rs2_m = (rs2_ue_m & ~rs1_ue_m) | (rs2_ce_m & ~rs1_ue_m & ~rs1_ce_m & ~rs3_ue_m);
189
   assign      ecl_ecc_log_rs3_m = ~(ecl_ecc_log_rs1_m | ecl_ecc_log_rs2_m);
190
   // Mux to generate the rs for error_logging
191
   mux3ds #(5) ecc_rdlog_mux(.dout(log_rs_m[4:0]),
192
                          .in0(ifu_exu_rs1_m[4:0]),
193
                          .in1(ifu_exu_rs2_m[4:0]),
194
                          .in2(ifu_exu_rs3_m[4:0]),
195
                          .sel0(ecl_ecc_log_rs1_m),
196
                          .sel1(ecl_ecc_log_rs2_m),
197
                          .sel2(ecl_ecc_log_rs3_m));
198
 
199
   dff_s #(3) cwp_d2e(.din(rml_ecl_cwp_d[2:0]), .clk(clk), .q(cwp_e[2:0]),
200
                    .se(se), .si(), .so());
201
   dff_s #(3) cwp_e2m(.din(cwp_e[2:0]), .clk(clk), .q(cwp_m[2:0]),
202
                    .se(se), .si(), .so());
203
   dff_s #(2) gl_e2m(.din(rml_ecl_gl_e[1:0]), .clk(clk), .q(gl_m[1:0]),
204
                   .se(se), .si(), .so());
205
 
206
   // Syndrome needs to know if it was really a ce or ue
207
   mux3ds ecc_synd7_mux(.dout(exu_ifu_err_synd_7_m),
208
                        .in0(rs1_ce_m),
209
                        .in1(rs2_ce_m),
210
                        .in2(~rs3_ue_m),
211
                        .sel0(ecl_ecc_log_rs1_m),
212
                        .sel1(ecl_ecc_log_rs2_m),
213
                        .sel2(ecl_ecc_log_rs3_m));
214
 
215
 
216
   // signals for injecting errors
217
   // inject error if it is enabled and a write will probably happen
218
   // (don't bother to check kill_w
219
   assign      inj_irferr_m = wb_eccctl_spec_wen_next & ifu_exu_inj_irferr;
220
   assign      ecl_byp_ecc_mask_m_l = ~(ifu_exu_ecc_mask[7:0] & {8{inj_irferr_m}});
221
   dff_s inj_irferr_m2w(.din(inj_irferr_m), .clk(clk), .q(inj_irferr_w),
222
                      .se(se), .si(), .so());
223
   assign      exu_ifu_inj_ack = inj_irferr_w;
224
 
225
   // Pipeline Flops
226
   dff_s rs1_ue_e2m(.din(ecc_ecl_rs1_ue), .clk(clk), .q(rs1_ue_m), .se(se), .si(), .so());
227
   dff_s rs1_ce_e2m(.din(ecc_ecl_rs1_ce), .clk(clk), .q(rs1_ce_m), .se(se), .si(), .so());
228
   dff_s rs2_ue_e2m(.din(ecc_ecl_rs2_ue), .clk(clk), .q(rs2_ue_m), .se(se), .si(), .so());
229
   dff_s rs2_ce_e2m(.din(ecc_ecl_rs2_ce), .clk(clk), .q(rs2_ce_m), .se(se), .si(), .so());
230
   dff_s rs3_ue_e2m(.din(vld_rs3_ue_e), .clk(clk), .q(rs3_ue_m), .se(se), .si(), .so());
231
 
232
endmodule // sparc_exu_ecl_eccctl

powered by: WebSVN 2.1.0

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