Page 1

Representation of Incompletely Specified Index Generation Functions Using

Minimal Number of Compound Variables

Tsutomu Sasao, Takaaki Nakamura , Munehiro Matsuura

Kyushu Institute of Technology, Iizuka 820-8502, Japan

Abstract

This paper shows a method toreduce thenumber ofinput

variables to represent incompletely specified index genera-

tion functions. A compound variable is generated by EX-

ORing the original input variables. By using both origi-

nal and compound variables, incompletely specified index

generation functions can be represented by fewer variables.

As a means to select variables, a heuristic method using

information gains is presented. We compare representing

random functions using 1. only original variables, and 2.

both original and compound variables. Experimental re-

sults show that the use of compound variables effectively

reduces the number of input variables.

1Introduction

Consider an index generator that stores k different n-bit

vectors, and produces an output of 0 if an n-bit input vector

does not match the contents of any of the k vectors. If a

match occurs, the output is the index of the matched vector.

Index generators are used in IP address lookup [12] and

terminal access controllers [10]. To implement index gener-

ators, CAM (Content Addressable Memory) or PLA (Pro-

grammable Logic Array) can be used. However, power dis-

sipation for these devices is relatively high [11]. Thus, im-

plementationsusingordinarymemoriesaredesirable. How-

ever, the single-memory realization of index generators is

impractical, since n, the number of input variables, is often

larger than 32. To reduce the memory size, a method using

a main memory and an auxiliary memory has been devel-

oped [10]. In an index generator, the number of registered

vectors k, is much smaller than the number of the possible

input combinations, 2n. In such a case, the size of the main

memory is drastically reduced by reducing the number of

input variables.

Inthispaper, weconsiderareductionmethodoftheinput

variables for incompletely specified index generation func-

tions. In this case, the given function is realized by reduced-

input memories and some extra circuits consisting of EXOR

gates, registers and multiplexers. The rest of the paper is or-

ganized as follows: Section 2 defines incompletely spec-

ified index generation functions, and shows their proper-

ties. Section 3 shows a method to represent an incompletely

specified index generation function using a minimalnumber

of compound variables. Section 4 shows an index genera-

tor using memories. Section 5 shows a heuristic method

to reduce the number of variables to represent incompletely

specified index generation functions. Section 6 shows ex-

perimental results for the exact and heuristic methods. Fi-

nally, Section 7 summarizes the work.1

2 Incompletely Specified Index Generation

Functions

Definition 2.1 Let D = {? a1,? a2,...,? ak} be a set of k dif-

ferent vectors in Bn, where B = {0,1}. Each vector in

D is called a registered vector. The index table con-

tains the corresponding index i for each vector ? vi, where

i ∈ {1,2,...,k}.

f : Bn→ {1,2,...,k} is an index generation function

with weight k if

f(? ai)

f(?b)

=

=

i,(when? ai∈ D),and

0,(otherwise),

where i ∈ {1,2,...,k}.

ˆf : Bn→ {1,2,...,k,d} is an incompletely specified

index generation function with weight k if

f(? ai)

f(?b)

=

=

i,(when? ai∈ D),and

d,(otherwise),

where d denotes the don’t care value.

The number of variables to represent incompletely specified

logic functions can often be reduced [1, 2, 6, 10].

1The affiliation of the second author is currently, Elpida Memory Inc.,

Tokyo 104-0028, Japan.

Page 2

41110

x4

1

x3

0

x2

0

x1

0

30011

21101

1

24

1

3

x1

x2

x3

