Maze Routing
In order to make the best chip possible while spending the least amount of money, we need to perform good routing. Routing is the process of creating connections between different circuits. Because of the importance of routing, algorithms have been developed to efficiently and optimally create routes.
Lee's Algorithmβ
Wires need to be routed around obstacles and macros, ideally in a path that is short, clean (few bends), and legal. Leeβs Algorithm, a classic maze routing algorithm, can help.
Problem Contextβ
- Goal: Find the shortest legal path between a source and target in a grid-based space (think of the chip layout as a maze).
- Constraints:
- The path must not be diagonal
- The path must not overlap with blockages, like macros, HIPs, or other routed wires
- The preferred path has minimal bends (favoring L-shapes over zig-zags)
The Algorithmβ
- Represent the routing region as a 2D grid (matrix).
- Each grid cell is marked as one of the following:
S
: Source-
T
: Target
-
#
: Obstacle (macros, HIPs, blockages)
-
.
: Empty cell (free routing space)
+
: Visited cell during wave propagation
- Wave Expansion
- Begin from the source cell (
S
) and spread outward in all 4 directions (up, down, left, right). - Each newly visited cell is marked with a wavefront value, which is one more than the minimum of its visited neighbors.
- This creates a growing wave across the grid, effectively computing the shortest number of steps to reach any cell.
- The expansion continues until the target
T
is reached, or all paths are exhausted.
- Begin from the source cell (
- π Backtracking & Path Reconstruction
- Once
T
is reached, the algorithm begins backtracking to reconstruct the path: - From
T
, move to any neighboring cell with a value one less than the current. - Continue until reaching
S
. - Among all possible shortest paths, the router may choose the one with the fewest bends, improving signal integrity and reducing delay.
- Once