retagged by
1,077 views
3 votes
3 votes
An instruction is stored at location $300$ with its address field at location $301$. The address field has a value of $400$. A processor register $R1$ contains the number $200$. If relative-addressing mode is used by the instruction (with $R1$ as index register) then the effective address is _________.
retagged by

2 Answers

Best answer
2 votes
2 votes

In the question it is given that , an instruction is stored at memory location 300  and the memory address of that instruction is stored at memory location 301,

Think like a pointer , this will clear the  meaning of this line.

Now the  minimum size of an instruction is 2 word, we assume this value.

When this instruction was fetched by Program Counter  , program counter was assigned with 302 as memory address of the next instrudtion. Because Program counter ALWAYS STORE MEMORY ADDRESS OF THE NEXT INTRUCTION THAT IS GOING TO EXECUTE !!!

hence Program counter now have value 302 . 

the value of the address field is 400 means the memory address which store  at location 300 have memory address 400 which is store in memory location 301.

Now Effective Address is:

PC's Value + Value contained in address part = 302+400 = 702. 

selected by
2 votes
2 votes

PC relative mode is especially used for branching.

The branch address specified by the instruction is added to the contents of the PC (Program Counter).

 

An instruction is stored at location 300 with its address field at location 301.

This simply means that starting address of the instruction is at location 300, and it spans till location 301. ie, One instruction occupies two memory locations. (Some part stored at 300-301, remaining portion stored at 301-302)

 

What does PC point to?

At first PC must have pointed to 300, that's how it reached this instruction.

Now, as soon as this instruction got fetched, PC started to point at the next instruction.

Where is the next instruction stored? 301? No. Because 301 has some portion of the former instruction.

The next instruction is at 302.

So, PC points to 302.

 

Now branch address = 400. (given)

 

So, Effective memory address = 400 + 302 = 702.


R1 contains the number 200. If relative-addressing mode is used by the instruction (with R1 as index register)

This information is irrelevant here. We don't need any index registers in PC relative mode.

Index registers are used in Indexed Mode.

Answer:

Related questions

0 votes
0 votes
1 answer
1
Bikram asked Nov 25, 2016
224 views
What is the addressing mode of the below mentioned instruction?$’\text{MUL } \ R1, \ \#2’$ Indirect Indexed Immediate Direct
1 votes
1 votes
4 answers
2
1 votes
1 votes
3 answers
3