Reflex Game

A Student Application Note by Marc Dowdell, Amir Faiz, Mark Mielke, Kreshka Niehaus & Travis Robinson : the AVC group.

The following application note is a reflex game written in vhdl. The FPGA which we used to test the program was the Altera Flex10K20RC240-4 which is provided on the UP1 boards.

The Game | Code | Inputs/Outputs | Improvements

 

The Game:

The reflex game faces two opponents against each other in a test of their reflexes. A reset button resets the game for the next round. Once reset is pressed the start light comes on in 5 seconds. The first person who presses their button wins. Either the player1 light turns on or the player2 light turns on, depending who wins. Then press reset and the next game begins.

Code:

There are two .vhd files that are used in this program. They are player_button.vhd and reflex_game.vhd.

The player_button.vhd file controls one players button. If the start light is on and nobody has won yet, then when the button is pressed this player wins.

The reflex_game.vhd file controls the operation of both player buttons, as well as the external LEDs.

Inputs/Outputs:

The following is a list of the inputs and outputs, with the pins used on the FLEX10K20RC240-4 chip.

Name

I/O

Active High or Low

Pin

Clock

Input

Clock

 91

Player1_button

Input

Low

 45

Player2_button

Input

Low

 29

Reset

Input

Low

 28

Start_LED

Output

Low

 6

Player1won_LED

Output

Low

 9

Player2won_LED

Output

Low

 20

Done (LED)

Output

Low

 17

The clock used was the one provided on the UP1 board at a speed of 25.175 MHz. We counted to 125875000 for the start light to come on in 5 seconds. The LEDs that we used were on the two seven segment displays. Start is the top left LED. Done is the top right LED. Player1won is the bottom left LED. Player2won is the bottom right LED. Player1_button and Player2_button are push buttons PB1 and PB2 respectively. The third pushbutton (Reset) had to be connected to an input/output pin and hard wired to one of the other pushbuttons on the board Max_PB1 or Max_PB2.

Improvements:

The following is a list of improvements that can be added to make the reflex game more fun and exciting (other than betting on the opponents).

Adding a score keeping mechanism:

By changing the LEDs from the seven segment display to other LEDs on the board, you could use the display to keep track of the score of the two opponents.

Changing the start time:

By adding a random number generator, you could change the start time for every game. Be sure to keep the limits reasonable of course.

Add more players to the game:

There is still one unused pushbutton on the board, you could use it to add a third person to the game and go head to head to head. If you bring in external pushbuttons even more people could play ( but still, no gambling please).

Add sound to the game:

Everybody loves for everyone else to know when they won. Add a speaker and sounds when each player wins. It's starting to sound like a Jeopardy buzzer.

Top of Page | Player_button.vhd | Reflex_game.vhd

 

A Student Application Note by Marc Dowdell, Amir Faiz, Mark Mielke, Kreshka Niehaus & Travis Robinson : the AVC group