COA Mod 1 Part 2
COA Mod 1 Part 2
Fundamental concepts
Instruction cycle
Execution of a complete instruction
Single bus and multiple bus organization
Overview
• Instruction Set Processor (ISP) or Processor
• Central Processing Unit (CPU)
• A typical computing task consists of a series of steps specified by a sequence
of machine instructions that constitute a program.
• An instruction is executed by carrying out a sequence of more rudimentary
operations.
Fundamental Concepts
MDR HAS
TWO
INPUTS
AND TWO
OUTPUTS
• ALU
• Registers for temporary storage
• Various digital circuits for executing different
micro operations. ( gates, MUX, decoders,
counters)
• Internal data path for movement of data between
ALU and registers.
Internal organization
PC: Program Counter
of the processor
❖ Keeps track of execution of a program
❖ Contains the memory address of the next instruction to be
fetched and executed.
MAR: Memory Address Register
❖ Holds the address of the location to be accessed.
❖ I/P of MAR is connected to Internal bus and an O/p to external
bus.
MDR: Memory Data Register
❖ Contains data to be written into or read out of the addressed
location.
❖ It has 2 inputs and 2 Outputs.
❖ Data can be loaded into MDR either from memory bus or from
internal processor bus.
The data and address lines are connected to the internal bus via MDR
and MAR
Internal organization of the processor
Registers: The processor general purpose registers R0 to Rn-1 are
provided for use by programmer, vary considerably from one
processor to another.
❖ Special purpose registers - index & stack registers.
❖ Registers Y,Z &TEMP are temporary registers used by
processor during the execution of some instruction.
Multiplexer: Select either the output of the register Y or a
constant value 4 to be provided as input A of the ALU.
❖ Constant 4 is used by CPU to increment the contents of PC.
ALU: Used to perform arithmetic and logical operation.
Data Path:
❖ The registers, ALU and interconnecting bus are collectively
referred to as the data path.
An instruction can be executed by
performing one or more of the
following operations :
1) Transfer a word of data from one processor register to
another or to the ALU. eg : MOVE Ri, Rj
2) Perform an arithmetic or a logic operation and store the
result in a processor register. Eg : Add Ri, Rj, Rk
3) Fetch the contents of a given memory location and load
them into processor register. Eg : Move [Ri], Rj
4) Store a word of data from a processor register into a given
memory location.
eg: Move Ri,[Rj]
An instruction can be executed by
performing one or more of the
following operations :
MOVE R1, R4
1. R1out=1.
2. R4in=1
• The input and output gates for register Ri are controlled by
signals Rin and Rout .
R1out=1.
R4in=1.
Register Transfers
• All operations and data transfers are controlled by the processor clock.
1. R1out,Yin
2. R2out, SelectY, Add, Zin
3. Zout, R3in
Sequence of Operations : Add R1, R2, R3
Step 1:
• Output of the register R1 and Input of the register Y are enabled, causing the contents of R1
to be transferred to Y.
Step 2:
• The multiplexer’s select signal is set to select Y, causing the multiplexer to gate the contents of
register Y to input A of the ALU.
• At the same time, the contents of register R2 are gated onto the bus and hence, to input B.
• The function performed by the ALU depends on the signals applied to its control lines.
• This sum is loaded into register Z.
Step 3: The contents of Z are transferred to the destination register R3.
An instruction can be executed by
performing one or more of the
following operations :
1) Transfer a word of data from one processor register to
another or to the ALU. eg : MOVE Ri, Rj
2) Perform an arithmetic or a logic operation and store the
result in a processor register. Eg : Add Ri, Rj, Rk
3) Fetch the contents of a given memory location and load
them into processor register. Eg : Move [Ri], Rj
4) Store a word of data from a processor register into a given
memory location.
eg: Move Ri,[Rj]
3. Fetching a Word from
Memory
3. Fetching a Word from Memory
• The response time of each memory access varies
1. MAR ← [R1]
2. Start a Read operation on
the memory bus
3. Wait for the MFC response
from the memory
4. Load MDR from the
memory bus
5. R2 ← [MDR]
3. Fetching a Word from
Memory
An instruction can be executed by
performing one or more of the
following operations :
1) Transfer a word of data from one processor register to
another or to the ALU. Eg : MOVE Ri, Rj
2) Perform an arithmetic or a logic operation and store the
result in a processor register. Eg : Add Ri, Rj, Rk
3) Fetch the contents of a given memory location and load
them into processor register. Eg : Move [Ri], Rj
4) Store a word of data from a processor register into a given
memory location. Eg: Move Ri,[Rj]
4.Storing a word in memory
Example : Move R2,(R1)
1. The desired address is loaded into MAR
2. Data to be written are loaded into MDR and Write
command is issued.
***************************************
1. R1out,MARin
2. R2out,MDRin,Write
3. MDRoutE, , WMFC
Execution of a Complete Instruction
Ex-1 : Add R1,R2,R3
Fetch Phase
1. Fetch the instruction from the memory and decode
2. Fetch the operands
3. Perform the addition Execute Phase
4. Load the result into R3
Execution of a Complete Instruction
Add R1,R2,R3
Step Action
Fetch Phase
1 PCout, MARin,Read,Select4,Add,Zin
2 Zout,PCin,Yin,WMFC
3 MDRout,IRin
4 R1out,Yin
5 R2out, SelectY, Add, Zin
6 Zout, R3in ,End
Execute Phase
Execution of a Complete Instruction
Ex-2 : Add (R3), R1
1. Fetch the instruction
2. Fetch the first operand (the contents of the memory location pointed to by
R3)
3. Perform the addition
4. Load the result into R1
Control Sequence for the Execution of the
Instruction - Add (R3), R1
Instruction execution proceeds as follows.