[Cryptech-Commits] [core/cipher/aes] 14/21: Minor cleanup of states and register sizes.

git at cryptech.is git at cryptech.is
Thu Jan 10 11:54:02 UTC 2019


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

sra at hactrn.net pushed a commit to branch master
in repository core/cipher/aes.

commit 59c5def2740e91def5626fc91ff6fca072ecc748
Author: Joachim Strömbergson <joachim at secworks.se>
AuthorDate: Tue May 22 13:06:00 2018 +0200

    Minor cleanup of states and register sizes.
---
 src/rtl/aes_decipher_block.v | 22 ++++++++++------------
 src/rtl/aes_encipher_block.v | 22 ++++++++++------------
 2 files changed, 20 insertions(+), 24 deletions(-)

diff --git a/src/rtl/aes_decipher_block.v b/src/rtl/aes_decipher_block.v
index ce34cc8..b62065c 100644
--- a/src/rtl/aes_decipher_block.v
+++ b/src/rtl/aes_decipher_block.v
@@ -64,16 +64,14 @@ module aes_decipher_block(
   localparam AES128_ROUNDS = 4'ha;
   localparam AES256_ROUNDS = 4'he;
 
-  localparam NO_UPDATE    = 3'h0;
-  localparam INIT_UPDATE  = 3'h1;
-  localparam SBOX_UPDATE  = 3'h2;
-  localparam MAIN_UPDATE  = 3'h3;
-  localparam FINAL_UPDATE = 3'h4;
+  localparam NO_UPDATE    = 2'h0;
+  localparam INIT_UPDATE  = 2'h1;
+  localparam MAIN_UPDATE  = 2'h2;
+  localparam FINAL_UPDATE = 2'h3;
 
-  localparam CTRL_IDLE  = 3'h0;
-  localparam CTRL_INIT  = 3'h1;
-  localparam CTRL_MAIN  = 3'h2;
-  localparam CTRL_FINAL = 3'h3;
+  localparam CTRL_IDLE  = 2'h0;
+  localparam CTRL_INIT  = 2'h1;
+  localparam CTRL_MAIN  = 2'h2;
 
 
   //----------------------------------------------------------------
@@ -205,8 +203,8 @@ module aes_decipher_block(
   reg           ready_new;
   reg           ready_we;
 
-  reg [2 : 0]   dec_ctrl_reg;
-  reg [2 : 0]   dec_ctrl_new;
+  reg [1 : 0]   dec_ctrl_reg;
+  reg [1 : 0]   dec_ctrl_new;
   reg           dec_ctrl_we;
 
 
@@ -221,7 +219,7 @@ module aes_decipher_block(
   wire [31 : 0] new_sboxw1;
   wire [31 : 0] new_sboxw2;
   wire [31 : 0] new_sboxw3;
-  reg [2 : 0]   update_type;
+  reg [1 : 0]   update_type;
 
 
   //----------------------------------------------------------------
diff --git a/src/rtl/aes_encipher_block.v b/src/rtl/aes_encipher_block.v
index 8cac95f..f98d755 100644
--- a/src/rtl/aes_encipher_block.v
+++ b/src/rtl/aes_encipher_block.v
@@ -64,16 +64,14 @@ module aes_encipher_block(
   localparam AES128_ROUNDS = 4'ha;
   localparam AES256_ROUNDS = 4'he;
 
-  localparam NO_UPDATE    = 3'h0;
-  localparam INIT_UPDATE  = 3'h1;
-  localparam MAIN_UPDATE  = 3'h2;
-  localparam FINAL_UPDATE = 3'h3;
+  localparam NO_UPDATE    = 2'h0;
+  localparam INIT_UPDATE  = 2'h1;
+  localparam MAIN_UPDATE  = 2'h2;
+  localparam FINAL_UPDATE = 2'h3;
 
-  localparam CTRL_IDLE  = 3'h0;
-  localparam CTRL_INIT  = 3'h1;
-  localparam CTRL_SBOX  = 3'h2;
-  localparam CTRL_MAIN  = 3'h3;
-  localparam CTRL_FINAL = 3'h4;
+  localparam CTRL_IDLE  = 2'h0;
+  localparam CTRL_INIT  = 2'h1;
+  localparam CTRL_MAIN  = 2'h2;
 
 
   //----------------------------------------------------------------
@@ -169,15 +167,15 @@ module aes_encipher_block(
   reg           ready_new;
   reg           ready_we;
 
-  reg [2 : 0]   enc_ctrl_reg;
-  reg [2 : 0]   enc_ctrl_new;
+  reg [1 : 0]   enc_ctrl_reg;
+  reg [1 : 0]   enc_ctrl_new;
   reg           enc_ctrl_we;
 
 
   //----------------------------------------------------------------
   // Wires.
   //----------------------------------------------------------------
-  reg [2 : 0]  update_type;
+  reg [1 : 0]  update_type;
 
   reg [31 : 0] sboxw0;
   reg [31 : 0] sboxw1;



More information about the Commits mailing list