Question
In MIPS assembly, write an assembly program that does the following task, run your assembly code in QtSpim to double check its correctness. Your instructor
In MIPS assembly, write an assembly program that does the following task, run your assembly code in QtSpim to double check its correctness. Your instructor will grade base on your code based on the grading table.
a) We have two arrays A and B, each of them contains n = 10 elements.
A: B: n:
.data .word 1,2,3,4,5,6,7,8,9,10 .word 0,0,0,0,0,0,0,0,0,0
.word 10
b). Prompt the user for a positive number to be used to initialize each of the 10 elements in B one by one. If the user enters a non-positive number, print an error message and exit the program. c). Calculate a sum as follows:
for (i=1; i < n; i++) { sum = sum + 2*A[i] + B[i];
}
d). Print a message to display the formula or sum as well as its final calculated value. Notes:
Please make sure your code runs in QtSpim before it is turned in Blackboard. Non-functional
code will not receive credits.
Please also comment your code well, a reduction of up to 4 points will be applied for
uncommented or poorly commented code.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started