BIT151 · 2079 · 10 marks
State an algorithm for the restoring division method of fixed point binary division.Show the step-by step division process using restoring division algorithm when 448(0111000000) is divided by 17(10001). Use 5-bit register to represent the numbers.
State an algorithm for the restoring division method of fixed point binary division.Show the step-by step division process using restoring division algorithm when 448(0111000000) is divided by 17(10001). Use 5-bit register to represent the numbers.[10]
Restoring Division Algorithm (Fixed Point Binary Division)
Algorithm
Registers: A (accumulator/partial remainder), Q (holds dividend, then quotient), M (divisor), Count = number of bits.
- Initialize: A = 0, Q = dividend, M = divisor, Count = n.
- Repeat n times:
- Shift the combined register (A, Q) left by 1 bit.
- A = A − M (add 2's complement of M).
- If A ≥ 0 (MSB = 0): set Q[0] = 1.
- Else (A < 0, MSB = 1): set Q[0] = 0 and restore A = A + M.
- Decrement Count.
- End: Q = quotient, A = remainder.
Given
- Dividend = 448 =
0111000000(10 bits) - Divisor = 17 =
10001(5 bits) → M =10001 - 5-bit registers → n = 5 iterations
- 2's complement of M =
01111
Important note on register sizing
To hold both A and Q for a 10-bit dividend divided by a 5-bit divisor, and to detect the sign of a subtraction of two 5-bit numbers, the accumulator generally needs one extra (sign) bit. Working strictly with 5-bit registers as required, I use A as a 5-bit register and detect "A ≥ 0" via the carry-out of the addition of the 2's complement (carry = 1 means result ≥ 0, no borrow), which is the standard hardware convention.
Loading: A = 00000, Q = 0111000000? Q is only 5 bits. Since the dividend is 10 bits but registers are 5 bits, the standard approach splits the dividend into A and Q:
- A = high 5 bits =
01110 - Q = low 5 bits =
00000
Solution
M = 10001, 2's complement of M = 01111
Initial: A = 01110, Q = 00000
Iteration 1
- Shift left: A =
11100, Q =00000 - A + comp(M):
11100 + 01111 = 101011→ A =01011, carry = 1 ⇒ ≥ 0 ⇒ Q[0] = 1 - A = 01011, Q = 00001
Iteration 2
- Shift left: A =
10110, Q =00010 10110 + 01111 = 100101→ A =00101, carry = 1 ⇒ ≥ 0 ⇒ Q[0] = 1- A = 00101, Q = 00011
Iteration 3
- Shift left: A =
01010, Q =00110 01010 + 01111 = 011001→ A =11001, carry = 0 ⇒ < 0 ⇒ Q[0] = 0, restore- Restore:
11001 + 10001 = 101010→ A =01010 - A = 01010, Q = 00110
Iteration 4
- Shift left: A =
10100, Q =01100 10100 + 01111 = 100011→ A =00011, carry = 1 ⇒ ≥ 0 ⇒ Q[0] = 1- A = 00011, Q = 01101
Iteration 5 (the final required step)
- Shift left: A,Q =
00011 01101→ A =00110, Q =11010 00110 + 01111 = 010101→ A =10101, carry = 0 ⇒ < 0 ⇒ Q[0] = 0, restore- Restore:
10101 + 10001 = 100110→ A =00110 - A = 00110, Q = 11010
Result
- Quotient Q =
11010= 26 - Remainder A =
00110= 6
Verification
$$17 \times 26 + 6 = 442 + 6 = 448 \checkmark$$
Summary Table
| Iter | A (after) | Q (after) | Q[0] |
|---|---|---|---|
| Init | 01110 | 00000 | - |
| 1 | 01011 | 00001 | 1 |
| 2 | 00101 | 00011 | 1 |
| 3 | 01010 | 00110 | 0 |
| 4 | 00011 | 01101 | 1 |
| 5 | 00110 | 11010 | 0 |
Quotient = 26, Remainder = 6.
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.