Page 81 - Engineering Digital Design
P. 81
52 CHAPTER 2 / NUMBER SYSTEMS, BINARY ARITHMETIC, AND CODES
forms. For example, the IEEE double-precision FPN system requires an exponent of 11 bits
in excess 1023 code and a mantissa (in sign-magnitude) of 53 bits for a total 64 bits.
2.9 BINARY ARITHMETIC
There are many ways in which to manipulate data for the purpose of computation. It is
not the intent of this section to discuss all these methods. Rather, the emphasis will be
on the basic addition, subtraction, multiplication, and division methods for binary number
manipulation as a foundation for the design of the arithmetic units featured in Chapter 8. The
coverage will include the basic heuristics involved in fixed-point binary arithmetic together
with simple examples. Advanced methods applicable to computer arithmetic operations
are provided as needed for the device design. A limited treatment of floating-point binary
arithmetic will be given in a later section.
2.9.1 Direct Addition and Subtraction of Binary Numbers
The addition of any two positive binary numbers is accomplished in a manner similar to
that of two radix (base) 10 numbers. When the addition of two binary bits exceeds 01 2, a
carry bit is added to the next MSB, and this process is continued until all bits of the addend
and augend have been added together. As an example consider the addition of the following
two 8-bit numbers:
EXAMPLE 2.21
111 1 1 <- Carries
59io 0 0 1 1 1 0 1 1 2 = Augend
+ 122ip +0 1 1 1 1 0 1 0 2 = Addend
181,0 1 0 1 1 0 1 0 1 2 = Sum
Notice that in binary addition the carry is rippled to the left in much the same manner as
in base 10 addition. The binary numbers are easily converted to base 10 by the method of
positional weight described in Section 2.3.
Algorithm 2.8: A 2 + B 2
(1) Set operands A2 = a n-ia n-2 • • • a\aQ and B 2 = b n-.\b n-i • • • b\b<y, and their sum
A 2 + B 2 = S n S n ~i - • - S\ SQ = $2-
(2) Set i = 0 and S 2 - 0.
(3)Ifflo+&o < lOa* SQ — ao+^oandacarry C\ = 0 is generated for position i + 1 = 1,
>; 102. then So = «o +&o ~~ 1^2 and a carry C/+i = 1 is generated into position
(4) Continue steps (2) and (3) in the order i = 1, 2, 3, ...,« — 1 with carries generated
into position i + 1.
(5) The most significant sum bit is S n = C n, where C n is the carry resulting from the
addition of «„_! , b n~i , and C n-\ .