Altera_Forum
Honored Contributor
16 years agoHow to constrain generated clks derived from other generated clks?
Hi Everyone!
I am writing constraint for a legacy project. The original design uses too many "ripple clocks" that are generated from counters and FSMs. And the problem is while it is straightforward to constrain the first level of generated clocks, it is confusing to write constraints for the second level of generated clocks, that are "generated clocks derived from other generated clocks". I have read Brad's post of "ripple and gated clocks: clock dividers, clock muxes, and other logic-driven clocks (http://www.alteraforum.com/forum/showthread.php?p=8501)". It is really helpful. And I followed the instructions to reduce the number of the "ripple clocks" but there are still several ones left that are not easy to replace with clock enables. So I am determined to live with the remaining "ripple clocks" and constrain them correctly. I have read the examples for create_generated_clock command in the Altera website and related docs. They have not mentioned about the second level of generated clocks. So I tried to constrain them like this: create_clock -period 10.000 -name base_clk [get_ports clk_in] create_generated_clock -name gen_clk_level_1 -source [get_ports clk_in] -divide_by 2 -multiply_by 1 -master_clock [get_clocks base_clk] [get_registers inst1] create_generated_clock -name gen_clk_level_2 -source [get_registers inst1] -divide_by 2 -multiply_by 1 -master_clock [get_clocks gen_clk_level_1] [get_registers inst3] This works for me. The compilation result is good. But later on I read a doc from Synopsys about this kind of clock generation and it says:"generated clocks derived from other generated clocks should always be traced back to their non-generated source". And the suggested constraint for the above example looks like this: create_clock -period 10.000 -name base_clk [get_ports clk_in] create_generated_clock -name gen_clk_level_1 -source [get_ports clk_in] -divide_by 2 -multiply_by 1 [get_registers inst1] create_generated_clock -name gen_clk_level_2 -source [get_ports clk_in] -edges {3 7 11} [get_registers inst3] This works too. There is no difference in the constraint for the first level generated clock. So my questions are: 1. Can anyone tell me which style is correct? 2. For the second level generated clock, Does the first style accounts for all the clock source delay traced back to clk_in?