Problemcore
FPGA packing
Also called FPGA clustering, logic block packing.
Group LUTs and flip-flops into the logic clusters of an FPGA under limits on cluster size and inputs, so that delay and routing demand between clusters are low.
FPGA packing is the step of the FPGA CAD flow that groups the LUTs and flip-flops of a mapped netlist into the logic clusters of the chip. Each cluster has room for at most basic logic elements (BLEs) and at most input nets from outside, and the clusters are then placed and routed as single blocks. The problem asks for few clusters, and for few connections between clusters on the critical paths, since a connection inside a cluster is fast and uses no general routing.
In plain words
After LUT mapping, the design is a long list of small logic pieces. The chip does not hold them one by one: it holds them in groups, and each group has a fixed number of seats and a fixed number of input wires.
Packing chooses the groups. Pieces that talk to each other a lot should sit in the same group, because a signal inside a group is fast and needs no long wire. A group must not need more input wires than it has. Fewer groups mean a smaller chip, and fewer slow signals between groups mean a faster design.
Definition
Input.
- A netlist of BLEs. BLE has a set of at most input nets, one output net, and a flag for its flip-flop. A BLE is formed from a LUT and the flip-flop that only it feeds.
- The cluster parameters: the size and the number of input pins , with .
- For the timing form, a delay model with a delay for a connection inside a cluster and a larger one for a connection between clusters.
Output. A partition of the BLEs into clusters .
Constraints. Each cluster is legal. Let be the set of nets that some member of reads and no member drives. With the full local crossbar of the logic cluster definition, is legal if and only if
and its BLEs use at most the number of clocks that the cluster has. With sparse local routing, a cluster is legal when a routing of its nets exists inside it, which is a stronger condition.
Objective. The basic form minimizes , the number of clusters. The timing form minimizes the delay of the longest path when connections between clusters are slow, and the routability form minimizes the number of nets that leave clusters. Real packers mix the three.
Decision form. Given the netlist, , and , decide whether a legal partition into at most clusters exists.
Variants
- Cluster count only. Minimize with the two counting limits. This is the form whose hardness is shown below.
- Timing-driven. Keep the connections of critical paths inside clusters. T-VPack targets this form.
- Routability-driven. Lower the number of nets that cross between clusters, and leave some pins free so that the clusters are easier to route to.
- Complex blocks. Blocks with hierarchy, modes, carry chains, memories and multipliers, where legality is a routing check inside the block. AAPack targets this form.
- Depopulated clusters. Fill clusters below on purpose to spread congestion, at the cost of more clusters.
Examples
A hand instance. Take , , and four BLEs: reads and drives ; reads and drives ; reads and drives ; reads and drives .
| cluster | external nets | legal |
|---|---|---|
| yes | ||
| yes | ||
| yes | ||
| no | ||
| yes | ||
| no |
Two clusters is the least possible, since , and reaches it. It also keeps the connections and inside clusters. The pairing is not legal, and the pairing is not either, so the optimum is unique.
Absorbed nets. In the net is driven inside, so it needs no input pin. Adding a BLE to a cluster can lower the input count, which is why the limit cannot be checked BLE by BLE.
Known algorithms
- Greedy growth. T-VPack fills one cluster at a time from a critical seed, adding the BLE of highest attraction that fits. Every cluster that it outputs is legal and each closed cluster is full or admits no remaining BLE, but it has no guarantee on the number of clusters; its page has a 4-BLE netlist where it uses 3 clusters and 2 suffice.
- Greedy growth with a routing check. AAPack grows clusters in the same way and checks each addition by placing the BLE in a slot of the block and routing inside the block. The result is legal for the block's real interconnect, with no guarantee on the count.
- Partitioning. A hypergraph partitioning of the netlist into parts of size lowers the nets between parts, and the parts are then repaired to meet the input limit. This gives no legality by itself.
- Exact search. For tiny netlists, a dynamic program over subsets finds the least number of clusters: over legal that hold the lowest element of . It takes steps and is the brute force that the tests of the packer pages use.
- Clusters of two. For the problem is a maximum matching: join two BLEs by an edge when the pair is legal. A partition into clusters of size at most 2 has pairs, and the pairs are a matching, so the least is minus the size of a maximum matching, which Edmonds' blossom algorithm finds in polynomial time.
| Algorithm | Time | Space | Properties | Code |
|---|---|---|---|---|
| AAPack | O(n^2 N R) packing | O(n K + N K (I + N)) total | deterministicnot exactiterative | 1 language |
| T-VPack | O(n K) criticality | O(n K) total | deterministicnot exactiterative | 1 language |
Bounds
- Size. .
- Inputs. If the BLEs read nets that no BLE drives, each such net uses a pin in every cluster that reads it, so .
- Trivial upper bound. , with one BLE per cluster, which is legal since .
Reductions
Theorem 1 (strong NP-hardness). The decision form of the cluster count problem is NP-complete in the strong sense when , and are part of the input.
Proof. It is in NP: a partition is checked in polynomial time. For hardness, reduce from bin packing in its decision form: item sizes , a capacity with each , and a number of bins. Bin packing is NP-complete in the strong sense (Garey and Johnson, [SR1]; see also the hardness proof of bin packing), so we may assume that the sizes are written in unary. Build BLE with input nets of its own, used by no other BLE, and an output net that no BLE reads. Set , and . No net is shared and no BLE drives a net that another reads, so , and is legal if and only if its items fit in one bin. So a legal partition into clusters exists if and only if the items fit into bins. The netlist has nets, which is polynomial in the unary size.
Theorem 2 (hard already for clusters of three). The decision form is NP-complete when , with and part of the input.
Proof. Reduce from partition into triangles (Garey and Johnson, [GT11]): given a graph with vertices, decide whether its vertices split into triangles. Let . Make one BLE per vertex . It reads one net per edge at , shared with the other end of that edge, plus nets of its own, so it reads exactly nets; its output is read by no BLE. Set , and . A set of three BLEs with edges of among them reads distinct nets, so it is legal if and only if , that is, it is a triangle. A set of at most two BLEs reads at most nets and is always legal. A partition into clusters of size at most 3 covers BLEs, so every cluster has exactly three BLEs and is a triangle. Conversely, a partition into triangles gives legal clusters.
A brute force over 200 random graphs on 6 vertices (seed 2) agrees with Theorem 2 on every instance, 28 of them with a partition into triangles; this checks the construction, not the theorem. With Theorem 2 and the matching algorithm, the cluster count problem is polynomial for and NP-complete for . This page gives no result for fixed , and together.
Applications
- The FPGA CAD flow. Packing runs between LUT mapping and placement, such as timing-driven annealing placement. Its result fixes how many blocks the placer and the router must handle.
- Architecture studies. Betz, Rose and Marquardt chose the number of cluster inputs by packing benchmarks at different and measuring how full the clusters became.
- Heterogeneous blocks. Packing also fills memory and multiplier blocks and the carry chains of logic blocks, each with its own legality rules.
References
- Michael R. Garey and David S. Johnson, Computers and Intractability, A Guide to the Theory of NP-Completeness, W. H. Freeman, 1979, Appendix A, problem [SR1] Bin Packing (NP-complete in the strong sense) and problem [GT11] Partition into Triangles
- Vaughn Betz, Jonathan Rose and Alexander Marquardt, Architecture and CAD for Deep-Submicron FPGAs, Kluwer, 1999 (doi 10.1007/978-1-4615-5145-4), Chapter 3, Section 3.1 Logic Block Packing (the packing step of the CAD flow and its legality rules)
- Alexander Marquardt, Vaughn Betz and Jonathan Rose, Using cluster-based logic blocks and timing-driven packing to improve FPGA speed and density, Proceedings of the ACM/SIGDA International Symposium on Field Programmable Gate Arrays (FPGA '99), 37 to 46, 1999, the packing problem with the limits N and I and the timing-driven objective
- Jason Luu, Jason H. Anderson and Jonathan Rose, Architecture description and packing for logic blocks with hierarchy, modes and complex interconnect, Proceedings of the ACM/SIGDA International Symposium on Field Programmable Gate Arrays (FPGA '11), 227 to 236, 2011, packing for logic blocks whose legality depends on the local interconnect, not only on counts
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.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag 4EE5Y2 Edit this page History Report an error Markdown