Carryin /Bits | 0 0 | 0 1 | 1 1 | |||
---|---|---|---|---|---|---|
Cout | S | Cout | S | Cout | S | |
0 | 0 | 0 | 0 | 1 | 1 | 0 |
1 | 0 | 1 | 1 | 0 | 1 | 1 |
Carryin /Bits | 0 0 | 0 1 | 1 1 |
---|---|---|---|
0 | 0'0 | 0'1 | 1'0 |
1 | 0'1 | 1'0 | 1'1 |
1. Allign the bits of the two numbers 2. For each pair of bits, construct the partial sum (from the table above) 3. Repeat until only one pair of sums exist 4. Construct the carryin=0 sum 5. Construct the carryin = 1 sum 6. Look at carry in to determine final result. Construct carryin = 0 sum (a'wwww, b'xxxx) and (c'yyyy ,d'zzzz) 1. Leftmost bits = zzzz (since carryin = 0) 2. If d = 0, rightmost bits = b'xxxx (output = b'xxxxzzzz) 3. If d = 1, rightmost bits = a'wwww (output = a'wwwwzzzz) Construct carryin = 1 sum (a'wwww, b'xxxx) and (c'yyyy ,d'zzzz) 1. Leftmost bits = yyyy (since carryin = 1) 2. If c = 0, rightmost bits = b'xxxx (output = b'xxxxyyyy) 3. If c = 1, rightmost bits = a'wwww (output = a'wwwwyyyy)
1 1 1 0 0 1 1 1 0 0 1 0 (1'1,1'0) (1'1,1'0) (1'0,0'1) (0'1,0'0) (0'1,0'1) (1'0,0'1)
(1'1,1'0) (1'1,1'0) (1'0,0'1) (0'1,0'0) (0'1,0'1) (1'0,0'1) (1'11,1'10) (0'11,0'10) (0'10,0'11) (1'11,1'10) (0'1010,0'1011) (1'101010,1'101011)
a = 1001 b = 101 sum = 0 a * 1 = 1001 sum = 0 + 1001 = 1001 a = 1001 b = 10 sum = 1001 a * 0 = 0 sum << 1 + 0 = 10010 a = 1001 b = 1 sum = 10010 a * 1 = 1001 sum << 1 = 100100 + 1001 101101 = 45