[Cryptech-Commits] [core/hash/sha256] 01/01: Fixed state restore testcase in core testbench. Fixed the double block test case to really test the core. Added data valid task.
git at cryptech.is
git at cryptech.is
Fri Jul 17 06:55:51 UTC 2015
This is an automated email from the git hooks/post-receive script.
joachim at secworks.se pushed a commit to branch state_access
in repository core/hash/sha256.
commit 0165294513694ed208c44231992bf5e7f1676246
Author: Joachim Strömbergson <joachim at secworks.se>
Date: Fri Jul 17 08:55:43 2015 +0200
Fixed state restore testcase in core testbench. Fixed the double block test case to really test the core. Added data valid task.
---
src/tb/tb_sha256_core.v | 33 ++++++++++++++++++++++++++++-----
1 file 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("");
More information about the Commits
mailing list