Algorithm Search⌘K

Techniqueadvanced

Ashenhurst-Curtis decomposition

Also called functional decomposition, Ashenhurst decomposition.

Writes f(X, Y) as g(h(X), Y) by counting the distinct columns of a decomposition chart, a method used in synthesis for lookup table FPGAs.

Ashenhurst-Curtis decomposition splits a Boolean function f(X,Y)f(X, Y) of two disjoint sets of variables into g(h1(X),…,ht(X),Y)g(h_1(X), \ldots, h_t(X), Y), where the new functions hih_i see only the bound set XX. It works on a decomposition chart: a table of ff with one column for each assignment of XX and one row for each assignment of YY. If the chart has μ\mu distinct columns, the decomposition exists with tt functions exactly when μ≤2t\mu \le 2^t. Ashenhurst (1957) proved the case t=1t = 1, Curtis (1962) gave the general case, and Roth and Karp (1962) extended it to functions with don't-cares. The method fits lookup tables of FPGAs well, because each hih_i and gg have fewer inputs than ff, and Lai, Pedram and Vrudhula (1993) made it practical by reading the column count off a BDD.

In plain words

Suppose a function reads six switches, but your parts can read only four. Split the switches into two groups. Ask: for each setting of the first group, what does the function do as the second group changes? Write each answer as a column of a table. Often, many settings of the first group give the same column. If there are only two different columns, a small part can read the first group and say which column it is with one wire. A second part reads that wire and the second group and gives the answer. With four different columns you need two wires, and so on. The trick is to count the different columns, and to find a split of the switches with few of them.

When it applies

  • A function has more inputs than one cell can take, as in an FPGA with KK-input lookup tables, and you want to split it into cells with fewer inputs.
  • The function is given or can be built as a truth table or a BDD, so that its columns can be compared. A function of 20 inputs has a truth table of about 10610^6 bits, so the method works on single nodes or small groups of nodes of a Boolean network, not on a whole chip.
  • Some set of inputs affects the output only through a few patterns. A symmetric function is an example: it depends on a bound set of ss variables only through the number of ones in it, so the columns of two assignments with the same count are equal and μ≤s+1\mu \le s + 1.
  • The function has don't-cares that can merge columns, which can make μ\mu smaller.

The template

Write XX for the bound set with ss variables and YY for the free set with the other n−sn - s variables. The column of an assignment xx of XX is the vector col[x]=(f(x,y))y\mathrm{col}[x] = (f(x, y))_y over all assignments yy of YY, in a fixed order. The column multiplicity μ\mu is the number of distinct columns.

  1. DECOMPOSE(f, n, s) ▷ f: a truth table on n variables; s: the size of the bound set
  2. 1for each bound set X of s variables, in the order of CHOOSE-BOUND-SETS do
  3. 2Y ← the other n - s variables
  4. 3for each assignment x of X do
  5. 4col[x] ← (f(x, y) for each assignment y of Y)
  6. 5P ← GROUP(col) ▷ a partition of the assignments of X into classes
  7. 6t ← ⌈lg |P|⌉
  8. 7if t < s then
  9. 8e ← ENCODE(P, t) ▷ a distinct code of t bits for each class
  10. 9h(x) ← e(the class of x) for each assignment x of X
  11. 10g(c, y) ← col[x][y] for any x with h(x) = c; a don't-care if no x has the code c
  12. 11return (X, h, g)
  13. 12return fail

The template has three holes.

  • CHOOSE-BOUND-SETS. All (ns)\binom{n}{s} subsets, or a heuristic order that tries first the variables that appear together.
  • GROUP. For a completely specified ff, the classes of equal columns, so ∣P∣=μ|P| = \mu. With don't-cares, a partition into classes of pairwise compatible columns, where two columns are compatible if they agree wherever both are specified.
  • ENCODE. Any injective map from the classes to {0,1}t\{0,1\}^t is correct. The choice changes the size of hh and gg.

