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

Subversion Repositories s1_core

[/] [s1_core/] [trunk/] [hdl/] [rtl/] [sparc_core/] [sparc_exu_ecl.v] - Blame information for rev 113

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 95 fafa1971
// ========== Copyright Header Begin ==========================================
2
// 
3
// OpenSPARC T1 Processor File: sparc_exu_ecl.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 113 albert.wat
`ifdef SIMPLY_RISC_TWEAKS
22
`define SIMPLY_RISC_SCANIN .si(0)
23
`else
24
`define SIMPLY_RISC_SCANIN .si()
25
`endif
26 95 fafa1971
////////////////////////////////////////////////////////////////////////
27
/*
28
//  Module Name: sparc_exu_ecl
29
//      Description:  Implements all the control logic for the exu.
30
//              This includes: bypass logic, ccr control and ccr bypassing,
31
//                        w2 arbitration logic, mux selects for alu and shift.
32
//                              Also implements the ccrs.
33
*/
34
 
35
module sparc_exu_ecl
36
(/*AUTOARG*/
37
   // Outputs
38
   exu_tlu_ccr3_w, exu_tlu_ccr2_w, exu_tlu_ccr1_w, exu_tlu_ccr0_w,
39
   exu_mul_input_vld, exu_ifu_longop_done_g, exu_ifu_inj_ack,
40
   exu_ifu_err_synd_7_m, exu_ifu_err_reg_m, exu_ifu_ecc_ue_m,
41
   exu_ifu_ecc_ce_m, exu_ffu_wsr_inst_e, ecl_rml_wstate_wen_w,
42
   ecl_rml_otherwin_wen_w, ecl_rml_cwp_wen_e, ecl_rml_cleanwin_wen_w,
43
   ecl_rml_cansave_wen_w, ecl_rml_canrestore_wen_w,
44
   ecl_ecc_sel_rs3_m_l, ecl_ecc_sel_rs2_m_l, ecl_ecc_sel_rs1_m_l,
45
   ecl_ecc_log_rs3_m, ecl_ecc_log_rs2_m, ecl_ecc_log_rs1_m,
46
   ecl_div_yreg_wen_w, ecl_div_yreg_wen_l, ecl_div_yreg_wen_g,
47
   ecl_div_yreg_shift_g, ecl_div_xinmask, ecl_div_upper33_zero,
48
   ecl_div_upper33_one, ecl_div_upper32_zero, ecl_div_subtract_l,
49
   ecl_div_sel_u32, ecl_div_sel_pos32, ecl_div_sel_neg32,
50
   ecl_div_sel_adder, ecl_div_sel_64b, ecl_div_newq,
51
   ecl_div_mul_sext_rs2_e, ecl_div_mul_sext_rs1_e,
52
   ecl_div_mul_keep_data, ecl_div_mul_get_new_data,
53
   ecl_div_mul_get_32bit_data, ecl_div_last_cycle, ecl_div_keepx,
54
   ecl_div_keep_d, ecl_div_dividend_sign, ecl_div_cin,
55
   ecl_div_almostlast_cycle, ecl_byp_sel_restore_m,
56
   ecl_byp_sel_restore_g, ecl_byp_sel_pipe_m, ecl_byp_sel_muldiv_g,
57
   ecl_byp_sel_load_m, ecl_byp_sel_load_g, ecl_byp_eclpr_e,
58
   ecl_byp_ecc_mask_m_l, so, ecl_byp_sel_alu_e, ecl_byp_sel_eclpr_e,
59
   ecl_byp_sel_yreg_e, ecl_byp_sel_ifusr_e, ecl_byp_sel_ffusr_m,
60
   ecl_byp_sel_ifex_m, ecl_byp_sel_tlusr_m, exu_ifu_va_oor_m,
61
   ecl_alu_out_sel_sum_e_l, ecl_alu_out_sel_rs3_e_l,
62
   ecl_alu_out_sel_shift_e_l, ecl_alu_out_sel_logic_e_l,
63
   ecl_alu_log_sel_and_e, ecl_alu_log_sel_or_e,
64
   ecl_alu_log_sel_xor_e, ecl_alu_log_sel_move_e,
65
   ecl_alu_sethi_inst_e, ecl_alu_cin_e, ecl_shft_lshift_e_l,
66
   ecl_shft_op32_e, ecl_shft_shift4_e, ecl_shft_shift1_e,
67
   ecl_shft_enshift_e_l, ecl_byp_restore_m, ecl_byp_rs1_mux2_sel_e,
68
   ecl_byp_rs1_mux2_sel_rf, ecl_byp_rs1_mux2_sel_ld,
69
   ecl_byp_rs1_mux2_sel_usemux1, ecl_byp_rs1_mux1_sel_m,
70
   ecl_byp_rs1_mux1_sel_w, ecl_byp_rs1_mux1_sel_w2,
71
   ecl_byp_rs1_mux1_sel_other, ecl_byp_rcc_mux2_sel_e,
72
   ecl_byp_rcc_mux2_sel_rf, ecl_byp_rcc_mux2_sel_ld,
73
   ecl_byp_rcc_mux2_sel_usemux1, ecl_byp_rcc_mux1_sel_m,
74
   ecl_byp_rcc_mux1_sel_w, ecl_byp_rcc_mux1_sel_w2,
75
   ecl_byp_rcc_mux1_sel_other, ecl_byp_rs2_mux2_sel_e,
76
   ecl_byp_rs2_mux2_sel_rf, ecl_byp_rs2_mux2_sel_ld,
77
   ecl_byp_rs2_mux2_sel_usemux1, ecl_byp_rs2_mux1_sel_m,
78
   ecl_byp_rs2_mux1_sel_w, ecl_byp_rs2_mux1_sel_w2,
79
   ecl_byp_rs2_mux1_sel_other, ecl_byp_rs3_mux2_sel_e,
80
   ecl_byp_rs3_mux2_sel_rf, ecl_byp_rs3_mux2_sel_ld,
81
   ecl_byp_rs3_mux2_sel_usemux1, ecl_byp_rs3_mux1_sel_m,
82
   ecl_byp_rs3_mux1_sel_w, ecl_byp_rs3_mux1_sel_w2,
83
   ecl_byp_rs3_mux1_sel_other, ecl_byp_rs3h_mux2_sel_e,
84
   ecl_byp_rs3h_mux2_sel_rf, ecl_byp_rs3h_mux2_sel_ld,
85
   ecl_byp_rs3h_mux2_sel_usemux1, ecl_byp_rs3h_mux1_sel_m,
86
   ecl_byp_rs3h_mux1_sel_w, ecl_byp_rs3h_mux1_sel_w2,
87
   ecl_byp_rs3h_mux1_sel_other, ecl_byp_rs1_longmux_sel_g2,
88
   ecl_byp_rs1_longmux_sel_w2, ecl_byp_rs1_longmux_sel_ldxa,
89
   ecl_byp_rs2_longmux_sel_g2, ecl_byp_rs2_longmux_sel_w2,
90
   ecl_byp_rs2_longmux_sel_ldxa, ecl_byp_rs3_longmux_sel_g2,
91
   ecl_byp_rs3_longmux_sel_w2, ecl_byp_rs3_longmux_sel_ldxa,
92
   ecl_byp_rs3h_longmux_sel_g2, ecl_byp_rs3h_longmux_sel_w2,
93
   ecl_byp_rs3h_longmux_sel_ldxa, ecl_byp_std_e_l, ecl_byp_ldxa_g,
94
   ecl_byp_3lsb_m, ecl_ecc_rs1_use_rf_e, ecl_ecc_rs2_use_rf_e,
95
   ecl_ecc_rs3_use_rf_e, ecl_irf_rd_m, ecl_irf_tid_m, ecl_irf_wen_w,
96
   ecl_irf_wen_w2, ecl_irf_rd_g, ecl_irf_tid_g, ecl_div_thr_e,
97
   ecl_rml_thr_m, ecl_rml_thr_w, ecl_rml_xor_data_e,
98
   ecl_div_ld_inputs, ecl_div_sel_div, ecl_div_div64, exu_ifu_cc_d,
99
   ecl_shft_extendbit_e, ecl_shft_extend32bit_e_l,
100
   ecl_div_zero_rs2_e, ecl_div_muls_rs1_31_e_l,
101
   ecl_div_yreg_data_31_g, exu_tlu_va_oor_m, exu_tlu_va_oor_jl_ret_m,
102
   ecl_rml_kill_e, ecl_rml_kill_w, ecl_byp_sel_ecc_m,
103
   exu_tlu_ttype_m, exu_tlu_ttype_vld_m, exu_tlu_ue_trap_m,
104
   exu_tlu_misalign_addr_jmpl_rtn_m, exu_lsu_priority_trap_m,
105
   ecl_div_mul_wen, ecl_div_muls, ecl_rml_early_flush_w,
106
   ecl_rml_inst_vld_w, ecl_alu_casa_e,
107
   // Inputs
108
   tlu_exu_cwpccr_update_m, tlu_exu_ccr_m, sehold, rst_tri_en,
109
   rml_ecl_wstate_d, rml_ecl_swap_done, rml_ecl_rmlop_done_e,
110
   rml_ecl_otherwin_d, rml_ecl_kill_m, rml_ecl_gl_e, rml_ecl_cwp_d,
111
   rml_ecl_cleanwin_d, rml_ecl_cansave_d, rml_ecl_canrestore_d,
112
   mul_exu_ack, lsu_exu_ldst_miss_g2, ifu_tlu_wsr_inst_d,
113
   ifu_tlu_sraddr_d, ifu_exu_return_d, ifu_exu_muldivop_d,
114
   ifu_exu_inst_vld_w, ifu_exu_inst_vld_e, ifu_exu_inj_irferr,
115
   ifu_exu_ecc_mask, ifu_exu_disable_ce_e, ecc_ecl_rs3_ue,
116
   ecc_ecl_rs3_ce, ecc_ecl_rs2_ue, ecc_ecl_rs2_ce, ecc_ecl_rs1_ue,
117
   ecc_ecl_rs1_ce, div_ecl_xin_msb_l, div_ecl_x_msb,
118
   div_ecl_upper32_equal, div_ecl_low32_nonzero,
119
   div_ecl_gencc_in_msb_l, div_ecl_gencc_in_31, div_ecl_dividend_msb,
120
   div_ecl_detect_zero_low, div_ecl_detect_zero_high, div_ecl_d_msb,
121
   div_ecl_d_62, div_ecl_cout64, div_ecl_cout32,
122
   div_ecl_adder_out_31, byp_ecl_wrccr_data_w, rclk, se, si, grst_l,
123
   arst_l, ifu_exu_dbrinst_d, ifu_exu_aluop_d, ifu_exu_shiftop_d,
124
   ifu_exu_invert_d, ifu_exu_usecin_d, ifu_exu_enshift_d,
125
   byp_ecl_rs2_3_0_e, byp_ecl_rs1_2_0_e, byp_ecl_rd_data_3lsb_m,
126
   ifu_exu_use_rsr_e_l, ifu_exu_rd_exusr_e, ifu_exu_rd_ifusr_e,
127
   ifu_exu_rd_ffusr_e, ifu_exu_rs1_vld_d, ifu_exu_rs2_vld_d,
128
   ifu_exu_rs3e_vld_d, ifu_exu_rs3o_vld_d, ifu_exu_dontmv_regz0_e,
129
   ifu_exu_dontmv_regz1_e, ifu_exu_rd_d, ifu_exu_tid_s2,
130
   ifu_exu_kill_e, ifu_exu_wen_d, ifu_exu_ialign_d, exu_ifu_regz_e,
131
   alu_ecl_add_n64_e, alu_ecl_add_n32_e, alu_ecl_log_n64_e,
132
   alu_ecl_log_n32_e, alu_ecl_zhigh_e, alu_ecl_zlow_e,
133
   ifu_exu_setcc_d, lsu_exu_dfill_vld_g, lsu_exu_rd_m, lsu_exu_thr_m,
134
   lsu_exu_ldxa_m, byp_ecl_rs1_31_e, byp_ecl_rs2_31_e,
135
   byp_ecl_rs1_63_e, alu_ecl_cout64_e_l, alu_ecl_cout32_e,
136
   alu_ecl_adder_out_63_e, alu_ecl_adder_out_31_e,
137
   alu_ecl_adderin2_63_e, alu_ecl_adderin2_31_e, ifu_exu_rs1_s,
138
   ifu_exu_rs2_s, ifu_exu_rs3_s, ifu_exu_tagop_d, ifu_exu_tv_d,
139
   ifu_exu_muls_d, div_ecl_yreg_0_l, alu_ecl_mem_addr_invalid_e_l,
140
   ifu_exu_range_check_jlret_d, ifu_exu_range_check_other_d,
141
   ifu_exu_addr_mask_d, ifu_exu_save_d, ifu_exu_restore_d,
142
   ifu_exu_casa_d, rml_ecl_clean_window_e, rml_ecl_fill_e,
143
   rml_ecl_other_e, rml_ecl_wtype_e, ifu_exu_tcc_e,
144
   alu_ecl_adder_out_7_0_e, ifu_exu_useimm_d, ifu_exu_nceen_e,
145
   ifu_tlu_flush_m, ifu_exu_ttype_vld_m, tlu_exu_priv_trap_m,
146
   tlu_exu_pic_onebelow_m, tlu_exu_pic_twobelow_m,
147
   lsu_exu_flush_pipe_w, ifu_exu_sethi_inst_d,
148
   lsu_exu_st_dtlb_perr_g
149
   );
150
 
151
/*AUTOINPUT*/
152
// Beginning of automatic inputs (from unused autoinst inputs)
153
input [7:0]             byp_ecl_wrccr_data_w;   // To ccr of sparc_exu_eclccr.v
154
input                   div_ecl_adder_out_31;   // To divcntl of sparc_exu_ecl_divcntl.v
155
input                   div_ecl_cout32;         // To divcntl of sparc_exu_ecl_divcntl.v
156
input                   div_ecl_cout64;         // To divcntl of sparc_exu_ecl_divcntl.v
157
input                   div_ecl_d_62;           // To divcntl of sparc_exu_ecl_divcntl.v
158
input                   div_ecl_d_msb;          // To divcntl of sparc_exu_ecl_divcntl.v
159
input                   div_ecl_detect_zero_high;// To divcntl of sparc_exu_ecl_divcntl.v, ...
160
input                   div_ecl_detect_zero_low;// To divcntl of sparc_exu_ecl_divcntl.v, ...
161
input                   div_ecl_dividend_msb;   // To divcntl of sparc_exu_ecl_divcntl.v
162
input                   div_ecl_gencc_in_31;    // To divcntl of sparc_exu_ecl_divcntl.v
163
input                   div_ecl_gencc_in_msb_l; // To divcntl of sparc_exu_ecl_divcntl.v
164
input                   div_ecl_low32_nonzero;  // To divcntl of sparc_exu_ecl_divcntl.v
165
input                   div_ecl_upper32_equal;  // To divcntl of sparc_exu_ecl_divcntl.v
166
input                   div_ecl_x_msb;          // To divcntl of sparc_exu_ecl_divcntl.v
167
input                   div_ecl_xin_msb_l;      // To divcntl of sparc_exu_ecl_divcntl.v
168
input                   ecc_ecl_rs1_ce;         // To eccctl of sparc_exu_ecl_eccctl.v
169
input                   ecc_ecl_rs1_ue;         // To eccctl of sparc_exu_ecl_eccctl.v
170
input                   ecc_ecl_rs2_ce;         // To eccctl of sparc_exu_ecl_eccctl.v
171
input                   ecc_ecl_rs2_ue;         // To eccctl of sparc_exu_ecl_eccctl.v
172
input                   ecc_ecl_rs3_ce;         // To eccctl of sparc_exu_ecl_eccctl.v
173
input                   ecc_ecl_rs3_ue;         // To eccctl of sparc_exu_ecl_eccctl.v
174
input                   ifu_exu_disable_ce_e;   // To eccctl of sparc_exu_ecl_eccctl.v
175
input [7:0]             ifu_exu_ecc_mask;       // To eccctl of sparc_exu_ecl_eccctl.v
176
input                   ifu_exu_inj_irferr;     // To eccctl of sparc_exu_ecl_eccctl.v
177
input                   ifu_exu_inst_vld_e;     // To writeback of sparc_exu_ecl_wb.v, ...
178
input                   ifu_exu_inst_vld_w;     // To ccr of sparc_exu_eclccr.v, ...
179
input [4:0]             ifu_exu_muldivop_d;     // To mdqctl of sparc_exu_ecl_mdqctl.v
180
input                   ifu_exu_return_d;       // To writeback of sparc_exu_ecl_wb.v
181
input [6:0]             ifu_tlu_sraddr_d;       // To writeback of sparc_exu_ecl_wb.v
182
input                   ifu_tlu_wsr_inst_d;     // To writeback of sparc_exu_ecl_wb.v
183
input                   lsu_exu_ldst_miss_g2;   // To writeback of sparc_exu_ecl_wb.v
184
input                   mul_exu_ack;            // To mdqctl of sparc_exu_ecl_mdqctl.v
185
input [2:0]             rml_ecl_canrestore_d;   // To writeback of sparc_exu_ecl_wb.v
186
input [2:0]             rml_ecl_cansave_d;      // To writeback of sparc_exu_ecl_wb.v
187
input [2:0]             rml_ecl_cleanwin_d;     // To writeback of sparc_exu_ecl_wb.v
188
input [2:0]             rml_ecl_cwp_d;          // To writeback of sparc_exu_ecl_wb.v, ...
189
input [1:0]             rml_ecl_gl_e;           // To eccctl of sparc_exu_ecl_eccctl.v
190
input                   rml_ecl_kill_m;         // To writeback of sparc_exu_ecl_wb.v
191
input [2:0]             rml_ecl_otherwin_d;     // To writeback of sparc_exu_ecl_wb.v
192
input                   rml_ecl_rmlop_done_e;   // To writeback of sparc_exu_ecl_wb.v
193
input [3:0]             rml_ecl_swap_done;      // To writeback of sparc_exu_ecl_wb.v
194
input [5:0]             rml_ecl_wstate_d;       // To writeback of sparc_exu_ecl_wb.v
195
input                   rst_tri_en;             // To eccctl of sparc_exu_ecl_eccctl.v
196
input                   sehold;                 // To writeback of sparc_exu_ecl_wb.v, ...
197
input [7:0]             tlu_exu_ccr_m;          // To ccr of sparc_exu_eclccr.v
198
input                   tlu_exu_cwpccr_update_m;// To ccr of sparc_exu_eclccr.v
199
// End of automatics
200
   input                                rclk;
201
   input        se;
202
   input        si;
203
   input        grst_l;
204
   input        arst_l;
205
   input        ifu_exu_dbrinst_d;// rs1 bypass should use pc
206
   input [2:0]  ifu_exu_aluop_d;// partially decoded op for exu operation
207
   input [2:0]  ifu_exu_shiftop_d;
208
   input        ifu_exu_invert_d;       // invert logic output
209
   input        ifu_exu_usecin_d;        // use cin for add ops
210
   input        ifu_exu_enshift_d;     // enable shifter
211
   input [3:0]  byp_ecl_rs2_3_0_e;
212
   input [2:0]  byp_ecl_rs1_2_0_e;
213
   input [2:0]  byp_ecl_rd_data_3lsb_m;
214
   input        ifu_exu_use_rsr_e_l;      // e stage instruction uses sr
215
   input        ifu_exu_rd_exusr_e;
216
   input        ifu_exu_rd_ifusr_e;
217
   input        ifu_exu_rd_ffusr_e;
218
   input        ifu_exu_rs1_vld_d;
219
   input        ifu_exu_rs2_vld_d;
220
   input        ifu_exu_rs3e_vld_d;
221
   input        ifu_exu_rs3o_vld_d;
222
   input        ifu_exu_dontmv_regz0_e;// a move instruction got killed
223
   input        ifu_exu_dontmv_regz1_e;
224
   input [4:0]  ifu_exu_rd_d;           // destination register
225
   input [1:0]  ifu_exu_tid_s2;          // thread of inst in s stage
226
   input        ifu_exu_kill_e;         // kill instruction in e-stage
227
   input        ifu_exu_wen_d;  // instruction in d-stage writes to regfile
228
   input        ifu_exu_ialign_d;// instruction is alignaddress
229
   input        exu_ifu_regz_e;
230
   input        alu_ecl_add_n64_e;
231
   input        alu_ecl_add_n32_e;
232
   input        alu_ecl_log_n64_e;
233
   input        alu_ecl_log_n32_e;
234
   input        alu_ecl_zhigh_e;
235
   input        alu_ecl_zlow_e;
236
   input        ifu_exu_setcc_d;
237
   input        lsu_exu_dfill_vld_g; // load data is valid
238
   input [4:0]  lsu_exu_rd_m;  // load destination register
239
   input [1:0]  lsu_exu_thr_m; // load thread
240
   input        lsu_exu_ldxa_m;
241
   input  byp_ecl_rs1_31_e;
242
   input  byp_ecl_rs2_31_e;
243
   input  byp_ecl_rs1_63_e;
244
   input       alu_ecl_cout64_e_l;
245
   input       alu_ecl_cout32_e;
246
   input       alu_ecl_adder_out_63_e;
247
   input       alu_ecl_adder_out_31_e;
248
   input       alu_ecl_adderin2_63_e;
249
   input       alu_ecl_adderin2_31_e;
250
   input [4:0]  ifu_exu_rs1_s;  // source addresses
251
   input [4:0]  ifu_exu_rs2_s;
252
   input [4:0]  ifu_exu_rs3_s;
253
   input        ifu_exu_tagop_d;// add or sub sets icc.v with tagged overflow
254
   input        ifu_exu_tv_d;   // 32 bit overflow causes exception
255
   input  ifu_exu_muls_d;
256
   input  [3:0] div_ecl_yreg_0_l;
257
   input  alu_ecl_mem_addr_invalid_e_l;
258
   input  ifu_exu_range_check_jlret_d;
259
   input  ifu_exu_range_check_other_d;
260
   input  ifu_exu_addr_mask_d;
261
   input      ifu_exu_save_d;
262
   input      ifu_exu_restore_d;
263
   input      ifu_exu_casa_d;
264
   input  rml_ecl_clean_window_e;
265
   input  rml_ecl_fill_e;
266
   input  rml_ecl_other_e;
267
   input  [2:0] rml_ecl_wtype_e;
268
   input        ifu_exu_tcc_e;
269
   input [7:0]  alu_ecl_adder_out_7_0_e;
270
   input       ifu_exu_useimm_d;
271
   input       ifu_exu_nceen_e;
272
   input       ifu_tlu_flush_m;
273
   input       ifu_exu_ttype_vld_m;
274
   input        tlu_exu_priv_trap_m;
275
   input        tlu_exu_pic_onebelow_m;
276
   input        tlu_exu_pic_twobelow_m;
277
   input       lsu_exu_flush_pipe_w;
278
   input       ifu_exu_sethi_inst_d;
279
   input       lsu_exu_st_dtlb_perr_g;
280
 
281
   /*AUTOOUTPUT*/
282
   // Beginning of automatic outputs (from unused autoinst outputs)
283
   output [7:0]         ecl_byp_ecc_mask_m_l;   // From eccctl of sparc_exu_ecl_eccctl.v
284
   output [7:0]         ecl_byp_eclpr_e;        // From writeback of sparc_exu_ecl_wb.v
285
   output               ecl_byp_sel_load_g;     // From writeback of sparc_exu_ecl_wb.v
286
   output               ecl_byp_sel_load_m;     // From writeback of sparc_exu_ecl_wb.v
287
   output               ecl_byp_sel_muldiv_g;   // From writeback of sparc_exu_ecl_wb.v
288
   output               ecl_byp_sel_pipe_m;     // From writeback of sparc_exu_ecl_wb.v
289
   output               ecl_byp_sel_restore_g;  // From writeback of sparc_exu_ecl_wb.v
290
   output               ecl_byp_sel_restore_m;  // From writeback of sparc_exu_ecl_wb.v
291
   output               ecl_div_almostlast_cycle;// From divcntl of sparc_exu_ecl_divcntl.v
292
   output               ecl_div_cin;            // From divcntl of sparc_exu_ecl_divcntl.v
293
   output               ecl_div_dividend_sign;  // From divcntl of sparc_exu_ecl_divcntl.v
294
   output               ecl_div_keep_d;         // From divcntl of sparc_exu_ecl_divcntl.v
295
   output               ecl_div_keepx;          // From divcntl of sparc_exu_ecl_divcntl.v
296
   output               ecl_div_last_cycle;     // From divcntl of sparc_exu_ecl_divcntl.v
297
   output               ecl_div_mul_get_32bit_data;// From mdqctl of sparc_exu_ecl_mdqctl.v
298
   output               ecl_div_mul_get_new_data;// From mdqctl of sparc_exu_ecl_mdqctl.v
299
   output               ecl_div_mul_keep_data;  // From mdqctl of sparc_exu_ecl_mdqctl.v
300
   output               ecl_div_mul_sext_rs1_e; // From mdqctl of sparc_exu_ecl_mdqctl.v
301
   output               ecl_div_mul_sext_rs2_e; // From mdqctl of sparc_exu_ecl_mdqctl.v
302
   output               ecl_div_newq;           // From divcntl of sparc_exu_ecl_divcntl.v
303
   output               ecl_div_sel_64b;        // From divcntl of sparc_exu_ecl_divcntl.v
304
   output               ecl_div_sel_adder;      // From divcntl of sparc_exu_ecl_divcntl.v
305
   output               ecl_div_sel_neg32;      // From divcntl of sparc_exu_ecl_divcntl.v
306
   output               ecl_div_sel_pos32;      // From divcntl of sparc_exu_ecl_divcntl.v
307
   output               ecl_div_sel_u32;        // From divcntl of sparc_exu_ecl_divcntl.v
308
   output               ecl_div_subtract_l;     // From divcntl of sparc_exu_ecl_divcntl.v
309
   output               ecl_div_upper32_zero;   // From divcntl of sparc_exu_ecl_divcntl.v
310
   output               ecl_div_upper33_one;    // From divcntl of sparc_exu_ecl_divcntl.v
311
   output               ecl_div_upper33_zero;   // From divcntl of sparc_exu_ecl_divcntl.v
312
   output               ecl_div_xinmask;        // From divcntl of sparc_exu_ecl_divcntl.v
313
   output [3:0]         ecl_div_yreg_shift_g;   // From writeback of sparc_exu_ecl_wb.v
314
   output [3:0]         ecl_div_yreg_wen_g;     // From writeback of sparc_exu_ecl_wb.v
315
   output [3:0]         ecl_div_yreg_wen_l;     // From writeback of sparc_exu_ecl_wb.v
316
   output [3:0]         ecl_div_yreg_wen_w;     // From writeback of sparc_exu_ecl_wb.v
317
   output               ecl_ecc_log_rs1_m;      // From eccctl of sparc_exu_ecl_eccctl.v
318
   output               ecl_ecc_log_rs2_m;      // From eccctl of sparc_exu_ecl_eccctl.v
319
   output               ecl_ecc_log_rs3_m;      // From eccctl of sparc_exu_ecl_eccctl.v
320
   output               ecl_ecc_sel_rs1_m_l;    // From eccctl of sparc_exu_ecl_eccctl.v
321
   output               ecl_ecc_sel_rs2_m_l;    // From eccctl of sparc_exu_ecl_eccctl.v
322
   output               ecl_ecc_sel_rs3_m_l;    // From eccctl of sparc_exu_ecl_eccctl.v
323
   output               ecl_rml_canrestore_wen_w;// From writeback of sparc_exu_ecl_wb.v
324
   output               ecl_rml_cansave_wen_w;  // From writeback of sparc_exu_ecl_wb.v
325
   output               ecl_rml_cleanwin_wen_w; // From writeback of sparc_exu_ecl_wb.v
326
   output               ecl_rml_cwp_wen_e;      // From writeback of sparc_exu_ecl_wb.v
327
   output               ecl_rml_otherwin_wen_w; // From writeback of sparc_exu_ecl_wb.v
328
   output               ecl_rml_wstate_wen_w;   // From writeback of sparc_exu_ecl_wb.v
329
   output               exu_ffu_wsr_inst_e;     // From writeback of sparc_exu_ecl_wb.v
330
   output               exu_ifu_ecc_ce_m;       // From eccctl of sparc_exu_ecl_eccctl.v
331
   output               exu_ifu_ecc_ue_m;       // From eccctl of sparc_exu_ecl_eccctl.v
332
   output [7:0]         exu_ifu_err_reg_m;      // From eccctl of sparc_exu_ecl_eccctl.v
333
   output               exu_ifu_err_synd_7_m;   // From eccctl of sparc_exu_ecl_eccctl.v
334
   output               exu_ifu_inj_ack;        // From eccctl of sparc_exu_ecl_eccctl.v
335
   output [3:0]         exu_ifu_longop_done_g;  // From writeback of sparc_exu_ecl_wb.v
336
   output               exu_mul_input_vld;      // From mdqctl of sparc_exu_ecl_mdqctl.v
337
   output [7:0]         exu_tlu_ccr0_w;         // From ccr of sparc_exu_eclccr.v
338
   output [7:0]         exu_tlu_ccr1_w;         // From ccr of sparc_exu_eclccr.v
339
   output [7:0]         exu_tlu_ccr2_w;         // From ccr of sparc_exu_eclccr.v
340
   output [7:0]         exu_tlu_ccr3_w;         // From ccr of sparc_exu_eclccr.v
341
   // End of automatics
342
   output               so;
343
   output               ecl_byp_sel_alu_e;
344
   output               ecl_byp_sel_eclpr_e;
345
   output               ecl_byp_sel_yreg_e;
346
   output               ecl_byp_sel_ifusr_e;
347
   output               ecl_byp_sel_ffusr_m;
348
   output               ecl_byp_sel_ifex_m;
349
   output               ecl_byp_sel_tlusr_m;
350
   output   exu_ifu_va_oor_m;
351
   output ecl_alu_out_sel_sum_e_l;
352
   output ecl_alu_out_sel_rs3_e_l;
353
   output ecl_alu_out_sel_shift_e_l;
354
   output ecl_alu_out_sel_logic_e_l;
355
   output ecl_alu_log_sel_and_e;
356
   output ecl_alu_log_sel_or_e;
357
   output ecl_alu_log_sel_xor_e;
358
   output ecl_alu_log_sel_move_e;
359
   output ecl_alu_sethi_inst_e;
360
   output ecl_alu_cin_e;    // cin for add/sub operations
361
   output  ecl_shft_lshift_e_l;  // if 0 do left shift.  else right shift
362
   output  ecl_shft_op32_e;      // indicates 32 bit operation so upper 32 = 0
363
   //output [3:0] ecl_shft_shift16_e;// [48, 32, 16, 0] shift
364
   output [3:0] ecl_shft_shift4_e;// [12, 8, 4, 0] shift
365
   output [3:0] ecl_shft_shift1_e;// [3, 2, 1, 0] shift
366
   output        ecl_shft_enshift_e_l;// enables inputs to shifter
367
   output        ecl_byp_restore_m;
368
   output ecl_byp_rs1_mux2_sel_e;// select lines for bypass muxes for rs1
369
   output ecl_byp_rs1_mux2_sel_rf;
370
   output ecl_byp_rs1_mux2_sel_ld;
371
   output ecl_byp_rs1_mux2_sel_usemux1;
372
   output ecl_byp_rs1_mux1_sel_m;
373
   output ecl_byp_rs1_mux1_sel_w;
374
   output ecl_byp_rs1_mux1_sel_w2;
375
   output ecl_byp_rs1_mux1_sel_other;
376
   output ecl_byp_rcc_mux2_sel_e;// select lines for bypass muxes for rcc
377
   output ecl_byp_rcc_mux2_sel_rf;
378
   output ecl_byp_rcc_mux2_sel_ld;
379
   output ecl_byp_rcc_mux2_sel_usemux1;
380
   output ecl_byp_rcc_mux1_sel_m;
381
   output ecl_byp_rcc_mux1_sel_w;
382
   output ecl_byp_rcc_mux1_sel_w2;
383
   output ecl_byp_rcc_mux1_sel_other;
384
   output ecl_byp_rs2_mux2_sel_e;// select lines for bypass muxes for rs2
385
   output ecl_byp_rs2_mux2_sel_rf;
386
   output ecl_byp_rs2_mux2_sel_ld;
387
   output ecl_byp_rs2_mux2_sel_usemux1;
388
   output ecl_byp_rs2_mux1_sel_m;
389
   output ecl_byp_rs2_mux1_sel_w;
390
   output ecl_byp_rs2_mux1_sel_w2;
391
   output ecl_byp_rs2_mux1_sel_other;
392
   output ecl_byp_rs3_mux2_sel_e; // select lines for bypass muxes for rs3
393
   output ecl_byp_rs3_mux2_sel_rf;
394
   output ecl_byp_rs3_mux2_sel_ld;
395
   output ecl_byp_rs3_mux2_sel_usemux1;
396
   output ecl_byp_rs3_mux1_sel_m;
397
   output ecl_byp_rs3_mux1_sel_w;
398
   output ecl_byp_rs3_mux1_sel_w2;
399
   output ecl_byp_rs3_mux1_sel_other;
400
   output ecl_byp_rs3h_mux2_sel_e; // select lines for bypass muxes for rs3 double
401
   output ecl_byp_rs3h_mux2_sel_rf;
402
   output ecl_byp_rs3h_mux2_sel_ld;
403
   output ecl_byp_rs3h_mux2_sel_usemux1;
404
   output ecl_byp_rs3h_mux1_sel_m;
405
   output ecl_byp_rs3h_mux1_sel_w;
406
   output ecl_byp_rs3h_mux1_sel_w2;
407
   output ecl_byp_rs3h_mux1_sel_other;
408
   output ecl_byp_rs1_longmux_sel_g2;
409
   output ecl_byp_rs1_longmux_sel_w2;
410
   output ecl_byp_rs1_longmux_sel_ldxa;
411
   output ecl_byp_rs2_longmux_sel_g2;
412
   output ecl_byp_rs2_longmux_sel_w2;
413
   output ecl_byp_rs2_longmux_sel_ldxa;
414
   output ecl_byp_rs3_longmux_sel_g2;
415
   output ecl_byp_rs3_longmux_sel_w2;
416
   output ecl_byp_rs3_longmux_sel_ldxa;
417
   output ecl_byp_rs3h_longmux_sel_g2;
418
   output ecl_byp_rs3h_longmux_sel_w2;
419
   output ecl_byp_rs3h_longmux_sel_ldxa;
420
   output ecl_byp_std_e_l;
421
   output ecl_byp_ldxa_g;       // use the ldxa return data
422
   output [2:0] ecl_byp_3lsb_m;
423
   output                ecl_ecc_rs1_use_rf_e;
424
   output                ecl_ecc_rs2_use_rf_e;
425
   output                ecl_ecc_rs3_use_rf_e;
426
   output  [4:0] ecl_irf_rd_m;
427
   output  [1:0] ecl_irf_tid_m;
428
   output        ecl_irf_wen_w;
429
   output        ecl_irf_wen_w2;// write enable for w2
430
   output  [4:0] ecl_irf_rd_g; // w2 destination register
431
   output [1:0]  ecl_irf_tid_g;     // thread of inst in long w stage
432
   output [3:0]  ecl_div_thr_e;
433
   output [3:0] ecl_rml_thr_m;
434
   output [3:0] ecl_rml_thr_w;
435
   output [2:0] ecl_rml_xor_data_e;
436
   output        ecl_div_ld_inputs;
437
   output        ecl_div_sel_div;
438
   output        ecl_div_div64;
439
   output [7:0]  exu_ifu_cc_d;
440
   output ecl_shft_extendbit_e;     // bit that gets appended on right shifts
441
   output ecl_shft_extend32bit_e_l;   // bit that gets appended on 32 bit right shfts
442
   output         ecl_div_zero_rs2_e;// used on muls ops
443
   output         ecl_div_muls_rs1_31_e_l;
444
   output         ecl_div_yreg_data_31_g;
445
   output         exu_tlu_va_oor_m;
446
   output         exu_tlu_va_oor_jl_ret_m;
447
   output        ecl_rml_kill_e;
448
   output        ecl_rml_kill_w;
449
   output        ecl_byp_sel_ecc_m;
450
   output [8:0] exu_tlu_ttype_m;
451
   output       exu_tlu_ttype_vld_m;
452
   output       exu_tlu_ue_trap_m;
453
   output   exu_tlu_misalign_addr_jmpl_rtn_m;
454
   output   exu_lsu_priority_trap_m;
455
   output   ecl_div_mul_wen;
456
   output   ecl_div_muls;
457
   output   ecl_rml_early_flush_w;
458
   output   ecl_rml_inst_vld_w;
459
   output   ecl_alu_casa_e;
460
 
461
 
462
   /*AUTOWIRE*/
463
   // Beginning of automatic wires (for undeclared instantiated-module outputs)
464
   wire                 bypass_m;               // From writeback of sparc_exu_ecl_wb.v
465
   wire                 bypass_w;               // From writeback of sparc_exu_ecl_wb.v
466
   wire [7:0]           divcntl_ccr_cc_w2;      // From divcntl of sparc_exu_ecl_divcntl.v
467
   wire                 divcntl_wb_req_g;       // From divcntl of sparc_exu_ecl_divcntl.v
468
   wire [4:0]           eccctl_wb_rd_m;         // From eccctl of sparc_exu_ecl_eccctl.v
469
   wire                 ecl_div_signed_div;     // From mdqctl of sparc_exu_ecl_mdqctl.v
470
   wire                 mdqctl_divcntl_input_vld;// From mdqctl of sparc_exu_ecl_mdqctl.v
471
   wire                 mdqctl_divcntl_muldone; // From mdqctl of sparc_exu_ecl_mdqctl.v
472
   wire                 mdqctl_divcntl_reset_div;// From mdqctl of sparc_exu_ecl_mdqctl.v
473
   wire [4:0]           mdqctl_wb_divrd_g;      // From mdqctl of sparc_exu_ecl_mdqctl.v
474
   wire                 mdqctl_wb_divsetcc_g;   // From mdqctl of sparc_exu_ecl_mdqctl.v
475
   wire [1:0]           mdqctl_wb_divthr_g;     // From mdqctl of sparc_exu_ecl_mdqctl.v
476
   wire [4:0]           mdqctl_wb_mulrd_g;      // From mdqctl of sparc_exu_ecl_mdqctl.v
477
   wire                 mdqctl_wb_mulsetcc_g;   // From mdqctl of sparc_exu_ecl_mdqctl.v
478
   wire [1:0]           mdqctl_wb_multhr_g;     // From mdqctl of sparc_exu_ecl_mdqctl.v
479
   wire                 mdqctl_wb_yreg_shift_g; // From mdqctl of sparc_exu_ecl_mdqctl.v
480
   wire                 mdqctl_wb_yreg_wen_g;   // From mdqctl of sparc_exu_ecl_mdqctl.v
481
   wire [4:0]           wb_byplog_rd_g2;        // From writeback of sparc_exu_ecl_wb.v
482
   wire [4:0]           wb_byplog_rd_w2;        // From writeback of sparc_exu_ecl_wb.v
483
   wire [1:0]           wb_byplog_tid_w2;       // From writeback of sparc_exu_ecl_wb.v
484
   wire                 wb_byplog_wen_g2;       // From writeback of sparc_exu_ecl_wb.v
485
   wire                 wb_byplog_wen_w2;       // From writeback of sparc_exu_ecl_wb.v
486
   wire                 wb_ccr_setcc_g;         // From writeback of sparc_exu_ecl_wb.v
487
   wire                 wb_ccr_wrccr_w;         // From writeback of sparc_exu_ecl_wb.v
488
   wire                 wb_divcntl_ack_g;       // From writeback of sparc_exu_ecl_wb.v
489
   wire                 wb_e;                   // From writeback of sparc_exu_ecl_wb.v
490
   wire                 wb_eccctl_spec_wen_next;// From writeback of sparc_exu_ecl_wb.v
491
   // End of automatics
492
   wire                 clk;
493
   wire                 reset;
494
   wire                 ecl_reset_l;
495
   wire                ecl_byp_rs1_mux2_sel_rf;// To eccctl of sparc_exu_ecl_eccctl.v
496
   wire                ecl_byp_rs2_mux2_sel_rf;// To eccctl of sparc_exu_ecl_eccctl.v
497
   wire                ecl_byp_rs3_mux2_sel_rf;// To eccctl of sparc_exu_ecl_eccctl.v
498
   wire                ldxa_g;
499
   wire                ecl_byp_ldxa_g;
500
   wire                rs1_vld_e;
501
   wire                rs2_vld_e;
502
   wire                std_d;
503
   wire                std_e;
504
   wire                rs3_vld_d;
505
   wire                rs3_vld_e;
506
   wire                cancel_rs3_ecc_e;
507
   wire [4:0]  ifu_exu_rs1_d;  // source addresses
508
   wire [4:0]  ifu_exu_rs2_d;
509
   wire [4:0]  ifu_exu_rs3_d;
510
   wire [2:0]   ifu_exu_aluop_e;
511
   wire [2:0]   shiftop_d;
512
   wire [2:0]   shiftop_e;
513
   wire         enshift_e;
514
   wire         sel_sum_d;
515
   wire         sel_sum_e;
516
   wire         sub_e;        // Do subtraction for add ops
517
   wire         shft_sext_e;     // sign extend for R shift.  must be 0 for left
518
   wire         is_logic_e;       // opcode is for logic op
519
   wire         dont_move_e;
520
   wire         sethi_e;
521
   wire [4:0]   rd_e;
522
   wire  [4:0] rd_m;
523
   wire  [4:0] ecl_irf_rd_w;
524
   wire [1:0]  tid_d;
525
   wire [3:0] thr_d;
526
   wire [1:0]  tid_e;
527
   wire  [1:0] tid_m;
528
   wire [1:0]  tid_w;
529
   wire [1:0]  tid_w1;
530
   wire  [1:0] ecl_irf_tid_w;
531
   wire [3:0]  thr_m;
532
   wire [3:0]  ecl_rml_thr_w;
533
   wire        ecl_irf_wen_w;
534
   wire          extend64bit;   // bit that gets appended on 64 bit right shfts
535
   wire         c_used_d;       // actual c_in calculated in d_stage
536
   wire [1:0]  adder_xcc;
537
   wire [1:0]  adder_icc;
538
   wire        cc_e_3;          // cc_e for muls
539
   wire        cc_e_1;
540
   wire [3:0]  alu_xcc_e; // 64 bit ccs NZVC
541
   wire [3:0]  alu_icc_e; // 32 bit ccs NZVC
542
   wire        ialign_e;
543
   wire        ialign_m;
544
   wire        ifu_exu_tv_e;
545
   wire        ifu_exu_tagop_e;
546
   wire        tag_overflow;    // tag overflow has occured
547
   wire     tag_overflow_trap_e;
548
   wire           ifu_exu_range_check_jlret_e;
549
   wire           ifu_exu_range_check_other_e;
550
   wire           addr_mask_e;
551
   wire           valid_range_check_jlret_e;
552
   wire           ifu_exu_range_check_jlret_m;
553
   wire           ifu_exu_range_check_other_m;
554
   wire           alu_ecl_mem_addr_invalid_m_l;
555
   wire           misalign_addr_e;
556
   wire           muls_rs1_31_m_l;
557
   wire           rs2_data_31_m;
558
   wire       save_e;
559
   wire       restore_e;
560
   wire [4:0] real_rd_e;
561
   wire       ifu_tlu_flush_w;
562
   wire          flush_w;
563
   wire          flush_w1;
564
   wire          part_early_flush_m;
565
   wire          part_early_flush_w;
566
   wire          pic_trap_m;
567
   wire          inst_vld_w1;
568
   wire          tlu_priv_trap_w;
569
   wire          early_flush_w;
570
   wire          thr_match_ew;
571
   wire          thr_match_mw1;
572
   wire          thr_match_mw;
573
   wire          thr_match_sd;
574
   wire          thr_match_de;
575
   wire          thr_match_se;
576
   wire          thr_match_dm;
577
   wire          ld_thr_match_sm;
578
   wire          ld_thr_match_dg;
579
   wire          ld_thr_match_sg;
580
   wire          ld_thr_match_dg2;
581
   wire              ecl_exu_kill_m;
582
   wire              kill_rml_m;
583
   wire          kill_rml_w;
584
   wire [3:0]    perr_store_next;
585
   wire [3:0]    perr_store;
586
   wire [3:0]    perr_kill;
587
   wire [4:0]    ld_rd_g;
588
   wire [1:0]    ld_tid_g;
589
 
590
   wire          read_yreg_e;
591
   wire          read_ffusr_e;
592
   wire          read_tlusr_e;
593
   wire          read_ffusr_m;
594
   wire          read_tlusr_m;
595
 
596
   // trap logic
597
   wire          ue_trap_m;
598
   wire [8:0]    early1_ttype_e;
599
   wire [8:0]    early2_ttype_e;
600
   wire [8:0]    early_ttype_m;
601
   wire          early_ttype_vld_e;
602
   wire          early_ttype_vld_m;
603
   wire          pick_not_aligned;
604
   wire          pick_tcc;
605
   wire          pick_normal_ttype;
606
   wire          fill_trap_e;
607
   wire          fill_trap_m;
608
   wire       next_yreg_data_31;
609
   wire       muls_e;
610
   wire       zero_rs2_d;
611
   wire       div_e;
612
   wire       div_zero_m;
613
 
614
 
615
   wire [4:0]  ifu_exu_rs1_e;
616
   wire [4:0]  ifu_exu_rs1_m;
617
   wire [4:0]  ifu_exu_rs2_e;
618
   wire [4:0]  ifu_exu_rs2_m;
619
   wire [4:0]  ifu_exu_rs3_e;
620
   wire [4:0]  ifu_exu_rs3_m;
621
   wire [3:0]  div_ecl_yreg_0;
622
   wire   div_ecl_yreg_0_d;
623
 
624
   assign clk = rclk;
625
   // Reset flop
626
    dffrl_async rstff(.din (grst_l),
627
                        .q   (ecl_reset_l),
628
                        .clk (clk),
629 113 albert.wat
                        .rst_l (arst_l), .se(se), `SIMPLY_RISC_SCANIN, .so());
