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

Subversion Repositories sparc64soc

[/] [sparc64soc/] [trunk/] [T1-FPU/] [fpu_out_ctl.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_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
 
28
module 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
 
52
input           d8stg_fdiv_in;          // div pipe output request next cycle
53
input           m6stg_fmul_in;          // mul pipe output request next cycle
54
input           a6stg_fadd_in;          // add pipe output request next cycle
55
input [9:0]      div_id_out_in;          // div pipe output ID next cycle
56
input [9:0]      m6stg_id_in;            // mul pipe output ID next cycle
57
input [9:0]      add_id_out_in;          // add pipe output ID next cycle
58
input           arst_l;                 // global async. reset- asserted low
59
input           grst_l;                 // global sync. reset- asserted low
60
input           rclk;           // global clock
61
 
62
output [7:0]     fp_cpx_req_cq;          // FPU result request to CPX
63
output [1:0]     req_thread;             // thread ID of result req this cycle
64
output [2:0]     dest_rdy;               // pipe with result request this cycle
65
output          add_dest_rdy;           // add pipe result request this cycle
66
output          mul_dest_rdy;           // mul pipe result request this cycle
67
output          div_dest_rdy;           // div pipe result request this cycle
68
 
69
input           se;                     // scan_enable
70
input           si;                     // scan in
71
output          so;                     // scan out
72
 
73
 
74
wire            reset;
75
wire            add_req_in;
76
wire            add_req_step;
77
wire            add_req;
78
wire            div_req_sel;
79
wire            mul_req_sel;
80
wire            add_req_sel;
81
wire [9:0]       out_id;
82
wire [7:0]       fp_cpx_req_cq;
83
wire [1:0]       req_thread;
84
wire [2:0]       dest_rdy_in;
85
wire [2:0]       dest_rdy;
86
wire            add_dest_rdy;
87
wire            mul_dest_rdy;
88
wire            div_dest_rdy;
89
 
90
dffrl_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
 
100
assign 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
 
113
assign add_req_in= (!add_req);
114
 
115
assign add_req_step= add_req_sel || mul_req_sel;
116
 
117
dffre_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
 
130
assign div_req_sel= d8stg_fdiv_in;
131
 
132
assign mul_req_sel= m6stg_fmul_in
133
                && ((!add_req) || (!a6stg_fadd_in))
134
                && (!div_req_sel);
135
 
136
assign 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
 
149
assign 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
 
156
dff_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
 
176
dff_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
 
196
assign dest_rdy_in[2:0]= {div_req_sel, mul_req_sel, add_req_sel};
197
 
198
dff_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
 
209
dff_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
 
220
dff_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
 
231
dff_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
 
243
endmodule
244
 
245
 

powered by: WebSVN 2.1.0

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