Close

3 year recap and future plans

A project log for VerilogBoy - GameBoy on FPGA

A Pi emulating a GameBoy sounds cheap. What about an FPGA?

Wenting ZhangWenting Zhang 02/28/2021 at 20:090 Comments

Hi everyone. It's now end of February of 2021 as I am writing this. The VerilogBoy project was started back in February of 2018, and it has been 3 years since I have started this. I would just like to recap what have been achieved and the future plans of this project.

What has been done

Original Prototype on ML505

I started this project as a course project for the CMPEN275 (Digital Design Lab) back in Penn State. I implemented the whole thing on the ML505 FPGA dev board. By the end of the term I was able to get Pokemon running on the board as a demo. I wrote my own PSG, PPU, and timer, but reused the CPU from one of the open source FPGA GB project.

Unfortunately no recording of the presentation was available, otherwise personally I would really love to watch that again... The only thing I have from that time was a recording showing it running (captured via VGA, didn't capture sound):

Improving the Code

The original code works, but not great. It fails lot of the test ROMs available. After learning the internal architectures of the GB CPU (SM83), I rewrote the CPU myself, two times. It should be now cycle accurate.

To help test everything, I have also created a Verilated simulator that runs on PC. It could loads the ROM and runs the code in the simulated VerilogBoy. On Apple M1 Macs, it could runs up to close to real time speed (4MHz). As a reference, I used isim bundled with Xilinx ISE to simulate the design back in 2018 to aid debugging. It runs at around 2kHz.

Building a handheld

I have been working on creating an FPGA based handheld device that would work with my VerilogBoy.

I build 2 revisions of the device in total:

Rev 0.0 in September 2018. It was the first revision, with dedicated MCU for controlling the hardware. But I had some serious bugs in the design.

Rev 0.1 in December 2020. I removed the dedicated MCU because I thought I can just use FSMs and reuse the main GB CPU (turns out it was a bad idea) and fixed several bugs. This is the revision I showed people during the VCF and Latch-up conf.

See a demo here: https://twitter.com/zephray_wenting/status/1119956214752907264

After that I was working on designing the rev 0.2, with a dedicated MCU and a dedicated MIPI DSI bridge chip, But I didn't had much time in 2020 to really execute the project. So that stays as an unfinished PCB design.

Porting to the Pano Logic

I have a whole series of project logs about porting this thing to the Pano Logic G1 device, which is a small FPGA thin client:

A detour to the Pano Logic G1 (1) - LPDDR

A detour to the Pano Logic G1 (2) - Cache

A detour to Pano Logic G1 (3) - UART & Hard fault

A detour to Pano Logic G1 (4) - USB

It worked at last, and I am quite happy about that.

Going forward

Possible improvements to the code

The first thing would be the PPU. I never get to refactor the PPU code. It was quite messy. It also fails lot of the cycle accuracy tests.

The second thing would be extend the code to support GBC mode. This could be potentially combined with the first one, because the GBC mostly demands an enhanced PPU.

I do not have plan to do any of these in the near future.

The handheld

Though I didn't had much time to play with the handheld design back in 2020, I am hoping to spend more time on it in 2021. I have renamed the handheld to Fobu to avoid confusion, also denoting as a shift of the focus. Rather than a handheld designed to run VerilogBoy, but it would be a handheld targeting 2 use cases:

1. Handheld FPGA chiptune player

2. FPGA retro gaming in both handheld and docked mode

The project would have its own page: https://hackaday.io/project/177963-fobu

Discussions