630 95 fafa1971
   assign reset = ~ecl_reset_l;
631
 
632
   // Pipeline flops for irf control signals
633 113 albert.wat
   dff_s #(5) dff_rs1_s2d(.din(ifu_exu_rs1_s[4:0]), .clk(clk), .q(ifu_exu_rs1_d[4:0]), .se(se),
634
                      `SIMPLY_RISC_SCANIN,.so());
635
   dff_s #(5) dff_rs2_s2d(.din(ifu_exu_rs2_s[4:0]), .clk(clk), .q(ifu_exu_rs2_d[4:0]), .se(se),
636
                      `SIMPLY_RISC_SCANIN,.so());
637
   dff_s #(5) dff_rs3_s2d(.din(ifu_exu_rs3_s[4:0]), .clk(clk), .q(ifu_exu_rs3_d[4:0]), .se(se),
638
                      `SIMPLY_RISC_SCANIN,.so());
639
   dff_s #(5) dff_rs1_d2e(.din(ifu_exu_rs1_d[4:0]), .clk(clk), .q(ifu_exu_rs1_e[4:0]), .se(se),
640
                      `SIMPLY_RISC_SCANIN,.so());
641
   dff_s #(5) dff_rs2_d2e(.din(ifu_exu_rs2_d[4:0]), .clk(clk), .q(ifu_exu_rs2_e[4:0]), .se(se),
