📌  相关文章
📜  PC 相关寻址模式和基址寄存器寻址模式之间的区别

📅  最后修改于: 2021-09-13 03:07:20             🧑  作者: Mango

先决条件 – 寻址模式

1、PC相对寻址方式:
PC相对寻址方式用于实现控制的段内传输,该方式通过向PC添加位移来获得有效地址。

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

2.基址寄存器寻址方式:
基址寄存器寻址方式用于实现控制的段间转移。在这种模式下,有效地址是通过将基址寄存器值与地址字段值相加来获得的。

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

PC 相对寻址和基址寄存器寻址模式的区别:

PC Relative Addressing Mode Base Register Addressing Mode
The content of 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 less 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. Effective address of the operand is obtained by adding the program counter content to the addressing field of instruction. 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 value
EA = Base register + Address field value
PC = Base register + Relative value