首页
学习
活动
专区
圈层
工具
发布
50 篇文章
1
资源利用率报告中的LUT和LUTRAM有什么区别
2
xilinx verilog语法技巧(三)--RAM的初始化
3
为什么推荐使用XPM?
4
Block RAM的基本结构
5
为什么要用XPM_MEMORY
6
Vivado中用于时钟操作的几个Tcl命令
7
影响FPGA时序的进位链(Carry Chain), 你用对了么??
8
动态时钟相位
9
动态时钟频率
10
如何缩短Vivado运行时间
11
你的FPGA设计有这些缺陷吗
12
report_utilization远比你想象的强大
13
vivado如何快速找到schematic中的object
14
FPGA中的CLOCK REGION和SLR是什么含义
15
FPGA中的BEL, SITE, TILE是什么含义
16
如何快速查找目标cell
17
都是pin,有什么区别
18
都是net,有什么区别
19
一张图看懂cell, pin, net, port
20
如何快速找到组合逻辑生成的时钟
21
【Vivado那些事】Vivado下头文件使用注意事项
22
Pblock可以这么画
23
关于Pblock的8个必知问题
24
常用的跟Pblock相关的Tcl命令
25
【Vivado】那些事儿-汇总篇
26
【Vivado那些事】Xilinx FPGA普通IO能不能直接接入PLL作为时钟输入
27
Storage Elements
28
D触发器都有哪几种类型?对应什么样的代码?
29
Xilinx 7系列FPGA逻辑单元理解
30
Vivado下查看芯片资源
31
对RAM初始化怎么做
32
干货:Vivado 直接修改RAM初始化文件,避免重新综合、实现的方法
33
借助Elaborated Design优化RTL代码
34
一张图理解什么是好的设计层次
35
9个关于SSI芯片的必知问题
36
Vivado 2018.3 report_qor_suggestions怎么用
37
Vivado 2019.1新特性(5):更新的report_qor_suggestions
38
Xilinx的高质量时钟输出ODDR原语【随路时钟】【全局时钟网络】【ZC706输出时钟】【ZYNQ】
39
FPGA中BEL Site Tile FSR SLR分别指什么?
40
跟I/O相关的几个命令
41
Vivado Non-Project模式
42
FPGA中降低时钟skew的几种方法
43
FPGA时序优化之Reduce MUXF Mapping
44
什么是Forwarded Clock?
45
几个常见问题
46
如何让同一层次的模块在布局时更紧凑一些
47
什么情况下要用OOC综合方式
48
Vivado 2019.1新特性(2):report_ram_utilization
49
URAM和BRAM有什么区别
50
write_first/read_first/no_change什么区别
清单首页FPGA文章详情

Vivado中用于时钟操作的几个Tcl命令

前言

理论上,使用Tcl可以在Vivado上完成一切操作,但是没必要,因为命令太多,很难记忆,我们只需要知道几个常用的即可,方便我们使用Vivado。

对于时序约束,我们常用的tcl命令,最多的是时钟相关的,因为约束也是对时钟进行约束。

正文

下面给出几个常用的操作,并给出示例效果(以Xilinx的工程示例Wavegen为例),一起看看吧。

  1. report_clocks

直接在Tcl Console框内输入:

代码语言:javascript
复制
report_clocks

即可显示,工程中关于时钟的约束情况。

但是,前提是,打开了Elaborated Design或者Synthesized Design或者implemented Design。

如果没有打开三者之一,则会提示:

代码语言:javascript
复制
ERROR: [Common 17-53] User Exception: No open design. 
Please open an elaborated, synthesized or implemented design before executing this command.

例如我打开了Elaborated Design之后,输入该命令:

代码语言:javascript
复制
Clock Report


Attributes
  P: Propagated
  G: Generated
  A: Auto-derived
  R: Renamed
  V: Virtual
  I: Inverted
  S: Pin phase-shifted with Latency mode

