You are on page 1of 15

VIETNAM NATIONAL UNIVERSITY, HANOI

ĐẠI HỌC
CÔNG NGHỆ
University of Engineering & Technology

Digital Design
Lecture: Sequential Circuits and FSM

Xuan-Tu Tran, PhD


Vietnam National University, Hanoi
Smart Integrated Systems (SISLAB) Research Group
Email: tutx@vnu.edu.vn

ĐẠI HỌC
CÔNG NGHỆ
Outline

⚫ Introduction to sequential circuits


⚫ Delay in gate networks
⚫ Flip-Flops (RS, JK, D)
⚫ Counters (Binary, BCD, Johnson)
⚫ Shift registers (serial, parallel)
⚫ Finite State Machines (FSM)

4/12/2023 Xuan-Tu Tran 2

1
ĐẠI HỌC
CÔNG NGHỆ
What are sequential circuits?

⚫ Combinational circuits
⚫ The outputs are functions only of the present inputs

⚫ Sequential circuits
⚫ The outputs can be made functions of not only the present inputs, but also
some set of past inputs as well.
⚫ Sequential circuits have memory because one or more of the outputs are
“fed back” to serve as inputs the network.

4/12/2023 Xuan-Tu Tran 3

ĐẠI HỌC
CÔNG NGHỆ
Delay in gate networks

⚫ Propagation delay per gate (Thời gian trễ lan truyền):

X
X Y
Y

Td1 Td2

Td 1 + Td 2
Td =
2
TTL logic family: Td varies from 1 to 15 ns
4/12/2023 Xuan-Tu Tran 4

2
ĐẠI HỌC
CÔNG NGHỆ
Delay in gate networks (cont’d)

Ideal NAND gate has


⚫ Propagation delay in a NAND gate zero propagation delay

(a) non-ideal NAND gate


(b) Ideal NAND gate with delay

Timing diagram
4/12/2023 Xuan-Tu Tran 5

ĐẠI HỌC
CÔNG NGHỆ
Delay in gate networks (cont’d)

⚫ Generation of a “glitch” in a combinational circuit.

Timing diagrams assuming


that B and C are both high
throughout.

“Glitch” dues to the physical


4/12/2023 Xuan-Tu Tran
delays in a network 6

3
ĐẠI HỌC
CÔNG NGHỆ
Delay in gate networks (cont’d)

⚫ Adding the consensus (đồng


tâm) to the equation

The glitch will vanish because


BC = 1 throughout the various
transitions on A and A-bar

Note: Remove the consensus may cause undesired behavior

4/12/2023 Xuan-Tu Tran 7

ĐẠI HỌC
CÔNG NGHỆ
Flip-Flop (FF)

⚫ Is a memory element who has two stable states (‘0’ and ‘1’)

⚫ When it goes to a stable state, it will stay there until a control signal active.

⚫ The next state depends on both its input signals and its current state.

⚫ Built from basic logic gates

⚫ RS, JK, D

4/12/2023 Xuan-Tu Tran 8

4
ĐẠI HỌC
CÔNG NGHỆ
Simple SR Flip-Flop

⚫ Simple SR Flip-Flop (inputs active at high level)


Sn Rn Qn+1 Mode
S Q
0 0 Qn Remain
R Q
1 0 1 Set

0 1 0 Reset
Qn +1 = RnQn + S n 1 1 Not allowed Not allowed

S S
Q

Q
R Q
4/12/2023 Xuan-Tu Tran 9

ĐẠI HỌC
CÔNG NGHỆ
Simple SR Flip-Flop (cont’d)

⚫ Simple SR Flip-Flop (inputs active at low level)

Sn Rn Qn+1
S(L) Q
L L Not allowed
R(L) Q L H H
H L L
H H Qn

S(L) S(L)
Q

R(L)

Q
R(L)
Q

Note: Status of FF will not be stable if its inputs impacted by interferences


4/12/2023 Xuan-Tu Tran 10

5
ĐẠI HỌC
CÔNG NGHỆ
Clocked SR Flip-Flop (cont’d)

⚫ SR Flip-Flop with clock input


⚫ Use a clock signal to enable the
inputs → the circuit will be more
stable.

S Q

Clk
tn tn+1
R Q
Sn Rn Qn+1
0 0 Qn
S Q
1 0 1
Clk
0 1 0
R Q
1 1 Not allowed

4/12/2023 Xuan-Tu Tran 11

ĐẠI HỌC
CÔNG NGHỆ
Clocked SR Flip-Flop (cont’d)

⚫ SR Flip-Flop with clock input

tn tn+1 Clk
Sn Rn Qn+1
0 0 Qn
1 0 1 Q
0 1 0
Timing diagram
1 1 Not allowed
4/12/2023 Xuan-Tu Tran 12

6
ĐẠI HỌC
CÔNG NGHỆ
Master-Slave SR Flip-Flop

⚫ Latch-mode Flip-Flop
When G is asserted → the output will
follow the changes in S and R
lines (If the S and R change more
than once → the output Q will change
more than once)
!!! undesirable characteristic

