Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

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 syscall

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Datacasting How To Stream Databases Over The Internet

Authors: Jessica Keyes

1st Edition

007034678X, 978-0070346789

More Books

Students also viewed these Databases questions

Question

What is Change Control and how does it operate?

Answered: 1 week ago

Question

How do Data Requirements relate to Functional Requirements?

Answered: 1 week ago