Loading lessons...
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 machine | Moore machine | |
|---|---|---|
| Output depends on | present state and present input | present state only |
| Output written | on the arrows: input/output | inside the state circle: state/output |
| Output changes | as soon as the input changes | only after a clock edge |
| States needed | usually fewer | usually one or two more |
Block 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
- Write the flip-flop input equations (D, JK or T inputs) and the output equations from the circuit.
- 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.)
- Build the state table: one row per combination of present state and input.
- Draw the state diagram.
3. Analysis with D Flip-Flops
Clocked sequential circuit with two D flip-flops
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.
- With D flip-flops, A(t+1) = Ax + Bx and B(t+1) = A'x.
- Evaluate for all eight (A, B, x) rows:
| Present AB | x | Next AB | y |
|---|---|---|---|
| 00 | 0 | 00 | 0 |
| 00 | 1 | 01 | 0 |
| 01 | 0 | 00 | 1 |
| 01 | 1 | 11 | 0 |
| 10 | 0 | 00 | 1 |
| 10 | 1 | 10 | 0 |
| 11 | 0 | 00 | 1 |
| 11 | 1 | 10 | 0 |
- The output depends on x, so this is a Mealy machine; each arrow is labelled x/y.
- 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).
State 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 state | Next state, x = 0 | Next state, x = 1 | y, x = 0 | y, x = 1 |
|---|---|---|---|---|
| 00 | 00 | 01 | 0 | 0 |
| 01 | 00 | 11 | 1 | 0 |
| 10 | 00 | 10 | 1 | 0 |
| 11 | 00 | 10 | 1 | 0 |
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.
A circuit has JA = B, KA = Bx', JB = x', KB = A'x + Ax' = A oplus x. Find the state table.
| A B x | JA KA | JB KB | Next AB |
|---|---|---|---|
| 0 0 0 | 0 0 | 1 0 | 01 |
| 0 0 1 | 0 0 | 0 1 | 00 |
| 0 1 0 | 1 1 | 1 0 | 11 |
| 0 1 1 | 1 0 | 0 1 | 10 |
| 1 0 0 | 0 0 | 1 1 | 11 |
| 1 0 1 | 0 0 | 0 0 | 10 |
| 1 1 0 | 1 1 | 1 1 | 00 |
| 1 1 1 | 1 0 | 0 0 | 11 |
- Row 010: JA = KA = 1 toggles A from 0 to 1; JB = 1, KB = 0 sets B: next state 11.
- Row 110: both flip-flops have J = K = 1 and toggle: 11 becomes 00.
- 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.
A circuit has TA = Bx, TB = x and output y = AB. Find its state diagram and describe what it does.
- When x = 0: TA = TB = 0, so nothing changes.
- When x = 1: TB = 1 always toggles B; TA = B toggles A only when B = 1. From 00: 01, 10, 11, 00.
- y = AB depends only on the state, so this is a Moore machine and y = 1 only in state 11.
State 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.
Reduce the state table below (input x, output y).
| State | Next, x = 0 | Next, x = 1 | y, x = 0 | y, 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 |
- 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).
- Now rows d and f are identical (e, f, 0, 1). Remove f and replace every f by d.
- The remaining rows a, b, c, d, e are all different.
| State | Next, x = 0 | Next, x = 1 | y, x = 0 | y, x = 1 |
|---|---|---|---|---|
| a | a | b | 0 | 0 |
| b | c | d | 0 | 0 |
| c | a | d | 0 | 0 |
| d | e | d | 0 | 1 |
| e | a | d | 0 | 1 |
Reduced 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.
- Draw a staircase with one cell for every pair of states.
- Put X in a cell if the two states have different outputs.
- 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.
- Repeatedly cross out any cell that contains a pair already crossed out.
- Cells left without an X are equivalent pairs.
Find all equivalent states of the 7-state table in Example 4.
- 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.
- The initial chart (implied pairs written in each cell):
| a | b | c | d | e | f | |
|---|---|---|---|---|---|---|
| b | ac, bd | |||||
| c | bd | ac | ||||
| d | X | X | X | |||
| e | X | X | X | ae | ||
| f | X | X | X | eg | ag | |
| g | X | X | X | ae | ✓ | ag |
- 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.
- Pass 2: the cell df needs eg, which is ✓, so df survives. No further change.
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.
| Assignment | 5 states a to e | Flip-flops | Notes |
|---|---|---|---|
| Binary | 000, 001, 010, 011, 100 | 3 | fewest flip-flops |
| Gray | 000, 001, 011, 010, 110 | 3 | neighbouring states differ in one bit, often simpler logic |
| One-hot | 00001, 00010, 00100, 01000, 10000 | 5 | one 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:
// 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
endmoduleEvery printed row matches a row of the state table in Example 1:
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 | 00Key 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).
📝 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)