642
                      `SIMPLY_RISC_SCANIN,.so());
643
   dff_s #(5) dff_rs3_d2e(.din(ifu_exu_rs3_d[4:0]), .clk(clk), .q(ifu_exu_rs3_e[4:0]), .se(se),
644
                      `SIMPLY_RISC_SCANIN,.so());
645
   dff_s #(5) dff_rs1_e2m(.din(ifu_exu_rs1_e[4:0]), .clk(clk), .q(ifu_exu_rs1_m[4:0]), .se(se),
646
                      `SIMPLY_RISC_SCANIN,.so());
647
   dff_s #(5) dff_rs2_e2m(.din(ifu_exu_rs2_e[4:0]), .clk(clk), .q(ifu_exu_rs2_m[4:0]), .se(se),
648
                      `SIMPLY_RISC_SCANIN,.so());
649
   dff_s #(5) dff_rs3_e2m(.din(ifu_exu_rs3_e[4:0]), .clk(clk), .q(ifu_exu_rs3_m[4:0]), .se(se),
650
                      `SIMPLY_RISC_SCANIN,.so());
651
   dff_s #(5) dff_ld_rd_m2g(.din(lsu_exu_rd_m[4:0]), .clk(clk), .q(ld_rd_g[4:0]), .se(se), `SIMPLY_RISC_SCANIN, .so());
