A Display of Power: Running Doom on a Custom CPU
Doom, the iconic game by id Software released in 1993, has become a benchmark for testing the capabilities of computing systems. The saying "Doom can run on anything" isn't taken lightly. From microcontrollers to toasters, Doom has been ported to almost everything. So, why not on a CPU we designed from scratch?
The Challenge: Designing a Custom CPU
Designing a custom CPU is a formidable challenge. We started by defining the architecture at the logic gate level, integrating peripherals, and adapting Doom's source code for our machine. Our goal was to deploy it onto an FPGA to run in real-time.
Memory and Speed: Two Major Obstacles
Complex programs like Doom require considerable memory. The base file for Doom (doom1.wad) is 14 MB, well beyond our FPGA's BRAM capacity. Additionally, execution speed was another hurdle, as our CPU couldn't match modern PCs. To overcome this, we implemented dedicated solutions:
- Out-of-Order Processing: To mitigate slowness, we explored out-of-order processing, allowing increased parallelism.
- Memory Integration: Transitioning from BRAM to DDR3 memory required integrating a cache to speed up data access.
Crafting a Solution
We integrated an efficient cache to minimize the latency introduced by DDR3. The granularity of BRAM allowed us to read and modify memory words accurately, but DDR3 introduced variable latency. Optimizing the cache helped counteract this variability and improve overall performance.
The Outcome: A Viral Video
After weeks of hard work, we successfully ran Doom on our CPU. We shared our success online, and the video quickly went viral, reaching several million views. This achievement not only demonstrated our technical expertise but also inspired other developers to push the boundaries of innovation.
Conclusion
Running Doom on our custom CPU was an exciting journey, full of learning experiences and technical challenges. This experience proves that even the most ambitious projects can be realized with determination and expertise.
Let's discuss your project in 15 minutes.