Lab 1
- (40 points): Write a SPIM program to calculate 2 * (10 + 20) – 15. (use add – do not use mul, for
example: 2*x = x + x) Use R8, R9, and R10 to store the values 10, 20, 15. Store the result in R11.
(1) Screenshot of your program:
[Load your program into QtSPIM and run your program. Take a screenshot showing program code
and register values.] - (60 points): Write a SPIM program to prompt the user to enter two integer numbers x and y, and to
display their sum z, z = x + y. All x, y and z can be stored in the registers. (do not need to define
variables x, y and z in data segment)
Register Mapping: x $t0, y $t1, z $t2
Here is a sample run:
Enter the first integer: 6
Enter the second integer: 10
The sum is 16
(1) Screenshot of your program:
[Load your program into QtSPIM and run your program. Take a screenshot showing program code
and register values.]
(2) Test cases (screenshot of result, showing input/output):