Generated Clocks in Depth

Declare a derived clock so STA pairs the right edges, and see how the divider's own delay becomes clock latency.

You Will Be Able To

  • Write create_generated_clock with a source, a master and the right edges.
  • Predict which edges STA pairs for paths into and out of a divided clock.
  • Explain why the divider's clock-to-Q delay helps one crossing and hurts the other.
  • Order SDC lines so a generated clock is propagated like its master.
Lesson
T4.2
Time
25 min
Runs on
OpenROAD
Check
4 questions

Data crosses from a flop on a 2 ns clock to a flop on the same clock divided by two. With ideal clocks, the hold check of that crossing has 0.3466 ns of margin. With propagated clocks it has only 0.0092 ns, because the divider's own delay took the rest.

Timing pathHold from Fa (Clk) to Fb (Dclk), Propagated ClocksFlop fa launches on clk. Flop fb is clocked by div/Q, which changes a clock-to-Q after the same clk edge.

fa → fbhold check, earliest arrival1 cell

  • Clock latency
  • Cell delay
  • Hold time
Hold from fa (clk) to fb (dclk), propagated clocks00.050.10.150.20.250.3time (ns)launch and capture clk ↑Data arrivesRequired afterfa/CLK → fa/Q (dfxtp_1): 0.2749 ns1 dfxtp_1clock 0.2932 nshold −0.0274 nsslack +0.0092 ns · metarrival 0.2749required 0.2658Hold from fa (clk) to fb (dclk), propagated clocks00.10.20.3time (ns)launch and capture clk ↑Data arrivesRequired afterfa/CLK → fa/Q (dfxtp_1): 0.2749 ns1 dfxtp_1clock 0.2932 nshold −0.0274 nsslack +0.0092 ns · metarrival 0.2749required 0.2658
  1. New data from fa

    Flop fa launches on the clk edge at 0 ns, and its Q changes at 0.2749 ns.

  2. The late divided edge

    dclk reaches fb 0.2932 ns after the clk edge, the clock-to-Q of div. Flop fb must keep its old D until 0.2658 ns.

  3. Nine picoseconds

    The slack is 0.0092 ns. A slightly slower divider, or a faster fa, and hold fails.

Read the path as a table

Launch: clk rise edge at 0.0000 ns, clock latency 0.0000 ns. Capture: dclk rise edge at 0.0000 ns, latency 0.2932 ns, library hold time −0.0274 ns.

Arrival 0.2749 ns, required 0.2658 ns, slack 0.0092 ns (met).

CellArcThroughEdgeDelay (ns)Time (ns)Slew (ns)
1fa/CLK → fa/Qdfxtp_1rise0.27490.27490.0329
fa/Q → fb/Dwire arise0.00000.27490.0329
The report
Startpoint: fa (rising edge-triggered flip-flop clocked by clk)
Endpoint: fb (rising edge-triggered flip-flop clocked by dclk)
Path Group: dclk
Path Type: min

Fanout       Cap      Slew     Delay      Time   Description
-------------------------------------------------------------------------------------
                              0.0000    0.0000   clock clk (rise edge)
                              0.0000    0.0000   clock source latency
     3    0.0056    0.0000    0.0000    0.0000 ^ clk (in)
                                                 clk (net)
                    0.0000    0.0000    0.0000 ^ fa/CLK (sky130_fd_sc_hd__dfxtp_1)
     1    0.0017    0.0329    0.2749    0.2749 ^ fa/Q (sky130_fd_sc_hd__dfxtp_1)
                                                 a (net)
                    0.0329    0.0000    0.2749 ^ fb/D (sky130_fd_sc_hd__dfxtp_1)
                                        0.2749   data arrival time

                              0.0000    0.0000   clock dclk (rise edge)
                              0.0000    0.0000   clock source latency
     3    0.0056    0.0000    0.0000    0.0000 ^ clk (in)
                                                 clk (net)
                    0.0000    0.0000    0.0000 ^ div/CLK (sky130_fd_sc_hd__dfxtp_1)
     2    0.0043    0.0548    0.2932    0.2932 ^ div/Q (sky130_fd_sc_hd__dfxtp_1)
                                                 dclk (net)
                    0.0548    0.0000    0.2932 ^ fb/CLK (sky130_fd_sc_hd__dfxtp_1)
                              0.0000    0.2932   clock reconvergence pessimism
                             -0.0274    0.2658   library hold time
                                        0.2658   data required time
