Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Help this is due in an hour! Please complete the assembly language program to ev

ID: 3676671 • Letter: H

Question

Help this is due in an hour!

Please complete the assembly language program to evaluate the expression:

17xy - 12x - 6y + 12

use the symbolic addresses x, y, and answer. assume that the values are small enough so that all results fit into 32 bits.

## Program to calculate 17xy-12x-6y+12

##

.text.

.globl main

main:

lui $8, _____ # $8 saves base address

___ $9, _____ (____) # put x into $9

___ $10,____ (____) # put y into $10

___ $11,____, 17 # put 17 into $11

___ _____, _____ # compute 17x

___ $11 # save 17x into $11

___ _____, _____, 12 # put 12 into $12

___ _____,_____ # compute 12x

___ $12 # save 12x into $12

___ ____,____,$12 # compute 17xy-12x and put it into $11

___ $12, ____, ____ # put 6 into $12

___ ____, _____ # compute 6y

____ $12 # comput 6y into $12

____ ____,_____,___ #compute 17xy-12x-6y and put it into $11

____ ____,____,12 # compute 17xy-12x+-6+12 and save it into $11

____ ____,____(_____) # save the final answer back to main memory with symbolic address 'answer'

.data # The data section states at address 0x1000000

x: .word 8 # The base register points here

y: .word 9   

answer: .word 0

Explanation / Answer

.text
.globl main

main:

lui $15, 0x1001 #Loads base into reg 15
lw $9, 0($15) #Loads x into reg 9
nop

lw $10, 4($15) #Loads y into reg 10

ori $14, $0, 17 #Multiplier register init

multu $9, $10
mflo $13 #Result of xy

nop
nop

multu $13, $14 #Multiplies result of xy by 17
mflo $13 #Stores result of 17xy

nop
ori $14, $0, 12 #Changes multiplier to 12

multu $9, $14 #12x
mflo $12 #Stores result in reg 12

subu $13, $13, $12 #17xy - 12x

ori $14, $0, 6 #Multiplier changed to 6

multu $10, $14 #6y
mflo $12 #6y stored in reg 12

subu $13, $13, $12 #17xy - 12x - 6y
ori $14, $0, 12 #Multiplier changed to 12

addu $13, $13, $14 #17xy - 12x - 6y + 12

sw $13, 8($15) #Stores result in answer

.data
x: .word 10
y: .word 10
answer: .word 0