1 |
2 |
dmitryr |
// ========== Copyright Header Begin ==========================================
|
2 |
|
|
//
|
3 |
|
|
// OpenSPARC T1 Processor File: fpu_add_frac_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 |
|
|
// Add pipeline fraction datapath.
|
24 |
|
|
//
|
25 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
26 |
|
|
|
27 |
|
|
module fpu_add_frac_dp (
|
28 |
|
|
inq_in1,
|
29 |
|
|
inq_in2,
|
30 |
|
|
a1stg_step,
|
31 |
|
|
a1stg_sngop,
|
32 |
|
|
a1stg_expadd3_11,
|
33 |
|
|
a1stg_norm_dbl_in1,
|
34 |
|
|
a1stg_denorm_dbl_in1,
|
35 |
|
|
a1stg_norm_sng_in1,
|
36 |
|
|
a1stg_denorm_sng_in1,
|
37 |
|
|
a1stg_norm_dbl_in2,
|
38 |
|
|
a1stg_denorm_dbl_in2,
|
39 |
|
|
a1stg_norm_sng_in2,
|
40 |
|
|
a1stg_denorm_sng_in2,
|
41 |
|
|
a1stg_intlngop,
|
42 |
|
|
a2stg_frac1_in_frac1,
|
43 |
|
|
a2stg_frac1_in_frac2,
|
44 |
|
|
a1stg_2nan_in_inv,
|
45 |
|
|
a1stg_faddsubop_inv,
|
46 |
|
|
a2stg_frac1_in_qnan,
|
47 |
|
|
a2stg_frac1_in_nv,
|
48 |
|
|
a2stg_frac1_in_nv_dbl,
|
49 |
|
|
a6stg_step,
|
50 |
|
|
a2stg_frac2_in_frac1,
|
51 |
|
|
a2stg_frac2_in_qnan,
|
52 |
|
|
a2stg_shr_cnt_in,
|
53 |
|
|
a2stg_shr_cnt_5_inv_in,
|
54 |
|
|
a2stg_shr_frac2_shr_int,
|
55 |
|
|
a2stg_shr_frac2_shr_dbl,
|
56 |
|
|
a2stg_shr_frac2_shr_sng,
|
57 |
|
|
a2stg_shr_frac2_max,
|
58 |
|
|
a2stg_expadd_11,
|
59 |
|
|
a2stg_sub_step,
|
60 |
|
|
a2stg_fracadd_frac2_inv_in,
|
61 |
|
|
a2stg_fracadd_frac2_inv_shr1_in,
|
62 |
|
|
a2stg_fracadd_frac2,
|
63 |
|
|
a2stg_fracadd_cin_in,
|
64 |
|
|
a2stg_exp,
|
65 |
|
|
a2stg_expdec_neq_0,
|
66 |
|
|
a3stg_faddsubopa,
|
67 |
|
|
a3stg_sub_in,
|
68 |
|
|
a3stg_exp10_0_eq0,
|
69 |
|
|
a3stg_exp10_1_eq0,
|
70 |
|
|
a3stg_exp_0,
|
71 |
|
|
a4stg_rnd_frac_add_inv,
|
72 |
|
|
a3stg_fdtos_inv,
|
73 |
|
|
a4stg_fixtos_fxtod_inv,
|
74 |
|
|
a4stg_rnd_sng,
|
75 |
|
|
a4stg_rnd_dbl,
|
76 |
|
|
a4stg_shl_cnt_in,
|
77 |
|
|
add_frac_out_rndadd,
|
78 |
|
|
add_frac_out_rnd_frac,
|
79 |
|
|
a4stg_in_of,
|
80 |
|
|
add_frac_out_shl,
|
81 |
|
|
a4stg_to_0,
|
82 |
|
|
fadd_clken_l,
|
83 |
|
|
rclk,
|
84 |
|
|
|
85 |
|
|
a1stg_in2_neq_in1_frac,
|
86 |
|
|
a1stg_in2_gt_in1_frac,
|
87 |
|
|
a1stg_in2_eq_in1_exp,
|
88 |
|
|
a2stg_frac2_63,
|
89 |
|
|
a2stg_frac2hi_neq_0,
|
90 |
|
|
a2stg_frac2lo_neq_0,
|
91 |
|
|
a3stg_fsdtoix_nx,
|
92 |
|
|
a3stg_fsdtoi_nx,
|
93 |
|
|
a3stg_denorm,
|
94 |
|
|
a3stg_denorm_inv,
|
95 |
|
|
a3stg_lead0,
|
96 |
|
|
a4stg_round,
|
97 |
|
|
a4stg_shl_cnt,
|
98 |
|
|
a4stg_denorm_inv,
|
99 |
|
|
a3stg_inc_exp_inv,
|
100 |
|
|
a3stg_same_exp_inv,
|
101 |
|
|
a3stg_dec_exp_inv,
|
102 |
|
|
a4stg_rnd_frac_40,
|
103 |
|
|
a4stg_rnd_frac_39,
|
104 |
|
|
a4stg_rnd_frac_11,
|
105 |
|
|
a4stg_rnd_frac_10,
|
106 |
|
|
a4stg_rndadd_cout,
|
107 |
|
|
a4stg_frac_9_0_nx,
|
108 |
|
|
a4stg_frac_dbl_nx,
|
109 |
|
|
a4stg_frac_38_0_nx,
|
110 |
|
|
a4stg_frac_sng_nx,
|
111 |
|
|
a4stg_frac_neq_0,
|
112 |
|
|
a4stg_shl_data_neq_0,
|
113 |
|
|
add_of_out_cout,
|
114 |
|
|
add_frac_out,
|
115 |
|
|
|
116 |
|
|
se,
|
117 |
|
|
si,
|
118 |
|
|
so
|
119 |
|
|
);
|
120 |
|
|
|
121 |
|
|
|
122 |
|
|
input [62:0] inq_in1; // request operand 1 to op pipes
|
123 |
|
|
input [63:0] inq_in2; // request operand 2 to op pipes
|
124 |
|
|
input a1stg_step; // add pipe load
|
125 |
|
|
input a1stg_sngop; // single precision operation- add 1 stg
|
126 |
|
|
input a1stg_expadd3_11; // exponent adder sign out- add 1 stg
|
127 |
|
|
input a1stg_norm_dbl_in1; // select line to normalized fraction 1
|
128 |
|
|
input a1stg_denorm_dbl_in1; // select line to normalized fraction 1
|
129 |
|
|
input a1stg_norm_sng_in1; // select line to normalized fraction 1
|
130 |
|
|
input a1stg_denorm_sng_in1; // select line to normalized fraction 1
|
131 |
|
|
input a1stg_norm_dbl_in2; // select line to normalized fraction 2
|
132 |
|
|
input a1stg_denorm_dbl_in2; // select line to normalized fraction 2
|
133 |
|
|
input a1stg_norm_sng_in2; // select line to normalized fraction 2
|
134 |
|
|
input a1stg_denorm_sng_in2; // select line to normalized fraction 2
|
135 |
|
|
input a1stg_intlngop; // integer/long input- add 1 stage
|
136 |
|
|
input a2stg_frac1_in_frac1; // select line to a2stg_frac1
|
137 |
|
|
input a2stg_frac1_in_frac2; // select line to a2stg_frac1
|
138 |
|
|
input a1stg_2nan_in_inv; // 2 NaN inputs- a1 stage
|
139 |
|
|
input a1stg_faddsubop_inv; // add/subtract- a1 stage
|
140 |
|
|
input a2stg_frac1_in_qnan; // make fraction 1 a QNaN
|
141 |
|
|
input a2stg_frac1_in_nv; // NV- make a new prec QNaN
|
142 |
|
|
input a2stg_frac1_in_nv_dbl; // NV- make a new double prec QNaN
|
143 |
|
|
input a6stg_step; // advance the add pipe
|
144 |
|
|
input a2stg_frac2_in_frac1; // select line to a2stg_frac2
|
145 |
|
|
input a2stg_frac2_in_qnan; // make fraction 2 a QNaN
|
146 |
|
|
input [5:0] a2stg_shr_cnt_in; // right shift count input- add 1 stage
|
147 |
|
|
input a2stg_shr_cnt_5_inv_in; // right shift count input[5]- add 1 stg
|
148 |
|
|
input a2stg_shr_frac2_shr_int; // select line to a3stg_frac2
|
149 |
|
|
input a2stg_shr_frac2_shr_dbl; // select line to a3stg_frac2
|
150 |
|
|
input a2stg_shr_frac2_shr_sng; // select line to a3stg_frac2
|
151 |
|
|
input a2stg_shr_frac2_max; // select line to a3stg_frac2
|
152 |
|
|
input a2stg_expadd_11; // exponent adder[11]- add 2 stage
|
153 |
|
|
input a2stg_sub_step; // select line to a3stg_frac2
|
154 |
|
|
input a2stg_fracadd_frac2_inv_in; // sel line to main adder input 2
|
155 |
|
|
input a2stg_fracadd_frac2_inv_shr1_in; // sel line to main adder in 2
|
156 |
|
|
input a2stg_fracadd_frac2; // select line to main adder input 2
|
157 |
|
|
input a2stg_fracadd_cin_in; // carry in to main adder- add 1 stage
|
158 |
|
|
input [5:0] a2stg_exp; // exponent add 2 stage bits[5:0]
|
159 |
|
|
input a2stg_expdec_neq_0; // exponent will be < 54
|
160 |
|
|
input [1:0] a3stg_faddsubopa; // denorm compare lead0[10] input select
|
161 |
|
|
input a3stg_sub_in; // subtract in main adder- add 3 stage
|
162 |
|
|
input a3stg_exp10_0_eq0; // exponent[10:0]==0- add 3 stg
|
163 |
|
|
input a3stg_exp10_1_eq0; // exponent[10:1]==0- add 3 stg
|
164 |
|
|
input a3stg_exp_0; // exponent[0]- add 3 stg
|
165 |
|
|
input a4stg_rnd_frac_add_inv; // select line to a4stg_rnd_frac
|
166 |
|
|
input a3stg_fdtos_inv; // double to single convert- add 3 stg
|
167 |
|
|
input a4stg_fixtos_fxtod_inv; // int to single/double cvt- add 4 stg
|
168 |
|
|
input a4stg_rnd_sng; // round to single precision- add 4 stg
|
169 |
|
|
input a4stg_rnd_dbl; // round to double precision- add 4 stg
|
170 |
|
|
input [9:0] a4stg_shl_cnt_in; // postnorm shift left count- add 3 stg
|
171 |
|
|
input add_frac_out_rndadd; // select line to add_frac_out
|
172 |
|
|
input add_frac_out_rnd_frac; // select line to add_frac_out
|
173 |
|
|
input a4stg_in_of; // add overflow- select fraction out
|
174 |
|
|
input add_frac_out_shl; // select line to add_frac_out
|
175 |
|
|
input a4stg_to_0; // result to max finite on overflow
|
176 |
|
|
input fadd_clken_l; // add pipe clk enable - asserted low
|
177 |
|
|
input rclk; // global clock
|
178 |
|
|
|
179 |
|
|
output a1stg_in2_neq_in1_frac; // operand 2 fraction != oprnd 1 frac
|
180 |
|
|
output a1stg_in2_gt_in1_frac; // operand 2 fraction > oprnd 1 frac
|
181 |
|
|
output a1stg_in2_eq_in1_exp; // operand 2 exponent == oprnd 1 exp
|
182 |
|
|
output a2stg_frac2_63; // fraction 2 bit[63]- add 2 stage
|
183 |
|
|
output a2stg_frac2hi_neq_0; // fraction 2[62:32]in add 2 stage != 0
|
184 |
|
|
output a2stg_frac2lo_neq_0; // fraction 2[31:11] in add 2 stage != 0
|
185 |
|
|
output a3stg_fsdtoix_nx; // inexact result for flt -> ints
|
186 |
|
|
output a3stg_fsdtoi_nx; // inexact result for flt -> 32b ints
|
187 |
|
|
output a3stg_denorm; // denorm output- add 3 stage
|
188 |
|
|
output a3stg_denorm_inv; // result is not a denorm- add 3 stage
|
189 |
|
|
output [5:0] a3stg_lead0; // leading 0's count- add 3 stage
|
190 |
|
|
output a4stg_round; // round the result- add 4 stage
|
191 |
|
|
output [5:0] a4stg_shl_cnt; // subtract in main adder- add 4 stage
|
192 |
|
|
output a4stg_denorm_inv; // 0 the exponent
|
193 |
|
|
output a3stg_inc_exp_inv; // increment the exponent- add 3 stg
|
194 |
|
|
output a3stg_same_exp_inv; // keep the exponent- add 3 stg
|
195 |
|
|
output a3stg_dec_exp_inv; // decrement the exponent- add 3 stg
|
196 |
|
|
output a4stg_rnd_frac_40; // rounded fraction[40]- add 4 stage
|
197 |
|
|
output a4stg_rnd_frac_39; // rounded fraction[39]- add 4 stage
|
198 |
|
|
output a4stg_rnd_frac_11; // rounded fraction[11]- add 4 stage
|
199 |
|
|
output a4stg_rnd_frac_10; // rounded fraction[10]- add 4 stage
|
200 |
|
|
output a4stg_rndadd_cout; // fraction rounding adder carry out
|
201 |
|
|
output a4stg_frac_9_0_nx; // inexact double precision result
|
202 |
|
|
output a4stg_frac_dbl_nx; // inexact double precision result
|
203 |
|
|
output a4stg_frac_38_0_nx; // inexact single precision result
|
204 |
|
|
output a4stg_frac_sng_nx; // inexact single precision result
|
205 |
|
|
output a4stg_frac_neq_0; // fraction != 0- add 4 stage
|
206 |
|
|
output a4stg_shl_data_neq_0; // left shift result != 0- add 4 stage
|
207 |
|
|
output add_of_out_cout; // fraction rounding adder carry out
|
208 |
|
|
output [63:0] add_frac_out; // add fraction output
|
209 |
|
|
|
210 |
|
|
input se; // scan_enable
|
211 |
|
|
input si; // scan in
|
212 |
|
|
output so; // scan out
|
213 |
|
|
|
214 |
|
|
|
215 |
|
|
wire [62:0] a1stg_in1;
|
216 |
|
|
wire [54:0] a1stg_in1a;
|
217 |
|
|
wire a1stg_in1_31_0_neq_0;
|
218 |
|
|
wire a1stg_in1_50_32_neq_0;
|
219 |
|
|
wire a1stg_in1_50_0_neq_0;
|
220 |
|
|
wire a1stg_in1_53_32_neq_0;
|
221 |
|
|
wire a1stg_in1_51;
|
222 |
|
|
wire a1stg_in1_54;
|
223 |
|
|
wire [63:0] a1stg_in2;
|
224 |
|
|
wire [54:0] a1stg_in2a;
|
225 |
|
|
wire a1stg_in2_31_0_neq_0;
|
226 |
|
|
wire a1stg_in2_50_32_neq_0;
|
227 |
|
|
wire a1stg_in2_50_0_neq_0;
|
228 |
|
|
wire a1stg_in2_53_32_neq_0;
|
229 |
|
|
wire a1stg_in2_51;
|
230 |
|
|
wire a1stg_in2_54;
|
231 |
|
|
wire a1stg_in2_neq_in1_frac;
|
232 |
|
|
wire a1stg_in2_gt_in1_frac;
|
233 |
|
|
wire a1stg_in2_gt_in1;
|
234 |
|
|
wire a1stg_in2_eq_in1_exp;
|
235 |
|
|
wire [63:0] a1stg_norm_frac1;
|
236 |
|
|
wire [63:0] a1stg_norm_frac2;
|
237 |
|
|
wire [63:0] a2stg_frac1_in;
|
238 |
|
|
wire [63:0] a2stg_frac1;
|
239 |
|
|
wire [63:0] a2stg_frac2_in;
|
240 |
|
|
wire [63:0] a2stg_frac2;
|
241 |
|
|
wire [63:0] a2stg_frac2a;
|
242 |
|
|
wire a2stg_frac2_63;
|
243 |
|
|
wire a2stg_frac2hi_neq_0;
|
244 |
|
|
wire a2stg_frac2lo_neq_0;
|
245 |
|
|
wire [115:52] a2stg_shr;
|
246 |
|
|
wire a2stg_fsdtoix_nx;
|
247 |
|
|
wire a2stg_fsdtoi_nx;
|
248 |
|
|
wire a2stg_shr_60_0_neq_0;
|
249 |
|
|
wire [63:0] a2stg_shr_frac2_inv;
|
250 |
|
|
wire [63:0] a3stg_frac2_in;
|
251 |
|
|
wire [63:0] a3stg_frac2;
|
252 |
|
|
wire [63:0] a3stg_frac1;
|
253 |
|
|
wire [63:0] a2stg_fracadd_in2;
|
254 |
|
|
wire [63:0] a2stg_fracadd;
|
255 |
|
|
wire [63:0] a3stg_ld0_frac;
|
256 |
|
|
wire [53:0] a2stg_expdec_tmp;
|
257 |
|
|
wire [53:0] a2stg_expdec;
|
258 |
|
|
wire [53:0] a3stg_expdec;
|
259 |
|
|
wire a3stg_ld0_dnrm_10;
|
260 |
|
|
wire a3stg_denorm;
|
261 |
|
|
wire a3stg_denorm_inv;
|
262 |
|
|
wire a3stg_denorma;
|
263 |
|
|
wire a3stg_denorm_inva;
|
264 |
|
|
wire [5:0] a3stg_lead0;
|
265 |
|
|
wire [63:0] a3stg_fracadd;
|
266 |
|
|
wire a4stg_round_in;
|
267 |
|
|
wire a4stg_round;
|
268 |
|
|
wire [5:0] a2stg_shr_cnt;
|
269 |
|
|
wire [5:3] a2stg_shr_cnta;
|
270 |
|
|
wire [2:0] a2stg_shr_cnta_5;
|
271 |
|
|
wire [3:0] a2stg_shr_cnt_5_inv;
|
272 |
|
|
wire [3:0] a2stg_shr_cnt_5;
|
273 |
|
|
wire [4:0] a2stg_shr_cnt_4;
|
274 |
|
|
wire [4:0] a2stg_shr_cnt_3;
|
275 |
|
|
wire [1:0] a2stg_shr_cnt_2;
|
276 |
|
|
wire [1:0] a2stg_shr_cnt_1;
|
277 |
|
|
wire [1:0] a2stg_shr_cnt_0;
|
278 |
|
|
wire a3stg_sub;
|
279 |
|
|
wire a3stg_suba;
|
280 |
|
|
wire [2:0] a4stg_shl_cnt_dec54_0;
|
281 |
|
|
wire [2:0] a4stg_shl_cnt_dec54_1;
|
282 |
|
|
wire [2:0] a4stg_shl_cnt_dec54_2;
|
283 |
|
|
wire [2:0] a4stg_shl_cnt_dec54_3;
|
284 |
|
|
wire [5:0] a4stg_shl_cnt;
|
285 |
|
|
wire a2stg_fracadd_frac2_inv;
|
286 |
|
|
wire a2stg_fracadd_frac2_inv_shr1;
|
287 |
|
|
wire a4stg_denorm_inv;
|
288 |
|
|
wire a3stg_fsdtoix_nx;
|
289 |
|
|
wire a3stg_fsdtoi_nx;
|
290 |
|
|
wire a2stg_fracadd_cin;
|
291 |
|
|
wire [63:0] astg_xtra_regs;
|
292 |
|
|
wire a3stg_inc_exp_inv;
|
293 |
|
|
wire a3stg_same_exp_inv;
|
294 |
|
|
wire a3stg_dec_exp_inv;
|
295 |
|
|
wire a3stg_inc_exp_inva;
|
296 |
|
|
wire a3stg_fsame_exp_inv;
|
297 |
|
|
wire a3stg_fdec_exp_inv;
|
298 |
|
|
wire [63:0] a4stg_rnd_frac_pre1_in;
|
299 |
|
|
wire [63:0] a4stg_rnd_frac_pre1;
|
300 |
|
|
wire [63:0] a4stg_rnd_frac_pre2_in;
|
301 |
|
|
wire [63:0] a4stg_rnd_frac_pre2;
|
302 |
|
|
wire [63:0] a4stg_rnd_frac_pre3_in;
|
303 |
|
|
wire [63:0] a4stg_rnd_frac_pre3;
|
304 |
|
|
wire [63:0] a4stg_rnd_frac;
|
305 |
|
|
wire [63:0] a4stg_rnd_fraca;
|
306 |
|
|
wire a4stg_rnd_frac_40;
|
307 |
|
|
wire a4stg_rnd_frac_39;
|
308 |
|
|
wire a4stg_rnd_frac_11;
|
309 |
|
|
wire a4stg_rnd_frac_10;
|
310 |
|
|
wire [63:0] a4stg_shl_data_in;
|
311 |
|
|
wire [63:0] a4stg_shl_data;
|
312 |
|
|
wire [52:0] a4stg_rndadd_tmp;
|
313 |
|
|
wire a4stg_rndadd_cout;
|
314 |
|
|
wire [51:0] a4stg_rndadd;
|
315 |
|
|
wire a4stg_frac_9_0_nx;
|
316 |
|
|
wire a4stg_frac_dbl_nx;
|
317 |
|
|
wire a4stg_frac_38_0_nx;
|
318 |
|
|
wire a4stg_frac_sng_nx;
|
319 |
|
|
wire a4stg_frac_neq_0;
|
320 |
|
|
wire a4stg_shl_data_neq_0;
|
321 |
|
|
wire [126:0] a4stg_shl_tmp;
|
322 |
|
|
wire [63:0] a4stg_shl;
|
323 |
|
|
wire add_of_out_cout;
|
324 |
|
|
wire a5stg_frac_out_rndadd;
|
325 |
|
|
wire a5stg_frac_out_rnd_frac;
|
326 |
|
|
wire a5stg_in_of;
|
327 |
|
|
wire a5stg_frac_out_shl;
|
328 |
|
|
wire a5stg_to_0;
|
329 |
|
|
wire [51:0] a5stg_rndadd;
|
330 |
|
|
wire [63:0] a5stg_rnd_frac;
|
331 |
|
|
wire [63:0] a5stg_shl;
|
332 |
|
|
wire [63:0] add_frac_out;
|
333 |
|
|
|
334 |
|
|
wire [63:0] a2stg_shr_tmp2;
|
335 |
|
|
wire [63:0] a2stg_shr_tmp4;
|
336 |
|
|
wire [63:0] a2stg_shr_tmp6;
|
337 |
|
|
wire [63:0] a2stg_shr_tmp8;
|
338 |
|
|
wire [63:0] a2stg_shr_tmp10;
|
339 |
|
|
wire [63:0] a2stg_shr_tmp13;
|
340 |
|
|
wire [63:0] a2stg_shr_tmp18;
|
341 |
|
|
wire [63:20] a2stg_nx_neq0_84_tmp_1;
|
342 |
|
|
wire [63:36] a2stg_nx_neq0_84_tmp_2;
|
343 |
|
|
wire [63:44] a2stg_nx_neq0_84_tmp_3;
|
344 |
|
|
wire [63:48] a2stg_nx_neq0_84_tmp_4;
|
345 |
|
|
wire [61:50] a2stg_nx_neq0_84_tmp_5;
|
346 |
|
|
wire [60:59] a2stg_nx_neq0_84_tmp_6;
|
347 |
|
|
wire a2stg_nx_neq0_84_tmp_6_51;
|
348 |
|
|
|
349 |
|
|
wire [63:0] a4stg_shl_tmp4;
|
350 |
|
|
|
351 |
|
|
wire se_l;
|
352 |
|
|
|
353 |
|
|
assign se_l = ~se;
|
354 |
|
|
|
355 |
|
|
|
356 |
|
|
clken_buf ckbuf_add_frac_dp (
|
357 |
|
|
.clk(clk),
|
358 |
|
|
.rclk(rclk),
|
359 |
|
|
.enb_l(fadd_clken_l),
|
360 |
|
|
.tmb_l(se_l)
|
361 |
|
|
);
|
362 |
|
|
|
363 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
364 |
|
|
//
|
365 |
|
|
// Add fraction inputs.
|
366 |
|
|
//
|
367 |
|
|
// Add input stage.
|
368 |
|
|
//
|
369 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
370 |
|
|
|
371 |
|
|
dffe_s #(63) i_a1stg_in1 (
|
372 |
|
|
.din (inq_in1[62:0]),
|
373 |
|
|
.en (a1stg_step),
|
374 |
|
|
.clk (clk),
|
375 |
|
|
|
376 |
|
|
.q (a1stg_in1[62:0]),
|
377 |
|
|
|
378 |
|
|
.se (se),
|
379 |
|
|
.si (),
|
380 |
|
|
.so ()
|
381 |
|
|
);
|
382 |
|
|
|
383 |
|
|
dffe_s #(55) i_a1stg_in1a (
|
384 |
|
|
.din (inq_in1[54:0]),
|
385 |
|
|
.en (a1stg_step),
|
386 |
|
|
.clk (clk),
|
387 |
|
|
|
388 |
|
|
.q (a1stg_in1a[54:0]),
|
389 |
|
|
|
390 |
|
|
.se (se),
|
391 |
|
|
.si (),
|
392 |
|
|
.so ()
|
393 |
|
|
);
|
394 |
|
|
|
395 |
|
|
dffe_s #(64) i_a1stg_in2 (
|
396 |
|
|
.din (inq_in2[63:0]),
|
397 |
|
|
.en (a1stg_step),
|
398 |
|
|
.clk (clk),
|
399 |
|
|
|
400 |
|
|
.q (a1stg_in2[63:0]),
|
401 |
|
|
|
402 |
|
|
.se (se),
|
403 |
|
|
.si (),
|
404 |
|
|
.so ()
|
405 |
|
|
);
|
406 |
|
|
|
407 |
|
|
dffe_s #(55) i_a1stg_in2a (
|
408 |
|
|
.din (inq_in2[54:0]),
|
409 |
|
|
.en (a1stg_step),
|
410 |
|
|
.clk (clk),
|
411 |
|
|
|
412 |
|
|
.q (a1stg_in2a[54:0]),
|
413 |
|
|
|
414 |
|
|
.se (se),
|
415 |
|
|
.si (),
|
416 |
|
|
.so ()
|
417 |
|
|
);
|
418 |
|
|
|
419 |
|
|
|
420 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
421 |
|
|
//
|
422 |
|
|
// Add normalization and special input injection.
|
423 |
|
|
//
|
424 |
|
|
// Add stage 1.
|
425 |
|
|
//
|
426 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
427 |
|
|
|
428 |
|
|
fpu_in2_gt_in1_frac i_a1stg_in2_gt_in1_frac (
|
429 |
|
|
.din1 (a1stg_in1a[54:0]),
|
430 |
|
|
.din2 (a1stg_in2a[54:0]),
|
431 |
|
|
.sngop (a1stg_sngop),
|
432 |
|
|
.expadd11 (a1stg_expadd3_11),
|
433 |
|
|
.expeq (a1stg_in2_eq_in1_exp),
|
434 |
|
|
|
435 |
|
|
.din2_neq_din1 (a1stg_in2_neq_in1_frac),
|
436 |
|
|
.din2_gt_din1 (a1stg_in2_gt_in1_frac),
|
437 |
|
|
.din2_gt1_din1 (a1stg_in2_gt_in1)
|
438 |
|
|
);
|
439 |
|
|
|
440 |
|
|
assign a1stg_in2_eq_in1_exp= (&{(~(a1stg_in1[62:55] ^ a1stg_in2[62:55])),
|
441 |
|
|
((~(a1stg_in1[54:52] ^ a1stg_in2[54:52]))
|
442 |
|
|
| {3{a1stg_sngop}})});
|
443 |
|
|
|
444 |
|
|
assign a1stg_norm_frac1[63:0]= ({64{a1stg_norm_dbl_in1}}
|
445 |
|
|
& {1'b1, a1stg_in1[51:0], 11'b0})
|
446 |
|
|
| ({64{a1stg_denorm_dbl_in1}}
|
447 |
|
|
& {a1stg_in1[51:0], 12'b0})
|
448 |
|
|
| ({64{a1stg_norm_sng_in1}}
|
449 |
|
|
& {1'b1, a1stg_in1[54:32], 40'b0})
|
450 |
|
|
| ({64{a1stg_denorm_sng_in1}}
|
451 |
|
|
& {a1stg_in1[54:32], 41'b0});
|
452 |
|
|
|
453 |
|
|
assign a1stg_norm_frac2[63:0]= ({64{a1stg_norm_dbl_in2}}
|
454 |
|
|
& {1'b1, a1stg_in2[51:0], 11'b0})
|
455 |
|
|
| ({64{a1stg_denorm_dbl_in2}}
|
456 |
|
|
& {a1stg_in2[51:0], 12'b0})
|
457 |
|
|
| ({64{a1stg_norm_sng_in2}}
|
458 |
|
|
& {1'b1, a1stg_in2[54:32], 40'b0})
|
459 |
|
|
| ({64{a1stg_denorm_sng_in2}}
|
460 |
|
|
& {a1stg_in2[54:32], 41'b0})
|
461 |
|
|
| ({64{a1stg_intlngop}}
|
462 |
|
|
& a1stg_in2[63:0]);
|
463 |
|
|
|
464 |
|
|
assign a2stg_frac1_in[63:0]= ({64{(a1stg_faddsubop_inv
|
465 |
|
|
|| (!((a1stg_in2_gt_in1 && a1stg_2nan_in_inv)
|
466 |
|
|
|| a2stg_frac1_in_frac1)))}}
|
467 |
|
|
& {a1stg_norm_frac1[63],
|
468 |
|
|
(a1stg_norm_frac1[62] || a2stg_frac1_in_qnan),
|
469 |
|
|
(a1stg_norm_frac1[61:40]
|
470 |
|
|
| {22{a2stg_frac1_in_nv}}),
|
471 |
|
|
(a1stg_norm_frac1[39:11]
|
472 |
|
|
| {29{a2stg_frac1_in_nv_dbl}}),
|
473 |
|
|
a1stg_norm_frac1[10:0]})
|
474 |
|
|
| ({64{(a2stg_frac1_in_frac2
|
475 |
|
|
&& (a1stg_in2_gt_in1 || a2stg_frac1_in_frac1))}}
|
476 |
|
|
& {a1stg_norm_frac2[63],
|
477 |
|
|
(a1stg_norm_frac2[62] || a2stg_frac1_in_qnan),
|
478 |
|
|
(a1stg_norm_frac2[61:40]
|
479 |
|
|
| {22{a2stg_frac1_in_nv}}),
|
480 |
|
|
(a1stg_norm_frac2[39:11]
|
481 |
|
|
| {29{a2stg_frac1_in_nv_dbl}}),
|
482 |
|
|
a1stg_norm_frac2[10:0]});
|
483 |
|
|
|
484 |
|
|
dffe_s #(64) i_a2stg_frac1 (
|
485 |
|
|
.din (a2stg_frac1_in[63:0]),
|
486 |
|
|
.en (a6stg_step),
|
487 |
|
|
.clk (clk),
|
488 |
|
|
|
489 |
|
|
.q (a2stg_frac1[63:0]),
|
490 |
|
|
|
491 |
|
|
.se (se),
|
492 |
|
|
.si (),
|
493 |
|
|
.so ()
|
494 |
|
|
);
|
495 |
|
|
|
496 |
|
|
assign a2stg_frac2_in[63:0]= ({64{a1stg_faddsubop_inv}}
|
497 |
|
|
& {a1stg_norm_frac2[63],
|
498 |
|
|
(a1stg_norm_frac2[62] || a2stg_frac2_in_qnan),
|
499 |
|
|
a1stg_norm_frac2[61:0]})
|
500 |
|
|
| ({64{(a2stg_frac2_in_frac1 && (!a1stg_in2_gt_in1))}}
|
501 |
|
|
& {a1stg_norm_frac2[63],
|
502 |
|
|
(a1stg_norm_frac2[62] || a2stg_frac2_in_qnan),
|
503 |
|
|
a1stg_norm_frac2[61:0]})
|
504 |
|
|
| ({64{(a2stg_frac2_in_frac1 && a1stg_in2_gt_in1)}}
|
505 |
|
|
& a1stg_norm_frac1[63:0]);
|
506 |
|
|
|
507 |
|
|
dffe_s #(64) i_a2stg_frac2 (
|
508 |
|
|
.din (a2stg_frac2_in[63:0]),
|
509 |
|
|
.en (a6stg_step),
|
510 |
|
|
.clk (clk),
|
511 |
|
|
|
512 |
|
|
.q (a2stg_frac2[63:0]),
|
513 |
|
|
|
514 |
|
|
.se (se),
|
515 |
|
|
.si (),
|
516 |
|
|
.so ()
|
517 |
|
|
);
|
518 |
|
|
|
519 |
|
|
dffe_s #(64) i_a2stg_frac2a (
|
520 |
|
|
.din (a2stg_frac2_in[63:0]),
|
521 |
|
|
.en (a6stg_step),
|
522 |
|
|
.clk (clk),
|
523 |
|
|
|
524 |
|
|
.q (a2stg_frac2a[63:0]),
|
525 |
|
|
|
526 |
|
|
.se (se),
|
527 |
|
|
.si (),
|
528 |
|
|
.so ()
|
529 |
|
|
);
|
530 |
|
|
|
531 |
|
|
|
532 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
533 |
|
|
//
|
534 |
|
|
// Add pipe right shift
|
535 |
|
|
// - shift the smaller fraction right for adds and subtracts
|
536 |
|
|
// - shift the fraction right for float to integer conversion
|
537 |
|
|
//
|
538 |
|
|
// Add stage 2.
|
539 |
|
|
//
|
540 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
541 |
|
|
|
542 |
|
|
assign a2stg_frac2_63= a2stg_frac2[63];
|
543 |
|
|
|
544 |
|
|
assign a2stg_frac2hi_neq_0= (|a2stg_frac2[62:32]);
|
545 |
|
|
|
546 |
|
|
assign a2stg_frac2lo_neq_0= (|a2stg_frac2[31:11]);
|
547 |
|
|
|
548 |
|
|
|
549 |
|
|
// a2 stage right shifter
|
550 |
|
|
assign a2stg_shr_tmp2[63:0] = ({{24{a2stg_shr_cnt_5[0]}}, {16{a2stg_shr_cnt_5[1]}}, {13{a2stg_shr_cnt_5[2]}}, {11{a2stg_shr_cnt_5[3]}}} & {32'h00000000, a2stg_frac2a[63:32]})
|
551 |
|
|
| ({{24{a2stg_shr_cnt_5_inv[0]}}, {16{a2stg_shr_cnt_5_inv[1]}}, {13{a2stg_shr_cnt_5_inv[2]}}, {11{a2stg_shr_cnt_5_inv[3]}}} & a2stg_frac2a[63:0]);
|
552 |
|
|
|
553 |
|
|
assign a2stg_shr_tmp4[63:0] = ({{24{a2stg_shr_cnt_4[0]}}, {16{a2stg_shr_cnt_4[1]}}, {13{a2stg_shr_cnt_4[2]}}, {11{a2stg_shr_cnt_4[3]}}} & {16'h0000, a2stg_shr_tmp2[63:16]})
|
554 |
|
|
| ({{43{~a2stg_shr_cnt_4[4]}}, {21{~a2stg_shr_cnt_4[4]}}} & a2stg_shr_tmp2[63:0]);
|
555 |
|
|
|
556 |
|
|
assign a2stg_shr_tmp6[63:0] = ~(({{24{a2stg_shr_cnt_3[0]}}, {16{a2stg_shr_cnt_3[1]}}, {13{a2stg_shr_cnt_3[2]}}, {11{a2stg_shr_cnt_3[3]}}} & {8'h00, a2stg_shr_tmp4[63:8]})
|
557 |
|
|
| ({64{~a2stg_shr_cnt_3[4]}} & a2stg_shr_tmp4[63:0]));
|
558 |
|
|
|
559 |
|
|
assign a2stg_shr_tmp8[63:0] = ~(({{43{a2stg_shr_cnt_2[0]}}, {21{a2stg_shr_cnt_2[0]}}} | a2stg_shr_tmp6[63:0])
|
560 |
|
|
& ({64{~a2stg_shr_cnt_2[1]}} | {4'hf, a2stg_shr_tmp6[63:4]}));
|
561 |
|
|
|
562 |
|
|
assign a2stg_shr_tmp10[63:0] = ~(({{43{a2stg_shr_cnt_1[0]}}, {21{a2stg_shr_cnt_1[0]}}} & {2'b00, a2stg_shr_tmp8[63:2]})
|
563 |
|
|
| ({64{~a2stg_shr_cnt_1[1]}} & a2stg_shr_tmp8[63:0]));
|
564 |
|
|
|
565 |
|
|
assign a2stg_shr[115:52] = ~(({{43{a2stg_shr_cnt_0[0]}}, {21{a2stg_shr_cnt_0[0]}}} | a2stg_shr_tmp10[63:0])
|
566 |
|
|
& ({64{~a2stg_shr_cnt_0[1]}} | {1'b1, a2stg_shr_tmp10[63:1]}));
|
567 |
|
|
|
568 |
|
|
assign a2stg_shr_tmp18[63:0] = ~a2stg_shr_tmp2[63:0];
|
569 |
|
|
assign a2stg_shr_tmp13[63:0] = a2stg_shr_tmp4[63:0];
|
570 |
|
|
|
571 |
|
|
// a2 stage nx signals
|
572 |
|
|
assign a2stg_fsdtoi_nx = (| a2stg_shr_tmp13[31:0])
|
573 |
|
|
| (~(& a2stg_shr_tmp6[31:24]))
|
574 |
|
|
| (| a2stg_shr_tmp8[31:28])
|
575 |
|
|
| (~(& a2stg_shr_tmp10[31:30]))
|
576 |
|
|
| a2stg_shr[83];
|
577 |
|
|
|
578 |
|
|
|
579 |
|
|
assign a2stg_nx_neq0_84_tmp_1[63:20] = ~((a2stg_frac2a[43:0] & {44{a2stg_shr_cnt[5]}})
|
580 |
|
|
| ({a2stg_frac2a[11:0], 32'h00000000} & {44{~a2stg_shr_cnt[5]}}));
|
581 |
|
|
|
582 |
|
|
assign a2stg_nx_neq0_84_tmp_2[63:36] = ~(({a2stg_shr_tmp18[27:12], a2stg_nx_neq0_84_tmp_1[63:52]} | {28{~a2stg_shr_cnt[4]}})
|
583 |
|
|
& (a2stg_nx_neq0_84_tmp_1[63:36] | {28{a2stg_shr_cnt[4]}}));
|
584 |
|
|
|
585 |
|
|
assign a2stg_nx_neq0_84_tmp_3[63:44] = ~(({a2stg_shr_tmp13[19:12], a2stg_nx_neq0_84_tmp_2[63:52]} & {20{a2stg_shr_cnt[3]}})
|
586 |
|
|
| (a2stg_nx_neq0_84_tmp_2[63:44] & {20{~a2stg_shr_cnt[3]}}));
|
587 |
|
|
|
588 |
|
|
assign a2stg_nx_neq0_84_tmp_4[63:48] = ~(({a2stg_shr_tmp6[15:12], a2stg_nx_neq0_84_tmp_3[63:52]} | {16{~a2stg_shr_cnt[2]}})
|
589 |
|
|
& (a2stg_nx_neq0_84_tmp_3[63:48] | {16{a2stg_shr_cnt[2]}}));
|
590 |
|
|
|
591 |
|
|
assign a2stg_nx_neq0_84_tmp_5[61:50] = ~((a2stg_nx_neq0_84_tmp_4[63:52] & {12{a2stg_shr_cnt[1]}})
|
592 |
|
|
| (a2stg_nx_neq0_84_tmp_4[61:50] & {12{~a2stg_shr_cnt[1]}}));
|
593 |
|
|
|
594 |
|
|
assign a2stg_nx_neq0_84_tmp_6[59] = ~(a2stg_shr_cnt[0] | a2stg_nx_neq0_84_tmp_5[60]);
|
595 |
|
|
assign a2stg_nx_neq0_84_tmp_6[60] = ~(~a2stg_shr_cnt[0] | a2stg_nx_neq0_84_tmp_5[61]);
|
596 |
|
|
assign a2stg_nx_neq0_84_tmp_6_51 = ~((a2stg_nx_neq0_84_tmp_5[52] | ~a2stg_shr_cnt[0])
|
597 |
|
|
& (a2stg_nx_neq0_84_tmp_5[51] | a2stg_shr_cnt[0]));
|
598 |
|
|
|
599 |
|
|
assign a2stg_fsdtoix_nx = (~(& a2stg_nx_neq0_84_tmp_1[51:20])
|
600 |
|
|
| (| a2stg_nx_neq0_84_tmp_2[51:36])
|
601 |
|
|
| ~(& a2stg_nx_neq0_84_tmp_3[51:44])
|
602 |
|
|
| (| a2stg_nx_neq0_84_tmp_4[51:48])
|
603 |
|
|
| ~(& a2stg_nx_neq0_84_tmp_5[51:50])
|
604 |
|
|
| a2stg_nx_neq0_84_tmp_6_51);
|
605 |
|
|
|
606 |
|
|
assign a2stg_shr_60_0_neq_0 = (~(& a2stg_nx_neq0_84_tmp_1[60:20])
|
607 |
|
|
| (| a2stg_nx_neq0_84_tmp_2[60:45])
|
608 |
|
|
| ~(& a2stg_nx_neq0_84_tmp_3[60:53])
|
609 |
|
|
| (| a2stg_nx_neq0_84_tmp_4[60:57])
|
610 |
|
|
| ~(& a2stg_nx_neq0_84_tmp_5[60:59])
|
611 |
|
|
| (| a2stg_nx_neq0_84_tmp_6[60:59]));
|
612 |
|
|
|
613 |
|
|
|
614 |
|
|
assign a2stg_shr_frac2_inv[63:0]= (~(({64{a2stg_shr_frac2_shr_int}}
|
615 |
|
|
& {1'b0, a2stg_shr[115:61], a2stg_shr_60_0_neq_0,
|
616 |
|
|
7'b0})
|
617 |
|
|
| ({64{(a2stg_shr_frac2_shr_dbl && a2stg_expadd_11)}}
|
618 |
|
|
& a2stg_shr[115:52])
|
619 |
|
|
| ({64{(a2stg_shr_frac2_shr_sng && a2stg_expadd_11)}}
|
620 |
|
|
& {a2stg_shr[115:84], 32'b0})
|
621 |
|
|
| ({64{(a2stg_shr_frac2_max && (!a2stg_expadd_11))}}
|
622 |
|
|
& 64'h7fffffffffffffff)
|
623 |
|
|
| ({64{(!a6stg_step)}}
|
624 |
|
|
& a3stg_frac2[63:0])));
|
625 |
|
|
|
626 |
|
|
assign a3stg_frac2_in[63:0]= (~(a2stg_shr_frac2_inv[63:0]
|
627 |
|
|
^ {64{a2stg_sub_step}}));
|
628 |
|
|
|
629 |
|
|
dff_s #(64) i_a3stg_frac2 (
|
630 |
|
|
.din (a3stg_frac2_in[63:0]),
|
631 |
|
|
.clk (clk),
|
632 |
|
|
|
633 |
|
|
.q (a3stg_frac2[63:0]),
|
634 |
|
|
|
635 |
|
|
.se (se),
|
636 |
|
|
.si (),
|
637 |
|
|
.so ()
|
638 |
|
|
);
|
639 |
|
|
|
640 |
|
|
|
641 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
642 |
|
|
//
|
643 |
|
|
// Pipe the other/larger fraction to stage 3.
|
644 |
|
|
//
|
645 |
|
|
// Add stage 2.
|
646 |
|
|
//
|
647 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
648 |
|
|
|
649 |
|
|
dffe_s #(64) i_a3stg_frac1 (
|
650 |
|
|
.din ({1'b0, a2stg_frac1[63:1]}),
|
651 |
|
|
.en (a6stg_step),
|
652 |
|
|
.clk (clk),
|
653 |
|
|
|
654 |
|
|
.q (a3stg_frac1[63:0]),
|
655 |
|
|
|
656 |
|
|
.se (se),
|
657 |
|
|
.si (),
|
658 |
|
|
.so ()
|
659 |
|
|
);
|
660 |
|
|
|
661 |
|
|
|
662 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
663 |
|
|
//
|
664 |
|
|
// Add pipe adder.
|
665 |
|
|
//
|
666 |
|
|
// Add stage 2.
|
667 |
|
|
//
|
668 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
669 |
|
|
|
670 |
|
|
assign a2stg_fracadd_in2[63:0]= ({64{a2stg_fracadd_frac2_inv}}
|
671 |
|
|
& (~a2stg_frac2[63:0]))
|
672 |
|
|
| ({64{a2stg_fracadd_frac2_inv_shr1}}
|
673 |
|
|
& (~{1'b0, a2stg_frac2[63:1]}))
|
674 |
|
|
| ({64{a2stg_fracadd_frac2}}
|
675 |
|
|
& a2stg_frac2[63:0]);
|
676 |
|
|
|
677 |
|
|
assign a2stg_fracadd[63:0]= (a2stg_frac1[63:0]
|
678 |
|
|
+ a2stg_fracadd_in2[63:0]
|
679 |
|
|
+ {63'b0, a2stg_fracadd_cin});
|
680 |
|
|
|
681 |
|
|
dffe_s #(64) i_a3stg_ld0_frac (
|
682 |
|
|
.din (a2stg_fracadd[63:0]),
|
683 |
|
|
.en (a6stg_step),
|
684 |
|
|
.clk (clk),
|
685 |
|
|
|
686 |
|
|
.q (a3stg_ld0_frac[63:0]),
|
687 |
|
|
|
688 |
|
|
.se (se),
|
689 |
|
|
.si (),
|
690 |
|
|
.so ()
|
691 |
|
|
);
|
692 |
|
|
|
693 |
|
|
|
694 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
695 |
|
|
//
|
696 |
|
|
// Add pipe exponent decode- used to identify denorm results.
|
697 |
|
|
//
|
698 |
|
|
// Add stage 2.
|
699 |
|
|
//
|
700 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
701 |
|
|
|
702 |
|
|
// assign a2stg_expdec_tmp[107:0]= ({54'b0, 54'h20000000000000} >> a2stg_exp[5:0]);
|
703 |
|
|
assign a2stg_expdec_tmp[53:0] = 54'h20000000000000 >> a2stg_exp[5:0] ;
|
704 |
|
|
|
705 |
|
|
assign a2stg_expdec[53:0]= a2stg_expdec_tmp[53:0] & {54{a2stg_expdec_neq_0}};
|
706 |
|
|
|
707 |
|
|
dffe_s #(54) i_a3stg_expdec (
|
708 |
|
|
.din (a2stg_expdec[53:0]),
|
709 |
|
|
.en (a6stg_step),
|
710 |
|
|
.clk (clk),
|
711 |
|
|
|
712 |
|
|
.q (a3stg_expdec[53:0]),
|
713 |
|
|
|
714 |
|
|
.se (se),
|
715 |
|
|
.si (),
|
716 |
|
|
.so ()
|
717 |
|
|
);
|
718 |
|
|
|
719 |
|
|
|
720 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
721 |
|
|
//
|
722 |
|
|
// Add pipe denorm comparator to identify denorm results.
|
723 |
|
|
//
|
724 |
|
|
// Add stage 3.
|
725 |
|
|
//
|
726 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
727 |
|
|
|
728 |
|
|
assign a3stg_ld0_dnrm_10= (a3stg_faddsubopa[0] && a3stg_ld0_frac[10])
|
729 |
|
|
|| ((!a3stg_faddsubopa[0]) && (|a3stg_ld0_frac[10:0]));
|
730 |
|
|
|
731 |
|
|
fpu_denorm_frac i_a3stg_denorm (
|
732 |
|
|
.din1 ({a3stg_ld0_frac[63:11], a3stg_ld0_dnrm_10}),
|
733 |
|
|
.din2 (a3stg_expdec[53:0]),
|
734 |
|
|
|
735 |
|
|
.din2_din1_denorm (a3stg_denorm),
|
736 |
|
|
.din2_din1_denorm_inv (a3stg_denorm_inv),
|
737 |
|
|
.din2_din1_denorma (a3stg_denorma),
|
738 |
|
|
.din2_din1_denorm_inva (a3stg_denorm_inva)
|
739 |
|
|
);
|
740 |
|
|
|
741 |
|
|
|
742 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
743 |
|
|
//
|
744 |
|
|
// Add pipe leading 0's counter.
|
745 |
|
|
//
|
746 |
|
|
// Add stage 3.
|
747 |
|
|
//
|
748 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
749 |
|
|
|
750 |
|
|
fpu_cnt_lead0_64b i_a3stg_lead0 (
|
751 |
|
|
.din (a3stg_ld0_frac[63:0]),
|
752 |
|
|
|
753 |
|
|
.lead0 (a3stg_lead0[5:0])
|
754 |
|
|
);
|
755 |
|
|
|
756 |
|
|
|
757 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
758 |
|
|
//
|
759 |
|
|
// Add pipe main adder.
|
760 |
|
|
//
|
761 |
|
|
// Add stage 3.
|
762 |
|
|
//
|
763 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
764 |
|
|
|
765 |
|
|
assign a3stg_fracadd[63:0]= (a3stg_frac1[63:0]
|
766 |
|
|
+ a3stg_frac2[63:0]
|
767 |
|
|
+ {63'b0, a3stg_suba});
|
768 |
|
|
|
769 |
|
|
dffe_s #(64) i_astg_xtra_regs (
|
770 |
|
|
.din ({{4{a2stg_shr_cnt_5_inv_in}}, {4{a2stg_shr_cnt_in[5]}},
|
771 |
|
|
a2stg_shr_cnt_in[5:3],
|
772 |
|
|
{5{a2stg_shr_cnt_in[4]}}, {5{a2stg_shr_cnt_in[3]}},
|
773 |
|
|
a2stg_shr_cnt_in[5:0], a4stg_round_in,
|
774 |
|
|
{2{a2stg_shr_cnt_in[2]}}, {2{a2stg_shr_cnt_in[1]}},
|
775 |
|
|
{2{a2stg_shr_cnt_in[0]}},
|
776 |
|
|
{3{a4stg_shl_cnt_in[6]}},
|
777 |
|
|
{3{a4stg_shl_cnt_in[7]}},
|
778 |
|
|
{3{a4stg_shl_cnt_in[8]}},
|
779 |
|
|
{3{a4stg_shl_cnt_in[9]}},
|
780 |
|
|
a4stg_shl_cnt_in[5:0],
|
781 |
|
|
{3{a2stg_shr_cnt_in[5]}},
|
782 |
|
|
a2stg_fracadd_frac2_inv_in,
|
783 |
|
|
a2stg_fracadd_frac2_inv_shr1_in,
|
784 |
|
|
a3stg_denorm_inva,
|
785 |
|
|
a2stg_fsdtoix_nx, a2stg_fsdtoi_nx,
|
786 |
|
|
1'b0, a2stg_fracadd_cin_in, {2{a3stg_sub_in}}}),
|
787 |
|
|
.en (a6stg_step),
|
788 |
|
|
.clk (clk),
|
789 |
|
|
|
790 |
|
|
.q ({a2stg_shr_cnt_5_inv[3:0], a2stg_shr_cnt_5[3:0],
|
791 |
|
|
a2stg_shr_cnta[5:3],
|
792 |
|
|
a2stg_shr_cnt_4[4:0], a2stg_shr_cnt_3[4:0],
|
793 |
|
|
a2stg_shr_cnt[5:0], a4stg_round,
|
794 |
|
|
a2stg_shr_cnt_2[1:0], a2stg_shr_cnt_1[1:0],
|
795 |
|
|
a2stg_shr_cnt_0[1:0],
|
796 |
|
|
a4stg_shl_cnt_dec54_0[2:0],
|
797 |
|
|
a4stg_shl_cnt_dec54_1[2:0],
|
798 |
|
|
a4stg_shl_cnt_dec54_2[2:0],
|
799 |
|
|
a4stg_shl_cnt_dec54_3[2:0],
|
800 |
|
|
a4stg_shl_cnt[5:0],
|
801 |
|
|
a2stg_shr_cnta_5[2:0],
|
802 |
|
|
a2stg_fracadd_frac2_inv,
|
803 |
|
|
a2stg_fracadd_frac2_inv_shr1,
|
804 |
|
|
a4stg_denorm_inv,
|
805 |
|
|
a3stg_fsdtoix_nx, a3stg_fsdtoi_nx,
|
806 |
|
|
astg_xtra_regs[3], a2stg_fracadd_cin,
|
807 |
|
|
a3stg_sub, a3stg_suba}),
|
808 |
|
|
|
809 |
|
|
.se (se),
|
810 |
|
|
.si (),
|
811 |
|
|
.so ()
|
812 |
|
|
);
|
813 |
|
|
|
814 |
|
|
assign a4stg_round_in= a3stg_fracadd[61]
|
815 |
|
|
|| a3stg_fracadd[62]
|
816 |
|
|
|| a3stg_fracadd[63];
|
817 |
|
|
|
818 |
|
|
assign a3stg_inc_exp_inv= (!a3stg_fracadd[63]);
|
819 |
|
|
|
820 |
|
|
assign a3stg_same_exp_inv= (!(((!a3stg_fracadd[63]) && a3stg_fracadd[62])
|
821 |
|
|
|| ((!a3stg_fracadd[63]) && a3stg_exp10_0_eq0)));
|
822 |
|
|
|
823 |
|
|
assign a3stg_dec_exp_inv= (!((!a3stg_fracadd[63])
|
824 |
|
|
&& (!a3stg_fracadd[62])
|
825 |
|
|
&& a3stg_fracadd[61]
|
826 |
|
|
&& (!a3stg_exp10_0_eq0)));
|
827 |
|
|
|
828 |
|
|
assign a3stg_inc_exp_inva= (!a3stg_fracadd[63]);
|
829 |
|
|
|
830 |
|
|
assign a3stg_fsame_exp_inv= (!(((!a3stg_fracadd[63])
|
831 |
|
|
&& (!a3stg_fracadd[62])
|
832 |
|
|
&& a3stg_fracadd[61]
|
833 |
|
|
&& a3stg_exp10_1_eq0
|
834 |
|
|
&& a3stg_exp_0)
|
835 |
|
|
|| ((!a3stg_fracadd[63])
|
836 |
|
|
&& a3stg_fracadd[62]
|
837 |
|
|
&& (!a3stg_exp10_0_eq0))));
|
838 |
|
|
|
839 |
|
|
assign a3stg_fdec_exp_inv= (!((!a3stg_fracadd[63])
|
840 |
|
|
&& (!a3stg_fracadd[62])
|
841 |
|
|
&& a3stg_fracadd[61]
|
842 |
|
|
&& (!a3stg_exp10_1_eq0)));
|
843 |
|
|
|
844 |
|
|
assign a4stg_rnd_frac_pre1_in[63:0]= ({64{(a3stg_faddsubopa[1] && a6stg_step
|
845 |
|
|
&& (!a3stg_fdec_exp_inv))}}
|
846 |
|
|
& {a3stg_fracadd[61:0], 2'b00});
|
847 |
|
|
|
848 |
|
|
dff_s #(64) i_a4stg_rnd_frac_pre1 (
|
849 |
|
|
.din (a4stg_rnd_frac_pre1_in[63:0]),
|
850 |
|
|
.clk (clk),
|
851 |
|
|
|
852 |
|
|
.q (a4stg_rnd_frac_pre1[63:0]),
|
853 |
|
|
|
854 |
|
|
.se (se),
|
855 |
|
|
.si (),
|
856 |
|
|
.so ()
|
857 |
|
|
);
|
858 |
|
|
|
859 |
|
|
assign a4stg_rnd_frac_pre3_in[63:0]= ({64{(a3stg_faddsubopa[1] && a6stg_step
|
860 |
|
|
&& (!a3stg_fsame_exp_inv))}}
|
861 |
|
|
& {a3stg_fracadd[62:0], 1'b0});
|
862 |
|
|
|
863 |
|
|
dff_s #(64) i_a4stg_rnd_frac_pre3 (
|
864 |
|
|
.din (a4stg_rnd_frac_pre3_in[63:0]),
|
865 |
|
|
.clk (clk),
|
866 |
|
|
|
867 |
|
|
.q (a4stg_rnd_frac_pre3[63:0]),
|
868 |
|
|
|
869 |
|
|
.se (se),
|
870 |
|
|
.si (),
|
871 |
|
|
.so ()
|
872 |
|
|
);
|
873 |
|
|
|
874 |
|
|
assign a4stg_rnd_frac_pre2_in[63:0]= ({64{(a3stg_faddsubopa[1] && a6stg_step
|
875 |
|
|
&& (!a3stg_inc_exp_inva))}}
|
876 |
|
|
& a3stg_fracadd[63:0])
|
877 |
|
|
| ({64{((!a4stg_rnd_frac_add_inv) && a6stg_step)}}
|
878 |
|
|
& a3stg_fracadd[63:0])
|
879 |
|
|
| ({64{((!a3stg_fdtos_inv) && a6stg_step)}}
|
880 |
|
|
& {a3stg_fracadd[62:0], 1'b0})
|
881 |
|
|
| ({64{((!a4stg_fixtos_fxtod_inv) && a6stg_step)}}
|
882 |
|
|
& a4stg_shl[63:0])
|
883 |
|
|
| ({64{(!a6stg_step)}}
|
884 |
|
|
& a4stg_rnd_frac[63:0]);
|
885 |
|
|
|
886 |
|
|
dff_s #(64) i_a4stg_rnd_frac_pre2 (
|
887 |
|
|
.din (a4stg_rnd_frac_pre2_in[63:0]),
|
888 |
|
|
.clk (clk),
|
889 |
|
|
|
890 |
|
|
.q (a4stg_rnd_frac_pre2[63:0]),
|
891 |
|
|
|
892 |
|
|
.se (se),
|
893 |
|
|
.si (),
|
894 |
|
|
.so ()
|
895 |
|
|
);
|
896 |
|
|
|
897 |
|
|
|
898 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
899 |
|
|
//
|
900 |
|
|
// Add pipe input to left shift.
|
901 |
|
|
//
|
902 |
|
|
// Add stage 3.
|
903 |
|
|
//
|
904 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
905 |
|
|
|
906 |
|
|
assign a4stg_shl_data_in[63:0]= ({64{a3stg_denorm_inva}}
|
907 |
|
|
& a3stg_ld0_frac[63:0])
|
908 |
|
|
| ({64{a3stg_denorma}}
|
909 |
|
|
& {1'b0, a3stg_ld0_frac[63:1]});
|
910 |
|
|
|
911 |
|
|
dffe_s #(64) i_a4stg_shl_data (
|
912 |
|
|
.din (a4stg_shl_data_in[63:0]),
|
913 |
|
|
.en (a6stg_step),
|
914 |
|
|
.clk (clk),
|
915 |
|
|
|
916 |
|
|
.q (a4stg_shl_data[63:0]),
|
917 |
|
|
|
918 |
|
|
.se (se),
|
919 |
|
|
.si (),
|
920 |
|
|
.so ()
|
921 |
|
|
);
|
922 |
|
|
|
923 |
|
|
|
924 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
925 |
|
|
//
|
926 |
|
|
// Add pipe rounding adder.
|
927 |
|
|
//
|
928 |
|
|
// Add stage 4.
|
929 |
|
|
//
|
930 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
931 |
|
|
|
932 |
|
|
assign a4stg_rnd_frac[63:0]= (a4stg_rnd_frac_pre1[63:0]
|
933 |
|
|
| a4stg_rnd_frac_pre2[63:0]
|
934 |
|
|
| a4stg_rnd_frac_pre3[63:0]);
|
935 |
|
|
|
936 |
|
|
assign a4stg_rnd_frac_40= a4stg_rnd_frac[40];
|
937 |
|
|
|
938 |
|
|
assign a4stg_rnd_frac_39= a4stg_rnd_frac[39];
|
939 |
|
|
|
940 |
|
|
assign a4stg_rnd_frac_11= a4stg_rnd_frac[11];
|
941 |
|
|
|
942 |
|
|
assign a4stg_rnd_frac_10= a4stg_rnd_frac[10];
|
943 |
|
|
|
944 |
|
|
assign a4stg_frac_9_0_nx= (|a4stg_rnd_frac[9:0]);
|
945 |
|
|
|
946 |
|
|
assign a4stg_frac_dbl_nx= a4stg_frac_9_0_nx || a4stg_rnd_frac[10];
|
947 |
|
|
|
948 |
|
|
assign a4stg_frac_38_0_nx= a4stg_frac_dbl_nx || (|a4stg_rnd_frac[38:11]);
|
949 |
|
|
|
950 |
|
|
assign a4stg_frac_sng_nx= a4stg_frac_38_0_nx || a4stg_rnd_frac[39];
|
951 |
|
|
|
952 |
|
|
assign a4stg_frac_neq_0= a4stg_frac_sng_nx || (|a4stg_rnd_frac[63:40]);
|
953 |
|
|
|
954 |
|
|
assign a4stg_rndadd_tmp[52:0]= {1'b0, a4stg_rnd_frac[62:11]}
|
955 |
|
|
+ {23'b0, a4stg_rnd_sng, 28'b0, a4stg_rnd_dbl};
|
956 |
|
|
|
957 |
|
|
assign a4stg_rndadd_cout= a4stg_rndadd_tmp[52];
|
958 |
|
|
|
959 |
|
|
assign a4stg_rndadd[51:0]= a4stg_rndadd_tmp[51:0];
|
960 |
|
|
|
961 |
|
|
|
962 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
963 |
|
|
//
|
964 |
|
|
// Add pipe left shift.
|
965 |
|
|
//
|
966 |
|
|
// Add stage 4.
|
967 |
|
|
//
|
968 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
969 |
|
|
|
970 |
|
|
assign a4stg_shl_data_neq_0= (|a4stg_shl_data[63:0]);
|
971 |
|
|
|
972 |
|
|
assign a4stg_shl_tmp4[63:0] = ({{32{a4stg_shl_cnt_dec54_0[0]}}, {21{a4stg_shl_cnt_dec54_0[1]}}, {11{a4stg_shl_cnt_dec54_0[2]}}} & a4stg_shl_data[63:0])
|
973 |
|
|
| ({{32{a4stg_shl_cnt_dec54_1[0]}}, {21{a4stg_shl_cnt_dec54_1[1]}}, {11{a4stg_shl_cnt_dec54_1[2]}}} & {a4stg_shl_data[47:0], 16'h0000})
|
974 |
|
|
| ({{32{a4stg_shl_cnt_dec54_2[0]}}, {21{a4stg_shl_cnt_dec54_2[1]}}, {11{a4stg_shl_cnt_dec54_2[2]}}} & {a4stg_shl_data[31:0], 32'h00000000})
|
975 |
|
|
| ({{32{a4stg_shl_cnt_dec54_3[0]}}, {21{a4stg_shl_cnt_dec54_3[1]}}, {11{a4stg_shl_cnt_dec54_3[2]}}} & {a4stg_shl_data[15:0], 32'h00000000, 16'h0000});
|
976 |
|
|
|
977 |
|
|
assign a4stg_shl[63:0] = a4stg_shl_tmp4[63:0] << a4stg_shl_cnt[3:0];
|
978 |
|
|
|
979 |
|
|
|
980 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
981 |
|
|
//
|
982 |
|
|
// Add pipe fraction output.
|
983 |
|
|
//
|
984 |
|
|
// Add stage 4.
|
985 |
|
|
//
|
986 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
987 |
|
|
|
988 |
|
|
dffe_s #(58) i_a5stg_rndadd (
|
989 |
|
|
.din ({a4stg_rndadd_cout, add_frac_out_rndadd, add_frac_out_rnd_frac,
|
990 |
|
|
a4stg_in_of, add_frac_out_shl, a4stg_to_0,
|
991 |
|
|
a4stg_rndadd[51:0]}),
|
992 |
|
|
.en (a6stg_step),
|
993 |
|
|
.clk (clk),
|
994 |
|
|
|
995 |
|
|
.q ({add_of_out_cout, a5stg_frac_out_rndadd,
|
996 |
|
|
a5stg_frac_out_rnd_frac, a5stg_in_of,
|
997 |
|
|
a5stg_frac_out_shl, a5stg_to_0,
|
998 |
|
|
a5stg_rndadd[51:0]}),
|
999 |
|
|
|
1000 |
|
|
.se (se),
|
1001 |
|
|
.si (),
|
1002 |
|
|
.so ()
|
1003 |
|
|
);
|
1004 |
|
|
|
1005 |
|
|
dffe_s #(64) i_a5stg_rnd_frac (
|
1006 |
|
|
.din (a4stg_rnd_frac[63:0]),
|
1007 |
|
|
.en (a6stg_step),
|
1008 |
|
|
.clk (clk),
|
1009 |
|
|
|
1010 |
|
|
.q (a5stg_rnd_frac[63:0]),
|
1011 |
|
|
|
1012 |
|
|
.se (se),
|
1013 |
|
|
.si (),
|
1014 |
|
|
.so ()
|
1015 |
|
|
);
|
1016 |
|
|
|
1017 |
|
|
dffe_s #(64) i_a5stg_shl (
|
1018 |
|
|
.din (a4stg_shl[63:0]),
|
1019 |
|
|
.en (a6stg_step),
|
1020 |
|
|
.clk (clk),
|
1021 |
|
|
|
1022 |
|
|
.q (a5stg_shl[63:0]),
|
1023 |
|
|
|
1024 |
|
|
.se (se),
|
1025 |
|
|
.si (),
|
1026 |
|
|
.so ()
|
1027 |
|
|
);
|
1028 |
|
|
|
1029 |
|
|
assign add_frac_out[63:0]= ({64{a5stg_frac_out_rndadd}}
|
1030 |
|
|
& {1'b0, a5stg_rndadd[51:0], 11'b0})
|
1031 |
|
|
| ({64{a5stg_frac_out_rnd_frac}}
|
1032 |
|
|
& a5stg_rnd_frac[63:0])
|
1033 |
|
|
| ({64{a5stg_in_of}}
|
1034 |
|
|
& {64{a5stg_to_0}})
|
1035 |
|
|
| ({64{a5stg_frac_out_shl}}
|
1036 |
|
|
& a5stg_shl[63:0]);
|
1037 |
|
|
|
1038 |
|
|
|
1039 |
|
|
endmodule
|
1040 |
|
|
|