LUTFFLUTFFLUTFFRAM×DSPLUTFF010101LUTFFLUTFFLUTFFRAM×DSPLUTFF1LUT 0000 00002 0000 00013SW 1 1 04... and more1LUT 0110 10012 1001 01103SW 1 1 04... and moredesign.bitABCDYCLKQ01010101234567891011121314150000010110101111AB0101DQFF0101101
Lit wire with moving dashes: it carries a 1 (current is flowing)Lamps: a glowing lamp shows 1, a dark one 0; a switch lamp at 1 is closedLUT cells: a yellow cell stores 1; the outlined cell is the one the inputs pickBitstream card: the bits that configure the chipThe fabric at the back is a grid of logic tiles (each a lookup table beside a flip-flop) joined by routing tracks whose switches each hold one bit, with columns of block RAM and DSP slices among them. Up front, one tile up close: inputs A to D pick one of the LUT's 16 cells, and the stored bits decide which logic function it is. Newer FPGAs use bigger LUTs: each slice of an AMD (Xilinx) 7 series chip has four 6-input LUTs and eight flip-flops (UG474). Block RAM and DSP figures are for AMD 7 series: 36 Kb per block RAM (UG473) and a 25 × 18 bit multiplier with a 48-bit accumulator per DSP48E1 slice (UG479). 7 series configuration memory is volatile SRAM, so the bitstream is loaded again after every power-up, usually from a flash chip on the board (UG470). Some FPGA families store their configuration in flash instead and keep it with the power off.

The fabric

  1. An FPGA, short for field-programmable gate array, is a chip full of blank building blocks: logic tiles, wires with switches between them, and blocks of memory and maths. You decide what it does after it is made.

Lookup tables

Memory and wiring

Configuring it

Inside the step

;; step 1/9 · fabric
;; about: Logic tiles, Routing switches, Block RAM, DSP slices
FPGA = field-programmable gate array

logic tiles   LUT + flip-flop, in a grid
routing       wire tracks + switches
block RAM     memory columns
DSP slices    multiplier columns

"field-programmable": set up by you,
after the chip leaves the factory.

A k-input LUT is 2 to the power k one-bit memory cells plus a selector: the inputs choose which cell's bit reaches the output. The 4-input LUT here is the one in each logic element of an Intel Cyclone IV (Harris and Harris, Digital Design and Computer Architecture, section 5.6.2). In Python a list can stand in for the LUT: lut[i] reads cell i, and a << 3 | b << 2 | c << 1 | d turns four 0/1 inputs into a cell number from 0 to 15.