Professional Documents
Culture Documents
Addressing Modes
and Formats
Addressing : Introduction
i. Immediate
ii. Direct
iii. Indirect
iv. Register
v. Register Indirect
vi. Displacement
vii. Stack
Note:
Almost all computer architectures provide
more than one of these addressing modes .
Several approaches are taken in order for the
control unit to determine the addressing
mode to be used :
Often different opcodes will use different
addressing modes .
One or more bits in the instruction format can be
used as addressing mode specifier .
For the description the following naming
convention is used:
Instructio
n
OPERAND
OPERAND = A
This mode can be used to define and store
constants or to set initial values of variables .
Typically the number will be stored as a 2s complement
form with leftmost bit being sign bit .When operand is
loaded into data register , sign bit is extended to full
data word length .
Immediate Addressing : (Contd)
Advantages:
No memory reference is required . Hence saving
cache or instruction reference in the instruction
cycle .
Disadvantages:
Size of the number is limited to size of address
field ,which in the case of most instruction sets is
small compared to word length .
Direct Addressing :
OPERAND
EA = A
Direct Addressing : (Contd)
Advantages:
Only one memory reference is required .
No special calculation is needed .
Disadvantages:
Provides only limited address space .
EA = ( A )
OPERAND
Indirect Addressing : (Contd)
Advantages:
For a word length N ,address space of 2N is now availiable .
Disadvantages:
Instruction execution requires two memory references to
fetch the operand , one to get the address of the operand
and the next to get the value of the operand .
Note:A rarely used variant of indirect addressing is
multilevel or cascaded indirect addressing .
EA = (.( A ).)
This uses an indirect flag to indicate whether the word
contains the EA whether it contains another level of
indirection .This method has no apparent advantage and
has the disadvantage of requiring three or more memory
references to fetch the operand .
Register Addressing :
OPERAND
EA = R
Typically an address field that references
registers will have 3 4 bits so a total of
8 16 general purpose registers can be
referenced .
Register Addressing : (Contd)
Advantages:
For a word length N ,address space of 2N is now
availiable .
Disadvantages:
Instruction execution requires two memory
references to fetch the operand , one to get the
address of the operand and the next to get the
value of the operand .
Register Indirect Addressing :
Memory
OPERAND EA = ( R )
Register Indirect Addressing : (Contd)
Advantages:
Address space limitation of address field is
overcome by having that field refer to a word
length location containing an address .
Register indirect addressing uses one less memory
reference than indirect addressing .
Disadvantages:
Same as indirect addressing .
Displacement Addressing :
Memory
Register
OPERAND
EA = A + ( R )
Displacement Addressing : (Contd)
EA= A + R
R=( R ) + 1
Stack Addressing :
1. Instruction Length
Affects and is affected by memory size memory organisation,
bus structure ,CPU complexity and CPU speed.
Larger instruction length provides programmers with more
opcodes and larger address fields. Resulting in easier coding
and shorter programs .However it also may result in wasteful .
2. Bit allocation
There is a trade-off between number of opcodes and
power of addressing .
Variable length opcodes can be used .This means
opcodes have a minimum bit length ,but for opcodes
which require fewer operands or less powerful
addressing larger amount of bits are allocated to
opcode field .
Instruction formats: (Contd)