[SOLVED] CSE230 Assignment 3

30.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon assn3-75idws.zip (126.3 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
🔒 Securely Powered by:
Secure Checkout
Rate this product

Minimal Submitted Files

You are required to turn in the following source file: assignment3.s

Objectives:

-write a MIPS assembly language program to:
-perform arithmetic and logical operations on variables

-use syscall operations to display integers and strings on the console window

-use syscall operations to read integers from the keyboard. Assignment Description:

The read_int system call (number 5) will cause the running program to stop and wait for the user to type in an integer at the keyboard. The integer will be put into $v0 register and will be available after the syscall completes. Write a MIPS assembly language program which prompts for a user to enter four integers and calls read_int four times to read in four integers. The program should perform the specified (see the C program below) addition, subtraction, multiplication, integer division, and modulo operation (compute the remainder of their division) using two of these four integers (see the C program below), then display their result on the console window. Also compute ((((num2 % 4) + num3) * 2) / num4) + num1 where num1 is the first read integer, num2 is the second read integer, num3 is the third read integer, and num4 is the forth read integer, and display the result.

Name your source code file assignment3.s.

The following shows how it looks like in a C program:

——–

int num1, num2, num3, num4, ans1, ans2, ans3, ans4, ans5, ans6;

printf(“Enter a value:\n”);

//read an integer from a user input and store it in num1 scanf(“%d”, &num1);

printf(“Enter another value:\n”);

//read an integer from a user input and store it in num2 scanf(“%d”, &num2);

printf (“Enter one more value:\n”);

//read an integer from a user input and store it in num3 scanf(“%d”, &num3);

printf (“Enter one more value:\n”);

//read an integer from a user input and store it in num4 scanf(“%d”, &num4);

https://canvas.asu.edu/courses/56799/pages/assignment3-due-friday-september-4th-5pm?module_item_id=3410170 2/4

9/3/2020 Assignment3 – Due: Friday, September 4th, 5pm: CSE 230: Computer Org/Assemb Lang Prog (2020 Fall)

ans1 = num4+num1; //addition printf(“num4+num1=%d\n”, ans1);

ans2 = num1-num2; //subtraction printf(“num1-num2=%d\n”, ans2);

ans3 = num4*num2; //multiplication printf(“num4*num2=%d\n”, ans3);

ans4 = num1/num3; //division printf(“num1/num3=%d\n”, ans4);

ans5 = num3%num1; //remainder of division printf(“num3 mod num1=%d\n”, ans5);

ans6 = ((((num2 % 4) + num3) * 2) / num4) + num1; printf(“((((num2 mod 4) + num3) * 2) / num4) + num1=%d\n”, ans6);

———–

Here is a sample output (user input is in bold):

Enter a value:

8

Enter another value:

5

Enter one more value:

11

Enter one more value:

-3

num4+num1=5

https://canvas.asu.edu/courses/56799/pages/assignment3-due-friday-september-4th-5pm?module_item_id=3410170 3/4

9/3/2020 Assignment3 – Due: Friday, September 4th, 5pm: CSE 230: Computer Org/Assemb Lang Prog (2020 Fall)

num1-num2=3
num4*num2=-15
num1/num3=0
num3 mod num1=3
((((num2 mod 4) + num3) * 2) / num4) + num1=0

——————————————–

What to turn in::

-Submit your assignment3.s file to the file submission site through the course website by the assignment deadline. You must have your name, email address, program description, and other information in the header block as it was described in the assignment 1, and your programs should be well commented.

Go to “GradeScope” tab on Canvas -> CSE/EEE230 -> Assignment3, and upload your program file.

  • assn3-75idws.zip