Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introductory Relational Database Design For Business With Microsoft Access

Authors: Jonathan Eckstein, Bonnie R. Schultz

1st Edition

1119329418, 978-1119329411

More Books

Students also viewed these Databases questions

Question

8. Describe the steps in the development planning process.

Answered: 1 week ago