Page 289 - Engineering Digital Design
P. 289

260               CHAPTER 6 / NONARITHMETIC COMBINATIONAL LOGIC DEVICES


                    output expressions become

                                              A' = B(C + £>) + A
                                              B' = B®(C + D) + AB

                                              C' = COD + AC + AB                       (6.16)




                    now representing a gate/input tally of 10/22, excluding an inverter but including three shared
                    Pis. Clearly, the FDR feature comes at a significant price in terms of hardware. FDR states
                    other than the 1111 can be used, as for example the 0000 state, but all increase the cost in
                    hardware even further.

                    Conversion between BCD and Binary The BCD and binary codes are two of the most
                    widely used codes in digital design, so it is fitting that conversion between them be consid-
                    ered. The simplest approach is to establish workable algorithms to produce an expandable
                    modular design. Even so, such tasks rank among the more difficult conversion problems.
                    Consider, for example, that a two-digit BCD word converts to an 8-bit binary number,
                    whereas an 8-bit binary word converts to a three-digit BCD representation.
                      Two algorithms will now be considered that make conversion between these two codes
                    tractable and that lead to modular designs. In these algorithms shifting right by one bit
                    is equivalent to dividing by 2 (srl = -^2) and shifting left by one bit is equivalent to
                    multiplying by 2 (sll = x2). Also, LSD and MSD refer to the least significant digit and
                    most significant digit, respectively, for the BCD number. A detailed treatment of the bi-
                    nary and BCD number systems is provided in Sections 2.3 and 2.4, and the pencil-and-
                    paper conversion method between the binary and BCD number systems is discussed in
                    Subsection 2.4.1.
                      The first of the two algorithms, the BCD-to-binary conversion, requires that the BCD
                    number first be placed in imaginary storage cells. For example, a two-decade BCD number
                    will occupy eight imaginary storage cells. After this has been done, then the algorithm
                    proceeds as follows:


                            Algorithm 6. 1 BCD-to-Binary Conversion by the (-~2)/(— 3) Process
                     (1) Shift the BCD number to the right by one bit into the new LSD position, but keeping
                     account of the bits shifted out of the LSD.
                     (2) Subtract 001 1 from the LSD (or add 1101 to the LSD if in 2's complement) iff the
                     new LSD number is greater than 7 (0111). After subtracting 3, shift right immediately
                     even if the new LSD is greater than 7.
                     (3) Repeat steps (1) and (2) until the final LSD number can no longer be greater than
                     decimal 7. The answer is now in binary.

                      Algorithm 6.1 is sometimes referred to as the shift-right/subtract 3 [or (-f 2)/(— 3)] algo-
                    rithm. The algorithm for binary-to-BCD conversion can be thought of as the mathematical
                    dual of Algorithm 6. 1 . In this case the process could be called the shift-left/add 3 [or ( x 2)/
                    (+3)] algorithm. Begin by placing the binary number outside and to the right of the LSD
                    positions, then proceed as follows:
   284   285   286   287   288   289   290   291   292   293   294