Digital circuits: Adders and subtractors

These are purely combinatory circuits.

No clock involved.

Single bit adders

Half adder

A B Sum Carry
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1

Full adder

A B Cᵢₙ Sum Cₒᵤₜ
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1

Multi-bit adders

An n-bit adder is made using n 1-bit full adders.

Ripple carry adder

Carry-out of i-th full adder is given as the carry-in of the i+1-st full adder.

The carry signal 'ripples' through the full adders.

To add n-bit numbers, we need n stages of full adders.

cout of previous full adder becomes cin of next full adder. ie, cinᵢ₊₁ = coutᵢ

Time required for addition in a ripple carry adder = propagation delay of the carry to ripple through the different stage of the overall adder.

The first carry value (which should be part of input) is sometimes called forced carry. And the last carry value (which is part of output) is also known as overflow carry.

aₙ₋₁ bₙ₋₁   coutₙ₋₁     a₁  b₁   cout₀    a₀  b₀ cin₀
  |  |  +-----+          |  |  +-----+     |  |  |        
  |  |  V     |          |  |  |     |     |  |  |        
+---------+   ^        +---------+   ^   +---------+    
|         |   ...      |         |   |   |         |    
|  FAn-1  |    ...     |   FA1   |   |   |   FA0   |    
|         |     ...    |         |   |   |         |
+---------+       ^    +---------+   ^   +---------+    
   |   |          |       |   |      |      |   |        
   V   V          +-------+   V      +------+   V        
       sₙ₋₁         cout₁     s₁       cout₀    s₀
coutₙ₋₁

Output would be calculate like:

sᵢ    = aᵢ ⊕ bᵢ ⊕ cinᵢ
coutᵢ = aᵢ.bᵢ + bᵢ.cinᵢ + aᵢ.cinᵢ

Look ahead carry adder

Use formula to calculate the value of carry outs faster??

dᵢ = aᵢ.bᵢ
tᵢ = aᵢ ⊕ bᵢ

coutᵢ = dᵢ + tᵢ.cinᵢ
sᵢ    = aᵢ ⊕ bᵢ ⊕ cinᵢ

Carry save adder

Instead of delaying execution by waiting for every previous full adder's carry out to be calculated, we store (ie, 'save') the carry-out of every full adder.

The actual result is calculated by applying the effect all carry out values at the end.

Single bit subtractors

Half subtractor

A B D Borrow
0 0 0 0
0 1 1 1
1 0 1 0
1 1 0 0

Full subtractor

A B Bᵢₙ D Bₒᵤₜ
0 0 0 0 0
0 0 1 1 1
0 1 0 1 1
0 1 1 0 1
1 0 0 1 0
1 0 1 0 0
1 1 0 0 0
1 1 1 1 1
A \ BC
   \ 00  01  11  10
    +---+---+---+---+
  0 |   | 1 | 1 | 1 |
    +---+---+---+---+
  1 |   |   | 1 |   |
    +---+---+---+---+

K-map for Bout (with C=Bₒᵤₜ)