Question: Consider the following assembly program fragment: add $ 1 0 , $ 0 , $ 0 addr: lw $ 8 , 0 ( $ 9

Consider the following assembly program fragment:
add $10, $0, $0
addr: lw $8,0($9)
beq $8, $0, label
addi $10, $10,1
addi $9, $9,4
j addr
label: ....
a) Assume that $9 initially contains the byte address of the first element, Array[0],
of a vector array called Array which contains consecutive 32 bit integers in
memory. Describe precisely in a sentence or two what the program fragment does.
b) Suppose the initial value of $9 is (2000)10(which is the byte address of A[0]).
Suppose the array starts with the initial values: A[0]=1, A[1]=1, A[2]=-2,
A[3]=0, A[4]=0, A[5]=2. What values do the registers $8, $9, $10 contain when
"label" is reached?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!