[英]MIPS Assembly sll instruction
I have a problem with the sll instruction. sll指令有问题。
sll $t1,$a0,1
with $a0 holds the value 11 would give $t1 the value 16 (I tested it in MARS). sll $t1,$a0,1
与$ a0保持值11会给$ t1带来值16(我在MARS中对其进行了测试)。
My suggestion for $t1 was 22, becaus a left shift of 11 aka 01011 would give me 10110, what is 22 in decimal. 我对$ t1的建议是22,因为左移11也就是01011会给我10110,即十进制的22。 Where did I made a mistake?
我在哪里弄错了?
Thanks! 谢谢!
sll $t1,$a0,1
with$a0
holds the value 11 would give$t1
the value 16 (I tested it in MARS).sll $t1,$a0,1
与$a0
保持值11会给$t1
带来值16(我在MARS中对其进行了测试)。
You're probably just mixing up decimal and hexadecimal. 您可能只是将十进制和十六进制混合在一起。 If you loaded
$a0
with the value 11 like this li $a0,11
and shifted it one bit to the left you'd indeed get 22 as the result. 如果您像这样的
li $a0,11
一样加载$a0
的值11,并将其向左移动一位,则结果的确为22。 The register viewer in Mars shows the values in hexadecimal, and 0x16 equals 22. 火星中的寄存器查看器以十六进制显示值,并且0x16等于22。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.