OpenCores
URL https://opencores.org/ocsvn/sparc64soc/sparc64soc/trunk

Subversion Repositories sparc64soc

[/] [sparc64soc/] [trunk/] [T1-FPU/] [fpu_mul_exp_dp.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dmitryr
// ========== 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
 
28
module 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
 
71
input [62:52]   inq_in1;                // request operand 1 to op pipes
72
input [62:52]   inq_in2;                // request operand 2 to op pipes
73
input           m6stg_step;             // advance the multiply pipe
74
input           m1stg_dblop;            // double precision operation- mul 1 stg
75
input           m1stg_sngop;            // single precision operation- mul 1 stg
76
input           m2stg_exp_expadd;       // select line to m2stg_exp
77
input           m2stg_exp_0bff;         // select line to m2stg_exp
78
input           m2stg_exp_017f;         // select line to m2stg_exp
79
input           m2stg_exp_04ff;         // select line to m2stg_exp
80
input           m2stg_exp_zero;         // select line to m2stg_exp
81
input           m1stg_fsmuld;           // fsmuld- multiply 1 stage
82
input           m2stg_fmuld;            // fmuld- multiply 2 stage
83
input           m2stg_fmuls;            // fmuls- multiply 2 stage
84
input           m2stg_fsmuld;           // fsmuld- multiply 2 stage
85
input [6:0]      m3stg_ld0_inv;          // leading 0's in multiply operands
86
input           m4stg_inc_exp_54;       // select line to m5stg_exp
87
input           m4stg_inc_exp_55;       // select line to m5stg_exp
88
input           m4stg_inc_exp_105;      // select line to m5stg_exp
89
input           m5stg_fracadd_cout;     // fraction rounding adder carry out
90
input           mul_exp_out_exp_plus1;  // select line to mul_exp_out
91
input           mul_exp_out_exp;        // select line to mul_exp_out
92
input           m5stg_in_of;            // multiply overflow- select exp out
93
input           m5stg_fmuld;            // fmuld- multiply 5 stage
94
input           m5stg_to_0_inv;         // result to infinity on overflow
95
input           m4stg_shl_54;           // multiply shift left output bit[54]
96
input           m4stg_shl_55;           // multiply shift left output bit[55]
97
input           fmul_clken_l;           // multiply pipe clk enable - asserted low
98
input           rclk;           // global clock
99
 
100
output [12:0]    m3stg_exp;              // exponent input- multiply 3 stage
101
output          m3stg_expadd_eq_0;      // mul stage 3 exponent adder sum == 0
102
output          m3stg_expadd_lte_0_inv; // mul stage 3 exponent adder sum <= 0
103
output [12:0]    m4stg_exp;              // exponent input- multiply 4 stage
104
output [12:0]    m5stg_exp;              // exponent input- multiply 5 stage
105
output [10:0]    mul_exp_out;            // multiply exponent output
106
 
107
input           se;                     // scan_enable
108
input           si;                     // scan in
109
output          so;                     // scan out
110
 
111
 
112
wire [10:0]      m1stg_exp_in1;
113
wire [10:0]      m1stg_exp_in2;
114
wire [12:0]      m1stg_expadd_in1;
115
wire [12:0]      m1stg_expadd_in2;
116
wire [12:0]      m1stg_expadd;
117
wire [12:0]      m2stg_exp_in;
118
wire [12:0]      m2stg_exp;
119
wire [12:0]      m2stg_expadd_in2;
120
wire [12:0]      m2stg_expadd;
121
wire [12:0]      m3astg_exp;
122
wire [12:0]      m3bstg_exp;
123
wire [12:0]      m3stg_exp;
124
wire [12:0]      m3stg_expa;
125
wire [12:0]      m3stg_expadd;
126
wire            m3stg_expadd_eq_0;
127
wire            m3stg_expadd_lte_0_inv;
128
wire [12:0]      m4stg_exp_in;
129
wire [12:0]      m4stg_exp;
130
wire [12:0]      m4stg_exp_plus1;
131
wire [12:0]      m5stg_exp_pre1_in;
132
wire [12:0]      m5stg_exp_pre1;
133
wire [12:0]      m5stg_exp_pre2_in;
134
wire [12:0]      m5stg_exp_pre2;
135
wire [12:0]      m5stg_exp_pre3_in;
136
wire [12:0]      m5stg_exp_pre3;
137
wire [12:0]      m5stg_exp;
138
wire [12:0]      m5stg_expa;
139
wire [12:0]      m5stg_exp_plus1;
140
wire [10:0]      mul_exp_out_in;
141
wire [10:0]      mul_exp_out;
142
 
143
 
144
wire se_l;
145
 
146
assign se_l = ~se;
147
 
148
clken_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
 
161
dffe_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
 
173
dffe_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
 
194
assign 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
 
199
assign 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
 
204
assign m1stg_expadd[12:0]= (m1stg_expadd_in1[12:0]
205
                        + m1stg_expadd_in2[12:0]
206
                        + 13'h0001);
207
 
208
assign 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
 
219
dffe_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
 
240
assign 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
 
247
assign m2stg_expadd[12:0]= m2stg_exp[12:0]
248
                        + m2stg_expadd_in2[12:0];
249
 
250
dffe_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
 
271
dffe_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
 
292
dffe_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
 
304
dffe_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
 
325
assign m3stg_expadd[12:0]= (m3stg_expa[12:0]
326
                        + {6'h3f, m3stg_ld0_inv[6:0]}
327
                        + 13'h0001);
328
 
329
assign m3stg_expadd_eq_0= (&(m3stg_exp[12:0] ^ {6'h3f, m3stg_ld0_inv[6:0]}));
330
 
331
assign m3stg_expadd_lte_0_inv= (!(m3stg_expadd[12] || m3stg_expadd_eq_0));
332
 
333
assign m4stg_exp_in[12:0]= (m3stg_expadd[12:0] & {13{(!m3stg_expadd[12])}});
334
 
335
dffe_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
 
356
assign 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
 
367
assign m5stg_exp_pre1_in[12:0]= ( ({13{m6stg_step}}
368
                            & m4stg_exp_plus1[12:0]));
369
 
370
dff_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
 
389
assign m5stg_exp_pre2_in[12:0]= ( ({13{m6stg_step}}
390
                            & m4stg_exp[12:0]));
391
 
392
dff_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
 
403
assign m5stg_exp_pre3_in[12:0]= (~({13{(!m6stg_step)}}
404
                            & m5stg_expa[12:0]));
405
 
406
dff_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
 
426
dff_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
 
439
assign 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
 
452
assign m5stg_expa[12:0]= m5stg_exp[12:0];
453
 
454
 
455
///////////////////////////////////////////////////////////////////////////////
456
//
457
//      Multiply rounding.
458
//      Multiply stage 5.
459
//
460
///////////////////////////////////////////////////////////////////////////////
461
 
462
assign m5stg_exp_plus1[12:0]= m5stg_expa[12:0]
463
                        + 13'h0001;
464
 
465
assign 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
 
476
dffe_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
 
489
endmodule
490
 
491
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.