Question: I need help getting my last step to output correctly: prompt: . asciiz Enter an IEEE 7 5 4 floating point number in decimal form:

I need help getting my last step to output correctly: prompt: .asciiz "Enter an IEEE 754 floating point number in decimal form: " $a
sign_label: .asciiz "The sign is: "
exp_label: .asciiz "The exponent is: "
sig_label: .asciiz "The significand bits as an integer is: "
trunc_uint_label: .asciiz "The truncated unsigned integer value is: "
final_result_label: .asciiz "The truncated integer number is: "
newline: .asciiz "
"
.text # Code goes here
main:
# Step 1: Read a floating point number
la $a0, prompt
li $v0,4
syscall
li $v0,6 # Syscall for reading a floating point number
syscall
mfc1 $t0, $f0 # Move the floating point number to a temporary register
# Step 2: setup and call parse_sign
la $a0, sign_label # Load address of sign label
li $v0,4 # System call for print string
syscall
move $a0, $v0 # Move the result of parse_sign (sign character) to $a0
li $v0,11 # System call for print character
syscall
move $a0, $t0 # Move the floating point number to $a0 for parse_sign
jal parse_sign # Call parse_sign
move $a0, $v0 # Move the result of parse_sign (sign character) to $a0
li $v0,11 # System call for print character
syscall
# Step 3: setup and call parse_exponent
# Printing the exponent
move $a0, $t0 # Move the floating point number to $a0 for parse_exponent
jal parse_exponent # Call parse_exponent
# After calling parse_exponent
move $a0, $t0 # Move the floating point number to $a0 for parse_exponent
jal parse_exponent # Call parse_exponent
move $t2, $v0 # Store the result of parse_exponent in $t2 to avoid being overwritten
# new line
la $a0, newline
li $v0,4
syscall
# Printing the exponent
la $a0, exp_label
li $v0,4
syscall
move $a0, $t2 # Move the exponent result from $t2 to $a0 for printing
li $v0,1 # System call for print integer
syscall
# Step 4: setup and call parse_significand
move $a0, $t0 # Move the floating point number to $a0 for parse_significand
jal parse_significand # Call parse_significand
move $a1, $v0 # move the result of parse_significand to $a1 for print
# new line
la $a0, newline
li $v0,4
syscall
la $a0, sig_label
li $v0,4
syscall
move $a0, $a1 # Use $a1 for the significand result
li $v0,35 # System call for print unsigned int
syscall
# Step 5: setup and call calc_truncated_uint
# new line
la $a0, newline
li $v0,4
syscall
# Step 5: setup and call calc_truncated_uint
# Print the label for the truncated unsigned integer value
la $a0, trunc_uint_label # Load address of the label into $a0
li $v0,4 # System call for print string
syscall # Print the label
move $a0, $t2 # Move the unbiased exponent to $a0
move $a1, $v0 # Move the significand to $a1
jal calc_truncated_uint # Call calc_truncated_uint
# Printing the truncated unsigned integer value
# Assume calc_truncated_uint has been called and result is in $v0
# Print the truncated unsigned integer value
move $a0, $v0 # Move the result of calc_truncated_uint to $a0 for printing
li $v0,36 # System call for unsigne integer
syscall # Print the integer in $a0
# Step 6: If you haven't been printing values along the way
# Print out the appropriate output here.
exit_main:
li $v0,10 # 10 is the exit program syscall
syscall # execute call
## end of ca.asm
#
IEEE 754 single precision floating point number based on the$a0- signed i
# Gets the sign from an IEEE 754 single precision representation
#
# Argument parameters:
# $a0- IEEE 754 single precision floating point number (required)
# Return Value:
# $v0- ascii char for sign (+ or -)(required)
parse_sign:
srl $v0, $a0,31 # Shift right to isolate the sign bit
andi $v0, $v0,0x1 # Isolate the sign bit
beqz $v0, sign_is_positive
li $v0,'-' # Negative sign
end_parse_sign:
jr $ra
sign_is_positive:
li $v0,'+' # Positive sign
jr $ra
# Gets the exponent from an IEEE 754 single precision representation
#
# Argument parameters:
# $a0- IEEE 754 single precision floating point number
# Return Value:
# $v0- signed integer of exponent value with bias removed
parse_exponent:
srl $t1, $a0,23 # Shift right to position the exponent bits
andi $t1, $t1,0xFF # Isolate the 8 exponent bits
li $t2,127 #
sub $v0, $t1, $t2 # Adjust
end_parse_exponent:
 I need help getting my last step to output correctly: prompt:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!