Addressing Modes in Computer Architecture with Diagram

Addressing Modes in Computer Architecture with Diagram

What is addressing modes?

The addressing modes is a really important topic to be considered in microprocessor or computer organisation. The addressing modes in computer architecture actually define how an operand is chosen to execute an instruction. It is the way that is used to identify the location of an operand which is specified in an instruction.

Whenever an instruction executes, it requires operands to be operated on. An instruction field consisting of opcode and operand. Where operand means the data and opcode means the instruction itself. In case of operations like addition or subtraction, they require two data. So, they are called binary instruction. On the other hand, the increment or decrement operations need only one data and are so called unary instruction. Now the question is how these data can be obtained.

Consider an example that you want to buy a product from an online shopping site say Amazon. Now you can pay it either by using cash on delivery, by net banking, by debit/credit card, by UPI etc. So, in different ways, you can make payment to Amazon. This is the various payment modes available. But here we are discussing the addressing modes in computer architecture, that means how an instruction can access operands to be operated on using various modes.

The various addressing modes in computer architecture can be classified as below. We have some other addressing modes too, but these are the prime addressing modes in computer architecture.

Addressing modes in computer architecture:

  • Implicit
  • Immediate
  • Direct
  • Indirect
  • Register
  • Register Indirect
  • Displacement
    • Relative
    • Base register
    • Indexing
  • Stack

Let us discuss all these addressing modes available in computer architecture one by one.

Implicit addressing mode :

The term implicit addressing mode means here we are not mentioning clearly in details that from where the instruction can get the operand. But by default, the instruction itself knows from where it is supposed to access the operand. For example, CMA stands for complement accumulator. The meaning of the CMA instruction is whatever the value present in the accumulator will be replaced by its 1’s complement.

In this instruction CMA or along with this instruction, we are not mentioning any operand. So here it knows that the operand has to be accessed from the accumulator implicitly. This is known as implicit addressing modes.

Immediate addressing mode :

In the immediate addressing mode, the instruction contains two fields. One for the opcode and another field contains the operand itself. That means in this addressing mode, there is no need to go anywhere to access the operand because of the instruction itself containing the operand. This is known as immediate addressing mode.

immediate addressing mode

Direct addressing mode :

In the direct addressing mode, the instruction will have the two parts. One part will contain the opcode and another one will contain the address of the memory location at where the operand can be found.

Here A is the address of the operand. That means at the Ath location in the memory, the operand can be found.

direct addressing mode

Indirect addressing mode :

Indirect addressing mode contains the opcode and address field. But unlike direct addressing mode, it doesn’t contain the address of the operand but contains the address of a memory location in which the actual address of the operand can be found.

indirect addressing mode

Here A contains the address of the location B in memory and B contains the actual address of the operand in memory.

Register addressing mode:

In case of register addressing mode, the instruction will have the opcode and a register number. Depending upon the register number, one of the registers will be selected from the available sets of registers by default automatically.

The unique identification of the register can be done by the register number which is mentioned in the instruction. In that register, the operand can be found.

register addressing mode

Register indirect addressing mode :

In the register indirect addressing mode, the instruction will contain the opcode as well as a register number. Depending upon the register number mentioned in the instruction, the corresponding register will be accessed from the set of registers. But here the register doesn’t contain the operand but will contain the address of the operand in the memory at where the operand can be found.

register indirect addressing mode

Suppose in memory, the operand is in the Ath location. Now, this address A will be stored in the register and the register number say R will be mentioned in the instruction. This is called register addressing mode.

Displacement addressing mode :

In the displacement addressing mode, the instruction will be having three fields. One for the opcode, one for the register number and the remaining one for an absolute address.

At first, depending upon the register number the register will be selected from the register set. After that its content will be added with the absolute address and the new address formed will be the actual physical address of the operand in the memory.

displacement addressing mode

Displacement addressing mode in computer architecture can be categorized into 3 different modes.

  1. Relative 
  2. Base register
  3. Indexing

In case of relative addressing mode, the register used will be a program counter.

In the base addressing mode, the register will contain the base address and the absolute field will be the offset or displacement from the base address. After adding both the actual physical address of the operand can be obtained and mapping this address in the memory we can access the operand.

For example, if the base address is 3000 and the offset is 20, then after adding both i.e. 3020 will be the actual address of the operand.

In case of Indexing mode, the absolute field will contain the starting base address of the memory block and the register field will contain the index value. Adding both will give the actual physical address of the operand.

Stack addressing mode:

In case of stack addressing mode, the instruction knows the topmost data should be the operand. If the instruction is a unary instruction then it will select the topmost data as the operand and if the instruction is a binary instruction then it will select the topmost two data as the operands from the top of the stack.

stack addressing mode

These are the basic and primary addressing modes in computer architecture. Apart from these modes, we have some other addressing modes in computer architecture including auto-increment, auto-decrement mode. But above mentioned are the most important addressing modes in computer architecture or computer organisation.

 

Liked this article? Then please like our Facebook Page & stay connected with us.

Also Read: Single bus structure in computer organisation

 

Debarshi Das

Debarshi Das is a passionate blogger & full-stack JavaScript developer from Guwahati, Assam. He has a deep interest in robotics too. He holds a BSc degree in Information Technology & currently pursuing Masters of Computer Application (MCA) from a premier govt. engineering college. He is also certified as a chip-level computer hardware expert from an ISO certified institute.

This Post Has One Comment

  1. Great Article About addressing mode in computer architecture
    very useful information

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Close Menu