74 #define DBL_MAX_EXP 1024
87 #define DEFAULT_PAGE_SIZE 2048
88 #define DEFAULT_NODE_DATA_PAGE_SIZE 1024
89 #define INITIAL_PAGES 128
120 static char rcsid[]
DD_UNUSED =
"$Id: cuddSubsetHB.c,v 1.37 2009/02/20 02:14:58 fabio Exp $";
125 static int num_calls;
322 fprintf(dd->
err,
"Cannot subset, nil object\n");
344 max = pow(2.0, (
double)numVars);
349 if ((visitedTable == NULL) ||
memOut) {
350 (void) fprintf(dd->
err,
"Out-of-memory; Cannot subset\n");
356 (void) fprintf(dd->
err,
"Out-of-memory; Cannot subset\n");
361 if (
st__lookup(visitedTable, (
const char *)f, (
char **)&currNodeQual) == 0) {
363 "Something is wrong, ought to be node quality table\n");
383 fprintf(dd->
out,
"Something wrong, st__table insert failed\n");
388 storeTable, approxTable);
389 if (subset != NULL) {
398 while(
st__gen(stGen, (
const char **)&key, (
char **)&value)) {
409 while(
st__gen(stGen, (
const char **)&key, (
char **)&value)) {
415 for (i = 0; i <=
page; i++) {
419 for (i = 0; i <=
page; i++) {
423 for (i = 0; i <=
page; i++) {
438 if (subset != NULL) {
441 fprintf(dd->
err,
"Wrong subset\n");
486 if (newNodeDataPages == NULL) {
493 newNodeDataPages[i] = nodeDataPages[i];
498 nodeDataPages = newNodeDataPages;
504 if (currentNodeDataPage == NULL) {
536 double **newMintermPages;
545 if (newMintermPages == NULL) {
603 if (newNodePages == NULL) {
619 if (newNodePages == NULL) {
707 if (
st__lookup(table, (
const char *)node, (
char **)&dummy)) {
803 max = pow(2.0,(
double) nvars);
805 if (table == NULL)
goto OUT_OF_MEM;
823 if (nodeDataPages == NULL) {
832 if (currentNodeDataPage == NULL) {
842 if (
memOut)
goto OUT_OF_MEM;
879 double minNv, minNnv;
880 NodeData_t *dummyN, *dummyNv, *dummyNnv, *dummyNBar;
881 int *pmin, *pminBar, *val;
887 if (
st__lookup(table, (
const char *)node, (
char **)&dummyN) == 1) {
910 if (
st__lookup(table, (
const char *)Nv, (
char **)&dummyNv) == 1)
923 if (
st__lookup(table, (
const char *)Nnv, (
char **)&dummyNnv) == 1) {
933 if (minNv >= minNnv) {
976 *pmin = tval + eval + 1;
1048 max = pow(2.0,(
double) nvars);
1091 if (
memOut)
goto OUT_OF_MEM;
1128 fprintf(dd->
err,
"Something wrong, st__table insert failed\n");
1168 DdNode *Nv, *Nnv, *N, *topv, *neW;
1169 double minNv, minNnv;
1173 DdNode *ThenBranch, *ElseBranch;
1182 if ((*size) <= threshold) {
1192 if (!
st__lookup(visitedTable, (
const char *)node, (
char **)&currNodeQual)) {
1194 "Something is wrong, ought to be in node quality table\n");
1208 if (!
st__lookup(visitedTable, (
const char *)Nv, (
char **)&currNodeQualT)) {
1209 fprintf(dd->
out,
"Something wrong, couldnt find nodes in node quality table\n");
1214 minNv = *(((
NodeData_t *)currNodeQualT)->mintermPointer);
1225 if (!
st__lookup(visitedTable, (
const char *)Nnv, (
char **)&currNodeQualE)) {
1226 fprintf(dd->
out,
"Something wrong, couldnt find nodes in node quality table\n");
1230 minNnv = *(((
NodeData_t *)currNodeQualE)->mintermPointer);
1244 if (minNv >= minNnv) {
1249 visitedTable, threshold, storeTable, approxTable);
1250 if (ThenBranch == NULL) {
1262 if (
st__lookup(approxTable, (
char *)Nnv, &dummy)) {
1263 ElseBranch = (
DdNode *)dummy;
1275 visitedTable, threshold, storeTable, approxTable);
1276 if (ElseBranch == NULL) {
1288 if (
st__lookup(approxTable, (
char *)Nv, &dummy)) {
1289 ThenBranch = (
DdNode *)dummy;
1322 if (
st__lookup(approxTable, (
char *)node, &dummy)) {
1323 fprintf(dd->
err,
"This node should not be in the approximated table\n");
1326 if (!
st__insert(approxTable, (
char *)node, (
char *)neW))
void st__free_table(st__table *table)
static int maxNodeDataPages
static int SubsetCountNodes(DdNode *node, st__table *table, int nvars)
#define DEFAULT_NODE_DATA_PAGE_SIZE
static double * currentMintermPage
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
void st__free_gen(st__generator *gen)
int st__insert(st__table *table, const char *key, char *value)
DdNode * Cudd_SubsetHeavyBranch(DdManager *dd, DdNode *f, int numVars, int threshold)
static int * currentNodePage
static void StoreNodes(st__table *storeTable, DdManager *dd, DdNode *node)
#define Cudd_IsConstant(node)
#define Cudd_Regular(node)
static void ResizeCountMintermPages(void)
static int ** lightNodePages
int st__ptrcmp(const char *, const char *)
static NodeData_t * currentNodeDataPage
#define ABC_ALLOC(type, num)
static int nodeDataPageIndex
static DdNode * BuildSubsetBdd(DdManager *dd, DdNode *node, int *size, st__table *visitedTable, int threshold, st__table *storeTable, st__table *approxTable)
static st__table * SubsetCountMinterm(DdNode *node, int nvars)
DdNode * cuddSubsetHeavyBranch(DdManager *dd, DdNode *f, int numVars, int threshold)
DdNode * Cudd_ReadVars(DdManager *dd, int i)
st__table * st__init_table(st__compare_func_type compare, st__hash_func_type hash)
#define Cudd_IsComplement(node)
int * lightChildNodesPointer
static int * currentLightNodePage
static void ResizeCountNodePages(void)
#define DEFAULT_PAGE_SIZE
DdNode * Cudd_SupersetHeavyBranch(DdManager *dd, DdNode *f, int numVars, int threshold)
#define ABC_NAMESPACE_IMPL_END
static void ResizeNodeDataPages(void)
static double ** mintermPages
int Cudd_DebugCheck(DdManager *table)
static char rcsid[] DD_UNUSED
st__generator * st__init_gen(st__table *table)
#define ABC_NAMESPACE_IMPL_START
DdNode * Cudd_ReadOne(DdManager *dd)
int Cudd_bddLeq(DdManager *dd, DdNode *f, DdNode *g)
int st__lookup(st__table *table, const char *key, char **value)
static NodeData_t ** nodeDataPages
static int SubsetCountNodesAux(DdNode *node, st__table *table, double max)
unsigned int Cudd_NodeReadIndex(DdNode *node)
int Cudd_CheckKeys(DdManager *table)
#define Cudd_NotCond(node, c)
static double SubsetCountMintermAux(DdNode *node, double max, st__table *table)
int st__ptrhash(const char *, int)
int st__gen(st__generator *gen, const char **key_p, char **value_p)
static int nodeDataPageSize
DdNode * cuddBddIteRecur(DdManager *dd, DdNode *f, DdNode *g, DdNode *h)