diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/rtl/sha512_core.v | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/src/rtl/sha512_core.v b/src/rtl/sha512_core.v index 1b50a6f..43ece2b 100644 --- a/src/rtl/sha512_core.v +++ b/src/rtl/sha512_core.v @@ -82,8 +82,8 @@ module sha512_core( parameter SHA512_ROUNDS = 79; parameter CTRL_IDLE = 0; - parameter CTRL_ROUNDS1 = 1; - parameter CTRL_ROUNDS2 = 2; + parameter CTRL_T1_T2 = 1; + parameter CTRL_ROUNDS = 2; parameter CTRL_DONE = 3; @@ -110,10 +110,9 @@ module sha512_core( reg [63 : 0] t1_reg; reg [63 : 0] t1_new; - reg t1_we; reg [63 : 0] t2_reg; reg [63 : 0] t2_new; - reg t2_we; + reg t1_t2_we; reg [63 : 0] H0_reg; reg [63 : 0] H0_new; @@ -265,11 +264,11 @@ module sha512_core( end else begin - if (t1_we) - t1_reg <= t1_new; - - if (t2_we) - t2_reg <= t2_new; + if (t1_t2_we) + begin + t1_reg <= t1_new; + t2_reg <= t2_new; + end if (a_h_we) begin @@ -579,8 +578,7 @@ module sha512_core( state_init = 0; state_update = 0; - t1_we = 1; - t2_we = 1; + t1_t2_we = 0; first_block = 0; ready_flag = 0; @@ -616,7 +614,7 @@ module sha512_core( round_ctr_rst = 1; digest_valid_new = 0; digest_valid_we = 1; - sha512_ctrl_new = CTRL_ROUNDS1; + sha512_ctrl_new = CTRL_T1_T2; sha512_ctrl_we = 1; end @@ -628,20 +626,21 @@ module sha512_core( round_ctr_rst = 1; digest_valid_new = 0; digest_valid_we = 1; - sha512_ctrl_new = CTRL_ROUNDS1; + sha512_ctrl_new = CTRL_T1_T2; sha512_ctrl_we = 1; end end - CTRL_ROUNDS1: + CTRL_T1_T2: begin - sha512_ctrl_new = CTRL_ROUNDS2; + t1_t2_we = 1; + sha512_ctrl_new = CTRL_ROUNDS; sha512_ctrl_we = 1; end - CTRL_ROUNDS2: + CTRL_ROUNDS: begin w_next = 1; state_update = 1; @@ -664,7 +663,7 @@ module sha512_core( w_init = 1; state_init = 1; round_ctr_rst = 1; - sha512_ctrl_new = CTRL_ROUNDS1; + sha512_ctrl_new = CTRL_T1_T2; sha512_ctrl_we = 1; end else |