There are 5 stages in pipeline.
IF - Instruction fetch
ID - Instruction Decode, read the register
EX - On a memeory reference add up base and offset,
and for arithmetic instruction do the math.
MEM - If load or store access memory
WB - Place the result in appropriate register.
I1 : R0 <- M[loc] IF | ID | EX | MEM | WB |
I2 - R0 <- R0 + R0 | IF | ID | EX | MEM | WB |
I3 - R2 <- R2 - R0 | IF | ID | EX | MEM | WB |
Consider that "Operand Forwarding " has been used.
Solution says :-
Instruction
I1is aLoadinstruction. So the next instruction (I2) cannot fetch untilI1finishes itsEXEstage.
But I think: in MEM stage, the processor accesses the memory and picks the desired word. And in WB stage it updates Registry of Register.
So until MEM stage the processor holds the control of Memory, so I2 will start fetching after MEM of I1.
Which one is correct?
Description of stages has not been given, it is written as per my knowledge.