Algorithm Search⌘K

Problemcore

Multi-level logic synthesis

Also called multi-level logic optimization.

Restructure a Boolean network into an equivalent one with fewer literals, less depth or less power, by factoring, extraction and don't-care optimization.

Multi-level logic synthesis takes a Boolean network, a circuit of nodes with local functions, and looks for an equivalent network that costs less: fewer literals or nodes, which estimate area, or fewer levels, which estimate delay. It is the step of a chip design flow between the description of the logic and technology mapping. Unlike two-level logic minimization, the result may have any number of levels, so a function can share and reuse its parts, and the search space is much larger. The problem is hard in each common form: deciding whether a network can lose all its literals is already co-NP-hard, and minimum formulas are Σ2p\Sigma_2^p-complete under Turing reductions (Buchfuhrer and Umans 2011). All practical methods are heuristics that change the network in small steps, each of which keeps the function. The MIS system (Brayton, Rudell, Sangiovanni-Vincentelli and Wang 1987) set the pattern with algebraic factoring and don't-care simplification, and later tools such as ABC work on and-inverter graphs.

In plain words

A circuit is a set of small logic blocks, where each block reads some wires and drives a new wire. Many different circuits do the same job. Some use fewer parts, and some give their answer after fewer steps. The task is to take a working circuit and find a cheaper one that gives the same answer for every input. A tool does this in small moves. It pulls out a part that two blocks both compute and builds it once. It writes a block in a shorter form, like taking out a common factor in algebra. It uses the inputs where a block's answer is never seen to make the block simpler. Each move keeps the answers the same, so the tool can stop at any time with a correct circuit. No known method finds the cheapest circuit for large designs.

Definition

Input. A Boolean network NN with primary inputs x=(x1,…,xn)x = (x_1, \ldots, x_n) and primary outputs z1,…,zmz_1, \ldots, z_m, with global functions gzjg_{z_j}. Optionally, an external don't-care set Ej⊆{0,1}nE_j \subseteq \{0,1\}^n for each output.

Feasible solutions. A Boolean network N′N' on the same inputs and outputs, with global functions gzj′g'_{z_j}, such that

gzj′(x)=gzj(x)for all j and all x∉Ej.g'_{z_j}(x) = g_{z_j}(x) \quad \text{for all } j \text{ and all } x \notin E_j.

With no external don't-cares, N′N' is equivalent to NN.

