Volume 00 Beginner 5 sub-modules ~25 min read

Start Here: Clocks, Delay and Units

Timing analysis asks one question: does the data arrive before the next clock tick? To ask it properly you need four things - a clock, a flip-flop, the idea that nothing is instant, and a timing diagram to draw it on. This volume teaches exactly those, and the units they are measured in. Nothing earlier is assumed.

You will learn
  • What a clock is, and what a flip-flop does at each clock edge
  • Why every gate and every wire takes time, and what changes that time
  • How to read a timing diagram, edge by edge
  • How ns, ps, MHz and GHz convert into each other, without a mistake
  • How this course works, and what you need for it
You need
  • Nothing - this is the very start of the course
  • A calculator for the last sub-module

0.1 How to use this course

Static timing analysis asks one question about a chip, over and over: does the data arrive before the next clock tick? Everything else in this course is arithmetic on that question.

A chip is full of small memories called flip-flops. On every clock tick they all grab whatever is on their inputs. Between the ticks, logic works on those values and passes the results along.

If a result is late, the next flip-flop grabs the old value, or worse, a half-finished one. The chip does not warn you. It just gives wrong answers, sometimes, on some units, in some weather.

Timing analysis finds that before the chip is built. It adds up the delay on every path, compares each total with the time the clock allows, and lists anything that does not fit.

In plain words

The name sounds harder than the job. "Static" only means the tool does not run your design. It looks at every path once and adds up numbers, so nothing can hide in a test you forgot to write.

What this course does, and in what order

Part Volumes What you get
What timing analysis is 00 to 03 Clocks, delay, paths, and why chips have a speed limit
The two checks 04 and 05 Setup and hold, worked by hand, number by number
The clock in detail 06 and 07 Latency, skew, jitter, and every clocking case there is
Telling the tool the truth 08 to 10 Exceptions, latches, and the world outside the chip
Variation and noise 11 and 12 Corners, on-chip variation, crosstalk
Constraints and closure 13 to 15 The full SDC language, fixing violations, revision

Take the volumes in order. Each one only uses what came before it.

How each lesson is built

  1. The big idea in one sentence, so you know where the lesson is going.
  2. Plain words, then an everyday picture, then the exact version.
  3. Worked numbers. Every value is computed, never guessed.
  4. A common mistake, because knowing the trap is half of knowing the rule.
  5. A quick check at the end of each sub-module.
Every number here was computed first

Beside these lessons sits a small timing model. It works out each arrival time, required time and slack, and a test script compares its answers with what the pages say. So when a lesson claims the slack is 0.42 ns, that number came out of the model, not out of the air.

Remember

You need no electronics and no programming for this course. You do need a calculator, and the patience to do the same addition many times. That repetition is the skill.

Quick check

What makes static timing analysis "static"?

Show the answer

Answer: B. Static means no simulation and no test patterns. The tool walks every path, adds the delays along it, and compares the total with the time the clock allows. A path cannot escape the check by not being exercised.

0.2 Clocks and flip-flops in plain words

A clock is a signal that ticks at a steady rate. A flip-flop is a one-bit memory that copies its input to its output on each tick, and holds it until the next one.

Everything in a synchronous chip moves on those ticks. Nothing happens "eventually": it happens at an edge, or it does not count.

Think of it like this

Think of a relay race where the runners may only pass the baton when a bell rings. The bell is the clock. A runner who arrives a moment late still has to wait, and if the bell rings while the baton is in mid-air, it is dropped.

The clock

The clock goes up and down for ever. One full up-and-down is a clock cycle, and the time it takes is the period.

A clock waveform with the period marked between two rising edges one period = 10 ns 0 1 2 3 4 5 clk
Figure 0.1 - A clock. The moment it goes from 0 to 1 is a rising edge, and most flip-flops act only there. The time from one rising edge to the next is the period - here 10 ns.

The numbers above the figure count the rising edges. Timing analysis spends its whole life between two of them.

The flip-flop

A flip-flop has a data input D, a clock input, and an output Q. At each rising clock edge it looks at D and copies that value to Q. Between edges, D can do whatever it likes and Q does not care.

