Professional Documents
Culture Documents
Sequential Circuits: Digital Systems
Sequential Circuits: Digital Systems
Chapter 4
1 Sequential Circuits
Dr. Iness NEDJI MILAT (Lecturer)
iness.nedji@ensia.edu.dz
Some sequential circuits may not Internal input Storage element contain
Internal
combinational circuits, but only (present state) storage elements output (next
Sequential circuit state)
Ex : Registers (set of bits).
The output of a sequential circuit depends not only on current inputs but also on the previous
outputs (states).
3 Storage elements
Internal outputs of a sequential circuit are fed back via storage elements
The storage elements (memory) are circuits that are capable of storing binary
information.
The binary information stored in these memory elements at any given time
defines the state of the sequential circuit at that time.
Each storage element memorize one bit with two states (0 or 1)
4 Types of sequential circuits
Sequential circuits can be Asynchronous or Synchronous.
Clk
5 The clock
clock
high rising
fallin
edge
g
1 edge
clock
period clock
low
6 Clock Disciplines
State changes occur in sequential circuits only when the clock ticks.
Level sensitive
State changes when clock is high (or low) Circui
t
CL
K
Edge triggered
State changes at clock edge
Circui
positive edge-triggered t
CL
K
negative edge-triggered
Circui
t
CL
K
7
Basic Storage Element
8 Basic storage elements
Generally, there are two types of storage elements used: Latches, and Flip-Flops.
A latch has two stages Set and Reset. Set input sets the output to 1. Reset input sets the
output to 0.
Flip-flops : A flip-flop is a synchronous memory element that has clock signals control the
state of the circuit.
SR
Latch
Active Active
Low High
To avoid
11 Timing Diagram Representation
1 1 0 0
0 Q’ 0 Q’ 1 1
Q’ Q’
1
R
0
S 1
0
Q 1
0
Q’ 1
0
00 01 11 10
0 0 0 X 1 characteristic equation
1 1 0 X 1 Q(t+1) = S + R’ Q(t)
Next state Present state
Q+ Q
13 SR gated Latch
Similar to the SR latch but with the extra control input EN which enables or disables
the operation of the S and R inputs.
When EN=1, the gated SR latch operates as an SR latch.
When EN=0, S and R are disabled and the circuit persists in the preceding state.
EN S R Q Q+
R
0 x x 0 0
Q 0 x x 1 1
EN 1 0 0 0 0
1 0 0 1 1
Q 1 0 1 x 0
S 1 1 0 x 1
1 1 1 x NA
14 Takeaway
The fact:
Set-Reset (SR) Latch can store one bit and we can change the value of the stored bit.
But,
The problem:
SR Latch has a forbidden state.
Question:
How do we avoid the forbidden state of SR Latch?
Response:
Ensure that inputs S and R How ?
Q+ = Q(t+1) = D
D Latch can change a value of bit like an SR Latch while avoiding the forbidden
state.
But, how can it store the bit? By using D Flip-Flop
16 D Latch
• Data (D) Latch D S Q
• Easier to use than an SR latch
R Q
• No possibility of entering an undefined state
D S Q
D Q
CLK cl R
k
TruthTable
Excitation Table clk D Q+
CLK D
0 0 Q
Store bit
↑ 0 0 1
0 1 Q
↑ 1 1 0 Reset bit
1 0 0 1
↑ : Rising Edge of Clock Set bit
1 1 1 0
18 D Flip-Flop: Example Timing Diagram
clock
period
1
CLK
0
1
D
0
1
Q
0
Clock to Q time (TC2Q) = Latch delay
In the JK latch, the inputs J and K behave exactly like inputs S and R, But it provides a
stable state when both inputs are 1 (The output is complemented).
J K Q+
0 0 Qprev No change (hold
/store)
0 1 0 Reset (clear)
1 0 1 Set
1 1 Q Toggle
R clk J K Q+
K
Q 0 x x Q Store
1 0 0 Q Store
CL
K 1 0 1 0 Reset
J 1 1 0 1 Set
S
Q 1 1 1 Q Toggle
21 J/K Flip-Flop : Example Timing
1
CLK 0
1
K 0
1
J 0
1
Q 0
NO
SET TOGGLE TOGGLE CLEAR CHANGE SET
22 T flip-flop
T Q(t+1)
0 Q(t) No change
Q(t + 1) = T Q = TQ` + T`Q
1 Complement
23 Implementations of T flip flop
T flip-flop can be implemented using SR flip-flop
R
T Q
C
L
K S Q’
D Q
T
CL
K
24 Implementations of T flip flop
The T flip-flop can also be obtained from a JK flip-flop when inputs J and K are
tied together.
T J Q
CLK
K
25 Characteristic Equations
Constraint 1 : the input signal must be stable between setup time and hold time.
Setup Time (Tsetup): The minimum time duration for which the data input must be valid and stable
before the arrival of the clock edge.
Hold Time (Thold): The minimum time duration for which the data input must not be changed after
the clock transition occurs.
27 Sequential circuit timing constraints
Constraint 2 : (Clock and Setup Times) The following timing constraint is required for
correct operation of the sequential circuit :
Tclk ≥ Tclk2q + TCombinational + Tsetup
Constraint 3 : (Hold Time) The following hold time constraint is required for correct
operation of Flip-Flop:
Thold ≤ Tclk2q + TCombinational
Time Clock
CLK
Setup time Hold time Setup time Hold time
Stable Stable
D1
FF B Stable
D2
ClktoQ time
ClktoQ time
Q1
ClktoQ time
Q2
29 Setup time violation : Case 1 (FF A) Between Input and First Flip-Flop
FF A FF B
10 0 0 0
Comb
D1 Q1 Logic D2 Q2
CLK Q CLK Q
Time Clock
CLK
Setup time Hold time Setup time Hold time
D1
FF A Instable : Setup Time Violation
D2
Data stable for a
FF B Stable
period < setup time
Q1
ClktoQ time
Q2
Low combinational
FF A FF B
10 01 0
1 01 0
Comb
D1 Q1 Logic D2 Q2
CLK Q CLK Q
CLK
Setup time Hold time Setup time Hold time
FF A Stable
D1 FF A Stable
FF B Stable
D2
ClktoQ time FF B Instable : Setup Time violation
Violation
Q1
ClktoQ time
ClktoQ time
Q2
31 Hold time violation : Case 1 (FF A) Between Input and First Flip-Flop
FF A FF B
010 0 0 0
Comb
D1 Q1 Logic D2 Q2
CLK Q CLK Q
CLK
Setup time Hold time Setup time Hold time
D1
FF A Instable : Hold Time Violation
D2
FF B Stable Data stable for a period < hold time (D1
Q1 changed the value before hold slack!!)
ClktoQ time
Q2
Fast combinational
FF A FF B
0 Q1 passes through the fast logic and
10 01 1 01 0
Comb arrives too early at the input D2 of FF
D1 Q1 Logic D2 Q2 B, which leads to hold time violation
CLK Q CLK Q and metastability.
CLK ClktoQ time Comb Logic time Setup time Timing constraint : ✔a
Hold Time violation Violation
TCLK > Tclk2q + TCombinational + Tsetup
Thold > Tclk2q + TCombinational Time Clock
D2
ClktoQ time FF B Instable : Hold Time violation
Violation
Q1
ClktoQ time
Q2
33
Finite State Machines
34 Finite State Machine
• The behavior of sequential circuits can be expressed by using Finite State Machines
(FSMs).
• FSM is an abstract model for describing a sequential circuit,
• FSM can be represented by :
• States-Transitions table : like truth table (Inputs, Present states, Next states, Outputs)
• States-Transitions diagram: consists of a set of nodes that hold the states of the circuit and a set of arcs
(transitions) that connect the states.
Q Input Q+ Output
Input / Output
Input Output
0 0 0 0
0 1 1 0
Flip-Flop 1 0 0 1
Q 1 1 1 0
State
0
0
0 1 01
1
Mealy State diagram
Nodes : states Q1 Q2 Arcs: X / Y
1/1 0/0
0/0
n
• n Flip-Flops max 2 possible states (nodes)
1/1
0/0
1/1
37 Moore FSM : Example
0 0
0
0
0
0
1 01
1
• Also called a modulus (MOD) m counter (2ⁿ < m ≤ 2ⁿ). (MOD m counter cycles through
m states).
Unused state
40 Types of counters
• Two types of counters:
• Synchronous (parallel) counters
• A common clock signal is connected to all flip-flops
State Excitation
Table Table
Present State Next State Inputs excitation
Q1 Q0
Q+ = D
Q 1+ Q 0+ D1 D0
0 0 0 1 0 1
Q+ = D1= Q1 Q0 + Q1 Q0
0 1 1 0 1 0 1
1 0 1 1 1 1 Q+
0
= D0= Q0
1 1 0 0 0 0
42 Unused states
• The synchronous counter up shown so far is with complete cycle (2n states, n
flip-flops). But sometimes you may have unused states.
• For example, here is a state table and diagram for a 3-bit up counter that repeatedly
counts from 0 (000) to 5 (101)
• What should we put in the table for the two unused states?
Self-starting counter
1 1 0
To get the safest circuit
simplest circuit
1 1 1
43 Asynchronous counters
▪ Asynchronous counter is a set of JK Flip-Flops in toggle mode (j=k=1).
▪ Also known as ripple counter, as the input clock pulse “ripples” through the counter.
▪ The clock signal controls only the first Flip-Flop (LSB), and
▪ Output of the first Flip-Flop (LSB) is connected to the clock input of the next
more-significant Flip-Flop.
▪ And so on..
▪ Ex : 2-bit ripple counter
1
LSB MSB
Q0 Q1
J Q J Q
CLK
K K
44 2-bit ripple counter (Async. MOD 4 counter)
1
LSB MSB
J Q Q0 J Q1
Q
CLK
K K
TCLK
1 2 3 4
Timing diagram : Q 1Q 0
CLK 00 → 01 → 10 → 11 → 00 ...
T Q0
1 2
Q0
0 1 0 1 0 TQ1 = 2TQ0 = 4TCLK
T Q1 1 1/FQ1 = 2/FQ0 = 4/FCLK
Q1 0 0 1 1 0
FQ1 = FQ0 /2 = FCLK /4
▪ Output of the last flip-flop (MSB) divides the input clock frequency by the 2ⁿ (n :
number of FFs), hence a counter is also a frequency divider.
45 3-bit ripple counter (Async. MOD 8 counter)
1 LSB MSB
J Q Q0 J Q Q1 J Q Q2
CLK CLK CLK CLK
K K K
CLK 1 2 3 4 5 6 7 8
Q0
Q0 0 1 0 1 0 1 0 1 0
Q1 0 0 1 1 0 0 1 1 0
Q2
0 0 0 0 1 1 1 1 0
Recycles back to 0
46 Unused states
▪ Also known as Asyn. Counters with MOD number (m) < 2n . States may be skipped
resulting in a truncated sequence.
▪ Technique: force counter to recycle before going through all of the states in the
sequence.
• MOD-6 counter produced by clearing (a 111 000
Temporary 001
MOD-8 binary counter) when count of state
six (110) occurs. 110
010
101 011
100
47
Registers
48 Basic register
A register is a set of Flips-Flops with sharing clock signal.
MSB LSB
49 Shift registers
• A shift register is a register with serial Load (Introduce bit by bit).
• It can move data from stage (Flip-Flop) to stage within the register, or into or out of
the register upon application of clock pulses.
• Shift left : Move each bit one position left and Shift in 0 to rightmost bit.
50 Shift registers : Implementation
• Connect each Flip-Flop’s output to next Flip-Flop’s input
CLK
CLK
51 Bidirectional shift registers
• Data can be shifted either left or right, using a control line RIGHT/LEFT (or
simply RIGHT) to indicate the direction.
52 Universal shift register 74 194
▪ 4-bit bidirectional shift register with parallel load.