Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 26

Digital Logic

Lecture 12

Analysis of Clocked Sequential


Circuits

The Hashemite University


Computer Engineering Department
Outline
 Introduction.
 Finite state machines models.
 Analysis of sequential clocked circuits.
 Analysis examples.

The Hashemite University 2


Introduction
 We have started talking about latches and flip-flops, which
are basic one-bit memory units.
 Now we’ll talk about sequential circuit analysis and design.
 First, we’ll see how to analyze and describe sequential
circuits.
 Analysis describes what a logic circuits do under a given
conditions.
 Remember that a sequential circuits is defined in terms of:
 Its external inputs.
 Present states of the flip flops.
 Next states of the flip flops.
 Outputs.
 Outputs and next states are functions of both the inputs
and the present states of the flip flops.
The Hashemite University 3
Analysis Components I
 The analysis of a sequential circuits
consists of obtaining the following:
 State or transition equations:
 Describes the next state of all flip flops in the
circuits in addition to all outputs algebraically
(using Boolean expressions) as a function of
the inputs and the current states of the flip
flops. Where for example Q(t) is the present
state and Q(t+1) is the next state.

The Hashemite University 4


Analysis Components II
 State or transition table:
 It is the counterpart of truth tables in combinational circuits.
 It consists of 4 sections: inputs, present state, next state,
and output.
 To determine the number of entries in the state table you
must determine the number of flip flops and the external
inputs in the circuit.
 If you have m flip flops and n external inputs then you have
2(m+n) entries having the values from 0 to 2(m+n)-1.
 So, just list the outputs of all flip flops (Q of all flip flops)
then external inputs and fill the state table in a similar way to
the truth table input section that we have learned previously.
 Filling the next state and the outputs sections using the state
equations.
The Hashemite University 5
Analysis Components III
 State diagram:
 Is an alternative but equivalent way of showing the same
information found in the state table.
 States are represented as circles and clock transitions are
represented as arrows connecting these circles.
 The circles contains binary numbers that defines the states
of all flip flops in the circuit.
 The arrows have labels that indicates the value of the
external inputs and the outputs of the circuit during the
present state separated by a slash (value before the slash
are the inputs and values after the slash are the output).
 Arrows start from the present state and terminate in the
next state which caused by the inputs values and the
resulted output values.
The Hashemite University 6
Finite State Machines Models
 Sequential circuits are called finite state
machines abbreviated as FSM since they have
a countable number of states that describe
the circuit.
 Two types of FSM:
 Mealy Model or Mealy FSM: In this model of
sequential circuits the external outputs depend on
inputs as well as on flip flops present states.
 Moore Model or Moore FSM: Where external
output depends on flip flops present states only.

The Hashemite University 7


How to analyze a sequential
circuit?
 For a combinational circuit we could find a truth
table, which shows how the outputs are related to
the inputs.
 To analyze sequential circuits, you have to:
 Find Boolean expressions for the outputs of the circuit and
the flip-flop inputs.
 Use these expressions to fill in the output and flip-flop input
columns in the state table.
 Finally, use the characteristic equation or characteristic table
of the flip-flop to fill in the next state columns.
 The result of sequential circuit analysis is a state
table and a state diagram describing the circuit.

The Hashemite University 8


Flip-flop input equations
 Used to finding the next states. To do this, you have to figure out how
the flip-flops are changing.
Step 1:
Find Boolean expressions for the flip-flop inputs.
i.e. How do the inputs (say, J & K) to the flipflops
depend on the current state and input
Step 2:
Use these expressions to find the actual flip-flop input values
for each possible combination of present states and inputs.
i.e. Fill in the state table (with new intermediate
columns)
Step 3:
Use flip-flop characteristic tables or equations to find the next
states, based on the flip-flop input values and the present
states.

The Hashemite University 9


An example of sequential
circuits analysis
 Here is a sequential
circuit with two JK flip-
flops. There is one
external input, X, and
one output, Z.
 The values of the flip-
flops (Q1Q0) form the
state, or the memory,
of the circuit.
 The flip-flop outputs
also go back into the
primitive gates on the
left.
The Hashemite University 10
Solution I – Build the state
table
 A basic state table for our example circuit is shown below.
 Remember that there is one input X, one output Z, and two
flip-flops Q1Q0.
 The present state Q1Q0 and the input will determine the
next state and the output.
Present State Inputs Next State Outputs
Q1 Q0 X Q1 Q0 Z
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
The Hashemite University 11
Solution II -- Finding the
Output
 The output depends on the current state – Q0 and Q1 – as well as
the inputs.
 From the diagram, you can see that
Z = Q1Q0X  Output at the current time

Present State Inputs Next State Outputs


Q1 Q0 X Q1 Q0 Z
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 0
1 0 1 0
1 1 0 0
1 1 1 1
The Hashemite University 12
Solution III -- Flip-flop input
equations
 For our example, the flip-flop input equations are:

J1 = X’ Q0
K1 = X + Q 0

J0 = X + Q1
K0 = X’
 JK flip-flops each have two inputs, J and K. (D and T
flip-flops have one input each.)
 Always name the inputs of the different flip flops with a
