2020 21 3a

Computer Organization and Architecture2020-2110 marksNumericalProcessor organization, general registers organization, stac

An instruction is stored at location 400 with its address field at location 401. The address field has the value 500. A processor register R1 contains the number 200. Evaluate the effective address if the addressing mode of the instruction is (i) direct (ii) immediate (iii) relative (iv) register in

An instruction is stored at location 400 with its address field at location 401. The address field has the value 500. A processor register R1 contains the number 200. Evaluate the effective address if the addressing mode of the instruction is (i) direct (ii) immediate (iii) relative (iv) register indirect (v) index with R1 as index register

The effective address (EA) is the memory address from which the operand is finally taken. It depends on the addressing mode. Here the instruction is at location 400 and its address field is at location 401, with value 500. The processor register R1 holds 200.

While the instruction is being fetched, the program counter (PC) moves on. The opcode is read from 400 and the address field from 401. So when the instruction is executed, PC holds the address of the next instruction.

$$PC = 401 + 1 = 402$$

We now go through each mode.

(i) Direct addressing

In direct mode the address field is itself the effective address. There is no calculation.

$$EA = 500$$

The operand is the word stored at memory location 500.

(ii) Immediate addressing

In immediate mode the address field is not an address at all. It is the operand. So the operand is the number 500 and no effective address exists. The processor does not go to memory for the operand, which makes this mode the fastest of all memory-type modes. We may say that the value used is found at location 401, the address field itself.

(iii) Relative addressing

In relative mode the address field is added to the content of the program counter. The PC already holds the address of the next instruction, which is 402.

$$EA = PC + 500$$

$$EA = 402 + 500 = 902$$

The operand is at location 902. This mode is used in branch instructions, because a jump is described as a distance from the present position.

(iv) Register indirect addressing

In register indirect mode the register named in the instruction holds the address of the operand. Here that register is R1.

$$EA = (R1) = 200$$

The operand is at location 200. The value 500 in the address field is not used in this mode.

(v) Indexed addressing with R1 as index register

In indexed mode the content of the index register is added to the address field.

$$EA = 500 + (R1)$$

$$EA = 500 + 200 = 700$$

The operand is at location 700. This mode is used to reach elements of an array. The address field gives the start of the array, and the index register selects one element.

Summary

ModeEffective address
Direct500
Immediatenone, operand = 500
Relative902
Register indirect200
Indexed with R1700

Therefore the five modes give five different results from the same instruction, which shows why the addressing mode matters. One small point: if the question wants the PC value as 401 instead of 402, the relative result would be 901. The standard rule is that the PC is incremented after the fetch, so 902 is the accepted answer.

Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.

Up nextWhat do you mean by processor organization? Explain various types of processor organizatio