Digital VLSI Slot Machine Project Documentation: Christopher Condrat, Heather Malko
Digital VLSI Slot Machine Project Documentation: Christopher Condrat, Heather Malko
Digital VLSI Slot Machine Project Documentation: Christopher Condrat, Heather Malko
and the cherries symbol provide winnings for simply appearing machine is a finite state machine with 8 states. A basic state
anywhere with any other combination of symbols. This is in diagram for the control logic can be seen in Fig 2.
addition to different three-of-a-kind awards. There are two inputs: add coin and spin. The control
Money management – When the user wins, the money is module holds two values, the current winnings and the value of
placed into a winnings counter. If the user should decide to the bet. When the add coin button is pressed, it adds one coin
play again, the money should be subtracted from the winnings to the bet. A coin is subtracted from the winnings if there is
before the player needs to add new money. any money present, or else it is assumed to have come from the
These four goals are the driving force behind the slot player. The control only allows for three coins to be bet per
machine. With these in mind some design decisions were spin.
made: the overall operation of the slot machine, the visual When the spin button is pressed, the control sends a lock
design of the slot machine, and the needed modules to signal to a random number generator module, which latches its
implement the slot machine. The overall design of the slot value, and a reel animate signal to the video controls. The
machine, in terms of modules can be seen in Fig. 1. control stays in a spin state until the done signal is received,
meaning the reels are finished animating on the screen. The
Now we shall go over the different components that make next step is to calculate the winnings. If a winning spin
up the slot machine: occurs, the amount won is added to the winnings and the
control returns to the beginning and waits for a coin to be
A. Slot Machine Control
added.
The slot machine’s operation is best described by the logic There are a total of 8 symbols for each reel. The random
Lock Bet 1
LFSR Value
LFSR Value
Winnings
Coins in
SpinReel
ReelDone
The Arbiter should be combinational logic.
Number
Y
Row/Col
Row/Col
Money/Odometer select
Row-Source BCD
Select
Row/Col
Y[2:0]
(sub-tile row select) X
VGA Hsync/Vsync/RGB
that controls the play action. The control module for the slot number has 9 bits, allowing each one of the three reels uses 3
05/06/2006 3
Bet = 0
Winnings = 0 arbiter. The output of this large multiplexer is then passed
Reel_Animate = false
LFSR_Lock = false Button Hit: Spin
Bet > 0
Else onto the VGA controller, which renders the graphics to the
Reset screen using VGA signals. The relationship of mapped data in
Spin the graphic system can be seen in Fig 5.
Reel_Animate = false Input
Button Hit: Add Coin
AND LFSR_Lock = true
Finally, the VGA controller is the heart of the graphic
system, and yet has the most mundane role. The controller
LFSR_Lock = false Bet < 3 Reel_Animate = true
Reel_Animate_Done
Else = true
merely provides screen coordinates to the other modules, while
Bet = Bet + 1
dumbly rendering the pixel information from the 48-bit tile
Coin Coin Spin row to the outside VGA connector.
C. Reel Animation
Winnings = 0
Player_Win = true
Coin Slot machines attract users through lights, sounds, and also
Winnings > 0
movement. A slot machine would be boring without reels to
Winnings = Winnings - 1
Bet = Bet + 1
Spin Winnings = Winnings +
spin and keep the user in anticipation. The reel animator
Amount_Won
module controls reel animation. Animation comes in the form
Player_Win = false
of vertical scrolling of reels, much like the mechanical
versions. This requires a vertical offset to be computed for
Fig. 2. The state diagram for the control logic. each of the reels. Each reel rotates independently of the
of the bits from the random number. There is a payout for any others; however, all reels rotate at the same speed. The reel
3 of a kind, and for any spin that has a jackpot or a cherry results are revealed when the reels stop. To make the slot
symbol. Every possible combination will occur 1 out of every machine animation more attractive and coordinated, reels are
512 spins, except for the triple-jackpot, which occurs once out stopped from left-to-right, and money is only awarded (or
of every 1,024 spins. With the current payout, 59% of the taken) after all the reels have fully revealed.
spins will be a winning spin. Over time, the slot machine has a Animation is timed upon successive frames (full screens)
payout of 247%—a very bad thing for a commercial slot of animation, and therefore the reel animator only changes the
machine, but fun for the player. The table in Fig 3 shows the reel-offset at the beginning of a frame. As a VGA screen is
winnings and the odds for the different combinations. refreshed 60 times per second, the reel spins at 8 pixels per
frame, rendering nearly a full reel rotation per second. Each
B. Graphics reel spins a minimum of four times before revealing its
Graphics establish the look and feel of the slot machine. symbol, extending the play action.
Great attention was paid to ensuring that the slot machine
D. Money Odometers and BCD
would be able to display detailed graphics to the screen.
Memory restrictions were a deciding factor in determining the The money odometers render numerical values to the screen
detail and resolution of graphics the slot machine would representing both the coin wager, and the user winnings.
render, and also the screen resolution. Subsequently, the Internally, bit vectors represent both the winnings and the
chosen resolution was 128x120, centered on a 640x480 coins in the machine; however, a BCD was designed to display
display, meaning that all pixels needed to be quadrupled in the current winnings in base-10, to provide the player with a
size (2x2). Winning
All graphics were manually drawn on a computer. The Winning Combos Odds s Winnings per Spin
restriction on the number of colors means that graphics can 3-jackpots 0.0977% 500 0.49
only be drawn using 64-colors, or in other words, the high two 3-cherries 0.1953% 200 0.39
bits of each color channel. Despite this limitation, the graphics 3-3xbars 0.1953% 100 0.20
are relatively high quality, as depicted in Fig 4. 3-bars 0.1953% 50 0.10
Displaying graphics to the screen involves many modules 3-$ 0.1953% 40 0.08
working independently to determine what is drawn to the 3-777 0.1953% 30 0.06
screen. The graphic system is based upon rendering “tiles”— 3-7 0.1953% 20 0.04
8x8 pixel graphics—repeatedly across the screen using a tile-
3-lemons 0.1953% 10 0.02
mapper. This mapping module is named the graphics arbiter,
2-jackpots & 1-cherry 0.5859% 5 0.03
and is named such because in addition to providing the basic
1-jackpot & 2-cherries 0.5859% 4 0.02
tile mapping for the slot machine interface, it is charged with
2-jackpots 3.5156% 4 0.14
the task of arbitrating which modules will render to the screen.
When a module is allowed to decide what is displayed to 2-cherries 3.5156% 2 0.07
the screen, it provides row and column information to ROMs 1-jackpot & 1-cherry 7.0313% 3 0.21
or graphic functions. These in turn pass on pixel information, 1-jackpot 21.0938% 2 0.42
as a full 8-pixel tile-row of 6-bit pixels (48-bits total) to a 1-cherry 21.0938% 1 0.21
multiplexer, the output of which is selected by the graphics
Fig 3 Winnings and odds computations
05/06/2006 4
F. Final Details
First, a shading module was added in between the reel ROM
output and the VGA controller. This shading module shades
the top and bottom of the reel graphics, by subtracting color, to
give the appearance of a rounded shape. The effect is not as
good as it could be because of the low number of colors, but it
is still observable.
As an area of future work, multi-frame animated tiles could
be added to the interface by assigning certain tiles to cycle
through tiles. Such animations could be used to render
blinking lights or switch the state of a winner indicator or such.
The solution to the simulation problem came in the form of External Connections
using an FPGA, a 100,000-gate Xilinx Spartan II in our case,
as the “chip.” Verilog is compiled using Xilinx’s ISE FPGA Red1
Push-Button
compiler, and the resulting bitmap is loaded onto an FPGA. Spin Red0
470
1000
Red
Due to space constraints, some graphics, notably the reel Push-Button
Coin-In
Green1
470
functionality. (break)
nReset
Hsync
Hsync
The real-time simulations also enabled our group to make Vsync
Vsync
adjustments to the code itself. For instance, the reels should
EEPROM
Address
stop (and therefore reveal the symbol it lands on) starting with
EEPROM
the left reel and ending with the right. Some combinations of
DATA
symbols, due to the relative order of the symbols, would cause
the reels to be rendered out of order. The solution to this
EEPROM
problem: force two full-reel-rotations between successive
reel-stops. This extends the animation, but ensures that the For off-chip data
reels reveal themselves in order. Fig. 6. How the slot machine chip would integrate into a system.
the Spin and Coin-in signals. A break-based push-button
IV. INTEGRATION INTO A SYSTEM
should be used for the reset signal, as it is active-low. Please
The chip requires a 50Mhz clock to operate. Other clock consult the Fig 6 for further details.
speeds will affect the VGA controller in adverse ways and
cause animation timing-problems as well. V. FABRICATED CHIP
The slot machine chip requires outside components to
The design was fabricated by MOSIS circuit-fabrication
operate correctly. Depending on the implementation, the chip
service [2], which provides free design fabrication for
may need access to an external EEPROM for reel graphics
educational purposes. This free fabrication service has two
data, or may stand alone without the EEPROM if enough chip
purposes: to enable students to fabricate designs and receive a
space is available for fabrication, or if the internal color
physical chip as a result, and more importantly, for MOSIS,
function (no symbol graphics) is used instead of reel graphics.
helps provide “realistic” and varied designs to help gauge the
The slot machine does, however, depend on resistor ladders to
quality of the fabrication process for MOSIS. The latter
produce color output to the screen. Each 2-bit color channel
purpose requires that students take a testing course to test and
can provide four combinations of output, and by passing these
benchmark their chips—both for educational value, and to
outputs through resistors (470Ω and 1000Ω), variable voltages
provide data to MOSIS on how well their fabrication operates.
can be sent out the VGA port, and therefore variable levels of
Fabricated designs vary in size, and are measured in tiny
color output. These, along with the synchronizing signals
processor units (TPUs). Arbitrary numbers of TPUs are not
allow the chip to render graphics to the VGA port. Amplifiers
allowed, and designs must fit into sizes of one, two, four,
for the signals may be required, but this requirement has not
and—for the first time ever in an educational fabrication run—
been verified.
six TPUs. Because of the massive amount of graphics data in
For input, pre-debounced push-buttons should be used for
the slot machine design, strings were pulled to allow a 6-TPU
processor design to be sent to MOSIS—without a reduction of
total chips returned. This also meant that no EEPROM had to
be incorporated in an extra-chip design to store the graphics
data.
Unfortunately, as there was no previous instance of a 6-TPU
design, the pad-ring required extra modification to work with
the design. Additional metal had to be laid down into the
design to fit the fabrication rules as well.
4.2
Fig. 9. Photo of the FPGA-simulated design.
3.7
8px 96px 696px
3.2 Each pixel is one clock cycle (the design ended up being
clocked down to 25 Mhz for simplicity). The pattern above
repeats continuously as the screen is drawn.
2.7 After a somewhat frustrating start, where the wrong voltage
was applied to the design, the tester started consistently
reporting that the tests passed. Next came the schmoo plots.
2.2 Schmoo-plots depict two test conditions, for instance chip-
voltage and clock-speed, varied on a 2D plot, with one
condition representing the horizontal axis, and the other
1.7 condition representing the vertical axis. A schmoo plot helps
visualize the conditions under which the chip will operate
correctly.
1.2
8ns 40ns The varying-conditions used in the testing of the fabricated
Phase Width (2ns/block)
chip were voltage and clock pulse-width. There were some
issues involving untestable voltage values, specifically the
Fig. 8. Schmoo Plot device voltage, which would not go below the forced voltage.
We were unable to find a workable solution to this issue, so
available to students is not especially modern, the chip designs
instead of varying the device voltage, we varied the forcing
have the opportunity to fail under adverse conditions where the
voltage versus the phase width and plotted the graph. The
5V, 0.6-micron logic may not hold up.
resulting schmoo-plot can be seen in Fig 8.
Testing is performed using test vectors, for which the LV-
After testing the chip using the LV-500, we determined that
500 may store up to 64,000 of. Values are forced, and then
the MOSIS fabrication run produced a working yield of 100%.
tests are made to determine whether the device has returned
This is unsurprising seeing that this was a relatively simple
the correct value. The tester has no ability to automatically
design, and it wasn’t really pushing the boundaries of even the
generate a clock, so clock signals must be coded manually into
test vectors. Test vectors can either be inputted by hand at the L K J H G F E D C B A A B C D E F G H J K L
campus. 4 4
Reset Red0 Reset
5 Green1 5
VSync
take some time before any change in the output can be 9 9
10 10
detected. The earliest-arriving, that is earliest-changing, 11 11
predictable signal is the horizontal synch signal (Hsync), VDD GND CLK
REFERENCES
[1] Icarus Verilog simulator and compiler.
http://www.icarus.com/eda/verilog/
[2] The MOSIS Service
http://www.mosis.org/
[3] VGA Connector
http://www.theavguide.co.uk/AdvHTML_Upload/vgaplug3.jpg