See below.
Now fill in the blanks so that the second term is evaluated and added to the accumulator.
Note: With actual hardware the result of
a mult operation should not be used
until two more instuctions have executed.
This feature is not simulated by SPIM,
so the program assumes that HI and LO contain
the correct results immediately after a mult operation.
## poly.asm
##
## evaluate 5x^2 -12x + 97
##
## Register Use:
##
## $10 base register, address of x
## $11 x
## $12 value of the polynomial
## $13 temporary
.text
.globl main
main:
lui $10,0x1000 # Init base register
lw $11,0($10) # Load x
ori $12,$0,97 # Initialize the accumulator
# during the "load delay slot"
ori $13,$0,12 # evaluate second term
mult $__,$__ # 12x
____ $13 # assume 32 bit result
subu $__,$__,$__ # accumulator = -12x +97
.... more instructions
sw $12,4($10) # Store result in poly
.data
x: .word 17 # base register points here
poly: .word 0
## End of file