Presentation is loading. Please wait.

Presentation is loading. Please wait.

Part II: Addressing Modes

Similar presentations

Presentation on theme: "Part II: Addressing Modes"— Presentation transcript:

1 Part II: Addressing Modes
Chapter 10 Part II: Addressing Modes

2 LMC Addressing Mode uses direct, absolute addressing
direct address: the address of the data being referenced can be reached directly from the address contained in the instruction word absolute address: the address given in the instruction is the actual memory location where the data is stored too limited for real computer systems to use only this method

3 Why alternative modes? Allow a much larger range of addressable memory locations while using reasonable number of bits in the instruction word Facilitate implementation of certain frequently occurring program statements - such as loops Facilitate use of registers and moving data between registers

4 Register Addressing Both operands are registers
Significantly speeds up the execution Reduces memory accesses RISC machines provide instruction sets that consist almost entirely of registers

5 Base Register Addressing
use a register to hold the initial address include the offset and the R# in the instruction address from register and offset are added to get final address

6 Base Register Example

7 IBM S/390 Load Instruction
Data value is loaded into destination register. Data address is found via indexed base addressing.

8 Advantages Provides larger address space - usually up to several GBs
Supports relocatability of program from one memory block to another Some systems have special base register - others permit use of general purpose registers

9 Relative Addressing - generate an address relative to the location of the current instruction-
similar to base addressing but uses Program Counter instead of base register. Useful for branching to n locations before or after an instruction => complement arithmetic Relative Addressing The desired address consists of the value in the address field added to the value in the program counter Instruction Program Counter (PC) OPCODE OPERANDS 1326 42 1326 + 42 1368 Actual (absolute) address in memory

10 Immediate Addressing Data operand is stored within the instruction itself Useful for constants No memory access is required

11 LMC Immediate Addressing

12 INDIRECT ADDRESSING separates the location of the data from the instruction itself OPCODE OPERANDS 47 48 49 50 51 52 53 52 74 72 73 74 75 DATA

13 Indirect Addressing Indirect addressing is useful if one needs to reference a location outside the range of absolute address values More commonly, register indirect addressing is provided

14 Register Indirect Addressing

15 Advantages Very efficient access to memory Utilized in most processors
Usually auto-incrementing or decrementing of register is supported

16 Indexed Addressing Similar to base register addressing
Index register is used as a offset for handling subscripting of arrays

17 Indexed Addressing

18 Indexed Addressing w/Base Register

Download ppt "Part II: Addressing Modes"

Similar presentations

Ads by Google