Lab 3 Finite State Machines Movie Ticket Dispensing Machine Design, implement, verify, and test a Movie Ticket Dispensing Machine based on the following specification: The machine should allow the choice between the following movie options: F1r (Film 1, regular) F1d (Film 1, 3D) F2r (Film 2, regular) F3d (Film 3, 3D). The number of tickets requested can be any number between 1 and 9. Every regular movie ticket costs $12, whereas every 3D movie ticket costs $18. Film 1 is available in both versions. If the user decides to buy more than one ticket, the second ticket will receive a 25% discount. Third ticket onwards, all tickets will be 50% off the original price. The Movie Ticket Dispensing Machine accepts the following bills: $1, $5, $10, and $20. The total value of all entered bills cannot exceed $99. The machine is capable of Accepting user choices Calculating the total price Dispensing tickets Returning change. The exact way of performing these tasks using the Digilent Nexys 3 board is described below: Step 1: Choosing a movie The machine displays the first option F1r (Film 1, regular) The user makes selection using the buttons Up (BTNU) and Down (BTND) of the FPGA board, by scrolling through the wrap-around list of all available ticket options F1r F1d F2r F3d
Each time the user is pressing Button Up or Button Down the code of an appropriate movie is displayed on the three leftmost seven-segment displays. The rightmost seven-segment display is left blank. The final selection is confirmed using the center button called Enter (BTNS). After making the selection, LED0 is switched on, and the default number of tickets, 1, is displayed on the right-most seven-segment display. Step 2: Choosing the ticket quantity The machine displays a default number of tickets "1" on the right-most seven segment display. By using buttons Up (BTNU) and Down (BTND), the user can choose the number of tickets between 1 and 9. An attempt to reduce the number of tickets below 1 or increase it above 9 should not be allowed, and the number of tickets on the seven-segment display should remain the same. The movie selection should remain to be displayed based on step 1, and thus, the total information appearing on the display may look for example as follows: F1d3. The final selection is confirmed using the button Enter (BTNS). After making the selection, LED1 is switched on (with LED0 remaining in the on state), and the total price of all tickets, taking all discounts into account, is displayed using all four seven segment displays. For example, this price may look as follows: 40.50 Step 3: Entering Bills The Movie Ticket Dispensing Machine should accept the following dollar amounts: 1 Dollar - Button BTNU 5 Dollar - Button BTND 10 Dollar - Button BTNL 20 Dollar - Button BTNR. After each bill is entered the total value of all bills entered so far is displayed. For example, the amount entered so far may be equal to: 45.00. The total is not allowed to exceed $99 (i.e., any subsequent entry is ignored). The final selection is confirmed using the button Enter (BTNS).
If the total amount entered is smaller than the total price of all tickets, the total amount entered should be displayed blinking for 3 seconds, and the machine should return to the Entering bill mode. If the total amount entered is greater or equal than the total price of all tickets: the tickets should be dispensed by showing a final movie selection, e.g., F1d3 blinking for 5 seconds the amount of change should be displayed afterwards, e.g., 04.50 LED2 should be switched on (with LED0 and LED1 remaining in the on state). Additional requirements and hints: Reset Condition: Switch 0 should be used as an asynchronous reset active high. Hint: Extend your BCD_AS circuit designed as a part of Lab Assignment 2 Task 1 to a 4-digit BCD_AS. Use this adder to calculate the total price of the tickets total value of all bills entered change to be returned to the user. Bonus Task 1: Add an additional capability of using the machine as a clock, in parallel with its regular operation. Switch 1 should be used to switch between the regular operation (SW1=OFF) and the clock display mode (SW1=ON). The clock should display the current time in the military (24-hour) mode, e.g., 13.30 represents 1:30pm. After reset, the clock should be set to 00.00 representing midnight. In order to enter the current time: Switch 2 should be set to ON, and then buttons Up and Down should be used to set an hour part of the current time in the range 00..23 buttons Left and Right should be used to set a minute part of the current time in the range 00..59. After the Switch 2 is set to OFF, the clock operates normally in the background, independently of the state of Switch 1. If the current time is between 00:00 and 16:00 a 20% discount should be applied to all prices, on top of the regular discount dependent on the number of tickets purchased. Bonus Task 2: Add sound effects to the Movie Ticket Dispensing Machine, e.g., by using an external buzzer.
Steps to accomplish required and bonus tasks: 1. Draw one or more Algorithmic State Machine (ASM) charts implementing the required functionality. Please note that multiple state machines, working in parallel, can be used to achieve the required behavior. 2. Translate the ASM charts to VHDL. 3. Develop a testbench with two versions of timing constants, one used for simulation, and the other used for the actual operation of the circuit on the board. 4. Perform functional simulation of your code. 5. Synthesize your code using Xilinx XST. 6. Prepare the correct UCF (User Constraints File) file. 7. Implement your circuit using Xilinx ISE. 8. Check thoroughly all implementation reports. Pay attention to timing, resource usage, and pin allocations. 9. Perform post-synthesis and timing simulations of your circuit using Aldec Active-HDL or ISim. 10. Perform static timing analysis. 11. Check very carefully your pin allocations listed in the report files, and only if these pin allocations are correct, download your bitstream to the FPGA board. 12. Test the operation of your circuit experimentally using the Nexys 3 FPGA Board. Deliverables 1. All ASM charts. 2. All source files used for synthesis and implementation of your circuit. 3. Testbench. 4. User constraint files. 5. All synthesis and implementation report files. 6. RTL netlist. 7. Simulation waveforms from the functional, post-synthesis, and timing simulations, proving the correct operation of your circuit, and demonstrating the delay of its critical path in the PDF format. 8. Report file from the static timing analysis. 9. Your own report containing at least the following additional information: Resource utilization. Minimum clock period and maximum clock frequency after synthesis and after implementation. List of any deviations from the original specification. Difficulties encountered and lessons learned.
Important Dates Hands-on Sessions and Introductions to the Experiment Demonstration and Deliverables Due Monday 02/10/2014, 02/17/2014 Wednesday 02/17/2014, 02/19/2014 Thursday 02/17/2014, 02/20/2014, 02/24/2014 03/03/2014 03/03/2014