Question: Can I get help with these two questions regarding MIPS and can the answers be in a regular text format? three examples are provided below.

Can I get help with these two questions regarding MIPS and can the answers be in a regular text format? three examples are provided below. thank you!
Can I get help with these two questions regarding MIPS and can
the answers be in a regular text format? three examples are provided
below. thank you! #adds three values stored at 3 variables main: lu$sp,0x7fff
ori$sp,$sp, Oxfffc lw $to, v1 lw $t1, V2 addu $vo, Sto, $t1

#adds three values stored at 3 variables main: lu$sp,0x7fff ori$sp,$sp, Oxfffc lw $to, v1 lw $t1, V2 addu $vo, Sto, $t1 lw $to, v3 addu $vo, $vo, Sto *done: beg $0.50,done vi word 1 v2 word 2 V3. word 3 #adds the first n natural numbers main: lui $sp,0x7fff ori $sp,$sp,Oxfffc lul $50,0x0000 ori $80,$s0,0x0005 # n stored here addu $a0,$so, Szero Jal addnat num *done: beg $0.$0,done addnat num: xor Sto, Sto, sto # set $to to zero. It will work as the counter xor Svo, $vo, $vo # set $v0 to zero. It will work as return value beg $a0,$to, end fn # special case if n == 0 loop: addiu Sto, $to, 1# increment counter addu $vo, $vo, Sto bne Sad, Sto, loop end fn: ir Sra #compute the factorial of n using recursive function calls main: lui $sp,Ox7fff or $sp,$sp, Oxfffc lul Sa0,0x0000 ori Sa0,$50,0x0005 # n stored here ial factorial *done: beg $0.50,done factorial: addiu Sto, Szero,4 addiu $t1, Szero, 1 sw Sra, ($sp) subu $sp,$sp, Sto sw $aq.($sp) subu $sp,$sp,$to bne $20, $1, else move Svo, St1 addu $sp,$sp,$to addu $sp,$sp,$to ir Sra else: sub $a0,$a0,$t1 jal factorial addu $sp,$sp,$to lw $t3,($sp) mul Svo, $vo, St3 addu $sp,$sp,$to w Sra, (Ssp) It Sra Problem 4 As you probably guessed, the Fibonacci example provided in the previous page does a lot of saving retrieving of data. In particular, the cost of storing this variables is linear with respect to the number of recursive calls, which is linear with respect to the size of the number. There is an optimization that allows you to use a single stack frame for the whole function. This is called tail recursion and it reduces the cost of recursive functions from linear to constant time. I leave you this link to figure out how to create your own tail recursive function: https://stackoverflow.com/questions/310974/what-is-tail-call- optimization Problem 5 For this problem you will use an online compiler explorer at URL: https://godbolt.org/ In this website, you provide a C source code and it converts it to the assembly language indicated. Be sure to change it to MIPS & 5.4 (this is the 32bit version of MIPS, which is simpler than the 64 version). Compile the assembly of the following program: int mainot int A19) - (5,10,13,22,16,48,13,90,31); int sum for (int 10;

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!