652
   dff_s #(2) dff_ld_tid_m2g(.din(lsu_exu_thr_m[1:0]), .clk(clk), .q(ld_tid_g[1:0]), .se(se), `SIMPLY_RISC_SCANIN, .so());
653 95 fafa1971
 
654
   // Pipeline flops for control signals
655 113 albert.wat
   dff_s #(3) dff_aluop_d2e(.din(ifu_exu_aluop_d[2:0]), .clk(clk), .q(ifu_exu_aluop_e[2:0]),
656
                        .se(se), `SIMPLY_RISC_SCANIN, .so());
657
   dff_s #(3) dff_shiftop_d2e(.din(shiftop_d[2:0]), .clk(clk),
658 95 fafa1971
                          .q(shiftop_e[2:0]), .se(se),
659 113 albert.wat
                          `SIMPLY_RISC_SCANIN, .so());
660
   dff_s dff_enshift_d2e(.din(ifu_exu_enshift_d), .clk(clk), .q(enshift_e),
661
                       .se(se), `SIMPLY_RISC_SCANIN, .so());
662
   dff_s dff_sel_sum_d2e(.din(sel_sum_d), .clk(clk), .q(sel_sum_e),
663
                       .se(se), `SIMPLY_RISC_SCANIN, .so());
664
   dff_s dff_tv_d2e(.din(ifu_exu_tv_d), .clk(clk), .q(ifu_exu_tv_e),
665
                  .se(se), `SIMPLY_RISC_SCANIN, .so());
666
   dff_s dff_tagop_d2e(.din(ifu_exu_tagop_d), .clk(clk), .q(ifu_exu_tagop_e),
667
                  .se(se), `SIMPLY_RISC_SCANIN, .so());
668
   dff_s dff_ialign_d2e(.din(ifu_exu_ialign_d), .clk(clk), .q(ialign_e),
669
                      .se(se), `SIMPLY_RISC_SCANIN, .so());
670
   dff_s dff_ialign_e2m(.din(ialign_e), .clk(clk), .q(ialign_m),
671
                      .se(se), `SIMPLY_RISC_SCANIN, .so());
672
   dff_s ldxa_dff(.din(lsu_exu_ldxa_m), .clk(clk), .q(ldxa_g), .se(se), `SIMPLY_RISC_SCANIN, .so());
673
   dff_s sethi_d2e(.din(ifu_exu_sethi_inst_d), .clk(clk), .q(sethi_e), .se(se), `SIMPLY_RISC_SCANIN, .so());
674
   dff_s rs1_vld_d2e(.din(ifu_exu_rs1_vld_d), .clk(clk), .q(rs1_vld_e), .se(se), `SIMPLY_RISC_SCANIN, .so());
675
   dff_s rs2_vld_d2e(.din(ifu_exu_rs2_vld_d), .clk(clk), .q(rs2_vld_e), .se(se), `SIMPLY_RISC_SCANIN, .so());
676 95 fafa1971
   assign rs3_vld_d = ifu_exu_rs3e_vld_d | ifu_exu_rs3o_vld_d;
