The long Assingment2. png has some information needed to complete the tasks please read before hand (I send you guys the file)And the cubesum.txt is the code to manipulate(I also send it)TasksHere are...

1 answer below »

The long Assingment2. png has some information needed to complete the tasks please read before hand (I send you guys the file)


And the cubesum.txt is the code to manipulate(I also send it)




Tasks


Here are the tasks that you need to do:



  1. (20 points) Execute the given program, input number 9 through console, and find the program output printed on console. Take a snapshot of the value of all the 32 MIPS registers before and after executing the program. The values are visible on the main window of your QtSpim program.

  2. (20 points) Manipulate the program assembly code so that it implements and prints out the return value of this function (instead of cube_sum):









int sum_odd_factorial(int n){



int sum = 0;



for(int i = 1; i <= n;i+="">



sum += factorial(i);



return sum;


}



where factorial is another function that you need to implement:









int factorial(int n)


{



int rv = 1;



for(int i = 1; i <=>



rv *= i;



return rv;


}




3. (20 points) Execute the program that you wrote in step 2 for input 11. Take a snapshot of the value of all the 32 MIPS registers before and after executing the program.



4. (20 points) Manipulate the program assembly code so that it it implements and prints out the return value of this function:









int nested_loop_test(int n){



int rv = 1;



for(int i = 1; i < n;i*="">



for(int j = i; j >=0; j--)



if(j % 2 == 0)



rv += (i + j);



else



rv += (2*i-3*j);



return rv;


}




5. (20 points) Execute the program that you wrote in step 4 for input 20. Take a snapshot of the value of all the 32 MIPS registers before and after executing the program.




Deliverables


You need to submit a zip file compressing the following files:



  • .asm file of the program for task #2

  • .asm file of the program for task #4

  • A report.pdf file containing all the snapshots and console outputs of tasks #1, #3, and #5.

Answered Same DayOct 11, 2022

Answer To: The long Assingment2. png has some information needed to complete the tasks please read before hand...

Nidhi answered on Oct 12 2022
53 Votes
Task 1: Task 1: Task 3:
Task 3:
Task 5:
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here