CPU kontra FPGA – różnice w podejściu i zasadzie działania

Naskrobałem krótki tekst po angielsku, w którym nakreślam różnicę w używaniu i działaniu układu FPGA w porównaniu z klasycznym procesorem. Nie znalazł się on tam, gdzie miał początkowo trafić, więc umieszczam go tutaj – być może komuś się on jeszcze kiedyś przyda.

FPGAs are a superset of CPUs. It means you can use FPGA like a CPU, but you can’t use CPU as a FPGA in a effective manner. Strictly speaking, FPGAs don’t process any instructions at all and aren’t programmable. A quick summary of comparison:

                     |    CPU     |    FPGA    |
|                    |            |            |
| Internal structure | Immutable  | Mutable    |
|                    |            |            |
| Program            | Read from  | Defined by |
|                    | memory     | structure  |
|                    |            |            |
| Input data         | Read from  | Read from  |
|                    | external   | external   |
|                    | sources    | sources    |
|                    |            |            |

Now, the details.


Once a CPU is manufactured, its internal structure is strictly defined. The structure defines its behavior: it will expect some program in a recognizable bytecode to be provided and will execute it. It’s one chip for all purposes – whatever you tell it to do, it will do it by sequentially processing your instructions. This is called programming: to program is to provide a list of instructions to be executed sequentially. No matter what program you provide, CPU always stays the same.


Once a FPGA is manufactured, it doesn’t have any internal structure. You are the guy who designs it. Out-of-the-box FPGA is like a box of Lego pieces. Each has its typical application, but they make no sense unless you build them into a larger structure that can receive, process and output data. But then, it doesn’t receive instructions, it receives data and processes it in an already defined manner. There’s no program involved, there’s only internal design. Programmed FPGA becomes a regular integrated circuit designed for specific application – with the only difference that you can reprogram it into a different specialized IC.


Think of a factory that makes defrobulators. To make a defrobulator, you have to take a bifrobulator, attach a gizmo and connect a widget.

The CPU way: You hire a guy that can do virtually anything you tell him to. You give him necessary parts and provide him with the list of tasks. He will take the bifrobulator, attach a gizmo to it, then connect the widget, take next bifrobulator and so on. There’s only one guy that can do all the tasks and you tell him what actions to perform sequentially on what items. You can also tell this guy to first get ten bifrobulators, then attach one gizmo to each and finally connect widgets – still sequentially.

The FPGA way: You hire one guy who can attach gizmos to bifrobulators. Then you hire second guy who can connect widgets to bifrobulators. Finding them and settingsin place takes some time, but then both guys are specialized to do specific tasks and work simultaneously; the first guy can start to assemble next defrobulator instantly after he passes the first one to the second guy. Both guys don’t know each other and don’t know what the other one’s dutys are, they just do their job.

Why use CPUs?

Because they are versatile and you don’t need additional time to program them. Besides, some things have to be made sequentially or are easier to implement that way.

Why use FPGAs?

Because they are better in continuous data processing – interpreting an instruction on CPU takes time too and this is not the case on FPGAs as there are no instructions, data flow is already defined.


As I said at the very beginning, inside a FPGA you can design anything that’s made of logical gates, including a CPU. Using CPU to emulate FPGA is theoretically possible, but completely ineffective.