The idea: treat logic like polynomials and pull out shared factors

A two-level circuit (a sum of products, SOP) can be large. Multilevel synthesis makes it smaller by finding pieces that several functions use, computing each piece once, and letting the functions read it. The tools that do this, MIS and SIS from Berkeley, use the algebraic methods of Brayton and McMullen: an SOP is handled like a polynomial, and a shared piece is found by polynomial division.

Left: f = ac + ad + bc + bd + e (9 literals) and g = ac + bc + ae + be (8 literals), 17 literals as two-level logic. Right: the network x = a + b, f = x(c + d) + e, g = x(c + e), 9 literals, with x feeding both f and g
The same two functions: 17 literals as two SOPs, 9 literals as a network where x = a + b is computed once.

The canvas follows the two functions f = ac + ad + bc + bd + e and g = ac + bc + ae + be from start to finish. On the left are their cubes; on the right is the Boolean network (one line per node) and its gates. Divide and Kernels work on the function you choose. Extract Common Kernel and Factor build the network.

Quine–McCluskey and Karnaugh maps find the smallest two-level form of one function. This page starts after that: it builds more levels and shares logic between functions. Multilevel Logic shows how such a network is drawn with NAND and NOR gates.

Cubes, literals and the literal count

A literal is a variable or its complement: a, b'. A cube is a product of literals: ac. The cost measure of SIS is the literal count: the number of literal occurrences. f has 4 cubes of 2 literals and one of 1, so 9 literals; g has 8; together 17. A literal count is a good guess at the area of the final circuit, because every literal becomes a transistor pair in a gate.

In a factored form such as (a + b)(c + d) + e, each literal is written once, so this form of f has 5 literals instead of 9.

Algebraic (weak) division

Algebraic division of f by a divisor d finds a quotient q and a remainder r with f = q·d + r, where q and d have no variable in common and q is as large as possible. It is also called weak division. It works cube by cube:

  1. For each cube of d, take the cubes of f that contain it, and strike it out of them. Call that set Q for that cube.
  2. The quotient q is the intersection of all these sets.
  3. The remainder r is every cube of f that is not a cube of q·d.
Weak division of f = ac + ad + bc + bd + e by a + b: cubes with a are ac and ad, giving Q_a = c, d; cubes with b are bc and bd, giving Q_b = c, d; the intersection q = c + d; q times (a + b) gives back ac, ad, bc, bd; the remainder is e
f / (a + b): both cubes of the divisor give {c, d}, so q = c + d and the cube left over, e, is the remainder.

For f / (a + b): Qa = {c, d} from ac and ad, and Qb = {c, d} from bc and bd. Both agree, so q = c + d. Multiplying back, (c + d)(a + b) = ac + ad + bc + bd, and the cube left over is r = e. So f = (a + b)(c + d) + e. Demo: divide f by a + b.

A divisor can fail. For f / (a + e): Qa = {c, d} but Qe = {1}. Nothing is in both, so q = 0 and r = f. Demo: f / (a + e) has no quotient.

Kernels and co-kernels

Which divisors should a tool try? Brayton and McMullen answered with kernels. An expression is cube-free if no single cube divides all of its terms: c + d is cube-free, ac + ad is not (a divides both). A kernel of f is a cube-free quotient f / c, where c is a cube; c is its co-kernel. f itself is a kernel with co-kernel 1 when it is cube-free.

To find them, divide f by each literal that is in two or more cubes, take out any cube common to the result, and repeat inside each kernel found. A literal that is in only one cube, like e in f, gives nothing.

FunctionKernelCo-kernels
f = ac + ad + bc + bd + ec + da, b
a + bc, d
f itself1
g = ac + bc + ae + bec + ea, b
a + bc, e
g itself1

Inside c + d, no literal is in two cubes, so there is no smaller kernel: c + d is a level-0 kernel. Demo: kernels of f and Demo: kernels of g.

Common kernels and extraction

The key theorem: two functions have a common divisor with two or more cubes only if some kernel of one and some kernel of the other share two or more cubes. So a tool needs to compare kernels only, not every possible divisor. Here f and g share the whole kernel a + b.

Extraction makes the shared kernel a new node, x = a + b, and rewrites both functions with it by algebraic division: f / x = c + d with remainder e, and g / x = c + e with remainder 0. The value of x is the number of literals it saves: f goes from 9 to 5 (xc + xd + e), g from 8 to 4 (xc + xe), and x costs 2. So 17 becomes 11, a value of 6. Demo: extract the common kernel a + b.

SIS runs this as a loop: find the kernels of all nodes, pick the kernel with the best value, extract it, and repeat until no kernel saves anything.

Factoring and the network

Last, each node is written in factored form. In f = xc + xd + e, x is in two cubes, so f / x = c + d with remainder e: f = x(c + d) + e, 4 literals. g = xc + xe becomes x(c + e), 3 literals. With x = a + b, the network has 2 + 4 + 3 = 9 literals.

