跳转指令的MIPS范围
我正在阅读 Patterson 和 Hennessy 的书“计算机组织与设计”对 MIPS 感兴趣。
我对找到跳转/分支指令的范围有疑问。还可以确定到达特定地址所需的分支/跳转指令的数量。
有人可以解释如何计算这个值,即考虑特定地址的 PC 并找到转到不同地址所需的分支/跳转指令的数量?例如,如果PC位于0x10001010,那么分支和跳转指令的地址范围是多少?
或者您可以指导我一些在线资源或书籍来帮助我更好地理解这些内容吗?
I am reading the book 'Computer Organization and Design' by Patterson and Hennessy and got interested in MIPS.
I have doubts in finding the range of a jump/branch instruction. Also in determining the number of branch/jump instructions required to get to a specific address.
Can someone provide an explanation of how this has to be calculated i.e. Considering PC at a specific address and finding the number of branch/jump instructions needed to go to a different address? For example, what if PC is at 0x10001010, what is the range of addresses of branch and jump instructions?
Or can you direct me to some online resource or book which would help me in getting a better understanding of these?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以下全部针对MIPS-32。
分支
B、BEQ、BNE等
指令具有16位有符号字偏移字段,允许分支到距当前位置+/- 128kBytes的地址。跳转J
指令指定由PC的最高有效4位指定的当前256MByte区域内的地址:26<<2位(这不是相对地址)。要分支到 4GB 地址空间中的任意地址,请使用 JR(跳转寄存器),它跳转到通用寄存器中包含的地址。它需要单个分支或跳转指令,或者寄存器加载后跟
JR
跳转到任意地址,具体取决于地址有多远。MIPS 编程的最佳书籍仍然是查看 MIPS Run。您还可以在 mips.com 找到 MIPS 架构参考手册(需要注册)。最相关的文档是MIPS32® Architecture for Programmers Volume II:MIPS32® 指令集。
The following is all for MIPS-32.
Branch
B, BEQ, BNE, etc.
instructions have a 16 bit signed word offset field, allowing a branch to an address +/- 128kBytes from the current location. A jumpJ
instruction specifies an address within the current 256MByte region specified by PC's most significant 4 bits : 26<<2 bits(this is not a relative address). To branch to an arbitrary address anywhere in the 4GB address space, useJR
(jump register) which jumps to an address contained in a general purpose register.It takes either a single branch or jump instruction, or a register load followed by a
JR
to jump to an arbitrary address, depending how far away the address is.The best book for MIPS programming is still See MIPS Run. You can also find MIPS architecture reference manuals at mips.com (registration required). The most relevant document is MIPS32® Architecture for Programmers Volume II: The MIPS32® Instruction Set.