How far can the j(jump) instruction jump in memory? (MIPS)

user977154 picture user977154 · Mar 7, 2012 · Viewed 7.8k times · Source

Consider the j(jump) instruction in MIPS. How far can it jump in memory? Would it be 32bits? Can i please have an explanation.

Answer

Carl Norum picture Carl Norum · Mar 7, 2012

From this page, you'll see that the jump instruction has the following effects:

PC = nPC; nPC = (PC & 0xf0000000) | (target << 2);

target is a 26 bit number. That means the j instruction can jump to any absolute address that can be created from the operation above. The largest value for target, therefore, is 226-1 (0x03FFFFFF), and the highest reachable address is (PC & 0xF0000000) | 0x0FFFFFFC.