The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
+23 votes

Consider the following data path of a CPU.


The ALU, the bus and all the registers in the data path are of identical size. All operations including incrementation of the PC and the GPRs are to be carried out in the ALU. Two clock cycles are needed for memory read operation – the first one for loading address in the MAR and the next one for loading data from the memory bus into the MDR.

The instruction “add R0, R1” has the register transfer interpretation R0 <= R0 + R1. The minimum number of clock cycles needed for execution cycle of this instruction is:

  1. $2$
  2. $3$
  3. $4$
  4. $5$
asked in CO & Architecture by Veteran (59.5k points)
edited by | 4.2k views
In the ques. it is given that one cycle for loading data to MAR and second for read the data from MBR. so firstly we need to fetch the data from memory for which itself requires 4 cycle for both registers bcoz 2 for MAR and MDR for r0 and similarly for r1. so how come the ans. will be 3? plz explain clearly....

No ,it is total 2 clock cycles are needed for memory read operation , 1 clock cycle for MAR ( memory address register ) another clock cycle for MDR ( memory data register ) . But this is part of Instruction cycle , not the execution cycle.

For execution there is 3 cycles only . Question asks minimum number of clock cycles needed for execution cycle .

1 clock cyle for R0 to S

2nd clock cycle for R1 to T

3rd clock cycle for add operation means R0 + R1 .

so for execution only 3 cycles require .
if anyone comes up with a better explanation then please post it.As all explanations are confusing

5 Answers

+23 votes
Best answer

instruction fetch require two cycles but question asks how many clock cycles require for execution part only !

Now for execution:

(1) $R1_{out}, S_{in}\qquad S \leftarrow R0 \quad -1$ $^{st}$ cycle

(2) $R2_{out}, T_{in}\qquad T \leftarrow R1 \quad - 2^{nd}$ cycle

(3) $S_{out}, T_{out}, \text{Add } R0_{in} \quad R0 \leftarrow R0 + R1  \quad -  3^{rd}$ cycle

So, 3 cycles for execution.

As it is asked for only execution cycles no of cycles $=3.$

If it has been asked for instruction cycles then answer will be $5.$

Hence, option B is correct.

answered by Boss (31.4k points)
edited by
It will take Five instructions cycle mean? I didn't get plz
@Bikram sir...sir this question will require 0 fetch cycle as no memory reference there is that the reason..?
@Shubham Shukla 6 , here we are only concerned about the execution cycle which involves fetching the operands into S and T register as shown by the data path and then adding them..

If we talk about entire instruction cycle , then yes we need 5 cycles as in that case we have to instruction fetch cycles also..As we know instruction is stored in memory and memory reference 2 cycles as per the question hence that will be taken into account if we talk about entire instruction execution , from fetching of instruction to writing the sum into register..
thanks habib
@pooja ma'am

@habib sir

I have a confusion regarding the fetch phase. It will take 2 memory cycles to get instruction in MDR.  But to bring the it in IR another 1 cycle or the load control of IR is switched on while a movement from MAR to MDR?

In fetch phase 2mem cycles or 3??

Please help :(
How can we assume zero clock cycle as ALU is a combinatorial circuit having some propagation delay.

Do you mean that ALU operation and bus transfer takes place in the same cycle?
Very nice

Habibkhan, Instruction fetch will be required $3$ cycles here.

1) $MAR<--[PC]$ 

2)Load the data from external memory bus to $MDR$


first two steps for reading the data from memory  into MDR but we need one more cycle to store the instruction into Instruction register.


why are we here not considering fourth cycle for transferring the result from ALU to R0 ?


I have a question regarding two clock cycles taken by two register transfers one R0 to S and other R1 to T, doesn't this take a single clock cycle during EX phase in the Multicycle Datapath of a MIPS CPU, both of these transfers can be done parellely.

