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:
- Peripheral Mapping – All DE2i-150 peripherals (switches, buttons, LEDs, and 7-segment displays) are mapped in Quartus II for PCI read/write access.
- Driver Development – Implementation of a PCI character driver in C/C++ for Linux, enabling communication between the Atom CPU and FPGA-mapped devices.
- Application Development – The game is implemented in C++ using Raylib for rendering via HDMI, with real-time interaction through mapped hardware inputs and outputs.
- 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.
Alysson Ramos |
Lucas Torres |
Shellyda Barbosa |
- 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.
.
├── 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
-
Give execution permission:
chmod +x setup.sh
-
Run:
./setup.sh
Check Useful Commands for more details.
cd driver/pci
make
sudo insmod de2i-150.ko
sudo chmod 666 /dev/mydev
ls -l /dev/mydev
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
./app /dev/mydev
/dev/mydev
is the device node created by the driver. The application communicates with the hardware viaioctl
,read
, andwrite
.
- 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
- 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.