⚫ Master-Slave SR Flip-Flop

4/12/2023 Xuan-Tu Tran 13

ĐẠI HỌC
CÔNG NGHỆ
Master-Slave SR Flip-Flop

⚫ Master-Slave Flip-Flop

4/12/2023 Xuan-Tu Tran 14

7
ĐẠI HỌC
CÔNG NGHỆ
JK Flip-Flop

4/12/2023 Xuan-Tu Tran 15

ĐẠI HỌC
CÔNG NGHỆ
Counters (Binary, BCD, Johnson)

⚫ In the text book !!!

4/12/2023 Xuan-Tu Tran 16

8
ĐẠI HỌC
CÔNG NGHỆ
Shift registers (serial, parallel)

⚫ In the text book !!!

4/12/2023 Xuan-Tu Tran 17

ĐẠI HỌC
CÔNG NGHỆ

Finite State Machines

4/12/2023 Xuan-Tu Tran 18

9
ĐẠI HỌC
CÔNG NGHỆ
Models for clocked sequential circuits

State machine

Model of a combinational circuit


with feedback

Q = f ( q, X )
Z = h( q, X )
Mealy model for sequential circuits

Q = f ( q, X )
Moore model for sequential circuits Z = h( q )
4/12/2023 Xuan-Tu Tran 19

ĐẠI HỌC
CÔNG NGHỆ
Finite State Machines (FSMs)

⚫ Any Circuit with Memory Is a Finite State Machine


⚫ Even computers can be viewed as huge FSMs

⚫ Design of FSMs Involves


⚫ Defining states
⚫ Defining transitions between states
⚫ Optimization / minimization

⚫ Above Approach Is Practical for Small FSMs Only

4/12/2023 Xuan-Tu Tran 20

10
ĐẠI HỌC
CÔNG NGHỆ
Moore FSM

⚫ Output Is a Function of a Present State Only

Inputs Next State


function
Next State Present State
clock Present State
reset Register

Output Outputs
function
4/12/2023 Xuan-Tu Tran 21

ĐẠI HỌC
CÔNG NGHỆ
Mealy FSM
⚫ Output Is a Function of a Present State and Inputs

Inputs Next State


function
Next State Present State
clock Present State
reset Register

Output Outputs
function
4/12/2023 Xuan-Tu Tran 22

11
ĐẠI HỌC
CÔNG NGHỆ
Moore Machine

transition
condition 1

state 1 / state 2 /
output 1 output 2
transition
condition 2

4/12/2023 Xuan-Tu Tran 23

ĐẠI HỌC
CÔNG NGHỆ
Mealy Machine

transition condition 1 /
output 1

state 1 state 2
transition condition 2 /
output 2

4/12/2023 Xuan-Tu Tran 24

12
ĐẠI HỌC
CÔNG NGHỆ
Moore vs. Mealy FSM (1)

⚫ Moore and Mealy FSMs Can Be Functionally Equivalent

⚫ Equivalent Mealy FSM can be derived from Moore FSM and vice versa

⚫ Mealy FSM Has Richer Description and Usually Requires Smaller


Number of States
⚫ Smaller circuit area

4/12/2023 Xuan-Tu Tran 25

ĐẠI HỌC
CÔNG NGHỆ
Moore vs. Mealy FSM (2)

⚫ Mealy FSM Computes Outputs as soon as Inputs Change


⚫ Mealy FSM responds one clock cycle sooner than equivalent Moore FSM

⚫ Moore FSM Has No Combinational Path Between Inputs and


Outputs
⚫ Moore FSM is more likely to have a shorter critical path

4/12/2023 Xuan-Tu Tran 26

13
ĐẠI HỌC
CÔNG NGHỆ
Moore FSM - Example 1

⚫ Moore FSM that Recognizes Sequence “10”

0 1
0
1
S0 / 0 S1 / 0 1 S2 / 1

reset
0
S0: No S1: “1” S2: “10”
Meaning elements observed observed
of states: of the
sequence
observed
4/12/2023 Xuan-Tu Tran 27

ĐẠI HỌC
CÔNG NGHỆ
Mealy FSM - Example 1

⚫ Mealy FSM that Recognizes Sequence “10”

0/0 1/0 1/0

S0 S1

reset 0/1
S0: No S1: “1”
Meaning elements observed
of states: of the
sequence
observed
4/12/2023 Xuan-Tu Tran 28

14
ĐẠI HỌC
CÔNG NGHỆ
Moore & Mealy FSMs – Example 1

clock
0 1 0 0 0
input

S0 S1 S2 S0 S0
Moore
S0 S1 S0 S0 S0
Mealy

4/12/2023 Xuan-Tu Tran 29

ĐẠI HỌC
CÔNG NGHỆ
Finite State Machine (FSM)

FSM for a sequence detector that detects the sequence 101

Home work: Students draw the timing diagram for their given input data
4/12/2023 Xuan-Tu Tran 30

15

You might also like