-------------------------------------------------------------------------------------
                                        0.2658   data required time
                                       -0.2749   data arrival time
-------------------------------------------------------------------------------------
                                        0.0092   slack (MET)

OpenSTA 3.1.0 on the sky130 tt library, propagated clocks, no wires.

What a Generated Clock Declares

T4.1 showed that the tool stops at a divider. Without a generated clock, check_setup on div2 finds 1 unclocked register pin and 4 unconstrained endpoints. create_generated_clock names the new clock and ties it to a master clock.

The divided clock of div2: a 4 ns clock at div/Q, derived from clk at the port.
create_generated_clock -name dclk -source [get_ports clk] -divide_by 2 [get_pins div/Q]

The -source pin is where the master is measured, here the clk port. The last argument is where the new clock starts, here div/Q. The other options say how the new waveform follows the master.

OptionWhat it saysTypical use
-divide_by NPeriod is N times the master'sCounter or toggle-flop dividers
-multiply_by NPeriod is the master's divided by NA PLL output declared from its reference
-edges {a b c}Master edges that make the rise, fall and next riseOdd dividers, or a divider on the falling edge
-edge_shift {x y z}Moves each listed edge by x, y, z nsA divider with a known extra phase
-invertInverts the derived waveformA divider output taken through an inverter
-duty_cycle PHigh time as a percent, with -multiply_byA multiplied clock that is not 50 %
-combinationalTraces the source latency through combinational cells onlyThe bypass path of a divider, through a clock mux
-master_clock and -addNames which master, and keeps other clocks on the pinTwo clocks reaching one divider through a mux

The options of create_generated_clock in OpenSTA 3.1.0, from its command reference.

Which Edges STA Pairs

For each crossing, STA lists every launch edge and every capture edge of the two clocks. It then times setup against the closest later capture edge. Hold is checked against the capture edge that sampled the old data. The divided clock rises at 0, 4 and 8 ns, on every second rising edge of clk.

Clk and Dclk with -divide_by 2, in 0.5 Ns StepsThe master clk rises every 2 ns, and dclk rises at 0 and 4 ns.
0123456789101112131415clkdclk0 ns2 ns4 ns6 ns
Scroll horizontally ↔
  1. Cycle 0

    Hold for both crossings uses the shared edge at 0 ns for launch and capture.

  2. Cycle 4

    For fb → fc setup, dclk launches at 0 ns and the clk edge at 2 ns captures. For fa → fb setup, clk launches here.

  3. Cycle 8

    The clk launch at 2 ns is captured by dclk at 4 ns. Both crossings get 2 ns, one master period.

The closest edge pairs are one master period apart in both directions.

CheckLaunch (ns)Capture (ns)Slack, ideal (ns)
setup, fa → fb (clk to dclk)241.5833
hold, fa → fb000.3466
setup, fb → fc (dclk to clk)021.6066
hold, fb → fc000.3248

The four crossing checks of div2 with ideal clocks, as OpenSTA paired them.

Every run also lists the divider's own loop: from div/Q through ud back to div/D. It is timed as a path from dclk, which starts at div/Q, back to clk. With ideal clocks it is the worst hold of the block, at 0.0566 ns.

-edges: Naming the Master Edges

-edges lists master edges by number: edge 1 is the first rising edge, edge 2 the falling edge after it, and so on. A divide-by-two is -edges {1 3 5}: rise at edge 1, fall at edge 3, rise again at edge 5.

