---
title: Analog layout and matching
heading: Gradients, common-centroid placement, parasitics and coupling
eyebrow: S2 · Lesson 35 · Analog layout and matching
xp: 50
---

::: hook
Two transistors drawn identically on a chip are never quite identical. Random variation sets a floor described by Pelgrom's law, but on top of it sit systematic errors that layout either creates or cancels: gradients in oxide thickness, doping or stress across the die; etch effects at the edges of arrays; wire resistance in the current paths; and coupling from noisy digital lines next door. A schematic that simulates perfectly can fail on silicon because of how it was placed. This lesson puts numbers on those effects and on the standard countermeasures.
:::

::: play
- The curves show the threshold mismatch of a transistor pair against the distance between their centers: a random floor from Pelgrom's area term plus a systematic part from a linear gradient across the die, added in quadrature.
- Side by side, the gradient's contribution grows with separation; in a common-centroid arrangement it cancels to first order and only the random floor remains.
- Raise the gradient and the advantage of common-centroid layout grows.
:::

```sim plot
view: graph
x: d = 1..1000 µm log
y: s = 0.1..10 mV log
slider: g = 0.1..5 step 0.1 = 0.5 mV per 100 µm
slider: A = 1..100 = 10 µm² log
plot: sqrt((3/sqrt(A))^2 + (g/100*d)^2) | label: side by side
plot: 3/sqrt(A) + 0*d | dashed | label: common centroid
```

::: predict
## Two matched transistors sit 20 µm apart on a die whose threshold drifts 0.5 mV per 100 µm. What systematic mismatch does that add, and what does a common-centroid layout leave?

- [x] 0.1 mV side by side; nearly zero in common centroid
- [ ] 1 mV side by side; 0.5 mV in common centroid
- [ ] None either way: gradients don't affect matching
- [ ] 0.1 mV both ways

::: reveal
A linear gradient gives $0.5\text{ mV}/100\text{ µm} \times 20\text{ µm} = 0.1$ mV between the two centers. Split each device into halves arranged ABBA, or in a 2 × 2 cross-quad, and the two devices share a center: a linear gradient adds equally to both. Only curvature in the gradient remains.
:::
:::

::: nameit
## Systematic mismatch

A gradient G (per unit distance) in any parameter gives devices whose centers are d apart a difference of Gd. **Common-centroid** placement (ABBA, cross-quad) gives both devices the same center, cancelling linear gradients. **Interdigitation** (ABAB…) nearly does. Random mismatch adds in quadrature: Pelgrom's law with its distance term is
$$\sigma^2 = \frac{A^2}{WL} + S^2D^2$$

## Edge effects

Devices at the edge of an array see different etching, stress and implant shadowing. **Dummy** devices on the ends make every active device's neighbors alike.

## Wires are resistors

A wire of n squares of sheet resistance $R_\square$ drops $nR_\square I$. In a current path shared by a sensitive signal, that drop becomes an error: **Kelvin** (force and sense) connections and star grounds keep large currents out of the sense paths. Wires also have capacitance to each other: a digital line running beside a high-impedance node couples its edges in.

## Substrate and latch-up

Noisy circuits inject current into the shared substrate; **guard rings** collect it before it reaches sensitive devices, and well and substrate taps close by prevent the parasitic thyristor in CMOS from latching up.
:::

::: example
## A pair has $A_{VT}$ = 3 mV·µm and WL = 10 µm², placed 500 µm apart with a distance coefficient S = 1 µV/µm. What is the total mismatch spread?

::: solution
1. **Area term.**
   $$\frac{3}{\sqrt{10}} = 0.95\ \text{mV}$$
2. **Distance term.**
   $$1\ \text{µV/µm} \times 500\ \text{µm} = 0.5\ \text{mV}$$
3. **Total.**
   $$\sqrt{0.95^2 + 0.5^2} = 1.07\ \text{mV}$$
4. **Reducing each term.** Placing matched devices close together removes the second term; making them bigger shrinks only the first.

**Answer:** a total spread of 1.07 mV.
:::
:::

::: example
## A sense amplifier's ground return shares 20 squares of 0.04 Ω/□ metal with a 10 mA output current. What error does it add?

