retagged by
1,386 views
3 3 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 ]$

3 Answers

Best answer
4 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 0 votes
@bikram sir

explain sir not getting answer.
0 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:
Position:
Show:

Related questions

0 0 votes
1 answers 1 answer
521
521 views
Bikram asked May 27, 2017
521 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 0 votes
0 0 answers
642
642 views
Bikram asked May 27, 2017
642 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} ...
0 0 votes
1 answers 1 answer
759
759 views
Bikram asked May 27, 2017
759 views
Consider a hypothetical processor that supports two address, one address and zero address instructions. It has a $256$ word memory, and a $20$ bit instruction is placed i...
1 1 vote
1 answers 1 answer
1.2k
1.2k views
Bikram asked May 27, 2017
1,220 views
Suppose in a system we store data using arrays, we have $2$ arrays A1 and A2. Array A1 contains $256$ elements of size $4$ bytes each. The first element is stored at phy...