

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Implement a soda dispenser. The cost of the soda is 75 cents. Your machine will accept quarters, dimes, and nickels. As the user feeds coins into the machine you will need to keep track of how much money was inserted. Once you have collected at least 75 cents, you will release a single soda. You will also need to output how much change the machine should return. You do not need to compute the number of quarter, dimes, and nickels to return, rather just an 8-bit value indicating the correct change (i.e. if the user inserts 80 cents, change = 5). Once the soda has been dispensed, your circuit will start over and wait for additional coins.
The system interface is as follows:
The design of Soda_Machine should be divided into 2 parts - a controller and a datapath. The controller is an FSM which issues commands to the datapath based on the current state and the external inputs. This should be a behavioral description. The datapath contains a netlist of functional units like multiplexors, registers, adders, and comparators, and hence this design is structural. However, the individual components that make up the datapath can be described behaviorally.
Please make sure to declare your top-level module as shown in the example below to help the grader test your module.
module Soda_Machine(rst, clk, quarter, dime, nickel, soda_release, change);
input rst, clk, quarter, dime, nickel; output reg soda_release; output reg[7:0] change;
Soda_Machine
soda_release
change
nickel
quarter dime
rst clk
8
Extend your implementation to provide the user with a two choices, soda or water. The soda costs 75 cents, while the water costs one dollar. The user will insert coins then press the button corresponding to the desired drink. If the user selects a soda, input soda will be high. If the user selects water , input water will be high. If the user presses both buttons, soda has the priority. If enough money was inserted for the desired drink then you will release a single drink (to simplify the problem we assume that we simply set soda_release high and the appropriate drink will be released). If the user has not put enough money in for the desired drink set n_enough high to indicate insufficient funds.
Please make sure to declare your top-level module as shown in the example below to help the grader test your module.
Soda_Machine
soda_release
nickel
quarter dime
rst clk
soda water
change 8 n_enough