Dear Anjali, as you know that division algorithms can be restoring as well as non-restoring. I am mentioning you the restoring algorithm. Restoring division operates on fixed-point fractional numbers and depends on the assumption 0 < D < N.[citation needed]
The quotient digits q are formed from the digit set {0,1}.
The basic algorithm for binary (radix 2) restoring division is:
R := N
D := D << n -- R and D need twice the word width of N and Q
for i := n − 1 .. 0 do -- For example 31..0 for 32 bits
R := 2 * R − D -- Trial subtraction from shifted value (multiplication by 2 is a shift in binary representation)
if R ≥ 0 then
q(i) := 1 -- Result-bit 1
else
q(i) := 0 -- Result-bit 0
R := R + D -- New partial remainder is (restored) shifted value
end
-- Where: N = Numerator, D = Denominator, n = #bits, R = Partial remainder, q(i) = bit #i of quotient
The above restoring division algorithm can avoid the restoring step by saving the shifted value 2R before the subtraction in an additional register T (i.e., T = R << 1) and copying register T to R when the result of the subtraction 2R − D is negative.
All the best
Hope this helps
Hii aspirants
let me clear your doubt.
In a division algorithm there is a quotient and a remainder when we divide two number.Here, n-bit dividend is loaded in Q and divisor is loaded in M. Value of Register is initially kept 0 and this is the register whose value is restored during iteration due to which it is named Restoring.
I hope my answer will help you out
Good luck
Regular exam updates, QnA, Predictors, College Applications & E-books now on your Mobile