Skip to content

Midterm 1 Review: Sequential Sequence Problems | CSCI 343

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)

 

Solution

We have 6 valid states encoded in 3 bits ABCABC: 000 through 101. States 110 and 111 are unused. The circuit has no external input — it simply cycles through the 6 states on each clock edge.

State Diagram:

State diagram for Problem 1: six-state traffic-light cycle 000→001→010→011→100→101→000

Draw the state table:

The next state is fixed for each present state (no input variable), so the table has one row per state. The state sequence is given directly by the problem, so we fill in the Q(t+1)Q(t+1) columns first (the unused states can optionally be included, filled in as Don’t Cares):

Q(t)Q(t+1)f/fInputsABCABCDADBDC000001001010010011011100100101101000110XXXXXX111XXXXXX\begin{array}{ccc|ccc|ccc} & Q(t) & & & Q(t{+}1) & & \text{f/f} & \text{Inputs} & \\ \hline A & B & C & A & B & C & D_A & D_B & D_C \\ \hline 0 & 0 & 0 & 0 & 0 & 1 & & & \\ 0 & 0 & 1 & 0 & 1 & 0 & & & \\ 0 & 1 & 0 & 0 & 1 & 1 & & & \\ 0 & 1 & 1 & 1 & 0 & 0 & & & \\ 1 & 0 & 0 & 1 & 0 & 1 & & & \\ 1 & 0 & 1 & 0 & 0 & 0 & & & \\ \color{red}1 & \color{red}1 & \color{red}0 & X & X & X & X & X & X \\ \color{red}1 & \color{red}1 & \color{red}1 & X & X & X & X & X & X \\ \end{array}

Fill in the flip-flop inputs:

Use the D flip-flop excitation table to determine the DD input values that produce each next-state transition:

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)Q(t+1)f/fInputsABCABCDADBDC000001001001010010010011011011100100100101101101000000110XXXXXX111XXXXXX\begin{array}{ccc|ccc|ccc} & Q(t) & & & Q(t{+}1) & & \text{f/f} & \text{Inputs} & \\ \hline A & B & C & A & B & C & D_A & D_B & D_C \\ \hline 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 & 1 & 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 & 1 & 1 & 0 & 1 & 1 \\ 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 \\ 1 & 0 & 0 & 1 & 0 & 1 & 1 & 0 & 1 \\ 1 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ \color{red}1 & \color{red}1 & \color{red}0 & X & X & X & X & X & X \\ \color{red}1 & \color{red}1 & \color{red}1 & X & X & X & X & X & X \\ \end{array}

Derive the flip-flop input expressions:

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

DA:D_A:

K-map for D_A

DA=BC+ACD_A = BC + AC'

DB:D_B:

K-map for D_B

DB=BC+ABCD_B = BC' + A'B'C

DC:D_C:

K-map for D_C

DC=CD_C = C'
Extending the Circuitry

We can extend the circuitry by connecting the flip-flops to the traffic lights. Consider this cross-intersection traffic light, where both sides are controlled by the same flip-flops. To distinguish the lights on either side, we use subscripts: R1,Y1,G1R_1, Y_1, G_1 for Side 1 and R2,Y2,G2R_2, Y_2, G_2 for Side 2. Each state maps to a specific combination of active lights:

StateABCABCSide 1 / Side 2
0000R1/R2R_1 / R_2
1001G1/R2G_1 / R_2
2010Y1/R2Y_1 / R_2
3011R1/R2R_1 / R_2
4100R1/G2R_1 / G_2
5101R1/Y2R_1 / Y_2
6110unused
7111unused

We can connect the flip flops to the lights with a 3×8 decoder, which takes a 3-bit input — each flip flop A, B, C contributing 1 bit — and enables exactly one of its 8 outputs.

We’ll use DjD_j to refer to decoder output jj — that is, the wire that is enabled when the current state is jj. We can’t wire a decoder output directly to a light, because some lights need to be on across multiple states (e.g. R1R_1 is on in states 0, 3, 4, and 5). So those lights get an OR gate that combines the relevant decoder outputs for the states where that light should be on:

  • G1=D1G_1 = D_1
  • Y1=D2Y_1 = D_2
  • R1=D0+D3+D4+D5R_1 = D_0 + D_3 + D_4 + D_5 (red is on in states 0, 3, 4, 5)
  • G2=D4G_2 = D_4
  • Y2=D5Y_2 = D_5
  • R2=D0+D1+D2+D3R_2 = D_0 + D_1 + D_2 + D_3 (red is on in states 0, 1, 2, 3)

Decoder outputs D6D_6 and D7D_7 (for unused states 110 and 111) are left unconnected — they don’t feed into any light.

 

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.

 

