1 | // ========== Copyright Header Begin ========================================== |
---|
2 | // |
---|
3 | // OpenSPARC T1 Processor File: sparc_exu_ecc.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_ecc |
---|
24 | // Description: This block performs the ecc check and correction as well as |
---|
25 | // doing the w2 write port arbitration and the w2 ecc generation. |
---|
26 | */ |
---|
27 | module sparc_exu_ecc (/*AUTOARG*/ |
---|
28 | // Outputs |
---|
29 | so, ecc_ecl_rs1_ce, ecc_ecl_rs1_ue, ecc_ecl_rs2_ce, |
---|
30 | ecc_ecl_rs2_ue, ecc_ecl_rs3_ce, ecc_ecl_rs3_ue, |
---|
31 | ecc_byp_ecc_result_m, exu_ifu_err_synd_m, |
---|
32 | // Inputs |
---|
33 | rclk, se, si, byp_ecc_rcc_data_e, ecl_ecc_rs1_use_rf_e, |
---|
34 | byp_ecc_rs1_synd_d, byp_alu_rs2_data_e, ecl_ecc_rs2_use_rf_e, |
---|
35 | byp_ecc_rs2_synd_d, byp_ecc_rs3_data_e, ecl_ecc_rs3_use_rf_e, |
---|
36 | byp_ecc_rs3_synd_d, ecl_ecc_sel_rs1_m_l, ecl_ecc_sel_rs2_m_l, |
---|
37 | ecl_ecc_sel_rs3_m_l, ecl_ecc_log_rs1_m, ecl_ecc_log_rs2_m, |
---|
38 | ecl_ecc_log_rs3_m |
---|
39 | ) ; |
---|
40 | input rclk; |
---|
41 | input se; |
---|
42 | input si; |
---|
43 | input [63:0] byp_ecc_rcc_data_e; |
---|
44 | input ecl_ecc_rs1_use_rf_e; |
---|
45 | input [7:0] byp_ecc_rs1_synd_d; |
---|
46 | input [63:0] byp_alu_rs2_data_e; |
---|
47 | input ecl_ecc_rs2_use_rf_e; |
---|
48 | input [7:0] byp_ecc_rs2_synd_d; |
---|
49 | input [63:0] byp_ecc_rs3_data_e; |
---|
50 | input ecl_ecc_rs3_use_rf_e; |
---|
51 | input [7:0] byp_ecc_rs3_synd_d; |
---|
52 | input ecl_ecc_sel_rs1_m_l; |
---|
53 | input ecl_ecc_sel_rs2_m_l; |
---|
54 | input ecl_ecc_sel_rs3_m_l; |
---|
55 | input ecl_ecc_log_rs1_m; |
---|
56 | input ecl_ecc_log_rs2_m; |
---|
57 | input ecl_ecc_log_rs3_m; |
---|
58 | |
---|
59 | output so; |
---|
60 | output ecc_ecl_rs1_ce; |
---|
61 | output ecc_ecl_rs1_ue; |
---|
62 | output ecc_ecl_rs2_ce; |
---|
63 | output ecc_ecl_rs2_ue; |
---|
64 | output ecc_ecl_rs3_ce; |
---|
65 | output ecc_ecl_rs3_ue; |
---|
66 | |
---|
67 | output [63:0] ecc_byp_ecc_result_m; |
---|
68 | output [6:0] exu_ifu_err_synd_m; |
---|
69 | |
---|
70 | wire clk; |
---|
71 | wire sel_rs1_m; |
---|
72 | wire sel_rs2_m; |
---|
73 | wire sel_rs3_m; |
---|
74 | wire [7:0] rs1_ecc_e; |
---|
75 | wire [6:0] rs1_err_e; // syndrome generated by checker |
---|
76 | wire [6:0] rs1_err_m; // syndrome generated by checker |
---|
77 | wire [7:0] rs2_ecc_e; |
---|
78 | wire [6:0] rs2_err_e; // syndrome generated by checker |
---|
79 | wire [6:0] rs2_err_m; // syndrome generated by checker |
---|
80 | wire [7:0] rs3_ecc_e; |
---|
81 | wire [6:0] rs3_err_e; // syndrome generated by checker |
---|
82 | wire [6:0] rs3_err_m; // syndrome generated by checker |
---|
83 | wire [6:0] err_m; |
---|
84 | wire [63:0] ecc_datain_m; |
---|
85 | wire [63:0] byp_ecc_rcc_data_m; |
---|
86 | wire [63:0] byp_alu_rs2_data_m; |
---|
87 | wire [63:0] exu_lsu_rs3_data_m; |
---|
88 | wire [63:0] error_data_m; |
---|
89 | |
---|
90 | assign clk = rclk; |
---|
91 | // Pass along ecc parity bits from RF |
---|
92 | dff_s #(8) rs1_ecc_d2e(.din(byp_ecc_rs1_synd_d[7:0]), .clk(clk), .q(rs1_ecc_e[7:0]), |
---|
93 | .se(se), .si(), .so()); |
---|
94 | dff_s #(8) rs2_ecc_d2e(.din(byp_ecc_rs2_synd_d[7:0]), .clk(clk), .q(rs2_ecc_e[7:0]), |
---|
95 | .se(se), .si(), .so()); |
---|
96 | dff_s #(8) rs3_ecc_d2e(.din(byp_ecc_rs3_synd_d[7:0]), .clk(clk), .q(rs3_ecc_e[7:0]), |
---|
97 | .se(se), .si(), .so()); |
---|
98 | |
---|
99 | // Check the ecc for all 4 outputs from RF |
---|
100 | zzecc_exu_chkecc2 chk_rs1(.d(byp_ecc_rcc_data_e[63:0]), |
---|
101 | .vld(ecl_ecc_rs1_use_rf_e), |
---|
102 | .p(rs1_ecc_e[7:0]), |
---|
103 | .q(rs1_err_e[6:0]), |
---|
104 | .ce(ecc_ecl_rs1_ce), .ue(ecc_ecl_rs1_ue), .ne()); |
---|
105 | zzecc_exu_chkecc2 chk_rs2(.d(byp_alu_rs2_data_e[63:0]), |
---|
106 | .vld(ecl_ecc_rs2_use_rf_e), |
---|
107 | .p(rs2_ecc_e[7:0]), |
---|
108 | .q(rs2_err_e[6:0]), |
---|
109 | .ce(ecc_ecl_rs2_ce), .ue(ecc_ecl_rs2_ue), .ne()); |
---|
110 | zzecc_exu_chkecc2 chk_rs3(.d(byp_ecc_rs3_data_e[63:0]), |
---|
111 | .vld(ecl_ecc_rs3_use_rf_e), |
---|
112 | .p(rs3_ecc_e[7:0]), |
---|
113 | .q(rs3_err_e[6:0]), |
---|
114 | .ce(ecc_ecl_rs3_ce), .ue(ecc_ecl_rs3_ue), .ne()); |
---|
115 | |
---|
116 | // Put results from checkers into flops |
---|
117 | dff_s #(7) rs1_err_e2m(.din(rs1_err_e[6:0]), .clk(clk), .q(rs1_err_m[6:0]), |
---|
118 | .se(se), .si(), .so()); |
---|
119 | dff_s #(7) rs2_err_e2m(.din(rs2_err_e[6:0]), .clk(clk), .q(rs2_err_m[6:0]), |
---|
120 | .se(se), .si(), .so()); |
---|
121 | dff_s #(7) rs3o_err_e2m(.din(rs3_err_e[6:0]), .clk(clk), .q(rs3_err_m[6:0]), |
---|
122 | .se(se), .si(), .so()); |
---|
123 | |
---|
124 | // Pass along RF data to M stage |
---|
125 | dff_s #(64) rs1_data_e2m(.din(byp_ecc_rcc_data_e[63:0]), .clk(clk), .q(byp_ecc_rcc_data_m[63:0]), |
---|
126 | .se(se), .si(), .so()); |
---|
127 | dff_s #(64) rs2_data_e2m(.din(byp_alu_rs2_data_e[63:0]), .clk(clk), .q(byp_alu_rs2_data_m[63:0]), |
---|
128 | .se(se), .si(), .so()); |
---|
129 | dff_s #(64) rs3_data_e2m(.din(byp_ecc_rs3_data_e[63:0]), .clk(clk), |
---|
130 | .q(exu_lsu_rs3_data_m[63:0]), |
---|
131 | .se(se), .si(), .so()); |
---|
132 | |
---|
133 | // Mux between 3 different ports for syndrome and data |
---|
134 | assign sel_rs1_m = ~ecl_ecc_sel_rs1_m_l; |
---|
135 | assign sel_rs2_m = ~ecl_ecc_sel_rs2_m_l; |
---|
136 | assign sel_rs3_m = ~ecl_ecc_sel_rs3_m_l; |
---|
137 | mux3ds #(7) syn_mux(.dout(err_m[6:0]), |
---|
138 | .in0(rs1_err_m[6:0]), |
---|
139 | .in1(rs2_err_m[6:0]), |
---|
140 | .in2(rs3_err_m[6:0]), |
---|
141 | .sel0(sel_rs1_m), |
---|
142 | .sel1(sel_rs2_m), |
---|
143 | .sel2(sel_rs3_m)); |
---|
144 | mux3ds #(64) data_m_mux(.dout(ecc_datain_m[63:0]), |
---|
145 | .in0(byp_ecc_rcc_data_m[63:0]), |
---|
146 | .in1(byp_alu_rs2_data_m[63:0]), |
---|
147 | .in2(exu_lsu_rs3_data_m[63:0]), |
---|
148 | .sel0(sel_rs1_m), |
---|
149 | .sel1(sel_rs2_m), |
---|
150 | .sel2(sel_rs3_m)); |
---|
151 | |
---|
152 | mux3ds #(7) syn_log_mux(.dout(exu_ifu_err_synd_m[6:0]), |
---|
153 | .in0(rs1_err_m[6:0]), |
---|
154 | .in1(rs2_err_m[6:0]), |
---|
155 | .in2(rs3_err_m[6:0]), |
---|
156 | .sel0(ecl_ecc_log_rs1_m), |
---|
157 | .sel1(ecl_ecc_log_rs2_m), |
---|
158 | .sel2(ecl_ecc_log_rs3_m)); |
---|
159 | // Decode syndrome from checker |
---|
160 | sparc_exu_ecc_dec decode(.e (error_data_m[63:0]), |
---|
161 | .q (err_m[6:0])); |
---|
162 | assign ecc_byp_ecc_result_m[63:0] = ecc_datain_m[63:0] ^ error_data_m[63:0]; |
---|
163 | |
---|
164 | |
---|
165 | endmodule // sparc_exu_ecc |
---|