Algorithm Search⌘K

Definitioncore

Horizontal and vertical constraint graphs

Also called floorplan constraint graphs.

Two DAGs on the blocks whose edges say one block is left of or below another, so longest paths give the least width and height of a packing.

The horizontal and vertical constraint graphs of a set of rectangular blocks are two directed acyclic graphs on the blocks. An edge a→ba \to b in the horizontal graph GhG_h says that block aa must lie to the left of block bb, and an edge a→ba \to b in the vertical graph GvG_v says that aa must lie below bb. They are the common decoding step of floorplanning in chip design: a sequence pair, a B*-tree or an O-tree fixes the relations, and the longest paths in the two graphs give the least xx and yy coordinates that obey them. When every pair of blocks is joined by a path in one of the two graphs, the result has no overlap, and its width and height are the lengths of the longest paths through each graph.

Definition

Blocks and placements. There are nn blocks 1,…,n1, \ldots, n. Block ii has a width wi>0w_i > 0 and a height hi>0h_i > 0. A placement gives each block a lower-left corner (xi,yi)(x_i, y_i), and block ii then covers the rectangle [xi,xi+wi]×[yi,yi+hi][x_i, x_i + w_i] \times [y_i, y_i + h_i]. Two blocks overlap when the interiors of their rectangles meet. A placement is a packing when no two blocks overlap. In a placement, aa is left of bb when xa+wa≤xbx_a + w_a \le x_b, and aa is below bb when ya+ha≤yby_a + h_a \le y_b. The interiors of two rectangles meet exactly when the interiors of both their xx-intervals and their yy-intervals meet, so a placement is a packing if and only if for each pair {a,b}\{a, b\} at least one of four relations holds: aa left of bb, bb left of aa, aa below bb or bb below aa.

Constraint graphs. A horizontal constraint graph is a weighted directed graph GhG_h on the vertex set {s,1,…,n,t}\{s, 1, \ldots, n, t\}. Each edge a→ba \to b between two blocks has the weight waw_a and means "aa is left of bb". The source ss has an edge of weight 00 to every block, and every block ii has an edge of weight wiw_i to the sink tt. A vertical constraint graph GvG_v is the same with the heights hah_a as weights and "below" as the meaning. A placement satisfies the pair (Gh,Gv)(G_h, G_v) when xb≥xa+wax_b \ge x_a + w_a for each edge a→ba \to b of GhG_h between blocks, yb≥ya+hay_b \ge y_a + h_a for each such edge of GvG_v, and all coordinates are at least 00. These are difference constraints. The pair is complete when for every two blocks a≠ba \ne b there is a directed path from one to the other in GhG_h or in GvG_v.

Longest-path placement. When both graphs are acyclic, let Lh(v)L_h(v) be the length of a longest path from ss to vv in GhG_h, and Lv(v)L_v(v) the same in GvG_v. The longest-path placement is xi=Lh(i)x_i = L_h(i) and yi=Lv(i)y_i = L_v(i). Its width is W=Lh(t)=max⁡i(xi+wi)W = L_h(t) = \max_i (x_i + w_i) and its height is H=Lv(t)H = L_v(t). A longest ss to tt path is a critical path: the blocks on it decide the width or the height.

