aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim StroĢˆmbergson <joachim@secworks.se>2015-08-26 15:53:40 +0200
committerJoachim StroĢˆmbergson <joachim@secworks.se>2015-08-26 15:53:40 +0200
commit01336260cf2df771cd246c131238ef70b23d3c10 (patch)
treeaf81b72e34bd1f2b6089bb10dff01d21f2dc4f81
parent173d61b457da53a4dec607113df76ebd35a56d40 (diff)
Adding test case for verifying reseed functionality in csprng.
-rw-r--r--src/tb/tb_csprng.v42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/tb/tb_csprng.v b/src/tb/tb_csprng.v
index 0404b56..7f7823e 100644
--- a/src/tb/tb_csprng.v
+++ b/src/tb/tb_csprng.v
@@ -353,6 +353,7 @@ module tb_csprng();
tb_seed_data = {8{64'haaaaaaaa55555555}};
tb_seed_syn = 1'b1;
+ // Start pulling data.
tb_cs = 1'b1;
tb_we = 1'b0;
tb_address = ADDR_RND_DATA;
@@ -365,6 +366,46 @@ module tb_csprng();
//----------------------------------------------------------------
+ // tc2_reseed_csprng()
+ //
+ // TC2: Test that the CSPRNG is reseeded as expected.
+ // We set the max block size to a small value and pull data.
+ //----------------------------------------------------------------
+ task tc2_reseed_csprng();
+ begin
+ tc_ctr = tc_ctr + 1;
+
+ $display("*** TC2: Test reseed of CSPRNG started.");
+
+ tb_seed_data = {8{64'h0102030405060708}};
+ tb_seed_syn = 1'b1;
+
+ // Set the max block size to a low value
+ tb_cs = 1'b1;
+ tb_we = 1'b1;
+ tb_address = ADDR_NUM_BLOCKS_HIGH;
+ tb_write_data = 32'h00000000;
+ #(CLK_PERIOD);
+ tb_address = ADDR_NUM_BLOCKS_LOW;
+ tb_write_data = 32'h00000001;
+ #(CLK_PERIOD);
+ tb_cs = 1'b0;
+ tb_we = 1'b0;
+ #(CLK_PERIOD);
+
+ // Start pulling data.
+ tb_cs = 1'b1;
+ tb_we = 1'b0;
+ tb_address = ADDR_RND_DATA;
+
+ #(200 * CLK_PERIOD);
+
+ $display("*** TC2 done..");
+ end
+ endtask // tc2_reseed_csprng
+
+
+ //----------------------------------------------------------------
// csprng_test
//
// The main test functionality.
@@ -382,6 +423,7 @@ module tb_csprng();
dump_dut_state();
tc1_init_csprng();
+ tc2_reseed_csprng();
display_test_results();