module debounce_TB; //Port modes reg clock, reset, dataIn; wire dataOut; integer k; //Instantiate DUT debounce U1( .clock(clock), .reset(reset), .dataIn(dataIn), .dataOut(dataOut) ); //Create an input stimulus initial begin $shm_open("debouncewaves.shm"); $shm_probe("AC"); //Initial values clock=0; reset=1; dataIn = 1; //outputs should be undefined #2 //reset the machine reset=0; #1 //make the switch bounce a few times and settle at 1 dataIn=0; #2 dataIn=1; #4 dataIn=0; #6 dataIn=1; #8 dataIn=0; #12 dataIn=1; #400 //move the switch to a zero, make it bounce, and then settle at zero dataIn=0; #2 dataIn=1; #4 dataIn=0; #6 dataIn=1; #8 dataIn=0; #12 dataIn=1; #15 dataIn=0; #400 $finish; end always #5 clock = ~clock; endmodule