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 enter Farh as a float:\n" .align 2 #align next prompt on a word boundary constfahr: .float 1 # will hold the user's input .text .globl main main: ############################################################### # system call to prompt user la $a0,prompt # system call 4 for print string needs address of string in $a0 li $v0,4 # system call 4 for print string needs 4 in $v0 syscall ############################################################### # system call to store user input of a float into register $f0 li $v0,6 # system call 6 for reading a float is required in $v0 syscall # the user's input is placed in register $f0 ############################################################### # do the conversion from Fahrenheit to Celcius mov.s $f12, $f0 # load the value wanting to convert from Fahr to Celcius f2c: lwc1 $f16, const5($zero) #load 5.0 lwc1 $f18, const9($zero) # load 9.0 div.s $f16, $f16, $f18 # $f16 = 5.0 / 9.0 lwc1 $f18, const32($zero) # load 32.0 sub.s $f18, $f12, $f18 # $f18 = fahr - 32 mul.s $f0, $f16, $f18 # $f0 gets the result of ((5.0/9.0)*(fahr - 32.0)) # http://www.h-schmidt.net/FloatConverter/IEEE754.html can be used to convert the result in $f0 # from single precision float to a decimal number (we should know how to do by hand too!) ############################################################### # system call to print the float in register $f12 mov.s $f12, $f0 li $v0,2 # system call 2 to print a float is required in $v0 syscall # the user's input is placed in register $f0 ############################################################### # Exit gracefully li $v0, 10 # system call for exit syscall # close file ###############################################################
.data
prompt1: .asciiz "Daniel Bevilacqua's Floating Point Average
Calculator \n"
prompt2: .asciiz "How many numbers would you like to average?
"
prompt3: .asciiz "Please enter a 3 digit decimal d.dd: "
prompt4: .asciiz "The average is: "
newline: .asciiz "\n"
.text
.globl
main
main:
la $a0, prompt1 #
prints prompt1
li $v0,
4
syscall
la $a0, prompt2 #
prints prompt2
li $v0,
4
syscall
li $v0,
5 # reads in
an integer (number of floats to average)
syscall
add $s0, $v0,
$zero # Stores number of floats
mtc1 $v0,
$f1 # puts user input, $v0 into
$f1
cvt.s.w $f1,
$f1 # Convert from integer into single precision float
point
jal dataCollect
jal averageLoop
# system call to exit the program
li $v0, 10
syscall
dataCollect:
bge $t0, $s0, exit
la $a0,
prompt3 # prints prompt3
li $v0,
4
syscall
li $v0,
6 #
read the float the user input
syscall
add.s $f2, $f2, $f0 # adds float
inputs
addi $t0, $t0, 1
j dataCollect
exit:
jr $ra
averageLoop:
div.s $f3, $f2, $f1
la $a0,
newline # prints an endl for beauty
li $v0, 4
la $a0, prompt4 #
prints the average prompt for user understanding
li $v0,
4
syscall
mov.s $f12, $f3 # loads the final
answer to be displayed
li $v0, 2
syscall
jr $ra
Computer Architecture Project Description: farh-to-cel.asm : # Revised and added code taken from Hennesey and Patterson...
(Mips) The below program is "Broken" , what 4 instructions need to be added to fix it, make sure you care clear where the instructions are added in the program. .data input : .asciiz "\nPlease Enter the Temperature in Fahrenheit:" Output: .asciiz"\nThe Temperature in Celsius is:" zero1: .float 0.0 onept8:.float 1.8 thirty2: .float 32.0 .text .global main main: la $a0,input li $v0,4 syscall #print input String li $v0,6 syscall #read floating point number in $f0 l.s $f4, zero1 #initialize $f4...
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...
AssignmentYou will be designing a calculator complete with user interface to take input from the user, process a response, and produce the output.Step 1: Present a menuFirst thing you should do is present a menu to the user when your program is first ran. Make sure that the operations match the numbers presented below, otherwise the graders won't be able to grade your program.1. Cartesian distance 2. Vector x matrix 3. Normalize 4. Quit Enter command:You will present the menu and wait for the user to input their...
For this c++ assignment, Overview write a program that will process two sets of numeric information. The information will be needed for later processing, so it will be stored in two arrays that will be displayed, sorted, and displayed (again). One set of numeric information will be read from a file while the other will be randomly generated. The arrays that will be used in the assignment should be declared to hold a maximum of 50 double or float elements....