Overview
For the final project of my Digital Logic course, I collaborated with a small group to implement the popular 2048 game entirely in VHDL on an iCE40 FPGA development board. The game outputs full VGA graphics and supports user input via a classic NES controller, enabling a complete gaming experience on custom hardware.
Game logic & graphics pipeline
At the core of the project was the game logic, which required careful state management to handle tile movement, merging, and score updates. On top of that, I developed a custom graphics pipeline to render the board and tiles on a VGA display under strict timing requirements for synchronization signals. Each tile was stored in its own ROM block for efficient fetch and rendering during gameplay. The graphics system also required tightly timed pixel-clock generation, horizontal-sync, and vertical-sync signals to maintain a stable display.
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
entity vga is
port(
clk : in std_logic;
HSYNC : out std_logic;
VSYNC : out std_logic;
rowOut : out unsigned(9 downto 0);
colOut : out unsigned(9 downto 0);
valid : out std_logic
);
end;
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
entity twoBlockROM is
port(
clk : in std_logic;
rowIn : in unsigned(9 downto 0);
colIn : in unsigned(9 downto 0);
rowOffset : in unsigned (9 downto 0);
colOffset : in unsigned (9 downto 0);
rgbOut : out std_logic_vector(5 downto 0)
);
end;