677 113 albert.wat
   dff_s rs3_vld_d2e(.din(rs3_vld_d), .q(rs3_vld_e), .clk(clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
678
   dff_s casa_d2e(.din(ifu_exu_casa_d), .q(ecl_alu_casa_e), .clk(clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
679 95 fafa1971
 
680
   ///////////////////////////////
681
   // ALU Control
682
   ///////////////////////////////
683
   // Decode opcode for ALU
684
   // aluop: [move, log1, log0]
685
   // ADD = 00, AND = 01, OR = 10, XOR = 11
686
   // log_sel: [and, or, xor, pass]
687
   // out_sel: [sum, logic, shift]
688
   assign ecl_alu_log_sel_and_e =
689
          (~ifu_exu_aluop_e[2] & ~ifu_exu_aluop_e[1] & ifu_exu_aluop_e[0]);
690
   assign ecl_alu_log_sel_or_e = (~ifu_exu_aluop_e[2] & ifu_exu_aluop_e[1]
691
                                     & ~ifu_exu_aluop_e[0]);
692
   assign ecl_alu_log_sel_xor_e = (~ifu_exu_aluop_e[2] & ifu_exu_aluop_e[1]
693
                                      & ifu_exu_aluop_e[0]);
694
   assign ecl_alu_log_sel_move_e =
695
          (ifu_exu_aluop_e[2] | ~(ifu_exu_aluop_e[1] | ifu_exu_aluop_e[0]));
696
 
697
   assign is_logic_e = ifu_exu_aluop_e[2] | ifu_exu_aluop_e[1] |
698
          ifu_exu_aluop_e[0];
699
 
700
   assign ecl_alu_sethi_inst_e = sethi_e;// | ifu_exu_sethi_inst_e;
701
 
702
   assign dont_move_e = (exu_ifu_regz_e)? ifu_exu_dontmv_regz1_e:ifu_exu_dontmv_regz0_e;
703
 
704
   assign sel_sum_d = ~(ifu_exu_enshift_d | ifu_exu_aluop_d[2] |ifu_exu_aluop_d[1] |ifu_exu_aluop_d[0]);
705
   assign ecl_alu_out_sel_sum_e_l = ~sel_sum_e;
706
   assign ecl_alu_out_sel_shift_e_l = ~(~is_logic_e & ~sel_sum_e);
707
   assign ecl_alu_out_sel_logic_e_l = ~(is_logic_e & ~dont_move_e & ~sel_sum_e);
708
   assign ecl_alu_out_sel_rs3_e_l = ~(is_logic_e & dont_move_e & ~sel_sum_e);// dontmove includes is_logic
709
 
710
   assign ecl_byp_sel_alu_e = ifu_exu_use_rsr_e_l;
711
   assign ecl_byp_sel_ifusr_e = ~ifu_exu_use_rsr_e_l & ifu_exu_rd_ifusr_e;
712
   assign ecl_byp_sel_yreg_e = ~ifu_exu_use_rsr_e_l & ~ifu_exu_rd_ifusr_e & read_yreg_e;
713
   assign ecl_byp_sel_eclpr_e = ~ifu_exu_use_rsr_e_l & ~ifu_exu_rd_ifusr_e & ~read_yreg_e;
714
 
715
   assign read_ffusr_e = ~ifu_exu_use_rsr_e_l & ifu_exu_rd_ffusr_e;
716
   assign read_tlusr_e = ~ifu_exu_use_rsr_e_l & ~ifu_exu_rd_ffusr_e & ~ifu_exu_rd_ifusr_e & ~ifu_exu_rd_exusr_e;
717
   assign ecl_byp_sel_ffusr_m = read_ffusr_m;
718
   assign ecl_byp_sel_tlusr_m = read_tlusr_m & ~read_ffusr_m;
719
   assign ecl_byp_sel_ifex_m = ~read_tlusr_m & ~read_ffusr_m;
720
 
721 113 albert.wat
   dff_s #(2) rsr_e2m(.din({read_ffusr_e, read_tlusr_e}), .clk(clk),
722
                    .q({read_ffusr_m, read_tlusr_m}), .se(se), `SIMPLY_RISC_SCANIN, .so());
723 95 fafa1971
 
724
   // ecc checking on rs3 will be cancelled if mov happens
725
   assign cancel_rs3_ecc_e = ~dont_move_e & is_logic_e;
726
 
727
   // compute xor for write to cwp
728
   assign ecl_rml_xor_data_e = byp_ecl_rs1_2_0_e[2:0] ^ byp_ecl_rs2_3_0_e[2:0];
729
   // Logic for muls control signals
730
   // icc.v ^ icc.n
731
   assign         ecl_div_muls_rs1_31_e_l = ~(cc_e_3 ^ cc_e_1);
732
   assign div_ecl_yreg_0[3:0] = ~div_ecl_yreg_0_l[3:0];
733
   mux4ds yreg0_mux(.dout(div_ecl_yreg_0_d),
734
                    .in0(div_ecl_yreg_0[0]),
735
                    .in1(div_ecl_yreg_0[1]),
736
                    .in2(div_ecl_yreg_0[2]),
737
                    .in3(div_ecl_yreg_0[3]),
738
                    .sel0(thr_d[0]),
739
                    .sel1(thr_d[1]),
740
                    .sel2(thr_d[2]),
741
                    .sel3(thr_d[3]));
742
 
743
   assign zero_rs2_d = ifu_exu_muls_d & ~div_ecl_yreg_0_d;
744
 
745
   assign next_yreg_data_31 = (muls_e)? byp_ecl_rs1_2_0_e[0]:ecl_div_yreg_data_31_g;
746 113 albert.wat
   dff_s dff_rs1_b0_m2w(.din(next_yreg_data_31), .clk(clk), .q(ecl_div_yreg_data_31_g),
747
                .se(se), `SIMPLY_RISC_SCANIN, .so());
748 95 fafa1971
 
749
   // Logic for carryin and subtract
750
   assign      c_used_d = ~(ifu_exu_invert_d ^ ~(exu_ifu_cc_d[0] & ifu_exu_usecin_d));
751
   // Pipeline flops
752 113 albert.wat
   dff_s sub_dff(.din(ifu_exu_invert_d), .clk(clk), .q(sub_e), .se(se),
753
               `SIMPLY_RISC_SCANIN, .so());
754
   dff_s c_used_dff(.din(c_used_d), .clk(clk), .q(ecl_alu_cin_e), .se(se),
755
                 `SIMPLY_RISC_SCANIN, .so());
756
   dff_s dff_muls_d2e(.din(ifu_exu_muls_d), .clk(clk), .q(muls_e),
757
                .se(se), `SIMPLY_RISC_SCANIN, .so());
758
   dff_s zero_rs2_dff(.din(zero_rs2_d), .clk(clk), .q(ecl_div_zero_rs2_e),
759
                    .se(se), `SIMPLY_RISC_SCANIN, .so());
760
   dff_s #(2) cc_d2e(.din({exu_ifu_cc_d[3],exu_ifu_cc_d[1]}), .clk(clk), .q({cc_e_3,cc_e_1}),
761
                   .se(se), `SIMPLY_RISC_SCANIN, .so());
762
   dff_s mulsrs131_e2m(.din(ecl_div_muls_rs1_31_e_l), .clk(clk),
763 95 fafa1971
                     .q(muls_rs1_31_m_l),
764 113 albert.wat
                     .se(se), `SIMPLY_RISC_SCANIN, .so());
765
   dff_s rs2_31_e2m(.din(byp_ecl_rs2_31_e), .clk(clk),
766
                  .q(rs2_data_31_m), .se(se), `SIMPLY_RISC_SCANIN, .so());
767 95 fafa1971
 
768 113 albert.wat
   dff_s save_dff(.din(ifu_exu_save_d), .clk(clk), .q(save_e), .se(se),
769
                `SIMPLY_RISC_SCANIN, .so());
770
   dff_s restore_dff(.din(ifu_exu_restore_d), .clk(clk), .q(restore_e), .se(se),
771
                `SIMPLY_RISC_SCANIN, .so());
772 95 fafa1971
 
773
   // Condition code generation
774
   assign      adder_xcc[0] = (~alu_ecl_cout64_e_l ^ sub_e) & sel_sum_e;
775
   assign      adder_icc[0] = (alu_ecl_cout32_e ^ sub_e) & sel_sum_e;
776
/* -----\/----- EXCLUDED -----\/-----
777
   assign adder_xcc[1] = ((byp_ecl_rs1_63_e & alu_ecl_adderin2_63_e &
778
                             ~alu_ecl_adder_out_63_e) |
779
                           (~byp_ecl_rs1_63_e & ~alu_ecl_adderin2_63_e &
780
                             alu_ecl_adder_out_63_e));
781
   assign adder_icc[1] = ((byp_ecl_rs1_31_e & alu_ecl_adderin2_31_e &
782
                             ~alu_ecl_adder_out_31_e) |
783
                           (~byp_ecl_rs1_31_e & ~alu_ecl_adderin2_31_e &
784
                             alu_ecl_adder_out_31_e));
785
 -----/\----- EXCLUDED -----/\----- */
786
   assign adder_xcc[1] = (alu_ecl_adder_out_63_e) ? (~byp_ecl_rs1_63_e & ~alu_ecl_adderin2_63_e & sel_sum_e):
787
                                                      (byp_ecl_rs1_63_e & alu_ecl_adderin2_63_e & sel_sum_e);
788
   assign adder_icc[1] = (alu_ecl_adder_out_31_e) ? ((~byp_ecl_rs1_31_e & ~alu_ecl_adderin2_31_e | tag_overflow)
789
                                                     & sel_sum_e):
790
                                                      ((byp_ecl_rs1_31_e & alu_ecl_adderin2_31_e | tag_overflow)
791
                                                       & sel_sum_e);
792
   // Tagged overflow
793
   assign tag_overflow = (byp_ecl_rs1_2_0_e[0] | byp_ecl_rs1_2_0_e[1] |
794
                          byp_ecl_rs2_3_0_e[0] | byp_ecl_rs2_3_0_e[1]) & ifu_exu_tagop_e;
795
 
796
   // Set V C ccs assuming they are 0s for logic and shifting
797
   assign alu_xcc_e[3] = (sel_sum_e)? alu_ecl_add_n64_e: alu_ecl_log_n64_e;
798
   assign alu_xcc_e[2] = alu_ecl_zlow_e & alu_ecl_zhigh_e;
799
   assign alu_xcc_e[1:0] = adder_xcc[1:0]; // includes sel_sum
800
 
801
   assign alu_icc_e[3] = (sel_sum_e)? alu_ecl_add_n32_e: alu_ecl_log_n32_e;
802
   assign alu_icc_e[2] = alu_ecl_zlow_e;
803
   assign alu_icc_e[1:0] = adder_icc[1:0]; // includes sel_sum
804
 
805
   // Tag overflow exception on TV instruction with icc.v
806
   assign   tag_overflow_trap_e = ifu_exu_tv_e & adder_icc[1];
807
 
808
   // Mem address exception generation and flops
809
   assign   misalign_addr_e = (alu_ecl_adder_out_7_0_e[1] | alu_ecl_adder_out_7_0_e[0]) & ifu_exu_range_check_jlret_e;
810
   // jlret is used for misalign (E stage) and va hole (M stage).
811
   // if address mask is on then the va hole is not checked
812
   assign   valid_range_check_jlret_e = ifu_exu_range_check_jlret_e & ~addr_mask_e;
813
   assign   exu_ifu_va_oor_m = ~alu_ecl_mem_addr_invalid_m_l;
814
   assign exu_tlu_va_oor_m = (~alu_ecl_mem_addr_invalid_m_l &
815
                              ifu_exu_range_check_other_m);
816
   assign exu_tlu_va_oor_jl_ret_m = (~alu_ecl_mem_addr_invalid_m_l &
817
                                     ifu_exu_range_check_jlret_m);
818 113 albert.wat
   dff_s dff_addr_mask_d2e (.din(ifu_exu_addr_mask_d), .clk(clk), .q(addr_mask_e),
819
                          .se(se), `SIMPLY_RISC_SCANIN, .so());
820
   dff_s dff_mem_invalid_e2m(.din(alu_ecl_mem_addr_invalid_e_l), .clk(clk),
821 95 fafa1971
                           .q(alu_ecl_mem_addr_invalid_m_l), .se(se),
822 113 albert.wat
                           `SIMPLY_RISC_SCANIN, .so());
823
   dff_s dff_misalign_addr_e2m(.din(misalign_addr_e), .clk(clk),
824 95 fafa1971
                           .q(exu_tlu_misalign_addr_jmpl_rtn_m), .se(se),
825 113 albert.wat
                           `SIMPLY_RISC_SCANIN, .so());
826
   dff_s dff_range_check_jlret_d2e(.din(ifu_exu_range_check_jlret_d), .clk(clk),
827 95 fafa1971
                            .q(ifu_exu_range_check_jlret_e), .se(se),
828 113 albert.wat
                            `SIMPLY_RISC_SCANIN, .so());
829
   dff_s dff_range_check_jlret_e2m(.din(valid_range_check_jlret_e), .clk(clk),
830 95 fafa1971
                            .q(ifu_exu_range_check_jlret_m), .se(se),
831 113 albert.wat
                            `SIMPLY_RISC_SCANIN, .so());
832
   dff_s dff_range_check_other_d2e(.din(ifu_exu_range_check_other_d), .clk(clk),
833 95 fafa1971
                            .q(ifu_exu_range_check_other_e), .se(se),
834 113 albert.wat
                            `SIMPLY_RISC_SCANIN, .so());
835
   dff_s dff_range_check_other_e2m(.din(ifu_exu_range_check_other_e), .clk(clk),
836 95 fafa1971
                            .q(ifu_exu_range_check_other_m), .se(se),
837 113 albert.wat
                            `SIMPLY_RISC_SCANIN, .so());
838 95 fafa1971
 
839
   // 3lsbs can be zeroes for ialign
840
   assign ecl_byp_3lsb_m[2:0] = (ialign_m)? 3'b0: byp_ecl_rd_data_3lsb_m[2:0];
841
 
842
   /////////////////////////////
843
   // Generate Shift control
844
   /////////////////////////////
845
   assign shiftop_d[2:0] = ifu_exu_shiftop_d[2:0] & {3{ifu_exu_enshift_d}};
846
   // shiftop:
847
   //   2 = 64bit shift
848
   //   1 = Rshift (1), LShift (0)
849
   //   0 = arithmetic shift
850
   assign ecl_shft_lshift_e_l = shiftop_e[1];
851
   assign shft_sext_e = shiftop_e[0];
852
   assign ecl_shft_op32_e = ~shiftop_e[2];
853
   assign ecl_shft_enshift_e_l = ~enshift_e;
854
   // decide what sign extension for right shifts should be (in parallel w/
855
   // masking operation)
856
   assign ecl_shft_extend32bit_e_l = ~(ecl_shft_op32_e & byp_ecl_rs1_31_e
857
                                   & shft_sext_e);
858
   assign extend64bit = shft_sext_e & byp_ecl_rs1_63_e &
859
          ~ecl_shft_op32_e;
860
   assign ecl_shft_extendbit_e = (extend64bit | ~ecl_shft_extend32bit_e_l);
861
 
862
   // Get rid of top bit for 32 bit instructions
863
   //assign mod_shiftby_e[5]  = shiftop_e[2] & byp_ecl_rs2_3_0_e[5];
864
   // decode shiftby input into mux control signals
865
   //assign ecl_shft_shift16_e[0] = (~mod_shiftby_e[5] & ~mod_shiftby_e[4]);
866
   //assign ecl_shft_shift16_e[1] = (~mod_shiftby_e[5] & mod_shiftby_e[4]);
867
   //assign ecl_shft_shift16_e[2] = (mod_shiftby_e[5] & ~mod_shiftby_e[4]);
868
   //assign ecl_shft_shift16_e[3] = (mod_shiftby_e[5] & mod_shiftby_e[4]);
869
 
870
   assign ecl_shft_shift4_e[0] = (~byp_ecl_rs2_3_0_e[3] & ~byp_ecl_rs2_3_0_e[2]);
871
   assign ecl_shft_shift4_e[1] = (~byp_ecl_rs2_3_0_e[3] & byp_ecl_rs2_3_0_e[2]);
872
   assign ecl_shft_shift4_e[2] = (byp_ecl_rs2_3_0_e[3] & ~byp_ecl_rs2_3_0_e[2]);
873
   assign ecl_shft_shift4_e[3] = (byp_ecl_rs2_3_0_e[3] & byp_ecl_rs2_3_0_e[2]);
874
 
875
   assign ecl_shft_shift1_e[0] = (~byp_ecl_rs2_3_0_e[1] & ~byp_ecl_rs2_3_0_e[0]);
876
   assign ecl_shft_shift1_e[1] = (~byp_ecl_rs2_3_0_e[1] & byp_ecl_rs2_3_0_e[0]);
877
   assign ecl_shft_shift1_e[2] = (byp_ecl_rs2_3_0_e[1] & ~byp_ecl_rs2_3_0_e[0]);
878
   assign ecl_shft_shift1_e[3] = (byp_ecl_rs2_3_0_e[1] & byp_ecl_rs2_3_0_e[0]);
879
 
880
 
881
   // pipeline flops for bypass data
882 113 albert.wat
   dff_s #(5) dff_rd_d2e(.din(ifu_exu_rd_d[4:0]), .clk(clk), .q(rd_e[4:0]), .se(se),
883
                     `SIMPLY_RISC_SCANIN, .so());
884 95 fafa1971
   // account for switch of ins outs on save/restore
885
   assign real_rd_e[4] = rd_e[4] ^ (rd_e[3] & (save_e | restore_e));
886
   assign real_rd_e[3:0] = rd_e[3:0];
887 113 albert.wat
   dff_s #(5) dff_rd_e2m(.din(real_rd_e[4:0]), .clk(clk), .q(rd_m[4:0]), .se(se),
888
                     `SIMPLY_RISC_SCANIN, .so());
889
   dff_s #(5) dff_rd_m2w(.din(ecl_irf_rd_m[4:0]), .clk(clk), .q(ecl_irf_rd_w[4:0]), .se(se),
890
                     `SIMPLY_RISC_SCANIN, .so());
891
   dff_s #(2) dff_thr_s2d(.din(ifu_exu_tid_s2[1:0]), .clk(clk), .q(tid_d[1:0]), .se(se),
892
                      `SIMPLY_RISC_SCANIN, .so());
893
   dff_s #(2) dff_tid_d2e(.din(tid_d[1:0]), .clk(clk), .q(tid_e[1:0]), .se(se),
894
                      `SIMPLY_RISC_SCANIN, .so());
895
   dff_s #(2) dff_thr_e2m(.din(tid_e[1:0]), .clk(clk), .q(tid_m[1:0]), .se(se),
896
                      `SIMPLY_RISC_SCANIN, .so());
897 95 fafa1971
   // Need the original thr and the one with ld thr muxed in
898 113 albert.wat
   dff_s #(2) dff_tid_m2w(.din(tid_m[1:0]), .clk(clk), .q(tid_w[1:0]), .se(se),
899
                      `SIMPLY_RISC_SCANIN, .so());
900
   dff_s #(2) dff_tid_w2w1(.din(tid_w[1:0]), .clk(clk), .q(tid_w1[1:0]), .se(se),
901
                      `SIMPLY_RISC_SCANIN, .so());
902
   dff_s #(2) dff_irf_thr_m2w(.din(ecl_irf_tid_m[1:0]), .clk(clk), .q(ecl_irf_tid_w[1:0]), .se(se),
903
                      `SIMPLY_RISC_SCANIN, .so());
904 95 fafa1971
 
905
   // Thread decode
906
   // decode tid_d
907
   assign        thr_d[0] = ~tid_d[1] & ~tid_d[0];
908
   assign        thr_d[1] = ~tid_d[1] & tid_d[0];
909
   assign        thr_d[2] = tid_d[1] & ~tid_d[0];
910
   assign        thr_d[3] = tid_d[1] & tid_d[0];
911
 
912
   // decode thr_e
913
   assign        ecl_div_thr_e[0] = ~tid_e[1] & ~tid_e[0];
914
   assign        ecl_div_thr_e[1] = ~tid_e[1] & tid_e[0];
915
   assign        ecl_div_thr_e[2] = tid_e[1] & ~tid_e[0];
916
   assign        ecl_div_thr_e[3] = tid_e[1] & tid_e[0];
917
 
918
   // decode thr_m
919
   assign        thr_m[0] = ~tid_m[1] & ~tid_m[0];
920
   assign        thr_m[1] = ~tid_m[1] & tid_m[0];
921
   assign        thr_m[2] = tid_m[1] & ~tid_m[0];
922
   assign        thr_m[3] = tid_m[1] & tid_m[0];
923
   assign        ecl_rml_thr_m[3:0] = thr_m[3:0];
924
   // decode tid_w
925
   assign        ecl_rml_thr_w[0] = ~tid_w[1] & ~tid_w[0];
926
   assign        ecl_rml_thr_w[1] = ~tid_w[1] & tid_w[0];
927
   assign        ecl_rml_thr_w[2] = tid_w[1] & ~tid_w[0];
928
   assign        ecl_rml_thr_w[3] = tid_w[1] & tid_w[0];
929
 
930
   //////////////////////////////////////
931
   // Kill logic
932
   //////////////////////////////////////
933
   // a parity error on a store should kill the next instruction on that thread
934
   // perr_store_w sets the bit.  perr_kill_m says that the instruction in M should
935
   // be killed.  However, it does not check inst_vld or flush so it might be killing
936
   // an invalid instruction.  Therefore perr_store does not get cleared until W.  This
937
   // might cause an extra perr_kill_m, but that is OK because subsequent instructions will
938
   // be killed until the trap is taken.
939
   wire [3:0]    perr_store_w;
940
   wire [3:0]    perr_clear_w;
941
   wire          perr_kill_m;
942
   assign        perr_store_w[3] = tid_w[1] & tid_w[0] & lsu_exu_st_dtlb_perr_g;
943
   assign        perr_store_w[2] = tid_w[1] & ~tid_w[0] & lsu_exu_st_dtlb_perr_g;
944
   assign        perr_store_w[1] = ~tid_w[1] & tid_w[0] & lsu_exu_st_dtlb_perr_g;
945
   assign        perr_store_w[0] = ~tid_w[1] & ~tid_w[0] & lsu_exu_st_dtlb_perr_g;
946
   assign        perr_store_next[3] = perr_store_w[3] | perr_store[3] & ~perr_clear_w[3];
947
   assign        perr_store_next[2] = perr_store_w[2] | perr_store[2] & ~perr_clear_w[2];
948
   assign        perr_store_next[1] = perr_store_w[1] | perr_store[1] & ~perr_clear_w[1];
949
   assign        perr_store_next[0] = perr_store_w[0] | perr_store[0] & ~perr_clear_w[0];
950
   assign        perr_kill[3] = tid_m[1] & tid_m[0] & perr_store[3];
951
   assign        perr_kill[2] = tid_m[1] & ~tid_m[0] & perr_store[2];
952
   assign        perr_kill[1] = ~tid_m[1] & tid_m[0] & perr_store[1];
953
   assign        perr_kill[0] = ~tid_m[1] & ~tid_m[0] & perr_store[0];
954
   assign        perr_kill_m = |perr_kill[3:0] | lsu_exu_st_dtlb_perr_g & thr_match_mw;
955
   assign        perr_clear_w[3] = tid_w[1] & tid_w[0] & perr_store[3] & ifu_exu_inst_vld_w & ~ifu_tlu_flush_w;
956
   assign        perr_clear_w[2] = tid_w[1] & ~tid_w[0] & perr_store[2] & ifu_exu_inst_vld_w & ~ifu_tlu_flush_w;
957
   assign        perr_clear_w[1] = ~tid_w[1] & tid_w[0] & perr_store[1] & ifu_exu_inst_vld_w & ~ifu_tlu_flush_w;
958
   assign        perr_clear_w[0] = ~tid_w[1] & ~tid_w[0] & perr_store[0] & ifu_exu_inst_vld_w & ~ifu_tlu_flush_w;
959
 
960 113 albert.wat
   dffr_s #(4) perr_dff(.din(perr_store_next[3:0]), .clk(clk), .q(perr_store[3:0]), `SIMPLY_RISC_SCANIN, .so(), .se(se), .rst(reset));
