From 285a7830994783cd04307e4274749a84123a26b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joachim=20Stro=CC=88mbergson?= Date: Tue, 3 Apr 2018 10:28:31 +0200 Subject: Added second round state to allow for one cycle propagation of t1 in a future register. --- src/rtl/sha512_core.v | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/rtl/sha512_core.v b/src/rtl/sha512_core.v index 03408c1..9454f40 100644 --- a/src/rtl/sha512_core.v +++ b/src/rtl/sha512_core.v @@ -81,9 +81,10 @@ module sha512_core( //---------------------------------------------------------------- parameter SHA512_ROUNDS = 79; - parameter CTRL_IDLE = 0; - parameter CTRL_ROUNDS = 1; - parameter CTRL_DONE = 2; + parameter CTRL_IDLE = 0; + parameter CTRL_ROUNDS1 = 1; + parameter CTRL_ROUNDS2 = 2; + parameter CTRL_DONE = 3; //---------------------------------------------------------------- @@ -258,7 +259,6 @@ module sha512_core( end else begin - if (a_h_we) begin a_reg <= a_new; @@ -567,6 +567,7 @@ module sha512_core( state_init = 0; state_update = 0; + t1_we = 0; first_block = 0; ready_flag = 0; @@ -602,7 +603,7 @@ module sha512_core( t_ctr_rst = 1; digest_valid_new = 0; digest_valid_we = 1; - sha512_ctrl_new = CTRL_ROUNDS; + sha512_ctrl_new = CTRL_ROUNDS1; sha512_ctrl_we = 1; end @@ -614,13 +615,21 @@ module sha512_core( t_ctr_rst = 1; digest_valid_new = 0; digest_valid_we = 1; - sha512_ctrl_new = CTRL_ROUNDS; + sha512_ctrl_new = CTRL_ROUNDS1; sha512_ctrl_we = 1; end end - CTRL_ROUNDS: + CTRL_ROUNDS1: + begin + t1_we = 1; + sha512_ctrl_new = CTRL_ROUNDS2; + sha512_ctrl_we = 1; + end + + + CTRL_ROUNDS2: begin w_next = 1; state_update = 1; @@ -634,7 +643,6 @@ module sha512_core( end end - CTRL_DONE: begin if (work_factor) @@ -644,7 +652,7 @@ module sha512_core( w_init = 1; state_init = 1; t_ctr_rst = 1; - sha512_ctrl_new = CTRL_ROUNDS; + sha512_ctrl_new = CTRL_ROUNDS1; sha512_ctrl_we = 1; end else -- cgit v1.2.3