1,068 views
0 votes
0 votes

Consider 4-stage (IF, ID, EX, WB) pipeline used to execute the following code. All instructions are spending are spending one cycle on all the stages but ALU instructions are spending 3 cycles on  3rd  stage.

I1: LOAD R0, [2000]

I2: ADD R2, R0, R1

I3: SUB R3, R2, R1

Number of cycles are saved using operand forwarding over without operand forwarding is?

Can someone please explain by drawing the diagram?

 

1 Answer

3 votes
3 votes

Without Operand Forwarding:

$\begin{array} {|r|r|}\hline 1 & 2 & 3 & 4 & 5&6&7&8&9&10&11&12&13&14 \\\hline IF & ID & EX & WB \\ \hline & IF& -- & -- & ID & EX & EX & EX & WB &  &  & & &  \\ \hline  & & -- & --& IF& --& -- &-- & --& ID & EX & EX& EX& WB \\ \hline \end{array}$

With Operand forwarding:

Assuming Operand forwarding is from EX to EX stage

$\begin{array} {|r|r|}\hline 1 & 2 & 3 & 4 & 5&6&7&8&9&10\\\hline IF & ID & EX & WB \\ \hline & IF& ID &EX & EX & EX & WB&    \\ \hline  & & IF & ID& --& --& EX &EX& EX& WB  \\ \hline \end{array}$

So cycles saved = 14-10 = 4

edited by

Related questions

287
views
1 answers
0 votes
Deepak9000 asked Nov 5, 2023
287 views
I have a Self doubt question on Operand Forwarding . The data forwarded should be done in EX-EX stage or Mem-EX ? Which one to follow and when ?Using EX-EX we require less no. of cycles.
1.2k
views
0 answers
0 votes
Na462 asked Sep 3, 2018
1,195 views
I dont understand here:- Load R2,(R3)1. Fetch2. Decode: Rz <--- Address of R3 given in instruction3. Compute : NOP4. Memory Memory address <---[RZ] , read ... at Cycle 5 but there is extra stall at cycle 6 for Instruction j+1 why ??
21.7k
views
1 answers
17 votes
dd asked Jan 8, 2017
21,650 views
A $5$ stage pipelined processor has the following stages:$IF$ : instruction fetch$ID$ : instruction decode$EX$ : execute$MA$ : memory access$WB$ : ... No. of cycles needed to execute these instructions using operand forwarding?
1.3k
views
2 answers
0 votes
Abhilash Mishra asked Jan 2, 2019
1,309 views
Data forwarding is used to avoid which type of conflict??(1) RAW(2) WAR(3) WAW(4) RAR