961 95 fafa1971
 
962
   // calculate an early flush for killing writes in W
963
   // the pic trap occurs if there are too many instructions on a given thread.
964 113 albert.wat
   dff_s inst_vld_ww1(.din(ifu_exu_inst_vld_w), .clk(clk), .q(inst_vld_w1), .se(se), `SIMPLY_RISC_SCANIN, .so());
965 95 fafa1971
   assign pic_trap_m = ((tlu_exu_pic_onebelow_m & (thr_match_mw & ifu_exu_inst_vld_w |
966
                                                   thr_match_mw1 & inst_vld_w1)) |
967
                        (tlu_exu_pic_twobelow_m & thr_match_mw & ifu_exu_inst_vld_w &
968
                         thr_match_mw1 & inst_vld_w1));
969
   assign        part_early_flush_m = (exu_tlu_ttype_vld_m | ifu_exu_ttype_vld_m | exu_tlu_va_oor_jl_ret_m |
970
                                       perr_kill_m | pic_trap_m);
971 113 albert.wat
   dff_s priv_trap_dff(.din(tlu_exu_priv_trap_m), .clk(clk), .q(tlu_priv_trap_w), .se(se), `SIMPLY_RISC_SCANIN, .so());
972
   dff_s early_flush_dff(.din(part_early_flush_m), .clk(clk), .q(part_early_flush_w), .se(se), `SIMPLY_RISC_SCANIN, .so());
973 95 fafa1971
   assign        early_flush_w = part_early_flush_w | tlu_priv_trap_w;
974
   assign        ecl_rml_early_flush_w = early_flush_w;
975
 
976
   // buffer this off so it only sees one load from the ifu
977
   assign        ecl_rml_inst_vld_w = ifu_exu_inst_vld_w & ~ifu_tlu_flush_w;
978
 
979 113 albert.wat
   dff_s flush_m2w(.din(ifu_tlu_flush_m), .clk(clk), .q(ifu_tlu_flush_w), .se(se), `SIMPLY_RISC_SCANIN, .so());
980 95 fafa1971
   assign        flush_w = ifu_tlu_flush_w | lsu_exu_flush_pipe_w;
981 113 albert.wat
   dff_s flush_w_dff(.din(flush_w), .clk(clk), .q(flush_w1), .se(se), `SIMPLY_RISC_SCANIN, .so());
982 95 fafa1971
   // allow misalign address on returns to kill the cwp switch
983
   // ttype[7] is a fill_trap so the return misalign should be ignored
984
   // UE trap should kill window ops.  This check is needed here because the
985
   // window traps will override the flush_W signals.
986
   assign        kill_rml_m = (ue_trap_m | ifu_exu_ttype_vld_m | perr_kill_m | pic_trap_m |
987
                               (exu_tlu_misalign_addr_jmpl_rtn_m & ~exu_tlu_ttype_m[7]));
988 113 albert.wat
   dff_s kill_rml_mw(.din(kill_rml_m), .clk(clk) , .q(kill_rml_w), .se(se), `SIMPLY_RISC_SCANIN, .so());
989 95 fafa1971
   // include tlu_priv_trap to cancel window traps
990
   assign        ecl_rml_kill_w = tlu_priv_trap_w | kill_rml_w;
991
 
992
   // pass kill_e through to the rml
993
   assign        ecl_rml_kill_e = ifu_exu_kill_e;
994
 
995
   assign        ecl_exu_kill_m = thr_match_mw1 & flush_w1;
996
   assign thr_match_mw = ~((tid_w[1] ^ tid_m[1]) |
997
                           (tid_w[0] ^ tid_m[0]));
998
   assign thr_match_ew = ~((tid_e[1] ^ tid_w[1]) |
999
                           (tid_e[0] ^ tid_w[0]));
1000 113 albert.wat
   dff_s thr_match_ew_dff(.din(thr_match_ew), .clk(clk), .q(thr_match_mw1), .se(se), `SIMPLY_RISC_SCANIN, .so());
1001 95 fafa1971
 
1002
   // ldxa needs to check inst_vld and prior flushes
1003
   assign ecl_byp_ldxa_g = ldxa_g & ifu_exu_inst_vld_w;
1004
 
1005
   // controls for outputs to lsu
1006
   assign std_d = ifu_exu_rs3e_vld_d & ifu_exu_rs3o_vld_d;
1007 113 albert.wat
   dff_s std_d2e (.din(std_d), .q(std_e), .clk(clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
1008 95 fafa1971
   assign ecl_byp_std_e_l = ~std_e;
1009
 
1010
 
1011
   //////////////////////////////////////
1012
   // Trap output logic
1013
   //-----------------------
1014
   // In pipe traps (with priority order):
1015
   // 029h: uncorrected ecc trap
1016
   // 0C0h-0FFh: Fill trap
1017
   // 024h: clean window trap
1018
   // 034h: mem_address_not_aligned
1019
   // 023h: Tag Overflow
1020
   // 028h: Div by zero
1021
   // 100h-17Fh: Trap instruction
1022
   //////////////////////////////////////
1023
   // ecc traps must be enabled
1024
   assign fill_trap_e = rml_ecl_fill_e;
1025
 
1026
   assign early_ttype_vld_e = (rml_ecl_clean_window_e | rml_ecl_fill_e |
1027
                                 tag_overflow_trap_e | ifu_exu_tcc_e |
1028
                                 misalign_addr_e);
1029
   // This ttype includes clean window, fill, tag overflow, tcc, misalign address, and div zero.
1030
   // Note that this will be div_zero on any divide instruction.  The valid will only be asserted if
1031
   // div_zero is detected though.
1032
   assign early1_ttype_e[8] = 1'b0;
1033
   assign early1_ttype_e[7] = fill_trap_e;
1034
   assign early1_ttype_e[6] = fill_trap_e;
1035
   assign early1_ttype_e[5] = (rml_ecl_fill_e & rml_ecl_other_e) |
1036
                                (~rml_ecl_fill_e & (rml_ecl_clean_window_e | tag_overflow_trap_e | div_e));
1037
   assign early1_ttype_e[4] = fill_trap_e & rml_ecl_wtype_e[2];
1038
   assign early1_ttype_e[3] = (rml_ecl_fill_e & rml_ecl_wtype_e[1]) |
1039
                           (~rml_ecl_fill_e & ~rml_ecl_clean_window_e & ~tag_overflow_trap_e & div_e);
1040
   assign early1_ttype_e[2] = (fill_trap_e & rml_ecl_wtype_e[0]) |
1041
                                 (~rml_ecl_fill_e & rml_ecl_clean_window_e);
1042
   assign early1_ttype_e[1] = ~rml_ecl_fill_e & ~rml_ecl_clean_window_e & tag_overflow_trap_e;
1043
   assign early1_ttype_e[0] = (~rml_ecl_fill_e & ~rml_ecl_clean_window_e & tag_overflow_trap_e);
1044
 
1045
   // mux together the ttypes
1046
   // tcc only can be combined with an ue which is caught later so it isn't qualified by other traps
1047
   assign pick_normal_ttype = ~pick_not_aligned & ~ifu_exu_tcc_e;
1048
   assign pick_tcc = ifu_exu_tcc_e;
1049
   assign pick_not_aligned = ~(rml_ecl_fill_e | rml_ecl_clean_window_e) & misalign_addr_e & ~ifu_exu_tcc_e;
1050
 
1051
   // the ue ttype is muxed in after the flop because it is so late
1052
   mux3ds #(9) ttype_mux(.dout(early2_ttype_e[8:0]),
1053
                         .in0(early1_ttype_e[8:0]),
1054
                         .in1({1'b1, alu_ecl_adder_out_7_0_e[7:0]}),
1055
                         .in2(9'h034),
1056
                         .sel0(pick_normal_ttype),
1057
                         .sel1(pick_tcc),
1058
                         .sel2(pick_not_aligned));
1059
   assign exu_tlu_ttype_m[8:0] = (ue_trap_m)? 9'h029: early_ttype_m[8:0];
1060
   assign exu_tlu_ttype_vld_m = early_ttype_vld_m | ue_trap_m | div_zero_m;
1061
   assign exu_tlu_ue_trap_m = ue_trap_m;
1062
 
1063 113 albert.wat
   dff_s ttype_vld_e2m(.din(early_ttype_vld_e), .clk(clk), .q(early_ttype_vld_m),
1064
                     .se(se), `SIMPLY_RISC_SCANIN, .so());
1065
   dff_s #(9) ttype_e2m(.din(early2_ttype_e[8:0]), .clk(clk), .q(early_ttype_m[8:0]),
1066
                    .se(se), `SIMPLY_RISC_SCANIN, .so());
1067 95 fafa1971
   // lsu needs to know about spill and ue traps for squashing sfsr writes
1068 113 albert.wat
   dff_s fill_e2m(.din(fill_trap_e), .clk(clk), .q(fill_trap_m), .se(se), `SIMPLY_RISC_SCANIN, .so());
1069 95 fafa1971
   assign exu_lsu_priority_trap_m = fill_trap_m | ue_trap_m;
1070
 
1071
   // Condition code Register
1072
   sparc_exu_eclccr ccr(.wb_ccr_thr_g(ecl_irf_tid_g[1:0]),
1073
                        .thrdec_d  (thr_d[3:0]),
1074
                        .thr_w  (ecl_rml_thr_w[3:0]),
1075
                       /*AUTOINST*/
1076
                        // Outputs
1077
                        .exu_ifu_cc_d   (exu_ifu_cc_d[7:0]),
1078
                        .exu_tlu_ccr0_w (exu_tlu_ccr0_w[7:0]),
1079
                        .exu_tlu_ccr1_w (exu_tlu_ccr1_w[7:0]),
1080
                        .exu_tlu_ccr2_w (exu_tlu_ccr2_w[7:0]),
1081
                        .exu_tlu_ccr3_w (exu_tlu_ccr3_w[7:0]),
1082
                        // Inputs
1083
                        .clk            (clk),
1084
                        .se             (se),
1085
                        .alu_xcc_e      (alu_xcc_e[3:0]),
1086
                        .alu_icc_e      (alu_icc_e[3:0]),
1087
                        .tid_d          (tid_d[1:0]),
1088
                        .thr_match_dm   (thr_match_dm),
1089
                        .thr_match_de   (thr_match_de),
1090
                        .tid_w          (tid_w[1:0]),
1091
                        .ifu_exu_kill_e (ifu_exu_kill_e),
1092
                        .ifu_exu_setcc_d(ifu_exu_setcc_d),
1093
                        .byp_ecl_wrccr_data_w(byp_ecl_wrccr_data_w[7:0]),
1094
                        .wb_ccr_wrccr_w (wb_ccr_wrccr_w),
1095
                        .wb_ccr_setcc_g (wb_ccr_setcc_g),
1096
                        .divcntl_ccr_cc_w2(divcntl_ccr_cc_w2[7:0]),
1097
                        .tlu_exu_cwpccr_update_m(tlu_exu_cwpccr_update_m),
1098
                        .tlu_exu_ccr_m  (tlu_exu_ccr_m[7:0]),
1099
                        .ifu_exu_inst_vld_w(ifu_exu_inst_vld_w),
1100
                        .ifu_tlu_flush_w(ifu_tlu_flush_w),
1101
                        .early_flush_w  (early_flush_w));
1102
 
1103
   // Writeback control logic
