Fundamentals of Operating System

A Quick Guide to Addressing Modes in Computer Architecture

A Quick Guide to Addressing Modes in Computer Architecture

INTRODUCTION

  • The operands of every particular instruction can be found in the main memory or in the CPU registers.
  • The available education would give the location's address in the operand field if the operand were to be placed in the main memory. The address of the operand is specified using a variety of techniques.
  • The addressing modes refer to the many techniques/methods utilized to determine the operand's address in the instructions supplied.

Modes of Addressing

  • We can specify how an operand's effective address is represented in any particular instruction by using the addressing modes.
  • Some addressing mechanisms, such as some linear arrays of addresses together with a list of addresses, allow efficient referring to a wide variety of regions. The addressing modes outline a quick and adaptable method for defining intricate effective addresses.
  • High-level languages are typically used to write programs because they make it easy to define variables and the operations that a programmer can carry out on them. Later, this program is compiled to produce the actual machine code. Low-level instructions are included in a machine code.
  • Opcodes and operands are components of a set of low-level instructions. The opcode section is unrelated to the addressing mode. It primarily focuses on providing the operand's address in the instructions.

TYPES OF ADDRESSING MODES

Addressing modes refer to the various ways that an operand can be specified within an instruction.

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

Here we will discuss the major addressing modes

IMPLIED MODE

  • In this addressing technique, the operands are implicitly specified in the definition of the instruction. The term implicit addressing mode is another name for it.

Example: Include The implied mode command "Complement Accumulator" (CMA).

  • Zero Address Instructions are implied mode instructions in a stack-organized computer. (since operands are assumed to be present at the top of the stack at all times)

STACK ADDRESSING MODE

  • The operand is kept at the top of the stack in this addressing mode.
  • Consider ADD.
  • Two symbols that are at the top of the stack are simply popped out by this instruction.
  • Both of those operands are added together. The result of the addition is once more pushed to the top of the stack.

IMMEDIATE ADDRESSING MODE

  • The operand is explicitly indicated in the instruction in this addressing mode. An operand field is present in place of the address field and contains the operand.

By using Example:

>> ADD 10, the accumulator's value will be increased by 10.

>> Register R is set to the constant value 20 by MOV R #20.

DIRECT ADDRESSING MODE

The effective address of the operand is contained in the address field of the instruction in this addressing mode. To fetch the operand, only one memory reference is needed. The term "absolute addressing mode" is sometimes used.

As an illustration, the operation  ADD X  will increase the value in the accumulator by the amount kept in memory location X.

AC ← AC + [X]

INDIRECT ADDRESSING MODES

The address field of the instruction indicates the address of the memory location that houses the operand's actual address in the indirect addressing mode. To fetch the operand, two references to memory are needed.

Example:

ADD X will add the value stored at the memory location indicated by X to the value already present in the accumulator.

AC ← AC + [[X]]

REGISTER DIRECT ADDRESSING MODES

The operand is kept in a register set when using the register direct addressing technique. The operand is contained in a CPU register that is mentioned in the instruction's address field.

The operand can be fetched without using a reference to memory.

By using Example ADD R, the value kept in the accumulator will be increased by the information in register R.

AC → AC + [R]

The direct addressing mode is comparable to this addressing mode.

The instruction's address field simply differs in that it now refers to a CPU register rather than the main memory.

REGISTER INDIRECT ADDRESSING MODE

In this addressing mode, the instruction's address field refers to a CPU register that holds the operand's actual address. To fetch the operand, only one memory reference is needed.

Example:

ADD R will increase the value in the accumulator by the amount indicated in the register R-specified memory location.

AC → AC + [[R]]

The indirect addressing mode and this addressing mode are comparable. The instruction's address field now corresponds to a CPU register, which is the only difference.