Electronic – What are the differences and similarities between FPGA, ASIC and General Microcontrollers

asicfpgamicrocontroller

I have read this post and it does not answer my question in its entirety:

I think of a microcontroller as anything that has some memory, registers, and can process a set of instructions such as LOAD, STORE and ADD. It contains logic gates and such to perform its role, but its main task is to be a universal processor of bits. I think of a Microntroller as a system of interconnected ASIC designs to create the ability to store and process instructions.

I think of an ASIC device as a circuit that has been specifically constructed using logical and electrical components to perform one single task, with no other task in mind nor extra hardware included.

I think of an FPGA device as an ASIC device (a low-level device) + a bunch of unused stuff left over, used to implement a particular truth table.

Despite its name, an FGPA feels very "application-specific", since it must be rewired to perform a new and different task. This leads to confusion with ASIC. Albeit, in the case of rewiring an FPGA, all necessary hardware should be present. Also, FPGA's are meant to be programmable, but isn't that what a Microcontroller is meant for?

The post above I referenced also mentions HDL, with which I am familiar. Can't HDL be used for both ASIC and FPGA, and by proxy to design an entire microcontroller?

Best Answer

ASIC vs FPGA

A Field Programmable Gate Array can be seen as the prototyping stage of Application Specific Integrated Circuits: ASICs are very expensive to manufacture, and once it's made there is no going back (as the most expensive fixed cost is the masks [sort of manufacturing "stencil"] and their development). FPGAs are reprogrammable many times, however because of the fact that a generic array of gates is connected to accomplish your goal, it is not optimised like ASICs. Also, FPGAs are natively dynamic devices in that if you power it off, you loose not only the current state but also your configuration. Boards now exist though that add a FLASH chip and/or a microcontroller to load the configuration at startup so this tends to be a less important argument. Both ASICs and FPGAs can be configured with Hardware Description Languages, and sometimes FPGAs are used for the end product. But generally ASICs kick in when the design is fixed.

FPGA vs microcontroller

As for the difference between a microcontroller and a FPGA, you can consider a microcontroller to be an ASIC which basically processes code in FLASH/ROM sequentially. You can make microcontrollers with FPGAs even if it's not optimised, but not the opposite. FPGAs are wired just like electronic circuits so you can have truly parallel circuits, not like in a microcontroller where the processor jumps from a piece of code to another to simulate good-enough parallelism. However because FPGAs have been designed for parallel tasks, it's not as easy to write sequential code as in a microcontroller.

For example, typically if you write in pseudocode "let C be A XOR B", on a FPGA that will be translated into "build a XOR gate with the lego bricks contained (lookup tables and latches), and connect A/B as inputs and C as output" which will be updated every clock cycle regardless of whether C is used or not. Whereas on a microcontroller that will be translated into "read instruction - it's a XOR of variables at address A and address B of RAM, result to store at address C. Load arithmetic logic units registers, then ask the ALU to do a XOR, then copy the output register at address C of RAM". On the user side though, both instructions were 1 line of code. If we were to do this, THEN something else, in HDL we would have to define what is called a Process to artificially do sequences - separate from the parallel code. Whereas in a microcontroller there is nothing to do. On the other hand, to get "parallelism" (tuning in and out really) out of a microcontroller, you would need to juggle with threads which is not trivial. Different ways of working, different purposes.

In summary:

ASIC vs FPGA: fixed, more expensive for small number of products (cheaper for high volumes), but more optimised.

ASIC vs microcontroller: certainly like comparing a tool with a hammer.

FPGA vs microcontroller: not optimised for sequential code processing, but can do truly parallel tasks very easily as well. Generally FPGAs are programmed in HDL, microcontrollers in C/Assembly

Whenever speed of parallel tasks is an issue, take an FPGA, evolve your design and finally make it an ASIC if it's cheaper to you in the long run (mass production). If sequential tasks are okay, take a microcontroller. I guess you could do an even more application specific IC from this if it's cheaper to you in the long run as well. The best solution will probably be a bit of both.

What a quick search after writing this gave me: enter image description here enter image description here

FPGA vs Microcontrollers, on this very forum