96 #define b0 Cudd_Not((dd)->one)
100 #define ABC_PRB(dd,f) printf("%s = ", #f); Bbr_bddPrint(dd,f); printf("\n")
114 int nVars,
DdNode ** pbVarsNs );
131 int * piNode1,
int * piNode2 );
136 int nParts,
DdNode ** pbParts,
137 int nVars,
DdNode ** pbVars );
170 int nParts,
DdNode ** pbParts,
171 int nVars,
DdNode ** pbVars,
int nBddMax,
int fVerbose )
179 if ( fVerbose && dd->
size <= 80 )
186 pCare = pNodes[nParts];
194 for ( v = 0; v < dd->
size; v++ )
198 for ( v = 0; v <= nParts; v++ )
210 for ( v = 0; v < dd->
size; v++ )
211 assert( pVars[v] == NULL );
217 pTree->
pCare = pCare;
225 for ( v = 0; v < nParts + 1; v++ )
226 assert( pNodes[v] == NULL );
267 printf(
"Original care set support: " );
269 printf(
"Current care set support: " );
273 printf(
"The care set depends on some vars that were not in the care set during scheduling.\n" );
293 return pTree->
pRoot->bImage;
328 return pTree->
pRoot->bImage;
351 int nVars = dd->
size;
362 printf(
"Constant 0");
367 printf(
"Constant 1");
379 for ( i = 0; i < nVars; i++ )
381 printf(
"[%d]'", i );
383 else if ( Cube[i] == 1 )
415 for ( i = 0; i < nParts; i++ )
422 pParts[i]->
iPart = i;
426 pParts[nParts]->
bFunc = bCare;
Cudd_Ref( pParts[nParts]->bFunc );
430 pParts[nParts]->
iPart = nParts;
447 int nVars,
DdNode ** pbVars )
451 DdNode * bCubeNs, * bSupp, * bParts, * bTemp, * bSuppTemp;
456 for ( p = 0; p < nParts; p++ )
457 pbFuncs[p] = pParts[p]->bSupp;
474 for ( bSuppTemp = bSupp; bSuppTemp !=
b1; bSuppTemp =
cuddT(bSuppTemp) )
476 iVar = bSuppTemp->
index;
478 pVars[iVar]->
iNum = iVar;
482 for ( p = 0; p < nParts; p++ )
489 pVars[iVar]->
bParts = bParts;
526 for ( i = 0; i < nParts; i++ )
531 pNodes[i]->pPart = pParts[i];
534 for ( v = 0; v < nVars; v++ )
536 if ( pVars[v] == NULL )
538 assert( pVars[v]->nParts > 0 );
539 if ( pVars[v]->nParts > 1 )
542 if ( pNodes[iPart]->bCube == NULL )
544 pNodes[iPart]->bCube = dd->
vars[v];
549 pNodes[iPart]->bCube =
Cudd_bddAnd( dd, bTemp = pNodes[iPart]->bCube, dd->
vars[v] );
559 for ( i = 0; i < nParts; i++ )
577 if ( i < nParts - 1 )
618 pPart = pNode->pPart;
645 assert( pNode->pPart == NULL );
667 if ( pNode->pNode1 == NULL )
689 pNode->bImage = NULL;
694 pNode->pNode1->bImage, pNode->pNode2->bImage, pNode->bCube );
696 pNode->bImage =
Cudd_bddAnd( dd, pNode->pNode1->bImage, pNode->pNode2->bImage );
728 DdNode * bCube, * bTemp, * bSuppTemp;
730 int iVarBest, nSupp, v;
734 if ( iVarBest == -1 )
749 pVar = pVars[iVarBest];
763 pNode1 = pNodes[iNode1];
764 pNode2 = pNodes[iNode2];
769 for ( v = 0; v < nVars; v++ )
770 if ( pVars[v] && v != iVarBest && pVars[v]->bParts == pVars[iVarBest]->bParts )
791 pNode1 = pNodes[iNode1];
792 pNode2 = pNodes[iNode2];
808 pNodes[iNode1] = pNode;
809 pNodes[iNode2] = NULL;
813 for ( bSuppTemp = pNode2->pPart->bSupp; bSuppTemp !=
b1; bSuppTemp =
cuddT(bSuppTemp) )
815 pVar = pVars[bSuppTemp->
index];
830 if ( dd->
keys-dd->
dead > (
unsigned)nBddMax )
854 int n1 = -1, n2 = -1, n;
857 for ( n = 0; n < nNodes; n++ )
927 pNode->pPart = pPart;
928 pNode->pNode1 = pNode1;
929 pNode->pNode2 = pNode2;
936 pNode->bCube = bCube;
Cudd_Ref( bCube );
959 double CostBest, CostCur;
961 CostBest = 100000000000000.0;
965 for ( v = 0; v < nVars; v++ )
966 if ( pVars[v] && pVars[v]->nParts == 2 )
969 for ( bTemp = pVars[v]->bParts; bTemp !=
b1; bTemp =
cuddT(bTemp) )
970 CostCur += pNodes[bTemp->
index]->pPart->nNodes *
971 pNodes[bTemp->
index]->pPart->nNodes;
972 if ( CostBest > CostCur )
982 for ( v = 0; v < nVars; v++ )
985 assert( pVars[v]->nParts > 1 );
987 for ( bTemp = pVars[v]->bParts; bTemp !=
b1; bTemp =
cuddT(bTemp) )
988 CostCur += pNodes[bTemp->
index]->pPart->nNodes *
989 pNodes[bTemp->
index]->pPart->nNodes;
990 if ( CostBest > CostCur )
1012 int * piNode1,
int * piNode2 )
1016 int CostMin1, CostMin2, Cost;
1019 iPart1 = iPart2 = -1;
1020 CostMin1 = CostMin2 = 1000000;
1021 for ( bTemp = bParts; bTemp !=
b1; bTemp =
cuddT(bTemp) )
1023 Cost = pNodes[bTemp->
index]->pPart->nNodes;
1024 if ( CostMin1 > Cost )
1026 CostMin2 = CostMin1; iPart2 = iPart1;
1027 CostMin1 = Cost; iPart1 = bTemp->
index;
1029 else if ( CostMin2 > Cost )
1031 CostMin2 = Cost; iPart2 = bTemp->
index;
1052 int nParts,
DdNode ** pbParts,
1053 int nVars,
DdNode ** pbVars )
1056 DdNode * bVarsCs, * bVarsNs;
1061 printf(
"The latch dependency matrix:\n" );
1062 printf(
"Partitions = %d Variables: total = %d non-quantifiable = %d\n",
1063 nParts, dd->
size, nVars );
1065 for ( i = 0; i < dd->
size; i++ )
1066 printf(
"%d", i % 10 );
1069 for ( i = 0; i < nParts; i++ )
1096 printf(
" %3d : ", iPart );
1097 for ( v = 0; v < dd->
size; v++ )
1129 printf(
"The quantification scheduling tree:\n" );
1149 Cube = pNode->bCube;
1151 if ( pNode->pNode1 == NULL )
1153 printf(
"<%d> ", pNode->pPart->iPart );
1171 for ( i = 0; i < Offset; i++ )
1175 for ( i = 0; i < Offset; i++ )
1198 for ( i = 0; i < nVars; i++ )
1233 int nParts,
DdNode ** pbParts,
1234 int nVars,
DdNode ** pbVars,
int fVerbose )
1237 DdNode * bCubeAll, * bCubeNot, * bTemp;
1252 for ( i = 0; i < nParts; i++ )
static void Bbr_bddImagePrintLatchDependency(DdManager *dd, DdNode *bCare, int nParts, DdNode **pbParts, int nVars, DdNode **pbVars)
static void Bbr_bddImagePrintLatchDependencyOne(DdManager *dd, DdNode *bFunc, DdNode *bVarsCs, DdNode *bVarsNs, int iPart)
static void Bbr_bddPrint(DdManager *dd, DdNode *F)
Bbr_ImageTree2_t * Bbr_bddImageStart2(DdManager *dd, DdNode *bCare, int nParts, DdNode **pbParts, int nVars, DdNode **pbVars, int fVerbose)
DdNode * Cudd_bddComputeCube(DdManager *dd, DdNode **vars, int *phase, int n)
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
void Bbr_bddImageTreeDelete2(Bbr_ImageTree2_t *pTree)
DdNode * Cudd_Support(DdManager *dd, DdNode *f)
#define Cudd_ForeachCube(manager, f, gen, cube, value)
void Cudd_Deref(DdNode *node)
typedefABC_NAMESPACE_IMPL_START struct Bbr_ImageNode_t_ Bbr_ImageNode_t
DdNode * Bbr_bddImageCompute(Bbr_ImageTree_t *pTree, DdNode *bCare)
DdNode * Bbr_bddImageCompute2(Bbr_ImageTree2_t *pTree, DdNode *bCare)
DdNode * Cudd_bddExistAbstract(DdManager *manager, DdNode *f, DdNode *cube)
static void Bbr_FindBestPartitions(DdManager *dd, DdNode *bParts, int nNodes, Bbr_ImageNode_t **pNodes, int *piNode1, int *piNode2)
#define ABC_ALLOC(type, num)
static int Bbr_bddImageCompute_rec(Bbr_ImageTree_t *pTree, Bbr_ImageNode_t *pNode)
DdNode * Bbr_bddImageRead(Bbr_ImageTree_t *pTree)
static void Bbr_bddImagePrintTree_rec(Bbr_ImageNode_t *pNode, int nOffset)
Bbr_ImageTree_t * Bbr_bddImageStart(DdManager *dd, DdNode *bCare, int nParts, DdNode **pbParts, int nVars, DdNode **pbVars, int nBddMax, int fVerbose)
DdNode * Bbr_bddComputeCube(DdManager *dd, DdNode **bXVars, int nVars)
static Bbr_ImagePart_t ** Bbr_CreateParts(DdManager *dd, int nParts, DdNode **pbParts, DdNode *bCare)
static int Bbr_BuildTreeNode(DdManager *dd, int nNodes, Bbr_ImageNode_t **pNodes, int nVars, Bbr_ImageVar_t **pVars, int *pfStop, int nBddMax)
static Bbr_ImageNode_t ** Bbr_CreateNodes(DdManager *dd, int nParts, Bbr_ImagePart_t **pParts, int nVars, Bbr_ImageVar_t **pVars)
#define ABC_NAMESPACE_IMPL_END
static Bbr_ImageNode_t * Bbr_CombineTwoNodes(DdManager *dd, DdNode *bCube, Bbr_ImageNode_t *pNode1, Bbr_ImageNode_t *pNode2)
DdNode * Cudd_bddAndAbstract(DdManager *manager, DdNode *f, DdNode *g, DdNode *cube)
static void Bbr_bddImagePrintTree(Bbr_ImageTree_t *pTree)
#define ABC_NAMESPACE_IMPL_START
int Cudd_bddLeq(DdManager *dd, DdNode *f, DdNode *g)
static int Bbr_FindBestVariable(DdManager *dd, int nNodes, Bbr_ImageNode_t **pNodes, int nVars, Bbr_ImageVar_t **pVars)
DdNode * Bbr_bddImageRead2(Bbr_ImageTree2_t *pTree)
static Bbr_ImageNode_t * Bbr_MergeTopNodes(DdManager *dd, int nNodes, Bbr_ImageNode_t **pNodes)
DdNode * Cudd_bddAnd(DdManager *dd, DdNode *f, DdNode *g)
static void Bbr_DeleteParts_rec(Bbr_ImageNode_t *pNode)
void Bbr_bddImageTreeDelete(Bbr_ImageTree_t *pTree)
static void Bbr_bddImageTreeDelete_rec(Bbr_ImageNode_t *pNode)
int Cudd_SupportSize(DdManager *dd, DdNode *f)
static Bbr_ImageVar_t ** Bbr_CreateVars(DdManager *dd, int nParts, Bbr_ImagePart_t **pParts, int nVars, DdNode **pbVarsNs)
DdNode * Cudd_VectorSupport(DdManager *dd, DdNode **F, int n)
int Cudd_DagSize(DdNode *node)