::: solution
1. **Drop on the shared return.**
   $$\begin{aligned} V &= 20 \times 0.04\ \Omega \times 10\ \text{mA} \\ &= 8\ \text{mV} \end{aligned}$$
   It appears in series with the sensed signal: enormous next to a 1 mV sense voltage.
2. **The fix.** A separate sense wire from the resistor's own terminals (a Kelvin connection) carries no current and drops nothing.

**Answer:** an 8 mV error.
:::
:::

::: example
## An 8:1 capacitor ratio is built from nine identical unit capacitors rather than one capacitor eight times the area of another. Why?

::: solution
1. **Two terms.** A capacitor's value has an area term and a perimeter (fringing) term.
2. **One big plate.** A single large plate has relatively less perimeter than a small one, so an 8× area gives less than 8× capacitance.
3. **Identical units.** Nine identical units have identical area-to-perimeter ratios, so eight of them are exactly eight times one, whatever the fringing.
4. **Gradients.** Arranged in common centroid, they cancel gradients too.

**Answer:** identical units share the same area-to-perimeter ratio, so the 8:1 ratio holds whatever the fringing, and a common-centroid arrangement cancels gradients as well.
:::
:::

::: check
kind: parts
given: g = 0.2 | 0.5 | 2; d = 5 | 20 | 100

## A parameter drifts {g} mV per 100 µm across the die; two devices' centers are {d} µm apart.

::: part
answer: g/100*d
unit: mV
tolerance: 0.5%

### What systematic mismatch does the gradient cause?

::: misses
- [any] Gradient × distance.
:::
:::

::: part
answer: 0
unit: mV
tolerance: 0

### What does a common-centroid arrangement leave from a linear gradient?

::: misses
- [any] Both devices share a center.
:::
:::
:::

::: check
kind: parts
given: A = 2 | 3 | 5; W = 4 | 10 | 50; S = 1 | 2; D = 500 | 1000 | 2000

## A pair has $A_{VT}$ = {A} mV·µm, WL = {W} µm², distance coefficient S = {S} µV/µm, and its devices are {D} µm apart.

::: part
answer: sqrt((A/sqrt(W))^2 + (S*D/1000)^2)
unit: mV
tolerance: 0.5%

### What is the total mismatch spread?

::: misses
- [A/sqrt(W)] Include the distance term.
- [any] $\sqrt{A^2/WL + S^2D^2}$.
:::
:::

::: part
answer: A/sqrt(W)
unit: mV
tolerance: 0.5%

### What would placing them together leave?

::: misses
- [any] The area term.
:::
:::
:::

::: check
kind: parts
given: n = 5 | 20 | 100; r = 0.02 | 0.05 | 0.1; I = 1 | 10 | 100

## A shared return path has {n} squares of {r} Ω/□ metal and carries {I} mA.

::: part
answer: n*r*I
unit: mV
tolerance: 0.5%

### What voltage drops along it?

::: misses
- [any] $nR_\square I$.
:::
:::

::: part
answer: n*r
unit: Ω
tolerance: 0.5%

### What resistance is that?

::: misses
- [any] Squares × sheet resistance.
:::
:::
:::

::: check
kind: parts
given: C = 0.1 | 0.5 | 2; c = 10 | 50; V = 1 | 3.3; A = 10 | 100

## A digital line couples to a {C} pF high-impedance node through {c} fF; it swings {V} V.

::: part
answer: V*c*1e-15/(C*1e-12 + c*1e-15)*1000
unit: mV
tolerance: 0.5%

### What step does each edge put on the node?

::: misses
- [any] Capacitive divider.
:::
:::

::: part
answer: V*c*1e-15/(C*1e-12 + c*1e-15)*1000/A
unit: mV
tolerance: 0.5%

### How much smaller would a grounded shield line make it, if it cuts the coupling capacitance {A} times?

::: misses
- [any] Divide the coupling.
:::
:::
:::

::: check
kind: parts
given: a = 10 | 50 | 100; p = 0.05 | 0.1; k = 4 | 8

## A capacitor's value is its area plus a fringing term along its edges: a square plate of side a has $C = a^2 + 4pa$ (arbitrary units, p = {p}). Unit plates are {a} µm on a side; one large plate of side $\sqrt k\,a$ is compared with k unit plates, k = {k}.

