Loading header...

Logic Fabric, LUTs, Flip-Flops, and Routing

FPGA logic fabric is made from many repeated resources: lookup tables for Boolean logic, flip-flops for state, routing switches for connections, and dedicated blocks for memories, arithmetic, clocks, and I/O. HDL becomes useful only when you can picture how those resources implement the circuit.

Learning Objectives

By the end of this lesson, you should be able to:

  • explain how a LUT implements a truth table;
  • describe why flip-flops are the normal storage element in FPGA RTL;
  • identify the role of routing, carry chains, BRAM, DSP blocks, clock networks, and I/O cells;
  • calculate the number of entries in an n-input LUT;
  • explain why routing delay and fanout affect timing.

The Basic FPGA Tile

Vendors use different names such as CLB, logic cell, adaptive logic module, slice, or logic element. The repeated tile idea is similar:

Resource What it does Student mental model
LUT Implements a small Boolean truth table programmable gate network
Flip-flop Stores one bit on a clock edge register bit
Multiplexer Selects between signals or modes programmable choice
Carry chain Fast dedicated arithmetic path adder shortcut
Local routing Connects nearby tile resources short wires
flowchart TB I["Inputs from routing"] --> L["LUT truth table"] L --> M{"Register output?"} M -->|no| C["Combinational output"] M -->|yes| F["Flip-flop"] F --> R["Registered output"] C --> O["Routing to fabric"] R --> O

The synthesis and place-and-route tools decide which physical resources implement your RTL. Your job is to write RTL that maps cleanly to predictable hardware.

What Is a LUT?

A lookup table is a small memory used as logic. Its inputs select one stored output bit. An n-input LUT has:

entries = 2^n

So a 4-input LUT stores 2^4 = 16 output bits, and a 6-input LUT stores 2^6 = 64 output bits.

For a 2-input XOR:

A B A XOR B
0 0 0
0 1 1
1 0 1
1 1 0

The LUT stores those four result bits. When A and B change, the selected stored bit appears at the output after LUT and routing delay. No CPU reads an array.

Worked Example: Majority Logic

Requirement: output Y = 1 when at least two of A, B, and C are high.

A B C Y
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 1
1 1 1 1

Boolean form:

Y = (A and B) or (A and C) or (B and C)

In Verilog:

assign y = (a & b) | (a & c) | (b & c);

A 3-input LUT can implement this directly by storing the eight output bits. A wider LUT can also implement it, possibly while sharing resources with related logic depending on the architecture.

Flip-Flops Make State

Combinational logic depends only on current inputs. Sequential logic remembers previous events. In FPGA RTL, the normal storage element is a flip-flop updated by a clock edge.

title "Illustrative flip-flop sampling"
time start=0 end=8 unit=ns divisions=8

CLK: square label="clock" low=0 high=1 duty=50 cycles=4 unit=logic color=#2563eb
D: step label="D changes before edge" low=0 high=1 at=2.4 unit=logic color=#dc2626
Q: step label="Q updates on edge" low=0 high=1 at=4 unit=logic color=#16a34a

marker EDGE at=4 label="sample edge" color=#475569

This waveform is explanatory, not a measured or simulated device trace. Real timing includes setup time, hold time, clock-to-Q delay, clock skew, jitter, LUT delay, and routing delay.

Routing Is Part of the Circuit

The FPGA contains many programmable wires and switches. Place-and-route chooses where each LUT and flip-flop sits and how signals travel between them. Two builds of similar RTL can have different timing because physical placement and routing are different.

Important timing quantities include:

Quantity Meaning
Tclk requested clock period
Tco clock-to-output delay of the launching flip-flop
Tlogic LUT, carry, mux, or block delay
Trouting delay through FPGA routing
Tsetup setup requirement of the capturing flip-flop
Slack timing margin after required delay is met

For a simple register-to-register setup path:

required time = Tclk - Tsetup - clock uncertainty
arrival time = Tco + Tlogic + Trouting
setup slack = required time - arrival time

Positive slack means the path meets the setup requirement. Negative slack means the design is too slow for that clock unless you change RTL, constraints, placement, pipelining, or resource use.

Dedicated Blocks

Modern FPGAs include resources that should not be rebuilt from LUTs unless there is a clear reason:

  • BRAM for FIFOs, buffers, frame stores, lookup tables, and packet queues.
  • Distributed RAM for small memories built from LUT resources.
  • DSP slices for fast multiply, add, accumulate, and pipelined arithmetic.
  • PLL/MMCM blocks for clock generation, multiplication, division, and phase alignment.
  • I/O blocks for input/output registers, standards, drive strength, differential I/O, and sometimes delay tuning.

Good FPGA design uses the fabric and dedicated blocks together. For example, a streaming filter may use LUTs for control, flip-flops for pipeline registers, DSP slices for multiply-accumulate, and BRAM for coefficient or sample storage.

Practical Checks

Before trusting a fabric-level design, check:

  • LUT count, flip-flop count, BRAM count, and DSP count;
  • highest-fanout nets such as resets, enables, and wide control signals;
  • critical path reports and whether the delay is logic-heavy or routing-heavy;
  • inferred resource type for memories and arithmetic;
  • whether registers were optimized away unexpectedly;
  • whether clock enables, resets, and generated clocks match the intended hardware.

Common Mistakes

  • Thinking a LUT is software table lookup.
  • Counting LUTs while ignoring routing, fanout, BRAM, DSP, and clocks.
  • Building large memories from registers by accident.
  • Writing one huge combinational expression that becomes a long timing path.
  • Assuming a design without timing constraints is validated.
  • Forgetting that a reset or enable net with huge fanout can become a timing problem.

Summary

FPGA fabric combines LUTs for logic, flip-flops for state, routing for connectivity, and dedicated blocks for common heavy tasks. A LUT with n inputs stores 2^n entries. Timing depends on register delays, logic depth, routing, clock uncertainty, setup requirements, and fanout. Learning to read these resources in reports is the bridge from HDL syntax to real hardware design.

Next: Open-Source FPGA Toolchains: Yosys, nextpnr, APIO.

Further Reading

  • AMD/Xilinx: configurable logic block and clocking user guides.
  • Intel FPGA: adaptive logic module and timing analyzer documentation.
  • Lattice Semiconductor: iCE40 and ECP5 architecture documentation.
  • Yosys Manual: technology mapping, memory inference, and synthesis passes.

Mind Map

mindmap root((FPGA Fabric)) Core idea LUT truth table FF stores state Routing connects Blocks add speed Formulas LUT entries 2^n Arrival Tco plus logic Setup slack required minus arrival Positive slack passes Applications Counters FSMs FIFOs DSP pipelines Fast IO Design checks Resource report Critical path Fanout nets BRAM inference DSP inference Common mistakes LUT as software Long combo path RAM as FFs No timing constraint