Field Programmable Gate Arrays (FPGAs) and Complex Programmable Logic Devices (CPLDs) are two types of programmable logic devices that allow engineers to implement custom digital circuits. Both offer flexibility and rapid prototyping capabilities for digital systems. However, there are some key differences between the two that make each more suitable for certain applications.
What is an FPGA?
An FPGA is an integrated circuit designed to be configured by the customer or designer after manufacturing. FPGAs contain programmable logic components called logic blocks and a hierarchy of reconfigurable interconnects that allow the logic blocks to be connected. Logic blocks can be configured to perform complex combinational functions or simple logic gates like AND and XOR gates.
FPGAs typically contain a large array of logic blocks and rich interconnect resources to implement very complex digital circuits. The programmable logic blocks and interconnects configuration is generally specified using a hardware description language like VHDL or Verilog.
Some key capabilities of FPGAs include:
- Implementing any digital circuit up to hundreds of thousands of gates
- Reconfigurability – circuits can be changed after manufacturing
- Rapid prototyping and design iteration
- DSP and math-intensive functions with dedicated DSP slices
- Parallel processing with a large number of logic blocks
FPGAs are commonly used for digital signal processing, software-defined radio, aerospace and defense systems, ASIC prototyping, medical imaging, computer vision, cryptography and other compute-intensive tasks. Leading FPGA vendors include Xilinx and Intel (formerly Altera).
What is a CPLD?
A CPLD or Complex Programmable Logic Device is also a programmable integrated circuit containing logic blocks and interconnects. However, CPLDs have a much simpler overall architecture compared to FPGAs.
CPLDs consist of a small number of macrocells connected through a programmable interconnect matrix. Each macrocell is more complex than a typical FPGA logic block and can implement medium-sized logic functions. The interconnect matrix provides routing between macrocells.
Some of the key characteristics of CPLDs are:
- Contains a few tens to hundreds of macrocells
- Each macrocell has wide input/output capability
- Interconnect is less flexible than FPGA routing
- Limited clocking and I/O resources compared to FPGAs
- Programming is via logic equations instead of hardware description languages
CPLDs are best suited for:
- Glue logic and interfacing between components
- Small to medium complexity logic implementation
- Cost-sensitive simple designs
Some examples applications of CPLDs include:
- Front panel button and LED interfacing
- State machine control logic
- Parallel data processing
Key Differences Between FPGAs and CPLDs
Although both FPGAs and CPLDs are programmable logic devices, there are some key differences between the two architectures:
The most fundamental difference is logic capacity. FPGAs offer much higher capacity with hundreds of thousands of logic gates while CPLDs have hundreds to a few thousand gates.
For implementing complex digital circuits with large gate counts, FPGAs are preferable. CPLDs are suitable for simple glue logic functions.
Architecture and Flexibility
The overall architecture and configurability of both devices is very different. FPGAs have a sea of small logic blocks interconnected by a flexible routing structure. This allows very complex custom architectures to be realized.
CPLDs have a coarser overall architecture with a small number of larger macrocells connected by a simple interconnect structure. This limits the range of designs that can be implemented compared to FPGAs.
Design Entry Methods
FPGAs are configured using hardware description languages like VHDL or Verilog. This gives designers full control over the architecture and behavior.
CPLDs are programmed using logic equations that define the function of each macrocell. This is more restrictive than HDL-based design entry.
The abundant interconnect and separate memory blocks of FPGAs allow much higher performance for designs with lots of parallelism or requiring high memory bandwidth. Special DSP slices can accelerate signal processing algorithms.
CPLD performance is more limited in comparison due to the simpler architecture.
Owing to their architectural simplicity, CPLDs tend to be lower cost than FPGAs for smaller logic capacity needs. High-density FPGAs can be quite expensive.
FPGAs provide sophisticated clock management tiles that allow many clock domains with frequency synthesis and clock skewing. This is useful for complex synchronous digital circuits.
CPLD clock management capabilities are quite limited in comparison.
The design toolchains for FPGAs and CPLDs are very different. FPGA vendors offer advanced software for design simulation, timing analysis, layout, placement & routing and programming.
CPLDs are programmed using logic compilers that are simpler to use but offer less verification capability.
Summary of Differences
The architectural differences between FPGAs and CPLDs make them suitable for different classes of applications:
FPGAs are ideal for:
- Compute-intensive algorithms like video processing, encryption, bioinformatics
- Complex systems requiring high data throughput and parallelism
- Advanced interfacing protocols like PCIe, Ethernet, SATA
- Prototyping ASIC/SoC designs before tapeout
CPLDs are ideal for:
- Simpler glue logic, control logic and interfacing
- Low-cost designs not requiring advanced features
- Small form factor designs (CPLDs have smaller packages)
FPGA vs CPLD Example Designs
To better illustrate the differences in applications suited for FPGAs and CPLDs, let’s compare a few example digital systems typically implemented using each type of programmable logic device.
FPGA Design Examples
High-Speed Network Router
A network router for high-end infrastructure has the following requirements:
- Packet forwarding at up to 400 Gbps
- Routing table lookup using TCAM
- Traffic shaping algorithms
- Buffering with high memory bandwidth
- Multiple network interfaces up to 100Gbps
An FPGA would be an ideal fit for implementing a high-performance router like this. The flexible logic blocks and DSP slices can implement the data plane forwarding functions. Large embedded memory blocks provide packet buffering. The I/O blocks support high-speed interfaces like 100Gbps Ethernet.
Real-Time Video Processing
A real-time video processing pipeline has the following functionality:
- Pixel processor for image enhancement
- Motion estimation for video compression
- Image pyramid generation
- Neural network-based object detection
The highly parallel nature of video processing maps perfectly to an FPGA. The dedicated DSP blocks handle pixel processing and motion estimation. The FPGA’s logic fabric implements generate image pyramids efficiently in hardware. Theobject detection neural network can also be mapped to programmable logic.
An encryption accelerator card offloads processing for algorithms like AES, SHA, RSA from the host CPU. It requires:
- High-bandwidth I/O to transfer data
- Parallel encryption engines
- Low-latency request processing
FPGAs are widely used for encryption due to their performance benefits over software. The reconfigurable fabric implements parallel encryption pipelines to achieve very high throughput. Low-latency access to the encryption engines can also be guaranteed when using an FPGA compared to software.
CPLD Design Examples
An LED controller drives a set of eight RGB LEDs for mood lighting based on user input. It requires:
- Debounced button inputs for mode select
- PWM generation for LED intensity control
- LED enable signals
A small CPLD with eight to sixteen macrocells can easily implement the glue logic for the LED controller. The parallel I/O capability enables driving multiple LEDs simultaneously. Timers implemented in logic generate the PWM waveforms.
An electric motor controller coordinates six motors. It requires:
- Individual speed and direction control for each motor
- Motor enable signals
- Position and speed feedback processing
- Analog voltage monitoring
The glue logic and interfacing in the motor controller maps well to a mid-size CPLD. Macrocells can generate the necessary control signals for enabling and driving each motor. Additional logic processes the feedback and monitor inputs.
A simple SDRAM controller interfaces to a 64MB SDRAM with a 16-bit data bus. Key requirements are:
- SDRAM command timing
- Refresh cycle generation
- Bank/row/column addressing
- Data bus buffering
A CPLD can implement the basic timing and control functionality needed for the SDRAM controller using its predictable timing performance and parallel I/O capability. More advanced memory controllers are better suited for FPGAs however.
Choosing Between FPGAs and CPLDs
So when should you choose an FPGA over a CPLD, and vice versa? Here are some guidelines for selecting between the two types of programmable logic:
When to Use an FPGA
- For complex logic functions requiring thousands of gates/logic cells
- If DSP capabilities like multipliers are needed
- For designs requiring lots of memory and wide memory buses
- Fast processing of parallel data is required
- Multiple high-speed serial I/O standards are required
- HDL-based design entry is preferable
- Advanced debugging capabilities are desired
When to Use a CPLD
- Only simple glue logic or interfacing is needed
- Low cost is critical
- Small packaging is required
- Low power operation is prioritized
- Simple logic equations can specify the design adequately
- Minimal debugging capabilities are sufficient
For the vast majority of complex, high-performance designs FPGAs will be the best choice. CPLDs excel in simpler glue logic applications where their low cost and small form factor are beneficial.
FPGAs and CPLDs both provide user-programmable logic capability but are suited for very different types of applications. FPGAs offer higher logic density, more flexibility, advanced features and superior performance. CPLDs trade off capability for a simpler architecture, smaller footprint and lower cost.
Engineers should carefully consider the requirements of their application and determine which type of programmable logic device better suits their design needs. As a rule of thumb, FPGAs tackle complex logic problems requiring high data throughput while CPLDs handle simpler glue logic and interfacing tasks.
Understanding the architectural differences between FPGAs and CPLDs will ensure the best choice is made when starting a new programmable logic design. Both families offer unique benefits spanning a wide range of digital systems.
FPGA vs CPLD FAQ
Here are answers to some frequently asked questions about FPGA and CPLD differences:
Q: Can an FPGA replace a CPLD in a design?
Yes, an FPGA can readily implement the same functions as a CPLD owing to its greater logic density and flexibility. Replacing a CPLD with an FPGA may also allow you to add more functionality and performance.
Q: Do FPGAs and CPLDs require different CAD tools?
Generally yes. FPGA vendors provide advanced toolchains for simulation, synthesis, place and route, timing analysis and programming. CPLDs use simpler logic compilers and do not require intensive timing analysis.
Q: How do FPGA and CPLD programming differ?
FPGAs are programmed using hardware description languages like VHDL or Verilog. CPLDs are programmed by defining Boolean equations or state machines to specify logic functions.
Q: Can unused FPGA logic cells be powered down to save energy?
Yes, FPGA architectures support selective power down of unused sections. This can provide substantial energy savings in designs not requiring the full FPGA gate capacity.
Q: Which has higher performance – FPGA or CPLD?
FPGAs offer superior performance thanks to abundant routing, DSP blocks, memory bandwidth and hard processor cores. CPLD performance is constrained by the macrocell/interconnect architecture.
- FPGAs have higher logic density and more advanced features compared to CPLDs
- CPLDs trade off capability for simpler architecture and lower cost
- FPGAs are ideal for complex, high-performance applications
- CPLDs are well-suited for simple glue logic and interfacing
- FPGA design is HDL-based while CPLDs use logic equations
- When selecting programmable logic, consider requirements carefully before choosing between FPGA and CPLD