uni

University stuff
git clone git://git.margiolis.net/uni.git
Log | Files | Refs | README | LICENSE

dff_tb.v (436B)


      1 module dff_tb;
      2 	reg tb_d;
      3 	reg tb_clk;
      4 	reg tb_rst;
      5 	wire q;
      6 
      7 	dff dff_tb(
      8 		.d (tb_d),
      9 		.clk (tb_clk),
     10 		.rst (tb_rst),
     11 		.q (tb_q)
     12 	);
     13 
     14 	always #20 tb_clk = ~tb_clk;
     15 
     16 	initial begin
     17 		$dumpfile("dff.vcd");
     18 		$dumpvars(0, dff_tb);
     19 
     20 		$monitor("time=%3d, tb_d=%b, tb_clk=%b, tb_rst=%b, tb_q=%b\n",
     21 		    $time, tb_d, tb_clk, tb_rst, tb_q);
     22 
     23 		tb_clk <= 1;
     24 		tb_rst <= 0;
     25 		tb_d <= 1;
     26 		#40
     27 
     28 		tb_rst <= 1;
     29 		$finish;
     30     end
     31 endmodule