1104
   sparc_exu_ecl_wb writeback(
1105
                              .read_yreg_e(read_yreg_e),
1106
                              /*AUTOINST*/
1107
                              // Outputs
1108
                              .wb_ccr_wrccr_w(wb_ccr_wrccr_w),
1109
                              .ecl_rml_cwp_wen_e(ecl_rml_cwp_wen_e),
1110
                              .ecl_rml_cansave_wen_w(ecl_rml_cansave_wen_w),
1111
                              .ecl_rml_canrestore_wen_w(ecl_rml_canrestore_wen_w),
1112
                              .ecl_rml_otherwin_wen_w(ecl_rml_otherwin_wen_w),
1113
                              .ecl_rml_wstate_wen_w(ecl_rml_wstate_wen_w),
1114
                              .ecl_rml_cleanwin_wen_w(ecl_rml_cleanwin_wen_w),
1115
                              .ecl_byp_sel_load_m(ecl_byp_sel_load_m),
1116
                              .ecl_byp_sel_restore_m(ecl_byp_sel_restore_m),
1117
                              .ecl_byp_sel_pipe_m(ecl_byp_sel_pipe_m),
1118
                              .ecl_byp_restore_m(ecl_byp_restore_m),
1119
                              .ecl_irf_tid_m(ecl_irf_tid_m[1:0]),
1120
                              .ecl_irf_rd_m(ecl_irf_rd_m[4:0]),
1121
                              .ecl_irf_rd_g(ecl_irf_rd_g[4:0]),
1122
                              .ecl_irf_wen_w2(ecl_irf_wen_w2),
1123
                              .ecl_irf_tid_g(ecl_irf_tid_g[1:0]),
1124
                              .wb_e     (wb_e),
1125
                              .bypass_m (bypass_m),
1126
                              .ecl_irf_wen_w(ecl_irf_wen_w),
1127
                              .ecl_byp_sel_load_g(ecl_byp_sel_load_g),
1128
                              .ecl_byp_sel_muldiv_g(ecl_byp_sel_muldiv_g),
1129
                              .ecl_byp_sel_restore_g(ecl_byp_sel_restore_g),
1130
                              .wb_divcntl_ack_g(wb_divcntl_ack_g),
1131
                              .wb_ccr_setcc_g(wb_ccr_setcc_g),
1132
                              .ecl_byp_eclpr_e(ecl_byp_eclpr_e[7:0]),
1133
                              .exu_ifu_longop_done_g(exu_ifu_longop_done_g[3:0]),
1134
                              .ecl_div_yreg_wen_w(ecl_div_yreg_wen_w[3:0]),
1135
                              .ecl_div_yreg_wen_g(ecl_div_yreg_wen_g[3:0]),
1136
                              .ecl_div_yreg_shift_g(ecl_div_yreg_shift_g[3:0]),
1137
                              .ecl_div_yreg_wen_l(ecl_div_yreg_wen_l[3:0]),
1138
                              .wb_eccctl_spec_wen_next(wb_eccctl_spec_wen_next),
1139
                              .bypass_w (bypass_w),
1140
                              .wb_byplog_rd_w2(wb_byplog_rd_w2[4:0]),
1141
                              .wb_byplog_tid_w2(wb_byplog_tid_w2[1:0]),
1142
                              .wb_byplog_wen_w2(wb_byplog_wen_w2),
1143
                              .wb_byplog_rd_g2(wb_byplog_rd_g2[4:0]),
1144
                              .wb_byplog_wen_g2(wb_byplog_wen_g2),
1145
                              .exu_ffu_wsr_inst_e(exu_ffu_wsr_inst_e),
1146
                              // Inputs
1147
                              .clk      (clk),
1148
                              .se       (se),
1149
                              .reset    (reset),
1150
                              .sehold   (sehold),
1151
                              .ld_rd_g  (ld_rd_g[4:0]),
1152
                              .ld_tid_g (ld_tid_g[1:0]),
1153
                              .lsu_exu_dfill_vld_g(lsu_exu_dfill_vld_g),
1154
                              .lsu_exu_ldst_miss_g2(lsu_exu_ldst_miss_g2),
1155
                              .rd_m     (rd_m[4:0]),
1156
                              .tid_m    (tid_m[1:0]),
1157
                              .thr_m    (thr_m[3:0]),
1158
                              .tid_w1   (tid_w1[1:0]),
1159
                              .ifu_exu_wen_d(ifu_exu_wen_d),
1160
                              .ifu_exu_kill_e(ifu_exu_kill_e),
1161
                              .ecl_exu_kill_m(ecl_exu_kill_m),
1162
                              .rml_ecl_kill_m(rml_ecl_kill_m),
1163
                              .ifu_tlu_flush_w(ifu_tlu_flush_w),
1164
                              .flush_w1 (flush_w1),
1165
                              .divcntl_wb_req_g(divcntl_wb_req_g),
1166
                              .mdqctl_wb_divrd_g(mdqctl_wb_divrd_g[4:0]),
1167
                              .mdqctl_wb_divthr_g(mdqctl_wb_divthr_g[1:0]),
1168
                              .mdqctl_wb_mulrd_g(mdqctl_wb_mulrd_g[4:0]),
1169
                              .mdqctl_wb_multhr_g(mdqctl_wb_multhr_g[1:0]),
1170
                              .mdqctl_wb_divsetcc_g(mdqctl_wb_divsetcc_g),
1171
                              .mdqctl_wb_mulsetcc_g(mdqctl_wb_mulsetcc_g),
1172
                              .ecl_div_sel_div(ecl_div_sel_div),
1173
                              .ifu_tlu_wsr_inst_d(ifu_tlu_wsr_inst_d),
1174
                              .ifu_tlu_sraddr_d(ifu_tlu_sraddr_d[6:0]),
1175
                              .rml_ecl_cwp_d(rml_ecl_cwp_d[2:0]),
1176
                              .rml_ecl_cansave_d(rml_ecl_cansave_d[2:0]),
1177
                              .rml_ecl_canrestore_d(rml_ecl_canrestore_d[2:0]),
1178
                              .rml_ecl_otherwin_d(rml_ecl_otherwin_d[2:0]),
1179
                              .rml_ecl_wstate_d(rml_ecl_wstate_d[5:0]),
1180
                              .rml_ecl_cleanwin_d(rml_ecl_cleanwin_d[2:0]),
1181
                              .exu_ifu_cc_d(exu_ifu_cc_d[7:0]),
1182
                              .rml_ecl_swap_done(rml_ecl_swap_done[3:0]),
1183
                              .rml_ecl_rmlop_done_e(rml_ecl_rmlop_done_e),
1184
                              .mdqctl_wb_yreg_wen_g(mdqctl_wb_yreg_wen_g),
1185
                              .mdqctl_wb_yreg_shift_g(mdqctl_wb_yreg_shift_g),
1186
                              .ecl_byp_sel_ecc_m(ecl_byp_sel_ecc_m),
1187
                              .eccctl_wb_rd_m(eccctl_wb_rd_m[4:0]),
1188
                              .ifu_exu_inst_vld_e(ifu_exu_inst_vld_e),
1189
                              .ifu_exu_inst_vld_w(ifu_exu_inst_vld_w),
1190
                              .ifu_exu_return_d(ifu_exu_return_d),
1191
                              .restore_e(restore_e),
1192
                              .rml_ecl_fill_e(rml_ecl_fill_e),
1193
                              .early_flush_w(early_flush_w),
1194
                              .ecl_byp_ldxa_g(ecl_byp_ldxa_g));
1195
 
1196
   ////////////////////////
1197
   // ECC control logic
1198
   ////////////////////////
1199
   sparc_exu_ecl_eccctl eccctl(
1200
                               .ue_trap_m(ue_trap_m),
1201
                               /*AUTOINST*/
1202
                               // Outputs
1203
                               .ecl_ecc_sel_rs1_m_l(ecl_ecc_sel_rs1_m_l),
1204
                               .ecl_ecc_sel_rs2_m_l(ecl_ecc_sel_rs2_m_l),
1205
                               .ecl_ecc_sel_rs3_m_l(ecl_ecc_sel_rs3_m_l),
1206
                               .ecl_ecc_log_rs1_m(ecl_ecc_log_rs1_m),
1207
                               .ecl_ecc_log_rs2_m(ecl_ecc_log_rs2_m),
1208
                               .ecl_ecc_log_rs3_m(ecl_ecc_log_rs3_m),
1209
                               .ecl_byp_sel_ecc_m(ecl_byp_sel_ecc_m),
1210
                               .ecl_ecc_rs1_use_rf_e(ecl_ecc_rs1_use_rf_e),
1211
                               .ecl_ecc_rs2_use_rf_e(ecl_ecc_rs2_use_rf_e),
1212
                               .ecl_ecc_rs3_use_rf_e(ecl_ecc_rs3_use_rf_e),
1213
                               .eccctl_wb_rd_m(eccctl_wb_rd_m[4:0]),
1214
                               .exu_ifu_ecc_ce_m(exu_ifu_ecc_ce_m),
1215
                               .exu_ifu_ecc_ue_m(exu_ifu_ecc_ue_m),
1216
                               .exu_ifu_err_reg_m(exu_ifu_err_reg_m[7:0]),
1217
                               .ecl_byp_ecc_mask_m_l(ecl_byp_ecc_mask_m_l[7:0]),
1218
                               .exu_ifu_inj_ack(exu_ifu_inj_ack),
1219
                               .exu_ifu_err_synd_7_m(exu_ifu_err_synd_7_m),
1220
                               // Inputs
1221
                               .clk     (clk),
1222
                               .se      (se),
1223
                               .rst_tri_en(rst_tri_en),
1224
                               .ecc_ecl_rs1_ce(ecc_ecl_rs1_ce),
1225
                               .ecc_ecl_rs1_ue(ecc_ecl_rs1_ue),
1226
                               .ecc_ecl_rs2_ce(ecc_ecl_rs2_ce),
1227
                               .ecc_ecl_rs2_ue(ecc_ecl_rs2_ue),
1228
                               .ecc_ecl_rs3_ce(ecc_ecl_rs3_ce),
1229
                               .ecc_ecl_rs3_ue(ecc_ecl_rs3_ue),
1230
                               .ecl_byp_rcc_mux2_sel_rf(ecl_byp_rcc_mux2_sel_rf),
1231
                               .ecl_byp_rs2_mux2_sel_rf(ecl_byp_rs2_mux2_sel_rf),
1232
                               .ecl_byp_rs3_mux2_sel_rf(ecl_byp_rs3_mux2_sel_rf),
1233
                               .rs1_vld_e(rs1_vld_e),
1234
                               .rs2_vld_e(rs2_vld_e),
1235
                               .rs3_vld_e(rs3_vld_e),
1236
                               .ifu_exu_rs1_m(ifu_exu_rs1_m[4:0]),
1237
                               .ifu_exu_rs2_m(ifu_exu_rs2_m[4:0]),
1238
                               .ifu_exu_rs3_m(ifu_exu_rs3_m[4:0]),
1239
                               .rml_ecl_cwp_d(rml_ecl_cwp_d[2:0]),
1240
                               .ifu_exu_ecc_mask(ifu_exu_ecc_mask[7:0]),
1241
                               .ifu_exu_inj_irferr(ifu_exu_inj_irferr),
1242
                               .ifu_exu_disable_ce_e(ifu_exu_disable_ce_e),
1243
                               .wb_eccctl_spec_wen_next(wb_eccctl_spec_wen_next),
1244
                               .ifu_exu_nceen_e(ifu_exu_nceen_e),
1245
                               .ifu_exu_inst_vld_e(ifu_exu_inst_vld_e),
1246
                               .rml_ecl_gl_e(rml_ecl_gl_e[1:0]),
1247
                               .cancel_rs3_ecc_e(cancel_rs3_ecc_e));
1248
   // Bypass logic
1249
   // Precalculate some of the matching logic to help timing
1250
   assign thr_match_sd =  ~((ifu_exu_tid_s2[1] ^ tid_d[1]) |
1251
                           (ifu_exu_tid_s2[0] ^ tid_d[0]));
1252 113 albert.wat
   dff_s thr_match_sd_dff(.din(thr_match_sd), .clk(clk), .q(thr_match_de),
1253
                        .se(se), `SIMPLY_RISC_SCANIN, .so());
1254 95 fafa1971
   assign thr_match_se =  ~((ifu_exu_tid_s2[1] ^ tid_e[1]) |
1255
                           (ifu_exu_tid_s2[0] ^ tid_e[0]));
1256 113 albert.wat
   dff_s thr_match_se_dff(.din(thr_match_se), .clk(clk), .q(thr_match_dm),
1257
                        .se(se), `SIMPLY_RISC_SCANIN, .so());
1258 95 fafa1971
   assign ld_thr_match_sm = ~((ifu_exu_tid_s2[1] ^ lsu_exu_thr_m[1]) |
1259
                           (ifu_exu_tid_s2[0] ^ lsu_exu_thr_m[0]));
1260 113 albert.wat
   dff_s ld_thr_match_sm_dff(.din(ld_thr_match_sm), .clk(clk), .q(ld_thr_match_dg), .se(se),
1261
                           `SIMPLY_RISC_SCANIN, .so());
1262 95 fafa1971
   assign ld_thr_match_sg = ~((ifu_exu_tid_s2[1] ^ ld_tid_g[1]) |
1263
                           (ifu_exu_tid_s2[0] ^ ld_tid_g[0]));
1264 113 albert.wat
   dff_s ld_thr_match_sg_dff(.din(ld_thr_match_sg), .clk(clk), .q(ld_thr_match_dg2), .se(se),
1265
                           `SIMPLY_RISC_SCANIN, .so());
1266 95 fafa1971
   sparc_exu_eclbyplog_rs1 byplog_rs1(.rs_sel_mux1_m(ecl_byp_rs1_mux1_sel_m),
1267
                                  .rs_sel_mux1_w(ecl_byp_rs1_mux1_sel_w),
1268
                                  .rs_sel_mux1_w2(ecl_byp_rs1_mux1_sel_w2),
1269
                                  .rs_sel_mux1_other(ecl_byp_rs1_mux1_sel_other),
1270
                                  .rs_sel_mux2_e(ecl_byp_rs1_mux2_sel_e),
1271
                                  .rs_sel_mux2_rf(ecl_byp_rs1_mux2_sel_rf),
1272
                                  .rs_sel_mux2_ld(ecl_byp_rs1_mux2_sel_ld),
1273
                                  .rs_sel_mux2_usemux1(ecl_byp_rs1_mux2_sel_usemux1),
1274
                                  .rs_sel_longmux_g2(ecl_byp_rs1_longmux_sel_g2),
1275
                                  .rs_sel_longmux_w2(ecl_byp_rs1_longmux_sel_w2),
1276
                                  .rs_sel_longmux_ldxa(ecl_byp_rs1_longmux_sel_ldxa),
1277
                                  .rs   (ifu_exu_rs1_d[4:0]),
1278
                                  .use_other(ifu_exu_dbrinst_d),
1279
                                  /*AUTOINST*/
1280
                                      // Outputs
1281
                                      .ecl_byp_rcc_mux1_sel_m(ecl_byp_rcc_mux1_sel_m),
1282
                                      .ecl_byp_rcc_mux1_sel_w(ecl_byp_rcc_mux1_sel_w),
1283
                                      .ecl_byp_rcc_mux1_sel_w2(ecl_byp_rcc_mux1_sel_w2),
1284
                                      .ecl_byp_rcc_mux1_sel_other(ecl_byp_rcc_mux1_sel_other),
1285
                                      .ecl_byp_rcc_mux2_sel_usemux1(ecl_byp_rcc_mux2_sel_usemux1),
1286
                                      .ecl_byp_rcc_mux2_sel_rf(ecl_byp_rcc_mux2_sel_rf),
1287
                                      .ecl_byp_rcc_mux2_sel_e(ecl_byp_rcc_mux2_sel_e),
1288
                                      .ecl_byp_rcc_mux2_sel_ld(ecl_byp_rcc_mux2_sel_ld),
1289
                                      // Inputs
1290
                                      .sehold(sehold),
1291
                                      .rd_e(rd_e[4:0]),
1292
                                      .rd_m(rd_m[4:0]),
1293
                                      .ecl_irf_rd_w(ecl_irf_rd_w[4:0]),
1294
                                      .ld_rd_g(ld_rd_g[4:0]),
1295
                                      .wb_byplog_rd_w2(wb_byplog_rd_w2[4:0]),
1296
                                      .wb_byplog_rd_g2(wb_byplog_rd_g2[4:0]),
1297
                                      .tid_d(tid_d[1:0]),
1298
                                      .thr_match_de(thr_match_de),
1299
                                      .thr_match_dm(thr_match_dm),
1300
                                      .ecl_irf_tid_w(ecl_irf_tid_w[1:0]),
1301
                                      .ld_thr_match_dg(ld_thr_match_dg),
1302
                                      .wb_byplog_tid_w2(wb_byplog_tid_w2[1:0]),
1303
                                      .ld_thr_match_dg2(ld_thr_match_dg2),
1304
                                      .ifu_exu_kill_e(ifu_exu_kill_e),
1305
                                      .wb_e(wb_e),
1306
                                      .bypass_m(bypass_m),
1307
                                      .lsu_exu_dfill_vld_g(lsu_exu_dfill_vld_g),
1308
                                      .bypass_w(bypass_w),
1309
                                      .wb_byplog_wen_w2(wb_byplog_wen_w2),
1310
                                      .wb_byplog_wen_g2(wb_byplog_wen_g2),
1311
                                      .ecl_byp_ldxa_g(ecl_byp_ldxa_g));
1312
 
