2.1k views

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

edited | 2.1k views
+1
I think in 4th instruction RHS should be

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

in i) data forwarding is used

https://gateoverflow.in/3689/gate2004-it-46

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

by Active (5k points)
edited by
0
why option ii is not correct ..??

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

Loc is not having same data as R1.

+1
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 ??
0
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.
0
then how i is true?
0
it is a copy operation, so loc should also contain the data.

RHS of (ii) is not doing that.
+1

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

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

And

 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 ??

+17

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.

0
got it thanks :)
0
Gr8 Explanation :)