summaryrefslogtreecommitdiff
path: root/collatz/collatz_tb.v
diff options
context:
space:
mode:
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