Skip to content

Midterm 1 Review: Sequential Sequence Problems

Original Document: PDF Type of problems for Midterm 1 (Partial Solutions)

Design a Traffic Light using D Flip-Flops. Define 6 states (000 — 101):

state 0 (R/R) \to state 1 (G/R) \to state 2 (Y/R) \to state 3 (R/R) \to state 4 (R/G) \to state 5 (R/Y)

 

Problem 2: Traffic Light with Emergency State

Section titled “Problem 2: Traffic Light with Emergency State”

Extend Problem 1 by adding an emergency state:

  • RY blink:
    • for x=1x = 1: go into emergency state
    • for x=0x = 0: go into next state

Consider the emergency state to be 110. We now have 7 states (0 to 6) and a 4-variable table for ABC and X. From the emergency state, x=1x=1 stays in emergency and x=0x=0 resets to 000. You can also consider that by 0/1 stays in the emergency state — in that case you will get different expressions for the f/f inputs.

 

Problem 3: Sequential Circuit with Two D Flip-Flops

Section titled “Problem 3: Sequential Circuit with Two D Flip-Flops”

A sequential circuit with two D f/f, AA and BB; two inputs, xx and yy; and one output ZZ is specified by the following next-state and output functions:

A(t+1)=xy+xAB(t+1)=xB+xAZ=B\begin{aligned} A(t+1) &= x'y + xA \\ B(t+1) &= x'B + xA \\ Z &= B \end{aligned}
  • Draw the circuit
  • Derive the state table
  • Derive the state diagram
Solution

Draw the state table:

Q(t)InputsQ(t+1)OutputABxyABZ0000000100100011010001010110011110001001101010111100110111101111\begin{array}{cc|cc|cc|c} Q(t) & & \text{Inputs} & & Q(t{+}1) & & \text{Output} \\ \hline A & B & x & y & A & B & Z \\ \hline 0 & 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 & 0 & 0 & 0 & & & \\ 1 & 0 & 0 & 1 & & & \\ 1 & 0 & 1 & 0 & & & \\ 1 & 0 & 1 & 1 & & & \\ 1 & 1 & 0 & 0 & & & \\ 1 & 1 & 0 & 1 & & & \\ 1 & 1 & 1 & 0 & & & \\ 1 & 1 & 1 & 1 & & & \\ \end{array}

Since we’re given the next-state functions directly, we can evaluate A(t+1)A(t+1), B(t+1)B(t+1), and ZZ for each row by substituting the present state and inputs:

Q(t)InputsQ(t+1)OutputABxyABZ0000000000110000100000011000010001101011110110001011100110000001001100101011010111101100011110111111101111111111\begin{array}{cc|cc|cc|c} Q(t) & & \text{Inputs} & & Q(t{+}1) & & \text{Output} \\ \hline A & B & x & y & A & B & Z \\ \hline 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 & 1 & 1 \\ 0 & 1 & 0 & 1 & 1 & 1 & 1 \\ 0 & 1 & 1 & 0 & 0 & 0 & 1 \\ 0 & 1 & 1 & 1 & 0 & 0 & 1 \\ 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ 1 & 0 & 0 & 1 & 1 & 0 & 0 \\ 1 & 0 & 1 & 0 & 1 & 1 & 0 \\ 1 & 0 & 1 & 1 & 1 & 1 & 0 \\ 1 & 1 & 0 & 0 & 0 & 1 & 1 \\ 1 & 1 & 0 & 1 & 1 & 1 & 1 \\ 1 & 1 & 1 & 0 & 1 & 1 & 1 \\ 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ \end{array}

Draw the state diagram:

Each of the four present states ABAB becomes a node. Since there are two inputs xx and yy, each state has four outgoing edges labeled xy/Zxy/Z:

State diagram for Problem 3: four states 00, 01, 10, 11 with transitions labeled xy/Z

Drawing the circuit:

In general, drawing the circuit requires knowing the f/f input expressions. You would derive them by filling in the DAD_A and DBD_B columns of the state table using the D flip-flop excitation table, then working through the K-maps to derive the minimized expressions.

In this problem, however, the next-state functions A(t+1)A(t+1) and B(t+1)B(t+1) are given directly. Because a D flip-flop passes its input straight through to its output — that is, D=Q(t+1)D = Q(t+1) — the next-state function and the D input expression are one and the same. So the next-state expressions from the problem statement can be used directly as the D input expressions:

DA=xy+xADB=xB+xAD_A = x'y + xA \qquad D_B = x'B + xA

 

Problem 4: Full Adder Connected to a D Flip-Flop

Section titled “Problem 4: Full Adder Connected to a D Flip-Flop”

