The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
0 votes
85 views
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 | 85 views
0
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.
0
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.
0

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

1 Answer

0 votes

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)
0
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.
0
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.
0

@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.

0

@aambazinga

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
48,515 questions
52,763 answers
183,377 comments
68,234 users