diff options
author | Joachim StroĢmbergson <joachim@secworks.se> | 2015-06-22 13:25:05 +0200 |
---|---|---|
committer | Joachim StroĢmbergson <joachim@secworks.se> | 2015-06-22 13:25:05 +0200 |
commit | 99f265001791aa8c58995fe1d8cfa1959f97de15 (patch) | |
tree | 9018b4aac3c8a0e9cbcee21a17670a391ac4a948 /src | |
parent | 747377fd9a6533695dbee9394e16ad4e0481f5b2 (diff) |
Removing stale states in FSM.
Diffstat (limited to 'src')
-rw-r--r-- | src/rtl/montprod.v | 52 | ||||
-rw-r--r-- | src/tb/tb_montprod.v | 12 |
2 files changed, 32 insertions, 32 deletions
diff --git a/src/rtl/montprod.v b/src/rtl/montprod.v index 5957c17..45b2792 100644 --- a/src/rtl/montprod.v +++ b/src/rtl/montprod.v @@ -65,21 +65,21 @@ module montprod( //---------------------------------------------------------------- localparam DEBUG = 0; - localparam CTRL_IDLE = 4'h0; - localparam CTRL_INIT_S = 4'h1; - localparam CTRL_WAIT = 4'h2; - localparam CTRL_LOOP_ITER = 4'h3; - localparam CTRL_LOOP_BQ = 4'h4; - localparam CTRL_L_CALC_SA = 4'h5; - localparam CTRL_L_STALLPIPE_SA = 4'h6; - localparam CTRL_L_CALC_SDIV2 = 4'h7; - localparam CTRL_L_STALLPIPE_D2 = 4'h8; - localparam CTRL_L_STALLPIPE_ES = 4'h9; - localparam CTRL_EMIT_S = 4'ha; - - localparam SMUX_0 = 2'h0; - localparam SMUX_ADD = 2'h1; - localparam SMUX_SHR = 2'h2; + localparam CTRL_IDLE = 4'h0; + localparam CTRL_INIT_S = 4'h1; + localparam CTRL_WAIT = 4'h2; + localparam CTRL_LOOP_ITER = 4'h3; + localparam CTRL_LOOP_BQ = 4'h4; + localparam CTRL_CALC_ADD = 4'h5; + localparam CTRL_STALLPIPE_ADD = 4'h6; + localparam CTRL_CALC_SDIV2 = 4'h7; + localparam CTRL_STALLPIPE_SDIV2 = 4'h8; + localparam CTRL_L_STALLPIPE_ES = 4'h9; + localparam CTRL_EMIT_S = 4'ha; + + localparam SMUX_0 = 2'h0; + localparam SMUX_ADD = 2'h1; + localparam SMUX_SHR = 2'h2; //---------------------------------------------------------------- @@ -317,7 +317,7 @@ module montprod( else if (reset_word_index_msw == 1'b1) word_index_new = 8'h0; - else if (montprod_ctrl_reg == CTRL_L_CALC_SDIV2) + else if (montprod_ctrl_reg == CTRL_CALC_SDIV2) word_index_new = word_index_reg + 1'b1; else @@ -345,13 +345,13 @@ module montprod( s_mem_we_new = 1'b1; end - CTRL_L_CALC_SA: + CTRL_CALC_ADD: begin //s = (s + q*M + b*A) >>> 1;, if(b==1) S+= A. Takes (1..length) cycles. s_mem_we_new = b_reg | q_reg | first_iteration_reg; end - CTRL_L_CALC_SDIV2: + CTRL_CALC_SDIV2: begin //s = (s + q*M + b*A) >>> 1; s>>=1. Takes (1..length) cycles. s_mem_we_new = 1'b1; @@ -513,11 +513,11 @@ module montprod( begin reset_word_index_lsw = 1'b1; bq_we = 1'b1; - montprod_ctrl_new = CTRL_L_CALC_SA; + montprod_ctrl_new = CTRL_CALC_ADD; montprod_ctrl_we = 1'b1; end - CTRL_L_CALC_SA: + CTRL_CALC_ADD: begin s_mux_new = SMUX_ADD; @@ -526,30 +526,30 @@ module montprod( reset_word_index_lsw = 1'b1; first_iteration_new = 1'b0; first_iteration_we = 1'b1; - montprod_ctrl_new = CTRL_L_STALLPIPE_SA; + montprod_ctrl_new = CTRL_STALLPIPE_ADD; montprod_ctrl_we = 1'b1; end end - CTRL_L_STALLPIPE_SA: + CTRL_STALLPIPE_ADD: begin - montprod_ctrl_new = CTRL_L_CALC_SDIV2; + montprod_ctrl_new = CTRL_CALC_SDIV2; montprod_ctrl_we = 1'b1; reset_word_index_msw = 1'b1; end - CTRL_L_CALC_SDIV2: + CTRL_CALC_SDIV2: begin s_mux_new = SMUX_SHR; if (word_index_reg == length_m1) begin - montprod_ctrl_new = CTRL_L_STALLPIPE_D2; + montprod_ctrl_new = CTRL_STALLPIPE_SDIV2; montprod_ctrl_we = 1'b1; end end - CTRL_L_STALLPIPE_D2: + CTRL_STALLPIPE_SDIV2: begin loop_ctr_dec = 1'b1; montprod_ctrl_new = CTRL_LOOP_ITER; diff --git a/src/tb/tb_montprod.v b/src/tb/tb_montprod.v index 850f8d9..5e0a015 100644 --- a/src/tb/tb_montprod.v +++ b/src/tb/tb_montprod.v @@ -247,12 +247,12 @@ module tb_montprod(); $display("FSM: LOOP_ITER"); dut.CTRL_LOOP_BQ: $display("FSM: LOOP_BQ"); - dut.CTRL_L_CALC_SA: - $display("FSM: LOOP_CALC_SA"); - dut.CTRL_L_STALLPIPE_SA: - $display("FSM: STALL_PIPE"); - dut.CTRL_L_CALC_SDIV2: - $display("FSM: LOOP_CALC_SDIV2"); + dut.CTRL_CALC_ADD: + $display("FSM: LOOP_CALC_ADD"); + dut.CTRL_STALLPIPE_ADD: + $display("FSM: STALL_PIPE_ADD"); + dut.CTRL_CALC_SDIV2: + $display("FSM: CALC_SDIV2"); dut.CTRL_EMIT_S: $display("FSM: LOOP_EMIT_S"); default: |