user977154
user977154

Reputation: 1095

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.

Upvotes: 5

Views: 10050

Answers (1)

Carl Norum
Carl Norum

Reputation: 224844

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.

Upvotes: 7

Related Questions