Overview

A simple game of 'craps', in which a player "rolls" a pair of dice. The number on each dice is summed together, which determines if the player has won or lost.

Controls

Left Button - Hold, and then release to "shake and roll" dice.
Right Button - Press to reset.

Game Rules

The player starts the game by rolling the dice.

  • If the sum of the dice is either 7 or 11, the player wins.
  • Otherwise, the sum is stored in the point register, and the player proceeds to the next stage.

The player then rolls again.

  • If the sum of the dice is 7, the player loses.
  • If the sum is equal to the value stored in the point register, then the player wins.
  • Otherwise, this stage is repeated until the player wins or loses.

Once the player wins or loses, the game ends, and the dice can no longer be rolled. The player can start a new game by pressing the 'reset' button.

Display

The value of dice 1 is shown on the 3rd digit, and dice 2 on the 4th digit.

Dice

The system controls on hold the values for a pair of dice. When the user holds the roll button, the values of the two dice are cycled through the numbers 1-6, so that when the user releases the button, a seemingly random value is produced. As the dice cycle through numbers, they appear as 8, as the human eye cannot perceive the individual numbers due to the speed with which they change.

Control SSM

The system is controlled by a single state machine, as shown in the moore model above. The control system decides which state to move to based on inputs:
Rb = 1 if the roll button is being pressed.
reset = 1 if the reset button is being pressed.
D2312 = 1 if the sum of the dice is 2, 3, or 12.
D7 = 1 if the sum of the dice is 7.
D711 = 1 if the sum of the dice is 7 or 11.
EQ = 1 if the sum of the dice is equal to the value stored in the point register.

Grading

This project was part of the 'Intermediate Digital Design' module of my degree programme, and received a grade of 95%.

Built With

  • basys-3
  • fpga
  • vhdl
  • xilinx-vivado
Share this project:

Updates