RDIV Binary Division Algorithm

Restoring Division Calculator

Perform unsigned binary division using the restoring division algorithm. Follow accumulator A, quotient register Q, divisor M, left shifts, subtraction tests, restoration steps, quotient-bit decisions and the final remainder.

Unsigned Division Accumulator A Quotient Q Divisor M Restore A Step-by-Step
Restoring Binary Division Register Simulation
Unsigned binary dividend loaded into Q.
Unsigned binary divisor. Divisor cannot be zero.
Both operands must contain exactly this many bits.
This implementation uses unsigned restoring division.
Restoring Division Result
Dividend Decimal
Divisor Decimal
Quotient Binary
Quotient Decimal
Remainder Binary
Remainder Decimal
Verification
Cycles
Final A
Final Q
Divisor M
Bit Width
Restoring Division Step Table
Cycle A,Q After Left Shift A – M Test Action Quotient Bit Final A Final Q
Enter values and calculate to view the division cycles.

What Is Restoring Division?

Restoring division is a sequential binary division algorithm commonly used to explain how unsigned division can be implemented with registers, shifts, subtraction and conditional restoration.

The dividend begins in register Q, the divisor is stored in M, and accumulator A starts at zero. During each cycle, the combined A and Q registers are shifted left and the divisor is subtracted from A.

If the subtraction produces a negative accumulator, A is restored by adding M back and the new quotient bit becomes 0. If A remains non-negative, the subtraction is kept and the quotient bit becomes 1.

Registers Used in Restoring Division

A — Accumulator

A begins at zero and stores the partial remainder during each division cycle.

Q — Dividend / Quotient

Q initially contains the dividend. As the algorithm runs, its low-order positions are replaced with calculated quotient bits.

M — Divisor

M holds the divisor throughout the entire restoring division process.

Cycle Counter

The standard algorithm performs one division cycle for each dividend bit.

Restoring Division Algorithm Steps

Initial state:

A = 0
Q = Dividend
M = Divisor

For each bit:

1. Shift the combined A,Q register left.
2. Calculate A = A – M.
3. Check the sign of A.

If A is negative:
Q0 = 0
A = A + M
This restores the previous non-negative partial remainder.

If A is non-negative:
Q0 = 1
Keep the new A value.

Repeat for n cycles.

Final:
Q = Quotient
A = Remainder

Why Is It Called Restoring Division?

The name comes from what happens after an unsuccessful subtraction. When subtracting divisor M makes accumulator A negative, that subtraction cannot be retained for the current quotient position.

The algorithm therefore adds M back to A, restoring the accumulator to its value before the failed subtraction.

Trial:
A – M

If result is negative:
A = (A – M) + M

Therefore:
A returns to the shifted pre-subtraction value.

How the Quotient Bit Is Selected

Result of A – M Q0 Accumulator Action
Negative 0 Restore A by adding M
Zero 1 Keep A = 0
Positive 1 Keep new A

Worked Example: 13 ÷ 3

4-bit dividend:
Q = 1101 = 13

4-bit divisor:
M = 0011 = 3

Decimal division:
13 ÷ 3

Quotient:
4 = 0100

Remainder:
1 = 0001

Verification:
3 × 4 + 1 = 13

Worked Example: 15 ÷ 3

Dividend:
1111 = 15

Divisor:
0011 = 3

Quotient:
0101 = 5

Remainder:
0000 = 0

Verification:
3 × 5 + 0 = 15

Worked Example: 11 ÷ 2

Dividend:
1011 = 11

Divisor:
0010 = 2

Quotient:
0101 = 5

Remainder:
0001 = 1

Verification:
2 × 5 + 1 = 11

Binary Restoring Division Examples

Dividend Divisor Quotient Remainder Decimal Check
1000 0010 0100 0000 8 ÷ 2 = 4
1001 0010 0100 0001 9 = 2×4 + 1
1011 0010 0101 0001 11 = 2×5 + 1
1101 0011 0100 0001 13 = 3×4 + 1
1111 0011 0101 0000 15 = 3×5

What If the Dividend Is Smaller Than the Divisor?

The restoring algorithm still works normally. If the unsigned dividend is smaller than the divisor, no successful divisor subtraction produces a quotient contribution large enough to make the quotient nonzero.

Dividend:
0011 = 3

Divisor:
0101 = 5

Result:
Quotient = 0000
Remainder = 0011

3 = 5 × 0 + 3

Restoring Division Remainder Rule

For valid unsigned integer division with a nonzero divisor, the final remainder must always be smaller than the divisor.

Dividend = Divisor × Quotient + Remainder

with:

0 ≤ Remainder < Divisor

Restoring Division vs Ordinary Binary Division

Feature Ordinary Binary Division Restoring Division
Primary goal Find quotient and remainder Simulate register-level division
Accumulator Usually not exposed A register explicitly tracked
Trial subtraction Conceptual Performed every cycle
Negative trial Skip subtraction Subtract, then restore A
Quotient generation Long-division style One quotient bit per cycle
Best use General conversion/math Computer arithmetic study

Why Study Restoring Division?

Computer Architecture

The algorithm demonstrates how division can be decomposed into shifts, subtraction, tests and register updates.

Digital Arithmetic

It provides a clear model for understanding sequential unsigned division hardware.

Register Operations

Students can see how accumulator and quotient registers change during every cycle.

Algorithm Comparison

Restoring division provides a useful baseline for studying alternative hardware division algorithms.

Important Restoring Division Notes

Important: this calculator performs unsigned integer restoring division.

The divisor cannot be zero.

A standard n-bit calculation runs for n cycles.

The quotient is stored in Q and the final partial remainder is stored in A.

Whenever the trial subtraction makes A negative, the algorithm restores A by adding M back and places 0 in the current quotient position.

A valid final result satisfies:

Dividend = Divisor × Quotient + Remainder

and the final remainder must be smaller than the divisor.

Related BinaryCon Tools

Restoring Division Calculator FAQs

What is restoring division?
Restoring division is a binary division algorithm that shifts registers, subtracts the divisor from a partial remainder and restores the accumulator whenever that subtraction produces a negative result.
Why is it called restoring division?
When a trial subtraction fails, the divisor is added back to the accumulator, restoring its previous non-negative value.
What does register A contain?
A stores the partial remainder during the restoring division process and contains the final remainder when the algorithm finishes.
What does register Q contain?
Q initially contains the dividend and gradually becomes the quotient as quotient bits are generated.
What does M represent?
M is the divisor and remains unchanged throughout the division cycles.
When is the quotient bit set to 0?
The quotient bit becomes 0 when subtracting M makes A negative. A is then restored by adding M back.
When is the quotient bit set to 1?
It becomes 1 when A minus M is zero or positive, so the subtraction is retained.
How many cycles are required?
Standard restoring division performs one cycle for each dividend bit. A 4-bit operation therefore requires four cycles.
Where is the final remainder stored?
The final remainder is stored in accumulator A.
Where is the final quotient stored?
The quotient is stored in register Q after the final cycle.
Can the divisor be zero?
No. Division by zero is undefined and the calculator rejects a zero divisor.
Does this calculator support signed division?
No. This implementation models unsigned restoring division.
How can I verify the result?
Multiply the divisor by the quotient and add the remainder. The result should equal the original dividend.
Scroll to Top