diff options
author | Joachim StroĢmbergson <joachim@secworks.se> | 2015-07-17 08:55:43 +0200 |
---|---|---|
committer | Joachim StroĢmbergson <joachim@secworks.se> | 2015-07-17 08:55:43 +0200 |
commit | 0165294513694ed208c44231992bf5e7f1676246 (patch) | |
tree | 2ec166ebbc07cea5aebf32a5bca06a5143edfe39 /src | |
parent | 2016dab85881d20821656d8003054e256a0cecc8 (diff) |
Fixed state restore testcase in core testbench. Fixed the double block test case to really test the core. Added data valid task.
Diffstat (limited to 'src')
-rw-r--r-- | src/tb/tb_sha256_core.v | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/src/tb/tb_sha256_core.v b/src/tb/tb_sha256_core.v index 5527bf5..1b1c6ed 100644 --- a/src/tb/tb_sha256_core.v +++ b/src/tb/tb_sha256_core.v @@ -296,6 +296,25 @@ module tb_sha256_core(); //---------------------------------------------------------------- + // wait_data_valid() + // + // Wait for the data valid in th dut to be set. + // + // Note: It is the callers responsibility to call the function + // when the dut is actively processing and will in fact at some + // point set the flag. + //---------------------------------------------------------------- + task wait_data_valid(); + begin + while (!tb_digest_valid) + begin + #(CLK_PERIOD); + end + end + endtask // wait_data_valid + + + //---------------------------------------------------------------- // single_block_test() // // Run a test case spanning a single data block. @@ -310,9 +329,9 @@ module tb_sha256_core(); tb_block = block; tb_init = 1; #(CLK_PERIOD); + tb_init = 0; wait_ready(); - if (tb_digest == expected) begin $display("*** TC %0d successful.", tc_number); @@ -354,15 +373,20 @@ module tb_sha256_core(); tb_block = block1; tb_init = 1; #(CLK_PERIOD); + tb_init = 0; wait_ready(); + db_digest1 = tb_digest; $display("*** TC %0d first block done.", tc_number); $display("*** TC %0d second block started.", tc_number); tb_block = block2; + dump_dut_state(); tb_next = 1; #(CLK_PERIOD); + tb_next = 0; wait_ready(); + $display("*** TC %0d second block done.", tc_number); if (db_digest1 == expected1) @@ -379,7 +403,7 @@ module tb_sha256_core(); db_error = 1; end - if (db_digest1 == expected1) + if (tb_digest == expected2) begin $display("*** TC %0d second block successful", tc_number); $display(""); @@ -413,7 +437,6 @@ module tb_sha256_core(); input [511 : 0] block, input [255 : 0] expected); - reg [255 : 0] db_digest1; reg db_error; begin $display("*** TC %0d state restore block test case started.", tc_number); @@ -463,16 +486,16 @@ module tb_sha256_core(); tb_state7_we = 0; #(CLK_PERIOD); - dump_H_state(); $display("*** TC %0d block started.", tc_number); tb_block = block; tb_next = 1; #(CLK_PERIOD); + tb_next = 0; wait_ready(); $display("*** TC %0d block done.", tc_number); - if (db_digest1 == expected) + if (tb_digest == expected) begin $display("*** TC %0d block successful", tc_number); $display(""); |