Question: i have this code and i have only one error code that is messing up everything please help this is the prompt i am wanting

i have this code and i have only one error code that is messing up everything please help this is the prompt i am wanting to achieve f =(g + h -3)-(i +7)
instead of starting with the variables in registers, instead read the 3 inputs from memory locations defined in a data section of your program, and output the result to another location in the data section this is my code below :
.data
g: .word 0 # g input
h: .word 0 # h input
i: .word 0 # i input
result: .word 0 # Result storage
.text
lw x10, g # Load g from memory into register x10
lw x11, h # Load h from memory into register x11
lw x12, i # Load i from memory into register x12
add x20, x10, x11 # Calculate (g+h)
addi x20, x20,-3 # Subtract 3 from (g+h), result in x20
addi x13, x12,7 # Calculate (i+7), store in temporary register x13
sub x20, x20, x13 # Subtract (i+7) from (g+h-3), result in x20
sw x20, result # Store the result in memory location 'result'
Error in C:\Users\fleno\OneDrive\Documents\Comp and arch\Hw7.asm line 17 column 5: "sw": Too few or incorrectly formatted operands. Expected: sw t1,-100(t2)
Assemble: operation completed with errors

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!