The Gateway to Computer Science Excellence
+22 votes

Data forwarding techniques can be used to speed up the operation in presence of data dependencies. Consider the following replacements of LHS with RHS.

  1.  $R1→ Loc, Loc→ R2 \quad ≡  R1→ R2, R1 → Loc$
  2.  $R1→ Loc, Loc→ R2 \quad ≡ R1→ R2$
  3.  $R1→ Loc, R2 → Loc \quad ≡ R1→ Loc$
  4.  $R1→ Loc, R2 → Loc \quad ≡  R2→ Loc$

In which of the following options, will the result of executing the RHS be the same as executing the LHS irrespective of the instructions that follow ?

  1. i and iii
  2. i and iv
  3. ii and iii
  4. ii and iv
in CO and Architecture by
edited by | 2.5k views
I think in 4th instruction RHS should be

R2 --> Loc. Than the option B will be tha right ans.
I am thinking why term "forwarding techniques" is used in this question. Could it change answer ?

in i) data forwarding is used

What does it mean by "irrespective of the instructions that follows"?

Acc to me it mean either we follow lhs or rhs instructions result should be same.

1 Answer

+31 votes
Best answer
  1. is true. Both $LOC$ and $R2$ are getting the value of $R1$ in $LHS$ and $RHS$.
  2. false, because $R2$ gets the correct data in both $LHS$ and $RHS$, but $LOC$ is not updated in $RHS$.
  3. is wrong because $R2$ is writing last, not $R1$ in $LHS$, but not in $RHS$.
  4. is true. The first write to $LOC$ in $LHS$ is useless as it is overwritten by the next write.

So, answer is (B).

edited by
why option ii is not correct ..??

R1 -> loc, loc -> R2  ==> R1 - > R2.

Loc is not having same data as R1.

but first we are copying the content of R1 into 'loc' and then copying same data of 'loc' into R2. So it should be equivalent to copying the content of R1 into R2.

Isn't it ??
what u r saying is correct since rhs show R1 ,R2 contain same data but loc contain any data . but lhs says loc also contain R1 data.
then how i is true?
it is a copy operation, so loc should also contain the data.

RHS of (ii) is not doing that.

@Kapil Sir .. I didn't understand .... can you please tell me ... what is happening in-

 R1→ Loc, Loc→ R2  ≡              R1→ R2, R1 → Loc


 R1→ Loc, Loc→ R2  ≡  R1→ R2


If you say Loc  does not contain data in case of 2nd one  then what does it contain in 1st one where Loc→ R2 is happening ??



See , Ex--> (i) R1 has value 5 ,and transfer(store) that value to some memory address(Loc = 3000) 

Now, at some time, suppose a new program or same program only wants that value to load in some register say R2.

This time we didn't load it into R1, because data of R1 will be needed in future .Now, R1 = R2 = 5 = LOC (3000)

RHS is also doing the same thing.

(ii) LHS is saying load 5 in all  , but RHS says, no need of LOC .

So, we are not sure about what LOC contains. IN this statement, there is no role of LOC. so, how can we say LOC contains 5 or any other garbage value.

got it thanks :)
Gr8 Explanation :)

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
52,315 questions
60,438 answers
95,269 users