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

Subversion Repositories sparc64soc

[/] [sparc64soc/] [trunk/] [T1-FPU/] [fpu_div_frac_dp.v] - Blame information for rev 3

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dmitryr
// ========== Copyright Header Begin ==========================================
2
// 
3
// OpenSPARC T1 Processor File: fpu_div_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
//      Divide pipeline fraction datapath.
24
//
25
///////////////////////////////////////////////////////////////////////////////
26
 
27
 
28
module fpu_div_frac_dp (
29
        inq_in1,
30
        inq_in2,
31
        d1stg_step,
32
        div_norm_frac_in1_dbl_norm,
33
        div_norm_frac_in1_dbl_dnrm,
34
        div_norm_frac_in1_sng_norm,
35
        div_norm_frac_in1_sng_dnrm,
36
        div_norm_frac_in2_dbl_norm,
37
        div_norm_frac_in2_dbl_dnrm,
38
        div_norm_frac_in2_sng_norm,
39
        div_norm_frac_in2_sng_dnrm,
40
        div_norm_inf,
41
        div_norm_qnan,
42
        d1stg_dblop,
43
        div_norm_zero,
44
        d1stg_snan_dbl_in1,
45
        d1stg_snan_sng_in1,
46
        d1stg_snan_dbl_in2,
47
        d1stg_snan_sng_in2,
48
        d3stg_fdiv,
49
        d6stg_fdiv,
50
        d6stg_fdivd,
51
        d6stg_fdivs,
52
        div_frac_add_in2_load,
53
        d6stg_frac_out_shl1,
54
        d6stg_frac_out_nosh,
55
        d4stg_fdiv,
56
        div_frac_add_in1_add,
57
        div_frac_add_in1_load,
58
        d5stg_fdivb,
59
        div_frac_out_add_in1,
60
        div_frac_out_add,
61
        div_frac_out_shl1_dbl,
62
        div_frac_out_shl1_sng,
63
        div_frac_out_of,
64
        d7stg_to_0,
65
        div_frac_out_load,
66
        fdiv_clken_l,
67
        rclk,
68
 
69
        div_shl_cnt,
70
        d6stg_frac_0,
71
        d6stg_frac_1,
72
        d6stg_frac_2,
73
        d6stg_frac_29,
74
        d6stg_frac_30,
75
        d6stg_frac_31,
76
        div_frac_add_in1_neq_0,
77
        div_frac_add_52_inv,
78
        div_frac_add_52_inva,
79
        div_frac_out_54_53,
80
        div_frac_outa,
81
 
82
        se,
83
        si,
84
        so
85
);
86
 
87
 
88
input [54:0]     inq_in1;                // request operand 1 to op pipes
89
input [54:0]     inq_in2;                // request operand 2 to op pipes
90
input           d1stg_step;             // divide pipe load
91
input           div_norm_frac_in1_dbl_norm; // select line to div_norm
92
input           div_norm_frac_in1_dbl_dnrm; // select line to div_norm
93
input           div_norm_frac_in1_sng_norm; // select line to div_norm
94
input           div_norm_frac_in1_sng_dnrm; // select line to div_norm
95
input           div_norm_frac_in2_dbl_norm; // select line to div_norm
96
input           div_norm_frac_in2_dbl_dnrm; // select line to div_norm
97
input           div_norm_frac_in2_sng_norm; // select line to div_norm
98
input           div_norm_frac_in2_sng_dnrm; // select line to div_norm
99
input           div_norm_inf;           // select line to div_norm
100
input           div_norm_qnan;          // select line to div_norm
101
input           d1stg_dblop;            // double precision operation- d1 stg
102
input           div_norm_zero;          // select line to div_norm
103
input           d1stg_snan_dbl_in1;     // operand 1 is double signalling NaN
104
input           d1stg_snan_sng_in1;     // operand 1 is single signalling NaN
105
input           d1stg_snan_dbl_in2;     // operand 2 is double signalling NaN
106
input           d1stg_snan_sng_in2;     // operand 2 is single signalling NaN
107
input           d3stg_fdiv;             // divide operation- divide stage 3
108
input           d6stg_fdiv;             // divide operation- divide stage 6
109
input           d6stg_fdivd;            // divide double- divide stage 6
110
input           d6stg_fdivs;            // divide single- divide stage 6
111
input           div_frac_add_in2_load;  // load enable to div_frac_add_in2
112
input           d6stg_frac_out_shl1;    // select line to d6stg_frac
113
input           d6stg_frac_out_nosh;    // select line to d6stg_frac
114
input           d4stg_fdiv;             // divide operation- divide stage 4
115
input           div_frac_add_in1_add;   // select line to div_frac_add_in1
116
input           div_frac_add_in1_load;  // load enable to div_frac_add_in1
117
input           d5stg_fdivb;            // divide operation- divide stage 5
118
input           div_frac_out_add_in1;   // select line to div_frac_out
119
input           div_frac_out_add;       // select line to div_frac_out
120
input           div_frac_out_shl1_dbl;  // select line to div_frac_out
121
input           div_frac_out_shl1_sng;  // select line to div_frac_out
122
input           div_frac_out_of;        // select line to div_frac_out
123
input           d7stg_to_0;             // result to max finite on overflow
124
input           div_frac_out_load;      // load enable to div_frac_out
125
input           fdiv_clken_l;           // div pipe clk enable - asserted low
126
input           rclk;           // global clock
127
 
