Altifigence Academy

13 / 36 · Concept

Half adders and full adders

Compute sum and carry separately, then chain them.

Learning goals

  • Distinguish sum width from carry.
  • Explain how full adders can be chained.

1+1 produces a two-bit result.

A half adder computes sum=a^b and carry=a&b. Adding 1 and 1 gives binary 10, so sum=0 and carry=1.

A full adder also adds cin from the previous position. Its sum is a^b^cin and cout=(a&b)|(a&cin)|(b&cin). Carry is 1 when at least two inputs are 1.

RTL excerpt
assign sum = a ^ b ^ cin;
assign cout = (a & b) | (a & cin) | (b & cin);

Change the inputs

Pass carry to the next bit.

In a chain, cout from bit 0 becomes cin for bit 1. Keeping the final carry when adding two N-bit inputs requires an N+1-bit result.

Make width explicit with assign total = {1'b0, a} + {1'b0, b};. A ripple-carry implementation has propagation delay; the arithmetic expression alone does not verify its speed.

Try it yourself

Find sum and cout for a=1, b=0, cin=1.

Read the explanation

The total is 2, or binary 10: sum=0 and cout=1.

Your choice applies to this browser. Change it any time using the footer.