The main and the most significant difference between the microcontroller and the FPGA is that FPGA doesn’t have a fixed hardware structure, on the contrary it is programmable according to user applications. However processors have a fixed hardware structure. It means that all the transistors memory, peripheral structures and the connections are constant. Operations which processor can do (addition, multiplication, I/O control, etc.) are predefined.And users make the processor do these operations "in a sequential manner" by using a software, in accordance with their own purposes.
Hardware structure in the FPGA is not fixed so it is defined by the user. Although logic cells are fixed in FPGA, functions they perform and the interconnections between them are determined by the user. So operations that FPGAs can do are not predefined. You can have the processes done according to the written HDL code "in parallel" which means simultaneously. Ability of parallel processing is one of the most important features that seperate FPGA from processor and make it superior in many areas.
Processors are generally more useful for routine control of a particular circuits. For example, using FPGA for simple functions such as turn on and off any device from a computer may be overstated. This process can be easily done with many ordinary microcontroller (PIC series, etc.). However, FPGA solution is more reasonable, if you want to process on a high-resolution video data on the computer.
Because video processing requires processing large data in high speed and make these types of applications are very suitable for FPGA that is capable of parallel processing.
Since the user can determine the hardware structure of FPGAs, you can program FPGA to process larger data with few clock cycle.
Whereas this is not possible with the processor. Because data flow is limited by processor bus (16-bit, 32 bit, etc.) and the processing speed.
As a result, applications that requires more performance such as intensive data processing FPGA has come to the fore, and processor / microcontroller has come to the fore for routine control operations.
Nevertheless, processors / microcontrollers can be embedded into the FPGA since they are logic circuits in fact.
Thus it possible to define and use processor and user-specific hardware functions on only one chip by using FPGA. This solution gives engineers the oportunity to control the hardware because of its great flexibility.
You can modify and update whole design (FPGA on the processor and other logic circuits) by only changing the code on FPGA, without any change on circuit board layout.
In this way, you can add different functions, improve performance and make your design resistant of time without having to redesign the cards.
Thanks for your wonderful insight on FPGA and a Microcontroller.
Just a bit addition -
"" Since the user can determine the hardware structure of FPGAs, you can program FPGA to process larger data with few clock cycle."" ------ Not very convincing. A FPGA device will require many clock cycles but since these are clocked with a much higher clock frequencies in excess of 100MHz, the FPGAs offer the speed advantage over the controller.
"" Whereas this is not possible with the processor. Because data flow is limited by processor bus (16-bit, 32 bit, etc.) and the processing speed."" ----- Also, the speed of a micro or effectively the instruction execution rate (instruction per seconds) depends upon the architecture as whether the program memory and data memory share the same bus or a separate bus for each of them - the Von-Neumann and Harvard architecture.
If you want to build an embedded system or normal application which don't need speed or much memory, you should use Micro-Controller because it's suitable for your system. MCU is designed for specific application.
If you want to implement a DSP(digital signal processing) system which will process digital signals such as image, video, etc, you should use DSP or FPGA. FPGA is a programmabe logic devices, so the advantage is that you can control the hardware resources by coding, while Micro-controller cannot do that because of it's fixed in hardware. You can design your own system by using HDL languages on FPGA. Another point is that Micro-controller use C-programming, it means sequential processing, otherwise FPGA you can do pipeline or parallel processing, the processing speed is much higher. Memory resources on FPGA is much higher than MCU. That's why we use FPGA for this. They also designed DSP processor for DSP application. The choice is yours. You can visit the website to see the trade-offs between them.
"" Another point is that Micro-controller use C-programming, it means sequential processing,.... ""
Microcontrollers or Microprocessors DO NOT NECESSARILY USE C Programming. In fact, and TRUELY, all the resources of that device can be utilized using ASSEMBLY LANGUAGE. It is for the portability of the code (to make life easier for the SOFTWARE ENGINEERS OR THE PROGRAMMERS!!!) that has driven into wide-spread use of C-Compilers but that too against a COST!!! The C-Compiler (the Cross-Compiler) is just a Language Translator that finally converts the C-code into the HEX code of Assembly Instructions. As I understand, the instructions are executed in a sequential manner no matter whether written in C or Assembly.
@ Ali,
Coming back to your question as what parameters to be considered while selecting a Micro against a FPGA -
I shall start with "To know WHY MICROCONTROLLERS EXISTS?"" Kindly note the old (GRANDPA!!) style 8-bit revolution of microprocessors that had the processor chips but require all other chips such as ROM (Program memory), RAM (Data Memory), I/O Ports, Timers, and Communication peripherals as external chips. Thus "TO COOK" even for a simple 8-bit I/O requirement you would require "ALL THOSE INGREDIENTS".
Now, the technology got developed to fit all those in a single chip (THE SPICY CUP-NOODLES!!!) but with small size of program memory, RAM, I/O ports, and Communications etc. That gave birth to the Microcontroller devices. Ultimately a "Controller" is used that require small code size, few tens of bytes of RAM!!, and few other peripherals etc.
When the technology got even further developed, we felt the need of programmable devices to BUILD our own logic devices.
If you look at FPGA as a competitor to a Microcontroller, I think the comparison is not worth. As Loi and Amir has stated, the FPGA is used specifically for a large data processing applications to support the main processor particularly in video or image processing applications and to utilize its speed benefits. There are some IP cores available for a FPGA to demonstrate application as a PROCESSOR or a CONTROLLER but then you have to define your own instructions set and the instruction format, then compile the code and so on..... Therefore using a FPGA for the application that can be performed by a microcontroller is like buying a JET plane to go to a shop in your lane!.
@Prasana: I know it, just an example as we usually use C to program for MCU. of course, C-compiler will compile to Assembly and then, to machine code @@.
Never Mind Loi. It is not a question as what we know or we don't. But, I really use this discussion to know views of different people, help clearing ours (mine ofcourse!) doubts if any (read many!) and ultimately I use it during my classroom sessions to illustrate the concept/s to the students. You are most welcome!
thank you for your answers. I really learned many things.
as the last question;"" Is there any limitation about the working frequency if someone wants to do a simple application on a single frequency sine wave? For example suppose one needs to read an ac voltage drop on an element in a circuit and use that for some calculations. Is it OK to do that with micro-controller in any frequency range?""
@Ali: The Nyquist theorem states that a signal must be sampled at a rate greater than twice the highest frequency component of the signal to accurately reconstruct the waveform; otherwise, the high-frequency content will alias at a frequency inside the spectrum of interest (passband).
It means that the sampling frequency of your system (using MicroController) > 2 * highest frequency component (of interest) of the measured signal.
Satisfy this rule, it would be OK.
Please note that clock frequency of MCU is usually low. Thus, we generally use another specific ICs for Analog to Digital Converter, which use another clock source (sampling frequency).
Ali, The Nyquist Frequency is the BEAUTY for the BOOKS! In practice we need the sampling rate even higher, usually 10times the highest frequency component in your signal of interest. That said, you have to choose the ADC and the no. of bits of resolution you are looking for. This will determine the DEVICE (or the controller for that matter) speed. Usually the 8-bit micros are suitable for sub kHz frequency ranges. However, you have now Mixed-Signal-Controllers to go up to hundreds of kSPS. Still further you have DSP chips. Then even further you have your FPGAs and Flash ADCs etc.So you select where your signal fits in!
The ADC is eventually in the 100MSPS category but you can start with 50MSPS devices too!
As far as the Controller device is considered, pay attention primary to DSPs. I know TI has been, since many years, selling GHz DSPs. If you want the proof of concept and to trim your algo, I would suggest the ADC+DSP platform. Once you are freezed your firmware port it to a FPGA in case volume production is required. Pay attention to the costing and economics for bulk production. It is not just that one can use FPGA or a DSP for a better performance, but ultimately the reliability and product costs do matter a lot, probably become the governing factors at a later stage of development!
Prof. Aamir Habib has provided the detailed answer to the question.
Also, microcontrollers are bound by the architecture whereas FPGAs are not. The design developed by the designer can reconfigurable as many times as possible. The design synthesis produces the netlist that can program the FPGAs. Also, pipelining and parallel processing may be adopted in FPGAs to improve the throughput. However, this feature may not be possible with microcontrollers.
میکروکنترلر ها دارای CPU و جافظه های جانبی و … هستند ، میکروکنترلر ها برای کاربرد مشخصی ساخته نشده اند و هر طراح می تواند برنامه دلخواه خود را درون آنها برنامه ریزی کند ، منابع و دستور العمل های اجرایی یک میکروکنترلر مشخص همواره ثابت است در حالی که می تواند حاوی هزاران برنامه مختلف را روی خود جای دهد اما در مورد FPGA ها چنین نیست ، در یک FPGA هیچ CPU پیشفرضی وجود ندارد که شما عملیات های مورد نیازتان را با آن انجام دهید ، بلکه شما باید بلوک های مختلف مورد نیاز خود را در داخل FPGA پیاده سازی کنید و در نهایت از آنها برای رسیدن به نتیجه دلخواهتان استفاده کنید. به عنوان مثال برای اینکه بتوانید در FPGA چند عدد را جمع کنید باید بوسیله ی گیت ها یک بلوک جمع کننده طراحی کنید و از آن پس می توانید در سایر بلوک ها از آن استفاده نمایید.
FPGA ها به دلیل داشتن بلوک های منطقی خاص برای انجام هر عملیات و انجام پردازش های موازی ، با سرعت بسیار بالا عملیات های مورد نظر را انجام می دهد و از نظر سرعت و دقت نمی توان FPGA را با میکروکنترلر ها مقایسه کرد. از نظر هزینه اجرا نیز اغلب پروژه های FPGA گرانتر و هزینه بر تر از پروژه های میکروکنترلر هستند و در صورتی که بخواهید کارهایی را که با یک میکروکنترلر انجام می دادید با FPGA انجام دهید ، باید وقت و هزینه بیشتری صرف اجرا کنید از این رو معمولا FPGA و میکروکنترلر هر کدام کاربرد های خاص خود را دارند و به جای یکدیگر استفاده نمیشوند.
The main difference is about the need/application requirements. In microcontroller, all the components are predesigned. Whereas in FPGA, the user has to design.
Now if your application demands a certain specifications of any module which can't be satisfied by the existing design present in the available micrcontrollers, you can use FPGA and program it using VHLD/Verilog HDL language and design your own hardware system as pre your own specification so that your application can be successfully implemented.
Secondly, in microcontrollers the number of available modules are based with a view to cover lots of application areas. So it might be possible that you might use only a fraction of the available modules with the usage factor below 20%. This might waste the processing capability of the processor and you might end-up paying more than what is required as you are only using one/two modules and paying for all the available ones. Whereas in FPGA, you can design the module you require and save the space and cost.
Moreover you can also optimize your design as per your specifications if you use FPGA compared to microcontroller.
However, for designing using FPGA, you have to have the knowledge of all the VLSI design steps and its effects while designing. On the contrary, microcontroller is already optimized by the experts and we, as users, have only to directly write code for our applications.
So both the approach have their own advantages and limitation. Depending upon your applications, cost and expertise, selection between microcontroller and FPGA should be made for your destined applications.
FPGA can be used to implement in applications wherein parallel functionality is required eg. mux where output changes as select lines changes. FPGA's are programmed using hardware description languages.
On other hand, micro-controllers are programmed in embedded C or assembly language. The program written in these language are executed serially and do not support parallel functionality.
Using FPGA chip adoption across all industries is driven by the fact that FPGAs combine the best parts of application-specific integrated circuits (ASICs) and processor-based systems. FPGAs provide hardware-timed speed and reliability, but they do not require high volumes to justify the large upfront expense of custom ASIC design.