Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Computer Architecture Project Description farh-to-cel.asm # Revised and added code taken from Hennesey and Patterson 5th edition # to work with this simulator. # #

Computer Architecture

Project Description

image text in transcribed

 

image text in transcribed 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: " .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 ###############################################################
You will learn how fractions (floating point numbers) are stored in the computer and how to use MIPS assembly language instructions to work with such numbers In statistics, arithmetic mean (or simply mean, average, or expected value) of a series ao a1, , aN-1 is defined as: Write an assembly program named average.asm that reads a list of floating point numbers from the keyboard and displays the measure given above on the simulator's console The input specifications are given below . Prompt the user for the number of floating point values that the user will enter. You MUST save this number as in integer or 10 points are deducted from the assignment. Later you will need to convert it to a float. By using a loop, repeatedly prompt the user to enter the floating point numbers. You may read the floating point number the user entered into a floating point register. Assume the format for the number to enter is 3 decimal numbers, one for the integer part and two numbers after the decimal point; e.g. the user may enter 4.29,-5.90, 0.02, etc. For example, given the following input: A [0.11 0.34 1.23 5.34 0.76 0.65 0.34 0.12 0.87 0.56] The program's output should be similar to given in the following The Mean of A 1.03 Prompt the user for each number separately. An example dialog is How many numbers would you like to average? 3 Please enter a 3 digit decimal d.dd: 4.12 Please enter a 3 digit decimal d.dd: 0.99 Please enter a 3 digit decimal d.dd: 1.87 The average is: 2.326666666666

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Joe Celkos Data And Databases Concepts In Practice

Authors: Joe Celko

1st Edition

1558604324, 978-1558604322

More Books

Students also viewed these Databases questions