From e7474587db169f990fb4d762c69c0fcd096cc891 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joachim=20Stro=CC=88mbergson?= Date: Tue, 22 May 2018 10:21:58 +0200 Subject: 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(-) (limited to 'src') 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) -- cgit v1.2.3