01signal.com

Vivado 对 set_input_delay 和 set_output_delay 约束的时序分析

好的,这是什么?

本页是另一篇文章的示例部分,那篇文章解释了 SDC 时序约束(timing constraints)中 set_input_delay 和 set_output_delay 的含义。

按照那篇文章的说法,下面这些示例用到的时序约束是:

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(建立时间)分析

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)约束中指定的 4 ns(时钟到输出)加上去,并沿着这条数据路径(data path)继续。逻辑元件延迟所采用的数值,来自工艺、电压与温度最快的可能组合。再加上 FPGA 自身的数据路径延迟(2.465 ns),总数据路径延迟为 6.465 ns。

接着计算时钟路径(clock path),从 20 ns 处的下一个时钟沿开始。延迟数值同样取最快可能组合。时钟从输入引脚走到触发器(这里没有对时钟网络延迟做补偿,因为没有用到 PLL)。这个计算还把估计的抖动(jitter)也算了进去(通过“clock uncertainty”这个量)。总体算下来,时钟路径在 22.129 ns 处结束,比数据到达触发器晚了 15.664 ns。这就是该约束的余量(slack)。

这个分析说明了 set_input_delay -max 约束中应填写的数,是驱动输入引脚的外部器件的最大时钟到输出(clock-to-output)延迟,再加上电路板走线延迟。得出这个结论,是因为这个数被用作数据路径的起始时间。注意上文 Path Type 里的 “Max”。

set_input_delay -min(保持时间)分析

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)约束中指定的 2 ns(时钟到输出)加上去,并沿着这条数据路径继续。逻辑元件延迟采用工艺、电压与温度最慢可能组合下的数值。再加上 FPGA 自身的数据路径延迟(3.443 ns),总数据路径延迟为 5.443 ns。与上面的快速分析相比,FPGA 自身的延迟更大,这一点并不奇怪。

接下来计算时钟路径,但这次采用最慢的可能组合。计算从0 ns 处的同一个时钟沿开始。毕竟这是在计算保持时间,问题在于触发器来得及采样之前,它输入的数据是不是已经变了。

时钟从输入引脚走到触发器(这里没有对时钟网络延迟做补偿,因为没有用到 PLL)。计算也把估计的抖动算了进去(通过“clock uncertainty”)。请注意,它的数值与建立时间的计算相同,但符号相反。抖动本身是同一个量,只是最坏情况出现在相反方向上。

总体算下来,时钟路径在 5.488 ns 处结束,比数据变化晚了 0.045 ns(数据是在 5.443 ns 变化的)。因此这个约束被违反,负余量为 0.045 ns。

这个分析说明了 set_input_delay -min 约束中应填写的数,是驱动输入引脚的外部器件的最小时钟到输出延迟。得出这个结论,是因为这个数被用作数据路径的起始时间。注意上文 Path Type 里的 “Min”。

也许有人会意外:最小时钟到输出延迟只有 2 ns,也会违反保持时间约束。这不应被轻视——和任何被违反的时序约束一样,如果置之不理,它会造成实际的问题。

这种情况的解决办法是在时钟路径上加入一个 PLL,把全局时钟网络的时钟与输入时钟锁定。这实际上等于把时钟拉早几个纳秒,肯定能解决问题。

set_output_delay -max(建立时间)分析

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

由于这次分析的目的是衡量输出延迟,所以它从时钟沿出发,顺着时钟路径走到触发器,再继续沿着数据路径前进。把这些加起来就得到总延迟,算出来是 8.982 ns。

请注意,尽管这次计算考虑的是 20 ns 处的下一个时钟(而不是 0 ns 处的同一个时钟),但上面的 “Path Type” 里并没有说明这是建立时间的计算(也许是为了避免混淆?)。

这次计算采用工艺、电压与温度最慢的可能组合(回忆一下,输入端建立时间的计算用的是最快组合)。这里的时钟路径与输入延迟的保持时间分析中的时钟路径非常相似。这很符合预期,因为两次计算都基于慢速模型。

总延迟要与 20 ns 处下一个时钟的时刻做比较,并减去 set_output_delay 中给定的值,再减去估计的抖动(上面的例子中是 0.035 ns)。

总结一下:数据在 8.982 ns 时达到稳定的逻辑状态,而它需要保持稳定的时间大约到 12 ns,所以有接近 3 ns 的余量。

这说明了 set_output_delay -max 中使用的数,为什么应该是外部器件输入所要求的建立时间。验证该时序约束的方法是:计算输出端达到有效数据所需的总延迟与下一个时钟沿位置之差。这个差就是要达到的目标。而这也正是建立时间的定义:在下一次时钟到来之前,数据必须保持稳定的时间长度。

set_output_delay -min(保持时间)分析

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

这次分析与上面 set_output_delay -max 的分析类似,只是它按同一个时钟沿计算(而不是下一个时钟沿)。另外,计算采用工艺、电压与温度最快的可能组合。

和前面一样,这里的时钟路径与输入端建立时间分析中的时钟路径非常相似。这很符合预期,因为两次计算都基于快速模型。

与 set_output_delay -max 的计算一样,数据路径沿着时钟路径继续,直到输出稳定。计算得到的稳定时刻是 3.826 ns(注意这与慢速模型之间的差别)。

再把这个时间与 0 ns 处同一个时钟的时刻比较,并减去输出延迟。回想一下,时序约束中的最小输出延迟是负数(-3 ns),所以在计算中它表现为正数。

另外还加上了估计的抖动 0.035 ns(我不太明白为什么在这种计算中也要计入抖动,因为这里用的是同一个时钟周期)。

结论:数据一直稳定到 3.826 ns,并且需要稳定到 3.035 ns。这没有问题,余量为 0.791 ns。

这说明了 set_output_delay -min 中使用的数,为什么应该是外部器件输入所要求的保持时间(hold time),并且取相反的符号。验证该时序约束的方法是:要求总延迟大于这个给定数。换句话说,时钟沿之后数据还必须继续保持稳定那么久。这正是保持时间的定义。

本页由机器从英文翻译而来。如有疑问,请参阅原文
Copyright © 2021-2026. All rights reserved. (dcc38493)