Docsity

Addressing Modes-Microprocessor and Computer Architecture-Lecture Slides, Slides of Computer Architecture and Organization

Partial preview of the text

Download Addressing Modes-Microprocessor and Computer Architecture-Lecture Slides and more Slides Computer Architecture and Organization in PDF only on Docsity!

Addressing Modes z

Immediate z Direct z Indirect z Register z Register Indirect z Displacement (Indexed) z Stack

Immediate Addressing z

Operand is part of instruction z Operand = address field z e.g. ADD 5 z Add 5 to contents of accumulator z 5 is operand z No memory reference to fetch data z Fast z Limited range

Direct Addressing z

Address field contains address of operand z Effective address (EA) = address field (A) z e.g. ADD A z Add contents of cell A to accumulator z Look in memory at address A for operand z Single memory reference to access data z No additional calculations to work outeffective address z Limited address space

Direct Addressing Diagram

Address A Opcode Instruction Memory Operand

Indirect Addressing (Cont) z

Large address space z

n where n = word length z May be nested, multilevel, cascaded z e.g. EA = (((A))) z Multiple memory accesses to find operand z Hence slower

Indirect Addressing Diagram

Address A Opcode Instruction Memory Operand Pointer to operand

Register Addressing (Cont) z

No memory access z Very fast execution z Very limited address space z Multiple registers helps performance z Requires good assembly programming orcompiler writing z Direct addressing

Register Addressing Diagram

Register Address R Opcode Instruction Registers Operand

Register Indirect AddressingDiagram

Register Address R Opcode Instruction Memory Operand Pointer to Operand Registers

Displacement Addressing z

EA = A + (R)

z Address field hold two values z A = base value z R = register that holds displacement z or vice versa

Relative Addressing z

A version of displacement addressing z R = Program counter, PC z

EA = A + (PC)

z i.e. get operand from A cells from currentlocation pointed to by PC

Base-Register Addressing z

A holds displacement z R holds pointer to base address

Combinations z

Postindex z

EA = (A) + (R)

z Preindex z

EA = (A+(R))

Stack Addressing z

Operand is (implicitly) on top of stack z e.g. z ADD Pop top two items from stackand add