edited by
4,096 views
18 18 votes

A machine $\mathcal{M}$ has the following five pipeline stages; their respective time requirements in nanoseconds (ns) are given within parentheses:

  • $F$-stage — instruction fetch ($9$ ns),
  • $D$-stage — instruction decode and register fetch ($3$ ns),
  • $X$-stage — execute/address calculation ($7$ ns),
  • $M$-stage — memory access ($9$ ns),
  • $W$-stage — write back to a register ($2$ ns).

Assume that for each stage, the pipeline overhead is $1$ ns. A program $P$ having $100$ machine instructions runs on $\mathcal{M}$, where every $3$rd instruction needs a $1$ – cycle stall before the $X$-stage. Calculate the CPU time in seconds for completing $P$.

5 Answers

Best answer
22 22 votes
As there are $5$ stages so $1$ instruction will take $5$ clock cycles, now all subsequent
instructions will take $1\text{-}1$ cycle each So,
Now without any stall cycle total cycles are $ 5+(100-1) =104$

Now each $3^{rd}$ instruction is taking one stall cycle So,
Total stall cycles in $100$ instructions are $\dfrac{100}{3}=33$

Total cycle to complete the $100$ instructions are $104+33=137$ cycles.

Max time taken from all the stages are $9\text{ ns}$ and $1\text{ ns}$ is overhead
then $10\text{ ns}$ can be given as clock cycle time
So, total time taken is: $137\times 10=1370 \text{ ns}$   ...:)
edited by
4 4 votes
Tc=Max(among all delay of stages)+Toverhead

Tc=10ns

Time required for one instruction=(1+SF*SP)Tc

Here, SF=0.33 bcz every third out of 100 and SP=1(Stall)

T1st=(1+.033*1)Tc=13.3ns

Therefore for 100 instruction=13.3*100ns=1330ns
2 2 votes
Clock cycle for pipe line is 10 ns,  we take Max time

there is 100 instruction

33 instruction are branch instruction which take CPI=2     , 2 clock cycle to execute

67 instruction are non branching instruction which take CPI=1 ,   1 clock cycle to execute

so ,Total time taken is == 67*1 + 33*2 = 133 clock cycle

and 1 clock cycle is of 10ns

Total time taken as = 1330ns
0 0 votes

"Every 3rd instruction needs a 1– cycle stall before the X-stage"

therefore for 100 instructions , clock cycles will be = 100/3 = 33 clock cycles stalls

And the time taken for each cycle is = max( 9,3,7,9,2) + 1ns of overhead = 9+1 = 10ns

therefore for 33 clock cycles it take =  33 * 10 = 330 ns

 

And the time taken by CPU to execute 100 instructions is

= 1(1st instruction) * 5(CPI) * 10(each clock cycle time)  +  99(remaining 99 instruction) * 1 ( CPI ) * 10(each clock cycle time) 

= 1040 ns

 

Total time taken by CPU = 330 + 1040 = 1370 ns Ans.

 

 

–1 –1 vote
No.of cycles required is (stages+no.of instructions-1)*stage delay

Here max delay is 9ns which will be our stage delay.

5 stages, 100 instructions requires (5+100-1)*9ns = 104*9ns = 936ns

It is also mentioned that every 3rd instruction needs a 1-cycle stall before the X-stage. For 100 instructions extra 100 ns will be added.

So, the required CPU time will be 936+100 = 1036ns.

Please correct me. If it is wrong.
Answer:
Position:
Show:

Related questions

1 1 vote
0 0 answers
913
913 views
go_editor asked Jun 3, 2016
913 views
A network has $125$ stations attached by a dedicated pair of lines to a hub in a star topology. The distance from each station to the hub is $25$ meters, the speed of the...
1 1 vote
3 3 answers
1.4k
1.4k views
go_editor asked Jun 3, 2016
1,381 views
Consider a LIBRARY database consisting of the following entity sets:Book (bookid, title, publishername)Book authors (bookid, authorname)Publisher (publishername, address,...
2 2 votes
0 0 answers
589
589 views
go_editor asked Jun 3, 2016
589 views
Let $T$ be an AVL tree for storing a set of $n$ integers. Insertions and deletions in $T$ can hence be done in $O(\log n)$ time. Given two integers $a$ and $b, \: a < b$,...
1 1 vote
0 0 answers
731
731 views
go_editor asked Jun 3, 2016
731 views
Suppose you have the following three subroutines:$\text{max}(A, i, j)$: returns the index of the maximum among the set of consecutive elements $A[i, \dots, j]$ of the arr...