aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim StroĢˆmbergson <joachim@secworks.se>2018-04-03 10:28:31 +0200
committerJoachim StroĢˆmbergson <joachim@secworks.se>2018-04-03 10:28:31 +0200
commit285a7830994783cd04307e4274749a84123a26b5 (patch)
treeef92e0b5a22d13d8913c8269c3a72004e3e2cf63
parent59c53c4dfa6e13df616850355dc3fed3631de31f (diff)
Added second round state to allow for one cycle propagation of t1 in a future register.
-rw-r--r--src/rtl/sha512_core.v26
1 files 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