If you have been following my posts, you know I am currently enrolled in the BEng Electrical Engineering program at BCIT, now in my third year (Level 6). This semester, I took ELEX 7660 – Digital System Design, a course that dives into hardware description languages (HDLs) (SystemVerilog), finite state machines (FSMs), the principles of digital system design, etc.
For this course, we were provided with DE10-Nano development boards. These boards are a popular choice due to their relatively low cost, having fewer onboard I/O options. To augment the board’s capabilities, BCIT supplied us with a custom PCB featuring four 7-segment LED displays, two rotary encoders, and pin headers. These headers allowed for direct connections to the FPGA via the GPIO interface and facilitated the attachment of the Texas Instruments BOOSTXL-EDUMKII. This booster pack is equipped with a variety of analog and digital inputs/outputs, including an analog joystick, environmental and motion sensors, an RGB LED, a microphone, a buzzer, a color LCD display, and more.
For our end-of-semester project, we had to build something—anything—that expanded on the complexity and concepts we explored in the labs and assignments. This project accounted for 20% of the final grade. FPGAs can be used for a wide variety of tasks, and there’s no shortage of creative project ideas. I chose to build a game because it’s a great way to challenge and showcase your technical skills. My original plan was to recreate a game similar to the arcade classic Breakout.
I had two options for video output: use the LCD module on the TI BoosterPack or write a VGA module in SystemVerilog (which is relatively straightforward). However, since the DE10-Nano lacks an onboard VGA DAC, using VGA would have required connecting a breakout adapter to the GPIO pins and adding resistor networks. I ordered parts for this setup, but kept it as a backup option. Our instructor made Lab 5 optional, the lab where we displayed a static image on the LCD screen. I suspected most students would skip that lab and therefore not use the LCD in their final projects. That made it a more interesting goal for me: to display game output on the 128×128 pixel LCD screen.
This approach required the use of a NIOS II soft processor system, implemented via Platform Designer (Qsys) in Intel Quartus Prime. Thankfully, our instructor provided a working codebase to display a static image on the LCD using C code that runs on the soft processor and writes to a framebuffer. I modified this code to dynamically update the framebuffer and draw it to the screen. The display, an ST7735S LCD, receives burst writes via SPI.
This is where I ran into a problem, the screen simply isn’t fast enough for smooth, real-time updates. A fast-paced game like Breakout was nearly unplayable due to the sluggish and blocky movements, even after optimization. That’s when I realized this display would be much better suited for a game like Tetris. So I decided to pivot.
Presenting: Tetris on FPGA 🎮
This is a SystemVerilog + C implementation of Tetris using:
- 🧠 RTL logic for all game mechanics (piece movement, collision, locking, scoring, etc.)
- 🖥️ NIOS II soft processor for drawing the framebuffer to the LCD display
- 🎵 Hardware audio module that plays the Tetris melody on game over
- 🕹️ Analog joystick + pushbuttons for controls
- ⚡ 7-segment LED display for score
- 📺 ST7735S 128x128 LCD as game display
GitHub: https://github.com/raghavmarwah/ELEX7660_Tetris_RTL
One thing I appreciated was how BCIT structured the course to make the most of hardware we had already purchased in earlier semesters. We already owned the TI BoosterPack from previous courses, so being able to reuse it here was convenient. On top of that, BCIT loaned out the DE10-Nano FPGA boards, removing the need for us to invest in additional expensive development hardware.
Tetris Melody “Korobeiniki” 🎹
The notes and time durations for this melody were obtained from here. Converted by ChatGPT.
Closing Remarks 💡
This project was a fantastic opportunity to apply everything I’ve learned so far in this course—and then some. By building this project, I gained valuable hands-on experience in:
- Writing synthesizable SystemVerilog to model complex game logic using FSMs.
- Interfacing with peripherals using Avalon memory-mapped components and buses.
- Integrating a NIOS II soft processor to offload embedded C tasks like framebuffer rendering.
- Integrating IP blocks using Platform Designer (Qsys).
- Working with real-world hardware constraints like SPI display bottlenecks.
While the game is fully playable, there are still enhancements I would like to explore—such as improving input handling with debouncing, adding hard drop mechanics, implementing per-tetromino colors, and optimizing display performance further.
Sadly, this FPGA development board needs to be returned at the end of the semester. I would have loved to keep it over the summer break to experiment with it further. Fortunately, I recently found an excellent deal on a used board that I purchased and I’m excited to start tinkering with it in the coming weeks. Stay tuned! 🚀