Jan 1, 2023

Microprocessor, Microcontroller or FPGA : Which One to Choose and Why?


FPGA, Micro-controller and Microprocessor are the most powerful tools for an embedded system Design. All three are the programmable devices. Most of the consumer electronic products are designed with them. 

In this article we will do a comparative study about all these three programmable devices  and will try to understand which one is used in which scenario.

Let's understand what are  Microprocessor , Micro-controller and FPGA. Here we will start with Microprocessor.

I. Microprocessor :

Microprocessor is an electronic integrated circuit that works as a CPU alone. This is the basic controlling unit and works as the brain of the system. No other peripherals such as RAM, ROM,input or output slots are integrated with it. 

Microprocessors understand machine code. but they will require a higher level programming language such as "C" or "Assembly" to write the program. The “vocabulary” of instructions for any microprocessor chip is  specific to that model of chip. 



Fig 1. Microprocessor

An Intel 80386 and a Motorola 68020 uses completely different set of binary codes for equivalent functions.         

Advantages :

1. Present day processors have amazing speed and cheaper in cost. 

2. They are small and Compact in Size work with 100% accuracy provided the input is proper and accurate. 

3. Multicore processors are available in market which is incredibly faster and cheaper. 

4. Modern Processors are built with Artificial Intelligence and with latest technology. They emits less heat and energy and so no need to take any excessive measure to make it cool.

5. Processors are built with GUI (Graphical User Interface) which make them user friendly.

Disadvantages : 

1. Microprocessors are bound to makes mistakes ,if the input is  incorrect or improper. 

2. Improper electric current and supply can damage the Processor.  

3. The Single Core Processors are slow and not suitable for heavy software or applications.

4. Most of the microprocessor does not support floating point operations.

5. Microprocessors require machine level language.


II.  Microcontroller :

A micro-controller is an IC that contains a microprocessor and some peripherals like ADC, RAM, ROM, DAC to be a complete functional computer.

                                Fig 2. Micro- contoller

programming a micro controller involves, writing a program code in C, compiling the code in a Compiler, uploading the compiled version of the program to the micro controller.

Advantages :

1. Micro controllers are simple to program.

2.  They are the best for a simple and hardware specific application. That is if only limited hardware is required. 

3. Micro controllers are cost effective than FPGAs.

Disadvantages :  

1. They can perform limited tasks because of limited instruction set. 

2. A Micro-controller  can perform only the pre-loaded instructions.  

3. They performs sequential processing i.e. one instruction at a time. 

4. Hence programming using interrupts (ISR) becomes complex.  

5. Designer can utilize only the hardware available on the board. 

III. FPGA :

The third programmable device in our list is FPGA. FPGA is Field Programmable Gate Array. FPGA is an integrated circuit that can be programmed on the field to work as per the required design. A FPGA typically contains thousands of Configurable Logic Blocks (CLBs) embedded with a lot of programmable interconnects. The CLBs are made of Look-Up Tables (LUTs), Multiplexers and Flip-Flops. They are programmed to implement complex logic functions. FPGAs also contain dedicated  hard-silicon blocks for various functions such as Block RAM, DSP Blocks, External Memory Controllers, PLL and many more.


                                     Fig 3. FPGA

FPGA programming is comparatively complex than that of a Microcontroller. It requires specialized software such a Xilinx, Intel Quartus. FPGA is programmed using Verilog or VHDL and System Verilog is usually used for verification. 

FPGA programming involves below steps : 

                              Fig 4.  FPGA Programming

Advantages:

1. In FPGA the hardware itself is programmable. New hardware or logical functions can be programmed by altering the programmable blocks in the FPGA by installing a new FPGA firmware.

2. FPGA does not have a fixed instruction set.

3. They process instruction in parallel processing. This capability of FPGAs allows user to control the interrupts effectively by using Finite State Machines (FSMs).

4.Trial and error method is possible in FPGA. This allows a steep learning curve.

Disadvantages : 

1. Configuring FPGA is complex. 

2. They consume more power than a Microcontroller .

3. For a simple application, FPGA can be bulky and costly.

4. Since there is no internal oscillator, clock  has to be provided from an external source.


Microcontroller  vs. Microprocessor : 

1. Microprocessors based systems becomes bulky due to presence of peripherals whereas in a  microcontroller peripherals are in-built and   available on a single chip.

2. Cost of Microprocessor based system is on higher side compared Microcontroller based system.

3. We can connect external memory in ranges of Mbytes/Gbytes with an microprocessor when the applicaton demands high memory although the trade off is lesser speed.  The inbuilt finite memory in micro-controller improve the speed of the operations.

4. Microprocessor is not suitable of compact systems whereas  Micro-controllers are.  

5. In a microprocessor presence of external components results in higher power consumption. Therefore, it is not ideal for the devices running on stored power like batteries. Micro-controllers are suitable for such application due to less power consumption.

6. The microprocessor is useful in Personal Computers whereas Micro Controller is useful in an embedded system.

So when the application is low-computational and specific,  micro-controller is preferred.To keep the overall cost on lower side, micro-controller is better. Micro-controller is easy to debug and design. Firmware used to program a micro-controller is easy and  Open source libraries are available to program a controller. 

Microprocessor requires an Operating system as in a computer.If the application is extremely complex and requires a special central control unit, microprocessors are preferred. 


FPGA  vs. Micro-controller : 

From our previous discussion its clear that consumer specific projects which require customization FPGA or Micro controller is preferred. 

Now lets do a comparison of  FPGA and Micro controller.

1. Micro controllers are programmed using an assembly or a high-level language which is converted to machine code for execution on a CPU. FPGA programming is more complex compared to micro controller programming.

2. FPGAs can execute multiple instructions at the same time i.e. in parallel form. This is a big advantage over micro-controllers, which can only execute one instruction sequentially. So FPGAs are typically much faster at processing tasks. 

3. Any digital circuit can be designed on an FPGA, provided the chip contains a sufficient number of logic blocks to emulate the design. Micro-controllers do not offer such flexibility. This is because there is no way to alter the chipset in a micro-controller to suit an application. So FPGA offers more design flexibility.

4. FPGA is costly compared to MCU.

5. FPGA is basically a single-chip solution to a application or design requirement. Micro-controllers must interface with other peripherals which might not be in-built. 

6. Most FPGA boards are powered by a 48V backplane. This high-power requirement of FPGAs make them unsuitable for several applications. Micro-controller boards usually require a 5 or 3.3-V supply for operation. SO they are the obvious choice for the design of any battery operated, portable embedded device.

7. In general, most FPGAs have several pins. Therefore, these chips are not ideal for small spaces or constrained embedded applications where the computing processor or controller must be compact. In contrast, there are many Micro-controllers with eight pins or less, which easily fit in  small devices.

If the design requires complex logic and requires high processing ability and if the cost is comparable to the performance achieved, FPGA can be used. In case of a design that requires limited hardware, and is set to perform only some specific functions, then Micro-controller is preferred. There is no specific criteria to select FPGA or Micro-controller. Each has its own pros and cons. So which one to choose depends on design requirement , cost etc.   

Find the video lecture here :





     




Courtesy : Image by Maxence Pira on unsplash