[6] | 1 | // ========== Copyright Header Begin ========================================== |
---|
| 2 | // |
---|
| 3 | // OpenSPARC T1 Processor File: sparc_ffu_dp.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_ffu_dp |
---|
| 24 | // Description: This is the ffu datapath. It stores the 2 128 bit operands |
---|
| 25 | // and the result (puts result in the 1st source to save space). |
---|
| 26 | */ |
---|
| 27 | |
---|
| 28 | `include "iop.h" |
---|
| 29 | |
---|
| 30 | module sparc_ffu_dp (/*AUTOARG*/ |
---|
| 31 | // Outputs |
---|
| 32 | so, dp_frf_data, ffu_lsu_data, dp_vis_rs1_data, dp_vis_rs2_data, |
---|
| 33 | dp_ctl_rs2_sign, dp_ctl_fsr_fcc, dp_ctl_fsr_rnd, dp_ctl_fsr_tem, |
---|
| 34 | dp_ctl_fsr_aexc, dp_ctl_fsr_cexc, dp_ctl_ld_fcc, |
---|
| 35 | dp_ctl_gsr_mask_e, dp_ctl_gsr_scale_e, dp_ctl_synd_out_low, |
---|
| 36 | dp_ctl_synd_out_high, |
---|
| 37 | // Inputs |
---|
| 38 | rclk, se, si, ctl_dp_rst_l, frf_dp_data, cpx_fpu_data, |
---|
| 39 | lsu_ffu_ld_data, vis_dp_rd_data, ctl_dp_wsr_data_w2, ctl_dp_sign, |
---|
| 40 | ctl_dp_exc_w2, ctl_dp_fcc_w2, ctl_dp_ftt_w2, ctl_dp_noshift64_frf, |
---|
| 41 | ctl_dp_shift_frf_right, ctl_dp_shift_frf_left, |
---|
| 42 | ctl_dp_zero_low32_frf, ctl_dp_output_sel_rs1, |
---|
| 43 | ctl_dp_output_sel_rs2, ctl_dp_output_sel_frf, |
---|
| 44 | ctl_dp_output_sel_fsr, ctl_dp_noflip_lsu, ctl_dp_flip_lsu, |
---|
| 45 | ctl_dp_noflip_fpu, ctl_dp_flip_fpu, ctl_dp_rs2_frf_read, |
---|
| 46 | ctl_dp_rs2_sel_vis, ctl_dp_rs2_sel_fpu_lsu, ctl_dp_rs2_keep_data, |
---|
| 47 | ctl_dp_rd_ecc, ctl_dp_fp_thr, ctl_dp_fsr_sel_old, |
---|
| 48 | ctl_dp_fsr_sel_ld, ctl_dp_fsr_sel_fpu, ctl_dp_gsr_wsr_w2, |
---|
| 49 | ctl_dp_thr_e, ctl_dp_new_rs1, ctl_dp_ecc_sel_frf |
---|
| 50 | ) ; |
---|
| 51 | input rclk; |
---|
| 52 | input se; |
---|
| 53 | input si; |
---|
| 54 | input ctl_dp_rst_l; |
---|
| 55 | input [77:0] frf_dp_data; |
---|
| 56 | input [63:0] cpx_fpu_data; |
---|
| 57 | input [63:0] lsu_ffu_ld_data; |
---|
| 58 | input [63:0] vis_dp_rd_data; |
---|
| 59 | |
---|
| 60 | input [36:0] ctl_dp_wsr_data_w2; |
---|
| 61 | |
---|
| 62 | input [1:0] ctl_dp_sign; // sign after abs or neg |
---|
| 63 | input [9:0] ctl_dp_exc_w2; |
---|
| 64 | input [7:0] ctl_dp_fcc_w2; |
---|
| 65 | input [2:0] ctl_dp_ftt_w2; |
---|
| 66 | |
---|
| 67 | // mux selects |
---|
| 68 | input ctl_dp_noshift64_frf; // choose output from FRF |
---|
| 69 | input ctl_dp_shift_frf_right; |
---|
| 70 | input ctl_dp_shift_frf_left; |
---|
| 71 | |
---|
| 72 | input ctl_dp_zero_low32_frf; |
---|
| 73 | |
---|
| 74 | input ctl_dp_output_sel_rs1; // choose output to lsu |
---|
| 75 | input ctl_dp_output_sel_rs2; |
---|
| 76 | input ctl_dp_output_sel_frf; |
---|
| 77 | input ctl_dp_output_sel_fsr; |
---|
| 78 | |
---|
| 79 | input ctl_dp_noflip_lsu;// inputs from lsu and fpu |
---|
| 80 | input ctl_dp_flip_lsu; |
---|
| 81 | input ctl_dp_noflip_fpu; |
---|
| 82 | input ctl_dp_flip_fpu; |
---|
| 83 | |
---|
| 84 | input ctl_dp_rs2_frf_read; // choose r2 |
---|
| 85 | input ctl_dp_rs2_sel_vis; |
---|
| 86 | input ctl_dp_rs2_sel_fpu_lsu; |
---|
| 87 | input ctl_dp_rs2_keep_data; |
---|
| 88 | input ctl_dp_rd_ecc; |
---|
| 89 | |
---|
| 90 | input [3:0] ctl_dp_fp_thr; |
---|
| 91 | |
---|
| 92 | input [3:0] ctl_dp_fsr_sel_old, // choose what to update FSR with |
---|
| 93 | ctl_dp_fsr_sel_ld, |
---|
| 94 | ctl_dp_fsr_sel_fpu; |
---|
| 95 | |
---|
| 96 | input [3:0] ctl_dp_gsr_wsr_w2; |
---|
| 97 | input [3:0] ctl_dp_thr_e; |
---|
| 98 | |
---|
| 99 | |
---|
| 100 | // rs1 selects |
---|
| 101 | input ctl_dp_new_rs1; |
---|
| 102 | |
---|
| 103 | // 2:1 mux selects |
---|
| 104 | input ctl_dp_ecc_sel_frf; |
---|
| 105 | |
---|
| 106 | // outputs |
---|
| 107 | output so; |
---|
| 108 | output [63:0] dp_frf_data; |
---|
| 109 | output [63:0] ffu_lsu_data; |
---|
| 110 | output [63:0] dp_vis_rs1_data; |
---|
| 111 | output [63:0] dp_vis_rs2_data; |
---|
| 112 | output [1:0] dp_ctl_rs2_sign; // sign for rs2 |
---|
| 113 | output [7:0] dp_ctl_fsr_fcc; |
---|
| 114 | output [1:0] dp_ctl_fsr_rnd; |
---|
| 115 | output [4:0] dp_ctl_fsr_tem; |
---|
| 116 | output [4:0] dp_ctl_fsr_aexc; |
---|
| 117 | output [4:0] dp_ctl_fsr_cexc; |
---|
| 118 | |
---|
| 119 | output [7:0] dp_ctl_ld_fcc; |
---|
| 120 | |
---|
| 121 | output [31:0] dp_ctl_gsr_mask_e; |
---|
| 122 | output [4:0] dp_ctl_gsr_scale_e; |
---|
| 123 | |
---|
| 124 | |
---|
| 125 | output [6:0] dp_ctl_synd_out_low; // signals for ecc errors |
---|
| 126 | output [6:0] dp_ctl_synd_out_high; |
---|
| 127 | |
---|
| 128 | wire clk; |
---|
| 129 | wire reset; |
---|
| 130 | // local signals |
---|
| 131 | wire [63:0] fpu_ffu_data; |
---|
| 132 | wire [63:0] lsu_ffu_ld_data_d1; |
---|
| 133 | wire [63:0] rs2_rd_data; // stores both the rs2 and rd data |
---|
| 134 | wire [63:0] rs2_rd_data_next; |
---|
| 135 | wire [63:0] write_data; // needed since block loads are pipelined |
---|
| 136 | wire [63:0] rs2_data_changed; |
---|
| 137 | wire [63:0] local_rd_data; |
---|
| 138 | wire [63:0] rs1_data; |
---|
| 139 | wire [63:0] rs1_data_next; |
---|
| 140 | wire [63:0] shifted_frf_data; |
---|
| 141 | wire [63:0] new_frf_data; |
---|
| 142 | wire [63:0] lsu_fpu_data; |
---|
| 143 | wire [63:0] frf_data_in; |
---|
| 144 | wire [6:0] synd_in_low; // input ecc for lower word |
---|
| 145 | wire [6:0] synd_in_h; // input ecc for upper word |
---|
| 146 | wire [63:0] corr_data_next; |
---|
| 147 | wire [63:0] corr_data; |
---|
| 148 | wire [63:0] ecc_data_in; |
---|
| 149 | |
---|
| 150 | wire [27:0] current_fsr, |
---|
| 151 | t0_fsr, |
---|
| 152 | t1_fsr, |
---|
| 153 | t2_fsr, |
---|
| 154 | t3_fsr; |
---|
| 155 | wire [27:0] t0_fsr_nxt, |
---|
| 156 | t1_fsr_nxt, |
---|
| 157 | t2_fsr_nxt, |
---|
| 158 | t3_fsr_nxt; |
---|
| 159 | wire [27:0] t0_ldfsr_data, |
---|
| 160 | t0_fpufsr_data; |
---|
| 161 | wire [27:0] t1_ldfsr_data, |
---|
| 162 | t1_fpufsr_data; |
---|
| 163 | wire [27:0] t2_ldfsr_data, |
---|
| 164 | t2_fpufsr_data; |
---|
| 165 | wire [27:0] t3_ldfsr_data, |
---|
| 166 | t3_fpufsr_data; |
---|
| 167 | |
---|
| 168 | wire [36:0] gsr_e; |
---|
| 169 | wire [36:0] t0_gsr; |
---|
| 170 | wire [36:0] t0_gsr_nxt; |
---|
| 171 | wire [36:0] t1_gsr; |
---|
| 172 | wire [36:0] t1_gsr_nxt; |
---|
| 173 | wire [36:0] t2_gsr; |
---|
| 174 | wire [36:0] t2_gsr_nxt; |
---|
| 175 | wire [36:0] t3_gsr; |
---|
| 176 | wire [36:0] t3_gsr_nxt; |
---|
| 177 | |
---|
| 178 | assign reset = ~ctl_dp_rst_l; |
---|
| 179 | assign clk= rclk; |
---|
| 180 | |
---|
| 181 | dff_s #(64) cpx_reg(.din(cpx_fpu_data[63:0]), |
---|
| 182 | .q (fpu_ffu_data[63:0]), |
---|
| 183 | .clk (clk), .se(se), .si(), .so()); |
---|
| 184 | |
---|
| 185 | // flop for lsu data. the data is flopped in ffu, but the vld is flopped in the lsu. |
---|
| 186 | // This is for timing reasons on the valid bit and Sanjay didn't want to redo the |
---|
| 187 | // lsu dp for the data portion |
---|
| 188 | dff_s #(64) lsu_data_dff(.din(lsu_ffu_ld_data[63:0]), .clk(clk), .q(lsu_ffu_ld_data_d1[63:0]), |
---|
| 189 | .se(se), .si(), .so()); |
---|
| 190 | assign dp_ctl_ld_fcc[7:0] = {lsu_ffu_ld_data_d1[37:32], lsu_ffu_ld_data_d1[11:10]}; |
---|
| 191 | |
---|
| 192 | /////////////////////////////////////////////// |
---|
| 193 | // Input from FRF (shift as needed for singles) |
---|
| 194 | // The data needs to be shifted around because these are 64 bit reads but |
---|
| 195 | // the required data might be in either the upper or lower 32 bits for |
---|
| 196 | // singles. If it is a double then the data is left alone. |
---|
| 197 | // If it is a single move and the source and target have the same alignment |
---|
| 198 | // then no change happens. If it is a single move and the source and target |
---|
| 199 | // have different alignments the operands get moved into place for the write. |
---|
| 200 | // If it is data that will be sent to the lsu the data is moved into the lower |
---|
| 201 | // 32 bits. If the data will be sent to the fpu the data is moved to the upper |
---|
| 202 | // 32 bits (if not there already) |
---|
| 203 | /////////////////////////////////////////////// |
---|
| 204 | assign frf_data_in[63:32] = frf_dp_data[70:39]; |
---|
| 205 | assign frf_data_in[31:0] = frf_dp_data[31:0]; |
---|
| 206 | mux3ds #(64) frf_input_mux(.dout(shifted_frf_data[63:0]), |
---|
| 207 | .in0(frf_data_in[63:0]), |
---|
| 208 | .in1({32'b0, frf_data_in[63:32]}), |
---|
| 209 | .in2({frf_data_in[31:0], 32'b0}), |
---|
| 210 | .sel0(ctl_dp_noshift64_frf), |
---|
| 211 | .sel1(ctl_dp_shift_frf_right), |
---|
| 212 | .sel2(ctl_dp_shift_frf_left)); |
---|
| 213 | assign new_frf_data[63:32] = shifted_frf_data[63:32]; |
---|
| 214 | assign new_frf_data[31:0] = shifted_frf_data[31:0] & {32{~ctl_dp_zero_low32_frf}}; |
---|
| 215 | |
---|
| 216 | mux4ds #(64) lsu_fpu_input_mux(.dout(lsu_fpu_data[63:0]), |
---|
| 217 | .in0(lsu_ffu_ld_data_d1[63:0]), |
---|
| 218 | .in1({lsu_ffu_ld_data_d1[31:0], 32'b0}), |
---|
| 219 | .in2(fpu_ffu_data[63:0]), |
---|
| 220 | .in3({32'b0, fpu_ffu_data[63:32]}), |
---|
| 221 | .sel0(ctl_dp_noflip_lsu), |
---|
| 222 | .sel1(ctl_dp_flip_lsu), |
---|
| 223 | .sel2(ctl_dp_noflip_fpu), |
---|
| 224 | .sel3(ctl_dp_flip_fpu)); |
---|
| 225 | |
---|
| 226 | // Data to FRF |
---|
| 227 | dp_buffer #(64) frf_out_buf(.in(write_data[63:0]), .dout (dp_frf_data[63:0])); |
---|
| 228 | |
---|
| 229 | |
---|
| 230 | |
---|
| 231 | // Data to LSU |
---|
| 232 | // Mux for lsu data between two sets of data and the direct |
---|
| 233 | // frf output for stores |
---|
| 234 | mux4ds #(64) output_mux(.dout (ffu_lsu_data[63:0]), |
---|
| 235 | .in0 (rs2_rd_data[63:0]), |
---|
| 236 | .in1 (rs1_data[63:0]), |
---|
| 237 | .in2 (shifted_frf_data[63:0]), |
---|
| 238 | .in3 ({26'b0, current_fsr[27:20], 2'b0, current_fsr[19:15], 6'b0, current_fsr[14:12], 2'b0, current_fsr[11:0]}), |
---|
| 239 | .sel0 (ctl_dp_output_sel_rs2), |
---|
| 240 | .sel1 (ctl_dp_output_sel_rs1), |
---|
| 241 | .sel2 (ctl_dp_output_sel_frf), |
---|
| 242 | .sel3 (ctl_dp_output_sel_fsr)); |
---|
| 243 | |
---|
| 244 | // RS2 can take value from frf (with modification to sign), from lsu |
---|
| 245 | // or keep value |
---|
| 246 | // The modification to the sign bits allows for FABS and FNEG |
---|
| 247 | assign dp_ctl_rs2_sign[1:0] = {new_frf_data[63], new_frf_data[31]}; |
---|
| 248 | |
---|
| 249 | assign rs2_data_changed[63:0] = {ctl_dp_sign[1], new_frf_data[62:32], |
---|
| 250 | ctl_dp_sign[0], new_frf_data[30:0]}; |
---|
| 251 | |
---|
| 252 | dp_mux2es #(64) local_rd_mux(.dout(local_rd_data[63:0]), |
---|
| 253 | .in0(rs2_data_changed[63:0]), |
---|
| 254 | .in1(corr_data[63:0]), |
---|
| 255 | .sel(ctl_dp_rd_ecc)); |
---|
| 256 | |
---|
| 257 | mux4ds #(64) rs2_rd_mux(.dout (rs2_rd_data_next[63:0]), |
---|
| 258 | .in0 (local_rd_data[63:0]), |
---|
| 259 | .in1 (vis_dp_rd_data[63:0]), |
---|
| 260 | .in2 (lsu_fpu_data[63:0]), |
---|
| 261 | .in3 (rs2_rd_data[63:0]), |
---|
| 262 | .sel0 (ctl_dp_rs2_frf_read), |
---|
| 263 | .sel1 (ctl_dp_rs2_sel_vis), |
---|
| 264 | .sel2 (ctl_dp_rs2_sel_fpu_lsu), |
---|
| 265 | .sel3 (ctl_dp_rs2_keep_data)); |
---|
| 266 | |
---|
| 267 | dff_s #(64) rs2_rd_dff(.din (rs2_rd_data_next[63:0]), |
---|
| 268 | .q (rs2_rd_data[63:0]), |
---|
| 269 | .clk (clk), .se(se), .si(), .so()); |
---|
| 270 | assign dp_vis_rs2_data[63:0] = rs2_rd_data[63:0]; |
---|
| 271 | dff_s #(64) write_data_dff(.din(rs2_rd_data[63:0]), |
---|
| 272 | .q(write_data[63:0]), |
---|
| 273 | .clk(clk), .se(se), .si(), .so()); |
---|
| 274 | |
---|
| 275 | //////////////////////////////////////////////////////// |
---|
| 276 | // RS1 |
---|
| 277 | //////////////////////////////////////////////////////// |
---|
| 278 | // RS1 next either takes value from frf or keeps value |
---|
| 279 | dp_mux2es #(64) rs1_mux(.dout (rs1_data_next[63:0]), |
---|
| 280 | .in0 (rs1_data[63:0]), |
---|
| 281 | .in1 (new_frf_data[63:0]), |
---|
| 282 | .sel (ctl_dp_new_rs1)); |
---|
| 283 | |
---|
| 284 | dff_s #(64) rs1_dff(.din (rs1_data_next[63:0]), |
---|
| 285 | .q (rs1_data[63:0]), |
---|
| 286 | .clk (clk), .se(se), .si(), .so()); |
---|
| 287 | assign dp_vis_rs1_data[63:0] = rs1_data[63:0]; |
---|
| 288 | |
---|
| 289 | |
---|
| 290 | ///////////////////////////////////////////////////////// |
---|
| 291 | // FSR |
---|
| 292 | ///////////////////////////////////////////////////////// |
---|
| 293 | // FSR takes data from load |
---|
| 294 | // fsr is set by ldfsr, ldxfsr, or any fpu operation |
---|
| 295 | assign t0_ldfsr_data[27:0] = {ctl_dp_fcc_w2[7:2], // fcc3,2,1 |
---|
| 296 | lsu_ffu_ld_data_d1[31:30], // RND mode |
---|
| 297 | //2'b0, // rsvd |
---|
| 298 | lsu_ffu_ld_data_d1[27:23], // TEM |
---|
| 299 | //6'b0, // NS, rsvd, ver |
---|
| 300 | t0_fsr[14:12], // ftt |
---|
| 301 | //2'b0, // qne, rsvd |
---|
| 302 | lsu_ffu_ld_data_d1[11:0]}; // fcc0, aexc, cexc |
---|
| 303 | |
---|
| 304 | assign t0_fpufsr_data[27:0] = {ctl_dp_fcc_w2[7:2], |
---|
| 305 | t0_fsr[21:20], // rnd |
---|
| 306 | t0_fsr[19:15], // TEM |
---|
| 307 | ctl_dp_ftt_w2[2:0], // ftt |
---|
| 308 | ctl_dp_fcc_w2[1:0], |
---|
| 309 | ctl_dp_exc_w2[9:0]}; |
---|
| 310 | |
---|
| 311 | assign t1_ldfsr_data[27:0] = {ctl_dp_fcc_w2[7:2], // fcc3,2,1 |
---|
| 312 | lsu_ffu_ld_data_d1[31:30], // RND mode |
---|
| 313 | //2'b0, // rsvd |
---|
| 314 | lsu_ffu_ld_data_d1[27:23], // TEM |
---|
| 315 | //6'b0, // NS, rsvd, ver |
---|
| 316 | t1_fsr[14:12], // ftt |
---|
| 317 | //2'b0, // qne, rsvd |
---|
| 318 | lsu_ffu_ld_data_d1[11:0]}; // fcc0, aexc, cexc |
---|
| 319 | |
---|
| 320 | assign t1_fpufsr_data[27:0] = {ctl_dp_fcc_w2[7:2], |
---|
| 321 | t1_fsr[21:20], // rnd |
---|
| 322 | t1_fsr[19:15], // TEM |
---|
| 323 | ctl_dp_ftt_w2[2:0], // ftt |
---|
| 324 | ctl_dp_fcc_w2[1:0], |
---|
| 325 | ctl_dp_exc_w2[9:0]}; |
---|
| 326 | |
---|
| 327 | assign t2_ldfsr_data[27:0] = {ctl_dp_fcc_w2[7:2], // fcc3,2,1 |
---|
| 328 | lsu_ffu_ld_data_d1[31:30], // RND mode |
---|
| 329 | //2'b0, // rsvd |
---|
| 330 | lsu_ffu_ld_data_d1[27:23], // TEM |
---|
| 331 | //6'b0, // NS, rsvd, ver |
---|
| 332 | t2_fsr[14:12], // ftt |
---|
| 333 | //2'b0, // qne, rsvd |
---|
| 334 | lsu_ffu_ld_data_d1[11:0]}; // fcc0, aexc, cexc |
---|
| 335 | |
---|
| 336 | assign t2_fpufsr_data[27:0] = {ctl_dp_fcc_w2[7:2], |
---|
| 337 | t2_fsr[21:20], // rnd |
---|
| 338 | t2_fsr[19:15], // TEM |
---|
| 339 | ctl_dp_ftt_w2[2:0], // ftt |
---|
| 340 | ctl_dp_fcc_w2[1:0], |
---|
| 341 | ctl_dp_exc_w2[9:0]}; |
---|
| 342 | |
---|
| 343 | assign t3_ldfsr_data[27:0] = {ctl_dp_fcc_w2[7:2], // fcc3,2,1 |
---|
| 344 | lsu_ffu_ld_data_d1[31:30], // RND mode |
---|
| 345 | //2'b0, // rsvd |
---|
| 346 | lsu_ffu_ld_data_d1[27:23], // TEM |
---|
| 347 | //6'b0, // NS, rsvd, ver |
---|
| 348 | t3_fsr[14:12], // ftt |
---|
| 349 | //2'b0, // qne, rsvd |
---|
| 350 | lsu_ffu_ld_data_d1[11:0]}; // fcc0, aexc, cexc |
---|
| 351 | |
---|
| 352 | assign t3_fpufsr_data[27:0] = {ctl_dp_fcc_w2[7:2], |
---|
| 353 | t3_fsr[21:20], // rnd |
---|
| 354 | t3_fsr[19:15], // TEM |
---|
| 355 | ctl_dp_ftt_w2[2:0], // ftt |
---|
| 356 | ctl_dp_fcc_w2[1:0], |
---|
| 357 | ctl_dp_exc_w2[9:0]}; |
---|
| 358 | |
---|
| 359 | `ifdef FPGA_SYN_1THREAD |
---|
| 360 | |
---|
| 361 | mux3ds #28 fsr0_mux(.dout (t0_fsr_nxt[27:0]), |
---|
| 362 | .in0 (t0_fsr[27:0]), |
---|
| 363 | .in1 (t0_ldfsr_data[27:0]), |
---|
| 364 | .in2 (t0_fpufsr_data[27:0]), |
---|
| 365 | .sel0 (ctl_dp_fsr_sel_old[0]), |
---|
| 366 | .sel1 (ctl_dp_fsr_sel_ld[0]), |
---|
| 367 | .sel2 (ctl_dp_fsr_sel_fpu[0])); |
---|
| 368 | // FSR registers |
---|
| 369 | // need only 28 flops for FSR since rest are always 0 |
---|
| 370 | dffr_s #28 fsr0_reg(.din (t0_fsr_nxt[27:0]), |
---|
| 371 | .q (t0_fsr[27:0]), |
---|
| 372 | .rst(reset), |
---|
| 373 | .clk (clk), .se(se), .si(), .so()); |
---|
| 374 | assign current_fsr[27:0] = t0_fsr[27:0]; |
---|
| 375 | |
---|
| 376 | `else |
---|
| 377 | |
---|
| 378 | mux3ds #28 fsr0_mux(.dout (t0_fsr_nxt[27:0]), |
---|
| 379 | .in0 (t0_fsr[27:0]), |
---|
| 380 | .in1 (t0_ldfsr_data[27:0]), |
---|
| 381 | .in2 (t0_fpufsr_data[27:0]), |
---|
| 382 | .sel0 (ctl_dp_fsr_sel_old[0]), |
---|
| 383 | .sel1 (ctl_dp_fsr_sel_ld[0]), |
---|
| 384 | .sel2 (ctl_dp_fsr_sel_fpu[0])); |
---|
| 385 | mux3ds #28 fsr1_mux(.dout (t1_fsr_nxt[27:0]), |
---|
| 386 | .in0 (t1_fsr[27:0]), |
---|
| 387 | .in1 (t1_ldfsr_data[27:0]), |
---|
| 388 | .in2 (t1_fpufsr_data[27:0]), |
---|
| 389 | .sel0 (ctl_dp_fsr_sel_old[1]), |
---|
| 390 | .sel1 (ctl_dp_fsr_sel_ld[1]), |
---|
| 391 | .sel2 (ctl_dp_fsr_sel_fpu[1])); |
---|
| 392 | mux3ds #28 fsr2_mux(.dout (t2_fsr_nxt[27:0]), |
---|
| 393 | .in0 (t2_fsr[27:0]), |
---|
| 394 | .in1 (t2_ldfsr_data[27:0]), |
---|
| 395 | .in2 (t2_fpufsr_data[27:0]), |
---|
| 396 | .sel0 (ctl_dp_fsr_sel_old[2]), |
---|
| 397 | .sel1 (ctl_dp_fsr_sel_ld[2]), |
---|
| 398 | .sel2 (ctl_dp_fsr_sel_fpu[2])); |
---|
| 399 | mux3ds #28 fsr3_mux(.dout (t3_fsr_nxt[27:0]), |
---|
| 400 | .in0 (t3_fsr[27:0]), |
---|
| 401 | .in1 (t3_ldfsr_data[27:0]), |
---|
| 402 | .in2 (t3_fpufsr_data[27:0]), |
---|
| 403 | .sel0 (ctl_dp_fsr_sel_old[3]), |
---|
| 404 | .sel1 (ctl_dp_fsr_sel_ld[3]), |
---|
| 405 | .sel2 (ctl_dp_fsr_sel_fpu[3])); |
---|
| 406 | |
---|
| 407 | // FSR registers |
---|
| 408 | // need only 28 flops for FSR since rest are always 0 |
---|
| 409 | dffr_s #28 fsr0_reg(.din (t0_fsr_nxt[27:0]), |
---|
| 410 | .q (t0_fsr[27:0]), |
---|
| 411 | .rst(reset), |
---|
| 412 | .clk (clk), .se(se), .si(), .so()); |
---|
| 413 | dffr_s #28 fsr1_reg(.din (t1_fsr_nxt[27:0]), |
---|
| 414 | .q (t1_fsr[27:0]), |
---|
| 415 | .rst(reset), |
---|
| 416 | .clk (clk), .se(se), .si(), .so()); |
---|
| 417 | dffr_s #28 fsr2_reg(.din (t2_fsr_nxt[27:0]), |
---|
| 418 | .q (t2_fsr[27:0]), |
---|
| 419 | .rst(reset), |
---|
| 420 | .clk (clk), .se(se), .si(), .so()); |
---|
| 421 | dffr_s #28 fsr3_reg(.din (t3_fsr_nxt[27:0]), |
---|
| 422 | .q (t3_fsr[27:0]), |
---|
| 423 | .rst(reset), |
---|
| 424 | .clk (clk), .se(se), .si(), .so()); |
---|
| 425 | |
---|
| 426 | // Current FSR |
---|
| 427 | mux4ds #28 curr_fsr_mux(.dout (current_fsr[27:0]), |
---|
| 428 | .in0 (t0_fsr[27:0]), |
---|
| 429 | .in1 (t1_fsr[27:0]), |
---|
| 430 | .in2 (t2_fsr[27:0]), |
---|
| 431 | .in3 (t3_fsr[27:0]), |
---|
| 432 | .sel0 (ctl_dp_fp_thr[0]), |
---|
| 433 | .sel1 (ctl_dp_fp_thr[1]), |
---|
| 434 | .sel2 (ctl_dp_fp_thr[2]), |
---|
| 435 | .sel3 (ctl_dp_fp_thr[3])); |
---|
| 436 | `endif // !`ifdef FPGA_SYN_1THREAD |
---|
| 437 | |
---|
| 438 | assign dp_ctl_fsr_fcc = {current_fsr[27:22], current_fsr[11:10]}; |
---|
| 439 | assign dp_ctl_fsr_rnd = current_fsr[21:20]; |
---|
| 440 | assign dp_ctl_fsr_tem = current_fsr[19:15]; |
---|
| 441 | assign dp_ctl_fsr_aexc = current_fsr[9:5]; |
---|
| 442 | assign dp_ctl_fsr_cexc = current_fsr[4:0]; |
---|
| 443 | |
---|
| 444 | //////////////////////////////////////////////////////////// |
---|
| 445 | // ECC generation and correction |
---|
| 446 | //////////////////////////////////////////////////////////// |
---|
| 447 | dp_mux2es #(64) ecc_mux(.dout(ecc_data_in[63:0]), |
---|
| 448 | .in0(rs2_rd_data[63:0]), |
---|
| 449 | .in1({frf_dp_data[70:39], frf_dp_data[31:0]}), |
---|
| 450 | .sel(ctl_dp_ecc_sel_frf)); |
---|
| 451 | |
---|
| 452 | assign synd_in_low[6:0] = {7{ctl_dp_ecc_sel_frf}} & frf_dp_data[38:32]; |
---|
| 453 | assign synd_in_h[6:0] = {7{ctl_dp_ecc_sel_frf}} & frf_dp_data[77:71]; |
---|
| 454 | |
---|
| 455 | zzecc_sctag_ecc39 ecccor_low(.din(ecc_data_in[31:0]), |
---|
| 456 | .parity(synd_in_low[6:0]), |
---|
| 457 | .dout(corr_data_next[31:0]), |
---|
| 458 | .pflag(dp_ctl_synd_out_low[6]), |
---|
| 459 | .cflag(dp_ctl_synd_out_low[5:0])); |
---|
| 460 | |
---|
| 461 | zzecc_sctag_ecc39 ecccor_high(.din(ecc_data_in[63:32]), |
---|
| 462 | .parity(synd_in_h[6:0]), |
---|
| 463 | .dout(corr_data_next[63:32]), |
---|
| 464 | .pflag(dp_ctl_synd_out_high[6]), |
---|
| 465 | .cflag(dp_ctl_synd_out_high[5:0])); |
---|
| 466 | |
---|
| 467 | |
---|
| 468 | dff_s #(64) ecc_corr_data(.din(corr_data_next[63:0]), .q(corr_data[63:0]), |
---|
| 469 | .clk(clk), .se(se), .si(), .so()); |
---|
| 470 | |
---|
| 471 | |
---|
| 472 | //////////////////////////////////////////////// |
---|
| 473 | // GSR Storage |
---|
| 474 | //////////////////////////////////////////////// |
---|
| 475 | // GSR registers |
---|
| 476 | // need only 37 flops for GSR since rest are always 0 |
---|
| 477 | // and the align and rnd fields are in the ctl block |
---|
| 478 | `ifdef FPGA_SYN_1THREAD |
---|
| 479 | dffr_s #37 gsr0_reg(.din (t0_gsr_nxt[36:0]), |
---|
| 480 | .q (t0_gsr[36:0]), |
---|
| 481 | .rst(reset), |
---|
| 482 | .clk (clk), .se(se), .si(), .so()); |
---|
| 483 | assign t0_gsr_nxt[36:0] = t0_gsr[36:0]; |
---|
| 484 | assign gsr_e[36:0] = t0_gsr[36:0]; |
---|
| 485 | |
---|
| 486 | `else |
---|
| 487 | |
---|
| 488 | dffr_s #37 gsr0_reg(.din (t0_gsr_nxt[36:0]), |
---|
| 489 | .q (t0_gsr[36:0]), |
---|
| 490 | .rst(reset), |
---|
| 491 | .clk (clk), .se(se), .si(), .so()); |
---|
| 492 | dffr_s #37 gsr1_reg(.din (t1_gsr_nxt[36:0]), |
---|
| 493 | .q (t1_gsr[36:0]), |
---|
| 494 | .rst(reset), |
---|
| 495 | .clk (clk), .se(se), .si(), .so()); |
---|
| 496 | dffr_s #37 gsr2_reg(.din (t2_gsr_nxt[36:0]), |
---|
| 497 | .q (t2_gsr[36:0]), |
---|
| 498 | .rst(reset), |
---|
| 499 | .clk (clk), .se(se), .si(), .so()); |
---|
| 500 | dffr_s #37 gsr3_reg(.din (t3_gsr_nxt[36:0]), |
---|
| 501 | .q (t3_gsr[36:0]), |
---|
| 502 | .rst(reset), |
---|
| 503 | .clk (clk), .se(se), .si(), .so()); |
---|
| 504 | |
---|
| 505 | dp_mux2es #(37) gsr0_mux(.dout(t0_gsr_nxt[36:0]), |
---|
| 506 | .in0(t0_gsr[36:0]), |
---|
| 507 | .in1(ctl_dp_wsr_data_w2[36:0]), |
---|
| 508 | .sel(ctl_dp_gsr_wsr_w2[0])); |
---|
| 509 | dp_mux2es #(37) gsr1_mux(.dout(t1_gsr_nxt[36:0]), |
---|
| 510 | .in0(t1_gsr[36:0]), |
---|
| 511 | .in1(ctl_dp_wsr_data_w2[36:0]), |
---|
| 512 | .sel(ctl_dp_gsr_wsr_w2[1])); |
---|
| 513 | dp_mux2es #(37) gsr2_mux(.dout(t2_gsr_nxt[36:0]), |
---|
| 514 | .in0(t2_gsr[36:0]), |
---|
| 515 | .in1(ctl_dp_wsr_data_w2[36:0]), |
---|
| 516 | .sel(ctl_dp_gsr_wsr_w2[2])); |
---|
| 517 | dp_mux2es #(37) gsr3_mux(.dout(t3_gsr_nxt[36:0]), |
---|
| 518 | .in0(t3_gsr[36:0]), |
---|
| 519 | .in1(ctl_dp_wsr_data_w2[36:0]), |
---|
| 520 | .sel(ctl_dp_gsr_wsr_w2[3])); |
---|
| 521 | |
---|
| 522 | |
---|
| 523 | // GSR_E |
---|
| 524 | mux4ds #37 curr_gsr_mux(.dout (gsr_e[36:0]), |
---|
| 525 | .in0 (t0_gsr[36:0]), |
---|
| 526 | .in1 (t1_gsr[36:0]), |
---|
| 527 | .in2 (t2_gsr[36:0]), |
---|
| 528 | .in3 (t3_gsr[36:0]), |
---|
| 529 | .sel0 (ctl_dp_thr_e[0]), |
---|
| 530 | .sel1 (ctl_dp_thr_e[1]), |
---|
| 531 | .sel2 (ctl_dp_thr_e[2]), |
---|
| 532 | .sel3 (ctl_dp_thr_e[3])); |
---|
| 533 | `endif // !`ifdef FPGA_SYN_1THREAD |
---|
| 534 | |
---|
| 535 | assign dp_ctl_gsr_scale_e[4:0] = gsr_e[4:0]; |
---|
| 536 | assign dp_ctl_gsr_mask_e[31:0] = gsr_e[36:5]; |
---|
| 537 | |
---|
| 538 | |
---|
| 539 | |
---|
| 540 | |
---|
| 541 | endmodule // sparc_ffu_dp |
---|