`timescale 1us/1us module counter_tb; logic tst_clk, tst_store_X; logic [15:0] tst_in_X, tst_result; counter uut ( .clk_in(tst_clk), .X_in(tst_in_X), .counter_out(tst_result), .st_store_X_in(tst_store_X) ); string filename; initial begin `ifdef DUMP_FILE_NAME filename=`DUMP_FILE_NAME; `else filename="counter.lxt2"; `endif $dumpfile(filename); $dumpvars(); tst_clk = 0; tst_store_X = 0; tst_in_X = 0; end always #10 tst_clk = ~tst_clk; initial begin #200 @(posedge tst_clk); tst_store_X = 1; tst_in_X = 16'd834; repeat(3) begin @(posedge tst_clk); assert (tst_result == 834) else $error("Expected 834, got %d", tst_result); end tst_store_X = 0; @(posedge tst_clk); assert (tst_result == 835) else $error("Expected 835, got %d", tst_result); #30 $finish(); end endmodule