lfsr_tb.v (435B)
1 module lfsr_tb; 2 reg tb_clk; 3 reg tb_rst; 4 wire [2:0] tb_out; 5 6 lfsr lfsr_tb( 7 .clk (tb_clk), 8 .rst (tb_rst), 9 .out (tb_out) 10 ); 11 12 always #20 tb_clk = ~tb_clk; 13 14 initial begin 15 $dumpfile("lfsr.vcd"); 16 $dumpvars(0, lfsr_tb); 17 18 $monitor("time=%3d, clk=%b, rst=%b, out=%b\n", 19 $time, tb_clk, tb_rst, tb_out); 20 21 tb_clk <= 0; 22 tb_rst <= 1; 23 #20 24 25 tb_rst <= 0; 26 27 repeat (4) @ (posedge tb_clk) 28 ; 29 30 $finish; 31 end 32 endmodule