Sequential Logic
Sequential Logic
Overview
Introduction Latches and Flipflops Analysis of Clocked Sequential Circuits Design Procedures of Clocked Sequential Circuits Design of Counter
2011/3/30 9-2
Sequential Systems
A combinational system is a system whose outputs depend only upon its current inputs. A sequential system is a system whose outputs depends on the current inputs and the systems current state.
2011/3/30
9-3
2011/3/30
9-4
2011/3/30
9-5
FlipFlip-Flops/ Latches
Latches and Flip-Flops are devices that can have two internal states (0,1) The output of a latch or a Flip-Flop (FF) is dependent upon its CURRENT STATE and CURRENT INPUTS. Latches and FFs are the simplest examples of sequential systems.
2011/3/30
9-6
Latch
Bistable memory element A bistable multivibrator Can store one bit of data. Types of latch According to modes of operation.
2011/3/30
Asynchronous latches :
Operate independently of any type of clock or timing. Data will be stored as soon as the input attain a valid voltage level.
Input
Q Q
D Q Q
2011/3/30 9-8
Synchronous latches :
Has some additional control circuit and enable input. Level triggered, or level sensitive.
Input Clock D EN Q Q True Output Complement Output
D EN 0 1 0 1 1 1 0 0
Q 0 1 NC NC
Q 1 0 NC NC
D EN Q Q
2011/3/30
NC : No Change
9-9
SR Latch :
Set-Reset flip-flop. Cross-coupled NOR gates. Direct-coupled RS flip-flop NOR gate latch.
R (Reset)
Q Q Q Q S (Set) R (Reset)
9-10
(Set) S
2011/3/30
S R
Q Q
(Set) S
S R 0 0 1 1
2011/3/30
Q Q
Operation
0 1 0 1
Feedback : Output is fed back to the input. Cross-coupled feedback : Output of one of the NOR gate is fed back to the other NOR gate.
000 Q x1 1 Q 00 0 Q Q x11 0 S (Set) 1 R (Reset)
9-12
1 R (Reset)
(Set) S 0
2011/3/30
(Set) S 1 0 R (Reset)
Q 000
(Set) S 0 1p0
Q 000
000 Q
R (Reset)
01010 Q
(Set) S 0
2011/3/30
Q 111
(Set) S 1p0
Q 01010
Race condition
9-13
The actual circuit does not oscillate between 00 to 11 indefinitely, but rather ends up sometimes in state 10 and sometimes in state 01.
011 Q 1p1 R (Reset) 000 Q
1p0 R (Reset)
(Set) S 1p1
Q 000
(Set) S 1p0
Q 011
2011/3/30
9-14
S R
Q Q0=0
2011/3/30
9-15
S R 1 1 0 0
2011/3/30
Q Q
Operation
1 0 1 0
CP
0 01 1 01 11 1 0 10 1
11 10 0
Q
R
11 01 0
S x 0 0 1 1 R Q x Q0 0 Q0 1 0 0 1 1 ? Q Q0 Q0 1 0 ? Operation Hold (Disable) Hold Reset Set Unstable
9-17
Function table
CP 0 1 1 1 1
2011/3/30
CP Q S
Characteristic table
Q ( t ) , Q present state : the state before the application of a clock pulse ( to CP ). Q ( t +1 ) next state : the state after the application of a clock pulse ( to CP ).
2011/3/30
9-18
Characteristic table
Q S R 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 Q ( t+1 ) 0 0 1 Indeterminate 1 0 1 Indeterminate
2011/3/30
9-19
Characteristic Equation
SR Q 00 0 0 1 1 01 0 0 11 10 x x 1 1 S RQ
Q ( t +1 ) = S + RQ
S and R cannot equal to 1 simultaneously @ SR = 0 must be include as a part of the characteristic equation.
Q ( t +1 ) = S + RQ SR = 0
2011/3/30 9-20
Graphic symbol
S CP R Q
CP 0 1 1 1 1
2011/3/30
S x 0 0 1 1
R Q x Q0 0 Q0 1 0 0 1 1 ?
Q Q0 Q0 1 0 ?
2011/3/30
9-22
Logic diagram
Q
CP Q
D CP
S CP R
Q Q
9-23
2011/3/30
Characteristic table
Q D 0 0 1 1 0 1 0 1
Characteristic equation
D Q 0 0 0 1 0 1 1 1 D
Q ( t+1 ) 0 1 0 1
Q ( t+1 ) = D
Graphic Symbol
D CP Q Q
9-24
2011/3/30
2011/3/30
9-25
TTL Latch IC
Latch Type Gated D latch Gated D latch SR latch Gated D latch Gated D latch
2011/3/30
DIP
Description
16-pin 4-bit latch, true and complement outputs 24-pin Dual 4-bit latch, true outputs with clear input 16-pin Quad SR latch
74LS373 20-pin Octal 3-state outputs Active low enable 74LS375 16-pin 4-bit latch, true and complement outputs
9-26
CMOS Latch IC
Latch Type Gated D latch Gated D latch Gated D latch Gated D latch TTL No. DIP Description
74HC75 16-pin 4-bit latch, true and 74HCT75 complement outputs 74HC77 14-pin 4-bit latch, true outputs 74HCT77 74HC373 20-pin Octal 3-state outputs 74HCT373 Active low enable 74HC573 20-pin 8-bit latch, complement 74HCT573 outputs with 3-state
9-27
2011/3/30
Latch IC Parameters : D
tSU
CP Q
Setup time tSU : The amount of time that the inputs must be stable before the device is enable
9-28
2011/3/30
D
tSU tH
CP Q
Hold time tH : The amount of time that the inputs must be stable after the device has completed its operation.
9-29
2011/3/30
D
tSU tH tW tPLH
CP Q
Pulse width (Enable) tW : The amount of time that the enabling pulse must be active for the device to be properly enabled. Propagation delay time, Low-to-high tPLH .
9-30
2011/3/30
Outputs Q 0 1 Q0 Q0 0
9-31
2011/3/30
2 3 13 6 7 4
16 1 15 14 10 11 9 8
Inputs D 0 1 x C 1 1 0
Outputs Q Q 0 1 1 0 Q0 Q0
2011/3/30
9-32
Voltage bounce Due to the physical vibration of the contacts of the mechanical switch upon closure.
Vcc
Actual
bounce
2011/3/30 9-33
Debounce Circuit
Vcc
Vcc
R Debounced output
R S R R Q Q
Debounced output
R Vcc Vcc
2011/3/30
9-34
JK Flip-Flop (FF) :
A refinement of RS FF. Logic Diagram : J is for set, K is for reset.
R J CP K S
R Q
Q S
2011/3/30
Characteristic table
Q ( t+1 ) 0 0 1 1 1 0 1 0 J K Q 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 Q ( t+1 ) 0 1 0 0 1 1 1 0
Hold Reset Set Toggle
Q J K 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1
2011/3/30
9-36
Characteristic Equation
JK Q 00 0 0 1 1 01 0 0 11 10 1 0 1 1 JQ KQ
Q ( t +1 ) = JQ + KQ
Note: CP=1, J=K=1 Q(t+1) = Q Toggle Oscillation. How to avoid oscillation : The clock pulse duration must be shorter than the propagation delay time of the FF.
2011/3/30 9-37
2011/3/30
9-38
T Flip-Flop :
Tie the inputs of JK type together. T Toggle, change state. Logic diagram
T CP
R Q
Q S
2011/3/30
9-39
Q ( t+1 ) = TQ + TQ
Note : CP = 1, T = 1 Oscillation
2011/3/30
9-40
Flip-Flop Operation
Flip-Flop :
Bistable storage device Differ from latch in method triggering
Flip-Flop triggering :
2011/3/30
2011/3/30
9-42
Types of triggering :
Pulse-triggered :
Respond to the inputs when the clock make a transition from LOW to HIGH, than back to LOW.
2011/3/30
9-43
2011/3/30
9-44
2011/3/30
9-45
2011/3/30
9-46
When Clock is LOW, the Master Latch is Disabled & Slave Latch is Enabled. Hence, the path from the input to the output is broken. Great! When the Clock is High, if the value of X changes, only the value of Y changes. Value of Z will not be affected. State (value) of the flip-flop is the state (value) of the slave latch.
Master-slave FF :
RS Master-slave FF
Logic diagram :
Y S C Q C Y R Q R Q Q S Q Q
Master
Slave
CP
2011/3/30
9-49
Timing relationship :
S 1 C Y S Q C Y 0 R Q R S
Master
Slave
Q Q
CP
CP S Y Q Pulse-triggered device.
2011/3/30 9-50
Master-slave JK FF
Logic diagram : Master Slave
5
J K
Q Q
Clock
2011/3/30 9-51
Master K 2
R Q
Slave 4
R Q
Clock
Clock J K Y Q
2011/3/30 9-52
Edge-triggered Flip-flop :
2 Clock 3
6 R
2011/3/30
9-53
NAND gate latches : NAND 1 and 2. NAND 3 and 4. NAND 5 and 6. S = 0, R = 1 Q ( t+1 ) = 1 S = 1, R = 0 Q ( t+1 ) = 0 S = 1, R = 1 Q ( t+1 ) = Q ( t )
2011/3/30
9-54
2). D = 1
1 1 S 1 Q(t+1) = Q(t) 1 R 0
9-55
2 0
2011/3/30
2. Clock = 0 p 1 1). D = 0
D Clock 1 1 o 0 Clock 3 0 00 S 1 11 Q(t+1) = 0 1 00 R 1 11 Clock 1 o 0
0 D
2011/3/30
4). D = 0 p 1
D Clock 1 0010 1 S 1110 1 Oscillation 1010 1 R 1010 1
9-57
1 D
2011/3/30
3. Clock = 1 1). D = 1 p 0
D Clock 1 1 11 S 0 00 Q(t+1) = 1 Clock 3 0 o 1 D
2011/3/30
2 1
2 1
1 11 R 0 11
2 1
D
2011/3/30
5). D = 0 p 1
D Clock 1 000 S 111 Q(t+1) = 0 Clock 3 1 o 0 000 R 111
9-60
2 1
2 1
1 11 R 1 00
2 00 11 Clock 3 01 11 D
2011/3/30
D Clock 1
1 0 00 0 0 01
2 00 11 Clock 3 10 00 D
2011/3/30
00 00 S 11 11 Q(t+1) = 0 10 00 R 11 11
2 01 11 Clock 3 00 11 D
2011/3/30
SR Flip-Flop
D CLK Q
JK Flip-Flop
T CLK Q
D Flip-Flop
2011/3/30
T Flip-Flop
9-64
Inputs
Clear Q K Q J
Outputs Q 1 Q0 1 0 Q0
9-65
CLK
2011/3/30
Clear CLK J K Q 0 x x x 0 1 q 0 0 Q0 1 q 0 1 0 1 q 1 0 1 1 q 1 1 Q0
D Flip-Flop
Delay or Data Flip-Flop
D Q D Q
CLK Q
D CLK Q Q
2011/3/30 9-67
D Flip-Flop IC
IC 74 174 Type Dual D Hex D Outputs Q, Q Q Features Preset, Clear Clear Clear Clear Output enable Output enable Output enable
171/175 Quad D Q, Q 273 Octal D Q 374/377 Octal D Q 378 Hex D Q 379 Quad D Q, Q
2011/3/30
9-68
74LS273 D Flip-Flop IC
3 4 7 8 13 14 17 18 1 11
74273
1D 2D 3D 4D 5D 6D 7D 8D CLR CLK 1Q 2Q 3Q 4Q 5Q 6Q 7Q 8Q
2 5 6 9 12 15 16 19
2011/3/30
9-69
1D CLK
D R
2D
3D
4D
5D
6D
7D
8D
D R
D R
D R
D R
D R
D R
D R
CLR 1Q 2Q 3Q 4Q 5Q 6Q 7Q 8Q
2011/3/30
9-70
SR Flip-Flop
Set-Reset Flip-Flop
S R CLK Q Q S R CLK Q Q
2011/3/30
SR FF wired as a D FF
S R
CLK Q
2011/3/30
9-72
Example
A B S R CLK Q Q Qa A B S R CLK Q Q Qb A B S R CLK Q Q Qc
A B CLK Qa Qb Qc
2011/3/30 9-73
JK Flip-Flop
J K CLK Q Q
J K CLK Q Operation 0 0 1 1
2011/3/30
0 1 0 1
o Q0 o 0 o 1 o Q 0
JK FF wired as a D FF
D
J K CLK Q Q
JK FF wired as a T FF
1
J K CLK Q Q
2011/3/30
9-75
Example : IC 7476
4 16 1 3 2 1J 1K
7476 1Q
1Q
15 14
2J 2K
7476 2Q
2Q
11 10
2011/3/30
JK Flip-Flop ICs :
no. of FF Trigger 7470 74H71 7473 74LS73 7476 74LS76 74LS107 74LS109 74111 74LS114 74276 74376
2011/3/30
Synchronous Sequential Logic Preset Clear Yes Yes No No Yes Yes No Yes Yes Yes Yes No Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
9-77
1 1 2 2 2 2 2 2 2 2 4 4
Leading Pulse Pulse Trailing Pulse Trailing Pulse Leading Pulse Trailing Trailing Leading
J-K Flipflop: versatile building block can be used to implement D and T FFs usually requires least amount of logic to implement ?In,Q,Q+) but has two inputs with increased wiring complexity because of 1's catching, never use master/slave J-K FFs edge-triggered varieties exist D Flipflop: minimizes wires, much preferred in VLSI technologies simplest design technique best choice for storage registers T Flipflops: don't really exist, constructed from J-K FFs usually best choice for implementing counters Preset and Clear inputs highly desirable!!
J D
Q Q
Q D J Q Q
Q Q+ 0 0 0 1 1 0 1 1
X 0 1 0
S 0 1 0 X
J K 0 X 1 X X 1 X 0
T 0 1 1 0
D 0 1 0 1
Q
D 0 0 1 0 0 1 1 1
Implementing D FF with a J-K FF: 1) Start with K-map of Q+ = F(D, Q) 2) Create K-maps for J and K with same inputs (D, Q)
Q+ = D
3) Fill in K-maps with appropriate values for J and K to cause the same state changes as in the original K-map
D D 0 0 1 0 X 1 1 X Q 0 1 0 X 1 1 X 0
E.g., D = Q= 0, Q+ = 0 then J = 0, K = X
J= D
K =D
J 00 01 0 1 0 0 0 0 11
J 10
J
Resulting equation is the combinational logic input to D to cause same behavior as J-K FF. Of course it is identical to the characteristic equation for a J-K FF.
Ax CLK A+B
B B y
CLK Q (A+B)x
2011/3/30
9-82
2011/3/30
9-83
State Table :
Consist of 4 section :
present input next
state
state output
2011/3/30
Present state AB 00 01 10 11
2011/3/30
State Diagram
A state is represent by a circle. Direct lines : transition between the states. Examples:
0/0 00
Input/Output
0/1 0/1
1/0 10 1/0 11
9-86
1/0 01
2011/3/30
0/1
1/0
The logic diagram of a sequential circuit consists of flip-flops and gates. Circuit Output Functions The parts of the combinational circuit that generates external outputs are described algebraically by a set of Boolean functions. Flip-flop Input Functions (Input Equation) The parts of the circuit that generates the inputs to flip-flops are described algebraically by a set of Boolean functions.
9-87
2011/3/30
Ax Ax+Bx D Bx Q CLK Q
Ax
B B y
2011/3/30
9-88
B y B C x B C x
K CLK CLK J
2011/3/30
9-89
Characteristic Tables :
JK Flip-flop J K Q(t+1) 0 0 1 1 0 1 0 1 Q(t) No change 0 Reset 1 Set Q(t) Complement D Flip-flop D Q(t+1) 0 1
2011/3/30
0 1
Reset Set
Step : Obtain the binary value of each flip-flop input function in terms of the present states and input variables. Use characteristic table to determine the next states.
2011/3/30
9-91
Example :
J CLK CLK K Q Q A
J CLK K
Flip-flop Inputs JA KA JB KB 0 0 1 1 0 0 1 1 0 0 1 0 0 0 1 0 1 0 1 0 1 0 1 0 0 1 0 1 1 0 1 0
JA = B KA = Bx JB = x KB = A x
0 0 1 1 0 0 1 1
9-93
2011/3/30
9-94
Moore Machine :
The outputs depend only on the present state.
xi
Combinational Logic
Flip Flops
yk
Mealy Machine :
The outputs depend only on the present state and the present value of the inputs. xi yk
Combinational Logic Flip Flops
0/0
1/1
1. Example of input sequence 01010110100 start from initial state a. state a a b c d e f f g f g a input 0 1 0 1 0 1 1 0 1 0 0 output 0 0 0 0 0 1 1 0 1 0 0
0/0 a 0/0 1/0 b 1/0 g 0/0 1/1
2011/3/30 9-98
0/0
1/1
Present state a b c d e f g
2011/3/30
3. Two states are said to be equivalent if, for each member of the set of the inputs, they give exactly the same output and send the circuit either to the same state or to an equivalent state. Reducing the state table : Present state a b c d e f g
2011/3/30
Present state a b c d e
2011/3/30
9-101
Synchronous Sequential Logic 5. The final reduced state diagram : 0/0 a 0/0 1/0 0/0 e 1/1 0/0 d 1/1
2011/3/30 9-102
2011/3/30
9-103
State Assignment :
Reduce the cost of combinational circuit part of a sequential circuit : 1). Using simplification method for combinational circuit. 2). Appropriate state assignment : The complexity of combinational circuit obtained depends on the binary state assignment chosen.
2011/3/30
9-104
Synchronous Sequential Logic Challenging Problem : No state-assignment procedures that guarantee a minimal-cost combinational circuit. Example : Three possible binary state assignments State Assignment1 Assignment2 Assignment3 a b c d e
2011/3/30
Present Next state Output state x=0 x=1 x=0 x=1 a a b 0 0 b c d 0 0 c a d 0 0 d e d 0 1 e a d 0 1 Reduced state table with binary state assignment 1 Present state 001 010 011 100 101
2011/3/30
Next state x=0 x=1 001 010 011 100 001 100 101 100 001 100
Design Procedures
Recommended Steps :
00
1 11 1
10 0
9-109
Present state A B 0 0 0 1 1 0 1 1
5. Determine the number of flip-flop and assign a letter symbol to each. 4 states 2 flip-flops letter symbol : A and B 6. Choose the type of flip-flop.
Example : choose JK flip-flops.
A Q K
2011/3/30
A Q J
B Q K
B Q J
9-111
Q K KA A A B B
Q J JA
Q K KB
Combinational Circuit
x External input
2011/3/30
9-112
JA
01 0 x 11 10 0 x 1 x
Bx A 00 0 x 1 0
KA
01 x 0 11 10 x 1 x 0
JA=Bx
Bx A 00 0 0 1 0
2011/3/30
KA=Bx
Bx A 00 0 x 1 x
JB
01 1 1 11 10 x x x x
KB
01 x x 11 10 0 1 1 0
9-114
JB=x
KB= ( A x )
Q K KA
Q J JA
Q K KB
Q J JB Clock
x
2011/3/30 9-115
B 0 0 1 1 0 0 1 1
x 0 1 0 1 0 1 0 1
2. Derive circuit output function and flip-flop input function : Since DA = A(t+1), DB = B(t+1) Excitation = Next state DA(A, B, x) = (2, 4, 5, 6) DB(A, B, x) = (1, 3, 5, 6) y(A, B, x) = (1, 5)
Bx A 00 0 0 1 1
DA
01 0 1 11 10 0 0 1 1
Bx A 00 0 0 1 0
DB
01 1 1 11 10 1 0 0 1
Bx A 00 0 0 1 0
y
01 1 1 11 10 0 0 0 0
DA=AB + Bx
2011/3/30
DB=Ax + Bx + ABx
y=Bx
9-117
A A
CLK Q
D CLK
B B
CLK Q
y
2011/3/30 9-118
9-119
2. State Table :
Present state Input Next state A 0 0 0 0 0 0 1 1 1 1 B 0 0 1 1 1 1 0 0 0 0 C 1 1 0 0 1 1 0 0 1 1 x 0 1 0 1 0 1 0 1 0 1 A 0 0 0 1 0 1 1 1 0 1 B 0 1 1 0 0 0 0 0 0 0 C 1 0 1 0 1 0 1 0 1 0 Flip-flop Inputs SA RA 0 x 0 x 0 x 1 0 0 x 1 0 x 0 x 0 0 1 x 0 SB RB SC RC 0 x x 0 1 0 0 1 x 0 1 0 0 1 0 x 0 1 x 0 0 1 0 1 0 x 1 1 0 x 0 x 0 x x 0 0 x 0 1 Output y 0 0 0 0 0 0 0 1 0 1
9-120
2011/3/30
Unused states : ( 000, 110, 111) For variables : A B C x m0 , m1 , m12 , m13 , m14 , m15 unused treat as dont care condition.
2011/3/30
9-121
RA
SA = B x
2011/3/30
RA = C x
9-122
Cx 00 AB 00 x 01 x 11 x 10
SB
01 x 11 10 1
Cx 00 AB 00 x 01
RB
01 x 1 x x 1 x x 11 10 x 1 x x
11 x 10 x
SB = A B x
Cx 00 AB 00 x 01 1 11 x 10 1
2011/3/30
RB = B C + B x
Cx
SC
01 x 11 10 x x x x x x
RC
01 x x x x 11 10 1 1 x 1
9-123
00 AB 00 x 01 11 x 10
SC = x
RC = x
y
00 AB 00 x 01 11 x 10 x 1 x 1 x Cx 01 x 11 10
y=Ax
2011/3/30
9-124
CLK R
S CLK R
Q Q B
S CLK
2011/3/30
Q Q
9-125
CLK R
5. Problem : What if a circuit is not reset to a initial valid state ? Check unused state : A=B=C=0, x=0 (m0) from filp-flop input function : SA=RA=0, SB=RB=0, SC=1, RC=0, y=0 Flip-flop C : set , i.e. 000
0/0
001
2011/3/30
9-126
A=B=C=0, x=1 (m1) from filp-flop input function : SA=RA=0, SB=1, RB=0, SC=0, RC=1, y=0 Flip-flop B : set , i.e. 000
1/0
010
111
Synchronous Sequential Logic 0/0 001 0/0 1/0 0/0 101 1/1 0/0 100 1/1 011 1/0 1/0 1/1 010 1/1 111 110 0/0 1/0 0/0 000
2011/3/30
9-128
Design of Counter
Counter : A sequential circuit that goes through a prescribed sequence of states upon the application of input pulses (count pulse). Binary Counter : A counter that follows the binary sequence.
2011/3/30
9-129
010
110
011 100
2011/3/30
101
9-130
2. Choose the type of Flip-flop T Flip-flop 3. Derive the circuit excitation table and output table :
Present state A2 A1 A0 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1
2011/3/30
Next state A2 A1 A0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 0 0 0
TA1
A1A0 A 00
2
TA0
A 1A 0 A 00
2
01 0 0
11 10 1 1 0 0
01 1 1
11 10 1 1 0 0
01 1 1
11 10 1 1 1 1
0 0 1 0
0 0 1 0
0 1 1 1
TA2=A1 A0
TA1= A0
TA0= 1
2011/3/30
9-132
Q T
Q T
Q T Count pulse
2011/3/30
9-133
010 100
2011/3/30
101
9-134
2. Choose the type of Flip-flop JK Flip-flop 3. Derive the circuit excitation table and output table :
Present state A2 A1 A0 0 0 0 0 0 1 0 1 0 1 0 0 1 0 1 1 1 0
2011/3/30
Next state A2 A1 A0 0 0 1 0 1 0 1 0 0 1 0 1 1 1 0 0 0 0
4. Derive the circuit output function and flip-flop input function : m3 and m7 : dont care condition. JA2 = B JA1 = C JA0 = B KA2 = B KA1 = 1 KA0 = 1
2011/3/30
9-136
Q K
Q J
Q K
Q J
Q K
Q J Count pulse
2011/3/30
9-137
6. Check m3 ant m7
011 p 100 111 p 000
A2 A1 A0
0 1
Q K Q J Q K Q J
1 0
Q K Q J
1 0
Count pulse
1
2011/3/30 9-138
111
010 100
101 011
2011/3/30
9-139