A sequential circuit has one f/f QQ; two inputs, xx and yy; and one output SS. It consists of a full adder circuit connected to a D f/f. Derive the state table and state diagram of the sequential circuit.

 

Problem 5: Self-Correcting Sequential Circuit Design

Section titled “Problem 5: Self-Correcting Sequential Circuit Design”

A sequential circuit has three f/f AA, BB, CC; one input xx; one output yy.

  • Design the circuit using D f/f, treating unused states as don’t care conditions
  • Analyze if the circuit is self-correcting

State diagram for Problem 5

Solution

Draw the state table:

The state diagram tells us plenty of information upfront: the valid states, invalid states (the missing states), xx input values that drive the transition for each state, and the output yy for each transition. Using that information, we fill the state table (the unused states can optionally be included, filled in as Don’t Cares):

Q(t)InputQ(t+1)f/fInputsOutputABCxABCDADBDCy000001100001100100100010001110010100010001010001011000100111010110000100100101101010XXXXXXX1011XXXXXXX1100XXXXXXX1101XXXXXXX1110XXXXXXX1111XXXXXXX\begin{array}{ccc|c|ccc|ccc|c} & Q(t) & & \text{Input} & & Q(t{+}1) & & \text{f/f} & \text{Inputs} & & \text{Output} \\ \hline A & B & C & x & A & B & C & D_A & D_B & D_C & y \\ \hline 0 & 0 & 0 & 0 & 0 & 1 & 1 & & & & 0 \\ 0 & 0 & 0 & 1 & 1 & 0 & 0 & & & & 1 \\ 0 & 0 & 1 & 0 & 0 & 0 & 1 & & & & 0 \\ 0 & 0 & 1 & 1 & 1 & 0 & 0 & & & & 1 \\ 0 & 1 & 0 & 0 & 0 & 1 & 0 & & & & 0 \\ 0 & 1 & 0 & 1 & 0 & 0 & 0 & & & & 1 \\ 0 & 1 & 1 & 0 & 0 & 0 & 1 & & & & 0 \\ 0 & 1 & 1 & 1 & 0 & 1 & 0 & & & & 1 \\ 1 & 0 & 0 & 0 & 0 & 1 & 0 & & & & 0 \\ 1 & 0 & 0 & 1 & 0 & 1 & 1 & & & & 0 \\ \color{red}1 & \color{red}0 & \color{red}1 & 0 & X & X & X & X & X & X & X \\ \color{red}1 & \color{red}0 & \color{red}1 & 1 & X & X & X & X & X & X & X \\ \color{red}1 & \color{red}1 & \color{red}0 & 0 & X & X & X & X & X & X & X \\ \color{red}1 & \color{red}1 & \color{red}0 & 1 & X & X & X & X & X & X & X \\ \color{red}1 & \color{red}1 & \color{red}1 & 0 & X & X & X & X & X & X & X \\ \color{red}1 & \color{red}1 & \color{red}1 & 1 & X & X & X & X & X & X & X \\ \end{array}

Fill in the f/f inputs

Use the D flip-flop excitation table to determine the specific values of DAD_A, DBD_B, DCD_C that will produce the next state values:

Q(t)Q(t+1)D000011100111\begin{array}{cc|c} Q(t) & Q(t+1) & D \\ \hline 0 & 0 & 0 \\ 0 & 1 & 1 \\ 1 & 0 & 0 \\ 1 & 1 & 1 \\ \end{array} Q(t)InputQ(t+1)f/fInputsOutputABCxABCDADBDCy000001101100001100100100100010010001110010010100010010001010000001011000100100111010010110000100100100101101101010XXXXXXX1011XXXXXXX1100XXXXXXX1101XXXXXXX1110XXXXXXX1111XXXXXXX\begin{array}{ccc|c|ccc|ccc|c} & Q(t) & & \text{Input} & & Q(t{+}1) & & \text{f/f} & \text{Inputs} & & \text{Output} \\ \hline A & B & C & x & A & B & C & D_A & D_B & D_C & y \\ \hline 0 & 0 & 0 & 0 & 0 & 1 & 1 & 0 & 1 & 1 & 0 \\ 0 & 0 & 0 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 & 0 & 0 & 1 & 0 & 0 & 1 & 0 \\ 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 \\ 0 & 1 & 0 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 \\ 0 & 1 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\ 0 & 1 & 1 & 0 & 0 & 0 & 1 & 0 & 0 & 1 & 0 \\ 0 & 1 & 1 & 1 & 0 & 1 & 0 & 0 & 1 & 0 & 1 \\ 1 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 \\ 1 & 0 & 0 & 1 & 0 & 1 & 1 & 0 & 1 & 1 & 0 \\ \color{red}1 & \color{red}0 & \color{red}1 & 0 & X & X & X & X & X & X & X \\ \color{red}1 & \color{red}0 & \color{red}1 & 1 & X & X & X & X & X & X & X \\ \color{red}1 & \color{red}1 & \color{red}0 & 0 & X & X & X & X & X & X & X \\ \color{red}1 & \color{red}1 & \color{red}0 & 1 & X & X & X & X & X & X & X \\ \color{red}1 & \color{red}1 & \color{red}1 & 0 & X & X & X & X & X & X & X \\ \color{red}1 & \color{red}1 & \color{red}1 & 1 & X & X & X & X & X & X & X \\ \end{array}

