summaryrefslogtreecommitdiff
path: root/collatz/collatz_tb.v
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2022-12-28 13:50:47 -0700
committerJosh Rahm <joshuarahm@gmail.com>2022-12-28 13:50:47 -0700
commit9acc760308079ae553f4b47694a5682da99bf2a3 (patch)
tree747d65d1faee5551fd001a85fe8858b0da908e57 /collatz/collatz_tb.v
parente39a5b294588dca668ea82b3e683c1684e85ca0c (diff)
downloadverilog-9acc760308079ae553f4b47694a5682da99bf2a3.tar.gz
verilog-9acc760308079ae553f4b47694a5682da99bf2a3.tar.bz2
verilog-9acc760308079ae553f4b47694a5682da99bf2a3.zip
Rearchitect into separate projects.main
Diffstat (limited to 'collatz/collatz_tb.v')
-rw-r--r--collatz/collatz_tb.v49
1 files changed, 49 insertions, 0 deletions
diff --git a/collatz/collatz_tb.v b/collatz/collatz_tb.v
new file mode 100644
index 0000000..c56b13c
--- /dev/null
+++ b/collatz/collatz_tb.v
@@ -0,0 +1,49 @@
+`timescale 1 ns / 10 ps
+
+module collatz_tb ();
+ reg clk = 0;
+ reg rst = 0;
+
+ wire idle;
+
+ localparam integer DURATION = 500_000;
+
+ always begin
+ #41.667;
+ clk = ~clk;
+ end
+
+ reg [24:0] n = 1_000_000;
+ reg start_int;
+
+ wire [24:0] count_out;
+
+ collatz #(
+ .WIDTH(32)
+ ) ctz (
+ .clk(clk),
+ .rst(rst),
+ .in_start(n),
+ .start_int(start_int),
+ .o_count(count_out),
+ .idle(idle)
+ );
+
+ initial begin
+ #10 rst = 1'b1;
+ #1 rst = 1'b0;
+ end
+
+ initial begin
+ $dumpfile("collatz_tb.vcd");
+ $dumpvars(0, collatz_tb);
+
+ #50 start_int = 1;
+ #10 start_int = 0;
+
+ #(DURATION);
+ $display("Finished!");
+ $finish;
+ end
+
+endmodule