Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Homework 9 Coin Counter and Vending Machine The objective of this exercise is to build a vending machine. First we will build a coin counter.

Homework 9

Coin Counter and Vending Machine The objective of this exercise is to build a vending machine. First we will build a coin counter. On each input should be either 1 nickel, dime or quarter, (or none). Count up to 1 dollar from any combination of these coins. Output should be the accumulated value. When the value is $1 it should create an output Z = 1. If it is greater than 1 it should go to an overflow state with an output of Z=1. Otherwise Z should be 0. (see Lecture 12 Section 1)

You could assume that only a quarter, dime, or nickel can be input at a given time. This can be expressed as qdn. A 100 means that a quarter is input. A 010 means a dime is input. A 001 means a nickel is input. You can assume that the input 110 for instance cannot occur because of the mechanism. Each 1 only occurs at the instance the coin slides into the slot, which we will assume to be long enough to coincide with a positive clock pulse.

1) Provide State diagram for above (for this you will need to extend the state diagram in the lecture, finding ways to handle the range of possibilities) (see lecture 12 slide 8 for an example, except that you need to add output Z to the diagram). Go to $1.00 for this problem.

2) Now lets increase the maximum to $2.55. (Z now indicated overflow) Create a procedural code that performs this coin counter function. You can assume that between each coin where there is a coin there is an input indicating no coins. Assume that a positive clock edge will occur capturing each coin input. See the description input description below in problem 3 for further clarification.

Name the module vendcoin. If you need help take a look at lecture 12, slide 12 (the pdf version).I want to assume that a clock is used. This means the inputs occur during positive clock edges. Think about your assumptions and include them in a comment above the module statement in the code. So, your always statement is

always @ (posedge clk or posedge Reset)

3) Create a test bench, and run the test bench for this sequence Where these groups of 3 are q(quarter)d(dime)n(nickel) Note in the sequence below that 000 occurs between each coin inserted, and it indicates 0 quarters 0 dimes and 0 nickels inserted. 001 indicates 1 nickel was inserted. Note that 000 means nothing was inserted, and I assume this occurs between each coin inserted. Create positive clock edge to capture each of these coin inputs.

000 100 000 100 000 100 000 100 000 100 000 100 000 100 000 100 000 100 000 010 000 001 000 001 000

On each additional coin write to a comma separated variable file showing the coin input in that step and the total amount of money put in so far. For an example of this see Lecture 12 slide 24(pdf version), and lecture 11 slides 17-20.

Turn in state diagram above, Verilog code for coin counter module vendcoin, Verilog code for test bench, waveform images captured and converted to pdf, and a log file with a .csv extension containing the information described.

Each answer should be clearly marked as to which problem it goes with. The instructions to the graders is to disregard anything that is not. (note I merged this testbench with the one needed below, and handed that in as answer to both problems, and that is fine)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design For Mere Mortals

Authors: Michael J Hernandez

4th Edition

978-0136788041

More Books

Students also viewed these Databases questions

Question

Draw a picture consisting parts of monocot leaf

Answered: 1 week ago

Question

List the five steps in the decision-making model.

Answered: 1 week ago