edited by
35,962 views
88 88 votes
An instruction pipeline has five stages, namely, instruction fetch (IF), instruction decode and register fetch (ID/RF), instruction execution (EX), memory access (MEM), and register writeback (WB) with stage latencies $1$ ns, $2.2 $ ns, $2$ ns, $1$ ns, and $0.75$ ns, respectively (ns stands for nanoseconds). To gain in terms of frequency, the designers have decided to split the ID/RF stage into three stages (ID, RF1, RF2) each of latency $2.2/3$ ns. Also, the EX stage is split into two stages (EX1, EX2) each of latency $1$ ns. The new design has a total of eight pipeline stages. A program has $20\%$ branch instructions which execute in the EX stage and produce the next instruction pointer at the end of the EX stage in the old design and at the end of the EX2 stage in the new design. The IF stage stalls after fetching a branch instruction until the next instruction pointer is computed. All instructions other than the branch instruction have an average CPI of one in both the designs. The execution times of this program on the old and the new design are $P$ and $Q$ nanoseconds, respectively. The value of $P/Q$ is __________.

13 Answers

Best answer
96 96 votes

Five stages:

(IF), instruction decode and register fetch (ID/RF),

instruction execution (EX),

memory access (MEM), and register writeback (WB)


P old  design:

with stage latencies $\text{1 ns, 2.2 ns, 2 ns, 1 ns, and 0.75 ns}$

$\text{MAX( 1 ns, 2.2 ns, 2 ns, 1 ns, and 0.75 ns) = 2.2nsec}$

AVG instruction execution time is 

$\text{Tavg=(1+no of stalls$\times $branch penality)$\times $cycle time}$

$=(1+0.20\times 2)2.2$  { branch peanlity is $2$ because the next instruction
     pointer at the end of the EX stage in the old design.}

 $=3.08 \text{ nsec}$


Q :new DESIGN:

the designers decided to split the ID/RF stage into three stages $\text{(ID, RF1, RF2)}$
each of latency $\dfrac{2.2}{3}\text{ ns}$. Also, the $EX$ stage is split into two stages
$\text{(EX1, EX2)}$ each of latency $1\text{ ns}$.
The new design has a total of eight pipeline stages.

Time of stages in new design $=\text{{1 ns, 0.73ns, 0.73ns, 0.73ns , 1ns,1ns, 1 ns, and 0.75 ns}}$

(IF), instruction decode

register fetch (ID/RF) $\rightarrow$ further divided into $3$ ie with latency $0.73$ of each 

instruction execution (EX) $\rightarrow$ further divided int $1\text{ nsec}$ of each)

memory access (MEM)

 register writeback (WB)

$\text{MAX( 1 ns, 0.73ns, 0.73ns, 0.73ns , 1ns,1ns, 1 ns, and 0.75 ns) =1 nsec}$

AVG instruction execution time is 

$\text{Tavg=(1+no of stalls$\times $branch penality)$\times $cycle time}$

$=(1+0.20\times 5)1$ { branch penalty is $5$ because the next instruction pointer
    at the end of the $EX2$ stage in the new design.}

$=2 \text{nsec}$


final result 

$\dfrac{P}{Q}=\dfrac{3.08}{2}=1.54$

edited by
1 flag:
✌ Edit necessary (Ujjwal_Nikam “stalls instead of branch penalty Tavg calculations”)
29 29 votes
cpi for first case $=2.2(1+2\times .2)$ as the stall required is $2$ and $2.2$
is the maximum stage delay.

cpi for second state $=1\times (1+5\times .2)$ as now stall increase to $5$ as
there are five stages before the address is calculated and the maximum stage
delay now is $1.$

$\dfrac{\text{cpu_time1}}{\text{cpu_time2}}=\dfrac{3.08}{2}=1.54$
edited by
7 7 votes
OLD DESIGN :