Objective. Minimize a cost c(N′)c(N'). The classic cost is the number of literals of all local functions in factored form. Other costs are the number of nodes of an and-inverter graph, the depth, a weighted sum, or the literal count under a bound on the depth.

Decision version. Given NN, the don't-care sets and an integer kk, is there a feasible N′N' with c(N′)≤kc(N') \le k?

Variants

  • By the cost. Area (literals in factored form, or AIG nodes), delay (depth, or depth with a delay per node), or power (an estimate of the switching activity of each node).
  • By the node functions. Any local function, as in MIS and SIS. A fixed basis, such as 2-input AND with inverted edges in an and-inverter graph, or 3-input majority in a majority-inverter graph. With a complete basis of 2-input gates, the problem is the minimum circuit problem.
  • By the input form. A network, a set of SOPs, or a truth table. The input form changes the complexity, as under Bounds.
  • Technology-independent or mapped. The classic problem ignores the cell library. When the cost is the area or delay of library cells or lookup tables, the problem becomes technology mapping or LUT mapping, usually solved after this one.
  • Sequential. With latches, the latches may also move, as in retiming, and the unreachable states give extra don't-cares.
  • Exact on small functions. For functions of a few inputs, exact synthesis finds a minimum network over a fixed basis.

Examples

Each example was checked on all input vectors by a script.

  • Factoring. The single node f=ab+ac+bd+cdf = a b + a c + b d + c d has 8 literals. Since ab+ac+db+dc=(a+d)(b+c)a b + a c + d b + d c = (a + d)(b + c), the factored form has 4.
  • Extraction across outputs. The nodes f=ac+bc+ef = a c + b c + e and g=ad+bd+eˉg = a d + b d + \bar{e} have 10 literals. The new node x=a+bx = a + b gives f=xc+ef = x c + e and g=xd+eˉg = x d + \bar{e}, with 2+3+3=82 + 3 + 3 = 8 literals. Finding xx is the job of kernel extraction.
  • Boolean beats algebraic. The node f=ab+aˉc+bcf = a b + \bar{a} c + b c has 6 literals. The algebraic methods treat aa and aˉ\bar{a} as unrelated letters and never drop a cube. The best algebraic factored form has 5 literals, b(a+c)+aˉcb(a + c) + \bar{a} c: a search over all factored forms with at most 4 leaves over the literals a,aˉ,b,ca, \bar{a}, b, c found none that multiplies out to these three cubes. The cube bcb c is the consensus of aba b and aˉc\bar{a} c, so f=ab+aˉcf = a b + \bar{a} c as a function, with 4 literals. Removing it needs Boolean reasoning, such as a two-level minimizer.
  • Don't-cares. With y=a+by = a + b and the only output z=yaˉz = y \bar{a}, the node yy is never seen when a=1a = 1, and it can become the wire bb. The observability don't-care page works this out.
  • Depth. The AND of a,b,c,da, b, c, d as the chain ((ab)c)d((a b) c) d has 3 nodes and depth 3. The tree (ab)(cd)(a b)(c d) has 3 nodes and depth 2. AIG balancing makes this change.
  • A network that loses every literal. For a CNF formula φ\varphi and a new variable zz, build the network of φ∧z\varphi \wedge z with one node per clause. It has an equivalent network with no literal, a constant, exactly when φ\varphi is unsatisfiable. If φ\varphi has a satisfying assignment, the function depends on zz.

Known algorithms

All of these are heuristics for the full problem: each step keeps the function, and none has a proved bound on the distance to the optimum.

  • Algebraic division, algebraic kernels and kernel extraction. Treat each SOP as a polynomial, divide it by kernels, and pull out divisors that several nodes share. Fast, and blind to Boolean identities such as aaˉ=0a \bar{a} = 0.
  • Node simplification with observability don't-cares. Minimize each local SOP with Espresso and the don't-cares from the rest of the network.
  • Ashenhurst-Curtis decomposition. Split a function by the distinct columns of a decomposition chart, often for lookup tables.
  • AIG balancing and AIG rewriting. Reduce the depth or the node count of an and-inverter graph by local changes on small cuts, with precomputed small networks.
  • SAT sweeping. Find nodes with the same function by simulation and SAT, and merge them.
  • Exact synthesis. Optimal for a few inputs over a fixed basis, in time exponential in the size of the result.

Tools such as MIS, SIS and ABC run these steps in scripts. Their results are measured on benchmark circuits and are not proved.

AlgorithmTimeSpacePropertiesCode
AIG balancingO(N log k) expected worstO(N) extradeterministicnot exactofflinerecursive1 language
DAG-aware AIG rewritingO(N^2 C^2) worstO(N C) extradeterministicnot exactofflineiterative1 language
Kernel extractionO(E P^4 K n) worstO(P K n) extradeterministicnot exactofflinerecursive1 language

Bounds

Upper bounds (proved).

  • Every function of nn inputs has a network. Its minterm SOP is one node with at most n2nn 2^n literals, and the Shannon expansion f=xˉ1f0+x1f1f = \bar{x}_1 f_0 + x_1 f_1, applied to the subfunctions level by level, gives a network of fewer than 2n2^n nodes with 4 literals each.
  • For a network input and a literal cost, the decision version is in Σ2p\Sigma_2^p of the polynomial hierarchy: guess N′N' with at most kk literals, and check for all xx that it agrees with NN off the don't-care sets. The check is in co-NP.
  • For a truth table input and a fixed basis of 2-input gates, the decision version is in NP, since a circuit with at most k≤2nk \le 2^n gates is a certificate checked in time polynomial in 2n2^n. This is the minimum circuit size problem.

Lower bounds (proved, as hardness).

  • For a network input, the decision version is co-NP-hard, even for k=0k = 0, by the last example above and the co-NP-completeness of unsatisfiability.
  • For formulas, the Minimum Equivalent Expression problem, given a formula and kk, is there an equivalent formula of size at most kk, is Σ2p\Sigma_2^p-complete under Turing reductions (Buchfuhrer and Umans 2011). A network in which every node has one fanout is a formula, so this is the fanout-free case of the problem.
  • The two-level case is NP-hard for a truth table input and Σ2p\Sigma_2^p-complete for a DNF input; see two-level logic minimization.
  • For a truth table input, it is not known whether the minimum circuit size problem is NP-complete. Kabanets and Cai (2000) showed that a proof of NP-completeness by the usual kind of reduction would give circuit lower bounds for exponential time that are beyond the known methods.
  • For n≥5n \ge 5, most functions of nn inputs need more than 2n/(4n)2^n / (4n) nodes with two fanins. The Boolean network page proves this by counting.

Measured. The papers on MIS, SIS, ABC and AIG rewriting report literal counts, node counts and depths on benchmark circuits. These are measurements on those sets, not bounds.

Reductions

  • From unsatisfiability. The construction in the examples reduces the complement of SAT to the decision version with k=0k = 0, in linear time.
  • To two-level minimization, by collapsing. Eliminating every internal node gives one SOP per output, which two-level methods can minimize. The SOP can be exponentially larger than the network, as for parity of nn inputs, which has a network of n−1n - 1 XOR nodes and needs 2n−12^{n-1} cubes in two levels.
  • To SAT, for exact synthesis. The question "is there a network of rr nodes for ff" for a small truth table becomes a SAT instance, which is how exact synthesis works.
  • To and from circuits. A network becomes a circuit of 2-input gates with at most three gates per literal, and a circuit is a network with small local functions.

Applications

  • Chip design. ASIC flows run technology-independent optimization before technology mapping, and FPGA flows run it before LUT mapping.
  • Verification. The same AIG rewriting and SAT sweeping make equivalence and model checking problems smaller before a solver runs.
  • High-level synthesis output. The logic that a scheduler and binder produce is a network that this step cleans up.

References

  1. Robert K. Brayton, Richard Rudell, Alberto Sangiovanni-Vincentelli and Albert R. Wang, MIS, a multiple-level logic optimization system, IEEE Transactions on Computer-Aided Design 6(6), 1987, pages 1062 to 1081, the optimization of a Boolean network for literal count and its operations of factoring, extraction, substitution and simplification
  2. Robert K. Brayton, Gary D. Hachtel and Alberto L. Sangiovanni-Vincentelli, Multilevel logic synthesis, Proceedings of the IEEE 78(2), 1990, pages 264 to 300, the statement of the multilevel problem, its cost functions, and the algebraic and Boolean methods
  3. Giovanni De Micheli, Synthesis and Optimization of Digital Circuits, McGraw-Hill, 1994, Chapter 8, Multiple-Level Combinational Logic Optimization
  4. David Buchfuhrer and Christopher Umans, The complexity of Boolean formula minimization, Journal of Computer and System Sciences 77(1), 2011, pages 142 to 153, the Sigma_2^p-completeness under Turing reductions of the Minimum Equivalent Expression problem
  5. Valentine Kabanets and Jin-Yi Cai, Circuit minimization problem, Proceedings of the 32nd ACM Symposium on Theory of Computing (STOC), 2000, pages 73 to 79, the circuit minimization problem for a truth table input, and the consequences of a proof of its NP-completeness
  6. Alan Mishchenko, Satrajit Chatterjee and Robert Brayton, DAG-aware AIG rewriting, a fresh look at combinational logic synthesis, Proceedings of the 43rd Design Automation Conference, 2006, pages 532 to 535, the and-inverter graph as the form of multi-level synthesis, with node count and depth as the costs

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