Circuit Bytes · Episode 54 · Electronics · Clock signals
"Clock signals"
A clock is a signal that flips low, high, low, high at a steady beat. Flip-flops grab new values only on the rising edge, which gives the gates between them time to settle so every answer is stored at once. One low-high round is a cycle, so 3 GHz means 3 billion cycles every second, and most clocks start from a quartz crystal.
The beat a chip marches to
A flip-flop (last episode's one-bit memory) only updates when a clock tells it to. The clock is a signal that switches between a low voltage and a high voltage, over and over, at an even pace. Drawn on a graph it looks like a row of square steps, so it is called a square wave. One wire carries it to every flip-flop on the chip.
The rising edge
Most flip-flops look at their input at one exact instant: the rising edge, the moment the clock jumps from low to high. At that instant the flip-flop copies its input into storage. Between rising edges the input can change as much as it likes and the stored bit stays put. (Some flip-flops use the falling edge, high to low, instead; the idea is the same.)
Why wait for the beat?
Gates are fast, but not instant. When the inputs of a chain of gates change (say, a row of adders), the signals ripple through at slightly different speeds, and for a moment some outputs flicker with wrong values. This settling time is called propagation delay.
The clock solves that. The flip-flops feeding the gates update on one rising edge; the gates then have a whole beat to settle; on the next rising edge a second row of flip-flops captures every answer at the same instant. Like a drummer keeping a band in time, the clock makes every part of the chip move together. It also sets the speed limit: the beat has to be slower than the slowest path between two rows of flip-flops.
Cycles and hertz
One low part plus one high part of the wave is one cycle. Frequency counts cycles per second, measured in hertz (Hz):
- 1 Hz = 1 cycle per second
- 1 kHz = 1,000 cycles per second
- 1 MHz = 1,000,000 cycles per second
- 1 GHz = 1,000,000,000 cycles per second
So a 3 GHz processor's clock completes 3,000,000,000 cycles every second; each cycle lasts about a third of a nanosecond. A cycle is not the same as an instruction: modern cores can finish several instructions in one cycle, and some instructions take many cycles.
Where the beat comes from
Most clocks start from a small quartz crystal. Quartz flexes very slightly when a voltage is applied and vibrates at a very precise rate set by its size and cut, so a small circuit around it produces a steady wave. Crystals usually run in the megahertz range; inside a processor a circuit called a phase-locked loop multiplies that steady reference up to gigahertz. Some cheap circuits use a simpler resistor-capacitor or on-chip oscillator instead, which is why it is "most" clocks, not all.
Try it yourself
A microcontroller's clock runs at 16 MHz. How many cycles does it complete in one millisecond (a thousandth of a second)? Then flip it round: how long does one of its cycles last, in nanoseconds?
Good to know
- A clock signal is a square wave that alternates between low and high at a steady rate.
- Edge-triggered flip-flops change state only on a clock edge, usually the rising (low-to-high) edge.
- The clock period must be longer than the slowest gate path between flip-flops (propagation delay); that is what limits clock speed.
- Frequency in hertz = cycles per second; 3 GHz = 3,000,000,000 cycles per second, a period of about 0.33 ns.
- Quartz crystal oscillators give a precise reference, usually in MHz; a phase-locked loop multiplies it up.
- Modern processors also raise and lower their clock speed with load to save power.
Answer to the comment question
A clock runs at 4 Hz. How many cycles does it complete in 30 seconds? 120 cycles. 4 Hz means 4 cycles every second, so in 30 seconds it completes 4 × 30 = 120 cycles.
Test your knowledge
Quick quiz: "Clock signals"
4 multiple-choice questions. Pick one answer for each, then check how you did.
Sources
- All About Circuits textbook, Vol. IV Digital, chapter 10 "Multivibrators," "Edge-triggered Latches: Flip-Flops": the clock as a square-wave enable signal; positive-edge flip-flops respond to the low-to-high transition
- Nand2Tetris (Nisan and Schocken, The Elements of Computing Systems), "Project 3: Memory": a master clock steps every flip-flop in the computer in time
- Renesas, "PLL clock generators overview": a low-frequency crystal reference multiplied up to high-frequency clocks with a phase-locked loop
- Wikipedia, "Clock signal": square-wave clocks, rising-edge triggering, clock rate in hertz (cross-check only)
Video transcript
What's actually ticking inside a three gigahertz processor?
A flip-flop only updates when a clock tells it to. The clock is a signal that flips low, high, low, high, at a steady beat.
Flip-flops grab new values on the rising edge, the instant it jumps from low to high.
Why wait? Gates need a moment to settle. Each beat gives them time to finish, so every answer is stored at once, like a drummer keeping a band in time.
One low-high round is a cycle. Three gigahertz means three billion cycles every second.
Most clocks start from a tiny quartz crystal that vibrates at a precise rate.
A clock runs at four hertz. How many cycles does it complete in thirty seconds? Comment your answer below!
That's your byte.
More from Circuit Bytes
- EP52c"Adding numbers with gates"
- EP53c"Flip-flops: one bit of memory"
- EP55c"What a microcontroller is"
- EP56c"Electromagnetic induction"