0% found this document useful (0 votes)
22 views

Addressing Modes

The document discusses various addressing modes in computer architecture, explaining how instructions are structured and how operands are accessed. It covers types such as implied, immediate, register, indirect, and others, detailing their functionalities and applications. Additionally, it addresses the importance of addressing modes for efficient data access and performance optimization in programming.

Uploaded by

Utpal Ghosh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

Addressing Modes

The document discusses various addressing modes in computer architecture, explaining how instructions are structured and how operands are accessed. It covers types such as implied, immediate, register, indirect, and others, detailing their functionalities and applications. Additionally, it addresses the importance of addressing modes for efficient data access and performance optimization in programming.

Uploaded by

Utpal Ghosh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Computer Architecture

Addressing Modes
An instruction contains an operation field, an address field, and a mode field. The operation
field indicates what operation is to be performed, for example, addition, subtraction,
multiplication, etc. The mode field indicates how the memory address of the operand, which
is to be used in an operation, is determined. To understand the various types of addressing
modes, it is important to understand how the computer deals with instruction. The instruction
cycle of a computer goes through the following three phases:

 Fetch the instruction from the memory


 Decode the instruction
 Execute the instruction

Types of Addressing Modes

The various types of addressing modes are discussed below:

Implied mode

In this mode, the instruction contains an indirect definition of the operand. An example of an
implied mode instruction is CMA (complement accumulator). Here, the operand
(complement) is implicitly specified in the instruction.

The operand is mentioned in the instruction itself in inferred addressing. Data is a component
of instructions in this mode and might be 8 bits or 16 bits long. Insinuated addressing is used
in the construction of zero address instructions.

Immediate addressing mode

In this mode, the instruction contains both the opcode and the operand. It can be said that an
instruction that uses the immediate addressing mode contains an operand field in place of an
address field. The operation, as well as the operands, are mentioned in the instruction. An
example of immediate addressing mode instruction is ADD 10. Here, ADD, which is the
operation, and 10, which is the operand, are specified.

 Data is present in the instruction’s address field in this manner. Like a single format for
address instructions.

Note: Limitation in the immediate mode is that the range of constants are restricted by the
size of the address field.

Register mode

In this mode, the instruction specifies a register. This register stores the operand. An example
of register mode instruction is:

AC = AC + [R]

This will add the operand stored at register R to the operand stored in the accumulator.

 The operand is put in either an 8 bit or 16 bit general purpose register when using register
addressing. The instruction’s designated register for the data is present.

 Here one register reference is required to access the data.

Example: MOV AX,CX (move the contents of CX register to AX register)


Register indirect mode

In this mode, the instruction specifies a register. This register stores the effective address of
the operand. An instruction that uses register indirect addressing mode is:

AC = AC + [[R]]

Here, the contents which reside in the memory location specified by the register R will be
added to the contents of the accumulator.

 Register Indirect mode: According to the instruction, the operand’s offset is put in any one
of the registers BX, BP, SI, or DI in this addressing. The base register or an index register
that the instruction specifies is where the data’s actual address is located.

Here two register references are required to access the data.

Using the register indirect addressing modes, the 8086 CPUs enable indirect memory access
via a register.
MOV AX, [BX](move the contents of memory location s
addressed by the register BX to the register AX)

Auto-increment/decrement mode

Auto Indexed (increment mode): Effective address of the operand is the contents of a register
specified in the instruction. After accessing the operand, the contents of this register are
automatically incremented to point to the next consecutive memory location.(R1)+.

In this mode, the instruction specifies a register which points to a memory address that
contains the operand. However, after the address stored in the register is accessed, the address
is incremented or decremented, as specified. The next operand is found by the new value
stored in the register.

Here one register reference, one memory reference and one ALU operation is required to
access the data.

Example:
Add R1, (R2) + // OR

R1 = R1 +M[R2]

R2 = R2 + d

Useful for stepping through arrays in a loop. R2 – start of array d – size of an element.

Auto indexed ( decrement mode):The information in a register designated by the instruction


serves as the operand’s effective address. The values of this register are automatically
decremented to point to the preceding consecutive memory location before accessing the
operand. –(R1)

