60 Computer Architecture and Organization
In these examples, we have considered a 4-bit representation. However, the same rule is applicable for
8-bit or 16-bit representation and the result may be interpreted in the same way.
4.2.2 Purpose of Two’s Complement
However, at this stage, the reader may ask about the meaning of two’s complement representation. As a
matter of fact it simply changes the sign of a given number. If we take +3 (0011 in binary) and calculate
its two’s complement, it would give us −3 (1101 in binary). Similarly, if we take −5 (1011 in binary) and
calculate its two’s complement, it would generate +5 (0101 in binary). The reader may take any integer
in binary form, positive or negative and prove it by longhand calculations using 4-bit or 8-bit format
(or any n -bit format). Just remember that any eventual carry, generated after adding 1 has to be dis-
carded and the n -bit format has to be maintained throughout.
The purpose of two’s complement representation is to make the subtraction process easier, as an
addition of any number in its two’s complement is actually its subtraction. We can easily understand
that, addition or subtraction is a matter of the sign involved. Otherwise they may be considered as
identical (refer our algebra course in schools). Therefore, we shall now discuss about sign representa-
tion in Section 4.2.3.
4.2.3 Sign Representation
If we have to perform the arithmetic operations, we cannot avoid the signs involved with numbers.
Of course, we do not consider the imaginary numbers but only the positive and negative numbers.
In this section, we shall consider only integers and in a later section we shall discuss about the sign
convention adopted for real numbers. Out of several available methods (at least four), two methods
of sign representation are widely adopted. In the rst method, known as signed-magnitude method,
the most signi cant bit of binary representation is reserved as the sign bit, which should contain 0 to
indicate positive and 1 to represent negative integers. The remaining bits of the location are to repre-
sent the magnitude of the number, i.e., its absolute value. Therefore, if we consider 8-bit representa-
tion of integers, using this method, 00000001 would represent +1 and 10000001 would represent −1.
In Table 4.1, considering 4-bit representation, signed decimal integers from +7 to −7 are shown in its
second column, using signed-magnitude representation scheme. Another widely adopted method for
sign representation is the two’s complement method, which we have discussed above. Using 4-bit
representation, two’s complement values for the decimal range between +7 and −7 are presented in the
third column of Table 4.1.
One of the major disadvantages of signed-magnitude method of sign representation is the duplication
of the value of zero (0). As we may observe, in 4-bit representation, the most signi cant bit would indi-
cate the sign and remaining three bits are left to represent the number. To represent zero, all these three
bits would be 0, i.e., 000. The most signi cant bit may contain either 0 or 1 indicating the value as +0 or
−0. However, the advantage of this method is that the absolute value of the integer (value irrespective of
its sign) may easily be obtained by discarding its sign bit, which is an easy process in Boolean operation.
In two’s complement method, this duplicate representation of zero is avoided, as we may observe
from Table 4.1. Moreover, the sign of the integer may be readily available through its most signi cant
bit, similar to the signed-magnitude representation. In other words, in two’s complement representation,
if the most signi cant bit is 0, then the number is positive, and if it is 1, then the number is negative.
However, unlike the signed-magnitude method, the range of integers is not identical for positive and
negative numbers, in this representation.
M04_GHOS1557_01_SE_C04.indd 60M04_GHOS1557_01_SE_C04.indd 60 4/29/11 5:03 PM4/29/11 5:03 PM