Consider the 4-stages(S1, S2, S3, S4) pipeline where different instructions are spending different cycles at different stages given below.
| S1 | S2 | S3 | S4 |
---|
I1 | 1 | 3 | 1 | 2 |
I2 | 1 | 1 | 3 | 1 |
I3 | 2 | 1 | 1 | 2 |
I4 | 1 | 1 | 1 | 2 |
(a) How many cycles are required to complete the instructions?
(b) Following loop is executed in the pipeline
for(i = 1; i <= n; i++)
{
I1;
I2;
I3;
I4;
}
The output of the instruction "I2" will be available after _____ cycles for I2.