+2 votes
332 views
Adding a constant to the content of register

Is it

a)Immediate mode or b) Indexed mode?
asked | 332 views
+1
The address of the operand is obtained by adding to the contents of the general register (called index register) a constant value.

It is index mode

## 1 Answer

+3 votes
Best answer
The question is very much incomplete. Informally, I would say it depends. If this addition (Adding a Reg content to a constant) leads to computation of "effective address or address", then that means the instruction uses Indexed AM . But if the addition(Adding a Reg content to a constant) is done to fetch/manipulate the Data then that would mean the instruction uses Immediate AM (for Constant).

Say, $ADD \,\,R \,\,30 \,\,\,\,|\,\,\, R\leftarrow R+30$  // Immidiate AM

$ADD \,\,R_0,R_1, \,\,3000 \,\,\,\,|\,\,\, R_0\leftarrow M\left [R_1+3000 \right ]$  // Indexed AM

So, these things are very much Context Dependent. Unless each required information is given, the answer can't be given precisely.

There are Questions in Previous GATE papers where Different learned people give different answers because the question isn't self-contained and thus, the answer depends on what interpretation GATE professors take outta it.
answered by Boss (25k points)
edited
+1
ok

constant can be added in indexed mode and also immediate mode both depending on situation

when register containt added with constant value and stored as memory address, then it will be storing memory address as register. So, it is indexed addressing mode

1)  when register containt added with constant value and stored in another register, then it will be indexed addressing mode.Is it not an effective address calculation?

then how will it be addressing mode?

2)  Is there any possibility that constant can be added with indirect or direct addressing mode too?
+1

An addressing mode specifies how to calculate the effective memory address of an operand by using information held in registers and/or constants contained within a machine instruction or elsewhere.

Addressing mode is about calculating the effective memory address. Now in immediate addressing mode we directly provide operand so there will be no effective address calculation.

IN index absolute addressing mode :- address provided + index value in index register (constant value ) .

ans is 2nd according to me

https://en.wikipedia.org/wiki/Addressing_mode#Indexed_absolute

+1

constant can be added in indexed mode and also immediate mode both depending on situation

No, Constant is Not added in immediate AM. In your original Question, You had asked "Adding register content to a Constant", For that I had said that "If this addition is done to get/fetch/manipulate the Data rather than Address, then that would mean "this Constant that you are adding, is itself an Operand. (i.e. Immediate AM)"

when register content added with constant value and stored in another register, then it will be indexed addressing mode?

No, when register content added with constant value and stored in another register, then it will be Two AMs, Register AM and Immediate AM.

You must be talking about this following example.

$ADD \,\,R_0,R_1, \,\,3000 \,\,\,\,|\,\,\, R_0\leftarrow M\left [R_1+3000 \right ]$  // Indexed AM

Here, We indeed are adding Register content with constant But we are Not storing that in another register directly. We  are adding Register content with constant to get the address where the Operand is available.

See, Addressing Modes (Sticking to Data Centric AMs) only specify or giver information about the "Address" of the Operand/Data. One just can't see the Instruction and tell which AM has been used in that instruction Unless the specification/Working of that instruction has been given.

Is there any possibility that constant can be added with indirect or direct addressing mode too?

Unless one (Author/Manufacturer) defines these AMs in some other way, No, Conventionally We don't define these AMs where Constants are added to them in order to get the final Effective Address. But if you talk about "Possibility", Yes, Possibility is there Because Note that there is no generally accepted way of naming the various addressing modes. In particular, different authors and computer manufacturers may give different names to the same addressing mode, or the same names to different addressing modes. Furthermore, an addressing mode which, in one given architecture, is treated as a single addressing mode may represent functionality that, in another architecture, is covered by two or more addressing modes.

I don't want to Confuse anyone. Just Stick to the Conventional Use of Different AMs unless in GATE they "specify" it otherwise.

0

ans is 2nd according to me

Since the Question isn't self-contained and is incomplete, One is open to interpret it in different ways, leading to many different answers.  So, I would say It is more of a Doubt on AMs rather than a Question(which damands one word Answer).

0

https://gateoverflow.in/182093/isro-dec2017-43

why here ans is not immediate addressing mode?

because we are calculating effective address

rt?

+2
It would be Immediate AM if That value "20" itself acted as Second Operand. You can think of Immediate AM as "The Instructions Itself is the Address of One Operand" i.e. To get the Operand, You don't need to go anywhere But the Instruction Itself will provide you with the value of the Operand.

In the Question (the link), The constant 20 is being added to the register content to get the Effective address of the Operand. Now to get the value of the Operand, we need to go to that Effective Address. So, Operand Value is not directly available in the Instruction, Thus Not immediate AM.

+1 vote
1 answer
3
+5 votes
0 answers
4
+1 vote
1 answer
5
+4 votes
0 answers
6
+2 votes
0 answers
7