An FPGA (field-programmable gate array) is a chip made of programmable logic blocks and wiring that you configure after manufacture to become a custom digital circuit. Because the design runs as hardware rather than as instructions on a processor, an FPGA can do many operations in parallel with timing that is exact to the clock cycle. That makes it the right tool for high-speed data acquisition, real-time control and precise triggering, and the wrong tool for general-purpose computing.
This article explains how FPGAs work, how they compare with CPUs, GPUs and PLCs, and where they are used in industrial and scientific systems. If you are planning a system that needs one, see our FPGA software and systems page.
How an FPGA works
A processor reads instructions one after another. An FPGA has no instruction stream: its logic blocks and routing are configured into the circuit you designed, and every part of that circuit runs at the same time on each clock tick. A configuration file, called a bitstream, is loaded at power-up and can be replaced later, so the same chip can take on a new function without new hardware.
| Building block | What it does | Why it matters |
|---|---|---|
| Look-up tables (LUTs) | Implement any small logic function of a few inputs | The basic fabric from which all custom logic is built |
| Flip-flops (registers) | Store one bit per clock cycle | Create pipelines so long calculations still run at full clock rate |
| DSP slices | Hardened multiply-accumulate units | Fast filters, FFTs and control math without using general logic |
| Block RAM | Small, fast on-chip memories | Buffers, FIFOs and lookup tables close to the logic that uses them |
| Clock management | Generates and aligns internal clocks | Deterministic timing and phase-aligned sampling |
| I/O and transceivers | Connect to ADCs, DACs, digital lines and high-speed links | Direct, low-latency access to sensors and actuators |
FPGA vs CPU, GPU, PLC and ASIC
Most systems use an FPGA alongside a processor, not instead of one. The FPGA handles the time-critical, high-rate work at the edge of the hardware, and the processor runs the user interface, data storage and higher-level logic.
| CPU | GPU | PLC or microcontroller | FPGA | ASIC | |
|---|---|---|---|---|---|
| Timing | Varies with the operating system | Batch-oriented, variable | Scan-cycle based, milliseconds typical | Exact to the clock cycle | Exact to the clock cycle |
| Parallelism | A few cores | Thousands of threads | Limited | True hardware parallelism | True hardware parallelism |
| Best at | General software, UI, databases | Large neural networks and image batches | Sequencing and machine logic | High-rate I/O, triggering, control loops, preprocessing | Very high volume fixed functions |
| Development effort | Low | Medium | Low | High | Very high |
| Change after deployment | Easy | Easy | Easy | Reload the bitstream | Not possible |
For image processing specifically, our comparison of GPU vs CPU vs FPGA for machine vision goes deeper.
Worked examples: why timing and bandwidth matter
A deterministic control loop
At a 100 MHz clock, one cycle is 10 ns. A control calculation pipelined over 40 cycles produces a new output 400 ns after each input sample, every time. A loop running in software on a desktop operating system can be delayed by a millisecond or more when the system is busy, which is thousands of times longer. Where a laser, valve or motor must respond within microseconds, that difference decides whether the system works.
Reducing data at the source
Eight channels sampled at 2 MS/s with 16-bit resolution produce 8 × 2,000,000 × 2 bytes = 32 MB/s of raw data. If the FPGA computes an RMS value for every block of 1,000 samples, it sends only 16,000 values per second, or 64 kB/s at 4 bytes per value: a 500-fold reduction. The host computer stores and displays results instead of struggling to keep up with raw samples. See high-speed data acquisition for the rest of the signal chain.
How FPGAs are programmed
- Hardware description languages (VHDL and Verilog). The circuit is described in text, then synthesized, placed and routed into a bitstream. This gives the most control and the most efficient designs.
- High-level synthesis (HLS). Algorithms are written in C or C++ and converted to hardware. Faster for math-heavy blocks, but timing and resource use still need an engineer who understands the hardware.
- LabVIEW FPGA. Graphical programming for NI hardware such as CompactRIO and FlexRIO. It suits measurement and control systems where the FPGA, the real-time processor and the host application are developed together.
Compiling an FPGA design can take from minutes to hours, so a good project simulates and verifies logic before every build, and keeps as much of the application as possible in software on the host.
FPGA uses and applications
| Application | What the FPGA does |
|---|---|
| High-speed data acquisition | Samples many channels in lockstep, filters, decimates and timestamps data before it reaches the host |
| Real-time and closed-loop control | Runs control loops at kilohertz to megahertz rates with fixed latency |
| Automated test and hardware-in-the-loop | Generates and measures signals at precise times and simulates sensors or plants for the device under test; see hardware-in-the-loop testing |
| Machine vision preprocessing | Handles camera interfaces, triggering, filtering and region extraction before images reach a GPU or CPU |
| Scientific instrumentation | Synchronizes lasers, galvo mirrors, stages and cameras for advanced microscopes; see microscope hardware synchronization |
| Aerospace and defense test | Precise timing and high channel counts in systems such as gyroscope test stations |
| Signal processing and communications | Digital filters, FFTs, modulation and protocol handling at line rate |
| Prototyping | Proves a custom digital design in hardware before committing to an ASIC |
Sciotex has used FPGAs in gyroscope test stations, fill and test control for ring laser gyros, high-speed laser triggering and galvo mirror control for microscopes, and two-photon and light sheet microscope systems.
When an FPGA is the right choice
- Response times must be microseconds or less, every time.
- Many channels must be sampled or controlled in exact synchronization.
- The raw data rate is too high to send to a computer, so it must be reduced at the source.
- Custom digital interfaces or triggering are needed that off-the-shelf hardware does not provide.
If none of these apply, a PLC, an industrial PC or a GPU is usually faster to develop, cheaper to maintain and easier to change. Many projects use an FPGA for a small, critical part of the system and keep everything else in software.
Challenges to plan for
- Development time. FPGA logic takes longer to design and verify than equivalent software, so scope it tightly.
- Compile times. Long builds slow iteration; simulation and good test benches matter.
- Power and cost. An FPGA uses more power than a dedicated chip for the same fixed task and costs more than a microcontroller.
- Long-term support. Tool versions and chip families change, so document the design and the build environment so the system can be maintained for years.
Need an FPGA in your test, measurement or control system?
Sciotex engineers design FPGA software and the systems around it, from high-speed data acquisition and closed-loop control to precision timing for scientific instruments, designed, programmed, built and supported in the US since 1997.
Frequently asked questions
FPGA stands for field-programmable gate array: a chip whose logic and wiring are configured in the field, after manufacture, to implement a custom digital circuit.
FPGAs are used where timing and throughput matter: high-speed data acquisition, real-time control, automated test and hardware-in-the-loop systems, machine vision preprocessing, scientific instruments, communications and prototyping.
For parallel, time-critical tasks such as filtering many channels or running a control loop with fixed latency, yes. For general-purpose software, a CPU is faster to program and usually the better choice.
With a hardware description language such as VHDL or Verilog, with high-level synthesis from C or C++, or graphically with LabVIEW FPGA on NI hardware. The design is compiled into a bitstream that configures the chip.
Yes. Loading a new bitstream changes the circuit, so an FPGA-based system can gain features or fixes without new hardware.