views:

241

answers:

1

I'm wondering if anyone might know how to perform a division between two signed integers in MIPS, WITHOUT using the built in division operations.

In the problem specs, I'm told the divisor register, ALU, and quotient register are all 32 bits wide, and the remainder register is 64 bits.

+1  A: 

There are various methods - I would suggest Newton-Raphson, which is simple and fast, and uses only multiplication and subtraction.

If multiplication is not allowed then there also seem to be plenty of integer division algorithms which just use shifts, bitwise operations and add/subtract, e.g. first hit on Google: www.bearcave.com/software/divide.htm

Paul R
A bit more info: the divisor register, ALU, and quotient register are all 32 bits wide, and the remainder register is 64 bits. The ALU and divisor registers are halved and the remainder is shifted left. this combines the quotient register with the right half of the remainder register.
Allen
and from the looks of things, no multiplication is allowed either
Allen