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

Revision 6, 6.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_out_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//      FPU output datapath.
24//
25///////////////////////////////////////////////////////////////////////////////
26 
27
28module fpu_out_dp (
29        dest_rdy,
30        req_thread,
31        div_exc_out,
32        d8stg_fdivd,
33        d8stg_fdivs,
34        div_sign_out,
35        div_exp_out,
36        div_frac_out,
37        mul_exc_out,
38        m6stg_fmul_dbl_dst,
39        m6stg_fmuls,
40        mul_sign_out,
41        mul_exp_out,
42        mul_frac_out,
43        add_exc_out,
44        a6stg_fcmpop,
45        add_cc_out,
46        add_fcc_out,
47        a6stg_dbl_dst,
48        a6stg_sng_dst,
49        a6stg_long_dst,
50        a6stg_int_dst,
51        add_sign_out,
52        add_exp_out,
53        add_frac_out,
54        rclk,
55       
56        fp_cpx_data_ca,
57
58        se,
59        si,
60        so
61);
62
63
64input [2:0]     dest_rdy;               // pipe with result request this cycle
65input [1:0]     req_thread;             // thread ID of result req this cycle
66input [4:0]     div_exc_out;            // divide pipe result- exception flags
67input           d8stg_fdivd;            // divide double- divide stage 8
68input           d8stg_fdivs;            // divide single- divide stage 8
69input           div_sign_out;           // divide sign output
70input [10:0]    div_exp_out;            // divide exponent output
71input [51:0]    div_frac_out;           // divide fraction output
72input [4:0]     mul_exc_out;            // multiply pipe result- exception flags
73input           m6stg_fmul_dbl_dst;     // double precision multiply result
74input           m6stg_fmuls;            // fmuls- multiply 6 stage
75input           mul_sign_out;           // multiply sign output
76input [10:0]    mul_exp_out;            // multiply exponent output
77input [51:0]    mul_frac_out;           // multiply fraction output
78input [4:0]     add_exc_out;            // add pipe result- exception flags
79input           a6stg_fcmpop;           // compare- add 6 stage
80input [1:0]     add_cc_out;             // add pipe result- condition
81input [1:0]     add_fcc_out;            // add pipe input fcc passed through
82input           a6stg_dbl_dst;          // float double result- add 6 stage
83input           a6stg_sng_dst;          // float single result- add 6 stage
84input           a6stg_long_dst;         // 64bit integer result- add 6 stage
85input           a6stg_int_dst;          // 32bit integer result- add 6 stage
86input           add_sign_out;           // add sign output
87input [10:0]    add_exp_out;            // add exponent output
88input [63:0]    add_frac_out;           // add fraction output
89input           rclk;           // global clock
90
91output [144:0]  fp_cpx_data_ca;         // FPU result to CPX
92
93input           se;                     // scan_enable
94input           si;                     // scan in
95output          so;                     // scan out
96
97
98wire [63:0]     add_out;
99wire [63:0]     mul_out;
100wire [63:0]     div_out;
101wire [7:0]      fp_cpx_data_ca_84_77_in;
102wire [76:0]     fp_cpx_data_ca_76_0_in;
103wire [7:0]      fp_cpx_data_ca_84_77;
104wire [76:0]     fp_cpx_data_ca_76_0;
105wire [144:0]    fp_cpx_data_ca;
106
107
108wire se_l;
109
110assign se_l = ~se;
111
112clken_buf  ckbuf_out_dp (
113  .clk(clk),
114  .rclk(rclk),
115  .enb_l(1'b0),
116  .tmb_l(se_l)
117  );
118
119///////////////////////////////////////////////////////////////////////////////
120//
121//      Add pipe output.
122//
123///////////////////////////////////////////////////////////////////////////////
124
125assign add_out[63:0]= ({64{a6stg_dbl_dst}}
126                            & {add_sign_out, add_exp_out[10:0],
127                                add_frac_out[62:11]})
128                | ({64{a6stg_sng_dst}}
129                            & {add_sign_out, add_exp_out[7:0],
130                                add_frac_out[62:40], 32'b0})
131                | ({64{a6stg_long_dst}}
132                            & add_frac_out[63:0])
133                | ({64{a6stg_int_dst}}
134                            & {add_frac_out[63:32], 32'b0});
135
136
137///////////////////////////////////////////////////////////////////////////////
138//
139//      Multiply output.
140//
141///////////////////////////////////////////////////////////////////////////////
142
143assign mul_out[63:0]= ({64{m6stg_fmul_dbl_dst}}
144                            & {mul_sign_out, mul_exp_out[10:0],
145                                mul_frac_out[51:0]})
146                | ({64{m6stg_fmuls}}
147                            & {mul_sign_out, mul_exp_out[7:0],
148                                mul_frac_out[51:29], 32'b0});
149
150
151///////////////////////////////////////////////////////////////////////////////
152//
153//      Divide output.
154//
155///////////////////////////////////////////////////////////////////////////////
156
157assign div_out[63:0]= ({64{d8stg_fdivd}}
158                            & {div_sign_out, div_exp_out[10:0],
159                                div_frac_out[51:0]})
160                | ({64{d8stg_fdivs}}
161                            & {div_sign_out, div_exp_out[7:0],
162                                div_frac_out[51:29], 32'b0});
163
164
165///////////////////////////////////////////////////////////////////////////////
166//
167//      Choose the output data.
168//
169//      Input to the CPX data (CA) stage.
170//
171///////////////////////////////////////////////////////////////////////////////
172
173assign fp_cpx_data_ca_84_77_in[7:0]= ({8{(|dest_rdy)}}
174                            & {1'b1, 4'b1000, 1'b0, req_thread[1:0]});
175
176assign fp_cpx_data_ca_76_0_in[76:0]= ({77{dest_rdy[2]}}
177                            & {div_exc_out[4:0], 8'b0, div_out[63:0]})
178                | ({77{dest_rdy[1]}}
179                            & {mul_exc_out[4:0], 8'b0, mul_out[63:0]})
180                | ({77{dest_rdy[0]}}
181                            & {add_exc_out[4:0], 2'b0, a6stg_fcmpop,
182                                add_cc_out[1:0], add_fcc_out[1:0], 1'b0,
183                                add_out[63:0]});
184
185dff_s #(8) i_fp_cpx_data_ca_84_77 (
186        .din    (fp_cpx_data_ca_84_77_in[7:0]),
187        .clk    (clk),
188
189        .q      (fp_cpx_data_ca_84_77[7:0]),
190
191        .se     (se),
192        .si     (),
193        .so     ()
194);
195
196dff_s #(77) i_fp_cpx_data_ca_76_0 (
197        .din    (fp_cpx_data_ca_76_0_in[76:0]),
198        .clk    (clk),
199
200        .q      (fp_cpx_data_ca_76_0[76:0]),
201
202        .se     (se),
203        .si     (),
204        .so     ()
205);
206
207assign fp_cpx_data_ca[144:0]= {fp_cpx_data_ca_84_77[7:3],
208                                3'b0,
209                                fp_cpx_data_ca_84_77[2:0],
210                                57'b0,
211                                fp_cpx_data_ca_76_0[76:0]};
212
213
214endmodule
215
216
Note: See TracBrowser for help on using the repository browser.