Loading simulator…
Gray encoding is preferred when state bits cross clock domains, drive asynchronous decode logic, or physically switch at slightly different times.
Since only one state bit changes between adjacent Gray-coded states, the probability of transient multi-bit decode glitches can be reduced.
It can also reduce simultaneous switching activity.
Gray encoding does not remove the need for proper synchronization or hazard-aware logic.
The excitation table is:
Q2Q1Q0 | X | Q2+Q1+Q0+ | D2D1D0 |
|---|---|---|---|
000 | 0 | 001 | 001 |
000 | 1 | 010 | 010 |
001 | 0 | 011 | 011 |
001 | 1 | 000 | 000 |
011 | 0 | 010 | 010 |
011 | 1 | 001 | 001 |
010 | 0 | 000 | 000 |
010 | 1 | 110 | 110 |
110 | 0 | 010 | 010 |
110 | 1 | 100 | 100 |
100 | 0 | 110 | 110 |
100 | 1 | 000 | 000 |
101 | 0, 1 | Don't Care | XXX |
111 | 0, 1 | Don't Care | XXX |
The state codes 101 and 111 are unused by the FSM.
Invalid States are treated as don't-care conditions during logic minimization.
After Boolean minimization, the D-input equations are:
D2 = Q1·Q0'·X + Q2·Q1'·X'
D1 = Q0·X' + Q2·X' + Q2'·Q0'·X
D0 = Q1·Q0·X + Q1'·Q2'·X'
Therefore, the combinational logic connected to the three D flip-flop inputs is:
D2 = Q1·Q0'·X + Q2·Q1'·X'
D1 = Q0·X' + Q2·X' + Q2'·Q0'·X
D0 = Q1·Q0·X + Q1'·Q2'·X'
These equations are valid for all legal FSM states.