Derive the flip-flop input expressions:

Unused states ABC = 101, 110, 111 treated as Don’t Care conditions on the K-maps:

DA:D_A:

K-map for D_A: rows AB, cols Cx; row AB=00: 0 1 1 0; row AB=01: 0 0 0 0; row AB=11: X X X X; row AB=10: 0 0 X X; group on row AB=00 cols Cx=01,11 gives D_A = A'B'x

DA=ABxD_A = A'B'x

DB:D_B:

K-map for D_B: rows AB, cols Cx; row AB=00: 1 0 0 0; row AB=01: 1 0 1 0; row AB=11: X X X X; row AB=10: 1 1 X X; three groups give D_B = C'x' + A + BCx

DB=Cx+A+BCxD_B = C'x' + A + BCx

DC:D_C:

K-map for D_C: rows AB, cols Cx; row AB=00: 1 0 0 1; row AB=01: 0 0 0 1; row AB=11: X X X X; row AB=10: 0 1 X X; three groups give D_C = A'B'x' + Cx' + Ax

DC=ABx+Cx+AxD_C = A'B'x' + Cx' + Ax

y:y:

K-map for y: rows AB, cols Cx; row AB=00: 0 1 1 0; row AB=01: 0 1 1 0; row AB=11: X X X X; row AB=10: 0 0 X X; 2x2 group on rows AB=00,01 cols Cx=01,11 gives y = A'x

y=Axy = A'x

Check for self-correction:

We plug each unused state into the derived expressions and trace where the circuit goes next.

Unused state ABC = 101:

DA=ABx=0A reset to 0DB=Cx+A+BCx=0+1+0=1B set to 1DC=ABx+Cx+Ax=0+x+x=1C set to 1\begin{aligned} D_A &= A'B'x = 0 & &\Rightarrow A \text{ reset to } 0 \\ D_B &= C'x' + A + BCx = 0 + 1 + 0 = 1 & &\Rightarrow B \text{ set to } 1 \\ D_C &= A'B'x' + Cx' + Ax = 0 + x' + x = 1 & &\Rightarrow C \text{ set to } 1 \end{aligned} 101011101 \to 011

State 011 is valid, so the circuit self-corrects out of state 101.

Unused state ABC = 110:

DA=ABx=0A reset to 0DB=Cx+A+BCx=x+1+0=1B set to 1DC=ABx+Cx+Ax=0+0+x=xC dependent on x\begin{aligned} D_A &= A'B'x = 0 & &\Rightarrow A \text{ reset to } 0 \\ D_B &= C'x' + A + BCx = x' + 1 + 0 = 1 & &\Rightarrow B \text{ set to } 1 \\ D_C &= A'B'x' + Cx' + Ax = 0 + 0 + x = x & & \Rightarrow C \text{ dependent on } x \\ \end{aligned} 11001?110 \to 01?

Invalid state 110 could transition to either of two states, so now we check the two cases:

  • x=0x = 0:
DC=x=0C reset to 0D_C = x = 0 \quad\Rightarrow\quad C \text{ reset to } 0 1100010110 \xrightarrow{0} 010
  • x=1x = 1:
DC=x=1C set to 1D_C = x = 1 \quad\Rightarrow\quad C \text{ set to } 1 1101011110 \xrightarrow{1} 011

Both states 010 and 011 are valid, so the circuit self-corrects out of state 110.

Unused state ABC = 111:

DA=ABx=0A reset to 0DB=Cx+A+BCx=0+1+x=1B set to 1DC=ABx+Cx+Ax=0+x+x=1C set to 1\begin{aligned} D_A &= A'B'x = 0 & &\Rightarrow A \text{ reset to } 0 \\ D_B &= C'x' + A + BCx = 0 + 1 + x = 1 & &\Rightarrow B \text{ set to } 1 \\ D_C &= A'B'x' + Cx' + Ax = 0 + x' + x = 1 & &\Rightarrow C \text{ set to } 1 \end{aligned} 111011111 \to 011

State 011 is valid, so the circuit self-corrects out of state 111.

All unused states transition to valid states regardless of input, so the circuit is self-correcting.

 

Problem 6: JK Flip-Flop Sequential Circuit