Here one register reference,one memory reference and one ALU operation is required to
access the data.

Example:

Add R1,-(R2) //OR

R2 = R2-d

R1 = R1 + M[R2]

The auto increment and auto decrement modes are identical. Both can be used to the push and
pop implementation of a stack. For the implementation of "Last-In-First-Out" data structures,
auto increment and auto decrement modes are helpful.

Direct addressing mode

In this mode, the instruction specifies an address. This address is the address of the operand.
An example of a direct addressing mode instruction is:

AC = AC + [X]

This will add the operand stored at address X with the operand stored in the accumulator.
This mode is also referred to as absolute addressing mode.
Indirect addressing mode

In this mode, the instruction specifies an address. The memory location specified by the
address contains the address of the operand. An example of an indirect addressing mode
instruction is:

AC = AC + [[X]]

This will add the operand stored at the address specified by the memory location X with the
contents of the accumulator.

Based on the availability of Effective address, Indirect mode is of two kind:

Register Indirect: In this method, the register holds the effective address, while the address
field of an instruction maintains the name of the relevant register. In this case, one memory
reference and one register reference are needed to access the data.

Memory Indirect: In this mode, the instruction’s address field will always preserve the
associated memory address even while the effective address is in the memory. Here,
accessing the data requires two memory references.

Relative address mode

In this mode, the contents of the address field are added to the constant stored in the program
counter. The result of the addition gives the address of the operand. For example, suppose the
address field contains 850, and the program counter contains 20, then the operand will be at
memory location 850 + 20 = 870.

Indexed addressing mode

In this mode, the address of the operand is determined by adding the contents of the address
field and the contents of the index register.

Base register addressing mode

In this mode, the address of the operand is determined by adding the contents of the address
field and the contents of the base register.

Applications of Various Addressing Modes


The applications of various addressing modes are as follows:

 Immediate addressing mode: Used to set an initial value for a register. The value is usually
a constant
 Register addressing mode/direct addressing mode: Used to implement variables and
access static data
 Register indirect addressing mode/indirect addressing mode: Used to pass an array as a
parameter and to implement pointers
 Relative addressing mode: Used to relocate programs at run time and to change the
execution order of instruction
 Index addressing mode: Used to implement arrays
 Base register addressing mode: Used to write codes that are relocatable and for handling
recursion
 Auto-increment/decrement addressing mode: Used to implement loops and stacks

Purpose of Addressing Mode

The addressing modes serve the following purposes:

 To decrease the number of bits contained in an instruction’s address field


 To provide users with programming versatility by providing facilities such as counters,
pointers, indexing, and program relocation

Q1: Why are addressing modes important in computer architecture?

Addressing modes are essential in computer architecture as they determine how data is
accessed and manipulated within a system. They enable efficient memory utilization, operand
access, and code optimization, ultimately impacting the overall performance of the system.

Q2: How many types of addressing modes are there?

There are various types of addressing modes, including immediate addressing, register
addressing, direct addressing, indirect addressing, indexed addressing, base+offset
addressing, and stack addressing. The exact number and types may vary depending on the
architecture and design of the processor.

Q3: How do addressing modes affect performance?

Different addressing modes have varying impacts on performance. Modes like immediate and
register addressing offer quick access to data, minimizing memory access time and enhancing
performance. However, indirect addressing may introduce additional memory access
overhead, affecting performance to some extent.
Q4: How do I choose the right addressing mode for my program?

The choice of addressing mode depends on the specific requirements of your program.
Consider factors such as the nature of the data, memory availability, the need for flexibility,
and the desired level of performance optimization. Analyzing these factors will help you
select the most appropriate addressing mode.

Q5: Can multiple addressing modes be used within a program?

Yes, it is common to use multiple addressing modes within a program. Different instructions
may require different addressing modes based on the specific data access or manipulation
needs. The choice of addressing mode can vary throughout the program based on the
instruction being executed.

Q6: Do all processors support the same addressing modes?

Different processors and computer architectures may support different addressing modes. The
availability and specific implementation of addressing modes can vary based on the
processor’s design and architecture. It is essential to refer to the processor’s documentation to
understand the supported addressing modes.

You might also like