aboutsummaryrefslogtreecommitdiff
path: root/src/tb
diff options
context:
space:
mode:
authorJoachim StroĢˆmbergson <joachim@secworks.se>2014-03-16 21:46:10 +0100
committerJoachim StroĢˆmbergson <joachim@secworks.se>2014-03-16 21:46:10 +0100
commitc33d1df5f95b1baadee66aa464d6af4a2c849966 (patch)
tree4b52be12b28428b5185e71a36eb4bfe5d490ce25 /src/tb
parent6e8e124cce82c83abf4273d7362c6eaa62d2d426 (diff)
Adding self resetting init and next flags. Updating TBs to not reset the flags. Fixing clock parameter naming.
Diffstat (limited to 'src/tb')
-rw-r--r--src/tb/tb_sha256.v11
-rw-r--r--src/tb/tb_sha256_core.v15
2 files changed, 13 insertions, 13 deletions
diff --git a/src/tb/tb_sha256.v b/src/tb/tb_sha256.v
index 69f2186..72e7d21 100644
--- a/src/tb/tb_sha256.v
+++ b/src/tb/tb_sha256.v
@@ -53,6 +53,7 @@ module tb_sha256();
parameter DEBUG = 0;
parameter CLK_HALF_PERIOD = 2;
+ parameter CLK_PERIOD = 2 * CLK_HALF_PERIOD;
// The address map.
parameter ADDR_NAME0 = 8'h00;
@@ -297,7 +298,7 @@ module tb_sha256();
tb_write_data = word;
tb_cs = 1;
tb_we = 1;
- #(2 * CLK_HALF_PERIOD);
+ #(CLK_PERIOD);
tb_cs = 0;
tb_we = 0;
end
@@ -343,7 +344,7 @@ module tb_sha256();
tb_address = address;
tb_cs = 1;
tb_we = 0;
- #(2 * CLK_HALF_PERIOD);
+ #(CLK_PERIOD);
read_data = tb_read_data;
tb_cs = 0;
@@ -424,7 +425,7 @@ module tb_sha256();
write_block(block);
write_word(ADDR_CTRL, CTRL_INIT_VALUE);
- write_word(ADDR_CTRL, 8'h00);
+ #(CLK_PERIOD);
wait_ready();
read_digest();
@@ -463,7 +464,7 @@ module tb_sha256();
// First block
write_block(block0);
write_word(ADDR_CTRL, CTRL_INIT_VALUE);
- write_word(ADDR_CTRL, 8'h00);
+ #(CLK_PERIOD);
wait_ready();
read_digest();
@@ -482,7 +483,7 @@ module tb_sha256();
// Final block
write_block(block1);
write_word(ADDR_CTRL, CTRL_NEXT_VALUE);
- write_word(ADDR_CTRL, 8'h00);
+ #(CLK_PERIOD);
wait_ready();
read_digest();
diff --git a/src/tb/tb_sha256_core.v b/src/tb/tb_sha256_core.v
index 2f2a288..df0cafc 100644
--- a/src/tb/tb_sha256_core.v
+++ b/src/tb/tb_sha256_core.v
@@ -6,7 +6,8 @@
//
//
// Author: Joachim Strombergson
-// Copyright (c) 2014 SUNET
+// Copyright (c) 2014, SUNET
+// All rights reserved.
//
// Redistribution and use in source and binary forms, with or
// without modification, are permitted provided that the following
@@ -52,6 +53,7 @@ module tb_sha256_core();
parameter DEBUG = 0;
parameter CLK_HALF_PERIOD = 2;
+ parameter CLK_PERIOD = 2 * CLK_HALF_PERIOD;
//----------------------------------------------------------------
@@ -243,7 +245,7 @@ module tb_sha256_core();
begin
while (!tb_ready)
begin
- #(2 * CLK_HALF_PERIOD);
+ #(CLK_PERIOD);
end
end
endtask // wait_ready
@@ -263,8 +265,7 @@ module tb_sha256_core();
tb_block = block;
tb_init = 1;
- #(2 * CLK_HALF_PERIOD);
- tb_init = 0;
+ #(CLK_PERIOD);
wait_ready();
@@ -308,8 +309,7 @@ module tb_sha256_core();
$display("*** TC %0d first block started.", tc_number);
tb_block = block1;
tb_init = 1;
- #(2 * CLK_HALF_PERIOD);
- tb_init = 0;
+ #(CLK_PERIOD);
wait_ready();
db_digest1 = tb_digest;
$display("*** TC %0d first block done.", tc_number);
@@ -317,8 +317,7 @@ module tb_sha256_core();
$display("*** TC %0d second block started.", tc_number);
tb_block = block2;
tb_next = 1;
- #(2 * CLK_HALF_PERIOD);
- tb_next = 0;
+ #(CLK_PERIOD);
wait_ready();
$display("*** TC %0d second block done.", tc_number);