Clock              Period(ns)  Waveform(ns)    Attributes  Sources
clk_pin_p          5.000       {0.000 2.500}   P           {clk_pin_p}
virtual_clock      6.000       {0.000 3.000}   V           {}
clk_samp           192.000     {0.000 96.000}  P,G         {clk_gen_i0/BUFHCE_clk_samp_i0/O}
spi_clk            6.000       {3.000 6.000}   P,G,I       {spi_clk_pin}
clk_rx_clk_core    5.000       {0.000 2.500}   P,G,A       {clk_gen_i0/clk_core_i0/inst/mmcm_adv_inst/CLKOUT0}
clk_tx_clk_core    6.000       {0.000 3.000}   P,G,A       {clk_gen_i0/clk_core_i0/inst/mmcm_adv_inst/CLKOUT1}
clkfbout_clk_core  5.000       {0.000 2.500}   P,G,A       {clk_gen_i0/clk_core_i0/inst/mmcm_adv_inst/CLKFBOUT}


====================================================
Generated Clocks
====================================================

Generated Clock     : clk_samp
Master Source       : clk_gen_i0/clk_core_i0/clk_tx
Master Clock        : clk_tx_clk_core
Divide By           : 32
Generated Sources   : {clk_gen_i0/BUFHCE_clk_samp_i0/O}

Generated Clock     : spi_clk
Master Source       : dac_spi_i0/out_ddr_flop_spi_clk_i0/ODDR_inst/C
Master Clock        : clk_tx_clk_core
Divide By           : 1
Generated Sources   : {spi_clk_pin}

Generated Clock     : clk_rx_clk_core
Master Source       : clk_gen_i0/clk_core_i0/inst/mmcm_adv_inst/CLKIN1
Master Clock        : clk_pin_p
Multiply By         : 1
Generated Sources   : {clk_gen_i0/clk_core_i0/inst/mmcm_adv_inst/CLKOUT0}

Generated Clock     : clk_tx_clk_core
Master Source       : clk_gen_i0/clk_core_i0/inst/mmcm_adv_inst/CLKIN1
Master Clock        : clk_pin_p
Edges               : {1 2 3}
Edge Shifts(ns)     : {0.000 0.500 1.000}
Generated Sources   : {clk_gen_i0/clk_core_i0/inst/mmcm_adv_inst/CLKOUT1}

Generated Clock     : clkfbout_clk_core
Master Source       : clk_gen_i0/clk_core_i0/inst/mmcm_adv_inst/CLKIN1
Master Clock        : clk_pin_p
Multiply By         : 1
Generated Sources   : {clk_gen_i0/clk_core_i0/inst/mmcm_adv_inst/CLKFBOUT}



====================================================
User Uncertainty
====================================================



====================================================
User Jitter
====================================================

时钟的属性也一览无余,我们注意到这三个时钟:

代码语言:javascript
复制
clk_rx_clk_core    5.000       {0.000 2.500}   P,G,A       {clk_gen_i0/clk_core_i0/inst/mmcm_adv_inst/CLKOUT0}
clk_tx_clk_core    6.000       {0.000 3.000}   P,G,A       {clk_gen_i0/clk_core_i0/inst/mmcm_adv_inst/CLKOUT1}
clkfbout_clk_core  5.000       {0.000 2.500}   P,G,A       {clk_gen_i0/clk_core_i0/inst/mmcm_adv_inst/CLKFBOUT}

其时钟属性包括A,即自动生成的时钟,也就是这几个时钟不是我们手动在Xdc文件中约束的时钟,而是IP核根据用户定制设置,自动约束的时钟。

对于经过时钟IP的主时钟,约束只需要约束输入即可,输出时钟IP会自动推断。有的时候,(可能是高版本的Vivado工具),输入时钟也给你自动约束好了,再约束一次反而会有warning?面对这种情况,约束与不约束都行,看个人习惯,可不用理会这种warning。

