Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Let m be a segment of data memory starting at location 5100 and ending at the first locations (after 5100) that contains 0. Write a

Let m be a segment of data memory starting at location 5100 and ending at the first locations

(after 5100) that contains 0.

Write a MIPSzy program that computes:

the sum of positive numbers in m (stored in data memory location 5084)

the number of positive values in m (stored in data memory location 5088)

the sum of negative numbers in m (stored in data memory location 5092); and

the number of negative values in m (stored in data memory location 5096)

For example, if m contains:

5100

10

5104

12

5108

-5

5112

-6

5116

11

5120

1

5124

0

After execution of the program, data memory will contain:

5084

34

5088

4

5092

-11

5096

2

5100

10

5104

12

5108

-5

5112

-6

5116

11

5120

1

5124

0

Should be somewhat similar to this code:

add $t0, $zero, $zero

add $t1, $zero, $zero

addi $t1, $zero, 5100

addi $t5, $t2, -4

addi $t6, $t5, -4

Top:

lw $t3, 0($t2)

beq $t3, $zero, Done

slt $t4, $t3, $zero

addi $t4, $t4, -1

beq $t4, $zero, Next

addi $t1, $t1, 1

add $t0, $t0, $t3

Next:

addi $t2, $t2, 4

j Top

Done:

sw $t1, 0($t5)

sw $t0, 0($t6)

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

Advances In Databases 28th British National Conference On Databases Bncod 28 Manchester Uk July 2011 Revised Selected Papers Lncs 7051

Authors: Alvaro A.A. Fernandes ,Alasdair J.G. Gray ,Khalid Belhajjame

2011th Edition

3642245765, 978-3642245763

More Books

Students also viewed these Databases questions

Question

Solve the equation. 3x + 4 = -8

Answered: 1 week ago

Question

Presentations Approaches to Conveying Information

Answered: 1 week ago