Division:

From SPARC Architure, Assembly Language Programming, & C
by Richard P. Paul:

Restoring Division Example:  (two's complement!)

          10111 + 1
        _____________
0100000 ) 01011100001    (737/32 base 10)
          1100000        (-32 base 10)
          _______
          00011100001    positive, set 1 into quotient
           1100000       shift and subtract again
           _______
           1111100001    negative, set 0 into quotient
           0100000       get old dividend back by adding instead of subtracting
           _______       (no shift!)  this is a _restore_
           0011100001
            1100000      shift and try again
            _______
            001100001    positive, set 1 into quotient
             1100000
             _______
             01000001    positive, set 1 into quotient
             1100000     shift and subtract again
             _______
              000001     positive, set 1 into quotient
                         remainder is 1


Non-Restoring Division Example:
Instead of restoring when getting a negative number, you can shift and add
(instead of restore), along with recording a zero into the quotient--this
example explains things a little better...

          10111 remainder of 1
        _____________
0100000 ) 01011100001   (737/32 base 10)
          1100000       (-32 base 10)
          _______
          00011100001   positive, set 1 into quotient
           1100000      shift and subtract again
           _______
           1111100001   negative, set 0 into quotient
            0100000     shift and _add_ (instead of restore!) compare w/ above
            _______
            001100001   positive, set 1 into quotient
             1100000    shift and subtract
             _______
             00100001   positive, set 1 into quotient
              1100000   shift and subtract
              _______
               000001   positive, set 1 into quotient
                        remainder is 1

--end of SPARC manual reference---

Another example of non-restoring division:

0110010 base 2 = 50 base 10
01010 base 2 = 10 base 10    two's comp = 10101 + 1 = 10110 = 10110

        101, no remainder   5 base 10
      _________
01010 ) 0110010
        10110
        -----
        0001010  positive, set 1 into quotient
         10110   shift and subtract
         -----
         110110  negative, set 0 into quotient
          01010  shift and _add_
          -----
          00000  positive, set 1 into quotient, remainder of 0, done




One student posed the question similar to the following:
Why not just do the following (for unsigned representation)?

       10100 remainder of 10   (20 base 10 remainder of 2)
     ___________
1010 ) 11001010    (202/12 base 10)
     - 10100000    by inspection, we can see we can subtract here and
       ________    put a one in the quotient  (note we have to perform a
       00101010    subtract which requires a borrow)
     -   101000    here again, by inspection, we can see we can subtract
         ______    and put a one in the quotient
         000010

So...
Isn't this easier?  It might be for humans to divide binary numbers this way,
but it is hard for a computer to follow our normal algorithm.

In this algorithm, we must perform subtraction which in some instances,
requires borrowing.  This is very difficult and expensive to implement in
logic (gates).  Also, determining how many bits to shift the divisor to find
the correct next subtraction requires lots of steps (time) and extra logic.
On the other hand, the restoring and non-restoring algorithms can be easily
implemented in logic.  (You'll have to trust me on this one.  When you take
CS552, the reasons for using the first two algorithms will become apparent.)