Log In
33 votes

Consider a hypothetical processor with an instruction of type $\text{LW  R1, 20(R2)}$, which during execution reads a $32-bit$ word from memory and stores it in a $32-bit$ register $\text{R1}$. The effective address of the memory location is obtained by the addition of a constant $20$ and the contents of register $\text{R2}$. Which of the following best reflects the addressing mode implemented by this instruction for the operand in memory?

  1. Immediate addressing
  2. Register addressing
  3. Register Indirect Scaled Addressing
  4. Base Indexed Addressing
in CO and Architecture
edited by
Answer can never be A or B.
Plz correct me if wrong:

"The reason it cannot be register mode is because it is reading the address from memory, while, in register mode, address is never read from memory"?
Index Mode

The address of the operand is obtained by adding to the contents of the general register (called index register) a constant value. The number of the index register and the constant value are included in the instruction code. Index Mode is used to access an array whose elements are in successive memory locations. The content of the instruction code, represents the starting address of the array and the value of the index register, and the index value of the current element. By incrementing or decrementing index register different element of the array can be accessed.
Why is it not register addressing?
Why not option C ?

Some related additional information -->

After reading this question some terms are coming in my mind for calculating effective address -->

  1. Addressing mode for Data (Used in sequential control flow)  -
    1. Immediate AM(addressing mode)  # 
    2. Register AM 
    3. Direct AM []
    4. Indirect AM(Register indirect AM and Memory Indirect AM)  @ or ()
    5. Indexed AM -
      1. Base Indexed Addressing - Base address is available in the address field of the instruction and index value is fetched from Index reg.
      2. In some processor we have designated register for both Base and Index value. 
      3. Auto indexed AM( [Base reg] + Step Size)
        • Auto increment and Auto Decrement  
    6. Implied (or Implicit) AM. (Ex - CLC, STC etc.)
  2. Addressing mode for Instruction(Used in transfer of Control) - 
    1. PC Relative AM (For accessing within segment) PC $\leftarrow$ PC + IR[Address Field].
    2. Base register AM or Based AM(For accessing instruction outside of the current segment) PC $\leftarrow$ [Base Reg.] + IR[Address Field]

PS: If something is missing or not proper please notify. It will be really helpful.

why not register indirect?
@sushmita in register indirect we hold the effective address in the register here we calculate it with additional index here the register is only the base
same question appeared in ISRO 2017 dec..


It's not Register Addressing because we don't use Offset in Register Addressing.

option D) Base indexed addressing

5 Answers

43 votes
Best answer

Answer is (D).

Base Index Addressing, as the content of register $R2$ will serve as the index and $20$ will be the Base address.

edited by
why are we not considering c as there is additive scaling

Hope, this will help!

why not immediate mode?

Why not reasoning for the answer be like,

Answer: D.

Base index addressing, as the content of the register, R2 will serve as the BASE and 20 will be the INDEX.

@Hemant . By standard we assume that the constant in the address field represent then Base address  and the index register contains index value.
Isnt based indexed addressing mode required to use base registers (BX and BP) and index registers (SI and DI)? If yes, then how is this based indexed addressing mode? Is it just conceptual, like we should have some fixed base address and indexing offset?


sir, why not option C ?

i mean there is no significance to the word "SCALED" in Register indirect scaled Addressing ?

@smartmeet For indexed mode, It should have been [(index*scale) + startAddress]. Because "index*scale" itself gives you displacement.

@Shaik Masthan

Please let me know if this understanding is correct.

I think it is not C)Register Indirect Scaled Addressing, because we do not have any indirect memory/register accesses.

21 votes

The answer has to be option D.

Reason:It is mentioned in the question that the constant value 20 is added to the contents of Register R2(the word "CONSTANT" has got a significance here).The base address is something that remains CONSTANT under normal circumstances.The content of R2 is added to 20(constant base address) to get the effective address and this process resembles the way how we access an element of an array randomly.As we know that accessing of array elements is best done using INDEXED ADDRESSING hence the answer.

Very good
0 votes
LW R1 , 20(R2)

options A,B are anyway out of the context.

first of all in such writings 2 symbols directly means indirect , 1) @  2) (  );

2nd of all in base addressing or based indexed addressing we do not I REPEAT we do not use the base value like this.

i dont know if option C is correct or not..

but D can't be the answer...

in based indexed addressing we must use 2 registers... giving 20 directly is not fulfilling the rules.


(Effective address = contents of specified base register + contents of specified index register)




Based Indexed Addressing: The operand’s offset is sum of the content of a base register BX or BP and an index register SI or DI.

Example: ADD AX, [BX+SI]
0 votes

Which of the following best reflects the addressing mode implemented by this instruction for the operand in memory?

"best reflects" doesn't imply that it must be exactly that implementation..

Keeping that in mind, and also that options A and B could not be the candidates,

Let's focus on  $option \; C$ and $option \; D$

There is no literature that I found on the so called Indirect Scaled addressing.. 

There's nothing called Indirect Scaled Addressing, There is only scaled Base addressing where the scale is the number of bytes per offset..

But if we assume it exists and is similar to the Base Indexed addressing, then we have two valid interpretations, where both are consistent..

$R_1 \leftarrow  (A+(R_0))$ or $R_1 \leftarrow (20+(R_2))$ Base Indexed addressing, where 20 is assumed to be the base address

$R_1 \leftarrow  ((R_2)+20)$ Indirect Scaled offset [Access the register, add scaled offset(20) and get the data from the memory location]

It's debatable if Indirect Scaled offset is really even a thing, but considering yet another fact that there's generally no use of offset in Register Addressing, we conclude the best answer is $option\;D$

I am still not convinced by the answer, and really wish the question was little clearer..

After some time I felt it's pointless debating a vaguely defined theory question.

Anyone comes up with a better explaination, or If I am wrong anywhere, please comment
–1 vote
Ans: D

Index     X(Ri)    EA=[Ri]+X  

Where  x=displacement

So here R2 is Index or Base register and 20 is displacement

Related questions

26 votes
3 answers
Let $P$ be a regular language and $Q$ be a context-free language such that $Q \subseteq P$. (For example, let $P$ be the language represented by the regular expression $p^*q^*$ and $Q$ be $\{p^nq^n \mid n \in N\})$. Then which of the following is ALWAYS regular? $P \cap Q$ $P-Q$ $\Sigma^*-P$ $\Sigma^*-Q$
asked Oct 30, 2014 in Theory of Computation akash 3.8k views
8 votes
2 answers
Choose the most appropriate word(s) from the options given below to complete the following sentence. I contemplated _________ Singapore for my vacation but decided against it. to visit having to visit visiting for a visit
asked Sep 29, 2014 in Verbal Ability jothee 1.6k views
23 votes
6 answers
A deterministic finite automaton ($\text{DFA}$) $D$ with alphabet $\Sigma = \{a, b\}$ is given below. Which of the following finite state machines is a valid minimal $\text{DFA}$ which accepts the same languages as $D$?
asked Sep 29, 2014 in Theory of Computation jothee 3.6k views
19 votes
4 answers
Consider the matrix as given below. $\begin{bmatrix} 1 & 2 & 3 \\ 0 & 4 & 7 \\ 0 & 0 & 3\end{bmatrix}$ Which one of the following options provides the CORRECT values of the eigenvalues of the matrix? $1, 4, 3$ $3, 7, 3$ $7, 3, 2$ $1, 2, 3$
asked Sep 29, 2014 in Linear Algebra jothee 1.7k views