la 指令在 MIPS 中是如何翻译的? [英] How is the la instruction translated in MIPS?
问题描述
我知道 MIPS 中的 la
分解为 lui
和 ori
但这些指令的参数是什么?
I know la
in MIPS breaks down to lui
and ori
but what are the arguments for those instructions?
我在这里查看了这个问题 MIPS 伪指令,替换但结果lui
总是使用 4097?
I looked at this question here MIPS Pseudo istructions, replacements but does the resulting lui
always use 4097?
考虑以下事项:
.data
_a: .space 4
.text
main: la $s0,_a
翻译成这个了吗?
lui $at,4097
ori $s0,$at,0
谢谢!
推荐答案
4097 十进制是 0x1001.这是 0x10010000 的高 16 位.
4097 decimal is 0x1001. This is the upper 16 bits of 0x10010000.
这是 mars
模拟器中 .data
段开头的默认加载地址.
This is the default load address for the start of the .data
segment in the mars
simulator.
如果你做了la $s0,main
,lui
将是 lui $at,0x0040
因为的默认起始地址code>.text
是 0x00400000.
If you had done la $s0,main
, the lui
would be lui $at,0x0040
because the default start address for .text
is 0x00400000.
要查看不同之处,请尝试此程序:
To see the difference, try this program:
.data
_a: .space 100000
_b: .space 4
.text
main: la $s0,_b
这篇关于la 指令在 MIPS 中是如何翻译的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!