Restoring Division - mbits-mirafra/digitalDesignCourse GitHub Wiki
Steps included
- Initialize
- Shift
- addition/subtraction
- Set Q0
- Restore A
The steps 2 to 4 are repeated n times. (n - number of bits in Dividend)
1. initialize :
Q register -A ānā bit Dividend is initialized B register - Divisor is given B register. The Number of bits in the divisor must be equal to ān+1ā. If not equal 0ās are added to MSB. A register - initialized to 0 with n+1 bits.
Ex: dividend - 1011 Divisor - 101 In Q register ā- 1011 (n=4) In B register ā 00101 (n+1=5) A register ā 00000
2. Shift
It referred to left shifting of A and Q register
3. Addition / subtraction
Based on the MSB of A register after shifting operation addition or subtraction is performed
If MSB of A register is 1 - divisor is added to A register If MSB of A register is 0 - divisor is subtracted from A register
4. Set Q0
Based on the value of MSB of A register after addition/ subtraction Q0 is set either 1 or 0
If MSB of A register is 1 - Q0 is set to 1 If MSB of A register is 0 - Q0 is set to 0
5. Reset A
To reset A register divisor is added to the A register.
After n cycle if the MSB of A register is 1 then divisor must be added to it to get the final value of A register. Otherwise Its the final value.
Finally the number in A register is Reminder The number in Q Register is Quotient.