Lecture 5
Lecture 5
Thursday, Apr. 17
Dr. Asmaa Farouk
Assiut University
Course Overview
• Topics will be covered in this course
– Digital Systems and Binary Numbers.
– Boolean Algebra and Logic Gates.
– Gate-Level Minimization.
– Combinational Logic.
– Synchronous Sequential Logic.
– Registers and Counters..
Lecture # 9, 10
• Reading:
Mano:
Chapter 5.
Topics of Today
• Sequential Circuits.
• Storage Elements: Latches.
• Storage Elements: Flip-Flops.
• Analysis of Clocked Sequential Circuits.
• State Reduction and Assignment.
• Design Procedure.
Sequential Circuits
• Digital circuits we have learned, so far, have
been combinational:
– No memory
– Outputs are entirely defined by the “current” inputs.
Sequential Circuits
• However, many digital systems encountered
everyday life are sequential (i.e., they have
memory):
– The memory elements remember (store) past
inputs.
– Outputs of sequential circuits are not only
dependent on the current input but also on the
state of the memory elements.
Sequential Circuits
Inputs Outputs
Combinational
Circuit
Current Next
state state
Memory
Elements
Previous
state
Previous
state
Storage Elements: Latches
• SR Latch (Set-Reset):
– S = R = 1 (OR implementation) may result in an
undefined state.
• The next state is unpredictable when both S and R goes to
0 at the same time.
• It may oscillate, or the outcome state depend on which of
S and R goes to 0 first.
Storage Elements: Latches
• SR Latch with Enable:
– Control inputs (enable) allow the changes at S and R
to change the state of the latch.
Storage Elements: Latches
• D (data) Latch (Transparent Latch):
– SR latches are seldom used in practice because the
indeterminate state may cause instability.
– Remedy: D-latches.
– Symbol:
Storage Elements: Latches
• D (data) Latch (Transparent Latch):
– D-latches can be used as temporary storage.
– The input of D-latch is transferred to the Q output
when En = 1.
– When En = 0 the binary information is stored.
– We call latches level-sensitive devices.
• As long as En remains at logic-1 level, any change in data
input will change the state and the output of the latch.
– Memory devices that are sensitive to the rising or
falling edge of control input is called flip-flops.
Topics of Today
• Sequential Circuits.
• Storage Elements: Latches.
• Storage Elements: Flip-Flops.
• Analysis of Clocked Sequential Circuits.
• State Reduction and Assignment.
• Design Procedure.
Storage Elements: Flip Flops
• How does it Work?
– The state of a latch or flip-flop is switched by a
change in the control input (enable).
– This momentary change is called a trigger, and the
transition it causes is said to trigger the flip-flop.
– The D-latch with pulses in its control input is
essentially a flip-flop that is triggered every time the
pulse goes to the logic-1.
– As long as the input pulse remains at logic-1, any
change in the input data will change the output (and
the state of the latch).
Storage Elements: Flip Flops
• Edge-Triggered D Flip Flop:
– Constructed using two D latches.
Y=D
clk clk
Q=Y=D
D
clk’
Y
clk
clk
– JK flip flop:
– T flip flop:
Storage Elements: Flip Flops
• Direct Inputs:
– They are used to force the flip-flop to a particular
state independent of the clock.
• “Preset” (direct set) set FF state to 1.
• “Clear” (direct reset) set FF state to 0.
– They are especially useful at startup.
• In digital circuits when the power is turned on, the state
of flip-flops are unknown.
• Direct inputs are used to bring all flip-flops to a known
“starting” state prior to clock operation.
Storage Elements: Flip Flops
• Direct Inputs:
– They are used to force the flip-flop to a particular
state independent of the clock.
• “Preset” (direct set) set FF state to 1.
• “Clear” (direct reset) set FF state to 0.
Topics of Today
• Sequential Circuits.
• Storage Elements: Latches.
• Storage Elements: Flip-Flops.
• Analysis of Clocked Sequential Circuits.
• State Reduction and Assignment.
• Design Procedure.
Analysis of Clocked Sequential Circuits
• Goal:
– To determine the behavior of clocked sequential
circuits.
– “Behavior” is determined from:
• Inputs.
• Outputs.
• State of the flip-flops.
– We have to obtain:
• Boolean expressions for the output and the next state.
– Output & state equations.
• State table.
• State diagram.
Analysis of Clocked Sequential Circuits
• State Equations:
– Known as “transition equations”.
– Specify the next state as a function of the present
state and inputs.
Analysis of Clocked Sequential Circuits
• State Equations:
– Example:
Analysis of Clocked Sequential Circuits
• State Tables:
– Example:
• A sequential
circuit with
m FFs and n
inputs needs
2m+n rows in
the state
table .
Analysis of Clocked Sequential Circuits
• State Diagram:
– The state table can be represented graphically in the
form of a state diagram.
– A state is represented by a circle, and the
transitions between states are indicated by directed
lines connecting the circles.
– The directed lines are labeled with two binary
numbers separated by a slash. The input value
during the present state is labeled first, and the
number after the slash gives the output during the
present state with the given input.
Analysis of Clocked Sequential Circuits
• State Diagram:
– Example:
How many states?
m FFs = 2m states.
We have 2 FFs = 4
states.
Analysis of Clocked Sequential Circuits
• State Diagram:
– Example:
0/0
00 11
1/0
01 10
Analysis of Clocked Sequential Circuits
• State Diagram:
– Example:
0/0
00 10
1/0 0/1
01 11
1/0
Analysis of Clocked Sequential Circuits
• State Diagram:
– Example:
0/0 1/0
00 0/1 10
1/0 0/1
01 11
1/0
Analysis of Clocked Sequential Circuits
• State Diagram:
– Example:
0/0 1/0
00 0/1 10
01 11
1/0
Analysis of Clocked Sequential Circuits
• Flip Flop Input Equations:
– Example:
• Same as the state equations in D flip-flops.
• Sometimes called “excitation equations”.
Analysis of Clocked Sequential Circuits
• Analysis with D Flip Flops:
– The circuit we want to analyze is described by the
input equation:
Keep
reducing.
State Reduction and Assignment
• State reduction:
– Example:
2. Inspect the state table for equivalent states.
State Reduction and Assignment
• State assignment:
– We have to assign binary values to each state.
– If we have m states, then we need a code with
minimum n bits, where n = log2m.
– There are different ways of encoding.
– The circuit complexity depends on the state
encoding (assignment) scheme.
State Reduction and Assignment
• State assignment:
– Example: five states: a, b, c, d, e (of Table 5.8).
State Reduction and Assignment
• State assignment:
– Example: five states: a, b, c, d, e (of Table 5.8).
Topics of Today
• Sequential Circuits.
• Storage Elements: Latches.
• Storage Elements: Flip-Flops.
• Analysis of Clocked Sequential Circuits.
• State Reduction and Assignment.
• Design Procedure.
Design Procedure
• Combinational circuits:
– Can be designed given a truth table.
• Sequential circuits:
– We need,
• State diagram or state table.
– Two parts,
• Flip-flops: number of flip-flops is determined by the
number of states.
• Combinational part:
– Output equations.
– Flip-flop input equations.
Design Procedure
• Procedure:
1. From the word description and specifications of
the desired operation, derive a state diagram.
2. Reduce the number of states if necessary.
3. Assign binary values to the states.
4. Obtain the binary-coded state table.
5. Choose the type of flip-flops to be used.
6. Derive the simplified flip-flop input equations and
output equations.
7. Draw the logic diagram.
Design Procedure
• Example:
– Verbal description: “we want a (sequential) circuit
that detects three or more consecutive 1’s in a string
of bits”.
– Input: string of bits of any length.
– Output:
• “1” if the circuit detects the pattern in the string.
• “0” otherwise.
Design Procedure
• Example:
– Step 1: Derive the state diagram.
0
1
S0 /0 S1/0
0 1
0
S3/1 S2/0
1
1
Design Procedure
• Synthesis Using D Flip Flops:
– Number of flip-flops
• Four states, flip-flops ?
– State reduction:
• Not possible in this case.
– State assignment:
• Use binary encoding:
– S0 00
– S1 01
– S2 10
– S3 11
Design Procedure
• Synthesis Using D Flip Flops:
– Step 4: Obtain the state table.
Design Procedure
• Synthesis Using D Flip Flops:
– Step 5: Choose the flip-flops.
• D flip-flops.
Design Procedure
• Synthesis Using D Flip Flops:
– Step 6: Derive the simplified flip-flop input
equations.
• Boolean expressions for DA and DB.
Design Procedure
• Synthesis Using D Flip Flops:
– Step 6: Derive the simplified flip-flop input
equations.
Bx
A 00 01 11 10
0 0 0 1 0
1 0 1 1 0
DA = Ax + Bx
Design Procedure
• Synthesis Using D Flip Flops:
– Step 6: Derive the simplified flip-flop input
equations.
Bx
A 00 01 11 10
0 0 1 0 0
1 0 1 1 0
DB = Ax + B’x
Design Procedure
• Synthesis Using D Flip Flops:
– Step 6: Derive the simplified flip-flop input
equations.
Bx
A 00 01 11 10
0 0 0 0 0
1 0 0 1 1
y = AB
Design Procedure
• Synthesis Using D Flip Flops:
– Step 8: Draw the logic diagram.
Design Procedure
• Excitation Tables:
– Synthesis using flip flops other than D type, is more
complicated.
– We should know the “excitation tables”.
+ +
Design Procedure
• Synthesis Using JK Flip Flops:
Design Procedure
• Synthesis Using JK Flip Flops:
Bx Bx
A 00 01 11 10 A 00 01 11 10
0 0 0 0 1 0 X X X X
1 X X X X 1 0 0 1 0
JA = Bx’ kA = Bx
Bx Bx
A 00 01 11 10 A 00 01 11 10
0 0 1 X X 0 X X 0 1
1 0 1 X X 1 X X 1 0
JB = x kB = (A x)’
Design Procedure
• Synthesis Using JK Flip Flops:
Design Procedure
• Synthesis Using T Flip Flops:
– Example: 3-bit binary counter:
• 012 ... 7 0 1 2…
• State assignments:
– S0 000
– S1 001
– S2 010
– ...
– S7 111
Design Procedure
• Synthesis Using T Flip Flops:
– Example: 3-bit binary counter:
Design Procedure
• Synthesis Using T Flip Flops:
– Example: 3-bit binary counter:
A1 A0 A1 A0
A2 00 01 11 10 A2 00 01 11 10
0 0 1 1 0 0 0 0 1 0
1 0 1 1 0 1 0 0 1 0
TA1 = A0 TA2 = A1A0
A1 A0
A2 00 01 11 10
0 1 1 1 1
1 1 1 1 1
TA0 = 1
Design Procedure
• Synthesis Using T Flip Flops:
– Example: 3-bit binary counter:
Questions?