aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoachim StroĢˆmbergson <joachim@secworks.se>2018-05-22 10:21:58 +0200
committerJoachim StroĢˆmbergson <joachim@secworks.se>2018-05-22 10:21:58 +0200
commite7474587db169f990fb4d762c69c0fcd096cc891 (patch)
treec51208a232c8dae4d44133c2d6e2e61337870960 /src
parent2caa4d54188338226494daa53d024a52572bd3a4 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/tb/tb_aes.v24
1 files 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
@@ -307,6 +307,25 @@ module tb_aes();
//----------------------------------------------------------------
+ // 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()
//
// Read the result block in the dut.
@@ -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)