Skip to content

Mathematics

The mathematics are as simple as addition of 10-based digits

  • Add two binary number of the same bit and the carry (from the last bit)
  • If sum exeeds 1, sum turns 0, add 1 to the next carry

Overflow

Overflow occurs when the result of addition exceeds the maximum length of binary digits (2N), resulting the result to be the modulo of 2N (decreases 2N)

Digital Adder

  • Half Adder - adds two bits
  • Full Adder - adds three bits
  • Adder - Adds two numbers

Half Adder

If the carry is 0, then

abSumCarry
0000
1010
0110
1101
  • Sum=a XOR b
  • Carry=a AND b

**Diagram**

Full Adder

Why a half adder is called HALF? There're two of them in a FULL Adder.

Take the carry into consideration

abc (last carry)SumCarry
00000
00110
10010
10101
01010
01101
11001
11111
  • There're two ways to get Sum=1
    1. HalfAdd(a,b)sum=0 And c=1
    2. HalfAdd(a,b)sum=1 And c=0
    • Otherwise Sum = 0
    • Sum=HalfAdd(HalfAdd(a,b)sum,c)sum
  • There're two ways to get Carry=1
    1. HalfAdd(a,b)sum=1 And c=1
    2. HalfAdd(a,b)carry=1
      • (c doesn't matter because HalfAdd(a,b)sum0, so c only affect Sum)
    • Carry=HalfAdd(HalfAdd(a,b)sum,c))carryHalfAdd(a,b)carry

**Diagram**

Multi-bit Adder

  • The first c is always 0
  • The last carry is thrown (ignore the overflow)

For N-bit adder

  • 1 Half adder
  • N-1 Full adder