Synchronous Design Rules, Clock Skew and Jitter
Follow the rules that make a circuit synchronous, spot circuits that break them, and add skew and jitter to the checks.
You Will Be Able To
- State the rules of synchronous design.
- Recognize a combinational loop, a gated clock and a derived clock.
- Add clock skew to the setup and hold checks with the right sign.
- Explain how jitter shrinks the usable clock period.
- Lesson
- G5.9
- Time
- 30 min
- Runs on
- Your browser
- Check
- 5 questions
A low-power counter counted one extra event in every burst. Its enable had been ANDed into the clock, and the enable sometimes rose while the clock was high. That rise was a clock edge too.
- Cycle 2
en rose while the clock was low. Both counters count once at the next edge.
- Cycle 4
en rises 2 ns after an edge, while the clock is high. clk AND en rises at once: the gated counter counts early.
- Cycle 6
Both count the real edges while en is 1, so the gated counter stays one ahead: 4 against 3.
Measured: the lines the lab prints, one per clock period.
The Synchronous Rules
A synchronous circuit is easy to time because every check involves one clock period. Three rules make it so.
One clock
Every flip-flop gets the same clock, from the clock tree, not from logic.
Edge-triggered storage
All state is held in flip-flops that change only at the clock edge.
No loops through logic
Every loop passes through at least one flip-flop.
- Clock / reset
- Storage
- Datapath
- Clock
- Data
- Data
Data moves from register to register through logic, once per clock period.
- Feedback
A loop is legal because it passes a register: its value changes once per edge.
Read the diagram as text
- Clock tree: one clock
- Register: flip-flops
- Logic: settles within a period
- Register: flip-flops
- Clock tree → Register: clk
- Register → Logic
- Logic → Register
- Register → Logic: feedback through a register
Break any rule and the setup and hold checks of G5.8 no longer describe the circuit.
Circuits That Break the Rules
A loop of logic with an odd number of inversions has no stable state. It oscillates.
A gated clock feeds the clock through logic. The hook showed its failure: an enable that changes while the clock is high makes an extra edge. Logic glitches can do the same (G5.3).
A derived clock comes from a flip-flop or counter output. It reaches its flops late, and a path between the two clocks is no longer one clean period.
Clock Skew
Skew is the difference in arrival time of one clock edge at two flops: the capture arrival minus the launch arrival.
| Check | With skew (capture late is positive) |
|---|---|
| Setup | T + skew ≥ t_pcq + t_pd + t_setup |
| Hold | t_ccq + t_cd ≥ t_hold + skew |
A late capture edge waits longer for slow data, and must also be held past by fast data.
So skew trades one check for the other. A clock tree is built to keep skew small; STA lesson T2.1 measures it on SKY130 cells.
Clock Jitter
Jitter is the variation of an edge around its ideal time. For setup, what counts is cycle-to-cycle jitter: the most one period can be shorter than T. The design cannot use that time, so it comes off the setup budget.
The last step of the window above shows such a short cycle as a capture edge 1.5 ns early. The hold check compares one edge at launch and capture, so period jitter does not enter it. Timing tools give hold its own uncertainty margin.
Asked in interviews
Does clock skew help or hurt?
Both. With the capture clock later than the launch clock, setup gets more time and hold gets less. With the capture clock earlier, setup loses and hold gains.
Why is gating a clock with an AND gate dangerous?
If the enable changes while the clock is high, the AND output makes an extra edge or a runt pulse. Clock gating uses a latch that is transparent while the clock is low, so the enable cannot change during the high phase.
What makes a design synchronous?
One clock for all state, state held only in edge-triggered flops, and no combinational loops. Then every path is checked by one setup and one hold check per clock period.
Gated clocks done right are lesson R2.3 of the RTL track.
Try It
Both counters start at 0 after the reset pulse. The first burst of en rises and falls while the clock is low: both count once.
The second burst rises at 47 ns, 2 ns after an edge, with the clock high. The gated clock rises at once: an extra count. From then on n_gated is one ahead.
Move the second rise of en to 52 ns, in the low half, and run again. The counters agree.
edge 1 en=0 n_gated=0 n_enabled=0 edge 2 en=0 n_gated=0 n_enabled=0 edge 3 en=1 n_gated=1 n_enabled=1 edge 4 en=0 n_gated=1 n_enabled=1 edge 5 en=1 n_gated=2 n_enabled=1 edge 6 en=1 n_gated=3 n_enabled=2 edge 7 en=0 n_gated=4 n_enabled=3 edge 8 en=0 n_gated=4 n_enabled=3Read included file: tb.sv
// tb.sv: en changes while the clock is low, then while it is high; one line per clock period (read-only).
`timescale 1ns/1ns
module tb;
logic clk = 0, rst = 0, en = 0;
logic [3:0] n_gated, n_enabled;
int edge_n = 0;
two_counters dut (.clk(clk), .rst(rst), .en(en), .n_gated(n_gated), .n_enabled(n_enabled));
always #5 clk = ~clk; // rising edges at 5, 15, 25, ... ns
always @(posedge clk) edge_n++;
initial begin
#1 rst = 1;
#1 rst = 0;
#20 en = 1; // t=22: clock low
#10 en = 0; // t=32: clock low
#15 en = 1; // t=47: clock high
#20 en = 0; // t=67: clock high
#20 $finish;
end
always @(negedge clk) $display("edge %0d en=%b n_gated=%0d n_enabled=%0d", edge_n, en, n_gated, n_enabled);
endmodule
Check Yourself
Common Mistakes
Wrong Save power by ANDing an enable into the clock.
If the enable rises while the clock is high, the AND gate makes an extra edge. The lab's gated counter reached 4 where the correct count was 3.
Fix Use the enable as an enable. For real clock gating, use an integrated clock-gating cell with a latch.
Wrong Clock a block from a divided or decoded signal of another block.
The derived clock arrives late and is a new clock domain. One clock period no longer checks the paths between the two.
Fix Keep one clock and use a one-cycle enable every N cycles.
Wrong Assume skew always hurts.
A late capture clock gives setup more time. It is hold that it hurts.
Fix Skew = capture arrival − launch arrival: add it to setup slack and subtract it from hold slack.
Wrong Leave jitter out of the setup budget.
An edge that arrives early by the jitter shortens the cycle by that much.
Fix Subtract the jitter from the period before checking setup.
Remember
- Synchronous design: one clock, state only in edge-triggered flops, every loop through a register.
- A gated clock makes an extra edge when its enable changes during the high phase; use an enable instead.
- A late capture clock helps setup and hurts hold by the same amount.
- Cycle-to-cycle jitter can only shrink the usable period; take it off the setup budget, not the hold one.