A flip-flop copying D to Q at each rising clock edge, ignoring a pulse between edges 0 1 2 3 4 5 6 clk d q
Figure 0.2 - Q only changes just after a rising edge. In cycle 3 a short pulse on D comes and goes between edges, so Q never sees it. At the start nobody knows what Q holds, so it is drawn hatched.

Read it edge by edge:

  1. Edge 1. D has been 0 all cycle, so Q becomes 0.
  2. Edge 2. D went high during the last cycle, so Q becomes 1.
  3. Edge 4. D pulsed high and fell back before the edge, so Q becomes 0. The pulse is lost.
  4. Edge 6. D rose very late in the last cycle, and Q still takes the 1.

That last one hides a question: how late is too late? The answer is the setup time, and it is the whole of Volume 04.

The three numbers every flip-flop has

Number What it means Who it constrains
Clock-to-Q How long after the edge Q shows the new value The path leaving this flop
Setup time How long D must be steady before the edge The path arriving at this flop
Hold time How long D must stay steady after the edge The same path, at its fastest

Volume 02 explains where those three numbers come from. For now, just hold on to the shape of them: one describes leaving, two describe arriving.

Common mistake

Thinking Q changes at the same instant as the clock edge. It does not. The edge starts a small chain of transistors moving, and Q appears a little later. That gap is the clock-to-Q delay, and every path in the chip starts with it.

Quick check

D goes high in the middle of a cycle and stays high. When does Q change?

Show the answer

Answer: C. A rising-edge flip-flop copies D only at a rising edge, and Q appears a short clock-to-Q delay after it. D changing mid-cycle is fine, as long as it is steady before the edge arrives.

0.3 Delay: nothing is instant

Nothing in a chip is instant. Every gate takes time, every wire takes time, and the chip's speed limit is the sum of those times along its slowest path.

A logic gate does not switch the moment its input changes. Its transistors have to charge the wire and the gates hanging off it. That takes a few tens of picoseconds.

One gate is quick. A chain of them is not.

A chain of five things

Element Its delay Total so far
Inverter 0.06 ns 0.06 ns
NAND2 0.09 ns 0.15 ns
NAND2 0.09 ns 0.24 ns
Wire to the next flop 0.04 ns 0.28 ns
XOR2 0.13 ns 0.41 ns

Notice the wire. It is not a gate, and it still costs 0.04 ns. On a big chip, wires often cost more than the gates they join. Volume 02 explains why.

The same delay, drawn as a path

A timing path always has the same shape: a flip-flop launches the data, some logic works on it, and another flip-flop captures it.

A timing path: a launch flip-flop, three stages of logic, and a capture flip-flop, with the delay of each FF1 D Q t_cq 0.35 AND2 0.14 ns 16-bit adder 3.42 ns MUX 0.64 ns setup 0.15 FF2 D Q clk period 10.00 ns data takes 4.55 ns to get across
Figure 0.3 - The path this course will study for fifteen volumes. The clock reaches both flip-flops from the same source. Data leaves FF1 0.35 ns after the edge, spends 4.20 ns in the logic, and has to be at FF2 in good time for the next edge.

Add it up: 0.35 ns to leave FF1, then 0.14 + 3.42 + 0.64 = 4.20 ns of logic. The data is ready 4.55 ns after the clock edge that launched it.

In plain words

That is the entire method. Find where the data starts, add every delay along the way, and see when it arrives. The rest of this course is about being precise with the two ends of that sum.

Delay is not one number

The same gate is slower on a hot chip and faster on a cold one. It is slower at a low supply voltage, and slower when it drives more gates. Two chips off the same wafer differ as well.

So a delay is really a range. The chain above measures 0.41 ns typically, and this at the two ends of the range:

The chip is The chain takes
Cold, on a high supply, and lucky in manufacturing 0.27 ns
Typical 0.41 ns
Hot, on a low supply, and unlucky in manufacturing 0.66 ns

Both ends matter, and for different reasons. Volume 04 uses the slow numbers, Volume 05 uses the fast ones, and Volume 11 explains where the range comes from.

Common mistake

Treating delay as a single fixed value. A chip that only works when it is cold has failed. Timing analysis always asks both questions: is it fast enough when everything is slow, and is it still correct when everything is fast?

Quick check

A path has four gates of 0.09 ns each and two wires of 0.05 ns each. How long does the data take?

Show the answer

