Skip to content
Tutorials Center
My learning

Topics

Lesson 28 of 37 ยท Synthesis and FPGA

What Synthesis Does

Understand what logic synthesis does with VHDL: the synthesizable subset, elaboration, optimization and technology mapping to LUTs and flip-flops, with C models.

Simulation tells you whether your VHDL behaves correctly. Synthesis turns it into something you can actually build: a network of logic gates and flip-flops, or on an FPGA, a configuration of look-up tables (LUTs) and registers. Synthesis is not compilation in the software sense; the result is a circuit that does everything at once, not instructions that run one after another. Understanding what the tool does with your code is the difference between designs that work on the board and designs that only work in the simulator.

Synthesis tools (Vivado, Quartus, Yosys and others) cannot run on this site, so VHDL is read-only. C stand-ins model LUTs, gate counting and logic, to make the ideas concrete.

The flow in four steps

flowchart LR
  A["VHDL source"] --> B["Elaboration<br/>(read, check types)"]
  B --> C["RTL netlist<br/>(adders, muxes, registers)"]
  C --> D["Optimization<br/>(simplify, share, remove unused)"]
  D --> E["Technology mapping<br/>(LUTs, flip-flops, RAM, DSP)"]
  E --> F["Gate-level netlist"]

Synthesis stages, simplified. After this come place and route, timing analysis and bitstream generation.

  1. Elaboration parses the code, checks types and builds an internal picture of registers and operators. a + b becomes an adder, an if chain becomes a multiplexer, a clocked process becomes flip-flops.
  2. Optimization removes logic whose result is never used, merges identical logic, propagates constants (x and '0' is always '0') and shares resources.
  3. Technology mapping fits the logic to the actual building blocks of the chip. An FPGA has LUTs, flip-flops, block RAM and DSP slices; an ASIC has a library of standard cells.
  4. Reports list resource use (LUT count, registers, RAM), warnings (latches, unconnected ports) and the estimated timing.

The synthesizable subset

VHDL was designed for describing and simulating hardware, so it contains many features with no hardware equivalent. Synthesis tools accept a subset:

Usually synthesizable Not synthesizable (simulation only)
std_logic, unsigned, signed, enumerations, records, arrays real and time arithmetic in logic
process with a clock edge or a complete combinational description wait for 10 ns; and after delays
if, case, for ... loop with constant bounds file I/O (textio), report, assert (ignored)
generate, generics, constants access types (pointers), shared variable objects
Operators + - * and or xor etc. while loops with data-dependent bounds

Delays are the classic trap: y <= a after 5 ns; simulates a delay but synthesis ignores it. The real delay is whatever the silicon gives you. So never use delays to make a design work.

If a design passes simulation but fails on the board, check first for untimed behavior: delays, uninitialized signals, latches, and inputs that change asynchronously to the clock.

Everything happens at once

In software, a = b + c; d = a + e; takes two steps. In hardware two adders are built and work in parallel (the second one simply waits for the first one's output to settle). VHDL concurrent statements, process bodies and for loops all describe structure, and a for loop is unrolled into repeated copies of logic.

VHDL
-- Becomes 8 AND gates side by side, not 8 time steps
for i in 0 to 7 loop
  y(i) <= a(i) and b(i);
end loop;

The loop bounds must be known at synthesis time. A loop that needs 1,000 iterations creates 1,000 copies of the logic: valid, but huge.

What a LUT is

An FPGA does not contain AND and OR gates. Its basic cell is a look-up table: a tiny memory with N address inputs (commonly 4 or 6) and one output. Any Boolean function of N variables can be stored in it by writing its truth table. Synthesis' job is to cover your logic with as few LUTs as possible.

C C stand-in: a 4-input LUT as a truth table in memory

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with scanf or fgets), it gets the next line from this box.

Any four-input function costs exactly one LUT, whether it is an AND or a complicated mess. Functions with more inputs need several LUTs chained together, and that chain is what determines how fast your design can run.

Constant folding and dead logic

Synthesis removes what does not matter. In the next program, a function with a constant input collapses, and an unused result disappears. It models what the optimizer does by checking which input combinations still change the output.

C C stand-in: does an input matter? (the optimizer's question)

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with scanf or fgets), it gets the next line from this box.

You will see this in a real report as a warning: "input c is unused" or "signal x has no load". Treat such warnings as bugs unless you meant it.

Resources you will meet

Resource What it is Typical VHDL that infers it
LUT any small Boolean function and, or, case on few inputs
Flip-flop 1-bit register clocked process (rising_edge)
Block RAM on-chip memory array with synchronous read/write
DSP slice multiplier plus adder * on 18-bit or wider operands
Carry chain fast adder + and - on unsigned
I/O buffer pin driver entity ports

Reading the reports

After synthesis, open the utilization report (how many LUTs, registers, RAM blocks) and the warnings list. Typical messages and what they mean:

  • Inferred latch: you did not assign a signal on every path (next lesson).
  • Signal driven by constant / unused: dead logic or a port you forgot to connect.
  • Multiple drivers: two processes assign one signal.
  • Sequential element removed: a register whose output is never used was deleted.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does synthesis do with 'y <= a after 5 ns;'?

    After clauses are simulation-only. Synthesis builds the logic without them.
  2. 2. How is a for loop with constant bounds synthesized?

    Loops describe structure; the tool replicates the body for each iteration.
  3. 3. A 4-input LUT can implement

    A LUT stores the truth table, so any function of its inputs fits.
  4. 4. Which VHDL feature is usually NOT synthesizable?

    File access exists only in simulation; hardware has no file system.

Summary

  • Synthesis converts VHDL into registers, LUTs, RAM and DSP blocks through elaboration, optimization and technology mapping.
  • Only a subset of VHDL is synthesizable; delays, file I/O and report are simulation-only.
  • Hardware is parallel; loops unroll into copies and need constant bounds.
  • A LUT stores a truth table, so any small function costs one LUT.
  • Read the warnings: dead logic, latches and multiple drivers are usually bugs.

Next: Inferred Hardware: Registers, Latches and Memories