1630 Views

FPGA vs. Microcontroller, what to choose?

18/01/2021, hardwarebee

This article provides a comparison between FPGA vs. Microcontroller. We did the comparison between FPGA vs. Microcontroller by looking into their differences and similarities in terms of architecture, cost, performance, application, programmability technology, power consumption, processing capability and usability in the real-time world.

 

FPGA vs. Microcontroller

 

FPGA and Microcontroller both are hardware devices. They are developed to serve the embedded system market, where software and hardware work together to facilitate the overall functionality of the design, e.g. to solve the problem. FPGAs are intended to solve more complex problems than the microcontroller, for example: signal and image processing problems, like video compression,  where it requires more computational power to process the data in real time. FPGA tasks also involve solving the problem with the best possible time along with the minimum consumption of the resources and power. Whereas, Microcontroller due to their inherited hardware fixed architectural nature which is bounded to have a fixed Instruction Set Architecture (ISA) would not able to process the data beyond its limit. However, FPGAs due to their flexible architecture can process the data and do computation because of having a flexible programmability nature that can control the hardware resources putting FPGA a unique platform to perform embedded system tasks.

 

We can discuss the similarities and differences between FPGA and Microcontroller as the following:

 

Architecture

 

The first major difference between FPGA and microcontroller is related to its hardware architecture. The microcontroller is based on a fixed building blocks that cannot be changed. It’s a fixed hardware architecture that is based on the instruction set architecture (ISA) as shown in Figure 1. The ISA is fixed for each microcontroller, the programmer cannot initiate any instruction out of the ISA. The central processing unit of the microcontroller is the typical processor whose job is to execute the instructions sequentially. Microcontrollers are supported by the GPIOs along with timers and memory elements e.g., RAM/ROM. The modern microcontrollers are also equipped with USB interfaces, PCI interfaces for external data communication.

 

Figure 1: Microcontroller Block Diagram (source: Renesas)

 

FPGA architecture is very different than microcontrollers FPGA hardware architecture is based on a “sea of gates”. It involves Look-up-Tables (LUTs), Configurable Logic Blocks (CLBs), routing elements, switch matrix between the CLBs, and Input/Output Block as shown in Figure 2. This means that an engineering can program can use this flexibility to design any digital block required to fulfil any requirement.  FPGA architectures is flexible by default.

 

FPGA Architecture

Figure 2: FPGA Architecture

 

The central processing element of the FPGA is a Look Up Table (LUT) which is designed in a way that it implements any fundamental combinational logic gates e.g., NAND, NOR, OR, AND. All these basic gates can be implemented via LUTs.  Being a student of digital logic, you should know that if you can implement any basic logic gate (nand, nor, etc), you are good to have the functionality of any combinational circuit. Then with the help of a flip-flop, the LUT can be used to implement any sequential logic as well. Here, the point to be noted that whatever you implement on FPGA should go the basic gate-level implementation, any function, any design converted into the basic gates with the help of the FPGA design development tools i.e., Vivado. FPGAs are also well supported with the external GPIOs interfaces, memories, even the modern FPGA are equipped with the DSP slices and faster adder and multipliers circuits to enhance their processing capability and increase the computational speed.

 

Cost

Typical microcontrollers are using smaller number of gates than FPGAs, and due their maturity and high market usage, they range from just a few dollars to the tens of dollars.

 

FPGAs are typically more expensive than microcontrollers due to the fact that they consist of more logic gates and therefore require more silicon. In addition to that, FPGAs are not as popular as Microcontrollers, therefore, the are not able to drive production cost down. Use the link to find FPGA prices online.

 

Technology

 

The core of both FPGA and microcontroller is the CMOS technology-based transistor. But both process their end data differently. A microcontroller contains one or more processing core (CPU) along with the program memory in the form of the ferroelectric RAM, NOR flash that contains the program memory that is also called the machine code (.hex file), each machine code is an instruction that executes on the processor.

 

However, FPGAs programming based on memory technology there are different technologies are available to program the FPGAs like SRAM based FPGA, flash-based, one-time programmable based FPGAs. The memory cell stores the FPGA configuration that crosses ponds to the designer code written in RTL languages and with the help of the tool designer converts the code into the .bit file. Later, this file was used to program the FPGA.

 

Power Consumption

 

FPGA is designed to have posse’s higher computational capability, process high data rate, having low latency with high throughput. It poses a challenge to the engineers to have all these capabilities at a low power cost. It’s always a trade-off in the FPGA based design — between power and functional capabilities. In addition, FPGA architecture also inherits a lot of static power consumption as well for unused logic (unused transistor) resources, sometime poor placement and routing also increase the power consumption of the FPGAs.

 

Microcontrollers have clock frequency of a few to 10’s MHz and use less power compared to FPGAs. In addition to that, Microcontrollers offer idle or power-saving modes to help reduce power consumption even further. Some of them come with sleep currents less than 1µA and can function at a few µA during slow clock rates.

 

There are very few FPGAs with such low requirements of power in the market comparable to microcontroller.

 

Application

 

The parallel processing of FPGAs lends itself to higher computational capability. Its ability to run multiple instructions in a single clock cycle make it purpose full for DSP computations so the designer can run two independent instruction at the same time.  While the Microcontroller designer would need to take into account the length of time required for each instruction. Due to parallel processing capability make FPGA can be used in the following applications:

 

  • Data Center
  • Aerospace & Defense
  • ASIC Prototyping
  • Automotive
  • Broadcast & Pro AV
  • Video & Image Processing
  • Wired and Wireless Communications

 

A Microcontroller can be used in small scale applications:

 

  • Consumer Electronics
  • Media Applications
  • Industrial Applications
  • Automotive Applications

 

FPGA vs Microcontroller Comparison Table

 

noCriteriaFPGAMicrocontroller
1ProgrammingSpecialized knowledge requires Easy to Program
2Hardware DesignComplex Simple
3ArchitectureLUT based Processor based
4ToolsExpensive and vendor tools are required Open-source tools available
5CostHigh Low
6Power/speed Higher Lower
7 Processing Parallel Sequential

 

Advantages of Microcontroller

 

  • Microcontrollers are easy to program
  • Microcontrollers are the best for a simple and hardware design
  • Microcontrollers are cheaper than FPGA

 

Disadvantages of Microcontroller

 

  • Microcontrollers can perform limited tasks
  • Microcontroller relies on sequential processing
  • Hardware is limited. A designer can utilize only the hardware available on the board

 

Advantages of FPGA

 

  • FPGA’s hardware is programmable
  • FPGA does not have a fixed instruction set
  • FPGA process functions in parallel processing

 

Disadvantages of FPGA

 

  • The FPGA learning curve is steep, needs knowledge of a lot of other domains like Computer Architecture, microprocessor, digital logic design
  • High power consumption
  • FPGAs are costly

 

 

Further Reading

 

FPGA vs. CPU

FPGA vs. CPLD

FPGA vs. ASIC

Recent Stories