Lesson 17 +40 XP

Analysis of Sequential Circuits, State Tables & State Reduction

Analysis of Sequential Circuits, State Tables & State Reduction

A clocked sequential circuit is described by three equivalent things: its equations, its state table and its state diagram. Analysis starts from a circuit and produces the table and diagram, so we can say what the circuit does. This lesson covers analysis with D, JK and T flip-flops, the Mealy and Moore models, and state reduction, which removes redundant states before a design is built.

1. Mealy and Moore Models

Mealy machineMoore machine
Output depends onpresent state and present inputpresent state only
Output writtenon the arrows: input/outputinside the state circle: state/output
Output changesas soon as the input changesonly after a clock edge
States neededusually fewerusually one or two more

Block diagrams of the Mealy and Moore modelsBlock diagrams of the Mealy and Moore models

A Mealy output can contain glitches if the input changes in the middle of a clock period; a Moore output is synchronised with the clock, which makes it safer to feed to other circuits.

2. The Analysis Procedure

  1. Write the flip-flop input equations (D, JK or T inputs) and the output equations from the circuit.
  2. Find the next-state equations: substitute the input equations into the characteristic equation of each flip-flop. (For D flip-flops, Q+ = D, so this step is immediate.)
  3. Build the state table: one row per combination of present state and input.
  4. Draw the state diagram.

3. Analysis with D Flip-Flops

Clocked sequential circuit with two D flip-flopsClocked sequential circuit with two D flip-flops

SolvedExample 1 · Analysing a circuit with D flip-flops (Mano)

A circuit has flip-flops A, B, input x and output y, with DA = Ax + Bx, DB = A'x and y = (A + B)x'. Derive the state table and state diagram.

  1. With D flip-flops, A(t+1) = Ax + Bx and B(t+1) = A'x.
  2. Evaluate for all eight (A, B, x) rows:
Present ABxNext ABy
000000
001010
010001
011110
100001
101100
110001
111100
  1. The output depends on x, so this is a Mealy machine; each arrow is labelled x/y.
  2. Behaviour: any 0 input returns the circuit to 00, and y = 1 when a 0 arrives after at least one 1 (from any state other than 00).
Answerthe table above; the state diagram is shown below

State diagram of the circuitState diagram of the circuit

The state table is often written in a compact two-column form, which is the form used in state reduction:

Present stateNext state, x = 0Next state, x = 1y, x = 0y, x = 1
00000100
01001110
10001010
11001010

4. Analysis with JK and T Flip-Flops

For JK and T flip-flops the next state is not just the input, so step 2 matters: either substitute into Q+ = JQ' + K'Q (or Q+ = T oplus Q), or list the J, K values in the table and read the next state from the characteristic table.

SolvedExample 2 · Analysing a circuit with JK flip-flops (Mano)

A circuit has JA = B, KA = Bx', JB = x', KB = A'x + Ax' = A oplus x. Find the state table.

A B xJA KAJB KBNext AB
0 0 00 01 001
0 0 10 00 100
0 1 01 11 011
0 1 11 00 110
1 0 00 01 111
1 0 10 00 010
1 1 01 11 100
1 1 11 00 011
  1. Row 010: JA = KA = 1 toggles A from 0 to 1; JB = 1, KB = 0 sets B: next state 11.
  2. Row 110: both flip-flops have J = K = 1 and toggle: 11 becomes 00.
  3. Check with the next-state equations: A+ = JA A' + KA' A = BA' + (Bx')'A = A'B + AB' + Ax, and B+ = JB B' + KB' B = x'B' + (A oplus x)'B.
Answer00 → (01, 00), 01 → (11, 10), 10 → (11, 10), 11 → (00, 11) for x = (0, 1)
SolvedExample 3 · A Moore circuit with T flip-flops

A circuit has TA = Bx, TB = x and output y = AB. Find its state diagram and describe what it does.

  1. When x = 0: TA = TB = 0, so nothing changes.
  2. When x = 1: TB = 1 always toggles B; TA = B toggles A only when B = 1. From 00: 01, 10, 11, 00.
  3. y = AB depends only on the state, so this is a Moore machine and y = 1 only in state 11.
Answera 2-bit binary counter that counts when x = 1 and holds when x = 0; y = 1 at count 3

State diagram of the Moore circuitState diagram of the Moore circuit

5. State Reduction

Two states are equivalent if, for every input, they give the same output and go to the same or equivalent next states. One of them can then be removed and every reference to it replaced by the other. Fewer states can mean fewer flip-flops and always means simpler next-state logic.

Method 1: Row Matching

Look for two rows of the state table with identical next states and identical outputs. Remove one, rename, and repeat until no two rows match.

SolvedExample 4 · Reducing a 7-state table (Mano)

Reduce the state table below (input x, output y).

StateNext, x = 0Next, x = 1y, x = 0y, x = 1
aab00
bcd00
cad00
def01
eaf01
fgf01
gaf01
  1. Rows e and g are identical (a, f, 0, 1). Remove g and replace every g by e: row f becomes (e, f, 0, 1).
  2. Now rows d and f are identical (e, f, 0, 1). Remove f and replace every f by d.
  3. The remaining rows a, b, c, d, e are all different.
