In MIPS, why can a jump instruction set the program counter to a 28-bit target address

99封情书 提交于 2021-01-27 21:28:35

问题


In MIPS, a 32-bit jump instruction consists of 6-bits for the opcode and 26-bits for the target (destination) address that we want to set the program counter to.

However, it is possible to set the program counter to a 28-bit target address. How is this possible if we can only fit 26-bits in the jump instruction?


回答1:


Instructions on MIPS are always 4-byte aligned, so the low 2 bits of any valid target address can only be zero. Thus, the 26 bits specified in jump instructions are always implicitly left shifted of 2 positions, hence setting the low 28 bits of the PC.



来源:https://stackoverflow.com/questions/42219553/in-mips-why-can-a-jump-instruction-set-the-program-counter-to-a-28-bit-target-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!