1
Taylor Expansion of Logic Functions: From Conventional to Nanoscale Design S. N. Yanushkevich, V. P. Shmerko
Abstract— The paper revisits the well-known spectral transforms of a Boolean function, emphasizing on the fact that ReedMuller, arithmetic and Walsh spectra can be calculated through boolean difference, and arithmetical and Walsh analogs of it. This techniques is called Taylor technique, by analogy with Taylor series which coefficients are differences, or differentials. The algorithms are perfectly implementable on parallel-pipelining processors in VLSI technology. This paper argues that Taylor based algorithms can also be implemented on nanoscale circuits.
Decision diagram based technique is one of prospective ways of implementing logic functions and their manipulation, including spectral transforms, on nanoscale devices, in particular single-electron based nanowire networks [19] [24], [29]. II. L OGIC TAYLOR EXPANSION FOR SWITCHING FUNCTIONS REPRESENTATION
The Boolean difference of a function f of n variables with respect to a variable xi is defined as : I. I NTRODUCTION There are two forms of polynomial forms of Boolean functions that widely used in logic design: Reed-Muller and arithmetic form. From the spectral point of view, this phenomena can be explained by the fact that the Reed-Muller and arithmetic spectra of Boolean functions can be interpreted in terms of Boolean function behavior and circuit characteristics. The Walsh spectral components carry even more information compared against Reed-Muller and arithmetic spectra. The spectral coefficients of a Boolean function can be interpreted in terms of changing the function with respect to a variable, i.e. so-called Boolean difference. Thus, spectrum computing can be implemented via Taylor expansion. The next step can be formulated as interpretation of spectral coefficients of a Boolean function as circuit characteristics (sensitivity, testing, fault propagation, etc.) We refer to the well-known results as follows. Akers [2] has introduce the notation of Boolean differences. Davio, Deschamps and Thayse have shown that coefficients of Reed-Muller expressions can be described by Boolean differences [8], [22]. They used so-called logic Taylor expansion. Relationship between Boolean differences and Gibbs differences were introduced in [9], Gibbs differences was studied in [20]. Arithmetic differences of Boolean functions was introduced by Tosic [?]. Spectral transformation of a polynomial forms of Boolean functions was presented in [18]. Technique of spectral transforms of Boolean and multiplevalued functions was developed in [27], [25], [26]. Decision Diagram (DD) technique for Reed-Muller, arithmetic and Walsh spectrum computing introduced in [11]. Matrix algorithms for Reed-Muller, arithmetic and Walsh spectrum computing have been mapped to parallel-pipelining architectures, so-called systolic processor, in particular [25]. The work was partially supported by NATO Collaborative Linkage Grant PST/CLG 979071, and NSERC Grant 239025-02 (Canada) Authors are with the Department of Electrical and Computing Engineering, University of Calgary, Canada, E-mail:
[email protected]
∂f = f (x1 , ..., xi , ..., xn ) ⊕ f (x1 , ..., xi , ..., xn ). ∂xi
(II.1)
The following formula is preferable for computation ∂f = f (x1 , ..., 1, ..., xn ) ⊕ f (x1 , ..., 0, ..., xn ). ∂xi
(II.2)
The Boolean difference is relevant to Reed-Muller expansion of a Boolean function. The logic Taylor series for a Boolean function f of n variables in point c ∈ 0, 1, . . . , 2n −1 is defined as f
=
n 2M −1
i=0
(c)
fi
(x1 ⊕ c1 )i1 . . . (xn ⊕ cn )in , | {z }
(II.3)
i−th term
where c1 , c2 , . . . , cn and i1 , i2 , . . . , in is the binary representation of c and i correspondingly, and the i-th coefficient is defined as (c) fi (d)
¯ ¯ ∂ n f (c) ¯ = ¯ ∂xi11 ∂xi22 . . . ∂xinn ¯
and d=c
i ∂xij
( 1, ij = 0 = , ∂xj , ij = 1
that is a value of the n-ordered Boolean difference of f where x1 = c1 , ..., xn = cn . It follows from this definition that the logic Taylor expansion produces 2n Reed-Muller expressions corresponding to 2n polarities. In spectral interpretation this means that every one of these expressions is the spectrum of a Boolean function in one of 2n polarities. A variable xj is 0-polarized if it enters into the expansion uncomplemented, and 1-polarized otherwise. The components of the logic Taylor series are Boolean differences. While the i-th spectral coefficient is described by a Boolean expression, it can be calculated in different ways, for example, matrix transformations, cube-based technique, DD technique, and probabilistic methods. Example 1: By equation (II.3), the Reed-Muller spectrum of an arbitrary Boolean function of two variables (n = 2) and the polarity c = c1 , c2 = 0, 1 (x1 is uncomplemented and x2
2
is complemented) is defined as a logic Taylor expansion of this function f
=
7 M
The matrix form of the arithmetic difference with respect to the i-th variable xi of a Boolean function f of n variables given by truth vector F is defined as [26]
(1)
fi (x1 ⊕ 0)i1 (x2 ⊕ 1)i2
e ∂f e 2n−i F =D e i ∂x
i=0
∂f (1) ∂f (1) ∂ 2 f (1) = f (1) ⊕ x2 ⊕ x1 ⊕ x1 x2 . ∂x2 ∂x1 ∂x1 ∂x2 It follows from this example that it is possible to calculate separate spectral coefficients or their arbitrary sets to characterize the pruned property of a logic Taylor expansion (II.3). Moreover, the logic Taylor expansion generates a family of 2n Reed-Muller spectra of a Boolean function. In terms of a signal processing theory, we can implement a transform in one of 2n bases. The matrix notation for the Boolean difference with respect to a variable xi of the Boolean function f given by the truthvector F = [f (0) f (1) . . . f (2n − 1)]T is defined as ∂F (i) = D2n F, ∂xi
(II.4)
(i)
D2n = I2i−1 ⊗ D2 ⊗ I2n−i ,
e 2n−i of size 2n−i × 2n−i , called the where the matrix D arithmetic differential matrix, is generated by the rule h i 1 e 2n−i = I2i−1 ⊗ −1 ⊗ I2n−i (III.3) D 1 −1 and I2n−i is the identity matrix. IV. L OGIC TAYLOR EXPANSION FOR MULTI - VALUED FUNCTIONS REPRESENTATION
The logic Taylor series for an m-valued function f of n variables at the point c ∈ 0, 1, . . . , mn − 1 is defined as f=
n mX −1
(c)
fi
i=0
where F is the truth vector of the function f , the (2n × 2n−i ) (i) matrix D2n , called the Boolean differential matrix, is formed by the Kronecker product
(III.2)
(x1 ⊕ c1 )i1 . . . (xn ⊕ cn )in (mod m), (IV.1) | {z } i−th term
where m is a prime number, c1 c2 . . . cn and i1 i2 . . . in is the m-valued representation of c and i correspondingly, and the i-th coefficient is defined as
(II.5) ∂ n f (d)
(c) fi
¯ ¯ ¯ ¯ ¯
= (IV.2) hwherei n is the number of variables in the function, D2 = m−i1 m−i2 m−in 1 1 , and I is (p × p) the identity matrix. d=m−c p ∂ x ˆ1 ∂ x ˆ2 . . . ∂ x ˆn 1 1 Example 2: Switching function f = x1 x2 is given by 1, m−ij m = ij , the truth-vector F = [0 0 0 1]T . To calculate the Boolean (IV.3) ∂ x ˆi = m−ij ∂ x (1) ∂f ˆj , m 6= ij , difference ∂x by (II.4), we find the differential matrix D 2 2 1 accordingly (II.5). The final calculation is shown in Fig. II. that is a value of the n-ordered logic difference of f where # x = c , ..., x = c . " 1 1 1 1 n n h i h i h i (1) 1 1 It follows from this definition that the logic Taylor ex. D22 = I20 ⊗ 11 11 ⊗I21 = 11 11 ⊗ 10 01 = 1 1 pansion produces mn Reed-Muller expressions corresponding 1 1 to mn polarities. In spectral interpretation this means that every one of these expressions is the spectrum of an m·0¸ m−ij x1 f n (1) 1 ∂F valued function in one of m polarities. A variable x ˆj is ∂ F = D F = 0 22 ∂x1 x2 F 1 0-polarized if it enters into the expansion uncomplemented, ∂x1 and t-polarized otherwise. The coefficients in the logic Taylor series are logic differences. While the i-th spectral coefficient is described by a logFig. 1. Computing the Boolean differences with respect to the input x1 for two-input OR gate ical expression, it can be calculated in different ways, for example, by matrix transformations, cube-based technique, Fundamentals of the Boolean differential calculus have been DD technique, and probabilistic methods. It is possible to developed in [5], [8], [22]. In a number of publications, the calculate separate spectral coefficients or their arbitrary sets to usefulness of differential models has been shown [9], [13], characterize the pruned property of a logic Taylor expansion. [14], [17]. Review of applications of logic differential calculus Example 3: By equation (IV.1), the Reed-Muller spectrum is given in [4]. of an arbitrary ternary (m = 3) function of two variables (n = 2) and the 7-th polarity c = 7, c1 , c2 = 2, 1 is defined as a logic Taylor expansion of this function III. A RITHMETICAL ANALOG OF LOGIC TAYLOR EXPANSION
The arithmetic analog of Boolean difference of a function f of n variables with respect to a variable xi is defined as [23]: ∂f = −f (x1 , ..., xi , ..., xn ) ⊕ f (x1 , ..., xi , ..., xn ). (III.1) ∂xi
f
= = +
2 3X −1
i=0 (7) f0 (7) f5
(7)
f1
(x1 ⊕ 2)i1 (x2 ⊕ 1)i2 =
(7) + f1 x ˆ2 + (7) 2 ˆˆ1 x x ˆ 2 + f6
(7) f2 x ˆˆ1 2
(7)
fi
i=0 (7) ˆ (7) + f3 x ˆ2 + f4 2 (7) ˆ (7) f7 x ˆ1 x ˆ 2 + f8
x ˆ22 +
8 X
x ˆˆi11 x ˆi12 ˆˆ1 x x ˆ2 + 2 2 x ˆˆ1 x ˆ . 2
3 (7)
Computing logic derivatives of fi (c) fi
3−ij
∂ x ˆi
∂ 2 f (d)
=
3−i1
the Walsh differences with respect to a variable xi we need three iterations. However, the same Boolean and arithmetic differences are calculated via one matrix. The Walsh multiple differences of a Boolean function are defined analogously to the multiple Boolean and arithmetic differences. An analog of the logic Taylor series of a Boolean function f of n variables in the Walsh domain is defined as [28]
is shown below.
3−i2
¯ ¯ ¯ ¯ ¯
∂x ˆ1 ∂ x ˆ2 d=7 1, 3 = ij
=
3−ij
∂ x ˆj ,
3 6= ij n
ˆˆ2 f1 = ∂f (7)/∂ x f2 = ∂f (7)/∂ x ˆ2 f3 = ∂ 2 f (7)/∂ x ˆˆ1 ∂ x ˆ2 ˆˆ1 ∂ x ˆˆ2 f4 = ∂ 2 f (7)/∂ x
2 −1 j1 j2 jn 1 X (j) W = n w (−1)(x1 ⊕c1 ) (x2 ⊕c2 ) ...(xn ⊕cn ) , (V.4) 2 j=0 c
ˆˆ1 ∂ x f5 = ∂ 2 f (7)/∂ x ˆ2 f6 = ∂f (7)/∂ x ˆ2 f7 = ∂ 2 f (7)/∂ x ˆ1 ∂ x ˆˆ2
where c1 c2 . . . cn and j1 j2 . . . jn are binary representations of c and j respectively, and the j-th coefficient is defined as
f8 = ∂ 2 f (7)/∂ x ˆ1 ∂ x ˆ2
wc(j) =
V. WALSH DIFFERENCES AND TAYLOR EXPANSION The Walsh difference in matrix form [28] is based on a (p ) factorized representation of the Walsh matrix W2ni . Given a truth table F of a Boolean function, the Walsh difference of Boolean function of n variables with respect to the variable xi is defined as ee ∂F (p) = W2n F, ee ∂xi
(V.1)
(p)
where 2n−i × 2n−i matrix W2n is called the Walsh differential matrix and is defined as the product of the n matrices (p)
W 2n =
1 (p1 ) (p2 ) (p ) W n W 2n . . . W 2n n , 2n 2
+
where p1 p2 . . . pn is a binary code of p. Example 4: Find the Walsh difference with respect to the variable x2 of a 3-variable Boolean function f given its truth vector X = [11101100]T . Since i = 2, then p1 p2 p3 = 010. The appropriate matrix transform yields
=
1 (c) (p ) (p ) (p ) W 3 F = W231 W232 W233 F 23 2 (p )
(p )
(p )
where matrices W23 1 , W23 2 , and W23 3 are formed by (V.2) for p1 = 0, p2 = 1, p3 = 1 as given in Figure 2. The e e
result is e∂X = (1/8)[3 3 − 3 − 3 3 3 − 3 − 3]T . Notice e 2 ∂x that the 0-polarity Walsh expression of the initial function is W0 = 213 (5 + (−1)x3 + 3(−1)x2 − (−1)x2 +x3 + (−1)x1 + (−1)x1 +x3 (−1)x1 +x2 − (−1)x1 +x2 +x3 ). Here the coefficient (2) (2) w0 has a value obtained from the above difference: w0 = e e (0) ∂f e e 2 ∂x
=
+
(V.3)
ee ∂F ee ∂x 2
W3
(V.2)
(p )
= 3. Fig. 2 contains the Walsh differential matrices and corresponding flow graphs of the Walsh differences for a 3variables function f . We observe that in order to calculate
(V.5)
that is, the value of a n-ordered Walsh difference of f given (j) c i.e. (x1 = c1 , ..., xn = cn ). The coefficients wc (V.5) are called the Walsh spectrum of the Boolean function f . Example 5: The Walsh spectrum of an arbitrary Boolean function of three variables can be represented by (V.4) of polarity c = 3 (c1 c2 c3 = 011) as follows
=
matrix W2ni is formed by the rule £ ¤ pi = 0, I2i−1 ⊗ 11 11 ⊗ I2n−i , 1 (p ) W 2n i = £ ¤ 2 I2i−1 ⊗ −11 −11 ⊗ I2n−i , pi = 1,
f ∂fn f (c) ee j1 ee j2 ee jn ∂x 1 ∂x2 . . . ∂xn
7 j1 j2 j3 1 X (j) w (−1)(x1 ⊕0) (x2 ⊕1) (x3 ⊕1) 8 j=0 3
f e e f2 f (3) e (3) e (3) 1 ∂f ∂f ∂ (w(3) + (−1)x3 + (−1)x2 + (−1)x2 x3 e e e e 8 e e e e 3 ∂x3 ∂x2 ∂x2 ∂x f2 f e f f2 f (3) e (3) ∂f ∂ f (3) ∂ (−1)x1 + (−1)x1 x3 + (−1)x1 x2 e e e e e e e e e e ∂x1 ∂x1 ∂x3 ∂x1 ∂x2 f f3 f (3) ∂ (−1)x1 x2 x3 ). e e e e 1 ∂x e 2 ∂x e 3 ∂x p
L Definition 1: [27] The differential operator Lxi (L−operator for short) of a Boolean function f with respect to the variable xi and parameter p = p1 p2 . . . pn is specified by
Lp i f = f (x1 . . . xi . . . xn )+(−1)pi f (x1 . . . xi . . . xn ) (V.6) Lxi Hence ½ Lp i f f (x1 . . . 1 . . . xn ) + f (x1 . . . 0 . . . xn ), pi = 0, = f (x1 . . . 1 . . . xn ) − f (x1 . . . 0 . . . xn ), pi = 1. Lxi This operator detects all the possible changes of a Boolean 1 e f ∂f recfunction with respect to a given variable: L e Lxi = − ∂x 0
i
f ognizes changes of function, and difference L Lxi distinguishes two cases when the function is unchanged (0 to 0, or 1 to 1). It follows from n-iteration transform (V.1) that Walsh difference with respect to a variable xi of an n-variable Boolean function f given by truth vector X is the multiple differential operator [27]
f f Lp 1 Lp n f ∂f = (. . . ( )), ee Lx1 Lxn ∂x i
(V.7)
4 (p )
(p )
W 23 1
e e ∂f e e ∂x1
=
(p )
W 23 2
1
-1 1
-1 -1
1 1
-1 1
-1
1
-1
1
-1 -1
1
1 1
W23 3
1
1 1
1
1 1
1 1
1
1
1 1
1
F
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1
e e ∂f e e 2 ∂x
=
1
1 1
1 1
1 1
1
1 1
1
1 1
1 1
1 1
-1 -1 1
-1
1
-1
1
-1 1
1
-1 1
-1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1
-1
e e ∂f e e 3 ∂x
=
1
1 1
1 1
1 1
1
1 1
1
1 1
1 1
1
1 1
1
1 1
1
1 1
1 1
1
1
1 1
1
1
1 -1 -1 1 1 -1 -1 1 1 -1 -1 1 1 -1 -1 1
x(0) x(1) x(2) x(3) x(4) x(5) x(6) x(7)
x(0) x(1)
x(2) x(3) x(4) x(5) x(6) x(7)
x(0) x(1)
x(2) x(3) x(4) x(5) x(6) x(7)
Fig. 2. Matrix based computing of the Walsh differences with respect to a variables of Boolean function of three variables and corresponding flow graphs of algorithms (nodes realize arithmetic operations )
where pi = 1 and pj = 0 for j 6= i. The Walsh difference with respect to xi corresponds to a e 2n−i , ”butterfly” configuration of the flow graph or matrix D the standard matrix representation of the i-th iteration of the fast Walsh transform. A particular case of (V.7) is when p = 1 . . . 1, i.e. the Walsh difference with respect to a variable xi is equal to the n-th order arithmetic difference with opposite sign. We need to develop an effective algorithm to compute the Walsh differences in the form of (V.7), i.e. an algorithm to implement the L-operator. Table I contains four cases of the behavior of a Boolean function with respect to a variable xi , described in terms of arithmetic differences. Walsh differences, in contrast to Boolean differences and arithmetic differences [26], distinguish the cases of unchanging function (0 to 0 when the Walsh difference is equal to 0, and 1 to 1 when it is equal to 2). Table II contains the Walsh coefficients and symbolic form for the EXOR function. TABLE I B EHAVIOR OF B OOLEAN FUNCTION f
f fxi =0 fxi =1 fxi =0 fxi =1
= 0, =0 = 0, =1
fxi =0 fxi =1 fxi =0 fxi =1
= 1, =0 = 1, =1
e e (0) ∂f e e i ∂x
= 0 1
L0 f Lxi
e e (1) ∂f e e i ∂x
=
L1 f Lxi
0
TABLE II WALSH SPECTRUM AS TAYLOR EXPANSION OF FUNCTION x1 ⊕ x2 Walsh spectrum
2
X
e e ∂f e e 2 ∂x
e e ∂f e e 1 ∂x
e e f ∂ e e e 2 e 1 ∂x ∂x
2 2 2 2
0 0 0 0
0 0 0 0
−2 2 2 −2
Walsh expression 1 4 [2 1 4 [2 1 4 [2 1 4 [2
− 2(−1)x1 x2 ] + 2(−1)x1 x2 ] + 2(−1)x1 x2 ] − 2(−1)x1 x2 ]
Let a Boolean function is given by their SOP cubes [C] (tuples that corresponds to products in the sum-of-product expression, 0 corresponds to term xi , 1 corresponds to xi , and x corresponds to don’t care). When calculation of arithmetical or Walsh difference over cubes [C]xi =0 and [C]xi =1 (i.e. cubes where term corresponding to xi takes value 0 and 1 accordingly), the term can take value a = −xi + xi = (−1)xi or b = −xi + xi = (−1)xi . The corresponding cubes will be defined as [C]xi =a and [C]xi =b . Table III gives the basic operations over the cubes by the L-operator (sign plus and value equal to one is not indicated). TABLE III T HE BASIC OPERATIONS OVER THE CUBES IN THE WALSH FORM
1
1
−1
2
0
Walsh differences can be calculated based on cube techniques [28]. Below we will compare this techniques against DD based calculations.
Cube [C]xi =0 [C]xi =1 [C]xi =x
L1 Lxi [C]xi =x [C]xi =x 2[C]xi =x
L0 Lxi
[C]xi =b [C]xi =a ∅
It has been shown in [28] that the Walsh difference with respect to the variable xi of a Boolean function is a sum of the Walsh differences derived from the cubes [Ci ] representing
5
the Walsh form of this function t ee e X ∂e ∂f = [Ci ]. (V.8) ee ee ∂x ∂x i=1 i i Example 6: Let p = 0. Calculate the Walsh spectral coefficient w(9) for a 5-variable function f , given by cubes corresponding to an arithmetic expression. Applying the L0 -operator we obtain
0
L Lx4
0 1 0 1 x
x x 1 1 0
0 x x x x
1 1 x x 0
x 1 1 0 0
=
0 1 0 1 x
x x 1 1 0
0 x x x x
x x x x x
x 1 1 0 0
1 1 2 2 1
diagram for representation of arithmetical expressions utilizes arithmetical analogs of Davio expansion. The so-called Walsh spectral diagram is known too [16]. The alternative approach is based special spectral diagrams in which nodes the iteration of fast Fourier like transform are implemented [20]. Yet another approach is based calculation of Taylor coefficients (for Reed-Muller, arithmetical or Walsh spectrum) directly from the given Reduced Ordered Binary Decision Diagram (ROBDD) of a boolean function. It applies the search along with the paths in the ROBDD [27]. Below we give an example of computing the Taylor coefficients, Walsh spectrum values, on the initial ROBDD, derived from the initial PLA format of the functions.
where the last row is with sigh minus, or in symbolic form 0
L f Lx4
0
= + =
0
0
L L L [0x01x] + [1xx11] + [01xx1] Lx4 Lx4 Lx4 L0 L0 [11xx0] − [x0x00] Lx4 Lx4 x1 x3 + x1 x5 + 2x1 x2 x5 + 2x1 x2 x5 x2 x5 − x2 x5 . 0
f Thus, w(2) = L Lx4 |p=00010 = 1 + 0 + 0 + 0 − 1 = 0. The calculation of the Walsh spectral coefficients corresponding to multiple Walsh differences is illustrated by the next example. 2 f for the Example 7: Calculate the Walsh difference ∂x∂1 ∂x 3 arithmetic function f = [10x] + [xx0] − [100]. We apply L0 operator to variable x2 , and L1 operator to variables x1 , x3 :
TABLE V E XPERIMENTAL R ESULTS ON D ECISION DIAGRAM BASED WALSH S PECTRUM C OMPUTATION
Test Name SBDD apex4 982 ex1010 1047 alu4 721 misex3 537 add6 32 duke2 353 vg2 83 misex2 80 e64 129 Total
Walsh Spectra [time(s)] at p=0 256 1024 4096 16384 0.500 0.820 1.380 1.210 1.530 1.590 2.900 0.510 2.740 3.500 4.100 0.550 0.550 0.610 0.540 0.540 0.610 1.540 0.270 0.330 0.380 0.380 0.050 0.050 0.600 0.720 0.230 0.270 0.440 0.830 4.680 7.390 7.730 10.470
DD [11] 256 1024 0.02 0.02 0.06 0.01 0.04 0.01 0.07 0.01 0.02 0.01 0.02 0.01 0.02