cudd
3.0.0
The University of Colorado Decision Diagram Package
|
Arbitrary precision arithmetic functions. More...
Macros | |
#define | DD_APA_BITS ((int) sizeof(DdApaDigit) * 8) |
#define | DD_APA_BASE ((DdApaDoubleDigit) 1 << DD_APA_BITS) |
#define | DD_APA_MASK (DD_APA_BASE - 1) |
#define | DD_LSDIGIT(x) ((x) & DD_APA_MASK) |
Extract the least significant digit of a double digit. More... | |
#define | DD_MSDIGIT(x) ((x) >> DD_APA_BITS) |
Extract the most significant digit of a double digit. More... | |
Typedefs | |
typedef uint64_t | DdApaDoubleDigit |
Type used for intermediate results. | |
Functions | |
int | Cudd_ApaNumberOfDigits (int binaryDigits) |
Returns the number of digits for an arbitrary precision integer. More... | |
DdApaNumber | Cudd_NewApaNumber (int digits) |
Allocates memory for an arbitrary precision integer. More... | |
void | Cudd_FreeApaNumber (DdApaNumber number) |
Frees an arbitrary precision integer. More... | |
void | Cudd_ApaCopy (int digits, DdConstApaNumber source, DdApaNumber dest) |
Makes a copy of an arbitrary precision integer. More... | |
DdApaDigit | Cudd_ApaAdd (int digits, DdConstApaNumber a, DdConstApaNumber b, DdApaNumber sum) |
Adds two arbitrary precision integers. More... | |
DdApaDigit | Cudd_ApaSubtract (int digits, DdConstApaNumber a, DdConstApaNumber b, DdApaNumber diff) |
Subtracts two arbitrary precision integers. More... | |
DdApaDigit | Cudd_ApaShortDivision (int digits, DdConstApaNumber dividend, DdApaDigit divisor, DdApaNumber quotient) |
Divides an arbitrary precision integer by a digit. More... | |
unsigned int | Cudd_ApaIntDivision (int digits, DdConstApaNumber dividend, unsigned int divisor, DdApaNumber quotient) |
Divides an arbitrary precision integer by an integer. More... | |
void | Cudd_ApaShiftRight (int digits, DdApaDigit in, DdConstApaNumber a, DdApaNumber b) |
Shifts right an arbitrary precision integer by one binary place. More... | |
void | Cudd_ApaSetToLiteral (int digits, DdApaNumber number, DdApaDigit literal) |
Sets an arbitrary precision integer to a one-digit literal. More... | |
void | Cudd_ApaPowerOfTwo (int digits, DdApaNumber number, int power) |
Sets an arbitrary precision integer to a power of two. More... | |
int | Cudd_ApaCompare (int digitsFirst, DdConstApaNumber first, int digitsSecond, DdConstApaNumber second) |
Compares two arbitrary precision integers. More... | |
int | Cudd_ApaCompareRatios (int digitsFirst, DdConstApaNumber firstNum, unsigned int firstDen, int digitsSecond, DdConstApaNumber secondNum, unsigned int secondDen) |
Compares the ratios of two arbitrary precision integers to two unsigned ints. More... | |
int | Cudd_ApaPrintHex (FILE *fp, int digits, DdConstApaNumber number) |
Prints an arbitrary precision integer in hexadecimal format. More... | |
int | Cudd_ApaPrintDecimal (FILE *fp, int digits, DdConstApaNumber number) |
Prints an arbitrary precision integer in decimal format. More... | |
char * | Cudd_ApaStringDecimal (int digits, DdConstApaNumber number) |
converts an arbitrary precision integer to a string in decimal format. More... | |
int | Cudd_ApaPrintExponential (FILE *fp, int digits, DdConstApaNumber number, int precision) |
Prints an arbitrary precision integer in exponential format. More... | |
DdApaNumber | Cudd_ApaCountMinterm (DdManager const *manager, DdNode *node, int nvars, int *digits) |
Counts the number of minterms of a DD. More... | |
int | Cudd_ApaPrintMinterm (FILE *fp, DdManager const *dd, DdNode *node, int nvars) |
Prints the number of minterms of a BDD or ADD using arbitrary precision arithmetic. More... | |
int | Cudd_ApaPrintMintermExp (FILE *fp, DdManager const *dd, DdNode *node, int nvars, int precision) |
Prints the number of minterms of a BDD or ADD in exponential format using arbitrary precision arithmetic. More... | |
int | Cudd_ApaPrintDensity (FILE *fp, DdManager *dd, DdNode *node, int nvars) |
Prints the density of a BDD or ADD using arbitrary precision arithmetic. More... | |
static DdApaNumber | cuddApaCountMintermAux (DdManager const *manager, DdNode *node, int digits, DdApaNumber mmax, DdApaNumber mmin, st_table *table) |
Performs the recursive step of Cudd_ApaCountMinterm. More... | |
static enum st_retval | cuddApaStCountfree (void *key, void *value, void *arg) |
Frees the memory used to store the minterm counts recorded in the visited table. More... | |
Arbitrary precision arithmetic functions.
This file provides just enough functionality as needed by CUDD to compute the number of minterms of functions with many variables.
Copyright (c) 1995-2015, Regents of the University of Colorado
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the University of Colorado nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define DD_LSDIGIT | ( | x | ) | ((x) & DD_APA_MASK) |
#define DD_MSDIGIT | ( | x | ) | ((x) >> DD_APA_BITS) |
DdApaDigit Cudd_ApaAdd | ( | int | digits, |
DdConstApaNumber | a, | ||
DdConstApaNumber | b, | ||
DdApaNumber | sum | ||
) |
Adds two arbitrary precision integers.
int Cudd_ApaCompare | ( | int | digitsFirst, |
DdConstApaNumber | first, | ||
int | digitsSecond, | ||
DdConstApaNumber | second | ||
) |
Compares two arbitrary precision integers.
int Cudd_ApaCompareRatios | ( | int | digitsFirst, |
DdConstApaNumber | firstNum, | ||
unsigned int | firstDen, | ||
int | digitsSecond, | ||
DdConstApaNumber | secondNum, | ||
unsigned int | secondDen | ||
) |
Compares the ratios of two arbitrary precision integers to two unsigned ints.
void Cudd_ApaCopy | ( | int | digits, |
DdConstApaNumber | source, | ||
DdApaNumber | dest | ||
) |
Makes a copy of an arbitrary precision integer.
DdApaNumber Cudd_ApaCountMinterm | ( | DdManager const * | manager, |
DdNode * | node, | ||
int | nvars, | ||
int * | digits | ||
) |
Counts the number of minterms of a DD.
The function is assumed to depend on nvars variables. The minterm count is represented as an arbitrary precision unsigned integer, to allow for any number of variables CUDD supports.
digits
.unsigned int Cudd_ApaIntDivision | ( | int | digits, |
DdConstApaNumber | dividend, | ||
unsigned int | divisor, | ||
DdApaNumber | quotient | ||
) |
Divides an arbitrary precision integer by an integer.
Divides an arbitrary precision integer by a 32-bit unsigned integer. This procedure relies on the assumption that the number of bits of a DdApaDigit plus the number of bits of an unsigned int is less the number of bits of the mantissa of a double. This guarantees that the product of a DdApaDigit and an unsigned int can be represented without loss of precision by a double. On machines where this assumption is not satisfied, this procedure will malfunction.
int Cudd_ApaNumberOfDigits | ( | int | binaryDigits | ) |
Returns the number of digits for an arbitrary precision integer.
Finds the number of digits for an arbitrary precision integer given the maximum number of binary digits. The number of binary digits should be positive.
void Cudd_ApaPowerOfTwo | ( | int | digits, |
DdApaNumber | number, | ||
int | power | ||
) |
Sets an arbitrary precision integer to a power of two.
If the power of two is too large to be represented, the number is set to 0.
int Cudd_ApaPrintDecimal | ( | FILE * | fp, |
int | digits, | ||
DdConstApaNumber | number | ||
) |
Prints an arbitrary precision integer in decimal format.
Prints the density of a BDD or ADD using arbitrary precision arithmetic.
int Cudd_ApaPrintExponential | ( | FILE * | fp, |
int | digits, | ||
DdConstApaNumber | number, | ||
int | precision | ||
) |
Prints an arbitrary precision integer in exponential format.
Prints as an integer if precision is at least the number of digits to be printed. If precision does not allow printing of all digits, rounds to nearest breaking ties so that the last printed digit is even.
< readable false
< readable true
int Cudd_ApaPrintHex | ( | FILE * | fp, |
int | digits, | ||
DdConstApaNumber | number | ||
) |
Prints an arbitrary precision integer in hexadecimal format.
Prints the number of minterms of a BDD or ADD using arbitrary precision arithmetic.
int Cudd_ApaPrintMintermExp | ( | FILE * | fp, |
DdManager const * | dd, | ||
DdNode * | node, | ||
int | nvars, | ||
int | precision | ||
) |
Prints the number of minterms of a BDD or ADD in exponential format using arbitrary precision arithmetic.
Parameter precision controls the number of signficant digits printed.
void Cudd_ApaSetToLiteral | ( | int | digits, |
DdApaNumber | number, | ||
DdApaDigit | literal | ||
) |
Sets an arbitrary precision integer to a one-digit literal.
void Cudd_ApaShiftRight | ( | int | digits, |
DdApaDigit | in, | ||
DdConstApaNumber | a, | ||
DdApaNumber | b | ||
) |
Shifts right an arbitrary precision integer by one binary place.
The most significant binary digit of the result is taken from parameter in
.
DdApaDigit Cudd_ApaShortDivision | ( | int | digits, |
DdConstApaNumber | dividend, | ||
DdApaDigit | divisor, | ||
DdApaNumber | quotient | ||
) |
Divides an arbitrary precision integer by a digit.
char* Cudd_ApaStringDecimal | ( | int | digits, |
DdConstApaNumber | number | ||
) |
converts an arbitrary precision integer to a string in decimal format.
DdApaDigit Cudd_ApaSubtract | ( | int | digits, |
DdConstApaNumber | a, | ||
DdConstApaNumber | b, | ||
DdApaNumber | diff | ||
) |
Subtracts two arbitrary precision integers.
diff
. void Cudd_FreeApaNumber | ( | DdApaNumber | number | ) |
DdApaNumber Cudd_NewApaNumber | ( | int | digits | ) |
Allocates memory for an arbitrary precision integer.
|
static |
Performs the recursive step of Cudd_ApaCountMinterm.
It is based on the following identity. Let |f|
be the number of minterms of f
. Then:
|f| = (|f0|+|f1|)/2
where f0 and f1 are the two cofactors of f. Uses the identity |f'| = mmax - |f|
. The procedure expects the argument "node" to be a regular pointer, and guarantees this condition is met in the recursive calls. For efficiency, the result of a call is cached only if the node has a reference count greater than 1.
|
static |
Frees the memory used to store the minterm counts recorded in the visited table.