好的,这是什么?
本页是另一篇帖子的示例部分,解释了 SDC timing constraints中 set_input_delay 和 set_output_delay 的含义。
根据其他帖子,以下示例背后的 timing constraints 是:
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]
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
该分析从时间零开始。然后它添加在 max input delay constraint中指定的 4 ns (clock-to-output),并继续该 data path。 logic elements 的 delays 使用的值是 process、电压和温度的最快组合值。加上 FPGA自己的 data path delay (2.465 ns),总的 data path delay 为 6.465 ns。
然后计算 clock path ,从后面的 clock 到 20 ns开始。再一次, delays 的值是从可能的最快组合中选择的。 clock 从 input pin 移动到 flip-flop (对 clock network delay没有补偿,因为不涉及 PLL )。此计算还考虑了估计的 jitter (凭借“clock uncertainty”)。总而言之, clock path 结束于 22.129 ns,也就是 data 到 flip-flop之后的 15.664 ns 。这是 constraint的 slack。
该分析表明, set_input_delay -max constraint 上放置的数量是驱动 input pin 的外部设备的最大 clock-to-output (+ 板的 trace delay )。之所以得出这个结论,是因为 data path是以数字作为起始时间。注意上面 Path Type 中的“Max”部分。
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
该分析从时间零开始。然后它添加在 min input delay constraint中指定的 2 ns (clock-to-output),并继续 data path。 logic elements 的 delays 使用的值是 process、电压和温度的最慢组合的值。加上 FPGA自己的 data path delay (3.443 ns), data path delay 的总和为 5.443 ns。与上面的快速分析相比, FPGA自己的 delay 更大应该不足为奇。
然后计算 clock path ,现在使用最慢的组合。此计算从 0 ns处的相同 clock edge 开始。毕竟这是 hold timing的计算,所以问题是 flip-flop 的 input 上的数据在采样之前是否没有变化。
clock 从 input pin 移动到 flip-flop (对 clock network delay没有补偿,因为不涉及 PLL )。此计算还考虑了估计的 jitter (凭借“clock uncertainty”)。请注意,它与 setup的计算值相同,但符号相反。它是相同的 jitter,但最坏的情况是相反的方向。
总而言之, clock path 以 5.488 ns结束,这是 0.045 ns 为时已晚( data 更改为 5.443 ns)。所以 constraint 被违反了, 0.045 ns的 negative slack 。
该分析表明, set_input_delay -min constraint 上要安装的数字是驱动 input pin的外部设备的最小 clock-to-output 。之所以得出这个结论,是因为这个数字是作为 data path的启动时间。注意上面 Path Type 中的“Min”部分。
令人惊讶的是, 2 ns 的最小 clock-to-output 可能会违反 hold constraint。这不应该掉以轻心——就像任何违反的 timing constraint一样,如果忽略它可能会导致真正的问题。
这种情况的解决方案是在 clock path上添加一个 PLL ,将 global network的 clock 锁定到 input clock。这实际上意味着提前几纳秒拉动它,这绝对解决了问题。
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
由于此分析的目的是测量 output delay,因此它从 clock edge开始,然后沿着 flip-flop,然后沿着 data path。总和为 delay,结果是 8.982 ns。
请注意,“Path Type”并不是说它是 setup 的计算(为了避免混淆?),即使它考虑了以下 clock (at 20 ns)(而不是 clock,在 0 ns).
计算以 process、电压和温度的最慢组合进行(回想一下, input setup 计算以最快的组合进行)。 clock path 与 clock path 的分析 input delay的 hold timing 非常相似。这是意料之中的,因为这两个计算都是基于慢速 model。
总的 delay 与后面的 clock 在 20 ns的时间相比较,减去 set_output_delay给出的值。减去估计的 jitter (在上述情况下为0.035 ns )。
总而言之, data 在 8.982 ns达到稳定的 logic state ,它必须稳定的时间大约是 12 ns,所以 slack 几乎是 3 ns。
这说明了为什么与 set_output_delay -max 一起使用的编号应该是为外部设备的 input 指定的 setup time 。通过计算 output处的总 delay 与有效 data 与后续 clock的时间位置之间的差异来验证此 timing constraint 。这种差异是要达到的目标。这正是 setup time的定义: data 在下一个 clock之前必须稳定多长时间。
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
此分析类似于 max output delay,只是它是针对相同的 clock edge (而不是下一个)计算的。此外,计算是根据 process、电压和温度的最快组合进行的。
与之前类似, clock path 与 input delay的分析 setup timing 的 clock path 非常相似。这是意料之中的,因为这两个计算都是基于快速 model。
与 set_output_delay -max的计算一样, data path 继续 clock path 直到 output 稳定。这是计算发生在 3.826 ns (注意与慢 model的区别)。
这是在 0 ns上与相同 clock 的时间进行比较,减去 output delay。回想一下 timing constraint 中的 min output delay 是负数 (-3 ns),这就是它在计算中显示为正数的原因。
还添加了估计的 jitter、 0.035 ns(我不太明白为什么在此计算中使用 jitter ,因为它在同一个 clock cycle上)。
结论: data 稳定到 3.826 ns,需要稳定到 3.035 ns。没关系, 0.791 ns 就是 slack。
这说明了为什么与 set_output_delay -min 一起使用的数字是 hold time,它是为外部设备的 input 指定的,符号相反。此 timing constraint 通过要求总 delay 大于此给定数字来验证。换句话说, data 必须在 clock之后的很长时间内保持稳定。这是 hold time的定义。