Page 92 - Bebop to The Boolean Boogie An Unconventional Guide to Electronics Fundamentals, Components, and Processes
P. 92

Binary Arithmetic    73

                        Standard subtraction
                             00 11 1001
                          -0001 11 10

                          =00011011








                        l100000000                       001 11001 I
                        I-00011110                     +111000101
                        I    11100010                  10001 101 1
                        I=
                       I-                                0001 101 1
                        I    Take twos complement        - 1
                                                         Add twos complement  I
                                                              to minuend        I
                       L--------------------~

                            Figure 8-6. Twos complement binary subtraction


                 As fate would have it, there is a short-cut approach available to generate
             the twos complement of a binary number. Commencing with the least signifi-
             cant bit of the value to be complemented, each bit up to and including the first
                         *                         *
             1 is copied directly, and the remaining bits are inverted (Figure 8-7).
                        MSB                       L56








                          - _ _ - _ _           1  0  I  Copyfrom the L56 upto,
                                                            and including, the  first 1



                          1  1  1  0  0  0  1  0  I  lnvertthe remaining bits



                         Figure 8-7. Shortcut for generating a twos complement
   87   88   89   90   91   92   93   94   95   96   97