This was a fun project I did with my colleague Richard Osborn. Our goal was to allow people to practice applying basic strategy to blackjack without having to spend money at the casino or procure a deck of cards.
Block Diagrams are very helpful when designing multi-level modules. Flow Charts are also helpful for visualizing the proper sequence of an FSM (Finite State Machine).
Block Diagram
Blackjack Flow Chart
Being limited to 7-Segment output displays, there needed to be a way to identify alphanumerical characters.
Confusion-free 7-Segment-Alphabet
Assign controls for the user to operate the game.
DE2-115 FPGA Controls
Testing 7-Seg displays with testcases.
7-Segment "WIN"
7-Segment "LOSE"
7-Segment "TIE"
Utilizing a testbench, we can check if the FSM, Dealer AI, and all signals are properly working. This is a simulation of a single game of blackjack.
Dealer has 20 (0x14)
Player draws 4 cards: 4, 3, A, 10, which is 28 (0x1C)
The player busts, so playerBusted signal goes high.
Master Testbench (ModelSim)
Add some flash, make it spicy.
"TIE" State Loop
Voilà.
Demonstration given by Richard Osborn
This project is an extension of the base blackjack project. I used the original datapath as all of the blackjack logic is fully functional. Instead of using the 7-Segment displays, I now utilized the VGA port on the DE2-115 FPGA board.
I disconnected all the 7-Seg modules and interfaced the wrapper module with VGA signals.
Restructured Block Diagram
The first step in implementing this is to instantiate the existing blackjack datapath in a working VGA wrapper. And also be enthusiastic when it finally works.
Character ROM in each column
Adding a "New Game" function so the player can play multiple hands without having to hard reset everything.
New DE2-115 FPGA Controls
With a new output display means new output format. I display the game counter in top left, and the current game state in the top right. Then the dealers hand and the players hand are seen below.
VGA "WIN"
VGA "LOSE"
VGA "TIE"
VGA "BUST"
VGA "BLACKJACK"
VGA "5-CARD CHARLIE"
Final states will flash, informing the user that the game is over and to start a new game.
"TIE" State Loop
Voilà.
Demonstration given by me