Consider a hypothetical processor with an instruction of type , which during execution reads a word from memory and stores it in a register . The effective address of the memory location is obtained by the addition of a constant and the contents of register . Which of the following best reflects the addressing mode implemented by this instruction for the operand in memory?
View worked solution
Answer: D
The given instruction is LW R1, 20(R2), which loads a word from memory into register .
The effective address (EA) of the memory operand is calculated as:
Let us analyze the given addressing modes to find the best fit:
- Immediate Addressing: The operand itself is specified directly within the instruction (e.g.,
MOV R1, #20). No memory access is involved for the operand. - Register Addressing: The operand is stored inside a register (e.g.,
ADD R1, R2). No memory access is involved. - Register Indirect Scaled Addressing: The effective address is calculated by scaling (multiplying by etc.) the contents of an index register and adding it to a base register.
- Base Indexed Addressing (or Displacement Addressing): The effective address is obtained by adding a constant displacement (offset) to the contents of a base/index register. Here, is the displacement and is the base register.
Therefore, the addressing mode used for the memory operand is Base Indexed Addressing.
Free practice · Your answers on this page are not saved.
