Question: Consider the Memory layout: int a, b, c, d[10] in a program's data segment. Convert the high level language statement below to MIPS assembly: d[3]

Consider the Memory layout: int a, b, c, d[10] in a program's data segment.

Convert the high level language statement below to MIPS assembly:

d[3] = d[2] + a;

Let $s1 contain the base address of the memory segment.

Let $s4 = starting memory address of the d array.

A. lw $t0, 0($s4)

lw $t1, 0($s1)

add $t0, $t0, $t1

sw $t0, 4($s4)

B. lw $t0, 8($s4)

lw $t1, 0($s1)

add $t0, $t0, $t1

sw $t0, 12($s4)

C. lw $t0, 2($s4)

lw $t1, 0($s1)

add $t0, $t0, $t1

sw $t0, 3($s4)

D. lw $t0, 4($s4)

lw $t1, 0($s1)

add $t0, $t0, $t1

sw $t0, 8($s4)

Consider the Memory layout: int a, b, c, d[10] in a program's

Consider the Memory layout: int a, b, c, d[10] in a program's data segment. Convert the high level language statement below to MIPS assembly: d[3] = d[2] + a; Let $s1 contain the base address of the memory segment. Let $s4-starting memory address of the d array. lw $t1, 0($s1) add $t0, $t0, $t1 sw $to, 4($s4) lw $t1, 0($s1) add $t0, $to, $t1 sw $t0, 12($s4) Iw $t1, 0($s1) add $t0, $t0, $t1 sw $to, 3($s4) lw $t1, 0($s1) add $t0, $t0, $t1 sw $to, 8($s4)

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!