Question: Hi, need help MIPS! (Exercise) Create fp3.s Based on fp.s, write a program to add three values in different orders to show the resulting sum

Hi, need help MIPS!

(Exercise) Create fp3.s

Based on fp.s, write a program to add three values in different orders

to show the resulting sum

Here is fp.s:

.data # This shows you can use a .word and directly encode the value in hex # if you so choose num1: .word 0x4b000000 num2: .float 1.0 result: .word 0 string: .asciiz " "

.text main: la $t0, num1 lwc1 $f2, 0($t0) lwc1 $f4, 4($t0)

# Print out the values of the summands

li $v0, 2 mov.s $f12, $f2 syscall

li $v0, 4 la $a0, string syscall

li $v0, 2 mov.s $f12, $f4 syscall

li $v0, 4 la $a0, string syscall li $v0, 4 la $a0, string syscall

# Do the actual addition

add.s $f12, $f2, $f4

# Transfer the value from the floating point reg to the integer reg

swc1 $f12, 8($t0) lw $s0, 8($t0)

# At this point, $f12 holds the sum, and $s0 holds the sum which can # be read in hexadecimal

li $v0, 2 syscall li $v0, 4 la $a0, string syscall

# This jr crashes MARS # jr $ra

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!