Answer: B. Four gates give 4 x 0.09 = 0.36 ns, and two wires give 2 x 0.05 = 0.10 ns. Together that is 0.46 ns. The clock period does not change how long the data takes - it only decides whether that is fast enough.

0.4 Reading a timing diagram

A timing diagram is a picture of signals against time. Time runs left to right, each signal has its own row, and everything interesting happens at an edge.

You have already read two of them. This sub-module makes the habit explicit, because every later volume shows its argument as a waveform.

How to read one, every time

  1. Find the clock row first. It sets the beat for everything below it.
  2. Number the rising edges. The lessons print those numbers above the figure.
  3. Pick the edge that launches your data. Everything is measured from there.
  4. Follow the row below it. A signal that changes does so just after an edge, not on it.
  5. Find the edge that captures it. The gap between the two edges is the time you have.
A timing diagram showing data launched at one clock edge and captured at the next 0 1 2 3 4 clk q1 d2 OLD NEW q2 launch edge capture edge
Figure 0.4 - The two edges that matter. FF1 launches the new value just after edge 1, and it reaches FF2 as the value marked NEW. FF2 captures it at edge 2. The gap between those two edges is all the time the logic gets.

Reading it in order: at edge 1, FF1 copies its input and its output q1 rises. That new value travels through the logic, and appears at FF2's input d2 partway through the cycle. At edge 2, FF2 copies it, so q2 rises one cycle later.

Remember

Signals in these diagrams change just after an edge, never exactly on it. That small step is the clock-to-Q delay drawn honestly. When you see a value change a hair after the line, that is the picture telling you the truth.

What the diagram cannot show

A waveform is not to scale. A 0.35 ns clock-to-Q delay and a 4.20 ns adder would be invisible next to a 10 ns cycle, so figures exaggerate them. When a number matters, this course writes it down as well as drawing it.

Common mistake

Measuring time on a timing diagram with a ruler. The shapes show the order of events, not their size. Trust the numbers in the text, and use the picture for the story.

Quick check

In the figure above, how much time does the logic between FF1 and FF2 get?

Show the answer

Answer: A. The data is launched at edge 1 and captured at edge 2, one period later. The launch flop uses a little of that period to produce its output, and the capture flop needs the data slightly early, so the logic gets what is left.

0.5 Units: ns, ps, MHz and GHz

Frequency and period are the same fact said two ways. Divide 1000 by a frequency in MHz and you get the period in nanoseconds.

Timing is measured in small units, and mixing them up is the easiest way to get a wrong answer. Here they are, once, clearly.

Unit How long Where you meet it
Microsecond (us) One millionth of a second Slow chips, software timers
Nanosecond (ns) One thousandth of a microsecond Clock periods, path delays
Picosecond (ps) One thousandth of a nanosecond Gate delays, setup times, skew

So 1 ns = 1000 ps, and 0.25 ns = 250 ps. This course writes path delays in ns and small numbers in either, because engineers do: "the adder is 3.42 ns" and "setup is 150 ps" are both normal.

Frequency to period

Period and frequency period in ns = 1000 / (frequency in MHz)
Clock Period Period in ps
1 MHz 1000.000 ns 1000000 ps
50 MHz 20.000 ns 20000 ps
100 MHz 10.000 ns 10000 ps
125 MHz 8.000 ns 8000 ps
200 MHz 5.000 ns 5000 ps
500 MHz 2.000 ns 2000 ps
1 GHz 1.000 ns 1000 ps
2.5 GHz 0.400 ns 400 ps
3.6 GHz 0.278 ns 278 ps

A GHz is a thousand MHz, so 2.5 GHz is 2500 MHz and 1000 / 2500 = 0.4 ns. The same sum works backwards: a 4 ns period is 1000 / 4 = 250 MHz.

Getting a feel for it

  1. 500 ps + 1.2 ns = 1.7 ns. Convert first, then add.
  2. Six gates of 80 ps each = 0.48 ns.
  3. One 100 MHz cycle is 10 ns, so about 125 of those gates fit end to end in it.
  4. Light travels about 30 cm in one nanosecond, and about 0.30 mm in one picosecond.

That last line is worth keeping. When a lesson says a wire costs 40 ps, it is talking about a distance a beam of light would cross in about a centimetre. Electricity in a chip wire is slower still.

