diff options
author | Joachim StroĢmbergson <joachim@secworks.se> | 2018-05-21 17:57:42 +0200 |
---|---|---|
committer | Joachim StroĢmbergson <joachim@secworks.se> | 2018-05-21 17:57:42 +0200 |
commit | 8d0777b9f58efdc57fe9f2caa75b0ee6e2aae7b1 (patch) | |
tree | 4ce8ad6f50ee2bda045844a075b2c38bd33fc01f /src/rtl/aes_key_mem.v | |
parent | ac77ca2bfe6d184c13da7ba90e8276ed0fc35765 (diff) |
Moved the Sbox used for key expansion into the key_mem.
Diffstat (limited to 'src/rtl/aes_key_mem.v')
-rw-r--r-- | src/rtl/aes_key_mem.v | 18 |
1 files changed, 10 insertions, 8 deletions
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; |