aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoachim StroĢˆmbergson <joachim@secworks.se>2018-05-21 17:45:48 +0200
committerJoachim StroĢˆmbergson <joachim@secworks.se>2018-05-21 17:45:48 +0200
commitb25a4d4dcc274d791cf7997eb88fcedc395c8a6f (patch)
treeb1a837b35c0b2d11d985aeac7d38df2b8bb5bf7f /src
parent5bf8bd4db261c9823f0e80f6771f3e635c5cbb90 (diff)
Removed the sword counter since it is not needed.
Diffstat (limited to 'src')
-rw-r--r--src/rtl/aes_encipher_block.v41
-rw-r--r--src/tb/tb_aes_encipher_block.v4
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;
@@ -347,29 +337,6 @@ module aes_encipher_block(
//----------------------------------------------------------------
- // 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
//
// The round counter with reset and increase logic.
@@ -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");