【BES】create_generated_clock 工具的内在逻辑

1.为什么需要create_generate_clock,它和create_clock有什么不一样?

1.用create_clock代替create_generate_clock的话,会新增一个clock domain,可能需要新增一些约束
2.generated clock的时钟源头是master clock,因此时序路径的源头是master_clock,存在source latency。
因此建议对比如寄存器分频出来的时钟,用generated_clock

2.create_generate_clock有哪些要素,是什么含义?

工具里面man更详细

create_generated_clock  
 -name clock_name
 source_object  (一般是时钟定义点的管脚)
 -source master_pin
 -master_clock clock
 -combinational
 -add
 -divde by divide_factor | multiply_by multiply_factor
 -invert
 -preinvert
 -edge edge_list
 -edge_shift edge_shift_list
 -comment
  1. source_object 时钟定义的管脚(这个source有点让人误解)
  2. -source generated_clock的“基准时钟”,根据此管脚的时钟,对generated_clock进行分频等
  3. -master_clock 最源头的时钟,可能和-source不同,比如-source是-master取反后的pin
  4. -divde* -invert -edge 均是描述generated_clock和-source的关系
  5. -add 同一个source_object 时钟定义的管脚多个时钟要用-add
  6. -combinational 与工具寻找generated_clock和-source的路径有关

3.工具如何解析create_generated_clock命令?

3.1 例1——错误约束

在这里插入图片描述

对分频Q端定义generated_clock

create_clock -period 10 CLK

create_generated_clock -name CLKdiv2 -divide_by 2 -source CLK [get_pins Udiv/Q]

工具并不知道Q端的时钟频率、相位是什么
因为它是寄存器逻辑产生的,需要-source来提供这些基本信息

-divide_by 2 -source CLK
表示这个点的时钟是CLK这个管脚DIV2,相位一致,图画出来就是这样的

--          _   _   _   _   _   _   _   _   _   _
-- CLK     | |_| |_| |_| |_| |_| |_| |_| |_| |_| 
--          ___     ___     ___     ___     ___  
-- CLKDIV2 |   |___|   |___|   |___|   |___|   |_

但是,这个信息实际是错的!(工具并不知道)
这样的约束会让UFF1->UFF2的时序路径上,出现这样的setup时间

在这里插入图片描述
因为U1取反的存在,CLKdiv2和CLK的关系应该是这样

--          _   _   _   _   _   _   _   _   _   _
-- CLK     | |_| |_| |_| |_| |_| |_| |_| |_| |_| 
--            ___     ___     ___     ___     ___
-- CLKDIV2 __|   |___|   |___|   |___|   |___|   

3.2 例1——正确约束

1.把-source定义在Udiv/CK端,此时工具可以解析出这个点的时钟和CLK是反相的
可以加上-master CLK选项

create_generated_clock -name CLKdiv2 -divide_by 2 -source [get_pins Udiv/CLK]  [get_pins Udiv/Q]

2.显式声明generated clock 和 master clock 的相位关系(推荐)

create_generated_clock -name CLKdiv2 -edges {2 4 6} -source CLK [get_pins Udiv/Q]

似乎可以发现,组合逻辑工具可以辨认时钟传递,遇到寄存器分频,工具是无法辨认时钟传递的频率、相位的

3.3 例2——错误约束,尝试理解工具的逻辑

例2是存在generated_clock和-source之间多路径问题
在这里插入图片描述
以此约束为例

create_clock -period 10 CLK
create_generated_clock -name CLKdiv2 -divide_by 2 -source FFdiv2/CLK UMUX/Y -master CLK -add
create_generated_clock -name CLKdiv4 -divide_by 4 -source FFdiv4/CLK UMUX/Y -master CLK -add
set_clock_groups -physically_exclusive -group {CLK} -group {CLKdiv2} -group {CLKdiv4}

generated_clock定义在UMUX/Y端,并且是CLK的2分频
工具并不知道,这个时钟到底是MUX/A,B,C哪个传递过来的

  • FFDIV2、FFDIV4是寄存器分频,工具无法解析。
  • MUX/A直接从CLK过来,即使MUX/S可以动态改变,也无法形成占空比和CLK相同的2分频时钟。
  • 工具只是把约束当做了确定的事实——UMUX/Y一定是CLK的2分频

