Question
Write a MIPS assembly language program to solve the following problem. For a set of integers stored in an array, calculate the sum of the
Write a MIPS assembly language program to solve the following problem.
For a set of integers stored in an array, calculate the sum of the positive numbers and the sum of the negative numbers. The program should store both sums in memory variables: posSum and negSum. Numbers should be read from the array one at a time with a zero value (0) being used to signal the end of data (the zero value is acting as a "sentinel" value).
For examle, if your array has the values: 1010 -510 -3010 1510 2010 -110 -2610 -1810 010, then you program should update the posSum and negSum variables to 4510 and -8010, respectively.
For example, your .data section for the array values: 1010 -510 -3010 1510 2010 -110 -2610 -1810 010, will be:
Before you start writing MIPS assembly language, write a high-level language algorithm. THEN, translate it to MIPS assembly language. You can download the MIPS simulator at: http://sourceforge.net/projects/spimsimulator/files/ Select the latest version of QtSpim for either Windows, MAC or Linux.
.data .word 10,-5, -30,15, 20,-1,-26,-18,0 array: posSum: negSum: word 0 word o .text globl main # MIPS Assembly language program here main: # system call to exit the program li $v0, 10 syscallStep 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