Question 1 Translate the following simple C procedure program into MIPS assembly....

Question 1

Translate the following simple C  procedure program into MIPS assembly:

int compute(int a, int b){

   return (a -b) *(a + b);


20 pts


Question 2

Implement the absolute function in MIPS Assembly which is defined thus:

Use your knowledge of 2's complement (Links to an external site.) notation to answer this problem efficiently.


20 pts


Question 3

Write an MIPS assembly program with the appropriate .data and .text segments that takes in an array named 'values' that has 10 elements that doubles the even array elements and triples the odd data elements or in C

int a[10];

for(int i =0;i<10;i++){

    if(i%2==1)a[i] = a[i]*2;

    else a[i] = a[i]*3;


20 pts


Please submit the assembly programs as .asm and . txt files. Use the MIPS Mars simulator to test your programs before submitting them.
Powered by