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.

A Gated Clock Against an Enable, on the Same EnOne column per clock period, from the lab. en rises in the low half of period 3 and in the high half of period 5.
01234567clkenn_enabled0123n_gated01234extra edge
Scroll horizontally ↔
  1. Cycle 2

    en rose while the clock was low. Both counters count once at the next edge.

  2. 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.

  3. 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.

  1. One clock

    Every flip-flop gets the same clock, from the clock tree, not from logic.

  2. Edge-triggered storage

    All state is held in flip-flops that change only at the clock edge.

  3. No loops through logic

    Every loop passes through at least one flip-flop.

A Synchronous SystemArrows show data. Every loop passes a register; every register shares one clock.
  • Clock / reset
  • Storage
  • Datapath
  • Clock
  • Data
A synchronous systemArrows show data. Every loop passes a register; every register shares one clock. clock reset Clock tree one clock storage Register flip-flops datapath Logic settles within aperiod storage Register flip-flops clkfeedback through aregister
  1. storage Registerflip-flops
    • Logic
  2. datapath Logicsettles within a period
    • Register
  3. storage Registerflip-flops
    • feedback through a register → Logic
  4. clock reset Clock treeone clock
    • clk → Register
  1. Data

    Data moves from register to register through logic, once per clock period.

  2. 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 Loop With No Flip-Flop
A Loop With No Flip-Flopg1 · NANDn1=1g2 · NOTn2=0g3 · NOTy=1go=1
go=1
g1 · NANDgo=1, y=1 → n1=1
g2 · NOTn1=1 → n2=0
g3 · NOTn2=0 → y=1
Read the connections
GateKindInputsOutput
g1NANDgo, yn1
g2NOTn1n2
g3NOTn2y

Outputs: y. MUX inputs: d0, d1, select. Latch/flip-flop inputs: data, enable/clock. Unknown values are marked x; high impedance is folded into x in this model.

Gate delay 64. This circuit oscillates or has not settled within 64 gate delays.

Output values at each gate delay012345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364yxxx11110001110001110001110001110001110001110001110001110001110001
Scroll horizontally ↔
Every computed frame
Timey
0x
1x
2x
31
41
51
61
70
80
90
101
111
121
130
140
150
161
171
181
190
200
210
221
231
241
250
260
270
281
291
301
310
320
330
341
351
361
370
380
390
401
411
421
430
440
450
461
471
481
490
500
510
521
531
541
550
560
570
581
591
601
610
620
630
641

  1. Step 3 · Stopped. With `go` = 0 the NAND gate gives 1 whatever `y` is, so the loop rests at `y` = 1.
  2. Step 7 · Released. `go` rises at 4. Three inverting stages in a loop have no stable state: `y` falls at 7.
  3. Step 13 · Oscillating. `y` changes every 3 gate delays: a period of 6. The model stops after 64 gate delays.

A combinational loop: an odd number of inversions, no flip-flop. It is a ring oscillator, not logic.

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.

Skew and Jitter at the Capture Flop
Skew and Jitter at the Capture Flopsetupholdclkdoldnewqnew-6-4-20246ns
Scroll horizontally ↔

Captures the new value. The data is stable 1 ns before the setup time begins: setup slack 1 ns.

QuantityValue
Capture edge0 ns
Data must be stable from-2 ns (setup 2 ns before the earliest edge)
until1 ns (hold 1 ns after the latest edge)
Data changes at-3 ns
Setup slack (window start − data edge)1 ns

  1. No skew. Data arrives 3 ns before the edge: 1 ns of setup slack.
  2. Capture clock 1 ns late. The same data now has 2 ns of setup slack: late skew helps setup.
  3. Late clock, fast data. A short path changes the data 1.5 ns after the nominal edge. With the clock 1 ns late, that is inside the hold window.
  4. A short cycle. Back to no skew, data 3 ns early. Jitter makes this cycle 1.5 ns short, so the capture edge comes 1.5 ns early. The data now misses setup.

Setup 2 ns, hold 1 ns, as in G5.8. Skew moves the capture edge; a cycle shortened by jitter moves it early, for the setup check only.

CheckWith skew (capture late is positive)
SetupT + skew ≥ t_pcq + t_pd + t_setup
Holdt_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
  1. 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.

  2. 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.

  3. 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.

RUNIcarus Verilog · in your browser
Edit the code, then run it
Expected: 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=3
Read 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

ConceptThe capture clock of a path arrives 30 ps after the launch clock. What happens to the slacks?
ConceptWhich circuit breaks the synchronous rules?
ConceptA clock has 1 ns period and 40 ps of jitter. A path needs 980 ps for t_pcq + t_pd + t_setup. Does it meet setup with no skew?
Read the waveformgclk = clk AND en. In which cycle does gclk show an extra rising edge?
An AND-gated clock
0123456789clken
Scroll horizontally ↔

Each column is a quarter of a clock period. clk rises in columns 4 and 8; en rises in column 5.

Predict the outputIn the lab, the second rise of en moves to 52 ns, while the clock is low. Predict the last line.
// two_counters: both should count the clock edges at which en is 1.
module two_counters (
  input  logic       clk, rst, en,
  output logic [3:0] n_gated,    // clocked by clk AND en
  output logic [3:0] n_enabled   // clocked by clk, with en as an enable
);
  wire gclk = clk & en;
  always_ff @(posedge gclk or posedge rst)
    if (rst) n_gated <= 4'd0;
    else     n_gated <= n_gated + 4'd1;

  always_ff @(posedge clk or posedge rst)
    if (rst)     n_enabled <= 4'd0;
    else if (en) n_enabled <= n_enabled + 4'd1;
endmodule
// 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
    #20 en = 1;                                  // t=52: clock low
    #15 en = 0;                                  // t=67: clock high
    #20 $finish;
  end
  always @(negedge clk) if (edge_n == 8) $display("edge %0d  en=%b  n_gated=%0d n_enabled=%0d", edge_n, en, n_gated, n_enabled);
endmodule

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.

Practice

Report a problem with this page