Check-divide_by 2-edges {1 3 5}-edges {2 4 6}
setup, fa → fb (clk to dclk)1.92601.92600.6328
hold, fa → fb0.00920.00921.3024
setup, fb → fc (dclk to clk)1.27011.27010.5633
hold, fb → fc0.65100.65101.3578

Slacks in ns, propagated clocks. The first two declarations give identical reports.

-edges {2 4 6} builds dclk from the falling edges of clk. That describes a divider clocked on the falling edge, which div2 is not. STA believes it anyway: dclk now rises at 1 ns, and fa → fb gets half a period, 0.6328 ns of slack.

Odd dividers show why the circuit must lead. A divide-by-three counter of rising-edge flops is high for one or two master periods, never one and a half.

DeclarationWaveform OpenSTA buildsMatches a rising-edge counter?
-divide_by 3period 6 ns, high 0 to 3 nsNo: the fall lands on a falling clk edge
-edges {1 3 7}period 6 ns, high 0 to 2 nsYes: high for one period
-edges {1 5 7}period 6 ns, high 0 to 4 nsYes: high for two periods

report_clock_properties of each declaration on the 2 ns master.

The Divider's Delay Is Clock Latency

With propagated clocks the tool follows clk through div, so dclk reaches fb 0.2932 ns after each clk edge. That delay is part of dclk's latency, and for a crossing between the two clocks it acts as skew.

CheckIdeal (ns)Propagated (ns)Change
setup, fa → fb (clk to dclk)1.58331.92600.3427
hold, fa → fb0.34660.0092-0.3374
setup, fb → fc (dclk to clk)1.60661.2701-0.3365
hold, fb → fc0.32480.65100.3262

The same netlist and generated clock. Only set_propagated_clock differs.

A late capture clock gives setup more time and hold less, so fa → fb gains setup and loses hold. For fb → fc the late clock is on the launch side, so the signs flip: setup loses and hold gains.

The same happens in silicon, where a divider output often drives a clock tree of its own. The tree adds more latency, so the crossings need propagated clocks, and real clock trees, to be checked properly.

Source Latency and Network Latency

A generated clock's latency has two parts. Source latency runs from the master's source to the generated clock's own pin, here through div. Network latency runs from that pin to the flops, through any clock tree after it.

The block div2t is div2 with two clock buffers between div/Q and fb/CLK. In -format full_clock, the report folds the divider into one source-latency line and lists the buffers after it.

The capture side of the hold path into fb, div2t with propagated clocks.
   0.2952    0.2952   clock source latency
   0.0000    0.2952 ^ div/Q (sky130_fd_sc_hd__dfxtp_1)
   0.0795    0.3747 ^ cb1/X (sky130_fd_sc_hd__clkbuf_1)
   0.0709    0.4456 ^ cb2/X (sky130_fd_sc_hd__clkbuf_1)
   0.0000    0.4456 ^ fb/CLK (sky130_fd_sc_hd__dfxtp_1)
   0.0000    0.4456   clock reconvergence pessimism

Here the divider gives 0.2952 ns of source latency and the buffers add 0.1504 ns of network latency. Hold into fb now fails at -0.1407 ns. Before the tree exists, set_clock_latency on dclk models the network part, and set_clock_latency -source only overrides the source part.

When Data Moves Every Other Cycle

By default fa → fb gets one master period: the clk launch at 2 ns is captured by dclk at 4 ns. Often the design launches fa only once per dclk cycle, so the data really has a whole dclk period. A multicycle path says so.

-start counts cycles of the launch clock, clk: two for setup, and hold back at its usual edge.
set_multicycle_path 2 -setup -start -from [get_clocks clk] -to [get_clocks dclk]
set_multicycle_path 1 -hold -start -from [get_clocks clk] -to [get_clocks dclk]
Check fa → fbDefault (ns)With the multicycle path (ns)
setup1.92603.9260
hold0.00920.0092

