Question: MIPS Assembly Code Write a function add64 that adds two input unsigned 64 bit integers x and y and returns the unsigned 64 bit integer
MIPS Assembly Code
Write a function add64 that adds two input unsigned 64 bit integers x and y and returns the unsigned 64 bit integer sum z, i.e. z = x + y. In your main function, you should assume that x, y, and z will be stored in the following 6 registers as follows: x: upper 32 bits in $t1 lower 32 bits in $t0 y: upper 32 bits in $t3 lower 32 bits in $t2 z: upper 32 bits in $t5 lower 32 bits in $t4 Your main function call should read the values of x and y into the stack, invoke add64, and then return z on the stack. Also, your function should generate an error only if there is an overflow in the overall 64 bit addition (and not if there is an overflow in the addition of the lower 32 bit components). Hint: an overflow in the lower 32 bit addition means that there is a carry of 1 to the upper 32 bit addition. Only an overflow in the upper 32 bit addition means that there is a true overflow. One way you can implement this functionality is to have a flag register that is set when an overflow causes an interrupt, which will tell you that you have to carry a 1.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
