FPGA: Everything you need to know before getting started
Entering the world of FPGAs can be quite confusing for beginners and the fact that the answers to basic questions are spread across the internet is not helping either. We have gathered some frequently asked questions about FPGAs which we hope can be useful to help you get started on the subject.
- What is FPGA?
- How does an FPGA work?
- What language do you use to program FPGA?
- How is FPGA “programmed”?
- How many times can FPGAs reprogrammed?
- What are FPGA core and FPGA fabric?
- How much does an FPGA cost?
- What are the most common uses and applications for FPGAs today?
- Project ideas on FPGAs?
What is FPGA?
FPGA is an Integrated Circuit which can be reconfigured again and again to perform different tasks as desired. For example, an FPGA can be configured to function as a processor, and then it can be reconfigured to function as a Graphics Processing Unit (GPU), or hardware video encoder, or something else. The point is that FPGA can theoretically be programmed to function as any other Digital Integrated Circuit.Take the analogy of modern-day Microcontrollers. They can be programmed again and again with different software (i.e. firmware) and their functionality changes with the firmware running on them. FPGAs are similar, except they can be programmed again and again with different hardware design (hardware description) and their functionality changes with the hardware design running on them. And of course, FPGAs can function as Microcontrollers if you program with a design describing a microcontroller.
FPGA stands for Field Programmable Gate Array. Field Programmable implies that FPGAs can be programmed at home, at the office, anywhere outside of the IC fabrication factory. Gate Array means FPGAs contain a huge amount of logic gates and flip-flops which can be connected by users as per design requirements to make the FPGAs behave as per the intended design goal. Now coming to technical aspects, the gates and flip-flops are grouped into Configurable Logic Blocks (CLBs). There are thousands of CLBs on FPGAs and they are embedded in a sea of programmable interconnect matrix. The CLBs are interconnected with each other to implement a specific circuit functionality using this programmable interconnect matrix.
How does an FPGA work?
Think of FPGA as a breadboard (a huge one) for Digital Circuits. All the gates and flip-flops are present on the FPGA, and there are wires going through the complete chip. Circuits are made by connecting these wires to the relevant gates or flip-flops as per intended design. Instead of connecting the gates/flip-flops using a physical wire as in a breadboard, FPGAs has programmable interconnects that can be rewired programmatically. There are dedicated wires/routes for clock signals and only a selected number of FPGA pins are allowed to drive those global clock routing wires.
What language do you use to program FPGA?
The designs running on FPGAs are mainly coded using Hardware Description Languages (HDL) such as Verilog, VHDL or SystemVerilog. These three are the most popular languages although there are many more such as SystemC, Migen, MyHDL, Chisel, SpinalHDL, MATLAB etc which are more-higher level than the basic ones listed before. An increasingly popular way to program for FPGA is High-Level Synthesis (HLS) in which the design is done in a subset of C and the compiler transforms the design into correct Verilog code. Code written in the aforementioned languages are synthesized and converted into proprietary interconnect description by (usually vendor provided) synthesis tools. The output file that contains the interconnect description (and more) is usually called a bitstream, which is programmed to the FPGA.
How is FPGA “programmed”?
The correct term is FPGA “configuration” instead of FPGA “programming”. Still these days, both the terms are used interchangeably. A bitstream is a file which describes how an FPGA has to be configured, i.e, how to connect the gates, flip-flops and other digital circuit elements within the FPGA through the interconnect matrix. There is an inbuilt configuration circuit inside FPGAs which reads this bitstream file and configures the FPGA accordingly. There are many ways the bitstream can be read by the configuration circuit such as via JTAG, Serial Flash Memory, Parallel Flash Memory etc. The bitstream can also be transferred to the FPGA by another FPGA or Microcontroller which is in charge of the configuration and bootup process. FPGA board manufacturers usually provide software to program their boards. For example, the Tenagra FPGA System Management Software from Numato Lab allows programming of FPGA boards without using additional expensive JTAG cables.
How many times can FPGAs be reprogrammed?
SRAM based FPGAs can be programmed as many times as necessary. There is no limit until the device gets damaged by out-of-spec conditions such as voltage, temperature etc. Certain Flash-based FPGAs may have a very specific max programming cycle endurance. Since there are varieties of FPGAs, it is recommended to go through the datasheet of the FPGA in detail for any authoritative information.
What are FPGA core and FPGA fabric?
FPGA core could mean two things: 1. FPGA IP Core 2. FPGA core in a SoC such as Zynq MPSoC series or Intel (formerly Altera) SoC such as Stratix SoC, Arria SoC etc.
FPGA IP Core is a design unit which serves a specific purpose in an FPGA hardware design. There could be CPU IP core, LED blinking IP core, PCI Express IP Core, HDMI IP core etc. IP Cores can be thought as like libraries in case of software. Libraries add specific functionality to the design and are well tested. IP cores are the same thing in case of hardware designing.
In case of SoCs, FPGA core is an area in the silicon with complete FPGA core integrated to the die along with a processor core such as ARM Cortex-A series. Zynq series from Xilinx is an example of this kind of SoCs. They have full-featured FPGA die in them along with dual-core ARM Cortex-A9 cores plus an assortment of peripherals.
The FPGA fabric is mainly meant by the FPGA interconnect matrix and CLBs embedded into them. But FPGA core doesn’t contain only FPGA fabric since it would significantly decrease the practical applications possible. The FPGA core contains many more elements in addition to just FPGA fabric such as PLLs, Block RAMs, SerDes, Multi-Gigabit Transceivers, PCI Express blocks, DSP blocks, Configuration Logic etc.
How much does an FPGA cost?
The cost of the FPGA is dependent on many factors such as the maximum clock speed it supports, its resources in terms of the number of LUTs and Flip-flop, BRAM size, PLLs, transceivers and other dedicated on-die circuits, pinouts and packages etc. So, the cost depends on the FPGA you decide to use.
FPGAs are available from $1 onwards and go well beyond $100,000!
What are the most common uses and applications for FPGAs today?
FPGAs have numerous applications. They are used in Communication Systems from 4G Mobile Base Stations to Inter-planetary Communication Networks. They are also used in Military Radars. FPGAs are used to accelerate computations using frameworks such as OpenCL etc. They are used in precise quantum experiments. FPGAs are used wherever very high degree of parallelism is required, an area where traditional CPUs fail miserably.
Increasingly FPGAs are being used more for Software Defined Radio, Software Defined Networking etc.
In consumer applications, FPGAs are used for image processing in televisions, cameras etc. Chances are that you might have already used or interacted with a product using FPGA!
For a thorough list of FPGA applications, do take a look at the FPGA Wikipedia article: https://en.wikipedia.org/wiki/Field-programmable_gate_array
Project ideas on FPGAs?
Depending on your current level of knowledge in FPGAs you can shortlist FPGA projects from below.
- LED Blinking (also called Hello World program of FPGAs)
- LED Binary Counter
- BCD Counter on 7-Segment Displays
- VGA Output
- PWM Audio Synthesizer
- UART Transmitter and Receiver
- SPI & I2C Master & Slave
- Simple 8-bit processor core (like PicoBlaze)
- Frequency Counter
- Synchronous & Asynchronous FIFO
- FFT & IFFT Project
- CORDIC Implementation
- PID Controller Implementation on FPGA
- Software Defined Radio
- NAND Flash IP core (ONFI)
- NES Emulators
- Digital Audio Processing, FIR & IIR filters
- DDS based Arbitrary waveform generator
- Framebuffer design
- Video Overlay Demo
- Video Encoder & Decoder (MPEG, H.265 etc)
- Linux capable SoC Design
- Acceleration Framework such as OpenCL etc
- Deep Learning on FPGAs
- Synthetic Aperture Radar using Ultrasonic sensors
- IP Cores such as SDRAM controller, Ethernet, PCI Express etc
- Multi-FPGA ASIC Prototyping
- Encryption core
- FPGA assisted Ray Tracing
- Network-on-Chip (NoC) Design