All Exams Test series for 1 year @ ₹349 only
Question

How many bits are required to distinguish between a direct and an indirect address?

The correct answer is

1

Understanding Direct and Indirect Addressing

In computer architecture, addressing modes determine how the operand of an instruction is accessed. Two common addressing modes are direct addressing and indirect addressing.

  • Direct Addressing: The address field in the instruction contains the actual memory address where the operand is stored.
  • Indirect Addressing: The address field in the instruction contains the memory address of a location where the actual address of the operand is stored. It's like having a pointer; you go to one address to find another address.

How to Distinguish Between Modes

To allow an instruction format to support both direct and indirect addressing, a mechanism is needed to indicate which mode is being used for the address field. This is typically done by dedicating a specific part of the instruction word, often a single bit, to act as a flag or mode indicator.

  • If this bit is set to one value (e.g., 0), it signifies direct addressing.
  • If this bit is set to the other value (e.g., 1), it signifies indirect addressing.

Since there are only two possibilities to distinguish between (direct or indirect), only two distinct states are required. A single binary digit (bit) can represent exactly two states: 0 and 1.

Therefore, just 1 bit is sufficient to distinguish between these two addressing modes.

Let's represent this:

  • State 1 (e.g., 0) ⇒ Direct Address
  • State 2 (e.g., 1) ⇒ Indirect Address

The number of states required is 2. The number of bits (\(n\)) required to represent \(S\) states is given by \(2^n \ge S\). For \(S=2\), we have:

\(2^n \ge 2\)

The smallest integer value for \(n\) that satisfies this inequality is \(n=1\), since \(2^1 = 2\).

Hence, 1 bit is required.

Addressing Mode Distinction
Mode Bit Value Addressing Mode
0 Direct
1 Indirect

Conclusion

To differentiate between a direct and an indirect address within an instruction format, a single bit is allocated. This bit acts as a mode indicator, with one state representing direct addressing and the other state representing indirect addressing. Thus, 1 bit is required.

Revision Table: Key Concepts

Summary of Addressing Concepts
Term Description Bits Required for Distinction
Direct Addressing Instruction contains the actual memory address of the operand. 1 bit (to distinguish between direct and indirect)
Indirect Addressing Instruction contains the address of the memory location holding the address of the operand.

Additional Information: Addressing Modes

While direct and indirect are fundamental, computer architectures use various other addressing modes to provide flexibility in accessing data. These include:

  • Immediate Addressing: The operand itself is present in the instruction.
  • Register Addressing: The operand is in a CPU register specified by the instruction.
  • Register Indirect Addressing: The instruction specifies a register that contains the memory address of the operand.
  • Indexed Addressing: The address is calculated by adding a constant (offset) to the contents of an index register.
  • Relative Addressing: The address is calculated relative to the program counter (PC).

The number of bits required to specify the addressing mode depends on how many distinct modes the architecture supports. If there are \(M\) different addressing modes, \(\lceil \log_2 M \rceil\) bits would be needed to encode all possible modes.

Was this answer helpful?

Important Questions from Addressing Modes

  1. Which of the following addressing modes is convenient to handle pointers?

  2. Which one of the following types of instructions is useful for initializing registers to assign a constant value?
  3. In which one of the following addressing modes, the effective address is equal to the address part of the instruction?
  4. Match the LIST-I with LIST-II
    LIST-ILIST-II
    A. Immediate addressing modeI. MOV A,@R0
    B. Indexed addressing modeII. MOV DPTR,#4521H
    C. Register addressing modeIII. MOVC A,@A+DPTR
    D. Register indirect addressing modeIV. MOV A,R0
    Choose the correct answer from the options given below:
  5. Match each addressing mode in List I with a data element or an element of a data structure (in a high-level language) in List II:
    List IList II
    P. Immediate1. Element of an array
    Q. Indirect2. Pointer
    R. Base with index3. Element of a record
    S. Base with offset/displacement4. Constant
Need Expert Advice?

Start Your Preparation with Prepp Mobile App

Download the app from Google Play & App Store
Download the app from Google Play & App Store
Prepp Mobile App