FPGAs Aren't Magic2018-02-06

Recently, there's been a lot of news hype around the Analogue Super Nt. And unfortunately, sites like Polygon are putting out glorified press releases instead of reporting factual information. So I'd like to dispel some dangerous misrepresentations now before they spread further.

As immediate evidence that the Super Nt is not perfect, the initial hardware release ships with a bug that causes Rendering Ranger to be unplayable. I am sure it will be fixed soon, but it demonstrates right away that the Super Nt is not a perfect clone of the SNES.

Foreword

I have nothing against the Analogue Super Nt. I think it's a great product. In fact, I'll start by conveying by what I perceive as its benefits.

Over software emulators:

Over real hardware:

But it also has its limitations:

And of course, higan has its own limitations, in addition to the four things above which the Super Nt does better, it also:

The way I see it: there's no such thing as perfection. Everything has its pros and cons. And everyone is going to have different priorities and values. It's a *good* thing that both the Super Nt and higan exist. We can coexist cooperatively instead of competing with one another.

Emulation

All emulation works the same way: we study the original hardware, read documentation and datasheets, develop test code to run on hardware to verify our claims, and then implement the results in source code.

The end product attempts to provide a faithful recreation of the original hardware. The accuracy of this recreation is bounded by raw processing power: that is to say, more accurate emulation requires more resources.

There are those that will take shortcuts, and Chrisopher Taber, the CEO of Analogue, brought those emulators up in the Polygon article.

But absent from the article was any mention of software emulators that are serious about emulation: projects like higan (SNES), BlastEm (Genesis), gambatte (Game Boy Color), mGBA (Game Boy Advance), etc.

Instead, you have the following quotes:

"No matter how hard the (software emulator) developers try, the games will never sound exactly the same as the browning lump of plastic in your closet. Slight imperfections mar even the best emulators: the audio will bleep out for a second, or a sprite will flicker when it should fade."

"Mention the word "emulator" to him, and he'll immediately rev up his proselytizing process."

These quotes are deeply unfair. higan currently has zero known emulator bugs, despite us having tested the entire SNES library with it. No audio drop-outs, no sprite flickering instead of fading, nothing.

There are no examples provided in the article pointing to any issues with higan, because for more than a decade, I've fixed any and all reported SNES emulation bugs within days of them being reported to me.

Of course, it's not perfect. And neither is the Super Nt. You see, the Super Nt is not a real SNES. It is not a perfect transistor-level replication of the original hardware. It is prone to the same bugs, and goes through the same bug-fixing and improvement process as higan does. The Super Nt will never be the same as the browning lump of plastic in your closet, either. Yet this isn't mentioned in the article.

FPGAs

FPGAs, or field-programmable gate arrays, are components that are programmed through code written in languages such as Verilog or VHDL. This code tells the component how to operate, in the same way that C++ instructs a general purpose CPU how to operate.

How these two differ behind the scenes (logic gates versus microcode) is irrelevant to the end result: replicating the original hardware experience. Setting efficiency aside, there is absolutely nothing an FPGA can do that cannot be done in software. And indeed, there is nothing the Super Nt does that higan does not.

FPGAs may be inherently more parallel, which is beneficial for resource usage, but modern CPUs are really, really good about context switching. Software emulators can and do verifiably simulate down to the tiniest possible clock cycle, the parallel nature of real hardware simply by using more resources.

If you believe that HDLs such as Verilog are magic, consider that automated translators exist to transform C code into it. They just don't tend to operate as well in larger-scale applications. Yet.

In both cases, emulator developers are transforming their knowledge of how the original SNES works into source code that attempts to mimic their operation. Given equal knowledge of the original hardware and absolutely masterful potential, an FPGA implementation and a PC software implementation will be equally accurate.

In the case of higan, I've spent thirteen years working full-time on increasing my understanding of the SNES hardware, and refining my emulation of it. I've worked with dozens of people over the years to help me in this goal. The Super Nt has been in development for roughly one year. Furthermore, I consider its lead developer, Kevin Horton, a friend. We work together and share information. I'm in the credits on the Super Nt device for a reason: emulation is built on the shoulders of giants. The Super Nt is possible in part by higan, which was possible in part by Snes9X, etc. And indeed, the relationship is mutually beneficial: findings from Kevin have already made their way into higan.

