Search code examples
inputmipsmips32

Loading integers larger than 32-bits in MIPS assembly


I am working on a school project (if you couldn't figure that out just by the fact that I'm using MIPS and QTSpim), and my group chose to make a calculator for large (128-bit) numbers. We know how to do operations on 128-bit numbers, but what we're having trouble with is having the user input.

The professor doesn't quite know how to do it, so does anyone know if there is a way to load a 128-bit integer using MIPS and QTSpim?

MIPS registers hold 32-bit integers, so the result would have to be stored in 4 registers, but is there a way to make that happen?

Thanks!


Solution

  • I would:

    • Read the user input as a string
    • Convert the ASCII codes of the each digit to a number 0-9 (i.e. subtract '0')
    • Apply a radix conversion from base 10 to base 2, and hold the results in four 32 bit words