23 - External Don't Cares in Logic Synthesis
23 - External Don't Cares in Logic Synthesis
1 Introduction
approximate them were developed [9, 14, 15]. Nowadays, more powerful and
scalable computation of don’t cares enabled by satisfiability (SAT) solving and
simulation is commonly used, but consideration of don’t cares is still limited to
those within a combinational network [10].
In contrast to internal don’t cares computed within a network, external don’t cares
are flexibilities arising from outside of the combinational network under optimiza-
tion, derived from a higher-level perspective of the system. For example, cascaded
finite-state machines may produce don’t-care input sequences for each other [12].
As another example, sometimes the system is partitioned into submodules and
optimized separately. While their boundaries are intended to be kept, flexibilities
on the input-output relations of individual submodules due to their interactions are
allowed. Considering external don’t cares essentially changes the problem from
optimizing a (completely specified) Boolean function into optimizing a Boolean
relation. The solution space is enlarged and the problem complexity is much higher;
thus, there is currently no open-source logic synthesis tool that supports taking and
utilizing external don’t cares. Nevertheless, with the increased computation power
affordable nowadays, solving such optimization problems should be possible on
smaller benchmarks. Moreover, in some applications, users of logic synthesis tools
crave to optimize their circuit as much as possible and are willing to afford higher
runtime.
This paper serves as a pioneer toward support of external don’t cares in logic
synthesis. During this journey, we will lay the foundation with mathematical
definitions of don’t-care conditions in general, explore different flavors of external
don’t cares, view the general problem of logic synthesis from a Boolean relation
perspective, and finally take the first step of considering external don’t cares in
logic optimization. We will show with experimental demonstrations that external
don’t cares indeed open up more optimization opportunities that would have been
impossible without them. In the end, we will also point out possible directions for
future research.
A Boolean variable is a variable taking values in the Boolean domain .B = {0, 1}.
The (n-dimensional) Boolean space .Bn is an n-ary Cartesian power of the Boolean
domain. An (n-input, single-output, completely specified) Boolean function is a
function .f : Bn → B of n Boolean variables. Multi-output Boolean functions can
be seen as an ordered set of single-output functions.
A Boolean relation .R is a binary relation over two Boolean spaces .R ⊆ Bn ×Bm ,
a domain (.Bn ) and a codomain (.Bm ). Boolean functions are special cases of Boolean
relations. More specifically, they can be classified into two types:
External Don’t Cares in Logic Synthesis 35
• Completely specified functions are special cases of Boolean relations where the
relations are functional (i.e., an element in the domain maps into one unique
element in the codomain) and total (i.e., every element in the domain maps into
an element in the codomain). When describing Boolean functions as Boolean
relations, an element in the domain, which is a value assignment to all the
function’s input variables, is also called a minterm.
• Incompletely specified functions are Boolean functions for which the output
values under some minterms are not specified. In other words, for some minterm
.b ∈ B , the output value can be either 0 or 1. An incompletely specified function
n
∀b ∈ Bn , (b, f (b)) ∈ R.
. (1)
When not explicitly noted, functions in the remaining of this paper refer to single-
output, completely specified Boolean functions.
Given any set R of roots, the identical set .C = R is always a cut by definition; thus,
such cut is said to be a trivial cut. Also, the set I of PIs is always a cut in a network
for any possible R.
Global Function of Nodes Each node n in a network computes a Boolean function
.fn : B|I | → B in terms of the PIs, called the node’s global function. To express
the global functions, a Boolean variable .xi is associated with each PI .i ∈ I . Let
.x = (x1 , . . . , x|I | ) be the set of all PI variables. By definition, the function of a PI
node .i ∈ I is .fi (x) = xi . Then, in a topological order, the functions of all nodes in
the network can be computed by composing the functions of a node’s fanins with
the function of the corresponding logic gate. Finally, the PO functions are computed
by taking the function of a PO node and inverting if the PO is complemented.
Node Function in Terms of a Cut The function of a node may also be expressed
in terms of a cut supporting it. Given a node n and a cut .C ∈ CUTS(n), the local
function .fnC : B|C| → B is the Boolean function derived by associating a Boolean
variable with each node in C and computing the local functions of each node in
the logic cone between C and n in a topological order. The global functions are a
special case of local functions using the PI set I as the cut:
fn " fnI .
. (5)
A don’t care for an incompletely specified function is a minterm for which the
output value is not specified. In a logic network, although all node functions (in
terms of any cut) are completely specified, for some nodes, there may be some
minterms where the output values of their functions are flexible. In other words, the
function .fnC of a node n in terms of cut C may be modified by changing its output
value under some minterms without affecting the global functions of any PO. As
a consequence, an incompletely specified function where these minterms are don’t
cares and the output values under the other minterms are the same as .fnC can be
used to resynthesize the logic cone between C and n. Two types of internal don’t
cares, arising from different reasons, may appear in logic networks:
External Don’t Cares in Logic Synthesis 37
• Given a cut .C ∈ CUTS(R) supporting a set R of nodes1 and let .x = (x1 , . . . , x|C| )
be Boolean variables associated with each node in C, a value assignment .bC ∈
B|C| to .x (i.e., a minterm of the local functions .fnC of any node .n ∈ R) is a
satisfiability don’t care (SDC) if this value combination never appears under any
PI value assignment:
• Given a node n and a cut .C ∈ CUTS(n) and let .x = (x1 , . . . , x|C| ) be Boolean
variables associated with each node in C, a value assignment .bC ∈ B|C| to .x (i.e.,
a minterm of the local function .fnC ) is an observability don’t care (ODC) with
respect to n if none of the PO functions are affected by flipping the output value
of .fnC under .bC :
where .fo∗ is the PO function derived by replacing any regular outgoing edge of n
with a complemented one and replacing any complemented outgoing edge of n
with a regular one.
1 The supported set R is not involved in the definition of SDCs, so it can, in theory, be empty and
C is not necessarily a cut. Although one may define and compute SDCs for any set C of nodes, in
practice, SDCs are only meaningful when C is indeed a cut, as SDCs are used to optimize nodes
in R.
38 S.-Y. Lee et al.
In many modern logic synthesis tools, internal don’t cares are derived locally
(under-approximated) using bit-parallel circuit simulation:
• To compute the SDCs for a given set C of nodes, we first find another cut
.C0 ∈ C UTS (C) supporting C. Then, we perform circuit simulation by assigning
projection functions to nodes in .C0 and obtain the local functions of nodes in C
in terms of .C0 , represented as truth tables. Finally, by analyzing each bit in the
truth tables, we identify the value combinations at C that do not happen, which
are the SDCs at C.
• To compute the ODCs with respect to a node n, we first mark the transitive fanout
cone of n for a predefined number of levels and collect the set R of nodes having
fanouts outside of this transitive fanout cone. Then, we find a cut .C ∈ CUTS(R)
supporting R and perform circuit simulation to obtain the local functions .fR of
nodes in R in terms of C. After adding a temporary inverter at the output of n, we
perform another simulation to obtain .fR∗ . Finally, we compare the two simulation
results to identify the minterms where .fR and .fR∗ have identical values, which
are the ODCs with respect to n.
Extending the definition of SDC to the input boundary, a value assignment to the
PIs that will never appear is called an external controllability don’t care (EXCDC).
These don’t cares are controlled by the environment external to the network.
External Don’t Cares in Logic Synthesis 39
Mathematically, EXCDCs are essentially a special case of SDCs where the cut
C is the set of PIs. The set of EXCDCs of a network N may be given as a function
.f
CDC : B|I | → B:
Extending the definition of ODCs to the output boundary, external ODCs are
conditions under which some PO values are not of interest. Depending on the
reasons of such situations, there are several ways one may wish to define external
ODCs.
As a Function of PIs For each PO .o ∈ O, the condition under which the value of o
is not observed may be specified as a function of PI values. For example, when the
network describes the transition and output logic of a Mealy finite-state machine, it
may appear that for some previous states (PIs of the network), an output is not used.
In this case, the external ODCs are described as a multi-output function .f ODCI :
B|I | → B|O| :
As a Function of Other POs For each PO .o ∈ O, the condition under which the
value of o is not observed may be specified as a function of other PO values. For
example, when the outputs of the network are used in the next stage as a series of
cascaded conditional statements such that if a PO of higher priority evaluates to
1, then the lower-priority POs do not matter. In this case, the external ODCs are
described as a multi-output function .f ODCO : B|O| → B|O| :
The i-th output of .f ODCO should not depend on its i-th input. Note that in this
case, the don’t-care conditions depend on the actual implementation of the network.
Using one ODC to optimize and change the function of a PO may invalidate
opportunities of using another ODC to optimize some other POs.
As Equivalence Classes Instead of specifying external ODCs separately for each
PO, the flexible conditions might be some value combinations of a subset of POs.
Figure 1 gives an example. Because of the cascaded next-stage logic at the output
of N , the value combinations .o1 = 0, o2 = 1, and .o1 = 1, o2 = 0 have the
same effect as seen from the system output (both map into .y1 = 1, y2 = 1; red
edges). Thus, these two PO value combinations may be classified into the same
external observability equivalence class (EXOEC), and PI minterms that map to
one of them are flexible to be re-mapped to either one (pink edges are added).
40 S.-Y. Lee et al.
y1 y2
00
00
o1 o2
01 01
10 10
N
11 11
More generally, two PO value combinations are observably equivalent (in the same
EXOEC) if their difference may not be observed when the network is immersed in
a larger system. By definition, this is an equivalence relation and is reflexive (i.e.,
if a is observably equivalent to b, then b is observably equivalent to a [a and b
are indistinguishable]), symmetric (i.e., any PO value combination is observably
equivalent to itself [trivial]), and transitive (i.e., if a is observably equivalent to b
and b is observably equivalent to c, then a is observably equivalent to c [.a, b and c
are indistinguishable]).
EXOECs can be given as a function .f OEC : B2·|O| → B:
n C1
SDCs
C0
I n=0 n=1
Example 1 Let .C1 ∈ CUTS(N ) be a cut of the network. Let .C0 = I and let .C2 =
{n : ∃c, (n, c) ∈ O}. We may derive two Boolean relations:
where .fCC10 is the function the nodes in .C1 compute in terms of .C0 , and similarly for
fCC21 .
.
Whereas an (internal) ODC for a node .n ∈ C1 is an element .b0 ∈ B|C0 | such that,
let .b1 = fC1 +{n} (b0 ) be the values at .C1 + {n} under .b0 :
Generalizing internal and external don’t cares, SDCs are elements in a Boolean
space (which corresponds to any cut in the network) that are not mapped to by
any element in a previous-stage Boolean space. In contrast, ODCs arise from two
elements in a Boolean space that map to the same element in a next-stage Boolean
space.
We observe that none of .f ODCI , f ODCO , f OEC is general enough to express the
other two. More concretely:
42 S.-Y. Lee et al.
• .f ODCI cannot be represented using .f ODCO or .f OEC because the latter ones lack
conditioning on the PI values. There can be multiple PI value combinations
leading to the same PO value, but only some of them are don’t cares.
• The example in Fig. 1 cannot be represented using .f ODCI or .f ODCO because the
condition is not simply ignoring the value of a single PO, but flipping the values
of both POs.
It is possible to convert .f ODCO into .f OEC , but the conversion is not straightfor-
ward, nor efficient. Starting from .f OEC (aO , bO ) = aO ↔ bO , for each .bO ∈ B|O|
such that .foODCO (bO ) = 1, we make .f OEC (bO , b∗O ) = 1, where .b∗O is derived
by flipping the value corresponding to o in .bO . The complication comes from
propagating the equivalence and keeping the transitivity property of the equivalence
relation during the process.
As discussed in Sect. 4.3, the specification of a logic synthesis problem can
be seen as a Boolean relation. In the presence of external don’t-care conditions,
representation using Boolean relations is inevitable because there are more than one
compatible completely specified multi-output Boolean functions. To represent the
specification Boolean relation .Rspec , we write its characteristic function, called the
specification function .f spec : B|I |+|O| → B, which asks if a certain pair of PI and
PO minterms is in .Rspec :
Given an original network .Nori , computing the function .fOI , and the external
don’t-care conditions as any subset of representations discussed in this section, .f spec
may be derived:
In Eq. (17), if .f CDC , .f ODCI , or .f ODCO are not given, they are substituted with 0
(i.e., the term is $removed); OEC is not given, it is substituted with a negated
" I if .f #
miter function .¬ o∈O fo (bI ) ⊕ bO .
A network is compatible if its global PO function .f impl fulfills:
After logic optimization, a verification step is usually done to ensure the functional
correctness of the optimized circuit. Classical CEC verifies if the optimized circuit
computes exactly the same global PO function as the original circuit. However,
External Don’t Cares in Logic Synthesis 43
when optimization is performed with external don’t cares, such exact equivalence
requirement is too strong. Verification must be modified to use a network represent-
ing .f spec instead of a miter network.
Boolean relation .Rspec . The SAT instance in Step 3 also needs to be relaxed to
take external don’t cares into account. The modified SAT instance now encodes the
complement of Eq. (18) instead of a miter. A satisfiable assignment to the instance
is a counterexample violating the Boolean relation .Rspec .
6 Experimental Demonstration
Table 1 Optimization results of using randomly generated external don’t cares on highly
optimized benchmarks
Benchmark EXCDC EXODC Both
Name #PIs #POs #Gates .∆ % Time .∆ % Time .∆ % Time
ex70 12 3 263 15 5.70 0.24 0 0.00 0.27 15 5.70 0.35
ex71 12 3 369 2 0.54 0.70 13 3.52 0.75 13 3.52 0.70
ex72 12 3 456 83 18.20 2.03 38 8.33 1.80 35 7.68 2.13
ex73 12 3 208 1 0.48 0.36 1 0.48 0.28 1 0.48 0.24
ex74 12 3 468 40 8.55 3.78 0 0.00 3.78 37 7.91 3.78
ex75 12 3 489 78 15.95 1.43 114 23.31 1.20 132 26.99 1.03
ex76 12 3 246 2 0.81 0.22 1 0.41 0.24 4 1.63 0.27
ex77 12 3 319 89 27.90 0.37 25 7.84 0.32 98 30.72 0.29
ex78 12 3 369 42 11.38 0.36 56 15.18 0.35 52 14.09 0.35
ex79 12 3 365 0 0.00 0.92 20 5.48 0.70 17 4.66 0.78
2 Available: https://github.com/lsils/mockturtle.
3 https://www.iwls.org/iwls2022/.
External Don’t Cares in Logic Synthesis 45
the number of gates before optimization using EXDCs, columns .∆ list the reduction
on the number of gates after optimization, columns % list the reduction percentage,
and columns Time list the runtime in seconds. All benchmarks use the same external
don’t-care conditions. Column EXCDC is optimized providing only a randomly
generated .f CDC having 248 minterms evaluating to 1, column EXODC is optimized
providing only .f ODCO = (fyODCO
1
= 0, fyODCO
2
= ¬y1 , fyODCO
3
= 0), and column
Both is optimized with both .f CDC and .f ODCO .
This experiment shows that providing external don’t cares indeed enables further
optimization opportunities, and that the presented optimization technique works in
practice.
This paper aims primarily at raising and defining the problem of logic synthesis
with external don’t cares. It provides a review on the theoretical definition of don’t-
care conditions in general, and identifies different ways of representing external
don’t cares. An emphasis is made on the relation of don’t cares and Boolean
relations. Finally, using partial simulation and SAT-based verification, we present
how external don’t cares may be considered in logic optimization. In conclusion,
this paper is the first step toward involving external don’t cares in logic synthesis.
While the theoretical formulations serve as a foundation for future research,
the optimization technique is still limited in achievable optimization quality and
scalability. In the following, we discuss some future research directions.
From the Boolean relation point of view, the classical definition of internal ODCs
(Eq. 7) is additionally restricted to pairs of elements that only differ in one bit
(corresponding to the node under consideration) instead of any pair that map to
the same next-stage minterm. The advantage of this approach is that the don’t-care
conditions are used to optimize one node at a time without the need to modify
the other nodes. However, it is possible to generalize this class of don’t cares by
grouping all elements that map to the same element in the next-stage Boolean space
together as an OEC and drop the dependency of the definition on a certain node.
In this case, multiple nodes need to be optimized together and change their output
values.
It is shown in [8] that considering the resynthesis problem of multiple nodes
at the same time is necessary for some optimization opportunities to emerge,
and the work provides algorithms to describe internal DCs as Boolean relations
and to resynthesize windows from Boolean relations. The problem of multi-target
46 S.-Y. Lee et al.
References
1. Bañeres, D., Cortadella, J., Kishinevsky, M.: A recursive paradigm to solve Boolean relations.
IEEE Trans. Comput. 58(4), 512–527 (2009)
2. Bartlett, K.A., Brayton, R.K., Hachtel, G.D., Jacoby, R.M., Morrison, C.R., Rudell, R.L.,
Sangiovanni-Vincentelli, A.L., Wang, A.R.: Multi-level logic minimization using implicit don’t
cares. IEEE Trans. Comput. Aided Des. Integr. Circuits Syst. 7(6), 723–740 (1988)
3. Brand, D.: Redundancy and don’t cares in logic synthesis. IEEE Trans. Comput. 32(10), 947–
952 (1983)
4. Damiani, M., Micheli, G.D.: Don’t care set specifications in combinational and synchronous
logic circuits. IEEE Trans. Comput. Aided Des. Integr. Circuits Syst. 12(3), 365–388 (1993)
5. Goldberg, E.I., Prasad, M.R., Brayton, R.K.: Using SAT for combinational equivalence
checking. In: W. Nebel, A. Jerraya (eds.) Proceedings of the Conference on Design,
Automation and Test in Europe, DATE 2001, Munich, Germany, March 12–16, 2001, pp. 114–
121. IEEE Computer Society (2001)
6. Lee, S.Y., Riener, H., Micheli, G.D.: Logic resynthesis of majority-based circuits by top-
down decomposition. In: M. Shafique, A. Steininger, L. Sekanina, M. Krstic, G. Stojanovic,
V. Mrazek (eds.) 24th International Symposium on Design and Diagnostics of Electronic
Circuits & Systems, DDECS 2021, Vienna, Austria, April 7–9, 2021, pp. 105–110. IEEE
(2021)
External Don’t Cares in Logic Synthesis 47
7. Lee, S.Y., Riener, H., Mishchenko, A., Brayton, R.K., De Micheli, G.: A simulation-guided
paradigm for logic synthesis and verification. IEEE Trans. CAD Integr. Circuits Syst. (2021).
https://doi.org/10.1109/TCAD.2021.3108704
8. Lee, T.Y., Wu, C.C., Lin, C.C., Chen, Y.C., Wang, C.Y.: Logic optimization with considering
Boolean relations. In: J. Madsen, A.K. Coskun (eds.) 2018 Design, Automation & Test in
Europe Conference & Exhibition, DATE 2018, Dresden, Germany, March 19–23, 2018, pp.
761–766. IEEE (2018)
9. McGeer, P.C., Brayton, R.K.: The observability don’t-care set and its approximations. In:
Proceedings of the 1990 IEEE International Conference on Computer Design: VLSI in
Computers and Processors, ICCD 1990, Cambridge, MA, USA, 17–19 September, 1990, pp.
45–48. IEEE Computer Society (1990)
10. Mishchenko, A., Brayton, R.K.: SAT-based complete don’t-care computation for network
optimization. In: 2005 Design, Automation and Test in Europe Conference and Exposition
(DATE 2005), 7–11 March 2005, Munich, Germany, pp. 412–417. IEEE Computer Society
(2005)
11. Muroga, S., Kambayashi, Y., Lai, H.C., Culliney, J.N.: The transduction method-design of logic
networks based on permissible functions. IEEE Trans. Comput. 38(10), 1404–1424 (1989)
12. Rho, J.K., Somenzi, F.: Don’t care sequences and the optimization of interacting finite state
machines. IEEE Trans. Comput. Aided Des. Integr. Circuits Syst. 13(7), 865–874 (1994)
13. Riener, H., Lee, S.Y., Mishchenko, A., Micheli, G.D.: Boolean rewriting strikes back:
Reconvergence-driven windowing meets resynthesis. In: 27th Asia and South Pacific Design
Automation Conference, ASP-DAC 2022, Taipei, Taiwan, January 17–20, 2022, pp. 395–402.
IEEE (2022)
14. Saluja, N., Khatri, S.P.: A robust algorithm for approximate compatible observability don’t care
(CODC) computation. In: S. Malik, L. Fix, A.B. Kahng (eds.) Proceedings of the 41th Design
Automation Conference, DAC 2004, San Diego, CA, USA, June 7–11, 2004, pp. 422–427.
ACM (2004)
15. Savoj, H., Brayton, R.K.: The use of observability and external don’t cares for the simplification
of multi-level networks. In: R.C. Smith (ed.) Proceedings of the 27th ACM/IEEE Design
Automation Conference, Orlando, Florida, USA, June 24–28, 1990, pp. 297–301. IEEE
Computer Society Press (1990)
16. Soeken, M., Riener, H., Haaswijk, W., Testa, E., Schmitt, B., Meuli, G., Mozafari, F., Lee, S.Y.,
Tempia Calvino, A., Marakkalage, D.S., De Micheli, G.: The EPFL logic synthesis libraries.
Preprint (2022). arXiv:1805.05121