BEST代写-线上编程学术专家

Best代写-最专业靠谱代写IT | CS | 留学生作业 | 编程代写Java | Python |C/C++ | PHP | Matlab | Assignment Project Homework代写

MIPS代写 | 20T2 Final Exam Questions

MIPS代写 | 20T2 Final Exam Questions

本次澳洲代写主要为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

bestdaixie

评论已关闭。