Compile the following C code into MIPS i0 while i
Compile the following C code into MIPS:
i=0;
while (i<=100) do
A[4*i]=0;
where integer i is in register $s0 and the base memory address of array A is in$s1.
For turning in this homework, please bring your it to the class on February 21.
Solution
Code:
Note: In your question, the value of i is not incremented.So,it will stuck in infinite loop. So, here I incremented the value by 1.
![Compile the following C code into MIPS: i=0; while (i<=100) do A[4*i]=0; where integer i is in register $s0 and the base memory address of array A is in$s1. Compile the following C code into MIPS: i=0; while (i<=100) do A[4*i]=0; where integer i is in register $s0 and the base memory address of array A is in$s1.](/WebImages/40/compile-the-following-c-code-into-mips-i0-while-i-1123144-1761598174-0.webp)