2009年10月19日 星期一

2009年10月12日 星期一

04


module top;
integer icin,ia,ib;
reg a,b,cin;
wire cout,s;
xor x1(s1,a,b);
and a1(c1,a,b);
xor x2(s,s1,cin);
and a2(c2,s1,cin);
xor x2(cout,c2,c1);
initial
begin
for(ia=0;ia<=1;ia=ia+1)
begin
cin=ia;
for(ib=0;ib<=1;ib=ib+1)
begin
a=ib;
begin
for(icin=0;icin<=1;icin=icin+1)
begin
b=icin;
#10 $display("a=%d b=%d cin=%d s=%d cout=%d",a,b,cin,s,cout);
end
end
end
end
end
endmodule

2009年10月5日 星期一