retagged by
609 views
2 votes
2 votes

A two word instruction is stored in memory at an address designated by symbol $S$. The address field of the instruction (stored at $S+1$) is designated by symbol K. The operand used during the execution of the instruction is stored at an address symbolized by the $P$. Which of the following is/are correct if the addressing mode used is the relative addressing mode?

  1. $P = M[ M[S] ] + K$
  2. $P = M[K+1] + S$
  3. $P = M [S ] + (K + 2)$
  4. $P = (S + 2) + M [ K ]$
retagged by

3 Answers

Best answer
4 votes
4 votes

 question is saying about the 2-word length and yes it has clearly mentioned that it is the relative mode of addressing. 

  relative addressing is just for displacement means it transfers the control to its effective address.

   

    example: jump, -24  ,

   +----+   ------------------------------+
    | jump |           offset                |          
   +----+   ------------------------------+
    

        S: jump
     S+1: -24  here it is given that K = s+1 , while excuting this instruction pc= k+1;


   (Effective PC address = next instruction address + offset, offset may be negative)
and it's given that effective address (address, where the operand is present ) is P.

so, p = pc +M(s+1)

         =( k +1) +M(k)

        =(s+1+1) + M(k)

      so, (S+2) + M[K]   option D

selected by
0 votes
0 votes
@bikram sir

explain sir not getting answer.
0 votes
0 votes
Given:

Operand used during the execution of the instruction is stored at an address P.

Instruction is stored in memory at an address S .

The address field of the instruction (stored at S+1) is designated by symbol K means K = S+1 .

In Relative address mode we calculate Effective Address = PC value + Address part

so P = (K + 1) + M[K] ; where M[K] = memory address of K .

Since K = S + 1 is given in the question;

Hence P = ((S + 1)+1) + M[K]

             = (S+2) + M[K]
Answer:

Related questions

0 votes
0 votes
1 answer
1
Bikram asked May 27, 2017
207 views
Match the pairs about implementation and addressing modes:$\begin{array}{|l|l|l|l|} \hline {} & \text{Group A} & {} & \text{Group B} \\ \hline A. & \text{Array} & I. & \t...
0 votes
0 votes
0 answers
2
Bikram asked May 27, 2017
296 views
Match the following:$\begin{array}{|l|l|l|l|} \hline (i) & \text{Base addressing} & (p) & \text{Pointers} \\ \hline (ii) & \text{Indexed addressing} & (q) & \text{Loops} ...