Common mistake

Multiplying when you should divide. A common slip is to read "200 MHz" and write 200 ns. Say it out loud instead: 200 million cycles every second must mean a very short cycle. So the period is 1000 / 200 = 5 ns, and a bigger frequency always gives a smaller period.

Quick check

A design runs at 400 MHz. What is its clock period?

Show the answer

Answer: C. Period in ns = 1000 / frequency in MHz = 1000 / 400 = 2.5 ns. That is 2500 ps. The trap answers come from dividing by the wrong number or slipping a decimal place.

What you learned

Key words from this volume

Every word below has a plain-English entry in the glossary.

Practice

Practice 1

Period and frequency, both ways

A design has a clock period of 8 ns. What frequency is that? And if you wanted to run the same design at 250 MHz, how long would each cycle be?

Show the solution

Frequency in MHz = 1000 / period in ns = 1000 / 8 = 125 MHz.

At 250 MHz the period is 1000 / 250 = 4 ns. That is half as long, so every path in the design would have half the time it had before.

Practice 2

Add up a path

A flip-flop has a clock-to-Q delay of 0.28 ns. Its output goes through three gates of 0.11 ns each and two wires of 0.06 ns each, then into another flip-flop. How long after the clock edge is the data ready at the second flip-flop?

Show the solution

Add the pieces in the order the data meets them:

  1. Clock-to-Q: 0.28 ns
  2. Three gates: 3 x 0.11 = 0.33 ns
  3. Two wires: 2 x 0.06 = 0.12 ns

Total: 0.28 + 0.33 + 0.12 = 0.73 ns after the launching edge.

Nothing here mentions the clock period, and that is the point. How long the data takes and how long it is allowed to take are two separate questions. Volume 04 puts them together.

Practice 3

Does it fit?

The path in the figure above takes 4.55 ns to arrive, and the capture flip-flop needs its data 0.15 ns before the edge. The clock period is 10 ns. How much time is left over? What if the clock ran at 200 MHz instead?

Show the solution

At 100 MHz the edge comes 10 ns after the launch. The flip-flop needs the data by 10 - 0.15 = 9.85 ns. It arrives at 4.55 ns, so there is 9.85 - 4.55 = 5.30 ns to spare.

At 200 MHz the period is 5 ns, so the data is needed by 5 - 0.15 = 4.85 ns. It still arrives at 4.55 ns, leaving only 0.30 ns to spare. The path did not change; the time allowed did.

That spare time has a name - slack - and Volume 01 starts using it properly.

Practice 4

Read the waveform

Look again at the flip-flop figure in sub-module 0.2. D pulses high in cycle 3 and falls back before the next edge. Why does Q never go high because of it? And what would have to change for the pulse to be captured?

Show the solution

A flip-flop only looks at D at the rising edge. The pulse came and went between two edges, so at the edge D was already back at 0, and that 0 is what Q copied.

To capture it, the pulse would have to still be high at a rising edge - and steady for the flip-flop's setup time before it. A short pulse that lands between edges is invisible to a synchronous design. That is why glitches on a data line are usually harmless, and glitches on a clock line are a disaster.

Interview corner

Interview question 1

Why not just simulate?

"If you can simulate the design, why do you need static timing analysis at all?"

Show the solution

"Because simulation only checks what the test exercises, and timing bugs hide on paths no test happens to hit. Static timing analysis checks every path in the design, once, with no patterns at all. It is also far quicker: a full chip takes minutes, where a gate-level simulation of the same thing would take days and still miss paths.

The two answer different questions. Simulation asks whether the logic is right. Timing analysis asks whether the logic is fast enough. You need both."

Interview question 2

What are the three numbers of a flip-flop?

"Name the timing numbers a flip-flop brings to a path, and say which end of the path each one affects."

Show the solution

"Clock-to-Q, setup time and hold time.

Clock-to-Q is how long after the clock edge the output appears, so it is the start of the path leaving that flop. Setup and hold belong to the flop at the far end. Setup is how long the data must be steady before the capturing edge, and hold is how long it must stay steady after it.

So one path is bounded by clock-to-Q at the launch end and by setup or hold at the capture end."

Volume 01 turns this into a race: the data running down the path against the clock running down its own, with two ways to lose.