From 0d2aa16a71c1f0ca183a71c3d5460c6ff1a2f245 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joachim=20Stro=CC=88mbergson?= Date: Fri, 7 Dec 2018 10:03:23 +0100 Subject: Solved event loop. --- src/tb/tb_keywrap_mkmif.v | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) (limited to 'src/tb/tb_keywrap_mkmif.v') 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; @@ -336,6 +336,41 @@ module tb_keywrap_mkmif(); endtask // test_write_status + //---------------------------------------------------------------- + // 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 //---------------------------------------------------------------- @@ -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(""); -- cgit v1.2.3