I need help getting my mips program completed this are the full instructions with the sample
output (code is at the bottom)
1.3. Overview
For this assignment you will be writing a program the asks the user to enter a decimal number
and stores it in IEEE 754 single-precision floating point representation. You will then parse the
IEEE 754 representation to extract the different pieces (sign, exponent, and significand)
You do not have to convert the input to IEEE 754 representation manually. Just use the syscall to
read a float. This will automatically store the value in IEEE 754 format for you. You can then
copy the value to a normal 32-bit register to perform the different bit manipulations to extract
each piece.
After the initial reading in of the floating point value and moving the value to a standard register
you should not use the floating point registers again. Do not use any of the floating point
operations to find the sign, or anything else.
All of the parsing and calculations should be done using various bit manipulations operations
(i.e. bitshifts, maskings, etc). Remember beyond the initial reading of the floating point value
and moving it to a standard register your program should not touch the floating point registers
again.
Your program does not need to handle any of the special cases of floating point numbers like
NaN, infinity, -infinity, 0 or -0.
1.4. Task 1: Main Procedure
Your first task is to collect is to create a loop for your program. Ask user to enter "Do you want
to do it again?" in a Dialog box. Hint: Use syscall 50. If the user answers YES repeat the process.
NO or Cancel, exit the program.
1.5. Task 2: Take User Input Procedure
void read_float()
Next, take user input and store it in memory. Prompt the user to enter a floating point value as a
decimal number. Then, store the input value in a single precision floating point register. In a
DialogBox (syscall 52), Display a string with info about the program ex: "Welcome to the " and
capture a user input. The input should be a floating point number.
You MUST store input into memory space (ieee). To do this, first move your captured input
from the f0 floating point register to a regular temporary register using the following call:
Now, you should be able to store the value into the ieee variable in memory.
The procedure should have the following signature:
1.6. Task 3: Print the sign
void print_sign(ieee)
Your next task is to create a procedure called print_sign that will extract and interpret the sign bit
of the IEEE 754 single precision floating point number. The floating point number is the value
you collected from Task 2.
Your function will take the value as a 32-bit number in a non-floating point register (i.e. $a0).
Remember, this value is stored in your ieee memory space. You should use bit manipulations
(i.e. shifting, masking, etc) to determine the value of the sign bit. If the sign bit is a 1 your
function should print the '-' character. If it is a 0 your functi.
I need help getting my mips program completed this are the full inst.pdf
1. I need help getting my mips program completed this are the full instructions with the sample
output (code is at the bottom)
1.3. Overview
For this assignment you will be writing a program the asks the user to enter a decimal number
and stores it in IEEE 754 single-precision floating point representation. You will then parse the
IEEE 754 representation to extract the different pieces (sign, exponent, and significand)
You do not have to convert the input to IEEE 754 representation manually. Just use the syscall to
read a float. This will automatically store the value in IEEE 754 format for you. You can then
copy the value to a normal 32-bit register to perform the different bit manipulations to extract
each piece.
After the initial reading in of the floating point value and moving the value to a standard register
you should not use the floating point registers again. Do not use any of the floating point
operations to find the sign, or anything else.
All of the parsing and calculations should be done using various bit manipulations operations
(i.e. bitshifts, maskings, etc). Remember beyond the initial reading of the floating point value
and moving it to a standard register your program should not touch the floating point registers
again.
Your program does not need to handle any of the special cases of floating point numbers like
NaN, infinity, -infinity, 0 or -0.
1.4. Task 1: Main Procedure
Your first task is to collect is to create a loop for your program. Ask user to enter "Do you want
to do it again?" in a Dialog box. Hint: Use syscall 50. If the user answers YES repeat the process.
NO or Cancel, exit the program.
1.5. Task 2: Take User Input Procedure
void read_float()
Next, take user input and store it in memory. Prompt the user to enter a floating point value as a
decimal number. Then, store the input value in a single precision floating point register. In a
DialogBox (syscall 52), Display a string with info about the program ex: "Welcome to the " and
capture a user input. The input should be a floating point number.
You MUST store input into memory space (ieee). To do this, first move your captured input
from the f0 floating point register to a regular temporary register using the following call:
Now, you should be able to store the value into the ieee variable in memory.
The procedure should have the following signature:
2. 1.6. Task 3: Print the sign
void print_sign(ieee)
Your next task is to create a procedure called print_sign that will extract and interpret the sign bit
of the IEEE 754 single precision floating point number. The floating point number is the value
you collected from Task 2.
Your function will take the value as a 32-bit number in a non-floating point register (i.e. $a0).
Remember, this value is stored in your ieee memory space. You should use bit manipulations
(i.e. shifting, masking, etc) to determine the value of the sign bit. If the sign bit is a 1 your
function should print the '-' character. If it is a 0 your function should print the '+' character.
The procedure should have the following signature:
Remember, the sign bit in an IEEE 754 floating point number is the most significant bit.
1.7. Task 4: Print the exponent
void parse_exp(ieee)
Your next task is to create a procedure called parse_exp that will extract and interpret the
exponent bits of the IEEE 754 single precision floating point number. Your function will take the
value as a 32-bit number in a non-floating point register (i.e. $a0). Next it will need to isolate the
bits representing the exponent and interpret those bits as an unsigned integer. Finally, you will
need to subtract the bias to recover the true exponent value as a signed integer. This is the value
that should be returned.
The procedure should have the following signature:
Remember the exponent is the 8 bits immediately following the sign bit.
1.8. Task 5: Print the significand
void print_significand(ieee)
Your next task is to create a procedure called print_significand that will extract the mantissa of
the IEEE 754 single precision floating point number. Your function will take the value as a 32-
bit number in a non-floating point register (i.e. $a0). Next it will need to isolate the bits
representing the mantissa.
The procedure should have the following signature:
Remember the mantissa is the low order 23 bits and you will need to add the implied 1.
1.9. Task 6: Print value store from Task 2
Finally, print the output you captured in Task 2 in IEEE 32 bit form
Here is what i have so far please help
# Author: Your name
# Date: The date
# Description: Program description
.macro print_str (%string)
3. la $a0, %string
li $v0, 4
syscall
.end_macro
.globl read_float, print_sign, parse_exp, print_exp, parse_mantissa, print_significand, main,
ieee_to_hex
# Data for the program goes here
.data
ieee: .word 0
again: .asciiz "Do you want to do it again?"
prompt: .asciiz "Enter an IEEE 754 floating point number in decimal form: "
res_sign: .asciiz "nThe sign is: "
new_line: .asciiz "n"
expoBias: .asciiz "nExpo with bias: "
expoNoBias: .asciiz "nExpo without bias: "
manti: .asciiz "nMantissa: "
sieee: .asciiz "nIEEE-754 Single Prec: "
.text
main:
j loop # jump to the loop
exit_main:
li $v0, 10 # exit program
syscall
loop:
# Task 2: Call read_float()
jal read_float # jump and link to read_float
# Task 3: Call print_sign(ieee)
lw $a0, ieee # load the ieee number
jal print_sign # jump and link to print_sign
# Task 4: Call print_exp(ieee)
lw $a0, ieee # load the ieee number
jal print_exp # jump and link to print_exp
# Task 5: Call print_significand(ieee)
lw $a0, ieee # load the ieee number
jal print_significand # jump and link to print_significand
# Task 6: Print IEEE number in hex
4. lw $a0, ieee # load the ieee number
jal print_hex # jump and link to print_hex
# Task 1: Try again pop-up
print_str(again) # print the "Do you want to do it again?" message
li $v0, 8 # call the syscall for dialog box (syscall 8)
syscall # execute the call
beq $v0, 6, loop # if yes, repeat the loop
j exit_main # if no, exit the program
# Task 2: Take User Input Procedure
################################################################
# Procedure void read_float()
# Functional Description: Reads input from user using a pop up
# gui. It stores the capture value in ieee memory space
# Argument parameters: None
# Return Value: None
################################################################
# Register Usage:
# $f0: Input float value
# $t0: Temp storage for input value
# $a0: Prompt string address
read_float:
li $v0, 52
la $a0, prompt
syscall
li $v0, 5
syscall
mfc1 $f0, $f0
mfc1 $t0, $f0
sw $t0, ieee
jr $ra
# Task
# Task 3: Print the sign
################################################################
# Procedure void print_sign(ieee)
print_sign:
5. lw $t0, ieee
srl $t0, $t0, 31
beqz $t0, print_sign_positive
print_str res_sign
li $v0, 1
li $a0, '-'
syscall
j print_sign_end
print_sign_positive:
print_str res_sign
li $v0, 1
li $a0, '+'
syscall
print_sign_end:
jr $ra
# Task 4: Print the exponent
################################################################
# Procedure void print_exp(ieee)
print_exp:
print_str(expoBias)
lw $t1, ieee
andi $t0, $t1, 0x7f800000 # mask out the sign bit and mantissa
srl $t0, $t0, 23 # shift the exponent to the rightmost bit
addi $t0, $t0, -127 # subtract the exponent bias
li $v0, 34 # syscall to print a 32-bit hex number
move $a0, $t0
syscall
print_str(expoNoBias)
lw $t1, ieee
andi $t0, $t1, 0x7f800000 # mask out the sign bit and mantissa
srl $t0, $t0, 23 # shift the exponent to the rightmost bit
li $v0, 34 # syscall to print a 32-bit hex number
move $a0, $t0
syscall
print_str(new_line)
jr $ra
6. # Task 5: Print the significand
################################################################
# Procedure void print_significand(ieee)
parse_mantissa:
lw $t0, ieee
li $t1, 0x007fffff
and $t0, $t0, $t1
sll $t0, $t0, 1
or $t0, $t0, 0x80000000
mtc1 $t0, $f0
jr $ra
print_significand:
la $a0, manti
print_str($a0)
li $v0, 2
syscall
li $v0, 4
la $a0, new_line
syscall
jr $ra
# Task 6: print value store from task 2
#print output you captured in task 2 in IEEE 32 bit form
print_str sieee
li $v0, 34
lw $a0, ieee
syscall
li $v0, 16
syscall
exit_main:
li $v0, 10 # 10 is the exit program syscall
syscall # execute call In the tool below, "significand" is another name for the mantissa.
* Input Waldo Weber CS2810 Spring2018 Welcome to the IEEE Parser Enter a decimal number:
OK Cancel
7. Exponent 00000000
Significand
1.9.1. Sample Output Negative sign: 0x00000001 Expo with bias: 000000081 Expo without bias:
000000002 Mantissa: 0x00180000 IEEE-754 Single Prec: 0xc0980000
1.9.1.1. If your answer is YES Continue running the program Negative sign: 0x00000001 Expo
with bias: 000000081 Expo without bias: 0x00000002 Mantissa: 0x00180000 IEEE-754 Single
Prec: Oxc0980000 Expo without bias: 000000002 Mantissa: 0x00180000 IEEE-754 Single Prec:
Oxc0980000 Positive sign: 000000000 Expo with bias: 0x00000086 Expo without bias:
000000007 Mantissa: 000484000 IEEE-754 Single Prec: 0x43484000 1.9.1.2. If your answer is
NO Exit the program IEEE-754 Single Prec: 0x43484000 -- program is finished running .-