Consider a four stage pipeline, and each stage has delays D1, D2, D3 and D4, so the total delay because of the various stages should be N * (D1 + D2 + D3 + D4)
where N is the number of instructions, but I see that this is not the case, I see here that the delay is calculated as N*max(D1,D2,D3,D4)
, why is only the max value taken into account ?
I try to apply the above two ideas for the below chart and none of them work.
For the below chart consider that the numbers on top are the time and the S1, S2, S3 and S4 denote the time spent any stage of an instruction on the pipeline
with N*(max(S1,S2,S3,S4)) = 4*(4) = 16,
and with N*(S1 + S2 + S3 + S4) = 4*(1+2+4+1) = 32
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
S1 S2 S2 S3 S3 S3 S3 S4
S1 S2 S2 S3 S3 S3 S3 S4
S1 S2 S2 S3 S3 S3 S3 S4
S1 S2 S2 S3 S3 S3 S3 S4