Question: For the following MIPS programming exercise, you may use only these instructions or macros: add addi addiu addu and andi div divu li lui lw

For the following MIPS programming exercise, you may use only these instructions or macros:

add addi addiu addu and andi div divu li lui lw mfhi mflo mult multu nor or ori sll sra srl sub subu sw xor xori

Evaluate the polynomial: 2x3 - 3x2 + 5x + 12 Use symbolic addresses for variables x and answer (holds the result). Assume that the value in x is small enough so that all results fit into 32 bits. Since load delays are turned on in SPIM be careful what instructions are placed in the load delay slot. Verify that the program works by using several initial values for x. Use x = 0 and x = 1 to start since this will make debugging easy. Then try some other values, such as x = 10 and x = -1. Write the program following the hardware rule that two or more instructions must follow a mflo instruction before another mult instruction (the delay slot). Try to put useful instructions in the delay slots that follow the mflo.

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!