CSE/EEE230 Assignment11
Due Date
Thursday, April 25th, 5pm
Note: the lowest scored assignment will be dropped.
Important: This is an individual assignment. Please do not collaborate.
It must be submitted on-line (Blackboard).
No late assignment will be accepted
Minimal Submitted Files
You are required to turn in the following source file:
assignment11.s
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.
Assignment Description:
Write a MIPS assembly language program that prompts for a user to enter how many floating point numbers to enter, then prompts to enter a series of floating point numbers and reads in numbers and store them in an array, then asks a user how many small numbers to print, and computes and prints them.
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
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 stored in
$f0
8 read_string
$v0 = 8; user types a string at keybd; addr of beginning of string
is stored in $a0; len in $a1
------------------------------------------
C program will ask a user how many floating numbers will be entered,
then read floating point numbers and store them in an array.
Then it asks a user how many smallest numbers to print, then print that many smallest numbers.
-------------------------------------------
void main( )
{
int arraysize = 25;
float array[arraysize];
int i, j, howMany, howManySmall;
float num, temp;
printf("Specify how many numbers should be stored in the array (at most 25):\n");
scanf("%d", &howMany);
//The following loop reads in floating point numbers
//and stores them into the array
i = 0;
while (i < arraysize && i < howMany)
{
printf("Enter a number:\n");
//read an integer from a user input and store it in num
scanf("%f", &num);
array[i] = num;
i++;
}
//Print out each number in the array
printf("The original array contains the following:\n");
i = 0;
while (i < arraysize && i < howMany)
{
printf("%f\n", array[i]);
i++;
}
printf("Specify how many small numbers to print:\n");
scanf("%d", &howManySmall);
int minIndex;
for (i = 0; i < howManySmall && i < arraysize-1 && i < howMany; i++)
{
minIndex = i;
for (j = i+1; j < arraysize && j < howMany; j++)
{
if (array[j] < array[minIndex])
{
minIndex = j;
}
}
temp = array[i];
array[i] = array[minIndex];
array[minIndex] = temp;
printf("The smallest #%d : %f\n", (i+1), array[i]);
}
return;
}
Here are sample outputs (user input is in bold): -- note that you might get some rounding errors.
Specify how many numbers should be stored in the array (at most
25):
14
Enter a number:
3.2
Enter a number:
6.43
Enter a number:
-3.23
Enter a number:
4.3
Enter a number:
4.3
Enter a number:
-3.24
Enter a number:
-5.4
Enter a number:
3.2
Enter a number:
3.2
Enter a number:
5.1
Enter a number:
6.5
Enter a number:
8.8
Enter a number:
8.8
Enter a number:
9.9
The original array contains the following:
3.200000
6.430000
-3.230000
4.300000
4.300000
-3.240000
-5.400000
3.200000
3.200000
5.100000
6.500000
8.800000
8.800000
9.900000
Specify how many small numbers to print:
4
The smallest #1 : -5.400000
The smallest #2 : -3.240000
The smallest #3 : -3.230000
The smallest #4 : 3.200000
--------------------------------------------
What to turn in::
-Submit your assignment11.s file to the file submission site through the Blackboard by the assignment deadline. Make sure that your name and email address are correct in the header block.
Grading Criteria:
____/ 5 Documentation (header with your name, your information, and program description and comments within your code)
____/ 1 Indentation and spacing (easy to read)
____/ 6 Required functions and functionalities implemented
____/ 8 Produces correct results?
Please help!
www.bitsavers.org>pdf>intel>ISIS_II
This link under the concept of floating point arithmetic library user's manual-Bitsavers.org
In the above link we have pdf and that contain chapters
In chapter -3 your required concept is arranged it consists of more information about your required concept.
CSE/EEE230 Assignment11 Due Date Thursday, April 25th, 5pm Note: the lowest scored assignment will be dropped....
CSE/EEE230 Assignment11 Due Date Thursday, April 25th, 5pm Note: the lowest scored assignment will be dropped. Important: This is an individual assignment. Please do not collaborate. It must be submitted on-line (Blackboard). No late assignment will be accepted Minimal Submitted Files You are required to turn in the following source file: assignment11.s 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...
Computer Architecture
Project Description:
farh-to-cel.asm :
# Revised and added code taken from Hennesey and Patterson 5th edition
# to work with this simulator.
#
# Prompts a user to enter a Fahrenheit temperature as a floating point.
# Displays the converted temperature in Celcius.
# 10/28/2015
.data
const5: .float 5.0 # store a floating point constant 5.0
const9: .float 9.0
const32: .float 32.0
.align 2 # align the next string on a word boundary
.space 100
prompt: .asciiz "Please...
CSE/EEE230 Assignment4 Due Date Thursday, January 24th, 5pm Important: This is an individual assignment. Please do not collaborate. It must be submitted on-line (Blackboard). No late assignment will be accepted Minimal Submitted Files You are required to turn in the following source file: assignment4.s Objectives: -write assembly language programs to: -perform decision making using branch instructions. -use syscall operations to display integers and strings on the console window -use syscall operations to read integers from the keyboard....
Using Java
In this assignment we are working with arrays. You have to ask the user to enter the size of the integer array to be declared and then initialize this array randomly. Then use a menu to select from the following Modify the elements of the array. At any point in the program, if you select this option you are modifying the elements of the array randomly. Print the items in the array, one to a line with their...
Programming Assignment #2 EE 2372 MAKE SURE TO FOLLOW INSTRUCTIONS CAREFULLY, IF YOU HAVE ANY DOUBTS PLEASE EMAIL ME! This programming assignment will just be a small extension to programming assignment 1. In the first assignment each of the functions could only take a predefined number of inputs. This time the objective is to be able to complete these functions with any amount of inputs. The user will pass arguments through the command line (this means you will have to...
This is a quick little assignment I have to do, but I missed alot
of class due to the Hurricane and no one here knows what theyre
doing. please help! this is Java with intelli-J
Overview In this project students will build a four-function one-run calculator on the command line. The program will first prompt the user for two numbers, then display a menu with five operations. It will allow the user to select an option by reading input using...
Questin 1 (CO 2) Which of the following is not a valid name in python? last_name lastName last name lname Question 2 (CO 3) How many times will “Hello World” be displayed after the following code executes? num=2 while num<12: print("Hello world") num+=2 2 12 5 4 Question 3 (CO 1) The following code contains an error, what type of error is it and what line number is it? 1 count=1 2 while count<4 3 print("count = ",...
In C++ Please please help.. Assignment 5 - Payroll Version 1.0 In this assignment you must create and use a struct to hold the general employee information for one employee. Ideally, you should use an array of structs to hold the employee information for all employees. If you choose to declare a separate struct for each employee, I will not deduct any points. However, I strongly recommend that you use an array of structs. Be sure to read through Chapter...
In C++ Assignment 7 - Postal Packages In the Gaddis textbook read Chapter 8 sections 8.1-8.10 and Chapter 9 section 9.1 before starting this assignment. Lone Star Package Service ships packages within the state of Texas. Packages are accepted for shipping subject to the following restrictions: Shipping requirements The package weight must not exceed 50 pounds. The package must not exceed 3 feet in length, width, or height. The girth of the package must not exceed 5 feet. The girth...
In this assignment you are to utilize the Node data structure provided on Blackboard. In this assignmet you are to write a main program that implements two methods and a main method as their driver. So, only main and two methods with it. Note: You may not use any of the LinkedList class provided on Blackboard, you may use the methods in it as a guide (you should actually look at them) but you cannot use any of the methods...