PowerPC Branch Instruction - muneeb-mbytes/computerArchitectureCourse GitHub Wiki

PowerPC drawio

Following are few formats used for branch instruction

Long Immediate Format:

  • This format includes a 6-bit opcode, two special bits (A and L), and a 24-bit constant.
  • The 24-bit constant allows for a large range of values to be used in instructions like unconditional jumps.
  • The β€˜A’ bit indicates whether the displacement is absolute or PC relative. If β€˜A’ is set, the constant is added directly to the program counter (PC) to get address. Otherwise, the constant itself represents the address.
  • The β€˜L’ bit indicates whether a subroutine link is established. Control can be transferred to a subroutine using any branch instruction, whether it's unconditional or conditional, by setting this bit to one.

Displacement Format:

  • In this format, there’s a smaller constant (14 bits) along with the opcode, registers, and A and L bits.

  • Similar to the long immediate format, the β€˜A’ bit determines whether the displacement is absolute or PC relative. The β€˜L’ bit indicates whether a subroutine link is established.

Indirect through Link/Count Format:

  • This format involves control transfer based on the contents of the link register and count register.
  • In op ext control transfer is made based on the contents of link register and count register. Count register can also be made as an address.