HW 3: Light the Candles

Due March 12, 2024

For this assignment you are going to create a game played on the FPGA dev board. In this game the player’s goal is to light all the candles🕯️, which are represented by the LEDs 0 through 7 (🕯️🕯️🕯️🕯️🕯️🕯️🕯️🕯️) on the board just above the switches.

The game starts by the player pressing the RESET button (BTNR(M17)).

The match/ignitor 🔥 is placed initially at a position 0.

The human player may light the candles by moving the position of the match🔥 to a given🕯️. Repositioning of the match🔥 is triggered using the BTNC (N17) button ⚫ on the board. A player can ignite/reignite at the current position of the match🔥 by setting the switches to zero and pressing BTNC⚫. Any desired horizontal movement in match to another another position is provide by the four switches which indicate a value from 7 to -8, in binary two’s compliment.

Once a candle🕯️ is lit, the player keep the match🔥 in the same position (using delta=0) or to another location using the delta provide by the switches.

Here is the challenge: The candles🕯️ you light will continually be randomly extinguished by the extinguisher🧯 must be relit by the match🔥. More specifically: each time you push BTNC⚫, an extinguisher🧯 will randomly choose a position and also randomly decided whether to extinguish or not. Therefore, the player’s strategy is to make as few presses of BTNC⚫ as possible and choose. Secondly, note that there is no direct indicator of where the 🔥 is so the player must mentally keep track of the match position.

game diagram

Modules to Write and Test

Module 1: igniter🔥

Module 2: extinguisher🧯

Module 3: candle_controller🕯️

(note added May 21, 2024 based on earlier discussion: a consequence of this specification is that the value extinguised is based not based on the updated position since there is a register delay in the extinguisher. A combinational pathway through the extinguisher could avoid this, but it was not requested in this version of the HW)

Module 4: Top Module to implement the game

At this point you can assemble the game from the parts you’ve created, any required glue logic, and an appropriate contraints file. The results should be demonstrated on the FPGA board. I have provided a one-shot module that creates a one-cylce pulse every time the button is pressed and held to prevent multiple presses being registered due to bouncing (I don’t know if it is required on this board or not but I thought it would be safer to do this). You should include this in your design. You should provide this and all source code including the ucf used for your project. (I do not mandate a testbench to be submitted for this module, but I recommend you create one or more and simulate as much of your design as possible before testing on the board.)
debounce_and_oneshot.v

Special Note

When you implement your physical design, you may note that one of the switches is “trimmed” from the design. Give this some thought and investigate what it says about the arithmetic performed and the hardware synthesis process. Also consider how it relates to a players strategy in using the interface. You may include a discussion in your report if you like but I am not specifically asking for it.

Report

Create a report that briefly explains your completion for each part as well as the top module, and provide a description of the testing results. Your discussion should include a description of the tests performed and text or waveform outputs from stimulations. Provide pictures and text outputs directly in the report. If a text output is too long to include in a report, include the output as a file with your submission, then make reference to it and included only key output lines in the report itself. Also, make references to source files used where appropriate. Your report should be able to convince someone that your design works and your simulation-based testing is sufficient. Your final physical testing for the last module should be discussed as well.

Grading Guidelines (subject to small changes with announcement)

Correctness (40 pts) e.g.

Design (20 pts) e.g.

Test-bench and thoroughness of testing and reporting (15 pts) e.g.

Style (10 pts) e.g.

Documentation (15 pts) e.g

Late Policy:
One or Two day late: 20/100 points off

Modules to Write and Test