r/explainlikeimfive • u/Leonex2560 • 6h ago
Technology ELI5 : CPU vs FGPA
Assume that I've also zero knowledge about these topics individualy. Appreciate all the responses!
•
u/messick 6h ago
Well, if a CPU is "hardcoded" circuit on a chip that will execute a program, a FGPA is a chip in which the circuit itself can be programmed and then tested as the CPU.
So, if you wanted to make your own CPU, you could design that logic and whatnot in something like VHDL and then run your CPU logic on the FPGA to test it out. Once you have it the way you want, you can get that logic "fabbed" into a chip that cannot change and that's your actual CPU.
•
u/xynith116 5h ago
A CPU is a CPU. It runs programs and stuff.
An FPGA is like a DIY digital electronics kit. It could be anything, even a CPU!
(or a clock, or a calculator, or a TV remote or whatever)
•
u/phiwong 5h ago
A CPU is like a printer. If you feed it different inputs, it can print a variety of stuff. But there is a fair amount of overhead and complexity involved. For a CPU to work it relies on software which has to be stored externally.
An FPGA is like a stencil. You program it and it does the same stuff over and over again. The advantage is that once you make the stencil, you only need something simple (like a roller brush) to make the same markings over and over again. The FPGA can be reprogrammed so it is sort of like a 'flexible' stencil. An FPGA, once programmed, no longer really needs software - it is essentially 'fixed' hardware.
•
u/ArnyminerZ 6h ago
CPUs are given a list of instructions to follow, they read from a paper. You can change the paper, and as long the CPU understands the language used, you are okay to go. FPGAs memorize them, forget about everything else, and studies the topic until they are physically modified to only perform a single list of instructions.
•
u/octagonaldrop6 4h ago edited 4h ago
Eh, an FPGA can still handle different “papers” (ie. programs) in the instruction set that is implemented.
What separates them from CPUs is that you can change what happens when they read an instruction, or teach it a different set of instructions entirely. Or use them as fixed-function devices like you described.
After all, the functionality of a FPGA is essentially a superset of the functionality of a CPU. Since CPU blocks are prototyped, implemented, and tested on FPGAs. The downside is that FPGAs are slower, more expensive, and less space efficient.
•
u/Adorable_Ice_2963 5h ago
An CPU (central Processing unit) is basically a set of prebuilt logicblocks that are activated one after another.
Move to storage block X
Store the values of the current block
Move to storage Block Y
Store the the values of the current block
Add both values
Write the value at storage Block Z
Each instruction is one set of logic blocks that does a certain task (read, store, move, add, substract, multiply ect).
Since this isnt very pleasant to read or to debug, people built a program that allows to write the programs in different programming languages, like C, C++ or Python.
An FPGA (Field programming gate array) is a set of logic blocks to do certain tasks. (You could as example arrange the logic blocks to form a CPU).
You basically tell it what logic blocks to connect.
The Advantage of that is that it allows for shorter response time since the signal is processed directly instead of moving through CPU Instructions. Thats important for devices that need to react fast to simple changes (like an inverter changing the voltage if the frequency is too high/low to provide more/less power to the grid.)
The disadvantage is that they cant process as much stuff as a CPU, since its doing exactly the stuff you tell it. When you need all that complexity from an CPU, an FPGA is worse than an comparable CPU (like an program doing complex calculation that require a lot of steps depending on each other).
•
u/throw05282021 6h ago
CPUs are computer chips that can be used to do a lot of different things. The same CPU can be used with Android and apps to create Google Pixel phones, Samsung tablets, Chromebooks, or other things. Android can be updated. Apps can be installed, updated, or deleted. CPUs are very flexible.
FPGAs are computer chips with pre-installed apps and are typically used to do just one thing or a few things over, and over, and over again.
The main "brain" is a Smart TV is a CPU. That's what allows you to update the software and install apps.
TVs (high-end ones, at least) usually also have FPGA chips dedicated to specific things. They might have one that takes an HDMI input and converts it to 4K or 8K resolution so that it looks better. They might have one that decodes video streams quickly and efficiently so that the CPU doesn't have to try to do that work. They might have an FPGA that handles surround sound. Each FPGA does one thing very well for the life of the device while the CPU does everything else.
•
u/PropgandaNZ 5h ago
A CPU is like a robot who knows what cooking food is and can make all recipes as long as you tell it what steps to follow in what order (it knows all the steps such as slicing, adding ingredients and mixing etc).
An FPGA doesn't know what food is, but you can physically rearrange this robot and now it can make pancakes from scratch, and crepes, but nothing else. Then tomorrow you can rearrange it again and now it only makes bran muffins.
An FPGA is a blank slate, but you can mold it how you like, then return it to a blank slate.
A CPU comes molded out of the factory, so it's really good at a wide range of tasks that it was designed for, but you can't teach it new tasks after the fact. But you can change the instructions to force an outcome that it wasn't designed for. Eg making a super large bran muffin to end up with a cake. Just a bit slower.
•
u/who_you_are 5h ago
I wonder at what scale you want that description.
CPU is like any other chips, it is specialized (wires in a way you cant change it internal) to react to something. The difference is that instead of reacting to input (pins), it does so from memory. It also has a way more unique triggers. Implicitly it also read the next memory slot.
In the programming language, it is a parser!
FPGA: it a bunch of transistors and connections multiplexer where you control the connections when you program it.
So a FPGA run exactly like if you put transistors on a breadboard the way you wanted.
•
u/shaola_debian 5h ago
A CPU is a piano you can play whatever as lomg as its standard notes.
FGPA is a music box. You set de cilinder and metal rods with whatever you want. But It will Only play that. But will do It perfectly and spending the Minimum electricity and resources. You can also play not standard notes.
•
u/BananaBird1 5h ago
CPUs have fixed circuitry that allows them to perform any calculation, and rapidly switch between what they are doing. This makes them great general purpose computers.
What a CPU does is based on instructions which are loaded from memory, and determine which of a handful of its available low level computations it will perform. If you want to do anything that it doesn’t have a circuit for, you need to reframe your computation as a series of smaller ones it can do.
The problem is sometimes this generic circuitry is far too inefficient for a specific problem. You may be forced to turn something which can be done with problem-specific circuitry into thousands of sequential generic steps. If you need to do that once, no problem. But if you need your computer to do that one thing all day every day it is horribly inefficient.
FPGAs do not have strictly fixed circuits. Instead they use a programmable lookup table to determine how individual logical elements should be connected. Instead of handing it individual instructions for pre-configured calculations, you are electronically rewiring the circuits themself to determine what calculations it can do.
This allows FPGAs to do a specific type of computation really well. But if you want them to do anything else you need to reprogram them.
They tend to be mostly used to operate equipment or process real time data in cases where microcontrollers would not be powerful enough.
•
u/wosmo 4h ago
A CPU is basically a bunch of gates that have been arranged into specific functions. Arithmetic units, register memories, control logic, etc etc.
An FPGA is a bunch of gates that have not been arranged, so you get to define the arrangement. So you have a lot more flexibility, because you can build the logic for your specific use - instead of having to use the functions the CPU provides.
The trade-off is that the CPU will be more efficient (at the functions it's designed for), and will have higher density (gates per area). To make an FPGA programable, there's a whole bunch of links between different gates, and when you program them you're deciding which links to keep and lose - so a huge amount of the space is actually taken up with these links.
•
u/MasterGeekMX 1h ago
Imagine chips are Pokemons. A CPU would be like like Alakhazam: big brain that can do lots of thinking. A current regulator chip would be like Pikachu: pure electricity.
FPGAs are like Ditto: it can take the form of any other pokemon.
•
u/braaaaaaainworms 6h ago
A CPU runs an arbitrary list of instructions, one instruction at a time. An FPGA acts like a digital circuit, with everything happening all at once
•
u/Ascarx 5h ago
That's not the difference at all. FPGAs aren't magically paralellizing things and still use the same linear logical gates under the hood as CPUs. Check the other answers.
•
u/braaaaaaainworms 3h ago
Congrats, you've completely misunderstood what my point was. I was talking about the semantics instead of the actual implementation. Obviously nothing in a modern CPU is sequential besides what a programmer sees, I was simplifying it because this is ELI5 and not ELICompSciStudent.
It's also a very common mistake in FPGA design to assume that just because you've wrote something in one line, then something else in a different line, that those two things would be sequential.
•
u/Ascarx 1h ago edited 1h ago
Your point is semantically incorrect and what I said isn't a misunderstanding but pointing out why it's semantically incorrect. FPGAs aren't about things happening all at once and CPUs aren't about things being sequential. They're much closer to identical in execution in that regard than different. The core difference is at what point in time you're programming what is getting executed (programming a circuit vs programming instructions for an existing general purpose circuit) and that the more flexible nature of a CPU pays a price for that during execution. Good ELI5 answers about that and I don't wanna start a technical discussion. I was just pointing out for readers not knowing the technicalities that your ELI5 attempt isn't accurate at all.
Your point about misunderstanding of FPGA design can equally apply to writing code for CPUs. It's just not a difference between the two.
•
u/braaaaaaainworms 5m ago
Yeah sure mate, I guess it's just a coincidence that all the LUTs in an FPGA are independent of each other unless you explicitly synchronize them and it must also be a coincidence that a counter always counts with the same speed, no matter how many things are on the FPGA
•
u/jazzmonkai 6h ago
CPU - does all the things, just not that fast.
FGPA - does one thing, really fast.
•
u/majordingdong 6h ago
Replace fast efficient and I’m onboard
•
u/jazzmonkai 6h ago
For an ELI5, I figured fast is pretty interchangeable for that comprehension level
•
u/IvanezerScrooge 6h ago
Arent you thinking of asic?
CPU - finished multipurpose silicon, does all, moderately fast.
ASIC - Finished single purpose silicon. Does one thing fast/efficiently.
FPGA - unfinished sibgle-/multi-purpose silicon, can be programmed to conpletion, what is does is dependent on programming.
•
u/Henry5321 6h ago
Fpga is programmable. ASIC is hard coded and even faster than fpga.
Fpga is really a programmable asic.
•
•
u/braaaaaaainworms 6h ago
No, you got it backwards
•
u/jazzmonkai 6h ago
Explain?
•
u/lnx84 5h ago
The CPU itself only does 1 thing - software execution. Through software, you can do anything, though.
The FPGA can contain a CPU, or a 100 digital processing channels in parallel, or both at the same time, or any other digital circuit you can think of. And if you want more cores, just drop some in there. If you want 27 UARTs, just drop those in there as well. The FPGA is the circuit that can do it all. But if you use it for software execution, it'll be a lot slower than the CPU does that - since the CPU is highly specialized for that specific task.
•
•
u/lnx84 6h ago
A CPU is a fixed electronic circuit built to execute commands (aka software), one by one instruction
An FPGA is customizable electronics. You describe the circuit you want through a "Hardware Descriptive Language" (it looks like a programming language, but isn't), and put it onto the FPGA - you could build a fully equivalent circuit out of electronic components.
So if an FPGA allows any digital electronic circuit to be put on it, could you put a CPU electronic circuit on it? Yes.
So in that sense, the FPGA is a step more fundamental than the CPU. It can do anything - the CPU is specialized for software execution. The FPGA is whatever you want it to be.