FPGA Vs Microcontroller: Understanding the Key Differences

 In Manufacturing, PCB, Technology

When developing a functional embedded system, designers use a variety of electronic components. These include processors, memories, and peripheral devices. The complexity of the system depends on its intended objective application. The choice of the processor is one of the most intricate and involving, as it will affect the computational power of the system and the effective management of peripherals and other components within the system. The most common option for the designer is to use either a microcontroller or an FPGA, a field programmable gate array. Here, Rush PCB Inc will attempt to provide a background on both microcontrollers and FPGAs, their differences, and when to use them.

What are Embedded Systems?

Embedded systems are essentially computers intended to control or perform specific functions either on its own or within a larger system. With a processor at its core, an embedded system carries out computational and operations in real-time. Common embedded systems may employ various processors or processing systems such as:

  • Microcontrollers — containing the CPU, memory, and peripherals
  • Microprocessors — containing only the CPU
  • Digital Signal Processors — for processing digital signals
  • Field Programmable Gate Arrays — Integrated Circuit that customers can configure

Depending on the application complexity, one or more of the above may be necessary for the embedded system. Most common are microcontrollers and FPGAs.

FPGA Vs Microcontroller

What are Microcontrollers?

A microcontroller is an integrated circuit behaving like a small computer. Typically, it consists of a CPU or central processing unit, some memory, and a few peripheral devices for input and output of signals. Users can insert machine level programs, called embedded software, in the memory of a microcontroller so that it performs specific tasks while managing its peripherals and other components in the system.

It is possible to connect various sensors, switches, and other electronic components to the inputs of a microcontroller to allow it to collect their signals, process them and output them to control other devices. The other devices may be LED displays, relays, speakers, and others for controlling bigger electronic gadgets. The embedded software provides the microcontroller the necessary instructions for controlling the entire system. System designers typically use a higher-level language like C, C++, Python, JavaScript, or other to write their programs, and translate them to the machine level language for storing in the microcontroller memory.

What are FPGAs?

A Field Programmable Gate Array is a large integrated circuit. It typically has a set of circuits that a user can program. The FPGA architecture has thousands of CLBs or configurable logic blocks that include LUTs or look-up tables, FF or flip-flops, and MUX or multiplexers. Being a core of the FPGA, the LUTs implement Boolean equations, thereby forming the primary element for handling logical functions.

A system of programmable interconnects, such as switches and wires, surround the CLBs. They offer connectivity between the CLBs, logic blocks, and IO blocks. These IO blocks are the user interface between the FPGA and other external devices. The complete arrangement performs like a comprehensive multicore processor.

For using an FPGA, an engineer must program the hardware of the device. This is different from programming a microcontroller with a specific software. Engineers use an HDL or hardware descriptive language for programming the hardware in an FPGA.

Engineers find FPGAs especially useful when prototyping application-specific circuits. For instance, it is possible to use an FPGA to streamline the prototyping process itself. The usefulness of FPGAs can be gaged from the fact that it is possible to alter the functions of a device embedded with an FPGA, without adding or deleting any hardware from it.

Similarities and Differences Between FPGA and Microcontrollers

The basic purpose is the same for an FPGA and a microcontroller—both allow the end user to determine their functionality. Both are capable of performing specific applications while being embedded within a system, for instance, a vehicle, washing machine, or a traffic light controller.

Even physically, both look roughly the same. They are tiny integrated circuits, flat and square. Both are essentially miniature computers, capable of being programmed for specific purposes. That is the primary reason neither an FPGA nor a microcontroller can individually serve as a desktop or personal computer. Rather, by following commands, they can perform specific functions at varying levels of complexity.

Both devices are programmable, to a certain extent. That means, a manufacturer or an end-user can define their functions and embed the requirement as necessary. That is the primary reason these devices can perform in diverse applications in a broad range of industries.

