[Cryptech-Commits] [core/util/keywrap] 16/37: Integrated new mkmif_core wrapper.
git at cryptech.is
git at cryptech.is
Wed Apr 29 16:51:52 UTC 2020
This is an automated email from the git hooks/post-receive script.
paul at psgd.org pushed a commit to branch master
in repository core/util/keywrap.
commit 4da2caadb9219e5126ef15ec133faa36e61049c8
Author: Joachim Strömbergson <joachim at secworks.se>
AuthorDate: Fri Sep 28 12:37:04 2018 +0200
Integrated new mkmif_core wrapper.
---
src/rtl/keywrap_core.v | 71 +++++++++++++++++--------------------------------
src/rtl/keywrap_mkmif.v | 22 +++++++--------
toolruns/Makefile | 4 +--
3 files changed, 35 insertions(+), 62 deletions(-)
diff --git a/src/rtl/keywrap_core.v b/src/rtl/keywrap_core.v
index 00e8391..533cc83 100644
--- a/src/rtl/keywrap_core.v
+++ b/src/rtl/keywrap_core.v
@@ -153,21 +153,6 @@ module keywrap_core #(parameter MEM_BITS = 11)
reg iteration_ctr_set;
reg iteration_ctr_rst;
- reg [31 : 0] mkm_key [0 : 7];
- reg mkm_key_we;
-
- reg [2 : 0] mkm_word_ctr_reg;
- reg [2 : 0] mkm_word_ctr_new;
- reg mkm_word_ctr_we;
-
- reg [7 : 0] mkm_addr_reg;
- reg [7 : 0] mkm_addr_new;
- reg mkm_addr_we;
-
- reg [31 : 0] mkm_status_reg;
- reg [31 : 0] mkm_status_new;
- reg mkm_status_we;
-
reg [5 : 0] keywrap_core_ctrl_reg;
reg [5 : 0] keywrap_core_ctrl_new;
reg keywrap_core_ctrl_we;
@@ -190,15 +175,14 @@ module keywrap_core #(parameter MEM_BITS = 11)
reg [63 : 0] core_wr_data;
wire [63 : 0] core_rd_data;
- reg mkm_init_op;
- reg mkm_read_op;
- reg mkm_write_op;
+ reg mkm_init;
+ reg mkm_read;
+ reg mkm_write;
+ reg mkm_key_status;
wire mkm_ready;
- wire mkm_valid;
- reg [15 : 0] mkm_sclk_div;
- reg [15 : 0] mkm_addr;
- reg [31 : 0] mkm_write_data;
- wire [31 : 0] mkm_read_data;
+ wire [255 : 0] mkm_key;
+ wire [31 : 0] mkm_rd_status;
+ wire [31 : 0] mkm_wr_status;
//----------------------------------------------------------------
@@ -239,27 +223,26 @@ module keywrap_core #(parameter MEM_BITS = 11)
);
- mkmif_core mkm(
- .clk(clk),
- .reset_n(reset_n),
-
- .spi_sclk(mkm_spi_sclk),
- .spi_cs_n(mkm_spi_cs_n),
- .spi_do(mkm_spi_do),
- .spi_di(mkm_spi_di),
+ keywrap_mkmif mkmif(
+ .clk(clk),
+ .reset_n(reset_n),
- .init_op(mkm_init_op),
- .read_op(mkm_read_op),
- .write_op(mkm_write_op),
+ .mkm_spi_sclk(mkm_spi_sclk),
+ .mkm_spi_cs_n(mkm_spi_cs_n),
+ .mkm_spi_do(mkm_spi_do),
+ .mkm_spi_di(mkm_spi_di),
- .ready(mkm_ready),
- .valid(mkm_valid),
+ .init(mkm_init),
+ .read(mkm_read),
+ .write(mkm_write),
+ .key_status(mkm_key_status),
+ .ready(mkm_ready),
- .sclk_div(mkm_sclk_div),
- .addr(mkm_addr),
- .write_data(mkm_write_data),
- .read_data(mkm_read_data)
- );
+ .wr_status(mkm_wr_status),
+ .rd_status(mkm_rd_status),
+ .wr_key(key),
+ .rd_key(mkm_key)
+ );
//----------------------------------------------------------------
@@ -280,17 +263,11 @@ module keywrap_core #(parameter MEM_BITS = 11)
if (!reset_n)
begin
- for (i = 0 ; i < 8 ; i = i + 1)
- mkm_key[i] <= 32'h0;
-
a_reg <= 64'h0;
ready_reg <= 1'h1;
valid_reg <= 1'h1;
block_ctr_reg <= {(MEM_BITS - 1){1'h0}};
iteration_ctr_reg <= 3'h0;
- mkm_word_ctr_reg <= 3'h0;
- mkm_addr_reg <= 8'h0;
- mkm_status_reg <= 32'h0;
keywrap_core_ctrl_reg <= CTRL_IDLE;
end
diff --git a/src/rtl/keywrap_mkmif.v b/src/rtl/keywrap_mkmif.v
index 0399a04..082173b 100644
--- a/src/rtl/keywrap_mkmif.v
+++ b/src/rtl/keywrap_mkmif.v
@@ -63,17 +63,13 @@ module keywrap_mkmif (
//----------------------------------------------------------------
// Paramenters and local defines.
//----------------------------------------------------------------
- localparam CTRL_IDLE = 4'h0;
- localparam CTRL_INIT_WAIT = 4'h1;
- localparam CTRL_NEXT_WSTART = 4'h2;
- localparam CTRL_NEXT_USTART = 4'h3;
- localparam CTRL_NEXT_LOOP0 = 4'h4;
- localparam CTRL_NEXT_LOOP = 4'h5;
- localparam CTRL_NEXT_WAIT = 4'h6;
- localparam CTRL_NEXT_UPDATE = 4'h7;
- localparam CTRL_NEXT_WCHECK = 4'h8;
- localparam CTRL_NEXT_UCHECK = 4'h9;
- localparam CTRL_NEXT_FINALIZE = 4'ha;
+ localparam CTRL_IDLE = 3'h0;
+ localparam CTRL_WAIT = 3'h1;
+ localparam CTRL_READ_STATUS_WAIT = 3'h2;
+ localparam CTRL_READ_KEY = 3'h3;
+ localparam CTRL_READ_KEY_WAIT = 3'h4;
+ localparam CTRL_WRITE_KEY = 3'h5;
+ localparam CTRL_WRITE_KEY_WAIT = 3'h6;
// Addresses for storage in the mkm
localparam MKM_STATUS_WORD = 16'h00;
@@ -110,8 +106,8 @@ module keywrap_mkmif (
reg ready_new;
reg ready_we;
- reg [3 : 0] keywrap_mkmif_ctrl_reg;
- reg [3 : 0] keywrap_mkmif_ctrl_new;
+ reg [2 : 0] keywrap_mkmif_ctrl_reg;
+ reg [2 : 0] keywrap_mkmif_ctrl_new;
reg keywrap_mkmif_ctrl_we;
diff --git a/toolruns/Makefile b/toolruns/Makefile
index 3ea00bd..4ca1d54 100755
--- a/toolruns/Makefile
+++ b/toolruns/Makefile
@@ -38,7 +38,7 @@
#===================================================================
MKMIF_PATH = ../../mkmif/src/rtl
-MKMIF_SRC = $(MKMIF_PATH)/mkmif.v $(MKMIF_PATH)/mkmif_core.v $(MKMIF_PATH)/mkmif_spi.v
+MKMIF_SRC = $(MKMIF_PATH)/mkmif_core.v $(MKMIF_PATH)/mkmif_spi.v
AES_PATH = ../../../../core/cipher/aes_speed/src/rtl
AES_SRC = $(AES_PATH)/aes_core.v $(AES_PATH)/aes_decipher_block.v $(AES_PATH)/aes_encipher_block.v $(AES_PATH)/aes_inv_sbox.v $(AES_PATH)/aes_key_mem.v $(AES_PATH)/aes_sbox.v
@@ -46,7 +46,7 @@ AES_SRC = $(AES_PATH)/aes_core.v $(AES_PATH)/aes_decipher_block.v $(AES_PATH)/ae
MEM_SRC = ../src/rtl/keywrap_mem.v
TB_MEM_SRC = ../src/tb/tb_keywrap_mem.v
-CORE_SRC = ../src/rtl/keywrap_core.v $(AES_SRC) $(MEM_SRC) $(MKMIF_SRC)
+CORE_SRC = ../src/rtl/keywrap_core.v ../src/rtl/keywrap_mkmif.v $(AES_SRC) $(MEM_SRC) $(MKMIF_SRC)
TB_CORE_SRC = ../src/tb/tb_keywrap_core.v
TOP_SRC = ../src/rtl/keywrap.v $(CORE_SRC)
More information about the Commits
mailing list