.text Write a MIPS program to evaluate the polynomial 3-5x + 2x +4x. Prompt the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
.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 .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
Expert Answer:
Answer rating: 100% (QA)
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 the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Kelly Studio just bought two bikes for $3800 pre-tax. Kelly paid $190 in taxes, $60 for a 1 year warranty, and $150 in installation fees. Before the bikes were used for cycling, Kelly decided to pain...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Case Study: Quick Fix Dental Practice Technology requirements Application must be built using Visual Studio 2019 or Visual Studio 2017, professional or enterprise. The community edition is not...
-
Consider the market for milk. Draw a supply curve and a demand curve (is the demand curve elastic on inelastic). Label the equilibrium price and quantity. Suppose that the production of milk causes...
-
An electron is confined to a linear region with a length of the same order as the diameter of an atom (about 100 pm). Calculate the minimum uncertainties in its position and speed.
-
Light bulbs are tested for their luminance, with the intensity of brightness desired to be within a certain range. Random samples of 5 bulbs are chosen from the output and their luminance values...
-
A centrifugal fan operating in a duct has the dimensionless parameters \[ C_{Q}=\frac{Q}{\omega D^{3}} \quad \text { and } \quad C_{H}=\frac{\Delta p}{ho \omega^{2} D^{2}} \] where \(C_{Q}\) is a...
-
Margo, age 35, was severely injured in an auto accident. She is covered under her employer's preferred provider organization (PPO) plan. The plan has a $1000 calendar-year deductible, 80/20 percent...
-
How does the application of advanced probabilistic risk assessment (PRA) techniques, such as fault tree analysis and event tree analysis, enhance the identification and quantification of hazards in...
-
Answer the following questions. a. What are the strengths of Professor Waddocks analysis? What are the weaknesses? What does the fact that there were frauds and unethical behavior long before the...
-
I would love for some help with this problem. I'm not used toPython, and I haven't taken Calculus in a few years, so I'm prettymuch lost. Please help in any way. \begin{tabular}{|c|c|c|} \hline & &...
-
Holdier Corp. $1,000 par value zero coupon bonds mature in 12 years. If your required rate of return is 7.9%, how much are you willing to pay for the bond today? Assume annual compounding and round...
-
You invest $ 2 0 0 per month in a savings plan that pays an APR of 4 . 5 % . What is the total amount of money you will have saved after 2 8 years?
-
Mahindra International (India) imported spares of an engine from a US manufacturer for $ 5,000 per annum at a price of $ 2.5 per piece. The average exchange rate during 2001-02 was Rs. 47.70/$. The...
-
Given rhe following for GFD Inc: Stock price = $40/share # of shares = 10,000,000 Market value debt = $500,000,000 cash and cash equivalents = $60,000,000 Find the: 1. market capitalization of the...
-
How might the concepts from the Johari window explain a group's likelihood to reach the working stage, and what they might be able to accomplish within it? Can you also explain the intersection of...
-
Points A (-3,-2) and B(5,2) Find: Distance of points A and B from x-axis and y-axis.
-
Why is homeostasis defined as the "relative constancy of the internal environments? Does negative feedback or positive feedback tend to promote homeostasis?
-
Exceptions can be used to indicate problems that occur when an object is being constructed. Write a program that shows a constructor passing information about constructor failure to an exception...
-
Compare and contrast the if single-selection statement and the while iteration statement. How are these two statements similar? How are they different?
-
A criticism of the break statement and the continue statement (in a loop) is that each is unstructured. Actually, break and continue statements can always be replaced by structured statements,...
-
Use the code given earlier for R to make this plot. The command would be plot(percentage)
-
Why would you not feel comfortable computing a Pearson correlation on the data in Exercise 9.10? Exercise 9.10 Down syndrome is another problem that psychologists deal with. It has been proposed that...
-
In Exercise 9.1 the percentage of mothers over 40 does not appear to be important, and yet it is a risk factor in other societies. Why do you think that this might be? Exercise 9.1 In Sub-Saharan...
Study smarter with the SolutionInn App