A primary difference between an FPGA and a microcontroller is that unlike a microcontroller, there is no fixed hardware structure within an FPGA. Rather, an FPGA has fixed logic cells, which, along with other interconnects, an engineer can program in parallel, using the HDL coding language. Therefore, there is nothing predefined in an FPGA, and the user can alter its structure depending on their application.

On the other hand, a microcontroller has a fixed hardware structure. The manufacturer predefines all its components, the CPU, the memory, peripheral devices and their interconnections. If the user requires a device with a different capability, they must select a more suitable device. Designers can program a microcontroller to perform desired tasks using the available hardware structure.

Another feature setting an FPGA apart from a microcontroller is the extent to which it is possible to customize an FPGA. This feature allows using FPGAs for complicated and highly technical applications. While on the other hand, microcontrollers are more suited for simple applications.

Characteristics Defining Microcontrollers

  • Ease of use — Anyone with a knowledge of coding can program a microcontroller.
  • Affordability — Mass-production makes microcontrollers cost lower than FPGAs.
  • Unsuitable for complex applications — Sequential processing in microcontrollers can cause bottlenecks.
  • Good for simple applications — Microcontrollers are suitable for simple, repeated, and unchanging applications.

Characteristics Defining FPGAs

  • Use requires skill — Apart from coding knowledge, FPGA handling requires knowledge of HDL or hardware descriptive language.
  • Greater parallelism — FPGAs are capable of running multiple parallel operations simultaneously.
  • Higher customization — FPGAs can be much more customizable as compared to microcontrollers.
  • Higher cost — More expensive than microcontrollers. However, they can save money for industries that require to make retroactive changes, without making major hardware changes.
  • Possibility of later alterations — It is possible to change the hardware after initial programming. This can cost-effectively change the function of the device without any alterations in the hardware.

When to Use an FPGA or a Microcontroller

Whether to use an FPGA or a microcontroller depends on the application. For instance, microcontrollers are more suitable for routine control, such as for turning a specific device on or off depending on certain inputs. On the other hand, FPGAs are more suitable for applications requiring higher processing speeds or power. For instance, an FPGA would be eminently suitable for high-speed processing of high-resolution video data.

Engineers often use microcontrollers in embedded systems because of the ease of programming them, ease of design and debugging, and their low-cost implementation. However, there is a general lack of flexibility with microcontrollers, since users can reprogram FPGAs to change both, their hardware and firmware. Microcontrollers allow only firmware reprogramming, and this is a limit on their available modifications and options.

Unlike microcontrollers, FPGAs have the ability of parallel processing. This is the ability to simultaneously execute many identical operations. With hundreds upon thousands of CLBs synchronously processing information, applications like artificial intelligence and image processing are more feasible with FPGAs. On the other hand, the design of microcontrollers makes them more suitable for sequential processing of information, making them read and process each line of instructions one after the other. This is less powerful in comparison to parallel processing.

While it is possible to use either a microcontroller or an FPGA as the only processor in a system, it is perfectly possible to use both concurrently in a design. For instance, while the microcontroller controls complex interfaces, the FPGA can perform the mathematics and do the heavier calculations. By using both devices at the same time, engineers can take advantage of their individual strengths and create a robust design capable of handling advanced operations.

The following table may be useful for making a selection of the device to use:

Comparing FPGAs and Microcontrollers
Feature FPGA Microcontroller
Flexibility Superior customization. Possibility of reprogramming hardware and firmware. Firmware reprogramming only.
Programming & Firmware Complex Simple
Programming Tools No Portability Highly portable
Cost Expensive Cost-Effective
Processing Power/Speed High Low

 

Conclusion

It is possible to use an FPGA if the design requires complex logic, high processing ability, and if the cost to performance ratio justifies it. However, if the design requires only simple and limited hardware and performs only specific functions, using a microcontroller is a preferred choice. However, although there is no specific criteria to define the selection of either an FPGA and a microcontroller, we, at Rush PCB Inc, suggest considering their individual pros and cons for making the selection. The designer can make their choice between an FPGA and a microcontroller based on their design requirements.