Part I e
Part I e
Mealy Moore
In Mealy: For the same state, the output changes with the input.
In Moore: For the same state, the output does not change with the input
Moore State Diagram
0 0
1
00/0 01/0
1 1
11/1 10/0
1
0 0
State Reduction and Assignment
State Reduction Reductions on the number of flip-flops and the number of gates.
● A reduction in the number of states may result in a reduction in the number of flip-
flops.
● An example state diagram showing in Fig
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
Equivalent states
● Two states are said to be equivalent
♦ For each member of the set of inputs, they give exactly the same output and
send the circuit to the same state or to an equivalent state.
♦ One of them can be removed.
STATE TABLE:
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 f 0 1
e a f 0 1
f g f 0 1
g a f 0 1
STATE: a a b c d e d d e d e 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
● The checking of each pair of states for possible equivalence can be done systematically
using Implication Table.
● The unused states are treated as don't-care condition fewer combinational gates.
Implication Table
The state-reduction procedure for completely specified state tables is based on the
algorithm that two states in a state table can be combined into one if they can be shown to
be equivalent. There are occasions when a pair of states do not have the same next states,
but, nonetheless, go to equivalent next states. Consider the following state table:
b d,e
x x
x x x
x x x
c,d x c,e x x x x
a,b
x x x d,e d,e x
a b c d e f
On the left side along the vertical are listed all the states defined in the state table except
the last, and across the bottom horizontally are listed all the states except the last.
The states that are not equivalent are marked with a ‘x’ in the corresponding square,
whereas their equivalence is recorded with a ‘√’.
Some of the squares have entries of implied states that must be further investigated to
determine whether they are equivalent or not.
The step-by-step procedure of filling in the squares is as follows:
1. Place a cross in any square corresponding to a pair of states whose outputs are not
equal for every input.
2. Enter in the remaining squares the pairs of states that are implied by the pair of
states representing the squares. We do that by starting from the top square in the left
column and going down and then proceeding with the next column to the right.
3. Make successive passes through the table to determine whether any additional
squares should be marked with a ‘x’. A square in the table is crossed out if it
contains at least one implied pair that is not equivalent.
4. Finally, all the squares that have no crosses are recorded with check marks. The
equivalent states are: (a, b), (d, e), (d, g), (e, g).
We now combine pairs of states into larger groups of equivalent states. The last three pairs can be
combined into a set of three equivalent states (d, e,g) because each one of the states in the group is
equivalent to the other two. The final partition of these states consists of the equivalent states
found from the implication table, together with all the remaining states in the state table that are
not equivalent to any other state:
(a, b) (c) (d, e, g) (f)
The reduced state table is:
State Assignment
State Assignment
To minimize the cost of the combinational circuits.
● Three possible binary state assignments. (m states need n-bits, where 2n > m)
THREE POSSIBLE BINARY STATE ASSIGNMENTS:
● Any binary number assignment is satisfactory as long as each state is assigned a unique
number.
● Use binary assignment 1.
REDUCED STATE TABLE WITH BINARY ASSIGNMENT1:
Example:
Detect 3 or more consecutive 1’s
0 1
S0 / 0 S1 / 0
0
0 1
0
S3 / 1 S2 / 0
1 1
STATE A B
S0 0 0
S1 0 0
S2 1 0
S3 1 1
STATE TABLE:
K MAP SIMPLIFICATION
B B
0 0 1 0 0 1 0 0
A 0 1 1 0 A 0 1 1 0
x x
0 0 0 0
0 0 1 1
A
DA (A, B, x) = ∑ (3, 5, 7)
=Ax+Bx
DB (A, B, x) = ∑ (1, 5, 7)
= A x + B’ x
y (A, B, x) = ∑ (6, 7)
=AB
D Q A
x
Q
y
D Q B
CLK Q
Sequential circuit design
• Now let’s reverse the process: In sequential circuit design, we turn some description into a
working circuit.
– We first make a state table or diagram to express the computation.
– Then we can turn that table or diagram into a sequential circuit.
Sequence recognizers
• A sequence recognizer is a special kind of sequential circuit that looks for a special bit
pattern in some input.
• The recognizer circuit has only one input, X.
– One bit of input is supplied on every clock cycle. For example, it would take 20
cycles to scan a 20-bit input.
– This is an easy way to permit arbitrarily long input sequences.
• There is one output, Z, which is 1 when the desired pattern is found.
• Our example will detect the bit pattern “1001”:
Inputs: 1 1 1 0 0 1 1 0 1 0 0 1 0 0 1 1 0 …
Outputs: 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0 0 …
Here, one input and one output bit appear every clock cycle.
• This requires a sequential circuit because the circuit has to “remember” the inputs from
previous clock cycles, in order to determine whether or not a match was found.
A basic state diagram
• What state do we need for the sequence recognizer?
– We have to “remember” inputs from previous clock cycles.
– For example, if the previous three inputs were 100 and the current input is 1, then
the output should be 1.
– In general, we will have to remember occurrences of parts of the desired pattern—
in this case, 1, 10, and 100.
• We’ll start with a basic state diagram (edges are labeled input/output):
State Meaning
A None of the desired pattern (1001) has been input yet.
B We’ve already seen the first bit (1) of the desired pattern.
C We’ve already seen the first two bits (10) of the desired pattern.
D We’ve already seen the first three bits (100) of the desired pattern.
Overlapping occurrences of the pattern
• What happens if we’re in state D (the last three inputs were 100), and the current input is 1?
– The output should be a 1, because we’ve found the desired pattern.
– But this last 1 could also be the start of another occurrence of the pattern! For
example, 1001001 contains two occurrences of 1001.
– To detect overlapping occurrences of the pattern, the next state should be B.
1/0 0/0 0/0
A B C D
1/1
State Meaning
A None of the desired pattern (1001) has been input yet.
B We’ve already seen the first bit (1) of the desired pattern.
C We’ve already seen the first two bits (10) of the desired pattern.
D We’ve already seen the first three bits (100) of the desired pattern.
Filling in the other arrows
• Remember that we need two outgoing arrows for each node, to account for the possibilities
of X=0 and X=1.
• The remaining arrows we need are shown in blue. They also allow for the correct detection
of overlapping occurrences of 1001.
0/0
1/0
0/0 1/1
State Meaning
A None of the desired pattern (1001) has been input yet.
B We’ve already seen the first bit (1) of the desired pattern.
C We’ve already seen the first two bits (10) of the desired pattern.
D We’ve already seen the first three bits (100) of the desired pattern.
Finally, making the state table
0/0
1/0
0/0 1/1
Remember how the state diagram arrows correspond to rows of the state table:
Present Next
Input Flip Flop Inputs Output
State State
Q1 Q0 X Q1 Q0 J1 K1 J0 K0 Z
0 0 0 0 0 0
0 0 1 0 1 0
0 1 0 1 0 0
0 1 1 0 1 0
1 0 0 1 1 0
1 0 1 0 1 0
1 1 0 0 0 0
1 1 1 0 1 1
Finding JK flip-flop input values
• For JK flip-flops, this is a little tricky. Recall the characteristic table:
J K Q(t+1) Operation
0 0 Q(t) No Change
0 1 0 Reset
1 0 1 set
1 1 Q’(t) Complement
• If the present state of a JK flip-flop is 0 and we want the next state to be 1, then we have
two choices for the JK inputs:
– We can use JK=10, to explicitly set the flip-flop’s next state to 1.
– We can also use JK=11, to complement the current state 0.
• So to change from 0 to 1, we must set J=1, but K could be either 0 or 1.
• Similarly, the other possible state transitions can all be done in two different ways as well.
JK excitation table
An excitation table shows what flip-flop inputs are required in order to make a desired state
change
• This is the same information that’s given in the characteristic table, but presented
“backwards.”
J K Q(t+1) Operation
0 0 Q(t) No Change
0 1 0 Reset
1 0 1 Set
1 1 Q’(t) Complement
• We can now use the JK excitation table on the right to find the correct values
for each flip-flop’s inputs, based on its present and next states.
Present Next
Input Flip Flop Inputs Output
State State
Q1 Q0 X Q1 Q0 J1 K1 J0 K0 Z
0 0 0 0 0 0 X 0 X 0
0 0 1 0 1 0 X 1 X 0
0 1 0 1 0 1 X X 1 0
0 1 1 0 1 0 X X 0 0
1 0 0 1 1 X 0 1 X 0
1 0 1 0 1 X 1 1 X 0
1 1 0 0 0 X 1 X 1 0
1 1 1 0 1 X 1 X 0 1
Present Next
Input Flip Flop Inputs Output
State State
Q1 Q0 X Q1 Q0 J1 K1 J0 K0 Z
0 0 0 0 0 0 X 0 X 0
0 0 1 0 1 0 X 1 X 0
0 1 0 1 0 1 X X 1 0
0 1 1 0 1 0 1 1 0 0
1 0 0 1 1 X 0 1 X 0
1 0 1 0 1 X 1 1 X 0
1 1 0 1 1 X 1 X 1 0
1 1 1 0 1 X 1 X 0 1
J1 = X’ Q0
K 1 = X + Q0
J0 = X + Q1
K0 = X’
Z = Q1Q0X
Step 5: Build the circuit
Lastly, we use these simplified equations to build the completed circuit.
Timing diagram
• Here is one example timing diagram for our sequence detector.
– The flip-flops Q1Q0 start in the initial state, 00.
– On the first three positive clock edges, X is 1, 0, and 0. These inputs cause Q1Q0 to
change, so after the third edge Q1Q0 = 11.
– Then when X=1, Z becomes 1 also, meaning that 1001 was found.
• The output Z does not have to change at positive clock edges. Instead, it may change
whenever X changes, since Z = Q1Q0X.
1 2 3 4
CLK
Q1
Q0
X
Z
D1 = Q1 Q0’ X’ + Q1’ Q0 X’
D0 = X + Q1 Q0’
The analysis of asynchronous sequential circuits
proceeds in much the same way as that of clocked
From the state diagram, we can generate the state table. Note that there is no output section for this
circuit. Two flip-flops are needed to represent the four states and are designated Q0Q1. The input
variable is labelled x.
State table.
Present State Next State
Q0 Q1 x=0 x=1
0 0 0 0 0 1
0 1 1 0 0 1
1 0 1 0 1 1
1 1 1 1 0 0
We shall now derive the excitation table and the combinational structure. The table is now
arranged in a different form, where the present state and input variables are arranged in the form of
a truth table. Remember, the excitable for the JK flip-flop was derive in
Excitation table for JK flip-flop
In the first row, we have a transition for flip-flop Q0 from 0 in the present state to 0 in the next
state. In Table 10 we find that a transition of states from 0 to 0 requires that input J = 0 and input K
= X. So 0 and X are copied in the first row under J0 and K0 respectively. Since the first row also
shows a transition for the flip-flop Q1 from 0 in the present state to 0 in the next state, 0 and X are
copied in the first row under J1 and K1. This process is continued for each row of the table and for
each flip-flop, with the input conditions as specified in Table 10.
The simplified Boolean functions for the combinational circuit can now be derived. The input
variables are Q0, Q1, and x; the output are the variables J0, K0, J1 and K1. The information from
the truth table is plotted on the Karnaugh maps
Karnaugh Maps
The behaviour of a sequential circuit is determined from the inputs, the outputs and the
states of its flip-flops. Both the output and the next state are a function of the inputs and the present
state.
The suggested analysis procedure of a sequential circuit is
We start with the logic schematic from which we can derive excitation equations for each
flip-flop input. Then, to obtain next-state equations, we insert the excitation equations into the
characteristic equations. The output equations can be derived from the schematic, and once we
have our output and next-state equations, we can generate the next-state and output tables as well
as state diagrams. When we reach this stage, we use either the table or the state diagram to develop
a timing diagram which can be verified through simulation.
Example
Derive the next state, the output table and the state diagram for the sequential circuit shown
SOLUTION:
Excitation equations:
D0 = Cnt Q0 = Cnt'*Q0 + Cnt*Q0'
D0 = Cnt'*Q1 + Cnt*Q1'*Q0 + Cnt*Q1*Q0'
Next-state equations:
Q0(next) = D0 = Cnt'*Q0 + Cnt*Q0'
Q1(next) = D0 = Cnt'*Q1 + Cnt*Q1'*Q0 + Cnt*Q1*Q0'
In addition, however, we have computed the output equation.
Output equation: Y = Q1Q0
As this equation shows, the output Y will equal to 1 when the counter is in state Q1Q0 = 11, and it
will stay 1 as long as the counter stays in that state.
Next-state and output table:
Present State Next State Output
Q1 Q0 Cnt=0 Cnt=1 Z
0 0 0 0 0 1 0
0 1 0 1 1 0 0
1 0 1 0 1 1 0
1 1 1 1 0 0 1
State diagram:
Timing diagram:
Note that the counter will reach the state Q1Q0 = 11 only in the third clock cycle, so the output Y
will equal 1 after Q0 changes to 1. Since counting is disabled in the third clock cycle, the counter
will stay in the state Q1Q0 = 11 and Y will stay asserted in all succeeding clock cycles until
counting is enabled again.
Design a sequential circuit whose state tables are specified, using D flip-flops.
Next step is to derive the excitation table for the design circuit, which is. The output of the circuit
is labelled Z.
Present State Next State Input Flip Flop Inputs Output
Q0 Q1 Q0 Q1 X D0 D1 Z
0 0 0 0 0 0 0 0
0 0 0 1 1 0 1 0
0 1 0 0 0 0 0 0
0 1 1 0 0 0 0 0
1 0 1 1 0 1 1 0
1 0 1 0 1 1 0 0
1 1 0 0 0 0 0 0
1 1 0 1 1 0 1 1
Excitation table
Now plot the flip-flop inputs and output functions on the Karnaugh map to derive the Boolean
expressions, which is shown
Karnaugh maps
Hazards
In digital logic, a hazard in a system is an undesirable effect caused by either a deficiency
in the system or external influences. Logic hazards are manifestations of a problem in which
changes in the input variables do not change the output correctly due to some form of delay caused
by logic elements (NOT, AND, OR gates, etc.) This results in the logic not performing its function
properly. The three different most common kinds of hazards are usually referred to as static,
dynamic and function hazards.
Hazard is an unwanted transient i.e, spike or glitch that occurs due to unequal path or unequal
propagation delays.
Hazards are a temporary problem, as the logic circuit will eventually settle to the desired
function. However, despite the logic arriving at the correct output, it is imperative that hazards be
eliminated as they can have an effect on other connected systems.
Static Hazards
A static hazard is the situation where, when one input variable changes, the output changes
momentarily when it shouldn't. This particular type of hazard is usually due to a NOT gate within
the logic. The hazard can be dealt with in two ways:
• Insert another (additional) delay to the circuit. This then eliminates the static hazard.
• Eliminate the hazard by inserting more logic to counteract the effects (Note this makes
assumptions that the logic will fail)
Static hazard is a condition which results in a single momentary incorrect output due to change
in a single input variable when the output is expected to remain in the same state.
The first case is the most used of the two options. This is because it does not make assumptions
about the logic, instead the method adds redundancy to overcome the hazard.
To solve the hazard we shall use our previous example and apply a theory that David A. Huffman
discovered. The insertion of a redundant loop can eliminate a static hazard.
Static-0 hazard
When the output is to remain at the value 0 and a momentary 1 output is possible during the
transition between the two input states, then the hazard is called a static-0 hazard
Static-1 hazard
If the two input states both produce a 1 output in the steady state and a momentary 0 output is
possible during the transition between the two input states, then the hazard is called a Static-1
hazard
In the next example, it will also be evident that there will not be a situation where a static '0'
occurs. A static '0' hazard is one which briefly goes to '1' when it should remain at '0'. A static '1'
hazard is the reverse of this situation, i.e. the output should remain at '1' yet under some condition
it briefly changes state to '0' (something we shall see in the following example)..
If we first look at the starting diagram, it is clear that if no delays were to occur, then the circuit
would function normally. However since this isn't a perfect circuit, and an error occurs when the
input changes from 111 to 011. i.e. when X1 changes state. Now we know roughly how the hazard
is occurring, for a clearer picture and the solution on how to solve this problem, we look to the
Karnaugh Map:
This Karnaugh Map shows the circuit. The two gates are shown by solid rings, and the hazard can
be seen under the dashed ring. The theory proved by Huffman tells us that by adding a redundant
loop 'X2X3' this will eliminate the hazard. So the resulting logic is of the form shown in the next
figure.
So our original function is now: f = X1 * X2 + X1' * X3 + X2 * X3
Now we can see that even with imperfect logic elements, our example will not show signs of
hazards when X1 changes state. This theory can be applied to any logic system. Computer
programs deal with most of this work now, but for simple examples it is quicker to do the
debugging by hand. When there are many input variables (say 6 or more) it will become quite
difficult to 'see' the errors on a Karnaugh map.
Elimination of static hazard
By covering the adjacent cells with a redundant grouping that overlaps both groupings.
Dynamic hazard
A transient change occurring 3 or more times at an output terminal of a logic network when the
output is supposed to change only once during a transition between two input states differing in
the value of one variable.