Question: Write the corresponding MIPS assembly equivalent of the given pseudo code. Assume that register Ss0 contains the base address for array arr. Use a
Write the corresponding MIPS assembly equivalent of the given pseudo code. Assume that register Ss0 contains the base address for array arr. Use a register for each of the variables. (e.g. use $s1 for total, etc.) and indicate them as a comment line in your code. i=0, s= 10; total, ps, ng; arr [10] = {3, -21, 18, 0, 16, 85, -44, 23, 100, -20); total= 0; ps = 0; ng = 0; do { total = total + [arr[i]; if (arr[i] > 0) i++; if (arr[i] < 0) } while ( ps ps+arr[i]; H. = ng = ng + arr[i];
Step by Step Solution
There are 3 Steps involved in it
The provided pseudo code is performing a loop over an array and summing the elements to a total vari... View full answer
Get step-by-step solutions from verified subject matter experts
