Skip to content
Related Articles

Related Articles

Improve Article

GATE | GATE-CS-2005 | Question 68

  • Last Updated : 19 Nov, 2018

A 5 stage pipelined CPU has the following sequence of stages:

IF — Instruction fetch from instruction memory,
RD — Instruction decode and register read,
EX — Execute: ALU operation for data and address computation,
MA — Data memory access - for write access, the register read
     at RD stage is used,
WB — Register write back.
Consider the following sequence of instructions:
I1 : L R0, 1oc1;        R0 <= M[1oc1]
I2 : A R0, R0;           R0 <= R0 + R0
I3 : S R2, R0;           R2 <= R2 - R0
Let each stage take one clock cycle.

What is the number of clock cycles taken to complete the above sequence of instructions starting from the fetch of I1 ?
(A) 8
(B) 10
(C) 12
(D) 15


Answer: (A)

Explanation:
If we use operand forwarding from memory stage :

T1T2T3T4T5T6T7T8
l1IFRDEXMAWB
l2IFRDEXMAWB
l3IFRDEXMAWB

If we don’t use operand forwarding :

T1T2T3T4T5T6T7T8T9T10T11
l1IFRDEXMAWB
l2IFRDEXMAWB
l3IFRDEXMAWB

Thus, clock cycles = 8 / 11
Since, 11 is not in the option. So, clock cycles = 8.

 
Thus, option (A) is correct.

 
Please comment below if you find anything wrong in the above post.

Quiz of this Question

Attention reader! Don’t stop learning now.  Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.

Learn all GATE CS concepts with Free Live Classes on our youtube channel.

My Personal Notes arrow_drop_up
Recommended Articles
Page :