You are on page 1of 28

Majority Logic

Logic synthesis with 3-input majority elements


Majority decomposition
x1
x1

xn

xn

Logical Synthesis with 3-input majority


elements
Maj(x0,x1,x2) = Sign(x0+x1+x2-2) = x0#x1#x2 = x0x1+x0x2+x1x2
AND:
OR:

x0x1 = x0#x1#0;
x0+x1 = x0#x1#1;

Any logical function of three variables can be


implemented by a two-level circuit of four majority
elements with negations at the inputs of the first
level.

Majority based implementation of


functions of 3 variables
=

x0 x1 x2 = ( x0 x2 ) x1 = ( x0 # x2 # 0) # x1 # 0

( x0 + x1 ) x2 = ( x0 # x1 #1)# x2 #0
3

x0 x1 x2 + x0 x1 x2
= ( x0 x1 + x0 x2 + x1 x2 )( x0 + x1 )
= ( x0 # x1 # x2 ) #( x0 # x1 #1) # 0

x0 x1 x2 + x0 x1 x2 = ( x0 # x1 #1)#( x1 # x2 #0)#( x1 # x2 #0)

x1 x2 + x0 x1 x2 = ( x1 # x2 #1)#( x1 # x2 #0)#( x0 # x1 #0)

x0 x1 x2 + x0 x1 x2 + x0 x1 x2 =
= ( x0 # x1 # x2 )#( x0 # x1 # x2 )#( x1 # x2 #0)

x0 x1 + x0 x2 + x1 x2 = x0 # x1 # x2

x0 x2 + x1 x2 = ( x0 # x2 #1)#( x1 # x2 #1)#0

x0 x2 + x1 x2 + x0 x1 x2 = ( x0 # x1 # x2 )#( x0 # x2 #1)#( x1 # x2 #0)

x0 x1 x2 = ( x0 # x1 # x2 )#( x0 # x1 # x2 )# x2

Majority decomposition
Any circuit is a composition of simple (basic) elements (functions).
Hence, the problem of synthesizing a circuit of defined function is a
problem of representing the defined function as superposition of basic
element functions (decomposition, mapping).
The synthesis can be descending (from output, top-down) or
ascending (from inputs, down-top)
For the descending procedure:
1. Fix the output element function. In our case, the majority function :

F ( X ) = Y1 ( X )# Y2 ( X )# Y3 ( X )
2. Looking for functions Yj(X), the implementation of each of which is
guaranteed to be simple by certain criteria than that of F(X).
There are at least two of such criteria:
Reduction of the set of variables of Yj(X).
Reduction of the Yj(X) domain. (Reduction of the number of vertexes on
which function is defined).
7

Majority decomposition (cont)


Reduction criteria:
A. Reduction of the set of variables of Yj(X).

F1 = x1 x2 x3 x4 x5 x6 , F2 = x1 x2 x3 + x1 x2 x4 + x2 x3 x4
B. Reduction of the Yj(X) domain. (Reduction of the number of vertexes
on which function is defined).

F1 = (0,1, 2, 4), F2 = (1) + (0, 2, 4)

Reduction of the Yj(X) domain

if

if

F(X) = 1 then

F(X) = 0 then

or
or

Y1 ( X ) = 1; Y2 ( X ) = 1; Y3 ( X ) = *

or
or

Y1 ( X ) = 0; Y2 ( X ) = 0; Y3 ( X ) = *

Y1 ( X ) = 1; Y2 ( X ) = *; Y3 ( X ) = 1
Y1 ( X ) = *; Y2 ( X ) = 1; Y3 ( X ) = 1

Y1 ( X ) = 0; Y2 ( X ) = *; Y3 ( X ) = 0
Y1 ( X ) = *; Y2 ( X ) = 0; Y3 ( X ) = 0

Example
000
00

001

011

010

11

10

111

101

01

wv

110

1
1

100
1

xyz

F ( x, y, z , v, w) =
= xyz + xzw + xvw + xyzv + yzvw + yzv + wvz
10

Inputs
z

No

F(X)

Y1(X)

0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1

0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1

0
0
0
0
1
1
1
1
0
0
0
0
1
1
1
1
0
0
0
0
1
1
1
1
0
0
0
0
1
1
1
1

0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

1
1
0
1
0
0
0
0
0
0
0
1
0
1
0
0
1
1
0
1
0
1
1
1
1
1
1
1
0
1
0
0

*
*
0
1
*
1
*
*
0
0
0
1
0
1
*
*
*
*
0
1
0
1
1
1
*
*
*
1
0
1
*
*

Components
Y2(X)
Y3(X)
1
1
0
*
0
0
0
0
*
*
*
1
*
1
0
0
1
1
0
*
0
*
*
*
1
1
1
*
*
1
0
0

1
1
*
1
0
*
0
0
0
0
0
*
0
*
0
0
1
1
*
1
*
1
1
1
1
1
1
1
0
*
0
0

11

000
00

001

011

010

11

10

000
00

1
1

001

011

010

11

10

000
00

wv

1
1

001

011

010

10

1
1

100

110

111

101

100

Y1( X ) = x # y # z
0

xyz

Y2 ( X ) = y # z # v

110

111

101

100

xyz

Y3 ( X ) = z # v # w

xyz

01
11

101

01

wv

111

01

wv

110

12

Reduction of the set of variables of Yj(X)


From the implementations of 3-variable functions given above it follows
that any function of n variables can be implemented in a form:
f1(x ,W)
f2(y ,W)
f3(z ,W)

f4(x ,W)
f5(y ,W)
f6(z ,W)

F(x ,y ,z ,W)

f7(x ,W)
f8(y ,W)
f9(z ,W)

#
.

13

Example
F( x , y, z, W ) = xyzw 2 + xyz w 2 + x yw 1 + xyw 1 + xy zw 2 + xyzw 2
000

001

011

00

110

111

01

w1w2

010

101

10

xyz

11

100

1
1

1
1

14

000

001

011

00

11

10

000

001

101

010

110

111

101

10

000

001

011

00

10

Y2 = x # z # w2

010

110

111

101

100

11

xyz

01

100

1
1

Y1 ( x, y, z,W ) = x # y # w1 =
= x y + x w1 + yw1

11

xyz

011

100

01

w1w2

111

00

w1w2

110

01

w1w2

010

F ( X ) = Y1 ( X )# Y2 ( X )# Y3 ( X )

xyz

Y3 = x # z # w2

1
1

F ( x, y, z,W ) = ( x # y # w1 )# ( x # z # w2 )# ( x # z # w2 )

15

Reduction of the set of variables of Yj(X)


From the implementations of 3-variable functions given above it follows
that any function of n variables can be implemented in a form:
f1(x ,W)
f2(y ,W)
f3(z ,W)

f4(x ,W)
f5(y ,W)
f6(z ,W)

F(x ,y ,z ,W)

f7(x ,W)
f8(y ,W)
f9(z ,W)

#
.

16

Example

F( x , y, z, W ) = xyzw 2 + xyz w 2 + x yw 1 + xyw 1 + xy zw 2 + xyzw 2


17

W1=0; W2=0;

W1=1; W2=0;

W1=0; W2=1;

W1=1; W2=1;

Y1

18

W1=0; W2=0;

xy = x # y # 0

W1=1; W2=0;

x + y = x # y #1

W1=0; W2=1;

xy = x # y # 0

W1=1; W2=1;

x + y = x # y #1
Y1

f 1 (W , x ) = w1 w 2 x + w1 w 2 x + w1 w 2 x + w1 w 2 x = x
f 2 (W , y ) = w1 w 2 y + w1 w 2 y + w1 w 2 y + w1 w 2 y = y
f 3 (W , z ) = w1 w 2 0 + w1 w 2 1 + w1 w 2 0 + w1 w 2 1 = w1
Y1 (W , x , y , z ) = f 1 # f 2 # f 3 = x # y # w1

19

Some of vertexes may be defined arbitrary:


W1=0; W2=0;

W1=1; W2=0;

F ( X ) = Y1 ( X )# Y2 ( X )# Y3 ( X )
Y1 ( x, y, z,W ) = x # y # w1 =
= x y + x w1 + yw1

W1=0; W2=1;

Y2 = x # z # w2
Y3 = x # z # w2

W1=1; W2=1;

20

Y1( X ) = x # y # z

Y2 ( X ) = y # z # v

Y3 ( X ) = z # v # w

21

Representation of Y1
Y1 ( x, y, z,W ) = x # y # w1 =
= x y + x w1 + yw1

Finally, it can be checked that:

F ( x, y, z,W ) = ( x # y # w1 )# ( x # z # w2 )# ( x # z # w2 )

22

Varshavsky and
Rozenblum Methods 1968

23

From the Shannon expansion:

f ( x1 ,, xn ) = xi f ( xi = 1) x i f ( xi = 0)
we have:

f ( x1 ,, xn ) = ( f ( xi = 1) # xi # 0 ) # f ( xi = 0 ) # x i #0 #1
After the extraction of the next variable:

f ( x1 ,, xn ) =

((( f ( x = 1, x = 1) # x #0) # ( f ( x = 1, x = 0) # x #0) #1) # x # 0) #


((( f ( x = 0, x = 1) # x #0) # ( f ( x = 0, x = 0) # x #0) #1) # x #0) #1
i

24

Lemma:

( ( a # x #0 ) # ( b # x #0 ) #1) # x
i

#0 =

= ( a # xi #0 ) # ( b # xi #0 ) # x j
Theorem:
f ( x1 ,, xn ) =

(( f ( x = 1, x = 1) # x #0) # ( f ( x = 1, x = 0) # x #0) # x ) #
# ( ( f ( x = 0, x = 1) # x #0 ) # ( f ( x = 0, x = 0 ) # x #0 ) # x ) #1

25

xk

f ( xi =0,xj =0, xk =0)

xj

f ( xi =0, xj =0, xk =1)

xk
f ( xi =0, xj =1, xk =0)

f ( xi =0, xj =1, xk =1)

xk
f ( xi =1, xj =0, xk =0)

f ( xi =1, xj =0, xk =1)

f ( xi =1, xj =1, xk =0)

f ( xi =1, xj =1, xk =1)

Variables reordering based expansion.


f ( x1,x2,x3,....,xn)

xi
xj
xk

26

Variables reordering based expansion. Example

x1

x2

x2

x3

x4

x3

x4

x3

x4
27

y = (a + b + c + d ) (ab + ac + ad + bc + bd + cd ) (abc + abd + acd + bcd )abcd

= M

1
1

4
1

0
1

4
2

4
3

0
1

4
4

= M

1
0

4
1

11
10

4
2

4
3

1
1

1
0

1
0
0 = M
0
0

1
1

0
1

4
1

4
2

4
3

))

0
1
1
1
1

0
1

= M14 M 24 0 & 1 = M14 M 24 0 = M14 M 24 1 = M14 1 1 = 1 & 1 = 1 & 0 = 0 = a b c d


0

01

01

0
28

You might also like