number of memory cycles required. (ambiguity in question it2006 )

#it2006q79
ADD R5, R0, R1 ; R5 → R0 + R1
MUL R6, R2, R5 ; R6 → R2 * R5
SUB R5, R3, R6 ; R5 → R3 - R6
DIV R6, R5, R4 ; R6 → R5/R4
STORE R6, X ; X ← R6
The IF, ID and WB stages take 1 clock cycle each. The EX stage takes 1 clock cycle each for the ADD, SUB and STORE operations, and 3 clock cycles each for MUL and DIV operations. Operand forwarding from the EX stage to the ID stage is used. The number of clock cycles required to complete the sequence of instructions is
A) 10
B) 12
C) 14

10Comments
Shubham Sharma @shubhamsharma 15 Jan 2016 12:36 pm

ans is 10 ? 

Parimal Andhalkar @parimal_andhalkar 15 Jan 2016 01:02 pm

 

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
ADD IF ID EX WB                        
MUL   IF - ID EX EX EX WB                
SUB     IF - - - - ID EX WB            
DIV       IF - - - - - ID EX EX EX WB    
STORE         IF - - - - - - - - ID EX WB

16 CLOCK CYCLES REQ.

Parimal Andhalkar @parimal_andhalkar 15 Jan 2016 08:13 pm

@pritam sir  @digvijay  @anuragverma   plz check it

Anurag Verma @anuragverma 15 Jan 2016 08:29 pm

I think your solution is correct.

Pritam Prasun @pritam 15 Jan 2016 08:29 pm

For me, it seems to be perfectly fine. However some recent aspirant may confirm.

Pritam Prasun @pritam 15 Jan 2016 08:43 pm

Just got another thought on it.

As the last instruction is ONLY write, so instruction decode (ID), and Execute (EX) can be ignored WB can be performed in 14th cycle which ultimately will take only 14 Cycle as follows:

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
ADD IF ID EX WB                        
MUL   IF - ID EX EX EX WB                
SUB     IF - - - - ID EX WB            
DIV       IF - - - - - ID EX EX EX WB    
STORE         IF - - - - - - - - WB    

But, this is just intuition based. Requesting some expert's comment. @rbrgate

Satya Prakash @sprp 15 Jan 2016 10:15 pm

I think, in the 14th stage two instruction div and store can not perform write at the same time??

Parimal Andhalkar @parimal_andhalkar 15 Jan 2016 10:49 pm

this question is ambiguous. if someone have key plz check ans. 

Parimal Andhalkar @parimal_andhalkar 16 Jan 2016 12:05 am
  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16  
ADD IF ID EX WB                          
MUL   IF ID EX EX EX WB                    
SUB     IF     ID EX WB                  
DIV       IF     ID EX EX EX WB            
STORE         IF         ID EX WB          

12 CLOCK CYCLES .

it may be ans

Aman chauhan @amanchauhan7172 8 Dec 2016 02:54 pm