Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Suppose a word array is 0,1,2,3,4,5,6,7,8,9 and its starting address is in $t0. After the following instructions, what will be the values in this

1. Suppose a word array is 0,1,2,3,4,5,6,7,8,9 and its starting address is in $t0. After the following instructions, what will be the values in this array?

lw $t1, 8($t0)

sll $t1, $t1, 2

add $t0, $t0, $t1

2.

Suppose $t0 and $t1 are holding 0 and 1, respectively. When the program enters this segment, right before the program executes the instruction at p4L2, what will be the value in $t0?

beq $t0, $t1, p4L1

p4L0:add $t0, $t0, $t1

p4L1:bne $t0, $t1, p4L0

p4L2:

3.

The following problems deal with translating from C to MIPS. Assume that the variables f,g,h are assigned to registers $s0, $s1, $s2, respectively. Assume that the base address of the arrays A and B are registers $s6 and $s7, respectively.

(a) f=g+h+B[4];

(b) f=g-A[B[4]];

For the C statements above, what is the corresponding MIPS assembly code?

4. Write MIPS assembly code that implements the following: if $t0 has the same parity as $t1 (both even or both odd) and if $t0 is greater than 15, multiply $t0 by 5; otherwise, do nothing. Assume it is known that $t0 is positive.

sw $t1, 8($t0)

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

Repairing And Querying Databases Under Aggregate Constraints

Authors: Sergio Flesca ,Filippo Furfaro ,Francesco Parisi

2011th Edition

146141640X, 978-1461416401

Students also viewed these Databases questions