好了,这是什么?
本页是另一篇文章的示例部分,那篇文章解释了 SDC 时序约束(timing constraints)中 set_input_delay 和 set_output_delay 的含义。
TimeQuest(Quartus 的时序分析器)会在四种边界条件(corner)下做时序分析:最高温、最低温,再分别配合最高压、最低压。对每一条路径,TimeQuest 会从这些 corner 中挑出时序裕量(slack)最差的结果。下面例子展示的正是这四个 corner 中最坏的情况。因此,时序报告中 FPGA 逻辑元件的延时数值会随报告不同而不同。
我的另一篇文章介绍了下面这类时序报告的生成方法。
与那篇文章一致,下面例子所用的时序约束为:
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)分析
Delay Model:
Slow 1100mV 0C Model
+------------------------------------------------------------------------------------------------------+
; Summary of Paths ;
+--------+-----------+-----------+--------------+-------------+--------------+------------+------------+
; Slack ; From Node ; To Node ; Launch Clock ; Latch Clock ; Relationship ; Clock Skew ; Data Delay ;
+--------+-----------+-----------+--------------+-------------+--------------+------------+------------+
; 12.341 ; test_in ; test_samp ; theclk ; theclk ; 20.000 ; 3.940 ; 7.499 ;
+--------+-----------+-----------+--------------+-------------+--------------+------------+------------+
Path #1: Setup slack is 12.341
===============================================================================
+--------------------------------+
; Path Summary ;
+--------------------+-----------+
; Property ; Value ;
+--------------------+-----------+
; From Node ; test_in ;
; To Node ; test_samp ;
; Launch Clock ; theclk ;
; Latch Clock ; theclk ;
; Data Arrival Time ; 11.499 ;
; Data Required Time ; 23.840 ;
; Slack ; 12.341 ;
+--------------------+-----------+
+---------------------------------------------------------------------------------------+
; Statistics ;
+---------------------------+--------+-------+-------------+------------+-------+-------+
; Property ; Value ; Count ; Total Delay ; % of Total ; Min ; Max ;
+---------------------------+--------+-------+-------------+------------+-------+-------+
; Setup Relationship ; 20.000 ; ; ; ; ; ;
; Clock Skew ; 3.940 ; ; ; ; ; ;
; Data Delay ; 7.499 ; ; ; ; ; ;
; Number of Logic Levels ; ; 1 ; ; ; ; ;
; Physical Delays ; ; ; ; ; ; ;
; Arrival Path ; ; ; ; ; ; ;
; Clock ; ; ; ; ; ; ;
; Clock Network (Lumped) ; ; 1 ; 0.000 ; ; 0.000 ; 0.000 ;
; Data ; ; ; ; ; ; ;
; IC ; ; 2 ; 2.447 ; 33 ; 0.000 ; 2.447 ;
; Cell ; ; 2 ; 5.052 ; 67 ; 0.652 ; 4.400 ;
; Required Path ; ; ; ; ; ; ;
; Clock ; ; ; ; ; ; ;
; Clock Network (Lumped) ; ; 1 ; 3.940 ; 100 ; 3.940 ; 3.940 ;
+---------------------------+--------+-------+-------------+------------+-------+-------+
Note: Negative delays are omitted from totals when calculating percentages
+-----------------------------------------------------------------------------------+
; Data Arrival Path ;
+----------+---------+----+------+--------+-------------------+---------------------+
; Total ; Incr ; RF ; Type ; Fanout ; Location ; Element ;
+----------+---------+----+------+--------+-------------------+---------------------+
; 0.000 ; 0.000 ; ; ; ; ; launch edge time ;
; 0.000 ; 0.000 ; ; ; ; ; clock path ;
; 0.000 ; 0.000 ; R ; ; ; ; clock network delay ;
; 4.000 ; 4.000 ; F ; iExt ; 1 ; PIN_AP17 ; test_in ;
; 11.499 ; 7.499 ; ; ; ; ; data path ;
; 4.000 ; 0.000 ; FF ; IC ; 1 ; IOIBUF_X48_Y0_N58 ; test_in~input|i ;
; 8.400 ; 4.400 ; FF ; CELL ; 1 ; IOIBUF_X48_Y0_N58 ; test_in~input|o ;
; 10.847 ; 2.447 ; FF ; IC ; 1 ; FF_X48_Y2_N40 ; test_samp|asdata ;
; 11.499 ; 0.652 ; FF ; CELL ; 1 ; FF_X48_Y2_N40 ; test_samp ;
+----------+---------+----+------+--------+-------------------+---------------------+
+-------------------------------------------------------------------------------+
; Data Required Path ;
+----------+---------+----+------+--------+---------------+---------------------+
; Total ; Incr ; RF ; Type ; Fanout ; Location ; Element ;
+----------+---------+----+------+--------+---------------+---------------------+
; 20.000 ; 20.000 ; ; ; ; ; latch edge time ;
; 23.940 ; 3.940 ; ; ; ; ; clock path ;
; 23.940 ; 3.940 ; R ; ; ; ; clock network delay ;
; 23.840 ; -0.100 ; ; ; ; ; clock uncertainty ;
; 23.840 ; 0.000 ; ; uTsu ; 1 ; FF_X48_Y2_N40 ; test_samp ;
+----------+---------+----+------+--------+---------------+---------------------+
这个分析从报告中的 Data Arrival Path(数据到达路径)开始:按照 最大输入延时(max input delay)约束,把 test_in 端口上的数据到达时间定为 4 ns,然后继续沿数据路径往下计算。再加上 FPGA 自身的数据路径延时(7.499 ns),总的数据路径延时为 11.499 ns。
接着在 Data Required Path(数据需求路径)中计算时钟路径:从 下一个时钟沿开始,即 20 ns 处。时钟从输入引脚走到触发器(没有 PLL,因此不对时钟网络延时做补偿)。计算时还通过 “时钟不确定度(clock uncertainty)” 把估算的抖动(jitter)考虑了进去。最终时钟路径停在 23.840 ns,也就是比数据到达触发器的时间晚了 12.341 ns。这个值就是该约束的时序裕量(slack)。
这说明 set_input_delay -max 约束里要填的数值,是驱动该输入引脚的外部器件的最大时钟到输出延时(clock-to-output),还要再加上电路板上的走线延时。之所以这样,是因为这个数值被当作数据路径的起始时间。
set_input_delay -min 约束的保持时间(hold)分析
Delay Model:
Slow 1100mV 85C Model
+-----------------------------------------------------------------------------------------------------+
; Summary of Paths ;
+-------+-----------+-----------+--------------+-------------+--------------+------------+------------+
; Slack ; From Node ; To Node ; Launch Clock ; Latch Clock ; Relationship ; Clock Skew ; Data Delay ;
+-------+-----------+-----------+--------------+-------------+--------------+------------+------------+
; 0.770 ; test_in ; test_samp ; theclk ; theclk ; 0.000 ; 4.287 ; 3.057 ;
+-------+-----------+-----------+--------------+-------------+--------------+------------+------------+
Path #1: Hold slack is 0.770
===============================================================================
+--------------------------------+
; Path Summary ;
+--------------------+-----------+
; Property ; Value ;
+--------------------+-----------+
; From Node ; test_in ;
; To Node ; test_samp ;
; Launch Clock ; theclk ;
; Latch Clock ; theclk ;
; Data Arrival Time ; 5.057 ;
; Data Required Time ; 4.287 ;
; Slack ; 0.770 ;
+--------------------+-----------+
+--------------------------------------------------------------------------------------+
; Statistics ;
+---------------------------+-------+-------+-------------+------------+-------+-------+
; Property ; Value ; Count ; Total Delay ; % of Total ; Min ; Max ;
+---------------------------+-------+-------+-------------+------------+-------+-------+
; Hold Relationship ; 0.000 ; ; ; ; ; ;
; Clock Skew ; 4.287 ; ; ; ; ; ;
; Data Delay ; 3.057 ; ; ; ; ; ;
; Number of Logic Levels ; ; 1 ; ; ; ; ;
; Physical Delays ; ; ; ; ; ; ;
; Arrival Path ; ; ; ; ; ; ;
; Clock ; ; ; ; ; ; ;
; Clock Network (Lumped) ; ; 1 ; 0.000 ; ; 0.000 ; 0.000 ;
; Data ; ; ; ; ; ; ;
; IC ; ; 2 ; 2.028 ; 66 ; 0.000 ; 2.028 ;
; Cell ; ; 2 ; 1.029 ; 34 ; 0.290 ; 0.739 ;
; Required Path ; ; ; ; ; ; ;
; Clock ; ; ; ; ; ; ;
; Clock Network (Lumped) ; ; 1 ; 4.287 ; 100 ; 4.287 ; 4.287 ;
+---------------------------+-------+-------+-------------+------------+-------+-------+
Note: Negative delays are omitted from totals when calculating percentages
+----------------------------------------------------------------------------------+
; Data Arrival Path ;
+---------+---------+----+------+--------+-------------------+---------------------+
; Total ; Incr ; RF ; Type ; Fanout ; Location ; Element ;
+---------+---------+----+------+--------+-------------------+---------------------+
; 0.000 ; 0.000 ; ; ; ; ; launch edge time ;
; 0.000 ; 0.000 ; ; ; ; ; clock path ;
; 0.000 ; 0.000 ; R ; ; ; ; clock network delay ;
; 2.000 ; 2.000 ; R ; iExt ; 1 ; PIN_AP17 ; test_in ;
; 5.057 ; 3.057 ; ; ; ; ; data path ;
; 2.000 ; 0.000 ; RR ; IC ; 1 ; IOIBUF_X48_Y0_N58 ; test_in~input|i ;
; 2.739 ; 0.739 ; RR ; CELL ; 1 ; IOIBUF_X48_Y0_N58 ; test_in~input|o ;
; 4.767 ; 2.028 ; RR ; IC ; 1 ; FF_X48_Y2_N40 ; test_samp|asdata ;
; 5.057 ; 0.290 ; RR ; CELL ; 1 ; FF_X48_Y2_N40 ; test_samp ;
+---------+---------+----+------+--------+-------------------+---------------------+
+------------------------------------------------------------------------------+
; Data Required Path ;
+---------+---------+----+------+--------+---------------+---------------------+
; Total ; Incr ; RF ; Type ; Fanout ; Location ; Element ;
+---------+---------+----+------+--------+---------------+---------------------+
; 0.000 ; 0.000 ; ; ; ; ; latch edge time ;
; 4.287 ; 4.287 ; ; ; ; ; clock path ;
; 4.287 ; 4.287 ; R ; ; ; ; clock network delay ;
; 4.287 ; 0.000 ; ; ; ; ; clock uncertainty ;
; 4.287 ; 0.000 ; ; uTh ; 1 ; FF_X48_Y2_N40 ; test_samp ;
+---------+---------+----+------+--------+---------------+---------------------+
这个分析同样从 Data Arrival Path(数据到达路径)开始:按照 最小输入延时(min input delay)约束,把 test_in 端口上的数据到达时间定为 2 ns,然后继续沿数据路径往下计算。再加上 FPGA 自身的数据路径延时(3.057 ns),总的数据路径延时为 5.057 ns。
接着在 Data Required Path(数据需求路径)中计算时钟路径,但这次是从 0 ns 处的同一个时钟沿开始。毕竟这是保持时间(hold)检查,要回答的问题是:在触发器来得及采样之前,数据是不是已经变了。
时钟同样从输入引脚走到触发器(因为不涉及 PLL,所以不做时钟网络延时补偿)。计算时也通过 “时钟不确定度(clock uncertainty)” 计入了估算的抖动,只不过这里它的值是 0。最终时钟路径停在 4.287 ns,比数据变化的时刻早了 0.770 ns。因此 0.770 ns 就是该约束的时序裕量(slack)。
这说明 set_input_delay -min 约束里要填的数值,是驱动该输入引脚的外部器件的最小时钟到输出延时(clock-to-output)。结论同样是因为这个数值被当作数据路径的起始时间。
set_output_delay -max 约束的建立时间(setup)分析
Delay Model:
Slow 1100mV 85C Model
+--------------------------------------------------------------------------------------------------------+
; Summary of Paths ;
+-------+---------------+----------+--------------+-------------+--------------+------------+------------+
; Slack ; From Node ; To Node ; Launch Clock ; Latch Clock ; Relationship ; Clock Skew ; Data Delay ;
+-------+---------------+----------+--------------+-------------+--------------+------------+------------+
; 2.651 ; test_out~reg0 ; test_out ; theclk ; theclk ; 20.000 ; -5.320 ; 3.929 ;
+-------+---------------+----------+--------------+-------------+--------------+------------+------------+
Path #1: Setup slack is 2.651
===============================================================================
+------------------------------------+
; Path Summary ;
+--------------------+---------------+
; Property ; Value ;
+--------------------+---------------+
; From Node ; test_out~reg0 ;
; To Node ; test_out ;
; Launch Clock ; theclk ;
; Latch Clock ; theclk ;
; Data Arrival Time ; 9.249 ;
; Data Required Time ; 11.900 ;
; Slack ; 2.651 ;
+--------------------+---------------+
+---------------------------------------------------------------------------------------+
; Statistics ;
+---------------------------+--------+-------+-------------+------------+-------+-------+
; Property ; Value ; Count ; Total Delay ; % of Total ; Min ; Max ;
+---------------------------+--------+-------+-------------+------------+-------+-------+
; Setup Relationship ; 20.000 ; ; ; ; ; ;
; Clock Skew ; -5.320 ; ; ; ; ; ;
; Data Delay ; 3.929 ; ; ; ; ; ;
; Number of Logic Levels ; ; 0 ; ; ; ; ;
; Physical Delays ; ; ; ; ; ; ;
; Arrival Path ; ; ; ; ; ; ;
; Clock ; ; ; ; ; ; ;
; Clock Network (Lumped) ; ; 1 ; 5.320 ; 100 ; 5.320 ; 5.320 ;
; Data ; ; ; ; ; ; ;
; IC ; ; 1 ; 0.000 ; 0 ; 0.000 ; 0.000 ;
; Cell ; ; 3 ; 3.929 ; 100 ; 0.000 ; 2.150 ;
; uTco ; ; 1 ; 0.000 ; 0 ; 0.000 ; 0.000 ;
; Required Path ; ; ; ; ; ; ;
; Clock ; ; ; ; ; ; ;
; Clock Network (Lumped) ; ; 1 ; 0.000 ; ; 0.000 ; 0.000 ;
+---------------------------+--------+-------+-------------+------------+-------+-------+
Note: Negative delays are omitted from totals when calculating percentages
+---------------------------------------------------------------------------------------+
; Data Arrival Path ;
+---------+---------+----+------+--------+------------------------+---------------------+
; Total ; Incr ; RF ; Type ; Fanout ; Location ; Element ;
+---------+---------+----+------+--------+------------------------+---------------------+
; 0.000 ; 0.000 ; ; ; ; ; launch edge time ;
; 5.320 ; 5.320 ; ; ; ; ; clock path ;
; 5.320 ; 5.320 ; R ; ; ; ; clock network delay ;
; 9.249 ; 3.929 ; ; ; ; ; data path ;
; 5.320 ; 0.000 ; ; uTco ; 1 ; DDIOOUTCELL_X48_Y0_N50 ; test_out~reg0 ;
; 7.099 ; 1.779 ; FF ; CELL ; 1 ; DDIOOUTCELL_X48_Y0_N50 ; test_out~reg0|q ;
; 7.099 ; 0.000 ; FF ; IC ; 1 ; IOOBUF_X48_Y0_N42 ; test_out~output|i ;
; 9.249 ; 2.150 ; FF ; CELL ; 1 ; IOOBUF_X48_Y0_N42 ; test_out~output|o ;
; 9.249 ; 0.000 ; FF ; CELL ; 0 ; PIN_AN17 ; test_out ;
+---------+---------+----+------+--------+------------------------+---------------------+
+--------------------------------------------------------------------------+
; Data Required Path ;
+----------+---------+----+------+--------+----------+---------------------+
; Total ; Incr ; RF ; Type ; Fanout ; Location ; Element ;
+----------+---------+----+------+--------+----------+---------------------+
; 20.000 ; 20.000 ; ; ; ; ; latch edge time ;
; 20.000 ; 0.000 ; ; ; ; ; clock path ;
; 20.000 ; 0.000 ; R ; ; ; ; clock network delay ;
; 19.900 ; -0.100 ; ; ; ; ; clock uncertainty ;
; 11.900 ; -8.000 ; F ; oExt ; 0 ; PIN_AN17 ; test_out ;
+----------+---------+----+------+--------+----------+---------------------+
由于这个分析要考察的是输出延时,所以它从 Data Arrival Path(数据到达路径)开始:从 0 ns 的时钟沿出发,加上时钟网络到达触发器的延时,再沿数据路径继续走,直到输出达到稳定的逻辑状态。计算结果是 9.249 ns。
数据在 9.249 ns 达到稳定。拿它与 下一个时钟沿的时刻(20 ns)减去输出延时、再减去估算的抖动(上例中是 0.1 ns)之后所得的时刻比较。最后要求数据稳定的时间点是 11.9 ns,因此时序裕量(slack)为 2.651 ns。
这也解释了为什么 set_output_delay -max 里填的数值,应该是外部器件输入所要求的建立时间(setup time)。这个时序约束的检查方法是:先计算输出端数据达到有效所需的总延时,再计算它与下一个时钟沿时刻之间的差;这个差就是要达到的目标。这正是建立时间的定义:数据必须在下一个时钟沿之前保持稳定多长时间。
set_output_delay -min 约束的保持时间(hold)分析
Delay Model:
Fast 1100mV 0C Model
+--------------------------------------------------------------------------------------------------------+
; Summary of Paths ;
+-------+---------------+----------+--------------+-------------+--------------+------------+------------+
; Slack ; From Node ; To Node ; Launch Clock ; Latch Clock ; Relationship ; Clock Skew ; Data Delay ;
+-------+---------------+----------+--------------+-------------+--------------+------------+------------+
; 1.275 ; test_out~reg0 ; test_out ; theclk ; theclk ; 0.000 ; -2.255 ; 2.020 ;
+-------+---------------+----------+--------------+-------------+--------------+------------+------------+
Path #1: Hold slack is 1.275
===============================================================================
+------------------------------------+
; Path Summary ;
+--------------------+---------------+
; Property ; Value ;
+--------------------+---------------+
; From Node ; test_out~reg0 ;
; To Node ; test_out ;
; Launch Clock ; theclk ;
; Latch Clock ; theclk ;
; Data Arrival Time ; 4.275 ;
; Data Required Time ; 3.000 ;
; Slack ; 1.275 ;
+--------------------+---------------+
+---------------------------------------------------------------------------------------+
; Statistics ;
+---------------------------+--------+-------+-------------+------------+-------+-------+
; Property ; Value ; Count ; Total Delay ; % of Total ; Min ; Max ;
+---------------------------+--------+-------+-------------+------------+-------+-------+
; Hold Relationship ; 0.000 ; ; ; ; ; ;
; Clock Skew ; -2.255 ; ; ; ; ; ;
; Data Delay ; 2.020 ; ; ; ; ; ;
; Number of Logic Levels ; ; 0 ; ; ; ; ;
; Physical Delays ; ; ; ; ; ; ;
; Arrival Path ; ; ; ; ; ; ;
; Clock ; ; ; ; ; ; ;
; Clock Network (Lumped) ; ; 1 ; 2.255 ; 100 ; 2.255 ; 2.255 ;
; Data ; ; ; ; ; ; ;
; IC ; ; 1 ; 0.000 ; 0 ; 0.000 ; 0.000 ;
; Cell ; ; 3 ; 2.020 ; 100 ; 0.000 ; 1.296 ;
; uTco ; ; 1 ; 0.000 ; 0 ; 0.000 ; 0.000 ;
; Required Path ; ; ; ; ; ; ;
; Clock ; ; ; ; ; ; ;
; Clock Network (Lumped) ; ; 1 ; 0.000 ; ; 0.000 ; 0.000 ;
+---------------------------+--------+-------+-------------+------------+-------+-------+
Note: Negative delays are omitted from totals when calculating percentages
+---------------------------------------------------------------------------------------+
; Data Arrival Path ;
+---------+---------+----+------+--------+------------------------+---------------------+
; Total ; Incr ; RF ; Type ; Fanout ; Location ; Element ;
+---------+---------+----+------+--------+------------------------+---------------------+
; 0.000 ; 0.000 ; ; ; ; ; launch edge time ;
; 2.255 ; 2.255 ; ; ; ; ; clock path ;
; 2.255 ; 2.255 ; R ; ; ; ; clock network delay ;
; 4.275 ; 2.020 ; ; ; ; ; data path ;
; 2.255 ; 0.000 ; ; uTco ; 1 ; DDIOOUTCELL_X48_Y0_N50 ; test_out~reg0 ;
; 2.979 ; 0.724 ; RR ; CELL ; 1 ; DDIOOUTCELL_X48_Y0_N50 ; test_out~reg0|q ;
; 2.979 ; 0.000 ; RR ; IC ; 1 ; IOOBUF_X48_Y0_N42 ; test_out~output|i ;
; 4.275 ; 1.296 ; RR ; CELL ; 1 ; IOOBUF_X48_Y0_N42 ; test_out~output|o ;
; 4.275 ; 0.000 ; RR ; CELL ; 0 ; PIN_AN17 ; test_out ;
+---------+---------+----+------+--------+------------------------+---------------------+
+-------------------------------------------------------------------------+
; Data Required Path ;
+---------+---------+----+------+--------+----------+---------------------+
; Total ; Incr ; RF ; Type ; Fanout ; Location ; Element ;
+---------+---------+----+------+--------+----------+---------------------+
; 0.000 ; 0.000 ; ; ; ; ; latch edge time ;
; 0.000 ; 0.000 ; ; ; ; ; clock path ;
; 0.000 ; 0.000 ; R ; ; ; ; clock network delay ;
; 0.000 ; 0.000 ; ; ; ; ; clock uncertainty ;
; 3.000 ; 3.000 ; R ; oExt ; 0 ; PIN_AN17 ; test_out ;
+---------+---------+----+------+--------+----------+---------------------+
这个分析和最大输出延时的分析类似,区别只在于:这里是与 同一个时钟沿(而不是下一个时钟沿)进行比较计算。
和前面一样,时钟路径之后继续计算数据路径,直到输出达到稳定。计算结果为 4.275 ns。
拿它与 同一个时钟沿(0 ns)减去输出延时的结果比较。回忆一下,时序约束里的最小输出延时是 -3 ns,所以在计算中它表现为正的 3 ns。
结论:数据一直保持稳定到 4.275 ns,而要求是保持稳定到 3 ns。因此没有问题,时序裕量(slack)为 1.275 ns。
这也解释了为什么 set_output_delay -min 里填的数值,是外部器件输入所要求的保持时间(hold time),并且要取反。这个约束的检查方式是:要求数据路径的总延时大于给定的这个数值。换句话说,数据在时钟沿之后还必须保持稳定这么长的时间。这正是保持时间的定义。