StateNext, x = 0Next, x = 1y, x = 0y, x = 1
aab00
bcd00
cad00
ded01
ead01
Answer5 states (g ≡ e, f ≡ d); still 3 flip-flops, but more unused states become don't-cares

Reduced state diagramReduced state diagram

Method 2: The Implication Chart

Row matching misses equivalences that depend on each other (two rows that differ only because they point at each other). The implication chart (implication table) finds all of them.

  1. Draw a staircase with one cell for every pair of states.
  2. Put X in a cell if the two states have different outputs.
  3. Otherwise write in the cell the pairs of next states that must also be equivalent (the implied pairs). Write ✓ if the next states are the same.
  4. Repeatedly cross out any cell that contains a pair already crossed out.
  5. Cells left without an X are equivalent pairs.
SolvedExample 5 · Implication chart for the same table

Find all equivalent states of the 7-state table in Example 4.

  1. States a, b, c have output 00 and d, e, f, g have output 01, so every cell pairing one group with the other gets X.
  2. The initial chart (implied pairs written in each cell):
abcdef
bac, bd
cbdac
dXXX
eXXXae
fXXXegag
gXXXae✓ag
  1. Pass 1: bd is crossed, so ab and ac are crossed; ac is now crossed, so bc is crossed. ae is crossed, so de and dg are crossed; ag is crossed, so ef and fg are crossed.
  2. Pass 2: the cell df needs eg, which is ✓, so df survives. No further change.
Answerthe surviving cells are (e, g) and (d, f), the same result as row matching

6. State Assignment

Before a reduced table can be built, every symbolic state gets a binary code. With n states, at least ⌈ log2 n ⌉ flip-flops are needed.

Assignment5 states a to eFlip-flopsNotes
Binary000, 001, 010, 011, 1003fewest flip-flops
Gray000, 001, 011, 010, 1103neighbouring states differ in one bit, often simpler logic
One-hot00001, 00010, 00100, 01000, 100005one flip-flop per state; very simple logic, popular in FPGAs

Unused codes (here 101, 110, 111 for binary) become don't-cares in the K-maps of the design.

7. Simulating the Analysed Circuit in Verilog

The circuit of Example 1, written directly from its equations. The testbench applies the input sequence 0, 1, 1, 0, 1, 1, 1, 0 from state 00 and prints one state-table row per clock:

VERILOG
// The analysed circuit: DA = Ax + Bx, DB = A'x, y = (A + B)x'
module seq_circuit (
    input  clk,
    input  rst_n,
    input  x,
    output y,
    output reg A,
    output reg B
);
    wire DA = (A & x) | (B & x);
    wire DB = ~A & x;
    assign y = (A | B) & ~x;            // Mealy output: depends on x too

    always @(posedge clk or negedge rst_n) begin
        if (!rst_n) begin
            A <= 1'b0;
            B <= 1'b0;
        end else begin
            A <= DA;
            B <= DB;
        end
    end
endmodule

module tb;
    reg clk = 0, rst_n = 0, x = 0;
    wire y, A, B;
    reg [7:0] seq = 8'b01101110;        // input sequence, applied left to right
    integer i;

    seq_circuit dut (.clk(clk), .rst_n(rst_n), .x(x), .y(y), .A(A), .B(B));

    initial begin
        #1 rst_n = 1;
        $display("present AB  x | y | next AB");
        for (i = 7; i >= 0; i = i - 1) begin
            x = seq[i];
            #1 $write("        %b%b  %b | %b | ", A, B, x, y);
            #4 clk = 1;
            #1 $display("%b%b", A, B);
            #4 clk = 0;
        end
    end
endmodule

Every printed row matches a row of the state table in Example 1:

OUTPUT
present AB  x | y | next AB
        00  0 | 0 | 00
        00  1 | 0 | 01
        01  1 | 0 | 11
        11  0 | 1 | 00
        00  1 | 0 | 01
        01  1 | 0 | 11
        11  1 | 0 | 10
        10  0 | 1 | 00
💡 Tip

Key points to remember

  • Mealy: output = f(state, input), written on arrows. Moore: output = f(state), written in circles.
  • Analysis: input equations → next-state equations → state table → state diagram.
  • D: Q+ = D; JK: Q+ = JQ' + K'Q; T: Q+ = T oplus Q.
  • Equivalent states: same outputs and equivalent next states for every input.
  • Implication chart: X for different outputs, write implied pairs, cross out repeatedly.
  • n states need at least ⌈ log2 n ⌉ flip-flops (binary) or n (one-hot).
🎯 END-TERM EXAM PREP

📝 IPU End-Term Exam Corner (5-10 Marks)

  • Q1. Differentiate between Mealy and Moore machines with block diagrams and an example. (5 Marks)
  • Q2. Analyse a sequential circuit with DA = Ax + Bx, DB = A'x, y = (A + B)x'. Derive the state table and state diagram. (10 Marks)
  • Write: next-state equations, the 8-row state table, the 4-state Mealy diagram.
  • Q3. Analyse a circuit with JK flip-flops JA = B, KA = Bx', JB = x', KB = A oplus x. (10 Marks)
  • Q4. Reduce a given state table using the implication chart method. (10 Marks)
  • Write: the staircase chart, X for output conflicts, implied pairs, the crossing passes, the equivalent pairs and the reduced table.
  • Q5. What is state assignment? Compare binary, Gray and one-hot assignment. (5 Marks)