Tuesday, 30 September 2014

Why overflows are omitted in the non-restoring hardware binary division algorithm?


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

arduino - Can I use TI&#39;s cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...