Aviad Mintz Martin C. Golumbic
Factoring Logic Functions Using Graph Partitioning
University of Haifa
Factoring Logic Functions Using Graph Partitioning Aviad Mintz - - PowerPoint PPT Presentation
Factoring Logic Functions Using Graph Partitioning Aviad Mintz Martin C. Golumbic University of Haifa Outline of Talk Introduction Proposed Method Read Once Functions Clusters and Cluster Intersection Graph Separability
Aviad Mintz Martin C. Golumbic
University of Haifa
Introduction Proposed Method Read Once Functions Clusters and Cluster Intersection Graph Separability function and partition algorithms Form Conversions - P2SS2P Factoring Algorithm - Xfactor Results Analysis of Xfactor’s parameters Best Combination Group versus Best Average List Run Time Summary
Factoring Boolean Functions: Deriving a minimal factored form from a sum
Example.
Complexity: NP - Hard. Known Algorithms: Algebraic methods (QF and GF), Boolean methods. All algorithms work with a kind of division.
Use Graph Partitioning rather than division.
Exploiting locality of the literals.
Identify Read Once Functions and factor them separately.
Fast to factor, and frequently appears in lower
levels of logic.
Definition: Read Once Function - A function that has a factored form in which each variable appears exactly
Example:
Remarks:
Read Once functions are subset of Unate
Functions.
Read Once Functions frequently appear at lower
levels of Logic Design (PP 95).
The complexity of identifying and factoring Read
Once functions has almost linear complexity (in the input size).
Definition: A Cluster is the set of literals in a prime implicant of an SOP representation or prime explicant in a POS representation. Example:
Clusters of F:
Definition: G(C,E) an undirected weighted graph where:
C - clusters of the function
Example:
Cj Ci j i E ,
{a,b,d} {a,c,d} {c,g} {a,b,g} 2 1 2 1 1
) , ( j i
W
Measure separability of the cluster intersection graph by a graph partitioning algorithm. Try to partition the graph evenly (to minimize the number of stages). Choose the minimal separabilty and return its value and partitions ( - sets of vertices).
P2S - convert sum of product to product of sums S2P - convert product of sums to sum of products P2SS2P – a shortcut for both
Input: Parse tree T of the Boolean function being factored. Xfactor(T).
If T is a Read Once function - Construct the Read Once
tree and exit.
Otherwise, Construct the Cluster Intersection Graph G
corresponding to T and Calculate the Separability.
If the Separability of G is not 0 - Build T* by P2SS2P,
Construct the Cluster Intersection Graph G* and Calculate the Separability.
If the Separability of G is lower than the Separabilty of
G* - Partition T accordingly and Call Xfactor with each part.
Otherwise, Partition T* and Call Xfactor with each part.
{a,b,d} {a,c,d} {c,g} {a,b,g} 2 1 2 1 1 G(C,E):
) )( )( )( ( * g d c b g a c a F
{a,g} {d,g} {b,c} {a,c} 1 1 1
Xfactor chooses the second option and partitions G* evenly.
) )( ( ) )( (
2 1
c b c a F g d g a F
G*(C*,E*):
F1 and F2 are Read Once functions. Thus. Algebraic factoring (GF) produces worse result: Boolean factoring produces same result as. Xfactor.
c ab c b c a F g ad g d g a F ) )( ( ) )( (
2 1
) )( ( c ab g ad F cg cd g d b a F ) ) ( ( (
Factoring Results 1
5 10 15 20 25 30 Ofactor Pfactor Qfactor Rfactor Sfactor Tfactor Boolean Functions Literals QF GF BF XF
Factoring Results2
50 100 150 200 250 300 350 400 5xp1 f51m misex1 rd53 sao2 vg2 z4ml Boolean Functions Literals QF GF BF XF
Factoring Results3
50 100 150 200 250 300 350 400
9 symml alu 2 _ k alu 2 _ l alu 2 _
4 _
4 _ p alu 4 _ v b 9 _ a 1 b 9 _ d 1 b 9 _ i 1 b 9 _ z c 8 _ r c 8 _ s c 8 _ t cm 150 a cm 162 a _
162 a _ p cm 162 a _ q cm 162 a _ r cm 163 a _ q cm 163 a _ r cm 163 a _ s cm 163 a _ t cm 85 a _ l cm 85 a _ m cm 85 a _ n frg 1 _ d i 2 majority mux pcle _ y pcle _ z pcle _ a pcle _ b pcler 8 _ r sct _ d term 1 _ r term 1 _ s
Boolean Functions Literals GF XF
Algorithm
Total # of Literals QF 3630 GF 3408 XF 2586
Parameter Description Option
C CI Graph’s Type (1) VCI, (0) LCI W Weight Balancing (1) Use or (0) no use of weight balancing P Partition Cut Value (1) Use or (0) no use of modified cut size F FM Refinement (1) Use or (0) no use of FM I Initial Search Vertex (0) arbitrary, (1) min., (2) max., (3) random L LSP Stopping (1) 50% of vertices, (0) completing the 50% level M IBM90 Merge Function (1)maximum, (0) addition
Type of cluster intersection graph (C parameter): variable (VCI) or literal (LCI) Example: No edge in LCI, edge in VCI Edges weight (W parameter): number of common literals or balance function result
Balance function:
Example: LCI graph : VCI graph :
2 ) , ( ) , ( j i C C C C
j i j i
j i
j i
) , (
j C i C
) , (
j C i C
Separability value (P parameter): Regular cut size. Or. Modified cut size.
) , (
v u
Use of 4 different partition algorithms
Level structure partitioning (LSP) Greedy graph growing partitioning (GGGP) Max grow partitioning (MGP) Ibm90
Refinement algorithm (F parameter ):
Use or no use of the Fiduccia-Mattheyses refinement algorithm
General structure
Choose a starting vertex v Partition the graph vertices into levels by using
breadth first search (BFS) LSP stopping parameter (L parameter): Stop the BFS after covering 50% of the graph’s vertices
Stop the BFS after completing the remainder of the level k where the 50% vertex occurs Initialize parameter (I parameter): Possible values: an arbitrary vertex 0, a minimum connected vertex, a maximum connected vertex and a random vertex
General structure -.
Divide the graph’s nodes to two sets, the growing
region and the other region.
Nodes move only from the other region to the
growing region until there are no nodes in the other region.
The order of the movement is greedy; The next
node that will be moved is the one that will reduce the connectivity between the regions by the maximum amount.
First node moving to the growing region is
selected by the I parameter.
General structure -.
Divide the graph’s nodes to two sets, the growing
region and the other region.
Nodes move only from the other region to the
growing region until there are no nodes in the other region.
The order of the movement is by the heaviest
edge, the node connected to the heaviest edge in the cut, will be moved to the growing region.
First node moving to the growing region is selected
by the I parameter.
General structure. At each step the algorithm chooses two vertices u and v which are connected by the heaviest edge (e = (u,v)) and merges them to one new vertex (uv). During the merge, the edge e=(u,v) connecting the two vertices is eliminated and each pair of edges ((u.X),(v,x)) connecting these two vertices to another vertex x are merged. This process stops when there are exist two vertices and one edge which represents the bipartition of the whole graph. Weight of the merged edge (M parameter): Sum of its originals or max of its originals.
) , ( ) , ( ) , ( x v x u x uv
) , ( ) , ( ) , ( x v x u x uv
Parameter Preferred Value Condition C Literal Type Graph (LCI) Always W Balanced Edge’s Wight Most of the Time P Modified Cut Size Always F Using Refinement Most of the Time I None No Clear Answer L None No Clear Answer M Maximum Value Always
Algorithm Parameters % Achieving Best Total Literals IBM90 W0C0F0P1M1 69 3913 IBM90 W1C0F0P1M1 66 3574 MGP W0C0F0P1I3 60 3072 GGGP W0C0F0P1I0 58 3070 GGGP W1C0F0P1I0 57 2985 LSP W1C0F1P1L1I0 52 2786 LSP W0C0F1P1L0I3 52 3333 LSP W0C0F1P1L0I2 52 3520 LSP W1C0F1P1L1I3 51 2776 LSP W1C0F1P1L1I2 51 2790 GGGP W1C0F0P1I3 51 3058
Algorithm Parameters Total Literals % Achieving Best LSP W1C0F1P1L1I3 2776 51 LSP W1C0F1P1L1I0 2786 52 LSP W1C0F1P1L1I2 2790 51 GGGP W1C0F1P1I1 2800 55 MGP W1C0F0P1I1 2890 55 MGP W1C0F1P1I3 2900 53 GGGP W1C0F1P1I3 2906 50 GGGP W1C0F1P1I0 2912 51 MGP W1C0F1P1I0 2918 51 MGP W1C0F1P1I2 2918 51 LSP W1C0F1P1L1I1 2923 49 GGGP W1C0F0P1I1 2940 51
Most of the factoring algorithms which belong to the Best Combination Group do not belong to the Best Average List. The parameters values of the Factoring algorithms in the Best Average List follows the majority of all factoring algorithm. While parameters values of the Factoring algorithms in the Best Combination Group are exceptional. Factoring strategy-.
General case – use the best factoring algorithm from
the best average list.
Local optimization – use one from the best
combination group (maybe more then one).
An Open Question. In general, we believe it does, but counterexamples are easy to construct.
Xfactor consumes 2 to 12 times more CPU time than Algebraic methods and quite comparable to Boolean factoring. Most of the CPU time is spent on P2SS2P conversions (30%-80%). 20% to 50% of P2SS2P conversions are redundant. New techniques to eliminate redundant P2SS2P runs yield better run time.
We have presented a new method of factoring logic functions using Graph Partitioning. The method is optimal on Read Once Functions. The empirical results show that our method is better than Algebraic Factoring and competitive with Boolean Factoring.