36 static void Dsd_TreePrint_rec( FILE * pFile,
Dsd_Node_t * pNode,
int fCcmp,
char * pInputNames[],
char * pOutputName,
int nOffset,
int * pSigCounter,
int fShortNames );
110 for ( i = 0; i < pDsdMan->
nRoots; i++ )
140 for ( i = 0; i < pNode->
nDecs; i++ )
162 for ( i = 0; i < pDsdMan->
nRoots; i++ )
226 GateSize = pNode->
nDecs;
232 if ( pNode->
nDecs < 2 )
240 for ( i = 0; i < pNode->
nDecs; i++ )
263 if ( pNode->
nDecs < 2 )
268 Counter += pNode->
nDecs - 1;
270 Counter += 3*(pNode->
nDecs - 1);
275 for ( i = 0; i < pNode->
nDecs; i++ )
314 for ( i = 0; i < pDsdMan->
nRoots; i++ )
366 if ( pNode->
nDecs <= 1 )
370 for ( i = 0; i < pNode->
nDecs; i++ )
393 for ( i = 0; i < pDsdMan->
nRoots; i++ )
445 if ( pNode->
nDecs <= 1 )
449 for ( i = 0; i < pNode->
nDecs; i++ )
496 int fSkipThisNode, i;
503 if ( pNode->
nDecs <= 1 )
508 for ( i = 0; i < pNode->
nDecs; i++ )
515 printf(
"Node of type <%d> (OR=6,EXOR=8,RAND=1): ", pNode->
Type );
517 for ( i = 0; i < pNode->
nDecs; i++ )
523 pVars[ (*nVars)++ ] = pTemp->
S->
index;
528 printf(
"%d ", pTemp->
S->
index );
538 return fSkipThisNode;
558 int nNodes, nNodesAlloc;
564 for ( i = 0; i < pDsdMan->
nRoots; i++ )
567 assert( nNodesAlloc == nNodes );
588 int nNodes, nNodesAlloc;
594 assert( nNodesAlloc == nNodes );
620 if ( pNode->
nDecs <= 1 )
624 for ( i = 0; i < pNode->
nDecs; i++ )
627 ppNodes[ (*pnNodes)++ ] = pNode;
650 for ( i = 0; i < pDsdMan->
nRoots; i++ )
653 Dsd_TreePrint_rec( pFile, pNode, (pNode != pDsdMan->
pRoots[i]), pInputNames, pOutputNames[i], 0, &SigCounter, fShortNames );
658 assert( Output >= 0 && Output < pDsdMan->nRoots );
660 Dsd_TreePrint_rec( pFile, pNode, (pNode != pDsdMan->
pRoots[Output]), pInputNames, pOutputNames[Output], 0, &SigCounter, fShortNames );
675 void Dsd_TreePrint_rec( FILE * pFile,
Dsd_Node_t * pNode,
int fComp,
char * pInputNames[],
char * pOutputName,
int nOffset,
int * pSigCounter,
int fShortNames )
687 fprintf( pFile,
"%s = ", pOutputName );
689 fprintf( pFile,
"NOT(%s) = ", pOutputName );
693 fprintf( pFile,
" Constant 1.\n" );
698 fprintf( pFile,
"%d",
'a' + pNode->
S->
index );
700 fprintf( pFile,
"%s", pInputNames[pNode->
S->
index] );
701 fprintf( pFile,
"\n" );
706 fprintf( pFile,
"PRIME(" );
707 for ( i = 0; i < pNode->
nDecs; i++ )
710 fCompNew = (int)( pInput != pNode->
pDecs[i] );
712 fprintf( pFile,
"," );
714 fprintf( pFile,
" NOT(" );
716 fprintf( pFile,
" " );
721 fprintf( pFile,
"%d", pInput->
S->
index );
723 fprintf( pFile,
"%s", pInputNames[pInput->
S->
index] );
727 pInputNums[i] = (*pSigCounter)++;
728 fprintf( pFile,
"<%d>", pInputNums[i] );
731 fprintf( pFile,
")" );
733 fprintf( pFile,
" )\n" );
735 for ( i = 0; i < pNode->
nDecs; i++ )
739 sprintf( Buffer,
"<%d>", pInputNums[i] );
746 fprintf( pFile,
"OR(" );
747 for ( i = 0; i < pNode->
nDecs; i++ )
750 fCompNew = (int)( pInput != pNode->
pDecs[i] );
752 fprintf( pFile,
"," );
754 fprintf( pFile,
" NOT(" );
756 fprintf( pFile,
" " );
761 fprintf( pFile,
"%c",
'a' + pInput->
S->
index );
763 fprintf( pFile,
"%s", pInputNames[pInput->
S->
index] );
767 pInputNums[i] = (*pSigCounter)++;
768 fprintf( pFile,
"<%d>", pInputNums[i] );
771 fprintf( pFile,
")" );
773 fprintf( pFile,
" )\n" );
775 for ( i = 0; i < pNode->
nDecs; i++ )
779 sprintf( Buffer,
"<%d>", pInputNums[i] );
786 fprintf( pFile,
"EXOR(" );
787 for ( i = 0; i < pNode->
nDecs; i++ )
790 fCompNew = (int)( pInput != pNode->
pDecs[i] );
792 fprintf( pFile,
"," );
794 fprintf( pFile,
" NOT(" );
796 fprintf( pFile,
" " );
801 fprintf( pFile,
"%c",
'a' + pInput->
S->
index );
803 fprintf( pFile,
"%s", pInputNames[pInput->
S->
index] );
807 pInputNums[i] = (*pSigCounter)++;
808 fprintf( pFile,
"<%d>", pInputNums[i] );
811 fprintf( pFile,
")" );
813 fprintf( pFile,
" )\n" );
815 for ( i = 0; i < pNode->
nDecs; i++ )
819 sprintf( Buffer,
"<%d>", pInputNums[i] );
848 assert( Level >= 0 && Level < 6 );
858 fprintf( pFile,
"Const%d", !fComp );
865 fprintf( pFile,
"%s", fComp?
"!" :
"" );
866 fprintf( pFile,
"%s", pInputNames[pNode->
S->
index] );
870 fprintf( pFile,
" " );
871 if ( pNode->
nDecs <= 6 )
873 char pCanonPerm[6];
int uCanonPhase;
881 fprintf( pFile,
"%s", (fComp ^ ((uCanonPhase >> pNode->
nDecs) & 1)) ?
"!" :
"" );
883 fprintf( pFile,
"{" );
884 for ( i = 0; i < pNode->
nDecs; i++ )
889 fprintf( pFile,
"} " );
893 fprintf( pFile,
"|%d|", pNode->
nDecs );
894 fprintf( pFile,
"{" );
895 for ( i = 0; i < pNode->
nDecs; i++ )
897 fprintf( pFile,
"} " );
902 fprintf( pFile,
"%s", !fComp?
"!" :
"" );
903 fprintf( pFile,
"(" );
904 for ( i = 0; i < pNode->
nDecs; i++ )
906 fprintf( pFile,
")" );
910 fprintf( pFile,
"%s", fComp?
"!" :
"" );
911 fprintf( pFile,
"[" );
912 for ( i = 0; i < pNode->
nDecs; i++ )
914 fprintf( pFile,
"]" );
922 for ( i = 0; i < pDsdMan->
nRoots; i++ )
924 fprintf( pFile,
"%8s = ", pOutputNames[i] );
926 fprintf( pFile,
"\n" );
931 assert( Output >= 0 && Output < pDsdMan->nRoots );
932 fprintf( pFile,
"%8s = ", pOutputNames[Output] );
934 fprintf( pFile,
"\n" );
980 fprintf( pFile,
"%s = ", pOutputName );
982 fprintf( pFile,
"NOT(%s) = ", pOutputName );
986 fprintf( pFile,
" Constant 1.\n" );
990 fprintf( pFile,
" " );
991 fprintf( pFile,
"%c",
'a' + pNode->
S->
index );
992 fprintf( pFile,
"\n" );
997 fprintf( pFile,
"PRIME(" );
998 for ( i = 0; i < pNode->
nDecs; i++ )
1001 fCompNew = (int)( pInput != pNode->
pDecs[i] );
1004 fprintf( pFile,
"," );
1008 fprintf( pFile,
" %c",
'a' + pInput->
S->
index );
1012 pInputNums[i] = (*pSigCounter)++;
1013 fprintf( pFile,
" <%d>", pInputNums[i] );
1016 fprintf( pFile,
"\'" );
1018 fprintf( pFile,
" )\n" );
1029 for ( i = 0; i < pNode->
nDecs; i++ )
1030 if ( pInputNums[i] )
1033 sprintf( Buffer,
"<%d>", pInputNums[i] );
1040 fprintf( pFile,
"OR(" );
1041 for ( i = 0; i < pNode->
nDecs; i++ )
1044 fCompNew = (int)( pInput != pNode->
pDecs[i] );
1046 fprintf( pFile,
"," );
1050 fprintf( pFile,
" %c",
'a' + pInput->
S->
index );
1054 pInputNums[i] = (*pSigCounter)++;
1055 fprintf( pFile,
" <%d>", pInputNums[i] );
1058 fprintf( pFile,
"\'" );
1060 fprintf( pFile,
" )\n" );
1062 for ( i = 0; i < pNode->
nDecs; i++ )
1063 if ( pInputNums[i] )
1066 sprintf( Buffer,
"<%d>", pInputNums[i] );
1073 fprintf( pFile,
"EXOR(" );
1074 for ( i = 0; i < pNode->
nDecs; i++ )
1077 fCompNew = (int)( pInput != pNode->
pDecs[i] );
1080 fprintf( pFile,
"," );
1084 fprintf( pFile,
" %c",
'a' + pInput->
S->
index );
1088 pInputNums[i] = (*pSigCounter)++;
1089 fprintf( pFile,
" <%d>", pInputNums[i] );
1092 fprintf( pFile,
"\'" );
1094 fprintf( pFile,
" )\n" );
1096 for ( i = 0; i < pNode->
nDecs; i++ )
1097 if ( pInputNums[i] )
1100 sprintf( Buffer,
"<%d>", pInputNums[i] );
1122 DdNode * bCof0, * bCof1, * bCube0, * bCube1, * bNewFunc, * bTemp;
1137 bNewFunc = pNode->
G;
Cudd_Ref( bNewFunc );
1139 for ( i = 0; i < pNode->
nDecs; i++ )
1164 for ( i = 0; i < pNode->
nDecs; i++ )
void Dsd_TreeNodeGetInfoOne(Dsd_Node_t *pNode, int *DepthMax, int *GateSizeMax)
void Dsd_TreePrint(FILE *pFile, Dsd_Manager_t *pDsdMan, char *pInputNames[], char *pOutputNames[], int fShortNames, int Output)
void Dsd_TreePrint2(FILE *pFile, Dsd_Manager_t *pDsdMan, char *pInputNames[], char *pOutputNames[], int Output)
static int s_DepthMax
STATIC VARIABLES ///.
static void Dsd_TreePrint_rec(FILE *pFile, Dsd_Node_t *pNode, int fCcmp, char *pInputNames[], char *pOutputName, int nOffset, int *pSigCounter, int fShortNames)
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
static int Dsd_TreeCountNonTerminalNodes_rec(Dsd_Node_t *pNode)
void Cudd_Deref(DdNode *node)
int Dsd_TreeGetAigCost(Dsd_Node_t *pNode)
#define MAXINPUTS
INCLUDES ///.
static void Abc_TtPrintHexRev(FILE *pFile, word *pTruth, int nVars)
void Dsd_TreeUnmark(Dsd_Manager_t *pDsdMan)
#define ABC_ALLOC(type, num)
DdNode * Cudd_bddIte(DdManager *dd, DdNode *f, DdNode *g, DdNode *h)
int Dsd_TreeCountPrimeNodes(Dsd_Manager_t *pDsdMan)
static void Dsd_TreeCollectNodesDfs_rec(Dsd_Node_t *pNode, Dsd_Node_t *ppNodes[], int *pnNodes)
Dsd_Node_t * Dsd_TreeNodeCreate(int Type, int nDecs, int BlockNum)
FUNCTION DEFINITIONS ///.
#define Cudd_IsComplement(node)
static void Dsd_NodePrint_rec(FILE *pFile, Dsd_Node_t *pNode, int fComp, char *pOutputName, int nOffset, int *pSigCounter)
DdNode * Cudd_Cofactor(DdManager *dd, DdNode *f, DdNode *g)
static int Dsd_TreeCountPrimeNodes_rec(Dsd_Node_t *pNode)
DdNode * Cudd_bddPermute(DdManager *manager, DdNode *node, int *permut)
Dsd_Node_t ** Dsd_TreeCollectNodesDfsOne(Dsd_Manager_t *pDsdMan, Dsd_Node_t *pNode, int *pnNodes)
DdNode * Dsd_TreeGetPrimeFunctionOld(DdManager *dd, Dsd_Node_t *pNode, int fRemap)
static int Dsd_TreeCollectDecomposableVars_rec(DdManager *dd, Dsd_Node_t *pNode, int *pVars, int *nVars)
unsigned __int64 word
DECLARATIONS ///.
#define ABC_NAMESPACE_IMPL_END
STRUCTURE DEFINITIONS ///.
int Dsd_TreeCountNonTerminalNodes(Dsd_Manager_t *pDsdMan)
#define Dsd_IsComplement(p)
MACRO DEFINITIONS ///.
#define ABC_NAMESPACE_IMPL_START
DdNode * Dsd_TreeGetPrimeFunction(DdManager *dd, Dsd_Node_t *pNode)
FUNCTION DEFINITIONS ///.
int Dsd_TreeCountPrimeNodesOne(Dsd_Node_t *pRoot)
static ABC_NAMESPACE_IMPL_START void Dsd_TreeUnmark_rec(Dsd_Node_t *pNode)
FUNCTION DECLARATIONS ///.
int Dsd_TreeCountNonTerminalNodesOne(Dsd_Node_t *pRoot)
Dsd_Node_t ** Dsd_TreeCollectNodesDfs(Dsd_Manager_t *pDsdMan, int *pnNodes)
unsigned Abc_TtCanonicize(word *pTruth, int nVars, char *pCanonPerm)
FUNCTION DECLARATIONS ///.
int Dsd_TreeGetAigCost_rec(Dsd_Node_t *pNode)
enum Dsd_Type_t_ Dsd_Type_t
void Dsd_TreeNodeGetInfo(Dsd_Manager_t *pDsdMan, int *DepthMax, int *GateSizeMax)
void Dsd_TreeNodeDelete(DdManager *dd, Dsd_Node_t *pNode)
int Dsd_TreeCollectDecomposableVars(Dsd_Manager_t *pDsdMan, int *pVars)
word Dsd_TreeFunc2Truth_rec(DdManager *dd, DdNode *bFunc)
static void Dsd_TreeGetInfo_rec(Dsd_Node_t *pNode, int RankCur)
void Dsd_NodePrint(FILE *pFile, Dsd_Node_t *pNode)
void Dsd_TreePrint2_rec(FILE *pFile, DdManager *dd, Dsd_Node_t *pNode, int fComp, char *pInputNames[])