CSE 140: Components and Design Techniques for Digital Systems
Lecture 8: Sequential Networks and Finite State Machines
CK Cheng
- Dept. of Computer Science and Engineering
University of California, San Diego
1
Lecture 8: Sequential Networks and Finite State Machines CK Cheng - - PowerPoint PPT Presentation
CSE 140: Components and Design Techniques for Digital Systems Lecture 8: Sequential Networks and Finite State Machines CK Cheng Dept. of Computer Science and Engineering University of California, San Diego 1 Outlines Specification:
CK Cheng
University of California, San Diego
1
2
3
Combinational
4
T/0 T/0 H/1 H/0 H/0 T/0
H/0 T/0 H/0 T/1 T/0 H/0
7
8
9
CLK Q0 Q1
10
11
S0 S1 S2 S3
State Table: Binary
Q1(t) Q0(t) Q1(t+1) Q0(t+1) Current state Next State S0 S1 S1 S2 S2 S3 S3 S0
12
S0 S1 S2 S3
Q1(t) Q0(t) Q1(t+1) Q0(t+1) 1 1 1 1 1 1 1 1 Current state Next State S0 S1 S1 S2 S2 S3 S3 S0
13
Q1(t) Q0(t) Q1(t+1) Q0(t+1) 1 1 1 1 1 1 1 1
Q0(t) Q1(t)
D Q Q’ D Q Q’
Combinational circuit D0(t) = Q0(t)’ D1(t) = Q0(t) Q1(t)’ + Q0(t)’ Q1(t)
14
Q1(t) Q0(t) Q1(t+1) Q0(t+1) 1 1 1 1 1 1 1 1
We store the current state using D-flip flops so that:
don’t change while the next output is being computed
Q0(t) Q1(t)
D Q Q’ D Q Q’
Q0(t+1) = Q0(t)’ Q1(t+1) = Q0(t) Q1(t)’ + Q0(t)’ Q1(t) Truth table→K map→Switching function
15
16
0/0
0/0 1/1 0/1 0, 1/0 1/0 1/0
17
0/0
0/0 1/1 0/1 0, 1/0 1/0 1/0
18
19
Combinational Logic
x(t) y(t) CLK
y(t) CLK x(t)
CLK x(t) y(t)
20
x(t)
CLK x(t) y(t)
CLK y(t)
S(t) S(t)
21
x(t)
CLK x(t) y(t)
CLK y(t)
S(t) S(t)
Input PS NS Output Input PS NS, output
input
input/output
22
23
S1 S0
S2
S1 S0
S2
Input/output
24
S1 S0
0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reset Traffic Light Controller
44
S0 L A: green L B: red Reset
45
S0 L A: green L B: red S1 L A: yellow L B: red S3 L A: red L B: yellow S2 L A: red L B: green T A T A T B T B Reset
46
47
State Encoding S0 00 S1 01 S2 10 S3 11
48
Output Encoding green 00 yellow 01 red 10
49
S 1 S 0 S'1 S'0 CLK
state register
Reset r
50
S1 S0 S'1 S'0 CLK
next state logic state register
Reset TA TB
inputs
S1 S0 r
51
S1 S0 S'1 S'0 CLK
next state logic
state register
Reset LA1 LB1 LB0 LA0 TA TB
inputs
S1 S0 r
52