StageNetworkLiteralsGates
Two-level SOPf = ac + ad + bc + bd + e, g = ac + bc + ae + be178 (6 AND2, an OR5, an OR4)
After extractionx = a + b, f = xc + xd + e, g = xc + xe116
After factoringx = a + b, f = x(c + d) + e, g = x(c + e)96, all with 2 inputs

Algebraic steps never change the function. The page still checks it: it evaluates the network and the original SOPs on all 32 rows of a to e, and they agree. Formal tools do this check with binary decision diagrams instead of a full table. Demo: factor and check by truth table.

For these two small functions, factoring f and g separately would also give 9 literals: (a + b)(c + d) + e and (a + b)(c + e). The gain of sharing shows up in the gates: a + b is built once, not twice. With bigger kernels or more functions using them, sharing also wins in literals.

Algebraic is weaker than Boolean

Algebraic division multiplies cubes like polynomials. It does not use the Boolean rules a·a = a, a·a' = 0 or a + ab = a. That keeps it fast, but it misses some factors. Take h = a + bc and the divisor a + b: Qa = {1} and Qb = {c}, so q = 0. Yet in Boolean algebra (a + b)(a + c) = a + ab + ac + bc = a + bc = h. Demo: algebraic division misses a Boolean factor. Boolean division finds such factors, using don't-cares, but it is much slower, so tools use it sparingly.

Where it sits in the flow

RTL becomes generic logic, then this technology-independent optimization makes the network small, then technology mapping covers the nodes with real library cells. The whole chain, from RTL to layout, is on the ASIC design flow page.

What the page leaves out

  • Complemented literals: algebraic division treats a and a' as two unrelated variables. The examples here have none.
  • Cube extraction (a common cube such as ab shared by many cubes), and the faster "fast extract" (fx) that SIS and ABC use for two-cube divisors.
  • The kernel-cube matrix and rectangle covering, which find the best common kernel among many nodes at once.
  • Boolean division with don't-cares, resubstitution, and node simplification by two-level minimization.
  • Delay: more levels mean longer paths, and real scripts trade literals against depth.

On the mind map

Open the Computer Architecture mind mapComputerArchitectureAbstraction and numbers: layers and bit patternsAbstraction and numbersCombinational logic: output depends only on inputsCombinational logicSequential logic: state held by a clockSequential logicMIPS software: how C becomes machine wordsMIPS softwareThe processor: datapath plus controlThe processorPipelines and parallelism: more instructions at oncePipelines and parallelismMemory and I/O: small fast near, big slow farMemory and I/OLogic gatesLogic gatestruth table row picks the outputAdders, muxes, ALUAdders, muxes, ALUcritical path sets the delayMux, decoder, encoderMux, decoder, encoderSelect bits pick one input; decoder one lineBubble pushingBubble pushingDe Morgan: AND-OR becomes NAND-NANDAlgebraic factoringShare kernels: 17 → 9 literalsTechnology mappingTechnology mappingCheapest pattern per node, reused upwardFast arithmeticFast arithmeticlookahead carry beats ripple carryBCD and Gray CodesBCD and Gray CodesBCD adder: sum > 9 or carry → add 6Multiply/divide hardwareMultiply/divide hardwareadd or subtract, then shift, once per bitVerilog to hardwareVerilog to hardwareassign gives gates, always_ff gives flopsVerilog testbenchVerilog testbenchGolden model + check task say PASS/FAILASIC design flowASIC design flowRTL→netlist→DEF→GDSII; slack shrinksPlace and RoutePlace and RouteAnneal by HPWL, then Lee wave routesOpen the Computer Architecture mind mapComputer Architectureoutput depends only on inputsCombinational logicLogic gatesLogic gatestruth table row picks the outputAdders, muxes, ALUAdders, muxes, ALUcritical path sets the delayMux, decoder, encoderMux, decoder, encoderSelect bits pick one input; decoder one lineBubble pushingBubble pushingDe Morgan: AND-OR becomes NAND-NANDAlgebraic factoringShare kernels: 17 → 9 literalsTechnology mappingTechnology mappingCheapest pattern per node, reused upwardFast arithmeticFast arithmeticlookahead carry beats ripple carryBCD and Gray CodesBCD and Gray CodesBCD adder: sum > 9 or carry → add 6Multiply/divide hardwareMultiply/divide hardwareadd or subtract, then shift, once per bitVerilog to hardwareVerilog to hardwareassign gives gates, always_ff gives flopsVerilog testbenchVerilog testbenchGolden model + check task say PASS/FAILASIC design flowASIC design flowRTL→netlist→DEF→GDSII; slack shrinksPlace and RoutePlace and RouteAnneal by HPWL, then Lee wave routes
This page on the Computer Architecture mind map · 76 pages in 7 branches · open it to see the whole map and test yourself in recall mode.