Algorithm Search⌘K

Problemcore

LUT mapping

Also called FPGA technology mapping.

Cover a Boolean network with k-input lookup tables of an FPGA so that the depth or the number of tables is least.

LUT mapping is technology mapping for FPGAs whose logic blocks are lookup tables (LUTs). A kk-input LUT is a small memory of 2k2^k bits, so it can compute any function of at most kk inputs, and the task is to cover a Boolean network with such tables. In the structural form used by most mappers, each table computes one node of the network from a kk-feasible cut of that node, and the tables wired together must compute the outputs. The usual costs are the depth, the largest number of tables on a path from an input to an output, which models the delay, and the number of tables, which models the area. Cong and Ding (1994) showed that a mapping of least depth can be found in polynomial time. Farrahi and Sarrafzadeh (1994) showed that a mapping with the fewest tables is NP-hard to find. Networks that are trees are an easy case for the area.

In plain words

An FPGA is built from many small tables. Each table has a few inputs, often four or six, and can be set to compute any rule of them. To put a circuit on an FPGA, the circuit must be cut into pieces that each have at most that many inputs, one table per piece.

There are many ways to cut. One way gives short chains of tables from inputs to outputs, which makes the circuit fast. Another way uses fewer tables, which leaves room for more logic. The problem is to pick the cut with the shortest chains, or with the fewest tables, or with the fewest tables among the cuts with the shortest chains.

Definition

Input. A Boolean network GG, a directed acyclic graph whose sources are the primary inputs (PIs) and whose other nodes are gates, with a set of outputs, and an integer k≥2k \ge 2. For the depth results below, GG is kk-bounded: every gate has at most kk fanins.

Feasible solutions. A mapping: a set SS of gates, the LUT roots, and for each v∈Sv \in S a set CvC_v such that

  • every output gate is in SS;
  • CvC_v is a cut of vv, a set of nodes that meets every path from a PI to vv, with v∉Cvv \notin C_v and ∣Cv∣≤k|C_v| \le k;
  • every gate of CvC_v is in SS.

The LUT of vv holds the function of vv in terms of the nodes of CvC_v. A node of GG can lie inside the cones of several LUTs, so logic may be copied.

Objective. One of:

  • depth: the largest D(v)D(v) over the outputs, where D(u)=0D(u) = 0 for a PI and D(v)=1+max⁡u∈CvD(u)D(v) = 1 + \max_{u \in C_v} D(u) for v∈Sv \in S;
  • area: ∣S∣|S|;
  • area under a depth bound, or depth first and area second.

Decision version. Given GG, kk and a number DD or AA, is there a mapping of depth at most DD, or with at most AA LUTs?

A cut that is not minimal can be replaced by a minimal cut inside it without raising the depth or the number of LUTs, so it is enough to consider minimal cuts.

Variants

  • Objective. Depth, area, area under a depth bound, power (the switching activity of the LUT outputs), or the number of edges between LUTs, which models routing.
  • Delay model. Unit delay per LUT, or a delay per LUT and per connection.
  • Copying. Allowed by default. A duplication-free mapping requires the cones of the LUTs to be disjoint.
  • Sequential circuits. Registers stay in the network, and the mapping is done together with retiming to minimize the clock period, as in Pan and Lin (1998).
  • Structural and functional. The structural form uses cuts of the given network. The functional form allows any network of LUTs that computes the outputs, which can be smaller, and is reached by functional decomposition, such as Ashenhurst-Curtis decomposition.
  • Structural choices. The input holds several equivalent structures of the logic, and cuts may come from any of them.
  • Device features. LUTs of several sizes, LUTs that split into two smaller ones with shared inputs, carry chains and other hard blocks.

Examples

  • A wide AND. The AND of 5 inputs with k=4k = 4 needs 2 LUTs and has depth 2, since no LUT has 5 inputs. With k=5k = 5 it needs 1 LUT.
  • Depth and area together. Let k=3k = 3, with inputs a,b,c,da, b, c, d and gates p=(a,c)p = (a, c), q=(b,p)q = (b, p), r=(d,q)r = (d, q), s=(b,r)s = (b, r) and the output o=(p,s)o = (p, s). The output depends on 4 inputs, so it needs at least 2 LUTs and depth at least 2. The mapping with oo over {b,d,p}\{b, d, p\} and pp over {a,c}\{a, c\} reaches both bounds.
  • Depth and area in conflict. Let k=3k = 3, with inputs a,b,c,d,ea, b, c, d, e, gates p=(b,d)p = (b, d), q=(a,c)q = (a, c), r=(p,q)r = (p, q), s=(c,p)s = (c, p), t=(e,s)t = (e, s), and outputs o1=(c,r)o_1 = (c, r) and o2=(q,t)o_2 = (q, t). An exhaustive search over all mappings gives least depth 2, and every mapping of depth 2 has at least 5 LUTs, for example o1o_1 over {a,c,p}\{a, c, p\}, o2o_2 over {e,q,s}\{e, q, s\}, pp over {b,d}\{b, d\}, qq over {a,c}\{a, c\} and ss over {b,c,d}\{b, c, d\}. The fewest LUTs is 4, for example o1o_1 over {a,c,p}\{a, c, p\}, o2o_2 over {a,c,t}\{a, c, t\}, tt over {c,e,p}\{c, e, p\} and pp over {b,d}\{b, d\}, and every mapping with 4 LUTs has depth 3.
  • Copying. In the last example, the mapping of depth 2 computes qq in its own LUT and also inside the LUT of o1o_1, whose cone holds qq and rr.

