P-Functions - IEEE Computer Society

advertisement
126
I E E E
T R A N S A C T I O N S
O N
C O M P U T E R S ,
V O L .
C-30,
N O .
2,
F E B R U A R Y
1981
P-Functions: A New Tool for the Analysis and
Synthesis of Binary Programs
ANDRE
Abstract—This paper considers the realization of switching func­
tions by programs composed of certain conditional transfers (binary
programs). Methods exist for optimizing binary trees, i.e., binary
programs without reconvergent instructions. This paper studies
methods for optimizing binary simple programs (programs with pos­
sible reconvergent instructions, but where a variable may be tested only
once during a computation) and binary programs. The hardware im­
plementations of these programs involve either multiplexers or de­
multiplexers and OR-gates.
Index Terms—Binary decision programs or diagrams, hardware
description languages, hardware realization of switching functions,
software description.
I.
INTRODUCTION
R
E C E N T L Y , the possibility of obtaining the values of a
switching function by means of binary programs has
received considerable attention [ l ] - [ 6 ] . The reason for this
interest is its wide range of applications that encompasses both
hardware and software problems. One knows, e.g., that binary
programs are an adequate mathematical tool for synthesizing
switching functions with multiplexers [2], [4], [6] or with
demultiplexers [5], [7]; these binary programs lead also to a
scheme for sequential synthesis of switching functions with
address decoders and Read Only memories ( R O M ' s ) [2], [8],
[9]. From a software point of view, binary programs are used
for software description of hardware using the "if, then, else"
instruction [2], [3]. Finally, Akers [1] recently showed that
these programs are particularly useful in the domain of test
generation.
The general idea that will be developed in this paper is to
represent a decision program by means of pairs of switching
functions (P-functions). It will be shown that these /^functions
constitute an adequate mathematical tool for optimizing both
hardware realizations and software descriptions of switching
functions.
The optimization criteria that are considered in the litera­
ture are
1) the maximal duration of computation (time crite­
rion);
2) the number of instructions (cost criterion).
The following intermediate criterion is of particular in­
terest:
3) among all the programs having the shortest maximal
THAYSE
computation time, find those having a minimum number of
instructions (relative cost criterion).
The reason for introducing criterion 3) is twofold.
1) In most cases, criteria 2) and 3) lead to the same (min­
imum) number of instructions; and
2) the algebra of P-functions is particularly suited for
dealing with criterion 3).
In this paper one considers especially criterion 3) while the
realization of criterion 2) is more briefly suggested.
The program optimization methods considered at this time
in the literature [2], [4], [5] are only applicable to binary trees,
i.e., binary programs without reconvergent instructions. The
optimization method developed in this paper is applicable to
any binary program; the binary programs will be divided into
two classes:
1) simple programs, i.e., programs where a variable may
be tested at most once during a computation; and
2) (nonsimple) programs, i.e., programs where a variable
may be tested several times during a computation.
W e introduce this distinction between the two classes of
programs since the composition law for obtaining programs
1) is simpler than the composition law for obtaining programs
2).
II.
P-FUNCTIONS ASSOCIATED WITH SWITCHING
FUNCTIONS
Let f(x) be a switching function of η variables χ =
(x -\,
• · ·, x\, Xo). P-functions are ordered pairs of switching func­
tions associated with / .
Definition I (P-functions):
The pair offunctions
(g, h) is
a P-function off (one will write (g,h) V / ) if and only if
n
fg=hg.
The first component g of the P-function will be called the
domain-function
of P, while the second component will be
called the codomain-function.
The relation (1) means indeed
that the function / evaluated in the domain D characterized
by the equation g(x) = 1 reduces to the function h(x). There
are 2 " — 1 P-functions associated with / (2
— 1 is the
number of nonempty subdomains of the tt-cube). Only a small
number of these P-functions are useful for generating optimal
programs; they are the prime P -functions given in Definitions
2 and 3.
Definition 2 (P -functions
and prime P°-functions):
A
P-function of order 0 (or P°-function) is a P-function (g, h)
offwithh
= 0orh = L
2
2n
q
Q
Manuscript received July 18,1979; revised January 24,1980 and September
8, 1980.
The author is with Philips Research Laboratory, Brussels, Belgium.
(1)
0018-9340/81/0200-0126S00.75
© 1981 I E E E
THAYSE: ANALYSIS A N D SYNTHESIS O F BINARY
PROGRAMS
A prime P°-function
is a P°-function
(g, h) whose
function g is not included in the domain function g of
P°-function.
127
domain
another
f
a) (go, h )Tf(g
0
h)
u
b) (go, h )TJ(g
V/.
0
h
= (g Xi
x
0
Ai> = (g (Xi
0
(2)
V/=>
0
gl
= 1), Ao*/ +
Xi
(xM
2
= (x&iXo
+ xix\Xo,
xi)
= (x x xo
+ x x\Xo,
X3)
x
= (x xiXo
+ X2X\X0, X3)
Prime
P -functions:
= A T\Ai
B
0
4
h x)
(4)
x
t
2
Bs = A T\Ao
X2X0
"ί"
(x ,
X Xi
+
XX)
=
(X ,
XX
+
X3*l>
= B\T\BQ
=
(x ,
X Xi
4" X Xo)
= B T\B
= B4T2B5
= (xixo,
= B5T2B4
=
Ci = B\T BQ
=
c
= BoT\B\
2
3
C = b t\b
3
5
Prime
+ Xigi)
+ Xih\)(Xigo
= xfgo
0
Xih\g\.
hg
x
2
2
3
2
0
3
x
2
0
3
xx
+
xx)
XX
+
X3^2>
3
(XiXo,
2
3
2
3
2
P -function:
Do = CiT\Co
Part a) follows from the two above equalities and from the
relations
fgo = A o g o a n d / g i =
2
3
·*2·*·ΐ)
3
+ Xifgi
+ */£i) = x/A £o +
3
2
4
2
2
= (x ,
3
x
2
Co = BoT\B\
c
c
+ X3X2, X \ )
2
= (x2X1X0 + *3*Ι.ΧΟ, X )
0
Proof:
f(Xigo
3
= A T\Ai
2
+ g\Xi. h Xi + * i * I > V / ( 3 )
= 0) (
= (x x
0
B3 = A\T\Ao
The P-functions of order q (q ^ 1) or P*- functions associated
with the function/will be denoted P\(f),k
being a counting
index; they are obtained from P-functions of an order lower
than q by means of composition
laws expressed in the fol­
lowing theorem.
Theorem 1 (theorem on composition
laws Tf and Tj):
0
Bi = A T\Ao
2
(7,0).
(go, h ) V / a n d (g\, h\)
= ( . * 3 * 2 + X3X2, Xo)
l
B
while there are only two prime /^-functions, namely
/>?(/) = if. 1> a n d / > £ ( / ) =
Bo = AiT A
x
Vg<7
<g,0>
-functions:
1
Q
In view of Definition 1, ^ - f u n c t i o n s of / are of the form
(g, 1> V S ^ / a n d
Prime P
(If)
= C T\C =
3
2
Example
2 (Laws Γ?): Consider the function defined by
Table II; for the sake of conciseness only a subset of the prime
/^-functions are computed.
Prime
P°-functions:
Ao
=
<*3* 2*1*0 +
Al
=
(XoX\
x^x 2X\X0, 1) = (/)1)
which yield
f(xigo
+ */£i) = (*/A + *iAi)(*/go + * / £ ι ) .
(5)
0
The part b) is proven by multiplying the two members of (5)
by the function
+
*0*1 +
Prime
P
=1).
•
Definition 3 (Pi-functions
and prime Pi-functions):
Let
(go, ho) and (g\,h\)
be two P-functions
of order p and p\,
respectively,
(po, p\ < q — 1 andpoorp\
or both = q — 1);
the P-function
(3) [respectively,
(4)] is a P^-function
with
respect to the composition
law Tf (respectively
Tj) if its do­
main function is not included in the domain function
of a
Pi-'-function
(r > 7 ) .
+
*2*3 +
*2*1 +
* 0 * 2 . 0)
=
-functions:
x
Bo = A T Ai
Bi = A T\Ao
0
= (x x xiXo
2
3
=
X
go(xt = 0)gi(Xi
*2*3
(f,0)
Prime
+ *2*3 + *2*0 +
2
XlX2
(*0Xl +
X2X\, X2)
X\)
+ *1*3 + *3*2*1*0.
P -function:
2
C = BoT Bi
=
3
(X X
3
+ X\Xo
2
+
X2X0,
*3*1 +
*3*2
+
0
A prime Pi-function
is a Pi-function
(g, h) whose
domain
function g is not included in the domain function g of another
Pi-function.
P?-functions (q > 1) off are thus obtained by applying iteratively and in a consistent way to /^-functions of / , either
the composition laws Tj or the composition laws Tf, i = 0 , 1 ,
• · •, η — 1; the laws Tj will be used in the generation of simple
programs, while the laws Tf will be used in the generation of
(nonsimple) programs.
/
Example
Table I.
Prime
1 (Laws
Tj): Consider the function defined by
*3*1>
Prime
P -functions:
3
Do = C T^Ai
(xo + * 1 * 3 + * 1 * 2 + x x
=
x
Q
Ao
=
<*3*2*1 + * 3 * 2 * 0 + * 3 * 2 * 1 + *3*2*0>
Αχ
=
( * 3 * 2 * 1 + * 3 * 2 * 0 + * 3 * 2 * 1 + Χ Χ * θ , 0)
3
2
1) =
=
(/".
1 )
(f,
0)
+
x{x ,
+
X Xi,
2
3
Di
= AiT C
(Xo
=
2
+
*2*3
+
XX
2
+ X Xi
3
2
2
X 3X2X\)
Prime
P -functions:
4
E
= D T Di
0
0
0
0
=
(\,f).
T h e use of prime P-functions in the generation of optimal
binary programs is grounded on their properties as expressed
by Theorems 2 and 3 below.
Theorem
2: Let there be two P-functions
(go, h ) V / a n d
0
P -functions:
3
X X2~X\)
of f
(gi,h )Vf
x
Assume that the greatest domain where f —ho
f= Ai) is characterized
by go - 1 (respectively,
1) go*/ + g\Xi = 1 characterizes
where
(respectively,
gi = 1).
the greatest
domain
128
I E E E
T R A N S A C T I O N S
O
N
C O M P U T E R S ,
TABLE I
T R U T H
V O L .
C-30,
T R U T H
0
1
1
1
0
0
0
0
1
1
0
0
0
0
0
0
0
1
1
0
0
1
0
0
1
1
0
0
0
0
0
+
F E B R U A R Y
1981
T A B L E
0
0
2,
T A B L E II
T A B I E
/ = h Xi
N O .
Ϊ
h\Xi.
2) go(Xi = 0) g\(Xi = 1) = 1 characterizes
domain independent of X{ where
the greatest
Definition 4:
1) The Ρ-graph associated with f is the oriented graph
whose vertices are the prime P-functions and whose edges are
directed from Pj(f) and P (f) to Pi(f), ifPiif) is generated
by composition of Pj(f) and P (f), i-e., if
k
f=
h Xi
+ h\Xi.
0
k
Proof: The greatest domain where / = Α,· (i = 0, 1) is
characterized by (Θ means the modulo-2 sum)
=fehi=
1.
gi
(6)
One has successively
/ θ
(Xih
0
+ Xih\) = / Θ (Xfho + Xjh\)
= ( χ · / θ xj)
ζ
= Xiif
Θ h)
0
θ
(Xih
θ Xiif
0
Θ
Θ h\)
Xih\)
= Xigo +
Xigi
PiU)
= Pj(f)TiP (f),
(Ti stands for 7? or Tj). (7)
k
2) The optimal P-graph is the subgraph of the P-graph
obtained by deleting the vertices which do not precede the
vertex ( / , / ) . The P-graph and the optimal P-graph of / h a v e
thus the same two initial vertices, namely the prime P - f u n c ­
tions (/, 1) and (J, 0 ) ; the optimal P - g r a p h has, moreover, a
unique final vertex: ( 1 , / ) .
Whenever P / , Pj, and P are related by (7), the edge from
Pj to P / will be marked " / , " while the edge from P to P / will
be marked "i."
Example 1 (continued): T h e P - g r a p h of the function de­
fined in Table I is given in Fig. 1. T h e optimal P - g r a p h is the
subgraph whose edges are drawn in heavy lines.
k
k
which proves part 1) of the theorem. Part 2) derives from the
fact that go(Xi = 0) g\(xi = 1) is the meet derivative [10] of
*igo + *igi; it is the greatest function independent of χ · and
contained in Xjgo + Xig\.
•
The interest of Theorem 2 derives from the fact that it proves
that the set of prime P-functions is closed for the operations
Tf and Tj. Otherwise stated, prime P-functions are obtained
by composition of prime P-functions of lower order: nonprime
Ρ-functions may be dropped at each step of the iterative pro­
cess.
Theorem 3: Starting with the P°-functions [(g 1), (gj,
0) 1 +
2gj = 1\, the iterative generation of
Ρ-functions
(either by the law Tf or by the law Tj) produces in at least one
way the P-function of the highest order:
(l,f).
Proof: The proof immediately derives from the fact
that
1) the complete /z-cube is covered by the functions g gj,
so that after a sufficient number of operations Tf or Tj the
function " 1 " necessarily appears as the domain function of a
P-function; and
2) the Definition 1, which shows that the codomain function
associated with the domain function 1 is necessarily f.
•
ζ
it
it
III.
GRAPHS O FPRIME P-FUNCTIONS
Graphs associated with the prime P-functions, or P-graphs,
are graphs having the prime P-functions as vertices; their
usefulness is twofold. First, they provide us with a simple
graphical display showing how the prime P-functions are ob­
tained from each other by the iterative process. Second, they
constitute a representation of the optimal connection of logical
gates or of software instructions required to r e a l i z e / .
IV.
APPLYING PRIME P-FUNCTIONS A N D P-GRAPHS
T O T H ES Y N T H E S I S O F O P T I M A L P R O G R A M S
The optimization criterion considered throughout this sec­
tion is the relative cost criterion.
By a binary program we mean a loopfree interconnection
of a finite number of labeled instructions of the type
Nj if Xi = 0 then so else s\
(8)
where
1) Nj is an instruction label,
2) Xi is a binary variable name, and
3) the symbols so, s\ denote statements of one of the two
following types:
a) go to label N (nonterminal statement),
b) the value of the function is h (terminal statement).
The binary program gives us a program description of a
switching function. Let us observe that the composition laws
Tf and Tj, as defined by Theorem 1, produce on the codomain
functions hj of Pj(f) = (gj, hj) an instruction of the type (8).
Indeed, if
k
/ /(/)=
>
(gbhi)
= (gj,hj)Ti(g ,
h)
k
k
then
hi = x hj
t
+
(9)
xh
t
k
or, stated in the form (8)
hi if Xi = 0 then hj else h .
k
129
THAYSE: ANALYSIS AND SYNTHESIS OF BINARY PROGRAMS
Nj
Fig. 2.
Optimal P-graph.
Observe that the codomain function associated with the P function of the highest order i s / and that it has been produced
by iterative compositions of the type (9) applied to the codo­
main functions 1 and 0 of the P-functions. The vertices of the
optimal P-graph are thus in a one-to-one correspondence with
instructions of binary programs describing/. Observe also that
since P-functions may be produced by using different decision
variables, the optimal P-graph may generate several programs.
If, e.g.,
Pi = PjTiP
k
= PTP
p
r
q
(10)
the optimal P-graph may produce two decision programs ac­
cording to whether JC, or x is chosen as a decision variable.
Example 1 (continued): The optimal P-graph of Example
1 has been redrawn with some more detail in Fig. 2. One sees
that the only vertex where a choice between decision variables
exist is Do: x or x may be chosen as a decision variable.
Therefore, the optimal P-graph generates two binary programs
given in Table III. For the sake of conciseness, the instructions
of the type (8) will simply be written
r
3
2
Xi
s
0
s\
where the labels of the P-functions are used to label the in­
structions. Programs may evidently be written by simple ex­
amination of the list of P-functions without resorting to the
construction of a P-graph.
Example 2 (continued): The prime P-functions computed
above produce the (nonsimple) program of Table IV. The
flowcharts of the programs written in Tables 111(a) and IV are
given in Fig. 3(a) and (b), respectively.
Theorem 4 (theorem on relative cost optimization):
The
optimal P-graph generates binary programs where the
maximal duration of computation is minimal,
moreover,
1) if the composition laws Tf are used, the optimal Pgraph generates (among others) the optimal
programs;
and
2) if the composition laws Tj are used, the optimal P graph generates (among others) the optimal simple pro­
grams.
Proof: T h e computation duration of the programs is
minimal: the use of prime P-functions implies that the P function ( 1 , / ) is obtained in a minimum number of levels
between ( 1 , / ) and both </, 1) and (f, 0 ) . The program has
a minimum number of instructions if all the possible recon­
vergent instructions are detected; all these reconvergent in­
structions are detected since
130
I E E E
TABLE
B I N A R Y
E
D
D
o
0
l
C
B
B
0
l
x
o
X
2
X
x
2
X
l
C O M P U T E R S ,
V O L .
C-30,
N O .
2,
F E B R U A R Y
1981
IV
f - 0
c
C
3
O N
P R O G R A M
l
x
T R A N S A C T I O N S
B
o
_ L ^ < " \ 0 _
—
f-0
B
Bo
i
f=1
f-0
f-0
f-1
—
LBi
*CL.—
f=1
f=0
1) one starts with P-functions (/*, 1) and (f, 0) having
maximal domain functions; and
2) the use of the laws Tf preserves the maximal character
of the domain functions (see Theorem 2).
If we use the law Tj instead of the law Tf, only some nonsimple programs may not be detected: indeed the elimination
of the variable x in the domain function eliminates the pos­
sibility of testing this variable in a next step; the proof then
derives from Theorem 2-2).
•
Remarks: The law Tj has been introduced since the de­
tection of the prime character of a P-function is easier when
dealing with Tj instead of with Tf. Observe, moreover, that
all the nonsimple programs are not necessarily eliminated by
the law Tj and that the minimal number of instructions gen­
erally does not differ between simple and nonsimple pro­
grams.
(a)
t
V.
APPLICATION OF P-GRAPHS TO LOGICAL
DESIGN
A demultiplexer of one command variable χ is a logic gate
with one input terminal y and two output terminals z and z\
realizing the functions
0
zo = xy and z\ — xy.
(11)
The graphical representation of a demultiplexer is shown in
the net of Fig. 4(b).
A multiplexer of one command variable χ is a logic gate with
two input terminals
and y\ and one output terminal ζ
realizing the function
ζ = xy$ + xy\.
(12)
The graphical representation of a multiplexer is shown in the
net of Fig. 4(c). We will now show that Fig. 4 demonstrates
the graphical connection between optimal P-graphs, nets of
demultiplexers and O R - g a t e s , and nets of multiplexers.
Consider a subgraph of the optimal P-graph associated with
one of the decision programs computing the functionf. This
graph has a structure which is schematically depicted in Fig.
4(a).
Proposition 1 (synthesis by means of multiplexers):
If a
logical network is deduced from the optimal P-graph in the
following way [see also Fig. 4(a) and (c)]:
1) to each vertex of the graph corresponds a multiplexer
and to the edges of the graph correspond the connections be­
tween the
multiplexers;
2) if the edges i and i are incident to the P-function (gi, hi),
the multiplexer corresponding to that P-function has χ ι as
command
variable;
Fig. 3.
(b)
Flowcharts.
3) the edges issued from the P°-function
(f 1) are con­
nected to the Boolean constant I, while the edges issued from
the P^-function (f,0) are connected to the Boolean constant
0.
Then it realizes the function f and, more generally, the
multiplexer corresponding to the P-function (gi, hi) realizes
hi as output
function.
Proof: The proof immediately derives from the fact that
the codomain functions of the P-functions are generated by
the law
hi = Xih + Xih
t
p
q
which corresponds also to the output function (12) of the
multiplexer.
•
Proposition 2 (synthesis by means of demultiplexers
and
OR-gates):
If a logical network is deduced from the optimal
P-graph in the following way [see also Fig. 4(a) and (b)]:
1) to each vertex of the graph corresponds a demultiplexer
whose input terminal is connected to the output terminal of
an
OR-gate;
2) the in-edges i and i to this vertex are connected to the
outputs of the demultiplexer with command variable X/, while
the out-edges of this vertex are connected to the inputs of the
OR-gate;
3) the input of the initial demultiplexer
(corresponding
to the P-function (l,f) of the highest order) is connected to
the Boolean constant I.
Then it realizes the functions f and f, and the
OR-gates
corresponding to the P-function (gi, hi) realizes g] c gj as
output function so that the connected demultiplexer
realizes
the functions xig) and xig].
THAYSE: ANALYSIS A N D SYNTHESIS OF BINARY
AA
Ai
131
PROGRAMS
A A
In order to synthesize optimal binary trees (the optimality
criterion is again the relative cost criterion), define P^-cubes
and prime P^-cubes as follows.
A Pi-cube is a Pi-function whose domain function is a cube;
a prime P^-cube is a P^-cube whose domain function is not
contained in the domain function of another P^-cube.
One verifies, by using similar arguments as those developed
in Sections I I I - V , that the synthesis of optimal binary trees
is performed by computing iteratively the prime P^-cubes
associated w i t h / , the initial prime P°-cubes being \(p l ) , ( q
0)) and the composition laws being T}.
Example l
(continued):
Prime P^-cubes:
if
Fig. 4.
Logical networks.
Ao = (X X2X\,
l >, Αχ =' (x X Xo, l ) A
= < * 3 * 2 * l . I), A
= (x x xo,
Π A = (x\Xo, l ) , A = (x x X\,
0), A =
<*3*2*0, 0 ) , Αη = (x X X\,
0), Αχ = (X X XQ,
0), A =
(x\x ,
0)
3
3
3
2
VI.
APPLICATION
DESCRIPTION
OF P-FUNCTIONS TO
PROGRAM
AND HARDWARE REALIZATION
SWITCHING
FUNCTIONS
of Binary
Trees
The synthesis of binary trees may be performed in the same
way as the synthesis of binary programs: the only modification
of the algorithm is in starting the iterative computations with
the P°-functions \(p 1), ( q j , 0 ) |/? : prime implicant o f / qy.
prime implicant of/] instead of with the prime P°-functions
(f, 1) and (f, 0 ) . In view of Theorem 3, the P°-functions \(p
1), (qj, 0)) generate binary programs since Σ/?,· + Σξ,· = 1.
These binary programs are trees; indeed, the domain-functions
associated to the vertices of a binary tree are cubes and the
composition of cubes by the laws Tj produces P-functions
whose domain functions are cubes.
it
2
3
3
2
3
2
6
9
2
(For the sake of conciseness, only a part of the prime P^-cubes
( q ^ l ) will be computed).
Prime P -cubes:
l
Bo = A T Ai
= (x x ,
xo), Βχ = Α%Τ Α
= (x x ,
xo)
B
= (x xi,
x\),
= (x x ,
χ)
l
6
2
0
= A T\A
5
0
Prime Ρ
3
ι
2
0
3
3
3
B = Α Τ\Α
3
η
2
3
2
2
λ
-cubes:
2
Co = B T\B
= (x , x x
Ci = B T B\
= (x , x xo +
0
2
3
3
2
3
2
0
+ x *i>
2
2
Χ2 \)
χ
Prime Ρ -cube:
3
D = C T\Co=
0
l
(If)
From these prime cubes one deduces the binary tree of Table
V. Evidently, if the optimal binary program describing a
function / i s a binary tree, this tree is also obtained by starting
the computation process with the P°-functions </, l ) and (f,
0 ) and by applying the algorithm of Section IV.
B. Synthesis of Binary Programs
Decomposition
Law
OF
The synthesis of binary programs by means of P-functions
constitutes a core problem that can be extended in various
directions. Some particular cases and generalizations of this
problem are described in this section.
A. Synthesis
f
5
0
t
3
2
4
3
Proof: Identical to that of Proposition 1.
Both propositions may now be gathered in the following
theorem.
Theorem 5: Consider a subgraph of the optimal
P-graph
obtained by choosing for each vertex (gi, hi) a variable Xi in
the set of the possible command variables for this vertex; to
this subgraph correspond two optimal logical
realizations:
1) a realization with multiplexers; these multiplexers are
connected as the vertices of the subgraph, and the multiplexer
corresponding to the vertex (gi, hi) produces hi as output
function; and
2) a realization with demultiplexers
and OR-gates; these
demultiplexers-OR-gates
are connected as the vertices of the
considered subgraph and the demultiplexer
corresponding
to the vertex (gi, hi) has the function g] c g as input func­
tion.
Example 1 (continued): Consider the optimal P-graph of
Fig. 2 and let us choose x as command variable at Do. To this
choice corresponds the optimal logical realizations of Fig. 5.
J t
by Using a
The synthesis methods developed above for obtaining binary
programs may be summarized as follows: starting with P ° functions and using iteratively composition laws Ti acting on
the P-functions, obtain the P-function ( l , / ) . The following
synthesis method will be developed in this section: starting with
the P-function ( l , / ) and using iteratively a decomposition
law Δ acting on the P-functions, obtain a set of P°-functions
satisfying the condition of Theorem 3.
Theorem 6 (theorem on decomposition laws: Δ,·):
1)
(g,h)Vf=>
z
if
Δ / « * , Α » = [<x ,
ig
h(
Xi
= 0 ) ) V / (x ,
ig
h(Xi = l)> V / ] .
2) An iterative application of the laws Δ/ to the P-function
( l , / ) produces P°-functions.
Proof:
0 (g, h) V / = > / g = hg =*fiig
o f ( l ) ] (Xig, h(xi = 0)) V / ;
= h(Xi = 0)xig => [in view
132
I E E E T R A N S A C T I O N S O N C O M P U T E R S , V O L . C-30,
Fig. 5.
N O . 2, F E B R U A R Y
1981
Optimal
TABLE V
BINARY TREE
c
o
B
o
x
3
x
2
x
x
Bj
C
l
c
o
B
3
B
l
2
B
0
B
2
o
f-0
f-1
f-0
f-1
f-0
f-1
f-0
f-1
X
0
B
2
X
I
B
3
x
l
2) The proof of part 2) results from the fact that the ap­
plication of the law Δ, to (g, h) introduces the variable jc- in
the domain functions Xjg and Xjg, while this variable disap­
pears in the corresponding codomain functions h(xi = 0) and
h(xj = 1), respectively.
•
The use of decomposition laws for generating binary pro­
grams is attractive since these laws are easy to handle; they
present, however, an important drawback since they generate
only binary trees. One verifies indeed that, when starting with
the domain function 1, the iterative application of decompo­
sition laws Δ,· produces only P-functions whose domain
function are cubes. We know that the P-cubes generate binary
trees only. This drawback may be circumvented by introducing
a merging law on the set of P-functions.
Theorem 7 (theorem on merging law: υ ):
f
(go, h) V / a n d (g
h) V / = » (go + gi. h)
h
(One will write: (go, h) υ (g\,h)
= (go + g\,
Fig. 6.
indeed, the decomposition law does not allow a variable JC,- to
be present simultaneously in the domain and in the codomain
functions of the P-function. Hence, a variable already tested
in the computation process may not be tested again.
Example 1 (continued): Some of the P-functions computed
below were already obtained when the composition laws were
used; these P-functions will hold their label.
Do =
0
h)).
0
+ g\).
+
0
Δι (A))
fgo = hgo a n d / g i = hg =*f(go + g\) = h(g
X\(X3X2
(X ,
Proof:
x
< 1, * 3 * 2 * 1 + * 3 * 2 * 0 + X3X2X\ + * 3 * 2 * 0 > =
Δ (Α)) = \(X0,
Vf
•
The decomposition laws Δ,· and the merging law υ allow us
to generate binary simple programs. The merging of P-cubes
produces indeed P-functions whose domain function is not
necessarily a cube. These laws produce only simple programs;
P-graph.
X3X2)),
X\ + X 3 * 2 + * 3 * 2 > i = \E>4,
D\
2
= |<3Cl. Χθ(Χ~3Χ2 + * 3 * 2 ) > ,
(X\,
Δ (Α)) = \ (X2,
2
Xo + X2X3
+ * 3 * 0 > l = {C3,
C\
<X3, * 2 * 1 + * 2 * 0 > } = {Ci,
C |
2
Δ (Α)) = I < * 3 ,
+ * 2 * 3 > i = \P>3> D\\
X3X0 + * 3 * 1 > ,
(X ,
3
< 1»/)
X3X\
2
X2X\ + * 2 * 0 > ,
0
T H A Y S E :
A N A L Y S I S
A
N
D
Δι(Ζ) ) = f (XoX\, 0 ) ,
4
S Y N T H E S I S
O F
<Xo*i, X3X2
B I N A R Y
T R U T H
1)} = | C , ^ o )
Δι(Ζ) ) = {<*o*i, * 3 * 2 + X3X2),
1 >} = {C , ^ 0 )
0
Δ (Ζ>3) = { < * 0 * b 0 ) , (X\Xo,
0
A ( C ) = {(X3X2,
(xoX\,
5
X3X2 + * 3 * 2 > ! =
(X3X2,
xo)} = \B\, B 0\
A ( C ) = { < x * 2 , xo).
(X3X2,
xi)\
3
3
3
2
2
Ml\
C )
5
0
0
1
X
0
1
1
X
l
= \Bl
B})
TABLE VII
B I N A R Y
A ( C 0 = \(x X2,
x\),
3
{X3X2,
xo)\ = \B\,
Δ ( 0 ) ) = {{X3X2, Χθ), (X3X2, *!>} = «
Z?o
BQ
u Z?o, ^ 1
=
^1 u
x
*?}
2
P R O G R A M S
Bl\
( A )
=
T A B L E
4
x\).
3
TABLE VI
+ * 3 * 2 > i = \A\, C 4 )
Δ (£>ΐ) = \ {XQX\, X3X2 + * 3 * 2 > , (xoxi,
2
133
P R O G R A M S
2
l
o
B
B>\
B
Δ (^θ) = {<*θ(*3*2 + * 3 * 2 ) , 0 ) ,
x
0
f-1
o
f-O
f-1
f-0
B
(C)
( B )
I
o
B
D
C
2
B
2
X
0
*0
2
2
D
X j
l
2
f-0
Cj
f-1
f-0
B
B
x
C
x
2
2
Cj
A
l
f-1
B
f-1
f-0
2
0
Δ ι ( Λ ι ) = \(X\(X3X2
< x o ( * 3 * 2 + * 3 * 2 ) , 1 >) = {Al
Al]
+ * 3 * 2 ) , 0),
( j C l ( * 3 * 2 + x * 2 ) , 1 >} = \A\,
Al)
3
Ao = A uAluAl
l
0
= (f, 1>,
A =A\uA uAJ
=
2
x
x
<f,0).
These P-functions allow us again to derive P-graphs and
programs. A graph showing us how the P-functions are derived
from each other by using the decomposition and the merging
laws is depicted in Fig. 6. (Compare this P-graph with the
P-graph of Fig. 1.) The optimal simple programs written in
Table III may then be deduced either from this P-graph or
from the list of P-functions.
In summary, optimal simple programs may be obtained
either by means of composition laws or by means of decom­
position and merging laws. These two methods present the
following respective advantages and drawbacks. T h e reconvergent nodes are detected by the composition laws; in order
to detect reconvergent nodes a merging law must be added to
the decomposition laws.
Algorithms based on composition laws need the evaluation
of the first component of the P-function (the domain function),
while algorithms based on decomposition and merging laws
need the evaluation of the two components of the P-function
(see, e.g., Theorem 8 below). Algorithms based on composition
laws are nonexhaustive algorithms since the concept of prime
P-function allows us to evaluate a small subset of these func­
tions only. It is easier to perform decomposition of P-functions
than composition of P-functions.
Let us finally point out that nonsimple programs may be
obtained by using the decomposition laws Δ,· together with a
more elaborated merging criterion than that of Theorem 7. The
following theorem is given without proof.
Theorem 8 (theorem on merging law):
(go, h ) V / a n d
0
(g ,hx)Vf
x
=* (go + g\, ho + Ai) V / i f and only if:
hogo ^ h go and h g
x
x
{
^
hg.
0
x
To verify that the decomposition laws together with the
merging criterion of Theorem 8 leads, e.g., to the nonsimple
program of Table IV, is left to the reader.
C. Programs Having a Minimum
Number
of
instructions
A program with a minimum number of instructions, but
whose maximal duration of computation is not minimal,
cannot be obtained from the algorithms grounded on compo­
sition laws. Observe, however, that this drawback is only due
to the fact that, in order to build as nonexhaustive algorithms
as possible, only the prime P-functions were evaluated at each
computation step. If other P-functions are added to the prime
P-functions this drawback disappears, but the duration of
computations increases. A good compromise lies in attaching
a weight to each P-function: the weight is by definition the
minimum number of P-functions needed to obtain this P function by means of a given composition law.
For example, if one deals with binary trees, a weight 0 is
attached to each of the P°-functions. Let W(Pj)'be the weight
of the P-function P , ; it is computed iteratively as follows:
W(PjTiP )
k
= W(Pj) + W(P ) + 1.
k
At the <7th iteration step of the algorithm one has to retain the
following P^-functions:
1) the prime P^-functions (g, h), and
2) the P ^ = functions (g , h'),g' <zg, with:
w«^A0)<w((g,A)).
f
D. Synthesis of Optimal Programs for
Specified
Functions
Incompletely
A binary program of an incompletely specified function is
a binary program realizing a (completely specified) function
compatible with the initial function by means of, e.g., the
smallest number of instructions. The aim of this section is to
show, through the intermediate of a simple example that these
programs m a y be obtained through t h e use of composition
laws.
When dealing with completely specified functions, the it­
erative computation process was initiated by the P°-functions
(f\ 1) and (f, 0 ) of f Let / b e an incompletely specified
function, go be the maximal function contained i n / , and gi be
the maximal function contained i n / The iterative computation
process for obtaining binary programs describing a function
compatible with / is initiated with the prime P°-functions
(go, D a n d
(g 0).
u
134
I E E E T R A N S A C T I O N S O N C O M P U T E R S , V O L . C-30, N O . 2, F E B R U A R Y
1981
2) P-functions are able to generate programs where a
command variable is tested several times during a computation
process: this also reduces the instructions number.
3) The binary trees are obtained as a particular case of the
binary programs.
4) The theory of P-functions may be extended to the syn­
thesis of incompletely specified functions and of multivalued
functions.
Fig. 7.
Example
Flowcharts.
ACKNOWLEDGMENT
3: Consider the incompletely specified function
given by means of its truth Table VI.
borgh for his careful reading of the manuscript.
P°-functions:
Ao = (xo + x\Xi,
Q),A\
= (x\ + X0X2, 1 >
REFERENCES
P -functions:
]
Bo = A T^Aχ
= (x\ + x ,
xo)
B\ = A T\A\
= (xo + xi,
x\)
B
= (x\Xo + * i * o , * 2 >
0
0
2
= AoT\A\
2
Co = B\T Bo
= <l.*o*2 +
Ci = AoT\B
= <*i, x *o>
C 2 = B T\A\
= <Xo. * 2 + * i >
l2
2
2
*i*2>
2
P -functions:
3
Do = A TlC
= ( 1 , x (x\
Z>i = C\T\A\
= ( 1 , x xo
0
2
0
2
+ *2)>
+ *i>
From this set of P-functions one deduces three programs: Co,
Do, and D\ which compute functions compatible with the
entries of Table VI, i.e., χοΧι
x xo,
2
The author is indebted to referees Β and C for their detailed
and constructive comments and to his colleague H . Vantil-
+
*ι*2,
[1] S. B. Akers, "Binary decision diagrams," IEEE Trans. Comput., vol.
C-27, pp. 509-516, June 1978.
[2] A. Thayse and Μ. Davio, "Optimization of multivalued decision algo­
rithms," in Proc. 1978 Int. Symp. on Multiple-Valued Logic, pp.
171-178, and Philips J. Res., vol. 33, pp. 31-65, 1978.
[3] O. P. Kuznetsov, "Program realization of logical functions and auto­
mata; Part I: Analysis and synthesis of binary process," Automat. Re­
mote Contr., vol. 38, pp. 1077-1087, 1977.
[4] D. Mange and E . Sanchez, "Synthese des functions logiques avec des
multiplexers," Digital Processes, vol. 4, pp. 29-44, 1978.
[5] E . Cerny, D. Mange, and E. Sanchez, "Synthesis of minimal demulti­
plexer, multiplexer, and binary-decision trees," IEEE Trans. Comput.,
vol. C-28, July 1979.
[6] R. Voith, "ULM implicants for minimization of universal logic module
circuits," IEEE Trans. Comput., vol. C-26, pp. 417-424, 1977.
[7] D. Mange, "Arbres de decision pour systemes logiques cables ou pro­
grammes," Bulletin de ΓAssociation Suisse des Electriciens, vol. 69,
pp. 1238-1243, 1978.
[8] C. Lee, "Representation of switching circuits by binary decision pro­
grams," BellSyst. Tech. J., vol. 38, pp. 985-999, July 1959.
[9] M. Davio, J.-P. Deschamps, and A. Thayse, Discrete and Switching
Functions. New York: McGraw-Hill, 1978.
[10] A. Thayse, "Meet and join derivatives and their use in switching theory,"
IEEE Trans. Comput., vol. C-27, pp. 713-720, 1978.
*o(*i + xi)> and X\ +
respectively. These programs are written down in Table
VII and are depicted by their corresponding flowchart of Fig.
7. The three programs satisfy the minimal cost criterion, while
the program (a) satisfies moreover the minimal
time
crite­
rion.
VII.
CONCLUDING
REMARKS
In this paper we presented the "P-functions" as a new tool
for the synthesis and analysis of binary programs. T h e fol­
lowing advantages of the P-functions over other methods de­
scribed in the literature have been discussed.
1) P-functions detect automatically the reconvergent in­
structions in the programs, which reduces the instructions
number.
Andre Thayse was born in Brussels, Belgium. He
received the Electrical Engineering degree and the
Engineering degree in applied mathematics, both
from the University of Louvain, Louvain, Bel­
gium. He received the Ph.D. degree from the
Ecole polytechnique federale of Lausanne, Lau­
sanne, Switzerland.
Currently, he is employed at the Philips Re­
search Laboratory, Brussels, Belgium. His fields
of interest are switching theory, multivalued logic,
the relationship between hardware and software
design methods, and the transformation of algorithms based on automata and
parallel computation. He is the coauthor, with M. Davio and J. P. Deschamps,
of a book entitled Discrete and Switching Functions (New York: McGrawHill, 1978).
Download