Answered step by step
Verified Expert Solution
Question
1 Approved Answer
.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 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
Step: 1
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 ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started