如何将浮点寄存器的值移至MIPS中的通用寄存器?

发布于 2024-08-10 19:54:00 字数 362 浏览 2 评论 0原文

我有以下 MIPS 程序集,在 MARS 模拟器上运行,如下所示

.data

x: .space 4 # 4 bytes = 32 bits

li $v0, 6
syscall

:此时,我需要的浮点值在 $f0 中,但我需要将该值移动到 x 中。如果我可以将浮点寄存器 $f0 的内容传输到 $t0,我就能做到这一点。这可能吗?如果没有,解决方法是什么?

I have the following bit of MIPS assembly, run on the MARS simulator, given below:

.data

x: .space 4 # 4 bytes = 32 bits

li $v0, 6
syscall

At this point, the floating point value I need is in $f0, but I need to move the value to x. If I could transfer the contents of the floating point register $f0 to $t0, I would be able to do this. Is this possible? If not, what is the workaround?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

合约呢 2024-08-17 19:54:00

您需要'单精度存储'伪指令。我认为这个应该将 $f0 中的任何 32 位粘贴到 x 中。

s.s $f0, x

我刚刚下载了 MARS 并进行了测试,它在这里运行得很好。

You want the 'single precision store' pseudoinstruction. I think this one should stick whatever 32 bits are in $f0 to x.

s.s $f0, x

I just went and downloaded MARS and tested it out, it works fine here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文