Saturday 1 June 2013

Program for Restoring Division.


Restoring (conventional) binary divide, twos complement 4-bit numbers

                                1 1 0 0   quotient
                       ________________
             0 1 1 1  / 0 1 0 1 0 1 0 1
                       -0 1 1 1      may subtract by adding twos complement
                        _______          - 0 1 1 1   is   1 0 0 1
   5 - 7 = -2           1 1 1 0
   negative, add 7     +0 1 1 1
   restored             _______
   next bit               1 0 1 0
                         -0 1 1 1
                          _______
   10 - 7 = 3               0 1 1 1
   quotient=1, next bit    -0 1 1 1
                            _______
   7 - 7 = 0                0 0 0 0 0
   quotient=1, next bit      -0 1 1 1
                              _______
   0 - 7 = -7                 1 0 0 1
   negative, add 7           +0 1 1 1
   quotient=0                 _______
   restored, next bit           0 0 0 1
                               -0 1 1 1
                                _______
   1 - 7 = -6                   1 0 1 0
   negative, add 7             +0 1 1 1
   quotient=0                   _______
   restored, finished           0 0 0 1   final remainder
   (8 cycles using adder)

Download With OUTPUT


EmoticonEmoticon