CH5 - Synchronous Sequenctial Circuit
CH5 - Synchronous Sequenctial Circuit
Sequential Logic
https://youtu.be/fXeQxZqU_Bg
Sequential Circuits
• Output depends on current input and past history of inputs.
Inputs Outputs
Combinational
Circuit Memory
Elements
Sequential Circuits
• “State” contains all the information about the past needed to predict
current output based on current input.
• State variables, one or more bits of information.
Inputs Outputs
Combinational
Circuit Flip-flops
Clock pulses
Clock pulses
Real life examples
• A traffic light controller.
• A vending machine (the money acceptance and change return).
• A password checker (in an electronic door lock).
Clock signals
• Very important with most sequential circuits
• State variables change state at clock edge.
Clock
• Using a 555
timer IC /8038
IC
Bistable element
• The simplest sequential circuit
• Two states
• One state variable, say, Q
HIGH LOW
LOW HIGH
Bistable element
• The simplest sequential circuit
• Two states
• One state variable, say, Q
LOW HIGH
HIGH LOW
Metastability
• Metastability is inherent in any bistable circuit
Both transistors
are in saturation.
Huge current flow
causes huge
power loss.
(reset)
(set)
SR Latch
S-R latch operation
Metastability is possible
if S and R are negated
simultaneously.
S-R latch timing parameters
• Propagation delay
• Minimum pulse width
S-R latch symbols
S-R latch using NAND gates
S-R latch with enable
D latch
• Level sensitive
D-latch operation
Propagation delay
D-latch timing parameters
• Propagation delay (from C or D)
• Setup time (D before C edge)
• Hold time (D after C edge)
Edge-triggered D flip-flop behavior
• Clock enable
Edge-triggered D circuit
• Preset and clear
inputs
• like S-R latch
• 3 feedback
loops
• interesting
analysis
• Light loading on
D and C
Dual D Flipflop
• CLR=0; Q=0
• PR=0;Q=1
Other D flip-flop variations
• Negative-edge triggered
• Clock enable
J-K flip-flops
• Not used
much
anymore
D = JQ’ + K’Q
T flip-flops
T flip-flops
• Important for counters
• D = EN Q
Characteristic Tables & Equations
JK Flip-Flop D Flip-Flop T Flip-Flop
J K Q(t+1) D Q (t+1) T Q (t+1)
0 0 Q(t) No change 0 0 Reset 0 Q (t) No change
0 1 0 Reset 1 1 Set 1 Q’ (t) Complement
1 0 1 Set
1 1 Q’(t) Comlement
Q (t + 1) = D
Q (t + 1) = JQ’ + K’Q
Q (t + 1) = T Q = TQ’ + T’Q
● Q(t+1) = D
C QN Q0’
Q0(t+1) = D0 = Q0.x + Q1.x
●
D1 Q1(t+1) = D1 = Q0’.x
● D Q Q1
y
Analysis of Sequential Ckt
Sate Table Present Next State
Present Next State (Q0*Q1*) Output (y)
State Input State Output (Q0Q1) x=0 x=1 x=0 x=1
Q0 Q1 x Q0 * Q1 * y 00 00 01 0 0
0 0 0 0 0 0 01 00 11 1 0
10 00 10 1 0
0 0 1 0 1 0
11 00 10 1 0
0 1 0 0 0 1
0 1 1 1 1 0 Next State Output
Present
1 0 0 0 0 1 State x=0 x=1 x=0 x=1
1 0 1 1 0 0 A A B 0 0
1 1 0 0 0 1 B A D 1 0
1 1 1 1 0 0 C A C 1 0
D A C 1 0
Q0(t+1) = Q0* = Q0 x + Q1 x
Q1(t+1) = Q1* = Q0’ x
Analysis of Sequential Ckt
• Step 1: Write state and output 0/0 1/0
0/1
equations 00 10
• Determine the flip-flop input eqn in
terms of present state and input 0/1
variables. 1/0 0/1 1/0
x D0
D Q Q● z
y 0
CLK C QN Q0’
Present Inputs Next State
State (Q0) x y (Q0*)
0 0 0 0
0 0 1 1
00, 11 00, 11 0 1 0 1
01, 10
0 1 0 1 1 0
1 0 0 1
01, 10 1 0 1 0
1 1 0 0
1 1 1 1
Practice Problem
x D Q ● F
1
CLK C QN
Analysis with JK Flip-Flop
J0
J Q ●
State Equations:
Q0
C Q0* = J0Q’0 + K’0Q0
x K0 Q’0
● ●
● K QN = Q1Q’0 + (Q1x’)’Q0
J1
J Q ●
Q1
CLK ● C
K1
K QN
0 Q’1
Analysis with JK Flip-Flop
Present Next Flip-Flop 1
Input 1
State State Inputs
0
Q0 Q1 x Q0 * Q1 * J0 K0 J1 K1 00 11
0 0 0 0 1 0 0 1 0
0 0 1 0 0 0 0 0 1
0 0 0
0 1 0 1 1 1 1 1 0
0 1 1 1 0 1 0 0 1
1 0 0 1 1 0 0 1 1 01 10
1
1 0 1 1 0 0 0 0 0
1
1 1 0 0 0 1 1 1 1
1 1 1 1 1 1 0 0 0
Analysis with T Flip-Flop
x ● T0
T Q Q y
0
C QN
T1
T Q ●
Q1
CLK ● C QN
State Equations:
T0 = Q1 x Q0* = T0 Q0 = T0Q’0 + T’0Q0 = Q’0Q1x + Q0Q’1 + Q0x’
T1 = x Q1* = T1 Q1 = T1Q’1 + T’1Q1 = Q’1x + Q1x’
y= Q0Q1
Analysis with T Flip-Flop
0
0
Present Next State 1
00/0 01/0
State (Q1*Q0*) Output
(Q1Q0) x=0 x=1 x=0 x=1
00 00 01 0 0 1 1
01 01 10 0 0
10 10 11 0 0
11/1 1
10/0
11 11 00 1 1
0 0
0/0
0/0 b c
1/0 1/0
g 0/0
d e
0/0
1/1
1/1
1/1
State a a b c d e f f g f g
f Input 0 1 0 1 0 1 1 0 1 0 0
1/1 Output 0 0 0 0 0 1 1 0 1 0 0
State Reduction
0/0 Present Next State Output
0/0 State x=0 x=1 x=0 x=1
a
a a b 0 0
1/0 0/0
b c d 0 0
0/0
0/0 b c c a d 0 0
d e f 0 1
1/0 1/0 e a f 0 1
g 0/0
d e f g f 0 1
0/0 g a f 0 1
1/1 1/1
1/1 Present Next State Output
f State x=0 x=1 x=0 x=1
1/1 a a b 0 0
b c d 0 0
c a d 0 0
Both ‘e’ and ‘g’ have same next state d e f 0 1
and same output. So can remove ‘g’ e a f 0 1
and replace all ‘g’ with ‘e’ f e f 0 1
State Reduction
Present Next State Output
0/0
State x=0 x=1 x=0 x=1
a
a a b 0 0
0/0 0/0
b c d 0 0 1/0
c a d 0 0 0/0
e b c
d e d 0 1
e a d 0 1 0/0 1/0
1/1 1/0
State Table
Present Next State Output
Present Next State Output ( Q1*Q0* ) (y)
State
State x=0 x=1 x=0 x=1 ( Q1Q0 ) x=0 x=1 x=0 x=1
A A B 0 0 00 00 01 0 0
B A C 0 0 01 00 10 0 0
C A D 0 1 10 00 11 0 1
D A D 0 1 11 00 11 0 1
Next State Equations
Q0x Q0x
Q1 00 01 11 10 Q1 00 01 11 10
0 0 0 1 0 0 0 0 0 0
1 0 1 1 0 1 0 1 1 0
Q1 * = Q1 x + Q 0 x y = x Q1
1 1 0 1 1 X
1 0 X 1
1 1 X 0
Q* = T Q = TQ’ + T’Q
Q Q* T
0 0 0
0 1 1
1 0 1
1 1 0
Circuit Diagram w/ D Flip-Flop
D Q ● ● Q0
x ● ● ● ●
C QN ● Q’0
y
D Q ● Q1
CLK ● C QN
Q0* = D0 = Q1 x + Q’0 x
Q1* = D1 = Q1 x + Q0 x
y = x Q1
Circuit Diagram w/ JK Flip-Flop
Q0 x
Present Next 00 01 11 10
Q1
State Input State Flip-Flop Inputs
0 0 1 X X
Q1 Q0 x Q1 * Q0 * J1 K1 J0 K0
1 0 1 X X
0 0 0 0 0 0 X 0 X
0 0 1 0 1 0 X 1 X J0 = x
0 1 0 0 0 0 X X 1
Q0x
0 1 1 1 0 1 X X 1 Q1 00 01 11 10
1 0 0 0 0 X 1 0 X X X 1 1
0
1 0 1 1 1 X 0 1 X
1 X X 0 1
1 1 0 0 0 X 1 X 1
1 1 1 1 1 X 0 X 0 K0 = Q1’ Q0 + Q0 x’
Q1Q0 Q0 x
x 00 01 11 10 Q1 00 01 11 10 Q Q* J K
0 0 0 X
0 0 0 1 0 0 X X X X
0 1 1 X
1 X X X X J1 = Q1 Q0 1 1 0 0 1 K1 = x’ 1 0 X 1
1 1 X 0
Circuit Diagram w/ JK Flip-Flop
x J0
J Q ●
Q0
C
.. K0
K QN
Q’0
J1
J Q ●
Q1
CLK ● C
K1
K QN .Q’ 1
J0 = x J1 = Q1 Q0
K0 = Q1’ Q0 + Q0 x’ K1 = x’
Design w/ T Flip-Flop
Present Flip-Flop Design a 3 000
bit
State Next State Inputs synchronous
001 111
Q2 Q1 Q0 Q2* Q1* Q0* T2 T1 T0 up counter
0 0 0 0 0 1 0 0 1
State
010 110
0 0 1 0 1 0 0 1 1 Diagram
0 1 0 0 1 1 0 0 1
0 1 1 1 0 0 1 1 1 011 101
1 0 0 1 0 1 0 0 1 100
1 0 1 1 1 0 0 1 1 Q1Q0
Q2 00 01 11 10
1 1 0 1 1 1 0 0 1
1 1 1 0 0 0 1 1 1 0 1 1 1 1
1 1 1 1 1 T0 = 1
Q1Q0 Q1Q0
Q2 00 01 11 10 Q2 00 01 11 10
0 0 0 1 0 0 0 1 1 0
1 0 0 1 0 T2 = Q1Q0 1 0 1 1 0 T1 = Q0
Circuit Diagram w/ T Flip-Flop
T2
T Q Q2
C QN
T1 ● T Q ● Q1
● C QN
T0 Q0
1 T Q ●
CLK ● C QN
HDL for Sequential Circuits
• There are 2 kinds of behavioral statements
• initial
• Executes only once beginning at time = 0
• always
• Execute repeatedly and re-executes until the simulation terminates
• A module may contain an arbitrary number of initial or always
statements.
• These statements execute concurrently with respect to each other at
time 0.
HDL for Sequential Circuits
initial initial
begin begin
clock = 0; clock = 0;
repeat (30) #300 $finish;
#10 clock = ~clock; end
end always
#10 clock = ~clock;
In the absence of an assigned value, the Verilog compiler assumes that the
value of A caused by the if statement must be maintained until the next time
this if statement is evaluated. This notion of implied memory is realized by
instantiating a latch in the circuit.
Solution:
(a) RegA=125;
RegB=125;
(b) RegA=125;
RegB=50;
HDL to Circuit (<= , =)
module Seq_Ckt ( input A, B, C, output reg Q,input CLK,);
reg E;
With non-blocking (<=)
always @ ( posedge CLK)
begin
E <= A && B;
Q <= E || C;
end
endmodule
RST ●
T Q ●
T1 Q1
CLK ● C
HW – text book: 4 th edition
• 5-2, 5-4, 5-6~5-10, 5-12, 5-13, 5-16, 5-18, 5-19(a), 5-22~5-24, 5-26, 5-
30, 5-31, 5-35, 5-36, 5-38, 5-40, 5-44