四位超前进位加法器 门级建模
module FullAdder(A, B, CarryIn, Sum, CarryOut);
output Sum, CarryOut;
input A, B, CarryIn;
wire A,B,CarryOut,Sum;
wire A_bar,B_bar,CarryIn_bar;
not not1(A_bar, A);
not not2(B_bar, B);
not not3(CarryIn_bar, CarryIn);
and and4(and4_out, A_bar, B_bar, CarryIn);
and and5(and5_out, A_bar, B, CarryIn_bar);
and and6(and6_out, A, B_bar, CarryIn_bar);
and and7(and7_out, A, B, CarryIn);
or or8(Sum, and4_out, and5_out, and6_out,and7_out);
and and9(and9_out, A, B);
and and10(and10_out, A, CarryIn);
and and11(and11_out, B, CarryIn);
or or12(CarryOut, and9_out, and10_out, and11_out);
endmodule