edited by
1,185 views
2 votes
2 votes
A pipeline system is affected by branch instruction. The penalty for the branch instruction is $3$ stall cycle, if $33\%$ of instruction is branch instruction and pipeline is operated with a clock of $10$ $ns$ and providing the speed up factor $8$, then the number of stage in pipeline is _______
edited by

4 Answers

Best answer
9 votes
9 votes

If there are M stages and N instructions then without pipelining time taken will be = CPI$_{\text{Non-pipeline}}$*T$_{\text{Non-pipeline}}$

there are M stages ==> if you take T$_{\text{Non-pipeline}}$ = M*T$_{\text{pipeline}}$, then CPI$_{\text{Non-pipeline}}$=1

Total Time in Non-Pipeline Model = M*T$_{\text{pipeline}}$ = M clock cycles where these clocks are of PIPELINE model

Given that,in pipelining where 33% instructions are branch instructions, which will cause 3 stall cycles

∴ 67% are Normal instructions which will take CPI = 1 and 33% instructions will take CPI = (3+1) = 4

 

Total Cycles in Pipeline Model = (% normal ) * (time for normal instructions) + (% for branch ) * (time for Branch instructions)

= 0.67 * 1 + 0.33 * 4 = 0.67 + 1.32 = 1.99

so speed up = $\frac{\text{Cycles in non-pipeline model}}{\text{Cycles in non-pipeline model}}$ = $\frac{M}{1.99}$ = 8

so M = 8*1.99 which is nearly 16 .

edited by
3 votes
3 votes
The answer cannot be in fraction as, they have asked number of stages.

Let say we have 100 instructions.

 67- non branch instructions therefore, each will require only 1 clock, total = 67 clocks

33 Branch instructions , with 3 stalls, therefore each will require 4 clocks Total = 33*4 = 132clocks

Non pipeline system for 100 instruction will require = 100* no, of stages(m).

Speedup = 100m/132+67

m= 15.92 . It cant be 15 as speed up will not 8 then , therefore it has to be 16.
1 votes
1 votes
In pipelining, $Speedup=$ $Stages$  $*$  $efficiency$

 

Efficiency = $\frac{100}{67+33(4)}$

Why so? Because the basic intuition behind finding efficiency is that we compare "what could have been ideally" with "what we actually have"

Ideally, we'll have 1 CPI (therefore 100 for 100 instructions)

But what we actually get is 3 stall cycles per branch => 4 CPI for branches. (1 CPI usual requirement + 3CPI for 3 stalls)

So, Efficiency = $\frac{100}{199}$ $\approx0.5$

 

Since, $Speedup=$ $Stages$  $*$  $efficiency$

=> $8=Stages*0.5$

=> 16 stages.
0 votes
0 votes

Answer : 15.92

Speedup = no. of stages / (1+(%of branch instruction * no. of stall due to branch ))

speedup = n / (1+(0.33*3)) = n/1.99                                 // n is no. of stages

8 = n/1.99 

n = 15.92 

Answer:

Related questions