Title: Control Logic Design
1Control Logic Design
- CIS-3357
- Computer Engineering
- Chapter 8
2HOMEWORK
8-1, 8-2, 8-7, 8-8, 8-9, 8-13, 8-14, 8-20
Have a GREAT Day !!
3OVERVIEW
- Introduction
- Microprogrammed Control
- Control of Processor Unit
- Microprogram Examples
- Design ExampleBinary Multiplier
- Hardwired Control for Multiplier
- Example of a Simple Computer
- Design of Simple Computer
4Introduction
- Control logic is the hardware that controls the
operation of all the various hardware pieces
ranging from the ALU to the registers - Think of the control logic as the supervisor
- Determines the sequence of operations to be
performed
5Introduction
- Control logic is developed as one of two types
- Hardwired control
- Control logic is implemented with gates and
flip-flops like a sequential circuit - Microprogrammed control
- Control information such as control functions or
control words are stored as 1s and 0s in a
special memory - Hardwired control has the advantage of speed and
size but is harder to do
6Introduction
External Input
Control Logic Subsystem
Commands
Data Processor Subsystem
Status conditions
Input Data
Output Data
Hardwired or microprogrammed
7OVERVIEW
- Introduction
- Microprogrammed Control
- Control of Processor Unit
- Microprogram Examples
- Design ExampleBinary Multiplier
- Hardwired Control for Multiplier
- Example of a Simple Computer
- Design of Simple Computer
8Microprogrammed Control
- Purpose of the control unit is to initiate a
sequence of microoperations - During certain times, certain microoperations are
to be performed while others remain idle - Control variable at any given time can be
represented as a string of 1s and 0s (a control
word)
9Microprogrammed Control
- Control words then can be programmed to initiate
activity with various components in the digital
subsystem - A system whose binary control variables (control
words) are stored in a specialized memory is
called a microprogrammed control unit - Each control word in control memory contains a
microinstruction
10Microprogrammed Control
- The microinstruction specifies one or more
microoperation - A sequence of microinstructions constitutes a
microprogram - This microprogram is generally stored in a ROM
11Microprogrammed Control
External Input
Control Word
Next address generator (sequencer)
Control Address Register
Control memory ROM
Control data Register
Next Address Information
12Microprogrammed Control
- The next address generator determines the address
sequence that is read from control memory - Incrementing the control address
- Transferring an external address
- Loading an initial address to start operations
- The control data register holds the present
microinstruction while the next address is
computed and read from memory - Allows the microoperations specified in the
control word to be executed simultaneously with
the generation of the next microinstruction
13Microprogrammed Control
- The control address register holds the next
microinstruction and points to the correct
location in memory while the instruction of the
current address is being executed
14OVERVIEW
- Introduction
- Microprogrammed Control
- Control of Processor Unit
- Microprogram Examples
- Design ExampleBinary Multiplier
- Hardwired Control for Multiplier
- Example of a Simple Computer
- Design of Simple Computer
15Process Unit Control Example
SELECT
1-16
Control Memory 64 x 26 (ROM)
Control Address Register
MUX 1
17
18-20
21-26
External address
INC
LOAD
Clock
MUX 2
Select
3
n
Input Data
Processor Unit
16
Status bits
Control Word
16Encoding Microinstructions
- So far we have developed a control system in
theory that will control the processor that we
developed in chapter 7 - We have a memory which has a 26 bit output for
each and every address - Our control word has 16 bits which are used to
control the processor - The other 10 bits are used for control of the the
controller - How do we get the bits in the right arrangement
to do the things we want them to do? - Can use state diagrams, flow charts, etc
174-bit Processor Unit
Clock
A Select
n Inputs
R0
Load
MUX
R1
Load
A Bus
MUX
R2
B Bus
B Select
Load
Operation Select
Arithmetic Logic Unit (ALU)
Load
R3
S
Z
V
C
0
1
2
3
Decoder
Shift Select
Shifter
Output data
Destination Select
184-bit Processor Unit
Input Data
Clock
Register File R0 to R7
4
1
B Bus Select
A Bus Select
B
A
5
2
6
3
7
Destination Select
B Bus
A Bus
D
8
ALU Select
9
10
Arithmetic Logic Unit (ALU)
11
F
12
Clock
S
Z
V
C
13
14
Shifter
H
15
16
Shift Select
Output data
1 2 3
4 5 6
7 8 9
10 11 12 13
14 15 16
A
B
D
F
H
19Microinstruction Format
20Microinstruction Format
ALU Operations
21Microinstruction Format
Shifter Operations
22Microinstruction Format
Select Input to MUX2
23Microinstruction Format
Examples
24Microinstruction Format
Examples
The microinstruction at CAR Address 36 reads
R1 ? R1 ? R2, CAR ? CAR 1
The microinstruction at CAR Address 40 reads
R3 ? R3 - 1, CAR ? 43
25Microinstruction Format
Examples
The microinstruction at CAR Address 52 reads
R4 ? 0, If Sign 1 CAR ? 37 Else CAR ? CAR 1
The microinstruction at CAR Address 56 reads
R5 ? shl R5, If Carry 0 CAR?62 Else CAR?CAR1
26OVERVIEW
- Introduction
- Microprogrammed Control
- Control of Processor Unit
- Microprogram Examples
- Design ExampleBinary Multiplier
- Hardwired Control for Multiplier
- Example of a Simple Computer
- Design of Simple Computer
27Microprogram Example 1
- Lets try an example and see if we can generate a
microprogram
EXAMPLE Register Transfer Statements
28Microprogram Example
Pneumonic Microprogram
29Microprogram Example
ROM Microprogram Contents
30Process Unit Control
SELECT
1-16
Control Memory 64 x 26 (ROM)
Control Address Register
MUX 1
17
18-20
21-26
External address
INC
LOAD
Clock
MUX 2
Select
3
n
Input Data
Processor Unit
16
Status bits
Control Word
31Example 2 Counting of 1s
R2?0
START
R1?R1 C?0 Update Z
R2 holds the count value
R1 is the number
1
Z
Done
0
Rotate R1 with carry
0
C
1
R2?R2 1
32Example 2 Counting 1s
Pneumonic Microprogram
33Example 2 Counting 1s
ROM Microprogram Contents
34OVERVIEW
- Introduction
- Microprogrammed Control
- Control of Processor Unit
- Microprogram Examples
- Design ExampleBinary Multiplier
- Hardwired Control for Multiplier
- Example of a Simple Computer
- Design of Simple Computer
35Hardwire Control Example
- So far weve talked about the microprogramming
approach to developing control logic - Now lets change our focus and see how we can
apply the design methods weve discussed
previously to develop hardwired control logic - Take the binary multiplier as example
36Binary Multiplication
- Several ways of making hardware do multiplication
- Number of bits in the Product is considerably
larger than number of bits in either the
Multiplicand or the Multiplier (up to 2n) - Can perform multiplication in binary by
successive shifts and adds to develop partial
products
Multiplicand 1000 Multiplier x
1001 1000 0000 0000
1000 Product 1001000
8
9
72
37Multiply Hardware Configuration
Z1 if P0
Register B
Check Z?
Control Logic
P counter
32-bit ALU
S (Start)
n
Cout
Shift Right
Q0
Register A
C
0
Register Q
38Binary Multiplication Process Flowchart
Initial State
0
S
1
A?0 C?0 P?n
1
0
P?P-1 A?AB, C?Cout
Q0
P?P-1
AQ?shr CAQ, C?0
1
0
Z
39Binary Multiplication
- Now that the flow chart is complete, lets see if
we cant make some sense out of this flowchart and
the associated hardware - Looking at an example multiplication problem done
in binary
40Binary Multiplication
Numerical Example
41Binary Multiplication Example
- The numerical example works !
- Now determine the hardwired control
- A Sequential circuit design problem
- The flowchart is very similar to the state
diagram - Rectangular boxes represent states
- Diamond boxes designate decision points (input
variables which determine the next state taken)
42Binary Multiplication Example
- Conversion from flowchart to state diagram is not
unique - and thats ok! - Start by assigning an initial state T0 to our
sequential controller - Then determine the required transitions to other
states - For each state, determine the microoperations
that must be initiated by the logic control - This procedure produces a state diagram for the
controller along with a list of register transfer
operations to be execute in each state
43Binary Multiplication Example 1
- For our example, there are going to be four
states related to the rectangular boxes - There are two input variables S, Z
Z1/T3
S0/T01
Q0/T21,L
T1
T0
T2
T3
T11
S1/T01
Z0/T3
44Binary Multiplication Example 1
Z1/T3
S0/T01
Q0/T21,L
T1
T0
T2
T3
T11
S1/T01
T0 Initial State
Z0/T3
T1 A?0, C?0, P?n
T2 P? P-1
L Q0T2 A?AB, C?Cout
T3 AQ?shr CAQ, C?0
45Binary Multiplication Example 1
Control Logic
T0
Z
T1
S
T2
T3
Q0
LQ0T2
46Multiply Hardware Configuration
Z1 if P0
T0
(Load)
Register B
T0-T3
Check Z?
Control Logic
P counter
32-bit ALU
S (Start)
n
T2
(Dec)
T1
(Load)
Cout
Q0
Register A
C
0
Register Q
T3
T1
(Reset)
T3
(Shift)
T0
(Load)
Q0T2
47Binary Multiplication Example 1
Z1/T3
S0/T01
Q0/T21,L
T1
T0
T2
T3
T11
S1/T01
Present State
Next State
Z0/T3
Outputs
Inputs
G0
G1
G0
G1
T0
T1
T2
T3
S
Z
0
0
0
X
0
0
1
0
0
0
0
0
1
X
0
1
1
0
0
0
0
1
X
X
1
0
0
1
0
0
1
0
X
X
1
1
0
0
1
0
1
1
X
0
1
0
0
0
0
1
1
1
X
1
0
0
0
0
0
1
48Binary Multiplication Example 1
T0
T1
SZ
SZ
00
01
11
10
00
01
11
10
G1G0
G1G0
1
1
1
1
0
0
0
0
00
00
01
01
0
0
0
0
1
1
1
1
0
0
0
0
11
0
0
0
0
11
0
0
0
0
10
0
0
0
0
10
T0 G1(bar)G0
T0 G1(bar)G0(bar)
49Binary Multiplication Example 1
T2
T3
SZ
SZ
00
01
11
10
00
01
11
10
G1G0
G1G0
0
0
0
0
0
0
0
0
00
00
01
01
0
0
0
0
0
0
0
0
0
0
0
0
11
1
1
1
1
11
1
1
1
1
10
0
0
0
0
10
T0 G1G0
T2 G1G0(bar)
50Binary Multiplication Example 1
Next G1
Next G0
SZ
SZ
00
01
11
10
00
01
11
10
G1G0
G1G0
0
0
0
0
0
0
1
1
00
00
01
01
1
1
1
1
0
0
0
0
1
0
0
1
11
0
0
0
0
11
1
1
1
1
10
1
1
1
1
10
G1 G1G0 G1G0 G0Z
G0 G1G0 G0S
51Binary Multiplication Example 2
- For our example, there are going to be five
states related to the rectangular boxes - There are three input variables S, Z, and Q0
Z1
Q00
S0
T1
T0
T2
T3
T4
Q01
S1
Z0
52Binary Multiplication Example 2
Z1
Q00
S0
T1
T0
T2
T3
T4
Q01
S1
T0 Initial State
Z0
T1 A?0, C?0, P?n
T2 P? P-1
T3 A?AB, C?Cout
T4 AQ?shr CAQ, C?0
53Binary Multiplication Example 2
Control Logic
T0
Z
T1
S
T2
Q0
T3
T4
54OVERVIEW
- Introduction
- Microprogrammed Control
- Control of Processor Unit
- Microprogram Examples
- Design ExampleBinary Multiplier
- Hardwired Control for Multiplier
- Example of a Simple Computer
- Design of Simple Computer
55Design of Simple Computer
- We have already talked in some detail about
simple computer - Instruction codes
- Code Formats
- Block Diagram of the functional components
- Designing the control of a computer is very
similar to what we have already done for the
multiplier - Break operations down into microoperations
- Design control for each operation - Load, Store,
Add, Sub, etc
56Design of Simple Computer
- Typically break down into Instruction Fetch and
Execution phases - Fetch phase is typically very similar for all
instructions - Execution phase is normally unique to a specific
instruction - Flow chart the whole process for each instruction
- Develop a state diagram from the flow chart
57Opcode Process Flowchart
DR?M(PC)
START
T0
IR?DR PC?PC1
T1
Decode Opcode
INA microinstruction
CMA microinstruction
LOAD microinstruction
T2
CMA microinstruct 2
T3
LOAD microinstruct 2
Etc.
See Figure 8-14 for the simple computer show in
the book
58Design of Simple Computer
- Now convert into a state diagram or state table
and reduce to refine hardware requirements as
done previously - Many states will do common tasks (microoperations)
59END Chapter 8
604-bit Processor Unit
Input Data
Clock
Register File R0 to R7
4
1
B Bus Select
A Bus Select
B
A
5
2
6
3
7
Destination Select
B Bus
A Bus
D
8
ALU Select
9
10
Arithmetic Logic Unit (ALU)
11
F
12
Clock
S
Z
V
C
13
14
Shifter
H
15
16
Shift Select
Output data
1 2 3
4 5 6
7 8 9
10 11 12 13
14 15 16
A
B
D
F
H