assembly - 如何编写一系列 MIPS 指令以将 X 处的浮点数除以 (-4),而不使用任何浮点指令。
问题描述
我不明白如何在不使用任何浮点指令的情况下使用 -4 将浮点加载到整数中。我们假设没有溢出。我问这个问题是因为我真的迷失在这个 Mips 代码中.如果有人能启发我,我将非常感激。另外浮点在X中我需要再次将结果写在X中。
##
## 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 "\n\nProgram Starts Here ...\n"
endl: .asciiz "\n\nexiting ..."
X: .double 10.00
mes5a: .asciiz "\n\nX: "
mes5b: .asciiz "\n\nX/4: "
##
## end of file fib.a
解决方案
推荐阅读
- docker - .Net5、SAP 和 docker:UUID 守护进程 (uuidd) 未激活
- javascript - 添加溢出滚动删除伪元素
- c - GTK+2:透明地绘制在其他小部件之上
- sqlite - 更新表结构时 sqlite3.exe 需要重新启动
- performance - 我怎样才能使这个带有多个 for 循环的 go 代码更快?
- javascript - 快照侦听器中未捕获的错误:FirebaseError:找不到匹配的索引
- c# - 有什么方法可以通过“http 请求”和通过 DI 在 Blazor 组件中的“DI 范围”中为每个用户提供持久性?
- google-cloud-shell - GCP Cloud Shell IDE 打开文件夹
- python - 使用 gstreamer 的 Rtsp 流 python mss 屏幕截图
- python - 从 sklearn 导入“kfold”时出现“DLL 加载失败:找不到指定的模块”错误