【ug903】时序约束向导(4)

Exclusive Clocks

互斥时钟分为物理互斥(Physically Exclusive)和逻辑互斥(Logically Exclusive)。

Physically Exclusive

原文如下

1. Physically exclusive clocks are clocks that are defined on the same source point and propagate on the same clock tree.
2. The Timing Constraints wizard identifies such clocks and recommends a clock groups constraint to prevent unnecessary timing analysis on the clock domain crossing paths. 

物理互斥的时钟不能共存于设计中:
1. 时钟起点相同;
2. 时序路径相同;

模型如下
在这里插入图片描述
举例如下:在输入时钟端口i_clk上创建三个频率不同的时钟(注意要加-add选项,否则前面的时钟会被覆盖)。

create_clock -name clk_20m -period 50.000 -add [get_ports i_clk]
create_clock -name clk_40m -period 25.000 -add [get_ports i_clk]
create_clock -name clk_80m -period 12.500 -add [get_ports i_clk]

这三个时钟在物理上是不可能同时存在的,所以它们之间是物理互斥的,应该设置physically_exclusive时钟组。

当不设置时钟组时,如原文第2点提到的,Vivado的时序分析工具会分析一些不必要的的跨时钟域路径,如下图所示:
在这里插入图片描述
设置时钟组,Vivado就不会再分析这些不存在的跨时钟域路径,设置方式如下:

set_clock_groups -physically_exclusive -group clk_20m -group clk_40m -group clk_80m

Logically Exclusive

逻辑互斥的时钟可以共存于设计中,典型例就是用BUFGMUX在两个时钟之间做选择:
1. 时钟起点不同;
2. 时序路径共享;

逻辑互斥分为两种情况:with No Interaction 和with Interaction。

Logically Exclusive Clock Groups with No Interaction

逻辑互斥的时钟之间没有交互,原文如下

1. Logically exclusive clocks are clocks that are defined on different source points but share part of their clock tree due to a multiplexer or other combinational logic. 
2. The Timing Constraints wizard identifies such clocks and recommends a clock groups constraint directly on them when they do not have timing paths between each other except for the logic connected to their shared clock tree.
3. Logically exclusive clocks do not have timing paths between each other except for the logic connected to their shared clock tree.

这里说明以下,在FPGA里时钟的multiplexer一般是BUFGMUX,属于组合逻辑(combinational logic),其他组合逻辑如LUT也能做时钟选择,但是在FPGA不推荐使用。

模型如下
在这里插入图片描述
举例如下

例1 在两个时钟clkA和clkB之间选择:clkA、clkB和clk_mux分别驱动u0、u1和u2模块,三者之间没有交互,时序模型如下:
在这里插入图片描述
Wizard推荐的约束如下:
在这里插入图片描述

create_clock -period 16.667 -name clkA -waveform {0.000 8.334} [get_ports clkA]
create_clock -period 50.000 -name clkB -waveform {0.000 25.000} [get_ports clkB]
set_clock_groups -logically_exclusive -group [get_clocks -include_generated_clocks clkA] -group [get_clocks -include_generated_clocks clkB]

实现后的时序分析路径如下:
在这里插入图片描述
例2 在四个时钟clkA、clkB、clkC和clkD之间选择:clkA、clkB、clkC、clkD和clk_mux分别驱动proc模块,五者之间没有交互;使用3个BUFGMUX、两级选择来实现时钟的四选一,时序模型如下:
在这里插入图片描述
Wizard推荐的约束如下:
在这里插入图片描述

create_clock -period 50.000 -name clkA -waveform {0.000 25.000} [get_ports clkA]
create_clock -period 16.667 -name clkB -waveform {0.000 8.334} [get_ports clkB]
create_clock -period 10.000 -name clkC -waveform {0.000 5.000} [get_ports clkC]
create_clock -period 8.333 -name clkD -waveform {0.000 4.167} [get_ports clkD]
set_clock_groups -logically_exclusive -group [get_clocks -include_generated_clocks clkA] -group [get_clocks -include_generated_clocks clkB]
set_clock_groups -logically_exclusive -group [get_clocks -include_generated_clocks clkC] -group [get_clocks -include_generated_clocks clkD]
set_clock_groups -logically_exclusive -group [get_clocks -include_generated_clocks {clkA clkB}] -group [get_clocks -include_generated_clocks {clkC clkD}]

从上面的约束命令可以看到:clkA、clkB、clkC、clkD四个时钟,两两一组分为两组,先组内设置互斥,然后组间设置互斥。

实现后的时序分析路径如下:
在这里插入图片描述

Logically Exclusive Clock Groups with Interaction

逻辑互斥的时钟之间有交互,原文如下

1. The Timing Constraints wizard identifies logically exclusive clocks that have timing paths between each other elsewhere than just on the logic connected to the shared clock tree.
2. Because only the clock domain crossing paths of the shared clock tree must be ignored, the wizard recommends to create generated clocks that are copies of clkA and clkB but that only exist on the shared clock tree.
3. The clock groups constraint is applied to the generated clocks only, so that the paths outside the logic of the shared clock tree can still be normally timed.

