You are on page 1of 4

ENGR 365 { Digital Logic Design Spring 1997

Using espresso
1 Introduction
espresso is part of the OctTools suite of design tools from U.C. Berkeley. Its main function
is to nd simple SOP Boolean expressions for arbitrary truth tables, possibly including don't
cares and possibly for several outputs simultaneously. With a few tricks, you can even give it
arbitrary Boolean expressions as input and get readable Boolean expressions as output.
As pointed out in Katz and in class, espresso is not designed to nd absolutely minimal
SOP forms. Rather, it guarantees an irredundant cover of the ON-set of a function and uses
heuristics to try to make this cover simple. For small problems, however, (with up to ve or six
inputs, say), it is very unlikely that espresso's solution is not minimal.
espresso is available on the Department's HP workstations, and is a \classic" UNIX-type
program. It operates on an input text le, or on text input fed to its standard input, and
produces text output on its standard output, which can be redirected through the UNIX shell
to an output le if desired. Details of its operation can be controlled using options included on
the command line.

2 Basic Use
The command synopsis is
espresso [options] [file]
The square brackets mean, in UNIX-speak, that these arguments are optional. If the file
argument is not included, espresso operates instead on its standard input (i.e., it will wait for
you to type input into it, or you can use the shell's redirection capabilities to pipe data to it).
If the options argument is not included, espresso will operate in its input data in the default
way and produce its output in the default format.
espresso expects its input in Berkeley PLA Format, which you're probably familiar with.

X
For example, to specify the Boolean function
X
Y = f (A; B; C; D) = m(0; 3; 5; 12; 13) + d(1; 2; 15)
in PLA format you would type
.i 4
.o 1
.ilb A B C D
.ob Y
.p 8
0000 1
0011 1
0101 1
1100 1
1101 1
0001 -
0010 -
1111 -
.e
ENGR 365 { Using espresso 2

Basically you're identifying the truth table rows where the function should be 1 and where it
should be don't care (-).
If the above PLA description is stored in the le in.pla, you can simplify it by typing
espresso in.pla. This will produce the following output on your terminal:

.i 4
.o 1
.ilb A B C D
.ob Y
.p 3
-101 1
00-- 1
110- 1
.e

If you want to have the above output saved to a le called out.pla instead of appearing on your
terminal, just type espresso in.pla > out.pla instead. (\>" redirects a command's standard
output to a le in most UNIX shells.) In any case, the output means that the simplest form
espresso could nd for f is

Y = f (A; B; C; D) = BCD + A B + ABC

3 Options
Using the [options] argument you can get espresso to do some nice things:
-o eqntott
Use this to get espresso's output to look like a (sort of) readable equation. For example,
the output of espresso -o eqntott in.pla is
Y = (B&!C&D) | (!A&!B) | (A&B&!C);

which again means that


Y = f (A; B; C; D) = BCD + A B + ABC
(! means NOT, & means AND, and | means OR).
-epos
This complements the function (exchanges ON-set and OFF-set) before simplifying and
can be used to get a simple POS form for a function. espresso -epos in.pla gives the
output
.i 4
.o 1
.ilb A B C D
.ob Y
#.phase 0
.p 3
10-- 1
-11- 1
01-0 1
.e
ENGR 365 { Using espresso 3

Using this SOP expression for f and two applications of DeMorgan's Theorem gives a
simple POS form for f (see Slide 16, Chapter 2, of the lecture handouts):
f (A; B; C; D) = f (A; B; C; D) = AB + BC + ABD
= (AB )(BC )(ABD)
= (A + B )(B + C )(A + B + D)

-Dmap
This produces a crude Karnaugh map of the input function's ON-set; espresso -Dmap
in.pla gives

Output space # 0
1.1.
....
1...
..11

Unfortunately, the rows and columns aren't arranged in the way we're used to. :-(

-Dexact
This causes espresso to work much harder to nd a minimal cover (although still not
guaranteed minimal, I don't think).
There are lots more options too. For more information, try man espresso. For details on the
PLA le format, try man 5 espresso.

4 Simplifying Arbitrary Boolean Expressions


The tool misII, which we'll learn more about in Chapter 3, can accept eqntott-format input
expressions and produce PLA-format outputs. For example, if the le in.eqn contains
Y=(A&B)|(A&!B);

then typing misII -t eqn -T pla in.eqn produces the output


.i 2
.o 1
.ilb A B
.ob Y
.p 2
11 1
10 1
.e

This can be saved to a le using redirection (as in misII -t eqn -T pla in.eqn > in.pla)
and a simpli ed SOP form obtained using espresso -o eqntott in.pla, which gives the out-
put
Y = (A);
ENGR 365 { Using espresso 4

Redirection can be used with the espresso command to save this to a le if desired. What this
computation has done, of course, is to show that
Y = AB + AB = A
To be really cool and UNIX-y you can do this whole process in the one command line misII
-t eqn -T pla in.eqn | espresso -o eqntott > out.eqn, after which the le out.eqn will
contain
Y = (A);

Note that the input expression doesn't have to be SOP (although the output always is). For
example, if in.eqn contains
Y = (!A|B)&(A|C)&(A|B);

then misII -t eqn -T pla in.eqn| espresso -o eqntott produces


Y = (B&C) | (A&B);

which just means that


Y = (A + B )(A + C )(A + B ) = AB + BC

5 Multiple Outputs
One handy thing espresso can do is simultaneous simpli cation of several functions at once.
Here, for example, is the PLA le describing a one-bit full adder:
.i 3
.o 2
.ilb a b cin
.ob sum cout
.p 8
111 10
001 10
010 10
100 10
111 01
011 01
101 01
110 01
.e

If this le is called in.pla then simple SOP expressions for both outputs can be obtained using
espresso -o eqntott in.pla, which gives

sum = (a&!b&!cin) | (!a&b&!cin) | (!a&!b&cin) | (a&b&cin);


cout = (b&cin) | (a&cin) | (a&b);

Although it didn't make any di erence in this case, espresso will look for and take advantage of
common product terms between the two output functions. (Sometimes the overall solution can
be simpli ed by taking advantage of common terms rather than going for the absolute simplest
expression for each output separately.)

You might also like