MiSTer Saturn Core Optimisations Tackle FPGA Resource Limits

MiSTer Saturn Core Optimisations Tackle FPGA Resource Limits

The MiSTer Saturn core has received a significant set of updates, focusing on critical optimisations to manage the demanding resource footprint on the DE-10 Nano. These adjustments are vital, as the core has been pushing the limits of the FPGA's adaptive logic modules, or ALMs, making compilation increasingly difficult for the community.

Sergiy "SRG320" Dvodnenko, the core's developer, uploaded these improvements to the project's GitHub. They are currently available in the "unstable nightlies" channel on the MiSTer Discord server, rather than the main branch which last saw an update in October. This phased release allows for testing and refinement before broader deployment.

The MiSTer, a field-programmable gate array (FPGA), uses a DE-10 Nano board to physically reconfigure its hardware to emulate retro consoles. "Cores" are the specific programming files that instruct the FPGA on how to behave like a particular system, such as the Sega Saturn, according to RetroRGB. The Saturn core is one of the most complex, demanding nearly all of the DE-10 Nano's available ALMs, which are the fundamental programmable logic blocks within the FPGA.

This high ALM usage creates substantial hurdles during the compilation process, where software like Quartus attempts to translate the core's design into a usable RBF file for the FPGA. Zet-sensei, a key tester for the Saturn core, described the compilation difficulty plainly, noting his computer struggles with the task. The core's sheer size and complexity mean that even minor additions can tip the balance, preventing successful builds.

The Compilation Conundrum

Previous updates, particularly one on 3 April, pushed the core beyond its practical limits for many users. The community reported widespread failures to compile the core, especially for MiSTer setups with a single RAM chip. Even dual RAM configurations, which can offload some functions to the extra memory, barely managed to compile. This situation led to considerable frustration and a temporary halt in new feature integration.

SRG320's work since then has focused on finding efficiencies within the existing code. This is not about adding new features, but about ensuring the core remains buildable and stable. The developer's dedication to refining the core's footprint is clear, especially when considering the pressure from the community to maintain functionality while pushing for new additions.

Dual RAM vs. Single RAM Builds

The MiSTer platform supports both single and dual SDRAM (Synchronous Dynamic Random-Access Memory) configurations. For complex cores like the Saturn, dual RAM setups offer a distinct advantage. By having additional memory, the core can offload certain data storage and processing tasks, freeing up the precious ALMs on the DE-10 Nano itself. This distinction has become increasingly important for the Saturn core, with separate builds provided for each configuration.

At one point, the single RAM core was using 99% of the DE-10 Nano's ALMs, while the dual RAM version was at 98%. These figures, reported by Zet-sensei and confirmed by other community members like birdybro, highlight the extreme pressure on the hardware. It is a testament to SRG320's skill that the core compiles at all under such tight constraints.

A Developer's Relentless Pursuit of Efficiency

The real story here is the ongoing engineering challenge of fitting a console as complex as the Sega Saturn onto a fixed-resource FPGA like the DE-10 Nano. SRG320's efforts to optimise the core are not merely about bug fixes; they are about a constant battle against the physical limitations of the hardware. This requires deep understanding of FPGA architecture and efficient code design.

When asked about adding features like analog shoulder button support or cheat functionality, SRG320's response was stark: "There isn't any free space. Rather, I need to free up some space to improve the compilation. If I can't find a way to free up space, I'll have to remove some features." This statement shows the critical nature of the recent optimisations and the difficult choices developers face.

Community Input and Feature Trade-offs

One interesting example of community interaction leading to a feature is the implementation of LED status lights. A user named Kanel on the MiSTer Discord asked about mimicking the PlayStation core's disk access LED. Despite initial dismissals from some members who felt the core was too full for such a minor addition, SRG320 took notice.

Just a week later, the MiSTer's onboard red and yellow LEDs now imitate a Model 1 Saturn's power and disc read lights, respectively. The green LED also indicates data saving. This seemingly small feature provides useful visual feedback, letting users know if the system is accessing data or if it has frozen. It shows that even under immense resource pressure, thoughtful, user-driven enhancements can still find their way into the core.

Optimising Light Gun Functionality

The discussion around resource management also touched upon the virtual light gun support. SRG320 questioned the necessity of supporting two virtual light guns, causing some consternation among users who enjoy two-player light gun games like Virtua Cop and House of the Dead. While no features have been removed yet, the developer clarified that the goal was to optimise the existing code.

ElectronAsh, who originally wrote the MiSTer's light gun code, noted that while the code itself is relatively small, even 133 ALMs (roughly 351 Logic Elements in older Cyclone FPGA terms) is a significant amount when resources are so tight. SRG320's idea of combining two identical light gun modules into one to save ALMs is a clever approach to reduce the core's footprint without sacrificing functionality entirely. This kind of architectural re-evaluation is key to continued development.

The Future of Saturn Emulation on MiSTer

The recent optimisations are proof of the ongoing dedication of SRG320 and the MiSTer community to push the boundaries of FPGA-based emulation. While the core remains incredibly dense, these updates ensure its continued viability and buildability. The challenge of balancing new features with the DE-10 Nano's finite resources will persist, requiring careful consideration for every line of code.

Moving forward, the community will likely see a continued focus on efficiency. Whether further optimisations can be made to features like dual light gun support, or if difficult decisions about feature removal will eventually be necessary, remains to be seen. What is clear is that the MiSTer Saturn core continues to evolve, driven by a developer committed to delivering the best possible experience within the hardware's constraints. This ongoing work ensures that the Saturn's unique library remains accessible and accurately preserved for enthusiasts.

If you run Sega hardware, do the boxes a favour. Our Sega game protectors fit Megadrive, Saturn and Dreamcast cases, made in the UK from cast acrylic.

Follow RetroShell on X for daily retro gaming news. Join the community on r/RetroShell.


Originally published by RetroRGB. Read original article.

Encrypted Comms