You may wonder if you should use Micronctroller or FPGA for your next embedded application. It’s important to know the difference between the two.
Let’s have a look at this table for a brief comparison.
|Hardware Structure||MCU has a fixed hardware structure. It only offers the custom use of that hardware.||FPGA’s hardware structure is not predefined and can be altered based on applications.|
|Common Programming Languages||MCU program is often written in C/C++, and its execution is sequential on MCU.||FPGA program is written in VHDL/Verilog in the form of modules that work concurrently on hardware.|
|Portable Design||Easier to port designs between MCUs with C/C++ language.||No universal design method that is portable.|
|Computational Power||MCU is good at performing basic math operations but has low throughput.||FPGA is very fast for doing a lot of math operations. FPGA is preferred for time-critical signal processing applications.|
|Development Effort||Code development consumes less effort for MCU. Most of the libraries are available for different functions such as ADC, DAC, USB, UART, etc.||Code development consumes more effort compared to MCUs. FPGAs are not for beginners.|
|Flexibility||MCU is flexible only for reprogramming software.||FPGA is superior in software and hardware flexibility in customization.|
|Power consumption||MCU consumes less power and has a power-saving mode.||FPGA consumes high power due to a lot number of logic gates and does not support a power-saving mode.|
|Cost||With thousands of variants, the cost is low.||With fewer variants, the cost is high.|
Now let’s now have a look at the characteristics of each.
Field Programmable Gate Array (FPGA) Overview:
- FPGA is volatile as it does not have embedded flash memory for code. Therefore, external memory is connected to FPGA that holds the code.
- There is no CPU in FPGA.
- The program for FPGA is written in VHDL or Verilog.
- Programming is at the discrete component level, wiring up different gates.
- There might be hardcore processors in some FPGAs. This processor is built into the FPGA fabric, which can be instantiated in code.
- FPGA Design Flow:
Microcontroller (MCU) Overview:
- MCU has built-in memory for code storage.
- There is a CPU in MCU.
- The program is written in C programming.
- MCU contains various discrete hardware blocks such as timers, ADCs, RAM, oscillators, Communication interfaces, etc.
- MCU is less flexible than FPGA.
- MCU program flow:
Why one might choose FPGA over MCU:
If there are a lot of computations to do at once or in parallel, then FPGA is the better option.
Lots of math, especially multiplication
FPGAs are very fast for doing a lot of math operations because they can do multiple operations on every single clock cycle of the master clock.
A lot of Inputs / Outputs
FPGA usually has a lot of I/Os, so that several peripherals can be interfaced with FPGA.
Any unique protocol can be implemented, which may not be common in MCUs.
High Bandwidth Throughput
Many analogue data can be digitized, filtered, and processed quickly in FPGAs.
MCUs are cheaper than FPGA. A greater number of different MCUs available from different manufacturers compared to FPGAs.
MCUs are simpler than FPGAs; FPGAs are relatively complicated in terms of programming. In MCU, code is written in sequential order. It can easily be understood, whereas, in FPGA, code is written in parallel modules.
MCU has many built-in functions, such as USB, UART, USB, SPI, ADC, DAC, etc., which are useful in embedded projects. Whereas, in FPGA, either find a core and program that core into FPGA or write every function from scratch, which would take a lot of time.
Thousands of variants
There is an insane number of MCUs and each family of MCU has different variants.
MCUs are generally low power than FPGAs. MCUs can optimize power much better. For example, they can go to sleep mode, but FPGAs usually are not designed for low power consumption with sleep features.
How to choose between MCU and FPGA:
The following two steps should be considered while choosing the intelligent device for the project:
- List down all the requirements of the application project.
- Keeping in view the strengths of both devices, decide whether MCU will be the best fit for your application or FPGA.
Example no 1:
List of application requirements:
- Needs custom interfaces
- Lots of math with fast throughput
- Low power
- Cost of hardware is not the primary concern
In this case, FPGA is preferred for custom communication interfaces and lots of mathematical operations.
Example no. 2:
List of application requirements:
- Proof of concept required in 2 months
- Basic Math
- Low power
In this case, MCU is a better option that will take less development time and is cost-effective.
No wonder we see an abundance of MCUs in IoT applications such as wireless sensor nodes. IoT nodes are often battery-operated, need to be cost-effective, and need basic data collection, so the low power consumption and cost-effectiveness of MCUs make them an easy choice for IoT developers.
For any queries on the topic of Micro-controllers or FPGA Design, any consultancy on the subject, or any other Hardware Design related challenge in general, feel free to Contact Us for our consultancy. You can check out our other Technical Blogs on various topics or visit our new website Oxeltech.de to learn about our services and products.