且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Lui指令的立即数范围

更新时间:2023-02-26 17:52:00

在MIPS中,I型指令的立即数始终为16位长.这意味着如果汇编器将其视为未签名,则范围将为[0,65535],对于已签名的情况将范围为[-32768,32767]

In MIPS the immediate in I-type instructions is always 16-bit long. That means the range will be [0, 65535] if the assembler treats it as unsigned, and [-32768, 32767] for the signed case

但是您可以在汇编中使用什么取决于汇编器

However what you can use in the assembly depends on the assembler

例如,某些汇编程序,例如 shell-storm WeMips 接受[-32768,65535]中的常量,这是两个16-位签名和未签名, MIPS转换器仅接受十六进制值,但 WebMIPSASM 甚至接受9223372036854775807之类的巨大值并将结果截断为16位

For example some assemblers like shell-storm and WeMips accept constants in [-32768, 65535] which is a mix of both 16-bit signed and unsigned, MIPS Converter only accepts hexadecimal values but WebMIPSASM accepts even huge values like 9223372036854775807 and truncate the result to 16 bits