Clock in Contraint
【Clocks】
Clock 可以说是同步设计中一个至关重要的话题。同步设计通俗点将就是在时钟信号驱动下,从一个状态变换到另一个状态的电路设计。而这些状态保存在输入输出,内部寄存器等元件中。Clock有上升沿,下降沿,有高电平,低电平,周期,频率等基本属性。Clock Period
现在的SOC都已经上G了,所以我们做的40nm,28nm,时钟多以ns (nanosecond),自然半周期要用到ps(picosecond)来表示。
Period表示的是时钟周期性的时间长度。频率是周期的倒数。
- Positive edge (上升沿) is when a clock transitions from state 0 to stage 1.
- Negative edge (下降沿) is when a clock transitions from state 1 to state 0.
- Positive phase (高电平) is when the clock signal keep 1 state.
Duty cycle is defined as the percentage of the time clock spends in positive phase as a fraction of its total time period.
当我们说时钟有80%的duty cycle,那么这个时钟在一个周期内80%的时间处于高电平。
Duty cycle的其中一个应用是节省power,很多年前就有Pulse Register 脉冲寄存器了,我也是近两年才接触到,可上IEEE去搜些论文看看,现在工程应用也比较普遍了。
- create_clock
- -period period_time
- [source_object]
- [-name clock_name]
- [-waveform edge_list]
- [-add]
- [-comment comment_string]
period_time是没有单位的,在SDC里,这个必须由set_unit来统一指定。
source_object可以是port,pin或者带driver的net。
-waveform可以来指定波形,必须由偶数个整数组成,代表的意思是上升和下降沿的时间。这里的tcl list只能代表时钟上升,下降对,你要表示复杂时钟的时候,可以使用大于2个的数字。(这个与generated clock定义的edge是不同的,单位不同。)
-add的存在告诉我们,一个object上可以定义多个clock,像PLL,一些MUX,是需要在不同的mode下切换不同的clock,或者有backup clock,那么这种情况就存在了。
虚拟时钟 Virtual Clocks在IO上我们有时候需要虚拟时钟的帮助来进行IO约束,与set_input_delay和set_output_delay一个约束IO。
在定义中不指定source_object就表示一个虚拟时钟了。
时钟的其他特性在做CTS或者STA sign-off的时候,还要关注很多东西,例如skew,latnecy等等。后面慢慢铺开。
原文博客版 http://qfshare.com/archives/575
Generated Clock
先讲一个异步时钟,asynchronous clocks are clock signals that don’t share a fixed phase releationship.
Generated Clock当然和源是同步时钟,synchronous clocks share a fixed phase releationship.分频器 divider / 倍频器 multiplier / 门控 clock gating
A clock divider A clock divider generate a clock of higher period / low frequency compared to the original clock.
A clock multiplier is a circuit where frequency is increased and clock period is decreased for faster clocking rate. 普遍使用锁相环(PLL – phase-locked loops)。
Clock gating can disable clock to low level to reduce the switching power.这是90年代出现的低功耗方法,在现在的SOC设计中已经非常普遍和成熟,综合的时候敲一两个命令,工具就比较智能的完成了门控时钟的插入。
门控时钟也可用来作为分频电路或者脉冲发生器,原理比较简单,控制时钟的enable,实际电路要考虑毛刺,精确延时,脉冲宽度等因素。create_generated_clock
- create_generated_clock [source_objects]
- -source clock_source_pin
- [-master_clock master_clock_name]
- [-name generated_clock_name]
- [-edges edge_list]
- [-divide_by factor]
- [-multiply_by factor]
- [-invert]
- [-edge_shift shift_list]
- [-duty_cycle percent]
- [-combinational]
- [-add]
- [-comment comment_string]
generated clock 一般定义在分频,倍频,门控单元的输出位置,同样generated_clock可以定义在port,pin或者有驱动net上。当你指定义-source的时候,source点要和generated点有相位关系,否则波形可能不正确,影响STA结果。
-edges,指的是源clock的沿(包括上升和下降),由奇数个数字组成,至少三个,第一个表示源clock的上升沿。
-edge_list,list数目必须和-edges相同,使用这个选项,可以精确描述Pulse的波形。
create_generated_clock A/Q -master CLK -edges {1 1 3} -edge_shift {0 2 0} -name PULSE
-divide_by, 从频率上讲,clock被多少分频了,比如2分频,3分频。
-multiply_by,同理,讲的是频率,clock被多少倍频了,比如10倍频。这个比较多见于在IO和PLL上的clock定义。
-duty_clcle在定义倍频时钟的时候使用,也只能在-multiply_by一起用。
-combinational一般使用在一种情况,当数据和CLK需要源同步输出时,比如DDR,输出clock和输出data的时间差是0,而且这个输出clock其实也是内部REGOUT寄存器的时钟,那么加上-combinational后,其他选项就失效了,这相当于在输出端克隆了一个1分频的时钟。一些注意
- 在时钟跨越了时序器件后,还是作为clock用的话,必须要定义Generated Clock,某种会导致uncontrain的时序器件,这个综合工具都可以检查的。如果定义以后,那么这个时序器件就被CTS引擎认为是可以穿越了,有时候做CTS的时候会把generated clock改成create clock来让工具理解clock structure更直接,也方便step by step创建clock,来理清真正需要同步分支。
- 有多个clock时候一定要加-add,某则某些定义将会丢失。
- 尽量避免由多条路径带来的clock convergence,这很容易产生pulse。比较常作的方法来在disable组合逻辑。
博客原文 http://qfshare.com/archives/587
Clock Groups
我们现代设计中总有很多clock,系统越来越复杂,同步的有,异步的也有,SDC就要清楚地定义好这些clock的相互关系。
setup & Hold
setup和hold,有经验的人比较好理解,setup是建立时间,在时间沿之前“一段时间”数据必须稳定,否则输出结果未知,通俗点讲,反应到电路上就是组合逻辑不能太长,否则数据来不及从Launch到Capture;hould是保持时间,在有效沿之后“一段时间”数据必须稳定,否则寄存器将无法确定所存到的是否是所需要的数据,通俗点讲,反应到电路上就是组合逻辑不能太短,在数据还没被锁存,新数据已经到达Capture,导致锁存失败,hold violation。
这个可以把Capture端的FF内部两个Latch的结构显示出来,理解起来就很容易了,有时间我会在最终的图文版里加进去这部分。
STA分析的是同步电路的静态时序,是对电路的timing path的遍历。而分析不了异步的时钟,异步产生metastability。
fast to slow
Fast Launch and Capture Slow,要在function上保证的情况下,可以分析,并要清楚明白function上的功能。正常在波形图上在一个重复阶段内,Launch的有效沿到Capture的有效沿构成了许多setup和hold的check,meet当然要看最严格的一个。
slow to fast
Slow to Fast这种是有问题的,采样频率大于原始频率,就像2K图像到4K的转换,纯采样只能变难看,现在通过插值,预分析可以达到更清晰的目的。反之,从4K到2K,就像fast到slow,输出会丢失数据。就像图形会丢失一半的像素一样。
Exclusive Clocks
当两个clock经过一个MUX时候,这两个clocks是逻辑上互斥的。两个clock定义在一条net上时,很多情况下是物理上互斥的,因为同一个net上不可能存在两个clock,当然STA工具会去分析所有的路径。
set_clock_group
In order to indicate to timing tools to ignore any timing paths or crosstalk analysis between asynchronous or mutually exclusive clocks.
set_clock_group
[-name group_name]
[-group clock_list]
[-physical_exclusive]
[-logic_exclusive]
[-asynchronous]
[-allow_paths]
[-comment comment_string]
-asynchronous is used when the clocks don’t share a phase relationship with each other.
-logically_exclusive -physical_exclusive and -asynchronous are only used one in a single set_clock_group command.
for crosstalk analysis, logically_exclusive crosstalk会被计算,逻辑上互斥,物理上相关;physically_exclusive两个clock group不分析crosstalk。
However, if the clock group is asynchronous, the clocks are assumed to have an infinite timing window where the aggressor and victim can switch together.
更新占楼
很好,欢迎多多分享
谢谢分享
谢谢分享
占楼学习
Other Clock CharacteristicsTransition time
The rate of change of signal is termed as slew. Slew is generally measured in terms of transition time which is defiend as the time required for a signal to change from one state to another.
It is also typically measured as per centage of the total voltage change to be undergone.
CTS之前由于clock network上的high fanout,delay值的计算非常不准,所以使用set_clock_transition来模拟CTS之后的情况,在CTS时可以给tool添加transition约束,在大多数都满足要求的情况下,这个命令的设置是有意义的。
- set_clock_transition [-rise]
[-fall]
[-max]
[-min]- clock_list
- transition_time
This command is used only during
pre_layout. After CTS is done, this command should never be used for nay post-layout timing analysis.
The
-rise
option is used to provide the transition time for the rising edge of clock.
Similarly
-fall
is used to provide the transition time for the falling edge of clock.
The
-max
and
-min
optionsmodel transition time for maximum and mininum operating conditions.
The difference in the arrival time at various flops could be because of different paths through clock network, or coupling capacitance or other PVT variaions in the design.
The differentce between clock arrivals at differnt points in the desgn is referred to as clock skew.
Skew and Jitter
cause lack of predictablility as to when will an exact edge arrive at the point of the trigger (sequential device). Theses are called
Uncertainty.
- set_clock_uncertanty [-from|-rise_from|-fall_from from_clock]
[-to|-rise_to|-fall_to to_clock]
[-setup]
[-hold]
[-rise]
[-fall]
[object_list]
Uncertainty_value
同一个clock设置uncertainty时,需要指定clock或port或pin的名字。object是clock,那么Uncertainty就作用于当前clock的所有时序器件,而当object是pin或者是port时,Uncertainty会作用于定义在当前pin或者port上的所有clocks(相应于这些clock的时序器件)。
可以对setup和hold设置单独的uncertainty,对于同一个clock,setup会受skew和jitter的影响,而hold是同沿check的,只会受skew的影响。在现在的标准library里,如果两个时序器件直连,hold也是可以基本满足的,所以在我们的chip上,skew才是hold的根本原因。
如果interclock没有设置,那么intraclock的设置也会作用于intrerclock。
Interclock Uncertainty当我们需要对interclock进行设置时,source (start) clock is specified using the
-from
option and the destination (end) clock is specified using
-to
option.
同样,-rise_from|-fall_from|-rise_to|-fall_to可以具体到clock的edge,以及-setup和-hold可以对不同的check做设置。
clock uncertainty包含所有需要包含的一些不确定因素,比如之前提到的PVT,以及Library的精确度。当然还有之前一直在说的flow前后需要考虑的比如skew,jitter或者Syn和Pnr的gap等等。
Clock LatencyClock latency has two components - source and network latency.
Source Latency
is the delay from the source of the clock to the point where clock is defined (in SDC, through create_clock/create_generated_clock). This source could be on-chip or off-chip.
Network Latency
is the time it takes for clock to propagate from the point where clock is defined to the point where it is actually used to trigger the sequential device.
The longest path or the one which has maximum delay is often refeerred to as the late path and shortest path or the one which has minimum delay is referred t as the early path.
The total latency is the sum of source and network latency.
CTS之后,使用set_propagated_clock命令指导工具出去actual circuit elements - including parasitics,这个是network latency,在CTS之后是不需要设置的,而source latency是在CTS之后还要设置的。
- set_clock_latency [-rise]
[-fall]
[-min]
[-max]
[-source]
[-late]
[-early]
[-clock clock_list]- delay
- object_list
As clock propagates through the design, it has to pass through combinational elements. When it passes through buffer or gates lik AND/OR, its sense (direction of transition) is preserved. When it passes through inverters or gates like NAND/NOR, its sense is inverted.
In eigher case, it is possible to figure out the sense of the clock, alogn its path. Such a clock where based on its propagation, you can figure out the sense of the arriving clock edge at flip flops is said to be
unate.
In some cases, depending on the circuit it may not be posible to figure out the sense, such a clock path is said to be
non unate. For such clock paths, we can use
set_clock_sense
command to pick which sense (possitive or negative)
- set_clock_sense [-positive|-negative|-stop_propagation]
[pulse pulse]
[-clock clock_list]- pin_list
在综合时候,为了便于优化我们会设置ideal network.
还有比如scan或者不同mode的path。
- set_ideal_network [-no_propagate]
- object_list
对ideal network也可以设置transition和lantency。
set_ideal_transition and set_ideal_lantency
挺好,有兴趣每日一贴,造福大家
可以做到起一个topic,每周更新,每日一贴有点困难,没有那么多时间。
每周一次也不错了,坚持就很好了
学习了