Vous êtes sur la page 1sur 8

2016-11-29

Lecture 6: Control Unit

Basic operations

Implementation

Microprogramming

Zebo Peng, IDA, LiTH 1 TDTS10 Lecture 6

Control Unit in CPU


The main function of the control unit (CU) is to control the
execution of instructions.
The execution of an instruction is decomposed into smaller steps.
Each such step is usually called a micro-operation.

Program execution

Instruction cycle Instruction cycle Instruction cycle

Fetch Decode Execute Interrupt

OP OP OP OP OP

Zebo Peng, IDA, LiTH 2 TDTS10 Lecture 6

1
2016-11-29

Control Unit Operation


To perform a micro-operation, CU must send a set of control signals
to the datapath. i.e., the collection of registers, buses, and functional
units that perform data-processing operations:
Switch on/off a datapath component.
Set a flag signal.
Bus/multiplexer selection.
IR OP A

Flag signals from


Clock signal Control Unit the status register



Control signals to the datapath
Ex. 0 1 1 0 1 1 1 0 1 0 0 0 1 0 0 1
Zebo Peng, IDA, LiTH 3 TDTS10 Lecture 6

Control Signal Example


Pipeline The penalty due to data hazards can be reduced by a
technique called forwarding (bypassing):

0 1 0 1
Bypassing Path

C6 MUX MUX Memory


System
C7 Registers, cache and
C8 ALU main memory
C7 C8 : Op
00 : Add
01 : Sub
10 : Not
11 : And

Zebo Peng, IDA, LiTH 4 TDTS10 Lecture 6

2
2016-11-29

Data-Path and Control Signals


C12

M C11
B C1 C10
R
Main Memory

C3 C4 AR
C5
+1
C14 PC IR
C0 C7 C9
M C2
C13
A Selection
R


C6 ALU
Signals
C8

CR CW
Control
Clock Status Flags


PC: Program Counter Unit
IR: Instruction Register
AR: Accumulator Register
MAR: Memory Address Reg.
MBR: Memory Buffer Reg.
...
Zebo Peng, IDA, LiTH 5 TDTS10 Lecture 6

Micro-Operation Examples
Inst. exec. Micro-operations Active control
steps signals
T1: MAR (PC) C2

T2: MBR Memory Content C0, CR, C5, C14


Fetch
Instruction PC (PC) + 1

T3: IR (MBR) C4

T1: MAR (IR: Address_part) C8


Load
Operand T2: MBR Memory Content C0, CR, C5

T3: AC (MBR) C10

Zebo Peng, IDA, LiTH 6 TDTS10 Lecture 6

3
2016-11-29

Lecture 6: Control Unit

Basic operations

Implementation

Microprogramming

Zebo Peng, IDA, LiTH 7 TDTS10 Lecture 6

Hardwired Implementation
Instruction Register

Decoder
Clock
Sequencing Hardwired
Flags Control Add. Reg.Controller
Logic

+1

Read Control
Memory

Control Control Buf. Reg.


Control
Unit
Unit Decoder

C0 C1 Cn
Zebo Peng, IDA, LiTH 8 TDTS10 Lecture 6

4
2016-11-29

Microprogrammed Control
Instruction Register

Decoder PC
Clock
Sequencing
Flags Control Add. Reg.
Logic

+1

Read Control
Memory

Control Buf. Reg.


Control
Unit Decoder

C0 C1 Cn
Zebo Peng, IDA, LiTH 9 TDTS10 Lecture 6

Lecture 6: Control Unit

Basic operations

Implementation

Microprogramming

Zebo Peng, IDA, LiTH 10 TDTS10 Lecture 6

5
2016-11-29

Microprogrammed Control
Microprogramming is a technique used to implement the
control unit.

The basic idea is to implement the control unit as a micro-


program execution machine (a computer inside a computer).
The set of micro-operations occurring at one micro-clock cycle
defines a micro-instruction.
A sequence of micro-instructions defines a microprogram.

The execution of a machine instruction becomes the


execution of a sequence of micro-instructions.
This is similar to that a Java statement is implemented by a
sequence of machine instructions.

Zebo Peng, IDA, LiTH 11 TDTS10 Lecture 6

A Microprogrammed Computer
C12

M C11
B C1 C10
Main Memory

R
C3 C4 AC
C5
+1
C14 PC IR C9
C0 C7
M C2
C13 +
A C15
R C6 ALU -
C8 C16

Decoder Control Unit


CR CW
C17
Microprogram
PC
The controller design is
memory
becoming the problem +1 =0
C18 C19
of micro-programing!
C0 C1 . . . C19 CR CW
Zebo Peng, IDA, LiTH 12 TDTS10 Lecture 6

6
2016-11-29

Microprogram Examples
Fetch Instruction (FI):
T1: MAR (PC) Execution of LOAD Operation:
T2: MBR Memory Content T1: MAR (IRa)
PC (PC) + 1 T2: MBR Memory Content
T3: IR (MBR) T3: AC (MBR)
Decode Instruction (DI): PC 0
T1: IRop Controller (Decoder)
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 R W
0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0
FI

2 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
3 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0
DI

4 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0
Load

5 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0
6 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0

Zebo Peng, IDA, LiTH 13 TDTS10 Lecture 6

Microcode Storage
Microcodes are stored in a -memory 1 2 19 R W
0
which is much faster than a cache. 1 FI
2
Since the micro-memory stores only - 3 DI
instructions, a ROM is often used. 4
5 Load
6
Microprograms are, therefore, 7
sometimes called firmware. 8 Store
9
Software that provides control, monitoring 10
and data manipulation. 11 Add
12
Most firmware can be updated. 13
14 Sub
Changing of firmware may rarely or never 15
be done during its lifetime.
16 .
17 .
18
19 .
Zebo Peng, IDA, LiTH 14 TDTS10 Lecture 6

7
2016-11-29

Application of Microprogramming
Implementation of the control functions.
Operating-system support.
High-level language support:
Ex. to provide complex instructions to match the HLL
statements.
Control of special-purpose devices.
Emulation of other computers.
User tailoring.

Zebo Peng, IDA, LiTH 15 TDTS10 Lecture 6

Summary
The control unit plays an important role in the
operation of a computer.
It can be implemented in basically two different
technologies.
The microprogramming technique is used to:
simplify the control circuits;
increase flexibility (e.g., introducing a new instruction
for computing division);
make it efficient to use the same computer for
different purposes.

Zebo Peng, IDA, LiTH 16 TDTS10 Lecture 6

Vous aimerez peut-être aussi