Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Complete the corresponding assembly language fragments by selecting the correct instruction, register, or value: (Choices in bold) Consider the following fragment of C code: while

Complete the corresponding assembly language fragments by selecting the correct instruction, register, or value: (Choices in bold)

Consider the following fragment of C code:

while (A[ i ] == 0){

A[ i ] = A[ i ] + 10; i += 1;

}

Assume that variable i is assigned to $s0 and the base address for array A is in $s1. A is an array of words. Registers $t0 and $t1 are used for storing results temporarily.

Loop: sll $t0, $s0, (0 / 1 / 2 / 4 / 10)

add $t0, $t0, $s1

lw $t1, 0($s0 / $s1 / $t0 / $st1 / $zero)

bne $t1, $zero, (Loop / Exit)

addi $t1, ($s0 / $s1/ $t0 / $t1 / $zero) , 10

sw $t1, 0($t0)

addi ($s0 / $s1 / $t0 / $t1 / $zero) , $s0, 1 j Loop Exit:

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

Conceptual Database Design An Entity Relationship Approach

Authors: Carol Batini, Stefano Ceri, Shamkant B. Navathe

1st Edition

0805302441, 978-0805302448

More Books

Students also viewed these Databases questions