至于为什么多了一个clkfbuf_clk_core,看看IP,我们没有生成这么一个时钟呀。嗯,了解一下IP就知道这是IP自动生成的一个反馈时钟。

我们还注意到,对于差分输入时钟的约束:

代码语言:javascript
复制
clk_pin_p          5.000       {0.000 2.500}   P           {clk_pin_p}

仅仅约束P端即可。

这是允许且推荐的,对差分时钟的约束方式,没有必要对PN都约束。

  1. report_clock_networks

这个tcl命令主要还是用于查看有没有遗忘的主时钟约束,如果没有,例如我们的wavegen工程:

代码语言:javascript
复制
report_clock_networks

------------------------------------------------------------------------------------
| Tool Version : Vivado v.2019.1 (win64) Build 2552052 Fri May 24 14:49:42 MDT 2019
| Date         : Thu Oct  7 22:45:10 2021
| Host         : DESKTOP-REBORN running 64-bit major release  (build 9200)
| Command      : report_clock_networks
| Design       : wave_gen
| Device       : 7k70t-fbg676
| Speed File   : -1  PRODUCTION 1.12 2017-02-17
------------------------------------------------------------------------------------

Clock Networks Report


Constrained Clocks
-------------------

Clock clk_pin_p (200MHz)(endpoints: 645 clock, 1 nonclock)
Port clk_pin_p

Clock virtual_clock (166.667MHz)(endpoints: 0 clock, 0 nonclock)

如果我们将约束文件中的主时钟约束注释掉,注意, wavegen工程的主时钟在IP的XDC文件里:

注释掉:

综合之后,再运行这条指令:

代码语言:javascript
复制
Clock Networks Report


Constrained Clocks
-------------------

Clock virtual_clock (166.667MHz)(endpoints: 0 clock, 0 nonclock)


Unconstrained Clocks
-------------------

Clock clk_pin_p (endpoints: 645 clock, 1 nonclock)
Port clk_pin_p

可见,就会出现提示,这个主时钟未约束。

只要是它提示的,都要尽量给予约束。

注:如果要在GUI界面显示clock networks,可输入命令:

代码语言:javascript
复制
report_clock_networks -name mainclock

可以更直观看到时钟信息。

  1. check_timing

该命令可以检查更过内容,我们在wavegen中尝试输入,可得:

代码语言:javascript
复制

check_timing report

Table of Contents
-----------------
1. checking no_clock
2. checking constant_clock
3. checking pulse_width_clock
4. checking unconstrained_internal_endpoints
5. checking no_input_delay
6. checking no_output_delay
7. checking multiple_clock
8. checking generated_clocks
9. checking loops
10. checking partial_input_delay
11. checking partial_output_delay
12. checking latch_loops

1. checking no_clock
--------------------
 There are 0 register/latch pins with no clock.


2. checking constant_clock
--------------------------
 There are 0 register/latch pins with constant_clock.


3. checking pulse_width_clock
-----------------------------
 There are 0 register/latch pins which need pulse_width check


4. checking unconstrained_internal_endpoints
--------------------------------------------
 There are 0 pins that are not constrained for maximum delay.

 There are 0 pins that are not constrained for maximum delay due to constant clock.


5. checking no_input_delay
--------------------------
 There are 0 input ports with no input delay specified.

 There is 1 input port with no input delay but user has a false path constraint. (MEDIUM)


6. checking no_output_delay
---------------------------
 There are 0 ports with no output delay specified.

 There are 0 ports with no output delay but user has a false path constraint

 There is 1 port with no output delay but with a timing clock defined on it or propagating through it (LOW)


7. checking multiple_clock
--------------------------
 There are 0 register/latch pins with multiple clocks.


8. checking generated_clocks
----------------------------
 There are 0 generated clocks that are not connected to a clock source.


9. checking loops
-----------------
 There are 0 combinational loops in the design.


10. checking partial_input_delay
--------------------------------
 There are 0 input ports with partial input delay specified.


11. checking partial_output_delay
---------------------------------
 There are 0 ports with partial output delay specified.


