Question: MIPS Assembly Implementation of C Code Implementing the following C code in MIPS assembly: C Code void main ( ) { int MyArray [ 1

MIPS Assembly Implementation of C Code
Implementing the following C code in MIPS assembly:
C Code
void main(){
int MyArray[10];
for(int i =0; i <10; i++){
MyArray[i]= i +15; // initialize array with numbers 15 through 25
}
for(int i =1; i <10; i++){
// each array element = previous element -10
MyArray[i]= MyArray[i -1]-10;
}
}
Assumptions
The base address of MyArray is stored in register $S1.
Notes
You can use the MIPS instructions li (load immediate), si (store immediate), and addi (add
immediate) as needed.
The syntax for addi is addi rd, rs, i where rd is the destination register, rs is the source
register, and i is the immediate, so rd = rs + i. Negative numbers are allowed.
You cannot hard-code each iteration, loops must be present to receive credit.
While the program can be optimized into one loop, you must have two separate loops to receive
full credit.
1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!