Professional Documents
Culture Documents
Flip Flops Summary
Flip Flops Summary
Lecture Notes # 7
(A) Introduction to Sequential Circuits
(B) Latches and Flip-Flops
(C) Counter Design
SHANTANU DUTT
1
(A) Introduction to Sequential Circuits
• Current o/p depends on the current i/p and past history of all i/ps
seen by the circuit.
3
(B) Latches and Flip-Flops
A=0
When one I/P of NOR is 0, it acts like an inverter.
When one I/P is 1, then O/P=0.
Different I/P conditions for R-S latch:
i) R=S=0, current I/P is stored indefinitely
5
Hold ( becomes cascade of inverters)
ii) R=1, S=0, when we want to store a 0 in the R-S latch.
Q=0, Q 1
iii) R=0, S=1, when we want to store a 1 in the latch.
Q=1, Q 0
iv) R=1, S=1; Forbidden inputs!
Both Q = 0, Q 0 : Q and its complement have the same value !
Will play havoc in the rest of the logic circuit.
Transit to: R=0, S=0.
0 0 O/P oscillates.
R=10 Q
0 Oscillates
0 01
Q
between 1 and 0
1
when we transit from 6
01
S=10 R=S=1 to R=S=0.
From R, S = 1, 1 transit to R=0, S=1
then Q,Q transit to 1, 0 ( correctly )
From R, S = 1, 1 transit to R=1, S=0
then Q, Q correctly transit to 0, 1
Two implementations for R-S latch:
Q Q
S S
enb
R-S Clocked Latch
Latch Q (level-sensitive clock latch)
D S1 — see terminology defined
S
later.
D=1, S=1, R=0 enb=1
Q=1, Q 0
D=0, S=0, R=1
enb=1
Q=0, Q 1
enb=0 R1,S1=0 (hold state)
8
5) The J-K Latch:
— Proposed to get rid of the forbidden I/P problem of R-S
i) J=1, K=0: (a) Let Q=1, Q 0 R=0,S=0
Hold state of R-S Q=1, Q 0
(b) Let Q=0, Q 1, R=0, S=1 Q=1, Q 0
ii) J=0, K=1 Q=0, Q 1 using a similar analysis
iii) J=K=0 Hold state
iv) J=K=1, suppose Q=1,Q =0
R=1, S=0 Q=0, Q =1
S=1, R=0 Q=1, Q =0
This type of toggling continues as long as J=K=1, and the latch
is enabled ( CLK=1 below )
Q 10 10
K R
R Q
CLK
R-S
J 1
S Q
Q 01 01 9
Latch classification with respect to response to “control signal”
Terminology: Note that the terminology below applies to all types of latches:
R-S, D, J-K, T, etc., though the examples are given for the R-S latch.
i) Transparent Latch: O/P responds to latch I/Ps without any enable or clock signal.
R Q
Symbol: R Q
Q S Q
S
Clock:
Fixed frequency alternating 1 and 0 signal
ii) Clocked or Level-Sensitive Latch:
R O/P responds to I/Ps only when enb or
Q
clock is at a pre-determined level (high
Clock
or
or low — In this example, it is High)
Q
enb
S Symbol: R Q R Q
or
S Q S Q
CLK 10
(high enable) CLK (low enable)
iii) Edge-Triggered Flip-Flop (FF) or simply Flip-Flop
O/P will respond to I/Ps only at either:
(a) the positive or rising edge of the enb/clock signal (positive
edge-triggered FF), or Symbol: R Q
S Q
CLK
(b) the negative or falling edge of the enb/clock signal (negative
edge-triggered FF). Symbol: R Q
S Q
CLK
Clock:
O/P resp. period for
a low-enable/clock
level sensitive latch
O/P response
O/P response O/P response
period for a
period for a period for a
positive
negative HIGH-enable/clock
edge-
edge-triggered level-sensitive 11
triggered
FF latch
FF.
Setup Times and Hold Time of FFs and Latches
• Assume, positive edge-triggered D-FF
THold relates to propagation delay
of another part of circuit.
D
CLK
CLK
Negative edge arrival
• If D-Latch is high-level sensitive: Tsetup and Thold have to be around the negative edge
of clock (more specifically, when the clock begins to go low), similar to negative edge-triggered.
•If D-Latch is low-level sensitive: Tsetup and Thold have to be around the positive 12
edge of clock, similar to positive edge-triggered.
Solutions to Race Condition Problem with Level Sensitive Latches
Solution 1: Master-Slave FF:
Q
1 Q
R Qs
J Qm
P R
1 R-S 1
1
Latch R-S
0 P 0
K Qm Qs
S 0 S Q
0
CLK
D 0 14
Characteristic Equations of Latches/FFs
The next O/P Q+ defined in terms of the current O/P Q and the I/P.
(FF/Latch is the simplest possible sequential ckt.)
Q(t)\SR 00 01 11 10 Q+= S+ R Q
0 0 0 x 1 (Characteristic equation)
1 1 0 x 1 15
Similarly: Characteristic Equations of
2) J-K, Q+ = Q K + Q J.
Symbol: Q
3) D-FF, Q = D+
T
4) Toggle FF/Latch Q = Q T + QT
+
Q
or T-FF / Latch
16
Excitation Table
Q Q+ R S J K T D
0 0 x 0 0 x 0 0
0 1 0 1 1 x 1 1
1 0 1 0 x 1 1 0
1 1 0 x x 0 0 1
17
— Conversion between FFs
Example: J-K to D This should
behave like a
D-FF.
D J Q
Logic
Q
K
CLK
D D
Q 0 1 Q
O/P function = J Function = K x x
J=D
0 0 1 K= D
D D
1 x x 1 0
Map the D,Q input combination to a QQ+ transition
and then map this to J-K excitation required.
Thus, when D=1, Q=0, Q+=1 J,K = 1,x
D=0, Q=0, Q+=0 J,K = 0,x D-FF
D=1, Q=1, Q+=1 J,K = x,0
D=0, Q=1, Q+=0 J,K = x,1. J Q
D Q
K
CLK 18
Example 2: D J-K
should work like a J-K
Excitation Table for D
Q Q+ D J K Q Q+
00 0 0 0 0 0 J D Q
01 1 0 0 1 1 Logic
0 1 0 0 K Q
10 0
0 1 1 0
11 1 1 0 0 1
JQ CLK
JK 1 0 1 1
00 01 11 10
Q
1 1 0 1 TT for J-K
0 0 0 1 1
1 1 1 0
1 1 0 0 1
KQ
Function is D JQ K Q J-K FF/Latch
Q
D Q
K Q
J Q
CLK
19
(C) Counter Design
• A counter is a special case of an FSM that cycles through its states
on receiving triggering clock pluses.
• It does not have any external data I/Ps.
100 No external I/Ps
Reset E
A Counter O/P
000 011
D Logic Next State
001 bits
B
C 010
FFs
n n
CLK
• The states need to be encoded by binary bits.
20
State Transition Diagram and Table for a 3-bit Binary Up-Counter
CB
CB
00 01 11 10 A 00 01 11 10
A
0 0 0 0 0
0 1 1 1 1
1 1 0 1 1 0
1 1 1 1
TA=1 TC=AB
CB
A 00 01 11 10 K-maps for Up-Counter Using Toggle
0 0 0 0 0 Flip-Flops.
1 1 1 1 1
TB=A
Obtain logic expr. for FF I/Ps (as functions of current state bits A,
B, C, --- A=QA, B=QB, C=QC) and realize the counter
22
Counters with More Complex Sequencing (Non-Consecutive Binary Outputs)
Present State Next State
000 110 C B A C+ B+ A+
0 0 0 0 1 0
010 101 0 0 1 x x x
0 1 0 0 1 1
011 0 1 1 1 0 1
1 0 0 x x x
State Transition 1 0 1 1 1 0
Diagram 1 1 0 0 0 0
Implementation Using J-K FFs: 1 1 1 x x x
State Transition Table
Present Next Remapped Next
State State State
C B A C B+
+
A+ JC KC JB KB JA KA Q Q+ J K
0 0 0 0 1 0 0 x 1 x 0 x
0 0 0 x
0 0 1 x x x x x x x x x
0 1 0 0 1 1 0 x x 0 1 x
0 1 1 x
0 1 1 1 0 1 1 x x 1 x 0 1 0 x 1
1 0 0 x x x x x x x x x 1 1 x 0
1 0 1 1 1 0 x 0 1 x x 1 Q JQ K Q
1 1 0 0 0 0 x 1 x 1 0 x J-K Flip-Flop Excitation Table
1 1 1 x x x x x x x x x 23
State Transition Table and Remapped Next-State Functions
Next State Functions
JC A KC A
JB 1 KB A C
J A BC KA C
CB CB
00 01 11 10 A 00 01 11 10
A x x 1 x
0 0 0 x x 0 KC
JC
1 x 1 x x x 0
1 x x
CB CB
A 00 01 11 10 A 00 01 11 10
0 1 x x x 0 x 0 1 x
JB KB
1 x x x 1 1 x 1 x x
CB CB
A 00 01 11 10 00 01 11 10
A
0 0 1 0 x JA 0 x x x x KA
1 x x x x 1 x 0 x 1
Remapped K-Maps for J-K Implementation. 24
Actual Implementation ( Using J-K)
C B JA A
A J Q J Q J Q
CLK CLK CLK
K Q K Q K Q
A C KB B C A
Count
signal
A B
KB JA
C C
25