CleverSphere

Full adders, ripple carry and overflow

A ripple-carry adder chains full adders. Each stage takes two bits and a carry and produces a sum and the next carry.

Rules

  • Sum: s = a ⊕ b ⊕ c
  • Carry: c′ = (a ∧ b) ∨ (c ∧ (a ⊕ b))
  • Start on the right, pass the carry along
  • Two’s complement overflow: c3 ⊕ c4
  • Carry c4 and overflow are not the same

Your turn

Three problems on this topic. Any equivalent formula counts.

  1. 1 · Adders & overflow
  2. 2
  3. 3

A 4-bit ripple-carry adder adds A = 1000, B = 0001 with carry-in c0 = 1.

Sum S3 S2 S1 S0

Tap a cell to switch between 0 and 1. The digits above are the values of the variables.

Carry-out c4

Two’s complement overflow?

Worked example

A 4-bit ripple-carry adder adds A = 1100, B = 1111 with carry-in c0 = 0.

Worked solution

  1. 1Bit 0: a = 0, b = 1, c = 0 → s = 1, carry 0
  2. 2Bit 1: a = 0, b = 1, c = 0 → s = 1, carry 0
  3. 3Bit 2: a = 1, b = 1, c = 0 → s = 0, carry 1
  4. 4Bit 3: a = 1, b = 1, c = 1 → s = 1, carry 1
  5. 5Two’s complement overflow = c3 ⊕ c4 = 1 ⊕ 1 = 0

Typical mistake: Carry and overflow are not the same: overflow occurs when c3 and c4 differ.

Common questions

What is the difference between carry and overflow?

Carry concerns unsigned numbers. Overflow means the result no longer fits the bit width in two’s complement.

Related

More topics