diff options
Diffstat (limited to 'rtl/modexpng_recombinator_block.v')
-rw-r--r-- | rtl/modexpng_recombinator_block.v | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/rtl/modexpng_recombinator_block.v b/rtl/modexpng_recombinator_block.v index f6e23e5..cc89db0 100644 --- a/rtl/modexpng_recombinator_block.v +++ b/rtl/modexpng_recombinator_block.v @@ -499,7 +499,7 @@ module modexpng_recombinator_block reg [ 2:0] rcmb_xy_lsb_ce_purge = 3'b000; wire rcmb_xy_lsb_ce_combined = rcmb_xy_lsb_ce | rcmb_xy_lsb_ce_aux | rcmb_xy_lsb_ce_purge[0]; reg rcmb_xy_lsb_clr; - wire rcmb_xy_lsb_cry = !rcmb_xy_lsb_ce_purge[2] && (rcmb_xy_lsb_ce_purge[1] || rcmb_xy_lsb_ce_purge[0]); + wire rcmb_xy_lsb_cry = !xy_valid_latch_lsb && rcmb_xy_lsb_ce_purge[1]; reg [ MAC_W -1:0] rcmb_x_lsb_din; reg [ MAC_W -1:0] rcmb_y_lsb_din; @@ -523,8 +523,6 @@ module modexpng_recombinator_block .clk (clk), .ce (rcmb_xy_lsb_ce_combined), .clr (rcmb_xy_lsb_clr), - .cry (rcmb_xy_lsb_cry), - .cin (rcmb_x_msb_carry_1), .din (rcmb_x_lsb_din), .dout (rcmb_x_lsb_dout), .dout_ext (rcmb_x_lsb_dout_ext) @@ -534,8 +532,6 @@ module modexpng_recombinator_block .clk (clk), .ce (rcmb_xy_lsb_ce_combined), .clr (rcmb_xy_lsb_clr), - .cry (rcmb_xy_lsb_cry), - .cin (rcmb_y_msb_carry_1), .din (rcmb_y_lsb_din), .dout (rcmb_y_lsb_dout), .dout_ext (rcmb_y_lsb_dout_ext) @@ -546,20 +542,15 @@ module modexpng_recombinator_block .clk (clk), .ce (rcmb_xy_msb_ce_combined), .clr (rcmb_xy_msb_clr), - .cry (1'b0), - .cin (WORD_ZERO), .din (rcmb_x_msb_din), .dout (rcmb_x_msb_dout), .dout_ext () ); - modexpng_recombinator_cell recomb_y_msb ( .clk (clk), .ce (rcmb_xy_msb_ce_combined), .clr (rcmb_xy_msb_clr), - .cry (1'b0), - .cin (WORD_ZERO), .din (rcmb_y_msb_din), .dout (rcmb_y_msb_dout), .dout_ext () @@ -597,6 +588,9 @@ module modexpng_recombinator_block end else if (xy_aux_latch_lsb) begin rcmb_x_lsb_din <= dsp_x_p_latch[NUM_MULTS_AUX-1]; rcmb_y_lsb_din <= dsp_y_p_latch[NUM_MULTS_AUX-1]; + end else if (rcmb_xy_lsb_cry) begin + rcmb_x_lsb_din <= rcmb_x_msb_carry_1; + rcmb_y_lsb_din <= rcmb_y_msb_carry_1; end else begin rcmb_x_lsb_din <= {MAC_W{1'b0}}; rcmb_y_lsb_din <= {MAC_W{1'b0}}; @@ -891,16 +885,26 @@ module modexpng_recombinator_block end endtask - task shift_rcmb_msb_carry; + task _update_rcmb_msb_carry; input [WORD_W -1:0] dout_x; input [WORD_W -1:0] dout_y; begin rcmb_x_msb_carry_0 <= dout_x; rcmb_y_msb_carry_0 <= dout_y; rcmb_x_msb_carry_1 <= rcmb_x_msb_carry_0; - rcmb_y_msb_carry_1 <= rcmb_y_msb_carry_0; + rcmb_y_msb_carry_1 <= rcmb_y_msb_carry_0; end endtask + + task push_rcmb_msb_carry; + input [WORD_W -1:0] dout_x; + input [WORD_W -1:0] dout_y; + _update_rcmb_msb_carry(dout_x, dout_y); + endtask + + task pop_rcmb_msb_carry; + _update_rcmb_msb_carry(WORD_DNC, WORD_DNC); + endtask task _update_wide; input [BANK_ADDR_W -1:0] bank; @@ -1057,7 +1061,7 @@ module modexpng_recombinator_block // // Handy Signal // - wire [1:0] rcmb_xy_valid = {rcmb_xy_msb_valid, rcmb_xy_lsb_valid}; + wire [1:0] rcmb_xy_valid = {rcmb_xy_msb_valid, rcmb_xy_lsb_valid}; // @@ -1095,13 +1099,11 @@ module modexpng_recombinator_block // 2'b00: if (rcmb_msb_flag_delay_2) advance_rcmb_msb_delay(WORD_DNC, WORD_DNC, OP_ADDR_ZERO, 1'b0); // - 2'b01: if (rcmb_xy_lsb_cry) shift_rcmb_msb_carry(WORD_DNC, WORD_DNC); + 2'b01: if (rcmb_xy_lsb_cry) pop_rcmb_msb_carry; // - 2'b10: if (cnt_msb < OP_ADDR_TWO) shift_rcmb_msb_carry(rcmb_x_msb_dout, rcmb_y_msb_dout); + 2'b10: if (cnt_msb < OP_ADDR_TWO) push_rcmb_msb_carry(rcmb_x_msb_dout, rcmb_y_msb_dout); // - 2'b11: begin advance_rcmb_msb_delay(rcmb_x_msb_dout, rcmb_y_msb_dout, cnt_msb, 1'b1); - if (rcmb_xy_lsb_cry) shift_rcmb_msb_carry(WORD_DNC, WORD_DNC); - end + 2'b11: advance_rcmb_msb_delay(rcmb_x_msb_dout, rcmb_y_msb_dout, cnt_msb, 1'b1); // endcase // @@ -1173,10 +1175,10 @@ module modexpng_recombinator_block // 2'b00: if (rcmb_msb_flag_delay_2) advance_rcmb_msb_delay(WORD_DNC, WORD_DNC, OP_ADDR_ZERO, 1'b0); // - 2'b01: if (rcmb_xy_lsb_cry) shift_rcmb_msb_carry(WORD_DNC, WORD_DNC); + 2'b01: if (rcmb_xy_lsb_cry) pop_rcmb_msb_carry; // 2'b10: begin - if ((cnt_msb < OP_ADDR_TWO) && !cnt_msb_wrapped) shift_rcmb_msb_carry(rcmb_x_msb_dout, rcmb_y_msb_dout); + if ((cnt_msb < OP_ADDR_TWO) && !cnt_msb_wrapped) push_rcmb_msb_carry(rcmb_x_msb_dout, rcmb_y_msb_dout); if (cnt_msb_wrapped) advance_rcmb_msb_delay(WORD_DNC, WORD_DNC, OP_ADDR_ZERO, 1'b0); end // |