next state |
|
input |
|
|
state |
n |
d |
q |
v |
a |
b |
c |
h |
a |
b |
c |
f |
h |
b |
c |
f |
g |
h |
c |
f |
g |
h |
h |
f |
g |
h |
h |
h |
g |
h |
can't occur |
can't occur |
can't occur |
a |
The initial state is a. State a corresponds to having no money input, state b to 5 cents input, c to 10 cents, f to 15 cents, g to 20 cents, and h to 25 cents. All states are accepting states (will admit coins) except h.
For a one-hot state assignment, there is one flip-flop per state. We'll use the state names to designate the flip-flop names. Then the logic equations for the flip-flops are, by inspection of the table:
a = hv + av
b = an + bv
c = bn + ad + cv
f = cn + bd+ fv
g = an + cd + gv
h = gn + d(f + g) + q
The idea is that each flip-flop's next-state function is a disjunction of the combinations of state and input which lead to that state.