x4

),,,(

4

^

3211

xxxxf

1f

(a) Index Table

(b) Decomposition Table

^

Figure 2.1. Reduction of variables to repre-

sent an incompletely specified index gener-

ation function

Example 2.1 Consider

Fig. 2.1(a).

for the incompletely specified index generation function

is shown in Fig. 2.1(b), where blank cells denote don’t

cares. In this function, for the vectors ? a1 = (0,0,0,1),

? a2 = (1,0,1,1), ? a3 = (1,1,0,0), and ? a4 = (0,1,1,1),

the values of functions areˆf1(? a1) = 1,ˆf1(? a2) = 2,

ˆf1(? a3) = 3, andˆf1(? a4) = 4, respectively. For other inputs,

the values ofˆf1are d (don’t care or undefined).

In the decomposition chart, when each column has at

most one specified element, then the function can be repre-

sented by column variables only, since for each column, all

don’t cares values can be set to the specified value in that

column. In Fig. 2.1(a), values for (x1,x2) are distinct, and

the index can be specified by using only these two variables.

theindextableshown in

The corresponding decomposition chart

(End of Example)

As shown in the above example, in the decomposition chart,

when each column has at most one specified element, the

function can be represented by using only column variables.

Example 2.2 Consider the index table in Fig. 2.2, and

the decomposition chart for an incompletely specified in-

dex generation functionˆf2. Consider the number of vari-

ables to represent the function. In the decomposition chart

in Fig. 2.2(a), two non-zero elements exist in the column

(x1,x2) = (1,1). Thus, the functionˆf2cannot be repre-

sented by {x1,x2}. Similarly, in the row (x3,x4) = (1,1),

two non-zero elements exist, and the functionˆf2cannot be

represented by {x3,x4}, either.

Next, let us change the partition of the input variables

into (x1,x4) and (x2,x3) as shown in Fig. 2.2(b). In this

case, each column has at most one specified element. Note

that in the index table in Fig. 2.2(b), values of the vectors

(x1,x4) are all different. Thus, the functionˆf2can be rep-

resented by using only {x1,x4}.

As shown in the above examples, to represent incompletely

specified index generation functions, input variables can be

(End of Example)

41

x1

111

x4

0

x3

1

x2

0

x1

0

30011

21110

1

1

42

3

x2

(a)

x3

x4

41111

x3

1

x2

0

x4

0

x1

0

30101

21110

1

3

42

1

x1

x4

(b)

x2

x3

),,,(

43212

xxxxf

2 f

),,,(

43212

xxxxf

2 f

^

^

^

^

Figure 2.2. Reduction of variables to repre-

sent an input incompletely specified index

generation function

often reduced. Minimization methods of input variables for

single-output incompletely specified functions are consid-

ered in [1, 2].

Lemma 2.1 Let p be the number of variables to represent

an incompletely specified index generation function with

weight k. Then, we have the following relation:

p ≥ ?log2(k + 1)?.

For example, let k + 1 = 2p. Consider the complete binary

tree of height p. The k registered vectors can be distin-

guished by using p variables.

The minimization of the variables for an incompletely

specified index generation function can be done by reducing

the height of the binary tree representing the registered vec-

tors. To reduce the height of the tree, the variables should

be selected so as to make the height of the subtree as equal

as possible. That is, the variables should be selected so as to

make a balanced tree. This idea will be used in a heuristic

algorithm to reduce the number of input variables as ex-

plained later. Experimental results show that, most incom-

pletely specified index generation functions with weight k,

can be represented by 2?log2(k+1)?−1 or fewer variables

[10].

Conjecture 2.1 Let p be the number of variables to rep-

resent an incompletely specified index generation function

with weight k. Then, for most index generation functions,

we have the following relation:

p ≤ 2?log2(k + 1)? − 1.

Page 3

3Representation of Index Generation Func-

tions Using Compound Variables

In this part, we show a method to reduce the number of

variables to represent an incompletely specified function by

using compound variables.

Definition 3.1 For n input variables {x1,x2,...,xn}, a

compound variable y has a form

y = c1x1⊕ c2x2⊕ ··· ⊕ cnxn,

where ci ∈ {0,1}. The compound degree of y is δ =

?n

compound variable, and a variable with compound degree

3 is a tri-compound variable.

i=1ci. A variable with compound degree 1 is a primi-

tive variable. A variable with compound degree 2 is a bi-

Example 3.1 Consider the incompletely specified index

generationfunctionˆf3showninFig.3.1. Considerthenum-

ber of variables to represent this function. In Fig. 3.1(a),

the column (x1,x2) = (1,1) has two non-zero elements.

So, the function cannot be represented by {x1,x2}. In a

similar way, the row (x3,x4) = (1,1) has two non-zero el-

ements. So, the function cannot be represented by {x3,x4}.

Note that the decomposition chart with other partitions pro-

duce the same results. Thus, to represent the functionˆf3, at

least three variables are necessary. Next, consider the bi-

compound variables y1= x1⊕ x2and y2= x2⊕ x3. In

this case, we have the function ˆ g3(y1,y2,x3,x4) shown in

Fig. 3.1(b). Note that, in the decomposition chart shown in

Fig. 3.1(b), each column has at most one specified element.

Thus, the function ˆ g3can be represented by using only two

variables {y1,y2}.

As shown in the above example, by using compound

variables, the number of input variables for incompletely

specified index generation functions can be further reduced.

In the rest of the paper, both a primitive variable xiand a

compound variables yjare treated as input variables.

(End of Example)

4Index Generator

Fig. 4.1 is an index generator using two memories[10].

The programmable hash circuit has n inputs and at most

2?log2(k+1)?−1outputs. Itisusedtorearrangethecareel-

ements. This corresponds to compound variable generators.

We consider three types of programmable hash circuits.

The first type generates primitive variables as shown in

Fig. 3.2. It consists of p multiplexers, and selects variables

from n input variables. When only primitive variables are

used, the circuit in Fig. 3.2 can be used.

The second type generates bi-compound variables as

shown in Fig. 3.3.It performs a linear transformation

40

x1

111

x4

1

x3

1

x2

1

x1

0

31011

21101

1

4

21

3

x2

(a)

x3

x4

40

y1

100

x4

1

x3

1

y2

0

y1

1

31010

21111

1

4

12

3

y2

(b)

x3

x4

211

x

x

x

x

y

y

⊕

⊕

=

=

322

),,,(

4

f3

3213

xxxxf

),,,(

4

g

3213

xxyyg

3

^

^

^

^

Figure 3.1. Incompletely specified index gen-

eration function represented by compound

variables.

n

n n

22ixy =

1

1ixy =

n

ipp

xy =

Figure 3.2. Primitive

variable generator.

n

n

+

n

n

+

n

n

+

1

1

1ji

xxy

⊕=

2

2

2ji

xxy

⊕=

tj

t i

p

xxy

⊕=

Figure

compound

able generator.

3.3. Bi-

vari-

yi = xi⊕ xj or yi = xi, where i ?= j. It uses a pair

of multiplexers for each variable yi. The upper multiplex-

ers have the inputs x1,x2,...,xn. The lower multiplexers

have the inputs x1,x2,...,xn, except for xi. For the i-th

input, the constant input 0 is connected instead of xi. By

setting yi= xi⊕ 0, we can implement yi= xi. The val-

ues of control variables for the multiplexers are stored in the

registers. Thus, an arbitrary variable can be selected from n

input variables. Fig. 3.3 generates bi-compound variables.

The third type generates tri-compound variables. For

each output, it requires three multiplexers and a three-input

Page 4

n

n

Programmable

Hash

Circuit

Main

Memory

AUX-Memory

Comparator

n

1+ ) 1+( log2

2

k

) 1

