Microcontroller units (MCUs) have a computer processor unit (CPU) core, various types of memory, input/output (I/O) functions, and a range of integrated peripherals. Field programmable gate arrays (FPGAs) don’t have any of these features and consist of many configurable (or programmable) logic blocks, with a programmable interconnect overlay surrounded by numerous general purpose I/Os (GPIOs). But, of course, that’s not the whole story.
This FAQ begins with a brief overview of how MCUs and FPGAs function, followed by a deeper dive into the structures of MCU and FPGAs. It then compares how they can be used in application circuits and closes by looking at the possibility of co-packaging MCU cores and FPGAs in field-programmable systems-on-chips (FPSoCs).
At the most basic level, an MCU is programmable with software, and an FPGA is programmable through hardware interconnects. Both need software to be used in an embedded application. An MCU needs application software to perform the required tasks. The configurable logic cells and programmable interconnects in an FPGA are programmed using hardware description language (HDL) coding software.
FPGAs and MCUs are both reprogrammable. Once an FPGA is programmed to perform a given task (or tasks), it can be reprogrammed in the field by downloading a software update. An MCU is reprogrammed by changing the application software.
The functional blocks in a MCU include the central processing unit (CPU), random access memory (RAM), read-only memory (ROM) program memory, timers, multiple I/O ports, and serial communications interfaces (Figure 1). Some MCUs include analog-to-digital converters (ADCs), digital-to-analog converters (DACs), and other advanced functions.
The CPU includes an arithmetic logic unit (ALU), memory unit (MU), control unit (CU), accumulator, and so on. The ALU performs arithmetic operations and logic functions. The memory stores the instructions for the CPU, and the control unit controls connected peripherals internal to and external to the MCU. The accumulator stores results and speeds further processing.
The RAM is fast volatile memory that is used for temporary storage. It consists of general-purpose registers (GPR) and special-purpose registers (SPR). GPRs are used for all general-purpose storage needs, while SPRs have predefined functions that are assigned at the factory. For example, STATUS registers can only store a program’s status or operation.
ROM is a nonvolatile memory used for permanent or longer-term storage of data and programs. Electrically erasable programmable ROM (EEPROM) and Flash can both be rewritten. Flash is related to EEPROM and is addressable by the block, while EEPROM is addressable by the byte. Flash is used when constant rewriting is needed, while other EEPROMs are used when rewriting is more infrequent. And Flash memories tend to have a much larger capacity compared with EEPROMs.
In PIC MCUs, the stack is a memory used as a placeholder when an interrupt is received. Upon getting an interrupt, the CPU stores the current instruction in the stack. After finishing the interrupt execution, the CPU refers to the stack to know where to resume processing.
MCUs include dedicated buses for the transfer of data and the transfer of memory addresses from peripherals to the CPU. And there can be I/O pins for universal asynchronous receiver-transmitters (UARTs), universal synchronous-asynchronous receiver-transmitters (USARTs), GPIOs, and so on.
How does that compare with an FPGA?
A FPGA is designed to be configured or programmed after manufacturing. It contains an array of programmable logic blocks (in some cases, tens of millions of these blocks). The logic blocks are overlaid by reconfigurable interconnects and surrounded by GPIO blocks (Figure 2). The logic blocks can be configured and connected to perform complex functions or used as simple logic gates like AND and XOR. In most FPGAs, the logic blocks also include some memory capacity.
How is an FPGA programmed?
FPGA programming can be highly automated. For smaller devices, it begins with graphical design capture, while HDL tools are used for larger FPGAs. Software is used to ‘compile’ the design by placing and routing the logic blocks and interconnected fabric efficiently. A bitstream is then created that is used to program the FPGA. The reprogrammable nature of FPGAs is beneficial for updating the devices in the field as improved computing algorithms are developed, or new features are needed. It can also contribute to faster time to market for the overall system since the FPGA can be reprogrammed as needed as the system design evolves.
Which to use and when?
MCUs are more suited for general control applications in embedded systems. In these cases, MCUs can be easier to program, easier to design and debug and lower in cost. For example, MCUs often implement controls in various applications, from simple devices to complex industrial, automotive, and aerospace systems.
FPGAs are found in more customized applications, and their parallel processing capabilities support higher processing power. Many programmable logic gates can speed applications such as artificial intelligence, machine learning, and image processing.
Combine both into a SoC
While both can be used individually, combining a MCU and programmable logic in a single design is possible. The MCU can be used for control functions while the programmable logic performs complex computational functions. Of course, there are more choices than just MCUs and FPGAs. There are application specific ICs (ASICs), which are custom designs, graphics processing units (GPUs), multicore processors, digital signal processors (DSPs), and FPSoCs, each offering designers a different set of performance and flexibility tradeoffs (Figure 3). As can be seen, MCUs provide the highest level of flexibility, while FPGAs lie near the middle of the range and combine relatively high performance with moderate flexibility. Suppliers also offer multi-processor system on chips (MPSoCs) where the processor section can dominate and radio frequency system on chips (RFSoCs) that combine RF functions with FPGAs.
Figure 3: MCUs and FPGAs are only two of several options that provide various tradeoffs between performance and flexibility. (Image: MDPI electronics)
FPSoCs can include soft or hard MCUs. A soft MCU is programmed into the FPGA fabric, while a hard MCU is a conventional co-packaged MCU. FPSoCs can also include GPUs, real-time processors, DSPs, and video compression sections. Some of these FPSoCs include ARM Cortex-A0 processors in single- or dual-core configurations. They provide a fully programmable alternative to high-performance ASICs in applications like small cell base stations, machine vision for industrial automation, advanced driver assistance systems (ADAS) in automobiles, and other high-performance processing applications. Being co-packaged, these FPSoCs provide performance levels exceeding the capabilities of similar discrete MCU and FPGA combinations.
In a MPSoCs, the processor section dominates and combines high-performance multicore MCUs with programmable logic. They are available with dual- and quad-core processors. They can offload compute intense activities like graphics and video pipelining to the programmable logic that supports high-speed parallel processing. As a result of their MCU heritage, these devices can include a wide range of integrated peripherals and I/O options, along with custom co-processors, memory architectures, and deep learning processing units (DPUs) to support AI and ML.
RFSoCs can be optimized for applications like 5G infrastructure, massive multi-input multi-output (MIMO) systems, phased array radar, LIDAR, satellite communications, and various test and measurement systems. These RFSoCs integrate giga-sample RF data converters and soft decision forward error correction (SD-FEC) for optimal performance. They reduce component counts and support hardware and software flexibility compared to discrete implementations.
Summary
MCUs and FPGAs are inherently different in structure and provide designers with a different set of performance versus flexibility tradeoffs. MCUs are programmed using embedded software or application software, while FPGAs are programmed by changing the structure of the logic gates and the interconnect fabric. In addition, FPGAs and MCUs are available in a range of SoCs that provide greater design options. Some of the SoCs also include RF functionality.
References
Adaptive SoCs, Xilinx
FPGA Fundamentals, NI
PIC Microcontroller and Its Architecture, Electronics Hub
The Future of Low-End Motes in the Internet of Things, MDPI electronics
What’s an FPGA?, Lattice Semiconductor