Please answer the following questions involving MIPS assembly code:
A) For the C statement below, what is the corresponding MIPS assembly code? Assume f, g are stored in S1 and S2.
f = g + (-f -5)
B)
For the C statement below, what is the corresponding MIPS assembly code? Assume i and j are assigned in registers S1 and S2 respectively and base of address of arrays A and B are in registers S6 and S7.
B[8] = A[i –j]
C)
For the instruction below, show the binary then hexadecimal representation of these instructions.
sw $t, 32 ($t2)
sll $s1, $2, 4
D)
For the lines below, what is the value of $t2 for the following sequence of instructions?
Sll $t2, $t0, 4
andi $t2, $t2, -1
Assume, t0 stores a value of x000020A1
A)
f = g + (-f -5)
addi $s1,$s1,5 # add 5 to f i.e, f+5 and assign it to $s1
sub $s1,$s2,$s1 # subtract f from g and assign it to f => f= g +
(-f - 5) = g-(f+5)
B)
B[8] = A[i –j]
sub $s1,$s1,$s2 # subtract j from i and assign it to $s1 =
i-j
li $t1,8
li $t2,4
mul $t1,$t1,$t2 # $t1=32
mul $t3,$s1,$t2 # $t3 = (i-j)*4
add $t1,$t1,$s7 #add B array base address to $t1 which gives
address B[8]
add $t3,$t3,$s6 #add A array address to $t3 which gives address
A[i-j]
lw $t4,0($t3) #load A[i-j] to $t4
sw $t4,O($t1) # store $t4 in address $t1 i.e B[8]
D) value of $t2= 0x000
sll $t2, $t0, 4 #shift left 4 bits bu the number is hex so it
will shift to => t2 = 00020A10
andi $t2, $t2, -1 # do and operation $t2,-1 =>t2= 0x000
Please answer the following questions involving MIPS assembly code: A) For the C statement below, what...
2.4 For the MIPS assembly instructions below, what is the corresponding C statement? Assume that the variables f, g, h, i, and j are assigned to registers $s0, $s1, $s2, $s3, and $s4, respectively. Assume that the base address of the arrays A and B are in registers $s6 and $s7, respectively. sll $t0, $s0, 2 # $t0 = f * 4 add $t0, $s6, $t0 # $t0 = &A[f] sll $t1, $s1, 2 # $t1 =...
The relative time ratings of exercises are shown in square brackets after each exercise number. On average, an exercise rated [10] will take you twice as long as one rated [5]. Sections of the text that should be read before attempting an exercise will be given in angled brackets; for example, <1.3> means you should have read Section 1.3, Under the Covers, to help you solve this exercise. 2.1 [5] For the following C statement, what is the corresponding MIPS...
I AM POSTING MY QUESTION 3RD TIME . FIRST TWO TIMES I DIDNOT GET THE PROPER ANSWER. PLEASE DO ALL STEPS BY LABELING THE EACH STEP. THIS IS THE ASSIGNMENT IN WHICH THE EACH STEP SHOULD BE LABEL . I MEAN EVERY THING SHOULD BE WRITTEN WHAT WE HAVE DONE IN OUR PROGRAM THIS IS THE REQUIREMENT OF TEACHER , PLEASE DO IT PROPERLY 1) MIPS to C. Assume that the variables f, g, h, i, and j are assigned...
For the following C statement, what is the corresponding MIPS assembly code? Assume that the variables i andj are assigned to registers $50 and $s1, respectively and the base address of the arrays A and B are in registers $s6 and $57, respectively. B[i] = A[B[j]+12];
For the following C statement, what is the corresponding MIPS assembly code? Assume that the variables i, and j are assigned to registers $s0, $s1, respectively. Assume that the base address of the arrays A and B are in registers $s2 and $s3, respectively. B[i] = A[i] - 10
1. (15 pts) For the following C statement, what is the corresponding MIPS assembly code? Assume f, g, h correspond to $80, $s1, and $s2, respectively. f=g+(h-5) 2. (15 pts) For the following pseudo-MIPS assembly instructions, what is the corresponding C code? add f, g, h add f,i, f 3. (30 pts) Provide the instruction type, assembly language instruction, and binary representation of the instruction described by the following MIPS fields: a. op = 0, rs = 18, rt=9, rd...
2.9 5 $2.2, 2.3> Translate the following C code to MIPS. Assume that the variables f, g, h, i, and j are assigned to registers $s0, $s1, $s2, $s3, and $s4, respectively. Assume that the base address of the arrays A and B are in registers $s6 and $s7, respectively. Assume that the elements of the arrays A and B are 4-byte words: fAlBg
For the following C statement, what is the corresponding MIPS assembly code? Assume the arrays hold 16-bit integer values, $ s0 is the base for array X, $ s1 is the base for array Y, and $ t0 and $ t1 are index variables i and j respectively. Comment code X [j] = Y [i + j];
Assignment 3 Translate the following MIPS code to C. Assume that the variables f, g, h, i and j are assigned to registers Ss0, Ss1, Ss2, Ss3 and Ss4, respectively. Assume that the base address of the arrays A and B are in registers Ss6 and $s7, respectively. addi St0, Ss6, 4 add $t1, $s6, $0 #register $0 always holds 320s sw St1, 0(Sto) add Ss0, St1, Sto
Using beq only, not bge! Translate the following C code to MIPS assembly code. Use a minimum number of instructions. Assume that the values of a, b, i, and j are in registers $s0, $s1, $t0, and $t1, respectively. Also, assume that register $s2 holds the base address of the integer array D. Comments are required. for(i=1; i<a; i++) for(j=1; j<b; j++) D[2*j] = i + j;