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

Subversion Repositories sparc64soc

[/] [sparc64soc/] [trunk/] [T1-CPU/] [exu/] [sparc_exu_byp.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: sparc_exu_byp.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
//  Module Name: sparc_exu_byp
24
//      Description: This block includes the muxes for the bypassing for all
25
//              3 register outputs.  It also includes the pipeline registers
26
//              for the output of the ALU.  All other operands come from
27
//              outside the bypass block.  Rs1_data chooses between the normal
28
//              bypassing paths and the PC.  Rs2_data chooses between the normal
29
//              bypassing paths and the immediate.
30
*/
31
 
32
//FPGA_SYN enables all FPGA related modifications
33
`ifdef FPGA_SYN
34
`define FPGA_SYN_CLK_EN
35
`define FPGA_SYN_CLK_DFF
36
`endif
37
 
38
module sparc_exu_byp
39
( /*AUTOARG*/
40
   // Outputs
41
   so, byp_alu_rs1_data_e, byp_alu_rs2_data_e_l, byp_alu_rs2_data_e,
42
   exu_lsu_rs3_data_e, exu_spu_rs3_data_e, exu_lsu_rs2_data_e,
43
   byp_alu_rcc_data_e, byp_irf_rd_data_w, exu_tlu_wsr_data_m,
44
   byp_irf_rd_data_w2, byp_ecc_rs3_data_e, byp_ecc_rcc_data_e,
45
   byp_ecl_rs2_31_e, byp_ecl_rs1_31_e, byp_ecl_rs1_63_e,
46
   byp_ecl_rs1_2_0_e, byp_ecl_rs2_3_0_e, byp_ecc_rs1_synd_d,
47
   byp_ecc_rs2_synd_d, byp_ecc_rs3_synd_d,
48
   // Inputs
49
   rclk, se, si, sehold, ecl_byp_rs1_mux2_sel_e,
50
   ecl_byp_rs1_mux2_sel_rf, ecl_byp_rs1_mux2_sel_ld,
51
   ecl_byp_rs1_mux2_sel_usemux1, ecl_byp_rs1_mux1_sel_m,
52
   ecl_byp_rs1_mux1_sel_w, ecl_byp_rs1_mux1_sel_w2,
53
   ecl_byp_rs1_mux1_sel_other, ecl_byp_rcc_mux2_sel_e,
54
   ecl_byp_rcc_mux2_sel_rf, ecl_byp_rcc_mux2_sel_ld,
55
   ecl_byp_rcc_mux2_sel_usemux1, ecl_byp_rcc_mux1_sel_m,
56
   ecl_byp_rcc_mux1_sel_w, ecl_byp_rcc_mux1_sel_w2,
57
   ecl_byp_rcc_mux1_sel_other, ecl_byp_rs2_mux2_sel_e,
58
   ecl_byp_rs2_mux2_sel_rf, ecl_byp_rs2_mux2_sel_ld,
59
   ecl_byp_rs2_mux2_sel_usemux1, ecl_byp_rs2_mux1_sel_m,
60
   ecl_byp_rs2_mux1_sel_w, ecl_byp_rs2_mux1_sel_w2,
61
   ecl_byp_rs2_mux1_sel_other, ecl_byp_rs3_mux2_sel_e,
62
   ecl_byp_rs3_mux2_sel_rf, ecl_byp_rs3_mux2_sel_ld,
63
   ecl_byp_rs3_mux2_sel_usemux1, ecl_byp_rs3_mux1_sel_m,
64
   ecl_byp_rs3_mux1_sel_w, ecl_byp_rs3_mux1_sel_w2,
65
   ecl_byp_rs3_mux1_sel_other, ecl_byp_rs3h_mux2_sel_e,
66
   ecl_byp_rs3h_mux2_sel_rf, ecl_byp_rs3h_mux2_sel_ld,
67
   ecl_byp_rs3h_mux2_sel_usemux1, ecl_byp_rs3h_mux1_sel_m,
68
   ecl_byp_rs3h_mux1_sel_w, ecl_byp_rs3h_mux1_sel_w2,
69
   ecl_byp_rs3h_mux1_sel_other, ecl_byp_rs1_longmux_sel_g2,
70
   ecl_byp_rs1_longmux_sel_w2, ecl_byp_rs1_longmux_sel_ldxa,
71
   ecl_byp_rs2_longmux_sel_g2, ecl_byp_rs2_longmux_sel_w2,
72
   ecl_byp_rs2_longmux_sel_ldxa, ecl_byp_rs3_longmux_sel_g2,
73
   ecl_byp_rs3_longmux_sel_w2, ecl_byp_rs3_longmux_sel_ldxa,
74
   ecl_byp_rs3h_longmux_sel_g2, ecl_byp_rs3h_longmux_sel_w2,
75
   ecl_byp_rs3h_longmux_sel_ldxa, ecl_byp_sel_load_m,
76
   ecl_byp_sel_pipe_m, ecl_byp_sel_ecc_m, ecl_byp_sel_muldiv_g,
77
   ecl_byp_sel_load_g, ecl_byp_sel_restore_g, ecl_byp_std_e_l,
78
   ecl_byp_ldxa_g, alu_byp_rd_data_e, ifu_exu_imm_data_d,
79
   irf_byp_rs1_data_d_l, irf_byp_rs2_data_d_l, irf_byp_rs3_data_d_l,
80
   irf_byp_rs3h_data_d_l, lsu_exu_dfill_data_g, lsu_exu_ldxa_data_g,
81
   div_byp_muldivout_g, ecc_byp_ecc_result_m, ecl_byp_ecc_mask_m_l,
82
   ifu_exu_pc_d, ecl_byp_3lsb_m, ecl_byp_restore_m,
83
   ecl_byp_sel_restore_m, ecl_byp_eclpr_e, div_byp_yreg_e,
84
   ifu_exu_pcver_e, tlu_exu_rsr_data_m, ffu_exu_rsr_data_m,
85
   ecl_byp_sel_yreg_e, ecl_byp_sel_eclpr_e, ecl_byp_sel_ifusr_e,
86
   ecl_byp_sel_alu_e, ecl_byp_sel_ifex_m, ecl_byp_sel_ffusr_m,
87
   ecl_byp_sel_tlusr_m
88
   );
89
 
90
   input rclk;
91
   input se;                    // scan enable
92
   input si;
93
   input sehold;
94
   input ecl_byp_rs1_mux2_sel_e;// select lines for bypass muxes for rs1
95
   input ecl_byp_rs1_mux2_sel_rf;
96
   input ecl_byp_rs1_mux2_sel_ld;
97
   input ecl_byp_rs1_mux2_sel_usemux1;
98
   input ecl_byp_rs1_mux1_sel_m;
99
   input ecl_byp_rs1_mux1_sel_w;
100
   input ecl_byp_rs1_mux1_sel_w2;
101
   input ecl_byp_rs1_mux1_sel_other;
102
   input ecl_byp_rcc_mux2_sel_e;// select lines for bypass muxes for reg condition code
103
   input ecl_byp_rcc_mux2_sel_rf;
104
   input ecl_byp_rcc_mux2_sel_ld;
105
   input ecl_byp_rcc_mux2_sel_usemux1;
106
   input ecl_byp_rcc_mux1_sel_m;
107
   input ecl_byp_rcc_mux1_sel_w;
108
   input ecl_byp_rcc_mux1_sel_w2;
109
   input ecl_byp_rcc_mux1_sel_other;
110
   input ecl_byp_rs2_mux2_sel_e;// select lines for bypass muxes for rs2
111
   input ecl_byp_rs2_mux2_sel_rf;
112
   input ecl_byp_rs2_mux2_sel_ld;
113
   input ecl_byp_rs2_mux2_sel_usemux1;
114
   input ecl_byp_rs2_mux1_sel_m;
115
   input ecl_byp_rs2_mux1_sel_w;
116
   input ecl_byp_rs2_mux1_sel_w2;
117
   input ecl_byp_rs2_mux1_sel_other;
118
   input ecl_byp_rs3_mux2_sel_e;// select lines for bypass muxes for rs3
119
   input ecl_byp_rs3_mux2_sel_rf;
120
   input ecl_byp_rs3_mux2_sel_ld;
121
   input ecl_byp_rs3_mux2_sel_usemux1;
122
   input ecl_byp_rs3_mux1_sel_m;
123
   input ecl_byp_rs3_mux1_sel_w;
124
   input ecl_byp_rs3_mux1_sel_w2;
125
   input ecl_byp_rs3_mux1_sel_other;
126
   input ecl_byp_rs3h_mux2_sel_e;// select lines for bypass muxes for rs3 double
127
   input ecl_byp_rs3h_mux2_sel_rf;
128
   input ecl_byp_rs3h_mux2_sel_ld;
129
   input ecl_byp_rs3h_mux2_sel_usemux1;
130
   input ecl_byp_rs3h_mux1_sel_m;
131
   input ecl_byp_rs3h_mux1_sel_w;
132
   input ecl_byp_rs3h_mux1_sel_w2;
133
   input ecl_byp_rs3h_mux1_sel_other;
134
   input ecl_byp_rs1_longmux_sel_g2;
135
   input ecl_byp_rs1_longmux_sel_w2;
136
   input ecl_byp_rs1_longmux_sel_ldxa;
137
   input ecl_byp_rs2_longmux_sel_g2;
138
   input ecl_byp_rs2_longmux_sel_w2;
139
   input ecl_byp_rs2_longmux_sel_ldxa;
140
   input ecl_byp_rs3_longmux_sel_g2;
141
   input ecl_byp_rs3_longmux_sel_w2;
142
   input ecl_byp_rs3_longmux_sel_ldxa;
143
   input ecl_byp_rs3h_longmux_sel_g2;
144
   input ecl_byp_rs3h_longmux_sel_w2;
145
   input ecl_byp_rs3h_longmux_sel_ldxa;
146
   input ecl_byp_sel_load_m;        // m instruction uses load in w1 port
147
   input ecl_byp_sel_pipe_m;
148
   input ecl_byp_sel_ecc_m;
149
   input ecl_byp_sel_muldiv_g;
150
   input ecl_byp_sel_load_g;
151
   input ecl_byp_sel_restore_g;
152
   input ecl_byp_std_e_l;
153
   input ecl_byp_ldxa_g;
154
   input [63:0] alu_byp_rd_data_e;           // data from alu for bypass
155
   input [31:0] ifu_exu_imm_data_d;     // immediate
156
   input [71:0] irf_byp_rs1_data_d_l;  // RF rs1_data
157
   input [71:0] irf_byp_rs2_data_d_l;  // RF rs2_data
158
   input [71:0] irf_byp_rs3_data_d_l;  // RF rs3_data
159
   input [31:0] irf_byp_rs3h_data_d_l;// RF rs3 double data
160
   input [63:0] lsu_exu_dfill_data_g; // load data
161
   input [63:0] lsu_exu_ldxa_data_g;
162
   input [63:0] div_byp_muldivout_g;
163
   input [63:0] ecc_byp_ecc_result_m;// result from ecc
164
   input [7:0]  ecl_byp_ecc_mask_m_l;
165
   input [47:0]  ifu_exu_pc_d;
166
   input [2:0]   ecl_byp_3lsb_m;
167
   input         ecl_byp_restore_m;
168
   input         ecl_byp_sel_restore_m;
169
   input [7:0]   ecl_byp_eclpr_e;
170
   input [31:0]  div_byp_yreg_e;
171
   input [63:0]  ifu_exu_pcver_e;
172
   input [63:0]  tlu_exu_rsr_data_m;
173
   input [63:0]  ffu_exu_rsr_data_m;
174
   input         ecl_byp_sel_yreg_e;
175
   input         ecl_byp_sel_eclpr_e;
176
   input         ecl_byp_sel_ifusr_e;
177
   input         ecl_byp_sel_alu_e;
178
   input         ecl_byp_sel_ifex_m;
179
   input         ecl_byp_sel_ffusr_m;
180
   input         ecl_byp_sel_tlusr_m;
181
 
182
   output        so;
183
   output [63:0] byp_alu_rs1_data_e; // rs1_data operand for alu
184
   output [63:0] byp_alu_rs2_data_e_l; // rs2_data operand for alu
185
   output [63:0] byp_alu_rs2_data_e;
186
   output [63:0] exu_lsu_rs3_data_e; // rs3_data operand for lsu
187
   output [63:0] exu_spu_rs3_data_e;// rs3 data for spu
188
   output [63:0]  exu_lsu_rs2_data_e;
189
   output [63:0]  byp_alu_rcc_data_e;// data for reg condition codes
190
   output [71:0] byp_irf_rd_data_w;
191
   output [63:0] exu_tlu_wsr_data_m;          // data for writeback
192
   output [71:0] byp_irf_rd_data_w2;
193
   output [63:0] byp_ecc_rs3_data_e;
194
   output [63:0] byp_ecc_rcc_data_e;
195
   output        byp_ecl_rs2_31_e;
196
   output        byp_ecl_rs1_31_e;
197
   output        byp_ecl_rs1_63_e;
198
   output [2:0]  byp_ecl_rs1_2_0_e;
199
   output [3:0]  byp_ecl_rs2_3_0_e;
200
   output [7:0]  byp_ecc_rs1_synd_d;
201
   output [7:0]  byp_ecc_rs2_synd_d;
202
   output [7:0]  byp_ecc_rs3_synd_d;
203
 
204
   wire          clk;
205
   wire          sehold_clk;
206
   wire [63:0] irf_byp_rs1_data_d;  // RF rs1_data
207
   wire [63:0] irf_byp_rs2_data_d;  // RF rs2_data
208
   wire [63:0] irf_byp_rs3_data_d;  // RF rs3_data
209
   wire [31:0] irf_byp_rs3h_data_d;  // RF rs3_data double
210
   wire [63:0] byp_alu_rs1_data_d; // rs1 operand for alu
211
   wire [63:0] byp_alu_rcc_data_d; // rcc operand for alu
212
   wire [63:0] byp_alu_rs2_data_d; // rs2_data operand for alu
213
   wire [63:0]   rd_data_e;          // e stage rd_data
214
   wire [63:0]   rd_data_m;          // m stage non-load rd_data
215
   wire [63:0]   full_rd_data_m;          // m stage non-load rd_data including rdsr
216
   wire [63:0]   rd_data_g;
217
   wire [63:0]   byp_irf_rd_data_m;// m stage rd_data
218
   wire [63:0]   rs1_data_btwn_mux;  // intermediate net for rs1_data muxes
219
   wire [63:0]   rcc_data_btwn_mux;  // intermediate net for rs1_data muxes
220
   wire [63:0]   rs2_data_btwn_mux;  // intermediate net for rs2_data muxes
221
   wire [63:0]   rs3_data_btwn_mux;  // intermediate net for rs3_data muxes
222
   wire [31:0]   rs3h_data_btwn_mux;  // intermediate net for rs3h_data muxes
223
   wire [63:0]   rs3_data_d;
224
   wire [63:0]   rs3_data_e;
225
   wire [31:0]   rs3h_data_d;
226
   wire [31:0]   rs3h_data_e;
227
   wire [63:0]   restore_rd_data;
228
   wire [63:0]   restore_rd_data_next;
229
   wire [63:0]   dfill_data_g;
230
   wire [63:0]   dfill_data_g2;
231
   wire          ecl_byp_std_e;
232
   wire [7:0]    rd_synd_w_l;
233
   wire [7:0]    rd_synd_w2_l;
234
 
235
   assign        clk = rclk;
236
`ifdef FPGA_SYN_CLK_EN
237
`else
238
   clken_buf irf_write_clkbuf (
239
                                .rclk   (clk),
240
                                .enb_l  (sehold),
241
                                .tmb_l  (~se),
242
                                .clk    (sehold_clk)
243
                                ) ;
244
`endif
245
 
246
 
247
   assign        byp_ecc_rs1_synd_d[7:0] = ~irf_byp_rs1_data_d_l[71:64];
248
   assign        byp_ecc_rs2_synd_d[7:0] = ~irf_byp_rs2_data_d_l[71:64];
249
   assign        byp_ecc_rs3_synd_d[7:0] = ~irf_byp_rs3_data_d_l[71:64];
250
   /////////////////////////////////////////
251
   // Load returns go straight into a flop after mux with ldxa_data
252
   /////////////////////////////////////////
253
   dp_mux2es #(64) dfill_data_mux (.dout(dfill_data_g[63:0]),
254
                                   .in0(lsu_exu_dfill_data_g[63:0]),
255
                                   .in1(lsu_exu_ldxa_data_g[63:0]),
256
                                   .sel(ecl_byp_ldxa_g));
257
   dff_s #(64) dfill_data_dff (.din(dfill_data_g[63:0]), .clk(clk),
258
                             .q(dfill_data_g2[63:0]), .se(se), .si(), .so());
259
 
260
   //////////////////////////////////////////////////
261
   // RD of PR or SR
262
   //////////////////////////////////////////////////
263
 
264
   // Mux outputs for rdpr/rdsr
265
   mux4ds #(64) ifu_exu_sr_mux(.dout(rd_data_e[63:0]),
266
                               .in0({32'b0, div_byp_yreg_e[31:0]}),
267
                               .in1({56'b0, ecl_byp_eclpr_e[7:0]}),
268
                               .in2(ifu_exu_pcver_e[63:0]),
269
                               .in3(alu_byp_rd_data_e[63:0]),
270
                               .sel0(ecl_byp_sel_yreg_e),
271
                               .sel1(ecl_byp_sel_eclpr_e),
272
                               .sel2(ecl_byp_sel_ifusr_e),
273
                               .sel3(ecl_byp_sel_alu_e));
274
 
275
   // mux in the rdsr data from ffu and tlu
276
   mux3ds #(64) sr_out_mux(.dout(full_rd_data_m[63:0]),
277
                           .in0({rd_data_m[63:3], ecl_byp_3lsb_m[2:0]}),
278
                           .in1(ffu_exu_rsr_data_m[63:0]),
279
                           .in2(tlu_exu_rsr_data_m[63:0]),
280
                           .sel0(ecl_byp_sel_ifex_m),
281
                           .sel1(ecl_byp_sel_ffusr_m),
282
                           .sel2(ecl_byp_sel_tlusr_m));
283
 
284
   // Pipeline registers for rd_data
285
   dff_s #(64) dff_rd_data_e2m(.din(rd_data_e[63:0]), .clk(clk), .q(rd_data_m[63:0]),
286
                           .se(se), .si(), .so());
287
   dp_buffer #(64) wsr_data_buf(.dout(exu_tlu_wsr_data_m[63:0]), .in(rd_data_m[63:0]));
288
 
289
   // Flop for storing result from restore
290
   dp_mux2es #(64) restore_buf_mux(.dout(restore_rd_data_next[63:0]),
291
                                   .in0(restore_rd_data[63:0]),
292
                                   .in1(rd_data_m[63:0]),
293
                                   .sel(ecl_byp_restore_m));
294
   dff_s #(64) dff_restore_buf(.din(restore_rd_data_next[63:0]),
295
                             .q(restore_rd_data[63:0]), .clk(clk),
296
                             .se(se), .si(), .so());
297
   // Mux for rd_data_m between ALU and load data and ECC result and restore result
298
   mux4ds #(64) rd_data_m_mux(.dout(byp_irf_rd_data_m[63:0]),
299
                              .in0(full_rd_data_m[63:0]),
300
                              .in1(dfill_data_g2[63:0]),
301
                              .in2(ecc_byp_ecc_result_m[63:0]),
302
                              .in3(restore_rd_data[63:0]),
303
                              .sel0(ecl_byp_sel_pipe_m),
304
                              .sel1(ecl_byp_sel_load_m),
305
                              .sel2(ecl_byp_sel_ecc_m),
306
                              .sel3(ecl_byp_sel_restore_m));
307
`ifdef FPGA_SYN_CLK_DFF
308
   dffe_s #(64) dff_rd_data_m2w(.din(byp_irf_rd_data_m[63:0]), .en (~(sehold)), .clk(clk), .q(byp_irf_rd_data_w[63:0]),
309
                           .se(se), .si(), .so());
