What is restoring method in division algorithm?
What is restoring method in division algorithm?
The restoring method is a way of dividing two binary numbers by repeated subtraction and shifting. Register $A$ starts at 0, $Q$ holds the dividend and $M$ holds the divisor.
In each of $n$ cycles, we shift $A$ and $Q$ left by one bit. Then we subtract $M$ from $A$. If the result is negative, the subtraction was too large. So we set $Q_0 = 0$ and add $M$ back to $A$, which restores the old value. If the result is not negative, we set $Q_0 = 1$.
After $n$ cycles, $Q$ holds the quotient and $A$ holds the remainder. For example, $7 \div 3$ gives quotient $2$ and remainder $1$.
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.
Up nextDefine micro operation and micro code.