119 int SumMaxGateSize = 0;
141 printf(
"\nDecomposability statistics for individual outputs:\n" );
150 for ( i = 0; i < nFuncs; i++ )
155 int nReusedBlocksPres;
177 SumMaxGateSize += MaxBlock;
181 printf(
"#%02d: ", i );
185 printf(
"Max=%3d. ", MaxBlock );
187 printf(
"Csc=%2d. ", nCascades );
188 printf(
"T= %.2f s. ", (
float)(
Abc_Clock()-clk)/(
float)(CLOCKS_PER_SEC) ) ;
199 printf(
"The cumulative decomposability statistics:\n" );
200 printf(
" Total outputs = %5d\n", nFuncs );
201 printf(
" Decomposable outputs = %5d\n", nDecOutputs );
202 printf(
" Completely decomposable outputs = %5d\n", nCBFOutputs );
203 printf(
" The sum of max gate sizes = %5d\n", SumMaxGateSize );
205 printf(
" Decomposition entries = %5d\n",
st__count( pDsdMan->
Table ) );
206 printf(
" Pure decomposition time = %.2f sec\n", (
float)(
Abc_Clock() - clk)/(
float)(CLOCKS_PER_SEC) );
257 DdNode * bSuppNew = NULL, * bTemp;
275 int fCompF = (int)(bF != bFunc0);
294 bVarCur = dd->
vars[VarInt];
295 pVarCurDE = pDsdMan->
pInputs[VarInt];
309 pThis->
pDecs[0] = NULL;
372 if ( bLowR == bHigh )
447 int c, iCompLarge = -1;
456 if ( pSmallR == pLR )
491 int g, fFoundComp = -1;
493 DdNode * bLarge, * bSmall;
505 for ( g = 0; g < pLargeR->
nDecs; g++ )
508 pDETemp = pLargeR->
pDecs[g];
526 if ( g != pLargeR->
nDecs )
552 for ( c = 0; c < pLargeR->
nDecs; c++ )
560 if ( c != pLargeR->
nDecs )
562 pComp = pLargeR->
pDecs[iCompLarge];
570 if ( pLargeR->
Type == pSmallR->
Type &&
573 Dsd_Node_t ** pCommon, * pLastDiffL = NULL, * pLastDiffH = NULL;
577 if ( nCommon == pSmallR->
nDecs )
580 nComp = pSmallR->
nDecs;
589 int fComp1 = (int)( pLarge != pLargeR );
590 int fComp2 = (int)( pComp != pCompR );
591 int fComp3 = (int)( pSmall != pSmallR );
600 if ( (fComp1 ^ fComp2) == fComp3 )
626 bFTemp = (fComp1)?
Cudd_Not( bF ): bF;
627 bFuncComp = (fComp2)?
Cudd_Not( pCompR->
G ): pCompR->
G;
640 pThis->
pDecs[0] = pDENew;
641 pThis->
pDecs[1] = pComp;
679 bFTemp = (fComp3)? bF:
Cudd_Not( bF );
690 pThis->
pDecs[0] = pDENew;
691 pThis->
pDecs[1] = pComp;
708 if ( nSuppLH == nSuppL + nSuppH )
714 pThis->
pDecs[1] = pLR;
715 pThis->
pDecs[2] = pHR;
719 pThis->
pDecs[1] = pHR;
720 pThis->
pDecs[2] = pLR;
723 pThis->
pDecs[0] = pVarCurDE;
736 (pLR->
Type !=
DSD_NODE_OR || ( (pL == pLR && pH == pHR) || (pL != pLR && pH != pHR) ) ) &&
740 Dsd_Node_t ** pCommon, * pLastDiffL = NULL, * pLastDiffH = NULL;
750 DdNode * bCommF, * bCommS, * bFTemp, * bFuncNew;
756 bFTemp = ( pL != pLR )?
Cudd_Not(bF): bF;
775 pThis->
pDecs[0] = pDENew;
785 DdNode * bCommF, * bFuncNew;
811 pThis->
pDecs[0] = pDENew;
831 if ( nCommon == pLR->
nDecs )
838 for ( m = 0; m < pLR->
nDecs; m++ )
840 pTempL = pLR->
pDecs[m];
841 pTempH = pHR->
pDecs[m];
848 assert( pLastDiffL == pLastDiffH );
873 for ( m = 0; m < pLR->
nDecs; m++ )
874 if ( pLR->
pDecs[m] != pLastDiffL )
875 pCommon[nCommon++] = pLR->
pDecs[m];
901 if ( fCompComp == 1 )
902 bFuncNew =
Cudd_bddIte( dd, bVarCur, pLastDiffH->G, pLastDiffL->
G );
921 pThis->
pDecs[0] = pDENew;
937 int nEntriesMax = pDsdMan->
nInputs - dd->
perm[VarInt];
942 DdNode * SuppL, * SuppH, * SuppL_init, * SuppH_init;
952 pThis->
pDecs[ nEntries++ ] = pVarCurDE;
977 if ( levTopSuppL <= levTopSuppH )
979 levTop = levTopSuppL;
980 SuppL =
cuddT(SuppL);
983 levTop = levTopSuppH;
985 if ( levTopSuppH <= levTopSuppL )
986 SuppH =
cuddT(SuppH);
991 while ( SuppL !=
b1 || SuppH !=
b1 );
1002 while ( SuppL !=
b1 || SuppH !=
b1 )
1008 int TopLevel = TopLevH;
1009 int fEqualLevel = 0;
1015 if ( TopLevL < TopLevH )
1021 else if ( TopLevL > TopLevH )
1037 DdNode * bSuppLower = (TopLevL < TopLevH)? SuppH_init: SuppL_init;
1057 pThis->
pDecs[ nEntries++ ] = pCur;
1059 bSuppSubract = pCur->
S;
1067 int i, nNonOverlap = 0;
1068 for ( i = 0; i < pPrev->
nDecs; i++ )
1072 pNonOverlap[ nNonOverlap++ ] = pPrev->
pDecs[i];
1074 assert( nNonOverlap > 0 );
1076 if ( nNonOverlap == 1 )
1080 pThis->
pDecs[ nEntries++ ] = pCur;
1082 bSuppSubract = pCur->
S;
1098 pThis->
pDecs[ nEntries++ ] = pDENew;
1100 bSuppSubract = pDENew->
S;
1105 if ( TopLevL < TopLevH )
1120 int nMarkedLeft = 0;
1125 int fPolarityCurH = 0;
1128 int fPolarityCurL = 0;
1140 pMarkedLeft[ nMarkedLeft ] = pTempL;
1141 pMarkedPols[ nMarkedLeft ] = fPolarity;
1147 while ( pCurH->Mark !=
s_Mark )
1156 while ( pCurL != pCurH )
1159 pCurL = pMarkedLeft[index];
1160 fPolarityCurL = pMarkedPols[index];
1165 if ( !pPrevL || !pPrevH || pPrevL->
Type != pPrevH->
Type || pPrevL->
Type ==
DSD_NODE_PRIME || fPolarityCurL != fPolarityCurH )
1167 pThis->
pDecs[ nEntries++ ] = pCurH;
1169 bSuppSubract = pCurH->S;
1174 Dsd_Node_t ** pCommon, * pLastDiffL = NULL, * pLastDiffH = NULL;
1177 if ( nCommon == 0 || nCommon == 1 )
1181 pThis->
pDecs[ nEntries++ ] = pCurL;
1183 bSuppSubract = pCurL->S;
1197 pThis->
pDecs[ nEntries++ ] = pDENew;
1200 bSuppSubract = pDENew->
S;
1219 assert( nEntries <= nEntriesMax );
1225 pThis->
nDecs = nEntries;
1237 if ( pThisR == pThis )
1244 pThisR->
S = bSuppNew;
1309 if ( pWhere->
nDecs == 1 )
1312 for( i = 0; i < pWhere->
nDecs; i++ )
1317 *fPolarity = (int)( pTemp != pWhere->
pDecs[i] );
1359 while ( iCurL < pL->nDecs && iCurH < pH->nDecs )
1370 TopVar = bSLcur->
index;
1372 TopVar = bSHcur->
index;
1374 if ( TopVar == bSLcur->
index && TopVar == bSHcur->
index )
1378 Common[nCommon++] = pL->
pDecs[iCurL];
1381 *pLastDiffL = pL->
pDecs[iCurL];
1382 *pLastDiffH = pH->
pDecs[iCurH];
1389 else if ( TopVar == bSLcur->
index )
1392 *pLastDiffL = pL->
pDecs[iCurL++];
1397 *pLastDiffH = pH->
pDecs[iCurH++];
1402 if ( iCurL < pL->nDecs )
1403 *pLastDiffL = pL->
pDecs[iCurL];
1405 if ( iCurH < pH->nDecs )
1406 *pLastDiffH = pH->
pDecs[iCurH];
1428 DdNode * bF, * bFadd, * bTemp;
1440 for ( i = 0; i < nCommon; i++ )
1444 bFadd = (pDE != pDER)?
Cudd_Not(pDER->
G): pDER->
G;
1486 DdNode * bSuppLarge, * bSuppSmall;
1491 if ( RetValue == 0 )
1494 if ( pH->
S == bSuppLarge )
1522 p->
pDecs[0] = First;
1523 for( i = 0; i < nListSize; i++ )
1524 p->
pDecs[i+1] = ppList[i];
1542 p->
pDecs[0] = First;
1543 for( i = 0, Counter = 1; i < nListSize; i++ )
1544 if ( i != iSkipped )
1545 p->
pDecs[Counter++] = ppList[i];
1582 for ( i = 0; i < dd->
size; i++ )
1583 bGVars[i] = dd->
vars[i];
1594 RetValue = (int)( bRes == pR->
G );
1604 RetValue = (int)( bRes == pR->
G );
static int s_nReusedBlocks
static void dsdKernelCopyListPlusOne(Dsd_Node_t *p, Dsd_Node_t *First, Dsd_Node_t **ppList, int nListSize)
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
int st__insert(st__table *table, const char *key, char *value)
void Cudd_Deref(DdNode *node)
#define MAXINPUTS
INCLUDES ///.
#define Cudd_Regular(node)
DdNode * Cudd_bddExistAbstract(DdManager *manager, DdNode *f, DdNode *cube)
static int dsdKernelFindCommonComponents(Dsd_Manager_t *pDsdMan, Dsd_Node_t *pL, Dsd_Node_t *pH, Dsd_Node_t ***pCommon, Dsd_Node_t **pLastDiffL, Dsd_Node_t **pLastDiffH)
static Dsd_Node_t * dsdKernelDecompose_rec(Dsd_Manager_t *pDsdMan, DdNode *F)
#define ABC_ALLOC(type, num)
DdNode * Cudd_bddIte(DdManager *dd, DdNode *f, DdNode *g, DdNode *h)
static abctime Abc_Clock()
static int dsdKernelCheckContainment(Dsd_Manager_t *pDsdMan, Dsd_Node_t *pL, Dsd_Node_t *pH, Dsd_Node_t **pLarge, Dsd_Node_t **pSmall)
int Dsd_CheckRootFunctionIdentity(DdManager *dd, DdNode *bF1, DdNode *bF2, DdNode *bC1, DdNode *bC2)
for(p=first;p->value< newval;p=p->next)
int Dsd_TreeCountPrimeNodesOne(Dsd_Node_t *pRoot)
static Dsd_Node_t * dsdKernelFindContainingComponent(Dsd_Manager_t *pDsdMan, Dsd_Node_t *pWhere, DdNode *Var, int *fPolarity)
OTHER FUNCTIONS ///.
DdNode * Cudd_bddVectorCompose(DdManager *dd, DdNode *f, DdNode **vector)
static int s_nPrimeBlocks
static int s_CacheEntries
static int s_Case4CallsSpecial
#define ABC_NAMESPACE_IMPL_END
static int s_Mark
STATIC VARIABLES ///.
ABC_NAMESPACE_IMPL_START void dsdKernelDecompose(Dsd_Manager_t *pDsdMan, DdNode **pbFuncs, int nFuncs)
FUNCTION DECLARATIONS ///.
void Dsd_Decompose(Dsd_Manager_t *pDsdMan, DdNode **pbFuncs, int nFuncs)
DECOMPOSITION FUNCTIONS ///.
DdNode * Cudd_bddAndAbstract(DdManager *manager, DdNode *f, DdNode *g, DdNode *cube)
STRUCTURE DEFINITIONS ///.
DdNode * Cudd_bddOr(DdManager *dd, DdNode *f, DdNode *g)
DdNode * Dsd_TreeGetPrimeFunctionOld(DdManager *dd, Dsd_Node_t *pNode, int fRemap)
#define Dsd_IsComplement(p)
MACRO DEFINITIONS ///.
#define ABC_NAMESPACE_IMPL_START
static void dsdKernelCopyListPlusOneMinusOne(Dsd_Node_t *p, Dsd_Node_t *First, Dsd_Node_t **ppList, int nListSize, int Skipped)
int st__lookup(st__table *table, const char *key, char **value)
Dsd_Node_t * Dsd_TreeNodeCreate(int Type, int nDecs, int BlockNum)
FUNCTION DEFINITIONS ///.
DdNode * Cudd_bddXor(DdManager *dd, DdNode *f, DdNode *g)
DdNode * Cudd_bddAnd(DdManager *dd, DdNode *f, DdNode *g)
static int dsdKernelVerifyDecomposition(Dsd_Manager_t *pDsdMan, Dsd_Node_t *pDE)
int Dsd_TreeCountNonTerminalNodesOne(Dsd_Node_t *pRoot)
static void dsdKernelComputeSumOfComponents(Dsd_Manager_t *pDsdMan, Dsd_Node_t **pCommon, int nCommon, DdNode **pCompF, DdNode **pCompS, int fExor)
Dsd_Node_t * Dsd_DecomposeOne(Dsd_Manager_t *pDsdMan, DdNode *bFunc)
int Cudd_SupportSize(DdManager *dd, DdNode *f)
int Cudd_SharingSize(DdNode **nodeArray, int n)
#define Dsd_NotCond(p, c)
void Dsd_TreeNodeGetInfoOne(Dsd_Node_t *pNode, int *DepthMax, int *GateSizeMax)
int Cudd_DagSize(DdNode *node)