edited by
2,327 views
1 votes
1 votes
A system employs $10$ stage instruction pipeline in which $5$% instruction results in data dependency, $10$% instruction results in control dependency, $2$% instructions results in structural dependency. $10$% instructions are exposed to data and control dependencies. If the penalty for structural dependency is $1$ clock and the penalty for control dependency and data dependency are $3$ clocks and $2$ clocks respectively. The average instruction time is _______ [in cycles]
edited by

2 Answers

Best answer
4 votes
4 votes

let there are n instructions, Normally Pipe line without hazards gives us CPI = 1,

but in this question, there are hazards ==> CPI > 1

 

Number of instructions which cause structural hazards = 2% = 0.02 * n

Given that it cause penalty of 1 clock cycle ===> this instruction cause 1 more clocks as penalty compare to normal instruction 

∴ CPI for this type of instructions = 1+1 = 2

 

Number of instructions which cause Data hazards = 5% = 0.05 * n

Given that it cause penalty of 2 clock cycle ===> this instruction cause 2 more clocks as penalty compare to normal instruction 

∴ CPI for this type of instructions = 1+2 = 3

 

Number of instructions which cause control hazards = 10% = 0.1 * n

Given that it cause penalty of 3 clock cycle ===> this instruction cause 3 more clocks as penalty compare to normal instruction 

∴ CPI for this type of instructions = 1+3 = 4

 

Number of instructions which cause control and data hazards = 10% = 0.1 * n

it means, which cause control hazard, after stalling then it also cause data hazard....

and my assumption is this instructions are not counted twice

Given that it cause penalty of (3+2) clock cycle ===> this instruction cause 5 more clocks as penalty compare to normal instruction 

∴ CPI for this type of instructions = 1+5 = 6

 

Number of instructions which cause none of the hazards = ( n - ( $\frac{(2+5+10+10)}{100}$*n ) ) = ( 1 - 0.27 ) * n = 0.73 * n

Normal instructions are having CPI = 1

 

Average CPI = $\frac{((0.02*n)*2)\;+\;((0.05*n)*3)\;+\;((0.1*n)*4)\;\;+\;((0.1*n)*6)\;+\;((0.73*n)*1)}{n}$

= $((0.02)*2)+((0.05)*3)+((0.1)*4)+((0.1)*6)+((0.73)*1)$

= 0.04 + 0.15 + 0.4 + 0.6 + 0.73 = 1.92

edited by
0 votes
0 votes
stalls for,

data dependency = 2

control dependency = 3

structural dependency = 1

data+control dependency = 2+3=5

ideally it will take 1ns to execute an instruction but considering data dependency stalls it will be

= 1+.05x2

similarly considering control and structural dependency and also data structural = 1 + .05x2 + 0.1x3 +

0.02x1 + 0.1x5 = 1.92ns

Related questions

2 votes
2 votes
1 answer
1
Satbir asked Jan 16, 2019
847 views
5 stage pipeline → 3,6,5,8,4 latencies(in ns).What is average CPI of non pipelined CPU when speed up achieved by to pipeline is 4 ? (ans = 1.23)