2022 23 3b

Computer Organization and Architecture2022-2310 marksNumericalProcessor organization, general registers organization, stac

What is an effective address? How it is calculated in different types of addressing modes? Explain.

What is an effective address? How it is calculated in different types of addressing modes? Explain.

The effective address (EA) is the actual memory address of the operand. An instruction has an opcode and an address field. In some modes the address field is already the address, but in others it has to be changed by adding a register, or by reading memory, before the true address is known. The addressing mode tells the CPU how to do this. The EA is found by the CPU at execution time.

Calculation in the common modes

In direct addressing the address field gives the address, so

$$EA = A$$

In indirect addressing, the address field gives the location of a word that holds the address, so

$$EA = M[A]$$

In register indirect addressing, a register holds the address, so

$$EA = (R)$$

In relative addressing, the address field is added to the program counter, so

$$EA = PC + A$$

In indexed addressing, the address field is added to an index register, so

$$EA = A + (XR)$$

In base register addressing, an offset is added to a base register, so

$$EA = (BR) + A$$

In immediate addressing there is no effective address, as the operand is in the instruction. In register addressing, the operand is in the register, so no memory address is needed either. In autoincrement mode, EA is the register's value, and then the register is increased.

Worked example

Take an instruction located at 200, with the address field 500 at location 201. Let the register $R = 400$, the index register $XR = 100$, and $M[500] = 800$. After the fetch, $PC = 202$.

$$\text{Direct: } EA = 500$$

$$\text{Indirect: } EA = M[500] = 800$$

$$\text{Register indirect: } EA = 400$$

$$\text{Relative: } EA = 202 + 500 = 702$$

$$\text{Indexed: } EA = 500 + 100 = 600$$

Therefore the same instruction reads from five different locations, depending on the mode.

ModeEAMemory accesses for the operand
DirectA1
IndirectM[A]2
Register indirect(R)1
RelativePC + A1
IndexedA + (XR)1
Immediatenone0
Registernone0

A note on the mode with autoincrement: it is useful when a loop reads one array element after another. The register points to the element, the instruction uses it, and the register moves on to the next element by itself. This saves a separate add instruction each time.

Direct addressing is simple. Indirect addressing gives a bigger address range and allows pointers, but it is slow. Indexed and relative modes help with arrays and branches. The right mode makes the program shorter and flexible.

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

Up nextDescribe the derivation procedure of look ahead carry adder by an example with the help of