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

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 counts in memory variables:posSum and negSum . Numbers should 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: 10^10 -5^10 -30^10 15^10 20^10 -1^10 -26^10 -18^10 0^10, then your program should update the posSum ans negSum variables to 45^10 and -80^10, respectively.

For example, your .data section for the array values: 10^10 -5^10 -30^10 15^10 20^10 -1^10 -26^10 -18^10 0^10, will be:

. data

array: .word 10,-5,-30,15,20,-1,-26,-18, 0

possum: .word 0

negsum .word0

.text .

.globl main:

# MIPS Assembly language program here

li $v0, 10 # system call to exit the program syscall

Before you start writing MIPS assembly language, write a high-level language algorithm. THEN, translate it to MIPS assembly language.

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

Step: 3

blur-text-image

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

Web Database Development Step By Step

Authors: Jim Buyens

1st Edition

0735609667, 978-0735609662

More Books

Students also viewed these Databases questions