[Cryptech-Commits] [core/util/keywrap] 34/95: Adding additional test code to verify that core read-modify-write and api rread works correctly.

git at cryptech.is git at cryptech.is
Wed Mar 25 17:18:33 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 ef107e0aae06a658e1353dbf0856103cddfcf1c4
Author: Joachim Strömbergson <joachim at secworks.se>
AuthorDate: Tue Jul 3 09:45:19 2018 +0200

    Adding additional test code to verify that core read-modify-write and api rread works correctly.
---
 src/tb/tb_keywrap_mem.v | 74 +++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 69 insertions(+), 5 deletions(-)

diff --git a/src/tb/tb_keywrap_mem.v b/src/tb/tb_keywrap_mem.v
index 726e638..000bd16 100644
--- a/src/tb/tb_keywrap_mem.v
+++ b/src/tb/tb_keywrap_mem.v
@@ -132,12 +132,29 @@ module tb_keywrap_mem();
   endtask // init_sim
 
 
+  //----------------------------------------------------------------
+  // dump_api_mem;
+  //----------------------------------------------------------------
+  task dump_api_mem;
+    begin : dump_api_mem
+
+      reg [13 : 0] addr_ctr;
+
+      for (addr_ctr = 0 ; addr_ctr < API_ADDR_MAX ; addr_ctr = addr_ctr + 1)
+        begin
+          tb_api_addr = addr_ctr;
+          #(CLK_PERIOD);
+          $display("api_mem [0x%05x] = 0x%08x", addr_ctr, tb_api_rd_data);
+        end
+    end
+  endtask // dump_api_mem
+
 
   //----------------------------------------------------------------
-  // dump_mem;
+  // dump_core_mem;
   //----------------------------------------------------------------
-  task dump_mem;
-    begin : dump_mem
+  task dump_core_mem;
+    begin : dump_core_mem
 
       reg [12 : 0] addr_ctr;
 
@@ -148,7 +165,33 @@ module tb_keywrap_mem();
           $display("core_mem [0x%04x] = 0x%016x", addr_ctr, tb_core_rd_data);
         end
     end
-  endtask // dump_mem
+  endtask // dump_core_mem
+
+
+  //----------------------------------------------------------------
+  // test_core_rmw
+  //----------------------------------------------------------------
+  task test_core_rmw;
+    begin : test_core_rmw
+      reg [12 : 0] addr_ctr;
+
+      $display("** TC CORE RMW START");
+
+      for (addr_ctr = 0 ; addr_ctr < CORE_ADDR_MAX ; addr_ctr = addr_ctr + 1)
+        begin
+          tb_core_addr = addr_ctr;
+          #(CLK_PERIOD);
+          tb_core_we = 1;
+          tb_core_wr_data = ~tb_core_rd_data;
+          #(CLK_PERIOD);
+          tb_core_we = 0;
+        end
+
+      dump_core_mem();
+
+      $display("** TC CORE RMW END\n");
+    end
+  endtask // test_core_rmw
 
 
   //----------------------------------------------------------------
@@ -158,6 +201,8 @@ module tb_keywrap_mem();
     begin : test_api_write
       reg [13 : 0] addr_ctr;
 
+      $display("** TC API WRITE START");
+
       for (addr_ctr = 0 ; addr_ctr < API_ADDR_MAX ; addr_ctr = addr_ctr + 1)
         begin
           tb_api_we       = 1;
@@ -168,11 +213,28 @@ module tb_keywrap_mem();
         end
 
       #(CLK_PERIOD);
-      dump_mem();
+      dump_core_mem();
+
+      $display("** TC API WRITE END\n");
     end
   endtask // api_write
 
 
+  //----------------------------------------------------------------
+  // test_api_read;
+  //----------------------------------------------------------------
+  task test_api_read;
+    begin : test_api_reaqd
+
+      $display("** TC API READ START");
+
+      dump_api_mem();
+
+      $display("** TC API READ END\n");
+    end
+  endtask // api_read
+
+
   //----------------------------------------------------------------
   // main
   //----------------------------------------------------------------
@@ -184,6 +246,8 @@ module tb_keywrap_mem();
 
       init_sim();
       test_api_write();
+      test_core_rmw();
+      test_api_read();
 
       $display("");
       $display("*** Keywrap memory simulation done. ***");



More information about the Commits mailing list