aboutsummaryrefslogtreecommitdiff
path: root/src/rtl
diff options
context:
space:
mode:
Diffstat (limited to 'src/rtl')
-rw-r--r--src/rtl/keywrap_core.v71
-rw-r--r--src/rtl/keywrap_mkmif.v22
2 files changed, 33 insertions, 60 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;