VOOZH about

URL: https://www.geeksforgeeks.org/computer-organization-architecture/difference-between-pc-relative-and-base-register-addressing-modes/

⇱ Difference between PC relative and Base register Addressing Modes - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Difference between PC relative and Base register Addressing Modes

Last Updated : 12 Jul, 2025

In computer architecture addressing modes are very important since they show how the processor accesses data in memory. The two are the addressing modes include the PC-relative addressing mode and Base register addressing mode. These modes define the place of the operand and how the address of memory is computed during the course of program execution. It is crucial for programmers to know the differences between these two modes, particularly when using low-level programming languages and working with systems’ architecture.

What is PC Relative Addressing Mode?

PC relative addressing mode is used to implement the intra-segment transfer of control, In this mode effective address is obtained by adding displacement to the PC.

EA = PC + Address field value PC = PC + Relative value

👁 Image

Advantages of PC Relative Addressing Mode

  • Efficient for Short Jumps: PC-relative addressing is used in short jumps where the execution flow is to be redirected within a program and is thus very efficient for local branches or a loop.
  • Position Independence: Using PC-relative addressing leads to the fact that programs written there can be easily relocated without changes to the code because the address is relative to the program counter.
  • Smaller Instruction Size: Because the address is derived from the program counter plus offset, the instructions are smaller; this helps in saving on memory space.

Disadvantages of PC Relative Addressing Mode

  • Limited Range: The offset however is a fixed value and that’s the reason why, in comparison to segment/offset addressing, the range of available jumps and branches is limited in case of relative addressing.
  • Not Suitable for Large Program: To address larger programs or distant memory locations, the admin may not get to utilize PC-relative addressing due to the limitation of the offset.

What is Base Register Addressing Mode?

Base register addressing mode is used to implement inter segment transfer of control. In this mode effective address is obtained by adding base register value to address field value.

EA = Base register + Address field value PC = Base register + Relative value

👁 Image

Advantages of Base Register Addressing Mode

  • Flexibility: Although base register addressing is more flexible since a specific memory location can be accessed by modifying the value of the base register.
  • Memory Segmentation: Since different base registers are used to point to different segment of the memory it is usually used in memory segmentation.
  • Efficient for Large Programs: This mode is perfect for large programs especially when the memory space to be referenced is large in that far memory locations are easy to handle.

Disadvantages of Base Register Addressing Mode

  • More Complexity: Manipulating the base register termed as Modified Base Register requires more instruction to load and modify the register and therefore increases the level of difficulty of the program.
  • Slower Execution: It can be slower than the other modes because it required more instructions added to the base register in order to read from memory.

Difference between PC Relative And Base Register Addressing Modes

PC Relative Addressing ModeBase Register Addressing Mode
The content of the program counter is added to the addressing field of the instruction i to obtain the effective address. The base register content is added to the addressing field of the instruction to obtain the effective address.
The addressing field of the instruction is mostly a signed number which can be either positive or negative.A base register holds a base address and the addressing field of the instruction gives displacement according to the base address.
A program counter always keeps track of the instructions of the program stored in its memory.A particular register has to be selected from the register set, according to the instruction.
Uses more bits as it has to specify a memory address directly.Uses fewer bits as it has to select a register from a register set.
A program counter always contains the address of the immediately next instruction to be executed. After fetching the address mentioned in the instruction, the program counter value immediately increases.In Base Register addressing mode the displacement value can be the same as the value required to reference the desired address as it does not immediately go to the next instruction.
The Effective address of the operand is obtained by adding the program counter content to the addressing field of instruction.The Effective address of the operand is obtained by adding the base register content to the addressing field of instruction.
EA = PC + Address field value PC = PC + Relative valueEA = Base register + Address field value PC = Base register + Relative value
The assembler understands the value of PC while attempting to construct an instruction in PC-Relative mode. However, while attempting to build instruction in base relative mode, the assembler does not know the value of the base register.

Conclusion

PC-relative and Base register addressing modes are two addressing modes which are designed for different purposes and are applicable at different conditions. PC-relative addressing is most effective for position-depended code and short branch displacements while base register addressing is more general and is advantageous for large programs where segmentation of code is necessary. In deciding which addressing mode is suitable, the size of the program and the extent of region that the program would access as well as the level of efficiency desired is taken into consideration.

Comment

Explore