结果就是,在分析从master clk传递过来的时钟路径,会有多条
而周期是确定的20ns !
在这里插入图片描述
在这里插入图片描述
不过奇怪的是,虽然路径不同,时钟路径上增加了CRP时间1.1ns也就是FFdiv4 CK->Q的时间。因此slack = 19ns,就仅仅是FF1 CK->Q的时间。
是否意味着虽然工具不知道具体路径,但是依然把前面共同路径的时间减去了?
不得而知,后续再补充

3.3 例2——正确
Create_clock -period 10 CLK

Create_generated_clock -name CLKdiv2 -divide_by_2 FFdiv2/Q -source FFdiv2/CK
Create_generated_clock -name CLKdiv4 -divide_by_4 FFdiv4/Q -source FFdiv4/CK

create_generated_clock -name CLK_mux   -divide_by 1 -source CLK UMUX/Y         -master CLK -add
create_generated_clock -name CLKdiv2_mux -divide_by 2 -source FFdiv2/Q UMUX/Y -master CLK -add
create_generated_clock -name CLKdiv4_mux -divide_by 4 -source FFdiv4/Q UMUX/Y -master CLK -add

Set_clock_groups -physically_exclusive -group {CLK_mux}  -group {CLKdiv2_mux} -group {CLKdiv4_mux}

也有定义在MUX 入口的,个人认为这里应该用logically_exclusive?

Create_generated_clock -name CLK_mux -combinational UMUX/A -source UMUX/A
Create_generated_clock -name CLKdiv2_mux -combinational UMUX/B -source UMUX/B
Create_generated_clock -name CLKdiv4_mux -combinational UMUX/C -source UMUX/C
Set_clock_groups -physically_exclusive -group {CLK_mux}  -group {CLK_mux2} -group {CLK_mux4}

4. 小结

  1. -source master_pin直接决定了generated_clock形态。工具直接把-source上的时钟,作为分频、倍频等操作的基准。
  2. -source master_pin如果不是定义的时钟源,则工具会根据其时钟源或经过的组合逻辑,判断出它和时钟源的关系,从决定generated_clock和master_clk(或理解成source_clk,不是master_pin)最终的关系。
  3. 工具在计算master_clock到generated_clock的delay时,如果有多路径,工具无法识别,多条路径均会考虑计算。
    (-combination选项可以约束其只经过组合逻辑路径)

5. 约束建议

1.寄存器分频,要把generated时钟定义到分频器Q端
2.generated_clock在定义时,到上一个master clk或generated_clk的路径要唯一
3.generated_clock的-source master_pin尽量定义到一个master clk或generated_clk上,显式地表示其频率相位关系

参考

https://www.elecfans.com/d/2329468.html
https://3ms.huawei.com/km/blogs/details/10001447
https://blog.csdn.net/weixin_37584728/article/details/116641215、https://bbs.eetop.cn/thread-353672-1-1.html
https://bbs.eetop.cn/thread-458928-3-1.html

附录

原文
《Static Timing Analysis for Nanometer Designs A Practical Approach》
Page 190 ~ 191

Can a new clock, that is, a master clock, be defined at the output of the flipflop instead of a generated clock? The answer is yes, that it is indeed possible. However, there are some disadvantages. Defining a master clock instead of a generated clock creates a new clock domain. This is not a problem in general except that there are more clock domains to deal with in setting up the constraints for STA. Defining the new clock as a generated clock does not create a new clock domain, and the generated clock is considered to be in phase with its master clock. The generated clock does not require additional constraints to be developed. Thus, one must attempt to define a new internally generated clock as a generated clock instead of deciding to declare it as another master clock.

Another important difference between a master clock and a generated clock is the notion of clock origin. In a master clock, the origin of the clock is at the point of definition of the master clock. In a generated clock, the clock origin is that of the master clock and not that of the generated clock. This implies that in a clock path report, the start point of a clock path is always the master clock definition point. This is a big advantage of a generated clock over defining a new master clock as the source latency is not automatically included for the case of a new master clock.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值