4.3k views

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?

edited | 4.3k views
+1
Answer can never be A or B.

+1
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"?
+1
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.
0
Why is it not register addressing?
0
Why not option C ?
+7

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)  -
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.

0
why not register indirect?
0
@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
0
same question appeared in ISRO 2017 dec..
0

Purple

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

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

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

Hope, this will help!

0
why not immediate mode?
+2

Why not reasoning for the answer be like,

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

+2
@Hemant . By standard we assume that the constant in the address field represent then Base address  and the index register contains index value.
0
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?
0

@Arjun

sir, why not option C ?

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

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.

0
Very good
–1 vote
option d
Ans: D

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

Where  x=displacement

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

1
2