edited by
17,399 views
48 votes
48 votes

Consider a hypothetical processor with an instruction of type $\text{LW  R1, 20(R2)}$, which during execution reads a $32\text{-bit}$ word from memory and stores it in a $32\text{-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
edited by

5 Answers

Best answer
57 votes
57 votes

The answer is (D).

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

edited by
37 votes
37 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.

3 votes
3 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$

1 votes
1 votes
Ans: D

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

Where  x=displacement

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

Related questions

14 votes
14 votes
2 answers
2
go_editor asked Sep 29, 2014
4,763 views
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...
36 votes
36 votes
6 answers
3
go_editor asked Sep 29, 2014
10,713 views
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 $\tex...
25 votes
25 votes
5 answers
4
go_editor asked Sep 29, 2014
5,058 views
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...