aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rtl/keywrap_core.v46
-rw-r--r--src/tb/tb_keywrap.v29
2 files changed, 32 insertions, 43 deletions
diff --git a/src/rtl/keywrap_core.v b/src/rtl/keywrap_core.v
index 5a6f953..b084363 100644
--- a/src/rtl/keywrap_core.v
+++ b/src/rtl/keywrap_core.v
@@ -460,32 +460,30 @@ module keywrap_core #(parameter MEM_BITS = 11)
key_timeout_ctr_dec = 1'h1;
end
end
- else
+
+ if (init)
begin
- if (init)
- begin
- aes_init = 1'h1;
- ready_new = 1'h0;
- ready_we = 1'h1;
- valid_new = 1'h0;
- valid_we = 1'h1;
- keywrap_core_ctrl_new = CTRL_INIT_WAIT;
- keywrap_core_ctrl_we = 1'h1;
- end
+ aes_init = 1'h1;
+ ready_new = 1'h0;
+ ready_we = 1'h1;
+ valid_new = 1'h0;
+ valid_we = 1'h1;
+ keywrap_core_ctrl_new = CTRL_INIT_WAIT;
+ keywrap_core_ctrl_we = 1'h1;
+ end
- if (next)
- begin
- ready_new = 1'h0;
- ready_we = 1'h1;
- valid_new = 1'h0;
- valid_we = 1'h1;
- init_a = 1'h1;
- if (encdec)
- keywrap_core_ctrl_new = CTRL_NEXT_WSTART;
- else
- keywrap_core_ctrl_new = CTRL_NEXT_USTART;
- keywrap_core_ctrl_we = 1'h1;
- end
+ if (next)
+ begin
+ ready_new = 1'h0;
+ ready_we = 1'h1;
+ valid_new = 1'h0;
+ valid_we = 1'h1;
+ init_a = 1'h1;
+ if (encdec)
+ keywrap_core_ctrl_new = CTRL_NEXT_WSTART;
+ else
+ keywrap_core_ctrl_new = CTRL_NEXT_USTART;
+ keywrap_core_ctrl_we = 1'h1;
end
end
diff --git a/src/tb/tb_keywrap.v b/src/tb/tb_keywrap.v
index d0800fa..c900b2a 100644
--- a/src/tb/tb_keywrap.v
+++ b/src/tb/tb_keywrap.v
@@ -39,10 +39,10 @@
module tb_keywrap();
- parameter DEBUG = 0;
- parameter DUMP_TOP = 0;
- parameter DUMP_CORE = 0;
- parameter DUMP_TIMEOUT = 0;
+ parameter DEBUG = 1;
+ parameter DUMP_TOP = 1;
+ parameter DUMP_CORE = 1;
+ parameter DUMP_TIMEOUT = 1;
parameter CLK_HALF_PERIOD = 1;
parameter CLK_PERIOD = 2 * CLK_HALF_PERIOD;
@@ -313,9 +313,6 @@ module tb_keywrap();
$display("key_timeout = 0x%x key_timeout_ctr_we = 0x%x key_timeout_ctr_set = 0x%x key_timeout_ctr_dec = 0x%x",
dut.core.key_timeout, dut.core.key_timeout_ctr_we, dut.core.key_timeout_ctr_set, dut.core.key_timeout_ctr_dec);
- $display("keywrap_core_ctrl_reg = 0x%0x", dut.core.keywrap_core_ctrl_reg);
- $display("keywrap_core_ctrl_new = 0x%0x", dut.core.keywrap_core_ctrl_new);
- $display("keywrap_core_ctrl_we = 0x%0x", dut.core.keywrap_core_ctrl_we);
end
$display("");
$display("");
@@ -459,16 +456,11 @@ module tb_keywrap();
write_word(ADDR_A1, 32'h0000001f);
- $display("* Dumping state and mem after data write and A words.");
+ $display("* Dumping state and mem after write of data A words, but before wrap processing.");
dump_dut_state();
dump_mem(6);
-
- $display("* Contents of memory and dut before wrap processing:");
- dump_mem(6);
-
-
// Start wrapping and wait for wrap to complete.
$display("* Trying to start processing.");
write_word(ADDR_CTRL, 32'h00000002);
@@ -1538,17 +1530,16 @@ module tb_keywrap();
test_core_access();
-// test_kwp_ae_128_1();
+ test_kwp_ae_128_1();
// test_kwp_ad_128_1();
// test_kwp_ae_128_2();
// test_kwp_ad_128_2();
-
-// test_big_wrap_256();
+// test_big_wrap_256();
reset_dut();
- test_zeroise1();
- test_zeroise2();
- test_zeroise3();
+// test_zeroise1();
+// test_zeroise2();
+// test_zeroise3();
display_test_results();