+

( log2

k

) 1+( log2

k

Figure 4.1. Index generator using two memo-

ries.

EXOR gate (the figure is omitted).

The main memory has at most 2?log2(k + 1)? − 1 in-

puts and ?log2(k + 1)? outputs. The main memory pro-

duces correct outputs only for registered vectors. However,

it may produce incorrect outputs for non-registered vectors,

because the number of input variables is reduced by using

don’t care conditions. In an index generation function, if

the input vector is non-registered, then it should produce

0 outputs. To check whether the main memory produces

the correct output or not, we use the AUX memory. The

AUX memory has ?log2(k + 1)? inputs and n outputs: It

stores the registered vectors for each index. The compara-

tor checks if the inputs are the same as the registered vector

or not. If they are the same, the main memory produces

a correct output. Otherwise, the main memory produces a

wrong output, and the input vector is non-registered. In this

case, the output AND gates produce 0 outputs, showing

that the input vector is non-registered. Note that the main

memory produces the correct outputs only for the registered

vectors. In this way, we can implement an incompletely

specified index generation function instead of a completely

specified one2in the main memory. Let p = ?log2(k+1)?.

Then, the number of bits in the main memory is at most

p22p−1≈

memory is n2p≈ n(k + 1). In many cases,1

thus, the size of the AUX memory is much smaller than that

of the main memory.

1

2p(k + 1)2. The number of bits in the AUX

2kp >> n,

5 Methods to Select Compound Variable

When only primitive variables are used, the number of

variables for an incompletely specified index generation

function can be minimized by solving a kind of a minimum

covering problem [6, 10].

2The output AND, the AUX memory and the comparator are used to

establish observability don’t cares for the main memory.

Algorithm 5.1 (Exact minimization of the number of vari-

ables to represent an incompletely specified index genera-

tion function)

1. Representtheconditionstodistinguishthepairsofreg-

istered vectors by logical expressions.

2. Obtain the minimum weight assignments to the values

that cause the values of logical expressions to be 1.

Example 5.1 Let us minimize the number of variables to

represent the incompletely specified index generation func-

tionˆf2shown in Fig. 2.2(a).

1. Let the four registered vectors be ? a1 = (0,0,1,0),

? a2

= (0,1,1,1), ? a3

(1,1,1,1).

= (1,1,0,0), and ? a4

=

2. To distinguish? a1and? a2, either x2or x4is necessary.

Thus, we have the condition x2∨ x4= 1. Similarly,

to distinguish ? a1and ? a3, we have the condition x1∨

x2∨ x3 = 1; to distinguish ? a1and ? a4, we have the

conditionx1∨x2∨x4= 1; todistinguish? a2and? a3, we

have the condition x1∨x3∨x4= 1; to distinguish? a2

and? a4, wehavetheconditionx1=1; andtodistinguish

? a3and? a4, we have the condition x3∨ x4= 1.

3. To distinguish all the registered vectors, all the con-

ditions must be true at the same time. Thus, we have

the condition R = 1, where R = x1(x2∨ x4)(x3∨

x4)(x1∨ x2∨ x3)(x1∨ x2∨ x4)(x1∨ x3∨ x4).

4. Bythedistributivelawandtheabsorptionlaw, wehave

the relation R = x1x2x3∨ x1x4. The degree of the

product term with the minimum number of literals is

two. The product term x1x4shows the minimum solu-

tion. Thus, the functionˆf2can be represented by two

variables x1and x4.

(End of Example)

In principle, the minimization of variables consisting of

both primitive and compound variables can be done in the

same way as Algorithm 5.1. That is, we can perform the

minimization of the variables, where not only the primi-

tive variables x1,x2,...,xn, but also the compound vari-

ables y1,y2,...,ymcan be considered as the input vari-

ables. When both the primitive and the bi-compound vari-

ables are used, the number of the input variables to consider

is

n +

2

When tri-compound variables in addition to the bi-

compound and the primitive variables are used, the number

of the variables to consider is

?n

?n

?

=n(n + 1)

2

.

n +

2

?

+

?n

3

?

=n(n2+ 5)

6

.

Page 5

This problem can be solved by first representing the log-

ical expressions by a BDD (Binary Decision Diagram), and

then finding the path with the minimum weight. When we

use a BDD to minimize the number of variables, the size

of the BDD increases exponentially with the number of the

input variables. Thus, only a limited number of input vari-

ables can be solved.

Definition 5.1 In an incompletely specified index genera-

tion function with weight k, the balance factor with respect

to xiis k − |hi0− hi1|, where hi0is the number of regis-

tered vectors such that xi = 0, and hi1is the number of

registered vectors such that xi= 1.

From here, we will consider a heuristic method to represent

incompletely specified functions. Variables with as large

balance factor tend to partition the set of vectors into more

balanced sets. Let k be the number of registered vectors.

When the given set of variables partitions the set of vectors

into balanced sets, the number of variables to represent the

function is reduced to ?log2(k+1)?. From this, we have the

following:

Algorithm 5.2 (Heuristic reduction of the number of vari-

ables)

1. Let the input variables be x1,x2,...,xn.

2. Select m compound variables yi. In this case, select

variables with as large a balance factor as possible.

3. By using Algorithm 5.1, reduce the number of the in-

put variables for an incompletely specified index gen-

eration function, where the number of original inputs

variables is n + m, and the number of vectors is k.

The larger the value of m, the better solutions we can get.

However, computation time increases with an increase of

m.

Next, we present the information gain method, a

heuristic method to select compound variables. The selec-

tion of the compound variables can be considered as the

optimization of the binary decision tree [3].

When selecting compound variables, the larger the bal-

ance factor of a variable, the larger the information gain we

can achieve. Thus, a variable with a large information gain

(i.e., a variable with a large balance factor) tends to reduce

the number of variables in the decision tree.

Algorithm 5.3 (The information gain method)

1. Among the compound variables and primitive vari-

ables, select a variable y1with the largest balance fac-

tor. Then, partition the registered vectors into two sets

with y1= 0 and y1= 1. Let i ← 1.

2. Among the sets with more than one element, select

a variable yi+1whose minimal balance factor is the

maximum, and partition the sets with yi+1. Let i ←

i + 1.

3. Iterate the above step until all the sets have one ele-

ment.

4. The function can be represented by (y1,y2,...,yp).

Example 5.2 Consider the incompletely specified index

generation functionˆf4shown in Fig. 5.1. Select the com-

pound variables by using the information gain method. In-

stead of the set of vectors, the algorithm is illustrated by the

set of indices of the vectors.

First, topartitiontheinitialsetS11= {1,2,3,4,5,6,7},

the variable y1is selected. In this case, when y1= x1, we

have h0 = 4, h1 = 3 in the set S11. Thus, the variable

y1partitions the set S11into S21= {3,4,5,6} and S22=

{1,2,7}.

Second, two sets S21and S22are partitioned by the vari-

able y2. In this case, when y2 = x2⊕ x3, the set S21is

partitioned into S31= {4,5} and S32= {6,3}. Also, the

set S22is partitioned into S33= {7} and S34= {1,2}.

Third, by using the variable y3, S31, S32, and S34,

the sets with more than two elements, are partitioned. In

this case, by selecting y3 = x4, each set is partitioned

into two. After this partition, each set has just one ele-

ment, and we terminate the algorithm. Thus, the function

can be represented by (y1,y2,y3) = (x1,x2⊕ x3,x4).

(End of Example)

6Experimental Results

6.1Design of the Experiment

To show the effectiveness of the algorithms, we mini-

mized the number of variables for randomly generated in-

completely specified index generation functions, where

1. only primitive variables are used (δ = 1),

2. both primitive and bi-compound variables are used

(δ ≤ 2), and

3. tri-compound variables in addition to primitive and bi-

compound variables are used (δ ≤ 3).

When only primitive variables are used, the exact minimum

solutions were obtained by using Algorithm 5.1. When

compound variables are used, Algorithm 5.3 (information

gain method) was used to obtain near-optimal solutions.

Furthermore, to examine the optimality of the heuristic

solutions, for small-scale problems that use bi-compound