Lecture 8: Sequential Networks and Finite State Machines
CSE 140: Components and Design Techniques for Digital Systems Spring 2014
CK Cheng, Diba Mirza
- Dept. of Computer Science and Engineering
University of California, San Diego
1
Lecture 8: Sequential Networks and Finite State Machines CSE 140: - - PowerPoint PPT Presentation
Lecture 8: Sequential Networks and Finite State Machines CSE 140: Components and Design Techniques for Digital Systems Spring 2014 CK Cheng, Diba Mirza Dept. of Computer Science and Engineering University of California, San Diego 1
CK Cheng, Diba Mirza
University of California, San Diego
1
2
Combinational
3
4
5
6
7
8
9
11
CLK Q0 Q1
12
CLK
13
14
15
16
S0 S1 S2 S3
Q1(t) Q0(t) Q1(t+1) Q0(t+1) Current state Next State S0 S1 S1 S2 S2 S3 S3 S0
17
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
18
Q1(t) Q0(t) Q1(t+1) Q0(t+1) 1 1 1 1 1 1 1 1
19
Q1(t) Q0(t) Q1(t+1) Q0(t+1) 1 1 1 1 1 1 1 1
Q0(t) Q1(t) Q0(t+1) Q1(t+1) PI Q: What is wrong with the 2-bit counter implementation shown above
edge of the clock signal
20
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:
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)
21
Q1(t) Q0(t) Q1(t+1) Q0(t+1) 1 1 1 1 1 1 1 1
PI Q: When did we fix our choice of flip flops in the design process?
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)
22
23
Q0(t) Q1(t)
D Q Q’ D Q Q’
x(t) Q0(t) Q1(t)
24
Q0(t) Q1(t)
D Q Q’ D Q Q’
x(t) Q0(t) Q1(t)
25
Q0(t) Q1(t)
D Q Q’ D Q Q’
x(t) Q0(t) Q1(t)
26
0 0 0 1 1 0 1 1
PS
input
x=0 x=1
Q1(t) Q0(t) | (Q1(t+1) Q0(t+1), y(t)) Present State | Next State, Output
S0 S1 S2 S3
PS
input
x=0 x=1
State Assignment
27
0 0 0 1 1 0 1 1
PS
input
x=0 x=1 01, 0 00, 0 10, 0 00, 0 11, 0 00, 0 00, 1 00, 1
Q1(t) Q0(t) | Q1(t+1) Q0(t+1), y(t) Present State | Next State, Output
S0 S1 S2 S3
PS
input
x=0 x=1
S1, 0 S0, 0 S2, 0 S0, 0 S3, 0 S0, 0 S0, 1 S0, 1
Let: S0 = 00 S1 = 01 S2 = 10 S3 = 11
State Assignment
28
S1 S2 S3 S0
S0 S1 S2 S3
PS
input
x=0 x=1
S1, 0 S0, 0 S2, 0 S0, 0 S3, 0 S0, 0 S0, 1 S0, 1
29
S1 S2 S3 S0
0/0 0/0 0/0 1/0 1/0
(0 or 1)/1
S0 S1 S2 S3
PS
input
x=0 x=1
S1, 0 S0, 0 S2, 0 S0, 0 S3, 0 S0, 0 S0, 1 S0, 1 1/0
37
X
T Q Q’ T Q Q’
Q0 Q1 T0 T1
38
y(t) = Q1(t)Q0(t) T0(t) = x(t) Q1(t) T1(t) = x(t) + Q0(t) Q0(t+1) = T0(t) Q’0(t)+T’0(t)Q0(t) Q1(t+1) = T1(t) Q’1(t)+T’1(t)Q1(t)
id Q1(t) Q0(t) x T1(t) T0(t) Q1(t+1) Q0(t+1) y 1 1 1 1 2 1 1 1 1 3 1 1 1 1 1 4 1 1 5 1 1 1 1 1 6 1 1 1 1 1 7 1 1 1 1 1 1
39
40 id Q1(t) Q0(t) x T1(t) T0(t) Q1(t+1) Q0(t+1) y 1 1 1 1 2 1 1 1 1 3 1 1 1 1 1 4 1 1 5 1 1 1 1 1 6 1 1 1 1 1 7 1 1 1 1 1 1
41 id Q1(t) Q0(t) x T1(t) T0(t) Q1(t+1) Q0(t+1) y 1 1 1 1 2 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