Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need proper source code for this SIPM language. Complete the SPIM assembly language program loop2.s . The program will calculate the sum of the elements

Need proper source code for this SIPM language.

Complete the SPIM assembly language program loop2.s.

The program will calculate the sum of the elements in "numbers" whose value is less than or equal to 1000.

Here is the program skeleton; you will complete it.

##

## Program Name: loop2.s

##

## - will calculate the sum of all elements in the array "numbers"

## whose value is less than or equal to 1000.

## - "numbers" is an array with 5 integer elements.

## - "count" holds the number of elements in "numbers".

##

##

## - Output format must be

## "sum = 11"

##

## t0 - points to array elements in turn

## t1 - contains a count of elements

## t2 - contains sum

##

## t3 - each word from the array "numbers" in turn

##

#################################################

# #

# text segment #

# #

#################################################

.text

.globl __start

__start: # execution starts here

# Put your answer between dashed lines.

#

#------------------Your code starts next line---------------

#-----------------Your code ends above this line----------------

la $a0,endl # syscall to print out

li $v0,4 # a new line

syscall

li $v0,10 # Exit

syscall # Bye!

#################################################

# #

# data segment #

# #

#################################################

.data

numbers:

.word 3,2000,2,6,3000

count: .word 5

ans1: .asciiz "sum = "

endl: .asciiz " "

##

## end of file loop2.s

Print out the sum in this format: "sum = 11"

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

DB2 11 The Database For Big Data And Analytics

Authors: Cristian Molaro, Surekha Parekh, Terry Purcell, Julian Stuhler

1st Edition

1583473858, 978-1583473856

More Books

Students also viewed these Databases questions

Question

I am paid fairly for the work I do.

Answered: 1 week ago

Question

I receive the training I need to do my job well.

Answered: 1 week ago