Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
439 views
in Technique[技术] by (71.8m points)

architecture - Find the effective addresses

I am learning Computer organization and architecture. While studying effective addresses and various addressing modes, I have a doubt.

Let us suppose, A two-word instruction is stored in memory at an address designated by the symbol P. The address field of the instruction (stored at P+1) is designated by the symbol Q. The operand used during the execution of the instruction is stored at an address symbolized by EA. An index register contains the value X. What will be the EA if the addressing mode of the instruction is

  1. direct
  2. indirect
  3. relative
  4. indexed
question from:https://stackoverflow.com/questions/66058638/find-the-effective-addresses

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The memory reference for the instructions and addresses are designate

? A two-word instruction is stored in the symbol W.

? The address of the symbol is stored in W+1 and it is named as Y.

? W+2 is the address of the next instruction. PC is used to fetch the address of next instruction which is to be executed.

? The operands used by the instruction are addressed by a symbol Z.

? The value specified by the operand is stored in the index register which is named as X.

Now, to get the operands used for the execution, need to determine the symbol Z which is shown below with the addressing modes:

In Direct addressing mode, address field of the instruction directly gives the address of the operand. Therefore Y directly gives the address of Z.

Therefore Z=Y is the direct addressing mode of instruction to calculate the Z.

In Indirect addressing mode, the address filed of the instruction gives the address in which the effective address is stored in the memory.

Here, the effective address is stored in M[Y] and it gives the address of operands executed by the instruction.

Z = M[Y] 

In Relative addressing mode, the address filed of the instruction is added to the contents of the PC. Here PC indicates the address of next instruction which is Y (i.e. W+1). It will give the address of operands executed by the instruction.

Z = W + Y 

In Indexed addressing mode, the value specified by the index register is added to the address specified by the instruction. It will give the address of operands executed by the instruction.

Z = X + Y 

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...