1 |
2 |
dmitryr |
// ========== Copyright Header Begin ==========================================
|
2 |
|
|
//
|
3 |
|
|
// OpenSPARC T1 Processor File: fpu_div_exp_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 |
|
|
// Divide pipeline exponent datapath.
|
24 |
|
|
//
|
25 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
26 |
|
|
|
27 |
|
|
module fpu_div_exp_dp (
|
28 |
|
|
inq_in1,
|
29 |
|
|
inq_in2,
|
30 |
|
|
d1stg_step,
|
31 |
|
|
d234stg_fdiv,
|
32 |
|
|
div_expadd1_in1_dbl,
|
33 |
|
|
div_expadd1_in1_sng,
|
34 |
|
|
div_expadd1_in2_exp_in2_dbl,
|
35 |
|
|
div_expadd1_in2_exp_in2_sng,
|
36 |
|
|
d3stg_fdiv,
|
37 |
|
|
d4stg_fdiv,
|
38 |
|
|
div_shl_cnt,
|
39 |
|
|
div_exp1_expadd1,
|
40 |
|
|
div_exp1_0835,
|
41 |
|
|
div_exp1_0118,
|
42 |
|
|
div_exp1_zero,
|
43 |
|
|
div_exp1_load,
|
44 |
|
|
div_expadd2_in1_exp_out,
|
45 |
|
|
d5stg_fdiva,
|
46 |
|
|
d5stg_fdivd,
|
47 |
|
|
d5stg_fdivs,
|
48 |
|
|
d6stg_fdiv,
|
49 |
|
|
d7stg_fdiv,
|
50 |
|
|
div_expadd2_no_decr_inv,
|
51 |
|
|
div_expadd2_cin,
|
52 |
|
|
div_exp_out_expadd2,
|
53 |
|
|
div_exp_out_expadd22_inv,
|
54 |
|
|
div_exp_out_of,
|
55 |
|
|
d7stg_to_0_inv,
|
56 |
|
|
d7stg_fdivd,
|
57 |
|
|
div_exp_out_exp_out,
|
58 |
|
|
d7stg_rndup_inv,
|
59 |
|
|
div_frac_add_52_inv,
|
60 |
|
|
div_exp_out_load,
|
61 |
|
|
fdiv_clken_l,
|
62 |
|
|
rclk,
|
63 |
|
|
|
64 |
|
|
div_exp1,
|
65 |
|
|
div_expadd2_12,
|
66 |
|
|
div_exp_out,
|
67 |
|
|
div_exp_outa,
|
68 |
|
|
|
69 |
|
|
se,
|
70 |
|
|
si,
|
71 |
|
|
so
|
72 |
|
|
);
|
73 |
|
|
|
74 |
|
|
|
75 |
|
|
input [62:52] inq_in1; // request operand 1 to op pipes
|
76 |
|
|
input [62:52] inq_in2; // request operand 2 to op pipes
|
77 |
|
|
input d1stg_step; // divide pipe load
|
78 |
|
|
input d234stg_fdiv; // select line to div_expadd1
|
79 |
|
|
input div_expadd1_in1_dbl; // select line to div_expadd1
|
80 |
|
|
input div_expadd1_in1_sng; // select line to div_expadd1
|
81 |
|
|
input div_expadd1_in2_exp_in2_dbl; // select line to div_expadd1
|
82 |
|
|
input div_expadd1_in2_exp_in2_sng; //select line to div_expadd1
|
83 |
|
|
input d3stg_fdiv; // divide operation- divide stage 3
|
84 |
|
|
input d4stg_fdiv; // divide operation- divide stage 4
|
85 |
|
|
input [5:0] div_shl_cnt; // divide left shift amount
|
86 |
|
|
input div_exp1_expadd1; // select line to div_exp1
|
87 |
|
|
input div_exp1_0835; // select line to div_exp1
|
88 |
|
|
input div_exp1_0118; // select line to div_exp1
|
89 |
|
|
input div_exp1_zero; // select line to div_exp1
|
90 |
|
|
input div_exp1_load; // load enable to div_exp1
|
91 |
|
|
input div_expadd2_in1_exp_out; // select line to div_expadd2
|
92 |
|
|
input d5stg_fdiva; // divide operation- divide stage 5
|
93 |
|
|
input d5stg_fdivd; // divide double- divide stage 5
|
94 |
|
|
input d5stg_fdivs; // divide single- divide stage 5
|
95 |
|
|
input d6stg_fdiv; // divide operation- divide stage 6
|
96 |
|
|
input d7stg_fdiv; // divide operation- divide stage 7
|
97 |
|
|
input div_expadd2_no_decr_inv; // no exponent decrement
|
98 |
|
|
input div_expadd2_cin; // carry in to 2nd exponent adder
|
99 |
|
|
input div_exp_out_expadd2; // select line to div_exp_out
|
100 |
|
|
input div_exp_out_expadd22_inv; // select line to div_exp_out
|
101 |
|
|
input div_exp_out_of; // overflow to exponent output
|
102 |
|
|
input d7stg_to_0_inv; // result to infinity on overflow
|
103 |
|
|
input d7stg_fdivd; // divide double- divide stage 7
|
104 |
|
|
input div_exp_out_exp_out; // select line to div_exp_out
|
105 |
|
|
input d7stg_rndup_inv; // no rounding increment
|
106 |
|
|
input div_frac_add_52_inv; // div_frac_add bit[52] inverted
|
107 |
|
|
input div_exp_out_load; // load enable to div_exp_out
|
108 |
|
|
input fdiv_clken_l; // div pipe clk enable - asserted low
|
109 |
|
|
input rclk; // global clock
|
110 |
|
|
|
111 |
|
|
output [12:0] div_exp1; // divide exponent- intermediate value
|
112 |
|
|
output div_expadd2_12; // divide exponent- 2nd adder output
|
113 |
|
|
output [12:0] div_exp_out; // divide exponent output
|
114 |
|
|
output [10:0] div_exp_outa; // divide exponent output- buffered copy
|
115 |
|
|
|
116 |
|
|
input se; // scan_enable
|
117 |
|
|
input si; // scan in
|
118 |
|
|
output so; // scan out
|
119 |
|
|
|
120 |
|
|
|
121 |
|
|
wire [10:0] div_exp_in1;
|
122 |
|
|
wire [10:0] div_exp_in2;
|
123 |
|
|
wire [12:0] div_expadd1_in1;
|
124 |
|
|
wire [12:0] div_expadd1_in2;
|
125 |
|
|
wire [12:0] div_expadd1;
|
126 |
|
|
wire [12:0] div_exp1_in;
|
127 |
|
|
wire [12:0] div_exp1;
|
128 |
|
|
wire [12:0] div_expadd2_in1;
|
129 |
|
|
wire [12:0] div_expadd2_in2;
|
130 |
|
|
wire [12:0] div_expadd2;
|
131 |
|
|
wire div_expadd2_12;
|
132 |
|
|
wire [12:0] div_exp_out_in;
|
133 |
|
|
wire [12:0] div_exp_out;
|
134 |
|
|
wire [10:0] div_exp_outa;
|
135 |
|
|
|
136 |
|
|
|
137 |
|
|
wire se_l;
|
138 |
|
|
|
139 |
|
|
assign se_l = ~se;
|
140 |
|
|
|
141 |
|
|
clken_buf ckbuf_div_exp_dp (
|
142 |
|
|
.clk(clk),
|
143 |
|
|
.rclk(rclk),
|
144 |
|
|
.enb_l(fdiv_clken_l),
|
145 |
|
|
.tmb_l(se_l)
|
146 |
|
|
);
|
147 |
|
|
|
148 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
149 |
|
|
//
|
150 |
|
|
// Divide exponent inputs.
|
151 |
|
|
//
|
152 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
153 |
|
|
|
154 |
|
|
dffe_s #(11) i_div_exp_in1 (
|
155 |
|
|
.din (inq_in1[62:52]),
|
156 |
|
|
.en (d1stg_step),
|
157 |
|
|
.clk (clk),
|
158 |
|
|
|
159 |
|
|
.q (div_exp_in1[10:0]),
|
160 |
|
|
|
161 |
|
|
.se (se),
|
162 |
|
|
.si (),
|
163 |
|
|
.so ()
|
164 |
|
|
);
|
165 |
|
|
|
166 |
|
|
dffe_s #(11) i_div_exp_in2 (
|
167 |
|
|
.din (inq_in2[62:52]),
|
168 |
|
|
.en (d1stg_step),
|
169 |
|
|
.clk (clk),
|
170 |
|
|
|
171 |
|
|
.q (div_exp_in2[10:0]),
|
172 |
|
|
|
173 |
|
|
.se (se),
|
174 |
|
|
.si (),
|
175 |
|
|
.so ()
|
176 |
|
|
);
|
177 |
|
|
|
178 |
|
|
|
179 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
180 |
|
|
//
|
181 |
|
|
// Divide exponent adder in the front end of the divide pipe.
|
182 |
|
|
//
|
183 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
184 |
|
|
|
185 |
|
|
assign div_expadd1_in1[12:0]= ({13{d234stg_fdiv}}
|
186 |
|
|
& div_exp1[12:0])
|
187 |
|
|
| ({13{div_expadd1_in1_dbl}}
|
188 |
|
|
& {2'b0, div_exp_in1[10:0]})
|
189 |
|
|
| ({13{div_expadd1_in1_sng}}
|
190 |
|
|
& {5'b0, div_exp_in1[10:3]});
|
191 |
|
|
|
192 |
|
|
assign div_expadd1_in2[12:0]= ({13{div_expadd1_in1_dbl}}
|
193 |
|
|
& 13'h0436)
|
194 |
|
|
| ({13{div_expadd1_in1_sng}}
|
195 |
|
|
& 13'h0099)
|
196 |
|
|
| ({13{div_expadd1_in2_exp_in2_dbl}}
|
197 |
|
|
& (~{2'b0, div_exp_in2[10:0]}))
|
198 |
|
|
| ({13{div_expadd1_in2_exp_in2_sng}}
|
199 |
|
|
& (~{5'b0, div_exp_in2[10:3]}))
|
200 |
|
|
| ({13{d3stg_fdiv}}
|
201 |
|
|
& (~{7'b0, div_shl_cnt[5:0]}))
|
202 |
|
|
| ({13{d4stg_fdiv}}
|
203 |
|
|
& {7'b0, div_shl_cnt[5:0]});
|
204 |
|
|
|
205 |
|
|
assign div_expadd1[12:0]= (div_expadd1_in1[12:0]
|
206 |
|
|
+ div_expadd1_in2[12:0]);
|
207 |
|
|
|
208 |
|
|
assign div_exp1_in[12:0]= ({13{div_exp1_expadd1}}
|
209 |
|
|
& div_expadd1[12:0])
|
210 |
|
|
| ({13{div_exp1_0835}}
|
211 |
|
|
& 13'h0835)
|
212 |
|
|
| ({13{div_exp1_0118}}
|
213 |
|
|
& 13'h0118)
|
214 |
|
|
| ({13{div_exp1_zero}}
|
215 |
|
|
& 13'h0000);
|
216 |
|
|
|
217 |
|
|
dffe_s #(13) i_div_exp1 (
|
218 |
|
|
.din (div_exp1_in[12:0]),
|
219 |
|
|
.en (div_exp1_load),
|
220 |
|
|
.clk (clk),
|
221 |
|
|
|
222 |
|
|
.q (div_exp1[12:0]),
|
223 |
|
|
|
224 |
|
|
.se (se),
|
225 |
|
|
.si (),
|
226 |
|
|
.so ()
|
227 |
|
|
);
|
228 |
|
|
|
229 |
|
|
|
230 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
231 |
|
|
//
|
232 |
|
|
// Divide exponent adder in the back end of the divide pipe.
|
233 |
|
|
//
|
234 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
235 |
|
|
|
236 |
|
|
assign div_expadd2_in1[12:0]= ({13{div_expadd2_in1_exp_out}}
|
237 |
|
|
& div_exp_out[12:0])
|
238 |
|
|
| ({13{d5stg_fdiva}}
|
239 |
|
|
& div_exp1[12:0]);
|
240 |
|
|
|
241 |
|
|
assign div_expadd2_in2[12:0]= ({13{d5stg_fdiva}}
|
242 |
|
|
& {7'h7f, d5stg_fdivs, 1'b0, d5stg_fdivd,
|
243 |
|
|
d5stg_fdivs, 1'b1, d5stg_fdivs})
|
244 |
|
|
| ({13{d6stg_fdiv}}
|
245 |
|
|
& {13{div_expadd2_no_decr_inv}})
|
246 |
|
|
| ({13{d7stg_fdiv}}
|
247 |
|
|
& 13'h0000);
|
248 |
|
|
|
249 |
|
|
assign div_expadd2[12:0]= (div_expadd2_in1[12:0]
|
250 |
|
|
+ div_expadd2_in2[12:0]
|
251 |
|
|
+ {12'b0, div_expadd2_cin});
|
252 |
|
|
assign div_expadd2_12 = div_expadd2[12];
|
253 |
|
|
|
254 |
|
|
assign div_exp_out_in[12:0]= ({13{(div_exp_out_expadd2
|
255 |
|
|
&& (!(div_frac_add_52_inv
|
256 |
|
|
&& div_exp_out_expadd22_inv)))}}
|
257 |
|
|
& div_expadd2[12:0])
|
258 |
|
|
| ({13{div_exp_out_of}}
|
259 |
|
|
& {2'b00, {3{d7stg_fdivd}}, 7'h7f, d7stg_to_0_inv})
|
260 |
|
|
| ({13{(div_exp_out_exp_out
|
261 |
|
|
&& (div_frac_add_52_inv || d7stg_rndup_inv))}}
|
262 |
|
|
& div_exp_out[12:0]);
|
263 |
|
|
|
264 |
|
|
dffe_s #(13) i_div_exp_out (
|
265 |
|
|
.din (div_exp_out_in[12:0]),
|
266 |
|
|
.en (div_exp_out_load),
|
267 |
|
|
.clk (clk),
|
268 |
|
|
|
269 |
|
|
.q (div_exp_out[12:0]),
|
270 |
|
|
|
271 |
|
|
.se (se),
|
272 |
|
|
.si (),
|
273 |
|
|
.so ()
|
274 |
|
|
);
|
275 |
|
|
|
276 |
|
|
assign div_exp_outa[10:0]= div_exp_out[10:0];
|
277 |
|
|
|
278 |
|
|
|
279 |
|
|
endmodule
|
280 |
|
|
|
281 |
|
|
|