module p2toplevelTB; //Port modes reg [3:0] A, B, C, D, W, X, Y, Z; reg clock, reset; wire [3:0] Q; integer k; //Instantiate DUT p2toplevel U1( .clock(clock), .reset(reset), .A(A), .B(B), .C(C), .D(D), .W(W), .X(X), .Y(Y), .Z(Z), .Q(Q) ); //Create an Input Stimulus initial begin //initialize simulator $shm_open("p2toplevelwaves.shm"); $shm_probe("AC"); //Initial values: note that the input values are chosen carefully to test that //each bit of the mux will appropriately pass a 1 and a 0 clock = 1; A = 4'b0010; B = 4'b0011; C = 4'b1000; D = 4'b0110; W = 4'b0011; X = 4'b1100; Y = 4'b0011; Z = 4'b0010; //reset the machine reset = 1; #6 //take the machine out of reset reset = 0; //give time for the counter to run through all combinations #20 $finish; end always #2 clock=~clock; endmodule