Sending bits fast.
Anyone who opened a computer before about 2005 remembers the ribbon cables. They were flat gray bands two inches wide, forty or eighty wires side by side, folded and stuffed between the drives. A hard drive of the time sent its data sixteen bits abreast down one of those ribbons, and the best of them managed 133 million bytes a second.
Then the ribbons vanished. In their place came a thin red cable with seven wires in it, of which just two carried the data in each direction, one bit at a time. It looked like a move in the wrong direction, and yet it was faster the day it arrived, and before long it was more than four times as fast as the ribbon had ever been.
The same thing happened all over the computer in those years. In the expansion slots, the printer cable and the connection to the screen, one after another, wide bundles of wires gave way to a pair or two. This chapter is about why sending one bit at a time turned out to be the fast way, and about the picture that engineers use to tell whether those bits are arriving safely.
Why more wires stopped helping
The old way is the obvious way. To send a number, give each of its bits a wire, set all the wires at once, and tick a clock to say "read now." The front-side bus of chapter 24 worked like that, and so did PCI, the expansion slot that Intel introduced in 1992. PCI had 32 wires for data, shared by every card in the machine, and one clock that ticked 33 million times a second.
The weakness is that the bits have to arrive together. Think of eight runners who are required to cross the finish line at the same instant. Around a school track that is easy to arrange. Now shorten the race until the whole thing lasts one second, and the tiny differences between the runners become the entire story.
Wires differ in the same way. No two traces on a board are exactly the same length, and chapter 24 put a number on what that means: a signal covers about six inches of copper in a billionth of a second. An extra three inches on one wire makes its bit half a billionth of a second late. Engineers call these differences skew. The receiver cannot read the number until the latest wire has settled, and it has to finish before the earliest wire moves on. Speed up the clock in the drawing below and watch what is left.
At the speed of the old PCI slot the differences are invisible. A little past a billion ticks a second there is no time left at all in which the eight wires agree. Designers fought this for years with traces that wander back and forth across the board to make up their length, and you can still see those wiggles beside the memory slots of any motherboard. But the fight was against arithmetic, and wires that run side by side also disturb each other more and more as the edges get sharper.
The way out was to stop asking wires to agree. Send the bits one after another down a single path, and each bit has only itself to keep time with. The separate clock wire can go as well, because the receiver takes its timing from the changes in the data itself, the way the receiver of chapter 3 took its timing from the pattern at the head of a message. To make sure there are always enough changes to follow, the first serial links sent every eight bits as a code word ten bits long, chosen from a table worked out at IBM in 1983 so that no word has a long run of ones or of zeros.
When one path is too slow, the answer is several paths, each timed entirely by itself, with the pieces put back in order after they arrive. The standard that replaced PCI in 2003 calls each path a lane. It is named PCI Express, and one lane of the very first version carried 250 million bytes a second in each direction, nearly twice what the whole PCI bus had carried, on four wires.
Two wires that disagree
A lane has four wires because each direction uses two. The two carry the same bit as opposites: when one wire goes up, the other goes down by the same amount. The receiver ignores what either wire is doing by itself and looks only at the difference between them.
Picture a seesaw. The message is in the tilt, which end is up. Now put the seesaw on a boat in rough water. The whole thing heaves up and down by far more than the height of the tilt, and anyone trying to read the height of one end would be hopelessly lost. The tilt is exactly what it was. Noise on a pair of wires is the rough water. The two wires run a hair's width apart, so whatever disturbs one of them disturbs the other in the same way, and it disappears when one is subtracted from the other.
The idea is far older than computers. Alexander Graham Bell patented the twisted pair for telephone lines in 1881. A telephone wire strung beside a power line picks up its hum, and two wires twisted together pick up the same hum, which the telephone at the far end never hears. The microphone cables on every concert stage work the same way. In the drawing below, both wires pick up a large and ugly interference together. Compare what a receiver makes of one wire by itself with what it makes of the difference.
A pair has two more virtues, and the next chapter leans on both. The first is that the receiver judges a difference, so the swing on each wire can be small, a few tenths of a volt, and a small swing is quick to make. The second is that the two wires carry equal and opposite currents, so the radio waves they would each give off very nearly cancel. A pair is a quiet neighbor as well as a good listener.
The eye
Chapter 26 ended with two tests that a bit has to pass. It must be on the right side of the threshold with room to spare, and it must be holding still at the moment it is read. On a link carrying billions of bits a second, how would anyone check?
Looking at the signal directly is hopeless. A recording of one second of it, drawn large enough to see each bit, would be a wiggling line long enough to wrap around the earth. So engineers borrow a trick that photographers know as a multiple exposure. Cut the recording into pieces exactly one bit long, and lay every piece on top of all the others, as though the shutter had opened once for each bit onto the same sheet of film.
The ones pile up along the top and the zeros along the bottom. The changes from one to the other cross each other at the sides. In the middle, if the link is healthy, is a space where no trace ever goes. The picture looks like an open eye, and engineers call it an eye diagram.
Do it once by hand and the picture loses its mystery. The strip below is a recording of a signal, and the slider lays its bits down one at a time, each on top of the ones before. An eye diagram is exactly this: one signal, drawn over itself again and again.
An oscilloscope adds one more thing to the picture. For every spot on its screen it keeps count of how many traces have passed through, and it colors the spot by the count. Picture the lawn between two buildings. Where everybody walks, the grass is worn down to bare earth. Where one person cut the corner last week, a few blades are bent. The screen records wear in the same way. It glows in warm colors where nearly every bit passes, and stays cool and faint along a path that one bit in a thousand took.
Those faint paths are the ones an engineer looks at hardest. On a link that carries billions of bits a second, something that happens to one bit in a million happens thousands of times every second.
The eye shows both of the tests at a glance. Its height is the room around the threshold, and its width is the stretch of time in which the bit holds still. Anything that harms a link closes the eye, and each kind of harm closes it in a way of its own, so the shape of a damaged eye tells you what is wrong. Each button below sets up one kind of harm. Press them one at a time and watch what each does to the picture. The sliders mix them in any amounts you like.
| measured on these 1,200 bits | |
|---|---|
| eye height | |
| eye width | |
| edges, typical spread | |
| edges, first to last | |
| crossing level | |
| bits misread | |
| hits on the diamond | |
| worked out for a trillion bits | |
| eye width | |
| bits misread, at best | |
| Heights are a share of the full swing from zero to one. Widths and spreads are a share of one bit. | |
There are three pictures here, and they are three views of the same twelve hundred bits. The strip is a short stretch of the signal as it arrives, with a dot wherever the receiver reads a bit. The large picture is the eye, every one of those bits laid over the rest. The curve under the eye is explained a little further on.
Two piles of marks are drawn along the edges of the eye. The pile underneath counts when the edges arrive. Each time the signal crosses the threshold, one mark is added below that moment, so the marks heap up under the two crossings. The pile at the side counts the levels that arrive at the moment of reading, ones above and zeros below. A healthy link has narrow piles in both places. As the piles under the eye spread, they use up its width, and as the piles at the side spread, they use up its height.
The diamond in the middle is a forbidden shape of the kind that every standard for a fast link defines. It marks out the smallest opening that the receiver is sure to read correctly, and a link passes its test when no trace touches it.
What each kind of harm looks like
Three of the buttons move the edges in time. Engineers call any movement of that kind jitter, and they sort it by its cause, because each cause leaves a different mark and calls for a different cure.
| button | what you see in the eye | what is causing it |
|---|---|---|
| long wire | Each rail splits into bands, and the bands spread toward the middle until the eye closes from above and below and from both sides at once. | The wire blunts every edge, so a bit arrives on top of what is left of the bits before it. Each band belongs to one recent history: a one after three ones, a one after a zero, and so on. |
| edges scatter | The crossings swell into soft clouds. The pile under each one is shaped like a bell. | Every clock is a little unsteady, and each edge lands early or late by chance, like a commuter train that is a minute early one morning and two minutes late the next. This is random jitter. |
| edges sway | Each crossing spreads into a wide band. The pile under it has a peak at each end and a dip between. | Something with a rhythm of its own, very often a power supply switching on and off, is nudging the clock back and forth. A child on a swing spends most of the ride near the two ends, where the swing slows and turns, and the edges do the same. This is periodic jitter. |
| edges lean | The crossings slide down from the middle of the picture, and the pile under each one splits into two heaps, one for rising edges and one for falling. | The sender takes longer to raise the wire than to lower it. Every rising edge is late and every falling edge is early, so each one is cut short at both ends. Engineers call this duty-cycle distortion. |
| neighbor | Each rail splits into three near the moment of reading. The pile at the side shows three levels where one should be. | The wire alongside is carrying bits of its own, and each of its edges gives this wire a small push, up for a rising edge and down for a falling one. This is crosstalk, the word telephone engineers used when one call could be heard faintly on another line. |
| noise | Both rails grow evenly thicker along their whole length, and the crossings grow fuzzy. | Hiss of the kind chapter 11 measured, from the receiver itself and from everything switching nearby, is added to every level. |
These six fall into two families, and the difference between them matters a great deal. A long wire, a swaying clock, a leaning sender and a leaking neighbor each do a fixed amount of damage. Their bands and spread crossings reach only so far, however long you watch. Noise and scattered edges come from chance, and chance has no fixed reach. Watch for longer, and sooner or later one bit strays farther than any bit before it.
The long wire, and the cure for it
The length of the wire does the most interesting damage. Copper passes slow changes easily and fast ones poorly, so a long trace is a filter of the kind chapter 1 began with, one that blunts every edge. Once the edges take longer than a bit lasts, the signal stops reaching its full height before it has to turn around. A one that follows a long run of zeros climbs only part of the way, and what is left of each bit smears into the next.
You have heard this happen. Speak slowly in a tiled stairwell and every word is clear. Speak quickly and the echo of each word lands on top of the next, until none of them can be made out. The room has a limit on how fast it can be spoken in, and so does a wire.
Press the long wire button, and then push the wire slider further to the right. The bands merge into one broad smear, and red dots appear on the strip. Each red dot is a bit the receiver has read wrongly, and nearly every one is a lone bit that follows a run of the other kind: the wire was still on its way up, or down, when the bit was over.
Now press the button marked long wire, corrected. The wire is as long as it was, and the sender has begun to lean on each change. It sends a bit at full strength when the bit differs from the one before, and holds back when the bit repeats. That is the opposite of what the wire does to the signal, and the two cancel, like turning up the treble on a muffled recording. The bands draw back together and the eye reopens. It is smaller than the eye of a short wire, because the sender has given up some of its swing, and it is clean and clear of the diamond. Engineers call the trick emphasis. Every fast link uses it, and the two ends spend the first moments after power-up trying one setting after another and measuring the eye, like two people on a bad telephone line working out how loudly to talk.
A trace has one more way of blurring bits, and chapter 14 has already described it. A trace on a circuit board is a cable in miniature. Its impedance is fixed by its width and by its height above the sheet of copper beneath it, and wherever that impedance changes, at a connector, a sharp corner or the pin of a chip, part of each edge bounces back. An echo that bounces twice arrives behind the bit that made it and lands on a later one, as a ghost once landed on a television picture. So the traces of a fast link are drawn to hold one impedance from end to end, about 100 ohms for most pairs, and the receiver finishes each pair with a small resistor of that same value, so that the wave walks in and nothing comes back. Engineers call that resistor a termination. They judge a trace by its return loss, which is the standing wave ratio of chapter 14 stated in decibels.
How open is open enough
An eye drawn from twelve hundred bits can look wide open and still belong to a link that fails. The links inside a computer are expected to misread about one bit in a trillion at most, and a fault that strikes one bit in a million would very likely miss all twelve hundred.
The curve under the eye settles the matter. It runs across one bit, from one crossing to the next, and for every moment at which the bit could be read it gives the chance that the reading comes out wrong. The scale runs downward, and each marked line is a thousand times rarer than the line above it. Near the crossings the chance is close to one in two, a coin toss. Toward the middle it falls away steeply. The curve has two steep sides and a deep floor, and engineers call it a bathtub curve.
The number that matters is how wide the tub is where it crosses the line at one in a trillion. That width is the true opening of the eye. It is always narrower than the opening in the picture, because the picture shows where twelve hundred bits happened to go and the curve shows where a trillion would.
Counting a trillion bits takes a minute or more even at these speeds, and a careful test needs several trillion. So an oscilloscope works the curve out. It measures how widely the noise and the scattered edges are spread, takes both to follow the bell-shaped curve that chance usually follows, and reckons how often a bit would stray far enough to be misread. The rule of thumb that comes out of the arithmetic is worth remembering: to be safe for a trillion bits, allow for edges that stray seven times their typical spread to either side.
Press the noise button to see why the curve earns its place. The eye in the picture still has open space in the middle, and all twelve hundred bits are read correctly. The tub stops well short of the line all the same. This link would misread a bit several times every second, and the picture alone would never have told you.
The last button, everything, shows the trap that catches real designs. It turns each kind of harm up a little, by an amount that would pass easily if it were the only one. Together they use up the whole margin. This is why the designer of a fast link keeps a budget, with a share of the eye set aside for each kind of harm, and why the two families are added up in different ways: the fixed kinds by their full reach, and the chance kinds by seven times their typical spread.
import numpy as np
from math import erfc, hypot, sqrt
def fold(recording, samples_per_bit):
"""Cut a recording into pieces two bits long, one piece for every bit.
Plot all the rows on top of one another and you have the eye."""
count = len(recording) // samples_per_bit - 2
return np.stack([recording[k * samples_per_bit:(k + 2) * samples_per_bit]
for k in range(count)])
def opening(recording, bits, samples_per_bit, moment):
"""Height of the eye at one moment within the bit: the lowest one
minus the highest zero. Zero or less means the eye is shut."""
read = recording[moment::samples_per_bit][:len(bits)]
bits = np.asarray(bits[:len(read)])
return read[bits == 1].min() - read[bits == 0].max()
def chance_of_a_wrong_bit(margin, slope, noise, jitter):
"""One point on the bathtub curve, for one bit. `margin` is how far the
bit's level sits from the threshold at the moment of reading, and `slope`
is how fast the level is changing there. `noise` and `jitter` are the
typical sizes of each. Average this over every bit for the curve."""
spread = hypot(noise, slope * jitter)
return 0.5 * erfc(margin / spread / sqrt(2))The tools on the bench
Each of the instruments used on a fast link answers one plain question.
| the instrument | the question it answers |
|---|---|
| oscilloscope | What does the voltage do over time? It draws the signal, and it draws the eye. To show an edge faithfully it has to be several times faster than the signal it is looking at. |
| error-rate tester | How often is a bit read wrongly? It sends a known pattern for minutes or hours and counts the mistakes at the far end. |
| reflectometer | Where along the wire is the trouble? It sends one sharp edge down the trace and listens for echoes, as a ship's sonar does. An echo returns from every connector and every change in the trace, and its delay gives the distance. Chapter 14 played the same trick on an antenna cable. |
| network analyzer | How much does the wire lose at each frequency? It sweeps a tone from low to high and measures what comes out, which draws the filter that the wire really is. |
| spectrum analyzer | What is the link radiating, and at what frequencies? It draws strength against frequency, as the fixed-slice chart of chapter 9 did for sound, and it is the main instrument of the next chapter. |
The standard to be met is severe. PCI Express allowed a link, for most of its history, no more than one wrong bit in a trillion. At eight billion bits a second that is still a mistake every two minutes on every lane. So each packet of data carries a checksum, which is a few extra bits worked out from the rest that give away any damage, and a damaged packet is quietly sent again.
Twenty years of lanes
Each generation of PCI Express has doubled the speed of a lane, and each doubling has been an exercise in keeping the eye open.
| version | year | one lane, each second | what changed |
|---|---|---|---|
| PCI | 1992 | 133 million bytes, shared | 32 wires side by side, one clock, every card taking turns |
| Express 1 | 2003 | 2.5 billion bits | one bit at a time on a pair of wires; ten bits sent for every eight |
| Express 2 | 2007 | 5 billion | the sender leans harder on each change |
| Express 3 | 2010 | 8 billion | a leaner code, 130 bits sent for every 128; both ends tune themselves at power-up |
| Express 4 | 2017 | 16 billion | better board materials and connectors |
| Express 5 | 2019 | 32 billion | a bit now lasts 31 trillionths of a second |
| Express 6 | 2022 | 64 billion | four voltage levels in place of two, so each symbol carries two bits |
| Express 7 | 2025 | 128 billion | the same four levels, twice as fast |
Put the row for Express 5 beside Grace Hopper's wire. At 32 billion bits a second a bit lasts 31 trillionths of a second, and in that time a signal moves less than a fifth of an inch along the trace. The bits are strung along the copper like beads, and a trace as long as your hand holds thirty of them in flight at once.
The row after it marks a turn in the road. By 2022 there was little left to gain from making a bit shorter, so each change on the wire was made to carry two bits, by giving it four levels to choose from where there had been two. That splits one eye into three small ones stacked on top of each other, and the next chapter looks at what it costs.
Try it: find the pairs
- Cut open a scrap of network cable. Inside are four pairs of wires, each pair twisted together, and if you look closely each pair is twisted at a different rate, so that no two pairs lie alongside each other for long.
- On a motherboard, follow the traces from the long graphics slot toward the processor. They run in pairs, side by side, and they keep their distance from the other pairs.
- Look beside the memory slots for traces that wiggle back and forth. Those are the wires of a parallel bus, padded out so that they all end up the same length.
- Find a tiled stairwell or an empty gym. Read a sentence aloud slowly, and then as fast as you can, and listen for the moment the words begin to land on top of each other.