SUPPLEMENTARY CHAPTER 2 Instruction Addressing Modes

38 slides
1.26 MB
795 views

Similar Presentations

Presentation Transcript

1

SUPPLEMENTARY CHAPTER 2 Instruction Addressing ModesThe Architecture of Computer Hardware and Systems Software: An Information Technology Approach 3rd Edition, Irv Englander John Wiley and Sons 2003 Linda Senne, Bentley College Wilson Wong, Bentley College

2

Little Man ComputerDirect, absolute addressing Direct: data is reached directly from the address in the instruction Absolute: address in the instruction field is the actual memory location being addressed

3

Additional Addressing ModesProgrammer-accessible registers Provide faster execution with register-based instructions Alternatives to absolute addressing Allow larger range of addressable memory While using a reasonable number of bits for the address field Alternatives to direct addressing Facilitate writing certain types of programs Example: loops that use index to address different entries in a table or array

4

Register AddressingDoes not require a memory access Faster execution Implemented directly as part of the CPU RISC machine instruction set: made up almost entirely of register operation instructions

5

Register Addressing*Done in parallel with move; only 3 time units required

6

Additional Addressing ModesProgrammer-accessible registers Provide faster execution with register-based instructions Alternative to absolute addressing Allow larger range of addressable memory While using a reasonable number of bits for the address field Alternative to direct addressing Facilitate writing certain types of programs Example: loops that use index to address different entries in a table or array

7

Active Area of Memory Code executes in a small area of memory that changes as program proceeds Well-written code Small modular subroutines and procedures Local variables Conditional branches Fig S2.2

8

2 Alternatives to Absolute AddressingBase register addressing Relative addressing Both provide starting address and an offset or displacement from the starting point Starting address in register or program counter Offset: address in the instruction Programming advantage: relocatability

9

Base Register AddressingBase register set to initial address Hardware design: special, separate register or general-purpose registers Generally large to provide large memory space, frequently gigabytes Final address: contents of instruction address field added to the base address

10

IBM zSystemBase register address creation

11

IBM zSystem16 64-bit general-purpose registers Load instruction format

12

IBM zSystem Example: LoadBase-value register: general-purpose register 3 1 C 2 5 E 016 Displacement for the instruction 3 7 A16 Absolute address

13

IBM zSystem Example: LoadInstruction Word

14

Fetch-Execute Cycle for Relative Address

15

Relative AddressingValue in address field added to value in program counter Program counter used as the base register Similar to base addressing Constraint: address field must be able to store and manipulate positive and negative numbers Complementary representation

16

Relative Addressing Example

17

Direct AddressingSeparates data into location different from location of instructions Benefits to programmer Data can be changed without affecting the instruction itself Data is available to different instructions

18

Additional Addressing ModesProgrammer-accessible registers Provide faster execution with register-based instructions Alternative to absolute addressing Allow larger range of addressable memory While using a reasonable number of bits for the address field Alternative to direct addressing Facilitate writing certain types of programs Example: loops that use index to address different entries in a table or array

19

Alternatives to Direct AddressingImmediate addressing Indirect addressing Register Indirect addressing Indexed addressing

20

Immediate AddressingStore data with the instruction itself Example: Data is a constant Constraint: Address field must be able to store and manipulate positive and negative numbers Complementary representation Advantage: Additional memory access not required Faster execution

21

Immediate AddressingModified LMC Example Constant limited to the size of address field

22

Immediate AddressingModified LMC Example

23

Indirect AddressingAddress field of the instruction contains the address of the data Similar to pointers in Pascal or C Frequently used with subscripted data in a table

24

Little Man Indirect Addressinga. The Little Man reads in instructionb. ,,, he finds the address of the data

25

Little Man Indirect Addressingc. … from that address he retrieves the datad. … with a different address in location 45, he retrieves different data (note: In this step the address of the data has been incremented).

26

Incrementing Treat the instruction as data Modify the address field Pure code: does not modify itself during execution Incrementing does not modify the instruction Address stored in a separate data region Advantage: program can be stored in ROM

Browse More Presentations

Last Updated: 8th March 2018

Recommended PPTs