Electrical – 4-bit Full Adder using Two 2-bit Full Adders

adderverilog

I have the modules for a 1-bit full adder and 2-bit full adder (built upon the 1-bit adder). May I know how I could go about writing the subsequent 4-bit adder based on the 2-bit adder? This may be a little unorthodox but I'm curious to know as I am new to Verilog.
Thank you!

module full_adder(
    input A,
    input B,
    input CIN,
    output S,
    output COUT
    );

    assign S = A ^ B ^ CIN;
    assign COUT = (A & B) | (CIN & (A ^ B));

endmodule

module 2_bit_adder(
    input [1:0] A,
    input [1:0] B,
    input C0,
    output [1:0] S,
    output C2
    );

    wire C1;

    full_adder fu0 (A[0], B[0], C0, S[0], C1);
    full_adder fu1 (A[1], B[1], C1, S[1], C2);

endmodule

Best Answer

You can make a 4 bit adder out of 2 bit adders exactly the same way you make a 2 bit adder out of 1 bit full adders. Concatenate the inputs and outputs and chain the carries.

Related Topic