An emulator is not measured by any one bug or lack thereof: it's the total sum of years of testing, validation, and tens of thousands of unique behaviors all operating together correctly in harmony. These things take time.

I don't want to write an article critical of the Super Nt itself, nor of its lead engineer. But I am very distressed at how Chris' words in this story paint all software emulators as inferior to his product, ostensibly for marketing reasons. Even if that isn't his intention, that's how this article reads.

Latency

The one area where the Super Nt will absolutely beat traditional emulators is in latency: how long it takes between when you press a button on the gamepad until you see and hear the result of said action on the screen.

The reason for this is once again not magic: the Super Nt runs without an operating system in the way. Yet when you run an emulator on your desktop, it has to share resources with a thousand other processes that also want access to your video card, your sound card, your input devices, etc. This time sharing results in added latency. A software emulator can reasonably expect to get within 30-50ms of the latency of a pure hardware approach.

But again, it's not magic: there is nothing preventing an emulator written in C from running on bare metal, without an operating system in the way. It isn't done only because the demand isn't there to produce a robust real-time kernel environment that gives software emulators direct ownership access to all hardware resources. And thus, emulator developers cannot bypass the need to share these resources. Yet.

But indeed, if latency is your primary concern, I concede that FPGA devices are currently the way to go. Software emulation latency is almost imperceptible these days with the advent of adaptive sync, WASAPI/ASIO, 1000hz USB polling, etc, but it cannot be eliminated so long as users wish to run emulators right alongside their web browsers and photo editors.

The best software emulators claim to reach within 8ms of real hardware latency, and with all the above in higan I myself can perceive no difference to my real hardware, however I do not have the equipment to verify such claims, so I will leave that to another discussion.

Preservation

Chris is eager to tell you a story about his deep love for retro gaming. And I believe he is sincere.

But he is not the first to take SNES emulation accuracy seriously: I've been doing that since 2004.

But he is not in it to preserve the hardware for future generations: he's in it for the profit. His product is necessarily closed source. When the last Analogue Super Nt dies of old age, it will be a distant memory. It is a black box, just like the original SNES consoles.

I'm not going to begrudge someone for wanting to earn a living. But you need to understand: Polygon's article is nothing more than a product advertisement, devoid of any and all actual journalism and fact-checking. I am going to take issue with my life's work being misrepresented, as it has been here.

Game Preservation

These clone consoles that take physical cartridges bypass the need to emulate the hardware that exists inside of game cartridges. Game cartridges will one day fail just as game consoles will. And when they do, the Super Nt will not help you play SuperFX games like Yoshi's Island, or SA-1 games like Super Mario RPG.

Software emulation preserves the complete environments in digital form, not just the base systems. Those are meaningless without any content for them.

Technical Documentation

A very important point in fairness to mention is that Kevin Horton has promised to release detailed timing documentation on his findings while developing the Super Nt product.

THAT is preservation. And that is extraordinarily commendable, and we should all be deeply appreciative of Chris, Kevin, et al when this happens.

Without the Super Nt, we wouldn't have this documentation in the future.

Closing

Yes, I wrote this piece because the Super Nt press intentionally neglects my own work. And on that note, here's the bottom line: The Super Nt is not more accurate than higan is. And if you claim otherwise ... then I say to you, prove it.

This is also not to say that higan is more accurate than the Super Nt is! Only time will tell. And given the personalities of Kevin and I, it's extremely likely that the moment any issue is observed in either of our products, we'll be fixing it as soon as possible. And hopefully, helping each other with that.

But this truly isn't just about me: it's about the inevitability of seeing this claim that FPGAs are inherently superior in accuracy to software emulators repeated for more systems in the future if we don't set the record straight now.

The Super Nt is a fine product, produced by a fine engineer: but please stop with the grandstanding accuracy boasts. They're patently false, devoid of any evidence of said claims, and they're disparaging to the people doing the real work of preserving our gaming history.