266 views

Why can’t we keep target32 address in the 32 bit registers of the RISC instruction? Why is it have to be t

J target26 instead of J target32

If we have to use a register to keep the target 32 address, we'll first need to store it in a register(1 extra instruction), plus even if have it in the register, it'll be slower than having it as an immediate operand(Although not much slower).

So in JUMP instruction target address is in instruction as an immediate operand.

Why 26?

In a 32 bit instruction you can not include a 32-bit jump destination. The opcode uses 6 bits, which leaves 26 bits for the instruction. The target address is constructed by taking the first 4 bits of the address of the instruction following the j instruction, then 2 zero bits are appended to the 26 bits from the jump instruction operand. (As the instructions are 32 bits, alignment is useful and allows the omitting of the last two 0's.)

https://stackoverflow.com/questions/7877407/jump-instruction-in-mips-assembly