edited by
5,943 views
30 votes
30 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
edited by

1 Answer

Best answer
46 votes
46 votes
  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
Answer:

Related questions

56 votes
56 votes
5 answers
1