[Cryptech-Commits] [core/cipher/aes] 05/20: Removed the sword counter since it is not needed.

git at cryptech.is git at cryptech.is
Thu Jan 10 15:56:53 UTC 2019


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

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

commit 4d360294fd9deea928ba2e1e2d42be4406156f87
Author: Joachim Strömbergson <joachim at secworks.se>
AuthorDate: Mon May 21 17:45:48 2018 +0200

    Removed the sword counter since it is not needed.
---
 src/rtl/aes_encipher_block.v   | 41 ++---------------------------------------
 src/tb/tb_aes_encipher_block.v |  4 ++--
 2 files changed, 4 insertions(+), 41 deletions(-)

diff --git a/src/rtl/aes_encipher_block.v b/src/rtl/aes_encipher_block.v
index c1961bd..c3e672c 100644
--- a/src/rtl/aes_encipher_block.v
+++ b/src/rtl/aes_encipher_block.v
@@ -159,12 +159,6 @@ module aes_encipher_block(
   //----------------------------------------------------------------
   // Registers including update variables and write enable.
   //----------------------------------------------------------------
-  reg [1 : 0]   sword_ctr_reg;
-  reg [1 : 0]   sword_ctr_new;
-  reg           sword_ctr_we;
-  reg           sword_ctr_inc;
-  reg           sword_ctr_rst;
-
   reg [3 : 0]   round_ctr_reg;
   reg [3 : 0]   round_ctr_new;
   reg           round_ctr_we;
@@ -239,7 +233,6 @@ module aes_encipher_block(
           block_w1_reg  <= 32'h0;
           block_w2_reg  <= 32'h0;
           block_w3_reg  <= 32'h0;
-          sword_ctr_reg <= 2'h0;
           round_ctr_reg <= 4'h0;
           ready_reg     <= 1'b1;
           enc_ctrl_reg  <= CTRL_IDLE;
@@ -258,9 +251,6 @@ module aes_encipher_block(
           if (block_w3_we)
             block_w3_reg <= block_new[031 : 000];
 
-          if (sword_ctr_we)
-            sword_ctr_reg <= sword_ctr_new;
-
           if (round_ctr_we)
             round_ctr_reg <= round_ctr_new;
 
@@ -346,29 +336,6 @@ module aes_encipher_block(
     end // round_logic
 
 
-  //----------------------------------------------------------------
-  // sword_ctr
-  //
-  // The subbytes word counter with reset and increase logic.
-  //----------------------------------------------------------------
-  always @*
-    begin : sword_ctr
-      sword_ctr_new = 2'h0;
-      sword_ctr_we  = 1'b0;
-
-      if (sword_ctr_rst)
-        begin
-          sword_ctr_new = 2'h0;
-          sword_ctr_we  = 1'b1;
-        end
-      else if (sword_ctr_inc)
-        begin
-          sword_ctr_new = sword_ctr_reg + 1'b1;
-          sword_ctr_we  = 1'b1;
-        end
-    end // sword_ctr
-
-
   //----------------------------------------------------------------
   // round_ctr
   //
@@ -402,13 +369,9 @@ module aes_encipher_block(
       reg [3 : 0]  num_rounds;
 
       if (keylen == AES_256_BIT_KEY)
-        begin
-          num_rounds = AES256_ROUNDS;
-        end
+        num_rounds = AES256_ROUNDS;
       else
-        begin
-          num_rounds = AES128_ROUNDS;
-        end
+        num_rounds = AES128_ROUNDS;
 
       round_ctr_inc = 1'b0;
       round_ctr_rst = 1'b0;
diff --git a/src/tb/tb_aes_encipher_block.v b/src/tb/tb_aes_encipher_block.v
index 68e88dd..cc08d8e 100644
--- a/src/tb/tb_aes_encipher_block.v
+++ b/src/tb/tb_aes_encipher_block.v
@@ -166,8 +166,8 @@ module tb_aes_encipher_block();
 
       $display("Control states");
       $display("round = 0x%01x", dut.round);
-      $display("enc_ctrl = 0x%01x, update_type = 0x%01x, sword_ctr = 0x%01x, round_ctr = 0x%01x",
-               dut.enc_ctrl_reg, dut.update_type, dut.sword_ctr_reg, dut.round_ctr_reg);
+      $display("enc_ctrl = 0x%01x, update_type = 0x%01x, round_ctr = 0x%01x",
+               dut.enc_ctrl_reg, dut.update_type, dut.round_ctr_reg);
       $display("");
 
       $display("Internal data values");



More information about the Commits mailing list