In an ISA of type MIPS,there are two types of addressing for the functions Branch and Jump.These are PC-relative and pseudodirect.I want to know why do we use two different ways of addressing for two types of instructions? is this neccessary?Also,What is the maximal size of the jump of a branch instruction? what about the jump?
1 Answers
Branches require more bits to describe the operands and branch comparison type. Jump instructions need less information, and so they can devote more bits to the immediate. Thus, jumps can jump further away than branches.
I don't understand the difference between PC-relative and "psuedodirect" - they're BOTH PC-relative. The only real difference is how many bits the immediate is.
PC-relative is needed so the compiler can move the code around, and not care about where the branch and target end up exactly. Also, it requires fewer bits to describe "branch ahead 10 instructions" versus describing the absolute location of the target. Again, jumps have more immediate bits available, so they can jump further away. The exact distance a branch or jump can go depends on the specific ISA. Typically, a RISC ISA with 32b-sized instructions can jump 2^i words away (or 4*(2^i) bytes), where i is the size of the immediate.

- 3,827
- 22
- 30