6 ms·
You are correct enough here. The interesting question is not how they are different, but what the advantages are. An FPGA is really good at doing a single task
by phamilton 8y ago
You are correct enough here. The interesting question is not how they are different, but what the advantages are.
An FPGA is really good at doing a single task a ton of times. A microprocessor is good at doing a lot of tasks a ton of times. And an ASIC is just a more permanent and more efficient FPGA.
So when would I use an FPGA? Let me describe an example: Stream processing.
Let's say I have a stream of data. Like a camera producing a video feed. As each frame of data comes in, we want to compare it to the previous frame and take the average of the two values to create a blurring effect.
On a microprocessor we process each frame. We iterate over groups of pixels one at a time, compare it to the value at the pixel in the previous frame and divide by two. Our processing time is a function of the number of pixels we want to look at. If we're lucky we have multiple cores so we can do work in parallel. Maybe even do 32 groups of pixels in parallel on a ryzen or something. But if we have a 1 megapixel image, we're going to still have to visit ~30k pixels sequentially on each core and perform some math. We're probably adding at least a few ms of lag on the feed. And if we're trying to do any multitasking on this cpu, then we may not have very predictable performance.
On an FPGA we approach the problem very differently. Instead of having sequential logic for visiting each pixel, we have combinatorial logic. Supposed each pixel came through on a different wire. That wire goes into a component that holds the previous value for the pixel and outputs the average of the current and previous value. We then take that output and rebuild the video feed with it. On a 1 megapixel image, our unit of work is a single pixel and we have concurrency of 1 million units. We add a cycle or two of lag, which is negligible. Additionally, we have very predictable performance because our computation executes in lock step with the system clock.
FPGA's are expensive (per unit cost) and aren't always the most efficient. An ASIC will drop per unit cost and power requirements significantly but has a large up front capital investment.
- mrob 8y ago>That wire goes into a component that holds the previous value for the pixel Wouldn't that need at least 24M flip-flops in the FPGA (assuming 8 bits per channel color)? I don't think anybody makes one that big.
- mojomark 8y agoAlso... >On a 1 megapixel image, our unit of work is a single pixel and we have concurrency of 1 million units. Wouldn't that require 1 million input wires into the FPGA? Otherwise, you could use fewer input wires, but the input signals would need to be multiplexed to allow multiple bit streams to transit a single wire - significantly reducing your concurrency.
- janekm 8y agoThat's a detail the parent clearly skipped for tldr. On the kind of large (expensive) FPGA you might use for that kind of image you will find what are called deserialisers and serialisers which are hardware blocks that can take a serial bitstream as may come from a camera module or dvi bus and split it up onto your parallel processing streams. The kind of small FPGA as is mentioned in the OT is typically used for "glue logic", that is performing relatively simple logic on multiple pins, often to adapt one hardware protocol (say mipi bus from a camera module) to another (say spi Bus understood by a cheap micro controller).
- btashton 8y agowhat was written is clearly a simplification, but outlines the high level architecture differences. Say you want to do this with a 10 megapixel image, clearly you are not going to fully parallelize that, but you could load the whole thing into BRAM divide it up into 100 regions and itterate over that. This also ignores that most FPGAs are not just a pile of flip-flops you wire together, but instead have a whole pile of specialized blocks in addition to look-up-tables.
- oger 8y agoXxg X
- KSteffensen 8y agoAlso, ASIC can usually run at higher clock frequencies than FPGA's