edited by
2,009 views
1 votes
1 votes

anyone elaborate the reason for each stall cycles.

edited by

1 Answer

1 votes
1 votes
Instruction 1 2 3 4 5 6 7 8 9 10 11 12 13 14
lw $1, 40($6) IF ID EX M WB                  
add $2,$3,$1   IF _ _ ID EX M WB            
add $1,$2,$6         IF _ _ ID EX M WB      
sw $2,20($ 4)               IF ID EX WB    
and $1,$1,$4                 IF _ ID EX M WB

In this question, there is no forwarding technique used.

So, here we can only use split phase.

  • In 1st instruction, that is a LOAD instruction. So, we get value of instruction at last of MEM stage.
  • 2nd instruction depend on 1st instruction.So, decode (reading) phase of 2nd instruction starts after MEM stage of 1st instruction.
  • 3rd instruction depend on 1st and 2nd instruction. 3rd instruction is simply another ADD instruction .So, writing of 2nd can do in same cycle of reading of 3rd instruction, where writing done 1st half of cycle and reading in last half of cycle.
  • 4th instruction depend on 2nd instruction. So, no stall require here.
  • 5th instruction depend on 3rd instruction. So, writing of 3rd can do in same cycle of reading of 5th instruction, where writing done 1st half of cycle and reading in last half of cycle.So, one stall in this instruction too.

 

So, total these 14 cycles are present

edited by

Related questions

0 votes
0 votes
1 answer
3