retagged by
591 views
0 votes
0 votes
There is a $5$ stage Instruction pipeline, which takes $1$ $ns$ to execute each cycle. There are $4000$ branch instructions with a delay of $2$ clock cycles and $6000$ normal instructions ( They get completed in $5$ stages). What will be the total execution time taken by a pipelined processor?

Answer:

$P$ = total no. of normal instructions,

$Q$ = total no. of branch instructions,

$S$ = No. of cycles required to execute first instruction then,

In pipelined processor time to execute $6000$ instructions will be = $S - 1 + P$ = $4 + 6000$ = $6004$ $ns$

My branch instruction takes $2$ stalls per instruction => It means it will require total of $7$ cycles to complete.

Therefore, Time taken to execute branch instruction will be  = $S - 1 + Q$ = $4006$ $ns$

Hence the total time for execution will be $6004 + 4006 = 10010$ $ns$

Is this a correct answer and right way to solve such problem?
retagged by

2 Answers

Best answer
1 votes
1 votes
Total Instruction $=6000+4000=10000$

$\% \text{of branch instructions=}\frac{4000}{10000}=.4$

Net CPI$=1+(.4 \times 2)=1.8(\text{.4% of branch inst. and 2 clock cycle for delay i.e stall})$

Execution time $=(10000-1+5)\times 1.8 \times 1 nsec=18007.2ns$
edited by
1 votes
1 votes
branch delay=> 2 i.e 2 slot are wasted to know where to branch.

cpi bcz of branch instruction= 1+ $\frac{4000}{10000}$ * 2 = 1.8

execution time= (5+9999)1.8*1=18007.2

Related questions

0 votes
0 votes
1 answer
2