1 | // ========== Copyright Header Begin ========================================== |
---|
2 | // |
---|
3 | // OpenSPARC T1 Processor File: lsu_dcdp.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 | // Description: LSU Data Cache Data Path |
---|
24 | // - Final Way-Select Mux. |
---|
25 | // - Alignment, Sign-Extension, Endianness. |
---|
26 | */ |
---|
27 | //////////////////////////////////////////////////////////////////////// |
---|
28 | // Global header file includes |
---|
29 | //////////////////////////////////////////////////////////////////////// |
---|
30 | `include "sys.h" // system level definition file which contains the |
---|
31 | // time scale definition |
---|
32 | |
---|
33 | //////////////////////////////////////////////////////////////////////// |
---|
34 | // Local header file includes / local defines |
---|
35 | //////////////////////////////////////////////////////////////////////// |
---|
36 | |
---|
37 | module lsu_dcdp ( /*AUTOARG*/ |
---|
38 | // Outputs |
---|
39 | so, dcache_rdata_wb_buf, mbist_dcache_data_in, |
---|
40 | lsu_exu_dfill_data_w2, lsu_ffu_ld_data, stb_rdata_ramc_buf, |
---|
41 | // Inputs |
---|
42 | rclk, si, se, rst_tri_en, dcache_rdata_wb, dcache_rparity_wb, |
---|
43 | dcache_rdata_msb_w0_m, dcache_rdata_msb_w1_m, |
---|
44 | dcache_rdata_msb_w2_m, dcache_rdata_msb_w3_m, lsu_bist_rsel_way_e, |
---|
45 | dcache_alt_mx_sel_e, cache_way_hit_buf2, morphed_addr_m, |
---|
46 | signed_ldst_byte_m, signed_ldst_hw_m, signed_ldst_w_m, |
---|
47 | merge7_sel_byte0_m, merge7_sel_byte7_m, merge6_sel_byte1_m, |
---|
48 | merge6_sel_byte6_m, merge5_sel_byte2_m, merge5_sel_byte5_m, |
---|
49 | merge4_sel_byte3_m, merge4_sel_byte4_m, merge3_sel_byte0_m, |
---|
50 | merge3_sel_byte3_m, merge3_sel_byte4_m, |
---|
51 | merge3_sel_byte7_default_m, merge3_sel_byte_m, merge2_sel_byte1_m, |
---|
52 | merge2_sel_byte2_m, merge2_sel_byte5_m, |
---|
53 | merge2_sel_byte6_default_m, merge2_sel_byte_m, merge0_sel_byte0_m, |
---|
54 | merge0_sel_byte1_m, merge0_sel_byte2_m, |
---|
55 | merge0_sel_byte3_default_m, merge0_sel_byte4_m, |
---|
56 | merge0_sel_byte5_m, merge0_sel_byte6_m, |
---|
57 | merge0_sel_byte7_default_m, merge1_sel_byte0_m, |
---|
58 | merge1_sel_byte1_m, merge1_sel_byte2_m, |
---|
59 | merge1_sel_byte3_default_m, merge1_sel_byte4_m, |
---|
60 | merge1_sel_byte5_m, merge1_sel_byte6_m, |
---|
61 | merge1_sel_byte7_default_m, merge0_sel_byte_1h_m, |
---|
62 | merge1_sel_byte_1h_m, merge1_sel_byte_2h_m, stb_rdata_ramc |
---|
63 | ) ; |
---|
64 | |
---|
65 | input rclk; |
---|
66 | input si; |
---|
67 | input se; |
---|
68 | output so; |
---|
69 | input rst_tri_en; |
---|
70 | |
---|
71 | input [63:0] dcache_rdata_wb; |
---|
72 | output [63:0] dcache_rdata_wb_buf; |
---|
73 | |
---|
74 | input [7:0] dcache_rparity_wb; |
---|
75 | output [71:0] mbist_dcache_data_in; |
---|
76 | |
---|
77 | output [63:0] lsu_exu_dfill_data_w2; // bypass data - d$ fill or hit |
---|
78 | output [63:0] lsu_ffu_ld_data ; // ld data to frf |
---|
79 | |
---|
80 | |
---|
81 | //========================================= |
---|
82 | //dc_fill CP |
---|
83 | //========================================= |
---|
84 | input [7:0] dcache_rdata_msb_w0_m; //from D$ |
---|
85 | input [7:0] dcache_rdata_msb_w1_m; //from D$ |
---|
86 | input [7:0] dcache_rdata_msb_w2_m; //from D$ |
---|
87 | input [7:0] dcache_rdata_msb_w3_m; //from D$ |
---|
88 | |
---|
89 | input [3:0] lsu_bist_rsel_way_e; //from qdp2 |
---|
90 | |
---|
91 | input dcache_alt_mx_sel_e; |
---|
92 | input [3:0] cache_way_hit_buf2; //from dtlb |
---|
93 | |
---|
94 | input [7:0] morphed_addr_m; //from dctl |
---|
95 | |
---|
96 | input signed_ldst_byte_m; //from dctl |
---|
97 | // input unsigned_ldst_byte_m; //from dctl |
---|
98 | input signed_ldst_hw_m; //from dctl |
---|
99 | // input unsigned_ldst_hw_m; //from dctl |
---|
100 | input signed_ldst_w_m; //from dctl |
---|
101 | // input unsigned_ldst_w_m; //from dctl |
---|
102 | |
---|
103 | input merge7_sel_byte0_m; |
---|
104 | input merge7_sel_byte7_m; |
---|
105 | |
---|
106 | input merge6_sel_byte1_m; |
---|
107 | input merge6_sel_byte6_m; |
---|
108 | |
---|
109 | input merge5_sel_byte2_m; |
---|
110 | input merge5_sel_byte5_m; |
---|
111 | |
---|
112 | input merge4_sel_byte3_m; |
---|
113 | input merge4_sel_byte4_m; |
---|
114 | |
---|
115 | input merge3_sel_byte0_m; |
---|
116 | input merge3_sel_byte3_m; |
---|
117 | input merge3_sel_byte4_m; |
---|
118 | input merge3_sel_byte7_default_m; |
---|
119 | input merge3_sel_byte_m ; |
---|
120 | |
---|
121 | input merge2_sel_byte1_m; |
---|
122 | input merge2_sel_byte2_m; |
---|
123 | input merge2_sel_byte5_m; |
---|
124 | input merge2_sel_byte6_default_m; |
---|
125 | input merge2_sel_byte_m ; |
---|
126 | |
---|
127 | input merge0_sel_byte0_m, merge0_sel_byte1_m; |
---|
128 | input merge0_sel_byte2_m, merge0_sel_byte3_default_m; |
---|
129 | |
---|
130 | input merge0_sel_byte4_m, merge0_sel_byte5_m; |
---|
131 | input merge0_sel_byte6_m, merge0_sel_byte7_default_m; |
---|
132 | |
---|
133 | input merge1_sel_byte0_m, merge1_sel_byte1_m; |
---|
134 | input merge1_sel_byte2_m, merge1_sel_byte3_default_m; |
---|
135 | input merge1_sel_byte4_m, merge1_sel_byte5_m; |
---|
136 | input merge1_sel_byte6_m, merge1_sel_byte7_default_m; |
---|
137 | |
---|
138 | input merge0_sel_byte_1h_m ; |
---|
139 | |
---|
140 | input merge1_sel_byte_1h_m, merge1_sel_byte_2h_m ; |
---|
141 | |
---|
142 | input [14:9] stb_rdata_ramc; |
---|
143 | output [14:9] stb_rdata_ramc_buf; |
---|
144 | |
---|
145 | //wire [3:1] lsu_byp_byte_zero_extend ; // zero-extend for bypass bytes 7-1 |
---|
146 | wire [7:1] lsu_byp_byte_sign_extend ; // sign-extend by 1 for byp bytes 7-1 |
---|
147 | |
---|
148 | wire [7:0] byte0,byte1,byte2,byte3; |
---|
149 | wire [7:0] byte4,byte5,byte6,byte7; |
---|
150 | //wire [3:1] zero_extend_g; |
---|
151 | wire [7:1] sign_extend_g; |
---|
152 | |
---|
153 | wire [7:0] align_byte3 ; |
---|
154 | wire [7:0] align_byte2 ; |
---|
155 | wire [7:0] align_byte1_1h,align_byte1_2h; |
---|
156 | wire [7:0] align_byte0_1h,align_byte0_2h ; |
---|
157 | wire [63:0] align_byte ; |
---|
158 | |
---|
159 | |
---|
160 | wire merge7_sel_byte0; |
---|
161 | wire merge7_sel_byte7; |
---|
162 | |
---|
163 | wire merge6_sel_byte1; |
---|
164 | wire merge6_sel_byte6; |
---|
165 | |
---|
166 | wire merge5_sel_byte2; |
---|
167 | wire merge5_sel_byte5; |
---|
168 | |
---|
169 | wire merge4_sel_byte3; |
---|
170 | wire merge4_sel_byte4; |
---|
171 | |
---|
172 | wire merge3_sel_byte0; |
---|
173 | wire merge3_sel_byte3; |
---|
174 | wire merge3_sel_byte4; |
---|
175 | wire merge3_sel_byte7; |
---|
176 | wire merge3_sel_byte ; |
---|
177 | |
---|
178 | wire merge2_sel_byte1; |
---|
179 | wire merge2_sel_byte2; |
---|
180 | wire merge2_sel_byte5; |
---|
181 | wire merge2_sel_byte6; |
---|
182 | wire merge2_sel_byte ; |
---|
183 | |
---|
184 | wire merge0_sel_byte0, merge0_sel_byte1; |
---|
185 | wire merge0_sel_byte2, merge0_sel_byte3; |
---|
186 | wire merge0_sel_byte4, merge0_sel_byte5; |
---|
187 | wire merge0_sel_byte6, merge0_sel_byte7; |
---|
188 | wire merge1_sel_byte0, merge1_sel_byte1; |
---|
189 | wire merge1_sel_byte2, merge1_sel_byte3; |
---|
190 | wire merge1_sel_byte4, merge1_sel_byte5; |
---|
191 | wire merge1_sel_byte6, merge1_sel_byte7; |
---|
192 | |
---|
193 | wire merge0_sel_byte_1h ; |
---|
194 | wire merge1_sel_byte_1h, merge1_sel_byte_2h ; |
---|
195 | |
---|
196 | wire clk; |
---|
197 | assign clk = rclk; |
---|
198 | |
---|
199 | assign stb_rdata_ramc_buf[14:9] = stb_rdata_ramc[14:9]; |
---|
200 | |
---|
201 | //========================================================================================= |
---|
202 | // Alignment of Fill Data |
---|
203 | //========================================================================================= |
---|
204 | |
---|
205 | // Alignment needs to be done for following reasons : |
---|
206 | // - Write of data to irf on ld hit in l1. |
---|
207 | // - Write of data to irf on ld fill to l1 after miss in l1. |
---|
208 | // - Store of irf data to memory. |
---|
209 | // - Data must be aligned before write to stb. |
---|
210 | // - If data is bypassed from stb by ld then it will |
---|
211 | // need realignment thru dfq i.e., it looks like a fill. |
---|
212 | // This applies to data either read from the dcache (hit) or dfq(fill on miss). |
---|
213 | |
---|
214 | |
---|
215 | assign byte7[7:0] = dcache_rdata_wb[63:56]; |
---|
216 | assign byte6[7:0] = dcache_rdata_wb[55:48]; |
---|
217 | assign byte5[7:0] = dcache_rdata_wb[47:40]; |
---|
218 | assign byte4[7:0] = dcache_rdata_wb[39:32]; |
---|
219 | assign byte3[7:0] = dcache_rdata_wb[31:24]; |
---|
220 | assign byte2[7:0] = dcache_rdata_wb[23:16]; |
---|
221 | assign byte1[7:0] = dcache_rdata_wb[15:8]; |
---|
222 | assign byte0[7:0] = dcache_rdata_wb[7:0]; |
---|
223 | |
---|
224 | //assign zero_extend_g[3:1] = lsu_byp_byte_zero_extend[3:1] ; |
---|
225 | assign sign_extend_g[7:1] = lsu_byp_byte_sign_extend[7:1] ; |
---|
226 | |
---|
227 | //buffer |
---|
228 | assign dcache_rdata_wb_buf[63:0] = dcache_rdata_wb[63:0]; |
---|
229 | assign mbist_dcache_data_in[71:0] = {dcache_rdata_wb_buf[63:0], dcache_rparity_wb[7:0]}; |
---|
230 | |
---|
231 | // Final endian/justified/sign-extend Byte 0. |
---|
232 | //assign align_byte0_1h[7:0] |
---|
233 | // = merge0_sel_byte0 ? byte0[7:0] : |
---|
234 | // merge0_sel_byte1 ? byte1[7:0] : |
---|
235 | // merge0_sel_byte2 ? byte2[7:0] : |
---|
236 | // merge0_sel_byte3 ? byte3[7:0] : |
---|
237 | // 8'hxx ; |
---|
238 | |
---|
239 | wire merge0_sel_byte0_mxsel0, merge0_sel_byte1_mxsel1, merge0_sel_byte2_mxsel2, merge0_sel_byte3_mxsel3; |
---|
240 | assign merge0_sel_byte0_mxsel0 = merge0_sel_byte0 & ~rst_tri_en; |
---|
241 | assign merge0_sel_byte1_mxsel1 = merge0_sel_byte1 & ~rst_tri_en; |
---|
242 | assign merge0_sel_byte2_mxsel2 = merge0_sel_byte2 & ~rst_tri_en; |
---|
243 | assign merge0_sel_byte3_mxsel3 = merge0_sel_byte3 | rst_tri_en; |
---|
244 | |
---|
245 | mux4ds #(8) align_byte0_1h_mx ( |
---|
246 | .in0 (byte0[7:0]), |
---|
247 | .in1 (byte1[7:0]), |
---|
248 | .in2 (byte2[7:0]), |
---|
249 | .in3 (byte3[7:0]), |
---|
250 | .sel0(merge0_sel_byte0_mxsel0), |
---|
251 | .sel1(merge0_sel_byte1_mxsel1), |
---|
252 | .sel2(merge0_sel_byte2_mxsel2), |
---|
253 | .sel3(merge0_sel_byte3_mxsel3), |
---|
254 | .dout(align_byte0_1h[7:0]) |
---|
255 | ); |
---|
256 | |
---|
257 | //assign align_byte0_2h[7:0] |
---|
258 | // = merge0_sel_byte4 ? byte4[7:0] : |
---|
259 | // merge0_sel_byte5 ? byte5[7:0] : |
---|
260 | // merge0_sel_byte6 ? byte6[7:0] : |
---|
261 | // merge0_sel_byte7 ? byte7[7:0] : |
---|
262 | // 8'hxx ; |
---|
263 | |
---|
264 | wire merge0_sel_byte4_mxsel0, merge0_sel_byte5_mxsel1, merge0_sel_byte6_mxsel2, merge0_sel_byte7_mxsel3; |
---|
265 | assign merge0_sel_byte4_mxsel0 = merge0_sel_byte4 & ~rst_tri_en; |
---|
266 | assign merge0_sel_byte5_mxsel1 = merge0_sel_byte5 & ~rst_tri_en; |
---|
267 | assign merge0_sel_byte6_mxsel2 = merge0_sel_byte6 & ~rst_tri_en; |
---|
268 | assign merge0_sel_byte7_mxsel3 = merge0_sel_byte7 | rst_tri_en; |
---|
269 | |
---|
270 | mux4ds #(8) align_byte0_2h_mx ( |
---|
271 | .in0 (byte4[7:0]), |
---|
272 | .in1 (byte5[7:0]), |
---|
273 | .in2 (byte6[7:0]), |
---|
274 | .in3 (byte7[7:0]), |
---|
275 | .sel0(merge0_sel_byte4_mxsel0), |
---|
276 | .sel1(merge0_sel_byte5_mxsel1), |
---|
277 | .sel2(merge0_sel_byte6_mxsel2), |
---|
278 | .sel3(merge0_sel_byte7_mxsel3), |
---|
279 | .dout(align_byte0_2h[7:0]) |
---|
280 | ); |
---|
281 | |
---|
282 | // No sign-extension or zero-extension for byte0 |
---|
283 | //assign align_byte[7:0] |
---|
284 | // = merge0_sel_byte_1h ? align_byte0_1h[7:0] : |
---|
285 | // align_byte0_2h[7:0] ; |
---|
286 | |
---|
287 | assign align_byte[7:0] = merge0_sel_byte_1h ? align_byte0_1h[7:0] : |
---|
288 | align_byte0_2h[7:0]; |
---|
289 | |
---|
290 | |
---|
291 | // Final endian/justified/sign-extend Byte 1. |
---|
292 | // *** The path thru byte1 is the most critical *** |
---|
293 | //assign align_byte1_1h[7:0] |
---|
294 | // = merge1_sel_byte0 ? byte0[7:0] : |
---|
295 | // merge1_sel_byte1 ? byte1[7:0] : |
---|
296 | // merge1_sel_byte2 ? byte2[7:0] : |
---|
297 | // merge1_sel_byte3 ? byte3[7:0] : |
---|
298 | // 8'hxx ; |
---|
299 | |
---|
300 | wire merge1_sel_byte0_mxsel0, merge1_sel_byte1_mxsel1, merge1_sel_byte2_mxsel2, merge1_sel_byte3_mxsel3; |
---|
301 | assign merge1_sel_byte0_mxsel0 = merge1_sel_byte0 & ~rst_tri_en; |
---|
302 | assign merge1_sel_byte1_mxsel1 = merge1_sel_byte1 & ~rst_tri_en; |
---|
303 | assign merge1_sel_byte2_mxsel2 = merge1_sel_byte2 & ~rst_tri_en; |
---|
304 | assign merge1_sel_byte3_mxsel3 = merge1_sel_byte3 | rst_tri_en; |
---|
305 | |
---|
306 | mux4ds #(8) align_byte1_1h_mx ( |
---|
307 | .in0 (byte0[7:0]), |
---|
308 | .in1 (byte1[7:0]), |
---|
309 | .in2 (byte2[7:0]), |
---|
310 | .in3 (byte3[7:0]), |
---|
311 | .sel0(merge1_sel_byte0_mxsel0), |
---|
312 | .sel1(merge1_sel_byte1_mxsel1), |
---|
313 | .sel2(merge1_sel_byte2_mxsel2), |
---|
314 | .sel3(merge1_sel_byte3_mxsel3), |
---|
315 | .dout(align_byte1_1h[7:0]) |
---|
316 | ); |
---|
317 | |
---|
318 | //assign align_byte1_2h[7:0] |
---|
319 | // = merge1_sel_byte4 ? byte4[7:0] : |
---|
320 | // merge1_sel_byte5 ? byte5[7:0] : |
---|
321 | // merge1_sel_byte6 ? byte6[7:0] : |
---|
322 | // merge1_sel_byte7 ? byte7[7:0] : |
---|
323 | // 8'hxx ; |
---|
324 | |
---|
325 | wire merge1_sel_byte4_mxsel0, merge1_sel_byte5_mxsel1, merge1_sel_byte6_mxsel2, merge1_sel_byte7_mxsel3; |
---|
326 | assign merge1_sel_byte4_mxsel0 = merge1_sel_byte4 & ~rst_tri_en; |
---|
327 | assign merge1_sel_byte5_mxsel1 = merge1_sel_byte5 & ~rst_tri_en; |
---|
328 | assign merge1_sel_byte6_mxsel2 = merge1_sel_byte6 & ~rst_tri_en; |
---|
329 | assign merge1_sel_byte7_mxsel3 = merge1_sel_byte7 | rst_tri_en; |
---|
330 | |
---|
331 | mux4ds #(8) align_byte1_2h_mx ( |
---|
332 | .in0 (byte4[7:0]), |
---|
333 | .in1 (byte5[7:0]), |
---|
334 | .in2 (byte6[7:0]), |
---|
335 | .in3 (byte7[7:0]), |
---|
336 | .sel0(merge1_sel_byte4_mxsel0), |
---|
337 | .sel1(merge1_sel_byte5_mxsel1), |
---|
338 | .sel2(merge1_sel_byte6_mxsel2), |
---|
339 | .sel3(merge1_sel_byte7_mxsel3), |
---|
340 | .dout(align_byte1_2h[7:0]) |
---|
341 | ); |
---|
342 | |
---|
343 | //assign align_byte[15:8] = |
---|
344 | // zero_extend_g[1] ? 8'h00 : |
---|
345 | // sign_extend_g[1] ? 8'hff : |
---|
346 | // merge1_sel_byte_1h ? align_byte1_1h[7:0] : |
---|
347 | // merge1_sel_byte_2h ? align_byte1_2h[7:0] : |
---|
348 | // 8'hxx ; |
---|
349 | |
---|
350 | //mux4ds #(8) align_byte1_mx ( |
---|
351 | // .in0 (8'h00), |
---|
352 | // .in1 (8'hff), |
---|
353 | // .in2 (align_byte1_1h[7:0]), |
---|
354 | // .in3 (align_byte1_2h[7:0]), |
---|
355 | // .sel0(zero_extend_g[1]), |
---|
356 | // .sel1(sign_extend_g[1]), |
---|
357 | // .sel2(merge1_sel_byte_1h), |
---|
358 | // .sel3(merge1_sel_byte_2h), |
---|
359 | // .dout(align_byte[15:8]) |
---|
360 | //); |
---|
361 | |
---|
362 | //change to aoi from pass gate |
---|
363 | //don't need zero_extend |
---|
364 | |
---|
365 | assign align_byte[15:8] = |
---|
366 | (sign_extend_g[1] ? 8'hff : 8'h00) | |
---|
367 | (merge1_sel_byte_1h ? align_byte1_1h[7:0] : 8'h00) | |
---|
368 | (merge1_sel_byte_2h ? align_byte1_2h[7:0] : 8'h00); |
---|
369 | |
---|
370 | // Final endian/justified/sign-extend Byte 2. |
---|
371 | //assign align_byte2[7:0] |
---|
372 | // = merge2_sel_byte1 ? byte1[7:0] : |
---|
373 | // merge2_sel_byte2 ? byte2[7:0] : |
---|
374 | // merge2_sel_byte5 ? byte5[7:0] : |
---|
375 | // merge2_sel_byte6 ? byte6[7:0] : |
---|
376 | // 8'hxx ; |
---|
377 | |
---|
378 | wire merge2_sel_byte1_mxsel0, merge2_sel_byte2_mxsel1, merge2_sel_byte5_mxsel2, merge2_sel_byte6_mxsel3; |
---|
379 | assign merge2_sel_byte1_mxsel0 = merge2_sel_byte1 & ~rst_tri_en; |
---|
380 | assign merge2_sel_byte2_mxsel1 = merge2_sel_byte2 & ~rst_tri_en; |
---|
381 | assign merge2_sel_byte5_mxsel2 = merge2_sel_byte5 & ~rst_tri_en; |
---|
382 | assign merge2_sel_byte6_mxsel3 = merge2_sel_byte6 | rst_tri_en; |
---|
383 | |
---|
384 | mux4ds #(8) align_byte2_1st_mx ( |
---|
385 | .in0 (byte1[7:0]), |
---|
386 | .in1 (byte2[7:0]), |
---|
387 | .in2 (byte5[7:0]), |
---|
388 | .in3 (byte6[7:0]), |
---|
389 | .sel0(merge2_sel_byte1_mxsel0), |
---|
390 | .sel1(merge2_sel_byte2_mxsel1), |
---|
391 | .sel2(merge2_sel_byte5_mxsel2), |
---|
392 | .sel3(merge2_sel_byte6_mxsel3), |
---|
393 | .dout(align_byte2[7:0]) |
---|
394 | ); |
---|
395 | |
---|
396 | //assign align_byte[23:16] = |
---|
397 | // zero_extend_g[2] ? 8'h00 : |
---|
398 | // sign_extend_g[2] ? 8'hff : |
---|
399 | // merge2_sel_byte ? align_byte2[7:0] : |
---|
400 | // 8'hxx ; |
---|
401 | |
---|
402 | //mux3ds #(8) align_byte2_2nd_mx ( |
---|
403 | // .in0 (8'h00), |
---|
404 | // .in1 (8'hff), |
---|
405 | // .in2 (align_byte2[7:0]), |
---|
406 | // .sel0(zero_extend_g[2]), |
---|
407 | // .sel1(sign_extend_g[2]), |
---|
408 | // .sel2(merge2_sel_byte), |
---|
409 | // .dout(align_byte[23:16]) |
---|
410 | // ); |
---|
411 | |
---|
412 | assign align_byte[23:16] = |
---|
413 | ( sign_extend_g[2] ? 8'hff : 8'h00) | |
---|
414 | ( merge2_sel_byte ? align_byte2[7:0] : 8'h00); |
---|
415 | |
---|
416 | // Final endian/justified/sign-extend Byte 3. |
---|
417 | //assign align_byte3[7:0] |
---|
418 | // = merge3_sel_byte0 ? byte0[7:0] : |
---|
419 | // merge3_sel_byte3 ? byte3[7:0] : |
---|
420 | // merge3_sel_byte4 ? byte4[7:0] : |
---|
421 | // merge3_sel_byte7 ? byte7[7:0] : |
---|
422 | // 8'hxx ; |
---|
423 | |
---|
424 | wire merge3_sel_byte0_mxsel0, merge3_sel_byte3_mxsel1, merge3_sel_byte4_mxsel2, merge3_sel_byte7_mxsel3; |
---|
425 | assign merge3_sel_byte0_mxsel0 = merge3_sel_byte0 & ~rst_tri_en; |
---|
426 | assign merge3_sel_byte3_mxsel1 = merge3_sel_byte3 & ~rst_tri_en; |
---|
427 | assign merge3_sel_byte4_mxsel2 = merge3_sel_byte4 & ~rst_tri_en; |
---|
428 | assign merge3_sel_byte7_mxsel3 = merge3_sel_byte7 | rst_tri_en; |
---|
429 | |
---|
430 | mux4ds #(8) align_byte3_1st_mx ( |
---|
431 | .in0 (byte0[7:0]), |
---|
432 | .in1 (byte3[7:0]), |
---|
433 | .in2 (byte4[7:0]), |
---|
434 | .in3 (byte7[7:0]), |
---|
435 | .sel0(merge3_sel_byte0_mxsel0), |
---|
436 | .sel1(merge3_sel_byte3_mxsel1), |
---|
437 | .sel2(merge3_sel_byte4_mxsel2), |
---|
438 | .sel3(merge3_sel_byte7_mxsel3), |
---|
439 | .dout(align_byte3[7:0]) |
---|
440 | ); |
---|
441 | |
---|
442 | //assign align_byte[31:24] = |
---|
443 | // zero_extend_g[3] ? 8'h00 : |
---|
444 | // sign_extend_g[3] ? 8'hff : |
---|
445 | // merge3_sel_byte ? align_byte3[7:0] : |
---|
446 | // 8'hxx ; |
---|
447 | |
---|
448 | //mux3ds #(8) align_byte3_2nd_mx ( |
---|
449 | // .in0 (8'h00), |
---|
450 | // .in1 (8'hff), |
---|
451 | // .in2 (align_byte3[7:0]), |
---|
452 | // .sel0(zero_extend_g[3]), |
---|
453 | // .sel1(sign_extend_g[3]), |
---|
454 | // .sel2(merge3_sel_byte), |
---|
455 | // .dout(align_byte[31:24]) |
---|
456 | // ); |
---|
457 | |
---|
458 | assign align_byte[31:24] = |
---|
459 | (sign_extend_g[3] ? 8'hff : 8'h00 ) | |
---|
460 | (merge3_sel_byte ? align_byte3[7:0] : 8'h00); |
---|
461 | |
---|
462 | // Final endian/justified/sign-extend Byte 4. |
---|
463 | //assign align_byte[39:32] |
---|
464 | // = zero_extend_g[4] ? 8'h00 : |
---|
465 | // sign_extend_g[4] ? 8'hff : |
---|
466 | // merge4_sel_byte3 ? byte3[7:0] : |
---|
467 | // merge4_sel_byte4 ? byte4[7:0] : |
---|
468 | // 8'hxx; |
---|
469 | |
---|
470 | //mux4ds #(8) align_byte4_mx ( |
---|
471 | // .in0 (8'h00), |
---|
472 | // .in1 (8'hff), |
---|
473 | // .in2 (byte3[7:0]), |
---|
474 | // .in3 (byte4[7:0]), |
---|
475 | // .sel0(zero_extend_g[4]), |
---|
476 | // .sel1(sign_extend_g[4]), |
---|
477 | // .sel2(merge4_sel_byte3), |
---|
478 | // .sel3(merge4_sel_byte4), |
---|
479 | // .dout(align_byte[39:32]) |
---|
480 | // ); |
---|
481 | |
---|
482 | assign align_byte[39:32] = |
---|
483 | (sign_extend_g[4] ? 8'hff : 8'h00) | |
---|
484 | (merge4_sel_byte3 ? byte3[7:0] : 8'h00) | |
---|
485 | (merge4_sel_byte4 ? byte4[7:0] : 8'h00); |
---|
486 | |
---|
487 | // Final endian/justified/sign-extend Byte 5. |
---|
488 | //assign align_byte[47:40] |
---|
489 | // = zero_extend_g[5] ? 8'h00 : |
---|
490 | // sign_extend_g[5] ? 8'hff : |
---|
491 | // merge5_sel_byte2 ? byte2[7:0] : |
---|
492 | // merge5_sel_byte5 ? byte5[7:0] : |
---|
493 | // 8'hxx ; |
---|
494 | |
---|
495 | //mux4ds #(8) align_byte5_mx ( |
---|
496 | // .in0 (8'h00), |
---|
497 | // .in1 (8'hff), |
---|
498 | // .in2 (byte2[7:0]), |
---|
499 | // .in3 (byte5[7:0]), |
---|
500 | // .sel0(zero_extend_g[5]), |
---|
501 | // .sel1(sign_extend_g[5]), |
---|
502 | // .sel2(merge5_sel_byte2), |
---|
503 | // .sel3(merge5_sel_byte5), |
---|
504 | // .dout(align_byte[47:40]) |
---|
505 | // ); |
---|
506 | |
---|
507 | assign align_byte[47:40] = |
---|
508 | (sign_extend_g[5] ? 8'hff : 8'h00) | |
---|
509 | (merge5_sel_byte2 ? byte2[7:0] : 8'h00) | |
---|
510 | (merge5_sel_byte5 ? byte5[7:0] : 8'h00); |
---|
511 | |
---|
512 | |
---|
513 | // Final endian/justified/sign-extend Byte 6. |
---|
514 | //assign align_byte[55:48] |
---|
515 | // = zero_extend_g[6] ? 8'h00 : |
---|
516 | // sign_extend_g[6] ? 8'hff : |
---|
517 | // merge6_sel_byte1 ? byte1[7:0] : |
---|
518 | // merge6_sel_byte6 ? byte6[7:0] : |
---|
519 | // 8'hxx ; |
---|
520 | |
---|
521 | //mux4ds #(8) align_byte6_mx ( |
---|
522 | // .in0 (8'h00), |
---|
523 | // .in1 (8'hff), |
---|
524 | // .in2 (byte1[7:0]), |
---|
525 | // .in3 (byte6[7:0]), |
---|
526 | // .sel0(zero_extend_g[6]), |
---|
527 | // .sel1(sign_extend_g[6]), |
---|
528 | // .sel2(merge6_sel_byte1), |
---|
529 | // .sel3(merge6_sel_byte6), |
---|
530 | // .dout(align_byte[55:48]) |
---|
531 | // ); |
---|
532 | |
---|
533 | assign align_byte[55:48] = |
---|
534 | (sign_extend_g[6] ? 8'hff : 8'h00) | |
---|
535 | (merge6_sel_byte1 ? byte1[7:0] : 8'h00) | |
---|
536 | (merge6_sel_byte6 ? byte6[7:0] : 8'h00); |
---|
537 | |
---|
538 | |
---|
539 | // Final endian/justified/sign-extend Byte 7. |
---|
540 | //assign align_byte[63:56] = |
---|
541 | // zero_extend_g[7] ? 8'h00 : |
---|
542 | // sign_extend_g[7] ? 8'hff : |
---|
543 | // merge7_sel_byte0 ? byte0[7:0] : |
---|
544 | // merge7_sel_byte7 ? byte7[7:0] : |
---|
545 | // 8'hxx ; |
---|
546 | |
---|
547 | //mux4ds #(8) align_byte7_mx ( |
---|
548 | // .in0 (8'h00), |
---|
549 | // .in1 (8'hff), |
---|
550 | // .in2 (byte0[7:0]), |
---|
551 | // .in3 (byte7[7:0]), |
---|
552 | // .sel0(zero_extend_g[7]), |
---|
553 | // .sel1(sign_extend_g[7]), |
---|
554 | // .sel2(merge7_sel_byte0), |
---|
555 | // .sel3(merge7_sel_byte7), |
---|
556 | // .dout(align_byte[63:56]) |
---|
557 | // ); |
---|
558 | |
---|
559 | assign align_byte[63:56] = |
---|
560 | (sign_extend_g[7] ? 8'hff : 8'h00 ) | |
---|
561 | (merge7_sel_byte0 ? byte0[7:0] : 8'h00) | |
---|
562 | (merge7_sel_byte7 ? byte7[7:0] : 8'h00); |
---|
563 | |
---|
564 | //==================================================== |
---|
565 | //dc_fill CP sign/zero control signals |
---|
566 | //==================================================== |
---|
567 | wire [7:0] ld_data_msb_w0_m; |
---|
568 | wire [7:0] ld_data_msb_w1_m; |
---|
569 | wire [7:0] ld_data_msb_w2_m; |
---|
570 | wire [7:0] ld_data_msb_w3_m; |
---|
571 | |
---|
572 | wire [7:0] ld_data_msb_w0_g; |
---|
573 | wire [7:0] ld_data_msb_w1_g; |
---|
574 | wire [7:0] ld_data_msb_w2_g; |
---|
575 | wire [7:0] ld_data_msb_w3_g; |
---|
576 | |
---|
577 | assign ld_data_msb_w0_m[7:0] = dcache_rdata_msb_w0_m[7:0]; |
---|
578 | assign ld_data_msb_w1_m[7:0] = dcache_rdata_msb_w1_m[7:0]; |
---|
579 | assign ld_data_msb_w2_m[7:0] = dcache_rdata_msb_w2_m[7:0]; |
---|
580 | assign ld_data_msb_w3_m[7:0] = dcache_rdata_msb_w3_m[7:0]; |
---|
581 | |
---|
582 | dff_s #(32) ld_data_msb_stgg ( |
---|
583 | .din ({ld_data_msb_w0_m[7:0], ld_data_msb_w1_m[7:0], ld_data_msb_w2_m[7:0], ld_data_msb_w3_m[7:0]}), |
---|
584 | .q ({ld_data_msb_w0_g[7:0], ld_data_msb_w1_g[7:0], ld_data_msb_w2_g[7:0], ld_data_msb_w3_g[7:0]}), |
---|
585 | .clk (clk), |
---|
586 | .se (se), .si (), .so () |
---|
587 | ); |
---|
588 | |
---|
589 | wire [3:0] dcache_alt_rsel_way_m; |
---|
590 | wire dcache_alt_mx_sel_m; |
---|
591 | |
---|
592 | dff_s #(5) dcache_alt_stgm ( |
---|
593 | .din ({lsu_bist_rsel_way_e[3:0], dcache_alt_mx_sel_e}), |
---|
594 | .q ({dcache_alt_rsel_way_m[3:0], dcache_alt_mx_sel_m}), |
---|
595 | .clk (clk), |
---|
596 | .se (se), .si (), .so () |
---|
597 | ); |
---|
598 | |
---|
599 | wire [3:0] dcache_alt_rsel_way_g; |
---|
600 | wire dcache_alt_mx_sel_g; |
---|
601 | |
---|
602 | dff_s #(5) dcache_alt_stgg ( |
---|
603 | .din ({dcache_alt_rsel_way_m[3:0], dcache_alt_mx_sel_m}), |
---|
604 | .q ({dcache_alt_rsel_way_g[3:0], dcache_alt_mx_sel_g}), |
---|
605 | .clk (clk), |
---|
606 | .se (se), .si (), .so () |
---|
607 | ); |
---|
608 | wire [3:0] cache_way_mx_sel; |
---|
609 | |
---|
610 | assign cache_way_mx_sel [3:0] = dcache_alt_mx_sel_g ? dcache_alt_rsel_way_g[3:0] : cache_way_hit_buf2[3:0]; |
---|
611 | |
---|
612 | // wire [7:0] align_bytes_msb; |
---|
613 | |
---|
614 | //mux4ds #(8) align_bytes_msb_mux ( |
---|
615 | // .in0 (ld_data_msb_w0_g[7:0]), |
---|
616 | // .in1 (ld_data_msb_w1_g[7:0]), |
---|
617 | // .in2 (ld_data_msb_w2_g[7:0]), |
---|
618 | // .in3 (ld_data_msb_w3_g[7:0]), |
---|
619 | // .sel0 (cache_way_mx_sel[0]), |
---|
620 | // .sel1 (cache_way_mx_sel[1]), |
---|
621 | // .sel2 (cache_way_mx_sel[2]), |
---|
622 | // .sel3 (cache_way_mx_sel[3]), |
---|
623 | // .dout (align_bytes_msb[7:0]) |
---|
624 | //); |
---|
625 | |
---|
626 | wire signed_ldst_byte_g; |
---|
627 | wire signed_ldst_hw_g; |
---|
628 | wire signed_ldst_w_g; |
---|
629 | |
---|
630 | dff_s #(3) ldst_size_stgg( |
---|
631 | .din ({signed_ldst_byte_m, signed_ldst_hw_m, signed_ldst_w_m}), |
---|
632 | .q ({signed_ldst_byte_g, signed_ldst_hw_g, signed_ldst_w_g}), |
---|
633 | .clk (clk), |
---|
634 | .se (se), .si (), .so () |
---|
635 | ); |
---|
636 | |
---|
637 | wire [7:0] morphed_addr_g; |
---|
638 | |
---|
639 | dff_s #(8) stgg_morphadd( |
---|
640 | .din (morphed_addr_m[7:0]), |
---|
641 | .q (morphed_addr_g[7:0]), |
---|
642 | .clk (clk), |
---|
643 | .se (se), .si (), .so () |
---|
644 | ); |
---|
645 | |
---|
646 | wire sign_bit_w0_g, sign_bit_w1_g, sign_bit_w2_g, sign_bit_w3_g; |
---|
647 | |
---|
648 | assign sign_bit_w0_g = |
---|
649 | (morphed_addr_g[0] & ld_data_msb_w0_g[7]) | |
---|
650 | (morphed_addr_g[1] & ld_data_msb_w0_g[6]) | |
---|
651 | (morphed_addr_g[2] & ld_data_msb_w0_g[5]) | |
---|
652 | (morphed_addr_g[3] & ld_data_msb_w0_g[4]) | |
---|
653 | (morphed_addr_g[4] & ld_data_msb_w0_g[3]) | |
---|
654 | (morphed_addr_g[5] & ld_data_msb_w0_g[2]) | |
---|
655 | (morphed_addr_g[6] & ld_data_msb_w0_g[1]) | |
---|
656 | (morphed_addr_g[7] & ld_data_msb_w0_g[0]) ; |
---|
657 | |
---|
658 | assign sign_bit_w1_g = |
---|
659 | (morphed_addr_g[0] & ld_data_msb_w1_g[7]) | |
---|
660 | (morphed_addr_g[1] & ld_data_msb_w1_g[6]) | |
---|
661 | (morphed_addr_g[2] & ld_data_msb_w1_g[5]) | |
---|
662 | (morphed_addr_g[3] & ld_data_msb_w1_g[4]) | |
---|
663 | (morphed_addr_g[4] & ld_data_msb_w1_g[3]) | |
---|
664 | (morphed_addr_g[5] & ld_data_msb_w1_g[2]) | |
---|
665 | (morphed_addr_g[6] & ld_data_msb_w1_g[1]) | |
---|
666 | (morphed_addr_g[7] & ld_data_msb_w1_g[0]) ; |
---|
667 | |
---|
668 | assign sign_bit_w2_g = |
---|
669 | (morphed_addr_g[0] & ld_data_msb_w2_g[7]) | |
---|
670 | (morphed_addr_g[1] & ld_data_msb_w2_g[6]) | |
---|
671 | (morphed_addr_g[2] & ld_data_msb_w2_g[5]) | |
---|
672 | (morphed_addr_g[3] & ld_data_msb_w2_g[4]) | |
---|
673 | (morphed_addr_g[4] & ld_data_msb_w2_g[3]) | |
---|
674 | (morphed_addr_g[5] & ld_data_msb_w2_g[2]) | |
---|
675 | (morphed_addr_g[6] & ld_data_msb_w2_g[1]) | |
---|
676 | (morphed_addr_g[7] & ld_data_msb_w2_g[0]) ; |
---|
677 | |
---|
678 | assign sign_bit_w3_g = |
---|
679 | (morphed_addr_g[0] & ld_data_msb_w3_g[7]) | |
---|
680 | (morphed_addr_g[1] & ld_data_msb_w3_g[6]) | |
---|
681 | (morphed_addr_g[2] & ld_data_msb_w3_g[5]) | |
---|
682 | (morphed_addr_g[3] & ld_data_msb_w3_g[4]) | |
---|
683 | (morphed_addr_g[4] & ld_data_msb_w3_g[3]) | |
---|
684 | (morphed_addr_g[5] & ld_data_msb_w3_g[2]) | |
---|
685 | (morphed_addr_g[6] & ld_data_msb_w3_g[1]) | |
---|
686 | (morphed_addr_g[7] & ld_data_msb_w3_g[0]) ; |
---|
687 | |
---|
688 | //assign sign_bit_g = |
---|
689 | // (morphed_addr_g[0] & align_bytes_msb[7]) | |
---|
690 | // (morphed_addr_g[1] & align_bytes_msb[6]) | |
---|
691 | // (morphed_addr_g[2] & align_bytes_msb[5]) | |
---|
692 | // (morphed_addr_g[3] & align_bytes_msb[4]) | |
---|
693 | // (morphed_addr_g[4] & align_bytes_msb[3]) | |
---|
694 | // (morphed_addr_g[5] & align_bytes_msb[2]) | |
---|
695 | // (morphed_addr_g[6] & align_bytes_msb[1]) | |
---|
696 | // (morphed_addr_g[7] & align_bytes_msb[0]) ; |
---|
697 | |
---|
698 | |
---|
699 | //dff #(4) ssign_bit_stgg ( |
---|
700 | // .din ({sign_bit_w0_m, sign_bit_w1_m, sign_bit_w2_m, sign_bit_w3_m}), |
---|
701 | // .q ({sign_bit_w0_g, sign_bit_w1_g, sign_bit_w2_g, sign_bit_w3_g}), |
---|
702 | // .clk (clk), |
---|
703 | // .se (se), .si (), .so () |
---|
704 | // ); |
---|
705 | |
---|
706 | // byte0 never requires sign or zero extension. |
---|
707 | //w0 |
---|
708 | // wire [3:1] lsu_byp_byte_zero_extend_w0; |
---|
709 | wire [7:1] lsu_byp_byte_sign_extend_w0; |
---|
710 | |
---|
711 | //assign lsu_byp_byte_zero_extend_w0[1] = |
---|
712 | // unsigned_ldst_byte_g | (signed_ldst_byte_g & ~sign_bit_w0_g); |
---|
713 | |
---|
714 | assign lsu_byp_byte_sign_extend_w0[1] = |
---|
715 | signed_ldst_byte_g & sign_bit_w0_g; |
---|
716 | |
---|
717 | //assign lsu_byp_byte_zero_extend_w0[2] = |
---|
718 | // unsigned_ldst_hw_g | (signed_ldst_hw_g & ~sign_bit_w0_g); |
---|
719 | |
---|
720 | assign lsu_byp_byte_sign_extend_w0[2] = |
---|
721 | signed_ldst_hw_g & sign_bit_w0_g; |
---|
722 | |
---|
723 | //assign lsu_byp_byte_zero_extend_w0[3] = |
---|
724 | // lsu_byp_byte_zero_extend_w0[2] ; |
---|
725 | |
---|
726 | assign lsu_byp_byte_sign_extend_w0[3] = |
---|
727 | lsu_byp_byte_sign_extend_w0[2] ; |
---|
728 | |
---|
729 | //assign lsu_byp_byte_zero_extend_w0[4] = |
---|
730 | // unsigned_ldst_w_g | (signed_ldst_w_g & ~sign_bit_w0_g); |
---|
731 | |
---|
732 | assign lsu_byp_byte_sign_extend_w0[4] = |
---|
733 | signed_ldst_w_g & sign_bit_w0_g; |
---|
734 | |
---|
735 | //assign lsu_byp_byte_zero_extend_w0[5] = |
---|
736 | // lsu_byp_byte_zero_extend_w0[4] ; |
---|
737 | assign lsu_byp_byte_sign_extend_w0[5] = |
---|
738 | lsu_byp_byte_sign_extend_w0[4] ; |
---|
739 | //assign lsu_byp_byte_zero_extend_w0[6] = |
---|
740 | // lsu_byp_byte_zero_extend_w0[4] ; |
---|
741 | assign lsu_byp_byte_sign_extend_w0[6] = |
---|
742 | lsu_byp_byte_sign_extend_w0[4] ; |
---|
743 | //assign lsu_byp_byte_zero_extend_w0[7] = |
---|
744 | // lsu_byp_byte_zero_extend_w0[4] ; |
---|
745 | assign lsu_byp_byte_sign_extend_w0[7] = |
---|
746 | lsu_byp_byte_sign_extend_w0[4] ; |
---|
747 | |
---|
748 | //w1 |
---|
749 | // wire [3:1] lsu_byp_byte_zero_extend_w1; |
---|
750 | wire [7:1] lsu_byp_byte_sign_extend_w1; |
---|
751 | |
---|
752 | //assign lsu_byp_byte_zero_extend_w1[1] = |
---|
753 | // unsigned_ldst_byte_g | (signed_ldst_byte_g & ~sign_bit_w1_g); |
---|
754 | |
---|
755 | assign lsu_byp_byte_sign_extend_w1[1] = |
---|
756 | signed_ldst_byte_g & sign_bit_w1_g; |
---|
757 | |
---|
758 | //assign lsu_byp_byte_zero_extend_w1[2] = |
---|
759 | // unsigned_ldst_hw_g | (signed_ldst_hw_g & ~sign_bit_w1_g); |
---|
760 | |
---|
761 | assign lsu_byp_byte_sign_extend_w1[2] = |
---|
762 | signed_ldst_hw_g & sign_bit_w1_g; |
---|
763 | |
---|
764 | //assign lsu_byp_byte_zero_extend_w1[3] = |
---|
765 | // lsu_byp_byte_zero_extend_w1[2] ; |
---|
766 | |
---|
767 | assign lsu_byp_byte_sign_extend_w1[3] = |
---|
768 | lsu_byp_byte_sign_extend_w1[2] ; |
---|
769 | |
---|
770 | //assign lsu_byp_byte_zero_extend_w1[4] = |
---|
771 | // unsigned_ldst_w_g | (signed_ldst_w_g & ~sign_bit_w1_g); |
---|
772 | |
---|
773 | assign lsu_byp_byte_sign_extend_w1[4] = |
---|
774 | signed_ldst_w_g & sign_bit_w1_g; |
---|
775 | |
---|
776 | //assign lsu_byp_byte_zero_extend_w1[5] = |
---|
777 | // lsu_byp_byte_zero_extend_w1[4] ; |
---|
778 | assign lsu_byp_byte_sign_extend_w1[5] = |
---|
779 | lsu_byp_byte_sign_extend_w1[4] ; |
---|
780 | //assign lsu_byp_byte_zero_extend_w1[6] = |
---|
781 | // lsu_byp_byte_zero_extend_w1[4] ; |
---|
782 | assign lsu_byp_byte_sign_extend_w1[6] = |
---|
783 | lsu_byp_byte_sign_extend_w1[4] ; |
---|
784 | //assign lsu_byp_byte_zero_extend_w1[7] = |
---|
785 | // lsu_byp_byte_zero_extend_w1[4] ; |
---|
786 | assign lsu_byp_byte_sign_extend_w1[7] = |
---|
787 | lsu_byp_byte_sign_extend_w1[4] ; |
---|
788 | |
---|
789 | //w2 |
---|
790 | // wire [3:1] lsu_byp_byte_zero_extend_w2; |
---|
791 | wire [7:1] lsu_byp_byte_sign_extend_w2; |
---|
792 | |
---|
793 | //assign lsu_byp_byte_zero_extend_w2[1] = |
---|
794 | // unsigned_ldst_byte_g | (signed_ldst_byte_g & ~sign_bit_w2_g); |
---|
795 | |
---|
796 | assign lsu_byp_byte_sign_extend_w2[1] = |
---|
797 | signed_ldst_byte_g & sign_bit_w2_g; |
---|
798 | |
---|
799 | //assign lsu_byp_byte_zero_extend_w2[2] = |
---|
800 | // unsigned_ldst_hw_g | (signed_ldst_hw_g & ~sign_bit_w2_g); |
---|
801 | |
---|
802 | assign lsu_byp_byte_sign_extend_w2[2] = |
---|
803 | signed_ldst_hw_g & sign_bit_w2_g; |
---|
804 | |
---|
805 | //assign lsu_byp_byte_zero_extend_w2[3] = |
---|
806 | // lsu_byp_byte_zero_extend_w2[2] ; |
---|
807 | |
---|
808 | assign lsu_byp_byte_sign_extend_w2[3] = |
---|
809 | lsu_byp_byte_sign_extend_w2[2] ; |
---|
810 | |
---|
811 | //assign lsu_byp_byte_zero_extend_w2[4] = |
---|
812 | // unsigned_ldst_w_g | (signed_ldst_w_g & ~sign_bit_w2_g); |
---|
813 | |
---|
814 | assign lsu_byp_byte_sign_extend_w2[4] = |
---|
815 | signed_ldst_w_g & sign_bit_w2_g; |
---|
816 | |
---|
817 | //assign lsu_byp_byte_zero_extend_w2[5] = |
---|
818 | // lsu_byp_byte_zero_extend_w2[4] ; |
---|
819 | assign lsu_byp_byte_sign_extend_w2[5] = |
---|
820 | lsu_byp_byte_sign_extend_w2[4] ; |
---|
821 | //assign lsu_byp_byte_zero_extend_w2[6] = |
---|
822 | // lsu_byp_byte_zero_extend_w2[4] ; |
---|
823 | assign lsu_byp_byte_sign_extend_w2[6] = |
---|
824 | lsu_byp_byte_sign_extend_w2[4] ; |
---|
825 | //assign lsu_byp_byte_zero_extend_w2[7] = |
---|
826 | // lsu_byp_byte_zero_extend_w2[4] ; |
---|
827 | assign lsu_byp_byte_sign_extend_w2[7] = |
---|
828 | lsu_byp_byte_sign_extend_w2[4] ; |
---|
829 | |
---|
830 | //w3 |
---|
831 | // wire [3:1] lsu_byp_byte_zero_extend_w3; |
---|
832 | wire [7:1] lsu_byp_byte_sign_extend_w3; |
---|
833 | |
---|
834 | //assign lsu_byp_byte_zero_extend_w3[1] = |
---|
835 | // unsigned_ldst_byte_g | (signed_ldst_byte_g & ~sign_bit_w3_g); |
---|
836 | |
---|
837 | assign lsu_byp_byte_sign_extend_w3[1] = |
---|
838 | signed_ldst_byte_g & sign_bit_w3_g; |
---|
839 | |
---|
840 | //assign lsu_byp_byte_zero_extend_w3[2] = |
---|
841 | // unsigned_ldst_hw_g | (signed_ldst_hw_g & ~sign_bit_w3_g); |
---|
842 | |
---|
843 | assign lsu_byp_byte_sign_extend_w3[2] = |
---|
844 | signed_ldst_hw_g & sign_bit_w3_g; |
---|
845 | |
---|
846 | //assign lsu_byp_byte_zero_extend_w3[3] = |
---|
847 | // lsu_byp_byte_zero_extend_w3[2] ; |
---|
848 | |
---|
849 | assign lsu_byp_byte_sign_extend_w3[3] = |
---|
850 | lsu_byp_byte_sign_extend_w3[2] ; |
---|
851 | |
---|
852 | //assign lsu_byp_byte_zero_extend_w3[4] = |
---|
853 | // unsigned_ldst_w_g | (signed_ldst_w_g & ~sign_bit_w3_g); |
---|
854 | |
---|
855 | assign lsu_byp_byte_sign_extend_w3[4] = |
---|
856 | signed_ldst_w_g & sign_bit_w3_g; |
---|
857 | |
---|
858 | //assign lsu_byp_byte_zero_extend_w3[5] = |
---|
859 | // lsu_byp_byte_zero_extend_w3[4] ; |
---|
860 | assign lsu_byp_byte_sign_extend_w3[5] = |
---|
861 | lsu_byp_byte_sign_extend_w3[4] ; |
---|
862 | //assign lsu_byp_byte_zero_extend_w3[6] = |
---|
863 | // lsu_byp_byte_zero_extend_w3[4] ; |
---|
864 | assign lsu_byp_byte_sign_extend_w3[6] = |
---|
865 | lsu_byp_byte_sign_extend_w3[4] ; |
---|
866 | //assign lsu_byp_byte_zero_extend_w3[7] = |
---|
867 | // lsu_byp_byte_zero_extend_w3[4] ; |
---|
868 | assign lsu_byp_byte_sign_extend_w3[7] = |
---|
869 | lsu_byp_byte_sign_extend_w3[4] ; |
---|
870 | |
---|
871 | |
---|
872 | //mux4ds #(14) zero_sign_sel_mux ( |
---|
873 | // .in0 ({lsu_byp_byte_zero_extend_w0[7:1],lsu_byp_byte_sign_extend_w0[7:1]}), |
---|
874 | // .in1 ({lsu_byp_byte_zero_extend_w1[7:1],lsu_byp_byte_sign_extend_w1[7:1]}), |
---|
875 | // .in2 ({lsu_byp_byte_zero_extend_w2[7:1],lsu_byp_byte_sign_extend_w2[7:1]}), |
---|
876 | // .in3 ({lsu_byp_byte_zero_extend_w3[7:1],lsu_byp_byte_sign_extend_w3[7:1]}), |
---|
877 | // .sel0 (cache_way_mx_sel[0]), |
---|
878 | // .sel1 (cache_way_mx_sel[1]), |
---|
879 | // .sel2 (cache_way_mx_sel[2]), |
---|
880 | // .sel3 (cache_way_mx_sel[3]), |
---|
881 | // .dout ({lsu_byp_byte_zero_extend[7:1],lsu_byp_byte_sign_extend[7:1]}) |
---|
882 | //); |
---|
883 | |
---|
884 | //assign lsu_byp_byte_zero_extend[3:1] = |
---|
885 | // (cache_way_mx_sel[0] ? lsu_byp_byte_zero_extend_w0[3:1] : 3'b0 ) | |
---|
886 | // (cache_way_mx_sel[1] ? lsu_byp_byte_zero_extend_w1[3:1] : 3'b0 ) | |
---|
887 | // (cache_way_mx_sel[2] ? lsu_byp_byte_zero_extend_w2[3:1] : 3'b0 ) | |
---|
888 | // (cache_way_mx_sel[3] ? lsu_byp_byte_zero_extend_w3[3:1] : 3'b0 ) ; |
---|
889 | |
---|
890 | assign lsu_byp_byte_sign_extend[7:1] = |
---|
891 | (cache_way_mx_sel[0] ? lsu_byp_byte_sign_extend_w0[7:1] : 7'b0) | |
---|
892 | (cache_way_mx_sel[1] ? lsu_byp_byte_sign_extend_w1[7:1] : 7'b0) | |
---|
893 | (cache_way_mx_sel[2] ? lsu_byp_byte_sign_extend_w2[7:1] : 7'b0) | |
---|
894 | (cache_way_mx_sel[3] ? lsu_byp_byte_sign_extend_w3[7:1] : 7'b0) ; |
---|
895 | |
---|
896 | |
---|
897 | |
---|
898 | dff_s #(37) stgg_mergesel( |
---|
899 | .din ({ |
---|
900 | merge7_sel_byte0_m, merge7_sel_byte7_m, |
---|
901 | merge6_sel_byte1_m, merge6_sel_byte6_m, |
---|
902 | merge5_sel_byte2_m, merge5_sel_byte5_m, |
---|
903 | merge4_sel_byte3_m, merge4_sel_byte4_m, |
---|
904 | merge3_sel_byte0_m, merge3_sel_byte3_m, |
---|
905 | merge3_sel_byte4_m, merge3_sel_byte7_default_m, merge3_sel_byte_m, |
---|
906 | merge2_sel_byte1_m, merge2_sel_byte2_m, merge2_sel_byte5_m, |
---|
907 | merge2_sel_byte6_default_m, merge2_sel_byte_m, |
---|
908 | merge0_sel_byte0_m, merge0_sel_byte1_m, |
---|
909 | merge0_sel_byte2_m, merge0_sel_byte3_default_m, |
---|
910 | merge0_sel_byte4_m, merge0_sel_byte5_m, |
---|
911 | merge0_sel_byte6_m, merge0_sel_byte7_default_m, |
---|
912 | merge1_sel_byte0_m, merge1_sel_byte1_m, |
---|
913 | merge1_sel_byte2_m, merge1_sel_byte3_default_m, |
---|
914 | merge1_sel_byte4_m, merge1_sel_byte5_m, |
---|
915 | merge1_sel_byte6_m, merge1_sel_byte7_default_m, |
---|
916 | merge0_sel_byte_1h_m,merge1_sel_byte_1h_m, merge1_sel_byte_2h_m |
---|
917 | }), |
---|
918 | .q ({ |
---|
919 | merge7_sel_byte0, merge7_sel_byte7, |
---|
920 | merge6_sel_byte1, merge6_sel_byte6, |
---|
921 | merge5_sel_byte2, merge5_sel_byte5, |
---|
922 | merge4_sel_byte3, merge4_sel_byte4, |
---|
923 | merge3_sel_byte0, merge3_sel_byte3, |
---|
924 | merge3_sel_byte4, merge3_sel_byte7,merge3_sel_byte, |
---|
925 | merge2_sel_byte1, merge2_sel_byte2, merge2_sel_byte5, |
---|
926 | merge2_sel_byte6, merge2_sel_byte, |
---|
927 | merge0_sel_byte0, merge0_sel_byte1, |
---|
928 | merge0_sel_byte2, merge0_sel_byte3, |
---|
929 | merge0_sel_byte4, merge0_sel_byte5, |
---|
930 | merge0_sel_byte6, merge0_sel_byte7, |
---|
931 | merge1_sel_byte0, merge1_sel_byte1, |
---|
932 | merge1_sel_byte2, merge1_sel_byte3, |
---|
933 | merge1_sel_byte4, merge1_sel_byte5, |
---|
934 | merge1_sel_byte6, merge1_sel_byte7, |
---|
935 | merge0_sel_byte_1h,merge1_sel_byte_1h, merge1_sel_byte_2h |
---|
936 | }), |
---|
937 | .clk (clk), |
---|
938 | .se (se), .si (), .so () |
---|
939 | ); |
---|
940 | |
---|
941 | |
---|
942 | assign lsu_exu_dfill_data_w2[63:0] = align_byte[63:0] ; |
---|
943 | assign lsu_ffu_ld_data[63:0] = align_byte[63:0] ; |
---|
944 | |
---|
945 | endmodule |
---|
946 | |
---|
947 | |
---|