Control Unit
Control Unit
Control Unit
T0 Inst1
T1 inst2
Logic T2 Control Signal inst3
T3 inst4 Decoder
Circuit .. Generator ..
Tn inst5
Control Signals
• Clock
— One micro-instruction (or set of parallel micro-instructions)
per clock cycle
• Instruction Register
— Op-code for current instruction
— Determines which micro-instructions are performed
• Flags
— State of CPU
— Results of previous operations
• Within CPU
—Cause data movement
—Activate specific functions
Fetch Cycle:
t1: MAR (PC)
t2: MBR (memory)
PC (PC) +1
t3: IR (MBR)
Fetch Cycle
• Let Tx be the time unit of the clock. Then:
t1: MAR (PC)
t2: MBR (memory)
PC (PC) +1
t3: IR (MBR)
Execute: BSA X (Branch and Save Address) • BSA X - Branch and save address
Address of instruction following
t1: MAR (IRaddress)
BSA
MBR (PC) is saved in X
t2: PC (IRaddress)
• Execution continues from X+1
memory (MBR)
t3: PC (PC) + 1
Control Signals
Control Unit with Decoded Inputs
Internal Organization
• Usually a single internal bus
• Gates control movement of data onto and
off the bus
• Control signals control data transfer to
and from external systems bus
• Temporary registers needed for proper
operation of ALU
Functions of the Control Unit –
•It coordinates the sequence of data movements into, out of,
and between a processor’s many sub-units.
•It interprets instructions.
•It controls data flow inside the processor.
•It receives external instructions or commands to which it
converts to sequence of control signals.
•It controls many execution units(i.e. ALU, data buffers and
registers) contained within a CPU.
•It also handles multiple tasks, such as fetching, decoding,
execution handling and storing results.
• X,Y, temp are transparent to the
programmer /ALU buffer
• Never referenced by any
instruction
• Never used to store data
generated by instruction which
will be required for the other
instruction later.
There are two types of control units:
T0 Inst1
T1 inst2
Logic T2 Control Signal inst3
T3 inst4 Decoder
Circuit .. Generator ..
Tn inst5
Control Signals
Hardwired Control Unit: Here, the control signals that are important for
instruction execution control are generated by specially designed hardware logical
circuits, in which we can not modify the signal generation method without physical
change of the circuit structure
WMFC/
MEMR
MEMW J WMFC
clk
MFC K
Hard Wired Control Unit
• The Cycles (Fetch, Indirect, Execute,
Interrupt) are constructed as a State
Machine
State Machine
Storage
Clock Elements
State Diagram
Inputs
Outputs
Next States
Master-slave
flipflops
Problems With Hard Wired Designs
http://highered.mcgraw-hill.com/sites/dl/premium/0072467509/instructor/104653/figurec9.xls
Micro-Programmed Control
Generation of Microinstruction
Microinstruction for fetching a instruction
Microprogrammed Control
Unit:
Fetch the next instructions
Decode Instruction
Ix Iy Iz
to D, B, E F, H, G E, H
t1 C, A, H G D, A, C
t2 G, C B, C
Microinstructions:
• Generate Control Signals
• Provide Branching
Horizontal vs Vertical Microprogramming
Horizontal Microprogrammed or
— Unpacked
— Hard
— Direct
Vertical Microprogrammed or
— Packed
— Soft
— Indirect
Typical Microinstruction Formats
Microinstruction Encoding - Direct Encoding
Microinstruction Encoding - Indirect Encoding
Horizontal Micro-programming
• Faster
Vertical Micro-programming
• Slower
Example Microprogramming Formats
• MicroProgram Counter
• Subroutines
• Stack
• Control Register (MicroProgram Format)
Next Address Decision
• Necessity of speed
• Size of Microinstructions
• Address generation
—Branches
– Both conditional and unconditional
Advantage:
• Simplifies design of control unit
— Cheaper to design
— Less error-prone
— Much easier to modify
— Supports having multiple versions / models
Disadvantage:
• Slower
• More expensive to produce in quantities