310
`else
311
   dff_s #(64) dff_rd_data_m2w(.din(byp_irf_rd_data_m[63:0]), .clk(sehold_clk), .q(byp_irf_rd_data_w[63:0]),
312
                           .se(se), .si(), .so());
313
`endif
314
 
315
   // W2 flop
316
`ifdef FPGA_SYN_CLK_DFF
317
   dffe_s #(64) dff_rd_data_g2w(.din(rd_data_g[63:0]), .en (~(sehold)), .clk(clk), .q(byp_irf_rd_data_w2[63:0]),
318
                           .se(se), .si(), .so());
319
`else
320
   dff_s #(64) dff_rd_data_g2w(.din(rd_data_g[63:0]), .clk(sehold_clk), .q(byp_irf_rd_data_w2[63:0]),
321
                           .se(se), .si(), .so());
322
`endif
323
 
324
 
325
   // D-E pipeline registers for rs_data
326
   dff_s #(64) rs1_data_dff(.din(byp_alu_rs1_data_d[63:0]), .clk(clk),
327
                        .q(byp_alu_rs1_data_e[63:0]), .se(se),
328
                        .si(), .so());
329
   dff_s #(64) rs2_data_dff(.din(byp_alu_rs2_data_d[63:0]), .clk(clk),
330
                        .q(byp_alu_rs2_data_e[63:0]), .se(se),
331
                        .si(), .so());
332
   assign        byp_alu_rs2_data_e_l[63:0] = ~byp_alu_rs2_data_e[63:0];
333
   assign        byp_ecl_rs2_31_e = byp_alu_rs2_data_e[31];
334
   assign        byp_ecl_rs1_63_e = byp_alu_rs1_data_e[63];
335
   assign        byp_ecl_rs1_31_e = byp_alu_rs1_data_e[31];
336
   assign        byp_ecl_rs1_2_0_e[2:0] = byp_alu_rs1_data_e[2:0];
337
   assign        byp_ecl_rs2_3_0_e[3:0] = byp_alu_rs2_data_e[3:0];
338
 
339
 
340
   dff_s #(64) rs3_data_dff(.din(rs3_data_d[63:0]), .clk(clk),
341
                        .q(rs3_data_e[63:0]), .se(se),
342
                        .si(), .so());
343
   dff_s #(32) rs3h_data_dff(.din(rs3h_data_d[31:0]), .clk(clk),
344
                           .q(rs3h_data_e[31:0]), .se(se),
345
                           .si(), .so());
346
   dff_s #(64) rcc_data_dff(.din(byp_alu_rcc_data_d[63:0]), .clk(clk),
347
                        .q(byp_alu_rcc_data_e[63:0]), .se(se),
348
                        .si(), .so());
349
 
350
   assign        ecl_byp_std_e = ~ecl_byp_std_e_l;
351
   dp_mux2es #(64) rs2_data_out_mux(.dout(exu_lsu_rs2_data_e[63:0]),
352
                                    .in0(byp_alu_rs2_data_e[63:0]),
353
                                    .in1(rs3_data_e[63:0]),
354
                                    .sel(ecl_byp_std_e));
355
   dp_mux2es #(64) rs3_data_out_mux(.dout(exu_lsu_rs3_data_e[63:0]),
356
                                    .in0(rs3_data_e[63:0]),
357
                                    .in1({32'b0,rs3h_data_e[31:0]}),
358
                                    .sel(ecl_byp_std_e));
359
   // part of rs3 goes to spu.  Buffer off to help timing/loading
360
   assign        exu_spu_rs3_data_e[63:0] = rs3_data_e[63:0];
361
 
362
   assign        byp_ecc_rs3_data_e[63:0] = rs3_data_e[63:0];
363
   assign        byp_ecc_rcc_data_e[63:0] = byp_alu_rcc_data_e[63:0];
364
 
365
   // Forwarding Muxes
366
   // Select lines are as follows:
367
   // mux1[M, W, W2, OTHER(optional)]
368
   // mux2[mux1, RF, E, LD]
369
   assign        irf_byp_rs1_data_d[63:0] = ~irf_byp_rs1_data_d_l[63:0];
370
   assign        irf_byp_rs2_data_d[63:0] = ~irf_byp_rs2_data_d_l[63:0];
371
   assign        irf_byp_rs3_data_d[63:0] = ~irf_byp_rs3_data_d_l[63:0];
372
   assign        irf_byp_rs3h_data_d[31:0] = ~irf_byp_rs3h_data_d_l[31:0];
373
 
374
/* -----\/----- EXCLUDED -----\/-----
375
   // the w2 bypass path is either what is being written that cycle
376
   // or the load result that will be written next cycle.
377
 -----/\----- EXCLUDED -----/\----- */
378
   wire [63:0]   rs1_data_w2;
379
   wire [63:0]   rs2_data_w2;
380
   wire [63:0]   rs3_data_w2;
381
   wire [31:0]   rs3h_data_w2;
382
   mux3ds #(64) rs1_w2_mux(.dout(rs1_data_w2[63:0]),
383
                           .in0(byp_irf_rd_data_w2[63:0]),
384
                           .in1(dfill_data_g2[63:0]),
385
                           .in2(lsu_exu_ldxa_data_g[63:0]),
386
                           .sel0(ecl_byp_rs1_longmux_sel_w2),
387
                           .sel1(ecl_byp_rs1_longmux_sel_g2),
388
                           .sel2(ecl_byp_rs1_longmux_sel_ldxa));
389
   mux3ds #(64) rs2_w2_mux(.dout(rs2_data_w2[63:0]),
390
                           .in0(byp_irf_rd_data_w2[63:0]),
391
                           .in1(dfill_data_g2[63:0]),
392
                           .in2(lsu_exu_ldxa_data_g[63:0]),
393
                           .sel0(ecl_byp_rs2_longmux_sel_w2),
394
                           .sel1(ecl_byp_rs2_longmux_sel_g2),
395
                           .sel2(ecl_byp_rs2_longmux_sel_ldxa));
396
   mux3ds #(64) rs3_w2_mux(.dout(rs3_data_w2[63:0]),
397
                           .in0(byp_irf_rd_data_w2[63:0]),
398
                           .in1(dfill_data_g2[63:0]),
399
                           .in2(lsu_exu_ldxa_data_g[63:0]),
400
                           .sel0(ecl_byp_rs3_longmux_sel_w2),
401
                           .sel1(ecl_byp_rs3_longmux_sel_g2),
402
                           .sel2(ecl_byp_rs3_longmux_sel_ldxa));
403
   mux3ds #(32) rs3h_w2_mux(.dout(rs3h_data_w2[31:0]),
404
                            .in0(byp_irf_rd_data_w2[31:0]),
405
                            .in1(dfill_data_g2[31:0]),
406
                            .in2(lsu_exu_ldxa_data_g[31:0]),
407
                            .sel0(ecl_byp_rs3h_longmux_sel_w2),
408
                            .sel1(ecl_byp_rs3h_longmux_sel_g2),
409
                            .sel2(ecl_byp_rs3h_longmux_sel_ldxa));
410
 
411
 
412
   // rs1_data muxes: RF and E are critical paths
413
   mux4ds #(64) mux_rs1_data_1(.dout(rs1_data_btwn_mux[63:0]),
414
                               .in0(rd_data_m[63:0]),
415
                               .in1(byp_irf_rd_data_w[63:0]),
416
                               .in2(rs1_data_w2[63:0]),
417
                               .in3({{16{ifu_exu_pc_d[47]}}, ifu_exu_pc_d[47:0]}),
418
                             .sel0(ecl_byp_rs1_mux1_sel_m),
419
                             .sel1(ecl_byp_rs1_mux1_sel_w),
420
                             .sel2(ecl_byp_rs1_mux1_sel_w2),
421
                             .sel3(ecl_byp_rs1_mux1_sel_other));
422
   mux4ds #(64) mux_rs1_data_2(.dout(byp_alu_rs1_data_d[63:0]),
423
                             .in0(rs1_data_btwn_mux[63:0]),
424
                             .in1(irf_byp_rs1_data_d[63:0]),
425
                             .in2(alu_byp_rd_data_e[63:0]),
426
                             .in3(lsu_exu_dfill_data_g[63:0]),
427
                             .sel0(ecl_byp_rs1_mux2_sel_usemux1),
428
                             .sel1(ecl_byp_rs1_mux2_sel_rf),
429
                             .sel2(ecl_byp_rs1_mux2_sel_e),
430
                             .sel3(ecl_byp_rs1_mux2_sel_ld));
431
 
432
   // rcc_data muxes: RF and E are critical paths
433
   mux4ds #(64) mux_rcc_data_1(.dout(rcc_data_btwn_mux[63:0]),
434
                               .in0(rd_data_m[63:0]),
435
                               .in1(byp_irf_rd_data_w[63:0]),
436
                               .in2(rs1_data_w2[63:0]),
437
                               .in3({64{1'b0}}),
438
                             .sel0(ecl_byp_rcc_mux1_sel_m),
439
                             .sel1(ecl_byp_rcc_mux1_sel_w),
440
                             .sel2(ecl_byp_rcc_mux1_sel_w2),
441
                             .sel3(ecl_byp_rcc_mux1_sel_other));
442
   mux4ds #(64) mux_rcc_data_2(.dout(byp_alu_rcc_data_d[63:0]),
443
                             .in0(rcc_data_btwn_mux[63:0]),
444
                             .in1(irf_byp_rs1_data_d[63:0]),
445
                             .in2(alu_byp_rd_data_e[63:0]),
446
                             .in3(lsu_exu_dfill_data_g[63:0]),
447
                             .sel0(ecl_byp_rcc_mux2_sel_usemux1),
448
                             .sel1(ecl_byp_rcc_mux2_sel_rf),
449
                             .sel2(ecl_byp_rcc_mux2_sel_e),
450
                             .sel3(ecl_byp_rcc_mux2_sel_ld));
451
 
452
   // rs2_data muxes: RF and E are critical paths, optional is imm
453
   mux4ds #(64) mux_rs2_data_1(.dout(rs2_data_btwn_mux[63:0]),
454
                             .in0(rd_data_m[63:0]),
455
                             .in1(byp_irf_rd_data_w[63:0]),
456
                             .in2(rs2_data_w2[63:0]),
457
                             .in3({{32{ifu_exu_imm_data_d[31]}},
458
                                   ifu_exu_imm_data_d[31:0]}),
459
                             .sel0(ecl_byp_rs2_mux1_sel_m),
460
                             .sel1(ecl_byp_rs2_mux1_sel_w),
461
                             .sel2(ecl_byp_rs2_mux1_sel_w2),
462
                             .sel3(ecl_byp_rs2_mux1_sel_other));
463
   mux4ds #(64) mux_rs2_data_2(.dout(byp_alu_rs2_data_d[63:0]),
464
                             .in0(rs2_data_btwn_mux[63:0]),
465
                             .in1(irf_byp_rs2_data_d[63:0]),
466
                             .in2(alu_byp_rd_data_e[63:0]),
467
                             .in3(lsu_exu_dfill_data_g[63:0]),
468
                             .sel0(ecl_byp_rs2_mux2_sel_usemux1),
469
                             .sel1(ecl_byp_rs2_mux2_sel_rf),
470
                             .sel2(ecl_byp_rs2_mux2_sel_e),
471
                             .sel3(ecl_byp_rs2_mux2_sel_ld));
472
 
473
   // rs3_data muxes: RF and E are critical paths, no optional
474
   mux4ds #(64) mux_rs3_data_1(.dout(rs3_data_btwn_mux[63:0]),
475
                                .in0(rd_data_m[63:0]),
476
                             .in1(byp_irf_rd_data_w[63:0]),
477
                             .in2(rs3_data_w2[63:0]), .in3({64{1'b0}}),
478
                             .sel0(ecl_byp_rs3_mux1_sel_m),
479
                             .sel1(ecl_byp_rs3_mux1_sel_w),
480
                             .sel2(ecl_byp_rs3_mux1_sel_w2),
481
                             .sel3(ecl_byp_rs3_mux1_sel_other));
482
   mux4ds #(64) mux_rs3_data_2(.dout(rs3_data_d[63:0]),
483
                                .in0(rs3_data_btwn_mux[63:0]),
484
                                .in1(irf_byp_rs3_data_d[63:0]),
485
                                .in2(alu_byp_rd_data_e[63:0]),
486
                                .in3(lsu_exu_dfill_data_g[63:0]),
487
                                .sel0(ecl_byp_rs3_mux2_sel_usemux1),
488
                                .sel1(ecl_byp_rs3_mux2_sel_rf),
489
                                .sel2(ecl_byp_rs3_mux2_sel_e),
490
                                .sel3(ecl_byp_rs3_mux2_sel_ld));
491
 
492
   // rs3_data muxes: RF and E are critical paths, no optional
493
   mux4ds #(32) mux_rs3h_data_1(.dout(rs3h_data_btwn_mux[31:0]),
494
                                .in0(rd_data_m[31:0]),
495
                             .in1(byp_irf_rd_data_w[31:0]),
496
                             .in2(rs3h_data_w2[31:0]), .in3({32{1'b0}}),
497
                             .sel0(ecl_byp_rs3h_mux1_sel_m),
498
                             .sel1(ecl_byp_rs3h_mux1_sel_w),
499
                             .sel2(ecl_byp_rs3h_mux1_sel_w2),
500
                             .sel3(ecl_byp_rs3h_mux1_sel_other));
501
   mux4ds #(32) mux_rs3h_data_2(.dout(rs3h_data_d[31:0]),
502
                                .in0(rs3h_data_btwn_mux[31:0]),
503
                                .in1(irf_byp_rs3h_data_d[31:0]),
504
                                .in2(alu_byp_rd_data_e[31:0]),
505
                                .in3(lsu_exu_dfill_data_g[31:0]),
506
                                .sel0(ecl_byp_rs3h_mux2_sel_usemux1),
507
                                .sel1(ecl_byp_rs3h_mux2_sel_rf),
508
                                .sel2(ecl_byp_rs3h_mux2_sel_e),
509
                                .sel3(ecl_byp_rs3h_mux2_sel_ld));
510
 
511
   // ECC for W1
512
`ifdef FPGA_SYN_CLK_DFF
513
   sparc_exu_byp_eccgen w1_eccgen(.d(byp_irf_rd_data_m[63:0]),
514
                                   .msk(ecl_byp_ecc_mask_m_l[7:0]),
515
                                   .p(rd_synd_w_l[7:0]),
516
                                  .clk(clk), .se(se));