Known algorithms

  • FlowMap (Cong and Ding 1994). Least depth for kk-bounded networks with unit delay, by a max-flow computation at each node. Exact.
  • Cut enumeration with dynamic programming over the cuts of each node. Least depth when all cuts are kept; the area passes are heuristics.
  • Priority cuts (Mishchenko, Cho, Chatterjee and Brayton 2007). Keeps a few cuts per node; depth first, then area flow and exact area. Heuristic, with the depth of the first pass kept.
  • Chortle and its successors (Francis, Rose and Vranesic, from 1990). Area mapping by decomposing the network into trees and packing each tree into LUTs.
  • Exact area mapping by integer programming or SAT, with one variable per cut. Exact, with exponential time in the worst case.
AlgorithmTimeSpacePropertiesCode
Chortle-crfO(m d) this implementationO(n + m) totaldeterministicnot exactrecursive1 language
Cut enumerationO(N k C^(2d)) worstO(N k C) extradeterministicexactofflineiterative1 language
CutMapO(n c^d K) cut enumerationO(n c K) totaldeterministicnot exactiterative1 language
DAOmapO(n c^d K + n c d n) cut enumeration and costsO(n c K) totaldeterministicnot exactiterative1 language
FlowMapO(K m n) worstO(m) extradeterministicexactofflineiterative1 language
Priority cuts mappingO(N k C^4 + N^2 C^2) worstO(N k C) extradeterministicnot exactofflineiterative1 language

Bounds

Upper bounds (proved).

  • Depth. For a kk-bounded network with nn nodes and mm edges and unit delay, a mapping of least depth is found in O(kmn)O(k m n) time (Cong and Ding 1994). The proof is on the FlowMap page.
  • Area on trees. If every gate has at most one fanout and the network has one output, the fewest LUTs are found in polynomial time for a fixed kk. Proof: in a tree the leaves of a minimal cut of vv lie in disjoint subtrees, so the LUTs of a mapping inside the subtree of vv number at least 1+∑cost(u)1 + \sum \mathrm{cost}(u) over the gate leaves uu of CvC_v. So cost(v)=min⁡C(1+∑u∈C a gatecost(u))\mathrm{cost}(v) = \min_{C} \big(1 + \sum_{u \in C \text{ a gate}} \mathrm{cost}(u)\big) over the minimal kk-feasible cuts of vv, and a node has at most O(nk)O(n^k) cuts. An exhaustive search over all mappings agreed with this recurrence on 300 random trees (seed 31).
  • The decision versions are in NP: a mapping is a certificate of polynomial size, and checking it takes polynomial time.

Lower bounds (proved, as hardness).

  • Area. Finding a mapping with the fewest LUTs is NP-hard (Farrahi and Sarrafzadeh 1994), for fixed values of kk from a small constant on. The exact range of kk in their theorem was not checked for this page.
  • Area under a depth bound. With a depth bound at least the number of gates, the bound has no effect, so this problem is NP-hard as well.
  • Functional form. With the network given as a circuit, even the question whether an output needs no LUT at all is co-NP-hard, since it asks whether the output is a constant or an input.

Measured. Nothing on this page. The papers above report depth and LUT counts on benchmark sets such as the MCNC circuits, which are measurements on those sets, not bounds. The page on priority cuts gives a toy measurement of the effect of the number of kept cuts.

Reductions

  • Special case of technology mapping. Take the library of all functions of at most kk inputs, each with area 1 and delay 1, and match by function.
  • Depth to max flow. Cong and Ding reduce the test "can node vv have depth pp" to a max-flow problem on the cone of vv with unit node capacities, by the max-flow min-cut theorem.
  • Area to covering. Area mapping is a binate covering problem with one 0-1 variable per cut, with constraints that each output is a root and each gate leaf of a chosen cut is a root.

Applications

  • FPGA synthesis. Every FPGA flow maps logic into the LUTs of the device, followed by packing, placement and routing.
  • Logic optimization. Mapping into LUTs with small kk and reading the result back as a network is used as a restructuring step in synthesis.
  • Emulation and prototyping. Large designs are mapped into many FPGAs for hardware emulation before the chip is built.

References

  1. FlowMap: an optimal technology mapping algorithm for delay optimization in lookup-table based FPGA designs, pages 1 to 12; the formulation of LUT mapping with K-feasible cuts, and depth-optimal mapping in polynomial time
  2. Complexity of the lookup-table minimization problem for FPGA technology mapping, pages 1319 to 1332; the NP-hardness of mapping with the fewest lookup tables (the range of K is not checked)
  3. Peichen Pan and Chih-Chang Lin, A new retiming-based technology mapping algorithm for LUT-based FPGAs, FPGA 98, pages 35 to 42; LUT mapping of sequential circuits together with retiming (general locator)
  4. Improvements to technology mapping for LUT-based FPGAs, area recovery under a depth bound with area flow and exact area, and mapping with structural choices (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)
WritingW2 basic
  • a contract.yaml