• Skip to main content
  • Skip to primary sidebar
  • Computer Architecture
  • Computer Networks
  • DBMS
  • OS
  • Software Engineering
  • Security
  • OOT
binary-terms-logo

Binary Terms

The Computer Science & IT Guide

Addressing Mode and its Types

19th September 2019 by Neha T 5 Comments

Addressing modes specifies the way, the effective address of an operand is represented in the instruction. Some addressing mode efficiently allows referring to a large range of area like a linear array of addresses and list of addresses. Addressing mode describes a flexible and efficient way to define complex effective address.

Generally, the programs are written in a high-level language, as it is a convenient way to define the variables and operations that the programmer needs to perform on the variables. Later, this program is compiled to generate the machine code. The machine code has low-level instructions.

The low-level instruction has opcode and operands. Addressing mode has nothing to do with the opcode part. It focuses on presenting the operand’s address in the instructions.

We have the list below showing the various kind of addressing modes:

Types of Addressing Modes

  1. Register Addressing Mode
  2. Direct Addressing Mode
  3. Immediate Addressing Mode
  4. Register Indirect Addressing Mode
  5. Index Addressing Mode
  6. Auto Increment Mode
  7. Auto Decrement Mode
  8. Relative Addressing Mode

Before discussing the addressing modes, we must know about the term “effective address”.

Effective Address (EA):

Effective address is the address of the exact memory location where the value of the operand is present.

Let us discuss all the addressing modes along with the example for better understanding.

1. Register Addressing Mode

Every instruction includes operands; the operands can be a memory location, a processor register or an I/O device. The instruction which uses processor registers to represent operands is the instruction in register addressing mode.

Here, the effective address is a register where the value of the operand is present.

EA=R

Below we have two instructions as our examples for register addressing mode.

Add R4, R3

Load R3, R2

In the examples above, the Add instruction uses registers to represent both of its operands. Similarly, the Load instruction also uses registers to represent both of its operands. So, the instruction above uses register addressing mode to describe the address of the operand. Below, we have a figure showing the Add instruction in the example above.

Register Mode

Advantage: In the register addressing mode there are no memory references as the value to be operated is present in the register.
Disadvantage: Registers have limited address space. So, it has a limit on the size of value that can be stored.

2. Direct Addressing Mode

The direct addressing mode is also known as Absolute Addressing mode. Here, the instruction contains the address of the location in memory where the value of the operand is stored.

Here, the effective address is the address of memory location.

EA = A

For example, observe the examples below:

Add R2, A

Store R2, B

The Add instruction includes the memory location A which has the value to be added to the content of register R2. Similarly, the Store instruction has the address of memory location B where the content of register R2 will be stored. Below we have a figure showing the direct addressing of the operand A in the Add instruction of the example above.

Direct Mode

Advantage: Direct addressing mode is the simplest of all addressing mode.
Disadvantage: Direct addressing mode provides a limited address space.

3. Immediate Addressing Mode

In immediate addressing mode, the value of the operand is explicitly mentioned in the instruction. Here, effective address is not required as the operand is explicitly defined in instruction.

Let us see the example of immediate addressing mode:

Add R2, #100

Store R2, 100H

The Add instruction, adds 100 to R2’s content . The # sign in front of the value indicates the immediate value to be operated. If a value does not have # sign in front of it then it is the address of a memory location.

The next instruction Store considers the immediate value 100H as address as it does not have # sign in front of it. The Store instruction stores the content of R2 at memory location 100H. In the figure below we have shown the Store instruction of the above examples.

Immediate Addressing Mode 1

 

Advantage: In the immediate addressing mode the memory reference is not required as the value is explicitly present in the instruction

Disadvantage: The instruction format provides a limited size for the operand. So, the immediate addressing mode has limited space for immediate value.

4. Register Indirect Addressing mode

A processor register is used to hold the address of a memory location where the operand is placed. This addressing mode allows executing the same set of instructions for the different memory location. This can be done by incrementing the content of register thereby pointing the new location each time.

In higher-level language, it is referred to as pointers. The indirect mode is denoted by placing the register inside the parenthesis.

Here the effective address is the content of memory location present in the register.
EA=(R)

Now, for example:

Load R3, (R2)   // Load R2, A

The Load instruction above will load the value present at the memory location contained by register R2 in the register R3. The figure below shows how the register R3 gets loaded with the value stored in the memory location held by register R2.

Indirect Addressing Mode

