mips指令中 srl指令中的解释 rd<-lt<<shamt 是什么意思?

如题所述

第1个回答  2012-10-11
你看到的文档中解释srl的不是真正的指令集,真的指令集是三百页左右的一个pdf文档(百度文库中可以找到)。rd <- rt >> shamt ;的前后还有“srl $1,$2,10”和“(logical) ,其中rt=$2, rd=$1”的描述。

其中:srl 的意思是shift right logic。

srl $1,$2,10 描述的意思是无符号扩展的情况下,将$2向右移动 10 bit,最后将结果存放到 $1 中。

关于 srl 在指令集中描述如下:

Format: SRL rd, rt, sa MIPS32

Purpose: Shift Word Right Logical
To execute a logical right-shift of a word by a fixed number of bits

Description: GPR[rd] ← GPR[rt] >> sa (logical)
The contents of the low-order 32-bit word of GPR rt are shifted right, inserting zeros into the emptied bits; the word
result is placed in GPR rd. The bit-shift amount is specified by sa

Operation:
s ← sa
temp ← 0s || GPR[rt]31..s
GPR[rd] ← temp追问

向右移动10bit后,是用0补足那10位么?

追答

是的。

本回答被提问者采纳