12. checking latch_loops
------------------------
 There are 0 combinational latch loops in the design through latch input

可见,其检查内容之多:

代码语言:javascript
复制
1. checking no_clock
2. checking constant_clock
3. checking pulse_width_clock
4. checking unconstrained_internal_endpoints
5. checking no_input_delay
6. checking no_output_delay
7. checking multiple_clock
8. checking generated_clocks
9. checking loops
10. checking partial_input_delay
11. checking partial_output_delay
12. checking latch_loops

为了尝试效果,我们同样注释掉主时钟约束:

代码语言:javascript
复制
# Differential clock only needs one constraint
#create_clock -period 5.000 [get_ports clk_in1_p]
#set_input_jitter [get_clocks -of_objects [get_ports clk_in1_p]] 0.05


#set_property PHASESHIFT_MODE WAVEFORM [get_cells -hierarchical *adv*]

再输入 check_timing :

代码语言:javascript
复制


check_timing report

Table of Contents
-----------------
1. checking no_clock
2. checking constant_clock
3. checking pulse_width_clock
4. checking unconstrained_internal_endpoints
5. checking no_input_delay
6. checking no_output_delay
7. checking multiple_clock
8. checking generated_clocks
9. checking loops
10. checking partial_input_delay
11. checking partial_output_delay
12. checking latch_loops

1. checking no_clock
--------------------
 There are 604 register/latch pins with no clock driven by root clock pin: clk_pin_p (HIGH)

 There are 41 register/latch pins with no clock driven by root clock pin: clk_gen_i0/BUFHCE_clk_samp_i0/O (HIGH)


2. checking constant_clock
--------------------------
 There are 0 register/latch pins with constant_clock.


3. checking pulse_width_clock
-----------------------------
 There are 0 register/latch pins which need pulse_width check


4. checking unconstrained_internal_endpoints
--------------------------------------------
 There are 1468 pins that are not constrained for maximum delay. (HIGH)

 There are 0 pins that are not constrained for maximum delay due to constant clock.


5. checking no_input_delay
--------------------------
 There is 1 input port with no input delay specified. (HIGH)

 There is 1 input port with no input delay but user has a false path constraint. (MEDIUM)


6. checking no_output_delay
---------------------------
 There are 0 ports with no output delay specified.

 There are 0 ports with no output delay but user has a false path constraint

 There is 1 port with no output delay but with a timing clock defined on it or propagating through it (LOW)


7. checking multiple_clock
--------------------------
 There are 0 register/latch pins with multiple clocks.


8. checking generated_clocks
----------------------------
 There are 2 generated clocks that are not connected to a clock source. (HIGH)


9. checking loops
-----------------
 There are 0 combinational loops in the design.


10. checking partial_input_delay
--------------------------------
 There are 0 input ports with partial input delay specified.


11. checking partial_output_delay
---------------------------------
 There are 0 ports with partial output delay specified.


12. checking latch_loops
------------------------
 There are 0 combinational latch loops in the design through latch input

可见,也报出了缺时钟:

代码语言:javascript
复制
1. checking no_clock
--------------------
 There are 604 register/latch pins with no clock driven by root clock pin: clk_pin_p (HIGH)

 There are 41 register/latch pins with no clock driven by root clock pin: clk_gen_i0/BUFHCE_clk_samp_i0/O (HIGH)

为了专门检查:checking no_clock

可以针对输入命令:

代码语言:javascript
复制
check_timing -override_defaults no_clock

可得:

代码语言:javascript
复制

check_timing report

Table of Contents
-----------------
1. checking no_clock

1. checking no_clock
--------------------
 There are 604 register/latch pins with no clock driven by root clock pin: clk_pin_p (HIGH)

 There are 41 register/latch pins with no clock driven by root clock pin: clk_gen_i0/BUFHCE_clk_samp_i0/O (HIGH)

直接了当。

这篇短文就介绍到这里。

- END -

下一篇
举报
领券