128
output [5:0]     div_shl_cnt;            // divide left shift amount
129
output          d6stg_frac_0;           // divide fraction[0]- intermediate val
130
output          d6stg_frac_1;           // divide fraction[1]- intermediate val
131
output          d6stg_frac_2;           // divide fraction[2]- intermediate val
132
output          d6stg_frac_29;          // divide fraction[29]- intermediate val
133
output          d6stg_frac_30;          // divide fraction[30]- intermediate val
134
output          d6stg_frac_31;          // divide fraction[31]- intermediate val
135
output          div_frac_add_in1_neq_0; // div_frac_add_in1 != 0
136
output          div_frac_add_52_inv;    // div_frac_add bit[52] inverted
137
output          div_frac_add_52_inva;   // div_frac_add bit[52] inverted copy
138
output [1:0]     div_frac_out_54_53;     // divide fraction output
139
output [51:0]    div_frac_outa;          // divide fraction output- buffered copy
140
 
141
input           se;                     // scan_enable
142
input           si;                     // scan in
143
output          so;                     // scan out
144
 
145
 
146
wire [54:0]      div_frac_in1;
147
wire [54:0]      div_frac_in2;
148
wire [52:0]      div_norm_inv_in;
149
wire [52:0]      div_norm_inv;
150
wire [52:0]      div_norm;
151
wire [5:0]       div_lead0;
152
wire [5:0]       div_shl_cnt;
153
wire [5:0]       div_shl_cnta;
154
wire [52:0]      div_shl_data;
155
wire [105:53]   div_shl_tmp;
156
wire [52:0]      div_shl;
157
wire [54:0]      div_shl_save;
158
wire [54:0]      div_frac_add_in2_in;
159
wire [54:0]      div_frac_add_in2;
160
wire [53:0]      d6stg_frac;
161
wire            d6stg_frac_0;
162
wire            d6stg_frac_1;
163
wire            d6stg_frac_2;
164
wire            d6stg_frac_29;
165
wire            d6stg_frac_30;
166
wire            d6stg_frac_31;
167
wire [54:0]      div_frac_add_in1_in;
168
wire [54:0]      div_frac_add_in1;
169
wire [54:0]      div_frac_add_in1a;
170
wire            div_frac_add_in1_neq_0;
171
wire [54:0]      div_frac_add;
172
wire            div_frac_add_52_inv;
173
wire            div_frac_add_52_inva;
174
wire [54:0]      div_frac_out_in;
175
wire  [1:0]     div_frac_out_54_53;
176
wire [54:0]      div_frac_out;
177
wire [51:0]      div_frac_outa;
178
 
179
 
180
wire se_l;
181
 
182
assign se_l = ~se;
183
 
184
clken_buf  ckbuf_div_frac_dp (
185
  .clk(clk),
186
  .rclk(rclk),
187
  .enb_l(fdiv_clken_l),
188
  .tmb_l(se_l)
189
  );
190
 
191
///////////////////////////////////////////////////////////////////////////////
192
//
193
//      Divide fraction inputs.
194
//
195
///////////////////////////////////////////////////////////////////////////////
196
 
197
dffe_s #(55) i_div_frac_in1 (
198
        .din    (inq_in1[54:0]),
199
        .en     (d1stg_step),
200
        .clk    (clk),
201
 
202
        .q      (div_frac_in1[54:0]),
203
 
204
        .se     (se),
205
        .si     (),
206
        .so     ()
207
);
208
 
209
dffe_s #(55) i_div_frac_in2 (
210
        .din    (inq_in2[54:0]),
211
        .en     (d1stg_step),
212
        .clk    (clk),
213
 
214
        .q      (div_frac_in2[54:0]),
215
 
216
        .se     (se),
217
        .si     (),
218
        .so     ()
