FPGA Constraints and Timing Closure: XDC, WNS and Fixes

Constraints tell the tools two things they can't guess: which package pin each port uses, with its voltage standard, and how fast each clock runs. With a clock constraint, static timing analysis checks every path between flip-flops: the data must arrive a setup time before the next clock edge. The margin on the worst path is the worst negative slack (WNS); timing closure means getting it to zero or above.

What you'll learn

  • Pin and I/O standard constraints
  • The clock constraint, and why every design needs one
  • Setup slack and WNS, with real numbers
  • What to do when a path fails

Pins and the clock

These are the constraints for the blink project on a Basys 3, uncommented from Digilent's master file: the clock pin, the 100 MHz clock (a 10 ns period) and the LED pin, each at 3.3 V LVCMOS.

blink_basys3.xdc
## From Digilent's Basys-3-Master.xdc (github.com/Digilent/digilent-xdc), uncommented for this design.
set_property -dict { PACKAGE_PIN W5   IOSTANDARD LVCMOS33 } [get_ports clk]
create_clock -add -name sys_clk_pin -period 10.00 -waveform {0 5} [get_ports clk]
set_property -dict { PACKAGE_PIN U16   IOSTANDARD LVCMOS33 } [get_ports {led[0]}]

What timing analysis checks

For each path from a launching flip-flop to a capturing one, the tool adds clock-to-Q, logic and routing delay to get the data arrival time, and compares it with the required time: the next clock edge, minus setup time, adjusted for clock skew. Slack is required minus arrival. Positive slack meets timing; negative fails.

A timed pathA launch flip-flop drives logic and routing to a capture flip-flop; both are clocked by the same constrained clock. Slack is the required time minus the arrival time.Launch FFLUTs androutingCapture FFClock10 ns
Arrival = clock-to-Q + logic + routing. Required = period − setup ± skew. Slack = required − arrival.

Reading WNS

DesignPeriodWNSWhat it means
Blink, Basys 310 ns+5.949 nsWorst path takes about 4.05 ns; it would close up to about 247 MHz
AXI4-Lite peripheral, first version10 ns−0.064 nsFails: the multiply path takes 10.064 ns
AXI4-Lite peripheral, product registered10 ns+2.932 nsPasses with about 2.9 ns to spare

The 247 MHz figure is a rough estimate, 1 / (10 − 5.949) ns; the real limit depends on how the tool places the design at that speed. Total negative slack (TNS), the sum over all failing endpoints, tells you whether one path fails or hundreds.

When a path fails

  • Pipeline it: add a register in the middle of the long path, as the AXI4-Lite peripheral did with its multiplier.
  • Let the tools use dedicated blocks: write multiplies and memories so they map to DSP slices and block RAM.
  • Reduce logic depth: precompute, use one-hot state encoding, or split wide comparisons.
  • Check the constraint: a path between unrelated clocks may need to be declared asynchronous, with a proper synchronizer in the design.
  • Only then try tool options such as a different implementation strategy.

Common mistakes

  • No clock constraint, so Vivado reports no failing paths and the design fails on the board.
  • Pin constraints copied from a different board revision.
  • Declaring paths false to hide real failures.
  • Synchronous design with an input from a button or another clock domain and no synchronizer: the timing report can't see that problem.

Check your understanding

  • Q1. What does create_clock -period 10.00 tell the tools? Answer: the clock runs at 100 MHz, so data has 10 ns (less setup time and skew) between flip-flops.
  • Q2. A path has WNS −0.5 ns at 200 MHz. Roughly how fast could it run? Answer: about 1 / 5.5 ns, or 182 MHz.
  • Q3. What did registering the multiplier cost the AXI peripheral? Answer: one clock of latency and 17 flip-flops.

The FPGA series

Related

Sources

Last verified

Slack figures are from Vivado 2025.2 timing reports on 17 November 2026; the estimate arithmetic is checked in lib/content2Numbers.test.js.