Hardware Reference
In-Depth Information
B.10 Binary Addition and Subtraction
Addition in binary representation follows the familiar rules of decimal addition. When adding
two numbers, add the successive bits and any carry. You will need the following addition rules:
0 1 0 5 0
0 1 1 5 1
1 1 1 5 0 carry 5 1
1 1 1 1 1 5 1 carry 5 1
A carry generated in any bit position is added to the next higher bit.
Binary numbers are subtracted using the following rules:
0 2 0 5 0
0 2 1 5 1 with a borrow 1
1 2 0 5 1
1 2 1 5 0
Example B.9
Add the following pairs of binary positive numbers:
a. 1110110 2 and 1100100 2
b. 01101 2 and 10001 2
Solution: The addition process is shown in Figure B.5.
a. carry
b. carry
1
1
1
1
1
0
0
1
1
0
0
1
1
1
0
1
0
1
1
1
0
1
0
1
0
0
0
0
1
1
1
0
1
1
0
1
1
1
0
+
1
+
Figure B.5 Examples of binary addition
Example B.10
Perform the following binary subtractions:
a. 11001 2 2 110 2
b. 110011 2 2 11001 2
Solution: The subtraction process is shown in Figure B.6.
a.
b.
1
1
1
0
1
0
borrow
minuend
subtrahend
difference
1
1
1
1
1
1
borrow
minuend
subtrahend
difference
1
0
1
1
1
0
1
0
1
1
0
0
0
1
0
1
1
1
0
+
1
0
0
Figure B.6 Examples of binary subtraction
Search WWH ::




Custom Search