本次澳洲代写主要为Mips及计算机基础相关的限时测试
Question 1
You have been given practice_q1.s, a MIPS assembler program that reads one number and then prints it.
Add code to practice_q1.s to make it equivalent to this C program:
// print the sum of two integers
#include <stdio.h>
int main(void) {
int x, y;
scanf(“%d”, &x);
scanf(“%d”, &y);
printf(“%d\n”, x + y);
return 0;
}
n other words, it should read 2 numbers and print their sum.
For example:
$ 1521 spim -f practice_q1.s
5
8
13
$ 1521 spim -f practice_q1.s
118
26
144
$ 1521 spim -f practice_q1.s
42
42
84
NOTE:
No error checking is required.
Your program can assume its input always contains two integers, and only two integers.
You can assume the value of the expression can be represented as a signed 32 bit value. In other words, you can assume
overflow/underflow does not occur.
Your solution must be in MIPS assembler only.
When you think your program is working, you can run some simple automated tests:
$ 1521 autotest practice_q1
When you are finished working on this activity you must submit your work by running give:
$ give cs1521 practice_q1 practice_q1.s
To verify your submissions for this activity:
$ 1521 classrun -check practice_q1