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 |
- Sum = A XOR B
- Carry = AB
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 |
- Sum = A XOR B XOR Cᵢₙ
- Cₒᵤₜ = Cᵢₙ(A XOR B) + AB
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.
- Simple design
- Slower (since each full adder must wait for the carry out from the previous full adder before starting work).
To add n-bit numbers, we need n stages of full adders.
- cinᵢ: Carry-in of i-the full adder
- coutᵢ: Carry-out of i-the full adder
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
- An improvement over ripple carry adder.
- aka CLA (Carry Look-ahead Adder)
- carry values calculated parallelly.
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 |
- Difference = D = A XOR B
- Borrow = B = A'B
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 |
- Difference = D = A XOR B XOR Bᵢₙ
- Borrow out = Bₒᵤₜ = A'C + A'B + BC
A \ BC
\ 00 01 11 10
+---+---+---+---+
0 | | 1 | 1 | 1 |
+---+---+---+---+
1 | | | 1 | |
+---+---+---+---+
K-map for Bout (with C=Bₒᵤₜ)