I'm reading a book about a non-restoring binary division algorithm, for example 52_octal
divided by 41_octal
:
Round | Action | Divisor | Remainder(6 bits) appended Quotient(6 bits)
------+-------------------+---------+----------------------------------------------
0 | Init Value | 100 001 | 000 000 101 010
| R>0, RQ << 0, Sub | 100 001 | 000 001 010 100
------+-------------------+---------+----------------------------------------------
1 | R=R-D | 100 001 | 100 000 010 100
| R<0, RQ << 0, Add | 100 001 | 000 000 101 000 <--- Now the remainder bits overflow!
------+-------------------+---------+----------------------------------------------
2 | R=R+D | 100 001 | 100 001 101 000
| R<0, RQ << 0, Add | 100 001 | 000 011 010 000 <--- Overflow again.
------+-------------------+---------+----------------------------------------------
3 | R=R+D | 100 001 | 100 100 010 000
| R<0, RQ << 0, Add | 100 001 | 001 000 100 000 <--- Overflow again.
------+-------------------+---------+----------------------------------------------
4 | R=R+D | 100 001 | 101 001 100 000
| R<0, RQ << 0, Add | 100 001 | 010 011 000 000 <--- Overflow again.
------+-------------------+---------+----------------------------------------------
5 | R=R+D | 100 001 | 110 100 000 000
| R<0, RQ << 0, Add | 100 001 | 101 000 000 000 <--- Overflow again.
------+-------------------+---------+----------------------------------------------
6 | R=R+D | 100 001 | 001 001 000 000
| R>0, RQ << 1, Sub | 100 001 | 010 010 000 001
------+-------------------+---------+----------------------------------------------
| Shift R-part right 1 bit | 001 001 000 001
| R=11_oct | Q=1_oct
End
Why won't this cause an error? I follow this algorithm and it gives right answer...
No comments:
Post a Comment