Question: .text Write a MIPS program to evaluate the polynomial 3-5x + 2x +4x. Prompt the user for x, store it in a memory location

.text  Write a MIPS program to evaluate the polynomial 3-5x + 2x +4x. Prompt the user for x, store it in a

.text Write a MIPS program to evaluate the polynomial 3-5x + 2x +4x. Prompt the user for x, store it in a memory location called X, o then retrieve x into a register to use in the calculations. Store the result in a memory location called Y, o then retrieve y to print with a short description like "result = ". You have to use the Horner's method to evaluate the # use the Horner's method to evaluate the polynomial 3-5x + 2x^2 +4x^3 # as 3+x(-5+2x+4x^2) = 3+x(-5+x(2+4x)) = 3+x(-5+x(2+x(4) ) ) .data la polynomial. o Fill in the missing codes in the program template attached below o Test your program with the input values 0,1,2,3, -1, -2,-3... for your program. Submit your MIPS program as ploy.honner.asm Full credit are given only if your program produce correct answer for inputs 0,1,2,3, -1, -2,-3, and some other random integer. o No partial credit will be given. X: Y: result: asciiz "result = " prompt: asciiz "Input an integer for x to evaluate 3-5x + 2x^2 +4x^3 using Horner's method." .egy .egvi egy egy 11 la syscall 11 syscall la SW I Tw li li 42 li li mul add printResult: la .word .word la 11 syscall lw u Syscall u syscall a bb C d $50, 4 2 -5 3 $v0, 4 $a0, prompt 0 xxx fill in the missing codes sve, X $v0, ($50) ($50) $a0, ste. a $t1, bb St2, $13, d $t0, $a0, $te sto, $t1, ste $50, Y $v0, sto, ($50) $a0, result $v0, 4 $50, Y $a0, ($50) 1 $v0, 10 #input an integer > Sve contain the integer read #te= x(4) #te 2+x (4) Ite= x(2+x(4)) #te= -5 + x(2+x(4)) I t0 = x( -5 + x(2+x(4))). 1 # 10 = 3 + x( -5+ x(2+x(4))) #syscall code: print_string #syscall code: print int # exit

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

It seems you need help with writing a MIPS assembly program to evaluate a polynomial using Horners method The given polynomial is 3 5x 2x2 4x3 Horners ... View full answer

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 Programming Questions!