Lecture 13: Sequential Networks – Flip flops and Finite State … · 2015-02-09 · Lecture 13:...
Transcript of Lecture 13: Sequential Networks – Flip flops and Finite State … · 2015-02-09 · Lecture 13:...
![Page 1: Lecture 13: Sequential Networks – Flip flops and Finite State … · 2015-02-09 · Lecture 13: Sequential Networks – Flip flops and Finite State Machines CSE 140: Components](https://reader033.fdocuments.us/reader033/viewer/2022053009/5f0cbb617e708231d436dbae/html5/thumbnails/1.jpg)
Lecture 13: Sequential Networks – Flip flops and
Finite State Machines
CSE 140: Components and Design Techniques for Digital Systems
Diba Mirza
Dept. of Computer Science and Engineering University of California, San Diego
1
![Page 2: Lecture 13: Sequential Networks – Flip flops and Finite State … · 2015-02-09 · Lecture 13: Sequential Networks – Flip flops and Finite State Machines CSE 140: Components](https://reader033.fdocuments.us/reader033/viewer/2022053009/5f0cbb617e708231d436dbae/html5/thumbnails/2.jpg)
T
CLK
Q
Q’
Characteristic Expression Q(t+1) = Q’(t)T(t) + Q(t)T’(t)
0 0 1 1 1 0
PS T 0 1
State table
Q(t+1)
T Flip-Flop (Toggle)
2
![Page 3: Lecture 13: Sequential Networks – Flip flops and Finite State … · 2015-02-09 · Lecture 13: Sequential Networks – Flip flops and Finite State Machines CSE 140: Components](https://reader033.fdocuments.us/reader033/viewer/2022053009/5f0cbb617e708231d436dbae/html5/thumbnails/3.jpg)
Using a JK F-F to implement a D and T F-F
J K
Q Q’
x
CLK
3
iClicker The above circuit behaves as which of the following flip flops? A. D F-F B. T F-F C. None of the above
![Page 4: Lecture 13: Sequential Networks – Flip flops and Finite State … · 2015-02-09 · Lecture 13: Sequential Networks – Flip flops and Finite State Machines CSE 140: Components](https://reader033.fdocuments.us/reader033/viewer/2022053009/5f0cbb617e708231d436dbae/html5/thumbnails/4.jpg)
Using a JK F-F to implement a T F-F
J K
Q Q’
T
CLK
T flip flop
4
![Page 5: Lecture 13: Sequential Networks – Flip flops and Finite State … · 2015-02-09 · Lecture 13: Sequential Networks – Flip flops and Finite State Machines CSE 140: Components](https://reader033.fdocuments.us/reader033/viewer/2022053009/5f0cbb617e708231d436dbae/html5/thumbnails/5.jpg)
5
![Page 6: Lecture 13: Sequential Networks – Flip flops and Finite State … · 2015-02-09 · Lecture 13: Sequential Networks – Flip flops and Finite State Machines CSE 140: Components](https://reader033.fdocuments.us/reader033/viewer/2022053009/5f0cbb617e708231d436dbae/html5/thumbnails/6.jpg)
6
![Page 7: Lecture 13: Sequential Networks – Flip flops and Finite State … · 2015-02-09 · Lecture 13: Sequential Networks – Flip flops and Finite State Machines CSE 140: Components](https://reader033.fdocuments.us/reader033/viewer/2022053009/5f0cbb617e708231d436dbae/html5/thumbnails/7.jpg)
7
![Page 8: Lecture 13: Sequential Networks – Flip flops and Finite State … · 2015-02-09 · Lecture 13: Sequential Networks – Flip flops and Finite State Machines CSE 140: Components](https://reader033.fdocuments.us/reader033/viewer/2022053009/5f0cbb617e708231d436dbae/html5/thumbnails/8.jpg)
8
![Page 9: Lecture 13: Sequential Networks – Flip flops and Finite State … · 2015-02-09 · Lecture 13: Sequential Networks – Flip flops and Finite State Machines CSE 140: Components](https://reader033.fdocuments.us/reader033/viewer/2022053009/5f0cbb617e708231d436dbae/html5/thumbnails/9.jpg)
Flip flops
• Write the state-table of the following flip-flops – D – JK – T
9
![Page 10: Lecture 13: Sequential Networks – Flip flops and Finite State … · 2015-02-09 · Lecture 13: Sequential Networks – Flip flops and Finite State Machines CSE 140: Components](https://reader033.fdocuments.us/reader033/viewer/2022053009/5f0cbb617e708231d436dbae/html5/thumbnails/10.jpg)
10
Combinational
CLK CLK
A B C D
Sequential Networks
1. Components F-Fs 2. Specification 3. Implementation: Excitation Table
S(t) X
Y
CLK
RTL: Register-Transfer Level Description
![Page 11: Lecture 13: Sequential Networks – Flip flops and Finite State … · 2015-02-09 · Lecture 13: Sequential Networks – Flip flops and Finite State Machines CSE 140: Components](https://reader033.fdocuments.us/reader033/viewer/2022053009/5f0cbb617e708231d436dbae/html5/thumbnails/11.jpg)
11
Specification
• Combinational Logic – Truth Table – Boolean Expression – Logic Diagram (No feedback loops)
• Sequential Networks: State Diagram (Memory) – State Table and Excitation Table – Characteristic Expression – Logic Diagram (FFs and feedback loops)
![Page 12: Lecture 13: Sequential Networks – Flip flops and Finite State … · 2015-02-09 · Lecture 13: Sequential Networks – Flip flops and Finite State Machines CSE 140: Components](https://reader033.fdocuments.us/reader033/viewer/2022053009/5f0cbb617e708231d436dbae/html5/thumbnails/12.jpg)
What we will learn:
12
1. Describe the desired behavior of a sequential circuit over time (FSMs)
2. Given the behavior of a sequential circuit, implement the circuit
Wall-E is a Finite State Machine
Active Inactive
Describing Wall-E
Implementing Wall-E
![Page 13: Lecture 13: Sequential Networks – Flip flops and Finite State … · 2015-02-09 · Lecture 13: Sequential Networks – Flip flops and Finite State Machines CSE 140: Components](https://reader033.fdocuments.us/reader033/viewer/2022053009/5f0cbb617e708231d436dbae/html5/thumbnails/13.jpg)
Finite State Machines: Describing circuit behavior over time
13
2 bit Counter
Symbol/ Circuit
![Page 14: Lecture 13: Sequential Networks – Flip flops and Finite State … · 2015-02-09 · Lecture 13: Sequential Networks – Flip flops and Finite State Machines CSE 140: Components](https://reader033.fdocuments.us/reader033/viewer/2022053009/5f0cbb617e708231d436dbae/html5/thumbnails/14.jpg)
Finite State Machines: Describing circuit behavior over time
14
Free running 2 bit Counter
Symbol/ Circuit Output over time
time
CLK
Q1
Q0
What is the expected output of the counter over time?
![Page 15: Lecture 13: Sequential Networks – Flip flops and Finite State … · 2015-02-09 · Lecture 13: Sequential Networks – Flip flops and Finite State Machines CSE 140: Components](https://reader033.fdocuments.us/reader033/viewer/2022053009/5f0cbb617e708231d436dbae/html5/thumbnails/15.jpg)
Finite State Machines: Describing circuit behavior over time
15
2 bit Counter 00
Symbol/ Circuit Diagram that depicts behavior over time
01
10
11
![Page 16: Lecture 13: Sequential Networks – Flip flops and Finite State … · 2015-02-09 · Lecture 13: Sequential Networks – Flip flops and Finite State Machines CSE 140: Components](https://reader033.fdocuments.us/reader033/viewer/2022053009/5f0cbb617e708231d436dbae/html5/thumbnails/16.jpg)
State: What is it ? Why do we need it?
16
Symbol/ Circuit Behavior over time
time
CLK
2 bit Counter
PI Q: At time t1, what information is needed to produce the output of the counter at the next rising edge of the clock (i.e t2)? A. All the outputs of the counter until t1 B. The initial output of the counter at time t=0 C. The output of the counter at current time t1 D. We cannot determine the output of the counter at t2 prior to t2
t1 t2
![Page 17: Lecture 13: Sequential Networks – Flip flops and Finite State … · 2015-02-09 · Lecture 13: Sequential Networks – Flip flops and Finite State Machines CSE 140: Components](https://reader033.fdocuments.us/reader033/viewer/2022053009/5f0cbb617e708231d436dbae/html5/thumbnails/17.jpg)
Implementing the 2 bit counter
17
S0
S1
S2
S3
State Diagram
State Table
Q1(t) Q0(t) Q1(t+1) Q0(t+1)
Current state Next State S0 S1 S1 S2 S2 S3 S3 S0
![Page 18: Lecture 13: Sequential Networks – Flip flops and Finite State … · 2015-02-09 · Lecture 13: Sequential Networks – Flip flops and Finite State Machines CSE 140: Components](https://reader033.fdocuments.us/reader033/viewer/2022053009/5f0cbb617e708231d436dbae/html5/thumbnails/18.jpg)
18
State Table
Q1(t) Q0(t) Q1(t+1) Q0(t+1) 0 0 0 1 0 1 1 0 1 0 1 1 1 1 0 0
PI Q: Which of the following is the likely structure of the circuit realization of the counter
Q0(t)
Q1(t)
D Q Q’
D Q Q’
CLK
Circuit with 2 flip flops
B.
Combinational circuit
Combinational circuit
Circuit with no flip flops
A.
Q0(t)
Q1(t)
Q
D Q Q’
CLK
Circuit with one flip flop
C.
Combinational circuit
![Page 19: Lecture 13: Sequential Networks – Flip flops and Finite State … · 2015-02-09 · Lecture 13: Sequential Networks – Flip flops and Finite State Machines CSE 140: Components](https://reader033.fdocuments.us/reader033/viewer/2022053009/5f0cbb617e708231d436dbae/html5/thumbnails/19.jpg)
19
State Table
Q1(t) Q0(t) Q1(t+1) Q0(t+1) 0 0 0 1 0 1 1 0 1 0 1 1 1 1 0 0
Q0(t)
Q1(t)
D Q Q’
D Q Q’
CLK
Circuit with 2 flip flops
B.
Combinational circuit
D0(t) = Q0(t)’ D1(t) = Q0(t) Q1(t)’ + Q0(t)’ Q1(t)
![Page 20: Lecture 13: Sequential Networks – Flip flops and Finite State … · 2015-02-09 · Lecture 13: Sequential Networks – Flip flops and Finite State Machines CSE 140: Components](https://reader033.fdocuments.us/reader033/viewer/2022053009/5f0cbb617e708231d436dbae/html5/thumbnails/20.jpg)
20
State Table
Q1(t) Q0(t) Q1(t+1) Q0(t+1) 0 0 0 1 0 1 1 0 1 0 1 1 1 1 0 0
We store the current state using D-flip flops so that: • Inputs to the combinational circuit
don’t change while the next output is being computed
• The transition to the next state only occurs at the rising edge of the clock
Q0(t)
Q1(t)
D Q Q’
D Q Q’
CLK
Implementation of 2-bit counter
Q0(t+1) = Q0(t)’ Q1(t+1) = Q0(t) Q1(t)’ + Q0(t)’ Q1(t)
![Page 21: Lecture 13: Sequential Networks – Flip flops and Finite State … · 2015-02-09 · Lecture 13: Sequential Networks – Flip flops and Finite State Machines CSE 140: Components](https://reader033.fdocuments.us/reader033/viewer/2022053009/5f0cbb617e708231d436dbae/html5/thumbnails/21.jpg)
21
Generalized Model of Sequential Circuits
S(t) X
Y
CLK
![Page 22: Lecture 13: Sequential Networks – Flip flops and Finite State … · 2015-02-09 · Lecture 13: Sequential Networks – Flip flops and Finite State Machines CSE 140: Components](https://reader033.fdocuments.us/reader033/viewer/2022053009/5f0cbb617e708231d436dbae/html5/thumbnails/22.jpg)
22
Let’s implement our free running 2-bit counter using T-flip flops
id Q1(t) Q0(t) T1(t) T0(t) Q1(t+1) Q0(t+1)
0 0 0 0 1
1 0 1 1 0
2 1 0 1 1
3 1 1 0 0
Excitation table
Q0(t)
Q1(t)
T Q Q’
T Q Q’
CLK
Circuit with 2 T-flip flops
Combinational circuit
![Page 23: Lecture 13: Sequential Networks – Flip flops and Finite State … · 2015-02-09 · Lecture 13: Sequential Networks – Flip flops and Finite State Machines CSE 140: Components](https://reader033.fdocuments.us/reader033/viewer/2022053009/5f0cbb617e708231d436dbae/html5/thumbnails/23.jpg)
23
Let’s implement our free running 2-bit counter using T-flip flops
id Q1(t) Q0(t) T1(t) T0(t) Q1(t+1) Q0(t+1)
0 0 0 0 1 0 1
1 0 1 1 1 1 0
2 1 0 0 1 1 1
3 1 1 1 1 0 0
Excitation table
Q0(t)
Q1(t)
T Q Q’
T Q Q’
CLK
Circuit with 2 T-flip flops
![Page 24: Lecture 13: Sequential Networks – Flip flops and Finite State … · 2015-02-09 · Lecture 13: Sequential Networks – Flip flops and Finite State Machines CSE 140: Components](https://reader033.fdocuments.us/reader033/viewer/2022053009/5f0cbb617e708231d436dbae/html5/thumbnails/24.jpg)
24
Let’s implement our free running 2-bit counter using T-flip flops
Excitation table
T0(t) = T1(t) =
id Q1(t) Q0(t) T1(t) T0(t) Q1(t+1) Q0(t+1)
0 0 0 0 1 0 1
1 0 1 1 1 1 0
2 1 0 0 1 1 1
3 1 1 1 1 0 0
Q0(t)
Q1(t)
T Q Q’
T Q Q’
CLK
Circuit with 2 T-flip flops
![Page 25: Lecture 13: Sequential Networks – Flip flops and Finite State … · 2015-02-09 · Lecture 13: Sequential Networks – Flip flops and Finite State Machines CSE 140: Components](https://reader033.fdocuments.us/reader033/viewer/2022053009/5f0cbb617e708231d436dbae/html5/thumbnails/25.jpg)
25
T Q
Q’
T Q
Q’
Q0
Q1
1
T1
Free running counter with T flip flops
T0(t) = 1 T1(t) = Q0(t)
![Page 26: Lecture 13: Sequential Networks – Flip flops and Finite State … · 2015-02-09 · Lecture 13: Sequential Networks – Flip flops and Finite State Machines CSE 140: Components](https://reader033.fdocuments.us/reader033/viewer/2022053009/5f0cbb617e708231d436dbae/html5/thumbnails/26.jpg)
26
Let’s implement our free running 2-bit counter using JK-flip flops
id Q1(t) Q0(t) J1(t) K1(t) J0(t)
K0(t)
Q1(t+1) Q0(t+1)
0 0 0 0 1
1 0 1 1 0
2 1 0 1 1
3 1 1 0 0
Excitation table
Q0(t)
Q1(t)
Q Q’
Q Q’
CLK
Circuit with 2 JK-flip flops
Combinational circuit
![Page 27: Lecture 13: Sequential Networks – Flip flops and Finite State … · 2015-02-09 · Lecture 13: Sequential Networks – Flip flops and Finite State Machines CSE 140: Components](https://reader033.fdocuments.us/reader033/viewer/2022053009/5f0cbb617e708231d436dbae/html5/thumbnails/27.jpg)
27
Let’s implement our free running 2-bit counter using JK-flip flops
id Q1(t) Q0(t) J1(t) K1(t) J0(t)
K0(t)
Q1(t+1) Q0(t+1)
0 0 0 0 X 0 1
1 0 1 1 X 1 0
2 1 0 X 0 1 1
3 1 1 X 1 0 0
Excitation table
Q0(t)
Q1(t)
Q Q’
Q Q’
CLK
Circuit with 2 JK-flip flops
Combinational circuit
![Page 28: Lecture 13: Sequential Networks – Flip flops and Finite State … · 2015-02-09 · Lecture 13: Sequential Networks – Flip flops and Finite State Machines CSE 140: Components](https://reader033.fdocuments.us/reader033/viewer/2022053009/5f0cbb617e708231d436dbae/html5/thumbnails/28.jpg)
28
Let’s implement our free running 2-bit counter using JK-flip flops
id Q1(t) Q0(t) J1(t) K1(t) J0(t)
K0(t)
Q1(t+1) Q0(t+1)
0 0 0 0 X 1 X 0 1
1 0 1 1 X X 1 1 0
2 1 0 X 0 1 X 1 1
3 1 1 X 1 X 1 0 0
Excitation table
Q0(t)
Q1(t)
Q Q’
Q Q’
CLK
Circuit with 2 JK-flip flops
Combinational circuit
![Page 29: Lecture 13: Sequential Networks – Flip flops and Finite State … · 2015-02-09 · Lecture 13: Sequential Networks – Flip flops and Finite State Machines CSE 140: Components](https://reader033.fdocuments.us/reader033/viewer/2022053009/5f0cbb617e708231d436dbae/html5/thumbnails/29.jpg)
29
Let’s implement our free running 2-bit counter using JK-flip flops
id Q1(t) Q0(t) J1(t) K1(t) J0(t)
K0(t)
Q1(t+1) Q0(t+1)
0 0 0 0 X 1 X 0 1
1 0 1 1 X X 1 1 0
2 1 0 X 0 1 X 1 1
3 1 1 X 1 X 1 0 0
Excitation table
Q0(t)
Q1(t)
Q Q’
Q Q’
CLK
Circuit with 2 JK-flip flops
Combinational circuit
J1(t) = Q0(t) K1(t) = Q0(t) J0(t) = 1 K0(t) =1