1313
   sparc_exu_eclbyplog byplog_rs2(.rs_sel_mux1_m(ecl_byp_rs2_mux1_sel_m),
1314
                                  .rs_sel_mux1_w(ecl_byp_rs2_mux1_sel_w),
1315
                                  .rs_sel_mux1_w2(ecl_byp_rs2_mux1_sel_w2),
1316
                                  .rs_sel_mux1_other(ecl_byp_rs2_mux1_sel_other),
1317
                                  .rs_sel_mux2_e(ecl_byp_rs2_mux2_sel_e),
1318
                                  .rs_sel_mux2_rf(ecl_byp_rs2_mux2_sel_rf),
1319
                                  .rs_sel_mux2_ld(ecl_byp_rs2_mux2_sel_ld),
1320
                                  .rs_sel_mux2_usemux1(ecl_byp_rs2_mux2_sel_usemux1),
1321
                                  .rs_sel_longmux_g2(ecl_byp_rs2_longmux_sel_g2),
1322
                                  .rs_sel_longmux_w2(ecl_byp_rs2_longmux_sel_w2),
1323
                                  .rs_sel_longmux_ldxa(ecl_byp_rs2_longmux_sel_ldxa),
1324
                                  .rs   (ifu_exu_rs2_d[4:0]),
1325
                                  .use_other(ifu_exu_useimm_d),
1326
                                  /*AUTOINST*/
1327
                                  // Inputs
1328
                                  .sehold(sehold),
1329
                                  .rd_e (rd_e[4:0]),
1330
                                  .rd_m (rd_m[4:0]),
1331
                                  .ecl_irf_rd_w(ecl_irf_rd_w[4:0]),
1332
                                  .ld_rd_g(ld_rd_g[4:0]),
1333
                                  .wb_byplog_rd_w2(wb_byplog_rd_w2[4:0]),
1334
                                  .wb_byplog_rd_g2(wb_byplog_rd_g2[4:0]),
1335
                                  .tid_d(tid_d[1:0]),
1336
                                  .thr_match_de(thr_match_de),
1337
                                  .thr_match_dm(thr_match_dm),
1338
                                  .ecl_irf_tid_w(ecl_irf_tid_w[1:0]),
1339
                                  .ld_thr_match_dg(ld_thr_match_dg),
1340
                                  .wb_byplog_tid_w2(wb_byplog_tid_w2[1:0]),
1341
                                  .ld_thr_match_dg2(ld_thr_match_dg2),
1342
                                  .ifu_exu_kill_e(ifu_exu_kill_e),
1343
                                  .wb_e (wb_e),
1344
                                  .bypass_m(bypass_m),
1345
                                  .lsu_exu_dfill_vld_g(lsu_exu_dfill_vld_g),
1346
                                  .bypass_w(bypass_w),
1347
                                  .wb_byplog_wen_w2(wb_byplog_wen_w2),
1348
                                  .wb_byplog_wen_g2(wb_byplog_wen_g2),
1349
                                  .ecl_byp_ldxa_g(ecl_byp_ldxa_g));
1350
   sparc_exu_eclbyplog byplog_rs3(.rs_sel_mux1_m(ecl_byp_rs3_mux1_sel_m),
1351
                                  .rs_sel_mux1_w(ecl_byp_rs3_mux1_sel_w),
1352
                                  .rs_sel_mux1_w2(ecl_byp_rs3_mux1_sel_w2),
1353
                                  .rs_sel_mux1_other(ecl_byp_rs3_mux1_sel_other),
1354
                                  .rs_sel_mux2_e(ecl_byp_rs3_mux2_sel_e),
1355
                                  .rs_sel_mux2_rf(ecl_byp_rs3_mux2_sel_rf),
1356
                                  .rs_sel_mux2_ld(ecl_byp_rs3_mux2_sel_ld),
1357
                                  .rs_sel_mux2_usemux1(ecl_byp_rs3_mux2_sel_usemux1),
1358
                                  .rs_sel_longmux_g2(ecl_byp_rs3_longmux_sel_g2),
1359
                                  .rs_sel_longmux_w2(ecl_byp_rs3_longmux_sel_w2),
1360
                                  .rs_sel_longmux_ldxa(ecl_byp_rs3_longmux_sel_ldxa),
1361
                                  .rs   ({ifu_exu_rs3_d[4:0]}),
1362
                                  .use_other(1'b0),
1363
                                  /*AUTOINST*/
1364
                                  // Inputs
1365
                                  .sehold(sehold),
1366
                                  .rd_e (rd_e[4:0]),
1367
                                  .rd_m (rd_m[4:0]),
1368
                                  .ecl_irf_rd_w(ecl_irf_rd_w[4:0]),
1369
                                  .ld_rd_g(ld_rd_g[4:0]),
1370
                                  .wb_byplog_rd_w2(wb_byplog_rd_w2[4:0]),
1371
                                  .wb_byplog_rd_g2(wb_byplog_rd_g2[4:0]),
1372
                                  .tid_d(tid_d[1:0]),
1373
                                  .thr_match_de(thr_match_de),
1374
                                  .thr_match_dm(thr_match_dm),
1375
                                  .ecl_irf_tid_w(ecl_irf_tid_w[1:0]),
1376
                                  .ld_thr_match_dg(ld_thr_match_dg),
1377
                                  .wb_byplog_tid_w2(wb_byplog_tid_w2[1:0]),
1378
                                  .ld_thr_match_dg2(ld_thr_match_dg2),
1379
                                  .ifu_exu_kill_e(ifu_exu_kill_e),
1380
                                  .wb_e (wb_e),
1381
                                  .bypass_m(bypass_m),
1382
                                  .lsu_exu_dfill_vld_g(lsu_exu_dfill_vld_g),
1383
                                  .bypass_w(bypass_w),
1384
                                  .wb_byplog_wen_w2(wb_byplog_wen_w2),
1385
                                  .wb_byplog_wen_g2(wb_byplog_wen_g2),
1386
                                  .ecl_byp_ldxa_g(ecl_byp_ldxa_g));
1387
   sparc_exu_eclbyplog byplog_rs3h(.rs_sel_mux1_m(ecl_byp_rs3h_mux1_sel_m),
1388
                                  .rs_sel_mux1_w(ecl_byp_rs3h_mux1_sel_w),
1389
                                  .rs_sel_mux1_w2(ecl_byp_rs3h_mux1_sel_w2),
1390
                                  .rs_sel_mux1_other(ecl_byp_rs3h_mux1_sel_other),
1391
                                  .rs_sel_mux2_e(ecl_byp_rs3h_mux2_sel_e),
1392
                                  .rs_sel_mux2_rf(ecl_byp_rs3h_mux2_sel_rf),
1393
                                  .rs_sel_mux2_ld(ecl_byp_rs3h_mux2_sel_ld),
1394
                                  .rs_sel_mux2_usemux1(ecl_byp_rs3h_mux2_sel_usemux1),
1395
                                  .rs_sel_longmux_g2(ecl_byp_rs3h_longmux_sel_g2),
1396
                                  .rs_sel_longmux_w2(ecl_byp_rs3h_longmux_sel_w2),
1397
                                  .rs_sel_longmux_ldxa(ecl_byp_rs3h_longmux_sel_ldxa),
1398
                                  .rs   ({ifu_exu_rs3_d[4:1],1'b1}),
1399
                                  .use_other(1'b0),
1400
                                  /*AUTOINST*/
1401
                                   // Inputs
1402
                                   .sehold(sehold),
1403
                                   .rd_e(rd_e[4:0]),
1404
                                   .rd_m(rd_m[4:0]),
1405
                                   .ecl_irf_rd_w(ecl_irf_rd_w[4:0]),
1406
                                   .ld_rd_g(ld_rd_g[4:0]),
1407
                                   .wb_byplog_rd_w2(wb_byplog_rd_w2[4:0]),
1408
                                   .wb_byplog_rd_g2(wb_byplog_rd_g2[4:0]),
1409
                                   .tid_d(tid_d[1:0]),
1410
                                   .thr_match_de(thr_match_de),
1411
                                   .thr_match_dm(thr_match_dm),
1412
                                   .ecl_irf_tid_w(ecl_irf_tid_w[1:0]),
1413
                                   .ld_thr_match_dg(ld_thr_match_dg),
1414
                                   .wb_byplog_tid_w2(wb_byplog_tid_w2[1:0]),
1415
                                   .ld_thr_match_dg2(ld_thr_match_dg2),
1416
                                   .ifu_exu_kill_e(ifu_exu_kill_e),
1417
                                   .wb_e(wb_e),
1418
                                   .bypass_m(bypass_m),
1419
                                   .lsu_exu_dfill_vld_g(lsu_exu_dfill_vld_g),
1420
                                   .bypass_w(bypass_w),
1421
                                   .wb_byplog_wen_w2(wb_byplog_wen_w2),
1422
                                   .wb_byplog_wen_g2(wb_byplog_wen_g2),
1423
                                   .ecl_byp_ldxa_g(ecl_byp_ldxa_g));
1424
 
1425
   /////////////////////////
1426
   // Division control logic
1427
   /////////////////////////
1428
   sparc_exu_ecl_divcntl divcntl(
1429
                                 .div_ecl_divisorin_31(byp_ecl_rs2_31_e),
1430
                                 /*AUTOINST*/
1431
                                 // Outputs
1432
                                 .ecl_div_xinmask(ecl_div_xinmask),
1433
                                 .ecl_div_keep_d(ecl_div_keep_d),
1434
                                 .ecl_div_ld_inputs(ecl_div_ld_inputs),
1435
                                 .ecl_div_sel_adder(ecl_div_sel_adder),
1436
                                 .ecl_div_last_cycle(ecl_div_last_cycle),
1437
                                 .ecl_div_almostlast_cycle(ecl_div_almostlast_cycle),
1438
                                 .ecl_div_sel_div(ecl_div_sel_div),
1439
                                 .divcntl_wb_req_g(divcntl_wb_req_g),
1440
                                 .divcntl_ccr_cc_w2(divcntl_ccr_cc_w2[7:0]),
1441
                                 .ecl_div_sel_64b(ecl_div_sel_64b),
1442
                                 .ecl_div_sel_u32(ecl_div_sel_u32),
1443
                                 .ecl_div_sel_pos32(ecl_div_sel_pos32),
1444
                                 .ecl_div_sel_neg32(ecl_div_sel_neg32),
1445
                                 .ecl_div_upper32_zero(ecl_div_upper32_zero),
1446
                                 .ecl_div_upper33_one(ecl_div_upper33_one),
1447
                                 .ecl_div_upper33_zero(ecl_div_upper33_zero),
1448
                                 .ecl_div_dividend_sign(ecl_div_dividend_sign),
1449
                                 .ecl_div_newq(ecl_div_newq),
1450
                                 .ecl_div_subtract_l(ecl_div_subtract_l),
1451
                                 .ecl_div_keepx(ecl_div_keepx),
1452
                                 .ecl_div_cin(ecl_div_cin),
1453
                                 // Inputs
1454
                                 .clk   (clk),
1455
                                 .se    (se),
1456
                                 .reset (reset),
1457
                                 .mdqctl_divcntl_input_vld(mdqctl_divcntl_input_vld),
1458
                                 .wb_divcntl_ack_g(wb_divcntl_ack_g),
1459
                                 .mdqctl_divcntl_reset_div(mdqctl_divcntl_reset_div),
1460
                                 .div_ecl_gencc_in_msb_l(div_ecl_gencc_in_msb_l),
1461
                                 .div_ecl_gencc_in_31(div_ecl_gencc_in_31),
1462
                                 .div_ecl_upper32_equal(div_ecl_upper32_equal),
1463
                                 .div_ecl_low32_nonzero(div_ecl_low32_nonzero),
1464
                                 .ecl_div_signed_div(ecl_div_signed_div),
1465
                                 .div_ecl_dividend_msb(div_ecl_dividend_msb),
1466
                                 .div_ecl_xin_msb_l(div_ecl_xin_msb_l),
1467
                                 .div_ecl_x_msb(div_ecl_x_msb),
1468
                                 .div_ecl_d_msb(div_ecl_d_msb),
1469
                                 .div_ecl_cout64(div_ecl_cout64),
1470
                                 .ecl_div_div64(ecl_div_div64),
1471
                                 .mdqctl_divcntl_muldone(mdqctl_divcntl_muldone),
1472
                                 .ecl_div_muls(ecl_div_muls),
1473
                                 .div_ecl_adder_out_31(div_ecl_adder_out_31),
1474
                                 .muls_rs1_31_m_l(muls_rs1_31_m_l),
1475
                                 .div_ecl_cout32(div_ecl_cout32),
1476
                                 .rs2_data_31_m(rs2_data_31_m),
1477
                                 .div_ecl_detect_zero_high(div_ecl_detect_zero_high),
1478
                                 .div_ecl_detect_zero_low(div_ecl_detect_zero_low),
1479
                                 .div_ecl_d_62(div_ecl_d_62));
1480
 
1481
   assign div_e = mdqctl_divcntl_input_vld;
1482
   sparc_exu_ecl_mdqctl mdqctl(.div_zero_m(div_zero_m),
1483
                               .byp_alu_rs1_data_31_e(byp_ecl_rs1_31_e),
1484
                               .byp_alu_rs2_data_31_e(byp_ecl_rs2_31_e),
1485
                               /*AUTOINST*/
1486
                               // Outputs
1487
                               .mdqctl_divcntl_input_vld(mdqctl_divcntl_input_vld),
1488
                               .mdqctl_divcntl_reset_div(mdqctl_divcntl_reset_div),
1489
                               .mdqctl_divcntl_muldone(mdqctl_divcntl_muldone),
1490
                               .ecl_div_div64(ecl_div_div64),
1491
                               .ecl_div_signed_div(ecl_div_signed_div),
1492
                               .ecl_div_muls(ecl_div_muls),
1493
                               .mdqctl_wb_divthr_g(mdqctl_wb_divthr_g[1:0]),
1494
                               .mdqctl_wb_divrd_g(mdqctl_wb_divrd_g[4:0]),
1495
                               .mdqctl_wb_multhr_g(mdqctl_wb_multhr_g[1:0]),
1496
                               .mdqctl_wb_mulrd_g(mdqctl_wb_mulrd_g[4:0]),
1497
                               .mdqctl_wb_divsetcc_g(mdqctl_wb_divsetcc_g),
1498
                               .mdqctl_wb_mulsetcc_g(mdqctl_wb_mulsetcc_g),
1499
                               .mdqctl_wb_yreg_shift_g(mdqctl_wb_yreg_shift_g),
1500
                               .exu_mul_input_vld(exu_mul_input_vld),
1501
                               .mdqctl_wb_yreg_wen_g(mdqctl_wb_yreg_wen_g),
1502
                               .ecl_div_mul_sext_rs1_e(ecl_div_mul_sext_rs1_e),
1503
                               .ecl_div_mul_sext_rs2_e(ecl_div_mul_sext_rs2_e),
1504
                               .ecl_div_mul_get_new_data(ecl_div_mul_get_new_data),
1505
                               .ecl_div_mul_keep_data(ecl_div_mul_keep_data),
1506
                               .ecl_div_mul_get_32bit_data(ecl_div_mul_get_32bit_data),
1507
                               .ecl_div_mul_wen(ecl_div_mul_wen),
1508
                               // Inputs
1509
                               .clk     (clk),
1510
                               .se      (se),
1511
                               .reset   (reset),
1512
                               .ifu_exu_muldivop_d(ifu_exu_muldivop_d[4:0]),
1513
                               .tid_d   (tid_d[1:0]),
1514
                               .ifu_exu_rd_d(ifu_exu_rd_d[4:0]),
1515
                               .tid_w1  (tid_w1[1:0]),
1516
                               .flush_w1(flush_w1),
1517
                               .ifu_exu_inst_vld_w(ifu_exu_inst_vld_w),
1518
                               .wb_divcntl_ack_g(wb_divcntl_ack_g),
1519
                               .divcntl_wb_req_g(divcntl_wb_req_g),
1520
                               .mul_exu_ack(mul_exu_ack),
1521
                               .ecl_div_sel_div(ecl_div_sel_div),
1522
                               .ifu_exu_muls_d(ifu_exu_muls_d),
1523
                               .div_ecl_detect_zero_high(div_ecl_detect_zero_high),
1524
                               .div_ecl_detect_zero_low(div_ecl_detect_zero_low),
1525
                               .ifu_tlu_flush_w(ifu_tlu_flush_w),
1526
                               .early_flush_w(early_flush_w));
1527
 
1528
endmodule // sparc_exu_ecl
1529
 
1530
 

powered by: WebSVN 2.1.0

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