问题描述
在MIPS中,拉
指令转换成雷
和 ORI
。然而,MARS模拟器似乎并没有做到这一点的。当我转储以下机床code:
In MIPS, the la
instruction translates into lui
and ori
. However, MARS Simulator does not seem to do that at all. When I dump the following machine code:
.text
la $a0, array
la $a1, array_size
lw $a1, 0($a1)
.data
array: .word 0:10
array_size: .word 10
message: .asciiz "The sum of numbers in array is: "
我得到:
00100000000001000010000000000000
00100000000001010010000000101000
10001100101001010000000000000000
这是显而易见的。据倾销拉
为一条指令。什么是MARS办?我怎样才能使它间preT 拉
为雷
和 ORI
?
Which is obviously. It is dumping la
as one instruction. What does MARS do? How can I make it interpret la
as lui
and ori
?
感谢您,
推荐答案
这里发生的事情是,你的汇编作为汇编这些拉
取值 ADDI $< DEST>中$ 0< VALUE>
。两个指令序列时,才需要的量不能重新在一个16位立即psented $ P $值;您正在使用这里的值看起来像为0x2000
和 0x2028
,使其适合在一个单一的指令。
What's happening here is that your assembler is compiling these la
s as addi $<dest>, $0, <value>
. The two-instruction sequence is only required for values which can't be represented in a 16-bit immediate; the values you're using here look like 0x2000
and 0x2028
, so they fit in a single instruction.
我怎样才能使它间preT 拉
为雷
和 ORI
?
负载更大的常量。 :)
您的汇编程序还可能有一个选项,以强制使用全序列的,即使它是不必要的。
Load bigger constants. :)
Your assembler might also have an option to force the use of the full sequence even when it's unnecessary.
这篇关于MIPS&QUOT;拉&QUOT;伪instruciton的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!