Docsity

Addressing Modes 2-Programming and Computer Architechture-Lecture Slides, Slides of Computer Architecture and Organization

Partial preview of the text

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

Addressing Modes

 Addressing modes defined in a giveninstruction set architecture (ISA) define howmachine language instructions in thatarchitecture identify the operand (oroperands) of each instruction.  An addressing mode specifies how tocalculate the effective memory address of anoperand by using information held inregisters and/or constants contained within amachine instruction or elsewhere.

Addressing Mode

 The different ways in which operands can beaddressed are called the addressing modes  Different addressing modes are there ■ Immediate Mode ■ Direct (Absolute) Mode ■ Indirect Mode ■ Indexed Mode ■ Relative Mode ■ Auto increment Mode ■ Auto decrement Mode

Immediate Addressing Diagram

Operand Opcode Instruction

Immediate Mode…

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

Direct Addressing

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

Direct Addressing Diagram

Address A Opcode Instruction Memory Operand

Indirect Addressing (1)

 Memory cell pointed to by address fieldcontains the address of (pointer to) theoperand 

EA = (A)

■ Look in A, find address (A) and look there foroperand  e.g. ADD (A) ■ Add contents of cell pointed to by contents of Ato accumulator

Indirect Addressing (2)

 Large address space 

n where n = word length  May be nested, multilevel, cascaded ■ e.g. EA = (((A)))

  • Draw the diagram yourself  Multiple memory accesses to find operand  Hence slower

Indirect Mode

 we can identify two types of indirectaddressing modes: ■ register indirect addressing : if a register is used to hold the address of the operand. ■ memory indirect addressing : if a memory location is used to hold the address of theoperand.

Register Addressing (1)

 Operand is held in register named in addressfiled 

EA = R

 Limited number of registers  Very small address field needed ■ Shorter instructions ■ Faster instruction fetch

Register Addressing Diagram

Register Address R Opcode Instruction Registers Operand

Register Indirect Addressing

 C.f. indirect addressing 

EA = (R)

 Operand is in memory cell pointed to bycontents of register R  Large address space ( n

 One fewer memory access than indirectaddressing

©Javaid Khurshid

Indirect Mode

Displacement Addressing



EA = A + (R)

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