Author Topic: How FPGA works?  (Read 1458 times)

0 Members and 1 Guest are viewing this topic.

Offline vorob

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
How FPGA works?
« on: May 07, 2019, 04:30 PM »
Hi! Can anyone explain in simple words how it is possible? So there is an empty chip that can do many things but has no instructions. And then you flash these instructions via software method and this empty chip can play as anything you like?

Second question, how people get information which you need to flash into FPGA? Do they reverse engineer original chip? Layer by layer? Or its just BIOS dump?

If I'm still correct, it sounds pretty simple. Can I, for eg, take VooDoo 3Dfx BIOS, flash it into FPGA chip, put in on board with HDMI and its related components and had a modern 3Dfx card? Same for Pentium 1 MMX and I'll have a tiny retro pc for windows 95 games?

Or maybe I can flash there Sony PlayStation 1 BIOS?
« Last Edit: May 07, 2019, 04:32 PM by vorob »

Offline nuu

  • Hero Member
  • *****
  • Posts: 1250
  • Karma: +58/-2
    • View Profile
Re: How FPGA works?
« Reply #1 on: May 08, 2019, 04:18 AM »
I don't know the details but, digital electronics works by a series of logical gates known as AND, OR and NOT (plus a few more derived ones). These gates are in turn built by simple components like resistors and transistors. The gates are the most basic part of digital electronics and using a combination of them you can build all kinds of digital machines like counting machines, digital timers and computers among many other things. FPGA (which is a type of "programmable logic") is an array of such gates that can be "programmed" into any type of the basic gates using a special device. So instead of building a machine out of gates on a circuit board, you type the description of a machine you want to make in a special language on a computer and feed the FPGA this program, and it becomes this machine. Then you can feed it another program and it becomes that machine instead. Because of that, a flashcart can become many types of cartridges by just reprogramming itself when a game is loaded that requires a specific type of cartridge.

So what is the difference between programmable logic and normal computer programming? A CPU is a digital machine (built out of logical gates) that is designed to read instructions, one after another, in a program and execute them. Using such instructions you can do all sorts of things, but it's much slower than if you build a machine out of gates that is dedicated to do the same thing. All the devices inside a gaming console for example are dedicated machines that all run at the same time in parallel as they are designed. If you emulate the console on a computer (which runs on a CPU) for example, your emulator must simulate each and every one of these devices, but since a CPU only can do one instruction at a time, you can't run the machines in parallel. Instead you can make sure the computer is much much faster than the console it emulates and runs every device simulation one step at a time. The CPU is so fast that the user will normally not notice that everything runs in a series and doesn't work the same as the real console. If done in an FPGA instead, you can build each device in the programmable gates, and they will run in parallel just like the original device.

In other words, for a machine that is replicated in an FPGA and emulated on a CPU, the FPGA version is much faster than the emulator is, and potentially 1:1 to how it would be by building the machine.

There are several levels of abstractness of programmable logic though, depending on how much control you need when you program it. If you truly want to replicate a device in programmable logic, you can program it in the lowest level with no abstraction so that you have full control of what every single logic gate is going to be. This also means it is harder to do, so if you are making something where performance isn't that important you write it on a higher abstraction level that speeds up your work in trade of control and possibly effectiveness of the device.

Offline FeverDrive

  • Hero Member
  • *****
  • Posts: 1244
  • Karma: +53/-0
  • Blast Processing™ inside
    • View Profile
Re: How FPGA works?
« Reply #2 on: May 08, 2019, 07:10 AM »
If I'm still correct, it sounds pretty simple. Can I, for eg, take VooDoo 3Dfx BIOS, flash it into FPGA chip, put in on board with HDMI and its related components and had a modern 3Dfx card? Same for Pentium 1 MMX and I'll have a tiny retro pc for windows 95 games?
It's not that simple, believe me.
We must embrace pain and burn it as fuel for our journey.

Offline nuu

  • Hero Member
  • *****
  • Posts: 1250
  • Karma: +58/-2
    • View Profile
Re: How FPGA works?
« Reply #3 on: May 08, 2019, 06:41 PM »
Second question, how people get information which you need to flash into FPGA? Do they reverse engineer original chip? Layer by layer? Or its just BIOS dump?
Reverse-engineering and/or understanding how it works on a logic level is necessary. A BIOS is a CPU program, you can't put it on an FPGA like that. Of course if you design a certain CPU and put a compatible BIOS on a ROM chip the CPU may be able to run the BIOS.


If you read and understood my post I think you can answer most of those questions yourself. You don't take a chip and "flash" it. You design it from scratch in a special language, not simple at all.

Offline InnerCircle

  • Gamma Irradiated
  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: How FPGA works?
« Reply #4 on: July 20, 2019, 08:11 AM »
An FPGA can be seen as a “bag” of blocks which implement simple digital functionality (gates, flip-flops, multiplexers…) or, in more complex and expensive FPGAs, which implement high-level digital functions such as digital signal processing blocks. Inside the FPGA there is also an infrastructure of programmable interconnections which are used to link the FPGA blocks in order to “build” the proposed digital project. The circuit designer describes his/hers project in Verilog or VHDL most of the times, using the tools of the FPGA vendor (often provided without cost) and that circuit description is “hardware compiled” to a bit file consisting of the bitstream which is downloaded to the FPGA internals (in fact, to a long internal shift-register) . “Et voila,” you have your digital circuit built in a fashion similar to a Lego construction :-)

Offline Davestra

  • Newbie
  • *
  • Posts: 49
  • Karma: +0/-0
    • View Profile
Re: How FPGA works?
« Reply #5 on: January 21, 2020, 09:33 PM »
I see. Definitely learning a lot from this thread. Thanks for the info, fellas!