aboutsummaryrefslogtreecommitdiff
path: root/src/tb
diff options
context:
space:
mode:
authorJoachim StroĢˆmbergson <joachim@secworks.se>2018-12-07 10:03:23 +0100
committerJoachim StroĢˆmbergson <joachim@secworks.se>2018-12-07 10:03:23 +0100
commit0d2aa16a71c1f0ca183a71c3d5460c6ff1a2f245 (patch)
tree2d7e5db4e4fec4b9ad9ee4937de223e47f6731ec /src/tb
parent88c15a5ff837dc6871f7ca8caf4610a4e2d056fd (diff)
Solved event loop.
Diffstat (limited to 'src/tb')
-rw-r--r--src/tb/tb_keywrap_mkmif.v42
1 files changed, 39 insertions, 3 deletions
diff --git a/src/tb/tb_keywrap_mkmif.v b/src/tb/tb_keywrap_mkmif.v
index 3289a77..b275499 100644
--- a/src/tb/tb_keywrap_mkmif.v
+++ b/src/tb/tb_keywrap_mkmif.v
@@ -215,7 +215,7 @@ module tb_keywrap_mkmif();
tc_ctr = 0;
show_spi = 0;
- show_dut_state = 1;
+ show_dut_state = 0;
show_mem_state = 0;
show_mkm_state = 0;
@@ -303,7 +303,7 @@ module tb_keywrap_mkmif();
tc_ctr = tc_ctr + 1;
$display("TEST WRITE-STATUS START");
- $display("Check that we can write the key status word.");
+ $display("Check that we can write the status word.");
// Observe SPI for a number of cycles. Reset the DUT during observation.
show_spi = 0;
@@ -337,6 +337,41 @@ module tb_keywrap_mkmif();
//----------------------------------------------------------------
+ // test_read_status
+ // Note: This test should be called after test_write_status.
+ // If not the contents of the memort will be undefined.
+ //----------------------------------------------------------------
+ task test_read_status;
+ begin
+ tc_ctr = tc_ctr + 1;
+
+ $display("TEST READ-STATUS START");
+ $display("Check that we can read the status word.");
+
+ // Observe SPI for a number of cycles. Reset the DUT during observation.
+ show_spi = 0;
+ show_dut_state = 1;
+ #(10 * CLK_PERIOD);
+
+ $display("Trying to read 0xdeadbeef from the status address.");
+ tb_key_status = 1'h0;
+ tb_read = 1'h1;
+
+ #(CLK_PERIOD);
+ tb_read = 1'h0;
+
+ wait_ready();
+ show_spi = 0;
+
+ $display("The word read: 0x%04x", tb_rd_status);
+
+ $display("TEST READ-STATUS END");
+ $display("");
+ end
+ endtask // test_read_status
+
+
+ //----------------------------------------------------------------
// test_write_key
//----------------------------------------------------------------
task test_write_key;
@@ -383,7 +418,8 @@ module tb_keywrap_mkmif();
dump_mem();
test_init_mem();
test_write_status();
- test_write_key();
+// test_read_status();
+// test_write_key();
dump_mem();
$display("");