Skip to content

Lightweight adventure game inspired by the classic Pokémon series, adapted to run on the DE2i-150 FPGA board.

License

Notifications You must be signed in to change notification settings

Shellyda/pokemon-fpga-game-ihs-project

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PokeCIn - Infrastructure hardware-software Course project

This repository contains the structure, scripts, and documentation to develop the IF817 course project - a C++ game Pokémon like for the DE2i-150 FPGA board, integrating hardware-mapped peripherals (switches, buttons, LEDs, and 7-segment displays) via a custom PCI character driver. The project uses Quartus II for FPGA mapping, Raylib for rendering via HDMI, and real-time interaction through the board’s I/O components.

Gameplay FPGA DE2i-150

The project is divided into four main stages, as specified in the course requirements:

  1. Peripheral Mapping – All DE2i-150 peripherals (switches, buttons, LEDs, and 7-segment displays) are mapped in Quartus II for PCI read/write access.
  2. Driver Development – Implementation of a PCI character driver in C/C++ for Linux, enabling communication between the Atom CPU and FPGA-mapped devices.
  3. Application Development – The game is implemented in C++ using Raylib for rendering via HDMI, with real-time interaction through mapped hardware inputs and outputs.
  4. Optional Enhancements – Possible additions include sound interaction, OpenMP parallelization, or C/Assembly integration for performance boosts.

Reminder: This layout includes a simple Makefile for those who want to develop a straightforward C/C++/Assembly project without complex configuration. Do not remove the Makefile inside the driver folder, as it is essential for building the driver/module.

Contributors


Alysson Ramos


Lucas Torres


Shellyda Barbosa

Content

Game Overview

  • Raylib-based rendering via HDMI for smooth 2D graphics.
  • Real hardware interaction using switches, buttons, and LEDs on the FPGA.
  • Custom game loop controlling player movement, map collisions, and animations.
  • Music and sound effects for an immersive experience.

Players can explore a pixel-art map, control their character in real time, and interact with the environment through the FPGA’s I/O peripherals.

Current Project Tree

.
├── src
│   ├── assets/           # Images, sounds, and other game resources
│   ├── game/             # Game logic and components
│   │   ├── game.cpp/.h   # Manages game states and main loop
│   │   ├── map.cpp/.h    # Map rendering and collision logic
│   │   ├── player.cpp/.h # Player movement, animations, and interactions
│   ├── main.cpp          # Application entry point
│   └── Makefile          # Game compilation
├── include/
│   ├── display.h
│   └── ioctl_cmds.h
├── driver/
│   ├── char/
│   │   ├── dummy.c
│   │   └── Makefile
│   └── pci/
│       ├── de2i-150.c
│       └── Makefile
├── exemples/
│   ├── c/
│   │   ├── app-char.c
│   │   └── app-pci.c
│   └── python/
│       ├── app-char.py
│       └── app-pci.py
├── docs/
│   └── commands.md
├── LICENSE
├── Makefile              # Root makefile
├── README.md
└── setup.sh

How to Run & Debug

Using setup.sh

  1. Give execution permission:

    chmod +x setup.sh
  2. Run:

    ./setup.sh

Check Useful Commands for more details.

Step-by-step Manual Setup

1. Compile the driver

cd driver/pci
make

2. Insert the module into the kernel

sudo insmod de2i-150.ko

3. Set device permissions

sudo chmod 666 /dev/mydev

4. (Optional) Verify device creation

ls -l /dev/mydev

5. Compile the Main Application

make

This will create the target/ directory:

target/
├── release/
│    ├── app        # final executable
│    └── obj/       # .o object files
├── debug/          # created if you run make DEBUG=1
└── app.lst         # disassembly dump

6. Run the Application

./app /dev/mydev

/dev/mydev is the device node created by the driver. The application communicates with the hardware via ioctl, read, and write.

Debugging & Maintenance

  • Check kernel logs:
dmesg | tail -n 30
  • Remove the module:
sudo rmmod de2i-150
  • Reinsert the module:
sudo rmmod de2i-150
sudo insmod de2i-150.ko
  • Verify module load:
lsmod | grep de2i

Course Requirements Summary

  • Mandatory peripheral mapping in Quartus II (switches, buttons, LEDs, displays).
  • Custom PCI character driver in C/C++ for Ubuntu.
  • C++ game application using FPGA-mapped I/O for interaction.
  • Deliverables: Incremental submissions for mapping, driver, and final application.
  • Optional bonus: Sound interaction, OpenMP usage, C/Assembly integration, LCD mapping.

Releases

No releases published

Packages

No packages published

Languages

  • Verilog 67.2%
  • SystemVerilog 25.8%
  • HTML 5.9%
  • C 0.4%
  • C++ 0.2%
  • Tcl 0.2%
  • Other 0.3%