retagged by
479 views
0 votes
0 votes
Consider a 5–stage pipelined processor with stages – Instruction Fetch (IF), Instruction Decode (ID), Execute (EX), Memory Access (MA) and Write Back (WB). All stages except Memory Access takes 1 clock cycle each for all instructions. Memory access takes 3 clock cycles for instruction LOAD. How many clock cycles are needed to execute the following sequence of instructions with optimization?

I0 : LOAD R0, 3(R1) ; R0  ←  [3 + [R1]]

I1 : ADD R2, R0, R1 ; R2 ← R0 + R1

I2 : LOAD R3, 4(R4) ; R3 ←  [4 + [R4]]

I3 : SUB R5, R3, R4 ; R5 ←  R3 – R4

 

ans is 14 bt how?
retagged by

2 Answers

0 votes
0 votes
T1      T2      T3      T4      T5      T6       T7      T8       T9      T10      T11       T12      T13      T14

IF       ID       ID       ID       EX     MA     WB      

          IF        ...       ...        ...       ...         …         ID        EX      MA      WB

                     IF       …        ID       ID       ID         EX       MA     WB

                                 IF                                                                              ID        EX        MA       WB

so overall 14 cycle required instruction I1 is dependent on I0, we can’t used here operand forwarding so stall cycles required and as same instruction I3 is dependent on I2 so here also stalls requires

so ans is 14
edited by
0 votes
0 votes

     

  1 2 3 4 5 6 7 8 9 10 11 12 13 14
I0 IF ID EX MA MA MA WB              
I1   IF ID ID ID ID EX MA WB          
I2     IF IF IF IF ID EX MA MA MA WB    
I3             IF ID ID ID ID EX MA WB

Related questions

0 votes
0 votes
1 answer
2
0 votes
0 votes
1 answer
3
Dknights asked Apr 25, 2023
349 views
Given values:1-level page tableMemory access time =10msPage fault service time=20ms Page fault rate=40% what is the effective memory access time?