Search code examples
assemblyparallel-processingdependenciescomputer-sciencecpu-registers

RAW, WAW, and WAR dependencies not detected


Consider the following assembly language program:

I1: Move R3, R7      /R3 ← (R7)/  
I2: Load R8, (R3)    /R8 ← Memory (R3)/
I3: Add R3, R3, 4    /R3 ← (R3) + 4/
I4: Load R9, (R3)    /R9 ← Memory (R3)/
I5: BLE R8, R9, L3   /Branch if (R9) > (R8)/ 

This program includes WAW,RAW,and WAR dependencies.Show these.

I have solved this for:

WAW: (I3, I1, r3) -> meaning I3 is dependant on I1 regarding r3

RAW: (I2, I1, r3); (I3, I1, r3); (I4, I3, r3); (I5, I2, r8); (I5, I4, R8)

WAR: (I3, I2, R3)

However I found a solution of the exercise on the internet and it stated that:

•write-write: I1, I3
•read-write: I2, I3
•write-read: I1. I2

I really don't understand how they've come to that solution and why it seems to lack so many RAW dependencies. Which solution is right? Mine or theirs?


Solution

  • Ok, after talking to a couple of guys who know about this kind of stuff, they've confirmed my solution is right and the one from the solutions book is wrong. Also, I've found another solution for the same problem on the net, here's the link: http://www.ida.liu.se/~TDDI03/lecture-notes/seminar-2.frm.pdf

    Hope it helps someone else out there who was stressing out like me! :D