Lines L3 and L4 build the decomposition chart one column at a time. Line L7 keeps only splits that save inputs: hh replaces ss variables by tt wires. Line L10 reads gg off the chart, and the codes of no class are don't-cares of gg.

Why it works (Curtis). For a completely specified ff, functions h1,…,hth_1, \ldots, h_t of XX and gg with f(x,y)=g(h(x),y)f(x, y) = g(h(x), y) exist if and only if μ≤2t\mu \le 2^t. Proof. If f=g(h(X),Y)f = g(h(X), Y), two assignments x,x′x, x' with h(x)=h(x′)h(x) = h(x') have equal columns, since f(x,y)=g(h(x),y)=f(x′,y)f(x, y) = g(h(x), y) = f(x', y) for all yy. So there are at most as many distinct columns as values of hh, which is 2t2^t. Conversely, if μ≤2t\mu \le 2^t, give each distinct column its own code of tt bits, let h(x)h(x) be the code of col[x]\mathrm{col}[x], and let g(c,y)=col[x][y]g(c, y) = \mathrm{col}[x][y] for any xx with h(x)=ch(x) = c. All such xx have the same column, because the code is injective, so gg is well defined and g(h(x),y)=f(x,y)g(h(x), y) = f(x, y). □\square The case t=1t = 1, μ≤2\mu \le 2, is Ashenhurst's simple disjoint decomposition. With don't-cares, the same proof works for any partition into classes of pairwise compatible columns: each class has a common column that agrees with all of its members where they are specified.

Cost. For one bound set, the chart has 2n2^n entries. Hashing the columns finds the classes in O(2n)O(2^n) expected word operations on a word RAM, when a column fits in a constant number of words. Trying all bound sets of size ss costs (ns)\binom{n}{s} times this. Grouping with don't-cares is a coloring problem, below.

Worked example. Let f(a,b,c,d)=(a⊕b)c+dˉf(a, b, c, d) = (a \oplus b) c + \bar{d}, with the bound set X={a,b}X = \{a, b\} and the free set Y={c,d}Y = \{c, d\}.

cdc d \ aba b 00 01 10 11
00 1 1 1 1
01 0 0 0 0
10 1 1 1 1
11 0 1 1 0

The columns of ab=00ab = 00 and 1111 are equal, and so are those of 0101 and 1010, so μ=2\mu = 2 and t=1<2t = 1 < 2. With the code 0 for the first class and 1 for the second, h=a⊕bh = a \oplus b. The column of class 0 is dˉ\bar{d} and the column of class 1 is c+dˉc + \bar{d}, so g(h,c,d)=hc+dˉg(h, c, d) = h c + \bar{d}. A script computed μ\mu for every bound set. The other five bound sets of two variables have μ=3\mu = 3, so they need t=2t = 2 and give no saving. Of the bound sets of three variables, {a,b,c}\{a, b, c\} has μ=2\mu = 2, with h=(a⊕b)ch = (a \oplus b) c and g=h+dˉg = h + \bar{d}, {a,b,d}\{a, b, d\} has μ=3\mu = 3, and the other two have μ=4\mu = 4.

How often it works. A bound set of three variables of a 4-variable function leaves columns of 2 entries, so μ≤4\mu \le 4 and t=2<3t = 2 < 3 always. So every function of 4 variables is g(h1(X),h2(X),y)g(h_1(X), h_2(X), y) for any bound set XX of 3 variables, with three functions of 3 inputs. Simple decompositions are rarer. An exhaustive count found that of the 64594 functions of 4 variables that depend on all 4, exactly 7354 have a bound set of 2 or 3 variables with μ≤2\mu \le 2.

Classic examples

  • LUT mapping. A node with more than KK inputs is split with a bound set of at most KK variables, so that each hih_i fits in one lookup table, and gg is split again if it is still too large.
  • Reduced ordered BDD. Put the bound variables first in the order. Each node of a reduced ordered BDD stands for one distinct subfunction, so μ\mu is the number of distinct nodes reached from the root by the assignments of XX. Lai, Pedram and Vrudhula use this cut to find decompositions without a truth table.
  • Myhill-Nerode theorem. The distinct columns are the distinct residual functions f(x,⋅)f(x, \cdot), in the same way that the states of a minimum DFA are the distinct residual languages of prefixes. Counting columns is counting these classes.
  • Incompletely specified FSM minimization. Merging columns with don't-cares into compatible classes is the same problem as merging compatible states, and in both cases compatibility is not transitive.
  • k-coloring. With don't-cares, build the graph with a vertex per column and an edge between incompatible columns. A partition of compatible classes is a proper coloring, and tt wires suffice if the graph is 2t2^t-colorable.
  • State assignment. The choice of the codes in ENCODE is an encoding problem like the choice of state codes, with the same goal of simple logic after encoding.

Variations

  • Simple disjoint decomposition. The case t=1t = 1 of Ashenhurst, where hh is a single function and gg has n−s+1n - s + 1 inputs.
  • Several functions of the bound set. The general case t≥1t \ge 1 of Curtis, with the test μ≤2t\mu \le 2^t.
  • Non-disjoint decomposition. Some variables ZZ go to both hh and gg: f=g(h(X,Z),Y,Z)f = g(h(X, Z), Y, Z). For each assignment of ZZ the chart is split into its own part, and the classes are counted in each part, so the codes may differ between the parts.
  • Don't-cares. Roth and Karp (1962) gave the tests for functions with don't-cares, where GROUP is a coloring of the incompatibility graph. The don't-cares of gg at unused codes, from line L10, can also make gg smaller.
  • Multiple outputs. For several functions with the same bound set, the column is the tuple of their columns, and the functions hih_i are shared.
  • BDD-based. The method of Lai, Pedram and Vrudhula (1993) reads μ\mu off a BDD cut and builds hh and gg as BDDs, for both disjoint and non-disjoint bound sets.

Pitfalls

  • Accepting a split that saves nothing. With μ=3\mu = 3 and s=2s = 2, t=2t = 2 and the split replaces two inputs by two wires. Line L7 must test t<st < s, not μ≤2s\mu \le 2^s, which always holds.
  • Treating compatibility as an equivalence. The columns (1,∗)(1, *), (∗,0)(*, 0) and (0,∗)(0, *) show the problem: the middle one is compatible with each of the others, but the first and the last conflict in their first entry. Putting all three in one class gives a wrong gg. GROUP must check every pair in a class. Finding the fewest classes is NP-hard in general, because every graph is the incompatibility graph of some chart: give each edge its own row, with 0 and 1 in the columns of its two ends and ∗* in the others, and then the fewest classes is the chromatic number.
  • Treating ∗* as a third value. Comparing columns with ∗* as a symbol gives a correct result but throws away the freedom, so μ\mu can be larger than needed.
  • Forgetting the unused codes. When μ<2t\mu < 2^t, some codes of hh never occur, and gg may take any value there. Fixing them to 0 can make gg larger.
  • Truth tables of large functions. The chart has 2n2^n entries for each bound set, and there are (ns)\binom{n}{s} bound sets. Use a BDD or a small window of the network for more than about 20 inputs.

References

  1. The decomposition of switching functions, decomposition charts and the test for a simple disjoint decomposition by the number of distinct columns
  2. A New Approach to the Design of Switching Circuits, the extension of decomposition charts to decompositions with several functions of the bound set
  3. J. Paul Roth and Richard M. Karp, Minimization over Boolean graphs, IBM Journal of Research and Development 6(2), 1962, pages 227 to 238, the tests for decompositions of incompletely specified functions and the search for a minimum cost circuit
  4. BDD based decomposition of logic functions with application to FPGA synthesis, disjunctive and nondisjunctive decomposition on a BDD, with the bound variables above a cut

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)
WritingW3 standard
  • five exercises