assemblymipsmips32

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


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


Solution

  • 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.