An instruction format has the following structure:
Instruction Number: Opcode destination reg, source reg-, source reg-
Consider the following sequence of instructions to be executed in a pipelined processor:
Which of the following statements is/are TRUE?
View worked solution
Answer: A
To identify the dependencies, let us first list the destination and source registers for each instruction based on the format Opcode destination, source-1, source-2:
- I1:
DIV R3, R1, R2→ Writes toR3, Reads fromR1,R2 - I2:
SUB R5, R3, R4→ Writes toR5, Reads fromR3,R4 - I3:
ADD R3, R5, R6→ Writes toR3, Reads fromR5,R6 - I4:
MUL R7, R3, R8→ Writes toR7, Reads fromR3,R8
Now, let us evaluate each option:
-
There is a RAW dependency on R3 between I1 and I2:
I1 writes toR3and I2 subsequently reads fromR3. This is a Read After Write (RAW) dependency.
(True) -
There is a WAR dependency on R3 between I1 and I3:
I1 writes toR3and I3 also writes toR3. This is a Write After Write (WAW) dependency, not a Write After Read (WAR) dependency.
(False) -
There is a RAW dependency on R3 between I2 and I3:
I2 reads fromR3and I3 subsequently writes toR3. This is a Write After Read (WAR) dependency, not RAW.
(False) -
There is a WAW dependency on R3 between I3 and I4:
I3 writes toR3and I4 reads fromR3. This is a Read After Write (RAW) dependency, not WAW.
(False)
Thus, only statement A is true.
Free practice · Your answers on this page are not saved.
