Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
A generic potential user will eventually ask: Why do you need to use FPGA while other proven solutions exist such as Raspberry Pi?
There are debates how to call the process of simulating of real hardware in FPGA. Some people insist it's not emulation but real HW replica while any simulation on traditional CPU should be called as emulation. I have my own opinion here :) From my point of view, if FPGA code is based on a circuit of real hardware (with usual tweaks for FPGA compatibility) then it's called as a replica. Anything else is emulation since it includes different kinds of approximation. Currently, it's hard to find the core which can be called as a replica - most cores are based on more or less functional re-creation rather than real circuit re-creation. Most widely used CPU cores Z80(T80) and MC68000(TG68K) are pure functional emulations - not replicas. So, it's ok to call FPGA cores as emulators unless it's proven as replicas.
Go back, to the original question - Why FPGA if it's also just emulation? Well, FPGA emulation is fundamentally different than emulation on CPU. Traditional emulator on CPU executes the code sequentially. This is a tricky way of emulation because real hardware has many chips and all of them are working in parallel. CPU, Video chip/logic, audio chip, memory arbiter - all of them are working at the same time. So traditional emulator has to take care of all these parts and try to emulate the whole orchestra at the same time by quickly "running" from one chip to another. It requires a lot of CPU power to emulate even old and slow retro computer. Sometimes even modern CPU working on 100x speed of the retro computer is not enough, so emulator has to use approximation or skip emulation of some less important parts, or assume some standard work of emulated system without extraordinary usage. Let's take a well known UAE emulator emulating Amiga. On Raspberry Pi 3 you can run some Amiga CPU benchmarks and get crazy numbers like 100x of original 68000. So, you may assume you have an emulated Amiga which is 100x faster than real one. No, you don't. If you run different kinds of demo/games you will see the video is stuttering sometimes. For example, if you play "State of The Art" demo, you will notice video stuttering at some points while real Amiga 600 with 1x CPU speed plays the whole demo very smooth. This is how traditional emulators on RPi work.
FPGA emulation works very different from traditional emulation on CPU. FPGA is a large array of simple triggers and other logic. Exactly the same as all chips/CPUs. The only difference is that specific chip/CPU have such triggers/logic permanently connected while FPGA allows to connect them like you want. A special HDL language describes how to connect all these triggers/logic cells. Everything in FPGA works in parallel like in original chips/devices. Thus FPGA is pretty much close to original HW. FPGA doesn't need high frequencies to emulate retro computers, so it works at much lower frequencies than traditional emulators require. Since everything in FPGA works in parallel, there is no problem to handle any possible usage of the emulated system. Developers on FPGA usually concentrate on the specific part to make it work correctly - and it will work as it should in any possible scenario. In the same reference demo "State Of the Art", you can see a smooth video through the whole playback as on original HW.
You wanna ask: Why don't make all emulators on FPGA then? FPGA programming is not so trivial. Every bit in FPGA works in parallel, so the developer should think in parallel as well :). What is trivial on CPU, is not trivial on FPGA. Although some parts trivial on FPGA costs a lot in CPU code.