Adding Jump and Branch to Datapath (Cont.)

Jump
The jump (J-type) instruction looks somewhat like a branch instruction but computes the target PC differently and is not conditional. Its opcode is always 2 (or 0000102). The J-type instruction format and one example jump instruction are given as follows:

 j  addr
 # skip to label “addr”

Like a branch, the low-order 2 bits of a jump address are always 002. The next lower 26 bits of this 32-bit address come from the 26-bit immediate field in the instruction. The upper 4 bits of the address that should replace the PC come from the PC of the jump instruction plus 4. Thus we can implement a jump according to the Next PC block by storing into the PC the concatenation of

  • the upper 4 bits of the current PC+4 (these are bits 31:28 of the sequentially following instruction address),

  • the 26-bit immediate field of the jump instruction, and

  • the bits 002.