Consider the following (incomplete) instruction schedule for a MIPS pipeline where loads and stores take three cycles:
0 1 2 3 4 5 6
...
ADDI R1,R1,#1 F D E M W
SUB R4,R3,R2 F D E M W
SW R1,0(R3) F D E M W
...
This is part of a solution to homework problem where we were told that there is only forwarding hardware for ex->ex and mem->ex.
My question is: how does the SW get the correct value for R1? It clearly depends upon the result of the ADDI. But when SW attempts to read R1 from the register file, ADDI has not yet written the result to the register file.
I think this is a fundamental misunderstanding of mine in regards to pipeline registers and forwarding. My guess is that the ADDI could forward the value of R1 via mem->ex forwarding to SW, and it would "hang around", being pushed forward through the pipeline registers until it is needed in the mem stage. But every description I have seen of forwarding to the ex stage involves pushing the result into the ALU, which would be useless here.