Upload
others
View
3
Download
0
Embed Size (px)
Citation preview
CANONICAL FORM BASED BOOLEAN MATCHING AND SYMMETRY
DETECTION IN LOGIC SYNTHESIS AND VERIFICATION
by
Afshin Abdollahi
___________________________________________________________
A Dissertation Presented to the FACULTY OF THE GRADUATE SCHOOL
UNIVERSITY OF SOUTHERN CALIFORNIA In Partial Fulfillment of the
Requirements for the Degree DOCTOR OF PHILOSOPHY
(ELECTRICAL ENGINEERING)
May 2006
Copyright 2006 Afshin Abdollahi
ii
Dedication
To my wife
Delaram
iii
Acknowledgments
My first, and most earnest, acknowledgment must go to my advisor professor
Massoud Pedram for inviting me to join his research group and providing invaluable
professional and personal guidance throughout my Ph.D. research. His enthusiasm
and support made all the difference and has been instrumental in ensuring my
academic and professional career.
Many thanks also to committee members, professors Peter Beerel and Sheldon
Kamienny for their valuable comments and feedbacks.
Last but not least, I would like to thank my family for their devotion, encouragement
and support. In every sense, none of this work would have been possible without
them.
iv
Table of Contents
Dedication .................................................................................................................... ii Acknowledgments.......................................................................................................iii List of Tables .............................................................................................................. vi Abstract ......................................................................................................................vii Chapter 1. Introduction.......................................................................................... 1
1.1 Boolean Matching Problem ......................................................................... 1 1.2 Prior Work ................................................................................................... 3 1.3 Overview of the Dissertation ....................................................................... 7
Chapter 2. Preliminaries ...................................................................................... 13
2.1 Phase Assignment ...................................................................................... 13 2.2 Permutation ................................................................................................ 15 2.3 Transformation........................................................................................... 17 2.4 Cofactors .................................................................................................... 21 2.5 Formal Definition of Boolean Matching.................................................... 22
Chapter 3. Functional Symmetries ...................................................................... 30
3.1 Introduction................................................................................................ 30 3.2 Prior Work ................................................................................................. 31 3.3 General Form of Symmetry ....................................................................... 34 3.4 Simple Symmetry....................................................................................... 35 3.5 Symmetry Classes...................................................................................... 39 3.6 Relation between Simple and General Symmetries................................... 42 3.7 Hierarchical Symmetries............................................................................ 47
v
Chapter 4. Signatures and Signature Vector........................................................ 53 4.1 Introduction................................................................................................ 53 4.2 Generalized Signatures .............................................................................. 57 4.3 Total Ordering on Cubes............................................................................ 58 4.4 Signature Vector ........................................................................................ 60
Chapter 5. Signature Vector based Canonical Form ........................................... 64
5.1 Introduction................................................................................................ 64 5.2 NPN-Representative .................................................................................. 65 5.3 The Proposed Canonical Form................................................................... 68 5.4 Properties of the Canonical Form .............................................................. 70
Chapter 6. Computing the proposed Canonical Form ......................................... 85
6.1 Introduction................................................................................................ 85 6.2 Input and Output Phase Assignment.......................................................... 86 6.3 Detecting Simple Symmetry Relations...................................................... 87 6.4 The Compute_Cf Algorithm....................................................................... 88 6.5 Algorithm Summary .................................................................................. 99 6.6 Experimental Results ............................................................................... 104
Chapter 7. Conclusions...................................................................................... 108 References................................................................................................................ 109
vi
List of Tables
Table 1. Worst-case and average runtimes to compute canonical forms................. 105 Table 2. Number of non-simple SP transformations........................................... 107
vii
Abstract
Boolean matching algorithms have many applications in logic synthesis especially in
technology mapping and combinational logic verification. Canonical form based
Boolean matching has been studied by many researchers. However, none of the
previous work has produced in an algorithm with reasonable space and time
complexities for general Boolean matching problem. In contrast, this dissertation
provides an efficient and compact canonical form for representing the set of all
Boolean functions that are equivalent under permutation of input variables and
complementation of input or output variables (i.e., NPN-equivalent Boolean
functions.) In particular, important properties of the proposed canonical form are
investigated, and subsequently utilized to devise an effective algorithm for
computing the proposed canonical form. The low average computational complexity
of this algorithm allows it to be applied to large complex Boolean functions with no
limitation on the number of input variables as opposed to previous approaches,
which are not capable of handling functions with more than seven inputs. Key
contributions of this thesis include the introduction of the complete set of generalized
signatures of a Boolean function, development of efficient methods of recognizing
variable symmetries, and presentation of a proficient algorithm for computing the
canonical form of the class of NPN-equivalent Boolean functions based on the
generalized signatures and variable symmetries.
1
Chapter 1. Introduction
1.1 Boolean Matching Problem
Boolean matching is the problem of determining whether a Boolean function is
functionally equivalent to another one modulo the following transformations (for the
moment we only consider single-output functions):
1. Complementation of inputs
2. Permutation of inputs
3. Complementation of the output
A more rigorous definition will be provided later. In this dissertation we shall use the
terms ‘complementation’ and ‘negation’ interchangeably.
Boolean matching algorithms have many applications in logic synthesis and
verification including:
• Cell-library binding (also called technology mapping) where a multi-level
logic representation is transformed into an interconnection of instances of
logic cells of a given cell library. During the cell-library binding, it becomes
necessary to repeatedly determine whether some portion of a NAND-
decomposed Boolean network (e.g., a collection of NAND2 and INV cells)
2
can be realized by some cell in the library [16].
• Combinational logic verification. Boolean matching may be used to check
the equivalence of two Boolean functions, even when the correspondence
between inputs of the two functions or polarity of inputs and the output are
unknown. Even so, verification problems often involve functions with large
number of inputs. Therefore, the Boolean matching algorithms that are
applicable to verification differ from those used in library binding [24][40].
• Anti-fuse based logic synthesis. When mapping a logic network to a complex
coarse-grained configurable logic block (CLB) e.g., the pASIC3 cell from
Quicklogic, it is necessary to find clusters of logic cells in the network that
can be mapped to such a CLB. As expected an proficient Boolean matching
algorithm will be quite helpful in this kind of application.
• Library-free technology mapping where there is a “fluid” library of a large
number of cells – typically with constraints on the number of parallel and/or
series connected devices. A cell generator is used to generate and lay out the
cells on the fly. Boolean matching is used to check whether or not a cluster of
the Boolean network that satisfies the parallel and series constraints (and
hence forms a valid gate in the library) has already been generated and laid
out by the cell generator.
Boolean matching is a critical and CPU-intensive task and due to its critical role in
synthesizing logic circuits, there have been many efforts to solve the problem [1].
3
Boolean functions that are equivalent under negation (permutation) of inputs are
called N-equivalent (P-equivalent). Functions that are equivalent under both negation
and permutation of input variables are called NP-equivalent [20]. If the negation of
output is also allowed, then the functions are called NPN-equivalent. Evidently, if
functions are N-equivalent (or P-equivalent) they are also NP-equivalent. Similarly
NP-equivalent functions are NPN-equivalent. In other words for functions to be
NPN-equivalent it may not be necessary to perform all three transformations on the
inputs and the output.
For n-input functions there are 2n possible transformations that only involve
complementation of inputs (each of n inputs can be negated or kept intact.) We will
refer to each of these 2n transformations as a “phase assignment”. There are also n!
permutations on n inputs. Finally, there are two transformations that involve possible
complementation of the output. Therefore, the number of all possible transformations
for an n-input function is 2(n!)2n = 2n+1n!. The Boolean matching problem for n-
input functions is in principle reducible to 2n+1n! tautology checks. In other words
the complexity of an exhaustive method for Boolean matching is O(2n+1n!) tautology
checks. In practice, filters are used to reduce the number of required checks [25].
1.2 Prior Work
Boolean matching algorithms can be classified into two categories:
1. Pair-wise matching algorithms
4
2. Algorithms based on canonical representations (canonical forms) of
functions.
Pair-wise Boolean matching algorithms are based on a semi-exhaustive search where
the search space is pruned by the use of some filters which are computed from some
properties of Boolean functions [1] e.g., signatures. A signature in general is a
description of (one or more) input variables of a Boolean function that is independent
of the permutation or complementation of the variables of the function.
Equality of the signatures is a necessary condition for NP-equivalence of two
functions. Although signature equality is not a sufficient condition for NP-
equivalence of two functions, signature-based Boolean matching algorithms have
proven to be quite effective in the sense that they tend to significantly reduce the
average runtime complexity of the Boolean matching task.
Some of the signature-based algorithms are efficient for performing pair-wise
Boolean matching [24][27][34][40]. However, to match a function against cells in a
standard cell library, such algorithms often require performing pair-wise matching of
the function under consideration against each and every cell in the library.
Consequently, Boolean matching techniques based on explicit pairwise checks are
unsuitable when dealing with libraries with large number of cells. There are other
signature-based algorithms that have been successfully used with cell libraries;
however, these algorithms can only handle libraries of modest size [12][25][39].
Furthermore, the signatures used in these algorithms are often ‘weak’ in the sense
5
that the ratio of their differentiation power to their cost is low. In many cases these
weak signatures are unable to decide whether a Boolean match between two
functions exists or not. Consequently, an exhaustive search becomes necessary to
obtain a conclusive result. Other Boolean matching algorithms have considered only
some restricted form of Boolean matching [19][22][36][37].
Boolean matching algorithms that belong to the second category compute some
canonical form for Boolean functions [5][41][21][15][11][14]. These algorithms are
based on the fact that two functions match if and only if their canonical forms are the
same. The approach in this dissertation belongs to this category.
Burch and Long introduced a canonical form for matching under complementation of
inputs. This allows us to check for N-equivalence. This form can be used to check
for NP-equivalence (and NPN-equivalence) by testing under all input permutations
and output complementation in a straightforward manner. The canonical form for N-
equivalence relies on a reduced ordered binary decision diagram (ROBDD for short)
representation and can be seen as an operator (i.e., a Boolean function) whose
argument is a Boolean function. This canonical form of a function can be constructed
in polynomial time by performing a recursive expansion about its support variables.
Canonical forms for representing functions modulo the input permutation may be
defined in a similar way. For reasons of computational speed, Burch and Long [5]
proposed the use of semi-canonical forms for representing permutations [5]. These
two forms should be combined to do Boolean matching under permutation and
6
complementation of variables. Thus, in order to handle complementation and
permutation of inputs simultaneously, a large number of forms for each cell are
required.
Other researchers, including Wu et al. [41], Debnath and Sasao [15], and Ciric and
Sechen [11] also proposed canonical forms that are applicable for Boolean matching
under permutation of the variables only but do not handle complementation of
inputs.
Hinsberger and Kolla [21] and Debnath and Sasao [14] introduced a canonical form
for solving the general Boolean matching problem. However, their approach is
mainly based on manipulating the truth table of the function and using a table look-
up, which in turn introduces an enormous space complexity, thus limiting the
algorithm to library cells with seven and fewer input variables, which is a major
limitation.
Chai and Kuehlmann [6] present a competent matcher by joining together a number
of different ideas/techniques from previous works and adding new heuristics.
Mohnke and Malik [27] present an approach which computes a signature for each
variable or phase of a variable, which is subsequently helpful in establishing the
correspondence of variables or phases of variables. However, according to their
reported results, their approach fails to conclude a unique correspondence of
variables or phases of variables for some benchmarks.
Concepts of Boolean matching and symmetry are closely related. Functional
7
symmetries provide significant benefits for multiple tasks in synthesis and
verification. In the Boolean matching algorithm that will be provided in this thesis,
this relationship manifests itself in two levels. First, simple types of symmetries (that
are inexpensive to discover) are utilized to reduce the complexity of the Boolean
matching algorithm. Second, the proposed Boolean matching algorithm will generate
(as a bi-product) the remaining (more complicated) symmetries.
1.3 Overview of the Dissertation
In canonical form based Boolean matching, two functions match if and only if their
canonical forms are the same. Hence when checking for a match between two
Boolean functions, one should compute their canonical forms. Once the canonical
forms are computed checking the equality is usually of constant time complexity (for
example if ROBDD’s are used to represent functions, as is the case in this work, the
equality check will have constant time complexity.)
The power of canonical form based Boolean matching is best manifested in the cell-
library binding application. At the first stage of the process i.e., the library
preprocessing step, canonical forms of the library cell functions are computed. For
efficient equivalence checking of canonical forms a hash table is used to store the
canonical forms of all library cell functions. This preprocessing is performed only
once for a given library. During the cell binding step, to find a cell that covers a
subgraph of the subject graph, the canonical form of the cluster function is is
8
computed. Next, the hash table is checked for the presence of the canonical form of
the cluster function. A matching will be found exactly if the canonical form of the
cluster function is in the table. This method eliminates the need for pair wise
matching of the cluster against the library cells one cell at a time.
The canonical form is defined based on a property which makes it unique among all
functions in an NPN-equivalence class. Different researchers have used different
criteria to define the canonical form. The important task is to devise a canonical form
that can handle permutation and complementation of inputs and complementation of
output with a relatively low (at least on average) time complexity.
In this dissertation, the concept of a signature vector is used to define the canonical
form. The signature vector has two important properties that enable us to define the
canonical form based on it. The first property is that the signature vector of a
function is unique. In other words, different Boolean functions have different
signature vectors while equivalent ones have exactly the same canonical form.
Second, a total ordering between signature vectors (based on lexicographic
comparison) is defined that results in a total ordering on Boolean functions. The
ordering between two Boolean functions is defined as the ordering between their
respective signature vectors. More precisely, the canonical form (NPN-
representative) of an NPN-equivalence class is the function that is the greatest in the
class based on this ordering. (Alternatively, one may define the canonical form as the
smallest function in the NPN-equivalence class.)
9
Given a Boolean function f, a naïve approach for computing the canonical form of f
would be to generate all other functions in the NPN-equivalent class of f - by
applying all possible transformations on f – and then finding the greatest function
among generated functions (the NPN-equivalent class of f) based on their signature
vectors. Obviously, this approach is not practical for time complexity reasons.
A number of pervious researchers have used the notion of signatures to address the
Boolean matching problem. For example in [29] authors have introduced universal
signatures. A universal signature is defined in terms of a single variable. However, in
this dissertation we introduce a signature vector which is defined for a function with
respect to all groupings of its variables rather than single variables. Other researchers
[12][26] have used Walsh spectrum for defining the canonical form. This method
requires the computation the entire Walsh spectrum (an integer vector of size 2n for
an n-input function) and processing this vector while in the proposed method only a
small portion of the signature vector which is necessary for computing the canonical
form are calculated. In most cases zeroth, 1st and 2nd order signature are sufficient.
( ⎟⎟⎠
⎞⎜⎜⎝
⎛++
21
nn signatures are computed and used as opposed to 2n.)
Another advantage of the proposed method over previous approaches is efficient
handling and utilization of symmetry relations which has not been adequately
addressed in previous approaches. We thus present an approach that takes advantage
of variable symmetry and signatures of variables (mostly 1st and 2nd order signatures)
10
to efficiently (on average) compute the canonical form of a Boolean function under
the NPN equivalence relation. This efficient computation is made possible because
of some important properties of the proposed canonical form. In fact the proposed
canonical form has been defined attentively so that it possesses a number of
important properties that can be exploited for efficient computation of the canonical
form. This fact is one of the key contributions of this dissertation and provides a
considerable advantage over previous work. These useful properties of the canonical
form are proven rigorously.
The process of computing the canonical form, F, for a given function, f, is regarded
as a transformation - complementation of some inputs of f (input phase assignment),
a permutation on inputs and possible complementation of output of f (output phase
assignment) – that converts f to its canonical form F.
Some of the key properties, which can be exploited to convert f to its canonical form
F, are the following:
1- The zeroth order signature of the canonical form, F, of any given function, f,
is greater or equal than that of the complement of F. This property is used for
computing the output phase assignment.
2- The first order signature of the canonical form, F, with respect to any of its
variables, is greater or equal than that of the complement of that variable.
This property is used for computing the input phase assignment.
3- The first order signatures of the canonical form, F, with respect to input
11
variables are sorted non-decreasingly (the input variables of a function are
assumed to be indexed.) This property is used for computing the proper
permutation on inputs.
4- Symmetric variables of the canonical form, F, appear consecutively in the
inputs of function F. Since swapping symmetric variables does not change
the functionality, the search space for input permutations is significantly
reduced due to this property.
In case that these steps do not result in a unique transformation (e.g., there is a tie
between first signatures), second and (only if necessary) higher order signatures are
use to break the ties.
There may be more than one transformation that converts a function to its canonical
form. This situation occurs because of the existence of functional symmetries.
Functional symmetries are the result of transformations that leave the function
unchanged.
The proposed algorithm for computing the canonical form returns all transformations
that convert a function to its canonical form. One can use the relation between these
canonicity producing transformations to deduce all possible functional symmetry
relations for the given function. Note that functional symmetries provide significant
benefits for performing various tasks in logic synthesis and verification.
Experimental results provided in this dissertation demonstrate that the proposed
approach for computing the canonical form does not have the limitations of previous
12
works; i.e., it computes the canonical form of a Boolean function with any number of
variables under both permutation and complementation of variables. An important
advantage of the proposed technique is the way it handles and uses the symmetry of
variables to minimize the complexity of the algorithm compared to some of the
previous approaches which are not able to consider symmetries [14][21]. Hence, the
proposed technique is applicable to logic verification of large circuits and to
technology mapping with a large ASIC library with cells of any number of inputs.
13
Chapter 2. Preliminaries
In this chapter we provide terminology and preliminary concepts needed for
explaining the Boolean matching algorithms provided in the subsequent chapters.
We assume that the reader is familiar with the basic concepts of Boolean algebra (see
[3] for a review) and ROBDDs [4].
We denote vectors and matrices in capital letters i.e., ),,,( 21 nxxxX K= where X
denotes a vector of n Boolean variables.
2.1 Phase Assignment
A literal is a variable, x , or its complement x . We will refer to literal x as the
positive phase of variable x and to literal x as its negative phase. In general, a
literal may be denoted as px . The phase of the literal is described by using the
Boolean variable }1,0{=∈Bp where
xxp p =⇒=1 (positive phase)
xxp p =⇒= 0 (negative phase.)
With this notation, the complement of the literal px can be described by px i.e,
pp xx =
14
We shall refer to p in px as the phase assignment of variable x .
The definition of the phase can be extended to vectors as follows. For the variable
vector ),,,( 21 nxxxX K= and phase vector ),,,( 21 npppP K= (where X and nBP∈
contain the same number of variables and Bpi ∈ ), the phase assignment P of
variable vector X is defined as
),,,( 2
2
1
1
n
n
pppP xxxX K= .
As an example, for 1 2 3( , , )X x x x= and )0,1,0(=P , the result of phase assignment P
to variable vector X is ),,( 321 xxxX P = .
For a set A , we use || A to denote the cardinality of A . Since nnB 2|| = , the number
of distinct phase assignments to ),,,( 21 nxxxX K= is n2 .
Although we originally defined phase assignment for variables (positive phase
literals,) it can also be defined for (negative phase) literals:
ip xxp
i=⇒=1
ip xxp
i=⇒= 0
As an example, for ),,( 321 xxxX = and )0,0,1(=P the result of phase assignment is
),,( 321 xxxX P = .
The identity phase assignment is denoted by )1,,1,1(1 K= . Obviously, XX =1 . The
inverse of phase assignment P is P i.e., XX PP =)( .
15
The cascade of two phase assignments ),,,( 21 npppP K= and ),,,( 21 nqqqQ K= is
),,,( 2211 nn qpqpqpQP ⊕⊕⊕=⊕ K since QPQP XX ⊕=)( . (The ‘⊕ ’ is the XNOR
operation i.e., for Boolean variables x and y , 1=⊕⇔= yxyx .)
2.2 Permutation
A permutation is a rearrangement of the elements of an ordered list or a vector. We
define a permutation π on a set },,2,1{ nAn K= , which will serve as indices of an
ordered list or a vector.
Definition 1: A permutation π on set },,2,1{ nAn K= is a bijection from nA to nA
i.e.,
nn AA →:π
( ) ( )i j i jπ π≠ ⇔ ≠
For a subset nAB⊂ , the range of a permutation π on domain B is defined as
})({)( BiiB ∈= ππ
Based on this definition, the range of permutation π on nA is nA
nn AA =)(π
which is equivalent to the reversibility of permutation π as a function i.e.,
, , . . : ( )n nj A i A s t i jπ∀ ∈ ∃ ∈ =
16
The identity permutation, ι , on },,2,1{ nAn K= is defined as follows:
, ( )ni A i iι∀ ∈ =
We denote the set of all permutations on nA by nΠ .
The cascade of two permutations 1π and 2π on },,2,1{ nAn K= , denoted by 21ππ , is
defined as
1 2 1 2, ( ) ( ( ))ni A i iπ π π π∀ ∈ =
The cascade operation among permutations is not a commutative operation i.e., in
general,
1 2 1 2 2 1, ,nπ π π π π π∀ ∈Π ≠
However, it is an associative operation
1 2 3 1 2 3 1 2 3, , , ( ) ( )nπ π π π π π π π π∀ ∈Π =
Permutations are reversible. The inverse of a permutation π , denoted by 1−π , is
defined as
ijji =⇒= − )()( 1ππ
Or equivalently
ιππππππ ==Π∈∃Π∈∀ −−− 111 ,, nn
Based on these properties, set nΠ with cascade operation creates a group.1 The
1 A group G is a finite or infinite set of elements together with a binary operation (called the group
17
number of members of this group is !n .
Any permutation nΠ∈π can be applied to a vector of length n e.g.,
),,,( 21 nxxxX K= . The result of application of permutation nΠ∈π to vector is
determined based on the following relations.
)()( ii xx ππ =
),,,(),,,()( )()2()1(21 nn xxxxxxX πππππ KK ==
which, is simply a rearrangement the entries of vector X . It is easy to see that
XXXXn ===Π∈∀ −− )()()(, 11 ιπππππ
As an example, for the permutation 3Π∈π where 2)1( =π , 3)2( =π and 1)3( =π ,
we have ),,(),,( 132321 xxxxxx =π .
Next, we describe NP transformations comprising of phase assignment and
permutation.
2.3 Transformation
Definition 2: An NP transformation on vector ),,,( 21 nxxxX K= is defined as a
phase assignment followed by a permutation. In particular, for phase assignment
),,,( 21 npppP K= and permutation nΠ∈π , the NP transformation PTπ on vector
operation) that together satisfy the four fundamental properties of closure, associativity, identity, and
inverse property.
18
),,,( 21 nxxxX K= is computed as follows:
)()( PP XXT ππ = .
Now then,
(1) (2) ( )1 2
1 2 (1) (2) ( )1 2( , , , ) ( , , , ) ( , , , )nn
n n
p p ppp pPnT x x x x x x x x xπ π π
π π ππ π= =K K K
or more simply
)()]([)( PP XXT ππ π=
The set of all NP transformations on a vector of size n is denoted by
},{ nnP
n BPT Π∈∈=Γ ππ .
As an example for )0,0,1(=P and ),,(),,( 132321 xxxxxx =π , we have
),,(),,( 132321 xxxxxxT P =π .
The number of transformations in nΓ is
!2|||||| nB nn
nn =Π×=Γ
The identity transformation is denoted by 1ιT where )1,,1,1(1 K= is the identity phase
assignment and ι is the identity permutation. Obviously, XXT =)(1ι for any vector
X .
The cascade of two transformations 1
1
PTπ and 1
2
PTπ , denoted by 2
2
1
1
PPTT ππ , is defined as
))(()( 2
2
1
1
2
2
1
1XTTXTT PPPP
ππππ =
The following relations provide more insight to the cascade of two transformations.
19
))](([]))]([([)( 2112111
1
2
2
)(12
)(12
PPPPPP XXXTT ⊕== ππππ ππππ
])([12
)(12
21122111
1
2
2)]([]))]([([)( PPPPPP XXXTT ⊕== πππ
ππ ππππ
The second equality follows from )()]([)( PP XX πππ = .
One can verify that that for any permutation π and phase assignments (or vectors in
general) P and Q , the following relation holds
)()()( QPQP πππ ⊕=⊕
Therefore,
)]()([12
221121
1
2
2)]([)( PPPP XXTT πππ
ππ ππ ⊕=
PPP TTT πππ =1
1
2
2 where 12πππ = and )()( 221 PPP ππ ⊕=
The inverse of transformation PTπ denoted by 1)( −PTπ and satisfies the following
relations:
111 )()( ιππππ TTTTT PPPP == −−
Now we will try to find phase assignment P′ and permutation π′ such that
1)( −′′ =
PP TT ππ .
)()(1 PPPP TTTT ′′⊕′′
′′ == πππ
ππππι
which requires
1−=′⇒′= ππππι
)()()(1 PPPP ′′⊕=′′⊕′= ππππ
20
)()()( 1 PPPPP πππ =′=′⇒′′=⇒ −
Therefore,
)(11)( PP TT π
ππ −=−
PPP XXXT )]([)]([)()( 1))((11 1 −−− ==−
ππ πππ
We will show that set of all transformation nΓ with cascade operation creates a
group. For this reason the cascade operation is shown to be an associative operation.
Consider transformations 1
1
PTπ , 2
2
PTπ and 3
3
PTπ , we have
]])([[)(
])([ 321123
123
2112
12
3
3
1
1
2
2
3
3)( PPPPPPPPP TTTTTT ⊕⊕⊕ == πππ
πππππ
ππππππ
]])([)([))(
])([ 32231123
123
2
1
3223
23
1
1
2
2
3
3)( PPPPPPPPP TTTTTT ⊕⊕⊕ == πππππ
ππππππ
πππππ
For the cascade operation to be associative, the following relations must hold.
123123 )()( ππππππ =
]])([)([]]])([[ 32231123321123 PPPPPP ⊕⊕=⊕⊕ ππππππππ
The first equation follows from associative relation of the cascade operation of
permutations; in fact the cascade of three permutations 1π , 2π and 3π can be
expressed without the use of parentheses.
123123123 )()( πππππππππ ==
which is also equal to
)()()( 332231123 PPP ππππππ ⊕⊕
21
This concludes the proof of associative property of cascade operation for NP
transformations, i.e.,
1
1
2
2
3
3
1
1
2
2
3
3)()( PPPPPP TTTTTT ππππππ =
In the remainder of this document, when there is no ambiguity, we shall denote a
transformation PTπ by T for brevity. In addition, we may denote an NP
transformation on vector X as XT Pπ (or TX ) instead of )(XT P
π (or )(XT .) We
usually denote the identity transformation by 1ιTI = . Finally, with regard to
permutations, Xπ shall refer to )(Xπ .
2.4 Cofactors
Let function )(Xf be a single-output completely-specified Boolean function of
),,,( 21 nxxxX K= i.e.,
BBf n →:
The onset of )(Xf is a subset of its domain, nBF ⊂ , that results in .1)( =Xf
)1(}1)({ 1−==∈= fXfBXF n
We shall denote the size of onset of )(Xf by |)(| Xf i.e., |||)(| FXf = .
In this dissertation when there is no ambiguity about input X , we may simply write
f to mean )(Xf .
22
The cofactor of )(Xf with respect to literal ipix is a function )( ix
Xfip
i of
),,,,,,( 1121 niii xxxxxX KK +−= defined as
iiipi
ipi
pxxixXfXfXf ==
== |)(|)()(1
),,,,,,,(),,,,,,( 11211121 niiiniixxxpxxxfxxxxxf ip
iKKKK +−+− =
A cube (or product term) is the Boolean conjunction of some literals,
mi
m
ii pi
pi
pi xxxq L2
2
1
1=
The cofactor of )(Xf with respect to a cube q is a function of variables in X that
are not present in q (positive or negative phase) and is defined as
mimiiiii pxpxpxqqq XfXfXf ==== == ,,,1 2211|)(|)()( K
where
},,,{21 miiiq xxxXX K−= .
2.5 Formal Definition of Boolean Matching
In the context of library cell biding, we consider Boolean functions that model a
portion (or logic cell cluster) of the circuit. These functions are called cluster
functions. We denote by f a generic cluster function. We refer to the combinational
function modeling a library cell as a pattern function. We denote by g a generic
pattern function. We assume for now that both cluster and pattern functions are
23
single output Boolean functions. Of course, in contexts other than the library cell
binding problem, we can refer to f and g as functions between which a Boolean
match is to be confirmed or disproved.
We say that an input to a library cell is stuck-at 0 if it is connected to ground. This is
modeled by replacing the corresponding variable in the pattern function with 0. We
define the stuck-at 1 condition in a similar way, mutatis mutandis.
We say that two (or more) cell inputs are bridged together when they are connected
to the same input line. Finally, we say that a library is closed under stuck-at and
bridging (or closed for short) if, for any stuck-at and/or bridging condition, the
corresponding pattern function is equivalent to either the pattern function of another
cell in the library or to a Boolean constant value (i.e., 0 or 1.) Most cell libraries are
closed.
Let us consider a cluster function )(Xf , with n input variables that are entries of
vector X . Let us consider also a pattern function )(Yg , where variables in Y denote
m inputs of the corresponding library cell. For the sake of simplicity, we assume
that mn = unless specified otherwise. Note that when the cell has more inputs than
the cardinality of the support set of the cluster function, i.e., nm > , then a match
requires bridging or sticking-at-a-constant operations. When considering closed
libraries (and most libraries are closed), there always exists a more convenient
match, i.e., a simpler cell performing this function. Conversely, when the cell has
fewer inputs than n , a match is possible only if some variable in X is redundant.
24
This can be detected while matching the cluster function and considering don’t care
conditions.
Matching involves comparing two functions and finding an assignment of the cluster
variables to the pattern variables. For explanation, we separate the two issues and
describe first, matching two functions defined over the same set of variables.
We will discuss different categories of Boolean matching. First Boolean matching
under input permutations only is considered.
Consider two functions, )(Xf and )(Xg , defined over the same variable set
),,,( 21 nxxxX K= .
Definition 3: The two functions )(Xf and )(Xg are equivalent if )()( XgXf ⊕ is
a tautology.
)()(, XgXfBX n =∈∀
When the two functions are expressed by ROBDDs, such a test can be done in
constant time [2].
In general, we are interested in exploring the possible permutations of input variables
that yield equivalent behavior.
Definition 4: Two functions )(Xf and )(Xg are P-equivalent, denoted by gfP≡ , if
there exists a permutation π such that )()( XgXf π⊕ is a tautology.
)()(,, XgXfBX nn ππ =∈∀Π∈∃
25
Each function )(Xf is P-equivalent to itself since )()( XfXf ι= where ι is the
identity permutation. Hence, P-equivalence relation is reflexive i.e., ffP≡
Since the relation )()( XgXf π= holds for every input vector, in this relation X can
substituted by )(1 X−π , which yields the following relations:
)()( 11 XgXf −− = πππ
)()( 1 XgXf =−π
Hence, P-equivalence relation is symmetric.
fggfPP≡⇔≡
P-equivalence relation is also transitive. Assume that gfP≡ and hg
P≡ then there
exist permutations 1π and 2π such that
)()( 1XgXf π=
)()( 2 XhXg π=
Substituting the second equation in the first one results in:
)()()( 121 XhXgXf πππ ==
hfP≡⇒
We showed that P-equivalence relation is reflexive, symmetric and transitive. Hence
it is an equivalence relation. Hence P-equivalence relation partitions the set of
Boolean functions into equivalence classes. This fact is used in defining canonical
26
forms which will be explained in detail later.
The most simplistic approach to detect P-equivalence is to perform !|| nn =Π
tautology checks. Mailhot and De Micheli [25] were the first to propose a method for
Boolean matching. They detected tautology by comparing ordered BDDs, and
abandoned the canonicity of ROBDDs to save the computing time of having to
reduce the OBDDs of the cluster functions. (Historically, their method preceded
development of efficient ROBDD manipulation tools [2].) To expedite P-
equivalence checks, the authors used filters to prune unnecessary tautology checks.
The method can be perfected by associating each library element with a multi-rooted
ROBDD representing all variable permutations.
It is often the case that the polarity (also called phase) of the inputs and outputs of a
combinational network can be altered, because I/Os originate and terminate on
registers or I/O pads yielding signals and their complements. Thus, it is useful to
search for matches with arbitrary polarity assignments, when these reduce the cost of
the objective function of interest.
Equivalence under input negations
Definition 5: The two functions )(Xf and )(Xg are N-equivalent, denoted by
gfN≡ , if there is a phase assignment P such that )()( PXgXf ⊕ is a tautology.
)()(,, Pnn XgXfBXBP =∈∀∈∃
Similar to P-equivalence, N-equivalence also is an equivalence relation.
27
Another type of equivalence is resulted when both permutation and phase assignment
operations on inputs are considered.
Definition 6: Two functions )(Xf and )(Xg are NP-equivalent, denoted by
NPf g≡ , if there exists an NP transformation T such that )()( TXgXf ⊕ is a
tautology.
)()(,, TXgXfBXT nn =∈∀Γ∈∃
(As mentioned before, T denotes a transformation PTπ for some nΠ∈π and
nBP∈ .)
One can easily see that NP-equivalence is an equivalence relation.
The most general type of equivalence is when we also consider phase assignment of
the output. We will denote the phase assignment Bp∈ to function )(Xf by
pXf ))(( or )(Xf p for short. To avoid confusion we will use capital letters (such as
P ) for phase assignment to vectors (such as X ) and lower case letters (such as p )
for phase assignment to single variables or outputs of single output functions.
General Form of Boolean Matching
Definition 7: Two functions )(Xf and )(Xg are NPN-equivalent, denoted by
gf ≡ , if there exists an NP transformation T and an output phase assignment
Bp∈ such that )()( TXgXf p⊕ is a tautology i.e.,
)()(,,, TXgXfBXBpT pnn =∈∀∈∃Γ∈∃ .
28
Example: Let 3121321 ),,( xxxxxxxf += and 323121321 ),,( xxxxxxxxxg ++= . It is
easy to see that )()( TXgXf = where ),,( 321 xxxX = and ),,()( 132 xxxXT = . Thus,
)(Xf and )(Xg are NPN-equivalent.
In the following we show that NPN-equivalence is also an equivalence relation.
Symmetric property ( fggf ≡⇔≡ ):
)()()()( 1XTfXgTXgXf pp −=⇔=
Transitive property ( hfhggf ≡⇒≡≡ , ):
)()()()(),()( 12211221 XTThXfXThXgXTgXf pppp ⊕=⇒==
Boolean matching is often defined in terms of P, NP or NPN-equivalence. In
principle, P, NP, and NPN-equivalence can be reduced to !n , !2 nn and !2 1nn+
tautology checks.
We use the symbol x∀ and x∃ to designate the consensus and the smoothing
operators with respect to variable x, respectively. Recall that the consensus operation
corresponds to universal quantification and is computed as xxx fff =∀ , while the
smoothing operation corresponds to existential quantification and is computed as
xxx fff +=∀ . Consensus (smoothing) with respect to an array of variables can be
computed by repeated application of single-variable consensus (smoothing)
operations.
29
Variable Assignment and Boolean Matching
In practice, a cluster function )(Xf is defined over some network variables
),,,( 21 nxxxX K= and a pattern function )(Yg is defined over some other variables
),,,( 21 nyyyY K= . A matching requires an assignment of cluster variables to pattern
variables, representing the connections between the cluster and the cell. We denote a
generic assignment by the characteristic equation 1),( =YXA of a variable mapping
function that maps the variables X into Y .
In general, the characteristic equation is of the form of TXYYXA ⊕=),( .
Definition 8: The two functions )(Xf and )(Yg are NPN-equivalent, denoted by
gf ≡ , if there is a characteristic equation ),( YXA such that the following formula
is true.
))(),()(( YgYXAXf pYXp ∃⊕∀∃
30
Chapter 3. Functional Symmetries
In this section we discuss variable symmetries in Boolean functions. First we provide
a rigorous framework and a general definition of symmetry using transformations.
An important theorem will be presented that provides valuable knowledge about how
to handle symmetries in Boolean function.
3.1 Introduction
Symmetries usually refer to permutations of an object’s parameters that leave it
unchanged. Functional symmetries provide significant benefits for multiple tasks in
synthesis and verification. As will be explained in detail later in this document,
concepts of Boolean matching and symmetry are closely related. In the Boolean
matching algorithm that will be provided in this document, this relationship
manifests itself in two levels. First, simple types of symmetries (that are inexpensive
to discover) are utilized to reduce the complexity of the Boolean matching algorithm.
Second, the proposed Boolean matching algorithm will generate (as a bi-product) the
remaining (more complicated) symmetries.
Symmetries provide insights into the structure of the Boolean function that can be
used to facilitate operations on it. They can also serve as a guide for preserving that
31
structure when the function is transformed in some way. In the context of Boolean
matching problem, symmetries that we explore are variable permutations, with
possible complementation that leave the function unchanged.
3.2 Prior Work
In the presence of functional symmetries, several design problems (e.g., circuit
restructuring, checking satisfiability, and computing sequential reachability) are
considerably simplified. Hence, interest in functional symmetries has been keen
since the early days of logic design [33]. In the context of logic synthesis which we
view as a process that transforms an initial representation of the function (e.g., sum
of products representation or binary decision diagram representation) into a final
implementation as a multi-level Boolean network of primitive cells selected from a
given ASIC cell library, when guided by knowledge of functional symmetries, such a
process yields higher quality circuit realizations of the function [23].
In [10] functional symmetry is exploited to optimize a circuit implementation for low
power consumption and delay under an area increase constraint.
Another benefit of knowledge about functional symmetries is that it can help
produce better variable orders for Binary Decision Diagrams (BDDs) and related
data structures (e.g., Algebraic Decision Diagrams). The size of the BDD of a
Boolean function can be significantly reduced if symmetric variables are placed in
adjacent positions. Based on this observation a specialized sifting procedure for
32
dynamic variable ordering was proposed in [32]. This plays a crucial role in
symbolic model checking.
Algorithms for state space traversal, which are key in formal property checking, can
significantly benefit from exploiting symmetry of the state transition relation [18].
Symmetries were also utilized to improve the efficiency of functional equivalence
checking, especially for functions with unknown input correspondence [9].
The study of symmetries in Boolean functions dates back to [33] who recognized
that symmetric functions have particularly efficient switch network implementations.
Much of the existing literature on symmetry is based on function invariance under
swaps of variable pairs in the function’s support; we’ll refer to this type of symmetry
as simple symmetry to distinguish it from the more general symmetry we describe in
this chapter. For completely-specified functions, simple symmetry can be
represented as a partition on the set of variables: variables that belong to a given
block of that partition are equivalent, i.e. symmetric, whereas variables that belong to
different blocks are non-equivalent, i.e. non-symmetric. The blocks of such a
partition are referred to as the function’s symmetry classes, and variables within a
symmetry class are equivalent in the sense that they can be permuted arbitrarily
without changing the value of the function.
The advent of BDDs led to the development of efficient symbolic methods for the
identification of a function’s symmetry class. The computational core in such
algorithms is the check that determines the equivalence of a pair of variables; larger
33
symmetry classes are then built incrementally using transitivity. Many of the
recently-proposed techniques for symmetry identification achieve their efficiency
through careful analysis of the structure of the BDD that represents the function
[30][32][38]. In [35], the authors approach this problem by using the generalized
Reed-Muller transform to speed up computation of symmetries. A notable exception
to the commonly used definition of symmetry was proposed in [31]. Rather than
invariance under swaps of variables, symmetry is defined in terms of equivalence
among arbitrary subspaces (i.e. cofactors) of the function.
Functional symmetries are useful in physical design domain as well. C. W. Chang et
al. [7] propose a method to detect and use functional symmetries as the foundation
for logic rewiring with application to delay, power and reliability optimization.
K. H. Chang et al. [8] present rewiring, rebuffering, and post-placement optimization
that reconnects pins of a given netlist without changing the logic function and gate
locations by exploring functional symmetries. Their exhaustive search method, as
one would expect, results in significantly longer runtimes (in order of seconds)
compared to the proposed approach.
In this section we define symmetry as an invariance under arbitrary variable
permutation (and/or phase assignment) rather than invariance under swaps of
variable pairs. Under this broader definition, partitions on the set of variables fail to
capture all the invariant input permutations.
In this dissertation we study symmetries in the most general from i.e., considering
34
input permutation, input phase assignment, and output phase assignment which to the
best of our knowledge has not been studied thoroughly enough in the past.
3.3 General Form of Symmetry
Definition 9: A function )(Xf where ),,,( 21 nxxxX K= is symmetric with respect
to an NP transformation nT Γ∈ on its inputs if there exists an output phase
assignment Bq∈ such that )()( TXfXf q= .
We will refer to such a transformation a symmetry-producing (SP) transformation
and denote the set of all SP transformations by fS .
})()(,{ TXfXfqTS qnf =∃Γ∈= .
We will show fS is sub-group of nΓ . Clearly nfS Γ⊂ . Also the identity
transformation is a member of fS i.e., fSI ∈ .
The relation
)()()()( 1 XfXTfTXfXf qq =⇔= −
Implies that
ff STST ∈⇔∈ −1
One can easily verify that fS is closed with respect to cascade operation and since
we previously proved that cascade operation is associative. Hence,
35
)()()()(),()( 12212121 XTTfXfXTfXfXTfXf qqqq ⊕=⇒==
Therefore, fS is a sub-group of nΓ .
Notice that the definition of fS (unlike nΓ ) is dependent of the function )(Xf .
3.4 Simple Symmetry
As mentioned before, some types of symmetry are easily detectable and are
discovered before the Boolean matching algorithm. We start by discussing these
types of symmetries.
Definition 10 (Simple Symmetry): For a function )(Xf where ),,,( 21 nxxxX K= ,
two variables ix and jx are said to be symmetric, denoted as ji xx ≡ , if )(Xf is
invariant under an exchange of ix and jx i.e.,
),,,,,,(),,,,,,( 11 nijnji xxxxfxxxxf KKKKKK = .
In the case of simple symmetry, the phase of the output always remains unchanged.
The NP transformation fP ST ∈π associated with this simple symmetry has the
following effect:
),,,,,,(),,,,,,( 11 nijnjiP xxxxxxxxT KKKKKK =π .
Which corresponds to the identity phase assignment )1,,1,1(1 K==P and
permutation π :
ji =)(π
36
ij =)(π
kkjik =⇒∉ )(},{ π
A similar type of simple symmetry between variables ix and jx is when the
following condition holds:
),,,,,,(),,,,,,( 11 nijnji xxxxfxxxxf KKKKKK = .
In this case we use notation ji xx ≡ or equivalently ji xx ≡ . We will refer to ix and
jx as being symmetric in this case as well.
The corresponding transformation is PT ′π where π was defined above.
),,,,,,(),,,,,,( 11 nijnji xxxxxxxx KKKKKK =π
The phase assignment P′ is as follows.
0)( =′ iP
0)( =′ jP
1)(},{ =′⇒∉ kPjik
In this case we use notation ji xx ≡ , or equivalently, ji xx ≡ . We shall refer to ix and
jx as being symmetric in this case as well.
Example: For the function ))(()( 4321 xxxxXf ++= we have 21 xx ≡ and 43 xx ≡ .
To account for both types of symmetries with a consistent notation, we use pji xx ≡ .
When 1=p , the expression indicates that ji xx ≡ whereas 0=p implies that ji xx ≡
37
i.e.,
),,,,,,(),,,,,,( 11 npi
pjnji
pji xxxxfxxxxfxx KKKKKK =⇔≡ .
Variables ix and jx are called symmetric if pjip xx ≡∃ . We will use p
ijW (or pjiW ) to
denote the NP transformation
),,,,,,(),,,,,,( 11 npi
pjnji
pij xxxxxxxxW KKKKKK =
With this notation
fp
ijpji SWxx ∈⇔≡ .
We will also refer to simple symmetry as first level symmetry as opposed higher
level symmetries that will be defined later.
It is well known, as can be readily shown using Boole’s expansion theorem, that
condition pji xx ≡ is equivalent to the following equality constraint on the function’s
cofactors.
pjip
ji xxxxff ≡
This equation serves as the computational check for first-order symmetry between
variables ix and jx in function )(Xf .
Lemma 1: qpik
pij
qjk
pij WWWW ⊕= .
Proof: Obviously transformation pij
qjk
pij WWW only affects variables ix , jx and kx .
llp
ijqjk
pij xxWWWkjil =⇒∉ )(},,{
38
As for variables ix , jx and kx ,
qpk
qpk
pij
pj
qjk
piji
pij
qjk
pij xxWxWWxWWW ⊕⊕ === )()()(
jpp
jpi
pij
pi
qjk
pijj
pij
qjk
pij xxxWxWWxWWW ==== ⊕)()()(
qpi
qj
pijk
qjk
pijk
pij
qjk
pij xxWxWWxWWW ⊕=== )()()(
which proves that qpik
pij
qjk
pij WWWW ⊕= . ■
Lemma 2 (variable symmetry is transitive): The following transitive property
holds for simple symmetry:
qpki
qkj
pji xxxxxx ⊕≡⇒≡≡ ,
Proof: The symmetric relation pji xx ≡ implies that f
pij SW ∈ (or )()( XWfXf p
ij= )
where,
),,,,,,(),,,,,,( 11 npi
pjnji
pij xxxxxxxxW KKKKKK =
And qkj xx ≡ results in f
qjk SW ∈ .
Since fS subgroup is a subgroup,
fp
ijqjk
pijf
qjkf
pij SWWWSWSW ∈⇒∈∈ ,
Since qpik
pij
qjk
pij WWWW ⊕= , the following relation concludes the proof.
qpkif
qPik xxSw ⊕⊕ ≡⇒∈ ■
The past two Lemmas lead to the following Theorem.
39
Theorem 1: Variable symmetry is an equivalence relation.
Proof: Variable symmetry is reflexive, commutative and transitive; hence it is an
equivalence relation. ■
3.5 Symmetry Classes
From theorem 1, symmetry relation, pjip xx ≡∃ , is an equivalence relation. Hence, it
is possible to partition variables nxxx ,,, 21 K into equivalence classes, which we will
refer to as symmetry classes. There are a number of algorithms in literature for
generating maximal symmetry classes e.g., [30]. An overview of such a procedure,
which is composed of two nested loops that iterate on the variables, is as follows. We
denote symmetry classes by mCCC ,,, 21 K , where m is the number of classes. The
first step is to create }{ 11 xC = where 1x is considered the seed variable for class 1C .
Next, every variable ix that is symmetric to 1x will be added to 1C . The first
remaining variable, say jx , is used to initialize }{2 jxC = . Next, symmetric variables
to jx are added to 2C . This procedure continues until all variables are partitioned
into symmetry classes mCCC ,,, 21 K . Symmetry classes will include all information
about simple symmetries. For example, given symmetry classes mCCC ,,, 21 K , one
can infer that if kji Cxx ∈, , then there exists a phase assignment Bp∈ such that
pji xx ≡ . However, the symmetry classes do not include information as to whether
40
1=p or 0=p .
One way to include phase information in symmetry classes is to choose appropriate
phases for variables while forming classes one at a time. For example, consider a
class iC with seed ij Cx ∈ . If there exists a variable kx that is symmetric to jx i.e.,
pkj xx ≡ then literal p
kx will be added to iC . This is because we chose positive phase
jj xx =1 for the seed of iC . If we were to choose jj xx =0 as the seed of iC , then in the
case of pkj xx ≡ literal p
kx will be added to iC since pkj
pkj xxxx ≡⇒≡ . Suppose
},,,{ 2121
kpk
ppi xxxC K= is a symmetry class generated in this manner. Based on the
previous discussion, negating the phases of the literals },,,{ 2121
kpk
pp xxx K will create
an alternate symmetry class of the same variables. We shall denote this alternate
class by iC which introduces the notion of phase assignment for symmetry classes
i.e.,
}{ ipj
qpj
qi CxxC jj ∈= ⊕ .
The algorithm for generating first-level symmetry classes is given below. In this
algorithm, we choose positive phases for the seeds of all classes.
Algorithm Gen_1st_Order_Symm ( )
1←i ; while {}≠X do {
{}←iC ; select Xx∈ ;
41
for Xy∈∀ do {
if ( pyx ≡ ) then }{ pii yCC ∪← ;
} iCXX −← ;
1+← ii ; }
For the symmetry classes generated in this manner, literals of a class do not require
any phase assignment to become symmetric (the current phases of literals will be
fine) i.e.,
jiji pj
pik
pj
pi xxCxx ≡⇒∈, .
Example: For function ))(()( 4321 xxxxXf ++= , there exist two symmetry classes:
},{ 211 xxC = and },{ 432 xxC = .
In the remainder of this document we shall denote literals by simple letters such as x
or y which does not necessary mean that the phase of literal is positive. With this
convention the previous relation may be written as:
yxCyx k ≡⇒∈, .
The classes generated by Gen_1st_Order_Symm are maximal in the sense that for
every class iC no other literal iCy∉ is symmetric to the literals of the class iC i.e.,
ii CyyxCx ∈⇒≡∈ ,
So far we have discussed simple symmetries which correspond to NP
transformations that involve only two variables. In the sequel we present a key
42
theorem, which provides a valuable insight for handling and enumerating
symmetries. First, we present a lemma that will be useful in proving the main
theorem.
3.6 Relation between Simple and General Symmetries
In the following we will denote the kth element of vector TX by kTX][ . Furthermore,
pkTX][ will denote p
kTX )]([ .
Lemma 3: For any NP transformation nPT Γ∈π and n
qijW Γ∈ ,
qji
Pqij
P WTWT ′− = )()(1)( ππππ
where
)()( ji ppqq ππ ⊕⊕=′ .
Proof: Based on previous discussions
)()(][ kp
kkP xXT π
ππ =
kk pk
p
kkP xxXT )()(
11
))((1
1])[( −
−
− ==−πππ
ππ
We compute kPq
ijP XTWT ])[( 1
ππ− for different values of },2,1{ nk K∈ . First we consider
values of k such that )}(),({ jik ππ∉ and then deal with )}(),({ jik ππ∈ .
For )}(),({ jik ππ∉ ,
kpp
kp
kPp
kPq
ijkPq
ijP xxXTXTWXTWT kkkk ==== −
−−−− )(][][])[( ))(1(
111 ))(()()(1 ππ
ππππππππ
43
The second equality follows from },{)(1 jik ∉−π .
For )(ik π= ,
qj
ppqj
pqj
Ppi
Pqiji
Pqij
P xxXTXTWXTWT jiii ′⊕⊕⊕− ==== )()()(1 )()()()( ][][])[( πππππππ
ππππ
In addition, for )( jk π= ,
qi
ppqi
pqi
Ppj
Pqijj
Pqij
P xxXTXTWXTWT ijjj ′⊕⊕⊕− ==== )()()(1 )()()()( ][][])[( πππππππ
ππππ
Hence we showed that
),,,,,,(),,,,,,()( )()(1)()(11
nq
iq
jnjiPq
ijP xxxxxxxxTWT KKKKKK ′′− = ππππππ
which proves that
qji
Pqij
P WTWT ′− = )()(1)( ππππ . ■
Let ix and jx denote two symmetric variables of function )(Xf . Consider a general
symmetry relation that involves more than two variables i.e., consider
)()( XTfXf Pπ= . In the following we will explore the effect of n
P ST ∈π on symmetric
variables.
Every NP transformation nPT Γ∈π on X can be regarded as a mapping function on
literals with the specification
)()()( ip
iiP xxT π
ππ = .
We define the effect of NP transformation PTπ on literal qix as
qi
Pqi
P xTxT ))(()( ππ = .
44
Lemma 4: Let function )(Xf be symmetric with respect to NP transformation PTπ
i.e., fP ST ∈π ; Mappings of two symmetric variables ix and jx under PTπ are
symmetric i.e.,
qj
Pi
Pqji xTxTxx ))(()( ππ ≡⇔≡ .
Proof: Since fS is a subgroup,
fP
fP STST ∈⇒∈ −1)( ππ
Furthermore, since variables ix and jx are symmetric,
fq
ijqji SWxx ∈⇒≡
Based on the previous Lemma and the fact that nS is a subgroup,
fPq
ijPq
ji STWTW ∈= −′ππππ
1)()( )(
Where
)()( ji ppqq ππ ⊕⊕=′
which proves that qji xx ′≡ )()( ππ .
By applying phase assignment )(ipπ to both sides of qji xx ′≡ )()( ππ , one obtains
)()()()()()(jii p
jpq
jp
i xxx ππππππ =≡ ⊕′ or q
jP
iP xTxT ))(()( ππ ≡
which proves the lemma ■
Now we will investigate the effect of NP transformation fP ST ∈π on simple
45
symmetry classes. The range of an NP transformation T on a symmetry class (or any
other subset of literals) is defined as
})({)( kk CxxTCT ∈=
where x in general represents a literal (with positive or negative phase) rather than a
variable i.e. there is variable ix with phase p such that pixx = .
Theorem 2: Let function )(Xf be symmetric with respect to NP transformation T
i.e., fST∈ and let kC be a first order maximal symmetric class of variables of
)(Xf . The range of T on kC (i.e., )( kCT ) will be a maximal symmetry class.
Proof: First we will show that any two literals x and y of )( kCT are symmetric.
)()()(),()(, 1111 yTxTCyTxTCTyx kk−−−− ≡⇒∈⇒∈
Recall that for two literals in a symmetry class, the symmetry does not require
additional phase assignment since appropriate phases have already been assigned to
the literals while generating the symmetry classes.
Based the previous Lemma, the relation )()( 11 yTxT −− ≡ results in,
yxyTTxTT ≡⇒≡ −− )()( 11
Now we will prove that )( kCT is maximal by showing if there is a literal y
symmetric to literal )( kCTx∈ (i.e., yx ≡ ), then y is a literal in )( kCT .
Since fS is subgroup,
46
ff STST ∈⇒∈ −1
From the previous lemma,
)()( 11 yTxTyx −− ≡⇒≡
From )( kCTx∈ it can be seen that kCxT ∈− )(1 and since kC is maximal:
)()()()( 111kk CTyCyTyTxT ∈⇒∈⇒≡ −−−
This proves the theorem. ■
The theorem has a strong implication, that is, any NP transformation fP ST ∈π maps
maximal symmetry classes to other maximal symmetry classes. This result can be
considered as a constraint for any fP ST ∈π . It is especially important in the process of
identifying NP transformations of fS since it will limit the space of transformations
to be explored. In other words, to explore possible NP transformations fP ST ∈π , it is
sufficient to only explore NP transformations that are specified in terms of higher
order symmetry classes instead of individual variables. Since the number of classes
is usually considerably fewer than the number of variables, this theorem tends to
greatly reduce the search space.
Let mCCC ,,, 21 K represent the maximal symmetry classes for variables of )(Xf .
The corresponding NP transformation fP ST ∈π must satisfy
jiji CCTCC =∃∀ )(,
47
3.7 Hierarchical Symmetries
Swaps of variable pairs (with possible phase assignment) can be extended in a
straightforward manner to swaps of literal of simple symmetry classes. For example,
if literals Xdcba ⊂},,,{ create simple symmetry classes },{ baCi = and },{ dcCj =
and )(Xf satisfy the condition:
),,,,,,,,(),,,,,,,,( KKKKKKKKKK badcfdcbaf =
then we say there is hierarchical symmetry between },{ baCi = and },{ dcCj = . We
will refer to hierarchical symmetry as higher order symmetry. In this case the
symmetry between },{ baCi = and },{ dcCj = is of second order since the symmetry
is defined between first order classes.
The formal definition of second order symmetry is a follows.
Definition 11: Let iC and jC be two maximal symmetry classes for function )(Xf
and |||| ji CC = where || iC denotes the number of members of iC . Let’s T be a
transformation satisfying the following conditions:
qji CCT =)(
qij CCT =)(
kkjik xxTCCx =∉∀ )(,U
Then iC and jC are second order symmetric (denoted by qji CC ≡ ) if )(Xf is
invariant under transformation T on X .
48
qji CCTXfXf ≡⇔= )()(
Notice that if the phase of literals of jC are assigned properly there is no need for the
phase assignment q i.e., with proper representation of classes we can always
describe the symmetry between classes by ji CC ≡
In the case of simple symmetry we presented an equality constraint on the function’s
cofactors which can serve as the computational check for first-order symmetry.
In this part we will present a similar symmetry check for second order symmetry.
Consider first order symmetry classes },,,{ 21 kaaaA K= and },,,{ 21 kbbbB K= where
ia and ib in general are literals (positive or negative phase.) For class A will create
the following cubes.
kk aaaaau 13210 −= L
kk aaaaau 13211 −= L
kk aaaaau 13212 −= L
M
kkk aaaaau 13211 −− = L
kkk aaaaau 1321 −= L
As can be seen in cube iu exactly i literals are negated i.e.,
kkiiii aaaaaaaau 111321 −+−= LL
49
Similarly cubes kvvvv ,,,, 210 K are created for class B as well.
kkiiii bbbbbbbbv 111321 −+−= LL
The second order symmetry relation BA ≡ can be equivalently described by the
following cofactor constraints.
ijji vuvu ffkji =∈∀ },,,2,1{, K
There are ⎟⎟⎠
⎞⎜⎜⎝
⎛2k
pairs ),( ji and it is not necessary to check ),( ii pairs. Hence the
number of cofactor constraint checks is 2
)2(2
−=−⎟⎟
⎠
⎞⎜⎜⎝
⎛ kkkk
.
ijji vuvu ff = for jikji <∈ },,,2,1{, K
Notice that the dependency of a function f on a symmetry class A is through the
number of literals of A that evaluate to 1. Since all literals of a class are symmetric
to each other iu could be defined as a cubes in which exactly i literals are negated
and it does not make a difference as to which i literals are negated. Hence the above
constraints ensure many more cofactor constraints which eventually result in a proof
for the equivalency of the above constraint to second order symmetry relation.
Similar to first order symmetry, second order symmetry is also an equivalence
relation. Hence first order classes mCCC ,,, 21 K are partition to second order
symmetry classes. These facts can be generalized for higher order symmetries. The
concept of hierarchical symmetry will be explained recursively.
50
Definition 12: A kth order class is set of (k-1)th order classes that are symmetric to
each other. (The notion of symmetry in general will be defined later) A single literal
is considered a zeroth order class.
To discuss the symmetry of hierarchical classes we need to introduce the concept of
structural compatibility between classes.
Definition 13: Two kth order classes A and B are structurally compatible if they
include the same number of (k-1)th order classes i.e., |||| BA = and any two (k-1)th
order classes AC∈ and BD∈ are compatible. Any two zeroth order classes are
considered compatible.
Definition 14: Let A and B be two compatible classes for function )(Xf and T be
a transformation satisfying the following conditions:
BCTAC ∈⇒∈ )(
ADTBD ∈⇒∈ )(
EETBAE =⇒∉ )(U
Where E represent any class of any order not included (hierarchically) in A or B .
Then A and B are symmetric if f is invariant with respect to T .
BATXfXf ≡⇔= )()(
As mentioned before, in the case of general symmetry there might be an output phase
assignment i.e., )()( TXfXf q= ; however for first and higher order symmetries as
defined the output phase does not change )()( TXfXf = .
51
Based on these definition simple symmetry is a special case of hierarchical
symmetry. In the remainder of this dissertation when we refer to a class as
hierarchical there is a possibility for that class to be of first or higher order.
The following Theorem is the generalization of the previously presented Lemma and
Theorem in this chapter. Notice that )(AT is defined as })({)( ACCTAT ∈= .
Theorem 3: Let function )(Xf be symmetric with respect to transformation T i.e.,
fST∈ ; then if A is a symmetric class of )(Xf then )(AT will also be a symmetric
class of )(Xf . Also mappings of two symmetric classes A and B under T are
symmetric.
)()( BTATBA ≡⇔≡
As mentioned before, one of the important applications of this theorem is as follows.
For the purpose of identifying all members of fS first the hierarchical symmetry
classes are created. Besides the symmetry relations implied inside the classes
themselves, this theorem indicate that the necessary condition for a transformation to
be in fS is satisfying the conditions of the theorem. This fact will significantly limit
the search space for identifying transformations of fS .
52
53
Chapter 4. Signatures and Signature Vector
The canonical form proposed in this dissertation is based on the signatures vector of
a Boolean function. Hence in this section we define the signature vector and explain
some of its properties.
4.1 Introduction
Conventionally, a signature (a filter or a necessary condition) is defined as some
characteristics of a Boolean function with respect to one of its input variables. We
shall refer to such a signature as a first order signature (or 1st-signature) since it only
depends on one input variable. First order signatures have been used to identify
variables that can be exchanged (permuted) without affecting the function itself, i.e.,
any possible correspondence between the input variables of two functions is
restricted to a correspondence between variables with the same 1st-signature. So, if
each variable of a function has a unique 1st-signature, then there can be at most one
possible correspondence to any of the variables of some other function.
That is why the quality of any 1st-signature is characterized by its ability to be a
unique identification of a variable of a function and, of course, by its ability to be
computed fast. The 1st-signatures that have been introduced in literature differ in
54
terms of their quality figure. Although the 1st order signatures have been successful
in a large number of practical cases, they do not utilize the full potential of signatures
in the Boolean matching problem. There is no set of 1st-signatures that can uniquely
identify all the variables. However, this goal can be achieved by using higher order
signatures as described below.
The 1st-signatures have been traditionally defined for variables. However, since we
intend to consider phase assignment in addition to permutation of input variables, we
define the 1st-signatures for literals (as opposed to variables.)
For a function )(Xf a first order signature for literal x denoted by )),(( xXfs
should satisfy the following requirement.
))(),(()),((, xTTXfsxXfsT n =Γ∈∀
That means that a 1st-signature for an input variable x of a Boolean function )(Xf
is a description of x which provides special information about that variable in terms
of )(Xf . Furthermore, it is very important, that this information is independent of
any transformation of the inputs of )(Xf i.e., if a transformation T maps the literal
x to y , then the signature of x in )(Xf must be the same as the signature of y in
)(TXf .
A 1st-signature may be a value or a collection of values as well as a special function.
There are a number of other 1st-signatures that have been used in practice.
A well-known 1st-signature for a literal x of a Boolean function )(Xf is the
55
“minterm” count of the ONSET of the cofactor of this function w.r.t. x i.e, || xf .
In pair-wise matching methods (for checking P-equivalence), a 1st-signature must be
able to make out an input variable ix independent of input variable permutation so
that it can establish a correspondence between variable ix of )(Xf with a variable
jx of some other Boolean function )(Xg . It only makes sense to try to establish a
correspondence between these two variables only if variable ix of )(Xf has the
same 1st-signature as variable jx of )(Xg .
It only makes sense to establish a correspondence between these two variables, if
variable ix of )(Xf has the same 1st-signature as variable jx of )(Xg .
The main idea of this pair-wise matching approach is clear: If we are able to compute
a unique signature for each input variable of )(Xf , then the variable mapping
problem will have been solved – there is only one or no possible variable
correspondence for P-equivalence of function )(Xf with any other function )(Xg .
If we find for each variable of )(Xf a variable of )(Xg that has the same unique
signature, then we will have established a correspondence. Otherwise, we will know
immediately that these two functions are not P-equivalent.
The main problem that arises in this paradigm is when more than one variable of a
function )(Xf has the same 1st-signature, it is not possible to distinguish between
these variables, i.e. there is no unique correspondence that can be established with
the inputs of some other function.
56
Pervious researchers have used the notion of signatures to address the Boolean
matching problem. For example in [29] authors have introduced “universal
signatures”. A universal signature is defined in terms of a single variable. However,
in this dissertation we introduce a signature vector which is defined for a function
with respect to all variables rather than a single variable. For some functions such
signatures, will fail to conclude a canonical form. For example in function
414332214321 ),,,( xxxxxxxxxxxxf +++= the universal signatures of 4321 ,,, xxxx
will be the same; hence it would be impossible to derive a canonical form for this
function using universal signatures. Miller [26] and Clarke et al. [12] have used
Walsh spectrum for addressing the Boolean matching problem. This method requires
the computation the entire Walsh spectrum (an integer vector of size 2n for an n-
input function) and processing this vector while in the proposed method only a small
portion of the signature vector which is necessary for computing the canonical form
are calculated.
In this document we will generalize the concept of first order signatures to higher
order signatures and signature vector that have complete expressive power to handle
the Boolean matching problem. However the expressive power of the signature
vector is not the only motivation for this approach. The main incentive is that the
canonical form defined by using the proposed signature vector possesses several
important properties, which significantly reduce the computational complexity of
obtaining the canonical form.
57
In this document we will generalize the concept of first order signatures to higher
order signatures that have complete expressive power to handle the Boolean
matching problem.
Recall that a cube (product term) is the conjunction of some literals. Let kaaa ,,, 21 K
be literals created from variables nxxx ,,, 21 K i.e.,
pjiji xapxa =∃∃∀ ,,,
with the restriction that both phases of the same literal are not present in kaaa ,,, 21 K
i.e., for each variable ix at most one of literals ix and ix belong to },,,{ 21 kaaa K .
4.2 Generalized Signatures
Definition 15: The kth order signature of function )(Xf with respect to literals
kaaa ,,, 21 K is the minterm count of cofactor of )(Xf with respect to cube
kaaaq K21= i.e., |)(| qq Xf where qX denotes those variables of X that are not in
},,,{ 21 kaaa K in any phase. The 0th order signature is |)(| Xf .
We will refer to a cube kaaaq K21= as a positive cube if literals kaaa ,,, 21 K are in
their positive phases i.e., jiji xaxa =∃∀ ,, , or equivalently,
},,,{},,,{ 2121 nk xxxaaa KK ⊂ .
We also refer to signatures associated with positive cubes as positive signatures.
With respect to variables nxxx ,,, 21 K , the number of k-literal cubes (or the number of
58
kth-order signatures) is k
kn
2⎟⎟⎠
⎞⎜⎜⎝
⎛ whereas the number of positive kth-order signatures is
)!(!!
knkn
kn
−=⎟⎟
⎠
⎞⎜⎜⎝
⎛ .
In the following we introduce a method to enumerate positive signatures of function
)(Xf .
A k-literal cube can be presented as k
xxxq ααα L21
= where
},2,1{},,,{ 21 nk KK ⊂ααα .
We impose the constraint that kααα <<< K21 . Obviously, for each k-literal cube it
is always possible to find kααα ,,, 21 K that satisfy this constraint.
Before we proceed further, we must define the lexicographical comparison of two
vectors.
4.3 Total Ordering on Cubes
Definition 16: Consider two vectors ),,,( 21 kA ααα K= and ),,,( 21 kB βββ K= where
},2,1{},,,{ 21 nk KK ⊂ααα and },2,1{},,,{ 21 nk KK ⊂βββ . Let i be the smallest index
such that ii βα ≠ . Then the order relation ‘p ’ between A and B is defined as
BAii p⇒< βα
With this definition, an order relation can be defined between k-literal positive cubes.
Definition 17: Consider two cubes
59
kxxxqA ααα L
21= where nk ≤<<<≤ ααα K211
kxxxqB βββ L
21= where nk ≤<<<≤ βββ K211
The order relation ‘p ’ between Aq and Bq is defined as
BAkk qq pKpK ⇒),,,(),,,( 2121 βββααα .
We denote the set of all k-literal positive cubes by
}1{ 2121nxxxQ k
kk
≤<<<≤= αααααα KL .
Since we have defined an ordering for members of kQ , these members (which
correspond to k-literal positive cubes) can be represented as kn
kkk
qqq ,,, 21 K where the
superscript k indicates the number of literals in each cube and the following
ordering is satisfied by their indices:
kn
kkk
qqq pKpp 21 .
Notice that
)!(!!||
knkn
kn
Qn kk −
=⎟⎟⎠
⎞⎜⎜⎝
⎛== .
Every possible positive cube can be denoted as kiq . The set of all positive cubes is
denoted by
}1,1{210k
ki
k ninkqQQQQQ ≤≤≤≤=∪∪∪∪= L .
Now we extend the definition of ordering to members of Q . For two cubes kiq and
60
ljq if lk ≠ then
lj
ki qqlk p⇒<
Now, if lk = then
lj
ki qqji p⇒< .
In this ordering, single literal cubes appear first followed by two literal and higher
literal cubes i.e.,
}n
n
n
n
Q
nn
Q
nn
nn
Q
n
Q
n qqqqqqqqqqq p444 8444 76pKpppKp
444 8444 76pKppp
444 8444 76pKppp
1
1
2
1
1
1
112
11
222
21
112
11
01
−
−
−−−
which can also be represented as (except for {}01 =q ):
48476Lp
44444 844444 76LpKpLpKp
4444 84444 76pKppp
44 844 76pKpp
nn Q
n
Q
nn
Q
nn
Q
n xxxxxxxxxxxxxxxxxx 21321211312121
121 −
−−
We are now ready to introduce the signature vector for a function )(Xf .
4.4 Signature Vector
Definition 18: For the function )(Xf where ),,,( 21 nxxxX K= with positive cubes
kiq , the signature vector denoted by fV is defined as follows:
|)|,||,|,||,|,,||,|,||,|,||,|,||,||,(|)1(21
11
12
11
22
22
21
11
12
11
nnn
nd
nnn
nn
nd
n
st
n q
signaturesn
qqq
signatures
qqq
signatures
qqqf fffffffffffV
4444 84444 76KK
444 8444 76K
444 8444 76K
−−−−
−−
−−=
which can equivalently be presented as:
61
)||,|||,...,|,...,|||,...,||,|,|||,...,||,||,(|signaturen
...
signatures)1(
......
signatures2signatures1 th
1
th
211
nd
13121
st
21
876444 8444 764444 84444 76444 8444 76 −−−−−
−−=
nnnnnn xx
n
xxxxxxxxxxxxxf ffffffffffV
In the following we present an important theorem, which proves that the signature
vector of a function is unique i.e., two different functions have different signature
vectors i.e.,
)()( XgXfVV gf =⇔= .
To prove this claim, we first prove that values of all signatures of all orders can be
obtained from the signature vector (which only include positive signatures.) This
vector eventually specifies the function )(Xf uniquely for all nBX ∈ .
Lemma 5: Values of all kth-signatures can be uniquely obtained from the (k-1)th-
signatures and positive kth-signatures.
Proof: Given all (k-1)th-signatures and positive kth-signatures we want to prove that
all kth-signatures can be computed. A kth-signature in general can be denoted by || qf
where k
k
ppp xxxq ααα L2
2
1
1= , },,2,1{ ni K∈α and Bpi ∈ . The proof is by induction on the
number of negative literals of k
k
ppp xxxq ααα L2
2
1
1= denoted by qN . The value of qN
ranges from 0 to k . For 0=qN , the cube is positive and since positive kth-signatures
are given, the claim is correct for 0=qN . Assume that it is correct for 1−=mNq
i.e., all kth-signatures associated with cubes of 1−m negative literals are computed.
Now we will compute the kth-signatures associated with cubes of m negative literals.
Let’s denote such a cube by k
k
i
i
i
i
i
i
pppppp xxxxxx αααααα LL 1
1
1
1
2
2
1
1
+
+
−
− . Assume that i
i
pxα is one of the
62
negative literals i.e., 0=ip . Let’s denote this cube by k
k
i
ii
i
i
ppppp xxxxxxq αααααα LL 1
1
1
1
2
2
1
1
00
+
+
−
−= .
Accordingly we create the cube k
k
i
ii
i
i
ppppp xxxxxxq αααααα LL 1
1
1
1
2
2
1
1
11
+
+
−
−= in which the phase of
ixα is positive. One can easily verify that
||||||01 qqq fff =+
where k
k
i
i
i
i
ppppp xxxxxq ααααα LL 1
1
1
1
2
2
1
1
+
+
−
−= . Hence ||
0qf can be computed as ||||||10 qqq fff −=
Since q is a (k-1)-literal cube and 1q contains 1−m negative literals the claim is
proven by induction. ■
Theorem 4: For a function )(Xf , signature vector fV uniquely and completely
specifies function )(Xf .
Proof: Since the signature vector includes all positive signatures, it can be seen that
the values of || qf can be computed for all possible cubes q by using induction on
the number of literals in q and the previous Lemma. However, for this proof, we are
only interested in n-literal cubes since they deliver sufficient information to specify
function f for all points nn Bppp ∈),,,( 21 K i.e., ||),,,( 21 qn fpppf =K where
npn
pp xxxq L2121= . ■
Based on this theorem, the necessary and sufficient condition for two functions
)(Xf and )(Xg to be equal is that |||| qq gf = for all positive cubes q (which are
presented in the signature vectors of )(Xf and )(Xg .)
In this part we investigate the implication of this theorem on the general symmetry
63
relation.
Consider NP transformation T which corresponds to the symmetry relation
)()( TXfXf = . Let’s denote )()( TXfXg = . Since functions )(Xf and )(Xg are
equal, their signature vectors are equal i.e., |||| qq gf = for all k
xxxq ααα L21
= .
The cofactors qf and qg can be expressed as
121)( =====
kxxxq Xffααα L
1)()()(11 212121)()()( ============ ===
kkk xTxTxTxxxxxxq XfTXfXggααααααααα LLL .
Let’s denote )( ii xTt = and k
tttqT ααα L21
)( = for k
xxxq ααα L21
= . The necessary and
sufficient condition for NP transformation T to be symmetric is
QqffTXfXf qTq ∈∀=⇔= ||||)()( )( .
Notice that if )()( TXfXf = , then |||| )(qTq ff = , where q denotes any cube (not only
a positive cube.) A result of the previous theorem is that it proves that a sufficient
condition for )()( TXfXf = is that |||| )(qTq ff = for positive cubes only. We will
revisit these results in future sections.
64
Chapter 5. Signature Vector based Canonical Form
In this section we present a canonical form for under NPN-equivalent functions,
which is useful for Boolean matching.
5.1 Introduction
As was proved in previous chapters, NPN-equivalence is an equivalence relation that
partitions the set of all single output Boolean functions into equivalence classes.
Let’s consider an NPN-equivalence class by
)}(,),(),({ 21 XfXfXfE mK=
Every two functions in E are symmetric to each other, i.e.,
)()()(,)( XfXfEXfEXf jiji ≡⇒∈∈
and any function symmetric to some function in E is also in E .
EXfXfXfEXf jjii ∈⇒≡∈ )()()(,)(
The Boolean matching problem under NPN-equivalence is reduced to that of
verifying whether or not two target Boolean functions, )(Xf and )(Xg , belong to
the same NPN-equivalence class.
65
5.2 NPN-Representative
In the canonical form based Boolean matching, a unique representative is selected
for every class called the NPN-representative of the class. Let’s denote the NPN-
representative of a class E by )(XF .
Definition 19: The NPN-representative )(XF of a class E is defined as the NPN-
representative (or the canonical form) of all functions )(,),(),( 21 XfXfXf mK in E .
Let’s denote the canonical form of a function )(Xf by )(XF (i.e., we use capital
letters for canonical forms.) We have: )()()()( 21 XFXFXFXF m==== K . Notice
that )(XF is one of )(,),(),( 21 XfXfXf mK i.e., EXF ∈)( .
The NPN-representative )(XF is selected among )(,),(),( 21 XfXfXf mK based on
some criteria that makes )(XF unique. For example, one way is to define a total
ordering for functions )(,),(),( 21 XfXfXf mK and select the maximum or minimum
(with respect to the defined order) as the NPN-representative (canonical form.)
Observation: Two functions )(Xf and )(Xg are NPN-equivalent if and only if
they have the same canonical form i.e.,
)()()()( XGXFXgXf =⇔≡
The NPN-equivalence class that includes a function )(Xf , denoted by fE is the set
of all functions that are NPN-equivalent to )(Xf . Hence fE can be created by
applying all NP transformations and output phase assignments to )(Xf i.e.,
66
},)({ nq
f TBqTXfE Γ∈∈=
The number of different NP transformations and output phase assignments to )(Xf
is !2|||| 1nB nn
+=Γ× ; However || fE is in general less than |||| nB Γ× because of the
symmetry relations discussed in previous chapters.
Since )(Xf and )(XF are NPN-equivalent, there is an NP transformation T such
that )()( XFTXf qq =∃ ; however, T is not the only such NP transformation.
Definition 20: We call the set of NP transformations T such that )()( XFTXf qq =∃ ,
the canonicity-producing (CP) transformations :
)}()(,{ XFTXfqTC qnf =∃Γ∈=
We present an algorithm to compute the canonical form of a given NPN-equivalence
class as well as the set of all CP transformations fC . We will show that the set of
symmetry-producing (SP) transformations fS can be easily obtained from fC . The
importance of identifying all NP transformations in fS was explained in the previous
section.
For any set nS Γ⊂ of NP transformations and transformation nT Γ∈ , we define TS
and ST as follows:
}{ STTTTS ∈′′=
}{ STTTST ∈′′=
67
If nS Γ⊂ is a subgroup, then TS is called the left coset of S determined by T and
ST is called the right coset of S determined by T .
Lemma 6: For function )(Xf , let T and T ′ be two CP transformations. 1−′TT is a
SP transformation i.e.,
fff STTCTCT ∈′⇒∈′∈ −1, .
Proof: Clearly,
)()(, XFTXfqCT qf =∃⇒∈
)()(, XFXTfqCT qf =′′∃⇒∈′ ′
which result in
fqqqq STTXTTfXfXTfTXf ∈′⇒′=⇒′= −−′⊕′ 11 )()()()( . ■
Theorem 5: For function )(Xf and any CP transformation T , fC is the right coset
of fS determined by T i.e.,
TSCCT fff =⇒∈ .
Proof: First we prove that ff CTTST ∈⇒∈ 11 :
TTTSTTST ff ′=∈′∃⇒∈ 11 ,
)()()()()(, 1 TXfTXTfXTfXfXTfqST qqf
′′ =′=⇒=′′∃⇒∈′
)()(, XFTXfqCT qf =∃⇒∈
fqqq CTXFTXfXTf ∈⇒==′⊕
11 )()()(
68
Now we prove that TSTCT ff ∈⇒∈ 11 .
Based on the previous Lemma
TSTTSTTTSTTCTCT fffff ∈⇒∈⇒∈⇒∈∈ −−1
11
111 ,
hence, TSC ff = .
It can be easily verified that
fffff STTSTCTSC ==⇒= −− 11
hence, for any fCT ∈ , 1−= TCS ff which shows that fS can be easily obtained
from fC . ■
The set of SP transformations, fS , includes transformations corresponding to simple
symmetries. In the algorithm that we will present next to identify CP transformations
fC , first simple symmetries are identified since the computational complexity is
relatively lower than that of general symmetries. This information is used efficiently
to compute fC . Next based on fC the remaining SP transformations of fS are
computed.
5.3 The Proposed Canonical Form
In this part the canonical form used in this document is formally defined. As
mentioned earlier, among functions of an NPN-equivalence class the NPN-
representative is selected based on a criterion that makes the representative unique
69
among all functions in the class.
We previously defined the signature vector for a function and proved that it is unique
for every function. We will define a total ordering for functions based on the
lexicographical comparison of their signature vector.
Definition 21: Consider two functions )(Xf and )(Xg with signature vectors fV
and gV , respectively. The order relation ‘p ’ between )(Xf and )(Xg is defined as:
)()( XgXfVV gf pp ⇔
The relation )( )( XgXf f means that )()( XgXf f or )()( XgXf = .
This ordering is well defined since we proved that )()( XgXfVV gf =⇔= .
An important aspect of the signature vector is that it enables us to compare functions
even if they are not functions of the same variable vector. The only requirement is
the size of their variable vectors should be the same. Consider functions )(Xf and
)(Yg where ),,,( 21 nxxxX K= and ),,,( 21 nyyyY K= , then f and g are equal (or
equivalent) if their signature vectors are equal i.e.,
gf VVgf =⇔=
Also for the order relation ‘p ’,
gf VVgf pp ⇔
Using this order relation, the NPN-representative (canonical form) is defined as
follows.
70
Definition 22: The NPN-representative of a class { })(,),(),( 21 XfXfXf mK of
functions is a function )( XF which is maximal with respect to the order relation,
’f ’ i.e.,
)( )(},,,2,1{ XfXFmi ifK∈∀
5.4 Properties of the Canonical Form
In this section we will observe some important properties of the proposed canonical
form that are used for the purpose of computing the canonical form.
Theorem 6: Let )( XF be the canonical form of an NPN-equivalence class E .
)( XF is greater than to that of its complement )( XF (which may also be denoted
by )( XF ) i.e.,
)( )( XFXF f .
Proof: Obviously )( XF and )( XF are NPN-equivalent, Therefore, they belong to
the same NPN-equivalence class i.e.,
EXFXFXFEXF ∈⇒≡∈ )()()(,)(
Since )( XF is the NPN-representative of class E , it is maximal i.e.,
)( )( XFXF f
Clearly, the equality in not possible; hence,
)()( XFXF f ■
71
Corollary: |)(||)(| XFXF ≥ .
Proof: Clearly
FF VVXFXF ff ⇒)()(
where FV and FV are the signature vectors of )( XF and )( XF respectively and
|)(| XF is the zeroth signature and the first entry of signature vector FV and
|)(| XF is the first entry of FV . Since FF VV f is based on lexicographic
comparison,
|)(||)(| XFXFVV FF ≥⇒f . ■
Let ixF denote the cofactor of function )( XF with respect to ix where
),,,( 21 nxxxX K= . (ixF is regarded as a function of ),,,,,( 111 niii xxxxX KK +−= .)
Signatures in the signature vector ixFV of ixF are in the form of || qF where cube
q always include literal ix . (We will use the notation qxi ∈ to indicate that literal
ix is included in cube q .) Obviously, qxi ∈ if and only if the minterm count of qF
is used in signature vector ixFV .
All signatures that exist in the signature vector of ixF will also exist in the signature
vector of F i.e.,
Fq
Fq VFVF ix ∈⇒∈ |||| .
It is important to point out that the order in which, minterm count of qF appears in
72
ixFV is maintained in FV . To state this fact formally let’s denote the location of
minterm count of qF in FV by ),( qF FVL . We have }2,,3,2,1{),( n
qF FVL K∈ .
For example 1),( += iFVLix
F and 1),( =i
ixx
F FVL since ||ixF is the 1+i st entry
of FV and the first entry of ixFV .
Recall that in the previous chapter, when defining the signature vector, we defined an
ordering ‘p ’ between cubes q of a given function )( XF . One can verify that this
ordering has the following important property. For any two cubes 1q and 2q that
contain literal ix i.e., 11 qxq i ′= and 22 qxq i ′= , we have
2121 qqqq pp ⇔′′
If the cubes are ordered based on the ordering ‘p ’, then ),( qF FVL will be the
location of q in that ordering. From this argument it can be resulted that
),(),( qF
qF FVLFVLqq ′<⇔′p
Therefore, if two minterm counts of qF and qF ′ exist in both FV and ixFV (i.e.,
qxi ∈ and qxi ′∈ ) then the order in which they appear in FV and ixFV is the same
i.e., if minterm counts of qF appears before that of qF ′ in ixFV , then minterm counts
of qF will appear before that of qF ′ also in FV and vice versa i.e.,
),(),(),(),( qF
qF
qF
qF FVLFVLFVLFVL ixix
′′ <⇔<
Theorem 7: Let )( XF be the canonical form of an NPN-equivalence class E . The
73
cofactor of )( XF with respect to the positive phase literals ix is greater than or
equal to that of negative literals ix i.e.,
ii xx FFni fK },,,2,1{∈ .
Proof: The proof is by contradiction. Assuming that ii xx FF p for some
},,2,1{ ni K∈ , we prove that )( XF cannot be the canonical form. We will show
that if ii xx FF p then negating ix will transform )( XF to another function )( XF ′
such that FF f′ which is clearly a contradiction. Consider the NP transformation:
),,,,,,,(),,,,,,,( 11211121 niiiniii xxxxxxxxxxxxT KKKK +−+− =
We create a new function )()( TXFXF =′ . Clearly )( XF and )( XF ′ are NPN-
equivalent, thus EXF ∈′ )( since EXF ∈)( . Previously, we defined the NP
transformation on cubes.
Using this definition,
||||)()( )( qxTqx iiFFTXFXF =′⇒=′
Based on the definition of transformation T , if a cube q does not include ix i.e.,
qxi ∉ , then qqT =)( .
Therefore,
||||)()()( qxqxiii iiFFqxqTxTqxT =′⇒==
We made the assumption that ii xx FF p . The signatures of ixFV are of the form
74
|| qxiF where q is a positive cube not including ix ( qxi ∉ ). Let 1q be the first cube
(not including ix i.e., 1qxi ∉ ) for signature vectors ixFV and ixFV that
||||11 qxqx ii
FF < . Based on the previous Theorem for signature vectors FV and FV ′ ,
1qxi will also be the first cube (including ix ) such that ||||11 qxqx ii
FF ′< and for all
cubes qxi before 1qxi i.e., 1qxqx ii p (or equivalently 1qq p ), |||| qxqx iiFF ′= .
(Notice that since )( XF and )( XF ′ are defined over the same variable vector X
for all cubes q , ),(),( qF
qF FVLFVL ′= .)
Signatures in FV ′ are of the form || qF ′′ . In addition,
||||)()( )(qTq FFTXFXF ′′ =′⇒=′
If a cube q′ does not include ix then qqT ′=′)( ; Thus |||||| )( qqTq FFF ′′′ ==′ . Now if
a signature || qF ′′ from FV ′ is different from the corresponding signature || qF ′ from
FV , then q′ must include ix i.e., qxq i=′ . Based on these arguments, for signature
vectors FV and FV ′ , 1qxi will be the first cube among all cubes (including and not
including ix ) that ||||11 qxqx ii
FF ′< (for all cubes q before 1qxi i.e., 1qxq ip ,
|||| qq FF ′= .) This condition results in FF ′p which is a contradiction since )( XF
is the NPN-representative of its class E that also contains )( XF ′ (the relation
FF ′ f must be satisfied.) Hence the assumption ii xx FF p must be wrong which
proves that ii xx FF f . However if
ii xx FF = then )( XF will be independent of ix .
75
Therefore, ii xx FF f . ■
Corollary: | | ||ii xx FF f .
Proof: Since ||ixF and ||
ixF are the first entries of the signature vectors of ixF
and ixF ,
|| | |iiii xxxx FFFF ≥⇒f . ■
Let’s use Q to denote the set all positive cubes created from conjunction of some
literals among nxxx ,,, 21 K . Also let iQ denote the set of cubes that do not include ix
i.e.,
}{ qxQqQ ii ∉∈=
The set ijQ is defined as the set of cubes that do not include ix and jx i.e.,
},{ qxqxQqQ jiij ∉∉∈=
It is easy to see that
jiij QQQ I=
Similarly ijkQ is defined as
kjiijk QQQQ II= .
Since we include || f in the signature vector of function )( Xf , we define the cube
{}0 =q which contains no literals. Notice that ff q =0
and iQqi ∈∀ 0, .
In the following we study the symmetry of variables in the canonical form.
76
Theorem 8: Let )( XF be the canonical form of an NPN-equivalence class E and
q′ represent a cube that does not include literals ix and jx ( ijQq ∈′ ). For every
such cube, ijQq ∈′ , || qxiF ′ and || qx j
F ′ are equal if and only if ix and jx are
symmetric i.e.,
jiqxqxij xxFFQqji
≡⇔=∈′∀ ′′ |)|||,( .
Proof: We will prove that if signatures || qxiF and || qx j
F are equal, then swapping ix
and jx will not change the value of the signature vector of )( XF and vice versa.
Let’s denote the NP transformation that swaps ix and jx by T i.e.,
),,,,,,(),,,,,,( 11 nijnji xxxxxxxxT KKKKKK =
Furthermore, let’s denote )()( TXFXF =′ . We will investigate the relation between
signature vectors of functions )( XF and )( XF ′ . The cubes q appearing in the
signature vector of )( XF (or )( XF ′ ) can be classified into four types.
For ijQq ∈′ , the following relations are satisfied:
qqT ′=′)(
qxqxT ji ′=′)(
qxqxT ij ′=′)(
qxxqxxT jiji ′=′)(
As we can see, cubes of the form q′ and qxx ji ′ are invariant under NP
77
transformation T .
Recall that for a cube q ,
||||)()( )(qTq FFTXFXF =′⇒=′
Therefore, the signatures of the signature vectors FV and FV ′ that correspond to
cubes of the form q′ and qxx ji ′ are always equal.
The signature vectors FV and FV ′ are equal if and only if |||| qq FF ′= for every cube
q ; therefore,
FFqxqxqxqx VVFFFF
jjii
′′′′′ =⇔′=′= ||||&||||
However, from |||| )(qTq FF =′ , it can be concluded that |||| qxqx jiFF ′′ =′ and
|||| qxqx ijFF ′′ =′ , which combined with the previous relation, results in
|||| qxqx jiFFFF ′′ =⇔′=
Since )()( TXFXF =′ and T only swaps ix and jx , FF ′= means that ix and jx
are symmetric. Therefore,
jiqxqx xxFFji
≡⇔= ′′ |||| . ■
Theorem 9: Let )( XF be the canonical form of an NPN-equivalence class E .
Assume that ix and jx (with ji < ) are not symmetric. There exists a cube ijQq ∈1
such that ||||11 qxqx ji
FF > and for every cube ijQq∈ before 1q (i.e., 1qq p ), || qxiF
and || qx jF are equal i.e.,
78
||||,111 qxqxij ji
FFQq >∈∃
||||, 1 qxqxij jiFFqqQq =⇒∈∀ p .
Proof: Let ijQq ∈1 be the first cube in ijQ that ||||11 qxqx ji
FF ′′ ≠ . From the previous
Theorem since ix and jx are not symmetric, such a cube exists. We will prove that
||||11 qxqx ji
FF > .
The proof is by contradiction. We will prove that if ||||11 qxqx ji
FF < , then swapping
ix and jx in )( XF will result in another function EXF ∈′ )( with FF f′ which
is a contradiction since )( XF is the NPN-representative of E .
Let’s denote the NP transformation that swaps ix and jx by
),,,,,,(),,,,,,( 11 nijnji xxxxxxxxT KKKKKK =
Also let’s denote )()( TXFXF =′ .
Now we compare signatures || qF and || qF ′ of signature vectors FV and FV ′ .
Assuming that q′ generally denotes a cube not including ix and jx i.e., ijQq ∈′ ,
signatures || qF and || qF ′ are equal for cubes q of the form of qq ′= or qxxq ji ′=
i.e.,
|||||| )( qqTq FFF ′′′ ==′
|||||| )( qxxqxxTqxx jijijiFFF ′′′ ==′
Hence, FV and FV ′ may only be different in signatures with cubes of the form
79
qxq i ′= or qxq j ′= .
Notice that
|||||| )( qxqxTqx jiiFFF ′′′ ==′
|||||| )( qxqxTqx ijjFFF ′′′ ==′
Hence,
||||||||1111 qxqxqxqx iiji
FFFF ′<⇒<
||||||||,, 1 qxqxqxqxij iijiFFFFqqQq ′=⇒=∈∀ p
which proves that FF VV f′ . Since FFVV FF ff ′⇒′ results in a contradiction,
||||11 qxqx ji
FF > must be correct. ■
Corollary: If for the canonical form )( XF , ix and jx ( ji < ) are not symmetric,
then ||||ji xx FF ≥ .
Proof: Since {}0 ∈q is the first cube in ijQ , ||||00 qxqx ji
FF ≥ In addition, since
ii xqx FF =0
and jj xqx FF =
0, it can be seen that ||||
ji xx FF ≥ . ■
Corollary: For the case that ||||ji xx FF = , let },{ jik ∉ be the first number that
||||kjki xxxx FF ≠ ; if such k exists, ||||
kjki xxxx FF > .
Proof: Notice that cubes of the form kk xq = where },{ jik ∉ belong to ijQ .
For },{, jilk ∉ ,
80
lk qqlk p⇒< . ■
Another way of describing this result is,
),(),( ijVjiV FF f
where ),( jiV F is a partial signature vector defined as,
|)|,|,||,|,|,||,|,|,||,||,(|),(111121 nijijiiiiiiii xxxxxxxxxxxxxxx
F FFFFFFFFjiV KKK+−+−
=
Similarly ),( ijV F is defined as,
|)|,|,||,|,|,||,|,|,||,||,(|),(111121 njjjjjijijjjj xxxxxxxxxxxxxxx
F FFFFFFFFijV KKK+−+−
=
Theorem 10: Let )( XF be the canonical form of an NPN-equivalence class E . If
for ji < , ix and jx are symmetric in function )( XF , then all other kx where
jki << are also symmetric to ix and jx i.e.,
jiiji xxxxx ≡≡≡⇒≡ + L1 .
Proof: The proof is by contradiction. Assume that there exist kx (where jki << )
that is not symmetric to ix and jx . Let’s denote the NP transformation that swaps ix
and jx by
),,,,,,(),,,,,,( 11 nijnji xxxxxxxxT KKKKKK =
Since ix and jx are symmetric, )()( XFTXF = . Let ikQq ∈1 be the first cube in
ikQ such that ||||11 qxqx ki
FF ≠ .
Based on the previous Theorem, since ki < ,
81
||||11 qxqx ki
FF >
||||,111 qxqxik ki
FFqqQq =⇒∈∀ p
In addition, let ikQq ∈2 be the first cube in kjQ that ||||22 qxqx kj
FF ≠ . Based on the
previous Theorem, since jk < ,
||||22 qxqx jk
FF >
||||,222 qxqxkj jk
FFqqQq =⇒∈∀ p
Cube ikQq ∈1 does not include ix and kx . However, it may or may not include jx .
Similarly cube kjQq ∈2 may or may not include ix . Hence four possibilities exist.
We will investigate all cases.
First let’s assume that 1qx j ∉ and 2qxi ∉ i.e., ijkQqq ∈21, which results in 11)( qqT =
and 22 )( qqT = since ijQqq ∈21, . Now since )()( XFTXF = ,
||||||111 )( qxqxTqx jii
FFF ==
From the definition of 1q ,
||||||||1111 qxqxqxqx kjki
FFFF >⇒>
Therefore, based on the definition of 2q and since jkQq ∈1 , 1q should satisfy the
relation 12 qq p because if 21 qq p , then ||1qx j
F and ||1qxk
F must be equal.
Therefore, again based on the definition of 1q ,
||||,22212 qxqxik ki
FFQqqq =⇒∈p
82
However, 22 )( qqT = since ijQq ∈2 , and therefore, ||||||222 )( qxqxTqx jii
FFF == which
combined with the previous relation results in ||||22 qxqx kj
FF = . This is clearly a
contradiction since based on the definition of 2q , ||||22 qxqx jk
FF > . Hence our last
assumption (i.e., 1qx j ∉ and 2qxi ∉ ) must be incorrect.
Next we investigate the case 1qx j ∈ and 2qxi ∉ . Clearly,
1111 , qxqQqqx jijkj ′=∈′∃⇒∈
From the definition of 1q ,
||||||||1111 qxxqxxqxqx jkjiki
FFFF ′′ >⇒>
Since ijQq ∈′1 , 11)( qqT ′=′ , ||||||111 )( qxxqxxTqxx ikjkjk
FFF ′′′ == which combined with the
previous relation results in
||||11 qxxqxx ikij
FF ′′ >
Therefore, based on the definition of 2q and since jki Qqx ∈′1 , 1qxi ′ should satisfy the
relation 12 qxq i ′p . Since ji p , 11 qxqx ji ′′ p which combined with 12 qxq i ′p results
in 12 qxq j ′p . Notice that 11 qqx j =′ ; hence, 12 qq p . Therefore, again based on the
definition of 1q ,
||||,22212 qxqxik ki
FFQqqq =⇒∈p
However 22 )( qqT = since ijQq ∈2 , and therefore, ||||||222 )( qxqxTqx jii
FFF == which
83
combined with the previous relation results in ||||22 qxqx kj
FF = . This is a contradiction
since based on the definition of 2q , ||||22 qxqx jk
FF > . Hence the assumption (i.e.,
1qx j ∈ and 2qxi ∉ ) is also incorrect.
Similarly one can prove that 1qx j ∉ and 2qxi ∈ leads to contradiction. Hence the
only remaining option is 1qx j ∈ and 2qxi ∈ which in the following we will show
that results in a contradiction. Clearly,
1111 , qxqQqqx jijkj ′=∈′∃⇒∈
2222 , qxqQqqx iijki ′=∈′∃⇒∈
From the definition of 1q ,
||||||||1111 qxxqxxqxqx jkjiki
FFFF ′′ >⇒>
Since ijQq ∈′1 , 11)( qqT ′=′ and therefore ||||||111 )( qxxqxxTqxx ikjkjk
FFF ′′′ == which
combined with the previous relation results in
||||11 qxxqxx ikij
FF ′′ >
Therefore, based on the definition of 2q and since jki Qqx ∈′1 , 1qxi ′ should satisfy the
relation 21 qqxi f′ because if 21 qqxi p′ then ||1qxx ij
F ′ and ||1qxx ik
F ′ must be equal.
Therefore, since 22 qxq i ′= ,
2121 qxqxqqx iii ′′⇒′ ff
Based on one of important properties of the order relation that we defined between
84
cubes,
212121 qxqxqqqxqx jjii ′′⇒′′⇒′′ fff
which combined with 11 qxq j ′= results in 21 qxq j ′f . Therefore, again based on the
definition of 1q ,
||||,22221 qxxqxxikjj jkji
FFQqxqxq ′′ =⇒∈′′f
However, ||||22 qxqxx jji
FF =′ ; also 22 )( qqT ′=′ since ijQq ∈′2 . Therefore,
||||||||2222 )( qxqxxqxxTqxx kikjkjk
FFFF === ′′′ which combined with the previous relation
results in ||||22 qxqx kj
FF = . This is clearly a contradiction since based on the definition
of 2q , ||||22 qxqx jk
FF > . Hence, the statement that “there exist kx where jki << that
is not symmetric to ix and jx ” is incorrect, which proves that
jii xxx ≡≡≡ + L1 . ■
This Theorem indicates that for the canonical form )(XF , symmetric variables are
positioned consecutively in ),,,( 21 nxxxX K= i.e., variables will be arranged as:
444 8444 76LL
444 8444 76L
48476L
k
kk
C
nnnnn
C
nnnn
C
n xxxxxxxxx ,,,,,,,,,,,, 212121
2
2111
1
1 +−+−+++ where kCCC ,,, 21 K are
symmetry classes and || ii Cn = .
85
Chapter 6. Computing the proposed Canonical Form
In this section we will use the properties proven in the previous chapter for the
purpose of computing the canonical form.
6.1 Introduction
Given a function )(Xf the objective is to find its canonical form )(XF and the
corresponding set of CP transformations
)}()(,{ XFTXfqTC qnf =∃Γ∈=
Equivalently the set of CP transformations can be expressed as:
)}()(,,{ XTfTXfqTTC qnnf ′=∃Γ∈′∀Γ∈= .
Previous Theorems impose some conditions on the canonical form )(XF . For a CP
transformation T ′ such that )()( XFXTf qq =′∃ , we project the conditions on )(XF
to conditions on T ′ . These conditions significantly limit the search space (for fC )
since
86
)()()()( 1XTFXfXFXTf qq −′=⇒=′
Let’s denote the inverse of T ′ by 1−′= TT Pπ where ),,,( 21 npppP K= . Let’s also
denote the variable after phase assignment by PXX =~ (i.e. ipii xx =~ ) for simplicity.
With this notation,
)~,,~,~()~()( )()2()1( nPP xxxXXXT ππππ ππ K===
Based on the relation )()( XTFXf Pqπ= the conditions of previous Theorems are
translated as follows.
6.2 Input and Output Phase Assignment
The first condition is on the output phase assignment q . Since FF f , phase
assignment q should satisfy the condition
qq ff f
Again for simplicity we denote qff =~ .
The second condition is on phase assignment P which follows from ii xx FF f and
translates to
ii xx ff ~~~~
f (or ip
iip
i xxff ~~
f )
87
6.3 Detecting Simple Symmetry Relations
The next condition is as follows. If for ji < , )(~
ixπ and )(~
jxπ are symmetric in
function )( Xf (or )(~ Xf ), then all other )(~
kxπ where jki << are also symmetric
to )(ixπ and )( jxπ i.e.,
)()1()()()(~~~~~
jiiji xxxxx πππππ ≡≡≡⇒≡ + L .
Another important constraint is that if )(~
ixπ and )(~
jxπ are not symmetric in function
)( Xf (or )(~ Xf ), then
),(),(~~
ijVjiV ffππ f
where ),(~
jiV fπ is a partial signature vector defined as
|)~|,|,~||,~|,|,~||,~|,|,~||,~(|),()()()1()()1()()1()()1()()1()()(
~~~~~~~~~~~~~~
nijijiiiiiii xxxxxxxxxxxxxf fffffffjiV
ππππππππππππππ KKK+−+−
=
And similarly,
|)~|,|,~||,~|,|,~||,~|,|,~||,~(|),()()()1()()1()()1()()1()()1()()(
~~~~~~~~~~~~~~
njjjjjijijjj xxxxxxxxxxxxxf fffffffijV
ππππππππππππππ KKK+−+−
=
Symmetry classes of variables will be arranged as:
44 844 76LL
444 8444 76L
4484476L
k
k
C
nnn
C
nnn
C
n xxxxxx )()1()()1()()1(~,,~,,~,,~,~,,~
2
211
1
1 ππππππ +−++
where iC with in members is a maximal symmetry class for function )(~ Xf .
The first order signatures |~|)(
~ixf
π are sorted non-increasingly.
|~||~||~||~||~||~|)()1()21()11()1()1(
~~~~~~nknnnnnn xxxxxx ffffff
ππππππ==>>==>==
+−++LLLL
One can use this property to reduce the complexity of identifying symmetry classes
88
since a necessary condition for symmetry of )(~
ixπ and )(~
jxπ is the equality of |~|)(
~ixf
π
and |~|)(
~jxf
π i.e.,
|~||~|~~)()(
~~)()( ji xxji ffxxππππ =⇒≡ .
These conditions on 1−′= TT Pπ are necessary conditions for f
P CT ∈−1)( π . Hence, if
we define inverse of fC as }{ 11fnf CTTC ∈Γ∈= −− , then these are necessary
conditions for 1−∈ fP CTπ .
An important property of the CP transformation set fC is as follows. If for two NP
transformations T and T ′ satisfy the inequality )(~)(~ XTfTXf ′f , then T ′ is
definitely not a CP transformation i.e.,
fCTXTfTXf ∉′⇒′ )(~)(~f .
These constraints are effectively used to identify CP transformations fC as
described in the following.
6.4 The Compute_Cf Algorithm
The proposed algorithm, called Compute_Cf, uses signatures of function )( Xf to
compute the CP transformations on inputs and corresponding output phase
assignments. However, at the beginning, only 0th, 1st and if necessary 2nd signatures
are used. In most cases, 1st-signatures alone determine a considerable portion of the
89
inequalities required to identify the desired NP transformation. Otherwise, as will be
explained later, the remaining comparisons are performed using 2nd-signatures.
Similarly higher order signatures are used only if they become necessary.
Experimental evidence shows that in the great majority of cases, a signature
inequality occurs for the low order signatures (0th, 1st and 2nd signatures.) Intuitively,
the reason is that the lower order signatures depend on higher number of minterms of
the function, and thus, contain more information about the function. For example, a
1st-signature depends on 2n-1 minterms, which is one half of the whole Boolean space
(2n minterms) whereas a 2nd-signature depends on one-forth of all minterms (2n-2
minterms.) Hence, the 1st-signatures are the most powerful and effective signatures.
The 2nd-signatures are the next most effective signatures and so on. The reader will
observe that this arrangement of the proposed signature vector minimizes the
computational complexity.
The first step of the Compute_ fC algorithm is to identify the output phase
assignment. If |||| ff ≠ , then the output phase q can be uniquely determined from
the relation |||| qq ff > . However, if |||| ff = , the output phase cannot be
determined by using only 0th signatures. In this case ( |||| ff = ) the output phase is
considered undecided , which is denoted by uq = . (Thus we have extended the set
of acceptable phases }1,0{ to },1,0{ u .) If the output phase is undecided, it will be
determined in subsequent steps of the algorithm. In the end, the algorithm will return
90
a value in }1,0{ for the phase. For simplicity we will denote qff =~ .
In the next step, input phase assignment is performed by using 1st-signatures. First
assume that the output phase is decided i.e., uq ≠ . The opposite case will be
discussed later. For variable ix if |~||~|ii xx ff ≠ , then ip , the phase of ix , can be
uniquely determined by using the relation |~||~|ip
iip
i xxff > . However, if |~||~|
ii xx ff = ,
ip cannot be determined by using only 1st-signatures in which case the phase of ix
is considered undecided (which is again denoted by upi = .) Undecided input phases
will be determined in subsequent steps of the algorithm. If the output phase is
undecided i.e., uq = , then 1st-signatures are used as follows to determine output and
input phases. There are two possibilities for the final value of q i.e., 0=q or 1=q .
Each possibility for q results in input phase assignments )(qpi (where q in the
parenthesis indicates the dependence of ip on q ) based on the following relation,
||||)()(
q
x
qx qip
iqip
iff >
uqpff iq
xq
x ii=⇒= )(||||
Notice that even if uqpi =)( , the value of || )(q
x qipi
f will be unique i.e.,
||||||)( )(q
xq
xq
xi iiqipi
fffuqp ==⇒=
Next we sort signatures || )(q
x qipi
f in a non-increasing order. Let qπ be a permutation
that results in such an ordering i.e.,
91
||||||)()2()1(
~~~q
xq
xq
x nqqqfff
πππ≥≥≥ L
where )(~ qpii
ixx = for simplicity.
Let )(qV denote the vector comprising of the ordered 1st-signatures i.e.,
|)|,|,||,(|)()()2()1(
~~~q
xq
xq
x nqqqfffqV
πππK=
Assuming that q is the output phase assignment that results in the canonical form,
one can easily see that )(qV consists of 2nd to ( 1) stn + entries of the signature
vector of the canonical form of )( Xf . (The first entry is |||| ff = .)
Now if )()( qVqV ≠ , then q must satisfy the following relation:
)()( qVqV f
Since the canonical form has the maximal signature vector. This relation uniquely
determines the output phase assignment q unless )()( qVqV = in which case the
computation of q is again postponed to the subsequent steps of the algorithm.
Let’s denote a variable after phase assignment as jpjj xx =~ . In the next step, symmetry
classes of variables are determined. A necessary condition for ji xx ~~ ≡ is
|~||~| ~~ji xx ff = ; therefore the symmetry check is performed for ix~ and jx~ only if
|~||~| ~~ji xx ff = . If the phases of variables ix and jx are undecided, we will determine
ix and jx to be symmetric only if they are symmetric independent of their phases
i.e. ji xx ≡ and ji xx ≡ . An example of this situation is when )(~ Xf depends on
92
ji xx ⊕ .
Based on these symmetry relations, we form the maximal symmetry classes of
variables mCCC ,...,, 21 . Function )(~ Xf will remain invariant under
permutations inside a symmetry class. Based on this fact and since symmetric
variables are positioned consecutively, instead of finding NP transformations on the
variables, it is sufficient to search for NP transformations on classes mCCC ,...,, 21 ,
which will in turn greatly reduce the size of search space. In fact, this is a major
advantage of the proposed technique compared to previous approaches.
The objective is to determine all members of fC . Obviously, if an NP
transformation T is a member of fC and fST ∈′ , then the transformation TT ′ is
also a member of fC .
(Recall that fS is the set of SP transformations i.e.,
)()( XTfXfST qqf ′=∃⇔∈′ .)
Let’s denote the subgroup of SP transformations that correspond to simple symmetry
of variables by W . An example of a member of W is the NP transformation that
swaps variables ix and jx . Notice that W also includes the cascades of NP
transformations that correspond to simple symmetry of variables i.e., W is closed
with respect to the cascade operation:
WTTWTWT ∈′⇒∈′∈ ,
93
Obviously fSW ⊂ and also
ff CTWCT ⊂⇒∈
Thus, to avoid computational redundancy, the proposed algorithm will return only
one member of TW since given an NP transformation fCT ∈ , one can easily
obtain all members of TW .
To explain this matter formally, we define a relation ‘≈ ’ between fCTT ∈′, where
TT ′≈ means that there exist a WT ∈′′ such that TTT ′′′= . This relation breaks
fC into equivalence classes. The proposed algorithm returns the set ff CC ⊂′
which contains exactly one member of each such class i.e.,
ff CTTWTCT ′∉′⇒∈′′∈ ,
or equivalently,
ff CTTTCT ′∉′⇒′≈′∈ , .
Now we will discuss the concept of NP transformations on classes. The phases of
classes that contain variables with decided phases are defined as 1. The phase
assignment for classes that contain variables with undecided phases is defined as:
}|{ ijpj
pi CxxC ii ∈= where ip is to be determined.
An NP transformation on classes mCCC ,...,, 21 signifies a transformation on
variables ),,,( 21 nxxxX K= . The cofactor of function )( Xf with respect to any
member of a class iC is a unique function; hence the cofactor of )( Xf with
94
respect to the class iC can be defined as ji xC ff = for ij Cx ∈ .
Let’s denote the classes after phase assignment as mCCC ~,...,~,~21 . In the next step,
classes are ordered based on their first signatures. Let π be a permutation on classes
that respects the ordering: |~||~||~|)()2()1(
~~~mCCC fff
πππ≥≥≥ L (even when the phase
of a class, iC~ , is undecided, the 1st-signature can be defined since |~||~|ii CC ff = .)
If the 1st-signatures are distinct values for mCCC ~,...,~,~21 , then a unique ordering
can be achieved since |~||~||~|)()2()1(
~~~mCCC fff
πππ>>> L in which case the
algorithm terminates returning the NP transformation resulting from π and the
corresponding phase assignment as a member of }{ 11fnf CTTC ′∈Γ∈=′ −− .
Otherwise, the classes are placed in k groups such that all classes inside a group have
the same 1st-signature: 444 8444 76
LL444 8444 76
L4484476
L
k
k
G
mnn
G
nnn
G
n CCCCCC )()1()()1()()1(~,,~,,~,,~,~,,~
2
211
1
1 ππππππ +−++
where
|~||~||~||~||~||~|)()1()21()11()1()1(
~~~~~~mknnnnnn CCCCCC ffffff
ππππππ======
+−++LfLfLfL .
We refer to a group as unresolved if it contains more than one class or the phases of
classes in that group are undecided. If all the groups are resolved, a unique ordering
has been obtained and the algorithm terminates. The objective of next steps is to
resolve all unresolved groups.
Let }~,,~,~{ )()1()( ljjj CCCG πππ K+= be the first unresolved group. Since all groups
95
121 ,,, −jGGG K are resolved, (i.e., they contain a single class with decided phase,) the
ordering of classes up to jG is identified. (The case that 1G is unresolved is
discussed later.)
Now the 2nd-signatures are used to specify the ordering inside the unresolved groups
starting with jG . Since 1G is resolved, }~{ )1(1 πCG = , 2nd-signatures with respect to
)1(~πC and )(
~iCπ for lij ≤≤ (i.e., |~|
)()1(~~
iCCf ππ) can be used for phase assignment (if
needed) and ordering classes )()1()(~,,~,~
ljj CCC πππ K+ (later on this step will be referred
to as iteration 1.)
If phases of classes )(iCπ in jG is undecided, the 2nd-signatures |~|)()1(
~iCCf ππ
and
|~|)()1(
~iCCf ππ
are compared and phase p for )(iCπ is decided based on
|~||~|)()1()()1(
~~ pi
pi CCCC
ffππππ
>
In case of equality of the 2nd-signatures, the phase of )(iCπ remains undecided.
Next, new values of 2nd-signatures |~|)()1(
~~iCCf ππ
after phase assignment are used to
order classes )()1()(~,,~,~
ljj CCC πππ K+ and subsequently regroup these classes i.e., the
values of )(,),1(),( ljj πππ K+ are updated to respect the following ordering:
|~||~||~|)()1()1()1()()1(
~~~~~~ljj CCCCCC fff
ππππππ≥≥≥
+L
Subsequently, jG is split into smaller groups such that inside each group the 2nd-
96
signatures, |~|)()1(
~~iCCf ππ
, are equal. The same procedure (phase assignment, ordering
and regrouping based on |~|)()1(
~~iCCf ππ
) is applied to all other unresolved groups.
Finally, the indices of new groups are properly updated. If after these steps, there still
exists some unresolved group, lG , a similar procedure (called iteration 2) is applied
based on 2nd-signatures with respect to )2(~πC and li GC ∈)(
~π (i.e., |~|
)()2(~~
iCCf ππ
assuming 2>l ). If needed iterations 1,,4,3 −jK are applied. If at iteration j, there
still exists some unresolved groups and jG itself is also unresolved, the procedure
described below will be used. (This case includes the case where 1G is unresolved.)
At this point, the values of )1(,),2(),1( −jπππ K have been finalized (so is the value
of π for any other group with only one class). However, the values of
)(,),1(),( ljj πππ K+ (group jG ) is not final (since 1st and 2nd signature have not
made them distinct.) The final value for )( jπ can be any value among
)(,),1(),( ljj πππ K+ . Finalizing the value of )( jπ to one of )(,),1(),( ljj πππ K+
is equivalent to splitting }~,,~,~{ )()1()( ljjj CCCG πππ K+= to groups }~{ )(iCπ and
}~,,~,~,,~{ )()1()1()( liij CCCC ππππ KK +− and updating π and indices of groups so these two
groups are represented by }~{ )( jj CG π= and }~,,~,~{ )()2()1(1 ljjj CCCG πππ K+++ = .
Therefore, there are 1+− jl ways to do this split ( 1+− jl ways to specify new jG )
and if the phase of )( jCπ is undecided, then there will be two ways to resolve the
97
group, new jG (two phases 1=p and 0=p .) Consequently, there are 1+−= jlr
(or )1(2 +−= jlr ) ways to specify and resolve the new group, jG . All these r cases
need to be tracked, since it is unknown which one(s) will result in a maximal
transformation. For each case, the 2nd-signatures, |~|)()(
~~ij CCf ππ
, are used to first order
classes inside the unresolved groups among mjj GGG ,,, 21 K++ and then split them
based on the outcome of ordering.
This process will continue for all r cases, recursively (cf. the recursive-resolve
algorithm), until all groups are resolved. All resulting NP transformations
sTTT ,,, 21 K resulting from different cases are stored (where in general rs ≥ since
each returns more than one transformation as a result of the recursion process.)
Because of the way they have been constructed, the inverses of CP transformations
are among },,,{ 21 sTTT K , or equivalently, },,,{ 112
11
−−−⊂′ sf TTTC K . Hence by using 1st
and 2nd signatures, we have limited the search for a fC′ among all !2 nn
transformations of nΓ to search among },,,{ 112
11
−−−sTTT K which is a significantly
smaller size space than nΓ . Indeed, our experimental results confirm that most of the
time all members of },,,{ 112
11
−−−sTTT K are CP transformations i.e.,
},,,{ 112
11
−−−=′ sf TTTC K , which implies that most of the time only 1st and 2nd
signatures are capable of determining the canonical form.
Members of fC′ among },,,{ 112
11
−−−sTTT K are identified based on the fact that
98
fi CT ∈−1 if and only if )(~)(~ 11 XTfXTf ji−− f for sj ≤≤1 . This task requires the
performing comparison )(~)(~ 11 XTfXTf ji−− f repeatedly. The comparison is done
based on their signature vectors. However, before using the signature vectors, the
possibility equivalency of iT and jT should be considered i.e., first the relation
)(~)(~ 11 XTfXTf ji−− = should be checked since in case of equality their signature
vectors will be equal as well. On the other hand, if )(~)(~ 11 XTfXTf ji−− ≠ as we
proved in a theorem earlier, their signature vectors are different i.e., either
)(~)(~ 11 XTfXTf ji−− f or )(~)(~ 11 XTfXTf ji
−− p .
The algorithm will return fC′ which in general may contain more than one
transformation.
As a result of the way in which these NP transformations are obtained, they all have
the same set of 0th and 1st signatures and some of their 2nd signatures are equal as
well. Hence, to avoid redundancy in comparing )(~ 1XTf i− and )(~ 1XTf j
− , only
signatures that are not already determined to be equal are generated and compared.
Since comparison is done based on lexicographic comparison of signature vectors,
signatures are generated one by one based on their significance order. Furthermore,
only in case of equality, the subsequent signatures are generated and compared.
Experimental results show that for nearly all functions, 1st and 2nd signatures
conclude the comparison of )(~ 1XTf i− and )(~ 1XTf j
− .
99
6.5 Algorithm Summary
Different steps of the proposed techniques are summarized in the following pseudo-
code descriptions of Compute_Cf and Recursive_Resolve algorithms.
Algorithm Compute_Cf ( )(Xf )
Input: A Boolean function )(Xf
Output: The canonical form )(XF and CP transformations fC′ .
Using the 0th-signature perform output phase assignment ; Using the1st-signatures, Assign phases ; Create symmetry classes ; Order and group classes to groups kGGG ,,, 21 K ;
Recursive_Resolve( fk CGGG ;,,, 21 K ) ;
Set the canonical form: )(~)( TXfXF = where fCT ∈ ;
Algorithm Recursive_Resolve ( fk CGGG ;,,, 21 K )
Input: Ordered groups ( kGGG ,,, 21 K )
Output: The CP transformations fC′
1=i ; {}=′fC ;
while ( mi ≤ ) { // m is the number of classes
if ( iG is resolved) { // }~{ )(ii CG π=
for (all unresolved groups jG ){
use signatures |~|)()(
~~li CCf ππ
( jl GC ∈)(~π ) to assign phase, order and split jG ;
update indices of groups and classes; } 1+= ii ;
} else { // }~,,~,~{ )()1()( liii CCCG πππ K+= is not resolved
// for space limitation assume the phase of }~,,~,~{ )()1()( liii CCCG πππ K+= is decided
100
for ( ij = ; lj ≤ ; ++j ) {
split iG to groups }~{ )( jCπ and }~,,~,~,,~{ )()1()1()( ljji CCCC ππππ KK +− ;
update indices of groups and classes: ( 121 ,,,, +kk GGGG K );
recursive-resolve ( TEMPfkk CGGGG ′+ ;,,,, 121 K ) ;
if ( {}=′fC or )(~)(~ TXfXTf TEMP f ) {// TEMPf
TEMPf CTCT ′∈′∈ ,
TEMPff CC ′=′ ;
} else if ( )(~)(~ TXfXTf TEMP = ) {
TEMPfff CCC ′′=′ U ;
} } return; } } // At this point there are m groups and all of them are resolved T =Transformation resulted from current phase assignment and π ;
}{ 1−=′ TCf ;
return;
In the above description of the algorithm we have not included the case where the
output phase may not be decided by the 0th signature. In such a case, the following
steps will have to be performed for both output phases. Let’s assume that fC′ is the
set of NP transformations returned by the algorithm for f and fC ′′ is returned for f
then if )()( XTfXTf ′′′ f (where fCT ′∈′ and fCT ′′∈′′ ) then output phase is 1=q , if
)()( XTfXTf ′′′ p then 0=q and if )()( XTfXTf ′′=′ then both phases can result in
the canonical form i.e., )()()( XTfXTfXF ′′=′= .
And the set of CP transformations is set to ff CC ′′∪′ .
101
The algorithm will return fC′ which in general may contain more than one NP
transformations. Based on the members of fC′ SP transformations (other than
transformations corresponding to simple symmetries) are detected i.e.,
fff STTCTCT ∈′⇒′∈′′∈ −1, . Equivalently, for an NP transformation fCT ′∈ ,
ff SCT ⊂′−1 . The remaining member of fS can be generated by cascading NP
transformation fCT ′−1 of with transformations of W . By cascading we mean
generation every transformation that can be generated by members of fCT ′−1 and W
which might require repeated cascading since the cascade operation is not
commutative.
Example : Consider the multiplexer function
465365265165)( xxxxxxxxxxxxXf +++= . The 0th signature of the function and its
complement are equal i.e., 32|||| == ff ; hence in this step the output phase can not
be determined. We will consider both phases. First we chose the positive phase. In
this function there is no symmetry between variables i.e., each symmetry class
contains only one variable. After doing input phase assignment, ordering and
grouping classes (in this case, variables), two groups G1 and G2 are created:
8764847616:
65
20:
4321
21
,,,,,
== ixix fGfG
xxxxxx where for members in G2 the phase is undecided since
16||||||||6655==== xxxx ffff while for G1 the phase is decided and the 1st-signatures
are 20|| =ixf . Both groups G1 and G2 are unresolved. Group G1 can be split in four
102
ways: 1: 48476 1
4321 ,,,G
xxxx 2: 48476 1
4312 ,,,G
xxxx 3: 48476 1
4213 ,,,G
xxxx 4:
48476 1
3214 ,,,G
xxxx
The algorithm keeps track of all these cases. Let’s zoom in one of the cases e.g., case
1 which results in the following new grouping: 87648476 21
654321 ,,,,,GG
xxxxxx . Now we
try to resolve G1 and G2. Since 12||||||413121=== xxxxxx fff , G1 can not be
resolved at this step. As for G2, 12||8||5151=<= xxxx ff and
12||8||6161=<= xxxx ff which results implies that negative phases should be
assigned to x5 and x6. However ||||6151 xxxx ff = which means that G2
can not be
resolved further and the overall grouping so far will be 87648476 21
654321 ,,,,,GG
xxxxxx .
There are three ways to resolve G1. Following one of these cases, for example will
result in 654321 ,,,,,1
xxxxxxG876
since 12||||4232== xxxx ff and
8||12||6252=>= xxxx ff which consequently results in
65432112 ,,,,, xxxxxxT = because 8||||5453== xxxx ff and
8||12||6463=>= xxxx ff . Indices 1 and 2 in T12 indicate the decisions that have
been made for splitting G1 to obtain this transformation T12. Had we chosen x3
instead of x2, we would have arrived at 56423113 ,,,,, xxxxxxT = . Choosing x4
103
(instead of x2 ) however does not immediately resolve G1 and a further step
(deciding between x2 and x3) need to be made which results in the transformations
653241142 ,,,,, xxxxxxT = and 562341143 ,,,,, xxxxxxT = . Turns out
that )()( 1143
1142 XTfXTf −− = which means at this step we need to keep both
142T and 143T transformations. However )()()( 1142
113
112 XTfXTfXTf −−− ≠= which
means that we should either keep 142T and 143T or keep 12T and 13T . To make
this decision signature vectors of )( 112 XTf − and )( 1
142 XTf − need to be
compared. All their 0th and 1st signatures and most of (but not all) of their 2nd
signatures will be equal. Hence to decide between 12T and 142T first we compare
the remaining 2nd signatures of )( 112 XTf − and )( 1
142 XTf − . Since
8||12||6452=>= xxxx ff is the first inequality that breaks the tie,
)()( 1142
112 XTfXTf −− f which means only 12T and 13T should be kept. These
two transformations are the result of selecting x1 to spilt G1 at the beginning. If we
chose x2, x3 or x4 we will obtain transformations 21T , 24T , 31T , 34T , 42T and
43T .
Turns out that
)()()()()()()()( 143
142
134
131
124
121
113
112 XTfXTfXTfXTfXTfXTfXTfXTf −−−−−−−− =======
which means that all these 8 transformations are maximal. We obtained these
transformations by assuming positive phase for the output. If we chose negative case
104
and follow these steps we will obtain 8 other transformations 12T ′ , 13T ′ , 21T ′ , 24T ′ ,
31T ′ , 34T ′ , 42T ′ and 43T ′ . Turns out that these new transformations ijT ′ along with
out negation, convert )( Xf to the same function as previous transformations
ijT i.e., )()( 11 XTfXTf ijij−− =′ which means that there are 16 CP
transformations for this function and the canonical form is
46536526516511 )()()( xxxxxxxxxxxxXTfXTfXF ijij +++==′= −− . These 16 CP
transformations will result in 16 SP transformations.
6.6 Experimental Results
The technique presented above has been implanted on an Intel Xeon processor
running at 1700MHz. To reveal the effectiveness of the proposed technique, the
proposed canonical form is computed for all cells in a cell library, containing a large
number of complex cells with up to 20 inputs. To assess the efficiency of the
method, a large number of pseudo-randomly generated logic cells with different
input counts were added to the library. These pseudo-random functions were
generated from different single output clusters taken from the subject graphs created
for MCNC benchmark circuits.
Table 1 shows the worst-case and average run-times required for computing the
canonical form in terms of the number of inputs; i.e., the second and third columns
are the worst-case and average runtimes for all n-input cells. Forth and sixth columns
105
present results provided in references [14] and [6].
Numer
of
Inputs
Average
run-time
Worst-
case
run-ime Ref [14] Ref [6] 3 <1 <1 9.81 -
4 <1 <1 15.74 0.42
5 1 1 26.02 1.34
6 2 3 39.13 2.31
7 3 5 147.61 3.69
8 4 8 – 7.58
9 6 14 – 15
10 8 21 – –
11 14 30 – –
12 20 48 – –
13 23 61 – –
14 33 80 – –
15 37 105 – –
16 44 115 – –
17 56 140 – –
18 67 165 – –
19 80 200 – –
20 100 240 – –
Table 1. Worst-case and average runtimes to compute canonical forms
The run-times in this table are in microseconds and include data for cells with more
than 3 inputs. As an example the worst-case 20-input cell was a multiplexer with
four select inputs for which the algorithm takes 240 microseconds to compute its
canonical form.
106
These results show a major improvement in run-time over previous approaches [11]
[14]. (Notice that reference [11] does not handle complementation of inputs and
output and reference [14] entails enormous space complexity.) For nearly all of the
cells in the library, the canonical forms were computed using only the zeroth, 1st and
2nd signatures. Only one of the cells required the use of the 3rd signatures and none of
them required the use of higher order signatures. However, the algorithm given
above is complete and able to handle functions that may require the use of higher
order signatures for computing the canonical form.
The function that required the use of the 3rd signatures was a multiplexer where one
of the select inputs was the output of an XOR function. A simplified version of such
a function is 421321 )()()( xxxxxxXF ⊕+⊕= .
As mentioned in the document, one of the advantages of this technique is identifying
all symmetry relations for the given function.
The runtime of the algorithm for any function has a direct relation with the number
of non-simple symmetry relations of the function. More precisely, the higher the
number of non-simple SP transformations, the higher the runtime. Table 2
demonstrates the number of non-simple SP transformations for functions that
correspond to the worst-case runtimes in the previous experiment. Note that the
number of non-simple SP transformations is equal to the number of non-trivial CP
transformations i.e., || fC′ .
107
Numer of
Inputs
Number of non-simple
SP transformations
3 4
4 6
5 8
6 16
7 18
8 24
9 32
10 64
11 128
12 144
13 162
14 216
15 288
16 324
17 384
18 512
19 576
20 768
Table 2. Number of non-simple SP transformations
108
Chapter 7. Conclusions
A new efficient and compact canonical form was defined and an effective algorithm
for computing the proposed canonical form was provided in this document. The
compactness and efficiency of the presented methods enables the approach to be
applicable to a wide range of Boolean networks as opposed to previous approaches
that either do not solve the problem generally or only handle functions with limited
number of inputs. This document addresses the general Boolean matching problem
in which both permutation and complementation of inputs and output are considered.
The proposed canonical form was based on using generalized signatures to obtain all
CP transformations on inputs. Signatures were defined very effectively and first,
most powerful signatures (that include more information about the function) are
generated and used followed by less significant signatures, only if necessary. Using
the resulted CP transformations the information about all symmetry relations are
provided. Experimental results demonstrate the efficiency of the proposed approach
and it was observed, in nearly all cases zeroth, 1st and 2nd signatures are enough to
provide the canonical form and since these signatures is performed efficiently by
ordering variables; the proposed approach is associated with a very low
computational complexity.
109
References
[1] L. Benini and G. De Micheli, “A survey of Boolean matching techniques for library binding,” ACM Trans. Design Automation of Electronic Systems, vol. 2, no. 3, pp. 193–226, July 1997.
[2] K. S. Brace, R. L. Rudell, and R. E. Bryant, “Efficient implementation of a BDD package,” 1n 27th ACM/IEEE design automation conference, pp. 24-28, June 1990.
[3] F. Brown, Boolean reasoning, Kluwer Academic Publishers, Hingham, MA. 1990.
[4] R. E. Bryant, “Graph-based algorithms for Boolean function manipulation,” IEEE Trans. Computers, C-35, 8 (Aug.), pp. 677–691. 1986.
[5] J. R. Burch and D. E. Long, “Efficient Boolean function matching,” in Proc. Int. Conf. on Computer-Aided Design, pp. 408–411, Nov. 1992.
[6] D. Chai and A. Kuehlmann, “Building a Better Boolean Matcher and Symmetry Detector,” In Proc. Design, Automation and Test in Europe , March 2006.
[7] C.W. Chang, C.K. Cheng, PR Suaris and M. Marek-Sadowska, "Fast Postplacement Optimization Using Functional Symmetries," IEEE Trans. on Computer-Aided Design, pp. 102-118, Jan. 2004.
[8] K. H. Chang, I. L. Markov and V. Bertacco, "Post-Placement Rewiring and Rebuffering by Exhaustive Search For Functional Symmetries," Proc. International Conference on Computer-Aided Design, 2005, pp. 56-63.
[9] D. I. Cheng and M. Marek-Sadowska., “Verifying equivalence of functions with unknown input correspondence,” Proc. European Design Automation Conference, pp. 81–85, Paris, France, February 1993.
110
[10] K. S. Chung and C. L. Liu, “Local transformation techniques for multi-level logic circuits utilizing circuit symmetries for power reduction,” in Proc. of Internat. Symp. on Low Power Electronics and Design, pp. 215–220, August 1998.
[11] J. Ciric and C. Sechen, “Efficient canonical form for Boolean matching of complex functions in large libraries,” IEEE Trans. Computer-Aided Design of Integrated Circuits and Systems, vol. 22, no. 5, pp. 535–544, May 2003.
[12] E. M. Clarke, K. L. McMillan, X. Zhao, M. Fujita, and J. Yang, “Spectral transforms for large Boolean functions with applications to technology mapping,” Formal Methods in System Design: An Int. Journal, vol. 10, no. 2, pp. 137–148, Apr. 1997.
[13] D. Debnath and T. Sasao, “A heuristic algorithm to design AND-OR-EXOR three-level networks,” in Proc. Asia and South Pacific Design Automation Conf., pp. 69–74, Feb. 1998.
[14] D. Debnath and T. Sasao, “Efficient computation of canonical form for Boolean matching in large libraries,” Proc. ASP Design Automation Conf., pp. 591–596, Jan. 2004.
[15] D. Debnath and T. Sasao, “Fast Boolean matching under permutation using representative,” Proc. ASP Design Automation Conf., pp. 359–362, Jan. 1999.
[16] G. De Micheli, Synthesis and Optimization of Digital Circuits, McGraw-Hill, 1994.
[17] C. R. Edwards and S. L. Hurst, “A digital synthesis procedure under function symmetries and mapping methods”, IEEE Trans. Comp., Vol. C-27, No. 11, pp. 985-997, NOV. 1978.
[18] E. A. Emerson and A. P. Sistla, “Symmetry and model checking,” 5th international conference on computer-aided verification (CAV). Lecture notes in computer science, vol 697, Springer, Berlin Heidelberg New York, pp 463–378, 1993.
[19] S. Ercolani and G. De Micheli, “Technology mapping for electrically programmable gate arrays,” in Proc. IEEE/ACM Design Automation Conf., pp. 234–239, June 1991.
111
[20] M. A. Harrison, Introduction to Switching and Automata Theory, McGraw-Hill, 1965.
[21] U. Hinsberger and R. Kolla, “Boolean matching for large libraries,” Proc. of Design Automation Conf., pp. 206–211, June 1998.
[22] M. Hutter and M. Scheppler, “Memory efficient and fast Boolean matching for large functions using rectangle representation,” in IEEE/ACM Int. Workshop on Logic Synthesis, May 2003.
[23] V. N. Kravets and K. A. Sakallah, “Constructive library-aware synthesis using symmetries,” In Proc. Design, Automation and Test in Europe , pp. 208-213, March 2000.
[24] Y.-T. Lai, S. Sastry, and M. Pedram, “Boolean matching using binary decision diagrams with applications to logic synthesis and verification,” in Proc. IEEE Int. Conf. on Computer Design, pp. 452–458, Oct. 1992.
[25] F. Mailhot and G. De Micheli, “Algorithms for technology mapping based on binary decision diagrams and on Boolean operations,” IEEE Trans. Computer-Aided Design of Integrated Circuits and Systems, vol. 12, no. 5, pp. 599–620, May 1993.
[26] D.M. Miller, "A Spectral Method for Boolean Function Matching", In proc. of European Design and Test Conference, pp. 602, 1996.
[27] J. Mohnke and S. Malik, “Permutation and phase independent Boolean comparison,” in Proc. IEEE European Conf. on Design Automation, pp. 86–92, Feb. 1993.
[28] J. Mohnke, P. Molitor, and S. Malik, "Limits of using signatures for permutation independent Boolean comparison," Proc. of ASP Design Automation Conf., pp. 459-464, 1995.
[29] P. Molitor and J. Mohnke. Equivalence Checking of Digital Circuits. Kluwer Academic Publishers, 2004.
112
[30] D. Möller, J. Mohnke, and M. Weber, “Detection of symmetry of Boolean functions represented by ROBDDs,” Proc. International Conference on Computer-Aided Design, pp. 680–684, October 1993.
[31] J. C. Muzio and D. M. Miller and S. L. Hurst, “Multi-variable symmetries and their detection,” IEE Proc. Part E, 130: 141-148, 1983.
[32] S. Panda, F. Somenzi, and B. F. Plessier, “Symmetry detection and dynamic variable ordering of decision diagrams,” in Proc. International Conference on Computer-Aided Design, pp. 628–631, November 1994.
[33] C. E. Shannon, “A symbolic analysis of relay and switching circuits,” AIEE Trans., 57:713-723, 1938.
[34] C. Tsai and M. Marek-Sadowska, “Boolean functions classification via fixed polarity Reed-Muller forms,” IEEE Trans. Computers., vol. 46, no. 2, pp. 173–186, Feb. 1997.
[35] C. Tsai and M. Marek-Sadowska, “Generalized Reed-Muller forms as a tool to detect symmetries,” IEEE Transactions on Computers, C-45(1):772–781, Aug. 1996.
[36] U. Schlichtmann, F. Brglez, and M. Hermann, “Characterization of Boolean functions for rapid matching in EPGA technology mapping,” in Proc. IEEE/ACM Design Automation Conf., pp. 374–379, June 1992.
[37] U. Schlichtmann, F. Brglez, and P. Schneider, “Efficient Boolean matching based on unique variable ordering,” in IEEE/ACM Int.Workshop on Logic Synthesis, pp. 3b:1–3b:13, May 1993.
[38] C. Scholl, D. Moller, P. Molitor, and R. Drechsler, “BDD minimization using symmetries,” IEEE Transactions on Computer-Aided Design of Integrated Circuits, 18(2):81–100, Feb. 1999.
[39] E. Schubert and W. Rosenstiel, “Combined spectral techniques for Boolean matching,” in Proc. ACM Int. Symposium on Field-Programmable Gate Arrays, pp. 38–43, Feb. 1996.
113
[40] K.-H. Wang, T. Hwang, and C. Chen, “Exploiting communication complexity for Boolean matching,” IEEE Trans. Computer-Aided Design of Integrated Circuits and Systems, vol. 15, no. 10, pp. 1249–1256, Oct. 1996.
[41] Q. Wu, C. Y. R. Chen, and J. M. Acken, “Efficient Boolean matching algorithm for cell libraries,” Proc. IEEE Int. Conf. on Computer Design, pp. 36–39, Oct. 1994.