Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is a high level, C programming language for loop that is accessing all the 1 0 0 elements of an integer array named A:

This is a high level, C programming language for loop that is accessing all the 100 elements of an integer array named A:
for(i =0; i <100; i++){
sum+=A[i];
}
This is a low level MIPS assembly language program that works similarly to the for loop that is accessing all the 100 elements of the integer array named A:
and $t0, $t0, $zero
addi $t1, $zero, 100
LOOP: lw $t3,0($s0)
add $t4, $t0, $t3
addi $s0, $s0,4
addi $t0, $t0,1
bne $t1, $t0, LOOP
Given these facts, please answer the following questions.
a) Which register is being used to store the equivalent of the for loop's i variable? (4 points)
b) List the assembly language instruction or instructions that correspond to the high level language part of the for loop that states
i <100;
(5 points)
c) List the assembly language instruction or instructions that correspond to the high level language part of the for loop that states
i++
(3 points)
d) Assume the register $s0 contains the base address of the array A. List the assembly language instructions that correspond to the high level language statement
sum+=A[i];
(5 points)

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

XML Data Management Native XML And XML Enabled Database Systems

Authors: Akmal Chaudhri, Awais Rashid, Roberto Zicari, John Fuller

1st Edition

ISBN: 0201844524, 978-0201844528

More Books

Students also viewed these Databases questions