Download presentation
Presentation is loading. Please wait.
Published byRosaline Farmer Modified over 9 years ago
1
Processor Organization and Architecture Module III
2
Addressing Modes How to specify operands The different modes are: – Immediate – Direct – Indirect – Register – Register Indirect – Displacement (Indexed) – Stack
3
Immediate Addressing Operand is part of instruction e.g. ADD 5 – Add 5 to contents of accumulator – 5 is operand Adv: – No memory reference to fetch data – Fast Disadv: – Limited range
4
Immediate Addressing OperandOpcode Instruction
5
Direct Addressing Address field contains effective address of operand e.g. ADD A – Look in memory at address A for operand Adv: – Single memory reference to access data – No additional calculations to work out effective address Disadv: Limited address space
6
Direct Addressing Address AOpcode Instruction Memory Operand
7
Indirect Addressing Memory cell pointed to by address field contains the address of (pointer to) the operand EA = (A) – Look in A, find address (A) and look there for operand e.g. ADD (A) – Add contents of cell pointed to by contents of A to accumulator
8
Indirect Addressing Adv: – Large address space – 2 n where n = word length – May be nested, multilevel, cascaded e.g. EA = (((A))) Disadv: Multiple memory accesses to find operand and hence slower
9
Indirect Addressing Address AOpcode Instruction Memory Operand Pointer to operand
10
Register Addressing Address field refers to a register EA = R Adv: – Only a small address field is needed in the instruction – Less access time Disadv: – Limited number of registers – Limited address space
11
Register Addressing Register Address ROpcode Instruction Registers Operand
12
Register Indirect Addressing Similar to indirect addressing EA = (R) Operand is in memory cell pointed to by contents of register R One fewer memory access than indirect addressing
13
Register Indirect Addressing Register Address ROpcode Instruction Memory Operand Pointer to Operand Registers
14
Displacement Addressing Combines direct and register indirect addressing EA = A + (R) Address field hold two values – A = base value – R = register that holds displacement – or vice versa
15
Displacement Addressing Register ROpcode Instruction Memory Operand Pointer to Operand Registers Address A +
16
Uses of Displacement Addressing Relative Addressing Base-Register Addressing Indexed Addressing
17
Relative Addressing R = Program counter, PC EA = A + (PC) i.e. get operand from A cells from current location pointed to by PC Exploits locality of reference If memory references are near to the instruction being executed, this saves address bits in the instruction
18
Base-Register Addressing The referenced register (R) may contain – A main memory address – Displacement from that address R may be explicit or implicit Exploits locality of reference
19
Indexed Addressing just opposite of base register addressing Address field contains main memory address A = base Register contains displacement R = displacement EA = A + R Good for accessing arrays
20
Stack Addressing Stack is a reserved block of locations Stack pointer holds the address of the top of the stack. It is a form of implied addressing: as no memory reference is required but operate on the top of the stack
21
Instruction Formats Defines the layout of bits in an instruction Includes opcode & (implicit or explicit) operand(s) Usually more than one instruction format in an instruction set
22
Common Instruction Formats Four of them are a)Zero-address instruction b)One-address instruction c)Two-address instruction d)Three-address instruction
23
Zero-address instruction 0 (zero) addresses – All addresses implicit – Example: stack push a push b pop c
24
One-address instruction 1 address – Implicit second address : Usually a register (accumulator) – E.g. Add C // C=C+A(accumulator)
25
Two-address instruction 2 addresses – One address doubles as operand and result – a = a + b – Reduces length of instruction – Requires temporary storage to hold some results
26
Three-address instruction 3 addresses – Operand 1, Operand 2, Result – a = b + c; – May be a forth - usually implicit – Not common – Needs very long words to hold everything
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.