Assignment Description:
Write a MIPS assembly language program that prompts for a user to enter a series of floating point
numbers and calls read_float to read in numbers and store them in an array. Then the program should
display the array content on the console window. Then it should find the number that is computed by
the following C program.
Consult the green sheet and the chapter 3 for assembly instructions for floating point numbers. 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
To load a single precision floating point number (instead of lw for an integer), you might use:
l.s $f12, 0($t0)
To store a single precision floating point number (instead of sw for an integer), you might use:
s.s $f12, 0($t0)
To assign a constant floating point number (instead of li for an integer), you might use:
li.s $f12, 123.45
1 of 4
To copy a floating point number from one register to another (instead of move for an integer), you
might use:
mov.s $f10, $f12
The following shows the syscall numbers needed for this assignment.
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