aboutsummaryrefslogtreecommitdiff
path: root/src/rtl/keywrap.v
diff options
context:
space:
mode:
Diffstat (limited to 'src/rtl/keywrap.v')
-rw-r--r--src/rtl/keywrap.v25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/rtl/keywrap.v b/src/rtl/keywrap.v
index 54bc547..edfd8c3 100644
--- a/src/rtl/keywrap.v
+++ b/src/rtl/keywrap.v
@@ -74,8 +74,8 @@ module keywrap(
localparam CTRL_KEYLEN_BIT = 1;
localparam ADDR_RLEN = 8'h0c;
- localparam ADDR_A_LSB = 8'h0e;
- localparam ADDR_A_MSB = 8'h0f;
+ localparam ADDR_A0 = 8'h0e;
+ localparam ADDR_A1 = 8'h0f;
localparam ADDR_KEY0 = 8'h10;
localparam ADDR_KEY7 = 8'h17;
@@ -133,6 +133,7 @@ module keywrap(
wire core_ready;
wire core_valid;
wire [255 : 0] core_key;
+ wire [63 : 0] core_a;
wire [31 : 0] core_api_rd_data;
wire [63 : 0] core_a_result;
@@ -146,6 +147,8 @@ module keywrap(
assign core_key = {key_reg[0], key_reg[1], key_reg[2], key_reg[3],
key_reg[4], key_reg[5], key_reg[6], key_reg[7]};
+ assign core_a = {a0_reg, a1_reg};
+
//----------------------------------------------------------------
// core instantiation.
@@ -166,7 +169,7 @@ module keywrap(
.key(core_key),
.keylen(keylen_reg),
- .a_init({a1_reg, a0_reg}),
+ .a_init(core_a),
.a_result(core_a_result),
.api_cs(api_cs_reg),
@@ -244,8 +247,8 @@ module keywrap(
key_we = 1'h0;
api_cs_new = 1'h0;
api_we_new = 1'h0;
- a0_we = 1'h1;
- a1_we = 1'h1;
+ a0_we = 1'h0;
+ a1_we = 1'h0;
tmp_read_data = 32'h0;
tmp_error = 1'h0;
@@ -265,10 +268,10 @@ module keywrap(
if (address == ADDR_RLEN)
config_we = 1'h1;
- if (address == ADDR_A_LSB)
+ if (address == ADDR_A0)
a0_we = 1'h1;
- if (address == ADDR_A_MSB)
+ if (address == ADDR_A1)
a1_we = 1'h1;
if ((address >= ADDR_KEY0) && (address <= ADDR_KEY7))
@@ -295,12 +298,12 @@ module keywrap(
end
endcase // case (address)
- if (address == ADDR_A_LSB)
- tmp_read_data = core_a_result[31 : 0];
-
- if (address == ADDR_A_MSB)
+ if (address == ADDR_A0)
tmp_read_data = core_a_result[63 : 32];
+ if (address == ADDR_A1)
+ tmp_read_data = core_a_result[31 : 0];
+
if (address == ADDR_READ_DATA)
begin
api_cs_new = 1'h1;