Can someone help me understand, how can we know about these three operations (two register transfer and one ALU operation) to be taking 3 clock cycles rather than one or two, by looking at the datapath itself, I can't understand how does these three operations take 1 clock cycle each out of the blue because EX phase in a RISC cpu takes only 1 clock cycle to execute. Please help. Anyone.
+11 votes
S <- R0 ...... 1cycle ( Since the buses are of same size as the

T <- R1 ...... 2nd cycle

R0 <- R0 + R1  ..... 3rd cycle

therefore we need 3 cycles.
answered by Loyal (7.4k points)
will operand fetch not be the part of execution ?

If One wonders why S <- R0 is one cycle. 

It is given,

"Two clock cycles are needed for memory read operation – the first one for loading address in the MAR...."

Means PC to MAR one cyle, and it is given all registers are same size. so  R0 to S also one cycle.

because its register to register operation which doesnt involve memory read operation. We are assuming that operands are present in R0 and R1 already.
+6 votes

R0  <= R+R1

The sequence of instruction take place 

I Cycle : R1 out  , Sin

II Cycle: Ro out  , Tin

III Cycle: Sout  ,   Tout , ALU , Rin therefore 3 cycle required 

answered by Boss (15.7k points)
whats the diff btw execution cycle and instruction cycle??
@akriti sood, Instruction Cycle for fetching of instruction and execution cycle is for execution of instructions. Also, at the same time instructions/operands may be fetched. :). Hope you get it.

Instruction cyle means

  1. Fetch cycle
  2. Execution cycle 
  • PC to MAR
  • MBR to IR
+1 vote

This question seems to confusing , as , the first instrtuction does not require any memory reference ..
So during the execution cycle , it will take only the clock cycles needed for ADD instruction which is not given

answered by Junior (763 points)
@bikram sir Is the above answer correct? Please help.
No, see answer by Umang, if u get something ..

shraddha priya 

For execution there is 3 cycles only require . Question asks minimum number of clock cycles needed for execution cycle .

1 clock cyle for R0 to S

2nd clock cycle for R1 to T

3rd clock cycle for add operation means R0 + R1 .

And nothing saud about ALU operation so we assume no clock cycle needed for ALU operation !!

so for execution only 3 cycles require .

@bikram sir, but one more thing, isn't addition an ALU operation only? If not then what exactly is an alu operation?
YES it is ALU operation, But since here Number of cycle needed for ALU is not given so we take it as 0.

shraddha priya

yes, addition is an ALU operation but in this question no cycle is mention about ALU operation.

so we dont consider any cycle for ALU operation as per question here .

Hope you got my point now why 3 clock cycles is needed .


@Bikram sir, Sir will the result of addition from registers S and T will directly be stored in register R0? Don't we need another clock cycle to transfer this result from accumulator to GPR R0? In that case, this transfer should also be a part of instruction execution cycle?

In the above similar question we are counting writing in the memory as an independent memory cycle in execution phase, then what is the difference between the two questions.

Please explain sir.

0 votes

All the answers here are a tad confusing, I want to share my solution with evidences from the book "Computer Organisation and Embedded System" by Hamacher et al

In the book it is clearly mentioned that

Instruction processing consists of two phases: the fetch phase and the execution phase. It is convenient to divide the processor hardware into two corresponding sections. One section fetches instructions and the other executes them.

The section that fetches instructions is also responsible for decoding them and for generating the control signals that cause appropriate actions to take place in the execution section. The execution section reads the data operands specified in an instruction, performs the required computations, and stores the results.

Considering this in mind we can approach this question with each stage in the Execution cycle to be taking 1 clock cycle each, that is :

Execution Cycle : OF + Compute + WB

OF : 1 clock cycle for Sin←R0 and Tin←R1 both (as both can be done parellely)

Compute : 1 clock cycle for ALUout←S+T

WB : 1 clock cycle for writing the result R0in←ALUout

So in total 3 clock cycles are needed for the Execution cycle.

P.S - We don't have to assume anything at our end until and unless it is explicitly stated in the question, and the statement 

The instruction “add R0, R1” has the register transfer interpretation

doesn't mean that only register operations are to be considered for the clock cycle but it is providing the interpretation for the instruction to be R0 <= R0 + R1 and nothing else, please don't misinterpret it.

answered by (93 points)

How Sin←R0 and Tin←R1  can run in parallel...when the bus is in control of S then how it can be given to T at the same time.


Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

38,111 questions
45,619 answers
49,291 users