The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+15 votes
2k views

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 "call Rn, sub” is a two word instruction. Assuming that PC is incremented during the fetch cycle of the first word of the instruction, its register transfer interpretation is

Rn <= PC + 1;

PC <= M[PC];

The minimum number of CPU clock cycles needed during the execution cycle of this instruction is:

  1. 2
  2. 3
  3. 4
  4. 5
asked in CO & Architecture by Veteran (99.2k points)
retagged by | 2k views
What is S and T here?
Can u explain how 3 cycles??

Before looking at explanation first think --->

  • First check given architecture carefully.(means check various component and their functionality )
  • What are all micro-instruction required.
  • How many of them could be done in parallel. 

I think keeping these things in mind proper answer could be obtained.

6 Answers

+23 votes
Best answer

$MAR$ $\leftarrow $ $PC$ ..... $1$ cycle
$S$ $\leftarrow $ $PC$ (Since these two actions are independent they can be done in same cycle)
$MDR$ $\leftarrow $ $M[MAR]$ ..... $2$nd cycle (System BUS)
$RN$ $\leftarrow $ $S +1$     (ALU Is free and the two actions are independent.) (Internal BUS)
$PC$ $\leftarrow $ $MDR$ ----- $3$rd cycle

Therefore $3$ cycles needed.

A rough sketch:

answered by Boss (7.2k points)
selected by
In the second cycle S + 1 will be calculated but the result of increment can't be stored in the RN in the same cycle along with MDR <- M[MAR] as this will bring two different data on the bus in the same clock cycle.
can someone elaborate?? i am unable to understand this concept.
Even I think so. So it should be 4 cycles. I m unable to understand 3 cycles as answer
@sushmita, Why 4 cycles ?

Tell me what will happen if i enable $\text{PC}_{out} \text{, MAR}_{in} \text{, and S}_{in}$ ?

Enabling  $\text{PC}_{out}$ means content of  $\text{PC}$ is available on Dta Bus, now at the same time if i enable $\text{ MAR}_{in} \text{, and S}_{in}$ that means content of $PC$ will be loaded into  $\text{MAR}$ and  $\text{S}$.

Yes we can load PC value (or any register value) to many registers in ONE cycle.

$T_0$ : $ MAR \leftarrow PC \\ S \leftarrow PC$

$T_1$ : $ MDR \leftarrow M[MAR] \text{  Operation on system bus (address bus)}

\\ R_N  \leftarrow S+1  \text{  Operation on internal bus }$

$T_2$ : $PC \leftarrow MDR$
Thanx sachin. That was my doubt. i was confused about the 2 buses.
how to  know whether the question assumes different buses?
Welcome :)
Question does not assume anything, it is ALWAYS the case that system bus and internal buse needed everywhere.
System Bus: To let interact the CPU with external components. eg- Memory, I/O.
Internal Bus: To let interact the CPU with internal components. eg- Register file, ALU.
When do we load 1 in to temporary register to add it with PC?will it not take any extra cycle ,loading an immediate data?Or we are assuming it is already loaded ?

It is mentioned that  increment operation ALU is used ,but still we need to load 1 into T,when are we loading that 1 into T ?As T is connected to bus so it must come via bus.

Please someone clear this doubt
@rahul

what I am getting there are not separate clock cycles for each instruction

Fetch is taking 2 clock cycles and execute takes 1 clock cycle
@srestha ,my doubt is how 1 is loaded into the second operand of ALU while incrementing PC
what is the best source to read about control unit design and CPU organization..?
+3 votes

1)PCout ,MARin,Rin

2)MDRout ,PCin

2 cycles to read

so total 3  cycles

answered by Veteran (33.3k points)
edited by
can you explain your answer somewhat..as i am not able to understand any of the answers.
+3 votes

Rn <= Pc+1

Pc<= M[Pc]

The sequence of instruction take place 

 

I Cycle : PC out  , Sin , MARin (MAR can be loaded with PCout

II Cycle: S out  , ALUincrement  , Rn in

III Cycle: MDRout  ,   PCin  (MDRout can be performed once MARin has been performed)   therefore 3 cycle required

 
answered by Veteran (15.4k points)
why we need to store PC value in MAR and Sin??and can we transfer PC content to Sin and MAR in same clock cycle?

Thanks
Obviously we can store in same clock because once the content of PC is on bus both the registers MAR and S can activate their load input to take the data on the bus.
+2 votes

In this question PC and GPR are carried out in the ALU.

So, PC and GPR performing write operation.

"call Rn, sub” - here subroutine call is performing , which is a memory read operation

And each memory read operation takes 2 clock cycle.

Then operation is performed in ALU.

Next operation will be

Rn <= PC + 1;

PC <= M[PC];

i.e. PC is incremented which requires no clock cycle.

Next PC value will be that memory location and according to the question it is a write operation. It is the 3rd step of Fetch cycle. So, it requires 1 clock cycle.

Total 3 clock cycle

 

 

answered by Veteran (70.4k points)
No. Here we have an indirect memory access M[PC]. So, PC content must be moved to MAR and then memory read needs to be done and read content moved to PC. See the answer by Pooja, other stuffs like also happen but these are the important ones to get answer here.
In this question us memory bus separate from the data bus shown in the diagram?
@Arjun Sir

Pc increment is done by Add instruction or is it other instruction which increments PC by 1.If it is a add instruction then we need to load data into  i.e 1 in T register also.And if it is INC instruction then it always increment by one.But word length can be more than one?I understand that ALU will not consume any extra cycle but the way we have loaded PC into S register,the same way why havent we loaded 1 into T register?
@Arjun sir what does this line means PC is incremented during the fetch cycle of the first word of the instruction..? And why aren't we considering for second word of this instruction in our execution cycle..?I am bit confused please clear the question to me..thanks in advance sir
+1 vote
1 cycle: Pc out->S in, MAR in,

2 cycle: S out => ALU increment

3 cycle:  MBR out => Pc in

so it must be 3 cycle
answered by Boss (9.8k points)
+1 vote

$T_0$ : $ MAR \leftarrow$ PC (via system bus)since MAR connected through System bus  

          $ S \leftarrow PC$ ( via internal nus)

$T_1$ : $ MDR \leftarrow M[MAR]$ {  Operation on system bus (address bus)}

$\\ R_N  \leftarrow S+1  \text{  Operation on internal bus }$  {can also be done with 3rd cycle}

$T_2$ : $PC \leftarrow MDR$ ( via system bus)

Note: MAR and MDR are Connected through System bus cannot done in One Cycle.

answered by Veteran (55.6k points)
When doe we load 1 in to register for adding it to PC.As they have said ALU will do increment so ALU will take data from S and T register,when will we load 1 into T?
@Prashant.
In Cycle To

"T0 : MAR←PC (via system bus)since MAR connected through System bus  
    S←PC ( via internal nus)"

You have done a mistake here as MAR and PC are not connected via system bus but by internal bus
We are actually performing this operation in clock T0 by putting the content of PC over internal bus and then enabling Load input of S and MAR in  same clock cycle i.e T0
Answer:

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

29,157 questions
36,984 answers
92,161 comments
34,824 users