Question
A double-precision IEEE number is stored in memory address X (see the code in lab_2.s). Write a sequence of MIPS instructions to divide the floating
A double-precision IEEE number is stored in memory address X (see the code in lab_2.s). Write a sequence of MIPS instructions to divide the floating number at X by (-8), prints out the result and store the result back at X. Accomplish this without using any floating-point instructions (assume that overflow doesnt occur). See the code in lab_2.s to move the double-precision floating-point number to integer registers.
There is "YOUR CODE GOES HERE" part
## ## template for your assembly programs ## ##
################################################# # # # text segment # # # #################################################
.text .globl __start __start: # execution starts here
# say hello la $a0,starting li $v0,4 syscall ############################# # load the fp number in a fp register (just for printing) l.d $f0, X jal message5a # print X mov.d $f12, $f0 li $v0, 3 syscall
# load the fp number in an integer register $t0 and $t1 (the operations must be performed on $t0 and $t1) mfc1 $t0, $f0 mfc1 $t1, $f1 # YOUR CODE GOES HERE mtc1 $t0,$f0 mtc1 $t1,$f1 jal message5b # store the $f0 result in memory # print X/(-4) mov.d $f12, $f0 li $v0, 3 syscall ####################### ####################### # say good bye la $a0,endl li $v0,4 syscall
# exit call li $v0,10 syscall # au revoir...
############## messages
message5a: la $a0,mes5a j message
message5b: la $a0,mes5b j message
message: li $v0,4 syscall jr $ra
################################################# # # # data segment # # # #################################################
.data starting: .asciiz " Program Starts Here ... " endl: .asciiz " exiting ..."
X: .double 10.00
mes5a: .asciiz " X: " mes5b: .asciiz " X/4: " ## ## end of file fib.a
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started