CISH-4030
Structured Computer Architecture
Lecture 11 ( 11/17/03 )
Instruction Sets
Addressing Modes
• Roger Brown
• rhb@rh.edu
• www.rh.edu/~rhb
• 860-548-2462
Addressing Modes
n Immediate
n Direct
n Indirect
n Register
n Register Indirect
n Displacement (Indexed)
n Stack
Immediate Addressing
n 5 is operand
Instruction
Opcode Operand
Direct Addressing
Instruction
Opcode Address A
Memory
Operand
Pointer to operand
Operand
10
n No memory access
n Very fast execution
n Very limited address space
n Multiple registers helps performance
n Requires good assembly programming or compiler
writing
n N.B. C programming
• register int a;
n c.f. Direct addressing
11
Instruction
Opcode Register Address R
Registers
Operand
12
13
Instruction
Opcode Register Address R
Memory
Registers
14
Displacement Addressing
n EA = A + (R)
n Address field hold two values
n A = base value
n or vice versa
15
Instruction
Opcode Register R Address A
Memory
Registers
16
Relative Addressing
17
Base-Register Addressing
n A holds displacement
n R holds pointer to base address
n R may be explicit or implicit
n e.g. segment registers in 80x86
18
Indexed Addressing
n A = base
n R = displacement
n EA = A + R
n Good for accessing arrays
n EA = A + R
n R++
19
Combinations
n Postindex
n EA = (A) + (R)
n Preindex
n EA = (A+(R))
20
Stack Addressing
21
22
n Load/store architecture
n Indirect
• Instruction includes 16 bit displacement to be added to base
register (may be GP register)
• Can replace base register content with new address
n Indirect indexed
• Instruction references base register and index register (both may
be GP)
• EA is sum of contents
n Branch address
n Absolute
n Relative
n Indirect
n Arithmetic
n Operands in registers or part of instruction
n Floating point is register only
24
25
Instruction Formats
26
Instruction Length
n Memory organization
n Bus structure
n CPU complexity
n CPU speed
27
Allocation of Bits
28
29
30
PDP-11 Instruction
Format
VAX
Instruction
Examples
33
PowerPC
Instruction
Formats (2)
Foreground Reading
n Stallings chapter 11
n Intel and PowerPC Web sites
36