Comp Arch Chapter4v2010
Comp Arch Chapter4v2010
Comp Arch Chapter4v2010
CONTROL UNIT
1
OUTLINE
4.1 Introduction
4.2 Micro-operations
2
4.1 INTRODUCTION
In Chapter 3, seen:
Machine instructions
Operations performed by the processor to execute
each instruction
But how exactly each individual operation
is caused to happen ?
The job of the Control Unit
Instruction cycle
Consists of the following smaller cycles
Fetch/indirect/execute/interrupt cycle
5
MICRO-OPERATIONS...
In the next sections, we will see
How the events of any instruction cycle can be
described as a sequence of micro operations
6
MICRO-OPERATIONS...
Fetch cycle
Sequence of events, seen from point of view of its effects on
processor registers
First Step
To move the address from PC to MAR
Second Step
Overall effect is to bring in the instruction
Address (in the MAR) is placed on address bus
Control unit issues READ command
Result (data from memory) appears on data bus
Data from data bus copied into MBR
PC incremented by 1 (in parallel with data fetch from memory)
Third Step
Data (instruction) moved from MBR to IR 7
MICRO-OPERATIONS...
Fetch cycle (symbolic)
t1: MAR (PC)
t2: MBR memory
PC (PC) +1
t3: IR (MBR)
Fetch cycle
Involves three steps and four µop
Note that each µop involves movement of data into or out of
a register
Several µops can be performed in one clock cycle, so
long as these movements do not interfere with one 8
another
MICRO-OPERATIONS...
Assumptions
A clock is available for timing purpose
It emits regularly spaced clock pulses
Each clock pulse defines a time unit
Note
The second and third micro operations (µops) , both ,
takes place during the second time unit
The third µop could have been grouped with the 9
fourth without affecting the fetch operation
MICRO-OPERATIONS...
Rules for grouping of µops
Proper sequence of events must be followed
MAR (PC) must precede MBR (memory)
As memory read operation makes use of the address in
the MAR
Conflicts must be avoided
Must not read & write same register in one time unit
As the result would be unpredictable
cycle
10
MICRO-OPERATIONS...
Indirect Cycle
t1: MAR (IR[Address])
t2: MBR memory
t3: IR(Address) (MBR[Address])
Note:
IR[Address]
Refers to the address field of the instruction
Note:
Save_Address
The address at which the contents of the PC are to be saved
Routine_Address
The starting address of the interrupt processing routine
This is a minimum
May be additional micro-ops to get addresses
The nature of this cycle varies greatly from one machine to another
12
MICRO-OPERATIONS...
Fetch, Indirect and Interrupt Cycles
Simple and predictable
Each involves a small, fixed sequence of micro
operations
In each case, the same sequence of micro operations
repeated
13
MICRO-OPERATIONS...
Execute Cycle
Different for each instruction
For a machine with N different opcodes
N different sequence of micro operation
Example:
ADD R1,X
(add the contents of location X to Register 1 , result in R1)
t1: MAR (IR[Address])
t2: MBR memory
t3: R1 (R1) + (MBR)
14
MICRO-OPERATIONS...
Execute Cycle
Example:
ISZ X
(increment and skip if zero)
t1: MAR (IR[Address])
t2: MBR memory
t3: MBR (MBR) + 1
t4: memory (MBR)
if ((MBR) == 0) then PC (PC) + 1
15
MICRO-OPERATIONS...
So far we have seen
How the operation of the processor can be defined as
a sequence of micro operations
Next
How the control unit causes this sequence to occur
16
4.3 CONTROL UNIT
Functional Requirements
Functional requirements of the control unit, those
functions the control unit must perform,
Basis for the design and implementation of the control unit
Outputs
To control the behaviour of the system
Instruction register
Contains Op-code of current instruction
Determines which µops are performed during the
execute cycle
Flags
Used by control unit to determine the status of CPU
Also, to determine results of previous ALU operations
20
CONTROL UNIT...
Model of Control Unit
21
CONTROL UNIT...
How does the control unit maintain control ?
Control signals
MBR memory
Open gates between MAR and address bus
IR (MBR)
Open gates between MBR and IR 22
CONTROL UNIT...
Data Paths
and
Control Signals
23
CONTROL UNIT...
Maintains a knowledge of where it is in the
instruction cycle
Reads all of its inputs
24
4.4 CONTROL UNIT IMPLEMENTATION
Two ways to implement the control unit:
Hardwired Control Unit Implementation
Micro programmed Control Unit Implementation
25
HARDWIRED IMPLEMENTATION
The control unit is essentially a combinational
circuit
Its inputs logic signals are transformed into a set
of output logic signals which are the control
signals
26
HARDWIRED IMPLEMENTATION...
Control Unit Inputs
Flags and control bus signals
Each individual bit typically has some meaning
Instruction register
The control unit makes use of the opcode to issue different
combination of control signals for different instruction
To simplify the control unit logic, there should be a unique logic
input for each opcode
Performed by a decoder
A decoder with n binary inputs will have 2n binary outputs
For any combination of inputs only on of its output is high 27
HARDWIRED IMPLEMENTATION...
Control Unit Inputs
Clock
Generates a repetitive sequence of pulses
Useful for measuring duration of micro-ops
28
HARDWIRED IMPLEMENTATION...
Control Unit with Decoded Inputs
29
HARDWIRED IMPLEMENTATION...
Control Unit Internal Logic
Derive a boolean expression for each control signal as
a function of the inputs
Example:
Consider two control signals P and Q with the following
characteristics
PQ= 00 Fetch cycle
32