Screenshot
Program
.text
.globl main
main:
#parameter1 value
addi $t0,$0,2
#parameter2 value
addi $t1,$0,3
#call function
jal CalcFunc
#End of the program
addi $v0,$0,10
syscall
#Function implementation
CalcFunc:
#aVal*40
mul $t0,$t0,40
#bVal+(aVal*40)
add $t2,$t1,$t0
#retur from function
jr $ra
please help Convert the C to assembly. Assume first parameter is in $to, second parameter is...
Convert the following C/C++ fragment into equivalent MIPS assembly language. Assume that the variables a, b, c, d, i and x are assigned to registers $t1, $t2, $t3, $t4, $s0 and $s1 respectively. if ((a<b && (c == 0) d = 1;
Convert the following C fragment to equivalent MIPS assembly language. Assume that the variables a, b, c, d, i and x are assigened to registers $t1, $t2, $t3, $t4, $s0 and $s1 respectively. Assume that the base address of the array A and B is in register $a0 and $a1 respectively. if (a > 0) b = a + 10; else b = a - 10;
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 =...
1. For the MIPS assembly instructions below, what is the corresponding C statement? max: lw $t0, 0($a0) #load the first array value into $t0 addi $t1, $0, 1 #intialize the counter to one loop: beq $t1, $a1, exit #exit if we reach the end of the array addi $a0, $a0, 4 #increment the pointer by one word addi $t1, $t1, 1 #increment the loop counter lw $t2, 0($a0) #store the next array value into $t2 slt $t3, $t0, $t2 beq ...
1. Modify larger.s to let the user to enter three numbers and output the largest value # larger.s-- prints the larger of two numbers specified # at runtime by the user. # Registers used: # $t0 - used to hold the first number. # $t1 - used to hold the second number. # $t2 - used to store the larger of $t1 and $t2. # $v0 - syscall parameter and return value. # $a0 - syscall parameter. .text main: ##...
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...
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...
Please help me to answer those
three questions.
15. A third degree polynomial equation (a cubic equation) is of the form p(a) caz chac Co, where r and the into registers $t0, $t1, St2, and St3, respectively. Suppose the value of z is in $17. Write the MIPS32 instructions that would evaluate this polynomial, placing the result in St9. 16. Let $to 0xFEDC 4321, $t1 0x9876 ABCD, and St2 AAAA AAAA. Suppose the following sequence of in structions (on the...
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...
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...