[Cryptech-Commits] [core/hash/sha512] 03/03: Updated state display. Added cycle count display.

git at cryptech.is git at cryptech.is
Fri Apr 6 13:03:23 UTC 2018


This is an automated email from the git hooks/post-receive script.

joachim at secworks.se pushed a commit to branch clock_speed
in repository core/hash/sha512.

commit 087f18a05f73f78d5f3636ca47ce0a093874448a
Author: Joachim Strömbergson <joachim at secworks.se>
AuthorDate: Fri Apr 6 15:03:08 2018 +0200

    Updated state display. Added cycle count display.
---
 src/tb/tb_sha512_core.v | 35 +++++++++++++++++++----------------
 1 file changed, 19 insertions(+), 16 deletions(-)

diff --git a/src/tb/tb_sha512_core.v b/src/tb/tb_sha512_core.v
index 0d198d6..2fa665a 100644
--- a/src/tb/tb_sha512_core.v
+++ b/src/tb/tb_sha512_core.v
@@ -46,7 +46,7 @@ module tb_sha512_core();
   //----------------------------------------------------------------
   // Internal constant and parameter definitions.
   //----------------------------------------------------------------
-  parameter DEBUG = 0;
+  parameter DEBUG = 1;
 
   parameter CLK_PERIOD      = 2;
   parameter CLK_HALF_PERIOD = CLK_PERIOD / 2;
@@ -154,18 +154,14 @@ module tb_sha512_core();
     begin
       $display("State of DUT");
       $display("------------");
+      $display("Cycle %010d", cycle_ctr);
       $display("Inputs and outputs:");
       $display("init   = 0x%01x, next  = 0x%01x. mode = 0x%01x",
                dut.init, dut.next, dut.mode);
-      $display("block  = 0x%0128x", dut.block);
-
       $display("ready  = 0x%01x, valid = 0x%01x",
                dut.ready, dut.digest_valid);
+      $display("block  = 0x%0128x", dut.block);
       $display("digest = 0x%064x", dut.digest);
-      $display("H0_reg = 0x%08x, H1_reg = 0x%08x, H2_reg = 0x%08x, H3_reg = 0x%08x",
-               dut.H0_reg, dut.H1_reg, dut.H2_reg, dut.H3_reg);
-      $display("H4_reg = 0x%08x, H5_reg = 0x%08x, H6_reg = 0x%08x, H7_reg = 0x%08x",
-               dut.H4_reg, dut.H5_reg, dut.H6_reg, dut.H7_reg);
       $display("");
 
       $display("Control signals and counter:");
@@ -174,7 +170,7 @@ module tb_sha512_core();
                dut.digest_init, dut.digest_update);
       $display("state_init      = 0x%01x, state_update  = 0x%01x",
                dut.state_init, dut.state_update);
-      $display("first_block     = 0x%01x, ready_flag    = 0x%01x, w_init    = 0x%01x",
+      $display("first_block     = 0x%01x, ready_flag    = 0x%01x, w_init        = 0x%01x",
                dut.first_block, dut.ready_flag, dut.w_init);
       $display("round_ctr_inc   = 0x%01x, round_ctr_rst = 0x%01x, round_ctr_reg = 0x%02x",
                dut.round_ctr_inc, dut.round_ctr_rst, dut.round_ctr_reg);
@@ -186,15 +182,22 @@ module tb_sha512_core();
       $display("e_reg = 0x%08x, f_reg = 0x%08x, g_reg = 0x%08x, h_reg = 0x%08x",
                dut.e_reg, dut.f_reg, dut.g_reg, dut.h_reg);
       $display("");
-      $display("a_new = 0x%08x, b_new = 0x%08x, c_new = 0x%08x, d_new = 0x%08x",
-               dut.a_new, dut.b_new, dut.c_new, dut.d_new);
-      $display("e_new = 0x%08x, f_new = 0x%08x, g_new = 0x%08x, h_new = 0x%08x",
-               dut.e_new, dut.f_new, dut.g_new, dut.h_new);
+
+      $display("Digest registers:");
+      $display("H0_reg = 0x%08x, H1_reg = 0x%08x, H2_reg = 0x%08x, H3_reg = 0x%08x",
+               dut.H0_reg, dut.H1_reg, dut.H2_reg, dut.H3_reg);
+      $display("H4_reg = 0x%08x, H5_reg = 0x%08x, H6_reg = 0x%08x, H7_reg = 0x%08x",
+               dut.H4_reg, dut.H5_reg, dut.H6_reg, dut.H7_reg);
       $display("");
 
       $display("State update values:");
-      $display("w  = 0x%08x, k  = 0x%08x", dut.w_data, dut.k_data);
-      $display("t1 = 0x%08x, t2 = 0x%08x", dut.t1_new, dut.t2_new);
+      $display("w      = 0x%08x, k      = 0x%08x", dut.w_data, dut.k_data);
+      $display("t1     = 0x%08x, t2     = 0x%08x", dut.t1_new, dut.t2_new);
+      $display("t1_reg = 0x%08x, t2_reg = 0x%08x", dut.t1_reg, dut.t2_reg);
+      $display("a_new  = 0x%08x, b_new  = 0x%08x, c_new = 0x%08x, d_new = 0x%08x",
+               dut.a_new, dut.b_new, dut.c_new, dut.d_new);
+      $display("e_new  = 0x%08x, f_new  = 0x%08x, g_new = 0x%08x, h_new = 0x%08x",
+               dut.e_new, dut.f_new, dut.g_new, dut.h_new);
       $display("");
     end
   endtask // dump_dut_state
@@ -502,7 +505,7 @@ module tb_sha512_core();
       // SHA-512 single block digest and test.
       tc1_expected = 512'hDDAF35A193617ABACC417349AE20413112E6FA4E89A97EA20A9EEEE64B55D39A2192992A274FC1A836BA3C23A3FEEBBD454D4423643CE80E2A9AC94FA54CA49F;
       single_block_test(8'h01, MODE_SHA_512, single_block, tc1_expected);
-
+/*
       // SHA-512_224 single block digest and test.
       tc2_expected = {224'h4634270F707B6A54DAAE7530460842E20E37ED265CEEE9A43E8924AA, {9{32'h00000000}}};
       single_block_test(8'h02, MODE_SHA_512_224, single_block, tc2_expected);
@@ -539,7 +542,7 @@ module tb_sha512_core();
       tc11_expected = 512'h2A7F1D895FD58E0BEAAE96D1A673C741015A2173796C1A88F6352CA156ACAFF7C662113E9EBB4D6417B61A85E2CCF0A937EB9A6660FEB5198F2EBE9A81E6A2C5;
       tc12_expected = {384'h09330C33F71147E83D192FC782CD1B4753111B173B3B05D22FA08086E3B0F712FCC7C71A557E2DB966C3E9FA91746039, {4{32'h00000000}}};
       double_block_test(8'h08, MODE_SHA_384, double_block_one, double_block_two, tc11_expected, tc12_expected);
-
+*/
 
       display_test_result();
       $display("*** Simulation done.");



More information about the Commits mailing list