Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The code on pages 20-21 ( https://drive.google.com/file/d/1XAdgvGmrUVLhuUR0rv65i7ZTx5iJjQ8y/view?usp=sharing) the Text book asks you to input a number, and it will then sum the numbers from 1

The code on pages 20-21 ( https://drive.google.com/file/d/1XAdgvGmrUVLhuUR0rv65i7ZTx5iJjQ8y/view?usp=sharing) the Text book asks you to input a number, and it will then sum the numbers from 1 to that number. The Prompt asks you to input a number, not necessarily an integer. The program will abort if a floating point number is entered. Your project, is to fix the program and allow for a floating point number to be entered. The program will NOT run, so your task is to convert the floating point number to an integer. If a floating point number is entered, truncate the number and use that integer to run the program. Also, you must inform the user that they entered a floating point and it was truncated, please output to the user, the floating point they entered and the integer you used. The following are some pointers as to what needs to be done. 1) The program reads an integer, that must be changed to read a floating point. 2) You will need to move that number into a floating point register and then that number must be copied into an integer register. This code was reviewed in the class on 2/27. 3) You will need to extract the exponent from the integer register and stored in another register. This was also covered on 2/27. 4) You will need to insert the Implied bit. I would suggest, zero out the exponent part by shifting left 9 then shifting right 9. Then add 8388608 (2^23) to the number. 5) You will need to extract the fractional portion of the of the number. You will need the exponent to determine the shift. You only need to test to see that this is NOT EQUAL to 0 (if it is we have an integer) 6) Extract the Integer. You may want to Rotate the bits to the left. You may want to use the following Assembler instructions in your code: srl, add, sll, rol, sub, srlv and sllv

image text in transcribed

20 Chapter 2 Algorithm Development in Pseudocode o. Sto, SVO # sum of integers in register $t0 It is suggested that you use the MIPSter editor to create a gram a # 'sunning integers in #branch to loop if SVO is ! e system cail code for Print String I copy of the followinu riment with the different features of the MIPS ource code files must be saved as text only) svo. Lc op 1oad address of message into sao # system call code for Print Integer # move value to be printed to Sao Date last modified to find the sum of the integere trom 1 to # system call code for Print String # 10ad address of meg. into $a0 # read in from the keyboard svo # terminate program run and # return control to system Please input a value for n . MUST HAVE A BLANK LINE AT THE END OF THE TEXT FILE cout

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

Database Fundamentals Study Guide

Authors: Dr. Sergio Pisano

1st Edition

B09K1WW84J, 979-8985115307

More Books

Students also viewed these Databases questions