Page 91 - Engineering Digital Design
P. 91

62              CHAPTER 2 / NUMBER SYSTEMS, BINARY ARITHMETIC, AND CODES


                       Therefore, at the end of four iterations the quotient is

                                     Q = D Dk 0kik 2k 3 =0.1011111111111111010 2
                                                    = 0.7510 after rounding.

                    In 32-bit FPN notation the quotient Q would be given as

                                      ^01111111 011111111111111010- • • 00,
                                       S     E               M
                    where the most significant 1 bit in the mantissa M has been omitted in agreement the IEEE
                    normalized FPN notation discussed in Section 2.8.

                       In the simple example just given the value of a was determined by the value of D s.
                    Because this is a quadratic convergence algorithm, the process starts off slowly, particu-
                    larly if the divisor is close to |. The division calculations in computers can be speeded
                    up by using ROM look-up tables to determine a based on the divisor value. Further-
                    more, it is common practice to fix the number of iterations and then deal with rounding
                    problem.
                       With some simplifying assumptions the following algorithm generalizes the quadratic
                    convergence process for iterative division:

                                           Algorithm 2.13: Q = D D ~ D s
                     (1) Set DS to normalized FPN form, retain the MSB 1 in the mantissa, and adjust the
                     exponent as required by the FPN notation.
                     (2) Calculate a = 1 — DS by using Algorithm 2.9.
                     (3) Set fco = 1 + a and calculate (D$&o)2c by using Algorithms 2.10 and 2.6.
                     (4) Set k\ = 1 + (Dsko)2c and calculate (Dskoki^c as in step (3).
                                                                     for all j = 2, 3,....
                     (5) Repeat steps (1) through (4) for kj ~ 1 + D s
                                        j  »        j  *
                     (6) Calculate Q = D D J~| k { when D s ]~[ k t< — 1.
                                                    i=0


                    2.9.6  BCD Addition and Subtraction

                    Compared to binary arithmetic, BCD arithmetic is more complex, particularly with regard
                    to hardware implementation. This is true since not all possible four-bit binary number states
                    correspond to the BCD number system. The six number patterns 1010, 1011, 1100, 1101,
                    1110, and 1111 are not valid BCD states, as is indicated in Table 2.2.

                    BCD Addition BCD addition is similar to unsigned binary addition, except that a correc-
                    tion must be made any time a sum exceeds 9io = 10012. Summation begins with the least
                    significant digit (LSD) and ends with the most significant digit (MSD). If the sum exceeds
                    1001 for any given digit, that sum is corrected by adding 610 = 01102 with a carry of 0001
                    to the next MSD. The following example illustrates the addition process for two-decade
                    BCD integers ABCD = ^10^1 and BBCD — #10 #1 represented in three-decade form:
   86   87   88   89   90   91   92   93   94   95   96