diff options
author | Joachim StroĢmbergson <joachim@secworks.se> | 2018-06-28 16:04:13 +0200 |
---|---|---|
committer | Joachim StroĢmbergson <joachim@secworks.se> | 2018-06-28 16:04:13 +0200 |
commit | 9e08b2d3f5cdcca969f13c2cacd4511693848d59 (patch) | |
tree | 3f22061a5e03383ffdf4da6a916092979fa21708 /src/rtl/keywrap.v | |
parent | 311ab5f3d9b9c6777e8d4377c6774f2c47cb577f (diff) |
Adding a lot of functionality. Starting to get everthing in place.
Diffstat (limited to 'src/rtl/keywrap.v')
-rw-r--r-- | src/rtl/keywrap.v | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/rtl/keywrap.v b/src/rtl/keywrap.v index b656299..41f3bd5 100644 --- a/src/rtl/keywrap.v +++ b/src/rtl/keywrap.v @@ -74,6 +74,8 @@ module keywrap( localparam CTRL_KEYLEN_BIT = 1; localparam ADDR_RLEN = 8'h0c; + localparam ADDR_A0 = 8'h0e; + localparam ADDR_A1 = 8'h0f; localparam ADDR_KEY0 = 8'h10; localparam ADDR_KEY7 = 8'h17; @@ -109,6 +111,12 @@ module keywrap( reg [12 : 0] rlen_reg; reg rlen_we; + reg [31 : 0] a0_reg; + reg a0_we; + + reg [31 : 0] a1_reg; + reg a1_we; + reg [31 : 0] key_reg [0 : 7]; reg key_we; @@ -126,6 +134,7 @@ module keywrap( wire core_valid; wire [255 : 0] core_key; wire [31 : 0] core_api_rd_data; + wire [63 : 0] core_a_result; //---------------------------------------------------------------- @@ -157,6 +166,9 @@ module keywrap( .key(core_key), .keylen(keylen_reg), + .a_init({a1_reg, a0_reg}), + .a_result(core_a_result), + .api_cs(api_cs_reg), .api_we(api_we_reg), .api_wr_data(write_data), @@ -185,6 +197,8 @@ module keywrap( ready_reg <= 1'h0; api_cs_reg <= 1'h0; api_we_reg <= 1'h0; + a0_reg <= 32'h0; + a1_reg <= 32'h0; end else begin @@ -204,6 +218,12 @@ module keywrap( if (rlen_we) rlen_reg <= write_data[12 : 0]; + if (a0_we) + a0_reg <= write_data; + + if (a1_we) + a1_reg <= write_data; + if (key_we) key_reg[address[2 : 0]] <= write_data; end @@ -224,6 +244,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; tmp_read_data = 32'h0; tmp_error = 1'h0; @@ -246,6 +268,12 @@ module keywrap( if ((address >= ADDR_KEY0) && (address <= ADDR_KEY7)) key_we = 1'h1; + if (ADDR_A0) + a0_we = 1'h1; + + if (ADDR_A1) + a1_we = 1'h1; + if (address == ADDR_WRITE_DATA) begin api_cs_new = 1'h1; @@ -267,6 +295,12 @@ module keywrap( end endcase // case (address) + if (ADDR_A0) + tmp_read_data = core_a_result[31 : 0]; + + if (ADDR_A1) + tmp_read_data = core_a_result[63 : 32]; + if (address == ADDR_READ_DATA) begin api_cs_new = 1'h1; |