MIPS"拉"伪instruciton [英] MIPS "la" pseudo instruciton

查看:181
本文介绍了MIPS"拉"伪instruciton的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在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 $< D​​EST>中$ 0< VALUE> 。两个指令序列时,才需要的量不能重新在一个16位立即psented $ P $值;您正在使用这里的值看起来像为0x2000 0x2028 ,使其适合在一个单一的指令。

What's happening here is that your assembler is compiling these las 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

How can I make it interpret la as lui and 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