Line 16... |
Line 16... |
// You should have received a copy of the GNU General Public
|
// You should have received a copy of the GNU General Public
|
// License along with this work; if not, write to the Free Software
|
// License along with this work; if not, write to the Free Software
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
//
|
//
|
// ========== Copyright Header End ============================================
|
// ========== Copyright Header End ============================================
|
|
`ifdef SIMPLY_RISC_TWEAKS
|
|
`define SIMPLY_RISC_SCANIN .si(0)
|
|
`else
|
|
`define SIMPLY_RISC_SCANIN .si()
|
|
`endif
|
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
/*
|
/*
|
// Module Name: sparc_exu_eclccr
|
// Module Name: sparc_exu_eclccr
|
// Description: 4 bit condition code registers with forwarding. Takes
|
// Description: 4 bit condition code registers with forwarding. Takes
|
// the e_stage result and writes on the w stage.
|
// the e_stage result and writes on the w stage.
|
Line 115... |
Line 120... |
|
|
wire [7:0] ccr_m;
|
wire [7:0] ccr_m;
|
|
|
|
|
// D2E flops
|
// D2E flops
|
dff dff_setcc_d2e(.din(ifu_exu_setcc_d), .clk(clk), .q(setcc_e),
|
dff_s dff_setcc_d2e(.din(ifu_exu_setcc_d), .clk(clk), .q(setcc_e),
|
.se(se), .si(), .so());
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
|
|
// E stage
|
// E stage
|
assign alu_cc_e = {alu_xcc_e, alu_icc_e};
|
assign alu_cc_e = {alu_xcc_e, alu_icc_e};
|
assign valid_setcc_e = setcc_e & ~ifu_exu_kill_e;
|
assign valid_setcc_e = setcc_e & ~ifu_exu_kill_e;
|
|
|
dff #(8) dff_cc_e2m(.din(alu_cc_e[7:0]), .clk(clk), .q(alu_cc_m[7:0]),
|
dff_s #(8) dff_cc_e2m(.din(alu_cc_e[7:0]), .clk(clk), .q(alu_cc_m[7:0]),
|
.se(se), .si(), .so());
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
dff dff_setcc_e2m(.din(valid_setcc_e), .clk(clk), .q(setcc_m),
|
dff_s dff_setcc_e2m(.din(valid_setcc_e), .clk(clk), .q(setcc_m),
|
.se(se), .si(), .so());
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
|
|
// M stage
|
// M stage
|
assign valid_setcc_m = setcc_m | tlu_exu_cwpccr_update_m;
|
assign valid_setcc_m = setcc_m | tlu_exu_cwpccr_update_m;
|
mux2ds #(8) mux_ccr_m(.dout(ccr_m[7:0]),
|
mux2ds #(8) mux_ccr_m(.dout(ccr_m[7:0]),
|
.in0(alu_cc_m[7:0]),
|
.in0(alu_cc_m[7:0]),
|
.in1(tlu_exu_ccr_m[7:0]),
|
.in1(tlu_exu_ccr_m[7:0]),
|
.sel0(~tlu_exu_cwpccr_update_m),
|
.sel0(~tlu_exu_cwpccr_update_m),
|
.sel1(tlu_exu_cwpccr_update_m));
|
.sel1(tlu_exu_cwpccr_update_m));
|
|
|
dff #(8) dff_cc_m2w(.din(ccr_m[7:0]), .clk(clk), .q(alu_cc_w[7:0]),
|
dff_s #(8) dff_cc_m2w(.din(ccr_m[7:0]), .clk(clk), .q(alu_cc_w[7:0]),
|
.se(se), .si(), .so());
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
dff dff_setcc_m2w(.din(valid_setcc_m), .clk(clk), .q(setcc_w),
|
dff_s dff_setcc_m2w(.din(valid_setcc_m), .clk(clk), .q(setcc_w),
|
.se(se), .si(), .so());
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
|
|
// W stage
|
// W stage
|
assign bypass_cc_w = ifu_exu_inst_vld_w & setcc_w;
|
assign bypass_cc_w = ifu_exu_inst_vld_w & setcc_w;
|
assign valid_setcc_w = ~ifu_tlu_flush_w & ~early_flush_w & ifu_exu_inst_vld_w & (setcc_w | wb_ccr_wrccr_w);
|
assign valid_setcc_w = ~ifu_tlu_flush_w & ~early_flush_w & ifu_exu_inst_vld_w & (setcc_w | wb_ccr_wrccr_w);
|
|
|
Line 151... |
Line 156... |
mux2ds #(8) mux_ccrin_cc(.dout(exu_ifu_cc_w[7:0]), .sel0(wb_ccr_wrccr_w),
|
mux2ds #(8) mux_ccrin_cc(.dout(exu_ifu_cc_w[7:0]), .sel0(wb_ccr_wrccr_w),
|
.sel1(use_alu_cc),
|
.sel1(use_alu_cc),
|
.in0(byp_ecl_wrccr_data_w[7:0]),
|
.in0(byp_ecl_wrccr_data_w[7:0]),
|
.in1(alu_cc_w[7:0]));
|
.in1(alu_cc_w[7:0]));
|
|
|
dff #(3) setcc_g2w2 (.din({wb_ccr_setcc_g, wb_ccr_thr_g[1:0]}), .clk(clk),
|
dff_s #(3) setcc_g2w2 (.din({wb_ccr_setcc_g, wb_ccr_thr_g[1:0]}), .clk(clk),
|
.q({setcc_w2, thr_w2[1:0]}),
|
.q({setcc_w2, thr_w2[1:0]}),
|
.se(se), .si(), .so());
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
|
|
|
|
/////////////////////////
|
/////////////////////////
|
// Storage of ccr
|
// Storage of ccr
|
/////////////////////////
|
/////////////////////////
|
|
`ifdef FPGA_SYN_1THREAD
|
|
|
|
assign thr0_w2 = ~thr_w2[1] & ~thr_w2[0];
|
|
assign wen_thr0_w = (thr_w[0] & valid_setcc_w & ~wen_thr0_w2);
|
|
assign wen_thr0_w2 = thr0_w2 & setcc_w2;
|
|
assign wen_thr0_l = ~(wen_thr0_w | wen_thr0_w2);
|
|
// mux between cc_w, cc_w2, old value, tlu value
|
|
mux3ds #(8) mux_ccrin0(.dout(ccrin_thr0[7:0]), .sel0(wen_thr0_w),
|
|
.sel1(wen_thr0_w2), .sel2(wen_thr0_l),
|
|
.in0(exu_ifu_cc_w[7:0]),
|
|
.in1(divcntl_ccr_cc_w2[7:0]), .in2(ccr_thr0[7:0]));
|
|
// store new value
|
|
dff_s #(8) dff_ccr_thr0(.din(ccrin_thr0[7:0]), .clk(clk), .q(ccr_thr0[7:0]),
|
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
|
assign ccr_d[7:0] = ccr_thr0[7:0];
|
|
|
|
`else // !`ifdef FPGA_SYN_1THREAD
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// !`ifdef FPGA_SYN_1THREAD
|
|
|
|
// decode thr_w2 for mux select
|
// decode thr_w2 for mux select
|
assign thr0_w2 = ~thr_w2[1] & ~thr_w2[0];
|
assign thr0_w2 = ~thr_w2[1] & ~thr_w2[0];
|
assign thr1_w2 = ~thr_w2[1] & thr_w2[0];
|
assign thr1_w2 = ~thr_w2[1] & thr_w2[0];
|
assign thr2_w2 = thr_w2[1] & ~thr_w2[0];
|
assign thr2_w2 = thr_w2[1] & ~thr_w2[0];
|
Line 215... |
Line 220... |
.sel1(wen_thr3_w2), .sel2(wen_thr3_l),
|
.sel1(wen_thr3_w2), .sel2(wen_thr3_l),
|
.in0(exu_ifu_cc_w[7:0]),
|
.in0(exu_ifu_cc_w[7:0]),
|
.in1(divcntl_ccr_cc_w2[7:0]), .in2(ccr_thr3[7:0]));
|
.in1(divcntl_ccr_cc_w2[7:0]), .in2(ccr_thr3[7:0]));
|
|
|
// store new value
|
// store new value
|
dff #(8) dff_ccr_thr0(.din(ccrin_thr0[7:0]), .clk(clk), .q(ccr_thr0[7:0]),
|
dff_s #(8) dff_ccr_thr0(.din(ccrin_thr0[7:0]), .clk(clk), .q(ccr_thr0[7:0]),
|
.se(se), .si(), .so());
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
dff #(8) dff_ccr_thr1(.din(ccrin_thr1[7:0]), .clk(clk), .q(ccr_thr1[7:0]),
|
dff_s #(8) dff_ccr_thr1(.din(ccrin_thr1[7:0]), .clk(clk), .q(ccr_thr1[7:0]),
|
.se(se), .si(), .so());
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
dff #(8) dff_ccr_thr2(.din(ccrin_thr2[7:0]), .clk(clk), .q(ccr_thr2[7:0]),
|
dff_s #(8) dff_ccr_thr2(.din(ccrin_thr2[7:0]), .clk(clk), .q(ccr_thr2[7:0]),
|
.se(se), .si(), .so());
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
dff #(8) dff_ccr_thr3(.din(ccrin_thr3[7:0]), .clk(clk), .q(ccr_thr3[7:0]),
|
dff_s #(8) dff_ccr_thr3(.din(ccrin_thr3[7:0]), .clk(clk), .q(ccr_thr3[7:0]),
|
.se(se), .si(), .so());
|
.se(se), `SIMPLY_RISC_SCANIN, .so());
|
|
|
|
|
// mux between the 4 sets of ccrs
|
// mux between the 4 sets of ccrs
|
mux4ds #(8) mux_ccr_out(.dout(ccr_d[7:0]), .sel0(thrdec_d[0]),
|
mux4ds #(8) mux_ccr_out(.dout(ccr_d[7:0]), .sel0(thrdec_d[0]),
|
.sel1(thrdec_d[1]), .sel2(thrdec_d[2]),
|
.sel1(thrdec_d[1]), .sel2(thrdec_d[2]),
|
.sel3(thrdec_d[3]), .in0(ccr_thr0[7:0]),
|
.sel3(thrdec_d[3]), .in0(ccr_thr0[7:0]),
|
.in1(ccr_thr1[7:0]), .in2(ccr_thr2[7:0]),
|
.in1(ccr_thr1[7:0]), .in2(ccr_thr2[7:0]),
|
.in3(ccr_thr3[7:0]));
|
.in3(ccr_thr3[7:0]));
|
// !`ifdef FPGA_SYN_1THREAD
|
`endif // !`ifdef FPGA_SYN_1THREAD
|
|
|
// bypass the ccs to the output. Only alu result needs to be bypassed
|
// bypass the ccs to the output. Only alu result needs to be bypassed
|
assign exu_ifu_cc_d[7:0] = (use_cc_e)? alu_cc_e[7:0]: partial_cc_d[7:0];
|
assign exu_ifu_cc_d[7:0] = (use_cc_e)? alu_cc_e[7:0]: partial_cc_d[7:0];
|
mux3ds #(8) mux_ccr_bypass1(.dout(partial_cc_d[7:0]),
|
mux3ds #(8) mux_ccr_bypass1(.dout(partial_cc_d[7:0]),
|
.sel0(use_ccr),
|
.sel0(use_ccr),
|