MIPS 浮点加法示例
我正在尝试编写一个MIPS程序,它将两个浮点整数相加,第一个浮点整数是-8.0的二进制补码,
第二个是浮点整数2.0,
所以首先我将-8更改为二进制补码,即1000,然后我将其转换为十六进制,这样我的十六进制将是 0x00000008
我的 MIPS 程序到目前为止看起来像这样,
l.s $f1, 0x00000008
l.s $f2, 15.0
add.s $f0, $f1, $f2
我收到一个错误,显然有什么帮助吗?
另外,在命令 ls $f2, 15.0 中加载浮点整数时,我感到很困惑,我知道这是不对的。如何将 15 作为浮点数加载到注册表中?我的终极问题又是如何使用 MIPS 将两者相加。谢谢,
I am trying to write a MIPS program that will add two floating point integers togerther, the first floating point integer is the two's complement of -8.0
the second is the floating pointinteger 2.0
so first I changed -8 to two's compliment which is 1000 then I converted that to hex so my hex would be 0x00000008
my MIPS program so far looks like this
l.s $f1, 0x00000008
l.s $f2, 15.0
add.s $f0, $f1, $f2
I get an error on this obviously any help?
Also I am confused when loading in floating integers in the commant l.s $f2, 15.0 I know this is not right. how can I load 15 into the registry as a floating point? and again my ultimate question how can I add the two together using MIPS. thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,浮点数 8 并不表示为 0x00000008。请记住,浮点数是使用 IEEE 754 标准表示的。
如果要添加 0x8 和 0xF,那么您应该:
ls
)cvt.sw
指令(从 word 转换 single) )将它们转换为浮点寄存器。To start with, the floating point number 8 is not represented as 0x00000008. Remember that floating point numbers are represented using the IEEE 754 standard.
If you want to add 0x8 and 0xF, then you should:
l.s
)cvt.s.w
instruction (convert single from word) to convert them into floating point registers.