Skip to main content

Addressing Modes & Types of Addressing Modes

Addressing Modes & Types of Addressing Modes


Addressing modes: The different ways of specifying the location of an operand in instruction are called addressing modes.

Types of Addressing Modes: In computer architecture, there are the following types of addressing modes:
  1. Implied / Implicit Addressing Mode
  2. Stack Addressing Mode
  3. Immediate Addressing Mode
  4. Direct Addressing Mode
  5. Indirect Addressing Mode
  6. Register Direct Addressing Mode
  7. Register Indirect Addressing Mode
  8. Relative Addressing Mode
  9. Indexed Addressing Mode
  10. Base Register Addressing Mode
  11. Auto-Increment Addressing Mode
  12. Auto-Decrement Addressing Mode
Types of Addressing Modes
(Types of Addressing Modes)

In this article, we will discuss these addressing modes in detail.

1. Implied Addressing Mode:
In this addressing mode,
  • The definition of the instruction itself specifies the operands implicitly.
  • It is also called an implicit addressing mode.

Examples:
  • The instruction “Complement Accumulator” is an implied mode of instruction.
  • In a stack-organized computer, Zero Address Instructions have implied mode instructions.

2. Stack Addressing Mode:
In this addressing mode,
  • The operand is contained at the top of the stack.

Example:
  • This instruction simply pops out two symbols contained at the top of the stack.
  • The addition of those two operands is performed.
  • The result so obtained after addition is pushed again at the top of the stack.

3. Immediate Addressing Mode:
In this addressing mode,
  • The operand is specified in the instruction explicitly.
  • Instead of the address field, an operand field is present that contains the operand.

Examples:
  • ADD 10 will increment the value stored in the accumulator by 10.
  • MOV R #20 initializes register R to a constant value of 20.

4. Direct Addressing Mode:
In this addressing mode,
  • The address field of the instruction contains the effective address of the operand.
  • Only one reference to memory is required to fetch the operand.
  • It is also called an absolute addressing mode.

Example:
  • ADD X will increment the value stored in the accumulator by the value stored at memory location X.
AC ← AC + [X]

5. Indirect Addressing Mode:
In this addressing mode,
  • The address field of the instruction specifies the address of memory location that contains the effective address of the operand.
  • Two references to memory are required to fetch the operand.

Example:
  • ADD X will increment the value stored in the accumulator by the value stored at the memory location specified by X.
AC ← AC + [[X]]

6. 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.

Example:
  • ADD R will increment the value stored in the accumulator by the content of register R.
AC ← AC + [R]

NOTE:
  • This addressing mode is similar to the direct addressing mode.
  • The only difference is address field of the instruction refers to a CPU register instead of the main memory.

7. Register Indirect Addressing 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.

Example:
  • ADD R will increment the value stored in the accumulator by the content of the memory location specified in register R.
AC ← AC + [[R]]

NOTE:
  • This addressing mode is similar to the indirect addressing mode.
  • The only difference is address field of the instruction refers to a CPU register.

8. Relative Addressing Mode:
In this addressing mode,
  • Effective address of the operand is obtained by adding the content of the program counter with the address part of the instruction.
Effective Address = Content of Program Counter + Address part of the instruction

NOTE:
  • Program counter (PC) always contains the address of the next instruction to be executed.
  • After fetching the address of the instruction, the value of the program counter immediately increases.
  • The value increases irrespective of whether the fetched instruction has been completely executed or not.

9. Indexed Addressing Mode:
In this addressing mode,
  • Effective address of the operand is obtained by adding the content of the index register with the address part of the instruction.
Effective Address = Content of Index Register + Address part of the instruction

10. Base Register Addressing Mode:
In this addressing mode,
  • Effective address of the operand is obtained by adding the content of the base register with the address part of the instruction.
Effective Address = Content of Base Register + Address part of the instruction

11. Auto-Increment Addressing Mode:
  • This addressing mode is a special case of Register Indirect Addressing Mode where-

Effective Address of the Operand = Content of Register

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 the operand accessed.
  • Only one reference to memory is required to fetch the operand.

Example:
Assume operand size = 2 bytes.
Here,
  • After fetching operand 6B, the instruction register RAUTO will be automatically incremented by 2.
  • Then, updated value of RAUTO will be 3300 + 2 = 3302.
  • At memory address 3302, the next operand will be found.

NOTE:
In auto-increment addressing mode,
  • First, the operand value is fetched.
  • Then, the instruction register RAUTO value is incremented by step size ‘d’.

12. Auto-Decrement Addressing Mode:
  • This addressing mode is again a special case of Register Indirect Addressing Mode where-

Effective Address of the Operand = Content of Register – Step Size

In this addressing mode,
  • First, the content of the register is decremented by step size ‘d’.
  • Step size ‘d’ depends on the size of the operand accessed.
  • After decrementing, the operand is read.
  • Only one reference to memory is required to fetch the operand.
Example:
Assume operand size = 2 bytes.
Here,
  • First, the instruction register RAUTO will be decremented by 2.
  • Then, the updated value of RAUTO will be 3302 – 2 = 3300.
  • At memory address 3300, the operand will be found.
NOTE:
In auto-decrement addressing mode,
  • First, the instruction register RAUTO value is decremented by step size ‘d’.
  • Then, the operand value is fetched.


Comments

Popular posts from this blog

All About Microservices Architecture

All About Microservices Architecture **Microservices Architecture** is an approach to software development where a large application is broken down into smaller, independent services that can operate and be deployed independently. Instead of building a monolithic application, which is a single, tightly-integrated unit, microservices architecture divides the functionality into separate services that communicate with each other through well-defined APIs (Application Programming Interfaces). Key characteristics of microservices architecture include: 1. **Modularity:** Each microservice represents a specific business capability and can be developed, deployed, and scaled independently. 2. **Independence:** Microservices are autonomous, meaning they can be developed, deployed, and updated without affecting the entire system. This independence allows for faster development cycles. 3. **Scalability:** Since each service is independent, you can scale only the specific microservices that require...

Relational Calculus

Relational Calculus There is an alternate way of formulating queries known as Relational Calculus. Relational calculus is a non-procedural query language. In the non-procedural query language, the user is concerned with the details of how to obtain the end results. The relational calculus tells what to do but never explains how to do. Most commercial relational languages are based on aspects of relational calculus including SQL-QBE and QUEL. Why it is called Relational Calculus? It is based on Predicate calculus, a name derived from branch of symbolic language. A predicate is a truth-valued function with arguments. On substituting values for the arguments, the function result in an expression called a proposition. It can be either true or false. It is a tailored version of a subset of the Predicate Calculus to communicate with the relational database. Many of the calculus expressions involves the use of Quantifiers. There are two types of quantifiers: Universal Quantifiers: The univer...

Natural Language Processing (NLP)

What is Natural Language Processing (NLP) ? Natural Language Processing (NLP)* is a field of artificial intelligence (AI) that focuses on the interaction between computers and humans using natural language. It involves the development of algorithms and models that enable computers to understand, interpret, and generate human language. Here are key aspects of NLP: 1. *Text Understanding:* NLP systems aim to comprehend the meaning of written or spoken language. This involves tasks such as text classification, sentiment analysis, and named entity recognition. 2. *Speech Recognition:* NLP extends to processing spoken language, converting audio signals into text. This technology is used in voice assistants, transcription services, and more. 3. *Language Generation:* NLP systems can generate human-like text. This is employed in chatbots, language translation services, and content generation. 4. *Machine Translation:* NLP is fundamental to machine translation systems that enable the automatic...