Addressing Modes

  • July 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Addressing Modes as PDF for free.

More details

  • Words: 496
  • Pages: 2
Addressing Modes Addressing modes are the ways how architectures specify the address of an object they want to access. In GPR machines, an addressing mode can specify a constant, a register or a location in memory. The most common names for addressing modes (names may differ among architectures) Addressing Example Meaning When used modes Instruction Register Add R4,R3 R4 <- R4 + R3 When a value is in a register Immediate Add R4, #3 R4 <- R4 + 3 For constants Displacement Add R4, 100(R1) R4 <- R4 + M[100+R1] Accessing local variables Register deffered Add R4,(R1) R4 <- R4 + M[R1] Accessing using a pointer or a computed address Useful in array addressing: Add R3, (R1 + Indexed R3 <- R3 + M[R1+R2] R1 base of array R2) R2 - index amount Direct Add R1, (1001) R1 <- R1 + M[1001] Useful in accessing static data Memory deferred Add R1, @(R3) R1 <- R1 + M[M[R3]] If R3 is the address of a pointer p, then mode yields *p Useful for stepping through arrays in a loop. AutoR1 <- R1 +M[R2] Add R1, (R2)+ R2 start of array increment R2 <- R2 + d d - size of an element Same as autoincrement. AutoR2 <-R2-d Add R1,-(R2) Both can also be used to implement a stack as push and decrement R1 <- R1 + M[R2] pop Add R1, 100(R2) R1<Used to index arrays. May be applied to any base Scaled [R3] R1+M[100+R2+R3*d] addressing mode in some machines. Notation:
Encoding of Addressing Modes How the addressing modes of operands are encoded depends on

the range of addressing modes the degree of independence between opcodes and modes For small number of addressing modes or opcode/addressing mode combinations, the addressing mode can be encoded in opcode. For a larger number of combinations, typically a separate address specifier is needed for each operand. The architect has to balance several competing forces when encoding the instruction set: The desire to have as many registers and addressing modes as possible. The impact of the size of the register and addressing mode fields on the average instruction size and hence on the average program size. A desire to have instructions encode into lengths that are easy to handle in the implementation (multiples of bytes, fixed-length) with possible sacrificing in average code size.

Related Documents

Addressing Modes
April 2020 15
Addressing Modes
July 2020 9
Lecture 8 Addressing Modes
November 2019 8
Modes
August 2019 26