[Cryptech-Commits] [user/sra/aes_merged] 30/45: Added wait_ready task to allow test cases to wait for the core to complete an operation. This makes it possible to measure cycles for an operation.

git at cryptech.is git at cryptech.is
Wed Jan 9 16:32:47 UTC 2019


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

sra at hactrn.net pushed a commit to branch master
in repository user/sra/aes_merged.

commit e7474587db169f990fb4d762c69c0fcd096cc891
Author: Joachim Strömbergson <joachim at secworks.se>
AuthorDate: Tue May 22 10:21:58 2018 +0200

    Added wait_ready task to allow test cases to wait for the core to complete an operation. This makes it possible to measure cycles for an operation.
---
 src/tb/tb_aes.v | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/src/tb/tb_aes.v b/src/tb/tb_aes.v
index 188a21a..35fc1d9 100644
--- a/src/tb/tb_aes.v
+++ b/src/tb/tb_aes.v
@@ -306,6 +306,25 @@ module tb_aes();
   endtask // read_word
 
 
+  //----------------------------------------------------------------
+  // wait_ready
+  //
+  // Wait for the DUT to signal that the result is ready
+  //----------------------------------------------------------------
+  task wait_ready;
+    begin : wait_ready
+      reg rdy;
+      rdy = 1'b0;
+
+      while (rdy != 1'b1)
+        begin
+          read_word(ADDR_STATUS);
+          rdy = tb_read_data[STATUS_READY_BIT];
+        end
+    end
+  endtask // wait_ready
+
+
   //----------------------------------------------------------------
   // read_result()
   //
@@ -386,8 +405,9 @@ module tb_aes();
       write_word(ADDR_CONFIG, (8'h00 + (key_length << 1)+ encdec));
       write_word(ADDR_CTRL, 8'h02);
 
-      #(100 * CLK_PERIOD);
-
+      wait_ready();
+      $display("*** Ready has been set!");
+      dump_dut_state();
       read_result();
 
       if (result_data == expected)



More information about the Commits mailing list