[Cryptech-Commits] [core/util/keywrap] 33/95: Added first tasks to test api write and core read. Everything works as expected.

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

    Added first tasks to test api write and core read. Everything works as expected.
---
 src/tb/tb_keywrap_mem.v | 54 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/src/tb/tb_keywrap_mem.v b/src/tb/tb_keywrap_mem.v
index 6e4a056..726e638 100644
--- a/src/tb/tb_keywrap_mem.v
+++ b/src/tb/tb_keywrap_mem.v
@@ -45,6 +45,9 @@ module tb_keywrap_mem();
   parameter CLK_HALF_PERIOD = 1;
   parameter CLK_PERIOD      = 2 * CLK_HALF_PERIOD;
 
+  parameter API_ADDR_MAX = 2**14 - 1;
+  parameter CORE_ADDR_MAX = 2**13 - 1;
+
 
   //----------------------------------------------------------------
   // Variables, regs and wires.
@@ -116,10 +119,60 @@ module tb_keywrap_mem();
     begin
       cycle_ctr = 0;
       tb_clk    = 0;
+
+      tb_api_we       = 0;
+      tb_api_addr     = 14'h0;
+      tb_api_wr_data  = 32'h0;
+      tb_core_we      = 0;
+      tb_core_addr    = 13'h0;
+      tb_core_wr_data = 64'h0;
+
+      #(CLK_PERIOD);
     end
   endtask // init_sim
 
 
+
+  //----------------------------------------------------------------
+  // dump_mem;
+  //----------------------------------------------------------------
+  task dump_mem;
+    begin : dump_mem
+
+      reg [12 : 0] addr_ctr;
+
+      for (addr_ctr = 0 ; addr_ctr < CORE_ADDR_MAX ; addr_ctr = addr_ctr + 1)
+        begin
+          tb_core_addr = addr_ctr;
+          #(CLK_PERIOD);
+          $display("core_mem [0x%04x] = 0x%016x", addr_ctr, tb_core_rd_data);
+        end
+    end
+  endtask // dump_mem
+
+
+  //----------------------------------------------------------------
+  // test_api_write;
+  //----------------------------------------------------------------
+  task test_api_write;
+    begin : test_api_write
+      reg [13 : 0] addr_ctr;
+
+      for (addr_ctr = 0 ; addr_ctr < API_ADDR_MAX ; addr_ctr = addr_ctr + 1)
+        begin
+          tb_api_we       = 1;
+          tb_api_addr     = addr_ctr;
+          tb_api_wr_data  = {2'h0, addr_ctr, 2'h0, addr_ctr};
+          #(CLK_PERIOD);
+          tb_api_we       = 0;
+        end
+
+      #(CLK_PERIOD);
+      dump_mem();
+    end
+  endtask // api_write
+
+
   //----------------------------------------------------------------
   // main
   //----------------------------------------------------------------
@@ -130,6 +183,7 @@ module tb_keywrap_mem();
       $display("");
 
       init_sim();
+      test_api_write();
 
       $display("");
       $display("*** Keywrap memory simulation done. ***");



More information about the Commits mailing list