Question

Write a MIPS program that will ask the user to enter two floating point numbers at...

Write a MIPS program that will ask the user to enter two floating point numbers at the console and pass the values to a function that does multiplication

0 0
Add a comment Improve this question Transcribed image text
Answer #1

multiplicaiton(float, float):

addiu $sp,$sp,-8

sw $fp,4($sp)

move $fp,$sp

swc1 $f12,8($fp)

swc1 $f14,12($fp)

lwc1 $f2,8($fp)

lwc1 $f0,12($fp)

nop

mul.s $f0,$f2,$f0

move $sp,$fp

lw $fp,4($sp)

addiu $sp,$sp,8

j $31

nop

$LC0:

.ascii "Enter the value of X and Y\000"

main:

addiu $sp,$sp,-40

sw $31,36($sp)

sw $fp,32($sp)

move $fp,$sp

lui $2,%hi($LC0)

addiu $5,$2,%lo($LC0)

lui $2,%hi(_ZSt4cout)

addiu $4,$2,%lo(_ZSt4cout)

jal std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)

nop

move $3,$2

lui $2,%hi(_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)

addiu $5,$2,%lo(_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)

move $4,$3

jal std::basic_ostream<char, std::char_traits<char> >::operator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&))

nop

addiu $2,$fp,24

move $5,$2

lui $2,%hi(_ZSt3cin)

addiu $4,$2,%lo(_ZSt3cin)

jal std::basic_istream<char, std::char_traits<char> >::operator>>(float&)

nop

move $3,$2

addiu $2,$fp,28

move $5,$2

move $4,$3

jal std::basic_istream<char, std::char_traits<char> >::operator>>(float&)

nop

lwc1 $f0,24($fp)

lwc1 $f2,28($fp)

nop

mov.s $f14,$f2

mov.s $f12,$f0

jal multiplicaiton(float, float)

nop

mfc1 $5,$f0

lui $2,%hi(_ZSt4cout)

addiu $4,$2,%lo(_ZSt4cout)

jal std::basic_ostream<char, std::char_traits<char> >::operator<<(float)

nop

move $2,$0

move $sp,$fp

lw $31,36($sp)

lw $fp,32($sp)

addiu $sp,$sp,40

j $31

nop

__static_initialization_and_destruction_0(int, int):

addiu $sp,$sp,-32

sw $31,28($sp)

sw $fp,24($sp)

move $fp,$sp

sw $4,32($fp)

sw $5,36($fp)

lw $3,32($fp)

li $2,1 # 0x1

bne $3,$2,$L7

nop

lw $3,36($fp)

li $2,65535 # 0xffff

bne $3,$2,$L7

nop

lui $2,%hi(_ZStL8__ioinit)

addiu $4,$2,%lo(_ZStL8__ioinit)

jal std::ios_base::Init::Init() [complete object constructor]

nop

lui $2,%hi(__dso_handle)

addiu $6,$2,%lo(__dso_handle)

lui $2,%hi(_ZStL8__ioinit)

addiu $5,$2,%lo(_ZStL8__ioinit)

lui $2,%hi(_ZNSt8ios_base4InitD1Ev)

addiu $4,$2,%lo(_ZNSt8ios_base4InitD1Ev)

jal __cxa_atexit

nop

$L7:

nop

move $sp,$fp

lw $31,28($sp)

lw $fp,24($sp)

addiu $sp,$sp,32

j $31

nop

_GLOBAL__sub_I_multiplicaiton(float, float):

addiu $sp,$sp,-32

sw $31,28($sp)

sw $fp,24($sp)

move $fp,$sp

li $5,65535 # 0xffff

li $4,1 # 0x1

jal __static_initialization_and_destruction_0(int, int)

nop

move $sp,$fp

lw $31,28($sp)

lw $fp,24($sp)

addiu $sp,$sp,32

j $31

nop

PLEASE GIVE A THUMBS UP!!! DONT GIVE A THUMBS DOWN IF YOU HAVE ANY QUERY SO COMMENT DOWN I WILL CLEAR IT FOR YOU

Add a comment
Know the answer?
Add Answer to:
Write a MIPS program that will ask the user to enter two floating point numbers at...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT