source: XOpenSparcT1/trunk/T1-FPU/fpu_mul_exp_dp.v @ 6

Revision 6, 12.0 KB checked in by pntsvt00, 13 years ago (diff)

versione iniziale opensparc

Line 
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T1 Processor File: fpu_mul_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//      Multiply pipeline exponent datapath.
24//
25///////////////////////////////////////////////////////////////////////////////
26
27
28module fpu_mul_exp_dp (
29        inq_in1,
30        inq_in2,
31        m6stg_step,
32        m1stg_dblop,
33        m1stg_sngop,
34        m2stg_exp_expadd,
35        m2stg_exp_0bff,
36        m2stg_exp_017f,
37        m2stg_exp_04ff,
38        m2stg_exp_zero,
39        m1stg_fsmuld,
40        m2stg_fmuld,
41        m2stg_fmuls,
42        m2stg_fsmuld,
43        m3stg_ld0_inv,
44        m5stg_fracadd_cout,
45        mul_exp_out_exp_plus1,
46        mul_exp_out_exp,
47        m5stg_in_of,
48        m5stg_fmuld,
49        m5stg_to_0_inv,
50        m4stg_shl_54,
51        m4stg_shl_55,
52        m4stg_inc_exp_54,
53        m4stg_inc_exp_55,
54        m4stg_inc_exp_105,
55        fmul_clken_l,
56        rclk,
57       
58        m3stg_exp,
59        m3stg_expadd_eq_0,
60        m3stg_expadd_lte_0_inv,
61        m4stg_exp,
62        m5stg_exp,
63        mul_exp_out,
64
65        se,
66        si,
67        so
68);
69
70
71input [62:52]   inq_in1;                // request operand 1 to op pipes
72input [62:52]   inq_in2;                // request operand 2 to op pipes
73input           m6stg_step;             // advance the multiply pipe
74input           m1stg_dblop;            // double precision operation- mul 1 stg
75input           m1stg_sngop;            // single precision operation- mul 1 stg
76input           m2stg_exp_expadd;       // select line to m2stg_exp
77input           m2stg_exp_0bff;         // select line to m2stg_exp
78input           m2stg_exp_017f;         // select line to m2stg_exp
79input           m2stg_exp_04ff;         // select line to m2stg_exp
80input           m2stg_exp_zero;         // select line to m2stg_exp
81input           m1stg_fsmuld;           // fsmuld- multiply 1 stage
82input           m2stg_fmuld;            // fmuld- multiply 2 stage
83input           m2stg_fmuls;            // fmuls- multiply 2 stage
84input           m2stg_fsmuld;           // fsmuld- multiply 2 stage
85input [6:0]     m3stg_ld0_inv;          // leading 0's in multiply operands
86input           m4stg_inc_exp_54;       // select line to m5stg_exp
87input           m4stg_inc_exp_55;       // select line to m5stg_exp
88input           m4stg_inc_exp_105;      // select line to m5stg_exp
89input           m5stg_fracadd_cout;     // fraction rounding adder carry out
90input           mul_exp_out_exp_plus1;  // select line to mul_exp_out
91input           mul_exp_out_exp;        // select line to mul_exp_out
92input           m5stg_in_of;            // multiply overflow- select exp out
93input           m5stg_fmuld;            // fmuld- multiply 5 stage
94input           m5stg_to_0_inv;         // result to infinity on overflow
95input           m4stg_shl_54;           // multiply shift left output bit[54]
96input           m4stg_shl_55;           // multiply shift left output bit[55]
97input           fmul_clken_l;           // multiply pipe clk enable - asserted low
98input           rclk;           // global clock
99
100output [12:0]   m3stg_exp;              // exponent input- multiply 3 stage
101output          m3stg_expadd_eq_0;      // mul stage 3 exponent adder sum == 0
102output          m3stg_expadd_lte_0_inv; // mul stage 3 exponent adder sum <= 0
103output [12:0]   m4stg_exp;              // exponent input- multiply 4 stage
104output [12:0]   m5stg_exp;              // exponent input- multiply 5 stage
105output [10:0]   mul_exp_out;            // multiply exponent output
106
107input           se;                     // scan_enable
108input           si;                     // scan in
109output          so;                     // scan out
110
111
112wire [10:0]     m1stg_exp_in1;
113wire [10:0]     m1stg_exp_in2;
114wire [12:0]     m1stg_expadd_in1;
115wire [12:0]     m1stg_expadd_in2;
116wire [12:0]     m1stg_expadd;
117wire [12:0]     m2stg_exp_in;
118wire [12:0]     m2stg_exp;
119wire [12:0]     m2stg_expadd_in2;
120wire [12:0]     m2stg_expadd;
121wire [12:0]     m3astg_exp;
122wire [12:0]     m3bstg_exp;
123wire [12:0]     m3stg_exp;
124wire [12:0]     m3stg_expa;
125wire [12:0]     m3stg_expadd;
126wire            m3stg_expadd_eq_0;
127wire            m3stg_expadd_lte_0_inv;
128wire [12:0]     m4stg_exp_in;
129wire [12:0]     m4stg_exp;
130wire [12:0]     m4stg_exp_plus1;
131wire [12:0]     m5stg_exp_pre1_in;
132wire [12:0]     m5stg_exp_pre1;
133wire [12:0]     m5stg_exp_pre2_in;
134wire [12:0]     m5stg_exp_pre2;
135wire [12:0]     m5stg_exp_pre3_in;
136wire [12:0]     m5stg_exp_pre3;
137wire [12:0]     m5stg_exp;
138wire [12:0]     m5stg_expa;
139wire [12:0]     m5stg_exp_plus1;
140wire [10:0]     mul_exp_out_in;
141wire [10:0]     mul_exp_out;
142
143
144wire se_l;
145
146assign se_l = ~se;
147
148clken_buf  ckbuf_mul_exp_dp (
149  .clk(clk),
150  .rclk(rclk),
151  .enb_l(fmul_clken_l),
152  .tmb_l(se_l)
153  );
154
155///////////////////////////////////////////////////////////////////////////////
156//
157//      Multiply exponent inputs.
158//
159///////////////////////////////////////////////////////////////////////////////
160
161dffe_s #(11) i_m1stg_exp_in1 (
162        .din    (inq_in1[62:52]),
163        .en     (m6stg_step),
164        .clk    (clk),
165 
166        .q      (m1stg_exp_in1[10:0]),
167
168        .se     (se),
169        .si     (),
170        .so     ()
171);
172
173dffe_s #(11) i_m1stg_exp_in2 (
174        .din    (inq_in2[62:52]),
175        .en     (m6stg_step),
176        .clk    (clk),
177 
178        .q      (m1stg_exp_in2[10:0]),
179
180        .se     (se),
181        .si     (),
182        .so     ()
183);
184
185
186///////////////////////////////////////////////////////////////////////////////
187//
188//      Multiply exponent adder.
189//
190//      Multiply stage 1.
191//
192///////////////////////////////////////////////////////////////////////////////
193
194assign m1stg_expadd_in1[12:0]= ({13{m1stg_dblop}}
195                            & {2'b0, m1stg_exp_in1[10:0]})
196                | ({13{m1stg_sngop}}
197                            & {5'b0, m1stg_exp_in1[10:3]});
198
199assign m1stg_expadd_in2[12:0]= ({13{m1stg_dblop}}
200                            & {2'b0, m1stg_exp_in2[10:0]})
201                | ({13{m1stg_sngop}}
202                            & {5'b0, m1stg_exp_in2[10:3]});
203
204assign m1stg_expadd[12:0]= (m1stg_expadd_in1[12:0]
205                        + m1stg_expadd_in2[12:0]
206                        + 13'h0001);
207
208assign m2stg_exp_in[12:0]= ({13{m2stg_exp_expadd}}
209                            & m1stg_expadd[12:0])
210                | ({13{m2stg_exp_0bff}}
211                            & 13'h0bff)
212                | ({13{m2stg_exp_017f}}
213                            & 13'h017f)
214                | ({13{m2stg_exp_04ff}}
215                            & 13'h04ff)
216                | ({13{m2stg_exp_zero}}
217                            & {{3{m1stg_fsmuld}}, 10'b0});
218
219dffe_s #(13) i_m2stg_exp (
220        .din    (m2stg_exp_in[12:0]),
221        .en     (m6stg_step),
222        .clk    (clk),
223
224        .q      (m2stg_exp[12:0]),
225
226        .se     (se),
227        .si     (),
228        .so     ()
229);
230
231
232///////////////////////////////////////////////////////////////////////////////
233//
234//      Multiply exponent adder.
235//
236//      Multiply stage 2.
237//
238///////////////////////////////////////////////////////////////////////////////
239
240assign m2stg_expadd_in2[12:0]= ({13{m2stg_fmuld}}
241                            & 13'h1c00)
242                | ({13{m2stg_fmuls}}
243                            & 13'h1f80)
244                | ({13{m2stg_fsmuld}}
245                            & 13'h0300);
246
247assign m2stg_expadd[12:0]= m2stg_exp[12:0]
248                        + m2stg_expadd_in2[12:0];
249
250dffe_s #(13) i_m3astg_exp (
251        .din    (m2stg_expadd[12:0]),
252        .en     (m6stg_step),
253        .clk    (clk),
254
255        .q      (m3astg_exp[12:0]),
256
257        .se     (se),
258        .si     (),
259        .so     ()
260);
261
262
263///////////////////////////////////////////////////////////////////////////////
264//
265//      Multiply exponent.
266//
267//      Multiply stage 3a.
268//
269///////////////////////////////////////////////////////////////////////////////
270
271dffe_s #(13) i_m3bstg_exp (
272        .din    (m3astg_exp[12:0]),
273        .en     (m6stg_step),
274        .clk    (clk),
275
276        .q      (m3bstg_exp[12:0]),
277
278        .se     (se),
279        .si     (),
280        .so     ()
281);
282
283
284///////////////////////////////////////////////////////////////////////////////
285//
286//      Multiply exponent.
287//
288//      Multiply stage 3b.
289//
290///////////////////////////////////////////////////////////////////////////////
291
292dffe_s #(13) i_m3stg_exp (
293        .din    (m3bstg_exp[12:0]),
294        .en     (m6stg_step),
295        .clk    (clk),
296
297        .q      (m3stg_exp[12:0]),
298 
299        .se     (se),
300        .si     (),
301        .so     ()
302);
303
304dffe_s #(13) i_m3stg_expa (
305        .din    (m3bstg_exp[12:0]),
306        .en     (m6stg_step),
307        .clk    (clk),
308
309        .q      (m3stg_expa[12:0]),
310
311        .se     (se),
312        .si     (),
313        .so     ()
314);
315
316
317///////////////////////////////////////////////////////////////////////////////
318//
319//      Multiply exponent adder.
320//
321//      Multiply stage 3.
322//
323///////////////////////////////////////////////////////////////////////////////
324
325assign m3stg_expadd[12:0]= (m3stg_expa[12:0]
326                        + {6'h3f, m3stg_ld0_inv[6:0]}
327                        + 13'h0001);
328
329assign m3stg_expadd_eq_0= (&(m3stg_exp[12:0] ^ {6'h3f, m3stg_ld0_inv[6:0]}));
330
331assign m3stg_expadd_lte_0_inv= (!(m3stg_expadd[12] || m3stg_expadd_eq_0));
332
333assign m4stg_exp_in[12:0]= (m3stg_expadd[12:0] & {13{(!m3stg_expadd[12])}});
334
335dffe_s #(13) i_m4stg_exp (
336        .din    (m4stg_exp_in[12:0]),
337        .en     (m6stg_step),
338        .clk    (clk),
339
340        .q      (m4stg_exp[12:0]),
341
342        .se     (se),
343        .si     (),
344        .so     ()
345);
346
347
348///////////////////////////////////////////////////////////////////////////////
349//
350//      Multiply exponent increment.
351//
352//      Multiply stage 4.
353//
354///////////////////////////////////////////////////////////////////////////////
355
356assign m4stg_exp_plus1[12:0]= m4stg_exp[12:0]
357                        + 13'h0001;
358
359
360// Austin update
361// uarch timing fix
362// Endpoint: fpu_mul_exp_dp/i_m5stg_exp_pre2_10
363
364// assign m5stg_exp_pre1_in[12:0]= (~({13{m4stg_inc_exp}}
365//                          & m4stg_exp_plus1[12:0]));
366
367assign m5stg_exp_pre1_in[12:0]= ( ({13{m6stg_step}}
368                            & m4stg_exp_plus1[12:0]));
369
370dff_s #(13) i_m5stg_exp_pre1 (
371        .din    (m5stg_exp_pre1_in[12:0]),
372        .clk    (clk),
373 
374        .q      (m5stg_exp_pre1[12:0]),
375 
376        .se     (se),
377        .si     (),
378        .so     ()
379);
380
381
382// Austin update
383// uarch timing fix
384// Endpoint: fpu_mul_exp_dp/i_m5stg_exp_pre2_10
385
386// assign m5stg_exp_pre2_in[12:0]= (~({13{m4stg_inc_exp_inv}}
387//                          & m4stg_exp[12:0]));
388
389assign m5stg_exp_pre2_in[12:0]= ( ({13{m6stg_step}}
390                            & m4stg_exp[12:0]));
391
392dff_s #(13) i_m5stg_exp_pre2 (
393        .din    (m5stg_exp_pre2_in[12:0]),
394        .clk    (clk),
395
396        .q      (m5stg_exp_pre2[12:0]),
397
398        .se     (se),
399         .si    (),
400        .so     ()
401);
402
403assign m5stg_exp_pre3_in[12:0]= (~({13{(!m6stg_step)}}
404                            & m5stg_expa[12:0]));
405
406dff_s #(13) i_m5stg_exp_pre3 (
407        .din    (m5stg_exp_pre3_in[12:0]),
408        .clk    (clk),
409
410        .q      (m5stg_exp_pre3[12:0]),
411
412        .se     (se),
413         .si    (),
414        .so     ()
415);
416
417
418// Austin update
419// uarch timing fix
420// Endpoint: fpu_mul_exp_dp/i_m5stg_exp_pre2_10
421
422//assign m5stg_exp[12:0]= (~m5stg_exp_pre1[12:0])
423//              | (~m5stg_exp_pre2[12:0])
424//              | (~m5stg_exp_pre3[12:0]);
425
426dff_s #(5) i_m5stg_inc_exp (
427        .din    ({m4stg_shl_55,m4stg_shl_54,
428                  m4stg_inc_exp_54,m4stg_inc_exp_55,m4stg_inc_exp_105}),
429        .clk    (clk),
430
431        .q      ({m5stg_shl_55,m5stg_shl_54,
432                  m5stg_inc_exp_54,m5stg_inc_exp_55,m5stg_inc_exp_105}),
433
434        .se     (se),
435        .si     (),
436        .so     ()
437);
438
439assign m5stg_exp[12:0] =
440
441          ( {13{((m5stg_shl_54 & m5stg_inc_exp_54) |
442                 (m5stg_shl_55 & m5stg_inc_exp_55) |
443                 (m5stg_inc_exp_105)                )}} & m5stg_exp_pre1[12:0]) |
444
445          (~{13{((m5stg_shl_54 & m5stg_inc_exp_54) |
446                 (m5stg_shl_55 & m5stg_inc_exp_55) |
447                 (m5stg_inc_exp_105)                )}} & m5stg_exp_pre2[12:0]) |
448
449         ~(m5stg_exp_pre3[12:0]);
450
451
452assign m5stg_expa[12:0]= m5stg_exp[12:0];
453
454
455///////////////////////////////////////////////////////////////////////////////
456//
457//      Multiply rounding.
458//      Multiply stage 5.
459//
460///////////////////////////////////////////////////////////////////////////////
461 
462assign m5stg_exp_plus1[12:0]= m5stg_expa[12:0]
463                        + 13'h0001;
464
465assign mul_exp_out_in[10:0]= ({11{(mul_exp_out_exp_plus1
466                                        && m5stg_fracadd_cout)}}
467                            & m5stg_exp_plus1[10:0])
468                | ({11{mul_exp_out_exp}}
469                            & m5stg_expa[10:0])
470                | ({11{((!m5stg_fracadd_cout) && (!m5stg_in_of))}}
471                            & m5stg_expa[10:0])
472                | ({11{m5stg_in_of}}
473                            & {{3{m5stg_fmuld}}, 7'h7f, m5stg_to_0_inv});
474
475
476dffe_s #(11) i_mul_exp_out (
477        .din    (mul_exp_out_in[10:0]),
478        .en     (m6stg_step),
479        .clk    (clk),
480
481        .q      (mul_exp_out[10:0]),
482
483        .se     (se),
484        .si     (),
485        .so     ()
486);
487
488
489endmodule
490
491
Note: See TracBrowser for help on using the repository browser.