aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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();