Docsity

Soda Machine Design: Datapath and Controller Implementation - Prof. Susan Lysecky, Assignments of Electrical and Electronics Engineering

Toggle sidebar
bg1
ECE 474a/574a
Programming Assignment 2 (40 points)
Due February 18, 2006 (Monday) at 8:00 pm
Deliverables
• Datapath – behavioral implementation of various datapath components, structural implementation of the datapath itself
• Controller – behavioral implementation describing the internal states, transitions, and the corresponding state actions to control
the corresponding datapath
• Circuit Soda_Machine – structural implementation of the interconnection between the datapath and controller
• Testbench - a robust testbench to verify the proper functionality of the Soda_Machine circuit
Turnin
• Submit your project using electronic turnin, class_account_name is “ece474a”, assignment_name is “assign2”
Project Description
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:
• quarter – bit input, indicates the user has inserted 25 cents into the soda machine
• dime – bit input, indicates the user has inserted 10 cents into the soda machine
• nickel – bit input, indicates the user has inserted 5 cents into the soda machine
• soda_release –bit output, when enabled (set to 1) releases a soda.
• change – 8-bit output, indicates the amount of change to return
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
…
pf2

Partial preview of the text

Download Soda Machine Design: Datapath and Controller Implementation - Prof. Susan Lysecky and more Assignments Electrical and Electronics Engineering in PDF only on Docsity!

ECE 474a/574a

Programming Assignment 2 (40 points)

Due February 18, 2006 (Monday) at 8:00 pm

Deliverables

  • Datapath – behavioral implementation of various datapath components, structural implementation of the datapath itself
  • Controller – behavioral implementation describing the internal states, transitions, and the corresponding state actions to control the corresponding datapath
  • Circuit Soda_Machine – structural implementation of the interconnection between the datapath and controller
  • Testbench - a robust testbench to verify the proper functionality of the Soda_Machine circuit

Turnin

  • Submit your project using electronic turnin, class_account_name is “ece474a”, assignment_name is “assign2”

Project Description

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:

  • quarter – bit input, indicates the user has inserted 25 cents into the soda machine
  • dime – bit input, indicates the user has inserted 10 cents into the soda machine
  • nickel – bit input, indicates the user has inserted 5 cents into the soda machine
  • soda_release –bit output, when enabled (set to 1) releases a soda.
  • change – 8-bit output, indicates the amount of change to return

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

ECE 574 A ONLY

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.

module Soda_Machine(rst, clk, quarter, dime, nickel, soda, water, soda_release,

change, n_enough);

input rst, clk, quarter, dime, nickel, soda, water;

output reg soda_release, n_enough;

output reg [7:0] change;

Soda_Machine

soda_release

nickel

quarter dime

rst clk

soda water

change 8 n_enough