Ditutup

MIPS assembly language program which prompts for a user to e

Objectives:

-write assembly language programs to:

-perform arithmetic on floating point numbers

-use syscall operations to display floating point numbers and strings on the console window

-use syscall operations to read floating point numbers from the keyboard.

Project Description:

Write a MIPS assembly language program which prompts for a user to enter two floating point numbers and calls read_float twice to read in two numbers. The program should perform their addition and subtraction, then display their results on the console window. If the result value is too large, you will see "inf" on the console. Experiment to see when it starts showing "inf" instead of an actual number, and print "too large" instead. Also, if the result value is too small negative number, you will see "-inf". Instead, print "too small".

Here is one instruction that you might use:

c.lt.s $f2, $f4

bc1t Label1

Here if the value in the register $f2 is less than the value in $f4, it jumps to the Label1. If it should jump when the value in the register $f2 is NOT less than the value in $f4, then it should be:

c.lt.s $f2, $f4

bc1f Label1

The following shows the syscall numbers needed for this project.

System Call System Call System Call

Number Operation Description

2 print_float $v0 = 2, $f12 = float number to be printed

4 print_string $v0 = 4, $a0 = address of beginning of ASCIIZ string

6 read_float $v0 = 6; user types a float number at keyboard; value is store in $f0

8 read_string $v0 = 8; user types string at keybd; addr of beginning of string is store in $a0; len in $a1

Here are sample outputs (user input is in bold): -- note that you might get some rounding errors

Enter the first value:

5.24

Enter the second value:

3.314

num1+num2 is: 8.55400000

num1- num2 is: 1.92600000

--------------------------------------------

Enter the first value:

170141183460469231731687303715884105728.00

Enter the second value:

170141183460469231731687303715884105728.00

num1+num2 is: too large

num1- num2 is: 0.00000000

--------------------------------------------

Enter the first value:

[url removed, login to view]

Enter the second value:

[url removed, login to view]

num1+num2 is: too small

num1- num2 is: 0.00000000

--------------------------------------------

Enter the first value:

[url removed, login to view]

Enter the second value:

170141183460469231731687303715884105728.00

num1+num2 is: 0.00000000

num1- num2 is: too small

Kemahiran: Kejuruteraan Perisian

Lihat lebih lanjut: programs in c language, e value, write a note on get, language programs, a1, a0, mips ASSEMBLY, len, float, f2, assembly project, Assembly language, store float mips assembly, floating point addition, string float, mips assembly program, read_float assembly, read float assembly, assembly mips read_float, mips display number keyboard, read float number register assembly, sample assembly language programs, user input mips float, sample store numbers, mips assembly program project

Tentang Majikan:
( 0 ulasan ) United States

ID Projek: #1582917