What The Difference Between Register Addressing And Direct Addressing?
Direct and Indirect Addressing Modes are the two classifications of addressing modes. The significant difference between direct and indirect addressing modes is based on the way the two modes specify the operand of an instruction. The direct addressing mode offers the address of the data to be specified in the instruction itself. As against, the indirect addressing mode is the one that offers the effective address of the memory location where the data exist in the specified instruction.
Thus, we can say that the two modes are distinguished on the basis of their instruction format to get the data on which operation is to be performed.
Before proceeding further, let us understand-
What is Addressing?
We are aware of the fact that every instruction of a program operates on specific data. And the way any instruction specifies the data on which the desired operation will take place is called addressing. The addressing modes sometimes show variation according to the microprocessor involved in the system.
Basically, we know that the microprocessor performs the execution of the instruction stored in the memory one after the other. The instruction format is such that it contains opcode and operand. The opcode specifies the operation which is required to be performed such as ADD, SUB, LOAD, STORE, etc. whereas the operand corresponds to the data on which that specific operation is to be performed.
Example: MOV R1, R2
In the above-given example, MOV is the operation that is to be performed on the operands R1 and R2.
It is to be noted here that the instruction may contain either the actual operand or the address of the memory (register) location from where the data is to be fetched. Sometimes the operand field holds the reference of the address where the data is present. This differentiates the different ways in which the operand is accessed. Here we will discuss how direct and indirect addressing modes are different from each other.
Content: Direct Vs Indirect Addressing Mode
- Comparison Chart
- Definition
- Key Differences
- Conclusion
Comparison chart
Basis for Comparison | Direct Addressing Mode | Indirect Addressing Mode |
---|---|---|
Basic | It contains the actual address of the data. | It contains the effective address of the memory location where the actual address resides. |
Principle | First, through instruction, the address is read and then data is read. | First, through the instruction, the effective address is read and then the actual address is read and lastly the data is achieved. |
Speed of operation | Fast | Comparatively slow |
Address space required | Small | Large |
Memory reference | Single | Double |
Classification | No further classification exists. | Further classified into two categories namely register indirect and memory indirect. |
Definition of Direct Addressing Mode
It is sometimes referred to as Absolute Addressing Mode. The type of addressing mode whose operand field holds the address of the memory location where the data is residing. Thus, in this case, a single memory reference is needed in order to fetch the data. Here in order to get the exact memory location of the data, no exact calculation is required. It is called so because here the operand field directly specifies the location where data is present.
Suppose an instruction is specified as:
ADD A
Then this instruction will be decoded as to get the actual operand over which operation is to be performed one must reach the memory location at address A.
Definition of Indirect Addressing Mode
The type of addressing mode whose operand field contains either memory or register value where the address of the location resides within which the data on which operation is to be performed exist. So, in this scenario, to get the data, a dual memory reference is required. Unlike direct addressing mode, in this case, some extra calculation is needed to get the actual data.
Consider the below-given instruction:
Example: ADD A
This instruction will be decoded as to get the original operand the memory location at address A must be accessed. However, we will not get the data right there because at that particular address, another address will be present and on reaching that specific location data will be obtained. It is called so because the exact location is to be obtained indirectly.
Key Differences Between Direct and Indirect Addressing Mode
- The key factor of differentiation between two addressing modes lies in the way the operand is accessed. The direct addressing mode is the one whose operand part contains the address of the memory location where the data over which the operation is to be performed resides. On the contrary, the indirect addressing mode is the one whose operand part contains the effective address of the location where the address of the actual data resides.
- In the case of direct addressing mode, only a single memory reference is required as data is obtained by the address given in the operand. As against, in the case of indirect addressing mode, two memory references are required as data is present in the second specified address location.
- Whenever there is a need to access the data depending on the opcode specified then in the case of direct addressing mode, by simply reaching the memory location specified in the operand part of instruction, one can get the data. While in the case of indirect addressing mode, the address location specified in the operand part of the instruction gives the address of the location where actually the data is residing.
- The direct addressing mode is a quite faster approach in comparison to the indirect addressing mode.
- The address space required by direct addressing mode is less than the one needed in the case of indirect addressing mode.
- The direct addressing mode does not have any further classification while the indirect addressing mode is further classified into two categories namely register indirect or memory indirect. In the register indirect approach, the operand holds the name of the register where the address of the data is residing while in the memory indirect approach, the operand holds the address of the memory location where data exists.
Conclusion
Hence, this discussion concludes that direct and indirect addressing modes are the two classifications of addressing modes, distinguished on the basis of data on which operation is performed is accessed.
What The Difference Between Register Addressing And Direct Addressing?
Source: https://circuitglobe.com/difference-between-direct-and-indirect-addressing-modes.html
Posted by: laddliamed.blogspot.com
0 Response to "What The Difference Between Register Addressing And Direct Addressing?"
Post a Comment