2 T-Bird: Tail Light Control Circuit Design Designing a state machine that controls the tail lights of a 1965 Ford Thunderbird.There are three lights on each side. They operate in sequence to show the turning direction.The state machine has two input signals LEFT and RIGHT. It also has an emergency flasher input HAZ causes all six lights flashing on and off together.We assume the existence of a free-running clock signal whose frequency equals the desired flashing rate for the lights.
7 Design using State diagrams State diagrams are often used to design small to medium sized state machines.designing a state diagram is much like designing a state table.There is one fundamental difference between a state diagram and a state table, a difference that makes state-diagram design simpler but also more error prone:A state table is an exhaustive listing of the next states for each state/input combination. No ambiguity is possible.A state diagram contains a set of arcs labeled with transition expressions. There is no guarantee that the transition expressions written on the arcs leaving a particular state cover all the input combinations exactly once.
8 Different StatesWe will design a Moore machine, so that the state alone determines which lights are on and which are off.For a left turn, the machine should cycle through four states in which the righthand lights are off and 0, 1, 2, or 3 of the lefthand lights are on.For a right turn, the machine should cycle through four states - it is the opposite of left turn.In hazard mode, only two states are required - all lights ON and all lights OFF.
9 State diagram Figure 7-62 shows the state diagram for the machine. A common IDLE state is defined in which all of the lights are off.When a left turn is requested, the machine goes through three states in which 1, 2, and 3 of the lefthand lights are on, and then back to IDLE.Right turn works similarly.In the hazard mode, the machine cycles between the IDLE state and LR3 state in which all six lights are on.
13 Ambiguous state diagram There is one big problem with the state diagram of Figure it does not properly handle multiple inputs asserted simultaneously.For example, what happens in the IDLE state if both LEFT and HAZ are asserted?According to the state diagram, the machine goes to two states, LI and LR3, which is impossible.The problem is fixed in figure 7-63, where we have given the HAZ input priority.LEFT.HAZ’.RIGHTHAZ + LEFT.RIGHTAlso we have treated LEFT and RIGHT asserted simultaneously as a hazard request, since the driver is clearly confused and needs help.
15 State-Machine is unambiguous The new state diagram is unambiguous because the transition expressions on the arcs leaving each state are mutually exclusive and all-inclusive.That is, for each state, no two expressions are 1 for the same input combination, andsome expression is 1 for every input combination.
16 Tweaking the state diagram Once a left or right turn cycle begun, the state diagram in figure 7-63 allows the cycle to run to completion, even if HAZ is asserted.It would be safer for the car’s occupants to have the machine go into hazard mode as soon as possible.The state diagram is modified to provide this behaviour in figure 7-64.
17 Enhanced state diagram for T-bird tail lights Inputs:LEFT, RIGHT, HAZOutputs:Six lamps(function of state only
18 Finally ready to synthesize a circuit for the T-bird machine. The state diagram has eight states, so we will need a minimum of three flip-flops to code the states.Obviously, many state assignments are possible, we will use the one in table 7-16 for the following reasons:1. An initial (idle) state of 000 is compatible with most flip-flops and registers, which are easily initialized to the 0 state.2. Two state variables, Q1 and Q0, are used to “count” in gray-code sequence for the left-turn cycle (IDLE L1 L2 L3 IDLE ). This minimizes the number of state-variable changes per state transition, which can often simplify the excitation logic.3. Because of the symmetry in the state diagram, the same sequence on Q1 and Q0 is used to “count” during a right-turn cycle, while Q2 is used to distinguish between left and right.4. The remaining state-variable combination is used for the LR3 state.
20 Transition list The next step is to write a sort of transition table. Because the transitions in a state diagram are specified by expressions rather than by an exhaustive tabulation of next states. We will call the new format a transition list, because it has one row for each transition or arc in the state diagram.Both the named and coded versions of the current state and next state are shown.The named states are useful for reference purpose, while the coded states are used to develop transition equations.Once we have a transition list, the rest of the synthesis steps are pretty much “turning the crank”.
22 Transition equationsThe first step in synthesizing a state machine from a transition list is to develop a set of transition equations that define each next-state variable V* in terms of the current state and input.A row’s transition product-term is the product of the current state’s minterm and the transition expression.Q2* = Q2’ . Q1’ . Q0 . (HAZ + RIGHT)+ Q2’ . Q0 . (HAZ)+ Q2 . Q0Q1* = Q0 . HAZ’Q0* = Q2’ . Q1’ . HAZ’ . (LEFT RIGHT) + Q1’ . Q0 . HAZ’
23 Excitation equationsIf we use D flip-flops as the memory elements in our state machine then the excitation equations are easy to derive from the transition equations.Since the characteristic equation of a D flip-flop is Q* = D,the excitation equation for the corresponding D flip-flop will be the same as transition equations.if Qi* = ExpressionD = ExpressionD2 = Q2’ . Q1’ . Q0 . (HAZ + RIGHT)+ Q2’ . Q0 . (HAZ)+ Q2 . Q0D1 = Q0 . HAZ’D0 = Q2’ . Q1’ . HAZ’ . (LEFT RIGHT) + Q1’ . Q0 . HAZ’