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.
Think of how you’d perform a binary division by hand:
This “grade school” long division algorithm can be written (in Python — I’ll let you convert it to MIPS) as:
For signed division, you can just divide the absolute values while keeping track of the sign (assuming you want C-style truncating division):