From edb6018262d33f016bef7f7f740f1c7fac8db7b5 Mon Sep 17 00:00:00 2001 From: Paul Selkirk Date: Tue, 28 Apr 2020 12:06:29 -0400 Subject: Finally got integrate_mkmif working. Wired up mkey_key to allow the user to specify which key to use (MKM or user-provided key). Wired up mkm_wr_status so we can actually write the status word to MKM. Removed the reset initialization of mkmif_core, since that has its own auto-initialization. I might want to remove init as an input to keywrap_mkmif. Fixed a FSM state-transition write-enable, so it would actually transition states. Changed a 3-bit counter to 4 bits, so it can actually count to 8. And removed several bits of non-functional junk. --- src/rtl/keywrap_mkmif.v | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'src/rtl/keywrap_mkmif.v') diff --git a/src/rtl/keywrap_mkmif.v b/src/rtl/keywrap_mkmif.v index d73c5bd..d8aefb6 100644 --- a/src/rtl/keywrap_mkmif.v +++ b/src/rtl/keywrap_mkmif.v @@ -7,8 +7,9 @@ // // // Author: Joachim Strombergson -// Copyright (c) 2018, NORDUnet A/S -// All rights reserved. +// Copyright (c) 2018, NORDUnet A/S All rights reserved. +// Copyright: 2020, The Commons Conservancy Cryptech Project +// SPDX-License-Identifier: BSD-3-Clause // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -87,8 +88,8 @@ module keywrap_mkmif ( reg [31 : 0] key_reg [0 : 7]; reg key_we; - reg [2 : 0] key_word_ctr_reg; - reg [2 : 0] key_word_ctr_new; + reg [3 : 0] key_word_ctr_reg; + reg [3 : 0] key_word_ctr_new; reg key_word_ctr_we; reg key_word_ctr_rst; reg key_word_ctr_inc; @@ -127,7 +128,6 @@ module keywrap_mkmif ( wire mkm_ready; wire mkm_valid; reg [15 : 0] mkm_addr; - reg [31 : 0] mkm_write_data; wire [31 : 0] mkm_read_data; @@ -144,7 +144,7 @@ module keywrap_mkmif ( .spi_di(mkm_spi_di), .init_op(init_op_reg), - .read_op(read_op_reh), + .read_op(read_op_reg), .write_op(write_op_reg), .ready(mkm_ready), @@ -180,15 +180,15 @@ module keywrap_mkmif ( for (i = 0 ; i < 8 ; i = i + 1) key_reg[i] <= 32'h0; - ready_reg <= 1'h1; + ready_reg <= 1'h0; status_reg <= 32'h0; mkm_addr_reg <= 16'h0; mkm_write_data_reg <= 32'h0; - key_word_ctr_reg <= 3'h0; + key_word_ctr_reg <= 4'h0; init_op_reg <= 1'h0; read_op_reg <= 1'h0; write_op_reg <= 1'h0; - keywrap_mkmif_ctrl_reg <= CTRL_IDLE; + keywrap_mkmif_ctrl_reg <= CTRL_INIT; end else @@ -226,12 +226,12 @@ module keywrap_mkmif ( //---------------------------------------------------------------- always @* begin : key_word_ctr - key_word_ctr_new = 3'h0; + key_word_ctr_new = 4'h0; key_word_ctr_we = 1'h0; if (key_word_ctr_rst) begin - key_word_ctr_new = 3'h0; + key_word_ctr_new = 4'h0; key_word_ctr_we = 1'h1; end @@ -335,10 +335,6 @@ module keywrap_mkmif ( CTRL_READ_STATUS_WAIT: begin - ready_new = 1'h1; - ready_we = 1'h1; - keywrap_mkmif_ctrl_new = CTRL_IDLE; - keywrap_mkmif_ctrl_we = 1'h1; if (mkm_ready) begin status_we = 1'h1; -- cgit v1.2.3