本文介绍了MIPS大会 - 吕$ T0,4097?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人能解释我如何做的作品,什么是 4097 代表,这是什么加入 8 $ T0 意思?

 。数据0x10010000
空白:.asciiz#4097
换行:.asciiz\\ n#4097 + 2#input_start
Alength:.word 13
Aarray:.word 130,202,30,4440,530,532,33,204,8,524,8933,92,10
#input_end           。文本
吕$ T0,4097
ORI $ A0,$ T0,A的8#地址[]
LW $ A1,4($ T0)#负载长度


解决方案

4097 = 1001(十六进制)

因此​​,第一指令使0x10010000到寄存器T0。吕是负载上立竿见影,用上,意思是高16位,而立竿见影的意思是你给它一个文本值(4097)。 4097作为一个上值变成0x10010000。

ORI是或立即,有8个是眼前的价值,所以在A0产生的地址为0x10010008,这就是生活Aarray的地址。

最后指令LW是负载字,这从在T0存储器地址(其在这一点上仍只是0x10010000)加上4字节加载(4就是ALength住在一个地址从t0和结果的偏移) 4个字节的数据变为a1。

Can someone explain me how does lui works, what does "4097" stand for, what does adding 8 to $t0 mean?

               .data        0x10010000
blank:                .asciiz        " "                                # 4097
newline:        .asciiz        "\n"                                # 4097 + 2

#input_start
Alength:        .word        13
Aarray:         .word        130, 202, 30, 4440, 530, 532, 33, 204, 8, 524, 8933, 92, 10
#input_end

           .text


lui        $t0, 4097
ori        $a0, $t0, 8                        # address of A[]
lw        $a1, 4($t0)                        # load length
解决方案

4097 = 1001 hex

so, the first instruction puts 0x10010000 into register t0. lui is "load upper immediate", with "upper" meaning the upper 16 bits, and "immediate" meaning that you are giving it a literal value (4097). 4097 as an "upper" value becomes 0x10010000.

ori is "or immediate", with 8 being the immediate value, so the resulting address in a0 is 0x10010008, which is the address where Aarray lives.

The final instruction lw is "load word" which loads from the memory address in t0 (which at this point is still just 0x10010000) plus 4 bytes (the 4 is an offset from t0 and results in an address where ALength lives) 4 bytes of data into a1.

这篇关于MIPS大会 - 吕$ T0,4097?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 21:09