Page 285 - FUNDAMENTALS OF COMPUTER
P. 285

NPP













                  NPP               Number System, Boolean Algebra and Logic Circuits              285


                  us it is very easy to identify the condition for  ~Vm gH$Vo h¢ & `{X Xmo YZmË_H$ g§»`mAm| H$mo Omo‹S>Zo go
                  overflow. The resulting sign bit would differ  n[aUm_ F$UmË_H$  AmE `m BgH$m CëQ>m hmo Vmo `h
                  from the sign bits of integers which are added.
                  This is called sign reversal. That is the sum of  Amodaâbmo H$s pñW{V h¡Ÿ& Bgo gmBZ [aìhg©b H$hVo h¢Ÿ&
                  two  positive numbers  would be  a  negative  AWm©V² n[aUm_r g§»`m H$m {MÝh Omo‹S>r JB© g§»`mAm| Ho$
                  number and vice-versa.                      {MÝh go {dnarV AmEJm &
                      But computer circuit uses C  (carry in to   bo{H$Z H$åß`yQ>a n[anW C  VWm C  H$s ghm`Vm
                                               in
                                                                                     in
                                                                                            out
                  the sign bits) and C out  (carry-out to the sign bit)  go Amodaâbmo H$m nVm bJmVm h¡Ÿ& AJa `h XmoZm| {~Q>|
                  to determine the condition for overflow. If both  g_mZ h¢ Vmo Amodaâbmo Zht h¡ AV… XmoZm| na XOR H$s
                  are  similar, there  is  no overflow. That is  the
                  reason why both are Exclusive  ORed to  get  {H«$`m H$s OmVr h¡…
                  overflow bit:
                                                        OF = C  ⊕ C out
                                                              in
                      OF  →  Overflow Flag.  The overflow  flag   Ohm± OF → Amodaâbmo âboJ h¡ Ÿ& âboJ V^r goQ>
                  sets if both C  and C out  are different, indicating  hmoVm h¡ (AWm©V² 1) O~ C  VWm C  AbJ-AbJ h¡ Ÿ&
                             in
                  overflow condition. Consider an example:                       in     out
                                                              {ZåZ CXmhaU H$mo XoImo…
                                                          (+5)  + (+6)
                                                            C out     C in

                                                              0        1
                                                      ( 5)   →         0    1 0 1
                                                       +
                                                       +
                                                      ( 6)   →     +   0    1 1 0
                                                                       1    0 11
                                     Sign Reversal

                                                       OF = C  ⊕ C out   = 1 ⊕ 0  = 1
                                                             in
                      This is a case of overflow.
                  2's Complement Subtraction (Signed)             gmBÝS> 2's H$m°påßb_|Q> KQ>md
                      Suppose the problem of signed subtraction   {ZåZ KQ>md H$s g_ñ`m H$mo XoImo…
                  is
                                                          (±A) – (±B)
                      If we take 2's complement of (±B) it will be  `{X h_ (± B) H$m 2's H$m°påßb_|Q> b| Vmo dh ( B  )
                  converted to ( B  ) or in other words subtraction  hmo OmEJm Ÿ& Bg Vah go KQ>md Omo‹S> _| n[ad{V©V hmo OmEJm
                  sign (–) would be changed to addition (+). Now
                  it becomes the  2's  complement addition    Ÿ& Omo‹S> H$s g_ñ`m h_ nhbo hr n‹T> MwHo$ h¢ Ÿ& g_w{MV
                  problem. Add both numbers and neglect any   à{V{Z{YËd Ho$ níMmV² ~mBZar g§»`mAm| H$mo Omo‹S>Vo h¢ VWm
                  end carry. Consider the following. Example:  A§{V_ hm{gb H$mo N>mo‹S> XoVo h¢ Ÿ& CXmhaU…

                                                        (+15)  –  (–17)
   280   281   282   283   284   285   286   287   288   289   290