| 1 |
95 |
fafa1971 |
// ========== Copyright Header Begin ==========================================
|
| 2 |
|
|
//
|
| 3 |
|
|
// OpenSPARC T1 Processor File: sparc_ffu_ctl.v
|
| 4 |
|
|
// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
|
| 5 |
|
|
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
|
| 6 |
|
|
//
|
| 7 |
|
|
// The above named program is free software; you can redistribute it and/or
|
| 8 |
|
|
// modify it under the terms of the GNU General Public
|
| 9 |
|
|
// License version 2 as published by the Free Software Foundation.
|
| 10 |
|
|
//
|
| 11 |
|
|
// The above named program is distributed in the hope that it will be
|
| 12 |
|
|
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
|
|
// General Public License for more details.
|
| 15 |
|
|
//
|
| 16 |
|
|
// You should have received a copy of the GNU General Public
|
| 17 |
|
|
// License along with this work; if not, write to the Free Software
|
| 18 |
|
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
| 19 |
|
|
//
|
| 20 |
|
|
// ========== Copyright Header End ============================================
|
| 21 |
|
|
////////////////////////////////////////////////////////////////////////
|
| 22 |
113 |
albert.wat |
`ifdef SIMPLY_RISC_TWEAKS
|
| 23 |
|
|
`define SIMPLY_RISC_SCANIN .si(0)
|
| 24 |
|
|
`else
|
| 25 |
|
|
`define SIMPLY_RISC_SCANIN .si()
|
| 26 |
|
|
`endif
|
| 27 |
95 |
fafa1971 |
/*
|
| 28 |
|
|
// Module Name: sparc_ffu_ctl
|
| 29 |
|
|
// Description: This is the ffu control block.
|
| 30 |
|
|
*/
|
| 31 |
|
|
|
| 32 |
113 |
albert.wat |
`include "iop.h"
|
| 33 |
|
|
`define FSR_NVA 9
|
| 34 |
|
|
`define FSR_OFA 8
|
| 35 |
|
|
`define FSR_UFA 7
|
| 36 |
|
|
`define FSR_DZA 6
|
| 37 |
|
|
`define FSR_NXA 5
|
| 38 |
|
|
`define FSR_NVC 4
|
| 39 |
|
|
`define FSR_OFC 3
|
| 40 |
|
|
`define FSR_UFC 2
|
| 41 |
|
|
`define FSR_DZC 1
|
| 42 |
|
|
`define FSR_NXC 0
|
| 43 |
95 |
fafa1971 |
|
| 44 |
|
|
|
| 45 |
|
|
module sparc_ffu_ctl (/*AUTOARG*/
|
| 46 |
|
|
// Outputs
|
| 47 |
|
|
ffu_exu_rsr_data_mid_m, ffu_exu_rsr_data_lo_m,
|
| 48 |
|
|
ffu_exu_rsr_data_hi_m, ctl_vis_subtract, ctl_vis_sel_log,
|
| 49 |
|
|
ctl_vis_sel_align, ctl_vis_sel_add, ctl_vis_log_sel_xor,
|
| 50 |
|
|
ctl_vis_log_sel_pass, ctl_vis_log_sel_nor, ctl_vis_log_sel_nand,
|
| 51 |
|
|
ctl_vis_log_pass_rs2, ctl_vis_log_pass_rs1,
|
| 52 |
|
|
ctl_vis_log_pass_const, ctl_vis_log_invert_rs2,
|
| 53 |
|
|
ctl_vis_log_invert_rs1, ctl_vis_log_constant, ctl_vis_cin,
|
| 54 |
|
|
ctl_vis_align_odd, ctl_vis_align6, ctl_vis_align4, ctl_vis_align2,
|
| 55 |
|
|
ctl_vis_align0, ctl_vis_add32, ctl_dp_wsr_data_w2, ctl_dp_thr_e,
|
| 56 |
|
|
ctl_dp_gsr_wsr_w2, so, ctl_dp_rst_l, ffu_ifu_fpop_done_w2,
|
| 57 |
|
|
ffu_ifu_cc_vld_w2, ffu_ifu_cc_w2, ffu_ifu_tid_w2,
|
| 58 |
|
|
ffu_ifu_stallreq, ffu_ifu_ecc_ce_w2, ffu_ifu_ecc_ue_w2,
|
| 59 |
|
|
ffu_ifu_err_reg_w2, ffu_ifu_err_synd_w2, ffu_ifu_fst_ce_w,
|
| 60 |
|
|
ffu_lsu_kill_fst_w, ffu_ifu_inj_ack, ffu_lsu_data,
|
| 61 |
|
|
ffu_lsu_fpop_rq_vld, ffu_lsu_blk_st_va_e, ffu_lsu_blk_st_e,
|
| 62 |
|
|
ffu_tlu_trap_ieee754, ffu_tlu_trap_other, ffu_tlu_trap_ue,
|
| 63 |
|
|
ffu_tlu_ill_inst_m, ffu_tlu_fpu_tid, ffu_tlu_fpu_cmplt,
|
| 64 |
|
|
ctl_frf_ren, ctl_frf_wen, ctl_frf_addr, ctl_dp_fp_thr,
|
| 65 |
|
|
ctl_dp_fcc_w2, ctl_dp_ftt_w2, ctl_dp_exc_w2, ctl_dp_ecc_sel_frf,
|
| 66 |
|
|
ctl_dp_output_sel_rs1, ctl_dp_output_sel_rs2,
|
| 67 |
|
|
ctl_dp_output_sel_frf, ctl_dp_output_sel_fsr, ctl_dp_rs2_frf_read,
|
| 68 |
|
|
ctl_dp_rs2_sel_vis, ctl_dp_rs2_sel_fpu_lsu, ctl_dp_rs2_keep_data,
|
| 69 |
|
|
ctl_dp_rd_ecc, ctl_dp_fsr_sel_ld, ctl_dp_fsr_sel_fpu,
|
| 70 |
|
|
ctl_dp_fsr_sel_old, ctl_dp_noshift64_frf, ctl_dp_shift_frf_right,
|
| 71 |
|
|
ctl_dp_shift_frf_left, ctl_dp_zero_low32_frf, ctl_dp_new_rs1,
|
| 72 |
|
|
ctl_dp_sign, ctl_dp_flip_fpu, ctl_dp_flip_lsu, ctl_dp_noflip_fpu,
|
| 73 |
|
|
ctl_dp_noflip_lsu, ctl_frf_write_synd,
|
| 74 |
|
|
// Inputs
|
| 75 |
|
|
ifu_tlu_sraddr_d, exu_ffu_wsr_inst_e, exu_ffu_gsr_scale_m,
|
| 76 |
|
|
exu_ffu_gsr_rnd_m, exu_ffu_gsr_mask_m, exu_ffu_gsr_align_m,
|
| 77 |
|
|
dp_ctl_gsr_scale_e, dp_ctl_gsr_mask_e, rclk, si, se, grst_l,
|
| 78 |
|
|
arst_l, rst_tri_en, dp_ctl_rs2_sign, cpx_vld, cpx_fcmp, cpx_req,
|
| 79 |
|
|
cpx_fccval, cpx_fpexc, dp_ctl_fsr_fcc, dp_ctl_fsr_rnd,
|
| 80 |
|
|
dp_ctl_fsr_tem, dp_ctl_fsr_aexc, dp_ctl_fsr_cexc,
|
| 81 |
|
|
dp_ctl_synd_out_low, dp_ctl_synd_out_high, ifu_ffu_fpop1_d,
|
| 82 |
|
|
ifu_ffu_fpop2_d, ifu_ffu_visop_d, ifu_ffu_fpopcode_d,
|
| 83 |
|
|
ifu_ffu_frs1_d, ifu_ffu_frs2_d, ifu_ffu_frd_d, ifu_ffu_fld_d,
|
| 84 |
|
|
ifu_ffu_fst_d, ifu_ffu_ldst_single_d, ifu_ffu_tid_d,
|
| 85 |
|
|
ifu_ffu_fcc_num_d, ifu_ffu_mvcnd_m, ifu_ffu_inj_frferr,
|
| 86 |
|
|
ifu_exu_ecc_mask, ifu_ffu_ldfsr_d, ifu_ffu_ldxfsr_d,
|
| 87 |
|
|
ifu_ffu_stfsr_d, ifu_ffu_quad_op_e, ifu_tlu_inst_vld_w,
|
| 88 |
|
|
lsu_ffu_flush_pipe_w, ifu_tlu_flush_w, lsu_ffu_ack,
|
| 89 |
|
|
lsu_ffu_ld_vld, lsu_ffu_bld_cnt_w, dp_ctl_ld_fcc, ifu_exu_nceen_e,
|
| 90 |
|
|
ifu_exu_disable_ce_e, lsu_ffu_blk_asi_e, exu_ffu_ist_e,
|
| 91 |
|
|
ifu_tlu_flsh_inst_e, ifu_lsu_ld_inst_e, lsu_ffu_stb_full0,
|
| 92 |
|
|
lsu_ffu_stb_full1, lsu_ffu_stb_full2, lsu_ffu_stb_full3,
|
| 93 |
|
|
//sotheas,8/17/04: fixed eco 6529
|
| 94 |
|
|
lsu_ffu_st_dtlb_perr_g
|
| 95 |
|
|
//////////////////////////////
|
| 96 |
|
|
) ;
|
| 97 |
|
|
/*AUTOINPUT*/
|
| 98 |
|
|
// Beginning of automatic inputs (from unused autoinst inputs)
|
| 99 |
|
|
input [31:0] dp_ctl_gsr_mask_e; // To visctl of sparc_ffu_ctl_visctl.v
|
| 100 |
|
|
input [4:0] dp_ctl_gsr_scale_e; // To visctl of sparc_ffu_ctl_visctl.v
|
| 101 |
|
|
input [2:0] exu_ffu_gsr_align_m; // To visctl of sparc_ffu_ctl_visctl.v
|
| 102 |
|
|
input [31:0] exu_ffu_gsr_mask_m; // To visctl of sparc_ffu_ctl_visctl.v
|
| 103 |
|
|
input [2:0] exu_ffu_gsr_rnd_m; // To visctl of sparc_ffu_ctl_visctl.v
|
| 104 |
|
|
input [4:0] exu_ffu_gsr_scale_m; // To visctl of sparc_ffu_ctl_visctl.v
|
| 105 |
|
|
input exu_ffu_wsr_inst_e; // To visctl of sparc_ffu_ctl_visctl.v
|
| 106 |
|
|
input [6:0] ifu_tlu_sraddr_d; // To visctl of sparc_ffu_ctl_visctl.v
|
| 107 |
|
|
// End of automatics
|
| 108 |
|
|
input rclk;
|
| 109 |
|
|
input si;
|
| 110 |
|
|
input se;
|
| 111 |
|
|
input grst_l;
|
| 112 |
|
|
input arst_l;
|
| 113 |
|
|
input rst_tri_en;
|
| 114 |
|
|
input [1:0] dp_ctl_rs2_sign;
|
| 115 |
|
|
|
| 116 |
|
|
input cpx_vld;
|
| 117 |
|
|
input cpx_fcmp;
|
| 118 |
|
|
input [3:0] cpx_req;
|
| 119 |
|
|
input [1:0] cpx_fccval;
|
| 120 |
|
|
input [4:0] cpx_fpexc;
|
| 121 |
|
|
input [7:0] dp_ctl_fsr_fcc;
|
| 122 |
|
|
input [1:0] dp_ctl_fsr_rnd;
|
| 123 |
|
|
input [4:0] dp_ctl_fsr_tem;
|
| 124 |
|
|
input [4:0] dp_ctl_fsr_aexc;
|
| 125 |
|
|
input [4:0] dp_ctl_fsr_cexc;
|
| 126 |
|
|
|
| 127 |
|
|
input [6:0] dp_ctl_synd_out_low; // signals for ecc errors
|
| 128 |
|
|
input [6:0] dp_ctl_synd_out_high;
|
| 129 |
|
|
|
| 130 |
|
|
input ifu_ffu_fpop1_d;
|
| 131 |
|
|
input ifu_ffu_fpop2_d;
|
| 132 |
|
|
input ifu_ffu_visop_d;
|
| 133 |
|
|
input [8:0] ifu_ffu_fpopcode_d;
|
| 134 |
|
|
input [4:0] ifu_ffu_frs1_d;
|
| 135 |
|
|
input [4:0] ifu_ffu_frs2_d;
|
| 136 |
|
|
input [4:0] ifu_ffu_frd_d;
|
| 137 |
|
|
input ifu_ffu_fld_d;
|
| 138 |
|
|
input ifu_ffu_fst_d;
|
| 139 |
|
|
input ifu_ffu_ldst_single_d;
|
| 140 |
|
|
input [1:0] ifu_ffu_tid_d;
|
| 141 |
|
|
input [1:0] ifu_ffu_fcc_num_d;
|
| 142 |
|
|
input ifu_ffu_mvcnd_m;
|
| 143 |
|
|
|
| 144 |
|
|
input ifu_ffu_inj_frferr;
|
| 145 |
|
|
input [6:0] ifu_exu_ecc_mask;
|
| 146 |
|
|
|
| 147 |
|
|
input ifu_ffu_ldfsr_d,
|
| 148 |
|
|
ifu_ffu_ldxfsr_d,
|
| 149 |
|
|
ifu_ffu_stfsr_d;
|
| 150 |
|
|
input ifu_ffu_quad_op_e;
|
| 151 |
|
|
|
| 152 |
|
|
input ifu_tlu_inst_vld_w;
|
| 153 |
|
|
input lsu_ffu_flush_pipe_w;
|
| 154 |
|
|
input ifu_tlu_flush_w;
|
| 155 |
|
|
|
| 156 |
|
|
input lsu_ffu_ack;
|
| 157 |
|
|
input lsu_ffu_ld_vld;
|
| 158 |
|
|
input [2:0] lsu_ffu_bld_cnt_w;
|
| 159 |
|
|
input [7:0] dp_ctl_ld_fcc;
|
| 160 |
|
|
|
| 161 |
|
|
input ifu_exu_nceen_e;// enable ecc traps
|
| 162 |
|
|
input ifu_exu_disable_ce_e; // all ce are treated as ue
|
| 163 |
|
|
input lsu_ffu_blk_asi_e;
|
| 164 |
|
|
input exu_ffu_ist_e;
|
| 165 |
|
|
input ifu_tlu_flsh_inst_e;
|
| 166 |
|
|
input ifu_lsu_ld_inst_e;
|
| 167 |
|
|
input lsu_ffu_stb_full0;
|
| 168 |
|
|
input lsu_ffu_stb_full1;
|
| 169 |
|
|
input lsu_ffu_stb_full2;
|
| 170 |
|
|
input lsu_ffu_stb_full3;
|
| 171 |
|
|
|
| 172 |
|
|
input lsu_ffu_st_dtlb_perr_g; //sotheas,8/17/04: fixed eco 6529, when asserted terminated
|
| 173 |
|
|
// block store
|
| 174 |
|
|
|
| 175 |
|
|
/*AUTOOUTPUT*/
|
| 176 |
|
|
// Beginning of automatic outputs (from unused autoinst outputs)
|
| 177 |
|
|
output [3:0] ctl_dp_gsr_wsr_w2; // From visctl of sparc_ffu_ctl_visctl.v
|
| 178 |
|
|
output [3:0] ctl_dp_thr_e; // From visctl of sparc_ffu_ctl_visctl.v
|
| 179 |
|
|
output [36:0] ctl_dp_wsr_data_w2; // From visctl of sparc_ffu_ctl_visctl.v
|
| 180 |
|
|
output ctl_vis_add32; // From visctl of sparc_ffu_ctl_visctl.v
|
| 181 |
|
|
output ctl_vis_align0; // From visctl of sparc_ffu_ctl_visctl.v
|
| 182 |
|
|
output ctl_vis_align2; // From visctl of sparc_ffu_ctl_visctl.v
|
| 183 |
|
|
output ctl_vis_align4; // From visctl of sparc_ffu_ctl_visctl.v
|
| 184 |
|
|
output ctl_vis_align6; // From visctl of sparc_ffu_ctl_visctl.v
|
| 185 |
|
|
output ctl_vis_align_odd; // From visctl of sparc_ffu_ctl_visctl.v
|
| 186 |
|
|
output ctl_vis_cin; // From visctl of sparc_ffu_ctl_visctl.v
|
| 187 |
|
|
output ctl_vis_log_constant; // From visctl of sparc_ffu_ctl_visctl.v
|
| 188 |
|
|
output ctl_vis_log_invert_rs1; // From visctl of sparc_ffu_ctl_visctl.v
|
| 189 |
|
|
output ctl_vis_log_invert_rs2; // From visctl of sparc_ffu_ctl_visctl.v
|
| 190 |
|
|
output ctl_vis_log_pass_const; // From visctl of sparc_ffu_ctl_visctl.v
|
| 191 |
|
|
output ctl_vis_log_pass_rs1; // From visctl of sparc_ffu_ctl_visctl.v
|
| 192 |
|
|
output ctl_vis_log_pass_rs2; // From visctl of sparc_ffu_ctl_visctl.v
|
| 193 |
|
|
output ctl_vis_log_sel_nand; // From visctl of sparc_ffu_ctl_visctl.v
|
| 194 |
|
|
output ctl_vis_log_sel_nor; // From visctl of sparc_ffu_ctl_visctl.v
|
| 195 |
|
|
output ctl_vis_log_sel_pass; // From visctl of sparc_ffu_ctl_visctl.v
|
| 196 |
|
|
output ctl_vis_log_sel_xor; // From visctl of sparc_ffu_ctl_visctl.v
|
| 197 |
|
|
output ctl_vis_sel_add; // From visctl of sparc_ffu_ctl_visctl.v
|
| 198 |
|
|
output ctl_vis_sel_align; // From visctl of sparc_ffu_ctl_visctl.v
|
| 199 |
|
|
output ctl_vis_sel_log; // From visctl of sparc_ffu_ctl_visctl.v
|
| 200 |
|
|
output ctl_vis_subtract; // From visctl of sparc_ffu_ctl_visctl.v
|
| 201 |
|
|
output [31:0] ffu_exu_rsr_data_hi_m; // From visctl of sparc_ffu_ctl_visctl.v
|
| 202 |
|
|
output [7:0] ffu_exu_rsr_data_lo_m; // From visctl of sparc_ffu_ctl_visctl.v
|
| 203 |
|
|
output [2:0] ffu_exu_rsr_data_mid_m; // From visctl of sparc_ffu_ctl_visctl.v
|
| 204 |
|
|
// End of automatics
|
| 205 |
|
|
output so;
|
| 206 |
|
|
output ctl_dp_rst_l;
|
| 207 |
|
|
output ffu_ifu_fpop_done_w2;
|
| 208 |
|
|
output [3:0] ffu_ifu_cc_vld_w2;// one hot valid for each set of fcc
|
| 209 |
|
|
output [7:0] ffu_ifu_cc_w2;// all 4 sets of fcc
|
| 210 |
|
|
output [1:0] ffu_ifu_tid_w2;
|
| 211 |
|
|
output ffu_ifu_stallreq; // stall pipe so blk st can issue
|
| 212 |
|
|
|
| 213 |
|
|
output ffu_ifu_ecc_ce_w2; // correctable ecc error
|
| 214 |
|
|
output ffu_ifu_ecc_ue_w2; // uncorrectable ecc error
|
| 215 |
|
|
output [5:0] ffu_ifu_err_reg_w2;
|
| 216 |
|
|
output [13:0] ffu_ifu_err_synd_w2;
|
| 217 |
|
|
output ffu_ifu_fst_ce_w;
|
| 218 |
|
|
output ffu_lsu_kill_fst_w;
|
| 219 |
|
|
output ffu_ifu_inj_ack;
|
| 220 |
|
|
|
| 221 |
|
|
output [80:64] ffu_lsu_data;
|
| 222 |
|
|
output ffu_lsu_fpop_rq_vld ; // ffu dispatches fpop issue request.
|
| 223 |
|
|
output [5:3] ffu_lsu_blk_st_va_e;
|
| 224 |
|
|
output ffu_lsu_blk_st_e;
|
| 225 |
|
|
|
| 226 |
|
|
output ffu_tlu_trap_ieee754;
|
| 227 |
|
|
output ffu_tlu_trap_other;
|
| 228 |
|
|
output ffu_tlu_trap_ue;
|
| 229 |
|
|
output ffu_tlu_ill_inst_m;
|
| 230 |
|
|
|
| 231 |
|
|
output [1:0] ffu_tlu_fpu_tid;
|
| 232 |
|
|
output ffu_tlu_fpu_cmplt;
|
| 233 |
|
|
|
| 234 |
|
|
output ctl_frf_ren;
|
| 235 |
|
|
output [1:0] ctl_frf_wen;
|
| 236 |
|
|
output [6:0] ctl_frf_addr;
|
| 237 |
|
|
|
| 238 |
|
|
output [3:0] ctl_dp_fp_thr;
|
| 239 |
|
|
|
| 240 |
|
|
output [7:0] ctl_dp_fcc_w2;
|
| 241 |
|
|
output [2:0] ctl_dp_ftt_w2;
|
| 242 |
|
|
output [9:0] ctl_dp_exc_w2;
|
| 243 |
|
|
|
| 244 |
|
|
output ctl_dp_ecc_sel_frf;
|
| 245 |
|
|
|
| 246 |
|
|
|
| 247 |
|
|
// mux selects
|
| 248 |
|
|
output ctl_dp_output_sel_rs1;
|
| 249 |
|
|
output ctl_dp_output_sel_rs2;
|
| 250 |
|
|
output ctl_dp_output_sel_frf;
|
| 251 |
|
|
output ctl_dp_output_sel_fsr;
|
| 252 |
|
|
|
| 253 |
|
|
output ctl_dp_rs2_frf_read;
|
| 254 |
|
|
output ctl_dp_rs2_sel_vis;
|
| 255 |
|
|
output ctl_dp_rs2_sel_fpu_lsu;
|
| 256 |
|
|
output ctl_dp_rs2_keep_data;
|
| 257 |
|
|
output ctl_dp_rd_ecc;
|
| 258 |
|
|
|
| 259 |
|
|
output [3:0] ctl_dp_fsr_sel_ld,
|
| 260 |
|
|
ctl_dp_fsr_sel_fpu,
|
| 261 |
|
|
ctl_dp_fsr_sel_old;
|
| 262 |
|
|
|
| 263 |
|
|
output ctl_dp_noshift64_frf;
|
| 264 |
|
|
output ctl_dp_shift_frf_right;
|
| 265 |
|
|
output ctl_dp_shift_frf_left;
|
| 266 |
|
|
output ctl_dp_zero_low32_frf;
|
| 267 |
|
|
|
| 268 |
|
|
output ctl_dp_new_rs1;
|
| 269 |
|
|
|
| 270 |
|
|
output [1:0] ctl_dp_sign;
|
| 271 |
|
|
|
| 272 |
|
|
output ctl_dp_flip_fpu;
|
| 273 |
|
|
output ctl_dp_flip_lsu;
|
| 274 |
|
|
output ctl_dp_noflip_fpu;
|
| 275 |
|
|
output ctl_dp_noflip_lsu;
|
| 276 |
|
|
|
| 277 |
|
|
|
| 278 |
|
|
wire clk;
|
| 279 |
|
|
wire reset;
|
| 280 |
|
|
wire ffu_reset_l;
|
| 281 |
|
|
// FPOP is broken into parts:
|
| 282 |
|
|
// [8:4] fpop_high
|
| 283 |
|
|
// [3:2] fpop_mid
|
| 284 |
|
|
// [1:0] fpop_size
|
| 285 |
|
|
wire fpop_size_0; // 2 lsbs of fpop
|
| 286 |
|
|
wire fpop_size_1;
|
| 287 |
|
|
|
| 288 |
|
|
wire fpop_high_0; // 4 msbs of fpop
|
| 289 |
|
|
wire fpop_high_2;
|
| 290 |
|
|
wire fpop_high_4;
|
| 291 |
|
|
wire fpop_high_5;
|
| 292 |
|
|
wire fpop_high_6;
|
| 293 |
|
|
wire fpop_high_8;
|
| 294 |
|
|
wire fpop_high_a;
|
| 295 |
|
|
wire fpop_high_c;
|
| 296 |
|
|
wire fpop_high_d;
|
| 297 |
|
|
wire fpop_high_e;
|
| 298 |
|
|
wire fpop_high_10;
|
| 299 |
|
|
wire fpop_high_18;
|
| 300 |
|
|
wire fpop_low_1;
|
| 301 |
|
|
wire fpop_low_2;
|
| 302 |
|
|
wire fpop_low_4;
|
| 303 |
|
|
wire fpop_low_5;
|
| 304 |
|
|
wire fpop_low_6;
|
| 305 |
|
|
wire fpop_low_8;
|
| 306 |
|
|
wire fpop_low_9;
|
| 307 |
|
|
wire fpop_low_a;
|
| 308 |
|
|
wire fpop_low_d;
|
| 309 |
|
|
wire fpop_low_e;
|
| 310 |
|
|
|
| 311 |
|
|
wire source_single_e;
|
| 312 |
|
|
wire source_single_next;
|
| 313 |
|
|
wire source_single;
|
| 314 |
|
|
|
| 315 |
|
|
wire dest_single_e;
|
| 316 |
|
|
wire dest_single_next;
|
| 317 |
|
|
wire dest_single;
|
| 318 |
|
|
|
| 319 |
|
|
wire [4:0] frs1_e;
|
| 320 |
|
|
wire [5:0] rs1_e;
|
| 321 |
|
|
wire [5:0] rs1_next;
|
| 322 |
|
|
wire [5:0] rs1;
|
| 323 |
|
|
wire [4:0] frs2_e;
|
| 324 |
|
|
wire [5:0] rs2_e;
|
| 325 |
|
|
wire [4:0] frd_e;
|
| 326 |
|
|
wire ldst_single_e;
|
| 327 |
|
|
wire [5:0] rd_e;
|
| 328 |
|
|
wire [5:1] st_rd_d;
|
| 329 |
|
|
wire [5:1] write_addr;
|
| 330 |
|
|
|
| 331 |
|
|
wire [5:0] rs2_next;
|
| 332 |
|
|
wire [5:0] rs2;
|
| 333 |
|
|
wire [5:0] rd_next;
|
| 334 |
|
|
wire [5:0] rd;
|
| 335 |
|
|
wire [5:1] blk_rd;
|
| 336 |
|
|
|
| 337 |
|
|
wire is_fpop_d;
|
| 338 |
|
|
wire shift_frf_rs2_m;
|
| 339 |
|
|
wire shift_frf_rs1_w;
|
| 340 |
|
|
wire shift_frf_right_next;
|
| 341 |
|
|
wire shift_frf_right;
|
| 342 |
|
|
wire shift_frf_left_next;
|
| 343 |
|
|
wire shift_frf_left;
|
| 344 |
|
|
wire noshift64_frf_next;
|
| 345 |
|
|
wire noshift64_frf;
|
| 346 |
|
|
|
| 347 |
|
|
wire abs_w;
|
| 348 |
|
|
wire neg_w;
|
| 349 |
|
|
wire cond_move_e;
|
| 350 |
|
|
wire cond_move_m;
|
| 351 |
|
|
wire move_e;
|
| 352 |
|
|
wire move_m;
|
| 353 |
|
|
wire move_m_valid;
|
| 354 |
|
|
wire move_w;
|
| 355 |
|
|
wire move_w_valid;
|
| 356 |
|
|
wire move_w2;
|
| 357 |
|
|
wire move_w2_vld;
|
| 358 |
|
|
wire move_wen_m;
|
| 359 |
|
|
wire move_wen_w;
|
| 360 |
|
|
wire move_wen_w2;
|
| 361 |
|
|
wire move_wen_w2_valid;
|
| 362 |
|
|
|
| 363 |
|
|
wire vis_nofrf_e;
|
| 364 |
|
|
wire ren_rs2_e;
|
| 365 |
|
|
wire ren_rs2_e_vld;
|
| 366 |
|
|
wire ren_rs2_m;
|
| 367 |
|
|
wire ren_rs2_m_vld;
|
| 368 |
|
|
wire ren_rs2_w;
|
| 369 |
|
|
wire ren_rs2_w2;
|
| 370 |
|
|
wire ren_rs2_w3;
|
| 371 |
|
|
wire ren_rs2_w4;
|
| 372 |
|
|
wire ren_rs1_e;
|
| 373 |
|
|
wire ren_rs1_m;
|
| 374 |
|
|
wire ren_rs1_w;
|
| 375 |
|
|
wire ren_rs1_w_vld;
|
| 376 |
|
|
wire ren_rs1_w2_vld;
|
| 377 |
|
|
wire ren_rs1_w2;
|
| 378 |
|
|
wire ren_rs1_w3;
|
| 379 |
|
|
wire ren_rs1_w4;
|
| 380 |
|
|
wire ren_rs1_w5;
|
| 381 |
|
|
wire read_rs1;
|
| 382 |
|
|
wire read_rs2;
|
| 383 |
|
|
wire read_rd;
|
| 384 |
|
|
wire read_bst;
|
| 385 |
|
|
|
| 386 |
|
|
wire fpu_op_e;
|
| 387 |
|
|
wire fpu_op_m;
|
| 388 |
|
|
wire fpu_op_w_vld;
|
| 389 |
|
|
wire fpu_op_w;
|
| 390 |
|
|
wire fpu_op_w2;
|
| 391 |
|
|
wire fpu_op_w2_vld;
|
| 392 |
|
|
wire fpu_op_w3;
|
| 393 |
|
|
wire fpu_op_w3_vld;
|
| 394 |
|
|
wire any_op_e;
|
| 395 |
|
|
wire any_op_m;
|
| 396 |
|
|
wire any_op_w;
|
| 397 |
|
|
wire any_op_w2;
|
| 398 |
|
|
wire any_op_m_valid;
|
| 399 |
|
|
wire visop_e;
|
| 400 |
|
|
wire visop_m;
|
| 401 |
|
|
wire visop_w_vld;
|
| 402 |
|
|
|
| 403 |
|
|
wire fld_e;
|
| 404 |
|
|
wire fld_m;
|
| 405 |
|
|
wire fst_e;
|
| 406 |
|
|
wire fst_m;
|
| 407 |
|
|
wire fst_w;
|
| 408 |
|
|
wire zero_lower_data_next;
|
| 409 |
|
|
|
| 410 |
|
|
wire fpop1_e;
|
| 411 |
|
|
wire fpop2_e;
|
| 412 |
|
|
wire fpop1_next;
|
| 413 |
|
|
wire fpop1;
|
| 414 |
|
|
wire fpop2_next;
|
| 415 |
|
|
wire fpop2;
|
| 416 |
|
|
wire visop_next;
|
| 417 |
|
|
wire visop;
|
| 418 |
|
|
wire kill_m;
|
| 419 |
|
|
wire killed_w;
|
| 420 |
|
|
wire kill_w;
|
| 421 |
|
|
wire kill_unimpl_w;
|
| 422 |
|
|
wire kill_fp;
|
| 423 |
|
|
wire kill_eccchk_w;
|
| 424 |
|
|
wire flush_w;
|
| 425 |
|
|
wire flush_w2;
|
| 426 |
|
|
|
| 427 |
|
|
wire [1:0] tid_next;
|
| 428 |
|
|
wire [1:0] tid;
|
| 429 |
|
|
wire [1:0] extra_tid;
|
| 430 |
|
|
wire [8:0] opf_next;
|
| 431 |
|
|
wire [8:0] opf;
|
| 432 |
|
|
wire [5:1] early_frf_rnum;
|
| 433 |
|
|
wire [5:1] frf_rnum;
|
| 434 |
|
|
wire [1:0] frf_tid;
|
| 435 |
|
|
wire [1:0] fpu_rnd;
|
| 436 |
|
|
|
| 437 |
|
|
wire thr_match_mw2;
|
| 438 |
|
|
wire thr_match_ww2;
|
| 439 |
|
|
wire thr_match_fpw2;
|
| 440 |
|
|
wire [1:0] tid_e,
|
| 441 |
|
|
tid_m,
|
| 442 |
|
|
tid_w,
|
| 443 |
|
|
tid_w2;
|
| 444 |
|
|
|
| 445 |
|
|
wire fpop1_ready_w2_next;
|
| 446 |
|
|
wire fpop2_ready_w3_next;
|
| 447 |
|
|
wire fpop1_ready_w2;
|
| 448 |
|
|
wire fpop2_ready_w3;
|
| 449 |
|
|
wire issue_fpop2;
|
| 450 |
|
|
|
| 451 |
|
|
wire ldfsr,
|
| 452 |
|
|
ldxfsr,
|
| 453 |
|
|
stfsr_e,
|
| 454 |
|
|
stfsr_w,
|
| 455 |
|
|
stfsr_qual_w,
|
| 456 |
|
|
ldfsr_vld,
|
| 457 |
|
|
ldxfsr_vld;
|
| 458 |
|
|
wire stfsr_w2;
|
| 459 |
|
|
wire stfsr_w2_vld;
|
| 460 |
|
|
|
| 461 |
|
|
wire clear_ftt;
|
| 462 |
|
|
|
| 463 |
|
|
wire [1:0] ldfsr_next;
|
| 464 |
|
|
|
| 465 |
|
|
wire is_fpu_result;
|
| 466 |
|
|
|
| 467 |
|
|
wire output_sel_rs1_next;
|
| 468 |
|
|
wire output_sel_frf_next;
|
| 469 |
|
|
wire output_sel_fsr_next;
|
| 470 |
|
|
wire output_sel_rs2_next;
|
| 471 |
|
|
wire output_sel_rs1;
|
| 472 |
|
|
wire output_sel_frf;
|
| 473 |
|
|
wire output_sel_fsr;
|
| 474 |
|
|
wire output_sel_rs2;
|
| 475 |
|
|
|
| 476 |
|
|
wire ffu_op_done_next;
|
| 477 |
|
|
wire ffu_op_done;
|
| 478 |
|
|
wire ffu_op_done_vld;
|
| 479 |
|
|
wire external_wen_next;
|
| 480 |
|
|
wire lsu_pkt_vld;
|
| 481 |
|
|
wire [1:0] lsu_pkt_type;
|
| 482 |
|
|
wire store_ready;
|
| 483 |
|
|
wire load_pending;
|
| 484 |
|
|
wire load_pending_next;
|
| 485 |
|
|
wire blk_ld_done;
|
| 486 |
|
|
wire blk_ld_m;
|
| 487 |
|
|
wire blk_load_pending;
|
| 488 |
|
|
wire blk_load_pending_next;
|
| 489 |
|
|
wire fp_pending,
|
| 490 |
|
|
fp_pending_next;
|
| 491 |
|
|
|
| 492 |
|
|
wire [3:0] fcc_num_dec;
|
| 493 |
|
|
wire [1:0] fcc_num,
|
| 494 |
|
|
fcc_num_next;
|
| 495 |
|
|
|
| 496 |
|
|
wire [7:0] fpu_fcc;
|
| 497 |
|
|
wire [9:0] fp_exc_w2;
|
| 498 |
|
|
|
| 499 |
|
|
wire fcc_sel_fpu;
|
| 500 |
|
|
wire fcc_sel_ldx;
|
| 501 |
|
|
wire fcc_sel_ld;
|
| 502 |
|
|
wire fcc_sel_old;
|
| 503 |
|
|
wire cc_changed;
|
| 504 |
|
|
wire rf_wen;
|
| 505 |
|
|
wire rf_wen_next;
|
| 506 |
|
|
wire rf_ecc_gen_next;
|
| 507 |
|
|
wire rf_ecc_gen;
|
| 508 |
|
|
wire vis_wen_next;
|
| 509 |
|
|
wire vis_result;
|
| 510 |
|
|
|
| 511 |
|
|
wire [4:0] fsr_tem_d1;
|
| 512 |
|
|
wire ieee_trap;
|
| 513 |
|
|
wire take_ieee_trap;
|
| 514 |
|
|
wire take_other_trap;
|
| 515 |
|
|
wire [4:0] ieee_trap_vec;
|
| 516 |
|
|
wire fpexc_nxc;
|
| 517 |
|
|
wire fpexc_ofc;
|
| 518 |
|
|
wire fpexc_ufc;
|
| 519 |
|
|
|
| 520 |
|
|
wire [1:0] error_detected;
|
| 521 |
|
|
wire [1:0] possible_ue;
|
| 522 |
|
|
wire [1:0] ce;
|
| 523 |
|
|
wire [1:0] prev_err_detected;
|
| 524 |
|
|
wire [1:0] prev_poss_ue;
|
| 525 |
|
|
wire rollback_fst_m;
|
| 526 |
|
|
wire rollback_fst_w;
|
| 527 |
|
|
wire rollback_rs2_w2;
|
| 528 |
|
|
wire rollback_rs1_w3;
|
| 529 |
|
|
wire rollback_c1_next;
|
| 530 |
|
|
wire rollback_c1;
|
| 531 |
|
|
wire rollback_c1_vld;
|
| 532 |
|
|
wire rollback_c2;
|
| 533 |
|
|
wire rollback_c3;
|
| 534 |
|
|
wire rolled_back_next;
|
| 535 |
|
|
wire rolled_back;
|
| 536 |
|
|
wire chk_rs1_w2;
|
| 537 |
|
|
wire check_ecc_next;
|
| 538 |
|
|
wire [1:0] chk_ecc_m;
|
| 539 |
|
|
wire [1:0] chk_ecc_w;
|
| 540 |
|
|
wire [1:0] chk_ecc_w2;
|
| 541 |
|
|
wire [1:0] chk_ecc;
|
| 542 |
|
|
wire [1:0] chk_ecc_prev;
|
| 543 |
|
|
wire disable_ce_m;
|
| 544 |
|
|
wire disable_ce_w;
|
| 545 |
|
|
wire fst_ce_w;
|
| 546 |
|
|
wire fst_ue_w;
|
| 547 |
|
|
wire fst_ce_w2;
|
| 548 |
|
|
wire fst_ue_w2;
|
| 549 |
|
|
wire rs2_ce_w2;
|
| 550 |
|
|
wire rs2_ue_w2;
|
| 551 |
|
|
wire rs2_fst_ce_w2_vld;
|
| 552 |
|
|
wire rs2_fst_ue_w2_vld;
|
| 553 |
|
|
wire rs2_fst_ce_w3;
|
| 554 |
|
|
wire rs2_fst_ue_w3;
|
| 555 |
|
|
wire rs1_ce_w3;
|
| 556 |
|
|
wire ce_w3;
|
| 557 |
|
|
wire ue_w3;
|
| 558 |
|
|
wire nceen;
|
| 559 |
|
|
wire nceen_next;
|
| 560 |
|
|
wire ue_trap_w3;
|
| 561 |
|
|
wire [1:0] previous_ce;
|
| 562 |
|
|
wire previous_ue;
|
| 563 |
|
|
wire [1:0] ecc_wen_next;
|
| 564 |
|
|
wire [1:0] ecc_wen_gen_next;
|
| 565 |
|
|
wire [1:0] ecc_wen_gen;
|
| 566 |
|
|
wire [1:0] ecc_wen;
|
| 567 |
|
|
wire inject_err_next;
|
| 568 |
|
|
wire [6:0] err_data;
|
| 569 |
|
|
wire inject_err;
|
| 570 |
|
|
wire wen_rs1_ecc;
|
| 571 |
|
|
wire wen_rs2_ecc;
|
| 572 |
|
|
wire ecc_kill_rs2_w2;
|
| 573 |
|
|
wire [13:0] new_err_synd;
|
| 574 |
|
|
wire [13:0] err_synd_d1;
|
| 575 |
|
|
wire [13:0] err_synd_next;
|
| 576 |
|
|
wire [5:0] new_err_reg;
|
| 577 |
|
|
wire [5:0] err_reg_next;
|
| 578 |
|
|
wire [5:0] err_reg_d1;
|
| 579 |
|
|
wire log_new_err;
|
| 580 |
|
|
wire kill_st_ce_w;
|
| 581 |
|
|
wire possible_kill_st_ue_m;
|
| 582 |
|
|
wire possible_kill_st_ce_m;
|
| 583 |
|
|
wire possible_kill_st_ue_w;
|
| 584 |
|
|
wire possible_kill_st_ce_w;
|
| 585 |
|
|
|
| 586 |
|
|
wire unimpl_op_e,
|
| 587 |
|
|
unimpl_op_all_e,
|
| 588 |
|
|
unimpl_op_m,
|
| 589 |
|
|
unimpl_op_w,
|
| 590 |
|
|
unimpl_qual_w,
|
| 591 |
|
|
unimpl_qual_w2,
|
| 592 |
|
|
unimpl_op_w2;
|
| 593 |
|
|
wire illegal_vis_e;
|
| 594 |
|
|
wire illegal_vis_m;
|
| 595 |
|
|
wire illegal_blk_m;
|
| 596 |
|
|
wire illegal_rs1_e;
|
| 597 |
|
|
wire illegal_field_e;
|
| 598 |
|
|
wire convert_op_e;
|
| 599 |
|
|
|
| 600 |
|
|
wire cpx_vld_d1;
|
| 601 |
|
|
wire cpx_fcmp_d1;
|
| 602 |
|
|
wire [3:0] cpx_req_d1;
|
| 603 |
|
|
wire [1:0] cpx_fccval_d1;
|
| 604 |
|
|
wire [4:0] cpx_fpexc_d1;
|
| 605 |
|
|
|
| 606 |
|
|
wire bst_m;
|
| 607 |
|
|
wire bst_w;
|
| 608 |
|
|
wire st_dtlb_perr_w2_l;
|
| 609 |
|
|
wire can_issue_bst_c2;
|
| 610 |
|
|
wire other_mem_op_e;
|
| 611 |
|
|
wire [5:0] bst_rs;
|
| 612 |
|
|
wire [2:0] bst_cnt;
|
| 613 |
|
|
wire [2:0] bst_cnt_next;
|
| 614 |
|
|
wire bst_read_req;
|
| 615 |
|
|
wire bst_issue_c1;
|
| 616 |
|
|
wire bst_issue_c2;
|
| 617 |
|
|
wire bst_issue_c3;
|
| 618 |
|
|
wire bst_issue_c4;
|
| 619 |
|
|
wire bst_issue_c5;
|
| 620 |
|
|
wire bst_issue_c6;
|
| 621 |
|
|
wire bst_issue_c1_next;
|
| 622 |
|
|
wire bst_issue_c2_next;
|
| 623 |
|
|
wire bst_issue_c3_next;
|
| 624 |
|
|
wire bst_issue_c4_next;
|
| 625 |
|
|
wire bst_issue_c5_next;
|
| 626 |
|
|
wire bst_issue_c6_next;
|
| 627 |
|
|
wire bst_done;
|
| 628 |
|
|
wire [2:0] bld_cnt_d1;
|
| 629 |
|
|
wire [2:0] bld_cnt_d2;
|
| 630 |
|
|
wire [2:0] bld_cnt_d3;
|
| 631 |
|
|
wire stb_full0;
|
| 632 |
|
|
wire stb_full1;
|
| 633 |
|
|
wire stb_full2;
|
| 634 |
|
|
wire stb_full3;
|
| 635 |
|
|
wire stb_full_c2;
|
| 636 |
|
|
wire [5:0] bst_stall_cnt;
|
| 637 |
|
|
wire [5:0] bst_stall_cnt_next;
|
| 638 |
|
|
wire bst_stall_req;
|
| 639 |
|
|
wire bst_stall_req_next;
|
| 640 |
|
|
wire fld_done;
|
| 641 |
|
|
wire ld_ret;
|
| 642 |
|
|
wire bst_ce_c4;
|
| 643 |
|
|
wire bst_ue_c4;
|
| 644 |
|
|
wire fixed_bst_ce;
|
| 645 |
|
|
wire fixed_bst_ce_next;
|
| 646 |
|
|
wire blk_asi_m;
|
| 647 |
|
|
|
| 648 |
|
|
//
|
| 649 |
|
|
// Code begins here
|
| 650 |
|
|
//
|
| 651 |
|
|
assign clk = rclk;
|
| 652 |
|
|
// Reset flop
|
| 653 |
|
|
dffrl_async rstff(.din (grst_l),
|
| 654 |
|
|
.q (ffu_reset_l),
|
| 655 |
|
|
.clk (clk),
|
| 656 |
113 |
albert.wat |
.rst_l (arst_l), `SIMPLY_RISC_SCANIN, .so(), .se(se));
|
| 657 |
95 |
fafa1971 |
assign ctl_dp_rst_l = ffu_reset_l;
|
| 658 |
|
|
assign reset = ~ffu_reset_l;
|
| 659 |
|
|
// Stage cpx data by one cycle
|
| 660 |
113 |
albert.wat |
dff_s #(13) cpx_dff(.din({cpx_vld, cpx_fcmp, cpx_req[3:0], cpx_fccval[1:0], cpx_fpexc[4:0]}),
|
| 661 |
95 |
fafa1971 |
.q({cpx_vld_d1, cpx_fcmp_d1, cpx_req_d1[3:0], cpx_fccval_d1[1:0], cpx_fpexc_d1[4:0]}),
|
| 662 |
113 |
albert.wat |
.clk(clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 663 |
|
|
dff_s #(3) lsu_bld_cnt1_dff(.din({lsu_ffu_bld_cnt_w[2:0]}), .clk(clk),
|
| 664 |
|
|
.q({bld_cnt_d1[2:0]}), .se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 665 |
|
|
dff_s #(3) lsu_bld_cnt2_dff(.din({bld_cnt_d1[2:0]}), .clk(clk),
|
| 666 |
|
|
.q({bld_cnt_d2[2:0]}), .se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 667 |
|
|
dff_s #(3) lsu_bld_cnt3_dff(.din({bld_cnt_d2[2:0]}), .clk(clk),
|
| 668 |
|
|
.q({bld_cnt_d3[2:0]}), .se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 669 |
95 |
fafa1971 |
|
| 670 |
|
|
//----------------------------------------
|
| 671 |
|
|
// Decode Instruction From IFU
|
| 672 |
|
|
//----------------------------------------
|
| 673 |
113 |
albert.wat |
dff_s #(3) fpop_d2e(.din({ifu_ffu_fpop1_d, ifu_ffu_fpop2_d, ifu_ffu_visop_d}), .clk(clk),
|
| 674 |
|
|
.q({fpop1_e, fpop2_e, visop_e}), .se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 675 |
95 |
fafa1971 |
assign fpop1_next = (any_op_e | reset)? fpop1_e: fpop1;
|
| 676 |
|
|
assign fpop2_next = (any_op_e | reset)? fpop2_e: fpop2;
|
| 677 |
|
|
assign visop_next = (any_op_e | reset)? visop_e: visop;
|
| 678 |
113 |
albert.wat |
dff_s #(3) fpop_dff(.din({fpop1_next,fpop2_next,visop_next}),
|
| 679 |
95 |
fafa1971 |
.q({fpop1,fpop2,visop}),
|
| 680 |
113 |
albert.wat |
.clk(clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 681 |
95 |
fafa1971 |
|
| 682 |
|
|
assign fpop_size_0 = ~opf[1] & ~opf[0];
|
| 683 |
|
|
assign fpop_size_1 = ~opf[1] & opf[0];
|
| 684 |
|
|
|
| 685 |
|
|
assign fpop_low_1 = ~opf[3] & ~opf[2] & ~opf[1] & opf[0];
|
| 686 |
|
|
assign fpop_low_2 = ~opf[3] & ~opf[2] & opf[1] & ~opf[0];
|
| 687 |
|
|
assign fpop_low_4 = ~opf[3] & opf[2] & ~opf[1] & ~opf[0];
|
| 688 |
|
|
assign fpop_low_5 = ~opf[3] & opf[2] & ~opf[1] & opf[0];
|
| 689 |
|
|
assign fpop_low_6 = ~opf[3] & opf[2] & opf[1] & ~opf[0];
|
| 690 |
|
|
assign fpop_low_8 = opf[3] & ~opf[2] & ~opf[1] & ~opf[0];
|
| 691 |
|
|
assign fpop_low_9 = opf[3] & ~opf[2] & ~opf[1] & opf[0];
|
| 692 |
|
|
assign fpop_low_a = opf[3] & ~opf[2] & opf[1] & ~opf[0];
|
| 693 |
|
|
assign fpop_low_d = opf[3] & opf[2] & ~opf[1] & opf[0];
|
| 694 |
|
|
assign fpop_low_e = opf[3] & opf[2] & opf[1] & ~opf[0];
|
| 695 |
|
|
|
| 696 |
|
|
assign fpop_high_0 = ~opf[8] & ~opf[7] & ~opf[6] & ~opf[5] & ~opf[4];
|
| 697 |
|
|
assign fpop_high_2 = ~opf[8] & ~opf[7] & ~opf[6] & opf[5] & ~opf[4];
|
| 698 |
|
|
assign fpop_high_4 = ~opf[8] & ~opf[7] & opf[6] & ~opf[5] & ~opf[4];
|
| 699 |
|
|
assign fpop_high_5 = ~opf[8] & ~opf[7] & opf[6] & ~opf[5] & opf[4];
|
| 700 |
|
|
assign fpop_high_6 = ~opf[8] & ~opf[7] & opf[6] & opf[5] & ~opf[4];
|
| 701 |
|
|
assign fpop_high_a = ~opf[8] & opf[7] & ~opf[6] & opf[5] & ~opf[4];
|
| 702 |
|
|
assign fpop_high_8 = ~opf[8] & opf[7] & ~opf[6] & ~opf[5] & ~opf[4];
|
| 703 |
|
|
assign fpop_high_c = ~opf[8] & opf[7] & opf[6] & ~opf[5] & ~opf[4];
|
| 704 |
|
|
assign fpop_high_d = ~opf[8] & opf[7] & opf[6] & ~opf[5] & opf[4];
|
| 705 |
|
|
assign fpop_high_e = ~opf[8] & opf[7] & opf[6] & opf[5] & ~opf[4];
|
| 706 |
|
|
assign fpop_high_10 = opf[8] & ~opf[7] & ~opf[6] & ~opf[5] & ~opf[4];
|
| 707 |
|
|
assign fpop_high_18 = opf[8] & opf[7] & ~opf[6] & ~opf[5] & ~opf[4];
|
| 708 |
|
|
|
| 709 |
|
|
assign unimpl_op_e = ~((fpop_low_1 | fpop_low_2) & (fpop_high_0 | fpop_high_4 | fpop_high_8 |
|
| 710 |
|
|
fpop1_e & fpop_high_d |
|
| 711 |
|
|
fpop2_e & (fpop_high_5 | fpop_high_c |
|
| 712 |
|
|
fpop_high_10 | fpop_high_18)) |
|
| 713 |
|
|
(fpop_low_4 | fpop_low_8) & fpop1_e & (fpop_high_8 | fpop_high_c) |
|
| 714 |
|
|
(fpop_low_5 | fpop_low_6) & (fpop_high_4 |
|
| 715 |
|
|
fpop1_e & fpop_high_0 |
|
| 716 |
|
|
fpop2_e & (fpop_high_2 | fpop_high_5 |
|
| 717 |
|
|
fpop_high_6 | fpop_high_a |
|
| 718 |
|
|
fpop_high_c | fpop_high_e)) |
|
| 719 |
|
|
fpop_low_6 & fpop1_e & fpop_high_c |
|
| 720 |
|
|
fpop_low_9 & fpop1_e & (fpop_high_0 | fpop_high_4 | fpop_high_6 |
|
| 721 |
|
|
fpop_high_c) |
|
| 722 |
|
|
fpop_low_a & fpop1_e & (fpop_high_0 | fpop_high_4) |
|
| 723 |
|
|
(fpop_low_d | fpop_low_e) & fpop1_e & fpop_high_4) & (fpop1_e | fpop2_e);
|
| 724 |
|
|
assign illegal_field_e = fpop2_e & (fpop_high_5 & |rd_e[4:2] |// bits 29:27 must be zero on fcmp
|
| 725 |
|
|
~opf[4] & ~opf[2] & rs1_e[4]);// bit 18 must be zero on fmovcc
|
| 726 |
|
|
|
| 727 |
|
|
|
| 728 |
|
|
assign convert_op_e = fpop1_e & opf[7];
|
| 729 |
|
|
assign illegal_rs1_e = (frs1_e[4:0] != 5'b00000) & (move_e & ~rollback_c3 | convert_op_e);
|
| 730 |
|
|
|
| 731 |
|
|
//
|
| 732 |
|
|
// Decode size of source and destination. don't care for unimplemented ops
|
| 733 |
|
|
//
|
| 734 |
|
|
assign source_single_e = (fpop_high_c & fpop_size_0) | //32b int
|
| 735 |
|
|
(opf[0]);// single (also quad but those are illegal
|
| 736 |
|
|
|
| 737 |
|
|
/* -----\/----- EXCLUDED -----\/-----
|
| 738 |
|
|
assign convert_op = (ifu_ffu_fpopcode_d[7] |fpop_high_6_d) & ifu_ffu_fpop1_d;
|
| 739 |
|
|
assign dest_single_d = (is_fpop_d)? (fpop_size_1_d & ~convert_op) | // sgl and not conv
|
| 740 |
|
|
(ifu_ffu_fpop1_d & ifu_ffu_fpopcode_d[7] & ~ifu_ffu_fpopcode_d[3] &
|
| 741 |
|
|
(~fpop_high_8_d | ifu_ffu_fpopcode_d[2])) |// int to s or float to short int
|
| 742 |
|
|
(ifu_ffu_visop_d & ifu_ffu_fpopcode_d[0]) :// vis single
|
| 743 |
|
|
ifu_ffu_ldst_single_d;
|
| 744 |
|
|
-----/\----- EXCLUDED -----/\----- */
|
| 745 |
|
|
assign dest_single_e = (fpop1_e & (~opf[1] & opf[0] & ~(opf[7] |fpop_high_6) | // sgl and not conv
|
| 746 |
|
|
opf[7] & ~opf[3] &
|
| 747 |
|
|
(~fpop_high_8 | opf[2])) |// int to s or float to short int
|
| 748 |
|
|
fpop2_e & fpop_size_1 |
|
| 749 |
|
|
visop_e & opf[0] | // vis single
|
| 750 |
|
|
(fst_e | fld_e) & ldst_single_e);
|
| 751 |
|
|
|
| 752 |
|
|
assign unimpl_op_all_e = (unimpl_op_e | ifu_ffu_quad_op_e |
|
| 753 |
|
|
illegal_rs1_e | illegal_field_e);
|
| 754 |
|
|
|
| 755 |
113 |
albert.wat |
dff_s #1 qopm_ff(.din (unimpl_op_all_e),
|
| 756 |
95 |
fafa1971 |
.q (unimpl_op_m),
|
| 757 |
113 |
albert.wat |
.clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 758 |
95 |
fafa1971 |
|
| 759 |
113 |
albert.wat |
dff_s #1 qopw_ff(.din (unimpl_op_m),
|
| 760 |
95 |
fafa1971 |
.q (unimpl_op_w),
|
| 761 |
113 |
albert.wat |
.clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 762 |
95 |
fafa1971 |
assign unimpl_qual_w = unimpl_op_w & ~kill_unimpl_w;
|
| 763 |
|
|
assign unimpl_qual_w2 = unimpl_op_w2 & ~flush_w2;
|
| 764 |
|
|
|
| 765 |
113 |
albert.wat |
dff_s #1 qopw2_ff(.din (unimpl_qual_w),
|
| 766 |
95 |
fafa1971 |
.q (unimpl_op_w2),
|
| 767 |
113 |
albert.wat |
.clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 768 |
95 |
fafa1971 |
|
| 769 |
|
|
|
| 770 |
|
|
// Decode register encoding (bit[5] wrapped to bit[0] for non singles)
|
| 771 |
|
|
// Also the storage is flopped around so odd regs are at even addresses
|
| 772 |
|
|
// in the regfile for singles. this helps because everything external
|
| 773 |
|
|
// expects data to be [63:0] not [31:0, 63:32] on doubles.
|
| 774 |
|
|
|
| 775 |
|
|
assign rs1_e[5] = frs1_e[0] & ~source_single_e;// zero for singles
|
| 776 |
|
|
assign rs1_e[4:2] = frs1_e[4:2];
|
| 777 |
|
|
assign rs1_e[1] = frs1_e[1];
|
| 778 |
|
|
assign rs1_e[0] = frs1_e[0] & source_single_e;// only nonzro for sgl
|
| 779 |
|
|
|
| 780 |
|
|
assign rs2_e[5] = frs2_e[0] & ~source_single_e;// zero for singles
|
| 781 |
|
|
assign rs2_e[4:2] = frs2_e[4:2];
|
| 782 |
|
|
assign rs2_e[1] = frs2_e[1];
|
| 783 |
|
|
assign rs2_e[0] = frs2_e[0] & source_single_e;// only nonzro for sgl
|
| 784 |
|
|
|
| 785 |
|
|
assign rd_e[5] = frd_e[0] & ~dest_single_e;// zero for singles
|
| 786 |
|
|
assign rd_e[4:2] = frd_e[4:2];
|
| 787 |
|
|
assign rd_e[1] = frd_e[1];
|
| 788 |
|
|
assign rd_e[0] = frd_e[0] & dest_single_e;// only nonzro for sgl
|
| 789 |
|
|
|
| 790 |
|
|
|
| 791 |
|
|
// Decode general type of operation
|
| 792 |
|
|
assign is_fpop_d = ifu_ffu_fpop1_d | ifu_ffu_fpop2_d | ifu_ffu_visop_d;
|
| 793 |
|
|
|
| 794 |
|
|
// Do locally
|
| 795 |
|
|
assign move_e = fpop_high_0 & (fpop1_e | (fpop1 & rollback_c3)) |
|
| 796 |
|
|
(rollback_c3 & fpop2 & ~opf[4]);// rollback cond_move
|
| 797 |
|
|
// cond moves don't get rollback because they either don't happen or become unconditional
|
| 798 |
|
|
assign cond_move_e = fpop2_e & ~opf[4];
|
| 799 |
|
|
|
| 800 |
|
|
assign abs_w = move_w & fpop_high_0 & opf[3];
|
| 801 |
|
|
assign neg_w = move_w & fpop_high_0 & opf[2];
|
| 802 |
|
|
|
| 803 |
|
|
// Send to FPU
|
| 804 |
|
|
assign fpu_op_e = ((~fpop_high_0 & fpop1_next) | (fpop_high_5 & fpop2_next)) & (any_op_e | rollback_c3);
|
| 805 |
|
|
|
| 806 |
|
|
// FRF read indication
|
| 807 |
|
|
assign ren_rs2_e = (fpop1_e | fpop2_e | visop_e) | rollback_c3;
|
| 808 |
|
|
assign ren_rs2_e_vld = ren_rs2_e & ~vis_nofrf_e;
|
| 809 |
|
|
assign ren_rs2_m_vld = ren_rs2_m & (cond_move_m & ifu_ffu_mvcnd_m | ~cond_move_m);
|
| 810 |
|
|
assign ren_rs1_e = ((~vis_nofrf_e & visop_e) | // all vis except siam read rs1
|
| 811 |
|
|
(rollback_c3 & visop) |
|
| 812 |
|
|
((fpop2_next & opf[4]) | //FCMP
|
| 813 |
|
|
(fpop1_next & ~opf[7] & opf[6])) & // add,sub,mul,div
|
| 814 |
|
|
(any_op_e | rollback_c3 & ~reset));
|
| 815 |
|
|
assign ren_rs1_w_vld = ren_rs1_w & ~kill_eccchk_w;
|
| 816 |
|
|
assign ren_rs1_w2_vld = ren_rs1_w2 & ~flush_w2;
|
| 817 |
|
|
|
| 818 |
|
|
//------------------------------------
|
| 819 |
|
|
// Store and wait for FPop to complete
|
| 820 |
|
|
//------------------------------------
|
| 821 |
|
|
// Storage of control signals
|
| 822 |
|
|
|
| 823 |
|
|
// >>>>> added ~kill_fp
|
| 824 |
|
|
// set these in e so that kill_fp doesn't kill spuriously
|
| 825 |
|
|
assign load_pending_next = fld_e | // set
|
| 826 |
|
|
(load_pending & ~lsu_ffu_ld_vld & ~kill_fp & ~blk_ld_m);
|
| 827 |
|
|
assign fld_done = lsu_ffu_ld_vld & ~kill_fp & load_pending;
|
| 828 |
113 |
albert.wat |
dffr_s ldpend_dff(.din (load_pending_next),
|
| 829 |
95 |
fafa1971 |
.q (load_pending),
|
| 830 |
|
|
.clk (clk),
|
| 831 |
|
|
.rst (reset),
|
| 832 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 833 |
95 |
fafa1971 |
|
| 834 |
|
|
assign blk_ld_m = fld_m & blk_asi_m;
|
| 835 |
|
|
assign blk_ld_done = lsu_ffu_ld_vld & ~kill_fp & (bld_cnt_d1[2:0] == 3'b111) & blk_load_pending;
|
| 836 |
|
|
assign blk_load_pending_next = (blk_ld_m & ~kill_m) | // set
|
| 837 |
|
|
(blk_load_pending & ~kill_fp & ~ffu_ifu_fpop_done_w2);
|
| 838 |
113 |
albert.wat |
dffr_s blk_ldpend_dff(.din(blk_load_pending_next),
|
| 839 |
95 |
fafa1971 |
.q(blk_load_pending),
|
| 840 |
|
|
.clk(clk),
|
| 841 |
|
|
.rst(reset),
|
| 842 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 843 |
95 |
fafa1971 |
|
| 844 |
|
|
assign fp_pending_next = fpu_op_e | // set
|
| 845 |
|
|
(fp_pending & ~is_fpu_result & ~kill_fp);
|
| 846 |
113 |
albert.wat |
dffr_s fppend_dff(.din(fp_pending_next),
|
| 847 |
95 |
fafa1971 |
.q(fp_pending),
|
| 848 |
|
|
.clk(clk),
|
| 849 |
|
|
.rst (reset),
|
| 850 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 851 |
95 |
fafa1971 |
|
| 852 |
|
|
// rs1
|
| 853 |
113 |
albert.wat |
dff_s #(5) rs1_d2e(.din(ifu_ffu_frs1_d[4:0]), .clk(clk), .q(frs1_e[4:0]), .se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 854 |
95 |
fafa1971 |
mux2ds #(6) rs1_mux(.dout (rs1_next[5:0]),
|
| 855 |
|
|
.in0 (rs1[5:0]),
|
| 856 |
|
|
.in1 (rs1_e[5:0]),
|
| 857 |
|
|
.sel0 (~any_op_e),
|
| 858 |
|
|
.sel1 (any_op_e));
|
| 859 |
113 |
albert.wat |
dff_s #(6) rs1_dff(.din(rs1_next[5:0]),
|
| 860 |
95 |
fafa1971 |
.clk(clk),
|
| 861 |
|
|
.q(rs1[5:0]),
|
| 862 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 863 |
95 |
fafa1971 |
// rs2
|
| 864 |
113 |
albert.wat |
dff_s #(5) rs2_d2e(.din(ifu_ffu_frs2_d[4:0]), .clk(clk), .q(frs2_e[4:0]), .se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 865 |
95 |
fafa1971 |
mux2ds #(6) rs2_mux(.dout(rs2_next[5:0]),
|
| 866 |
|
|
.in0 (rs2[5:0]),
|
| 867 |
|
|
.in1 (rs2_e[5:0]),
|
| 868 |
|
|
.sel0(~any_op_e),
|
| 869 |
|
|
.sel1 (any_op_e));
|
| 870 |
113 |
albert.wat |
dff_s #(6) rs2_dff(.din (rs2_next[5:0]),
|
| 871 |
95 |
fafa1971 |
.clk (clk),
|
| 872 |
|
|
.q (rs2[5:0]),
|
| 873 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 874 |
95 |
fafa1971 |
// rd
|
| 875 |
113 |
albert.wat |
dff_s #(6) rd_d2e(.din({ifu_ffu_ldst_single_d,ifu_ffu_frd_d[4:0]}), .clk(clk),
|
| 876 |
95 |
fafa1971 |
.q({ldst_single_e,frd_e[4:0]}),
|
| 877 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 878 |
95 |
fafa1971 |
mux2ds #(6) rd_mux(.dout (rd_next[5:0]),
|
| 879 |
|
|
.in0 (rd[5:0]),
|
| 880 |
|
|
.in1 (rd_e[5:0]),
|
| 881 |
|
|
.sel0 (~any_op_e),
|
| 882 |
|
|
.sel1 (any_op_e));
|
| 883 |
113 |
albert.wat |
dff_s #(6) rd_dff(.din (rd_next[5:0]),
|
| 884 |
95 |
fafa1971 |
.clk (clk),
|
| 885 |
|
|
.q (rd[5:0]),
|
| 886 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so());
|
| 887 |
95 |
fafa1971 |
// rs size
|
| 888 |
|
|
mux2ds source_single_mux(.dout (source_single_next),
|
| 889 |
|
|
.in0 (source_single),
|
| 890 |
|
|
.in1 (source_single_e),
|
| 891 |
|
|
.sel0(~any_op_e),
|
| 892 |
|
|
.sel1 (any_op_e));
|
| 893 |
113 |
albert.wat |
dff_s source_single_dff(.din(source_single_next),
|
| 894 |
95 |
fafa1971 |
.clk(clk),
|
| 895 |
|
|
.q(source_single),
|
| 896 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 897 |
95 |
fafa1971 |
// rd size
|
| 898 |
|
|
assign dest_single_next = (any_op_e)? dest_single_e: dest_single;
|
| 899 |
113 |
albert.wat |
dff_s dest_single_dff(.din (dest_single_next),
|
| 900 |
95 |
fafa1971 |
.clk (clk),
|
| 901 |
|
|
.q (dest_single),
|
| 902 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so());
|
| 903 |
95 |
fafa1971 |
// thread
|
| 904 |
|
|
mux2ds #(2) tid_mux(.dout (tid_next[1:0]),
|
| 905 |
|
|
.in0 (tid[1:0]),
|
| 906 |
|
|
.in1 (tid_e[1:0]),
|
| 907 |
|
|
.sel0 (~any_op_e),
|
| 908 |
|
|
.sel1 (any_op_e));
|
| 909 |
113 |
albert.wat |
dff_s #(2) tid_dff(.din(tid_next[1:0]),
|
| 910 |
95 |
fafa1971 |
.clk(clk),
|
| 911 |
|
|
.q(tid[1:0]),
|
| 912 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 913 |
95 |
fafa1971 |
// extra tid to help fanout for critical signals
|
| 914 |
113 |
albert.wat |
dff_s #(2) extra_tid_dff(.din(tid_next[1:0]),
|
| 915 |
|
|
.clk(clk), .q(extra_tid[1:0]), .se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 916 |
95 |
fafa1971 |
// fcc num
|
| 917 |
|
|
mux2ds #(2) fcc_mux(.dout (fcc_num_next[1:0]),
|
| 918 |
|
|
.in0 (fcc_num[1:0]),
|
| 919 |
|
|
.in1 (ifu_ffu_fcc_num_d[1:0]),
|
| 920 |
|
|
.sel0 (~is_fpop_d),
|
| 921 |
|
|
.sel1 (is_fpop_d));
|
| 922 |
113 |
albert.wat |
dff_s #(2) fcc_dff(.din (fcc_num_next[1:0]),
|
| 923 |
95 |
fafa1971 |
.clk (clk),
|
| 924 |
|
|
.q (fcc_num[1:0]),
|
| 925 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so());
|
| 926 |
95 |
fafa1971 |
|
| 927 |
|
|
// ldfsr
|
| 928 |
|
|
mux2ds #(2) ldfsr_mux(.dout (ldfsr_next[1:0]),
|
| 929 |
|
|
.in0 ({ldfsr, ldxfsr}),
|
| 930 |
|
|
.in1 ({ifu_ffu_ldfsr_d, ifu_ffu_ldxfsr_d}),
|
| 931 |
|
|
.sel0 (~ifu_ffu_fld_d),
|
| 932 |
|
|
.sel1 (ifu_ffu_fld_d));
|
| 933 |
113 |
albert.wat |
dff_s #(2) ldfsr_dff(.din (ldfsr_next[1:0]),
|
| 934 |
95 |
fafa1971 |
.clk (clk),
|
| 935 |
|
|
.q ({ldfsr, ldxfsr}),
|
| 936 |
113 |
albert.wat |
.se (se), `SIMPLY_RISC_SCANIN, .so());
|
| 937 |
95 |
fafa1971 |
|
| 938 |
|
|
// op code
|
| 939 |
|
|
mux2ds #(9) opf_mux(.dout (opf_next[8:0]),
|
| 940 |
|
|
.in0 (opf[8:0]),
|
| 941 |
|
|
.in1 (ifu_ffu_fpopcode_d[8:0]),
|
| 942 |
|
|
.sel0 (~is_fpop_d),
|
| 943 |
|
|
.sel1 (is_fpop_d));
|
| 944 |
113 |
albert.wat |
dff_s #(9) opf_dff(.din(opf_next[8:0]),
|
| 945 |
95 |
fafa1971 |
.clk(clk),
|
| 946 |
|
|
.q(opf[8:0]),
|
| 947 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 948 |
95 |
fafa1971 |
//----------
|
| 949 |
|
|
// FP Pipe
|
| 950 |
|
|
//----------
|
| 951 |
113 |
albert.wat |
dff_s fop_e2m(.din(any_op_e), .clk(clk),
|
| 952 |
95 |
fafa1971 |
.q(any_op_m),
|
| 953 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 954 |
95 |
fafa1971 |
|
| 955 |
113 |
albert.wat |
dff_s fop_m2w(.din(any_op_m_valid), .clk(clk),
|
| 956 |
95 |
fafa1971 |
.q(any_op_w),
|
| 957 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 958 |
|
|
dff_s fop_w2w2(.din(any_op_w), .clk(clk),
|
| 959 |
95 |
fafa1971 |
.q(any_op_w2),
|
| 960 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 961 |
95 |
fafa1971 |
|
| 962 |
113 |
albert.wat |
dff_s fst_d2e(.din(ifu_ffu_fst_d), .clk(clk),
|
| 963 |
95 |
fafa1971 |
.q (fst_e),
|
| 964 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 965 |
|
|
dff_s fst_e2m(.din(fst_e), .clk(clk),
|
| 966 |
95 |
fafa1971 |
.q (fst_m),
|
| 967 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 968 |
|
|
dff_s fst_m2w(.din(fst_m), .clk(clk),
|
| 969 |
95 |
fafa1971 |
.q (fst_w),
|
| 970 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 971 |
|
|
dff_s fld_d2e(.din(ifu_ffu_fld_d), .clk(clk),
|
| 972 |
95 |
fafa1971 |
.q (fld_e),
|
| 973 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 974 |
|
|
dff_s fld_e2m(.din(fld_e), .clk(clk),
|
| 975 |
95 |
fafa1971 |
.q (fld_m),
|
| 976 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 977 |
95 |
fafa1971 |
|
| 978 |
113 |
albert.wat |
dff_s ren_rs2_e2m(.din(ren_rs2_e_vld), .clk(clk),
|
| 979 |
95 |
fafa1971 |
.q(ren_rs2_m),
|
| 980 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 981 |
|
|
dff_s ren_rs2_m2w(.din(ren_rs2_m_vld), .clk(clk),
|
| 982 |
95 |
fafa1971 |
.q(ren_rs2_w),
|
| 983 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 984 |
|
|
dff_s ren_rs2_w2w2(.din(ren_rs2_w), .clk(clk),
|
| 985 |
95 |
fafa1971 |
.q(ren_rs2_w2),
|
| 986 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 987 |
|
|
dff_s ren_rs2_w22w3(.din(ren_rs2_w2), .clk(clk),
|
| 988 |
95 |
fafa1971 |
.q(ren_rs2_w3),
|
| 989 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 990 |
|
|
dff_s ren_rs2_w32w4(.din(ren_rs2_w3), .clk(clk),
|
| 991 |
95 |
fafa1971 |
.q(ren_rs2_w4),
|
| 992 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 993 |
95 |
fafa1971 |
|
| 994 |
113 |
albert.wat |
dff_s ren_rs1_e2m(.din(ren_rs1_e), .clk(clk),
|
| 995 |
95 |
fafa1971 |
.q(ren_rs1_m),
|
| 996 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 997 |
|
|
dff_s ren_rs1_m2w(.din(ren_rs1_m), .clk(clk),
|
| 998 |
95 |
fafa1971 |
.q(ren_rs1_w),
|
| 999 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1000 |
|
|
dff_s ren_rs1_w2w2(.din(ren_rs1_w_vld), .clk(clk),
|
| 1001 |
95 |
fafa1971 |
.q(ren_rs1_w2),
|
| 1002 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1003 |
|
|
dff_s ren_rs1_w22w3(.din(ren_rs1_w2_vld), .clk(clk),
|
| 1004 |
95 |
fafa1971 |
.q(ren_rs1_w3),
|
| 1005 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1006 |
|
|
dff_s ren_rs1_w32w4(.din(ren_rs1_w3), .clk(clk),
|
| 1007 |
95 |
fafa1971 |
.q(ren_rs1_w4),
|
| 1008 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1009 |
|
|
dff_s ren_rs1_w42w5(.din(ren_rs1_w4), .clk(clk),
|
| 1010 |
95 |
fafa1971 |
.q(ren_rs1_w5),
|
| 1011 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1012 |
95 |
fafa1971 |
|
| 1013 |
113 |
albert.wat |
dff_s cond_move_e2m(.din(cond_move_e), .clk(clk),
|
| 1014 |
95 |
fafa1971 |
.q(cond_move_m),
|
| 1015 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1016 |
95 |
fafa1971 |
|
| 1017 |
113 |
albert.wat |
dff_s move_e2m(.din(move_e), .clk(clk),
|
| 1018 |
95 |
fafa1971 |
.q(move_m),
|
| 1019 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1020 |
|
|
dff_s move_m2w(.din(move_m_valid), .clk(clk),
|
| 1021 |
95 |
fafa1971 |
.q(move_w),
|
| 1022 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1023 |
|
|
dff_s move_wen_m2w(.din(move_wen_m), .clk(clk), .q(move_wen_w),
|
| 1024 |
|
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1025 |
|
|
dff_s move_wen_w2w2(.din(move_wen_w), .clk(clk), .q(move_wen_w2),
|
| 1026 |
|
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1027 |
|
|
dff_s move_wdff(.din(move_w_valid), .clk(clk), .q(move_w2), .se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1028 |
95 |
fafa1971 |
|
| 1029 |
113 |
albert.wat |
dff_s stfsr_d2e(.din(ifu_ffu_stfsr_d),
|
| 1030 |
95 |
fafa1971 |
.q(stfsr_e),
|
| 1031 |
|
|
.clk(clk),
|
| 1032 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1033 |
95 |
fafa1971 |
|
| 1034 |
113 |
albert.wat |
dff_s fpu_op_e2m(.din(fpu_op_e), .clk(clk),
|
| 1035 |
95 |
fafa1971 |
.q(fpu_op_m),
|
| 1036 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1037 |
|
|
dff_s fpu_op_m2w(.din(fpu_op_m), .clk(clk),
|
| 1038 |
95 |
fafa1971 |
.q(fpu_op_w),
|
| 1039 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1040 |
|
|
dff_s fpu_op_w2w2(.din(fpu_op_w_vld), .clk(clk),
|
| 1041 |
95 |
fafa1971 |
.q(fpu_op_w2),
|
| 1042 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1043 |
|
|
dff_s fpu_op_w22w3(.din(fpu_op_w2_vld), .clk(clk),
|
| 1044 |
95 |
fafa1971 |
.q(fpu_op_w3),
|
| 1045 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1046 |
95 |
fafa1971 |
|
| 1047 |
113 |
albert.wat |
dff_s #(2) tid_d2e(.din(ifu_ffu_tid_d[1:0]),
|
| 1048 |
95 |
fafa1971 |
.clk(clk),
|
| 1049 |
|
|
.q(tid_e[1:0]),
|
| 1050 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1051 |
95 |
fafa1971 |
|
| 1052 |
113 |
albert.wat |
dff_s #(2) tid_e2m(.din(tid_e[1:0]),
|
| 1053 |
95 |
fafa1971 |
.clk(clk),
|
| 1054 |
|
|
.q(tid_m[1:0]),
|
| 1055 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1056 |
95 |
fafa1971 |
|
| 1057 |
113 |
albert.wat |
dff_s #(2) tid_m2w(.din(tid_m[1:0]),
|
| 1058 |
95 |
fafa1971 |
.clk(clk),
|
| 1059 |
|
|
.q(tid_w[1:0]),
|
| 1060 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1061 |
95 |
fafa1971 |
|
| 1062 |
113 |
albert.wat |
dff_s #(2) tid_w2w2(.din(tid_w[1:0]),
|
| 1063 |
95 |
fafa1971 |
.clk(clk),
|
| 1064 |
|
|
.q(tid_w2[1:0]),
|
| 1065 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1066 |
95 |
fafa1971 |
|
| 1067 |
113 |
albert.wat |
dff_s dff_killed_w(.din(kill_m),
|
| 1068 |
95 |
fafa1971 |
.clk(clk),
|
| 1069 |
|
|
.q(killed_w),
|
| 1070 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1071 |
95 |
fafa1971 |
|
| 1072 |
113 |
albert.wat |
dff_s dff_flush_w2(.din(flush_w), .clk(clk), .q(flush_w2), .se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1073 |
95 |
fafa1971 |
|
| 1074 |
|
|
assign thr_match_mw2 = ~((tid_m[1] ^ tid_w2[1]) |
|
| 1075 |
|
|
(tid_m[0] ^ tid_w2[0]));
|
| 1076 |
|
|
assign thr_match_ww2 = ~((tid_w[1] ^ tid_w2[1]) |
|
| 1077 |
|
|
(tid_w[0] ^ tid_w2[0]));
|
| 1078 |
|
|
|
| 1079 |
|
|
assign thr_match_fpw2 = ~((tid[1] ^ tid_w2[1]) |
|
| 1080 |
|
|
(tid[0] ^ tid_w2[0]));
|
| 1081 |
|
|
|
| 1082 |
|
|
// new fpops squash previous ones (only possible in m or w, but w will also have ifu_tlu_flush_w)
|
| 1083 |
|
|
// all kill_w signals do not include lsu_ffu_flush_pipe_w. This must be included at the final destination
|
| 1084 |
|
|
assign flush_w = (lsu_ffu_flush_pipe_w | ifu_tlu_flush_w) & ~rolled_back;
|
| 1085 |
|
|
assign any_op_e = fpop1_e | fpop2_e | fst_e | fld_e | visop_e;
|
| 1086 |
|
|
assign any_op_m_valid = any_op_m & ~any_op_e;
|
| 1087 |
|
|
assign kill_m = (thr_match_mw2 & flush_w2) | any_op_e;
|
| 1088 |
|
|
assign kill_eccchk_w = (~ifu_tlu_inst_vld_w | killed_w | unimpl_op_w | any_op_e |
|
| 1089 |
|
|
(thr_match_ww2 & flush_w2)) & ~rolled_back;
|
| 1090 |
|
|
// unimplemented ops don't check rolled_back because they trap before rollback happens
|
| 1091 |
|
|
assign kill_unimpl_w = (~ifu_tlu_inst_vld_w | killed_w | any_op_e
|
| 1092 |
|
|
| (thr_match_ww2 & flush_w2));
|
| 1093 |
|
|
assign kill_w = (~ifu_tlu_inst_vld_w | killed_w | any_op_e |
|
| 1094 |
|
|
unimpl_op_w | ffu_lsu_kill_fst_w | (thr_match_ww2 & flush_w2)) & ~rolled_back;
|
| 1095 |
|
|
// this kills the "pending" signals that are set in the E stage.
|
| 1096 |
|
|
// Since they are set in E all the kills can be delayed by one cycle without
|
| 1097 |
|
|
// squashing a new, valid op
|
| 1098 |
|
|
assign kill_fp = (thr_match_fpw2 & flush_w2 | any_op_e |
|
| 1099 |
|
|
any_op_w & (~ifu_tlu_inst_vld_w | unimpl_op_w)) & ~rolled_back;
|
| 1100 |
|
|
|
| 1101 |
|
|
|
| 1102 |
|
|
//----------------------------
|
| 1103 |
|
|
// Control for muxes that manipulate data to/from FRF
|
| 1104 |
|
|
//----------------------------
|
| 1105 |
|
|
// implement fmov/fmovcc
|
| 1106 |
|
|
assign move_wen_m = move_m | (cond_move_m & ifu_ffu_mvcnd_m);
|
| 1107 |
|
|
assign move_wen_w2_valid = move_wen_w2 & move_w2_vld;
|
| 1108 |
|
|
assign move_m_valid = (move_m | cond_move_m);
|
| 1109 |
|
|
// used for updating fsr
|
| 1110 |
|
|
assign move_w_valid = move_w & ~kill_w;
|
| 1111 |
|
|
assign move_w2_vld = move_w2 & ~flush_w2 & ~rollback_rs2_w2 & ~(rs2_ue_w2 & nceen);
|
| 1112 |
|
|
|
| 1113 |
|
|
// negation or absolute value happen to rs2 in the m_stage if needed
|
| 1114 |
|
|
assign ctl_dp_sign[1] = (dp_ctl_rs2_sign[1] ^ neg_w) & ~abs_w;
|
| 1115 |
|
|
assign ctl_dp_sign[0] = (source_single) ?
|
| 1116 |
|
|
(dp_ctl_rs2_sign[0] ^ neg_w) & ~abs_w :
|
| 1117 |
|
|
dp_ctl_rs2_sign[0];
|
| 1118 |
|
|
|
| 1119 |
|
|
//
|
| 1120 |
|
|
// Shifts to align sgl precision 32b data
|
| 1121 |
|
|
//
|
| 1122 |
|
|
// mux for moving around single data from frf
|
| 1123 |
|
|
|
| 1124 |
|
|
// shift on moves or stores
|
| 1125 |
|
|
assign shift_frf_rs2_m = (rs2[0] ^ rd[0]) & (move_m | cond_move_m | visop_m) & ~fst_e;
|
| 1126 |
|
|
assign shift_frf_rs1_w = (rs1[0] ^ rd[0]) & visop_w_vld; //check for squash
|
| 1127 |
|
|
|
| 1128 |
|
|
assign shift_frf_right_next = (source_single & shift_frf_rs2_m & ~rs2[0]) |
|
| 1129 |
|
|
(source_single & shift_frf_rs1_w & ~rs1[0]) |
|
| 1130 |
|
|
(dest_single_e & fst_e & ~rd_e[0]);
|
| 1131 |
|
|
|
| 1132 |
|
|
assign shift_frf_left_next = ((source_single & rs2[0] & (shift_frf_rs2_m | fpu_op_m & ~fst_e) |
|
| 1133 |
|
|
source_single & rs1[0] & (shift_frf_rs1_w | fpu_op_w_vld))
|
| 1134 |
|
|
& ~shift_frf_right_next);
|
| 1135 |
|
|
|
| 1136 |
|
|
assign noshift64_frf_next = ~(shift_frf_right_next | shift_frf_left_next);
|
| 1137 |
|
|
|
| 1138 |
|
|
assign ctl_dp_shift_frf_right = shift_frf_right & ~rst_tri_en;
|
| 1139 |
|
|
assign ctl_dp_shift_frf_left = shift_frf_left & ~rst_tri_en;
|
| 1140 |
|
|
assign ctl_dp_noshift64_frf = noshift64_frf | rst_tri_en;
|
| 1141 |
|
|
|
| 1142 |
|
|
// fpu expects lower 32 bits to be zero on single operands
|
| 1143 |
|
|
assign zero_lower_data_next = ((source_single & ~rs1[0] & fpu_op_w_vld) |
|
| 1144 |
|
|
(source_single & ~rs2[0] & fpu_op_m));
|
| 1145 |
|
|
|
| 1146 |
113 |
albert.wat |
dff_s shift_frf_right_dff(.din(shift_frf_right_next), .clk(clk), .q(shift_frf_right),
|
| 1147 |
|
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1148 |
|
|
dff_s shift_frf_left_dff(.din(shift_frf_left_next), .clk(clk), .q(shift_frf_left),
|
| 1149 |
|
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1150 |
|
|
dff_s noshift64_dff(.din(noshift64_frf_next), .clk(clk), .q(noshift64_frf),
|
| 1151 |
|
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1152 |
|
|
dff_s noshift32_dff(.din(zero_lower_data_next), .clk(clk), .q(ctl_dp_zero_low32_frf),
|
| 1153 |
|
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1154 |
95 |
fafa1971 |
|
| 1155 |
|
|
wire flip_fpu;
|
| 1156 |
|
|
wire flip_lsu;
|
| 1157 |
|
|
// mux for rearranging data from fpu
|
| 1158 |
|
|
// data comes in with msb always at b63. This means that singles with an odd
|
| 1159 |
|
|
// rd must be flipped so that the data ends up in the correct
|
| 1160 |
|
|
// registers.
|
| 1161 |
|
|
assign flip_fpu = (dest_single & rd[0]);// single with odd rd
|
| 1162 |
|
|
|
| 1163 |
|
|
// mux for rearranging data from lsu
|
| 1164 |
|
|
// data comes in [63:0]. This means that singles with an even
|
| 1165 |
|
|
// rd must be flipped so that the data ends up in the correct
|
| 1166 |
|
|
// registers.
|
| 1167 |
|
|
assign flip_lsu = (dest_single & ~rd[0]);// single with even rd
|
| 1168 |
|
|
|
| 1169 |
|
|
assign ctl_dp_noflip_lsu = ld_ret & ~flip_lsu;
|
| 1170 |
|
|
assign ctl_dp_flip_lsu = ld_ret & flip_lsu;
|
| 1171 |
|
|
assign ctl_dp_noflip_fpu = ~ld_ret & ~flip_fpu & is_fpu_result & ~cpx_fcmp_d1;
|
| 1172 |
|
|
assign ctl_dp_flip_fpu = ~ld_ret & ~ctl_dp_noflip_fpu;
|
| 1173 |
|
|
|
| 1174 |
|
|
|
| 1175 |
|
|
//---------------------------------
|
| 1176 |
|
|
// LSU Interface
|
| 1177 |
|
|
//---------------------------------
|
| 1178 |
|
|
|
| 1179 |
|
|
// Note that stores fit into the standard pipeline so they are automatically
|
| 1180 |
|
|
// accepted and do not require an ACK. The lsu will check for kills in m and w.
|
| 1181 |
|
|
|
| 1182 |
|
|
assign store_ready = fst_m | bst_issue_c3;
|
| 1183 |
|
|
assign fpu_op_w_vld = fpu_op_w & ~kill_w;
|
| 1184 |
|
|
assign fpu_op_w2_vld = fpu_op_w2 & ~flush_w2 & ~ecc_kill_rs2_w2;
|
| 1185 |
|
|
assign fpu_op_w3_vld = fpu_op_w3 & ~ue_trap_w3 & ~rollback_rs1_w3;
|
| 1186 |
|
|
// don't qual with inst_vld since it takes too much time?
|
| 1187 |
|
|
// Resolved with Sanjay:
|
| 1188 |
|
|
// Will never receive ack in the same cycle req was first made
|
| 1189 |
|
|
assign fpop1_ready_w2_next = (fpu_op_w3_vld |
|
| 1190 |
|
|
(fpop1_ready_w2 & ~lsu_ffu_ack));
|
| 1191 |
|
|
|
| 1192 |
113 |
albert.wat |
dffr_s #1 fpop1_w2_dff(.din (fpop1_ready_w2_next),
|
| 1193 |
95 |
fafa1971 |
.q (fpop1_ready_w2),
|
| 1194 |
|
|
.rst (reset),
|
| 1195 |
113 |
albert.wat |
.clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1196 |
95 |
fafa1971 |
|
| 1197 |
|
|
// once op1 has been accepted, move to w2, and in the next cycle op2 is ready
|
| 1198 |
|
|
//
|
| 1199 |
|
|
// C1 -- recv ack, send op1 (fpop1_ready_w2)
|
| 1200 |
|
|
// C2 -- send op2 (fpop2_ready_w3)
|
| 1201 |
|
|
assign fpop2_ready_w3_next = fpop1_ready_w2 & lsu_ffu_ack;
|
| 1202 |
|
|
|
| 1203 |
113 |
albert.wat |
dff_s fpop2_w22w3(.din (fpop2_ready_w3_next),
|
| 1204 |
95 |
fafa1971 |
.q (fpop2_ready_w3),
|
| 1205 |
113 |
albert.wat |
.clk(clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1206 |
95 |
fafa1971 |
|
| 1207 |
|
|
|
| 1208 |
|
|
// request in W2 and wait till an ack is received
|
| 1209 |
|
|
// Will never receive ack in the same cycle req was first made
|
| 1210 |
|
|
assign ffu_lsu_fpop_rq_vld = fpu_op_w3_vld;
|
| 1211 |
|
|
|
| 1212 |
|
|
// valid pkt sent to lsu (after request)
|
| 1213 |
|
|
assign issue_fpop2 = fpop2_ready_w3 & ~opf[7];// not conversion op
|
| 1214 |
|
|
assign lsu_pkt_vld = fpop1_ready_w2 | fpu_op_w3_vld | issue_fpop2 | store_ready;
|
| 1215 |
|
|
|
| 1216 |
|
|
assign lsu_pkt_type[1:0] = {store_ready, fpop2_ready_w3};
|
| 1217 |
|
|
|
| 1218 |
|
|
// Create packet for LSU: ffu_lsu_data[80:0]
|
| 1219 |
|
|
// 80 = vld
|
| 1220 |
|
|
// 79:78 = type (00 = fpu operand 1, 01 = fpu operand 2, 10 = fp store)
|
| 1221 |
|
|
// 77:76 = tid
|
| 1222 |
|
|
// 75:68 = floating point opcode
|
| 1223 |
|
|
// 67:66 = fcc
|
| 1224 |
|
|
// 65:64 = rounding mode
|
| 1225 |
|
|
// 63:0 = data
|
| 1226 |
|
|
assign ffu_lsu_data[80:64] = {lsu_pkt_vld,
|
| 1227 |
|
|
lsu_pkt_type[1:0],
|
| 1228 |
|
|
extra_tid[1:0],
|
| 1229 |
|
|
opf[7:0],
|
| 1230 |
|
|
fcc_num[1:0],
|
| 1231 |
|
|
fpu_rnd[1:0]}; // rounding mode
|
| 1232 |
|
|
|
| 1233 |
|
|
// Select data to send to LSU. This is calculated one cycle early and flopped
|
| 1234 |
|
|
assign output_sel_rs1_next = fpop2_ready_w3_next & ~fst_e & ~bst_issue_c3_next; // rs2 is sent first (fpop1)
|
| 1235 |
|
|
assign output_sel_frf_next = fst_e & ~stfsr_e | bst_issue_c3_next; // store data
|
| 1236 |
|
|
assign output_sel_fsr_next = fst_e & stfsr_e & ~bst_issue_c3_next;
|
| 1237 |
|
|
assign output_sel_rs2_next = ~(fpop2_ready_w3_next | fst_e | bst_issue_c3_next);
|
| 1238 |
|
|
assign ctl_dp_output_sel_rs1 = output_sel_rs1 & ~rst_tri_en;
|
| 1239 |
|
|
assign ctl_dp_output_sel_frf = output_sel_frf & ~rst_tri_en;
|
| 1240 |
|
|
assign ctl_dp_output_sel_fsr = output_sel_fsr & ~rst_tri_en;
|
| 1241 |
|
|
assign ctl_dp_output_sel_rs2 = output_sel_rs2 | rst_tri_en;
|
| 1242 |
113 |
albert.wat |
dff_s #(4) output_sel_dff(.din({output_sel_rs1_next,output_sel_rs2_next,output_sel_frf_next,output_sel_fsr_next}),
|
| 1243 |
95 |
fafa1971 |
.q({output_sel_rs1,output_sel_rs2,output_sel_frf,output_sel_fsr}),
|
| 1244 |
113 |
albert.wat |
.clk(clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1245 |
95 |
fafa1971 |
|
| 1246 |
|
|
|
| 1247 |
113 |
albert.wat |
dff_s #1 sfsrw_ff(.din (ctl_dp_output_sel_fsr),
|
| 1248 |
95 |
fafa1971 |
.q (stfsr_w),
|
| 1249 |
113 |
albert.wat |
.clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1250 |
|
|
dff_s stfsr_wdff(.din(stfsr_qual_w), .clk(clk), .q(stfsr_w2), .se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1251 |
95 |
fafa1971 |
assign stfsr_qual_w = (stfsr_w & ~kill_w);
|
| 1252 |
|
|
assign stfsr_w2_vld = stfsr_w2 & ~flush_w2;
|
| 1253 |
|
|
|
| 1254 |
|
|
|
| 1255 |
|
|
//------------------------------------------------------
|
| 1256 |
|
|
// Block Stores
|
| 1257 |
|
|
//------------------------------------------------------
|
| 1258 |
|
|
// interface with lsu. bst packet issues in c3
|
| 1259 |
|
|
// check for stb_full so it doesn't confuse lsu. Don't have to count inflight packets
|
| 1260 |
|
|
// because none exist by bst_issue_c2
|
| 1261 |
|
|
assign ffu_lsu_blk_st_e = bst_issue_c2 & ~stb_full_c2;
|
| 1262 |
|
|
assign ffu_lsu_blk_st_va_e[5:3] = bst_cnt[2:0];
|
| 1263 |
|
|
assign bst_done = bst_issue_c4 & (bst_cnt[2:0] == 3'b111) & ~bst_ce_c4 & ~(bst_ue_c4 & nceen);
|
| 1264 |
|
|
|
| 1265 |
|
|
mux4ds stb_full_mux (.dout(stb_full_c2),
|
| 1266 |
|
|
.in0(stb_full0),
|
| 1267 |
|
|
.in1(stb_full1),
|
| 1268 |
|
|
.in2(stb_full2),
|
| 1269 |
|
|
.in3(stb_full3),
|
| 1270 |
|
|
.sel0(ctl_dp_fp_thr[0]),
|
| 1271 |
|
|
.sel1(ctl_dp_fp_thr[1]),
|
| 1272 |
|
|
.sel2(ctl_dp_fp_thr[2]),
|
| 1273 |
|
|
.sel3(ctl_dp_fp_thr[3]));
|
| 1274 |
|
|
|
| 1275 |
|
|
assign other_mem_op_e = exu_ffu_ist_e | ifu_tlu_flsh_inst_e | ifu_lsu_ld_inst_e;
|
| 1276 |
|
|
assign can_issue_bst_c2 = (~other_mem_op_e & ~stb_full_c2);
|
| 1277 |
|
|
assign bst_m = fst_m & blk_asi_m;
|
| 1278 |
|
|
|
| 1279 |
|
|
assign bst_rs[5:0] = {rd[5:4], bst_cnt[2:0], 1'b0};
|
| 1280 |
|
|
|
| 1281 |
|
|
// bst starts when bst hits w and is done when the 7th pckt has issued
|
| 1282 |
|
|
assign bst_issue_c1_next = ((bst_w & ~kill_w) |
|
| 1283 |
|
|
(bst_issue_c4 & ~(bst_cnt[2:0] == 3'b111) & ~bst_ce_c4 &
|
| 1284 |
|
|
~(bst_ue_c4 & nceen)) | bst_issue_c6);
|
| 1285 |
|
|
|
| 1286 |
|
|
// sotheas,9/14/04: fixed eco 6910, suppress block store start on dtlb perr
|
| 1287 |
|
|
// using registered version of lsu_ffu_st_dtlb_perr_g
|
| 1288 |
|
|
// WAS:
|
| 1289 |
|
|
// assign bst_issue_c2_next = ((bst_issue_c1 & ~(any_op_w2 & flush_w2)) | (bst_issue_c2 & ~can_issue_bst_c2)) & ~reset;
|
| 1290 |
|
|
// IS:
|
| 1291 |
113 |
albert.wat |
dff_s #1 st_dtlbperr_ff(.din (!lsu_ffu_st_dtlb_perr_g),
|
| 1292 |
95 |
fafa1971 |
.q (st_dtlb_perr_w2_l),
|
| 1293 |
113 |
albert.wat |
.clk (clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1294 |
95 |
fafa1971 |
assign bst_issue_c2_next = ((bst_issue_c1 & ~(any_op_w2 & flush_w2) & st_dtlb_perr_w2_l)
|
| 1295 |
|
|
| (bst_issue_c2 & ~can_issue_bst_c2)) & ~reset;
|
| 1296 |
|
|
assign bst_issue_c3_next = bst_issue_c2 & can_issue_bst_c2 & ~reset;
|
| 1297 |
|
|
assign bst_issue_c4_next = bst_issue_c3 & ~reset;
|
| 1298 |
|
|
assign bst_issue_c5_next = bst_issue_c4 & bst_ce_c4 & ~reset;
|
| 1299 |
|
|
assign bst_issue_c6_next = bst_issue_c5 & ~reset;
|
| 1300 |
|
|
|
| 1301 |
|
|
// bst keeps reading in both c1 and c2 in case it stalls in c2
|
| 1302 |
|
|
assign bst_read_req = bst_issue_c1 | bst_issue_c2;
|
| 1303 |
|
|
// counter resets to 1 when bst hits w, increments when one is issued to lsu without ce
|
| 1304 |
|
|
assign bst_cnt_next[2:0] = (bst_w? 3'b001:
|
| 1305 |
|
|
(bst_issue_c4 & ~bst_ce_c4)? (bst_cnt[2:0] + 3'b001):
|
| 1306 |
|
|
bst_cnt[2:0]);
|
| 1307 |
|
|
|
| 1308 |
|
|
///////////////////
|
| 1309 |
|
|
// bst starvation
|
| 1310 |
|
|
//----------------
|
| 1311 |
|
|
// when six bit counter saturates then a req to stall inst issue is made
|
| 1312 |
|
|
// The request stays high until a bst gets issued
|
| 1313 |
|
|
///////////////////
|
| 1314 |
|
|
assign ffu_ifu_stallreq = bst_stall_req;
|
| 1315 |
|
|
assign bst_stall_req_next = ((bst_stall_cnt[5:0] == 6'b111111) & bst_issue_c2 & ~can_issue_bst_c2 |
|
| 1316 |
|
|
bst_stall_req & other_mem_op_e);
|
| 1317 |
|
|
assign bst_stall_cnt_next[5:0] = (~bst_issue_c2)? 6'd0: bst_stall_cnt[5:0] + 6'd1;
|
| 1318 |
|
|
|
| 1319 |
|
|
/////////////////////
|
| 1320 |
|
|
// bst ecc control
|
| 1321 |
|
|
/////////////////////
|
| 1322 |
|
|
// if a ce occurs even after correction then it is converted to a ue
|
| 1323 |
|
|
assign bst_ue_c4 = bst_issue_c4 & (previous_ue | (fixed_bst_ce & |previous_ce[1:0]));
|
| 1324 |
|
|
assign bst_ce_c4 = bst_issue_c4 & |previous_ce[1:0] & ~fixed_bst_ce & ~previous_ue;
|
| 1325 |
|
|
assign fixed_bst_ce_next = bst_ce_c4 | (fixed_bst_ce & ~bst_issue_c4);
|
| 1326 |
|
|
|
| 1327 |
113 |
albert.wat |
dff_s #(4) stb_full_dff(.din({lsu_ffu_stb_full0,lsu_ffu_stb_full1,lsu_ffu_stb_full2,lsu_ffu_stb_full3}),
|
| 1328 |
95 |
fafa1971 |
.q({stb_full0, stb_full1, stb_full2, stb_full3}),
|
| 1329 |
113 |
albert.wat |
.clk(clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1330 |
|
|
dff_s blk_asi_dff(.din(lsu_ffu_blk_asi_e), .clk(clk), .q(blk_asi_m),
|
| 1331 |
|
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1332 |
|
|
dffr_s bst_fix_ce_dff(.din(fixed_bst_ce_next), .clk(clk), .q(fixed_bst_ce),
|
| 1333 |
|
|
.se(se), `SIMPLY_RISC_SCANIN, .so(), .rst(reset));
|
| 1334 |
|
|
dff_s #(3) bst_cnt_dff(.din(bst_cnt_next[2:0]), .clk(clk), .q(bst_cnt[2:0]),
|
| 1335 |
|
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1336 |
|
|
dff_s bst_m2w(.din(bst_m), .clk(clk), .q(bst_w), .se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1337 |
|
|
dff_s bst_issue_c1_dff(.din(bst_issue_c1_next), .clk(clk), .q(bst_issue_c1), .se(se),
|
| 1338 |
|
|
`SIMPLY_RISC_SCANIN, .so());
|
| 1339 |
|
|
dff_s bst_issue_c2_dff(.din(bst_issue_c2_next), .clk(clk), .q(bst_issue_c2), .se(se),
|
| 1340 |
|
|
`SIMPLY_RISC_SCANIN, .so());
|
| 1341 |
|
|
dff_s bst_issue_c3_dff(.din(bst_issue_c3_next), .clk(clk), .q(bst_issue_c3), .se(se),
|
| 1342 |
|
|
`SIMPLY_RISC_SCANIN, .so());
|
| 1343 |
|
|
dff_s bst_issue_c4_dff(.din(bst_issue_c4_next), .clk(clk), .q(bst_issue_c4), .se(se),
|
| 1344 |
|
|
`SIMPLY_RISC_SCANIN, .so());
|
| 1345 |
|
|
dff_s bst_issue_c5_dff(.din(bst_issue_c5_next), .clk(clk), .q(bst_issue_c5), .se(se),
|
| 1346 |
|
|
`SIMPLY_RISC_SCANIN, .so());
|
| 1347 |
|
|
dff_s bst_issue_c6_dff(.din(bst_issue_c6_next), .clk(clk), .q(bst_issue_c6), .se(se),
|
| 1348 |
|
|
`SIMPLY_RISC_SCANIN, .so());
|
| 1349 |
|
|
dff_s #(6) bst_stall_cntdff(.din(bst_stall_cnt_next[5:0]), .clk(clk), .q(bst_stall_cnt[5:0]),
|
| 1350 |
|
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1351 |
|
|
dffr_s bst_stall_reqdff(.din(bst_stall_req_next), .clk(clk), .q(bst_stall_req),
|
| 1352 |
|
|
.se(se), `SIMPLY_RISC_SCANIN, .so(), .rst(reset));
|
| 1353 |
95 |
fafa1971 |
|
| 1354 |
|
|
//----------------------------------------
|
| 1355 |
|
|
// Decode Returning FPU/LSU packets
|
| 1356 |
|
|
//----------------------------------------
|
| 1357 |
|
|
|
| 1358 |
|
|
// FPU result pulled off of cpx
|
| 1359 |
113 |
albert.wat |
assign is_fpu_result = (cpx_req_d1 == `FP_RET) ?
|
| 1360 |
95 |
fafa1971 |
cpx_vld_d1 & fp_pending : 1'b0;
|
| 1361 |
|
|
assign ld_ret = lsu_ffu_ld_vld & ~(thr_match_fpw2 & flush_w2) & (blk_load_pending | load_pending);
|
| 1362 |
|
|
|
| 1363 |
|
|
// select frf write data
|
| 1364 |
|
|
// don't write data on Fcompares
|
| 1365 |
|
|
assign ctl_dp_rs2_sel_fpu_lsu = is_fpu_result & ~cpx_fcmp_d1 | ld_ret;
|
| 1366 |
|
|
assign ctl_dp_rs2_sel_vis = vis_result & ~ctl_dp_rs2_sel_fpu_lsu;
|
| 1367 |
|
|
assign ctl_dp_rs2_frf_read = (ren_rs2_w | ctl_dp_rd_ecc) & ~ctl_dp_rs2_sel_fpu_lsu & ~vis_result;
|
| 1368 |
|
|
assign ctl_dp_rs2_keep_data = ~(ren_rs2_w | ctl_dp_rd_ecc | vis_result |
|
| 1369 |
|
|
ctl_dp_rs2_sel_fpu_lsu);
|
| 1370 |
|
|
|
| 1371 |
|
|
// selects for rs2 result mux
|
| 1372 |
|
|
assign ctl_dp_rd_ecc = fst_ce_w | rollback_rs2_w2 | bst_ce_c4 | rollback_rs1_w3;
|
| 1373 |
|
|
|
| 1374 |
|
|
// Selects for rs1 mux
|
| 1375 |
|
|
assign ctl_dp_new_rs1 = ren_rs1_w2;
|
| 1376 |
|
|
|
| 1377 |
|
|
//----------------------------------------
|
| 1378 |
|
|
// FRF Controls
|
| 1379 |
|
|
//----------------------------------------
|
| 1380 |
|
|
// WEN for frf from load, FPU result or mov
|
| 1381 |
|
|
assign external_wen_next = ld_ret & ~(ldfsr | ldxfsr) | (is_fpu_result & ~cpx_fcmp_d1 & ~take_ieee_trap);
|
| 1382 |
|
|
assign rf_ecc_gen_next = external_wen_next | vis_wen_next;
|
| 1383 |
|
|
|
| 1384 |
113 |
albert.wat |
dff_s rf_eccgen_dff(.din(rf_ecc_gen_next), .q(rf_ecc_gen), .clk(clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1385 |
|
|
dff_s rf_wen_dff(.din(rf_wen_next), .q(rf_wen), .clk(clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1386 |
95 |
fafa1971 |
// check for flush_pipe for moves
|
| 1387 |
|
|
assign rf_wen_next = rf_ecc_gen & ~(any_op_w2 & flush_w2) | move_wen_w2_valid;
|
| 1388 |
|
|
|
| 1389 |
|
|
|
| 1390 |
|
|
// REN and WEN must be mutually exclusive. This works because WEN is always after W
|
| 1391 |
|
|
// if a new fpop has arrived to cancel it.
|
| 1392 |
|
|
// The even register is the upper half, odd is the lower half
|
| 1393 |
|
|
assign ctl_frf_wen[1] = ((rf_wen & ~rd[0]) | ecc_wen[1]) & ~ctl_frf_ren; // double or even sgl
|
| 1394 |
|
|
assign ctl_frf_wen[0] = ((rf_wen & (~dest_single | rd[0])) | ecc_wen[0]) & ~ctl_frf_ren; // dbl or odd sgl
|
| 1395 |
|
|
|
| 1396 |
|
|
// REN for frf -- rd rs2 in D, rs1 in E
|
| 1397 |
|
|
assign read_rs2 = ren_rs2_e;
|
| 1398 |
|
|
assign read_rs1 = ren_rs1_m;
|
| 1399 |
|
|
assign read_rd = ifu_ffu_fst_d;
|
| 1400 |
|
|
assign read_bst = bst_read_req;
|
| 1401 |
|
|
// expanded out the terms for reading rs2 to help timing
|
| 1402 |
|
|
assign ctl_frf_ren = (read_rs1 | read_rs2 |
|
| 1403 |
|
|
ifu_ffu_fst_d | bst_read_req);
|
| 1404 |
|
|
|
| 1405 |
|
|
assign early_frf_rnum[5:1] = read_rs2? rs2_next[5:1]:
|
| 1406 |
|
|
read_rs1? rs1[5:1]:
|
| 1407 |
|
|
read_bst? bst_rs[5:1]:
|
| 1408 |
|
|
write_addr[5:1];
|
| 1409 |
|
|
assign st_rd_d[5:1] = {ifu_ffu_frd_d[0] & ~ifu_ffu_ldst_single_d, ifu_ffu_frd_d[4:1]};
|
| 1410 |
|
|
mux2ds #5 frf_rnum_mux(.dout(frf_rnum[5:1]),
|
| 1411 |
|
|
.in0(early_frf_rnum[5:1]),
|
| 1412 |
|
|
.in1(st_rd_d[5:1]),
|
| 1413 |
|
|
.sel0(~read_rd),
|
| 1414 |
|
|
.sel1(read_rd));
|
| 1415 |
|
|
|
| 1416 |
|
|
assign frf_tid[1:0] = (read_rd)? ifu_ffu_tid_d[1:0]: tid_next[1:0];
|
| 1417 |
|
|
|
| 1418 |
|
|
assign wen_rs2_ecc = |ecc_wen[1:0] & ren_rs2_w4;
|
| 1419 |
|
|
assign wen_rs1_ecc = |ecc_wen[1:0] & ren_rs1_w5;
|
| 1420 |
|
|
assign blk_rd[5:1] = rd[5:1] + {2'b0, bld_cnt_d3[2:0]};
|
| 1421 |
|
|
assign write_addr[5:1] = wen_rs2_ecc? rs2[5:1] :
|
| 1422 |
|
|
wen_rs1_ecc? rs1[5:1] :
|
| 1423 |
|
|
bst_issue_c6? bst_rs[5:1]:
|
| 1424 |
|
|
blk_load_pending? blk_rd[5:1]:
|
| 1425 |
|
|
rd[5:1];
|
| 1426 |
|
|
|
| 1427 |
|
|
// Address is combination of tid and rnum
|
| 1428 |
|
|
assign ctl_frf_addr[6:0] = {frf_tid[1:0], frf_rnum[5:1]};
|
| 1429 |
|
|
|
| 1430 |
|
|
//----------------------------------------
|
| 1431 |
|
|
// Data from FPU forwarded to IFU
|
| 1432 |
|
|
//----------------------------------------
|
| 1433 |
|
|
// Send thrid to IFU
|
| 1434 |
|
|
assign ffu_ifu_tid_w2[1:0] = tid;
|
| 1435 |
|
|
|
| 1436 |
|
|
// completion is always signalled after the w-stage so that flush_pipe, etc.
|
| 1437 |
|
|
// can be checked. For lds and fpops this is signalled after they write.
|
| 1438 |
|
|
// ecc_kill_rs2_w is checked for move and fst because the "compeletion"
|
| 1439 |
|
|
// is signalled over a separate interface so rollback can occur.
|
| 1440 |
|
|
// This is staged 2 cycles to allow for the cycle of ecc generation.
|
| 1441 |
|
|
//
|
| 1442 |
|
|
assign ffu_op_done_next = ((is_fpu_result & ~take_ieee_trap) | fld_done |
|
| 1443 |
|
|
blk_ld_done | bst_done | vis_result |
|
| 1444 |
|
|
fst_w & ~bst_w & ~kill_w);
|
| 1445 |
113 |
albert.wat |
dff_s ffu_op_done_dff(.din(ffu_op_done_next), .clk(clk), .q(ffu_op_done),
|
| 1446 |
|
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1447 |
95 |
fafa1971 |
// sotheas,9/14/04: fixed eco 6910, send done on dtlb perr for block store
|
| 1448 |
|
|
// using registered version of lsu_ffu_st_dtlb_perr_g
|
| 1449 |
|
|
// WAS:
|
| 1450 |
|
|
// assign ffu_op_done_vld = ffu_op_done & ~(any_op_w2 & flush_w2) | move_w2_vld;
|
| 1451 |
|
|
assign ffu_op_done_vld = (ffu_op_done | (bst_issue_c1 & !st_dtlb_perr_w2_l) )
|
| 1452 |
|
|
& ~(any_op_w2 & flush_w2) | move_w2_vld;
|
| 1453 |
113 |
albert.wat |
dff_s ffu_op_done2_dff(.din(ffu_op_done_vld), .clk(clk), .q(ffu_ifu_fpop_done_w2),
|
| 1454 |
|
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1455 |
95 |
fafa1971 |
|
| 1456 |
|
|
//------------------------------------------
|
| 1457 |
|
|
// FSR Controls
|
| 1458 |
|
|
//------------------------------------------
|
| 1459 |
|
|
|
| 1460 |
|
|
assign ctl_dp_fp_thr[0] = ~extra_tid[1] & ~extra_tid[0];
|
| 1461 |
|
|
assign ctl_dp_fp_thr[1] = ~extra_tid[1] & extra_tid[0];
|
| 1462 |
|
|
assign ctl_dp_fp_thr[2] = extra_tid[1] & ~extra_tid[0];
|
| 1463 |
|
|
assign ctl_dp_fp_thr[3] = extra_tid[1] & extra_tid[0];
|
| 1464 |
|
|
|
| 1465 |
|
|
// CC's
|
| 1466 |
|
|
assign fcc_num_dec[0] = ~fcc_num[1] & ~fcc_num[0];
|
| 1467 |
|
|
assign fcc_num_dec[1] = ~fcc_num[1] & fcc_num[0];
|
| 1468 |
|
|
assign fcc_num_dec[2] = fcc_num[1] & ~fcc_num[0];
|
| 1469 |
|
|
assign fcc_num_dec[3] = fcc_num[1] & fcc_num[0];
|
| 1470 |
|
|
|
| 1471 |
|
|
// selects to load next fsr from
|
| 1472 |
|
|
// stfsr or fmov always clear ftt
|
| 1473 |
|
|
assign clear_ftt = stfsr_w2_vld | move_w2_vld | is_fpu_result;
|
| 1474 |
|
|
|
| 1475 |
|
|
assign ctl_dp_fsr_sel_fpu[3:0] = ({4{is_fpu_result | move_w2_vld | take_other_trap | stfsr_w2_vld}}
|
| 1476 |
|
|
& ctl_dp_fp_thr[3:0]);
|
| 1477 |
|
|
assign ctl_dp_fsr_sel_ld[3:0] = ({4{ld_ret & (ldfsr | ldxfsr)}} &
|
| 1478 |
|
|
~ctl_dp_fsr_sel_fpu[3:0] & ctl_dp_fp_thr[3:0]);
|
| 1479 |
|
|
assign ctl_dp_fsr_sel_old[3:0] = (~ctl_dp_fsr_sel_fpu[3:0] & ~ctl_dp_fsr_sel_ld[3:0]);
|
| 1480 |
|
|
|
| 1481 |
|
|
// align fcc depending on which fcc_num was used
|
| 1482 |
|
|
mux4ds #8 fcc_ret_mux(.dout (fpu_fcc[7:0]),
|
| 1483 |
|
|
.in0 ({dp_ctl_fsr_fcc[7:2], cpx_fccval_d1[1:0]}),
|
| 1484 |
|
|
.in1 ({dp_ctl_fsr_fcc[7:4], cpx_fccval_d1[1:0], dp_ctl_fsr_fcc[1:0]}),
|
| 1485 |
|
|
.in2 ({dp_ctl_fsr_fcc[7:6], cpx_fccval_d1[1:0], dp_ctl_fsr_fcc[3:0]}),
|
| 1486 |
|
|
.in3 ({cpx_fccval_d1[1:0], dp_ctl_fsr_fcc[5:0]}),
|
| 1487 |
|
|
.sel0 (fcc_num_dec[0]),
|
| 1488 |
|
|
.sel1 (fcc_num_dec[1]),
|
| 1489 |
|
|
.sel2 (fcc_num_dec[2]),
|
| 1490 |
|
|
.sel3 (fcc_num_dec[3]));
|
| 1491 |
|
|
|
| 1492 |
|
|
// set fcc if this was an fcmp instruction
|
| 1493 |
|
|
assign fcc_sel_fpu = cpx_fcmp_d1 & ~ieee_trap & is_fpu_result;
|
| 1494 |
|
|
assign fcc_sel_ld = ~is_fpu_result & ldfsr_vld;
|
| 1495 |
|
|
assign fcc_sel_ldx = ~is_fpu_result & ~ldfsr_vld & ldxfsr_vld;
|
| 1496 |
|
|
assign fcc_sel_old = ~fcc_sel_fpu & ~fcc_sel_ld & ~fcc_sel_ldx;
|
| 1497 |
|
|
mux4ds #8 fcc_set_mux(.dout (ctl_dp_fcc_w2[7:0]),
|
| 1498 |
|
|
.in0 (dp_ctl_fsr_fcc[7:0]),
|
| 1499 |
|
|
.in1 (fpu_fcc[7:0]),
|
| 1500 |
|
|
.in2 (dp_ctl_ld_fcc[7:0]),
|
| 1501 |
|
|
.in3 ({dp_ctl_fsr_fcc[7:2], dp_ctl_ld_fcc[1:0]}),
|
| 1502 |
|
|
.sel0 (fcc_sel_old),
|
| 1503 |
|
|
.sel1 (fcc_sel_fpu),
|
| 1504 |
|
|
.sel2 (fcc_sel_ldx),
|
| 1505 |
|
|
.sel3 (fcc_sel_ld));
|
| 1506 |
|
|
|
| 1507 |
|
|
// get fcc's from ldfsr instruction
|
| 1508 |
|
|
assign ldfsr_vld = ldfsr & load_pending;
|
| 1509 |
|
|
assign ldxfsr_vld = ldxfsr & load_pending;
|
| 1510 |
|
|
|
| 1511 |
|
|
wire cc_changed_w2;
|
| 1512 |
|
|
|
| 1513 |
|
|
// fcc set by fcmp, ldfsr or ldxfsr
|
| 1514 |
|
|
assign cc_changed = fcc_sel_fpu |
|
| 1515 |
|
|
fld_done & (ldfsr_vld | ldxfsr_vld);
|
| 1516 |
|
|
|
| 1517 |
113 |
albert.wat |
dff_s cc_changed_dff(.din(cc_changed), .clk(clk), .q(cc_changed_w2),
|
| 1518 |
|
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1519 |
|
|
dff_s #(8) cc_next(.din(ctl_dp_fcc_w2[7:0]), .clk(clk), .q(ffu_ifu_cc_w2[7:0]),
|
| 1520 |
|
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1521 |
95 |
fafa1971 |
|
| 1522 |
|
|
assign ffu_ifu_cc_vld_w2[3:0] = ctl_dp_fp_thr[3:0] & {4{cc_changed_w2}};
|
| 1523 |
|
|
|
| 1524 |
|
|
//-----------------------------------
|
| 1525 |
|
|
// Traps
|
| 1526 |
|
|
//-----------------------------------
|
| 1527 |
|
|
|
| 1528 |
|
|
// illegal instruction if blk ld/st is not 8 dp regs aligned
|
| 1529 |
113 |
albert.wat |
dff_s illegal_vis_e2m (.din(illegal_vis_e), .clk(clk), .q(illegal_vis_m),
|
| 1530 |
|
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1531 |
95 |
fafa1971 |
assign illegal_blk_m = (blk_ld_m | bst_m) & (rd[0] | rd[1] | rd[2] | rd[3]) & ~dest_single;
|
| 1532 |
|
|
assign ffu_tlu_ill_inst_m = illegal_blk_m | illegal_vis_m;
|
| 1533 |
|
|
|
| 1534 |
|
|
assign ctl_dp_ftt_w2 = take_ieee_trap ? 3'b001 :
|
| 1535 |
|
|
unimpl_qual_w2 ? 3'b011 :
|
| 1536 |
|
|
clear_ftt ? 3'b000 :
|
| 1537 |
|
|
3'bxxx;
|
| 1538 |
|
|
|
| 1539 |
|
|
// SPARC V9 Underflow, Overflow, Inexact behavior:
|
| 1540 |
|
|
//
|
| 1541 |
|
|
// Exception(s) | Current
|
| 1542 |
|
|
// Detected Trap Enable | fp_ Exception
|
| 1543 |
|
|
// in f.p. Mask Bits | exception_ Bits (in
|
| 1544 |
|
|
// operation (in FSR.TEM) | ieee_754 FSR.cexc)
|
| 1545 |
|
|
// ----------- ------------ | Trap -----------
|
| 1546 |
|
|
// of uf nx OFM UFM NXM | Occurs? ofc ufc nxc Notes
|
| 1547 |
|
|
// --- --- --- --- --- --- | ---------- --- --- --- -----
|
| 1548 |
|
|
// - - - x x x | no 0 0 0
|
| 1549 |
|
|
// - - * x x 0 | no 0 0 1
|
| 1550 |
|
|
// - * * x 0 0 | no 0 1 1
|
| 1551 |
|
|
// * - * 0 x 0 | no 1 0 1 (2)
|
| 1552 |
|
|
// |
|
| 1553 |
|
|
// - - * x x 1 | yes 0 0 1
|
| 1554 |
|
|
// - * * x 0 1 | yes 0 0 1
|
| 1555 |
|
|
// - * - x 1 x | yes 0 1 0
|
| 1556 |
|
|
// - * * x 1 x | yes 0 1 0
|
| 1557 |
|
|
// * - * 1 x x | yes 1 0 0 (2)
|
| 1558 |
|
|
// * - * 0 x 1 | yes 0 0 1 (2)
|
| 1559 |
|
|
//
|
| 1560 |
|
|
// (2) Overflow is always accompanied by inexact.
|
| 1561 |
|
|
//
|
| 1562 |
|
|
//
|
| 1563 |
|
|
// The FPU does not receive FSR.TEM bits. FSR.TEM bits are used within
|
| 1564 |
|
|
// the FFU for the following cases:
|
| 1565 |
|
|
// (1) fp_exception_ieee_754 trap detection
|
| 1566 |
|
|
// If a FPop generates an IEEE exception (nv, of, uf, dz, nx) for
|
| 1567 |
|
|
// which the corresponding trap enable (TEM) is set, then a
|
| 1568 |
|
|
// fp_exception_ieee_754 trap is caused. FSR.cexc field has one bit
|
| 1569 |
|
|
// set corresponding to the IEEE exception, and FSR.aexc field is
|
| 1570 |
|
|
// unchanged.
|
| 1571 |
|
|
// (2) Clear FSR.nxc if an overflow (underflow) exception does trap
|
| 1572 |
|
|
// because FSR.OFM (FSR.UFM) is set, regardless of whether FSR.NXM
|
| 1573 |
|
|
// is set. Set FSR.ofc (FSR.ufc).
|
| 1574 |
|
|
// (3) Clear FSR.ofc (FSR.ufc) if overflow (underflow) exception traps
|
| 1575 |
|
|
// and FSR.OFM (FSR.UFM) is not set and FSR.NXM is set. Set FSR.nxc.
|
| 1576 |
|
|
// (4) Clear FSR.ufc if the result is exact (FSR.nxc is not set) and
|
| 1577 |
|
|
// FSR.UFM is not set. This case represents an exact denormalized
|
| 1578 |
|
|
// result.
|
| 1579 |
|
|
//
|
| 1580 |
|
|
// Note: - FPU will signal underflow to the FFU for all "tiny" results.
|
| 1581 |
|
|
// - FPU always reports inexact along with overflow.
|
| 1582 |
113 |
albert.wat |
dff_s #(5) tem_dff(.din(dp_ctl_fsr_tem[4:0]), .clk(clk), .q(fsr_tem_d1),
|
| 1583 |
|
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1584 |
95 |
fafa1971 |
assign fpexc_nxc =
|
| 1585 |
113 |
albert.wat |
cpx_fpexc_d1[`FSR_NXC] &
|
| 1586 |
|
|
~(( fsr_tem_d1[3] & cpx_fpexc_d1[`FSR_OFC]) | // enabled of
|
| 1587 |
|
|
( fsr_tem_d1[2] & cpx_fpexc_d1[`FSR_UFC]) ); // enabled uf
|
| 1588 |
95 |
fafa1971 |
|
| 1589 |
|
|
assign fpexc_ofc =
|
| 1590 |
113 |
albert.wat |
cpx_fpexc_d1[`FSR_OFC] &
|
| 1591 |
|
|
~(~fsr_tem_d1[3] & fsr_tem_d1[0] & cpx_fpexc_d1[`FSR_NXC]); // disabled of and enabled nx
|
| 1592 |
95 |
fafa1971 |
|
| 1593 |
|
|
assign fpexc_ufc =
|
| 1594 |
113 |
albert.wat |
cpx_fpexc_d1[`FSR_UFC] &
|
| 1595 |
|
|
~(~fsr_tem_d1[2] & ( fsr_tem_d1[0] & cpx_fpexc_d1[`FSR_NXC])) & // disabled uf & enabled nx
|
| 1596 |
|
|
~(~fsr_tem_d1[2] & ~cpx_fpexc_d1[`FSR_NXC]) ; // disabled uf with no inexact
|
| 1597 |
95 |
fafa1971 |
// (i.e. exact denorm w/ UFM=0)
|
| 1598 |
|
|
|
| 1599 |
|
|
|
| 1600 |
|
|
assign ieee_trap_vec[4:0] =
|
| 1601 |
|
|
({cpx_fpexc_d1[4],
|
| 1602 |
|
|
fpexc_ofc,
|
| 1603 |
|
|
fpexc_ufc,
|
| 1604 |
|
|
cpx_fpexc_d1[1],
|
| 1605 |
|
|
fpexc_nxc } & fsr_tem_d1[4:0]);
|
| 1606 |
|
|
|
| 1607 |
|
|
|
| 1608 |
|
|
// ieee trap has least priority. Put through a flop for timing reasons
|
| 1609 |
|
|
assign ieee_trap = (|ieee_trap_vec[4:0]);
|
| 1610 |
|
|
assign take_ieee_trap = ieee_trap & is_fpu_result;
|
| 1611 |
113 |
albert.wat |
dff_s trap_ieee_dff(.din(take_ieee_trap), .clk(clk), .q(ffu_tlu_trap_ieee754),
|
| 1612 |
|
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1613 |
95 |
fafa1971 |
|
| 1614 |
|
|
assign take_other_trap = unimpl_qual_w2;
|
| 1615 |
|
|
assign ffu_tlu_trap_other = take_other_trap;
|
| 1616 |
|
|
assign ffu_tlu_trap_ue = ue_trap_w3;
|
| 1617 |
|
|
|
| 1618 |
|
|
// current exception
|
| 1619 |
|
|
assign fp_exc_w2[4:0] =
|
| 1620 |
|
|
({cpx_fpexc_d1[4],
|
| 1621 |
|
|
fpexc_ofc,
|
| 1622 |
|
|
fpexc_ufc,
|
| 1623 |
|
|
cpx_fpexc_d1[1],
|
| 1624 |
|
|
fpexc_nxc });
|
| 1625 |
|
|
|
| 1626 |
|
|
|
| 1627 |
|
|
|
| 1628 |
|
|
|
| 1629 |
|
|
// accrued exceptions
|
| 1630 |
|
|
// fp_exc_w2 = dp_ctl_fsr_aexc | cpx_fpexc_d1 & {5{~take_ieee_trap}};
|
| 1631 |
113 |
albert.wat |
assign fp_exc_w2[`FSR_NVA] = dp_ctl_fsr_aexc[`FSR_NVC] |
|
| 1632 |
|
|
is_fpu_result & cpx_fpexc_d1[`FSR_NVC] & ~fsr_tem_d1[`FSR_NVC];
|
| 1633 |
|
|
assign fp_exc_w2[`FSR_DZA] = dp_ctl_fsr_aexc[`FSR_DZC] |
|
| 1634 |
|
|
is_fpu_result & cpx_fpexc_d1[`FSR_DZC] & ~fsr_tem_d1[`FSR_DZC];
|
| 1635 |
|
|
assign fp_exc_w2[`FSR_UFA] = dp_ctl_fsr_aexc[`FSR_UFC] |
|
| 1636 |
|
|
is_fpu_result & fpexc_ufc & ~fsr_tem_d1[`FSR_UFC];
|
| 1637 |
|
|
assign fp_exc_w2[`FSR_OFA] = dp_ctl_fsr_aexc[`FSR_OFC] |
|
| 1638 |
|
|
is_fpu_result & fpexc_ofc & ~fsr_tem_d1[`FSR_OFC];
|
| 1639 |
|
|
assign fp_exc_w2[`FSR_NXA] = dp_ctl_fsr_aexc[`FSR_NXC] |
|
| 1640 |
|
|
is_fpu_result & fpexc_nxc & ~fsr_tem_d1[`FSR_NXC];
|
| 1641 |
95 |
fafa1971 |
|
| 1642 |
|
|
assign ctl_dp_exc_w2[9:5] = fp_exc_w2[9:5];
|
| 1643 |
|
|
// move, abs, etc will clear cexc, fpu_results will update, all else will leave unchanged
|
| 1644 |
|
|
wire update_cexc;
|
| 1645 |
|
|
assign update_cexc = is_fpu_result | move_w2_vld;
|
| 1646 |
|
|
assign ctl_dp_exc_w2[4:0] = ((update_cexc)? fp_exc_w2[4:0] & {5{is_fpu_result}}:
|
| 1647 |
|
|
dp_ctl_fsr_cexc[4:0]);
|
| 1648 |
|
|
|
| 1649 |
|
|
|
| 1650 |
|
|
|
| 1651 |
|
|
////////////////////////////////
|
| 1652 |
|
|
// ECC control
|
| 1653 |
|
|
////////////////////////////////
|
| 1654 |
|
|
// Generation of the parity bit for writes
|
| 1655 |
|
|
wire [13:0] gen_synd_d1;
|
| 1656 |
|
|
wire gen_par_hi;
|
| 1657 |
|
|
wire gen_par_low;
|
| 1658 |
|
|
wire [6:0] error_inj_data;
|
| 1659 |
|
|
output [13:0] ctl_frf_write_synd;
|
| 1660 |
113 |
albert.wat |
dff_s #(14) gen_synd_dff (.din({dp_ctl_synd_out_high[6:0],dp_ctl_synd_out_low[6:0]}),
|
| 1661 |
|
|
.q(gen_synd_d1[13:0]), .clk(clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1662 |
95 |
fafa1971 |
assign gen_par_hi = ^gen_synd_d1[13:7];
|
| 1663 |
|
|
assign gen_par_low = ^gen_synd_d1[6:0];
|
| 1664 |
|
|
assign ctl_frf_write_synd[13:0] = ({gen_par_hi,gen_synd_d1[12:7],gen_par_low,gen_synd_d1[5:0]} ^
|
| 1665 |
|
|
{error_inj_data[6:0],error_inj_data[6:0]});
|
| 1666 |
|
|
/////////////////////////////////
|
| 1667 |
|
|
// error injection
|
| 1668 |
|
|
/////////////////////////////////
|
| 1669 |
|
|
// injection doesn't check for flush on wen
|
| 1670 |
|
|
assign inject_err_next = ifu_ffu_inj_frferr & rf_wen_next;
|
| 1671 |
|
|
assign error_inj_data[6:0] = {7{inject_err}} & err_data[6:0];
|
| 1672 |
113 |
albert.wat |
dff_s #(7) err_data_dff(.din(ifu_exu_ecc_mask[6:0]),
|
| 1673 |
95 |
fafa1971 |
.q(err_data[6:0]),
|
| 1674 |
113 |
albert.wat |
.clk(clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1675 |
|
|
dff_s err_cntl(.din(inject_err_next),
|
| 1676 |
95 |
fafa1971 |
.q(inject_err),
|
| 1677 |
113 |
albert.wat |
.clk(clk), .se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1678 |
95 |
fafa1971 |
// speculate on error injection (don't check flush_pipe etc)
|
| 1679 |
|
|
assign ffu_ifu_inj_ack = inject_err;
|
| 1680 |
|
|
|
| 1681 |
|
|
|
| 1682 |
|
|
// check the upper half on a double or a single with an even reg num
|
| 1683 |
|
|
// check the lower half on a double or a single with an odd reg num
|
| 1684 |
|
|
// ecc block will run on frf input for reads
|
| 1685 |
|
|
// otherwise it will run on the rd_data
|
| 1686 |
|
|
assign check_ecc_next = ren_rs2_m | fst_e | ren_rs1_w | bst_issue_c3_next;
|
| 1687 |
113 |
albert.wat |
dff_s check_ecc_dff(.din(check_ecc_next), .clk(clk), .q(ctl_dp_ecc_sel_frf),
|
| 1688 |
|
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1689 |
95 |
fafa1971 |
// rs1 will not be checked if a ce was detected on rs2. If there was a ue on rs2
|
| 1690 |
|
|
// rs1 will be checked and a ce will be corrected, but the error on rs2 will be logged
|
| 1691 |
|
|
assign chk_rs1_w2 = ren_rs1_w2;
|
| 1692 |
|
|
assign chk_ecc_m[1] = fst_m & ~rd[0] & ~output_sel_fsr;
|
| 1693 |
|
|
assign chk_ecc_m[0] = fst_m & (~dest_single | rd[0]) & ~output_sel_fsr;
|
| 1694 |
|
|
assign chk_ecc_w[1] = ren_rs2_w & ~kill_eccchk_w & ~rs2[0];
|
| 1695 |
|
|
assign chk_ecc_w[0] = ren_rs2_w & ~kill_eccchk_w & (~source_single | rs2[0]);
|
| 1696 |
|
|
assign chk_ecc_w2[1] = chk_rs1_w2 & ~rs1[0];
|
| 1697 |
|
|
assign chk_ecc_w2[0] = chk_rs1_w2 & (~source_single | rs1[0]);
|
| 1698 |
|
|
|
| 1699 |
|
|
assign chk_ecc[1:0] = chk_ecc_m[1:0] | chk_ecc_w[1:0] | chk_ecc_w2[1:0] | {2{bst_issue_c3}};
|
| 1700 |
113 |
albert.wat |
dff_s #(2) chk_ecc_dff(.din(chk_ecc[1:0]), .clk(clk), .q(chk_ecc_prev[1:0]),
|
| 1701 |
|
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1702 |
95 |
fafa1971 |
|
| 1703 |
|
|
assign error_detected[1] = |dp_ctl_synd_out_high[5:0];
|
| 1704 |
|
|
assign error_detected[0] = |dp_ctl_synd_out_low[5:0];
|
| 1705 |
|
|
|
| 1706 |
|
|
assign possible_ue[1] = ~dp_ctl_synd_out_high[6] & chk_ecc[1];
|
| 1707 |
|
|
assign possible_ue[0] = ~dp_ctl_synd_out_low[6] & chk_ecc[0];
|
| 1708 |
|
|
assign ce[1] = dp_ctl_synd_out_high[6] & chk_ecc[1];
|
| 1709 |
|
|
assign ce[0] = dp_ctl_synd_out_low[6] & chk_ecc[0];
|
| 1710 |
|
|
|
| 1711 |
|
|
assign rollback_fst_m = ((dp_ctl_synd_out_high[6] & chk_ecc_m[1] & ~disable_ce_m) |
|
| 1712 |
|
|
(dp_ctl_synd_out_low[6] & chk_ecc_m[0] & ~disable_ce_m));
|
| 1713 |
113 |
albert.wat |
dff_s rollback_m2w(.din(rollback_fst_m), .clk(clk), .q(rollback_fst_w), .se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1714 |
|
|
dff_s #(2) possible_ue_dff(.din(possible_ue[1:0]), .clk(clk), .q(prev_poss_ue[1:0]),
|
| 1715 |
|
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1716 |
|
|
dff_s #(2) ce_dff(.din(ce[1:0]), .clk(clk), .q(previous_ce[1:0]),
|
| 1717 |
|
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1718 |
|
|
dff_s #(2) err_det_dff(.din(error_detected[1:0]), .clk(clk), .q(prev_err_detected[1:0]),
|
| 1719 |
|
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1720 |
95 |
fafa1971 |
assign previous_ue = |(prev_err_detected[1:0] & prev_poss_ue[1:0]);
|
| 1721 |
|
|
|
| 1722 |
113 |
albert.wat |
dff_s #(2) ecc_wen1_dff(.din(ecc_wen_gen_next[1:0]), .clk(clk), .q(ecc_wen_gen[1:0]),
|
| 1723 |
|
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1724 |
|
|
dff_s #(2) ecc_wen2_dff(.din(ecc_wen_next[1:0]), .clk(clk), .q(ecc_wen[1:0]),
|
| 1725 |
|
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1726 |
95 |
fafa1971 |
// if the ecc error was in the m stage we need to check for a kill
|
| 1727 |
|
|
// if the ecc error was in the w stage we need to check flush
|
| 1728 |
|
|
// ECC errors on rs1 will not be written back to the frf. The data that is used will be corrected.
|
| 1729 |
|
|
assign ecc_wen_gen_next[1:0] = previous_ce[1:0] &
|
| 1730 |
|
|
{2{bst_issue_c4 | fst_ce_w | rollback_rs2_w2 | rollback_rs1_w3}};
|
| 1731 |
|
|
assign ecc_wen_next = ecc_wen_gen[1:0] & {2{~(fst_ce_w2 & flush_w2)}};
|
| 1732 |
|
|
|
| 1733 |
|
|
// pass along ce and ue so trap can be signalled to ffu and tlu
|
| 1734 |
|
|
// if disable_ce_m then don't tell ifu reissue ce. Instead convert to a ue.
|
| 1735 |
113 |
albert.wat |
dff_s disable_ce_e2m(.din(ifu_exu_disable_ce_e), .clk(clk), .q(disable_ce_m),
|
| 1736 |
|
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1737 |
|
|
dff_s disable_ce_m2w(.din(disable_ce_m), .clk(clk), .q(disable_ce_w),
|
| 1738 |
|
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1739 |
95 |
fafa1971 |
assign fst_ce_w = rollback_fst_w & ~kill_eccchk_w;
|
| 1740 |
|
|
assign fst_ue_w = fst_w & (previous_ue | (disable_ce_w & |(previous_ce[1:0]))) & ~kill_eccchk_w;
|
| 1741 |
|
|
assign rollback_rs2_w2 = (ren_rs2_w2 & ~flush_w2 & |previous_ce[1:0]
|
| 1742 |
|
|
& ~rolled_back);
|
| 1743 |
|
|
assign rs2_ce_w2 = ren_rs2_w2 & |previous_ce[1:0] & ~rolled_back & ~previous_ue;
|
| 1744 |
|
|
assign rs2_ue_w2 = ren_rs2_w2 & (previous_ue | (rolled_back & |previous_ce[1:0]));
|
| 1745 |
|
|
// must check for flush because eccchk doesn't do this
|
| 1746 |
|
|
assign rs2_fst_ce_w2_vld = (rs2_ce_w2 | fst_ce_w2) & ~flush_w2;
|
| 1747 |
|
|
assign rs2_fst_ue_w2_vld = (rs2_ue_w2 | fst_ue_w2) & ~flush_w2;
|
| 1748 |
113 |
albert.wat |
dff_s ce_w2w2(.din(fst_ce_w), .clk(clk), .q(fst_ce_w2),
|
| 1749 |
|
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1750 |
|
|
dff_s ue_w2w2(.din(fst_ue_w), .clk(clk), .q(fst_ue_w2),
|
| 1751 |
|
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1752 |
|
|
dff_s ce_w22w3(.din(rs2_fst_ce_w2_vld), .clk(clk), .q(rs2_fst_ce_w3),
|
| 1753 |
|
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1754 |
|
|
dff_s ue_w22w3(.din(rs2_fst_ue_w2_vld), .clk(clk), .q(rs2_fst_ue_w3),
|
| 1755 |
|
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1756 |
95 |
fafa1971 |
|
| 1757 |
|
|
assign rs1_ce_w3 = ren_rs1_w3 & |previous_ce[1:0] & ~previous_ue & ~rolled_back;
|
| 1758 |
|
|
assign rollback_rs1_w3 = rs1_ce_w3 & ~ue_trap_w3;
|
| 1759 |
|
|
assign ce_w3 = (rs1_ce_w3 | rs2_fst_ce_w3);
|
| 1760 |
|
|
assign ue_w3 = (ren_rs1_w3 & (previous_ue | (rolled_back & |previous_ce[1:0]))) | rs2_fst_ue_w3;
|
| 1761 |
|
|
|
| 1762 |
|
|
assign ffu_ifu_ecc_ce_w2 = (ce_w3 | bst_ce_c4);
|
| 1763 |
|
|
assign ffu_ifu_ecc_ue_w2 = (ue_w3 | bst_ue_c4);
|
| 1764 |
|
|
|
| 1765 |
|
|
// error logging signals. The error register priority is fst, bst, rs1_ue, rs2_ue, rs1_ce, rs2_ce
|
| 1766 |
|
|
assign log_new_err = (ren_rs2_w2 | bst_issue_c4 | fst_w |
|
| 1767 |
|
|
(ren_rs1_w3 & previous_ue) | (rs1_ce_w3 & ~rs2_fst_ue_w3));
|
| 1768 |
|
|
assign new_err_reg[5:0] = fst_w ? rd[5:0]:
|
| 1769 |
|
|
bst_issue_c4 ? bst_rs[5:0]:
|
| 1770 |
|
|
ren_rs2_w2 ? rs2[5:0]:
|
| 1771 |
|
|
rs1[5:0];
|
| 1772 |
|
|
assign err_reg_next[5:0] = (log_new_err) ? new_err_reg[5:0] : err_reg_d1[5:0];
|
| 1773 |
113 |
albert.wat |
dff_s #(6) err_reg_dff(.din(err_reg_next[5:0]), .clk(clk), .q(err_reg_d1[5:0]),
|
| 1774 |
|
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1775 |
95 |
fafa1971 |
assign ffu_ifu_err_reg_w2[5:0] = err_reg_d1[5:0];
|
| 1776 |
|
|
|
| 1777 |
|
|
// storage of error syndrome for logging
|
| 1778 |
|
|
// For singles the invalid half of the syndrome is zeroed out.
|
| 1779 |
|
|
// The syndrome reported to the ifu will be latched until a new error is detected
|
| 1780 |
|
|
assign new_err_synd[13:7] = gen_synd_d1[13:7] & {7{chk_ecc_prev[1]}};
|
| 1781 |
|
|
assign new_err_synd[6:0] = gen_synd_d1[6:0] & {7{chk_ecc_prev[0]}};
|
| 1782 |
|
|
assign err_synd_next[13:0] = (log_new_err)? new_err_synd: err_synd_d1;
|
| 1783 |
113 |
albert.wat |
dff_s #(14) err_synd_d1ff(.din(err_synd_next[13:0]), .clk(clk), .q(err_synd_d1[13:0]),
|
| 1784 |
|
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1785 |
95 |
fafa1971 |
assign ffu_ifu_err_synd_w2[13:0] = err_synd_d1[13:0];
|
| 1786 |
|
|
|
| 1787 |
|
|
// kill moves and fpu ops
|
| 1788 |
|
|
assign ecc_kill_rs2_w2 = rollback_rs2_w2 | (rs2_ue_w2 & nceen);
|
| 1789 |
|
|
|
| 1790 |
|
|
|
| 1791 |
|
|
// pipe along enable signal for ue traps
|
| 1792 |
|
|
assign nceen_next = (any_op_e)? ifu_exu_nceen_e: (nceen & ~rollback_fst_w);
|
| 1793 |
113 |
albert.wat |
dff_s nceen_dff(.din(nceen_next), .clk(clk), .q(nceen),
|
| 1794 |
|
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1795 |
95 |
fafa1971 |
assign ue_trap_w3 = (ue_w3 | bst_ue_c4) & nceen;
|
| 1796 |
|
|
|
| 1797 |
|
|
// signals for killing stores on ecc
|
| 1798 |
|
|
// use this to kill any rs2/rd ce
|
| 1799 |
|
|
assign ffu_ifu_fst_ce_w = rollback_fst_w;
|
| 1800 |
|
|
|
| 1801 |
|
|
// These signals kill the entry in the store buffer for any ce or trapping ue. Very critical timing.
|
| 1802 |
|
|
assign possible_kill_st_ce_m = ((fst_m & ~output_sel_fsr & ~(disable_ce_m & ~nceen)) |
|
| 1803 |
|
|
(bst_issue_c3 & ~(fixed_bst_ce & ~nceen)));
|
| 1804 |
|
|
assign possible_kill_st_ue_m = (fst_m & ~output_sel_fsr & nceen | bst_issue_c3 & nceen);
|
| 1805 |
|
|
assign kill_st_ce_w = (|previous_ce[1:0]) & possible_kill_st_ce_w;
|
| 1806 |
|
|
assign ffu_lsu_kill_fst_w = (previous_ue)? possible_kill_st_ue_w: kill_st_ce_w;
|
| 1807 |
113 |
albert.wat |
dff_s kill_fst_ce_dff(.din(possible_kill_st_ce_m), .clk(clk), .q(possible_kill_st_ce_w),
|
| 1808 |
|
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1809 |
|
|
dff_s kill_fst_ue_dff(.din(possible_kill_st_ue_m), .clk(clk), .q(possible_kill_st_ue_w),
|
| 1810 |
|
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1811 |
95 |
fafa1971 |
|
| 1812 |
|
|
// rollback signals
|
| 1813 |
|
|
assign rollback_c1_next = rollback_rs2_w2 | rollback_rs1_w3;
|
| 1814 |
113 |
albert.wat |
dffr_s #(3) rollback_dff(.din({rollback_c1_next,rollback_c1_vld,rollback_c2}),
|
| 1815 |
95 |
fafa1971 |
.q({rollback_c1, rollback_c2, rollback_c3}),
|
| 1816 |
113 |
albert.wat |
.clk(clk), .se(se), `SIMPLY_RISC_SCANIN, .so(), .rst(reset));
|
| 1817 |
95 |
fafa1971 |
// if both rs1 and rs2 rollback then the state machine needs to start on rs1
|
| 1818 |
|
|
assign rollback_c1_vld = rollback_c1 & ~ue_trap_w3 & ~rollback_rs1_w3;
|
| 1819 |
|
|
|
| 1820 |
|
|
assign rolled_back_next = rollback_c1_vld | rolled_back & ~any_op_e;
|
| 1821 |
113 |
albert.wat |
dffr_s rollback_state(.din(rolled_back_next), .q(rolled_back),
|
| 1822 |
95 |
fafa1971 |
.rst(reset), .clk(clk),
|
| 1823 |
113 |
albert.wat |
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
| 1824 |
95 |
fafa1971 |
|
| 1825 |
|
|
//////////////////////////////
|
| 1826 |
|
|
// Performance counter signals
|
| 1827 |
|
|
//////////////////////////////
|
| 1828 |
|
|
assign ffu_tlu_fpu_tid[1:0] = tid[1:0] & {2{is_fpu_result}}; // don't toggle wire if not needed
|
| 1829 |
|
|
assign ffu_tlu_fpu_cmplt = is_fpu_result;
|
| 1830 |
|
|
|
| 1831 |
|
|
sparc_ffu_ctl_visctl visctl(
|
| 1832 |
|
|
.illegal_vis_e(illegal_vis_e),
|
| 1833 |
|
|
.vis_nofrf_e(vis_nofrf_e),
|
| 1834 |
|
|
.visop_e (visop_e),
|
| 1835 |
|
|
.visop_m (visop_m),
|
| 1836 |
|
|
.visop_w_vld (visop_w_vld),
|
| 1837 |
|
|
.vis_wen_next (vis_wen_next),
|
| 1838 |
|
|
.ifu_ffu_rnd_e(frs2_e[2:0]),
|
| 1839 |
|
|
.fpu_rnd (fpu_rnd[1:0]),
|
| 1840 |
|
|
.vis_result(vis_result),
|
| 1841 |
|
|
/*AUTOINST*/
|
| 1842 |
|
|
// Outputs
|
| 1843 |
|
|
.ctl_vis_sel_add(ctl_vis_sel_add),
|
| 1844 |
|
|
.ctl_vis_sel_log(ctl_vis_sel_log),
|
| 1845 |
|
|
.ctl_vis_sel_align(ctl_vis_sel_align),
|
| 1846 |
|
|
.ctl_vis_add32(ctl_vis_add32),
|
| 1847 |
|
|
.ctl_vis_subtract(ctl_vis_subtract),
|
| 1848 |
|
|
.ctl_vis_cin(ctl_vis_cin),
|
| 1849 |
|
|
.ctl_vis_align0(ctl_vis_align0),
|
| 1850 |
|
|
.ctl_vis_align2(ctl_vis_align2),
|
| 1851 |
|
|
.ctl_vis_align4(ctl_vis_align4),
|
| 1852 |
|
|
.ctl_vis_align6(ctl_vis_align6),
|
| 1853 |
|
|
.ctl_vis_align_odd(ctl_vis_align_odd),
|
| 1854 |
|
|
.ctl_vis_log_sel_pass(ctl_vis_log_sel_pass),
|
| 1855 |
|
|
.ctl_vis_log_sel_nand(ctl_vis_log_sel_nand),
|
| 1856 |
|
|
.ctl_vis_log_sel_nor(ctl_vis_log_sel_nor),
|
| 1857 |
|
|
.ctl_vis_log_sel_xor(ctl_vis_log_sel_xor),
|
| 1858 |
|
|
.ctl_vis_log_invert_rs1(ctl_vis_log_invert_rs1),
|
| 1859 |
|
|
.ctl_vis_log_invert_rs2(ctl_vis_log_invert_rs2),
|
| 1860 |
|
|
.ctl_vis_log_constant(ctl_vis_log_constant),
|
| 1861 |
|
|
.ctl_vis_log_pass_const(ctl_vis_log_pass_const),
|
| 1862 |
|
|
.ctl_vis_log_pass_rs1(ctl_vis_log_pass_rs1),
|
| 1863 |
|
|
.ctl_vis_log_pass_rs2(ctl_vis_log_pass_rs2),
|
| 1864 |
|
|
.ffu_exu_rsr_data_hi_m(ffu_exu_rsr_data_hi_m[31:0]),
|
| 1865 |
|
|
.ffu_exu_rsr_data_mid_m(ffu_exu_rsr_data_mid_m[2:0]),
|
| 1866 |
|
|
.ffu_exu_rsr_data_lo_m(ffu_exu_rsr_data_lo_m[7:0]),
|
| 1867 |
|
|
.ctl_dp_wsr_data_w2(ctl_dp_wsr_data_w2[36:0]),
|
| 1868 |
|
|
.ctl_dp_gsr_wsr_w2(ctl_dp_gsr_wsr_w2[3:0]),
|
| 1869 |
|
|
.ctl_dp_thr_e(ctl_dp_thr_e[3:0]),
|
| 1870 |
|
|
// Inputs
|
| 1871 |
|
|
.clk (clk),
|
| 1872 |
|
|
.se (se),
|
| 1873 |
|
|
.reset (reset),
|
| 1874 |
|
|
.opf (opf[8:0]),
|
| 1875 |
|
|
.tid_w2 (tid_w2[1:0]),
|
| 1876 |
|
|
.tid_e (tid_e[1:0]),
|
| 1877 |
|
|
.tid (tid[1:0]),
|
| 1878 |
|
|
.kill_w (kill_w),
|
| 1879 |
|
|
.ifu_tlu_sraddr_d(ifu_tlu_sraddr_d[6:0]),
|
| 1880 |
|
|
.exu_ffu_wsr_inst_e(exu_ffu_wsr_inst_e),
|
| 1881 |
|
|
.exu_ffu_gsr_align_m(exu_ffu_gsr_align_m[2:0]),
|
| 1882 |
|
|
.exu_ffu_gsr_rnd_m(exu_ffu_gsr_rnd_m[2:0]),
|
| 1883 |
|
|
.exu_ffu_gsr_mask_m(exu_ffu_gsr_mask_m[31:0]),
|
| 1884 |
|
|
.exu_ffu_gsr_scale_m(exu_ffu_gsr_scale_m[4:0]),
|
| 1885 |
|
|
.dp_ctl_fsr_rnd(dp_ctl_fsr_rnd[1:0]),
|
| 1886 |
|
|
.flush_w2(flush_w2),
|
| 1887 |
|
|
.thr_match_mw2(thr_match_mw2),
|
| 1888 |
|
|
.thr_match_ww2(thr_match_ww2),
|
| 1889 |
|
|
.ifu_tlu_inst_vld_w(ifu_tlu_inst_vld_w),
|
| 1890 |
|
|
.ue_trap_w3(ue_trap_w3),
|
| 1891 |
|
|
.frs1_e (frs1_e[4:0]),
|
| 1892 |
|
|
.frs2_e (frs2_e[4:0]),
|
| 1893 |
|
|
.frd_e (frd_e[4:0]),
|
| 1894 |
|
|
.rollback_c3(rollback_c3),
|
| 1895 |
|
|
.rollback_rs2_w2(rollback_rs2_w2),
|
| 1896 |
|
|
.visop (visop),
|
| 1897 |
|
|
.rollback_rs1_w3(rollback_rs1_w3),
|
| 1898 |
|
|
.dp_ctl_gsr_mask_e(dp_ctl_gsr_mask_e[31:0]),
|
| 1899 |
|
|
.dp_ctl_gsr_scale_e(dp_ctl_gsr_scale_e[4:0]));
|
| 1900 |
|
|
|
| 1901 |
|
|
endmodule // sparc_ffu_ctl
|