Skip to content

Latest commit

 

History

History
66 lines (57 loc) · 3.25 KB

File metadata and controls

66 lines (57 loc) · 3.25 KB

Memory Addressing Modes

There are many ways to locate data and instructions in primary memory and these methods are known as Memory Address Modes.

There are essentially 4 types of Memory Addressing modes:

  1. Immediate
  2. Direct
  3. Indirect
  4. Indexed
  5. Implied
  6. Register Direct
  7. Register Indirect
  8. Relative
  9. Base
  10. Auto-increment
  11. Auto-decrement

Immediate Addressing mode

-> It basically means that the data is hard-coded into the instruction itself. -> It neither requires memory accesses nor fetching of memory so it is, by far, the fastest method of addressing. -> the major disadvantage of this mode is the size constraint.

Direct Addressing mode

->It is a very straightforward method of addressing data, we basically provide the memory location of the data. -> It requires a memory access so while it is fairly fast, it is slower than Immediate addressing.

Indirect Addressing mode

-> It essentially means that the address of the data is stored at an intermediate location so we basically have to find the intermediate location first which then gives us the address of the data. -> there are two memory accesses required so it is slower than both direct and immediate but it contain data of larger sizes.

Indexed Addressing mode

-> It means that the final address of the data has to be found using an offest from the base address. -> It is ideal for storing and accessing values of arrays because they require contiguous memory locations so we need only the address of the first element to find the location of the other elements in the array.

Implied Adressing mode

->In this addressing mode, The definition of the instruction itself specify the operands implicitly. It is also called as implicit addressing mode.

Register Direct Addressing mode

->In this addressing mode,

The operand is contained in a register set. The address field of the instruction refers to a CPU register that contains the operand. No reference to memory is required to fetch the operand.

Register Indirect Addresssing mode

->In this addressing mode,

The address field of the instruction refers to a CPU register that contains the effective address of the operand. Only one reference to memory is required to fetch the operand.

Relative Addressing mode

->In this addressing mode,

Effective address of the operand is obtained by adding the content of program counter with the address part of the instruction.

Base Register Addressing mode

->In this addressing mode,

Effective address of the operand is obtained by adding the content of program counter with the address part of the instruction.

Auto-Increment Addressing mode

->In this addressing mode,

After accessing the operand, the content of the register is automatically incremented by step size ‘d’. Step size ‘d’ depends on the size of operand accessed. Only one reference to memory is required to fetch the operand.

Auto-decrement Adreesing mode

->In this addressing mode,

First, the content of the register is decremented by step size ‘d’. Step size ‘d’ depends on the size of operand accessed. After decrementing, the operand is read. Only one reference to memory is required to fetch the operand.