The idea: first choose where each cell goes, then draw the wires

After synthesis a chip is a netlist: a list of library cells (gates and flip-flops) and the nets that join their pins. The back end turns it into geometry in two big steps. Placement decides where every cell sits. Routing draws the metal wires of every net. Both are hard search problems with millions of cells, so the tools use fast estimates and simple, repeated moves. The page shows the classic methods on a small design: 8 cells, 10 nets, 2 rows.

Two rows of standard cells of the same height. Row 1 sits between a VDD rail on top and a GND rail below; row 2 is flipped upside down, so it shares the same GND rail and has a VDD rail at the bottom. Each cell is a whole number of sites wide: INV 2, NAND2 3, DFF 6. Pins are points inside the cells; metal1 runs horizontally and metal2 vertically over the cells
All cells have the same height, so they line up in rows; flipping every second row lets two rows share one power rail.

Where this fits in the whole flow (floorplan, placement, clock tree, routing, signoff on the SKY130 library) is on ASIC Design Flow. This page opens up two of its boxes.

Rows, sites and rails

Every cell of a standard-cell library has the same height. Its power and ground wires run along its top and bottom edge, so cells placed side by side join their rails into one long VDD rail and one GND rail. Every second row is flipped upside down; then two rows share one rail. A row is cut into sites, and every cell is a whole number of sites wide (in SKY130 a site is 0.46 × 2.72 µm). Here: INV 2 sites, NAND2 and NOR2 3, the D flip-flop 6. The 8 cells fill 28 of the 40 sites, 70 % utilization; the free sites leave room for wires and later fixes.

The page uses one routing grid for everything: 22 columns × 9 tracks, one unit of length per track. The rails are metal1, so metal1 cannot run along tracks 0, 4 and 8. The I/O pins a, b, y, z sit in the columns at both ends.

Scoring a placement: half-perimeter wirelength

A placer tries thousands of placements and cannot route each one. It uses an estimate instead: for each net, draw the smallest box around its pins and take half its perimeter, HPWL = (max x − min x) + (max y − min y). For a 2-pin net that is exactly the shortest wire; for 3 pins it is exactly the shortest tree. For more pins it is a little short, but it is fast and smooth, and the real wirelength follows it. The score of a placement is the sum over all nets.

The random starting placement has total HPWL 98. Net n2 (U3.Y → U4.A) alone costs 18, because U3 is at the far left of row 2 and U4 at the far right of row 1. (Demo: HPWL of the random placement.)

Net a with three pins at (0, 3), (1, 7) and (6, 3). Left: its bounding box is 6 wide and 4 tall, HPWL 10. Middle: the shortest tree, a trunk from x 0 to 6 along y 3 and a branch down to (1, 7), length 10. Right: Lee's router connects one pin at a time, first (0, 3) to the nearest pin (1, 7) with length 5, then the tree to (6, 3) with length 6: total 11
For up to 3 pins HPWL equals the shortest tree; a router that adds one pin at a time can come out one unit longer.

Placement by simulated annealing

Simulated annealing (the TimberWolf placer of the 1980s worked this way) starts from any placement and repeats one move: pick two cells and swap them. Let Δ be the change in total HPWL.

  • Δ ≤ 0 (no worse): keep the swap.
  • Δ > 0 (worse): draw a random r between 0 and 1 and keep the swap only if r < e^(−Δ/T).

T is the temperature. While it is high, even bad swaps often pass, so the search can leave a dead end. T falls a little after each batch of swaps, and at the end only improvements are kept. The page starts at T = 8, does 8 swaps per temperature and multiplies T by 0.85 until it is below 0.5: 18 temperatures, 144 swaps. The cells sit on 4 slots per row; the random numbers come from a fixed seed, so every run (and Undo) is the same.

Swap at T = 8HPWLΔe^(−Δ/8)rResult
U1 ↔ FF298 → 107+90.3250.660rejected
U5 ↔ FF198 → 103+50.5350.069kept (uphill)
U6 ↔ U1103 → 118+150.1530.935rejected
FF1 ↔ U1103 → 95−8kept
U5 ↔ FF195 → 94−1kept
U3 ↔ U194 → 86−8kept
FF2 ↔ U186 → 110+240.0500.592rejected
U3 ↔ FF186 → 96+100.2870.208kept (uphill)

