XaiJu
JOTEGO
JOTEGO

patreon


Emulators inside FPGA cores!

(español abajo)
We are all in here because we want accuracy. We want no lag. We want the original speed. We even want the original glitches! And FPGA is the technology that provides it. FPGA allows you to make digital hardware at an affordable price. But what if I told you that you have used an emulator without knowing!
Here's the deal: you can fit any kind of circuit in an FPGA and that includes of course CPUs. We are used to having Z80 and 68000 CPUs synthesized inside. But some cores out there have invited an extra Z80. What for? It runs a Yamaha OPL3 emulator. Yes, there is an emulator inside some cores!
Of course, an emulated Yamaha OPL3 is better than no Yamaha at all. But can this work? Well, as long as it keeps the interface of the original chip, the rest of the system will not notice it. If the CPU speed is fast enough and the emulator code is written with care, you could get virtually identical input and output signals in the interface to those of a hardware implementation. Is that the case for the OPL3 core? I don't think so.
The OPL3 uses MAME's source code for OPL3. This code does not process signals in the same way as the original hardware and will have different output delays and glitches than the original. Not only that, but there is also a queue for commands that arrive to the OPL3 so the Z80 will not miss them when it is struggling to catch up. So commands will not be processed at the same time than in the original hardware.
Don't take me wrong. I think the author of this sound core made a very good engineering job. He put something together very quickly. And it works. But even if this core was achieving correct input and output signals at the right time... I would still prefer to have a hardware solution. But maybe that's just me.
(español)
Te compraste tu FPGA. Le has dicho adiós a la emulación. Eres el más chulo del barrio. Pues no. Te han dado por gato liebre. ¡Mamá, hay un emulador en mi FPGA!
Pues sí, algunos cores que hay por ahí tienen dentro una CPU invitada por la puerta trasera: un Z80 cuya misión es ejecutar código de MAME. ¿Cómo lo ves?
Esto viene de que alguien queria tener un OPL3 y pensó que la manera más fácil era compilar el código de MAME para Z80 y meterlo en la FPGA. Es una solución rápida y no es tan sencillo como parece. Creo que es un buen trabajo de ingeniería pero, a mí me falta algo con eso.
Y es que aunque mantiene la interfaz eléctrica con el resto del sistema, por dentro funciona muy diferente. Aparte de lo obvio, hay dentro una cola de comandos. Cuando el sistema escribe datos al OPL3 este los guarda en una cola y los va leyendo conforme el Z80 puede porque... no le da la vida para más.
Resumiendo, es un buen trabajo de ingeniería y esta técnica puede resultar útil si se emplea con más atención a respetar los tiempos. Pero aun así, yo me sigo quedando con la solución hardware. Llamadme romántico.

Emulators inside FPGA cores!

Comments

Which cores use this OPL3 emulation?

rsn8887

it might be fun to have a wavetable synthesis like Aztech sound cards running on Windows 95 for Packard Bell. That wavetable made duke nukem song really powerful.

Jordi

The only exception I might approve of would be implementing a nice sample-based MIDI tone bank in an FPGA-ized CPU for pairing with relevant computer cores that supported using external MIDI devices for superior game music and/or composition software. x86, AtariST, and Sharp X68000 all come to mind.

Keith F. Kelly


More Creators