div2 with propagated clocks.

Setup gains one master period and hold stays where it was. The exception is true only if fa really changes once per dclk cycle; a wrong one hides a real failure. T5.1 covers multicycle paths in full.

Forwarded Clocks on Output Ports

In a source-synchronous interface, the block sends its clock out with its data, and the receiver samples with that clock. The SDC declares the forwarded clock as a generated clock at the output, and the output delays refer to it.

The block fwd: f1 drives dout, and clk leaves through two buffers to clk_out.
create_generated_clock -name fclk -source [get_ports clk] -divide_by 1 [get_ports clk_out]
set_output_delay 0.6 -clock fclk -max [get_ports dout]
set_output_delay -0.2 -clock fclk -min [get_ports dout]
Output delays againstSetup slack (ns)Hold slack (ns)
clk, the internal clock1.03930.1491
fclk, the forwarded clock1.16940.0189

fwd at 2 ns with propagated clocks, the same 0.6 ns and −0.2 ns output delays.

With the forwarded clock, the clock's trip through the output buffers moves the receiver's edge later. Setup gains that delay and hold loses it: 0.1301 ns each way. Against the internal clock, the report ignores that the clock travels with the data.

Chained Generated Clocks

A divider of a divided clock is a generated clock whose source is another generated clock. Each stage adds its own clock-to-Q to the latency.

The block div4: dv1 divides clk by two, and dv2, clocked by dv1/Q, divides by four.
create_clock -name clk -period 2.0 [get_ports clk]
set_clock_transition 0.1 [all_clocks]
create_generated_clock -name c2 -source [get_ports clk] -divide_by 2 [get_pins dv1/Q]
create_generated_clock -name c4 -source [get_pins dv1/Q] -divide_by 2 [get_pins dv2/Q]
set_propagated_clock [all_clocks]

OpenSTA builds c2 with a period 4 ns, high 0 to 2 ns. It builds c4 with a period 8 ns, high 0 to 4 ns. The hold check from fa into fb now sees 0.6064 ns of latency, and it fails at -0.3040 ns. Chained dividers need their crossings checked with care.

Order Matters in SDC

SDC runs from top to bottom, and [all_clocks] returns the clocks that exist at that line, not the ones defined later. A generated clock declared after set_propagated_clock [all_clocks] therefore stays an ideal clock.

dclk stays ideal

create_clock -name clk -period 2.0 [get_ports clk]
set_clock_transition 0.1 [all_clocks]
set_propagated_clock [all_clocks]
create_generated_clock -name dclk -source [get_ports clk] -divide_by 2 [get_pins div/Q]

The report says "clock network delay (ideal)" for dclk. Hold fa → fb: 0.0164 ns.

dclk is propagated

create_clock -name clk -period 2.0 [get_ports clk]
set_clock_transition 0.1 [all_clocks]
create_generated_clock -name dclk -source [get_ports clk] -divide_by 2 [get_pins div/Q]
set_propagated_clock [all_clocks]

dclk uses the real clock slew at fb. Hold fa → fb: 0.0092 ns.

Here the difference is only 0.0072 ns. OpenSTA still adds the master's path through div as dclk's latency, and no cells sit after div/Q. The ideal dclk loses only its real slew at fb/CLK. In a block where a clock tree follows the divider, an ideal clock skips that whole tree.

The hold path with the generated clock declared last
Timing pathHold from Fa to Fb, Dclk Declared After set_propagated_clock

fa → fbhold check, earliest arrival1 cell

  • Clock latency
  • Cell delay
  • Hold time
