[Cryptech-Commits] [core/hash/sha512] 01/01: Added second round state to allow for one cycle propagation of t1 in a future register.

git at cryptech.is git at cryptech.is
Tue Apr 3 08:29:15 UTC 2018


This is an automated email from the git hooks/post-receive script.

joachim at secworks.se pushed a commit to branch clock_speed
in repository core/hash/sha512.

commit 285a7830994783cd04307e4274749a84123a26b5
Author: Joachim Strömbergson <joachim at secworks.se>
AuthorDate: Tue Apr 3 10:28:31 2018 +0200

    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



More information about the Commits mailing list