![68e747123c21d63af659ac5e5280b2e9.png](https://img-blog.csdnimg.cn/img_convert/68e747123c21d63af659ac5e5280b2e9.png)
此系列文章为在学校时的笔记总结,主要记录总结Xilinx Vivado工具中的时序约束。
![f60bf6e826d237e3b35f66aca71756a2.png](https://img-blog.csdnimg.cn/img_convert/f60bf6e826d237e3b35f66aca71756a2.png)
主时钟(primary clock)
主时钟应首先被定义,因为其他时序约束往往以主时钟为参照标准。主时钟的定义往往应定义在输入端口,而不是clock buffer的输出端口。如下图所示:
![973a4c4d1a172947501d98f0ae1f3aaf.png](https://img-blog.csdnimg.cn/img_convert/973a4c4d1a172947501d98f0ae1f3aaf.png)
针对主时钟进入时钟专用单元,则对主时钟输入端进行约束,时钟专用单元输出时钟将以主时钟作为树根节点进行约束调整。
针对差分时钟信号输入,主时钟约束应在差分时钟正相端进行约束,而不是在正反相上均进行约束,以避免错误的CDC路径。 约束原语:
create_clock -name -period -waveform {} [get_ports ]
虚拟时钟
![e9aa7db29effe4f3314283da5c16d2d0.png](https://img-blog.csdnimg.cn/img_convert/e9aa7db29effe4f3314283da5c16d2d0.png)
虚拟时钟并没有连接到任何物理线网。虚拟时钟同样使用create_
clock命令定义,但不定义源(get_port)。
虚拟时钟往往用于在下列情景中指定输入输出延迟约束 :
- 外部IO参考时钟并不是设计中的时钟
- I/O路径参考时钟来源于FPGA内部派生时钟,但内部派生时钟与主时钟的频率关系并不是整数倍。
- 仅针对I/O指定不同的jitter和latency
- 虚拟时钟必须在用于约束I/O延迟之前被定义。
示例:
create_clock -name clk_virt -period 10
衍生时钟(generated clock)
衍生时钟是设计中由时钟生成模块(MMCM,PLL等)或用户逻辑所产生的时钟模块。衍生时钟可衍生于主时钟或其他衍生时钟。衍生时钟衍生于其控制时钟(master clock),在进行约束时,并不是对衍生时钟的周期或波形做约束,而是描述时钟衍生单元如何对控制时钟(master clock)的转换。
控制时钟和主时钟的关系可以是:
约束原语:
create_generated_clock
简单二分频示例: ![d9cabe716f2122ac2f81c12b1b9f95a7.png](https://img-blog.csdnimg.cn/img_convert/d9cabe716f2122ac2f81c12b1b9f95a7.png)
create_clock -name clkin -period 10 [get_ports clkin]#1 采用主时钟作为master clockcreate_generated_clock -name clkdiv2 -source [get_ports clkin] -divide_by 2\[get_pins REGA/Q]#2 采用REGA的clock引脚作为源。create_generted_clock -name clkdiv2 -source [get_pins REGA/C] -divide_by 2\[get_pins REGA/Q]#3 使用-edges作为选项create_generated_clock -name clkdiv2 -source [get_pins REGA/C] -edges {1,3,5}
对于占空比改变或相移的约束:使用-edge_shift
-edge_shift不能与如下列命令同时使用:-divide_by -multiply_by -invert。
示例:
create_clock -name clkin -period 10 [get_ports clkin]create_generated_clock -name clkshift -source [get_pins mmcm0/CLKIN] -edges{1 2 3}\-edge_shift {2.5 0 2.5} [get_pins mmcm0/CLKOUT]
-edge_shift的值可以是正数也可以是负数。
-multiply_by和divide_by可同时使用以产生非整数倍频/分频。
create_generated_clock -name \-source \-multiply_by \-divide_by \
衍生时钟路径上组合逻辑的约束:-combinational;
示例:
假定master_clock驱动一个基于寄存器的二分频时钟电路和一个二选一驱动器的时钟选择器用于选择master和二分频时钟,对于主时钟到衍生时钟有时序路径也有组合路径,对于组合逻辑路径可以进行-combinational约束。
create_generated_clock -name clkout -source [get_pins mmcm0/CLKIN] -combinational [get_pins MUX/O]
自动衍生时钟
在定义了master_clock后,对于Clock modifying Blocks所输出产生的时钟,VIVADO可以自动进行约束。
对于7系列设备,CMB包含MMCM/PLL,BUFR,PHASER。对于UltraScale系列,CMBS包含MMCM/PLL*,BUFGGT/BUFGCE_DIV,GT*_COMMON/GT*_CHANNEL/IBUFDS_GET3,BITSLICE_CONTROL/RX*_BITSLICE,ISERDESE3。
衍生时钟的重命名:
create_generated_clock -name new_name [-source master_pin] [-master_clock master_clk] source_object
newname和sourceobject必须被制定。sourceobject指衍生时钟的对象(CMB output pin,GT output pin for UltraScale等)。当有多个时钟传递至source pin时应制定-source和-master_clock。
If any of the -edges/-edge_shift/-divide_by/-multiply_by/-combinational/-duty_cycle /-invert options is passed to the create_generated_clock command, the generated clock is not renamed. Instead a new generated clock is created with the specified characteristics.
自动衍生的时钟重命名只能在它的发源处重命名,不能经过任何原语器件。主时钟和用户定义的时钟不能被重命名。
The auto-derived clocks can be renamed at any time inside the XDC, even after they have been referenced by some timing constraints。
时钟重命名可以在XDC文件中任何地方重命名。
时钟组
默认情况下,vivado分析各时钟下所有的路径(除非制定或使用clock group 或false path约束)。
时钟组约束set_clock_groups将关断指定的时钟组之间的时序分析,但并不关断时钟组内各时钟之间的时钟约束。set_false_path约束是单向的,但set_clock_group时序分析忽略是双向的。
set_clockgroups在至少有两个有效非空时钟组时才有效。可以使用schematic viewer,clock_network_report观察决定哪些时钟不能一块儿分析。
对于异步时钟和不可预测时钟(unexpandable clocks,在1000个内时钟沿无法对齐),可采用set_clock_groups进行约束(set_clock_groups优先级比常规的时序例外高,若想分析两个异步时钟之间的的一些路径则不应该使用时钟组约束,应只使用timeing_exceptions)。
示例:
主时钟clk0经由MMCM产生usrclk和itfclk。第二个主时钟clk1有GTP恢复产生并由MMCM 产生时钟gtclkrx和gtclktx。
通过-asynchronous创建异步时钟组set_clock_groups -name async_clko_clk1 -asynchronous -group {clk0 usrclk itfclk} \-group {clk gtclkrx,gtclktx}也可通过get_clocks -include_generated_clocks去动态的追踪衍生时钟:set_clock_groups -name async_clk0_clk1 -asynchronous \-group [get_clocks -include_generated_clocks clk0]\-group [get_clocks -include_generated_clocks clk1]
排外性时钟组(exclusive clock groups)
有些设计模块中根据工作模式的不同通过BUFGMUX和BUFGCTRL实现多个时钟的切换,这种时钟称为排外性时钟,时钟不会同时存在。可通过-logically_exclusive或-physically_exclusive进行约束。
示例:
MMCM产生时钟clk0,clk1,两者通过一个BUFGMUX产生时钟clkmux驱动整个设计。
默认情况下,vivado会分析clk0和clk1之间的路径,即使两者不会同时存在于设计中。可进行如下约束:
set_clock_groups -name exclusive_clk0_clk1 -physically_exclusive \-group clk0 -group clk1
在FPGA中,-logically_exclusive和-physically_exclusive没有差别,仅在ASIC中有区别。
Clock Latency,Jitter,and Uncertainty
![e9aa7db29effe4f3314283da5c16d2d0.png](https://img-blog.csdnimg.cn/img_convert/e9aa7db29effe4f3314283da5c16d2d0.png)
片内的时钟延迟由vivado自动计算,可通过set_clock_latency约束片外时钟延时(用于源同步信号中的源时钟)
示例:
# Minimum source latency value for clock sysClk (for both Slow and Fast corners)set_clock_latency -source -early 0.2 [get_clocks sysClk]# Maximum source latency value for clock sysClk (for both Slow and Fast corners)set_clock_latency -source -late 0.5 [get_clocks sysClk]
时钟抖动分为input jitter(源时钟本身属性)和system jitter(电源噪声、板级噪声及其他额外系统抖动造成)。通过set_input_jitter、set_system_jitter可分别对input jitter和system jitter进行约束。system jitter 是对全部时钟的约束。
THE END
似
猿
非
猿
![016b82d8df25748991d767d89b1c1efe.png](https://img-blog.csdnimg.cn/img_convert/016b82d8df25748991d767d89b1c1efe.png)