Question: How do I translate java statements into corresponding MIPS assembly code? For example, how can I translate f=(g+h) +5 into MIPS, assume f, g, h
How do I translate java statements into corresponding MIPS assembly code? For example, how can I translate
f=(g+h) +5 into MIPS,
assume f, g, h are in $s0, $s1, $s2 I would think use
add $__, $s1, $s2
add $s0, $s__, 5
But how do I choose the $__, and can it be the same? Could I just use $s0 twice? How do I load my values? what should I choose
For a second example (please explain thoroughly Consider the following MIPS assembly instructions. Assume that the variables f, g, h and i are assigned to registers $s0, $s6,$s1, $s5 and the base address of an array A is at $s3. For each of the instructions write down the type of the instruction format and the corresponding java statement?
add $s0, $s6, $s0
sub $s1, $s6, $s5
sw $s1, 1200($s3)
For the following java statement what is the corresponding MIPS assembly code? Assume that the variables i and j are assigned to registers $s4 and $s5 and that the base addresses of arrays A and B are $s0 and $s1.
B[8] = (i - j) + A[20];
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