Hold from fa to fb, dclk declared after set_propagated_clock00.050.10.150.20.250.3time (ns)launch and capture clk ↑Data arrivesRequired afterfa/CLK → fa/Q (dfxtp_1): 0.2749 ns1 dfxtp_1clock 0.2932 nshold −0.0346 nsslack +0.0164 ns · metarrival 0.2749required 0.2586Hold from fa to fb, dclk declared after set_propagated_clock00.10.20.3time (ns)launch and capture clk ↑Data arrivesRequired afterfa/CLK → fa/Q (dfxtp_1): 0.2749 ns1 dfxtp_1clock 0.2932 nshold −0.0346 nsslack +0.0164 ns · metarrival 0.2749required 0.2586
Read the path as a table

Launch: clk rise edge at 0.0000 ns, clock latency 0.0000 ns. Capture: dclk rise edge at 0.0000 ns, latency 0.2932 ns, library hold time −0.0346 ns.

Arrival 0.2749 ns, required 0.2586 ns, slack 0.0164 ns (met).

CellArcThroughEdgeDelay (ns)Time (ns)Slew (ns)
1fa/CLK → fa/Qdfxtp_1rise0.27490.27490.0329
fa/Q → fb/Dwire arise0.00000.27490.0329
The report
Startpoint: fa (rising edge-triggered flip-flop clocked by clk)
Endpoint: fb (rising edge-triggered flip-flop clocked by dclk)
Path Group: dclk
Path Type: min

Fanout       Cap      Slew     Delay      Time   Description
-------------------------------------------------------------------------------------
                              0.0000    0.0000   clock clk (rise edge)
                              0.0000    0.0000   clock source latency
     3    0.0056    0.0000    0.0000    0.0000 ^ clk (in)
                                                 clk (net)
                    0.0000    0.0000    0.0000 ^ fa/CLK (sky130_fd_sc_hd__dfxtp_1)
     1    0.0017    0.0329    0.2749    0.2749 ^ fa/Q (sky130_fd_sc_hd__dfxtp_1)
                                                 a (net)
                    0.0329    0.0000    0.2749 ^ fb/D (sky130_fd_sc_hd__dfxtp_1)
                                        0.2749   data arrival time

                    0.0000    0.0000    0.0000   clock dclk (rise edge)
                              0.2932    0.2932   clock network delay (ideal)
                              0.0000    0.2932   clock reconvergence pessimism
                                        0.2932 ^ fb/CLK (sky130_fd_sc_hd__dfxtp_1)
                             -0.0346    0.2586   library hold time
                                        0.2586   data required time
-------------------------------------------------------------------------------------
                                        0.2586   data required time
                                       -0.2749   data arrival time
-------------------------------------------------------------------------------------
                                        0.0164   slack (MET)

Look at the capture side: the clock network delay is marked ideal.

Asked in interviews
  1. Why not create_clock on a divider output?

    It makes a new clock whose edges are assumed to line up with the master at time 0. The crossings are still timed, but the divider's delay is lost.

  2. What does -source mean in create_generated_clock?

    The pin where the master clock is observed. The tool follows the master from there to the generated clock's pin to find the latency.

  3. How do you declare a clock divided by three?

    It depends on the duty the counter makes. -divide_by 3 declares 50 %, which needs a falling-edge flop. A rising-edge counter high for one period is -edges {1 3 7}; high for two, -edges {1 5 7}.

  4. Two clocks reach one divider through a mux. How do you constrain it?

    Two generated clocks on the divider output, each with -master_clock naming its source clock, the second with -add. Then make them exclusive.

Try It

This is the propagated SDC. Run it and open Paths: the dclk capture edges carry 0.2932 ns of latency, and the worst hold slack is 0.0092 ns.

Now move set_propagated_clock above create_generated_clock and run again. Then try -edges {2 4 6} in place of -divide_by 2, and watch both crossings change.

