Professional Documents
Culture Documents
SEQUENTIAL LOGIC
INTRODUCTION TO SEQUENTIAL LOGIC
Sequential Logic Sequential circuit contains a set of inputs and outputs. The
outputs of sequential circuit depends not only on the combination
of present inputs but also on the previous outputs.
Memory Elements
21-Jun-21 Digital Electronics (Dr. Nikhil Agrawal) 2
COMBINATIONAL & SEQUENTIAL CIRCUITS
Sequential Logic Combinational circuit:
A B X Y
A
X 0 0 0 0
B 0 1 0 1
1 0 0 1
Y 1 1 1 0
X A B
Y A B
X= Carry
Y =Sum
Latch
Flip-flop
R
Q
Q
S
21-Jun-21 Digital Electronics (Dr. Nikhil Agrawal) 5
SR LATCH
Sequential Logic SR Latch is also called as Set Reset Latch. This latch affects
the outputs as long as the level of input is not changed.
The circuit diagram of SR Latch is shown in the following
figure.
R
Q
Q
S
1
0
1 0 0 1
21-Jun-21 Digital Electronics (Dr. Nikhil Agrawal) 7
SR LATCH USING NOR GATE WORKING
Sequential Logic Working of SR latch using NOR gate is as follows:
1 0
0 1
1 0 0 1
0 1 1 0
1 0
0 1
1 0 0
0 1 1
1 0 0 1
0 1 1 0
1 0 0
0 1 0 0 0 1 0
1 0 0 1
0 1 1 0
1 0 0 1
0 1 0 0
1 0 0 1
0 1 1 0
0 0 1 0
1 0 0 1
1 0 0 1
0 1 1 0
1 0 0 1
0 1 0 1
1 0 0 1
0 1 1 0
0 0 1 0
1 0 0 1
1 1
Q’ 1 0 0 1
S
1 1 Undefined
Not used
S =1 & R = 0, we have Q = 1 & Q’ = 0.
S =0 & R = 0, we have Q = 1 & Q’ = 0. Memory State
Or we have Q = 0 & Q’ = 1.
1
0
1 0 0 1
21-Jun-21 Digital Electronics (Dr. Nikhil Agrawal) 13
SR LATCH USING NAND GATE WORKING
Sequential Logic Working of SR latch using NAND gate is as follows:
1 0
0 1
1 0 0 1
0 1 1 0
1 0
0 1
1 0 1
0 1 1
1 0 0 1
0 1 1 0
1 0 0
0 1 1 1 1 1 0
1 0 1 1
0 1 1 0
1 0 0 1
0 1 1 0
1 0 0 1
0 1 1 0
1 1 1 0
1 0 0 1
1 1 1 0
0 0 0
1 0 1
0 1 0 0
1 0 0 1
0 1 1 0
1 1 1 0
1 0 0 1
0 0
R Q’
Q
S
Characteristic Table:
R S Q’ Q
1 1 No Change
0 1 1 0
1 0 0 1
0 0 Undefined
S S
Q
Clock
Q
R R
Q
R R*
Clock R S Q’ Q When clock is low FF
0 Memory will be in “invalid
State state”.
1 1 0 1 0
Now NAND gate latch
1 0 1 0 1 have same character-
1 0 0 Memory istics table as NOR gate
State base latch
1 1 1 Not used
1
0 t
Clock D Q Q’
1 1 1 0 When clock is low FF will be
1 0 0 1 in “invalid state”.
0 Memory Now NAND gate latch have
State
same characteristics table as
NOR gate base latch
S
A Q
Clock
Q
B R
S
A Q
Clock
Q
B R
S
A Q
Clock
Q
B R
S
A Q
Clock
Q
B R
1
0 t
Qn
t
Q
B R R
Q
K R R
S S
J
Q
Clock
Q
K R R
S S
J
Q
Clock
Q
K R R
T Q
clk
1
0 t
D QM D QS
clk clk
QM QS
clk
D
1
0
QM
QS
QP
QN
21-Jun-21 Digital Electronics (Dr. Nikhil Agrawal) 32
TYPES OF FLIP FLOP
Sequential Logic So far we have discussed 4 types of flip flops:
D Flip Flop,
T Flip Flop
S Q D Q J Q T Q
R Q Q K Q Q
R Q Q K Q Q
R Q Q K Q Q
S Q D Q J Q T Q
K1 Q1 K2 Q2
clk
Q1
Q2
J1 Q1 J2 Q2 J3 Q3 J4 Q4
K1 Q1 K2 Q2 K3 Q3 K4 Q4
+5 V
1
Clock
0 t
Q1 t
Q2 t
Q3 t
Q4 t
0 0 0 0 0 J1 Q1 J2 Q2 J3 Q3 J4 Q4
1 0 0 1
Ja PSa Qa Jb PSb Qb Jc PSc Qc
2 0 1 0 Clock
clk clk clk
3 0 1 1
Ka CLR a Qa Kb CLRb Qb Kc CLRc Qc
4 1 0 0
5 1 0 1
Qb Qc
6 1 1 0 Qa
0 0 0
+5 V
5 1 0 1
6 1 1 0 Qa
Qb Qc
7 1 1 1
0 1 0
+5 V
+5 V
clk Qc Qb Qa
Ja PSa Qa Jb PSb Qb Jc PSc Qc
0 0 0 0
clk clk clk
1 1 1 1
Ka CLRa Qa Kb CLRb Qb Kc CLRc Qc
2 0 0 0
3 1 1 1
Clock
7 1 1 1
+5 V
9 1 0 0 1 +5 V
10 1 0 1 0
Ja PSa Qa Jb PSb Qb Jc PSc Qc Jd PSd Qd
11 1 0 1 1
clk clk clk clk
13 1 1 0 1
Clock
14 1 1 1 0
21-Jun-21 Digital Electronics (Dr. Nikhil Agrawal) 44
FLIP FLOPS AS MEMORY ELEMENTS
Sequential Logic
As we have discussed that Flip Flop primary task is to
store.
For this purpose we use D Flip Flop.
The basic purpose of register is to store group of bits.
A B C D
Da Qa Db Qb Dc Qc Dd Qd
Qa Qb Qc Qd
Qa Qb Qc Qd
Load: Da Db Dc Dd
Asynchronous load clear
clock
Qa Qb Qc Qd
Clear:
Asynchronous clear
Synchronous clear
Serial
Data out
clk Qa Qb Qc Qd
0 1 0 0 0
1 IN1 1 0 0
2 IN2 IN1 1 0
3 - IN2 IN1 1
4 - - IN2 IN1
Serial
Data Da Qa Db Qb Dc Qc Dd Qd
Da Qa Db Qb Dc Qc Dd Qd
Qa Qb Qc Qd
Serial
Data
Da Qa Db Qb Dc Qc Dd Qd
Da Qa Db Qb Dc Qc Dd Qd
Qa Qb Qc Qd
clock
Clock
Qa t
Qb t
Qc t
21-Jun-21 Digital Electronics (Dr. Nikhil Agrawal) 53
RING COUNTER USING J-K FLIP FLOP
Sequential Logic
This is also known by:
Johnson counter,
Recirculating shift register,
Twisted Ring counter.
period. B t
C t
D t
E t
F t
clk Qa Qb Qc 𝑸𝒂 𝑸𝒃 𝑸𝒄 Logic
1 0 0 0 1 1 1 𝑄𝑎 ∙ 𝑄𝑐
2 1 0 0 0 1 1 𝑄𝑎 ∙ 𝑄𝑏
3 1 1 0 0 0 1 𝑄𝑏 ∙ 𝑄𝑐
4 1 1 1 0 0 0 𝑄𝑎 ∙ 𝑄𝑐
5 0 1 1 1 0 0 𝑄𝑎 ∙ 𝑄𝑏
6 0 0 1 1 1 0 𝑄𝑏 ∙ 𝑄𝑐
0 0 0 1 1 1
21-Jun-21 Digital Electronics (Dr. Nikhil Agrawal) 55
TWISTED RING COUNTER
Sequential Logic
Now lets examine graphically:
1
Clock
0 t
Qa t
Qb t
Qc t
Qa
t
Qb
t
Qc
t Logic
A 𝑄𝑎 ∙ 𝑄𝑐
t
𝑄𝑎 ∙ 𝑄𝑏
B t
𝑄𝑏 ∙ 𝑄𝑐
C t
𝑄𝑎 ∙ 𝑄𝑐
D t 𝑄𝑎 ∙ 𝑄𝑏
E 𝑄𝑏 ∙ 𝑄𝑐
t
Clock
Logic
𝑄𝑎 ∙ 𝑄𝑐
B 𝑄𝑎 ∙ 𝑄𝑏
𝑄𝑏 ∙ 𝑄𝑐
𝑄𝑎 ∙ 𝑄𝑐
𝑄𝑎 ∙ 𝑄𝑏
𝑄𝑏 ∙ 𝑄𝑐
x z
clk
S0
S3 S1
x=1
21-Jun-21
S 2
Digital Electronics (Dr. Nikhil Agrawal) 59
STATE MACHINE
Sequential Logic
If machine has external output also associated with
states.
S. No. State
x z
1 S0 00
2 S1 01 clk
3 S2 10
4 S3 11 A B
S0
QA DA
z=1
S3
S1
QB DB
z=1
z=0
S2
21-Jun-21 z = 1 (Dr. Nikhil Agrawal)
Digital Electronics 60
STATE MACHINE
Sequential Logic
Now clock is the actual event that triggers the
transaction.
Therefore, the digital system will now be:
Input Output
S. No. State
x y
1 S0 00 Present state Next state
information A A information
2 S1 01 B B
3 S2 10 DB
QB
4 S3 11 clk
QA DA
clk
S0
z=1
S3
S1
z=1
z=0
S2
21-Jun-21 z Digital
=1 Electronics (Dr. Nikhil Agrawal) 61
COUNTER AS STATE MACHINE
Sequential Logic
Counter is an example of state machine, whose state
diagram will be:
000
111 S0 001
S7 S1
S6 S2 010
S5 S3 011
S4
101 3 Bit A
100
Counter B
clk
C
QA DA
S0 clk
z=1
S3
S1
Generalized Model of a State Machine
z=1
z=0
S2
z=1
21-Jun-21 State (Dr.
Digital Electronics diagram
Nikhil Agrawal) 63
STATE MACHINE EXAMPLE
Sequential Logic
Let us consider an example of traffic light controller.
Main Main
Road Road
Secondary Secondary
Road Road
GR YR
Main Main
Road Road
Secondary Secondary
Road Road
YR RG
Main Main
Road Road
Secondary Secondary
Road Road
RG RY
Main Main
Road Road
Secondary Secondary
Road Road
RY GR
T3 = 0
21-Jun-21 Digital Electronics (Dr. Nikhil Agrawal) 68
STATE MACHINE EXAMPLE
Sequential Logic
Now from state graph we can have our state machine:
T1 = 0
S0
T4 = 1 GR
S1
S3
YR T2 = 0
T4 = 0 RY Combination
Outputs
Inputs logic
S2
T1 GR
RG
T2 YR
T3 RG Next
T3 = 0 State
T4 RY
A+ DA QA
Present clk
State A QA
B B+ DB QB
clk
QB
QC
QC clk
Clock
21-Jun-21 Digital Electronics (Dr. Nikhil Agrawal) 69
ARBITRARY COUNTER
Sequential Logic
Now lets consider an example of arbitrary counter
1, 4, 3, 5, 2, 6 A B C
0 0 1
1 0 0
001 0 1 1
S0 1 0 1
0 1 0
110 S5 S1 100
1 1 0
010
S4 S2 011
S3
21-Jun-21 101 (Dr. Nikhil Agrawal)
Digital Electronics 70
ARBITRARY COUNTER
Sequential Logic
Now state machine will be:
001
Excitation Table
S0
Qn Qn+1 D
110 S5 S1 100
0 0 0
0 1 1
010
S4 S2 011
S3 Combination
logic
Next
State
101 A+ Da QA
clk
QA
Present
State B+ DB QB
A clk
B QB
C C+ DC Qc
clk
QC
QC
QC clk
Da QA
clk
Combinational
Combination
logic
Next
State
Circuit QA
A+ Da QA
clk
QA
Present
State A
B+ DB QB B+ DB QB
B
clk
QB A clk
C C+ DC Qc
clk
QC B QB
QC
C+
QC clk
Clock
C DC Qc
A clk
QC
Clock
QC clk
21-Jun-21 Digital Electronics (Dr. Nikhil Agrawal) 75
DESIGN OF ARBITRARY COUNTER USING J-K FF
Sequential Logic
We will proceed to design:
Combination
logic
Next
State
Ja QA
A+ clk
KA QA
Present
JB QB
State A B+ clk
B KB QB
C JC Qc
C+
clk
KC QC
QC
QC clk
Transition Table
Present State Next State
A B C JA KA JB KB JC KC A+ B+ C+
0 0 0
0 0 1 1 0 0
0 1 0 1 1 0
0 1 1 1 0 1
1 0 0 0 1 1
1 0 1 0 1 0
1 1 0 0 0 1
1 1 1
00 01 11 10
A B C JA KA 0 1 1 1
A
0 0 0 1
0 0 1 1 K Map for JA
0 1 0 1 JA 1
0 1 1 1
1 0 0 1 BC
1 0 1 1 00 01 11 10
1 1 0 1 0
A
1 1 1 1 1 1 1
K Map for KA
KA 1
21-Jun-21 Digital Electronics (Dr. Nikhil Agrawal) 81
DESIGN OF ARBITRARY COUNTER USING J-K FF
Sequential Logic
Now steering logic BC
00 01 11 10
A B C JB KB 0 0
A
0 0 0 1 1 1
0 0 1 0 K Map for JB
0 1 0 0 JB A
0 1 1 1
1 0 0 1 BC
1 0 1 1 00 01 11 10
1 1 0 1 0 1 0
A
1 1 1 1 1
K Map for KB
KB A C
21-Jun-21 Digital Electronics (Dr. Nikhil Agrawal) 82
DESIGN OF ARBITRARY COUNTER USING J-K FF
Sequential Logic
Now steering logic BC
00 01 11 10
A B C JC KC 0 0
A
0 0 0 1 1 1
0 0 1 1 K Map for Jc
0 1 0 0 JC A
0 1 1 0
1 0 0 1 BC
1 0 1 1 00 01 11 10
1 1 0 1 0 1 0
A
1 1 1 1 1
K Map for Kc
KB B
21-Jun-21 Digital Electronics (Dr. Nikhil Agrawal) 83
DESIGN OF ARBITRARY COUNTER USING J-K FF
Sequential Logic
State Machine
1 Next
State
Ja QA
A
clk
KA QA A
Present
State JB QB
B
A clk
KB QB
C B
JC Qc
C
A clk
KC QC C
B
QC
QC clk
Clock
21-Jun-21 Digital Electronics (Dr. Nikhil Agrawal) 84
DESIGN EXAMPLE
Sequential Logic
Let make the inclusion of input in the previous design
example
State Table
Present State Next State
A B x (i/p) A+ B+
0 0 0 0 0
S0
0 0 1 0 1
0 1 0 1 0
0 1 1 0 1
S3 S1
1 0 0 0 0
1 0 1 1 1
S2 1 1 0 0 1
1 1 1 0 0
Da QA
x
clk
Combinational +
B QA
Circuit
A
B DB QB
clk
clk
QB
C
Clock
S1
x=1
S3 S2
S2
x=1
Mealy State
Machine
have output Mealy State Machine Moore State Machine
associated Combination
with input logic
Moore State T4 ZM
Machine A+ DA QA
Inputs x z Outputs
A+ DA QA
Present clk QA
State A DB QB
B B+ clk
QB
x=0
z=0 Clock
S0
S2 x=1
x=0 S1
z=0
z=1
21-Jun-21 S2 (Dr. Nikhil Agrawal)
Digital Electronics 90
MEALY STATE MODEL WITH OUTPUT
Sequential Logic Bx
State machine with outputs.
00 01 11 10
State Table 0 0 0 0 1
A
Present State Next State 1 0 0
A B x (i/p) A+ B+ z (o/p) K Map for DA
0 0 0 0 0 0 DA B x
0 0 1 0 1 0 Bx
0 1 0 1 0 1
0 1 0 00 01 11 10
0 1 1
0 0 0 A 0 0 1 1 0
1 0 0
0 0 1 1 0 0
1 0 1
1 1 0 0 K Map for DB
1 1 1 0 DB A x B x
Input Output
x z
Present state Next state
information A A information
B B
QB DB
clk
QA DA
clk
x=0110010100…
y = 0 0 0 0 0 0 1 0 1 0…
x/ z
1/ 0 S0 = Reset
x/ z
S0
x/ z
0/ 0 S1 = „0‟
1/ 0
S1 x/ z S2 = „01‟
x/ z
0/ 0
0/ 1
S2 x/ z
1/ 0
0 1 0 0 1 0 0 0 0 1 0
A
0 1 1 1 0 0 1 0 0
1 0 0 0 1 1 K Map for DA
1 0 1 0 0 0 DA B x
1 1 0 0
1 1 1 0
0 1 0 0 1 0 0 0 1 0 1
A
0 1 1 1 0 0 1 1 0
1 0 0 0 1 1 K Map for DB
1 0 1 0 0 0 DB B x A x A B x
1 1 0 0
1 1 1 0
0 1 0 0 1 0 0 0 0 0 0
A
0 1 1 1 0 0 1 1 0
1 0 0 0 1 1 K Map for z
1 0 1 0 0 0 z A x
1 1 0 0
1 1 1 0
x/ z S0 = Reset
x/ z 0/ 0
1/ 0 S1 = „0‟
S0
x/ z
1/ 0 x/ z S2 = „1‟
S2 S1 0/ 0
x/ z S3 = „01‟
0/ 0
x/ z S4 = „10‟
x/ z S3 1/ 0
0/ 1 x/ z
S4 S5 = „100‟
1/ 0 x/ z
1/ 1 x/ z
21-Jun-21
x/ z S5
Digital Electronics (Dr. Nikhil Agrawal)
0/ 0 100
0/ 0
Thank You
Email: nagrawal@iiit.ac.in