
module top; integer ic,ia,ib,id;
reg a,b,c,d;
wire cout;
not n1(A,a);
not n2(B,b);
not n3(C,c);
not n4(D,d);
and a1(s1,A,c,D);
and a2(s2,b,C,d);
and a3(s3,a,b,C);
and a4(s4,a,b,d);
and a5(s5,a,C,d);
or r1(cout,s1,s2,s3,s4,s5);
initial
begin
for(ia=0;ia<=1;ia=ia+1)
begin
a=ia;
for(ib=0;ib<=1;ib=ib+1)
begin
b=ib;
begin
for(ic=0;ic<=1;ic=ic+1)
begin
c=ic;
for(id=0;id<=1;id=id+1)
begin
d=id;
#10 $display("a=%d b=%d c=%d d=%d cout=%d",a,b,c,d,cout);
end
end
end
end
end
end
endmodule