Solution

We now have 7 valid states (000—110) and one input xx, making this a 4-variable problem. State 111 is the only unused state.

The problem statement gives us a design choice — we’ll go with the one that returns to 000 from the emergency state when x=0x = 0.

Draw the state table:

Each state now has two rows — one for x=0x=0 (normal cycling) and one for x=1x=1 (go to emergency):

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

Fill in the flip-flop inputs:

Use the D flip-flop excitation table to determine the DD input values that produce each next-state transition:

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/fInputsABCxABCDADBDC000000100100011101100010010010001111011001000110110101110110011010010001111101101000101101100111011010100000001011110110110000000011011101101110XXXXXX1111XXXXXX\begin{array}{ccc|c|ccc|ccc} & Q(t) & & \text{Input} & & Q(t{+}1) & & \text{f/f} & \text{Inputs} & \\ \hline A & B & C & x & A & B & C & D_A & D_B & D_C \\ \hline 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 1 \\ 0 & 0 & 0 & 1 & 1 & 1 & 0 & 1 & 1 & 0 \\ 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 \\ 0 & 0 & 1 & 1 & 1 & 1 & 0 & 1 & 1 & 0 \\ 0 & 1 & 0 & 0 & 0 & 1 & 1 & 0 & 1 & 1 \\ 0 & 1 & 0 & 1 & 1 & 1 & 0 & 1 & 1 & 0 \\ 0 & 1 & 1 & 0 & 1 & 0 & 0 & 1 & 0 & 0 \\ 0 & 1 & 1 & 1 & 1 & 1 & 0 & 1 & 1 & 0 \\ 1 & 0 & 0 & 0 & 1 & 0 & 1 & 1 & 0 & 1 \\ 1 & 0 & 0 & 1 & 1 & 1 & 0 & 1 & 1 & 0 \\ 1 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 1 & 0 & 1 & 1 & 1 & 1 & 0 & 1 & 1 & 0 \\ 1 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 1 & 1 & 0 & 1 & 1 & 1 & 0 & 1 & 1 & 0 \\ \color{red}1 & \color{red}1 & \color{red}1 & 0 & X & X & X & X & X & X \\ \color{red}1 & \color{red}1 & \color{red}1 & 1 & X & X & X & X & X & X \\ \end{array}

Derive the flip-flop input expressions:

Unused state ABC = 111 (both xx values) treated as Don’t Care conditions on the K-maps:

DA:D_A:

K-map for D_A (Problem 2)

DA=x+BC+ABCD_A = x + BC + A B'C'

DB:D_B:

K-map for D_B (Problem 2)

DB=x+ABC+ABCD_B = x + A'B'C + A'BC'

DC:D_C:

K-map for D_C (Problem 2)

DC=xAC+xBCD_C = x'A'C' + x'B'C'

State Diagram:

State diagram for Problem 2: six-state cycle with emergency state 110

 

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

Draw 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.

Hint

When adding two binary numbers, we add them one bit at a time (by column) and the carry that is generated by that addition will be remembered for the next one.

Solution

The circuitry that we build here is the adding core of a serial adder: it takes one bit from each number (xx and yy), produces their sum bit SS, and passes the carry forward to the next pair.

Recall the Full Adder:

A full adder takes 3 inputs: two addends (xx and yy) and the carry-in (CinC_\text{in}). Its outputs are the sum (SS) and the carry-out (CoutC_\text{out}).

Identify the role of the flip flop QQ:

Each column’s addition produces a carry-out that has to be remembered, since it becomes the carry-in for the next column. So the circuit needs some way to hold onto a single bit of state between one addition and the next — and remembering a bit of state is exactly the job of a flip-flop. We feed the adder’s CoutC_{out} into the flip-flop, and on the next addition it reappears at the flip-flop’s output, ready to serve as the CinC_{in} for that addition.

  • The carry-in to the adder is the current flip-flop state, QQ.
  • The sum output of the adder is the circuit’s output SS.
  • We know that the carry-out will be used as the next addition’s carry-in. We also know that by the characteristics of a D flip flop (D=Q(t+1)D = Q(t+1)), its input will be exactly its output (the next state). So we can just compute the carry generated by the current addition and feed it into the flip flop’s input, and it will be available again as the next carry-in.

Draw the state table:

There is one flip-flop, so only two present states, Q=0Q = 0 and Q=1Q = 1. Each is paired with the four combinations of the inputs xx and yy:

Q(t)InputsQ(t+1)OutputCinxy000001010011100101110111\begin{array}{c|cc|c|c} Q(t) & \text{Inputs} & & Q(t{+}1) & \text{Output} \\ \hline C_{in} & x & 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}

