write MIPS assembly code which, when run under QtSpim, will do the following: This program works with two arrays of the same length: an input array, and an output array. Additionally, it contains a value to add to each element of the array (amount_to_add). For each element of the input array, it should add this amount, putting the result in the output array. A code snippet below illustrates this behavior: for (int index = 0; index < array_length; index++) { output_array[index] = input_array[index] + amount_to_add; } The end of the code (provided) will print each element of the output array. As with the prior problem, this code MUST work for any values of amount_to_add, array_length, input_array, and output_array. You may make the following assumptions in your code: array_length will always be at least 1, and will be an unsigned integer input_array and output_array will always contain exactly array_length .words. The values of input_array will all be non-negative. amount_to_add will always be an unsigned integer.
write MIPS assembly code which, when run under QtSpim, will do the following:
This
for (int index = 0; index < array_length; index++) {
output_array[index] = input_array[index] + amount_to_add;
}
The end of the code (provided) will print each element of the output array. As with the prior problem, this code MUST work for any values of amount_to_add, array_length, input_array, and output_array. You may make the following assumptions in your code:
- array_length will always be at least 1, and will be an unsigned integer
- input_array and output_array will always contain exactly array_length .words.
- The values of input_array will all be non-negative.
- amount_to_add will always be an unsigned integer.
Step by step
Solved in 4 steps with 2 images