Carries ripple, numbers wrap
07Multi-bit arithmetic
- Stage 1
- Stage 2
- Stage 3
- Stage 4
- Stage 5
- Stage 6
- Stage 7 (this one)
- Stage 8
- Stage 9
- Stage 10
- Stage 11
- Stage 12
- Stage 13
- Stage 14
- Stage 15
Explanation
Chain eight full adders, carry out of each into the next, and you have an 8-bit ripple-carry adder. The carry may have to ripple through every column, so the worst case takes 8 full-adder delays.
A byte cannot hold 256, so 200 + 100 wraps to 44 and the final carry falls off: that is unsigned overflow, signalled by the carry flag. Read as two's complement, 100 + 100 = 200 shows as −56: that is signed overflow, which happens when two numbers of the same sign give a result of the other sign. Subtraction reuses the adder: A − B = A + NOT B + 1.
Eight full adders in a chain
A = 200 (signed -56)
B = 100 (signed 100)
| bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|
| carry in | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| A | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 |
| B | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 |
| sum | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 0 |
- Result
- 44 (signed 44)
- Carry out
- 1
- Unsigned overflow
- yes
- Signed overflow
- no
Longest carry chain this time: 2 columns. Try 255 + 1 for the worst case. Built from 40 gates.
Result 44, carry 1, signed overflow no
Check yourself
Marked instantly in your browser. Use the interactive above to work it out.