AR# 38099

How do I constrain designs with gated clocks?


It is common for designs to have one or more divided clocks. There are different ways to divide a clock and it is recommended that you use a clock management component, such as an MMCM to achieve the division. In this situation, the tool propagates the period constraint to the divided clock, for example, CLKDV and any multicycle path is also constrained automatically by the tool.

But, for a number of reasons, you might optout ofusing of an MMCM. In these cases, you normally use gated clocks for the division.

Because gated clocks generally are implemented using flip flops and look up tables, the tool does not propagate the period constraint on the input clock and as a result, the divided clock is left unconstrained and the you need to constrain these clocks.


The next diagram shows an example of a divider circuit using four flip flops and one inverter.

To constrain this kind of clock, add a period on the clock input as:


Then, apply a period on the clock out and relate it to the clock in manually as:


The value 16 is the division factor brought by the divider circuit, while the PHASE XYZ is the delay edge relation between CLKIN and CLKOUT. This phase is actually the delay from the output pin of component, which generates CLKIN to the output clock pin of FF4. The delay includes the switching delay from clock to Q output of all four FFs as well as the routing delays from FF to the next, shown in red in the diagram.

Because the phase depends on the routings, everytime something is changed in the design (even constraints) the routing delays change, and, therefore, it affects the PHASE XYZ. This needs to be fixed at a certain value. This is done in two ways:

  1. Add LOC constraints on the flip flops(to fix the placement) and use DIRT constraints (to fix the routings between the flip flops) in the UCF.
  2. Create an RPM for the divider circuit. In this way, the MAP/PAR tool is free to move the RPM around the device, but keeping the phase between the generated clock and input clock constant. This method is best option if the divider consists of several components and it would tedious to apply LOC all the components and add the DIRT constraint.

You can compute the delay using the FPGA Editor (selecting pins and pressing the 'delay' button) or Timing Analyzer (endpoint-to-endpoint analysis).

AR# 38099
Date 05/19/2012
Status Active
Type Design Advisory
Tools More Less