Advantage: In the register indirect addressing mode the same set of instructions can be used multiple times.

Disadvantage: In the register indirect addressing mode the number of memory reference is more.

5. Index Addressing Mode

Index addressing mode is helpful when the instructions in the program are accessing the array or the large range of memory addresses. In this mode, the effective address is generated by adding a constant to the register’s content. The content of the register does not change.

The symbolic representation of index addressing mode is denoted as:

X(R)

And the effective address is denoted by

EA = X + (R)

For example, consider the instruction below:

Load R2, A

Load R3, (R2)

Load R4, 4(R2)

Load R5, 8(R2)

Load R6, 12(R2)

The above instructions will load the register R3, R4, R5, R6 with the contents, present at the successive memory addresses from memory location A correspondingly.

Index Addressing Mode

Advantage: The index addressing mode provides flexibility to specify memory locations.

Disadvantage: The index addressing mode is complex to implement.

6. Auto Increment Addressing Mode

In auto-increment addressing mode once the content of the register is accessed by the instruction the register’s content is incremented to refer the next operand.

Symbolically it is represented as below:

(R)+

Here, the effective address is content of the register as it is enclosed by parenthesis. The content of register which is referring to a memory location is incremented so that it could point the next memory location where the next operand is stored.

7. Auto Decrement Addressing Mode

It is just opposite of auto-increment mode. In auto decrement mode the content of the register is decremented initially and then the decremented content of the register is used as effective address.

Symbolically it is presented as:

-(R)

The auto-increment and decrement mode help to implement the stack structure.

8. Relative Addressing Mode

In the content above we have discussed the index addressing mode. There we were adding a constant to the register content to refer the next operand address. In some computer instead of a register, the program counter is used.

The symbolic representation of relative address mode is

X(PC)

The effective address for it would be:

EA = X + (PC)

As here the operand addresses are found relative to the program counter. That’s why it is referred to as relative address mode.

Advantage: Relative addressing mode doesn’t require memory references.

Disadvantage: Relative addressing mode doesn’t have any disadvantage as such.

This is all about addressing modes in computer architecture. It provides us with a flexible method to specify the address of the operands used in instruction.

Related Terms:

  1. RISC Processor
  2. Instruction Format and Sequencing
  3. CISC Processor
  4. Register Organization
  5. Pipelining in Computer Architecture

Reader Interactions

Comments

  1. Deepanshu says

    3rd April 2020 at 2:47 pm

    Sir ,

    What is inherent type of addressing mode

    Reply
    • Neha T says

      7th April 2020 at 1:21 pm

      Inherent addressing mode is one we use in special instructions such as CLA i.e. clear accumulator. In these instructions, we do not have to mention the second operand, it is considered by the opcode itself.
      Example: CLA (clear accumulator i.e. A <- 0 )
      We have not mentioned 0 in CLA instruction i.e. we don't have to mention the second operator.
      So these types of instructions use inherent addressing mode.

      Reply
  2. Arshad Noman says

    8th June 2020 at 11:42 pm

    What do assembly language commands:

    LOAD MBR, ((050))
    ADD AC, 001(MQ)

    when executed do? What are their addressing modes?

    Reply
  3. Emmanuel says

    21st July 2020 at 6:28 pm

    A question was asked like this : ” CLA and ADD mnemonics may perform similar function “.

    They were asked to say something little about the above statement. Please what can be said?

    Reply
  4. Pratibha chakrawarti says

    18th October 2021 at 11:09 pm

    Thank you so much Maa’m

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Most Searched Terms

  • Directory Structure
  • Contiguous Memory Allocation
  • Addressing Mode and its Types
  • Pipelining
  • Vector Processing
  • Register Organization
  • Direct Memory Access (DMA)
  • Process Control Block (PCB)
  • Swapping in Operating System
  • Relational Data Model

Recent Additions

  • Wired Local Area Network
  • Multiple Access Control
  • Hardwired Control Unit
  • Producer Consumer Problem
  • Interprocess Communication (IPC)
  • Cloud Ecosystem
  • System Software
  • Data Link Layer Design Issues
  • Cloud Architecture
  • Linker and Loader in System Programming

Categories

  • Cloud Computing
  • Compiler Design
  • Computer Architecture
  • Computer Networks
  • Data Warehouse and Mining
  • DBMS
  • Object Oriented Technology
  • Operating System
  • Security
  • Software Engineering

Copyright © 2023 · Binary Terms · Contact Us · About Us · Privacy