Skip to content
GATEiit

GATE EC · Digital Circuits

Arithmetic circuits

Half and full adders and subtractors, ripple-carry and carry look-ahead adders with their delays, 2's complement adder-subtractor and overflow, BCD adder, magnitude comparators and array multipliers.

Before you start

This topic comes before: ALU, data-path and control unit, Critical path delay

Concept notes

1. Half adder and full adder

A half adder adds two bits A and B: S=A⊕B,C=AB

A full adder adds three bits A, B and a carry-in Cin: S=A⊕B⊕Cin,Cout=AB+Cin(A⊕B)=AB+BCin+ACin

In minterms, S=∑m(1,2,4,7) (odd number of 1s) and Cout=∑m(3,5,6,7) (two or more 1s, the majority function).

Full adder from two half adders. HA1 forms A⊕B and AB; HA2 adds Cin to give S and Cin(A⊕B); an OR gate combines the two carries. Note that AB and Cin(A⊕B) can never both be 1, so an XOR in place of the OR also works.

Half and full subtractor. For A−B:

Circuit Difference Borrow out
Half subtractor A⊕B A‾B
Full subtractor A⊕B⊕Bin A‾B+A‾Bin+BBin

The difference has the same form as the sum; only the borrow differs (it uses A‾ where the carry uses A).

NAND-only counts often asked: a half adder needs 5 two-input NAND gates and a full adder needs 9.

ABHA1S1 = A⊕B, C1 = ABCinS1HA2SS = A⊕B⊕CinC2C1ORCout
Full adder built from two half adders and an OR gate. HA1 adds A and B; HA2 adds the carry-in to their sum bit S1.

2. Ripple-carry adder and its delay

An n-bit ripple-carry adder (RCA) chains n full adders: the carry-out of stage i is the carry-in of stage i+1. It is simple and uses only n full adders, but it is slow, because the carry may have to pass through every stage (for example 0111…1+0000…1).

Worst-case delay. If each full adder produces its carry tc after its inputs are valid and its sum ts after its carry-in arrives, then with all Ai, Bi, C0 applied together:

  • C1 is ready at tc, Ci at i tc.
  • Sn−1 waits for Cn−1, so it is ready at (n−1)tc+ts.
  • Cn is ready at n tc.

tRCA=(n−1) tc+max⁡(ts, tc)

At gate level, with Cout=AB+Cin(A⊕B), each stage adds 2 gate delays (AND then OR) to the carry path, so an n-bit RCA needs about 2n gate delays. The delay grows linearly with n.

Always read how the question defines the delays (from inputs or from carry-in, sum or carry) and trace the longest path; do not just apply the formula.

FA0A0B0S0C1FA1A1B1S1C2FA2A2B2S2C3FA3A3B3S3C4C0Carry ripples right to left: C4 is valid only after all four carry delays
4-bit ripple-carry adder: each full adder passes its carry to the next stage on its left.

3. Carry look-ahead adder

A carry look-ahead adder (CLA) computes all carries directly from the inputs. For each bit define Gi=AiBi (generate),Pi=Ai⊕Bi (propagate)

Then Ci+1=Gi+PiCi. Expanding:

  • C1=G0+P0C0
  • C2=G1+P1G0+P1P0C0
  • C3=G2+P2G1+P2P1G0+P2P1P0C0
  • C4=G3+P3G2+P3P2G1+P3P2P1G0+P3P2P1P0C0

Each carry is a two-level AND-OR expression, and Si=Pi⊕Ci.

Delay (counting each gate, including XOR, as one delay): P and G in 1, all carries in 3, all sums in 4, independent of n.

Cost. Ci+1 needs AND gates with up to i+2 inputs and an OR gate with i+2 inputs, so fan-in and gate count grow quickly. In practice CLA blocks of 4 bits are used and joined in a ripple or a second look-ahead level.

Pi=Ai+Bi also gives correct carries (when both are 1, Gi already makes the carry 1), but the sum then needs Ai⊕Bi separately.

Adder Hardware Carry delay
Ripple carry n full adders grows as n
Carry look-ahead grows faster than n (large fan-in) constant (about 3 gate delays)

4. Adder-subtractor, overflow and BCD adder

2's complement adder-subtractor. A−B=A+B‾+1. Put an XOR gate on each Bi with a control line M that also drives C0:

  • M=0: XOR passes B, C0=0, output A+B.
  • M=1: XOR inverts B, C0=1, output A−B.

Overflow in signed n-bit addition happens when two numbers of the same sign give a result of the other sign. In hardware: V=Cn⊕Cn−1 (the carry out of the MSB differs from the carry into it). Adding numbers of opposite signs never overflows. For unsigned addition, Cn=1 itself signals overflow.

