I am trying to implement a MIPS code that preforms unsigned integer divide but i couldn't figure out how.
if D == 0, report an error and terminate.
Q = 0 # Q is the quotient, initialized to zero
R = 0 # R is the remainder, also initialized to zero
n = the number of bits in the numerator N
That is, the number 3710 is 1001012 has 6 bits.
Shift through the bits of N to find the
position of its most significant 1 bit.
Write a separate function to determine “n”.
for i = n-1, n-2, … 0 do
R = R shifted left one bit
R = N[i] # The least significant bit of R is
set to bit i of the numerator N.
if R >= D then # Test if R is greater than or equal
R = R – D # to D. If so, subtract D from R and
Q[i] = 1 # set the ith bit of Q to a one.
return Q, R # Return the results to the caller.