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

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

versione iniziale opensparc

Line 
1// ========== 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
27module 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
75input [62:52]   inq_in1;                // request operand 1 to op pipes
76input [62:52]   inq_in2;                // request operand 2 to op pipes
77input           d1stg_step;             // divide pipe load
78input           d234stg_fdiv;           // select line to div_expadd1
79input           div_expadd1_in1_dbl;    // select line to div_expadd1
80input           div_expadd1_in1_sng;    // select line to div_expadd1
81input           div_expadd1_in2_exp_in2_dbl; // select line to div_expadd1
82input           div_expadd1_in2_exp_in2_sng; //select line to div_expadd1
83input           d3stg_fdiv;             // divide operation- divide stage 3
84input           d4stg_fdiv;             // divide operation- divide stage 4
85input [5:0]     div_shl_cnt;            // divide left shift amount
86input           div_exp1_expadd1;       // select line to div_exp1
87input           div_exp1_0835;          // select line to div_exp1
88input           div_exp1_0118;          // select line to div_exp1
89input           div_exp1_zero;          // select line to div_exp1
90input           div_exp1_load;          // load enable to div_exp1
91input           div_expadd2_in1_exp_out; // select line to div_expadd2
92input           d5stg_fdiva;            // divide operation- divide stage 5
93input           d5stg_fdivd;            // divide double- divide stage 5
94input           d5stg_fdivs;            // divide single- divide stage 5
95input           d6stg_fdiv;             // divide operation- divide stage 6
96input           d7stg_fdiv;             // divide operation- divide stage 7
97input           div_expadd2_no_decr_inv; // no exponent decrement
98input           div_expadd2_cin;        // carry in to 2nd exponent adder
99input           div_exp_out_expadd2;    // select line to div_exp_out
100input           div_exp_out_expadd22_inv; // select line to div_exp_out
101input           div_exp_out_of;         // overflow to exponent output
102input           d7stg_to_0_inv;         // result to infinity on overflow
103input           d7stg_fdivd;            // divide double- divide stage 7
104input           div_exp_out_exp_out;    // select line to div_exp_out
105input           d7stg_rndup_inv;        // no rounding increment
106input           div_frac_add_52_inv;    // div_frac_add bit[52] inverted
107input           div_exp_out_load;       // load enable to div_exp_out
108input           fdiv_clken_l;           // div pipe clk enable - asserted low
109input           rclk;           // global clock
110
111output [12:0]   div_exp1;               // divide exponent- intermediate value
112output          div_expadd2_12;         // divide exponent- 2nd adder output
113output [12:0]   div_exp_out;            // divide exponent output
114output [10:0]   div_exp_outa;           // divide exponent output- buffered copy
115
116input           se;                     // scan_enable
117input           si;                     // scan in
118output          so;                     // scan out
119
120
121wire [10:0]     div_exp_in1;
122wire [10:0]     div_exp_in2;
123wire [12:0]     div_expadd1_in1;
124wire [12:0]     div_expadd1_in2;
125wire [12:0]     div_expadd1;
126wire [12:0]     div_exp1_in;
127wire [12:0]     div_exp1;
128wire [12:0]     div_expadd2_in1;
129wire [12:0]     div_expadd2_in2;
130wire [12:0]     div_expadd2;
131wire            div_expadd2_12;
132wire [12:0]     div_exp_out_in;
133wire [12:0]     div_exp_out;
134wire [10:0]     div_exp_outa;
135
136
137wire se_l;
138
139assign se_l = ~se;
140
141clken_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
154dffe_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
166dffe_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
185assign 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
192assign 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
205assign div_expadd1[12:0]= (div_expadd1_in1[12:0]
206                        + div_expadd1_in2[12:0]);
207
208assign 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
217dffe_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
236assign 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
241assign 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
249assign div_expadd2[12:0]= (div_expadd2_in1[12:0]
250                        + div_expadd2_in2[12:0]
251                        + {12'b0, div_expadd2_cin});
252assign div_expadd2_12 = div_expadd2[12];
253
254assign 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
264dffe_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
276assign div_exp_outa[10:0]= div_exp_out[10:0];
277
278
279endmodule
280
281
Note: See TracBrowser for help on using the repository browser.