Professional Documents
Culture Documents
and Architecture
EA = f(IR(address), R),
R is sometimes implied
EA = A + (R)
Features:
• Address field of the instruction is short
• Large physical memory can be accessed with a small number of address bits
Cont. . . 3 different Displacement Addressing Modes
PC Relative Addressing Mode (R = PC)
The content of the program counter is added to the address part of
the instruction in order to obtain the effective address.
EA = PC + IR(address)
Example: LDA $ add AC M[PC+add]
Indexed Addressing Mode (R = IX, where IX: Index Register)
The content of an index register XR is added to the address part of
the instruction to obtain the effective address.
EA = IX + IR(address)
Example: LDA add(x) AC M[XR+add]
Base Register Addressing Mode (R = BAR, where BAR: Base Address Register)
The content of an base register is added to the address part of the
instruction to obtain the effective address.
EA = BAR + IR(address)
Example: LDA add(x) AC M[XR+add]
Example of Addressing Mode
Numerical Example
The two-word instruction address 200 and 201 is a "load to AC'
instruction with an address field equal to 500.
The first word of the instruction specifies the operation code
and mode, and the second word specifies the address part.
PC has the value 200 for fetching this instruction.
The content of processor register R1 is 400, and the content of
an index register XR is 100
AC receives the operand after the instruction is executed.
The figure lists a few pertinent addresses and shows the
memory content at each of these addresses.
Example of Addressing Mode
Addressing Mode Effective Address Content of AC
Direct address 500 /* AC (500) */ 800
Immediate operand - /* AC 500 */ 500
Indirect address 800 /* AC ((500)) */ 300
Relative address 702 /* AC (PC+500) */ 325
Indexed address 600 /* AC (RX+500) */ 900
Register - /* AC R1 */ 400
Register indirect 400 /* AC (R1) */ 700
Auto-increment 400 /* AC (R1)+ */ 700
Auto-decrement 399 /* AC -(R) */ 450
How it works?
In the direct address mode the effective address is the address part of the instruction 500 and the operand to be
loaded into AC is 800.
In the immediate mode the second word of the instruction is taken as the operand rather than an address, so 500
is loaded into AC. (The effective address in this case is 201.).
In the indirect mode the effective address is stored in memory at address 500. Therefore, the effective address is
800 and the operand is 300.
In the relative mode the effective address is 500 + 202 = 702 and the operand is 325.
(Note that the value in PC after the fetch phase and during the execute phase is 202.)
In the index mode the effective address is R + 500 = 100 + 500 = 600 and the operand is 900.
In the register mode the operand is in R1 and 400 is loaded into AC. (There is no effective address in this case).
The auto-increment mode is the same as the register indirect mode except that R1 is incremented to 401 after
the execution of the instruction.
The auto-decrement mode decrements R1 to 399 prior to the execution of the instruction. The operand loaded
into AC is now 450
Exercise: Addressing Mode
For the instruction shown below, what value is loaded into the
accumulator for each addressing mode??
Data Transfer and Addressing Mode
Typical Data Transfer Instructions
Name Mnemonic
Load LD
Store ST
Move MOV
Exchange XCH
Input IN
Output OUT
Push PUSH
Pop POP Data Transfer Instructions with Different
Addressing Modes
Assembly
Mode Convention Register Transfer
Direct address LD ADR AC M[ADR]
Indirect address LD @ADR AC M[M[ADR]]
Relative address LD $ADR AC M[PC + ADR]
Immediate operand LD #NBR AC NBR
Index addressing LD ADR(X) AC M[ADR + XR]
Register LD R1 AC R1
Register indirect LD (R1) AC M[R1]
Auto-increment LD (R1)+ AC M[R1], R1 R1 + 1
Auto-decrement LD -(R1) R1 R1 - 1, AC M[R1]
Reading Resources/Materials
Chapter 8: Central Processing Unit
M. Marios Mano: Computer System Architecture (3rd edition),
Pearson, 1992
17
?
THANKS!!
18