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
  • In Python 3, Write a program that reads a set of floating-point values. Ask the user...

    In Python 3, Write a program that reads a set of floating-point values. Ask the user to enter the values, then print: The number of values entered. The smallest of the values The largest of the values. The average of the values. The range, that is the difference between the smallest and largest values. If no values were entered, the program should display “No values were entered” The program execution should look like (note: the bold values are sample user...

  • In MIPS: Write an assembly program that reads two lists of floating point numbers A and...

    In MIPS: Write an assembly program that reads two lists of floating point numbers A and B from users, and displays the measures given above on the simulator’s console. The program’s specifications are given below: • Each input vector should be of size 10, i.e., N=10 • The program should use PROCEDURES to compute dot product. Sample input vectors: A = [0.11 0.34 1.23 5.34 0.76 0.65 0.34 0.12 0.87 0.56] B = [7.89 6.87 9.89 7.12 6.23 8.76 8.21...

  • Write a program that uses a function that returns the minimum of four floating point numbers....

    Write a program that uses a function that returns the minimum of four floating point numbers. Use a function prototype and pass four parameters. Output the minimum of the four floating point values. use c code and variable names must be meaningful

  • Write a program that prompts the user to enter a character, an integer, and floating point...

    Write a program that prompts the user to enter a character, an integer, and floating point number. After reading the input, the program should print out the values entered. Be sure to format the code correctly and include relevant comments. in c

  • c++ no pointers just follow instructions Write a program (array.cpp) that read positive floating point numbers...

    c++ no pointers just follow instructions Write a program (array.cpp) that read positive floating point numbers into an array of capacity 100. The program will then ask for one of three letters(A, M or S). if the user inputs something other than one of these letters, then the program should ask for that input until an A, M, or S is entered. A do-while loop should be used for this. If the user inputs an A, then the program should...

  • Write a program that uses a function that returns the minimum of four floating point numbers....

    Write a program that uses a function that returns the minimum of four floating point numbers. Use a function prototype and pass four parameters. code in c program

  • Write a console-based program ( C # ) that asks a user to enter a number...

    Write a console-based program ( C # ) that asks a user to enter a number between 1 and 10. Check if the number is between the range and if not ask the user to enter again or quit. Store the values entered in an array. Write two methods. Method1 called displayByVal should have a parameter defined where you pass the value of an array element into the method and display it. Method2 called displayByRef should have a parameter defined...

  • Write program in C. Please ask the user to determine how many numbers to enter, and...

    Write program in C. Please ask the user to determine how many numbers to enter, and then find and display the largest one with two digits. Please call the following two functions in your main functions. void input_numbers(float *data, int num); void find_largest(float *data, int num); Note: In this assignment, please save the entered numbers using pointer, pass the pointer as the arguments. Depending upon the number of elements, the required size is allocated which prevents the wastage of memory....

  • Write a MIPS assembly program to calculate nCr. The program should accept the numbers n and...

    Write a MIPS assembly program to calculate nCr. The program should accept the numbers n and r from the user. The program should call the factorial function. nCr = n! / ((n-r)! * r!) If n<r print an error message "n should not be less than r: re-enter the values." and get the inputs n and r from the user.

  • The program I'm using is MIPS (mars) assembly; Write a program that in the main routine...

    The program I'm using is MIPS (mars) assembly; Write a program that in the main routine ask the user input n numbers(2<n<11) and pass n and array pointer to FillArray to stores numbers in the array. Main again passes the pointer to AddElement Function to add the elements of the array, and return the result back to main to print it.                                                                                                                                          

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