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

Revision 6, 5.5 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_ctl.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 control logic.
24//
25///////////////////////////////////////////////////////////////////////////////
26 
27
28module fpu_out_ctl (
29        d8stg_fdiv_in,
30        m6stg_fmul_in,
31        a6stg_fadd_in,
32        div_id_out_in,
33        m6stg_id_in,
34        add_id_out_in,
35        arst_l,
36        grst_l,
37        rclk,
38       
39        fp_cpx_req_cq,
40        req_thread,
41        dest_rdy,
42        add_dest_rdy,
43        mul_dest_rdy,
44        div_dest_rdy,
45
46        se,
47        si,
48        so
49);
50
51
52input           d8stg_fdiv_in;          // div pipe output request next cycle
53input           m6stg_fmul_in;          // mul pipe output request next cycle
54input           a6stg_fadd_in;          // add pipe output request next cycle
55input [9:0]     div_id_out_in;          // div pipe output ID next cycle
56input [9:0]     m6stg_id_in;            // mul pipe output ID next cycle
57input [9:0]     add_id_out_in;          // add pipe output ID next cycle
58input           arst_l;                 // global async. reset- asserted low
59input           grst_l;                 // global sync. reset- asserted low
60input           rclk;           // global clock
61
62output [7:0]    fp_cpx_req_cq;          // FPU result request to CPX
63output [1:0]    req_thread;             // thread ID of result req this cycle
64output [2:0]    dest_rdy;               // pipe with result request this cycle
65output          add_dest_rdy;           // add pipe result request this cycle
66output          mul_dest_rdy;           // mul pipe result request this cycle
67output          div_dest_rdy;           // div pipe result request this cycle
68
69input           se;                     // scan_enable
70input           si;                     // scan in
71output          so;                     // scan out
72
73
74wire            reset;
75wire            add_req_in;
76wire            add_req_step;
77wire            add_req;
78wire            div_req_sel;
79wire            mul_req_sel;
80wire            add_req_sel;
81wire [9:0]      out_id;
82wire [7:0]      fp_cpx_req_cq;
83wire [1:0]      req_thread;
84wire [2:0]      dest_rdy_in;
85wire [2:0]      dest_rdy;
86wire            add_dest_rdy;
87wire            mul_dest_rdy;
88wire            div_dest_rdy;
89
90dffrl_async #(1)  dffrl_out_ctl (
91  .din  (grst_l),
92  .clk  (rclk),
93  .rst_l(arst_l),
94  .q    (out_ctl_rst_l),
95        .se (se),
96        .si (),
97        .so ()
98  );
99
100assign reset= (!out_ctl_rst_l);
101
102
103///////////////////////////////////////////////////////////////////////////////
104//
105//      Arbitrate for the output.
106//
107//      Top priority- divide.
108//      Low priority- round robin arbitration between the add and multiply
109//              pipes.
110//
111///////////////////////////////////////////////////////////////////////////////
112
113assign add_req_in= (!add_req);
114
115assign add_req_step= add_req_sel || mul_req_sel;
116
117dffre_s #(1) i_add_req (
118        .din    (add_req_in),
119        .en     (add_req_step),
120        .rst    (reset),
121        .clk    (rclk),
122
123        .q      (add_req),
124
125        .se     (se),
126        .si     (),
127        .so     ()
128);
129
130assign div_req_sel= d8stg_fdiv_in;
131
132assign mul_req_sel= m6stg_fmul_in
133                && ((!add_req) || (!a6stg_fadd_in))
134                && (!div_req_sel);
135
136assign add_req_sel= a6stg_fadd_in
137                && (add_req || (!m6stg_fmul_in))
138                && (!div_req_sel);
139
140
141///////////////////////////////////////////////////////////////////////////////
142//
143//      Generate the request.
144//
145//      Input to the output request (CQ) stage.
146//
147///////////////////////////////////////////////////////////////////////////////
148
149assign out_id[9:0]= ({10{div_req_sel}}
150                            & div_id_out_in[9:0])
151                | ({10{mul_req_sel}}
152                            & m6stg_id_in[9:0])
153                | ({10{add_req_sel}}
154                            & add_id_out_in[9:0]);
155
156dff_s #(8) i_fp_cpx_req_cq (
157        .din    (out_id[9:2]),
158        .clk    (rclk),
159
160        .q      (fp_cpx_req_cq[7:0]),
161
162        .se     (se),
163        .si     (),
164        .so     ()
165);
166
167
168///////////////////////////////////////////////////////////////////////////////
169//
170//      Capture the thread.
171//
172//      Input to the output request (CQ) stage.
173//
174///////////////////////////////////////////////////////////////////////////////
175
176dff_s #(2) i_req_thread (
177        .din    (out_id[1:0]),
178        .clk    (rclk),
179 
180        .q      (req_thread[1:0]),
181
182        .se     (se),
183        .si     (),
184        .so     ()
185);
186
187
188///////////////////////////////////////////////////////////////////////////////
189//
190//      Capture the pipe that wins the output request.
191//
192//      Input to the output request (CQ) stage.
193//
194///////////////////////////////////////////////////////////////////////////////
195
196assign dest_rdy_in[2:0]= {div_req_sel, mul_req_sel, add_req_sel};
197
198dff_s #(3) i_dest_rdy (
199        .din    (dest_rdy_in[2:0]),
200        .clk    (rclk),
201
202        .q      (dest_rdy[2:0]),
203
204        .se     (se),
205        .si     (),
206        .so     ()
207);
208
209dff_s i_add_dest_rdy (
210        .din    (add_req_sel),
211        .clk    (rclk),
212
213        .q      (add_dest_rdy),
214
215        .se     (se),
216        .si     (),
217        .so     ()
218);
219
220dff_s i_mul_dest_rdy (
221        .din    (mul_req_sel),
222        .clk    (rclk),
223
224        .q      (mul_dest_rdy),
225
226        .se     (se),
227        .si     (),
228        .so     ()
229);
230
231dff_s i_div_dest_rdy (
232        .din    (div_req_sel),
233        .clk    (rclk),
234
235        .q      (div_dest_rdy),
236
237        .se     (se),
238        .si     (),
239        .so     ()
240);
241
242
243endmodule
244
245
Note: See TracBrowser for help on using the repository browser.