The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
0 votes
which addressing mode is faster and why? indirect or relative?
closed with the note: Solved
asked in CO & Architecture by Active (3.2k points)
closed by | 107 views
There are two indirect addressing modes :-

Register Indirect , Memory Indirect .

In register indirect mode , register has address of the memory location .

In PC relative mode , PC has the memory location .

And PC itself is a register . So if Register Indirect and Relative Mode is compared , I don't see why any can be faster than the other[Apart from the case when ALU is used to calculate EA in relative mode]

But Yes Relative is definitely faster than memory indirect , because memory indirect takes 2 memory cycles in the best case.
yeah that's what i think.

since nothing has been mentioned about the type of indirect addressing, we can't compare.

in case of register indirect, 1 memory cycle is common for both of them. they differ in register access( for register indirect) and ALU operation( for relative addressing), so definitely we can't compare, as we don't know if register access is done faster or a simple ALU operation.

@aambazinga  bydefault indirect addressing mode is memory indirect adressing mode.

1 Answer

+1 vote

Indirect addressing mode: Two memory references, one for fetching the operand address and other for fetching the operand.

Register Indirect: One access to register, to fetch the operand address and one memory reference to fetch the operand.

Relative addressing: It is a kind of a displacement addressing, program counter value is added to address to get the effective address. So there is one register access, one addition operation and one memory reference.

So I think relative addressing will be faster than Indirect addressing because of the difference in number of memory references.

Ref: Computer Organization and Architecture 8e by William Stallings

answered by Active (1.3k points)
i don't see any satisfying point as why relative is faster than register indirect?

both have 1 memory access in common.. so ignore that.

now register indirect has 1 register access for effective address calculation, and relative has 1 ALU for effective address calculation. so why are you saying relative faster than register indirect.

it means you are saying that ALU is faster than register access, which is not convincing.. it can be true otherwise. because registers are on the processor chip only, so there is no way it can be done slower than the ALU operation.
Read answer again, I said that "relative is faster than indirect" which was your original question NOT "relative is faster than register indirect". Indirect and register indirect are different modes.

@neeraj33negi you are true according to the diagram you attached.

but there are some some point,

indirect addressing modes can be implemented in two ways--- register indirect and memory indirect.

it's not like when we say "indirect", we consider it as memory indirect.. as you are saying.

i know that the diagram you attached is of stallings, but according to hamacher, indirect means both memory as well as register indirect. if after that you have to specify, then you have to say whether it's memory indirect or register indirect.

all in all, unless mentioned which kind of indirection, the question as well as the answer would be incomplete.



I didn't know that, they have to mention whether it is register or memory indirect. You are right then, answer changes according to the type. :)

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
49,540 questions
54,099 answers
71,006 users