Successfully reported this slideshow.

Analysis of state machines & Conversion of models

1,405 views

Published on

Lec4

Published in: Education
  • Be the first to comment

Analysis of state machines & Conversion of models

  1. 1. Analysis: Example 2 - New State Machine • This is now a Moore machine – output MAXS depends only on state (Q0 and Q1) MAXS MAXS = Q0 ⋅ Q1 1
  2. 2. Analysis: Example 2 - New Table/Diagram • Updated State/Output Table & Diagram – Moore machine state diagram output associated with state, not transition 2
  3. 3. Analysis: Example 2 - Timing Diagram• Timing Diagram for State Machine – Compare outputs MAX and MAXS for the Mealy and Moore machine implementations 3
  4. 4. Conversion of Models • Mealy to Moore machine – If all the transitions in a Mealy model to a particular state are associated with the same output then in the corresponding Moore model that output becomes the state output.T1 T1 1/0 1T2 1/0 1/0 T2 1 A 1 B A B 0 0 0/1 0 0/0 0T3 T4 T3 T4 Mealy Moore
  5. 5. Conversion of Models• Mealy to Moore machine – If the outputs of all the transitions in a Mealy model to a particular state are not the same, then in the corresponding Moore model we need to insert intermediate statesT1 T1 T4 1/0 1 0T2 0/0 1/0 T2 0 A0 B 1 A B 0 0 0/1 1/1T3 T4 A1 1 T3 1 Mealy 1 0 Moore T4
  6. 6. Conversion of Models• Moore to Mealy machine – If the state transition from two different states of the same input leads to common state then one state can be eliminatedT1 T1 1 1/0T2 0 A0 B T2 0/0 1/0 1 A B 0 0 1/1 1 A1 1 T3T3 1 Moore Mealy
  7. 7. Conversion of Models• Moore to Mealy machine – If the state transition from two different states of the same input does not lead to the same state, then state output becomes the output corresponding to each input transition of that stateT1 T1 1 1/0T2 A B T2 0/0 0/0 0 0 A B 0 0 1 1 1/0 1/1 C T3T3 C Moore 1 Mealy
  8. 8. Analysis: Example 3 - State MachineX Y Q0 Q1 J0 = X·Y K0 = X·Y + Y·Q1 Q0 Q1 J0 Q0 J Q K0 K Q J1 = X·Q0 + Y J1 Q1 J Q K1 K Q Z Clk K1 = Y·Q0 + X·Y·Q0 Z = X·Q0·Q1 + Q0·Q1·Y
  9. 9. 1. Determine the excitation equations for the flip flop inputs J 0 = X ⋅Y ′ J 1 = X ⋅ Q0 + Y K 0 = X ⋅ Y ′ + Y ⋅ Q1 K1 = Y ⋅ Q0′ + X ⋅ Y ′ ⋅ Q0 2. Substitute the excitation equations into the flip flop characteristic equations to obtain transition equations. Q0* = J 0 ⋅ Q0′ + K 0′Q 0 characteristic equations Q1* = J 1 ⋅ Q1′ + K1′Q1 ′Q 0* = ( X ⋅ Y ′) ⋅ Q0′ + ( X ⋅ Y ′ + Y ⋅ Q1) Q 0 transition equations ′Q1* = ( X ⋅ Q0 + Y ) ⋅ Q1′ + ( Y ⋅ Q0′ + X ⋅ Y ′ ⋅ Q 0 ) Q1
  10. 10. Simplifying the transition equations Q0* = ( X ⋅ Y ′) ⋅ Q0′ + ( X ⋅ Y ′ + Y ⋅ Q1) ′ Q 0 Q 0* = ( X ⋅ Y ) ⋅ Q0 + ( ( X ⋅ Y ) + ( Y ⋅ Q1) ) ⋅ Q0 ( ) Q0* = X ⋅ Y ⋅ Q 0 + ( X ⋅ Y ) ⋅ ( Y ⋅ Q1) ⋅ Q0 ( )( Q0* = X ⋅ Y ⋅ Q0 + X + Y ⋅ Y + Q1 ⋅ Q0 )) Q0* = X ⋅ Y ⋅ Q0 + ( ( X + Y ) ⋅ (Y + Q1) ) ⋅ Q0 Q0* = X ⋅ Y ⋅ Q0 + ( X ⋅ Y + X ⋅ Q1 + Y ⋅ Y + Y ⋅ Q1) ⋅ Q0 Q 0* = X ⋅ Y ′ ⋅ Q 0′ + X ′ ⋅ Y ′ ⋅ Q0 + X ′ ⋅ Q0 ⋅ Q1′ + Y ⋅ Q0 ⋅ Q1′
  11. 11. Simplifying the transition equations Q1* = ( X ⋅ Q0 + Y ) ⋅ Q1′ + ( Y ⋅ Q0′ + X ⋅ Y ′ ⋅ Q 0 ) ′ Q1 (( ) ( Q1* = ( X ⋅ Q0 + Y ) ⋅ Q1 + Y ⋅ Q0 + X ⋅ Y ⋅ Q0 ⋅ Q1 )) Q1* = X ⋅ Q0 ⋅ Q1 + Y ⋅ Q1 + ( Y ⋅ Q0 ) ⋅ ( X ⋅ Y ⋅ Q0 ) ) ⋅ Q1 ( )( Q1* = X ⋅ Q0 ⋅ Q1 + Y ⋅ Q1 + Y + Q0 ⋅ X + Y + Q0 ⋅ Q1 ) (( )( Q1* = X ⋅ Q0 ⋅ Q1 + Y ⋅ Q1 + Y + Q0 ⋅ X + Y + Q0 ⋅ Q1 )) ( Q1* = XQ0Q1 + Y Q1 + X Y + Y Y + Y Q0 + X Q 0 + YQ0 + Q0Q0 ⋅ Q1 ) Q1* = X ⋅ Q0 ⋅ Q1′ + Y ⋅ Q1′ + X ′ ⋅ Y ′ ⋅ Q1 + Y ′ ⋅ Q 0′ ⋅ Q1 + X ′ ⋅ Q0 ⋅ Q1 + Y ⋅ Q0 ⋅ Q13. Determine the output equations. Z = X ⋅ Q0 ⋅ Q1 + Y ⋅ Q0′ ⋅ Q1′ output equation
  12. 12. 4. Use transition equations and output equations to construct transition/output table. Transition/output table State Input XY Q1Q0 00 01 10 11 00 00,0 10,1 01,0 10,1 01 01,0 11,0 10,0 11,0 10 10,0 00,0 11,0 00,0 11 11,0 10,0 00,1 10,1 Next State Q1*Q0*, Z
  13. 13. 6. Name the states and substitute state names for state – variable combinations in the transition/output table to obtain the state/output table. State/output tableSubstituting thestate names as ‘A’ State Input XYfor Q1Q0 = 00,‘B’ for Q1Q0 = 01, S 00 01 10 11‘C’ for Q1Q0 = 10,‘D’ for Q1Q0 = 11. A A,0 C,1 B,0 C,1S is current state& S* is next state. B B,0 D,0 C,0 D,0 C C,0 A,0 D,0 A,0 D D,0 C,0 A,1 C,1 Next State S*, Z
  14. 14. State diagram 10/000/0 A B 00/0 01,11/1 01,11/0 10/1 10/0 01,11/0 11/100/0 D C 00/0 01/0 10/0
  15. 15. Synchronous Design Process1. Construct a state diagram and/or state/output table corresponding to the word description or specification2. Minimize the number of states3. Choose a set of state variables and assign state variable combinations to the named states4. Obtain the transition/output table5. Determine the number of flip-flops and select the type of flip-flop to be used (D is often the default)6. Construct the excitation table7. Derive excitation equations8. Derive output equations 15
  16. 16. Design a clocked synchronous state machinewhich accepts two serial strings of digits ofarbitrary length, starting with LSB andproduces the sum and carry of the two bitstreams as its output. The input bit streamscould come from two shift registers clockedsimultaneously .Assuming Mealy machine designLet the inputs be X and YLet the outputs be S and C
  17. 17. Obtaining the state Diagram Assume initial condition to be SC = 00 Let the state be represented by state A If XY = 00, then output SC = 00, Same state A = 01, then output SC = 10, goes to state BXY/SC = 10, then output SC = 10, goes to state B 01,10/10 00/00 A B = 11, then output SC = 01, goes to state C 11/01 C
  18. 18. Obtaining the state Diagram Assume machine has moved to state B If XY = 00, then output SC = 00, goes to state A = 01, then output SC = 10, same state B = 10, then output SC = 10, same stateXY/SC B 01,10/10 = 11, then output SC = 01, goes to 00/00 A B 01,10/10 state C 00/00 11/01 11/01 C
  19. 19. Obtaining the state Diagram Assume machine has moved to state C If XY = 00, then output SC = 10, goes to state B = 01, then output SC = 01, same state C = 10, then output SC = 01, same stateXY/SC C 01,10/10 = 11, then output SC = 11, goes to 00/00 A B 01,10/10 state D 00/00 11/01 11/01 00/10 11/1101,10/01 C D
  20. 20. Obtaining the state Diagram Assume machine has moved to state D If XY = 00, then output SC = 10, goes to state B = 01, then output SC = 01, goes to state CXY/SC = 10, then output SC = 01, goes to 01,10/10 state C 01,10/10 00/00 A B 00/00 = 11, then output SC = 11, same state D 11/01 11/01 00/10 00/10 11/11 11/1101,10/01 C D 01,10/01
  21. 21. Obtaining the state/output table State/output table State Input XY S 00 01 10 11 A A,00 B,10 B,10 C,01 B A,00 B,10 B,10 C,01 C B,10 C,01 C,01 D,11 D B,10 C,01 C,01 D,11 Next State S*, SC
  22. 22. Equivalent StatesTwo states are equivalent if it is impossible todistinguish them by observing only the currentand future outputs of the machine .A pair of equivalent states can be replaced by asingle state.Two states S1 and S2 are equivalent if twoconditions are true.1. S1 and S2 must produce the same values atthe state machine output(s) for all inputcombinations.2. For each input combination S1 and S2 must
  23. 23. State MinimizationEquivalen State/output tablet states State Input XY S 00 01 10 11 A A,00 B,10 B,10 C,01 B A,00 B,10 B,10 C,01 C B,10 C,01 C,01 D,11 D B,10 C,01 C,01 D,11 Next State S*, SCEquivalent states
  24. 24. Minimized state/output table & state diagram State/output table State Input XY S 00 01 10 11 A A,00 A,10 A,10 D,01 D A,10 D,01 D,01 D,11 Next State S*, SC00/00 01/01 11/0101/10 10/01 A D10/10 11/11 00/10 State diagram
  25. 25. Assigning state variable to obtaintransition/output table Transition/output table State Input XY Q 00 01 10 11 0 0,00 0,10 0,10 1,01 1 0,10 1,01 1,01 1,11 Next State Q*, SCEncoding A = 0 and D = 1Choosing D type flip flop
  26. 26. Constructing the excitation table Excitation/output table State Input XY Q 00 01 10 11 0 0,00 0,10 0,10 1,01 1 0,10 1,01 1,01 1,11 D, SC
  27. 27. Transferring onto K-maps to derive excitation &output equations Excitation/output table State Input XY Q 00 01 10 11 0 0,00 0,10 0,10 1,01 1 0,10 1,01 1,01 1,11 State Input XY D, SC Q 00 01 11 10 D = X· Y + X · Q +Y · Q 0 0 0 1 0 C = X· Y + X · Q +Y · Q 1 0 1 1 1
  28. 28. Transferring onto K-maps to derive excitation &output equations Excitation/output table State Input XY Q 00 01 10 11 0 0,00 0,10 0,10 1,01 1 0,10 1,01 1,01 1,11 State Input XY D, SC Q 00 01 11 10 S = X ⋅Y ⋅ Q + X ⋅Y ⋅ Q 0 0 1 0 1 + X ⋅Y ⋅ Q + X ⋅Y ⋅ Q 1 1 0 1 0 S = X ⊕Y ⊕Q
  29. 29. Circuit (logic) diagramD = X· Y + X · Q +Y · Q excitation equation S = X ⊕ Y ⊕ Q C = X· Y + X · Q +Y · Qoutput equations X Y Q C S D Q Q Clk

×