Section titled “Problem 6: JK Flip-Flop Sequential Circuit”

A sequential circuit has 2 JK f/f, one input xx, and one output yy. The logic diagram is shown below. Derive the state table and state diagram.

Solution

Get the expression of the f/f inputs (based on present states and external input) by tracing through the given circuit diagram. Based on present state and f/f inputs, get the next state.

f/f input and yy output expressions:

JA=BJB=(xA)KA=BKB=(xA)\begin{aligned} J_A &= B & \qquad J_B &= (x \oplus A)' \\ K_A &= B' & \qquad K_B &= (x \oplus A)' \end{aligned} y=xABy = x \oplus A \oplus B

Draw the state table:

Q(t)InputQ(t+1)f/fInputsOutputABxABJAKAJBKBy000001010011100101110111\begin{array}{cc|c|cc|cccc|c} Q(t) & & \text{Input} & Q(t{+}1) & & \text{f/f} & \text{Inputs} & & & Output \\ \hline A & B & x & A & B & J_A & K_A & J_B & K_B & y \\ \hline 0 & 0 & 0 & & & & & & & \\ 0 & 0 & 1 & & & & & & & \\ 0 & 1 & 0 & & & & & & & \\ 0 & 1 & 1 & & & & & & & \\ 1 & 0 & 0 & & & & & & & \\ 1 & 0 & 1 & & & & & & & \\ 1 & 1 & 0 & & & & & & & \\ 1 & 1 & 1 & & & & & & & \\ \end{array}

Fill in the flip-flop inputs:

The f/f inputs and the yy output are the first thing we can compute, since they depend only on the present state and xx, which we already have.

Q(t)InputQ(t+1)f/fInputsOutputABxABJAKAJBKBy0000111000101001010101110111000010001001101011101101000011110111\begin{array}{cc|c|cc|cccc|c} Q(t) & & \text{Input} & Q(t{+}1) & & \text{f/f} & \text{Inputs} & & & Output \\ \hline A & B & x & A & B & J_A & K_A & J_B & K_B & y \\ \hline 0 & 0 & 0 & & & 0 & 1 & 1 & 1 & 0 \\ 0 & 0 & 1 & & & 0 & 1 & 0 & 0 & 1 \\ 0 & 1 & 0 & & & 1 & 0 & 1 & 1 & 1 \\ 0 & 1 & 1 & & & 1 & 0 & 0 & 0 & 0 \\ 1 & 0 & 0 & & & 0 & 1 & 0 & 0 & 1 \\ 1 & 0 & 1 & & & 0 & 1 & 1 & 1 & 0 \\ 1 & 1 & 0 & & & 1 & 0 & 0 & 0 & 0 \\ 1 & 1 & 1 & & & 1 & 0 & 1 & 1 & 1 \\ \end{array}

Determine the next state:

With the f/f inputs in hand, each flip-flop’s next state follows from how a JK flip-flop behaves in response to its J/K inputs, as described by the JK characteristic table:

JKQ(t+1)00Q(t)01010111Q(t)\begin{array}{cc|c} J & K & Q(t+1) \\ \hline 0 & 0 & Q(t) \\ 0 & 1 & 0 \\ 1 & 0 & 1 \\ 1 & 1 & Q'(t) \\ \end{array}

Fill in the next state values:

Q(t)InputQ(t+1)f/fInputsOutputABxABJAKAJBKBy00001011100010001001010101011101111100001000001001101010111011011100001111010111\begin{array}{cc|c|cc|cccc|c} Q(t) & & \text{Input} & Q(t{+}1) & & \text{f/f} & \text{Inputs} & & & Output \\ \hline A & B & x & A & B & J_A & K_A & J_B & K_B & y \\ \hline 0 & 0 & 0 & 0 & 1 & 0 & 1 & 1 & 1 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 & 1 & 0 & 0 & 1 \\ 0 & 1 & 0 & 1 & 0 & 1 & 0 & 1 & 1 & 1 \\ 0 & 1 & 1 & 1 & 1 & 1 & 0 & 0 & 0 & 0 \\ 1 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 1 \\ 1 & 0 & 1 & 0 & 1 & 0 & 1 & 1 & 1 & 0 \\ 1 & 1 & 0 & 1 & 1 & 1 & 0 & 0 & 0 & 0 \\ 1 & 1 & 1 & 1 & 0 & 1 & 0 & 1 & 1 & 1 \\ \end{array}

State Diagram:

Draw the state diagram based on the state table. Each of the four present states AB becomes a node with a directed edge leading to the next state. The edges are labeled in the form x/y, where xx is the input driving the transition and yy is the resulting output:

State diagram: four states 00, 01, 10, 11 with transitions labeled input/output