๐งฎ Full Adder from Half Adders
A full adder computes the sum of three binary inputs: A, B, and C_in (carry-in), producing:
SumC_out(carry-out)
This notebook shows how to construct a full adder using two half adders and one OR gate.
๐ง Logic Expressions
Full Adder Logic
Sum = A โ B โ CinCout = (A โ B)ยทCin + AยทB
๐งฑ Construction Using Half Adders
Step 1: First Half Adder
- Inputs:
A,B - Outputs:
Sum1 = A โ BCarry1 = A ยท B
Step 2: Second Half Adder
- Inputs:
Sum1,Cin - Outputs:
Sum = Sum1 โ CinCarry2 = Sum1 ยท Cin
Step 3: Final Carry Output
Cout = Carry1 + Carry2
๐ Gate-Level Implementation
| Component | Inputs | Output | Function |
|---|---|---|---|
| XOR Gate 1 | A, B | Sum1 | A โ B |
| AND Gate 1 | A, B | Carry1 | A ยท B |
| XOR Gate 2 | Sum1, Cin | Sum | Sum1 โ Cin |
| AND Gate 2 | Sum1, Cin | Carry2 | Sum1 ยท Cin |
| OR Gate | Carry1, Carry2 | Cout | Carry1 + Carry2 |
๐งช Verilog Structural Module
module full_adder (
input wire A,
input wire B,
input wire Cin,
output wire Sum,
output wire Cout
);
wire Sum1, Carry1, Carry2;
// First half adder
xor xor1 (Sum1, A, B);
and and1 (Carry1, A, B);
// Second half adder
xor xor2 (Sum, Sum1, Cin);
and and2 (Carry2, Sum1, Cin);
// Final carry output
or or1 (Cout, Carry1, Carry2);
endmoduleLast updated on