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_clockwith 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.
fa → fbhold check, earliest arrival1 cell
- Clock latency
- Cell delay
- Hold time
- New data from fa
Flop fa launches on the clk edge at 0 ns, and its Q changes at 0.2749 ns.
- 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.
- 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).
| Cell | Arc | Through | Edge | Delay (ns) | Time (ns) | Slew (ns) |
|---|---|---|---|---|---|---|
| 1 | fa/CLK → fa/Q | dfxtp_1 | rise | 0.2749 | 0.2749 | 0.0329 |
fa/Q → fb/D | wire a | rise | 0.0000 | 0.2749 | 0.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.
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.
| Option | What it says | Typical use |
|---|---|---|
| -divide_by N | Period is N times the master's | Counter or toggle-flop dividers |
| -multiply_by N | Period is the master's divided by N | A PLL output declared from its reference |
| -edges {a b c} | Master edges that make the rise, fall and next rise | Odd dividers, or a divider on the falling edge |
| -edge_shift {x y z} | Moves each listed edge by x, y, z ns | A divider with a known extra phase |
| -invert | Inverts the derived waveform | A divider output taken through an inverter |
| -duty_cycle P | High time as a percent, with -multiply_by | A multiplied clock that is not 50 % |
| -combinational | Traces the source latency through combinational cells only | The bypass path of a divider, through a clock mux |
| -master_clock and -add | Names which master, and keeps other clocks on the pin | Two 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.
- Cycle 0
Hold for both crossings uses the shared edge at 0 ns for launch and capture.
- 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.
- 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.
| Check | Launch (ns) | Capture (ns) | Slack, ideal (ns) |
|---|---|---|---|
| setup, fa → fb (clk to dclk) | 2 | 4 | 1.5833 |
| hold, fa → fb | 0 | 0 | 0.3466 |
| setup, fb → fc (dclk to clk) | 0 | 2 | 1.6066 |
| hold, fb → fc | 0 | 0 | 0.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.9260 | 1.9260 | 0.6328 |
| hold, fa → fb | 0.0092 | 0.0092 | 1.3024 |
| setup, fb → fc (dclk to clk) | 1.2701 | 1.2701 | 0.5633 |
| hold, fb → fc | 0.6510 | 0.6510 | 1.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.
| Declaration | Waveform OpenSTA builds | Matches a rising-edge counter? |
|---|---|---|
| -divide_by 3 | period 6 ns, high 0 to 3 ns | No: the fall lands on a falling clk edge |
| -edges {1 3 7} | period 6 ns, high 0 to 2 ns | Yes: high for one period |
| -edges {1 5 7} | period 6 ns, high 0 to 4 ns | Yes: 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.
| Check | Ideal (ns) | Propagated (ns) | Change |
|---|---|---|---|
| setup, fa → fb (clk to dclk) | 1.5833 | 1.9260 | 0.3427 |
| hold, fa → fb | 0.3466 | 0.0092 | -0.3374 |
| setup, fb → fc (dclk to clk) | 1.6066 | 1.2701 | -0.3365 |
| hold, fb → fc | 0.3248 | 0.6510 | 0.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.
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 pessimismHere 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.
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 → fb | Default (ns) | With the multicycle path (ns) |
|---|---|---|
| setup | 1.9260 | 3.9260 |
| hold | 0.0092 | 0.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.
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 against | Setup slack (ns) | Hold slack (ns) |
|---|---|---|
| clk, the internal clock | 1.0393 | 0.1491 |
| fclk, the forwarded clock | 1.1694 | 0.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.
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
fa → fbhold check, earliest arrival1 cell
- Clock latency
- Cell delay
- Hold time
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).
| Cell | Arc | Through | Edge | Delay (ns) | Time (ns) | Slew (ns) |
|---|---|---|---|---|---|---|
| 1 | fa/CLK → fa/Q | dfxtp_1 | rise | 0.2749 | 0.2749 | 0.0329 |
fa/Q → fb/D | wire a | rise | 0.0000 | 0.2749 | 0.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
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.
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.
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}.
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.
Run to draw the timing paths here.
WNS 1.2701 ns worst minimum slack 0.0092 nsRead 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
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.
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]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.