Sequential Circuit Analysis

Introduction

In this lecture you will learn techniques for analyzing sequential circuits. Sequential circuit analysis is useful when

  1. You need to determine the functionality of an existing sequential circuit, or
  2. You want to make changes to an existing sequential circuit, and need to verify the new behavior

Sequential circuit analysis is primarily about expressing the functionality of a sequential circuit in different forms. Each form provides a little more information or insight as to the functionality of the circuit. The 5 forms of a sequential circuit we will study in this lecture are:

  1. Excitation equations
  2. Next state equations
  3. Output equations
  4. State table
  5. State diagram

We will also define the Mealy and Moore models for representing sequential circuits.

Example 1

We will study sequential circuit analysis by way of an example. Assume you have been asked to determine what the following circuit does:

circuit-ex1.gif (75375 bytes)

Figure 1.

The first step is to establish that it is in fact a sequential circuit. If it was a combinational circuit a truth table could be used to determine its functionality.

The circuit above is in fact a sequential circuit because it has memory elements (here D-type flip-flops) and feedback paths.

Step 1: Develop excitation equations

Excitation equations are Boolean equations that describe the input to the flip-flops. The circuit uses D-type flip-flips so each flip-flip has only one input.

D0 = Q0 XOR C

D1 = C'Q1 + Q0CQ1' + CQ1Q0'

Equation 1.

These equations describe the inputs to the flip-flops in terms of the current circuit inputs and current circuit state.

Step 2: Develop next state equations

Next state equations use the excitation equations developed in step 1 and the flip-flop characteristic equations to compute the next state of each flip-flop.

This step is easy for this example because the circuit uses D-type flip-flops. The characteristic equation for a D-type flip-flop is:

Qnext = D

So, the next state equations are:

Q0next = Q0 XOR C

Q1next =  C'Q1 + Q0CQ1' + CQ1Q0'

Equation 2.

As part of the next state equations we also provide the equation for the output:

Y = Q0Q1

Equation 3.

Step 3: Develop state table

This is the first step where you start to understand the functionality of the circuit.

Present State

Next State (Q1Q0)

Outputs
Q1  Q0 C=0 C=1  
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

Table 1.

The present state of the circuit is defined by the state of the flip-flops in the circuit. Next state is determined by the present state and current inputs (here C). In this circuit the outputs are completely a function of the current state. (The next example shows how to draw the state table for a sequential circuit where the outputs are a function of current state and current inputs.)

Looking at the state table you start to get an idea about the dynamic behavior of the circuit. From the state table it's easy to see that this circuit moves sequentially through the states while C=1.

Step 4: Develop state diagram

A state diagram shows graphically the state transitions:

state-di.gif (9971 bytes)

Figure 2.

Each node represents a state. The state which the node represents is written inside of the node. Also, since the output Y is completely determined by the current state we can write the output value within each node. The arcs in the diagram represent inputs. Some arcs take the circuit to a new state and others leave the circuit in the same state.

With this representation it's very easy to see how the circuit transitions between states.

Models

When doing sequential circuit analysis it is often helpful to distinguish between two different circuit models: Mealy and Moore.

moore.gif (20403 bytes)
Figure 3. Moore Model

mealy.gif (26652 bytes)
Figure 4. Mealy Model

The Moore model represents a circuit where the outputs are a function of only the current state. A Mealy model represents a circuit where the outputs are a function of both the current state and the current inputs. Why is it helpful to make the distinction? How you draw the state table and the state diagram depends on what model the circuit follows. For example, if the circuit follows the Mealy model you can't show the output of the circuit within nodes because the output depends on the current input also--not just the current state.

What model does our example above follow? It follows the Moore model because the output is a function only of the current state. This is reflected in the way we drew the state table and the state diagram.

Example 2

In this second example we show how to perform sequential circuit analysis on a Mealy-type circuit. Another noticeable difference is that the memory elements are JK flip-flops. This will make the development of the state equations slightly more difficult.

jk-imp.gif (32977 bytes)

Figure 5.

It is easy to see that this circuit is sequential--it has memory elements (JK flip-flops) and feedback paths. It's also easy to see that it is a Mealy type circuit because the output Z is a function of the current state and the input X:

Z = Q1Q2'X

Step 1: Develop excitation equations

The excitation equations are a bit more complex because each flip-flop has two inputs.

J1 = X'Q2

K1 = X XOR Q2

J2 = Q1 + X

K2 = Q1

Equation 4.

Step 2: Develop next state equations

Remember that the next state equations are equations that compute the next state of the circuit given the current state and inputs. Since the next state of a flip-flop is defined by it's characteristic equation we plug the excitation equations into the characteristic equation for the flip-flop.

This step is more complicated because we are using JK flip-flops.

The characteristic equation for a JK flip-flop is:

Qnext = JQ' + K'Q

So, the next state equations are:

Q1next = (X'Q2)Q1' + (X XOR Q2)'Q1

Q2next =  (Q1 + X)Q2' + (Q1)'Q2

Equation 5.

And the output of this circuit is:

Z = Q1Q2'X

Step 3: Develop state table

Because the output of this circuit is a function of the current state and input the state table has to show the output as part of the next state.

Present State

Next State (Q1Q2)/Output

Q1  Q2 X=0 X=1
0    0 00 / 0 01 / 0
0    1 11 / 0 01 / 0
1    0 11 / 0 01 / 1
1    1 00 / 0 10 / 0

Table 2.

The state table has an entry or row for every combination of state values (not all may be used be we can't determine this until the state table is filled out).

The values for next state (Q1Q2) are determined from the next state equations developed in step 2. The output value is for the current state and current input--not for the next state. If you have any confusion about how to calculate the output value, refer back to the original circuit. Looking at the circuit implementation you can see that the output is a function of the current state and current input.

The state table give more information about the circuit, but it is still hard to determine what the circuit is doing.

Step 4: Develop state diagram

It's easier to understand the functionality of this circuit by looking at the state diagram:

state-di-2.gif (55386 bytes)

Figure 6. Sequence detector for the sequence 1011.

The state diagram is slightly different because our circuit follows the Mealy model--the output is a function of the current state and current inputs.

Like the state diagram for the Moore circuit in the first example, the state which the node represents is written inside of the node. Unlike the diagram in the first example the output is show on the arcs. Here is how to interpret the label on the arc leaving a node:

state-output.gif (11254 bytes)

Figure 7.

If the current state of the circuit is X and the current input is 0 the output should be a 1. Note, that this output may not be around for long because as soon as the circuit does move to the next state (probably at the next high-to-low or low-to-high transition on the clock) there will be another arc that determines what the output should be.