Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 William Stallings Computer Organization and Architecture Chapter 10 Instruction Sets: Addressing Modes and Formats.

Similar presentations


Presentation on theme: "1 William Stallings Computer Organization and Architecture Chapter 10 Instruction Sets: Addressing Modes and Formats."— Presentation transcript:

1 1 William Stallings Computer Organization and Architecture Chapter 10 Instruction Sets: Addressing Modes and Formats

2 2 Addressing Modes zImmediate zDirect zIndirect zRegister zRegister Indirect zDisplacement (Indexed) zStack

3 3 Immediate Addressing zOperand is part of instruction zOperand = address field ze.g. ADD 5 yAdd 5 to contents of accumulator y5 is operand zNo memory reference to fetch data zFast zLimited range

4 4 Immediate Addressing Diagram OperandOpcode Instruction

5 5 Direct Addressing zAddress field contains address of operand zEffective address (EA) = address field (A) ze.g. ADD A yAdd contents of cell A to accumulator yLook in memory at address A for operand zSingle memory reference to access data zNo additional calculations to work out effective address zLimited address space

6 6 Direct Addressing Diagram Address AOpcode Instruction Memory Operand

7 7 Indirect Addressing (1) zMemory cell pointed to by address field contains the address of (pointer to) the operand zEA = (A) yLook in A, find address (A) and look there for operand ze.g. ADD (A) yAdd contents of cell pointed to by contents of A to accumulator

8 8 Indirect Addressing (2) zLarge address space z2 n where n = word length zMay be nested, multilevel, cascaded ye.g. EA = (((A))) xDraw the diagram yourself zMultiple memory accesses to find operand zHence slower

9 9 Indirect Addressing Diagram Address AOpcode Instruction Memory Operand Pointer to operand

10 10 Register Addressing (1) zOperand is held in register named in address filed zEA = R zLimited number of registers zVery small address field needed yShorter instructions yFaster instruction fetch

11 11 Register Addressing (2) zNo memory access zVery fast execution zVery limited address space zMultiple registers helps performance yRequires good assembly programming or compiler writing yN.B. C programming xregister int a; zc.f. Direct addressing

12 12 Register Addressing Diagram Register Address ROpcode Instruction Registers Operand

13 13 Register Indirect Addressing zC.f. indirect addressing zEA = (R) zOperand is in memory cell pointed to by contents of register R zLarge address space (2 n ) zOne fewer memory access than indirect addressing

14 14 Register Indirect Addressing Diagram Register Address ROpcode Instruction Memory Operand Pointer to Operand Registers

15 15 Displacement Addressing zEA = A + (R) zAddress field hold two values yA = base value yR = register that holds displacement yor vice versa

16 16 Displacement Addressing Diagram Register ROpcode Instruction Memory Operand Pointer to Operand Registers Address A +

17 17 Relative Addressing zA version of displacement addressing zR = Program counter, PC zEA = A + (PC) zi.e. get operand from A cells from current location pointed to by PC zc.f locality of reference & cache usage

18 18 Base-Register Addressing zA holds displacement zR holds pointer to base address zR may be explicit or implicit ze.g. segment registers in 80x86

19 19 Indexed Addressing zA = base zR = displacement zEA = A + R zGood for accessing arrays yEA = A + R yR++

20 20 Combinations zPostindex zEA = (A) + (R) zPreindex zEA = (A+(R)) z(Draw the diagrams)

21 21 Stack Addressing zOperand is (implicitly) on top of stack ze.g. yADDPop top two items from stack and add

22 22 Instruction Formats zLayout of bits in an instruction zIncludes opcode zIncludes (implicit or explicit) operand(s) zUsually more than one instruction format in an instruction set

23 23 Instruction Length zAffected by and affects: yMemory size yMemory organization yBus structure yCPU complexity yCPU speed zTrade off between powerful instruction repertoire and saving space

24 24 Allocation of Bits zNumber of addressing modes zNumber of operands zRegister versus memory zNumber of register sets zAddress range zAddress granularity

25 25 Foreground Reading zStallings chapter 10 zIntel and PowerPC Web sites


Download ppt "1 William Stallings Computer Organization and Architecture Chapter 10 Instruction Sets: Addressing Modes and Formats."

Similar presentations


Ads by Google