Lec9 - Logic Synthesis
Lec9 - Logic Synthesis
˙Course contents
Logic synthesis basics
Binary-decision diagram (BDD)
Verification
Logic optimization
Technology mapping
˙Readings
Chapter 11
Unit 9 1
Y.-W. Chang
sequential synthesis
Unit 9 2
Y.-W. Chang
1
Logic Synthesis & Verification
˙Technology-independent optimization
Works on Boolean expression equivalent.
Estimates size based on # of literals.
Uses don't-cares, common factor extraction (factorization), etc.
to optimize logic.
Uses simple delay models.
˙Technology-dependent optimization: technology
mapping/library binding
Maps Boolean expressions into a particular cell library.
May perform some optimizations in addition to simple mapping.
Uses more accurate delay models based on cell structures.
Unit 9 3
Y.-W. Chang
Boolean Functions
˙B = {0,1}, Y = {0,1,D}
˙A Boolean function f: Bm → Yn
f = x1 x2 + x1 x3 + x2 x3 + x1 x2 + x2 x3 + x1 x3
˙Input variables: x1, x2, …
˙The value of the output partitions Bm into three sets
the on-set
the off-set
the dc-set (don’t-care set)
Unit 9 4
Y.-W. Chang
2
Minterms and Cubes
˙A minterm is a product of all input variables or their
negations.
A minterm corresponds to a single point in Bn.
˙A cube is a product of the input variables or their
negations.
The fewer the number of variables in the product, the
bigger the space covered by the cube.
Unit 9 5
Y.-W. Chang
Unit 9 6
Y.-W. Chang
3
Cover Examples
˙f = x1 x3 + x2 x3 + x1 x2
˙f = x1 x2 + x2 x3 + x1 x3
Unit 9 7
Y.-W. Chang
Canonical Forms
˙A canonical form of a Boolean function is a unique
representation of the function.
It can be used for verification purposes.
˙The truth table or the sum of minterms are canonical
forms
They grow exponentially with the number of input variables.
˙A prime irredundant cover is not a canonical form.
˙Reduced ordered binary decision diagram (ROBDD):
a canonical form that is interesting from a practical point
of view.
Unit 9 8
Y.-W. Chang
4
Logic Synthesis in Practice
˙Specify the logic-level behavioral description of the
circuit in some hardware-description language.
˙Extract from this description the Boolean expressions
related to the logic and represent them in some suitable
internal form.
˙Manipulate these expressions to obtain an optimized
representation (two-level or multilevel).
˙Perform technology mapping, a mapping from the
abstract optimized representation to a netlist of cells
from a library.
Unit 9 9
Y.-W. Chang
f = x1 x2 x3 + x1 x2 x3 + x1 x2 x3 + x1 x2 x3 + x1 x2 x3 + x1 x2 x3
fx1 = x2 x3 + x2 x3 + x2 x3
fx1 = x2 x3 + x2 x3 + x2 x3
˙Shannon expansion (already known to Boole) states:
5
Example Ordered Binary-Decision Diagram (OBDD)
˙The complete Shannon expansion can be visualized as
a tree (solid lines correspond to the positive cofactors
and dashed lines to negative cofactors).
f = x1 x2 x3 + x1 x2 x3 + x1 x2 x3 + x1 x2 x3 + x1 x2 x3 + x1 x2 x3
Unit 9 11
Y.-W. Chang
Unit 9 12
Y.-W. Chang
6
Reduction Example
Unit 9 13
Y.-W. Chang
ROBDD Properties
˙The ROBDD is a canonical representation, given a
fixed ordering of the variables.
˙The ROBDD is a compact representation for many
Boolean functions used in practice.
˙Variable ordering can greatly affect the size of an
ROBDD. k
x2
Unit 9 14
Y.-W. Chang
7
A BDD Package
˙A BDD package refers to a software program that can
manipulate ROBDDs. It has the following properties:
Interaction with BDDs takes place through an abstract
data type (functionality is independent from the internal
representation used).
It supports the conversion of some external
representation of a Boolean function to the internal
ROBDD representation.
It can store multiple Boolean functions, sharing all
vertices that can be shared.
It can create new functions by combining existing ones
(e.g., h = f • g).
It can convert the internal representation back to an
external one.
Unit 9 15
Y.-W. Chang
Unit 9 16
Y.-W. Chang
8
Building an ROBDD
Unit 9 17
Y.-W. Chang
robdd_build Example
Unit 9 18
Y.-W. Chang
9
ROBDD Manipulation
˙Separate algorithms could be designed for each
separate operator on ROBDDs, such as AND, NOR, etc.
˙However, the universal if-then-else operator ‘ite’ is
sufficient. z = ite(f,g,h), z equals g when f is true and
equals h otherwise:
˙Examples:
Unit 9 19
Y.-W. Chang
Unit 9 20
Y.-W. Chang
10
Comments on the ite Algorithm
˙The algorithm processes the variables in the order
used in the BDD package.
π(i) gives the i variable from the top; π
th -1(x) gives the
Unit 9 21
Y.-W. Chang
G = ite(G, 0, 1)
Unit 9 22
Y.-W. Chang
11
ROBDD Example: Computing H from F, G, G
H=F⊕G
= ite(F, G, G)
Unit 9 23
Y.-W. Chang
Composition
˙The composite problem is
the ROBDDs of two functions f and g are known
where
h = f(x1, …, xi-1, g, xi+1, …,xn).
˙Using Shannon expansion, one finds that
Unit 9 24
Y.-W. Chang
12
Positive Cofactor
Unit 9 25
Y.-W. Chang
Unit 9 26
Y.-W. Chang
13
Variable Ordering
˙Reorder adjacent variables only has a local effect on
the ROBDD.
Unit 9 27
Y.-W. Chang
Unit 9 28
Y.-W. Chang
14
The Verification Problem
˙The issue is to compare a specification f to an
implementation g.
˙They can both be represented by ROBDDs (F resp. G).
˙In case of a fully specified function, verification is trivial
(pointer comparison) because of the strong canonicity
of the ROBDD data structure.
Strong canonicity: the representations to identical
functions are the same.
˙If there is a dc-set, use two functions f and d. The
implementation g is correct when
is a tautology (the expression evaluates to ’1’).
Unit 9 29
Y.-W. Chang
Unit 9 30
Y.-W. Chang
15
Applications to Combinatorial Optimization
˙Zero-one integer linear programming can be
formulated as a minimum-cost satisfiability problem.
˙Consider the (standard form) constraint: x1 + x2 + x3 +
x4 = 3.
˙It can be written as:
Unit 9 31
Y.-W. Chang
Set Covering
˙Given a set S = {s1, …,sm} and a set K = {K1, …,Kn}
where each Kj (1 ≤ j ≤ n) is a subset of S, find a subset
Γ of K such that the union of the elements Γ covers S.
˙The cost of a cover is the sum of the costs cj of the
elements Kj of Γ.
˙Multiple cost functions are possible. E.g., cj = 1 or
cj = |Kj|.
˙The problem is NP-complete for most cost functions.
Unit 9 32
Y.-W. Chang
16
Covering Matrix
Unit 9 33
Y.-W. Chang
K5 dominates K4
s2 dominates s3
K3 is essential
Unit 9 34
Y.-W. Chang
17
Technology-Independent Logic Optimization
˙Two-level: minimize the # of product terms.
Unit 9 36
Y.-W. Chang
18
Optimality in Two-Level Logic Synthesis
Unit 9 37
Y.-W. Chang
Unit 9 38
Y.-W. Chang
19
The Quine-McCluskey Algorithm
˙ F(a, b, c, d) = ∑m(2, 3, 7, 9, 11, 13) + ∑d(1, 10, 15)
˙ Step 1: Group minterms to find prime implicants by applying
xy + xy ' = x.
˙ Step 2: Select a minimum set of prime implicants (minimum
# of literals) to implement the original function.
˙ Exponential-time exact algorithm, huge amounts of memory!
Unit 9 39
Y.-W. Chang
Technology Mapping
20
Standard Cell Revisited
Unit 9 41
Y.-W. Chang
Unit 9 42
Y.-W. Chang
21
Technology Mapping
˙Technology Mapping: The optimization problem of
finding a minimum cost covering of the subject graph by
choosing from the collection of pattern graphs for all
gates in the library.
˙A cover is a collection of pattern graphs such that
every node of the subject graph is contained in one (or
more) of the pattern graphs.
˙The cover is further constrained so that each input
required by a pattern graph is actually an output of
some other pattern graph.
Unit 9 43
Y.-W. Chang
Trivial Covering
˙Mapped into 2-input NANDs and 1-input inverters.
˙8 2-input NAND-gates and 7 inverters for an area cost
of 23.
˙Best covering?
Unit 9 44
Y.-W. Chang
22
Optimal Tree Covering by Dynamic Programming
˙If the subject directed acyclic graph (DAG) is a tree,
then a polynomial-time algorithm to find the minimum
cover exists.
Based on dynamic programming: optimal substructure?
overlapping subproblems?
˙Given: subject trees (networks to be mapped), library
cells
˙Consider a node n of the subject tree
Recursive assumption: For all children of n, a best match
which implements the node is know.
Cost of a leaf is 0.
Consider each pattern tree which matches at n, compute
cost as the cost of implementing each node which the
pattern requires as an input plus the cost of the pattern.
Choose the lowest-cost matching pattern to implement n.
Unit 9 45
Y.-W. Chang
Unit 9 46
Y.-W. Chang
23
Best Covering
˙A best covering with an area of 15.
˙Obtained by the dynamic programming approach.
Unit 9 47
Y.-W. Chang
L L L L
L L L L
L L L L
L L L L
24
Xilinx XC4000 FPGA Logic Module Architecture
˙ Each contains two 4-input LUTs, one 3-input LUT, and two DFFs.
˙ Can implement any 2 functions of up to 4 variables, one function of
up to 5 variables, or selected functions of up to 9 variables.
Unit 9 49
Y.-W. Chang
Unit 9 50
Y.-W. Chang
25
Multiplexer-Based Technology Mapping
˙To implement f = ab + ac, set d0 = d1 = s3 = x, d2 = c,
d3 = b, s0 = a, s1 = s2 = 1.
Unit 9 51
Y.-W. Chang
26