Facts. Each one follows from the definitions in a few lines.

  1. Feasibility. Some placement satisfies the pair if and only if both graphs are acyclic. If GhG_h has a cycle a1→a2→⋯→ak→a1a_1 \to a_2 \to \cdots \to a_k \to a_1, adding the constraints along it gives xa1≥xa1+wa1+⋯+wakx_{a_1} \ge x_{a_1} + w_{a_1} + \cdots + w_{a_k}, which is false since the widths are positive. If both graphs are acyclic, the longest-path placement satisfies each edge, because a longest path to bb is at least as long as a longest path to aa followed by the edge a→ba \to b.
  2. Least placement. Every placement that satisfies the pair has xi≥Lh(i)x_i \ge L_h(i) and yi≥Lv(i)y_i \ge L_v(i) for each block. Along a longest path s→a1→⋯→ak=is \to a_1 \to \cdots \to a_k = i, the constraints give xa1≥0x_{a_1} \ge 0 and xaj+1≥xaj+wajx_{a_{j+1}} \ge x_{a_j} + w_{a_j}, so xix_i is at least the length of the path. So the longest-path placement has the least width and the least height, at the same time, among all placements that satisfy the pair.
  3. No overlap. If the pair is complete and acyclic, the longest-path placement is a packing. A path a⇝ba \leadsto b in GhG_h starts with an edge of weight waw_a, and all other weights are positive, so fact 2 applied to the path gives xb≥xa+wax_b \ge x_a + w_a: aa is left of bb. A path in GvG_v puts one block below the other in the same way.
  4. Every packing has a pair. For a packing, put an edge a→ba \to b in GhG_h whenever aa is left of bb, and in GvG_v whenever aa is below bb. Both graphs are acyclic, because xx (or yy) grows strictly along each edge. The pair is complete, because each pair of blocks has one of the four relations. The packing satisfies its own pair, so by fact 2 the longest-path placement of the pair is a packing that is no wider and no taller. It is the packing pushed as far left and down as its relations allow. So an optimal packing for area is always the longest-path placement of some complete acyclic pair.
  5. Only reachability counts. Adding an edge a→ca \to c when a path a⇝ca \leadsto c already exists does not change any LhL_h value, because that path is at least waw_a long. Removing such an edge does not change them either. So a pair can be replaced by its transitive reduction or by its transitive closure, and what matters are the two strict partial orders "left of" and "below" that the graphs generate.
  6. Cost. With mm edges, a topological sort and one pass give all of LhL_h in O(n+m)O(n + m) time on the word RAM. A complete pair has at least one path for each of the n(n−1)/2n(n-1)/2 pairs of blocks, and when each pair is a direct edge there are Θ(n2)\Theta(n^2) edges, so decoding a sequence pair this way costs O(n2)O(n^2). The weighted longest common subsequence method of Tang, Tian and Wong finds the same longest paths in O(nlog⁡n)O(n \log n) time without building the graphs.

Extra constraints. Design rules often add constraints that are not of the form "left of". A lower bound xa≥cx_a \ge c is an edge s→as \to a of weight cc. An upper bound xb−xa≤dx_b - x_a \le d, for example to keep two blocks close, is an edge b→ab \to a of weight −d-d. Such edges can close cycles. The least solution then exists if and only if no cycle has positive total weight, and the Bellman-Ford algorithm finds it, or reports the positive cycle, in O(nm)O(n m) time. A fixed outline W∗×H∗W^\ast \times H^\ast is met if and only if Lh(t)≤W∗L_h(t) \le W^\ast and Lv(t)≤H∗L_v(t) \le H^\ast.

Examples and non-examples

A complete pair. Take four blocks with sizes AA: 3×23 \times 2, BB: 2×32 \times 3, CC: 4×24 \times 2 and DD: 4×14 \times 1 (width times height). Let GhG_h have the edges A→BA \to B and C→BC \to B, and let GvG_v have the edges A→CA \to C, C→DC \to D and B→DB \to D. The six pairs are joined as follows: ABAB and CBCB in GhG_h, and ACAC, CDCD, BDBD and ADAD (by the path A→C→DA \to C \to D) in GvG_v. So the pair is complete. The longest paths give:

block size x=Lhx = L_h y=Lvy = L_v rectangle
AA 3×23 \times 2 00 00 [0,3]×[0,2][0, 3] \times [0, 2]
BB 2×32 \times 3 max⁡(0+3,0+4)=4\max(0 + 3, 0 + 4) = 4 00 [4,6]×[0,3][4, 6] \times [0, 3]
CC 4×24 \times 2 00 0+2=20 + 2 = 2 [0,4]×[2,4][0, 4] \times [2, 4]
DD 4×14 \times 1 00 max⁡(2+2,0+3)=4\max(2 + 2, 0 + 3) = 4 [0,4]×[4,5][0, 4] \times [4, 5]

