006_drink_machine : Verilog Drink Machine Schematic Simulation
Minimum Required Versions: Gateway 2.12.10.R, SILOS 4.10.90.R
The sixth digital example is a drink machine. This example contains structural and RTL/behavioral forms of Verilog. In this example, specify blocks are added to the netlist modules using the code symbol located in the basiclib library. The code symbol allows you to write freeform code and statements to be used in the netlist. It can be positioned to the correct location in the netlist by using the up and down arrows in the design browser, or by choosing whether to be placed above or below the module definition via the pulldown menus. The
drink machine schematic is shown in
In the example, there are three kinds of drinks that the machine will vend: coke, pepsi, and a screwdriver. The 2-bit vector coin[1:0] represents the monetary input to the drink machine. When the value of the signal is 1, a nickel is represented. A 2 represents a dime, and a value of 3 represents a quarter. Each drink costs 25 cents. When any of the vendcoke, vendpepsi, or vendscrewdriver signals goes high, the machine then expects the input of change. When a 25 cent combination is reached for the coin signal, the drink is vended and the coin is reset.
The output waveforms (
) show the three drink inputs, the input of the coins over time, and how each drink is vended from the machine.