[Cryptech-Commits] [core/cipher/aes] 07/21: Moved the Sbox used for key expansion into the key_mem.
git at cryptech.is
git at cryptech.is
Thu Jan 10 11:53:55 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 577a8c7e86164f02f81985ffb890963b241278a5
Author: Joachim Strömbergson <joachim at secworks.se>
AuthorDate: Mon May 21 17:57:42 2018 +0200
Moved the Sbox used for key expansion into the key_mem.
---
src/rtl/aes_core.v | 7 +------
src/rtl/aes_key_mem.v | 18 ++++++++++--------
src/tb/tb_aes_key_mem.v | 11 +----------
3 files changed, 12 insertions(+), 24 deletions(-)
diff --git a/src/rtl/aes_core.v b/src/rtl/aes_core.v
index 7c5720d..b74fdc4 100644
--- a/src/rtl/aes_core.v
+++ b/src/rtl/aes_core.v
@@ -154,15 +154,10 @@ module aes_core(
.round(muxed_round_nr),
.round_key(round_key),
- .ready(key_ready),
-
- .sboxw(keymem_sboxw),
- .new_sboxw(new_sboxw)
+ .ready(key_ready)
);
- aes_sbox sbox_inst(.sboxw(keymem_sboxw), .new_sboxw(new_sboxw));
-
//----------------------------------------------------------------
// Concurrent connectivity for ports etc.
diff --git a/src/rtl/aes_key_mem.v b/src/rtl/aes_key_mem.v
index 496fc08..e3aec4b 100644
--- a/src/rtl/aes_key_mem.v
+++ b/src/rtl/aes_key_mem.v
@@ -47,11 +47,7 @@ module aes_key_mem(
input wire [3 : 0] round,
output wire [127 : 0] round_key,
- output wire ready,
-
-
- output wire [31 : 0] sboxw,
- input wire [31 : 0] new_sboxw
+ output wire ready
);
@@ -109,7 +105,8 @@ module aes_key_mem(
//----------------------------------------------------------------
// Wires.
//----------------------------------------------------------------
- reg [31 : 0] tmp_sboxw;
+ reg [31 : 0] sboxw;
+ wire [31 : 0] new_sboxw;
reg round_key_update;
reg [3 : 0] num_rounds;
@@ -122,7 +119,12 @@ module aes_key_mem(
//----------------------------------------------------------------
assign round_key = tmp_round_key;
assign ready = ready_reg;
- assign sboxw = tmp_sboxw;
+
+
+ //----------------------------------------------------------------
+ // S-box for key expansion.
+ //----------------------------------------------------------------
+ aes_sbox sbox_inst(.sboxw(sboxw), .new_sboxw(new_sboxw));
//----------------------------------------------------------------
@@ -223,7 +225,7 @@ module aes_key_mem(
w7 = prev_key1_reg[031 : 000];
rconw = {rcon_reg, 24'h0};
- tmp_sboxw = w7;
+ sboxw = w7;
rotstw = {new_sboxw[23 : 00], new_sboxw[31 : 24]};
trw = rotstw ^ rconw;
tw = new_sboxw;
diff --git a/src/tb/tb_aes_key_mem.v b/src/tb/tb_aes_key_mem.v
index cac216a..b76fb64 100644
--- a/src/tb/tb_aes_key_mem.v
+++ b/src/tb/tb_aes_key_mem.v
@@ -78,9 +78,6 @@ module tb_aes_key_mem();
wire [127 : 0] tb_round_key;
wire tb_ready;
- wire [31 : 0] tb_sboxw;
- wire [31 : 0] tb_new_sboxw;
-
//----------------------------------------------------------------
// Device Under Test.
@@ -95,15 +92,9 @@ module tb_aes_key_mem();
.round(tb_round),
.round_key(tb_round_key),
- .ready(tb_ready),
-
- .sboxw(tb_sboxw),
- .new_sboxw(tb_new_sboxw)
+ .ready(tb_ready)
);
- // The DUT requirees Sboxes.
- aes_sbox sbox(.sboxw(tb_sboxw), .new_sboxw(tb_new_sboxw));
-
//----------------------------------------------------------------
// clk_gen
More information about the Commits
mailing list