执行以下循环所需的循环数是多少?

What is the number of cycles needed to execute the following loop?

Consider a 4 stage pipeline processor. The number of cycles needed by the four instructions I1, I2, I3, I4 in stages S1, S2, S3, S4 is shown below:

    S1    S2    S3    S4
I1  2     1     1     1
I2  1     3     2     2
I3  2     1     1     3
I4  1     2     2     2 

What is the number of cycles needed to execute the following loop?

For (i=1 to 2) {I1; I2; I3; I4;}

选项是:

  1. 16

  2. 23

  3. 28

  4. 30


我的解释:


我哪里错了?

使用以下时间轴时,我得到 23 个周期:

答案应该是 23 个周期... 从时间线10开始你就错了