[Cryptech-Commits] [user/js/keywrap] branch master updated: Adding more tasks for tb infrastructure.
git at cryptech.is
git at cryptech.is
Fri Jun 29 12:00:15 UTC 2018
This is an automated email from the git hooks/post-receive script.
joachim at secworks.se pushed a commit to branch master
in repository user/js/keywrap.
The following commit(s) were added to refs/heads/master by this push:
new 79cd684 Adding more tasks for tb infrastructure.
79cd684 is described below
commit 79cd68435bdd222a67a6c5ff17649d545e788560
Author: Joachim Strömbergson <joachim at secworks.se>
AuthorDate: Fri Jun 29 14:00:04 2018 +0200
Adding more tasks for tb infrastructure.
---
src/tb/tb_keywrap.v | 92 +++++++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 85 insertions(+), 7 deletions(-)
diff --git a/src/tb/tb_keywrap.v b/src/tb/tb_keywrap.v
index 29249ed..fee890c 100644
--- a/src/tb/tb_keywrap.v
+++ b/src/tb/tb_keywrap.v
@@ -146,6 +146,7 @@ module tb_keywrap();
tb_address = address;
tb_cs = 1;
tb_we = 0;
+
#(CLK_PERIOD);
read_data = tb_read_data;
tb_cs = 0;
@@ -177,7 +178,8 @@ module tb_keywrap();
tb_write_data = word;
tb_cs = 1;
tb_we = 1;
- #(2 * CLK_PERIOD);
+
+ #(1 * CLK_PERIOD);
tb_cs = 0;
tb_we = 0;
end
@@ -203,25 +205,101 @@ module tb_keywrap();
endtask // wait_ready
+ //----------------------------------------------------------------
+ // dump_dut_state()
+ //
+ // Dump the state of the dump when needed.
+ //----------------------------------------------------------------
+ task dump_dut_state;
+ begin
+ $display("cycle: 0x%016x", cycle_ctr);
+ $display("State of DUT");
+ $display("------------");
+ $display("");
+ end
+ endtask // dump_dut_state
+
+
+ //----------------------------------------------------------------
+ // display_test_results()
+ //
+ // Display the accumulated test results.
+ //----------------------------------------------------------------
+ task display_test_results;
+ begin
+ if (error_ctr == 0)
+ begin
+ $display("*** All %02d test cases completed successfully", tc_ctr);
+ end
+ else
+ begin
+ $display("*** %02d tests completed - %02d test cases did not complete successfully.",
+ tc_ctr, error_ctr);
+ end
+ end
+ endtask // display_test_results
+
+
//----------------------------------------------------------------
// init_sim()
//
// Initialize all counters and testbed functionality as well
// as setting the DUT inputs to defined values.
//----------------------------------------------------------------
- initial
+ task init_sim;
begin
cycle_ctr = 0;
+ error_ctr = 0;
+ tc_ctr = 0;
+
tb_clk = 0;
- tb_reset_n = 0;
+ tb_reset_n = 1;
- #(CLK_PERIOD * 10);
+ tb_cs = 0;
+ tb_we = 0;
+ tb_address = 8'h0;
+ tb_write_data = 32'h0;
+ end
+ endtask // init_sim
- tb_reset_n = 1;
- #(CLK_PERIOD * 10);
- $finish;
+ //----------------------------------------------------------------
+ // reset_dut()
+ //
+ // Toggle reset to put the DUT into a well known state.
+ //----------------------------------------------------------------
+ task reset_dut;
+ begin
+ $display("*** Toggling reset.");
+ tb_reset_n = 0;
+
+ #(2 * CLK_PERIOD);
+ tb_reset_n = 1;
+ $display("");
end
+ endtask // reset_dut
+
+
+ //----------------------------------------------------------------
+ // main
+ //----------------------------------------------------------------
+ initial
+ begin : main
+ $display(" -= Testbench for Keywrap started =-");
+ $display(" ==================================");
+ $display("");
+
+ init_sim();
+ dump_dut_state();
+ reset_dut();
+ dump_dut_state();
+
+ display_test_results();
+
+ $display("");
+ $display("*** Keywrap simulation done. ***");
+ $finish;
+ end // main
endmodule // tb_keywrap
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Commits
mailing list