The first temperature ends at 96: worse than the 86 it passed through, which is what annealing allows. (Demo: one temperature, swap by swap.) Over all 144 swaps, 23 are kept (7 of them uphill) and 121 rejected. HPWL goes 98 → 61; on the way it sits at 69 for six temperatures and only reaches 61 at T = 0.59. A search of all 8! = 40 320 ways to put the cells on the slots finds no placement below 61. (Demo: anneal to the end.) How annealing works in general, and how it compares with plain hill climbing, is on Simulated Annealing.

Real placers today mostly use analytic (quadratic or electrostatic) global placement, which treats wirelength as a smooth function of real-valued positions and moves all cells at once. Annealing is still the clearest way to see what a placer optimizes.

Legalization

The slots are 5 sites wide, but a flip-flop is 6. After annealing, FF1 in row 2 runs one site into U2's slot, and FF2 in row 1 runs one site past the end of the row. Global placement allows such overlaps; legalization then moves each cell to the nearest legal spot: inside its row, on whole sites, with no overlap. The page does it row by row in two sweeps: left to right, push each cell right of the one before it; right to left, pull each cell back inside the row end. U2 moves from site 16 to 17 and FF2 from 16 to 15. HPWL goes 61 → 60. (Demo: legalize.) A detailed placement step would then try small local swaps again on the legal rows.

Lee's maze router on two layers

Lee's algorithm (1961) is a breadth-first search on the routing grid. Number the source 0. Every free neighbour gets 1, their free neighbours 2, and so on: a wavefront that spreads out like a ripple. The first time the wave touches the target, its number is the length of the shortest path. The backtrace walks from the target to a neighbour numbered one less, again and again, until it is back at 0. Where there is a choice, keep going straight: fewer turns.

A chip has several metal layers, each with a preferred direction. Here metal1 runs horizontally and metal2 vertically, and a via joins them at one point. So the search state is (x, y, layer): a step along metal1 goes left or right, a step along metal2 up or down, and a via changes layer in place. The page counts a via as free in the wave and lists the vias separately; real routers give vias a cost because they add resistance and can fail. Because the layers differ, two nets can cross: one on metal1, the other above it on metal2.

Net n1 (U1.Y → U5.B), routed first on the empty grid, takes a wave of 6 levels that numbers 52 points. The backtrace climbs from U1.Y on metal2, runs 5 steps along metal1 on track 1 and ends at U5.B: 6 units of wire and 2 vias. (Demo: Lee routing of net n1.) A 3-pin net is routed one pin at a time: after the first connection, the next wave starts from every point the net already owns. The grid searches on Grid Pathfinding (BFS, Dijkstra, A*) are the same search; maze routers use A* and cost functions in the same way to go faster.

Congestion: detours, and rip-up and reroute

Once a net is routed, its points are taken on their layers, so later nets must go around. The order matters; routers often take short nets first, because they have few ways to go. On the annealed and legalized placement, in that order (n5, n4, n2, n3, n6, b, n1, a, q1, q2), every net routes at its HPWL except net a, which is one unit longer because it is built pin by pin. Total: 61 units of wire and 17 vias, against an HPWL of 60. (Demo: route all nets.)

Route the random placement instead (legalized first: HPWL 103) and the nets get in each other's way:

  • n4 (U4.Y → FF1.D) has HPWL 14 but needs 26 units: a detour of 12 around wires already there. q2 needs 17 for an HPWL of 14.
  • n2, routed last, is blocked: the wave dies out without reaching U4.A. The router rips up n4 (the first routed net whose removal opens a path), routes n2 at its HPWL of 20, and routes n4 again (26 units).
  • Total: 118 units of wire and 34 vias. The placement that looked twice as bad by HPWL needs twice the wire, and a router fix-up on top.

(Demo: route the random placement.) Real routers do this on a much larger scale. A global router first plans each net through coarse tiles and spreads the demand (the congestion map); the detailed router then draws the tracks, and negotiated rip-up and reroute (PathFinder) raises the cost of crowded spots on every pass until no two nets share a track. In OpenROAD these are FastRoute and TritonRoute.

The clock net is routed differently

The page leaves out the flip-flops' clock pins on purpose. The clock net reaches every flip-flop, and what matters there is not total length but that the edge arrives everywhere at the same time (low skew). Clock tree synthesis builds it before signal routing, for example as an H-tree: each H splits the wire into four equal branches, so every path from the root to a sink has the same length. Real tools insert buffers along the tree and balance the delays, not just the lengths; ASIC Design Flow shows a 10 ps skew after TritonCTS.

