UVMArena

Addressing Modes

Addressing modes define how an instruction obtains its data. They are a key concept in processor design, as they determine where operands come from during execution.

What is an Addressing Mode?

An addressing mode specifies how the processor accesses the data required by an instruction. In other words, it defines the source of operands.

Before designing the instruction register, it is essential to understand addressing modes, since they directly impact how instructions are interpreted and executed.

Types of Addressing Modes

There are four commonly used addressing modes:

  • Register Addressing
  • Immediate Addressing
  • Direct Addressing
  • Indirect Addressing

Register Addressing Mode

The data is stored in a processor register. The instruction directly references the register containing the operand.

move r0, r1

Meaning:

r0 = r1
  • Data comes from a register
  • Fast access
  • No memory access required

Immediate Addressing Mode

The data is provided directly within the instruction itself.

move r0, #10

Meaning:

r0 = 10
  • Operand is a constant value
  • No register or memory lookup
  • Very efficient for fixed values

Direct Addressing Mode

The instruction specifies a memory address where the data is stored.

move r0, @20H

Meaning:

r0 = MEM[20H]
  • Instruction provides memory address
  • Data is fetched from that location
  • Requires memory access

Indirect Addressing Mode

The instruction points to a register that contains the address of the data.

move r0, @r31

Meaning:

r0 = MEM[r31]
  • Register holds the memory address
  • Two-step access (register → memory)
  • More flexible than direct addressing

Direct vs Indirect Addressing

  • Direct: Instruction contains the actual memory address
  • Indirect: Instruction points to a register that holds the address

Key Takeaways

  • Addressing modes define how data is accessed
  • They are essential for instruction execution
  • Different modes offer trade-offs between speed and flexibility

Interview Questions

  • What is an addressing mode?
  • Difference between direct and indirect addressing?
  • Which addressing mode is fastest and why?
  • When would you use immediate addressing?