Answer the following Questions:
1. 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?
2. Consider the following assembly program. Assume i and j are initially stored in $1 and $2 registers.
and $1, $0, $0
and $2, $0, $0
addi $5, $0, 10
loop: slt $6, $1, $5
beq $6, $0,
addi $2, $2, 5
addi $1, $1, 1
j loop
end: add $1, $2, $0
What are the final value of i and j after the execution of the above program?
3. Write a MIPS code for the following C code fragment:
j=0
for (i = 0; i<10; i++)
{
j+=5;
}
i =j;
4. Write the following sequence of code into MIPS assembler.
x = x + y + z –q
Assume x, y, z, and q are stored in registers $S1‐$S4.
5. Write an assembly version of the following C code.
For (i = 1; i<100; i++) {
A[i] = A[i‐1] + B[i];
}
Hi I am a Masters in Embedded system student and I have good experience with Computer architecture. I can do these questions within the time limit you mentioned.