::: part
answer: (k*a^2 + 4*p*sqrt(k)*a)/(a^2 + 4*p*a)
tolerance: 0.5%

### What ratio does the single large plate give against one unit?

::: misses
- [any] Area scales by k, perimeter by $\sqrt k$.
:::
:::

::: part
answer: k
tolerance: 0.5%

### What ratio do k identical units give?

::: misses
- [any] Exactly k.
:::
:::
:::

::: check
kind: match

## Match each layout technique to the error it attacks.

- Common-centroid placement :: linear gradients across the die
- Dummy devices at array edges :: etch and stress differences at the ends
- Kelvin (force and sense) connections :: IR drops in shared current paths
- Guard rings :: substrate noise and latch-up
- [extra] larger supply voltage

::: misses
- [any] Each technique targets one mechanism.
:::
:::

::: check
kind: derivation
vars: A = 1..10, W = 1..100, S = 1e-4..5e-3, D = 1..2000, g = 1e-4..1e-1

## A device pair has Pelgrom coefficients A (mV·µm) and S (mV/µm), area W (µm²), separation D (µm), and sits in a gradient g (mV/µm).

::: step
answer: sqrt(A^2/W + S^2*D^2)

### What is the random mismatch spread (mV)?
:::

::: step
answer: g*D

### What systematic offset does the gradient add side by side?
:::

::: step
answer: sqrt(A^2/W + S^2*D^2 + (g*D)^2)

### What is the total, combining both as spreads?
:::

::: right
Right. Close placement fights the distance and gradient terms; area fights only the first.
:::
:::

::: check
kind: python

## Write `centroid_error(positions_a, positions_b, g)`: devices A and B are each split into unit segments at the given positions (µm along one axis), and a linear gradient adds g per µm to each segment. Return the difference between A's and B's average added value. Then compare an ABBA arrangement with AABB.

```python starter
def centroid_error(positions_a, positions_b, g):
    return 0.0
```

```python solution
def centroid_error(positions_a, positions_b, g):
    ma = sum(g * x for x in positions_a) / len(positions_a)
    mb = sum(g * x for x in positions_b) / len(positions_b)
    return ma - mb
```

```python tests
assert abs(centroid_error([0, 30], [10, 20], 0.005)) < 1e-15, "ABBA at 0, 10, 20, 30 µm: the centroids coincide."
assert abs(centroid_error([0, 10], [20, 30], 0.005) + 0.1) < 1e-12, "AABB: a 20 µm offset, 0.1 mV at 0.005 mV/µm."
assert abs(centroid_error([0, 20], [10, 30], 0.005) + 0.05) < 1e-12, "ABAB interdigitation halves it."
```

::: right
Right. What matters is each device's centroid; arrangements that share it cancel any linear gradient.
:::
:::

::: explain
## Why does a common-centroid layout cancel a linear gradient, and what does it fail to cancel?

::: model
A linear gradient adds an amount proportional to position to every piece of a device, so each device's total error is proportional to the average position of its pieces, its centroid. If the two devices are split into pieces arranged so their centroids coincide, as in ABBA or a cross-quad, both get exactly the same added amount and their difference cancels. It does nothing for random variation, which only area reduces, and it can't cancel gradients that curve, since then the error isn't a linear function of position and the centroid no longer tells the whole story.
:::
:::

::: practice
::: check
given: g = 0.3 | 1; d = 10 | 50
answer: g/100*d
unit: mV
tolerance: 0.5%

## Gradient mismatch: {g} mV/100 µm over {d} µm?

::: misses
- [any] g × d.
:::
:::

::: check
given: n = 10 | 40; r = 0.03 | 0.08; I = 5 | 50
answer: n*r*I
unit: mV
tolerance: 0.5%

## IR drop: {n} squares of {r} Ω/□ at {I} mA?

::: misses
- [any] $nR_\square I$.
:::
:::

::: check
given: A = 3 | 4; W = 9 | 36
answer: A/sqrt(W)
unit: mV
tolerance: 0.5%

## Pelgrom spread for $A_{VT}$ = {A} mV·µm, WL = {W} µm²?

::: misses
- [any] $A/\sqrt{WL}$.
:::
:::
:::
