Docsity

Espresso: Two-Level Optimization | CS 3710, Lab Reports of Computer Science

Toggle sidebar
bg1
CS/EE 3710 — Computer Design Lab
Espresso - Two-Level Optimization
Another tool, separate from the VIEWlogic tools and Foundation tools, that will be useful this semester
is a program called espresso. Espresso performs minimization of Boolean expressions using a heuristic
algorithm. Because the algorithm is heuristic, espresso will not always find the exact minimum for a
function, although for small functions the answer is almost always exact. In practice, espresso finds an
answer very close to the minimum using dramatically shorter execution times than exact techniques such
as Quine-McCluskey. Espresso, and its descendants MIS and SIS, are widely used in both academia and
industry, and you will find espresso algorithms at the core of many successful logic synthesis programs.
Espresso has a wide variety of uses, and a huge number of switches to control its operation. In this handout
we will use espresso in its simplest form to minimize Boolean sum-of-products expressions.
The input format for espresso that we will use is a simple listing of product terms from a sum-of-
products Boolean expression. The full man pages will be available on the class web page for those who
are interested. The file will begin with lines to tell espresso how many inputs the function has and how
many outputs it uses. These are followed by the product terms, and the output values, one per line. It’s
like a truth table except that you only have to enter the entries where the output is valid, and you can use
a “-” to represent a don’t-care in the product term. That is, if you have a function

of four
variables, and one of the product terms is

, you can denote this as 11- - in the input file.
Here’s an example. It is a function of four variables given by the expression
  "!$#%'&(()((
The input file that would be used for espresso is as follows:
.i 4
.o 1
0001 1
0011 1
0101 1
0111 1
1001 1
0110 -
1100 -
1101 -
.e
The first line tells espresso that there are 4 inputs, the second that there is only a single output. The
following lines are the minterms in the expression, listed one per line. The order I have chosen is ABCD
so that I can simply write the binary number of each minterm to represent that minterm. The 1 following
the space is the desired output value, and the “-” defines the don’t-care terms. The last line signals the
end of the function. Note that a 1 in the minterm representation represents that variable in true form, and
a 0 is the complemented form. For example, the first minterm in this file is

Note also that
you can have, if you like, don’t cares in the input file. If the expression you are trying to minimize is not
in standard sum of products form, some of the terms may not contain all the input variables, and would
have a “-” in any columns for the variables that are not used. You can also have multiple outputs and let
espresso minimize the whole thing. In this case you could have 0’s or “-”‘s in the output listing.
pf2

Partial preview of the text

Download Espresso: Two-Level Optimization | CS 3710 and more Lab Reports Computer Science in PDF only on Docsity!

CS/EE 3710 — Computer Design Lab

Espresso - Two-Level Optimization

Another tool, separate from the VIEW logic tools and Foundation tools, that will be useful this semester is a program called espresso. Espresso performs minimization of Boolean expressions using a heuristic algorithm. Because the algorithm is heuristic, espresso will not always find the exact minimum for a function, although for small functions the answer is almost always exact. In practice, espresso finds an answer very close to the minimum using dramatically shorter execution times than exact techniques such as Quine-McCluskey. Espresso, and its descendants MIS and SIS, are widely used in both academia and industry, and you will find espresso algorithms at the core of many successful logic synthesis programs. Espresso has a wide variety of uses, and a huge number of switches to control its operation. In this handout we will use espresso in its simplest form to minimize Boolean sum-of-products expressions. The input format for espresso that we will use is a simple listing of product terms from a sum-of- products Boolean expression. The full man pages will be available on the class web page for those who are interested. The file will begin with lines to tell espresso how many inputs the function has and how many outputs it uses. These are followed by the product terms, and the output values, one per line. It’s like a truth table except that you only have to enter the entries where the output is valid, and you can use a “-” to represent a don’t-care in the product term. That is, if you have a function

of four variables, and one of the product terms is

, you can denote this as 11- - in the input file. Here’s an example. It is a function of four variables given by the expression

The input file that would be used for espresso is as follows:

.i 4 .o 1 0001 1 0011 1 0101 1 0111 1 1001 1 0110 - 1100 - 1101 - .e

The first line tells espresso that there are 4 inputs, the second that there is only a single output. The following lines are the minterms in the expression, listed one per line. The order I have chosen is ABCD so that I can simply write the binary number of each minterm to represent that minterm. The 1 following the space is the desired output value, and the “-” defines the don’t-care terms. The last line signals the end of the function. Note that a 1 in the minterm representation represents that variable in true form, and a 0 is the complemented form. For example, the first minterm in this file is

Note also that you can have, if you like, don’t cares in the input file. If the expression you are trying to minimize is not in standard sum of products form, some of the terms may not contain all the input variables, and would have a “-” in any columns for the variables that are not used. You can also have multiple outputs and let espresso minimize the whole thing. In this case you could have 0’s or “-”‘s in the output listing.

Espresso is run on this input file by redirecting the input to be from that file, and redirecting the output to another file. The program itself is in the class bin directory on the CS UNIX machines and in the CADE lab (it only runs on SPARCs under UNIX at the moment). Assuming that /home/cs/handin/cs3710/bin (in the CADE lab) or /services/classes/cs3710/bin (CS) is on your path, and that the test file shown above is called test.es, and you would like the output of espresso to go to test.out, then the command would be:

espresso * test.es + test.out

The result, contained in test.out, of running espresso on this test case is:

.i 4 .o 1 .p 2 --01 1 0--1 1 .e

You can see that espresso has added a line to tell how many product terms are left, in this case 2, and has listed the remaining product terms in the reduced expression. Remember that the “-” is a don’t-care condition and signals that that variable need not appear in that product term. The reduced expression is therefore

. Luckily for espresso, this is the same as the expression that results from K-map manipulation.