0% found this document useful (0 votes)
14 views15 pages

Chapter 14

The document discusses various addressing modes used in instruction sets, including immediate, direct, indirect, register, and displacement addressing. Each mode is defined with its characteristics and applications, such as initializing registers, accessing static data, and implementing pointers. Additionally, it covers instruction length considerations and the implications of variable-length instructions on processor complexity.

Uploaded by

ahmed.waasel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views15 pages

Chapter 14

The document discusses various addressing modes used in instruction sets, including immediate, direct, indirect, register, and displacement addressing. Each mode is defined with its characteristics and applications, such as initializing registers, accessing static data, and implementing pointers. Additionally, it covers instruction length considerations and the implications of variable-length instructions on processor complexity.

Uploaded by

ahmed.waasel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

Ch 14

Instruction Sets: Addressing Modes


and Formats
Immediate Addressing
• Simplest form of addressing
• Operand = A
• The operand is specified in the instruction explicitly.
• This mode can be used to define and use constants or set
initial values of variables
Direct Addressing
• Effective address (EA)
= address field A

• The address field of the instruction contains the effective


address of the operand.
• Only one reference to memory is required to fetch the
operand.
Indirect Addressing
• EA = (A)
• Parentheses are to be
interpreted as meaning
contents of.
• The address field of the instruction specifies the address of
the memory location that contains the effective address of
the operand.
Register Addressing
• EA = R

• The operand is contained in a register set.


• Address field refers to a register rather than the main
memory address.
Register Indirect Addressing
• EA = (R)

• The address field of the instruction refers to a CPU register


that contains the effective address of the operand in the
memory.
Displacement Addressing
• Combines the capabilities of direct addressing and
register indirect addressing
• Requires that the instruction have two address fields, at
least one of which is explicit
➢ The value contained in one address field (value = A) is used
directly.
➢ The other address field, or an implicit reference based on
opcode, refers to a register whose contents are added to A to
produce the effective address.
Displacement Addressing

Relative Addressing
• The implicitly referenced
register is the program counter
(PC)
• The next instruction address is
added to the address field to
produce the EA.
• The effective address of the
operand is obtained by adding
the content of the program
counter (PC) with the address
part of the instruction.
EA = A + (PC)

➢The effective address is a displacement


relative to the address of the instruction.
Displacement Addressing

Base-Register Addressing

For base-register addressing, the interpretation is the


following:
➢ The referenced register contains the main memory address,
and the address field contains a displacement (usually an
unsigned integer representation) from that address.
Displacement Addressing

Indexing Addressing

➢ The address field references the main memory address and


the referenced register contains a positive displacement
from that address.
➢ An important use is to provide an efficient mechanism for
performing iterative operations.
Stack Addressing
• A stack is a linear array of
locations
➢ Sometimes referred to as last-
in-first-out queue

• Associated with the stack is a pointer whose value is the


address of the top of the stack
➢ The stack pointer is maintained in a register
➢ Thus references to stack locations in memory are in fact register
indirect addresses
➢ Is a form of implied addressing
➢ The machine instructions need not include a memory reference but
implicitly operate on the top of the stack
Applications of Addressing Modes-
Addressing Modes Applications
Immediate Addressing Mode • To initialize registers to a constant value
Direct Addressing Mode
• To access static data
and
Register Direct Addressing Mode • To implement variables
• To implement pointers because pointers are memory
Indirect Addressing Mode locations that store the address of another variable
and • To pass an array as a parameter because the array
Register Indirect Addressing Mode name is the base address and a pointer is needed to
point the address
• To change the normal sequence of execution of
instructions
Relative Addressing Mode
• For branch type instructions since it directly updates
the program counter
• Implementation of relocatable code i.e. relocation of
Base Register Addressing Mode program in memory even at run time
• For handling recursive procedures
• For array implementation or array addressing
Index Addressing Mode
• For records implementation
Instruction Length
• Most basic design issues, Affects, and is affected by:
➢ Memory size
➢ Memory organization
➢ Bus structure
➢ Processor complexity
➢ Processor speed
• Should be equal to the memory-transfer length or one
should be a multiple of the other.
• Should be a multiple of the character length, which is
usually 8 bits, and of the length of fixed-point
numbers.
Allocation of Bits
The following interrelated factors go into determining the
use of the addressing bits.

Number of Register
Number of
addressing versus
modes operands
memory

Number of Address
Address range
register sets granularity
Variable-Length Instructions
• Variations can be provided efficiently and compactly
• Increases the complexity of the processor

➢ Because the processor does not know the length of the


next instruction to be fetched a typical strategy is to
fetch a number of bytes or words equal to at least the
longest possible instruction
➢ Sometimes multiple instructions are fetched

You might also like