subscript of the flip flop output. For example a D flip
flop has an output of A will have an input as follows: D A
The Hashemite University 13
Solution IV -- Flip-flop input
values
 With these equations, we can make a table showing J1, K1, J0 and K0
for the different combinations of present state Q1Q0 and input X.

J1 = X’ Q0 J0 = X + Q1
K1 = X + Q0 K0 = X’
Present State Inputs Flip-flop Inputs
Q1 Q0 X J1 K1 J0 K0
0 0 0 0 0 0 1
0 0 1 0 1 1 0
0 1 0 1 1 0 1
0 1 1 0 1 1 0
1 0 0 0 0 1 1
1 0 1 0 1 1 0
1 1 0 1 1 1 1
1 1 1 0 1 1 0
The Hashemite University 14
Solution V -- Find the next
state
 Finally, use the JK flip-flop characteristic tables or equations to find the
next state of each flip-flop, based on its present state and inputs.
 The general JK flip-flop characteristic equation is:
Q(t+1) = K’Q(t) + JQ’(t)
 In our example circuit, we have two JK flip-flops, so we have to apply this
equation to each of them:

Q1(t+1) = K1’Q1(t) + J1Q1’(t)


Q0(t+1) = K0’Q0(t) + J0Q0’(t)
J K Q(t+1) Operation
0 0 Q(t) No change
 We can also determine the next state for
0 1 0 Reset
each input/current state combination
1 0 1 Set
directly from the characteristic table (much
1 1 Q’(t) Complement
easier).

The Hashemite University 15


Solution V -- Find the next
states … cont.
 Finally, here are the next states for Q1 and Q0, using these
equations:
 Q1(t+1) = K1’Q1(t) + J1Q1’(t)
Q0(t+1) = K0’Q0(t) + J0Q0’(t)
Present State Inputs FF Inputs Next State
Q1 Q0 X J1 K1 J0 K0 Q1 Q0
0 0 0 0 0 0 1 0 0
0 0 1 0 1 1 0 0 1
0 1 0 1 1 0 1 1 0
0 1 1 0 1 1 0 0 1
1 0 0 0 0 1 1 1 1
1 0 1 0 1 1 0 0 1
1 1 0 1 1 1 1 0 0
1 1 1 0 1 1 0 0 1
The Hashemite University 16
Solution VI – Final state table.
 The table starts with Present State and Inputs.
 Present State and Inputs yield FF Inputs.
 Present State and FF Inputs yield Next State, based on the flip-flop
characteristic tables.
 Present State and Inputs yield Output.
 We really only care about FF Inputs in order to find Next State.
Present State Inputs FF Inputs Next State Outputs
Q1 Q0 X J1 K1 J0 K0 Q1 Q0 Z
0 0 0 0 0 0 1 0 0 0
0 0 1 0 1 1 0 0 1 0
0 1 0 1 1 0 1 1 0 0
0 1 1 0 1 1 0 0 1 0
1 0 0 0 0 1 1 1 1 0
1 0 1 0 1 1 0 0 1 0
1 1 0 1 1 1 1 0 0 0
1 1 1 0 The1Hashemite
1 0
University 0 1 1 17
Solution VII – State diagrams.
 We can also represent the state table graphically with a
state diagram.
 A diagram corresponding to our example state table is
shown below.
input output
0/0 1/0

1/0
00 01

1/1
0/0 1/0 0/0

0/0
11 10

state
The Hashemite University 18
Sizes of state diagrams
 Always check the size of your state diagram.
 If there are m flip-flops, there should be 2m nodes
in the diagram.
 If there are n inputs, then each node will have 2n
outgoing arrows.
 From each state
 In our example,
 We have two flip-flops, and thus four states or
nodes.
 There is one input, so each node has two
outgoing arrows.

The Hashemite University 19


Home Exercise I
 Analyze the
following circuit.
 What is the type of
this FSM (Mealy or
Moore)?

The Hashemite University 20


Home Exercise II
 Analyze the
following circuit.
 What is the type
of this FSM
(Mealy or
Moore)?

The Hashemite University 21


Home Exercise III
 Solve the examples found in the
textbook, especially the one that
involves T flip flops.

The Hashemite University 22


Notes
 In a state diagram comma separated inputs values
on the state diagram can be used to reduce the
number of needed arrows, i.e. different input values
yields to the same next state from the same present
state.
 In a state diagram you can place the output value
inside the circles of the states separated by a slash
instead of placing them on the arrows if the state has
the same output value in every occurrence of this
state in the state table.
 In the same FSM or sequential circuit you may have
different types of flip flops.

The Hashemite University 23


Working in the opposite
direction
 Given the state equations of the flip flops (or
just the input equations) and the outputs
equations of a given sequential circuit, draw
this circuit.
 Exercise:
 Draw the FSM represented by the following state
equations:
Z = A+B
DA = x.y + B
TB = x + y, where x and y are external inputs and Z
is the output.

The Hashemite University 24


Additional Notes
 This lecture covers the following
material from the textbook:
 Chapter 5: Section 5.5

The Hashemite University 25


The Hashemite University 26

You might also like