[Cryptech-Commits] [core/util/keywrap] 21/37: Adding test case to observe auto-load of key and status after reset.

git at cryptech.is git at cryptech.is
Wed Apr 29 16:51:57 UTC 2020


This is an automated email from the git hooks/post-receive script.

paul at psgd.org pushed a commit to branch master
in repository core/util/keywrap.

commit 74efb3cd734209511d50b43cf22b8dd77364bc24
Author: Joachim Strömbergson <joachim at secworks.se>
AuthorDate: Tue Nov 6 14:16:01 2018 +0100

    Adding test case to observe auto-load of key and status after reset.
---
 src/tb/tb_keywrap_mkmif.v | 49 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/src/tb/tb_keywrap_mkmif.v b/src/tb/tb_keywrap_mkmif.v
index 8d42c6d..8bd3a05 100644
--- a/src/tb/tb_keywrap_mkmif.v
+++ b/src/tb/tb_keywrap_mkmif.v
@@ -55,6 +55,8 @@ module tb_keywrap_mkm();
   integer error_ctr;
   integer tc_ctr;
 
+  integer show_spi;
+
   reg            tb_clk;
   reg            tb_reset_n;
   wire           tb_mkm_spi_sclk;
@@ -119,6 +121,11 @@ module tb_keywrap_mkm();
     begin : sys_monitor
       cycle_ctr = cycle_ctr + 1;
 
+      if (show_spi)
+        begin
+          $display("spi_clk: 0x%01x, spi_cs_n: 0x%01x, spi_do: 0x%01x, spi_di: 0x%01x",
+                   tb_mkm_spi_sclk, tb_mkm_spi_cs_n, tb_mkm_spi_do, tb_mkm_spi_di);
+        end
       #(CLK_PERIOD);
     end
 
@@ -135,6 +142,8 @@ module tb_keywrap_mkm();
       error_ctr = 0;
       tc_ctr    = 0;
 
+      show_spi = 0;
+
       tb_clk        = 1'h0;
       tb_reset_n    = 1'h1;
       tb_mkm_spi_do = 1'h0;
@@ -150,6 +159,45 @@ module tb_keywrap_mkm();
   endtask // init_sim
 
 
+  //----------------------------------------------------------------
+  // reset_dut()
+  //
+  // Toggle reset to put the DUT into a well known state.
+  //----------------------------------------------------------------
+  task reset_dut;
+    begin
+      $display("TB: Resetting dut.");
+      tb_reset_n = 0;
+      #(2 * CLK_PERIOD);
+      tb_reset_n = 1;
+    end
+  endtask // reset_dut
+
+
+  //----------------------------------------------------------------
+  // test_auto_load
+  //----------------------------------------------------------------
+  task test_auto_load;
+    begin
+      tc_ctr = tc_ctr + 1;
+
+      $display("TEST AUTO-LOAD START");
+      $display("Check that correct ICV is generated for a single block message.");
+
+      // Observe SPI for a number of cycles. Reset the DUT during monitoring.
+      show_spi = 1;
+      #(10 * CLK_PERIOD);
+      reset_dut();
+      #(100 * CLK_PERIOD);
+      show_spi = 0;
+
+      $display("TEST AUTO-LOAD END");
+      $display("");
+    end
+  endtask // auto_load
+
+
+
   //----------------------------------------------------------------
   // main
   //----------------------------------------------------------------
@@ -160,6 +208,7 @@ module tb_keywrap_mkm();
       $display("");
 
       init_sim();
+      test_auto_load();
 
       $display("");
       $display("*** Keywrap mkmif wrapper testbench done. ***");



More information about the Commits mailing list