Addressing Modes of Computer Architecture
Addressing Modes of Computer Architecture
Addressing Modes
Specify the way the operands are selected during program
execution.
Usage
To give programming flexibility to the user
pointers to memory, counters for loop control, indexing of data, .
8.
1. Implied Mode
2. Immediate Mode
3. Register Mode
Operands are in registers.
Register is selected from a register field in the inst.
k-bit register field can specify any one of 2k registers.
Advantage: No memory reference, shorter instructions, faster
instruction fetch, very fast execution
Disadvantage: Limited address space as limited number of
registers
Example:
LOAD R1
MOV R1,R2
Prof. S.Meenatchi, SITE, VIT
MOV R1,(R2)
5. Autoincrement or Autodecrement
Mode
MOV R1,2000
Prof. S.Meenatchi, SITE, VIT
MOV R1,(2000)
Prof. S.Meenatchi, SITE, VIT
Algorithm
Advantage
disadvantage
Immediate
Operand=A
Direct
EA=A
No memory
reference
Simple
Indirect
EA=(A)
Register
EA=R
Register indirect
EA=(R)
Displacement
EA=A+(R)
Large address
space
No memory
reference
Large address
space
Flexibility
Limited operand
magnitude
Limited address
space
Multiple memory
references
Limited address
space
Extra memory
refernce
Complexity
Stack
EA=top of stack
No memory
reference
Limited
applicability
Problems
Find the effective address and the content of AC for the given data.
Addressing Mode
Effective
Address
Direct Address
500
AC (500)
800
Immediate operand
201
AC 500
500
Indirect address
800
AC ((500))
300
Relative address
702
AC (PC + 500)
325
Indexed address
600
AC (XR + 500)
900
AC R1
400
Register
Content of AC
Register Indirect
400
AC (R1)
700
Autoincrement
400
AC (R1)+
700
Autodecrement
399
AC -(R1)
450
Numerical Example
Problems
A two-word instruction is stored in memory at an address
designated by the symbol W. The address field of the
instruction (stored at W + 1) is designated by the symbol Y.
The operand used during the execution of the instruction is
stored at an address symbolized by Z. An index register
contains the value X. State how Z is calculated from the other
addresses if the addressing mode of the instruction is
Direct
Indirect
Relative
Indexed
How many times does the control unit refer to memory when it
fetches and executes an indirect addressing mode instruction if
the instruction is (a) a computational type requiring an operand
from memory; (b) a branch type.
What must the address field of an indexed addressing mode
instruction be to make it the same as a register indirect mode
instruction?
An instruction is stored at location 300 with its address field at
location 301. The address field has the value 400. A processor
register R1 contains the number 200. Evaluate the effective
address if the addressing mode of the instruction is (a) direct;
(b) immediate (c) relative (d) register indirect; (e) index with
R1 as the index register.
Prof. S.Meenatchi, SITE, VIT
Value
Instruction
PC
100
Immediate
R0
200
Direct
R1
300
Indirect
100
200
Load r0,r1
Register
104
300
Register Indirect
108
400
Based
200
500
300
600
500
700
Addressing mode
Relative
Value in R0
Word 20 contains 40
Word 30 contains 50
Word 40 contains 60
Word 50 contains 70
Load immediate 20
Load direct 20
Load indirect 20
Load immediate 30
Load direct 30
Load indirect 30
Let the address stored in the program counter be designated by the symbol X1.
The instruction stored in X1 has the address part (operand reference) X2. The
operand needed to execute the instruction is stored in the memory word with
address X3. An index register contains the value X4. What is the relationship
between these various quantities if the addressing mode of the instruction is (a)
direct (b) indirect (c) PC relative (d) indexed?
Prof. S.Meenatchi, SITE, VIT
Immediate addressing?
Direct addressing?
Indirect addressing?
Register addressing?
Register indirect addressing?