For each row, we add the three bits Cin+x+yC_\text{in} + x + y and split the 2-bit result across the two output columns:

  • The sum bit goes into the output SS.
  • The carry bit is the CoutC_\text{out}, which (as established above) is wired through the flip-flop to become the next state Q(t+1)Q(t+1). So we just compute the carry bit from each row’s addition and fill it into Q(t+1)Q(t+1).
Q(t)InputsD=Q(t+1)OutputCinxyCoutS0000000101010010111010001101101101011111\begin{array}{c|cc|c|c} Q(t) & \text{Inputs} & & D = Q(t{+}1) & \text{Output} \\ \hline C_{in} & x & y & C_{out} & S \\ \hline 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 1 \\ 0 & 1 & 0 & 0 & 1 \\ 0 & 1 & 1 & 1 & 0 \\ 1 & 0 & 0 & 0 & 1 \\ 1 & 0 & 1 & 1 & 0 \\ 1 & 1 & 0 & 1 & 0 \\ 1 & 1 & 1 & 1 & 1 \\ \end{array}

As a sanity check, the rows match what the full adder should produce: the next state (the carry-out) is 11 exactly when at least two of {x,y,Q}\{x, y, Q\} are 11, and the output SS is the XOR of the three bits.

Draw the state diagram:

With a single flip-flop the diagram has just two nodes, Q=0Q = 0 and Q=1Q = 1, and each transition is labeled xy/Sxy/S following the rows of the table above. For example, from Q=0Q = 0 the inputs xy=11xy = 11 generate a carry and move the circuit to Q=1Q = 1 with output S=0S = 0.

State diagram for Problem 4: two states Q=0 and Q=1 with transitions labeled xy/S

 

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

The transitions in the diagram are in the format input/output: the first value indicates the input variable driving the transition, and the second indicates the output of the circuit.

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

DA=ABxD_A = A'B'x

DB:D_B:

K-map for D_B

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

DC:D_C:

K-map for D_C

DC=Ax+Cx+ABxD_C = Ax + Cx' + A'B'x'

y:y:

K-map for y

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 expressions and yy output expression:

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

 

Problem 7: SR Flip-Flop Implementation of Problem 6’s Circuit

Section titled “Problem 7: SR Flip-Flop Implementation of Problem 6’s Circuit”

Using the same circuit diagram from Problem 6, assume that it uses SR flip flops rather than JK flip flops. Derive the state table.

Solution

The f/f input expressions are the same as Problem 6, but now mapped to SR inputs:

SA=BSB=(xA)RA=BRB=(xA)\begin{aligned} S_A &= B & \qquad S_B &= (x \oplus A)' \\ R_A &= B' & \qquad R_B &= (x \oplus A)' \end{aligned} y=xABy = x \oplus A \oplus B

Draw the state table:

Q(t)InputQ(t+1)f/fInputsOutputABxABSARASBRBy000001010011100101110111\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 & S_A & R_A & S_B & R_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:

Determine the f/f inputs given the above expressions:

Q(t)InputQ(t+1)f/fInputsOutputABxABSARASBRBy0000111000101001010101110111000010001001101011101101000011110111\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 & S_A & R_A & S_B & R_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:

Use the SR f/f characteristics table to determine the next state:

SRQ(t+1)00Q(t)01010111invalid\begin{array}{cc|c} S & R & Q(t+1) \\ \hline 0 & 0 & Q(t) \\ 0 & 1 & 0 \\ 1 & 0 & 1 \\ 1 & 1 & \text{invalid} \\ \end{array} Q(t)InputQ(t+1)f/fInputsOutputABxABSARASBRBy0000?0111000100010010101?10111011111000010000010011010?0111011011100001111?10111\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 & S_A & R_A & S_B & R_B & y \\ \hline 0 & 0 & 0 & 0 & \textcolor{#e73a73}{?} & 0 & 1 & 1 & 1 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 & 1 & 0 & 0 & 1 \\ 0 & 1 & 0 & 1 & \textcolor{#e73a73}{?} & 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 & \textcolor{#e73a73}{?} & 0 & 1 & 1 & 1 & 0 \\ 1 & 1 & 0 & 1 & 1 & 1 & 0 & 0 & 0 & 0 \\ 1 & 1 & 1 & 1 & \textcolor{#e73a73}{?} & 1 & 0 & 1 & 1 & 1 \\ \end{array}

For flip-flop BB: there are four rows where both SS and RR are 1, making BB‘s next state undefined. This is a fundamental limitation of SR flip-flops compared to JK flip-flops — the JK design eliminates this invalid condition by toggling when both inputs are 11.