Arithmetic Addition
2's complement addition:
The addition of two numbers in the signed-magnitude system follows the rules of ordinary arithmetic. If the signs are the same, we add the two magnitudes and give the sum the common sign. If the signs are different, we subtract the smaller magnitude from the larger and give the result the sign of the larger magnitude. For example, (+25) + (-37) = - (37 - 25) = - 12 and is done by subtracting the smaller magnitude 25 from the larger magnitude 37 and using the sign of 37 for the sign of the result. This is a process that requires the comparison of the signs and the magnitudes and then performing either addition or subtraction. (The procedure for adding binary numbers in signedmagnitude representation is described in Sec. 10-2.) By contrast, the rule for adding numbers in the signed-2's complement system does not require a comparison or subtraction, only addition and complementation. The procedure is very simple and can be stated as follows: Add the two numbers, including their sign bits, and discard any carry out of the sign (leftmost) bit position. Numerical examples for addition are shown below. Note that negative numbers must initially be in 2' s complement and that if the sum obtained after the addition is negative, it is in 2's complement form.
+6 00000110 -6 111 11010
+ 13 00001101 + 13 00001101
+19 00010011 +7 000001 11
These Topics Are Also In Your Syllabus | ||
---|---|---|
1 | Error Detection Codes-2 | link |
2 | Register Transfer Language | link |
You May Find Something Very Interesting Here. | link | |
3 | Register Transfer Language -2 | link |
4 | Register Transfer | link |
5 | Register Transfer -2 | link |
+6 00000110 -6 11111010
- 13 11110011 - 13 11110011 :
:'j 1111 1001 -19 1 1 101101
In each of the four cases, the operation performed is always addition, including the sign bits. Any carry out of the sign bit position is discarded, and negative results are automatically in 2' s complement form.
The complement form of representing negative numbers is unfamiliar to people used to the signed-magnitude system. To determine the value of a negative number when in signed-2's complement, it is necessary to convert it to a positive number to place it in a more familiar form. For example, the signed binary number 1111 1001 is negative because the leftmost bit is I. Its 2' s complement is 00000111, which is the binary equivalent of +7. We therefore recognize the original negative number to be equal to -7.
These Topics Are Also In Your Syllabus | ||
---|---|---|
1 | Indirect Address | link |
2 | Computer Registers | link |
You May Find Something Very Interesting Here. | link | |
3 | Program Counter | link |
4 | Common Bus System | link |
5 | Common Bus System-memory address | link |