517
`else
518
   sparc_exu_byp_eccgen w1_eccgen(.d(byp_irf_rd_data_m[63:0]),
519
                                   .msk(ecl_byp_ecc_mask_m_l[7:0]),
520
                                   .p(rd_synd_w_l[7:0]),
521
                                  .clk(sehold_clk), .se(se));
522
`endif
523
   assign        byp_irf_rd_data_w[71:64] = ~rd_synd_w_l[7:0];
524
 
525
   ////////////////////////
526
   // G arbitration muxes and W2 ECC
527
   ////////////////////////
528
   mux3ds #(64) mux_w2_data(.dout(rd_data_g[63:0]),
529
                            .in0(div_byp_muldivout_g[63:0]),
530
                            .in1(dfill_data_g2[63:0]),
531
                            .in2(restore_rd_data[63:0]),
532
                            .sel0(ecl_byp_sel_muldiv_g),
533
                            .sel1(ecl_byp_sel_load_g),
534
                            .sel2(ecl_byp_sel_restore_g));
535
`ifdef FPGA_SYN_CLK_DFF
536
   sparc_exu_byp_eccgen w2_eccgen(.d(rd_data_g[63:0]),
537
                                   .msk(ecl_byp_ecc_mask_m_l[7:0]),
538
                                  .p(rd_synd_w2_l[7:0]),
539
                                  .clk(clk), .se(se));
540
`else
541
   sparc_exu_byp_eccgen w2_eccgen(.d(rd_data_g[63:0]),
542
                                   .msk(ecl_byp_ecc_mask_m_l[7:0]),
543
                                  .p(rd_synd_w2_l[7:0]),
544
                                  .clk(sehold_clk), .se(se));
545
`endif
546
   assign        byp_irf_rd_data_w2[71:64] = ~rd_synd_w2_l[7:0];
547
 
548
endmodule // sparc_exu_byp
549
 
550
 

powered by: WebSVN 2.1.0

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