BCD adder. Add two BCD digits with a 4-bit binary adder, giving carry K and sum Z8Z4Z2Z1. If the result is more than 9, add 0110 (6) to skip the six unused codes. The correction (and the decimal carry) is C=K+Z8Z4+Z8Z2 A second 4-bit adder adds 0 C C 0 to the sum. So one BCD digit stage uses two 4-bit adders and a small correction circuit.

Example: 8+7: binary sum 1111 (15 > 9), add 0110 to get 1 0101, that is BCD 0001 0101 = 15.

5. Magnitude comparator and array multiplier

1-bit comparator: (A>B)=AB‾, (A<B)=A‾B, (A=B)=A⊕B‾ (XNOR).

n-bit comparator. Let xi=Ai⊕Bi‾ (1 when bit i is equal). Compare from the MSB down; the first unequal bit decides. For 4 bits:

  • (A=B)=x3x2x1x0
  • (A>B)=A3B3‾+x3A2B2‾+x3x2A1B1‾+x3x2x1A0B0‾
  • (A<B) is the same with Ai‾Bi in place of AiBi‾.

Exactly one of the three outputs is 1 at any time.

Array multiplier. Multiplying an m-bit number by an n-bit number:

  • partial-product bits AiBj need m×n AND gates;
  • the n shifted rows are summed by (n−1) adders of m bits each;
  • the product has m+n bits (largest value (2m−1)(2n−1)<2m+n).

2-bit by 2-bit multiplier: P0=A0B0; P1=A1B0⊕A0B1 with carry c1=A1B0A0B1; P2=A1B1⊕c1; P3=A1B1c1. It uses 4 AND gates and 2 half adders.

Multiplying by 2k needs no hardware: it is a left shift by k places.

Formulas to remember

Full adder sum
S=A⊕B⊕Cin
Full adder carryMajority function, ∑m(3,5,6,7)
Cout=AB+Cin(A⊕B)
Generate and propagate
Gi=AiBi,Pi=Ai⊕Bi,Ci+1=Gi+PiCi
Ripple-carry worst-case delaytc: carry delay per stage, ts: carry-in to sum delay (when ts≥tc)
t=(n−1) tc+ts
Signed overflow
V=Cn⊕Cn−1
BCD correctionIf C = 1, add 0110 to the binary sum
C=K+Z8Z4+Z8Z2
Array multiplier size
mn AND gates,(n−1) m-bit adders,m+n product bits

Common mistakes

  • Using n times the carry delay for the last sum bit; the last sum needs only n − 1 carry delays plus one sum delay.
  • Taking the final carry C4 as the overflow flag in signed addition; signed overflow is C4 XOR C3.
  • In a BCD adder, correcting only when the 4-bit sum exceeds 1001 and forgetting the case where the binary adder itself produces a carry (sums 16 to 19).
  • Writing the borrow of a subtractor as AB' instead of A'B (for A minus B).
  • In a magnitude comparator, testing a lower bit without the condition that all higher bits are equal.
  • Counting n full adders for an m by n array multiplier; it needs n − 1 adders of m bits each.

Worked examples

Try each step yourself, then reveal the working.

Example 1: Worst-case delay of an 8-bit ripple-carry adder

numerical

An 8-bit ripple-carry adder is built from full adders. In each full adder the carry-out is valid 2 ns after its inputs (including carry-in) are valid, and the sum is valid 3 ns after its carry-in is valid. All Ai, Bi and C0 are applied at t=0. Find the time after which all outputs are valid.

  1. Step 1: When is each carry ready?

    Try it on paper first.

Example 2: Subtraction and overflow in a 4-bit adder-subtractor

numerical

A 4-bit 2's complement adder-subtractor has A=0110 and B=0101. Find the output and the overflow flag V=C4⊕C3 for (a) M=1 (subtract) and (b) M=0 (add).

  1. Step 1: For M = 1, what does the adder actually add?

    Try it on paper first.

Example 3: Adding two BCD numbers

numerical

Add the BCD numbers 0101 1000 (58) and 0010 0111 (27) using BCD adder stages. How many times is the correction 0110 added?

  1. Step 1: Add the units digits first.

    Try it on paper first.

Example 4: Designing a 2-bit by 2-bit multiplier

conceptual

Design a multiplier for A1A0×B1B0 using AND gates and half adders, and check it for A=11, B=10.

  1. Step 1: Write the partial products as in long multiplication.

    Try it on paper first.

Previous year questions

1 official GATE EC question on this topic, newest first.

Topic test

9 questions: up to 1 official PYQs and original practice questions, with GATE marking (MCQ wrong answers lose marks). Score 60% or more to pass. A new set is drawn each time.

Mark as mastered

Loading your progress…

My revision notes

Notes written by the GATEiit team against the official GATE EC syllabus; being checked by a reviewer. Updated 2026-11-29. Spotted a mistake? Use Report an issue on any question, or contact us.