This folder accompanies the Project F blog post: FPGA Pong. These SystemVerilog designs recreate the arcade classic in logic. You can freely build on this MIT licensed design. Have fun.
File layout:
ice40
- designs for iCEBreaker and other Lattice iCE40 boardssim
- simulation with Verilator and LibSDL; see the Simulation READMExc7
- designs for Arty and other Xilinx 7 Series boards with VGA outputxc7-dvi
- experimental designs for Nexys Video and other Xilinx 7 Series boards with DVI output
These designs make use of modules from the Project F library. Check the included iCE40 Makefile or Vivado create_project.tcl to see the list of modules used.
Learn more about the designs and demos from FPGA Pong, or read on for build instructions.
Pong running as a Verilator simulation on macOS.
You can build projects for iCEBreaker using the included Makefile with Yosys, nextpnr, and IceStorm Tools.
You can get pre-built binaries for Linux, Mac, and Windows from YosysHQ.
To build pong
; clone the projf-explore git repo, then:
cd projf-explore/graphics/pong/ice40
make pong
After the build completes, you'll have a bin file pong.bin
. Use the bin file to program your board:
iceprog pong.bin
If you get the error Can't find iCE FTDI USB device
, try running iceprog
with sudo
.
The game controls for iCEBreaker:
- Button 3 - up
- Button 2 - start (fire)
- Button 1 - down
The iCE40 designs have been tested with:
- OSS CAD Suite 2023-03-01
To create a Vivado project for the Digilent Arty (original or A7-35T); clone the projf-explore git repo, then start Vivado and run the following in the Tcl console:
cd projf-explore/graphics/pong/xc7/vivado
source ./create_project.tcl
You can then build Pong as you would any Vivado project.
The game controls for Arty:
- BTN2 - up
- BTN1 - start (fire)
- BTN0 - down
The Arty designs have been tested with:
- Vivado 2022.2
It's straightforward to adapt the project for other Xilinx 7 Series boards:
- Create a suitable constraints file named
<board>.xdc
within thexc7
directory - Make a note of your board's FPGA part, such as
xc7a35ticsg324-1L
- Set the board and part names in Tcl, then source the create project script:
set board_name <board>
set fpga_part <fpga-part>
cd projf-explore/graphics/pong/xc7/vivado
source ./create_project.tcl
Replace <board>
and <fpga-part>
with the actual board and part names.
To create a Vivado project for the Digilent Nexys Video; clone the projf-explore git repo, then start Vivado and run the following in the Tcl console:
cd projf-explore/graphics/pong/xc7-dvi/vivado
source ./create_project.tcl
You can then build Pong as you would for any Vivado project.
The game controls for Nexys Video:
- BTNU - up
- BTNC - start (fire)
- BTND - down
The Nexys Video designs have been tested with:
- Vivado 2022.2
You can simulate these designs on your computer using Verilator and SDL. The Simulation README has build instructions.
If you have Verilator installed, you can run the linting shell script lint.sh
to check the designs. Learn more from Verilog Lint with Verilator.
These designs use a little SystemVerilog to make Verilog more pleasant. See the Library README for details of SV features used.