Hardware Reference
In-Depth Information
Figure 5.10
Controller for a vending machine that sells candy bars for $0.40, accepting nickels, dimes, and
quarters. (a) Circuit ports. (b) Corresponding Moore machine (state-bypass prevention not
included).
candy_out = '1' command from the candy-delivering mechanism coni rming that a
candy bar was dispensed or a reset pulse.
Note that the machine of i gure 5.10b is subject to state bypass (section 4.2.4) if
the inputs last longer than one clock period (which is generally the case in this kind
of application), so wait states (or a l ag or one-shot conversion) must be added (exercise
5.11).
Because glitches are dei nitely not acceptable in this application, the optional
output register should be used here. In regard to the inputs, we can assume that
they are produced by other circuits that process the actual inputs and hence
operate with the same clock as our state machine, dispensing with the use of debounc-
ers and/or synchronizers (although they might be needed at the inputs of preceding
circuits).
If we assume that all control inputs to this machine last exactly one clock period
(due to one-shot circuits, for example), so state bypass cannot occur and additional
states are not needed, the number of DFFs required to build it (with M FSM = 13 states)
is N FSM = 4 if sequential or Gray encoding is used, 7 for Johnson, or 13 for one-hot,
plus N output = 3 for the output register.
5.4.7 Datapath Control for an Accumulator
Before we examine this example, a review of section 3.13 is suggested.
In this example we assume that the datapath of i gure 3.22a must operate as an
add-and-accumulate circuit (ACC), accumulating in register A four consecutive values
Search WWH ::




Custom Search