1 | // ========== Copyright Header Begin ========================================== |
---|
2 | // |
---|
3 | // OpenSPARC T1 Processor File: lsu_tagdp.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 | module lsu_tagdp( /*AUTOARG*/ |
---|
22 | // Outputs |
---|
23 | so, lsu_misc_rdata_w2, lsu_rd_dtag_parity_g, |
---|
24 | // Inputs |
---|
25 | rclk, si, se, lsu_va_wtchpt_addr, lsu_va_wtchpt_sel_g, dva_vld_m, |
---|
26 | dtag_rdata_w0_m, dtag_rdata_w1_m, dtag_rdata_w2_m, |
---|
27 | dtag_rdata_w3_m, lsu_dtag_rsel_m, lsu_local_ldxa_data_g, |
---|
28 | lsu_local_ldxa_sel_g, lsu_tlb_rd_data, lsu_local_ldxa_tlbrd_sel_g, |
---|
29 | lsu_local_diagnstc_tagrd_sel_g |
---|
30 | ); |
---|
31 | |
---|
32 | input rclk; |
---|
33 | input si; |
---|
34 | input se; |
---|
35 | output so; |
---|
36 | |
---|
37 | input [47:3] lsu_va_wtchpt_addr ; |
---|
38 | input lsu_va_wtchpt_sel_g; |
---|
39 | |
---|
40 | input [3:0] dva_vld_m; // valid array read |
---|
41 | input [29:0] dtag_rdata_w0_m; // 29b tag; 1b parity from dtag |
---|
42 | input [29:0] dtag_rdata_w1_m; // 29b tag; 1b parity from dtag |
---|
43 | input [29:0] dtag_rdata_w2_m; // 29b tag; 1b parity from dtag |
---|
44 | input [29:0] dtag_rdata_w3_m; // 29b tag; 1b parity from dtag |
---|
45 | input [3:0] lsu_dtag_rsel_m; // select one of the above tag from ?? |
---|
46 | |
---|
47 | input [47:0] lsu_local_ldxa_data_g; // from dctl |
---|
48 | input lsu_local_ldxa_sel_g; //used to mux ldxa data with 1/4 tags. from ?? |
---|
49 | |
---|
50 | input [63:0] lsu_tlb_rd_data; // from tlbdp - used in local ldxa mux |
---|
51 | input lsu_local_ldxa_tlbrd_sel_g; |
---|
52 | input lsu_local_diagnstc_tagrd_sel_g; |
---|
53 | |
---|
54 | |
---|
55 | output [63:0] lsu_misc_rdata_w2; // to qdp1 |
---|
56 | output [3:0] lsu_rd_dtag_parity_g; // parity check on 4 tags. to dctl |
---|
57 | |
---|
58 | |
---|
59 | wire dtag_rdata_w0_parity_g, |
---|
60 | dtag_rdata_w1_parity_g, |
---|
61 | dtag_rdata_w2_parity_g, |
---|
62 | dtag_rdata_w3_parity_g; |
---|
63 | |
---|
64 | wire [29:0] dtag_rdata_sel_m, |
---|
65 | dtag_rdata_sel_g; |
---|
66 | |
---|
67 | |
---|
68 | wire [3:0] dtag_rdata_w0_8b_parity_m, |
---|
69 | dtag_rdata_w1_8b_parity_m, |
---|
70 | dtag_rdata_w2_8b_parity_m, |
---|
71 | dtag_rdata_w3_8b_parity_m; |
---|
72 | |
---|
73 | wire [3:0] dtag_rdata_w0_8b_parity_g, |
---|
74 | dtag_rdata_w1_8b_parity_g, |
---|
75 | dtag_rdata_w2_8b_parity_g, |
---|
76 | dtag_rdata_w3_8b_parity_g; |
---|
77 | |
---|
78 | wire [63:0] lsu_misc_rdata_g; |
---|
79 | |
---|
80 | wire dtag_vld_sel_m, dtag_vld_sel_g; |
---|
81 | |
---|
82 | wire clk; |
---|
83 | assign clk = rclk; |
---|
84 | |
---|
85 | //================================================================================================= |
---|
86 | // Select Tag Read data / ldxa data |
---|
87 | //================================================================================================= |
---|
88 | |
---|
89 | // select 1 out of 4 tags |
---|
90 | mux4ds #(31) dtag_rdata_sel ( |
---|
91 | .in0 ({dtag_rdata_w0_m[29:0],dva_vld_m[0]}), |
---|
92 | .in1 ({dtag_rdata_w1_m[29:0],dva_vld_m[1]}), |
---|
93 | .in2 ({dtag_rdata_w2_m[29:0],dva_vld_m[2]}), |
---|
94 | .in3 ({dtag_rdata_w3_m[29:0],dva_vld_m[3]}), |
---|
95 | .sel0 (lsu_dtag_rsel_m[0]), |
---|
96 | .sel1 (lsu_dtag_rsel_m[1]), |
---|
97 | .sel2 (lsu_dtag_rsel_m[2]), |
---|
98 | .sel3 (lsu_dtag_rsel_m[3]), |
---|
99 | .dout ({dtag_rdata_sel_m[29:0],dtag_vld_sel_m}) |
---|
100 | ); |
---|
101 | |
---|
102 | dff_s #(31) dtag_rdata_sel_g_ff ( |
---|
103 | .din ({dtag_rdata_sel_m[29:0],dtag_vld_sel_m}), |
---|
104 | .q ({dtag_rdata_sel_g[29:0],dtag_vld_sel_g}), |
---|
105 | .clk (clk), |
---|
106 | .se (se), .si (), .so ()); |
---|
107 | |
---|
108 | mux4ds #(64) lsu_misc_rdata_sel ( |
---|
109 | .in0 ({16'h0,lsu_local_ldxa_data_g[47:0]}), |
---|
110 | .in1 (lsu_tlb_rd_data[63:0]), |
---|
111 | .in2 ({16'h0,lsu_va_wtchpt_addr[47:3],3'b000}), |
---|
112 | .in3 ({33'h0,dtag_rdata_sel_g[29:0],dtag_vld_sel_g}), |
---|
113 | .sel0 (lsu_local_ldxa_sel_g), |
---|
114 | .sel1 (lsu_local_ldxa_tlbrd_sel_g), |
---|
115 | .sel2 (lsu_va_wtchpt_sel_g), |
---|
116 | .sel3 (lsu_local_diagnstc_tagrd_sel_g), |
---|
117 | .dout (lsu_misc_rdata_g[63:0]) |
---|
118 | ); |
---|
119 | |
---|
120 | dff_s #(64) lsu_misc_rdata_w2_ff ( |
---|
121 | .din (lsu_misc_rdata_g[63:0]), |
---|
122 | .q (lsu_misc_rdata_w2[63:0]), |
---|
123 | .clk (clk), |
---|
124 | .se (se), .si (), .so ()); |
---|
125 | |
---|
126 | |
---|
127 | //================================================================================================= |
---|
128 | // Tag Parity Calculation |
---|
129 | //================================================================================================= |
---|
130 | |
---|
131 | // flop tag parity bits |
---|
132 | dff_s #(4) dtag_rdata_parity_g_ff ( |
---|
133 | .din ({dtag_rdata_w0_m[29], |
---|
134 | dtag_rdata_w1_m[29], |
---|
135 | dtag_rdata_w2_m[29], |
---|
136 | dtag_rdata_w3_m[29]}), |
---|
137 | .q ({dtag_rdata_w0_parity_g, |
---|
138 | dtag_rdata_w1_parity_g, |
---|
139 | dtag_rdata_w2_parity_g, |
---|
140 | dtag_rdata_w3_parity_g}), |
---|
141 | .clk (clk), |
---|
142 | .se (se), .si (), .so ()); |
---|
143 | |
---|
144 | |
---|
145 | // generate 8bit parity for all ways before g-flop |
---|
146 | assign dtag_rdata_w0_8b_parity_m[0] = ^dtag_rdata_w0_m[7:0] ; |
---|
147 | assign dtag_rdata_w0_8b_parity_m[1] = ^dtag_rdata_w0_m[15:8] ; |
---|
148 | assign dtag_rdata_w0_8b_parity_m[2] = ^dtag_rdata_w0_m[23:16] ; |
---|
149 | assign dtag_rdata_w0_8b_parity_m[3] = ^dtag_rdata_w0_m[28:24] ; |
---|
150 | |
---|
151 | assign dtag_rdata_w1_8b_parity_m[0] = ^dtag_rdata_w1_m[7:0] ; |
---|
152 | assign dtag_rdata_w1_8b_parity_m[1] = ^dtag_rdata_w1_m[15:8] ; |
---|
153 | assign dtag_rdata_w1_8b_parity_m[2] = ^dtag_rdata_w1_m[23:16] ; |
---|
154 | assign dtag_rdata_w1_8b_parity_m[3] = ^dtag_rdata_w1_m[28:24] ; |
---|
155 | |
---|
156 | assign dtag_rdata_w2_8b_parity_m[0] = ^dtag_rdata_w2_m[7:0] ; |
---|
157 | assign dtag_rdata_w2_8b_parity_m[1] = ^dtag_rdata_w2_m[15:8] ; |
---|
158 | assign dtag_rdata_w2_8b_parity_m[2] = ^dtag_rdata_w2_m[23:16] ; |
---|
159 | assign dtag_rdata_w2_8b_parity_m[3] = ^dtag_rdata_w2_m[28:24] ; |
---|
160 | |
---|
161 | assign dtag_rdata_w3_8b_parity_m[0] = ^dtag_rdata_w3_m[7:0] ; |
---|
162 | assign dtag_rdata_w3_8b_parity_m[1] = ^dtag_rdata_w3_m[15:8] ; |
---|
163 | assign dtag_rdata_w3_8b_parity_m[2] = ^dtag_rdata_w3_m[23:16] ; |
---|
164 | assign dtag_rdata_w3_8b_parity_m[3] = ^dtag_rdata_w3_m[28:24] ; |
---|
165 | |
---|
166 | |
---|
167 | // g-flop for 8-bit parity for all 4 ways |
---|
168 | |
---|
169 | dff_s #(4) dtag_rdata_w0_8b_parity_g_ff ( |
---|
170 | .din (dtag_rdata_w0_8b_parity_m[3:0]), |
---|
171 | .q (dtag_rdata_w0_8b_parity_g[3:0]), |
---|
172 | .clk (clk), |
---|
173 | .se (se), .si (), .so ()); |
---|
174 | |
---|
175 | dff_s #(4) dtag_rdata_w1_8b_parity_g_ff ( |
---|
176 | .din (dtag_rdata_w1_8b_parity_m[3:0]), |
---|
177 | .q (dtag_rdata_w1_8b_parity_g[3:0]), |
---|
178 | .clk (clk), |
---|
179 | .se (se), .si (), .so ()); |
---|
180 | |
---|
181 | dff_s #(4) dtag_rdata_w2_8b_parity_g_ff ( |
---|
182 | .din (dtag_rdata_w2_8b_parity_m[3:0]), |
---|
183 | .q (dtag_rdata_w2_8b_parity_g[3:0]), |
---|
184 | .clk (clk), |
---|
185 | .se (se), .si (), .so ()); |
---|
186 | |
---|
187 | dff_s #(4) dtag_rdata_w3_8b_parity_g_ff ( |
---|
188 | .din (dtag_rdata_w3_8b_parity_m[3:0]), |
---|
189 | .q (dtag_rdata_w3_8b_parity_g[3:0]), |
---|
190 | .clk (clk), |
---|
191 | .se (se), .si (), .so ()); |
---|
192 | |
---|
193 | |
---|
194 | assign lsu_rd_dtag_parity_g[0] = ^({dtag_rdata_w0_8b_parity_g[3:0],dtag_rdata_w0_parity_g}); |
---|
195 | assign lsu_rd_dtag_parity_g[1] = ^({dtag_rdata_w1_8b_parity_g[3:0],dtag_rdata_w1_parity_g}); |
---|
196 | assign lsu_rd_dtag_parity_g[2] = ^({dtag_rdata_w2_8b_parity_g[3:0],dtag_rdata_w2_parity_g}); |
---|
197 | assign lsu_rd_dtag_parity_g[3] = ^({dtag_rdata_w3_8b_parity_g[3:0],dtag_rdata_w3_parity_g}); |
---|
198 | |
---|
199 | endmodule |
---|