1

I understand that in MIPs for PC-Addressing there is a maximum jump range. However, what if the address I wanted to jump to was beyond the range?

i.e. beq $s0, $s1, L1

where L1 is father away from the PC than can be supported by bne and beq. Is there any way I can construct an equivalent code sequence?

Meowmi
  • 322
  • 2
  • 11
  • Possible duplicate of [MIPS How to branch to a 32-bit address?](https://stackoverflow.com/questions/15937174/mips-how-to-branch-to-a-32-bit-address) – Raymond Chen Feb 28 '19 at 14:28
  • @RaymondChen this is not the question i’m asking. I’m not trying to “branch to a 32 bit address”. Right now my immediate is using PC Addressing, and I’m trying to ask if there is a way I can jump beyond the way of PC addressing using a different code sequence compared to the one I’m using, which is a direct jump beyond the range. – Meowmi Feb 28 '19 at 14:37
  • Sorry. If the instruction you want to use cannot reach your desired target, you'll have to switch to some type of jump instruction that can, hence my offered duplicate which contained suggestions. – Raymond Chen Feb 28 '19 at 15:22

1 Answers1

1

So if the 16 bits of the I-Type command isn't enough for L1 you can use the J-Type since it has 26 bits for your address (just build your if around it).MIPS I-Type vs J-Type

If this still isn't enough you should save your address to a register using:la $t0, L1 and then jump to that register using: jr $t0 If you safe it to a register first, you have your full 32 bit address.

Marc B.
  • 94
  • 2
  • 9