phase time = 2 ns branch penalty= 2 (since execution is 3rd stage penalty will be of 2 cycles) ,                                                 other than all branch instrucions CPI = 1

branch instrucion = 20% , other instruction = 80%

total execution time = CPI*Phase time

                            = (1+2*.2)*2ns

                          P = 3.08ns

NEW DESIGN :

phase time = 1ns branch penalty = 5 (since EX2 is 6th stage penalty will be of 5 cycles)

total execution time = (1+.2*5)*1ns

                           Q= 2 ns

therefor P/Q = 3.08/2 = 1.54ns
7 7 votes
Old design:

Two bubbles appear in the pipeline when a branch is taken. So clock cycles needed to complete the instruction after a branch is 3. Two cycles wasted by bubbles and one more to actually execute the instruction.

P = (0.8 * 1 + 0.2 * 3) * 2.2 = 3.08 ns

In new design, by the same reasoning, clock cycles for a branch instruction becomes 6. (5 bubbles + 1 )

Q = (0.8 * 1 + 0.2 * 6) * 1 = 2 ns

P/Q = 1.5
2 2 votes

Old case :

stage latencies 1 ns, 2.2 ns, 2 ns, 1 ns, and 0.75 ns .

take MAX( 1 ns, 2.2 ns, 2 ns, 1 ns, and 0.75 ns) = 2.2 ns

P= Tavg(old) = (0.2*3*2.2)+(0.8*1*2.2)= 3.08 ns.  // here 0.2(for brach instn..) , 3(CPI) , 2.2(MAX time delay) , 0.8(non branch) ,   1(CPI),2.2(MAX time delay)

 

New Case :

Time taken in stages ={1 ns, 0.73ns, 0.73ns, 0.73ns , 1ns,1ns, 1 ns, and 0.75 ns}

MAX( 1 ns, 0.73ns, 0.73ns, 0.73ns , 1ns,1ns, 1 ns, and 0.75 ns) =1 ns

Q= Tavg(New) = (0.2*6*1)+(0.8*1*1) = 2 ns   // here 0.2(for brach instn..) , 6(CPI) , 1(MAX time delay) , 0.8(non branch) , 1(CPI), 1(MAX time delay)

P/Q=3.08/2 = 1.54 

 

 

1 1 vote

$T_{avg}$ for old design,

$\text{P = (cycles for unbranched inst + cycles for branched inst ) ×cycle time = (0.8*1+0.2*3)*2.2 ns = 3.08 ns}$

and

$T_{avg}$ for new design,

$\text{Q = (cycles for unbranched inst + cycles for branched inst ) ×cycle time = (0.8*1+0.2*6)*1 ns = 2 ns}$

 

$\therefore \ \frac{P}{Q} = \frac{3.08}{2} = 1.54$

Answer:
Position:
Show:

Related questions

78 78 votes
11 answers 11 answers
33.4k
33.4k views
go_editor asked Sep 28, 2014
33,404 views
Consider a $6$-stage instruction pipeline, where all stages are perfectly balanced. Assume that there is no cycle-time overhead of pipelining. When an application is exec...
47 47 votes
7 answers 7 answers
14.5k
14.5k views
go_editor asked Sep 28, 2014
14,511 views
Consider the following processors (ns stands for nanoseconds). Assume that the pipeline registers have zero latency. $\text{P1:}$ Four-stage pipeline with stage latencies...
9 9 votes
5 answers 5 answers
8.9k
8.9k views
go_editor asked Sep 28, 2014
8,879 views
In the context of modular software design, which one of the following combinations is desirable?High cohesion and high couplingHigh cohesion and low couplingLow cohesion ...
115 115 votes
12 answers 12 answers
43.4k
43.4k views
go_editor asked Sep 28, 2014
43,382 views
The memory access time is $1$ nanosecond for a read operation with a hit in cache, $5$ nanoseconds for a read operation with a miss in cache, $2$ nanoseconds for a write ...