Restoring Division Algorithm For Unsigned Integer
Algorithm
Restoring Division Algorithm For Unsigned Integer Steps
|
Step-1:
|
Initialize registers
Q = Dividend, M = Divisor, A = 0, n = number of bits in dividend
|
Step-2:
|
Content of register A and Q is shifted left as by considering them as a single unit AQ
|
Step-3:
|
Content of register M is subtracted from A and result is stored in A (i.e. A = A - M)
|
Step-4:
|
The MSB (most significant bit) of the A is checked if it is 0 then LSB (least significant bit) of Q is set to 1 otherwise if it is 1 then LSB of Q is set to 0 and value of register A is restored.
|
Step-5:
|
The value of counter n is decremented by 1
|
Step-6:
|
If value of n becomes 0 then goto next step otherwise repeat from step-2
|
Step-7:
|
Now register Q contains Quotient value and A contains Remainder value
|
Example-1
1. Find 11 divided by 3 using restoring division Algorithm method
Solution:
Dividend = 11
Divisor = 3
First the registers are initialized with corresponding values (Q = Dividend, M = Divisor, A = 0, n = number of bits in dividend)
n | M | A | Q | Operation |
4 | 00011 | 00000 | 1011 | initialize |
4 | 00011 | 00001 | 011_ | shift left AQ |
| 00011 | 11110 | 011_ | A=A-M |
| 00011 | 00001 | 0110 | Q[0]=0 And restore A |
3 | 00011 | 00010 | 110_ | shift left AQ |
| 00011 | 11111 | 110_ | A=A-M |
| 00011 | 00010 | 1100 | Q[0]=0 And restore A |
2 | 00011 | 00101 | 100_ | shift left AQ |
| 00011 | 00010 | 100_ | A=A-M |
| 00011 | 00010 | 1001 | Q[0]=1 |
1 | 00011 | 00101 | 001_ | shift left AQ |
| 00011 | 00010 | 001_ | A=A-M |
| 00011 | 00010 | 0011 | Q[0]=1 |
register Q contain the quotient 3 and register A contain remainder 2
This material is intended as a summary. Use your textbook for detail explanation.
Any bug, improvement, feedback then