Lecture 9
Lecture 9
Instruction Sets:
Addressing Modes and Formats
Direct
Indirect
Register
Register indirect
Displacement
Stack
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
+ Immediate Addressing
■ The simplest form of addressing is immediate addressing, in which the
operand value is present in the instruction
Operand = A
■ This mode can be used to define and use constants or set initial values of
variables
■ Typically, the number will be stored in two’s complement form
■ The leftmost bit of the operand field is used as a sign bit
■ When the operand is loaded into a data register, the sign bit is
extended to the left to the full data word size.
■ Advantage:
■ No memory reference other than the instruction fetch is required to
obtain the operand, thus saving one memory or cache cycle in the
instruction cycle
■ Disadvantage:
■ The size of the number is restricted to the size of the address field,
which, in most instruction sets, is small compared with the word length
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
+
Direct Addressing
■ A very simple form of addressing is direct addressing, in which the
address field contains the effective address of the operand:
EA = A
EA = (A)
Advantage:
■ For a word length of N an address space of 2N is now available
■ Disadvantage:
■ Instruction execution requires two memory references to fetch the
operand: one to get its address and a second to get its value
EA = ( . . . (A) . . . )
■ In this case, one bit of a full-word address is an indirect flag (I). If the I
bit is 0, then the word contains the EA. If the I bit is 1, then another level
of indirection is invoked. There does not appear to be any particular
advantage to this approach, and its disadvantage is that three or more
memory references could be required to fetch an operand.
EA = R
■ Advantage:
■ Disadvantage:
EA = (R)
EA = A + (R)
THANK YOU