# Forum: FPGA, VHDL & Verilog Implementing the game Breakout in Verilog

 Author: Jacob Culleny (Guest) Posted on: 2014-12-03 04:54

Rate this post
 0 ▲ useful ▼ not useful
Hello All.

Im working on a final project for my freshman engineering class and my
team and we chose to recreate the game breakout in verilog and
implemented on an LED Matrix. However, we just started to dive into what
we need to do to get this to work, and we are already slightly lost. So
I just want to ask a general question about what modules we will need.

So we'll need the following modules (correct me if im wrong):

1. a module to control the ball movement
2. a module to control the paddle movement.
3. a module to control what happens when blocks are hit
4. a timing module
5. a module to actually implement the game on the matrix.
6. a counter module
7. a module for the state machine (which basically has three states,
when you win, when you lose, and when youre playing)

Does this sound okay? Thank you.

 Author: Verilog hotline (Guest) Posted on: 2014-12-03 17:39

Rate this post
 0 ▲ useful ▼ not useful
There are a lot of ways to do it. So what are your proposed block doing
and how do they interconnect to realize the game?

First you should be clear on the representation of the game logic in
your verilog model, then you can start to divide this into meaningful
blocks.

A simple approach could be:

Write an LED matrix control module that takes a two-dimensional
bit-array as input and updates the (monocolor?) LED matrix (as fast as
possible). This is totally separated from the game logic. The two
dimensional bit-array is your game board and the whole game logic may be
handled in one module that updates this array. A 1 in the array means,
there is sth. (ball or paddle or block or outer borders or ground).

Your game logic module updates the bit-array. Internally, it may have a
structure of a two-dimensional multi-bit array (e.g. 5 bit
one-hot-encoding to know internally what is the ball and what is the
paddle and what is a block and so on) that can be easily mapped to the
bit-array for the LED module.
In your game logic module you can create several counters. For example,
you could process the paddle input any 10 ms and trigger a bit-array
update accordingly (depends on how fast you allow to move the paddles).
A second counter of e.g. 1 s moves the ball.

The interesting thing in the game logic module is the game logic. The
ball has to be reflected from the paddle, the blocks and the outer
borders with a certain degree. So if your game logic module updates the
array, it has to check if an array element is used by more than one
element (i.e. more than one bit is 1 in the multi-bit one-hot
representation) and what happens then. Your checks are a lot faster (if
you run the verilog design on some MHz) than the LED output, so you have
enough time to "loop" through the array and trigger the according
actions.

 Author: fpgakuechle (Guest) Posted on: 2014-12-03 18:36

Rate this post
 0 ▲ useful ▼ not useful
Just re-implement the original schematics in verilog:

The circuit count should be optimal, because is a Woz-design :-)
http://en.wikipedia.org/wiki/Breakout_%28video_game%29

Best regards,

### Rules — please read before posting

• Post long source code as attachment, not in the text
• $formula (LaTeX syntax)$