2
$\begingroup$

I am confused in finding RAW dependencies whether we have to find only in adjacent instructions or non-adjacent also.

consider the following assembly code

I1: ADD R1 , R2, R2;

I2: ADD R3, R2, R1;

I3: SUB R4, R1 , R5;

I4: ADD R3, R3, R4;

FIND THE NUMBER OF READ AFTER WRITE(RAW) DEPENDENCIES IN THE Above Code.

I am getting 2 dependency I2-I1 and I4-I3.

$\endgroup$
1
  • $\begingroup$ I'd say it includes non-adjacent instructions. For example, in a 5-levels pipeline (F-D-E-M-W), there is 2 cycles between exectution and registers updates. $\endgroup$
    – Grabul
    Commented Sep 27, 2015 at 22:12

1 Answer 1

1
$\begingroup$

Adjacency is not relevant for determining Read-After-Write dependences. You simply list all the instructions where one of the source registers reads the value produced by some previous instruction.

So (assuming that your assembly language is OPERATOR DEST SRC1 SRC2) you are missing, for example, that the first source operand of I3 dependends on the value written by I1. (You are missing several others as well.)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.