OK, what’s this?
This page is the example part of another post, which explains the meaning of set_input_delay and set_output_delay in SDC timing constraints.
In accordance with that other post, the timing constraints behind the examples below are:
create_clock -name theclk -period 20 [get_ports test_clk] set_output_delay -clock theclk -max 8 [get_ports test_out] set_output_delay -clock theclk -min -3 [get_ports test_out] set_input_delay -clock theclk -max 4 [get_ports test_in] set_input_delay -clock theclk -min 2 [get_ports test_in]
Analysis of set_input_delay -max (setup)
Slack (MET) : 15.664ns (required time - arrival time) Source: test_in (input port clocked by theclk {rise@0.000ns fall@10.000ns period=20.000ns}) Destination: test_samp_reg/D (rising edge-triggered cell FDRE clocked by theclk {rise@0.000ns fall@10.000ns period=20.000ns}) Path Group: theclk Path Type: Setup (Max at Fast Process Corner) Requirement: 20.000ns (theclk rise@20.000ns - theclk rise@0.000ns) Data Path Delay: 2.465ns (logic 0.291ns (11.797%) route 2.175ns (88.203%)) Logic Levels: 1 (IBUF=1) Input Delay: 4.000ns Clock Path Skew: 2.162ns (DCD - SCD + CPR) Destination Clock Delay (DCD): 2.162ns = ( 22.162 - 20.000 ) Source Clock Delay (SCD): 0.000ns Clock Pessimism Removal (CPR): 0.000ns Clock Uncertainty: 0.035ns ((TSJ^2 + TIJ^2)^1/2 + DJ) / 2 + PE Total System Jitter (TSJ): 0.071ns Total Input Jitter (TIJ): 0.000ns Discrete Jitter (DJ): 0.000ns Phase Error (PE): 0.000ns Location Delay type Incr(ns) Path(ns) Netlist Resource(s) ------------------------------------------------------------------- ------------------- (clock theclk rise edge) 0.000 0.000 r input delay 4.000 4.000 AE20 0.000 4.000 r test_in (IN) net (fo=0) 0.000 4.000 test_in AE20 IBUF (Prop_ibuf_I_O) 0.291 4.291 r test_in_IBUF_inst/O net (fo=1, routed) 2.175 6.465 test_in_IBUF SLICE_X0Y1 FDRE r test_samp_reg/D ------------------------------------------------------------------- ------------------- (clock theclk rise edge) 20.000 20.000 r AE23 0.000 20.000 r test_clk (IN) net (fo=0) 0.000 20.000 test_clk AE23 IBUF (Prop_ibuf_I_O) 0.077 20.077 r test_clk_IBUF_inst/O net (fo=1, routed) 1.278 21.355 test_clk_IBUF BUFGCTRL_X0Y4 BUFG (Prop_bufg_I_O) 0.026 21.381 r test_clk_IBUF_BUFG_inst/O net (fo=2, routed) 0.781 22.162 test_clk_IBUF_BUFG SLICE_X0Y1 FDRE r test_samp_reg/C clock pessimism 0.000 22.162 clock uncertainty -0.035 22.126 SLICE_X0Y1 FDRE (Setup_fdre_C_D) 0.003 22.129 test_samp_reg ------------------------------------------------------------------- required time 22.129 arrival time -6.465 ------------------------------------------------------------------- slack 15.664
This analysis starts at time zero. It then adds the 4 ns (clock-to-output) that was specified in the max input delay constraint, and continues that data path. The values that are used for the delays of the logic elements are those of the fastest possible combination of process, voltage and temperature. Together with the FPGA’s own data path delay (2.465 ns), the total data path delay stands at 6.465 ns.
The clock path is then calculated, starting from the following clock at 20 ns. Once again, the values of the delays are chosen from the fastest possible combination. The clock travels from the input pin to the flip-flop (with no compensation for the clock network delay, since no PLL is involved). This calculation also takes the estimated jitter into account (by virtue of "clock uncertainty"). All in all, the clock path ends at 22.129 ns, which is 15.664 ns after the data arrived to the flip-flop. This is the constraint’s slack.
This analysis shows that the number to put on a set_input_delay -max constraint is the maximal clock-to-output of the external device that drives the input pin ( + the trace delay of the board). This conclusion is made because the number is used as the starting time of the data path. Note the "Max" part in the Path Type above.
Analysis of set_input_delay -min (hold)
Min Delay Paths -------------------------------------------------------------------------------------- Slack (VIOLATED) : -0.045ns (arrival time - required time) Source: test_in (input port clocked by theclk {rise@0.000ns fall@10.000ns period=20.000ns}) Destination: test_samp_reg/D (rising edge-triggered cell FDRE clocked by theclk {rise@0.000ns fall@10.000ns period=20.000ns}) Path Group: theclk Path Type: Hold (Min at Slow Process Corner) Requirement: 0.000ns (theclk rise@0.000ns - theclk rise@0.000ns) Data Path Delay: 3.443ns (logic 0.626ns (18.194%) route 2.817ns (81.806%)) Logic Levels: 1 (IBUF=1) Input Delay: 2.000ns Clock Path Skew: 5.351ns (DCD - SCD - CPR) Destination Clock Delay (DCD): 5.351ns Source Clock Delay (SCD): 0.000ns Clock Pessimism Removal (CPR): -0.000ns Clock Uncertainty: 0.035ns ((TSJ^2 + TIJ^2)^1/2 + DJ) / 2 + PE Total System Jitter (TSJ): 0.071ns Total Input Jitter (TIJ): 0.000ns Discrete Jitter (DJ): 0.000ns Phase Error (PE): 0.000ns Location Delay type Incr(ns) Path(ns) Netlist Resource(s) ------------------------------------------------------------------- ------------------- (clock theclk rise edge) 0.000 0.000 r input delay 2.000 2.000 AE20 0.000 2.000 r test_in (IN) net (fo=0) 0.000 2.000 test_in AE20 IBUF (Prop_ibuf_I_O) 0.626 2.626 r test_in_IBUF_inst/O net (fo=1, routed) 2.817 5.443 test_in_IBUF SLICE_X0Y1 FDRE r test_samp_reg/D ------------------------------------------------------------------- ------------------- (clock theclk rise edge) 0.000 0.000 r AE23 0.000 0.000 r test_clk (IN) net (fo=0) 0.000 0.000 test_clk AE23 IBUF (Prop_ibuf_I_O) 0.734 0.734 r test_clk_IBUF_inst/O net (fo=1, routed) 2.651 3.385 test_clk_IBUF BUFGCTRL_X0Y4 BUFG (Prop_bufg_I_O) 0.093 3.478 r test_clk_IBUF_BUFG_inst/O net (fo=2, routed) 1.873 5.351 test_clk_IBUF_BUFG SLICE_X0Y1 FDRE r test_samp_reg/C clock pessimism 0.000 5.351 clock uncertainty 0.035 5.387 SLICE_X0Y1 FDRE (Hold_fdre_C_D) 0.101 5.488 test_samp_reg ------------------------------------------------------------------- required time -5.488 arrival time 5.443 ------------------------------------------------------------------- slack -0.045
This analysis starts at time zero. It then adds the 2 ns (clock-to-output) that was specified in the min input delay constraint, and continues that data path. The values that are used for the delays of the logic elements are those of the slowest possible combination of process, voltage and temperature. Together with the FPGA’s own data path delay (3.443 ns), the total data path delay stands at 5.443 ns. It should be no surprise that the FPGA’s own delay is bigger compared with the fast analysis above.
The clock path is then calculated, now with the slowest possible combination. This calculation starts from the same clock edge at 0 ns. After all, this is a calculation of hold timing, so the question is whether the data wasn't changed at the input of the flip-flop before it managed to sample it.
The clock travels from the input pin to the flip-flop (with no compensation for the clock network delay, since no PLL is involved). This calculation also takes the estimated jitter into account (by virtue of "clock uncertainty"). Note that it has the same value as the calculation for the setup, but with a reversed sign. It's the same jitter, but the worst case is in the opposite direction.
All in all, the clock path ends at 5.488 ns, which is 0.045 ns too late (the data changed at 5.443 ns). So the constraint was violated, with a negative slack of 0.045 ns.
This analysis shows that the number to put on a set_input_delay -min constraint is the minimal clock-to-output of the external device that drives the input pin. This conclusion is made because the number is used as the starting time of the data path. Note the "Min" part in the Path Type above.
It may come as a surprise that a minimal clock-to-output of 2 ns can violate a hold constraint. This shouldn’t be taken lightly — like any violated timing constraint, it can cause real problems if it's ignored.
The solution for this case would be to add a PLL to the clock path, which locks the global network’s clock to the input clock. This effectively means pulling it several nanoseconds earlier, which definitely solves the problem.
Analysis of set_output_delay -max (setup)
Slack (MET) : 2.983ns (required time - arrival time) Source: test_out_reg/C (rising edge-triggered cell FDRE clocked by theclk {rise@0.000ns fall@10.000ns period=20.000ns}) Destination: test_out (output port clocked by theclk {rise@0.000ns fall@10.000ns period=20.000ns}) Path Group: theclk Path Type: Max at Slow Process Corner Requirement: 20.000ns (theclk rise@20.000ns - theclk rise@0.000ns) Data Path Delay: 3.631ns (logic 2.583ns (71.152%) route 1.047ns (28.848%)) Logic Levels: 1 (OBUF=1) Output Delay: 8.000ns Clock Path Skew: -5.351ns (DCD - SCD + CPR) Destination Clock Delay (DCD): 0.000ns = ( 20.000 - 20.000 ) Source Clock Delay (SCD): 5.351ns Clock Pessimism Removal (CPR): 0.000ns Clock Uncertainty: 0.035ns ((TSJ^2 + TIJ^2)^1/2 + DJ) / 2 + PE Total System Jitter (TSJ): 0.071ns Total Input Jitter (TIJ): 0.000ns Discrete Jitter (DJ): 0.000ns Phase Error (PE): 0.000ns Location Delay type Incr(ns) Path(ns) Netlist Resource(s) ------------------------------------------------------------------- ------------------- (clock theclk rise edge) 0.000 0.000 r AE23 0.000 0.000 r test_clk (IN) net (fo=0) 0.000 0.000 test_clk AE23 IBUF (Prop_ibuf_I_O) 0.734 0.734 r test_clk_IBUF_inst/O net (fo=1, routed) 2.651 3.385 test_clk_IBUF BUFGCTRL_X0Y4 BUFG (Prop_bufg_I_O) 0.093 3.478 r test_clk_IBUF_BUFG_inst/O net (fo=2, routed) 1.873 5.351 test_clk_IBUF_BUFG SLICE_X0Y1 FDRE r test_out_reg/C ------------------------------------------------------------------- ------------------- SLICE_X0Y1 FDRE (Prop_fdre_C_Q) 0.223 5.574 r test_out_reg/Q net (fo=1, routed) 1.047 6.622 test_out_OBUF AK21 OBUF (Prop_obuf_I_O) 2.360 8.982 r test_out_OBUF_inst/O net (fo=0) 0.000 8.982 test_out AK21 r test_out (OUT) ------------------------------------------------------------------- ------------------- (clock theclk rise edge) 20.000 20.000 r clock pessimism 0.000 20.000 clock uncertainty -0.035 19.965 output delay -8.000 11.965 ------------------------------------------------------------------- required time 11.965 arrival time -8.982 ------------------------------------------------------------------- slack 2.983
Since the purpose of this analysis is to measure the output delay, it starts off with the clock edge, follows it towards the flip-flop, and then along the data path. That sums up to the total delay, which turns out to be 8.982 ns.
Note that the "Path Type" doesn’t say that it’s a calculation for setup (to avoid confusion?), even though it takes the following clock (at 20 ns) into consideration (and not the same clock, at 0 ns).
The calculation takes place at the slowest possible combination of process, voltage and temperature (recall that the input setup calculation took place with the fastest combination). The clock path is very similar to the clock path of the analysis of hold timing for the input delay. This is quite expected, as both calculations are based upon the slow model.
The total delay is compared with the time of the following clock at 20 ns, minus the value given with set_output_delay. Minus the estimated jitter (0.035 ns in the case above).
To summarize, the data reaches a stable logic state at 8.982 ns, and the time that it has to be stable is about 12 ns, so there’s a slack of almost 3 ns.
This demonstrates why the number that is used with set_output_delay -max should be the setup time that is specified for the input of the external device. This timing constraint is verified by calculating the difference between the total delay to valid data at the output, and the following clock’s time position. This difference is the goal to achieve. That’s exactly the definition of setup time: How long the data must be stable before the next clock.
Analysis of set_output_delay -min (hold)
Slack (MET) : 0.791ns (arrival time - required time) Source: test_out_reg/C (rising edge-triggered cell FDRE clocked by theclk {rise@0.000ns fall@10.000ns period=20.000ns}) Destination: test_out (output port clocked by theclk {rise@0.000ns fall@10.000ns period=20.000ns}) Path Group: theclk Path Type: Min at Fast Process Corner Requirement: 0.000ns (theclk rise@0.000ns - theclk rise@0.000ns) Data Path Delay: 1.665ns (logic 1.384ns (83.159%) route 0.280ns (16.841%)) Logic Levels: 1 (OBUF=1) Output Delay: -3.000ns Clock Path Skew: -2.162ns (DCD - SCD - CPR) Destination Clock Delay (DCD): 0.000ns Source Clock Delay (SCD): 2.162ns Clock Pessimism Removal (CPR): -0.000ns Clock Uncertainty: 0.035ns ((TSJ^2 + TIJ^2)^1/2 + DJ) / 2 + PE Total System Jitter (TSJ): 0.071ns Total Input Jitter (TIJ): 0.000ns Discrete Jitter (DJ): 0.000ns Phase Error (PE): 0.000ns Location Delay type Incr(ns) Path(ns) Netlist Resource(s) ------------------------------------------------------------------- ------------------- (clock theclk rise edge) 0.000 0.000 r AE23 0.000 0.000 r test_clk (IN) net (fo=0) 0.000 0.000 test_clk AE23 IBUF (Prop_ibuf_I_O) 0.077 0.077 r test_clk_IBUF_inst/O net (fo=1, routed) 1.278 1.355 test_clk_IBUF BUFGCTRL_X0Y4 BUFG (Prop_bufg_I_O) 0.026 1.381 r test_clk_IBUF_BUFG_inst/O net (fo=2, routed) 0.781 2.162 test_clk_IBUF_BUFG SLICE_X0Y1 FDRE r test_out_reg/C ------------------------------------------------------------------- ------------------- SLICE_X0Y1 FDRE (Prop_fdre_C_Q) 0.100 2.262 r test_out_reg/Q net (fo=1, routed) 0.280 2.542 test_out_OBUF AK21 OBUF (Prop_obuf_I_O) 1.284 3.826 r test_out_OBUF_inst/O net (fo=0) 0.000 3.826 test_out AK21 r test_out (OUT) ------------------------------------------------------------------- ------------------- (clock theclk rise edge) 0.000 0.000 r clock pessimism 0.000 0.000 clock uncertainty 0.035 0.035 output delay 3.000 3.035 ------------------------------------------------------------------- required time -3.035 arrival time 3.826 ------------------------------------------------------------------- slack 0.791
This analysis is similar to the max output delay, only it’s calculated against the same clock edge (and not the following one). Also, the calculation is made on the fastest possible combination of process, voltage and temperature.
Similar to before, the clock path is very similar to the clock path of the analysis of setup timing for the input delay. This is quite expected, as both calculations are based upon the fast model.
As with the calculation for set_output_delay -max, the data path continues the clock path until the output is stable. This is calculated to happen at 3.826 ns (note the difference with the slow model).
This is compared with the time of the same clock at 0 ns, minus the output delay. Recall that the min output delay in the timing constraint is negative (-3 ns), which is why it appears as a positive number in the calculation.
The estimated jitter, 0.035 ns, is also added (I don't really understand why the jitter is used in this calculation, since it's on the same clock cycle).
Conclusion: The data was stable until 3.826 ns, and needs to be stable until 3.035 ns. That’s fine, with 0.791 ns as the slack.
This demonstrates why the number that is used with set_output_delay -min is the hold time, that is specified for the input of the external device, with a reversed sign. This timing constraint is verified by requiring that the total delay is larger than this given number. In other words, the data must be stable for that long after the clock. This is the definition of hold time.