The width is Lh(t)=4+2=6L_h(t) = 4 + 2 = 6, on the critical path s→C→B→ts \to C \to B \to t, and the height is Lv(t)=4+1=5L_v(t) = 4 + 1 = 5, on s→A→C→D→ts \to A \to C \to D \to t. The area is 3030, and the blocks cover 6+6+8+4=246 + 6 + 8 + 4 = 24 of it. By fact 2, no placement that keeps these five relations is narrower than 66 or lower than 55.

Non-example: a missing relation. Remove the edge C→BC \to B. Now no path joins BB and CC in either graph, so the pair is not complete. The longest paths give xB=3x_B = 3, and BB becomes [3,5]×[0,3][3, 5] \times [0, 3], which overlaps C=[0,4]×[2,4]C = [0, 4] \times [2, 4] in the square [3,4]×[2,3][3, 4] \times [2, 3]. Satisfying the constraints is not enough: without completeness, nothing keeps two blocks apart.

Non-example: a cycle. Add the edge B→AB \to A to GhG_h. The cycle A→B→AA \to B \to A asks for xB≥xA+3x_B \ge x_A + 3 and xA≥xB+2x_A \ge x_B + 2, so no placement satisfies the pair.

Redundant relations are allowed. Add the edge A→BA \to B to GvG_v as well, so that AA is both left of and below BB. The pair is still complete and acyclic, and the placement is still a packing, but now yB=2y_B = 2, yD=max⁡(4,2+3)=5y_D = \max(4, 2 + 3) = 5 and the height grows to 66. A pair that relates a pair of blocks in both graphs is legal, but it can cost area. Representations such as the sequence pair and TCG put each pair of blocks in exactly one graph.

A slicing structure. For a slicing floorplan, a vertical cut puts every block of the left part left of every block of the right part, and a horizontal cut does the same for below and above. So the transitive closure of GhG_h is built from the slicing tree by series composition at the vertical cuts and by disjoint union at the horizontal cuts: it is a series-parallel order.

  • Sequence pair. Two orders of the blocks that define a complete pair in which each pair of blocks has exactly one relation. Its edges go forward in one of the two orders, so both graphs are acyclic.
  • B*-tree and O-tree. Trees that fix the xx coordinate of each block from its parent and find each yy coordinate with a contour, so they build neither graph.
  • TCG (transitive closure graph). Lin and Chang (2001) store the pair itself, both graphs transitively closed, with each pair of blocks in exactly one of them. A move edits edges and then repairs the closure.
  • Difference constraints and DAG longest paths. The constraint system and the algorithm that solves it; the critical path is the same notion as in critical path scheduling.
  • Mosaic floorplan. A dissection of the chip into rooms. Its graphs can be taken on adjacent rooms only, an edge for each pair of rooms that touch across a segment.
  • Floorplanning. The optimization problem in which these graphs evaluate one candidate.

References

  1. Hiroshi Murata, Kunihiro Fujiyoshi, Shigetoshi Nakatake and Yoji Kajitani, VLSI module placement based on rectangle-packing by the sequence-pair, IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems 15(12), 1518 to 1524, 1996, the horizontal and vertical constraint graphs of a sequence pair and the packing by longest paths in them
  2. Jai-Ming Lin and Yao-Wen Chang, TCG: a transitive closure graph-based representation for non-slicing floorplans, Proceedings of the 38th Design Automation Conference, 764 to 769, 2001, the representation by a pair of transitively closed constraint graphs in which each pair of blocks is related in exactly one graph
  3. Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest and Clifford Stein, Introduction to Algorithms, fourth edition, MIT Press, 2022, Section 22.2 (single-source shortest paths in directed acyclic graphs, and longest paths by negated weights) and Section 22.4 (difference constraints and shortest paths)
  4. Andrew B. Kahng, Jens Lienig, Igor L. Markov and Jin Hu, VLSI Physical Design, From Graph Partitioning to Timing Closure, second edition, Springer, 2022, Chapter 3, Chip Planning (constraint graphs of floorplans and sequence pairs; general locator)

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/3CZSKW/text.yaml