aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim StroĢˆmbergson <joachim@secworks.se>2018-11-27 13:48:22 +0100
committerJoachim StroĢˆmbergson <joachim@secworks.se>2018-11-27 13:48:22 +0100
commit88c15a5ff837dc6871f7ca8caf4610a4e2d056fd (patch)
treece3d330d9a2fbeb0da22fa36f3a49ed37faf3d2c
parent0fb1cd7cddf85af93a29959b66b0295ae0021e45 (diff)
Adding test that tries to write a key into the serial memory.
-rw-r--r--src/tb/tb_keywrap_mkmif.v34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/tb/tb_keywrap_mkmif.v b/src/tb/tb_keywrap_mkmif.v
index 79083e4..3289a77 100644
--- a/src/tb/tb_keywrap_mkmif.v
+++ b/src/tb/tb_keywrap_mkmif.v
@@ -337,6 +337,39 @@ module tb_keywrap_mkmif();
//----------------------------------------------------------------
+ // test_write_key
+ //----------------------------------------------------------------
+ task test_write_key;
+ begin
+ tc_ctr = tc_ctr + 1;
+
+ $display("TEST WRITE-KEY START");
+ $display("Check that we can write the key words.");
+
+ // Observe SPI for a number of cycles. Reset the DUT during observation.
+ show_spi = 0;
+ #(10 * CLK_PERIOD);
+
+ $display("Trying to write test key to key address.");
+ $display("test key: 0x01020304 0xaa55aa55 0x00ff00ff 0x0f0e0d0c");
+ $display(" 0x11121314 0x55aa55aa 0x11ee11ee 0x1f1e1d1c");
+
+ tb_wr_key = 256'h01020304_aa55aa55_00ff00ff_0f0e0d0c_11121314_55aa55aa_11ee11ee_1f1e1d1c;
+ tb_key_status = 1'h1;
+ tb_write = 1'h1;
+
+ #(CLK_PERIOD);
+ tb_write = 1'h0;
+
+ wait_ready();
+ show_spi = 0;
+
+ $display("TEST WRITE-KEY END");
+ $display("");
+ end
+ endtask // test_write_key
+
+ //----------------------------------------------------------------
// main
//----------------------------------------------------------------
initial
@@ -350,6 +383,7 @@ module tb_keywrap_mkmif();
dump_mem();
test_init_mem();
test_write_status();
+ test_write_key();
dump_mem();
$display("");