UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Advisor ronnywebers
Advisor
6,084 Views
Registered: ‎10-10-2014

timing constraint - get clock period using tcl instead of hard-coding it

Jump to solution

For a CDC in my design, I have a set_max_delay -datapath_only constraint

 

the value of 62.5ns corresponds to 1 clock period of the destination clock (16MHz). This clock is an output of an MMCM in my (zynq) design. The MMCM is configured using a 'clock generator wizard'

 

Now what bothers me is that the 62.5ns is a hardcoded value, what if I later decide to change the clock frequency in the 'clock generator wizard' and forget to update this value? 

 

Q: can I get this clock period using a tcl command instead of hard-coding this value?

 

# constrain the datapath between the src data register and dst data register
set_max_delay -from [get_cells design_1_i/snap_sin_rx_0/U0/sync_2ff_i/src_din_reg_reg[*]] -to [get_cells design_1_i/snap_sin_rx_0/U0/sync_2ff_i/data_dst_clk_reg[*]] -datapath_only 62.5

 

** kudo if the answer was helpful. Accept as solution if your question is answered **
1 Solution

Accepted Solutions
Moderator
Moderator
10,047 Views
Registered: ‎01-16-2013

Re: timing constraint - get clock period using tcl instead of hard-coding it

Jump to solution

Hi @ronnywebers,

 

I have tried this in small test case and I am able to get the value using TCL command.

Below are the commands I have used.
get_property PERIOD [get_clocks <clock_name>]

If you don't know exact clock name then use below command.
get_property PERIOD [get_clocks -of_objects [get_pins <pin name>]]

It will give you the period value in Nanoseconds which you can use in your constraints.

 

Thanks,
Yash

View solution in original post

4 Replies
Moderator
Moderator
10,048 Views
Registered: ‎01-16-2013

Re: timing constraint - get clock period using tcl instead of hard-coding it

Jump to solution

Hi @ronnywebers,

 

I have tried this in small test case and I am able to get the value using TCL command.

Below are the commands I have used.
get_property PERIOD [get_clocks <clock_name>]

If you don't know exact clock name then use below command.
get_property PERIOD [get_clocks -of_objects [get_pins <pin name>]]

It will give you the period value in Nanoseconds which you can use in your constraints.

 

Thanks,
Yash

View solution in original post

Advisor ronnywebers
Advisor
6,048 Views
Registered: ‎10-10-2014

Re: timing constraint - get clock period using tcl instead of hard-coding it

Jump to solution

thanks @yashp, that seems to work, I tried this:

 

get_property PERIOD [get_clocks -of_objects [get_cells design_1_i/snap_sin_rx_0/U0/sync_2ff_i/data_dst_clk_reg[0]]]

that returns :

76.92184448242187500

which corresponds to my 13MHz clock. 

 

would you round this value or doesn't it matter for the timing analyser?

** kudo if the answer was helpful. Accept as solution if your question is answered **
0 Kudos
Moderator
Moderator
6,002 Views
Registered: ‎01-16-2013

Re: timing constraint - get clock period using tcl instead of hard-coding it

Jump to solution

Hi,

 

I guess I missed your reply.

Good that you are able get the value using TCL command.

In any constraints you can give value as xx.yyy ns but I am not sure if you are getting value as 76.92184448242187500.

 

Did you tried without any changes? Is there any issue?

 

Thanks,
Yash

0 Kudos
Guide avrumw
Guide
5,917 Views
Registered: ‎01-23-2009

Re: timing constraint - get clock period using tcl instead of hard-coding it

Jump to solution

I wouldn't worry about the precision. The tool always has to deal with rounding issues (since we often work with irrational clock periods). Specifying the full precision will be OK - the tools will round as they need to.

 

Avrum