219
);
220
 
221
 
222
///////////////////////////////////////////////////////////////////////////////
223
//
224
//      Divide normalization and special input injection.
225
//
226
///////////////////////////////////////////////////////////////////////////////
227
 
228
assign div_norm_inv_in[52:0]= (~(({53{div_norm_frac_in1_dbl_norm}}
229
                            & {1'b1, (div_frac_in1[51] || d1stg_snan_dbl_in1),
230
                                div_frac_in1[50:0]})
231
                | ({53{div_norm_frac_in1_dbl_dnrm}}
232
                            & {div_frac_in1[51:0], 1'b0})
233
                | ({53{div_norm_frac_in1_sng_norm}}
234
                            & {1'b1, (div_frac_in1[54] || d1stg_snan_sng_in1),
235
                                div_frac_in1[53:32], 29'b0})
236
                | ({53{div_norm_frac_in1_sng_dnrm}}
237
                            & {div_frac_in1[54:32], 30'b0})
238
                | ({53{div_norm_frac_in2_dbl_norm}}
239
                            & {1'b1, (div_frac_in2[51] || d1stg_snan_dbl_in2),
240
                                div_frac_in2[50:0]})
241
                | ({53{div_norm_frac_in2_dbl_dnrm}}
242
                            & {div_frac_in2[51:0], 1'b0})
243
                | ({53{div_norm_frac_in2_sng_norm}}
244
                            & {1'b1, (div_frac_in2[54] || d1stg_snan_sng_in2),
245
                                div_frac_in2[53:32], 29'b0})
246
                | ({53{div_norm_frac_in2_sng_dnrm}}
247
                            & {div_frac_in2[54:32], 30'b0})
248
                | ({53{div_norm_inf}}
249
                            & 53'h10000000000000)
250
                | ({53{div_norm_qnan}}
251
                            & {24'hffffff, {29{d1stg_dblop}}})
252
                | ({53{div_norm_zero}}
253
                            & 53'h00000000000000)));
254
 
255
dff_s #(53) i_div_norm_inv (
256
        .din    (div_norm_inv_in[52:0]),
257
        .clk    (clk),
258
 
259
        .q      (div_norm_inv[52:0]),
260
 
261
        .se     (se),
262
        .si     (),
263
        .so     ()
264
);
265
 
266
assign div_norm[52:0]= (~div_norm_inv);
267
 
268
 
269
///////////////////////////////////////////////////////////////////////////////
270
//
271
//      Divide lead zero count.
272
//
273
///////////////////////////////////////////////////////////////////////////////
274
 
275
 
276
fpu_cnt_lead0_53b i_div_lead0 (
277
        .din    (div_norm[52:0]),
278
 
279
        .lead0 (div_lead0[5:0])
280
);
281
 
282
dff_s #12 i_dstg_xtra_regs (
283
        .din    ({div_lead0[5:0], div_lead0[5:0]}),
284
        .clk    (clk),
285
 
286
        .q      ({div_shl_cnta[5:0], div_shl_cnt[5:0]}),
287
 
288
        .se     (se),
289
        .si     (),
290
        .so     ()
291
);
292
 
293
 
294
///////////////////////////////////////////////////////////////////////////////
295
//
296
//      Divide left shift.
297
//
298
///////////////////////////////////////////////////////////////////////////////
299
 
300
dff_s #(53) i_div_shl_data (
301
        .din    (div_norm[52:0]),
302
        .clk    (clk),
303
 
304
        .q      (div_shl_data[52:0]),
305
 
306
        .se     (se),
307
        .si     (),
308
        .so     ()
309
);
310
 
311
//assign div_shl_tmp[105:0]= {div_shl_data[52:0], 53'b0} << div_shl_cnta[5:0];
312
  assign div_shl_tmp[105:53]= div_shl_data[52:0]         << div_shl_cnta[5:0];
313
 
314
assign div_shl[52:0]= div_shl_tmp[105:53];
315
 
316
dffe_s #(55) i_div_shl_save (
317
        .din    ({2'b0, div_shl[52:0]}),
318
        .en     (d3stg_fdiv),
319
        .clk    (clk),
320
 
321
        .q      (div_shl_save[54:0]),
322
 
323
        .se     (se),
324
        .si     (),
325
        .so     ()
326
);
327
 
328
assign div_frac_add_in2_in[54:0]= ({55{d4stg_fdiv}}
329
                            & (~{2'b0, div_shl[52:0]}))
330
                | ({55{d6stg_fdiv}}
331
                            & {25'b0, d6stg_fdivs, 28'b0, d6stg_fdivd});
332
 
333
dffe_s #(55) i_div_frac_add_in2 (
334
        .din    (div_frac_add_in2_in[54:0]),
335
        .en     (div_frac_add_in2_load),
336
        .clk    (clk),
337
 
338
        .q      (div_frac_add_in2[54:0]),
339
 
340
        .se     (se),
341
        .si     (),
342
        .so     ()
343
);
344
 
345
 
346
///////////////////////////////////////////////////////////////////////////////
347
//
348
//      Divide adder/subtractor 2nd input.
349
//
350
///////////////////////////////////////////////////////////////////////////////
351
 
352
assign d6stg_frac[53:0]= ({54{d6stg_frac_out_shl1}}
353
                            & {div_frac_out[52:0], 1'b0})
354
                | ({54{d6stg_frac_out_nosh}}
355
                            & div_frac_out[53:0]);
356
 
357
assign d6stg_frac_0= d6stg_frac[0];
358
assign d6stg_frac_1= d6stg_frac[1];
359
assign d6stg_frac_2= d6stg_frac[2];
360
assign d6stg_frac_29= d6stg_frac[29];
361
assign d6stg_frac_30= d6stg_frac[30];
362
assign d6stg_frac_31= d6stg_frac[31];
363
 
364
assign div_frac_add_in1_in[54:0]= ({55{d4stg_fdiv}}
365
                            & div_shl_save[54:0])
366
                | ({55{(div_frac_add_in1_add && (!div_frac_add[54]))}}
367
                            & {div_frac_add[53:0], 1'b0})
368
                | ({55{(div_frac_add_in1_add && div_frac_add[54])}}
369
                            & {div_frac_add_in1[53:0], 1'b0})
370
                | ({55{d6stg_fdiv}}
371
                            & {3'b0, d6stg_frac[53:31],
372
                                (d6stg_frac[30:2] & {29{d6stg_fdivd}})});
373
 
374
dffe_s #(55) i_div_frac_add_in1 (
375
        .din    (div_frac_add_in1_in[54:0]),
376
        .en     (div_frac_add_in1_load),
377
        .clk    (clk),
378
 
379
        .q      (div_frac_add_in1[54:0]),
380
 
381
        .se     (se),
382
        .si     (),
383
        .so     ()
384
);
385
 
386
dffe_s #(55) i_div_frac_add_in1a (
387
        .din    (div_frac_add_in1_in[54:0]),
388
        .en     (div_frac_add_in1_load),
389
        .clk    (clk),
390
 
391
        .q      (div_frac_add_in1a[54:0]),
392
 
393
        .se     (se),
394
        .si     (),
395
        .so     ()
396
);
397
 
398
assign div_frac_add_in1_neq_0= (|div_frac_add_in1[54:0]);
399
 
400
 
401
///////////////////////////////////////////////////////////////////////////////
402
//
403
//      Divide adder/subtractor.
404
//
405
///////////////////////////////////////////////////////////////////////////////
406
 
407
assign div_frac_add[54:0]= (div_frac_add_in1a[54:0]
408
                        + div_frac_add_in2[54:0]
409
                        + {54'b0, d5stg_fdivb});
410
 
411
assign div_frac_add_52_inv= (!div_frac_add[52]);
412
assign div_frac_add_52_inva= (!div_frac_add[52]);
413
 
414
assign div_frac_out_in[54:0]= ({55{d4stg_fdiv}}
415
                            & 55'b0)
416
                | ({55{div_frac_out_add_in1}}
417
                            & div_frac_add_in1[54:0])
418
                | ({55{div_frac_out_add}}
419
                            & div_frac_add[54:0])
420
                | ({55{div_frac_out_shl1_dbl}}
421
                            & {div_frac_out[53:0], (!div_frac_add[54])})
422
                | ({55{div_frac_out_shl1_sng}}
423
                            & {div_frac_out[53:29], (!div_frac_add[54]), 29'b0})
424
                | ({55{div_frac_out_of}}
425
                            & {55{d7stg_to_0}});
426
 
427
dffe_s #(55) i_div_frac_out (
428
        .din    (div_frac_out_in[54:0]),
429
        .en     (div_frac_out_load),
430
        .clk    (clk),
431
 
432
        .q      (div_frac_out[54:0]),
433
 
434
        .se     (se),
435
        .si     (),
436
        .so     ()
437
);
438
 
439
assign div_frac_out_54_53[1:0] = div_frac_out[54:53];
440
 
441
assign div_frac_outa[51:0]= div_frac_out[51:0];
442
 
443
endmodule
444
 
445
 

powered by: WebSVN 2.1.0

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