STAOpenSTA in OpenROAD 26Q2 · sky130hd tt_025C_1v80 Liberty · simulator service
Edit the constraints, then run them

          
Expected: WNS 1.2701 ns worst minimum slack 0.0092 ns
Read the netlist: div2.v (the bundled design div2)
// div2: a toggle flop divides clk by two; its Q clocks two flops. One path crosses from clk to the divided clock and back.
module div2 (clk, d, q);
  input clk; input d; output q;
  wire dclk, dn, a, b, bn;
  sky130_fd_sc_hd__dfxtp_1 div (.CLK(clk), .D(dn), .Q(dclk));
  sky130_fd_sc_hd__inv_1 ud (.A(dclk), .Y(dn));
  sky130_fd_sc_hd__dfxtp_1 fa (.CLK(clk), .D(d), .Q(a));
  sky130_fd_sc_hd__dfxtp_1 fb (.CLK(dclk), .D(a), .Q(b));
  sky130_fd_sc_hd__inv_1 ub (.A(b), .Y(bn));
  sky130_fd_sc_hd__dfxtp_1 fc (.CLK(clk), .D(bn), .Q(q));
endmodule

Check Yourself

Predict the outputThe propagated SDC plus set_clock_uncertainty -hold 0.02 [all_clocks]. What worst hold slack (WHS) does OpenSTA report, in ns?
create_clock -name clk -period 2.0 [get_ports clk]
set_clock_transition 0.1 [all_clocks]
create_generated_clock -name dclk -source [get_ports clk] -divide_by 2 [get_pins div/Q]
set_propagated_clock [all_clocks]
set_clock_uncertainty -hold 0.02 [all_clocks]
ConceptA clock mux picks either clk or the divider output. You declare a generated clock on the mux output for the clk input. Which option stops the tool tracing its latency through the divider flop?
ConceptWith propagated clocks, fa → fb hold falls from 0.3466 to 0.0092 ns, but fb → fc hold grows from 0.3248 to 0.6510 ns. Why the opposite signs?
ConceptA design's PLL makes a 400 MHz clock from a 100 MHz reference. How is its output often declared for STA?

Common Mistakes

Wrong Write create_generated_clock after set_propagated_clock [all_clocks].

all_clocks finds only the clocks defined so far, so dclk stays ideal: hold reads 0.0164, not 0.0092 ns.

Fix Define every clock, generated ones included, before set_propagated_clock.

Before
create_clock -name clk -period 2.0 [get_ports clk]
set_propagated_clock [all_clocks]
create_generated_clock -name dclk \
  -source [get_ports clk] -divide_by 2 [get_pins div/Q]
After
create_clock -name clk -period 2.0 [get_ports clk]
create_generated_clock -name dclk \
  -source [get_ports clk] -divide_by 2 [get_pins div/Q]
set_propagated_clock [all_clocks]

Wrong Declare the divided clock with create_clock on the divider output.

It starts a new clock at that pin with no tie to the master, so the divider's delay never reaches the crossings.

Fix Use create_generated_clock -source on the master, so the tool follows the master through the divider.

Wrong Pick -edges that do not match how the divider really switches.

STA believes the declaration, so -edges {2 4 6} on a rising-edge divider moves every crossing and cuts fa → fb setup to 0.6328 ns.

Fix Count the master edges that make the divided clock rise and fall, starting from 1 at the first rising edge.

Wrong Sign off hold on a divided clock with ideal clocks.

Ideal clocks leave out the divider's 0.2932 ns, which here takes the hold margin from 0.3466 to 0.0092 ns.

Fix Check crossings between a master and its generated clock with propagated clocks.

Remember

  • A generated clock names its master and its source pin, so STA knows where its edges fall.
  • -edges counts master edges from 1 at the first rise; -edges {1 3 5} is a divide-by-two.
  • With propagated clocks the divider's clock-to-Q is latency: it helps one crossing's hold and hurts the other's.
  • SDC runs in order: define every clock before set_propagated_clock [all_clocks].
  • STA believes the declaration, so it must match how the circuit really switches.

Practice

Report a problem with this page