模型如下
在这里插入图片描述
举例如下

例1 在两个时钟clkA和clkB之间选择:clkA、clkB和clk_mux分别驱动u0、u1和u2模块,其中clkA和clk_mux之间有交互,时序模型如下:
在这里插入图片描述
Wizard推荐的约束如下:
在这里插入图片描述

create_clock -period 50.000 -name clkA -waveform {0.000 25.000} [get_ports clkA]
create_clock -period 16.667 -name clkB [get_ports clkB]
create_generated_clock -name clkA_Gen -source [get_pins BUFGMUX_0/I0] -divide_by 1 -add -master_clock clkA [get_pins BUFGMUX_0/O]
create_generated_clock -name clkB_Gen -source [get_pins BUFGMUX_0/I1] -divide_by 1 -add -master_clock clkB [get_pins BUFGMUX_0/O]
set_clock_groups -logically_exclusive -group [get_clocks -include_generated_clocks clkA_Gen] -group [get_clocks -include_generated_clocks clkB_Gen]

从上面的约束命令可以看出,在BUFGMUX的输出端口创建了两个生成时钟,在这两个生成时钟之间设置逻辑互斥组。

实现后的时序分析路径如下:
在这里插入图片描述
如上图所示,clkA和clkA/b_Gen之间有时序路径.

例2 在四个时钟clkA、clkB、clkC和clkD之间选择:clkA、clkB、clkC、clkD和clk_mux分别驱动proc模块,其中clkA、clkC和clk_mux之间有交互;使用3个BUFGMUX、两级选择来实现时钟的四选一,时序模型如下:
在这里插入图片描述
Wizard推荐的约束如下:
在这里插入图片描述

create_clock -period 50.000 -name clkA -waveform {0.000 25.000} [get_ports clkA]
create_clock -period 16.667 -name clkB -waveform {0.000 8.334} [get_ports clkB]
create_clock -period 10.000 -name clkC -waveform {0.000 5.000} [get_ports clkC]
create_clock -period 8.333 -name clkD -waveform {0.000 4.167} [get_ports clkD]
create_generated_clock -name clkA_Gen -source [get_pins BUFGMUX_0/I0] -divide_by 1 -add -master_clock clkA [get_pins BUFGMUX_0/O]
create_generated_clock -name clkB_Gen -source [get_pins BUFGMUX_0/I1] -divide_by 1 -add -master_clock clkB [get_pins BUFGMUX_0/O]
create_generated_clock -name clkC_Gen -source [get_pins BUFGMUX_1/I0] -divide_by 1 -add -master_clock clkC [get_pins BUFGMUX_1/O]
create_generated_clock -name clkD_Gen -source [get_pins BUFGMUX_1/I1] -divide_by 1 -add -master_clock clkD [get_pins BUFGMUX_1/O]
create_generated_clock -name clkA_Gen_1 -source [get_pins BUFGMUX_2/I0] -divide_by 1 -add -master_clock clkA [get_pins BUFGMUX_2/O]
create_generated_clock -name clkB_Gen_1 -source [get_pins BUFGMUX_2/I0] -divide_by 1 -add -master_clock clkB [get_pins BUFGMUX_2/O]
create_generated_clock -name clkC_Gen_1 -source [get_pins BUFGMUX_2/I1] -divide_by 1 -add -master_clock clkC [get_pins BUFGMUX_2/O]
create_generated_clock -name clkD_Gen_1 -source [get_pins BUFGMUX_2/I1] -divide_by 1 -add -master_clock clkD [get_pins BUFGMUX_2/O]
set_clock_groups -logically_exclusive -group [get_clocks -include_generated_clocks clkA_Gen] -group [get_clocks -include_generated_clocks clkB_Gen]
set_clock_groups -logically_exclusive -group [get_clocks -include_generated_clocks clkC_Gen] -group [get_clocks -include_generated_clocks clkD_Gen]
set_clock_groups -logically_exclusive -group [get_clocks -include_generated_clocks {clkA_Gen_1 clkB_Gen_1}] -group [get_clocks -include_generated_clocks {clkC_Gen_1 clkD_Gen_1}]

这种情况下的互斥组约束就比较复杂,四个时钟两两一组:首先,基于第一级的两个BUFGMUX的输出端口各自创建两个生成时钟,在这两个生成时钟之间设置逻辑互斥组;然后,基于第二级的一个BUFGMUX的输出端口创建四个生成时钟(此时需要用到-master_clock选项来指定时钟的源头),将这四个生成时钟两两一组分成两组设置逻辑互斥组。

实现后的时序分析路径如下:
在这里插入图片描述
如上图所示,clkA/B到clkA/B/C/D_Gen_1之间存在时序路径。

  • 4
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值