diff options
Diffstat (limited to 'src/rtl/sha1_core.v')
-rw-r--r-- | src/rtl/sha1_core.v | 74 |
1 files changed, 31 insertions, 43 deletions
diff --git a/src/rtl/sha1_core.v b/src/rtl/sha1_core.v index beb0cbd..e38da3b 100644 --- a/src/rtl/sha1_core.v +++ b/src/rtl/sha1_core.v @@ -67,8 +67,7 @@ module sha1_core( parameter CTRL_IDLE = 0; parameter CTRL_ROUNDS = 1; - parameter CTRL_DIGEST = 2; - parameter CTRL_DONE = 3; + parameter CTRL_DONE = 2; //---------------------------------------------------------------- @@ -161,18 +160,18 @@ module sha1_core( begin : reg_update if (!reset_n) begin - a_reg <= 32'h00000000; - b_reg <= 32'h00000000; - c_reg <= 32'h00000000; - d_reg <= 32'h00000000; - e_reg <= 32'h00000000; - H0_reg <= 32'h00000000; - H1_reg <= 32'h00000000; - H2_reg <= 32'h00000000; - H3_reg <= 32'h00000000; - H4_reg <= 32'h00000000; + a_reg <= 32'h0; + b_reg <= 32'h0; + c_reg <= 32'h0; + d_reg <= 32'h0; + e_reg <= 32'h0; + H0_reg <= 32'h0; + H1_reg <= 32'h0; + H2_reg <= 32'h0; + H3_reg <= 32'h0; + H4_reg <= 32'h0; digest_valid_reg <= 0; - round_ctr_reg <= 7'b0000000; + round_ctr_reg <= 7'b0; sha1_ctrl_reg <= CTRL_IDLE; end else @@ -196,19 +195,13 @@ module sha1_core( end if (round_ctr_we) - begin - round_ctr_reg <= round_ctr_new; - end + round_ctr_reg <= round_ctr_new; if (digest_valid_we) - begin - digest_valid_reg <= digest_valid_new; - end + digest_valid_reg <= digest_valid_new; if (sha1_ctrl_we) - begin - sha1_ctrl_reg <= sha1_ctrl_new; - end + sha1_ctrl_reg <= sha1_ctrl_new; end end // reg_update @@ -220,11 +213,11 @@ module sha1_core( //---------------------------------------------------------------- always @* begin : digest_logic - H0_new = 32'h00000000; - H1_new = 32'h00000000; - H2_new = 32'h00000000; - H3_new = 32'h00000000; - H4_new = 32'h00000000; + H0_new = 32'h0; + H1_new = 32'h0; + H2_new = 32'h0; + H3_new = 32'h0; + H4_new = 32'h0; H_we = 0; if (digest_init) @@ -262,15 +255,15 @@ module sha1_core( reg [31 : 0] k; reg [31 : 0] t; - a5 = 32'h00000000; - f = 32'h00000000; - k = 32'h00000000; - t = 32'h00000000; - a_new = 32'h00000000; - b_new = 32'h00000000; - c_new = 32'h00000000; - d_new = 32'h00000000; - e_new = 32'h00000000; + a5 = 32'h0; + f = 32'h0; + k = 32'h0; + t = 32'h0; + a_new = 32'h0; + b_new = 32'h0; + c_new = 32'h0; + d_new = 32'h0; + e_new = 32'h0; a_e_we = 0; if (state_init) @@ -416,20 +409,15 @@ module sha1_core( if (round_ctr_reg == SHA1_ROUNDS) begin - sha1_ctrl_new = CTRL_DIGEST; + sha1_ctrl_new = CTRL_DONE; sha1_ctrl_we = 1; end end - CTRL_DIGEST: - begin - digest_update = 1; - sha1_ctrl_new = CTRL_DONE; - sha1_ctrl_we = 1; - end CTRL_DONE: begin + digest_update = 1; digest_valid_new = 1; digest_valid_we = 1; sha1_ctrl_new = CTRL_IDLE; |