An H-tree from a clock root in the centre to 16 flip-flops on a 4 by 4 grid. The root wire splits into a large H; each end of it splits into a smaller H whose four ends are the flip-flops. Every root-to-flip-flop path is 7 + 7 + 3.5 + 3.5 = 21 units long
Every root-to-flip-flop path in an H-tree has the same length, so the clock edge arrives everywhere at once.

After routing

The routed wires are extracted into resistances and capacitances, and static timing analysis checks every path with them. A long detour like n4's adds delay; a failing path is fixed by upsizing cells (logical effort), moving them, or rerouting. Then DRC and LVS check the final geometry, which CMOS Layout, DRC and LVS shows on a single gate. Which cells are in the netlist to begin with is decided by technology mapping.

See also CMOS Layout, DRC and LVS, which draws one cell with its VDD and GND rails and checks it with DRC and LVS.

What the page leaves out

  • Cells snap to 4 fixed slots per row during annealing; real placers move cells to any site, change rows freely, and add timing and congestion to the cost.
  • Analytic global placement, detailed placement, filler and tap cells, and the power grid above the rails.
  • Pins are single grid points, the clock pins are left out, and the router uses only two layers with one fixed direction each; real chips have 5 to 15 layers and design rules for spacing and via enclosure.
  • Vias are free in the wave; global routing, congestion maps and negotiated rip-up and reroute are described, not drawn.
  • Lengths are counted in tracks; the numbers are a teaching model, not SKY130 measurements.

On the mind map

Open the Computer Architecture mind mapComputerArchitectureAbstraction and numbers: layers and bit patternsAbstraction and numbersCombinational logic: output depends only on inputsCombinational logicSequential logic: state held by a clockSequential logicMIPS software: how C becomes machine wordsMIPS softwareThe processor: datapath plus controlThe processorPipelines and parallelism: more instructions at oncePipelines and parallelismMemory and I/O: small fast near, big slow farMemory and I/OLogic gatesLogic gatestruth table row picks the outputAdders, muxes, ALUAdders, muxes, ALUcritical path sets the delayMux, decoder, encoderMux, decoder, encoderSelect bits pick one input; decoder one lineBubble pushingBubble pushingDe Morgan: AND-OR becomes NAND-NANDAlgebraic factoringAlgebraic factoringShare kernels: 17 → 9 literalsTechnology mappingTechnology mappingCheapest pattern per node, reused upwardFast arithmeticFast arithmeticlookahead carry beats ripple carryBCD and Gray CodesBCD and Gray CodesBCD adder: sum > 9 or carry → add 6Multiply/divide hardwareMultiply/divide hardwareadd or subtract, then shift, once per bitVerilog to hardwareVerilog to hardwareassign gives gates, always_ff gives flopsVerilog testbenchVerilog testbenchGolden model + check task say PASS/FAILASIC design flowASIC design flowRTL→netlist→DEF→GDSII; slack shrinksPlace and RouteAnneal by HPWL, then Lee wave routesOpen the Computer Architecture mind mapComputer Architectureoutput depends only on inputsCombinational logicLogic gatesLogic gatestruth table row picks the outputAdders, muxes, ALUAdders, muxes, ALUcritical path sets the delayMux, decoder, encoderMux, decoder, encoderSelect bits pick one input; decoder one lineBubble pushingBubble pushingDe Morgan: AND-OR becomes NAND-NANDAlgebraic factoringAlgebraic factoringShare kernels: 17 → 9 literalsTechnology mappingTechnology mappingCheapest pattern per node, reused upwardFast arithmeticFast arithmeticlookahead carry beats ripple carryBCD and Gray CodesBCD and Gray CodesBCD adder: sum > 9 or carry → add 6Multiply/divide hardwareMultiply/divide hardwareadd or subtract, then shift, once per bitVerilog to hardwareVerilog to hardwareassign gives gates, always_ff gives flopsVerilog testbenchVerilog testbenchGolden model + check task say PASS/FAILASIC design flowASIC design flowRTL→netlist→DEF→GDSII; slack shrinksPlace and RouteAnneal by HPWL, then Lee wave routes
This page on the Computer Architecture mind map · 76 pages in 7 branches · open it to see the whole map and test yourself in recall mode.