FPGARelated.com

Bitstream

Category: Configuration | Also known as: bit file

A bitstream (sometimes called a bit file in certain vendor toolchains) is a binary configuration file that encodes the logic, routing, and memory initialization data needed to program an FPGA or CPLD. Loading a bitstream into the device sets the programmable elements -- typically including lookup tables, interconnects, I/O standards, block RAM contents, and PLL parameters, though the exact set varies by architecture -- to the states defined by the design.

In practice

Bitstreams are produced by the vendor's synthesis and implementation toolchain (e.g., Xilinx/AMD Vivado or ISE, Intel Quartus, Lattice Diamond/Radiant, Microchip Libero). The flow is: RTL or schematic -> synthesis -> place-and-route -> bitstream generation. The resulting file is vendor- and device-specific; a bitstream built for a Xilinx Artix-7 will not configure a Cyclone V, and in most cases will not configure a different package or speed grade of the same family either.

Bitstreams are delivered to the device through one of several interfaces. JTAG is the most common path during development -- tools like Xilinx Vivado Hardware Manager or OpenOCD push the bitstream directly into the FPGA's configuration logic. For production and autonomous boot, the bitstream is stored in an external SPI or parallel NOR flash, or in a dedicated configuration device; the FPGA reads and loads it at power-up in one of its passive or master serial/parallel modes. Some SoC-class devices (e.g., Xilinx Zynq, Intel Cyclone V SoC) boot a hard ARM core first, which then orchestrates loading of the programmable-logic bitstream from sources such as an SD card or network through firmware or software.

Because bitstreams are volatile on SRAM-based FPGAs (a category that includes the mainstream FPGA families from Xilinx/AMD and Intel/Altera), configuration must happen every power cycle. Flash-based FPGAs (e.g., Microsemi/Microchip ProASIC, IGLOO, PolarFire families) store configuration on-chip and survive power loss without an external configuration memory. Blog posts on this site such as "MyHDL FPGA Tutorial II cont. (Echo, Audio Interface)" and "An absolute position encoder VHDL core" show practical examples of designs that ultimately produce and load a bitstream as the final delivery step.

A common pitfall is treating bitstream generation time as negligible. On large devices (Xilinx UltraScale+, Intel Agilex), place-and-route plus bitstream generation can take tens of minutes. Incremental compilation and design checkpoints help, but teams should account for this in their build pipeline. Another pitfall is bitstream versioning: an FPGA image programmed into flash in the field may not match the source RTL in revision control unless the build is reproducible and the bitstream is tracked as a first-class artifact.

Frequently asked

What is inside a bitstream file?
The bulk of the data is a long sequence of bits that initialize the FPGA's configuration SRAM cells, which control LUT contents, routing switch connectivity, I/O configuration, and block RAM initialization. The file also contains a header with device ID and checksum fields. Some formats (e.g., Xilinx .bit) wrap the raw configuration data with a small ASCII header; others (e.g., .bin) are raw binary intended for direct flash programming.
What is the difference between a .bit file and a .bin file?
In Xilinx/AMD toolchains, the .bit file is the primary output from bitstream generation and includes a header with device, date, and design name metadata. The .bin file strips that header and contains only the raw configuration data, which is what you typically write into an SPI flash or configuration PROM. Other vendors use their own extensions (.rbf for Intel/Altera, .jed or .stp for various CPLD formats), but the distinction between a 'with-header' and 'raw' variant appears across most toolchains.
Can a bitstream be read back or reverse-engineered?
Many SRAM-based FPGAs support readback of the configuration data, though support and the specific interface (which may be JTAG, a dedicated readback port, or a vendor-specific mechanism) vary by device and family. Readback can be used for design verification or to detect single-event upsets in radiation environments. Reverse-engineering a bitstream to recover the original RTL is much harder, but has been demonstrated for older Xilinx and Lattice families (the open-source Project IceStorm and Project X-Ray efforts document Lattice iCE40 and Xilinx 7-series bitstream formats). Many vendors offer bitstream encryption using AES-256 keys stored in battery-backed or eFuse registers to protect IP.
How long does it take to configure an FPGA from a bitstream?
Configuration time depends on bitstream size and interface speed. A small device like a Lattice iCE40 UP5K has a bitstream of roughly 1 Mbit and configures in milliseconds over SPI at typical flash read speeds. A large Xilinx UltraScale+ device may have a bitstream exceeding 300 Mbit, and configuration over a 32 MHz SPI interface can take several hundred milliseconds to a few seconds. JTAG configuration is generally slower than dedicated configuration interfaces for production use.
What happens if the bitstream is corrupted or the wrong bitstream is loaded?
Most FPGAs perform a CRC check on the incoming bitstream. If the check fails, the device asserts a INIT_B or nSTATUS error signal and aborts configuration rather than entering an undefined logic state. The device then either holds in reset or, on some families and boot mode configurations, may attempt to reload from a fallback configuration image stored in a secondary flash region. Some Xilinx 7-series and UltraScale parts support a fallback bitstream mechanism for this scenario, though availability depends on the specific device, boot mode, and configuration setup.

Differentiators vs similar concepts

A bitstream is sometimes confused with firmware or a binary image in the MCU sense. An MCU firmware binary contains machine instructions and data that the CPU fetches and executes; the CPU hardware itself is fixed. A bitstream, by contrast, defines the hardware -- it programs the device's logic fabric so that the resulting circuit implements the intended design. Once configured, the FPGA runs as that custom circuit; there is no stored-program fetch-execute loop unless the design itself instantiates a soft-core processor. The two concepts converge on SoC FPGAs (e.g., Zynq), where a single boot image may contain both a bitstream for the programmable logic and an executable binary for the hard ARM cores.