module aluTB;

//Port modes
reg [3:0] A,B; 
reg [1:0] Sel; 
wire [3:0] sum;
integer k;

//Instantiate DUT

alu U1(
.A(A),.B(B),.Sel(Sel),
.sum(sum)
);

//Create an Input Stimulus

initial

begin
	//initialize simulator
	$monitor($time, "A=%b B=%b Sel=%b sum=%b", 
		A, B, Sel, sum);
	$shm_open("aluwaves.shm");
	$shm_probe("AC");

	//Initial values: A and B positive and A>B
	A = 4'b0010;
	B = 4'b1111;
	Sel = 00;	
	
	//Run through select combinations
	for (k=0; k<=3; k=k+1)
	#5 Sel=k;
	#5

	//New A and B values: A and B positive and A<B
	A = 4'b0100;
	B = 4'b0111;
	Sel = 00;	
	
	//Run through select combinations
	for (k=0; k<=3; k=k+1)
	#5 Sel=k;
	#5

	//New A and B values: A and B negative and A<B
	A = 4'b1011;
	B = 4'b1000;
	Sel = 00;	
	
	//Run through select combinations
	for (k=0; k<=3; k=k+1)
	#5 Sel=k;
	#5

	//New A and B values: A and B negative and A>B
	A = 4'b1000;
	B = 4'b1011;
	Sel = 00;	
	
	//Run through select combinations
	for (k=0; k<=3; k=k+1)
	#5 Sel=k;
	#5

	$finish;
end

endmodule
