Question: * Assembly Code * CS254 Computer Organization and Assembly Language October 24, 2018 Homework 6 There are two programming questions for you to do. Please

* Assembly Code *

* Assembly Code * CS254 Computer Organization and Assembly Language October 24,

2018 Homework 6 There are two programming questions for you to do.

CS254 Computer Organization and Assembly Language October 24, 2018 Homework 6 There are two programming questions for you to do. Please submit two .s or .asm files. In the settings for SPIM, as usual use a bare machine with no exception handler, and also choose "Enable Delayed Loads" and "Enable Delayed Branches". This simulates a more realistic machine with a pipelined architecture 1. (5 points) Evaluate the polynomial 303-452 +28r 15 Get the value for x from symbolic addresses x. Store the result at symbolic address poly. Since load delays are turned on in SPIM be careful what instructions are placed in the load delay slot. Evaluate the polynomial by using Horner's Method. This is a way of building up values until the final value is reached. First, pick a register, say $7, to act as an accumulator. The accumulator will hold the value at each step. Use other registers to help build up the value at each step . First, put the coefficient of the first term into the accumulator: 30 . Next, multiply that value by : 30r Add the coefficient of the next term: 30x-45 . Next, multiply that sum by x: 30r2-45. . Add the coefficient of the next term: 3025+28 . Next, mltiply that sum by r: 30r -452 28a . Finally, add the coefficient of the last term: 30x3 - 45x2 28x - 15 Evaluating the polynomial in this way reduces the number of steps (and the amount of code) A sample of the data section in your program is shown as below , data word 10 .word 0 poly: 2. (5 points) Evaluate the following polynomial using Horner's method Now the values for the coefficients a, b. c, d as well as for x come from the .data section of memorv: CS254 Computer Organization and Assembly Language October 24, 2018 Homework 6 There are two programming questions for you to do. Please submit two .s or .asm files. In the settings for SPIM, as usual use a bare machine with no exception handler, and also choose "Enable Delayed Loads" and "Enable Delayed Branches". This simulates a more realistic machine with a pipelined architecture 1. (5 points) Evaluate the polynomial 303-452 +28r 15 Get the value for x from symbolic addresses x. Store the result at symbolic address poly. Since load delays are turned on in SPIM be careful what instructions are placed in the load delay slot. Evaluate the polynomial by using Horner's Method. This is a way of building up values until the final value is reached. First, pick a register, say $7, to act as an accumulator. The accumulator will hold the value at each step. Use other registers to help build up the value at each step . First, put the coefficient of the first term into the accumulator: 30 . Next, multiply that value by : 30r Add the coefficient of the next term: 30x-45 . Next, multiply that sum by x: 30r2-45. . Add the coefficient of the next term: 3025+28 . Next, mltiply that sum by r: 30r -452 28a . Finally, add the coefficient of the last term: 30x3 - 45x2 28x - 15 Evaluating the polynomial in this way reduces the number of steps (and the amount of code) A sample of the data section in your program is shown as below , data word 10 .word 0 poly: 2. (5 points) Evaluate the following polynomial using Horner's method Now the values for the coefficients a, b. c, d as well as for x come from the .data section of memorv

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!