ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
dsdTree.c File Reference
#include "dsdInt.h"
#include "misc/util/utilTruth.h"
#include "opt/dau/dau.h"
Include dependency graph for dsdTree.c:

Go to the source code of this file.

Functions

Dsd_Node_tDsd_TreeNodeCreate (int Type, int nDecs, int BlockNum)
 FUNCTION DEFINITIONS ///.
 
void Dsd_TreeNodeDelete (DdManager *dd, Dsd_Node_t *pNode)
 
void Dsd_TreeUnmark (Dsd_Manager_t *pDsdMan)
 
void Dsd_TreeNodeGetInfo (Dsd_Manager_t *pDsdMan, int *DepthMax, int *GateSizeMax)
 
void Dsd_TreeNodeGetInfoOne (Dsd_Node_t *pNode, int *DepthMax, int *GateSizeMax)
 
int Dsd_TreeGetAigCost_rec (Dsd_Node_t *pNode)
 
int Dsd_TreeGetAigCost (Dsd_Node_t *pNode)
 
int Dsd_TreeCountNonTerminalNodes (Dsd_Manager_t *pDsdMan)
 
int Dsd_TreeCountNonTerminalNodesOne (Dsd_Node_t *pRoot)
 
int Dsd_TreeCountPrimeNodes (Dsd_Manager_t *pDsdMan)
 
int Dsd_TreeCountPrimeNodesOne (Dsd_Node_t *pRoot)
 
int Dsd_TreeCollectDecomposableVars (Dsd_Manager_t *pDsdMan, int *pVars)
 
Dsd_Node_t ** Dsd_TreeCollectNodesDfs (Dsd_Manager_t *pDsdMan, int *pnNodes)
 
Dsd_Node_t ** Dsd_TreeCollectNodesDfsOne (Dsd_Manager_t *pDsdMan, Dsd_Node_t *pNode, int *pnNodes)
 
int Dsd_TreeNonDsdMax_rec (Dsd_Node_t *pNode)
 
int Dsd_TreeNonDsdMax (Dsd_Manager_t *pDsdMan, int Output)
 
int Dsd_TreeSuppSize_rec (Dsd_Node_t *pNode)
 
int Dsd_TreeSuppSize (Dsd_Manager_t *pDsdMan, int Output)
 
void Dsd_TreePrint3_rec (Vec_Str_t *p, Dsd_Node_t *pNode)
 
void Dsd_TreePrint3 (void *pStr, Dsd_Manager_t *pDsdMan, int Output)
 
void Dsd_TreePrint4_rec (Vec_Str_t *p, Dsd_Node_t *pNode)
 
void Dsd_TreePrint4 (void *pStr, Dsd_Manager_t *pDsdMan, int Output)
 
void Dsd_TreePrint (FILE *pFile, Dsd_Manager_t *pDsdMan, char *pInputNames[], char *pOutputNames[], int fShortNames, int Output, int OffSet)
 
word Dsd_TreeFunc2Truth_rec (DdManager *dd, DdNode *bFunc)
 
void Dsd_TreePrint2_rec (FILE *pFile, DdManager *dd, Dsd_Node_t *pNode, int fComp, char *pInputNames[])
 
void Dsd_TreePrint2 (FILE *pFile, Dsd_Manager_t *pDsdMan, char *pInputNames[], char *pOutputNames[], int Output)
 
void Dsd_NodePrint (FILE *pFile, Dsd_Node_t *pNode)
 
DdNode * Dsd_TreeGetPrimeFunctionOld (DdManager *dd, Dsd_Node_t *pNode, int fRemap)
 

Function Documentation

◆ Dsd_NodePrint()

void Dsd_NodePrint ( FILE * pFile,
Dsd_Node_t * pNode )

Function*************************************************************

Synopsis [Prints the decompostion tree into file.]

Description []

SideEffects []

SeeAlso []

Definition at line 1138 of file dsdTree.c.

1139{
1140 Dsd_Node_t * pNodeR;
1141 int SigCounter = 1;
1142 pNodeR = Dsd_Regular(pNode);
1143 Dsd_NodePrint_rec( pFile, pNodeR, pNodeR != pNode, "F", 0, &SigCounter );
1144}
struct Dsd_Node_t_ Dsd_Node_t
Definition dsd.h:60
#define Dsd_Regular(p)
Definition dsd.h:69

◆ Dsd_TreeCollectDecomposableVars()

int Dsd_TreeCollectDecomposableVars ( Dsd_Manager_t * pDsdMan,
int * pVars )

Function*************************************************************

Synopsis [Collects the decomposable vars on the PI side.]

Description []

SideEffects []

SeeAlso []

Definition at line 470 of file dsdTree.c.

471{
472 int nVars;
473
474 // set the vars collected to 0
475 nVars = 0;
476 Dsd_TreeCollectDecomposableVars_rec( pDsdMan->dd, Dsd_Regular(pDsdMan->pRoots[0]), pVars, &nVars );
477 // return the number of collected vars
478 return nVars;
479}
DdManager * dd
Definition dsdInt.h:42
Dsd_Node_t ** pRoots
Definition dsdInt.h:48

◆ Dsd_TreeCollectNodesDfs()

Dsd_Node_t ** Dsd_TreeCollectNodesDfs ( Dsd_Manager_t * pDsdMan,
int * pnNodes )

Function*************************************************************

Synopsis [Creates the DFS ordered array of DSD nodes in the tree.]

Description [The collected nodes do not include the terminal nodes and the constant 1 node. The array of nodes is returned. The number of entries in the array is returned in the variale pnNodes.]

SideEffects []

SeeAlso []

Definition at line 555 of file dsdTree.c.

556{
557 Dsd_Node_t ** ppNodes;
558 int nNodes, nNodesAlloc;
559 int i;
560
561 nNodesAlloc = Dsd_TreeCountNonTerminalNodes(pDsdMan);
562 nNodes = 0;
563 ppNodes = ABC_ALLOC( Dsd_Node_t *, nNodesAlloc );
564 for ( i = 0; i < pDsdMan->nRoots; i++ )
565 Dsd_TreeCollectNodesDfs_rec( Dsd_Regular(pDsdMan->pRoots[i]), ppNodes, &nNodes );
566 Dsd_TreeUnmark( pDsdMan );
567 assert( nNodesAlloc == nNodes );
568 *pnNodes = nNodes;
569 return ppNodes;
570}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
int Dsd_TreeCountNonTerminalNodes(Dsd_Manager_t *pDsdMan)
Definition dsdTree.c:310
void Dsd_TreeUnmark(Dsd_Manager_t *pDsdMan)
Definition dsdTree.c:107
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:

◆ Dsd_TreeCollectNodesDfsOne()

Dsd_Node_t ** Dsd_TreeCollectNodesDfsOne ( Dsd_Manager_t * pDsdMan,
Dsd_Node_t * pNode,
int * pnNodes )

Function*************************************************************

Synopsis [Creates the DFS ordered array of DSD nodes in the tree.]

Description [The collected nodes do not include the terminal nodes and the constant 1 node. The array of nodes is returned. The number of entries in the array is returned in the variale pnNodes.]

SideEffects []

SeeAlso []

Definition at line 585 of file dsdTree.c.

586{
587 Dsd_Node_t ** ppNodes;
588 int nNodes, nNodesAlloc;
589 nNodesAlloc = Dsd_TreeCountNonTerminalNodesOne(pNode);
590 nNodes = 0;
591 ppNodes = ABC_ALLOC( Dsd_Node_t *, nNodesAlloc );
592 Dsd_TreeCollectNodesDfs_rec( Dsd_Regular(pNode), ppNodes, &nNodes );
593 Dsd_TreeUnmark_rec(Dsd_Regular(pNode));
594 assert( nNodesAlloc == nNodes );
595 *pnNodes = nNodes;
596 return ppNodes;
597}
int Dsd_TreeCountNonTerminalNodesOne(Dsd_Node_t *pRoot)
Definition dsdTree.c:331
Here is the call graph for this function:

◆ Dsd_TreeCountNonTerminalNodes()

int Dsd_TreeCountNonTerminalNodes ( Dsd_Manager_t * pDsdMan)

Function*************************************************************

Synopsis [Counts non-terminal nodes of the DSD tree.]

Description [Nonterminal nodes include all the nodes with the support more than 1. These are OR, EXOR, and PRIME nodes. They do not include the elementary variable nodes and the constant 1 node.]

SideEffects []

SeeAlso []

Definition at line 310 of file dsdTree.c.

311{
312 int Counter, i;
313 Counter = 0;
314 for ( i = 0; i < pDsdMan->nRoots; i++ )
315 Counter += Dsd_TreeCountNonTerminalNodes_rec( Dsd_Regular( pDsdMan->pRoots[i] ) );
316 Dsd_TreeUnmark( pDsdMan );
317 return Counter;
318}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Dsd_TreeCountNonTerminalNodesOne()

int Dsd_TreeCountNonTerminalNodesOne ( Dsd_Node_t * pRoot)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 331 of file dsdTree.c.

332{
333 int Counter = 0;
334
335 // go through the list of successors and call recursively
336 Counter = Dsd_TreeCountNonTerminalNodes_rec( Dsd_Regular(pRoot) );
337
338 Dsd_TreeUnmark_rec( Dsd_Regular(pRoot) );
339 return Counter;
340}
Here is the caller graph for this function:

◆ Dsd_TreeCountPrimeNodes()

int Dsd_TreeCountPrimeNodes ( Dsd_Manager_t * pDsdMan)

Function*************************************************************

Synopsis [Counts prime nodes of the DSD tree.]

Description [Prime nodes are nodes with the support more than 2, that is not an OR or EXOR gate.]

SideEffects []

SeeAlso []

Definition at line 389 of file dsdTree.c.

390{
391 int Counter, i;
392 Counter = 0;
393 for ( i = 0; i < pDsdMan->nRoots; i++ )
394 Counter += Dsd_TreeCountPrimeNodes_rec( Dsd_Regular( pDsdMan->pRoots[i] ) );
395 Dsd_TreeUnmark( pDsdMan );
396 return Counter;
397}
Here is the call graph for this function:

◆ Dsd_TreeCountPrimeNodesOne()

int Dsd_TreeCountPrimeNodesOne ( Dsd_Node_t * pRoot)

Function*************************************************************

Synopsis [Counts prime nodes for one root.]

Description []

SideEffects []

SeeAlso []

Definition at line 410 of file dsdTree.c.

411{
412 int Counter = 0;
413
414 // go through the list of successors and call recursively
415 Counter = Dsd_TreeCountPrimeNodes_rec( Dsd_Regular(pRoot) );
416
417 Dsd_TreeUnmark_rec( Dsd_Regular(pRoot) );
418 return Counter;
419}
Here is the caller graph for this function:

◆ Dsd_TreeFunc2Truth_rec()

word Dsd_TreeFunc2Truth_rec ( DdManager * dd,
DdNode * bFunc )

Function*************************************************************

Synopsis [Prints the decompostion tree into file.]

Description []

SideEffects []

SeeAlso []

Definition at line 1026 of file dsdTree.c.

1027{
1028 word Cof0, Cof1;
1029 int Level;
1030 if ( bFunc == b0 )
1031 return 0;
1032 if ( bFunc == b1 )
1033 return ~(word)0;
1034 if ( Cudd_IsComplement(bFunc) )
1035 return ~Dsd_TreeFunc2Truth_rec( dd, Cudd_Not(bFunc) );
1036 Level = dd->perm[bFunc->index];
1037 assert( Level >= 0 && Level < 6 );
1038 Cof0 = Dsd_TreeFunc2Truth_rec( dd, cuddE(bFunc) );
1039 Cof1 = Dsd_TreeFunc2Truth_rec( dd, cuddT(bFunc) );
1040 return (s_Truths6[Level] & Cof1) | (~s_Truths6[Level] & Cof0);
1041}
#define b0
Definition bbrImage.c:96
#define b1
Definition bbrImage.c:97
word Dsd_TreeFunc2Truth_rec(DdManager *dd, DdNode *bFunc)
Definition dsdTree.c:1026
unsigned __int64 word
DECLARATIONS ///.
Definition kitPerm.c:36
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Dsd_TreeGetAigCost()

int Dsd_TreeGetAigCost ( Dsd_Node_t * pNode)

Function*************************************************************

Synopsis [Counts AIG nodes needed to implement this node.]

Description [Assumes that the only primes of the DSD tree are MUXes.]

SideEffects []

SeeAlso []

Definition at line 291 of file dsdTree.c.

292{
293 return Dsd_TreeGetAigCost_rec( Dsd_Regular(pNode) );
294}
int Dsd_TreeGetAigCost_rec(Dsd_Node_t *pNode)
Definition dsdTree.c:255
Here is the call graph for this function:

◆ Dsd_TreeGetAigCost_rec()

int Dsd_TreeGetAigCost_rec ( Dsd_Node_t * pNode)

Function*************************************************************

Synopsis [Counts AIG nodes needed to implement this node.]

Description []

SideEffects []

SeeAlso []

Definition at line 255 of file dsdTree.c.

256{
257 int i, Counter = 0;
258
259 assert( pNode );
260 assert( !Dsd_IsComplement( pNode ) );
261 assert( pNode->nVisits >= 0 );
262
263 if ( pNode->nDecs < 2 )
264 return 0;
265
266 // we don't want the two-input gates to count for non-decomposable blocks
267 if ( pNode->Type == DSD_NODE_OR )
268 Counter += pNode->nDecs - 1;
269 else if ( pNode->Type == DSD_NODE_EXOR )
270 Counter += 3*(pNode->nDecs - 1);
271 else if ( pNode->Type == DSD_NODE_PRIME && pNode->nDecs == 3 )
272 Counter += 3;
273
274 // call recursively
275 for ( i = 0; i < pNode->nDecs; i++ )
276 Counter += Dsd_TreeGetAigCost_rec( Dsd_Regular(pNode->pDecs[i]) );
277 return Counter;
278}
@ DSD_NODE_EXOR
Definition dsd.h:51
@ DSD_NODE_OR
Definition dsd.h:50
@ DSD_NODE_PRIME
Definition dsd.h:52
#define Dsd_IsComplement(p)
MACRO DEFINITIONS ///.
Definition dsd.h:68
Dsd_Type_t Type
Definition dsdInt.h:56
short nVisits
Definition dsdInt.h:62
Dsd_Node_t ** pDecs
Definition dsdInt.h:59
short nDecs
Definition dsdInt.h:61
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Dsd_TreeGetPrimeFunctionOld()

DdNode * Dsd_TreeGetPrimeFunctionOld ( DdManager * dd,
Dsd_Node_t * pNode,
int fRemap )

Function*************************************************************

Synopsis [Retuns the function of one node of the decomposition tree.]

Description [This is the old procedure. It is now superceded by the procedure Dsd_TreeGetPrimeFunction() found in "dsdLocal.c".]

SideEffects []

SeeAlso []

Definition at line 1309 of file dsdTree.c.

1310{
1311 DdNode * bCof0, * bCof1, * bCube0, * bCube1, * bNewFunc, * bTemp;
1312 int i;
1313 static int Permute[MAXINPUTS];
1314
1315 assert( pNode );
1316 assert( !Dsd_IsComplement( pNode ) );
1317 assert( pNode->Type == DSD_NODE_PRIME );
1318
1319 // transform the function of this block to depend on inputs
1320 // corresponding to the formal inputs
1321
1322 // first, substitute those inputs that have some blocks associated with them
1323 // second, remap the inputs to the top of the manager (then, it is easy to output them)
1324
1325 // start the function
1326 bNewFunc = pNode->G; Cudd_Ref( bNewFunc );
1327 // go over all primary inputs
1328 for ( i = 0; i < pNode->nDecs; i++ )
1329 if ( pNode->pDecs[i]->Type != DSD_NODE_BUF ) // remap only if it is not the buffer
1330 {
1331 bCube0 = Extra_bddFindOneCube( dd, Cudd_Not(pNode->pDecs[i]->G) ); Cudd_Ref( bCube0 );
1332 bCof0 = Cudd_Cofactor( dd, bNewFunc, bCube0 ); Cudd_Ref( bCof0 );
1333 Cudd_RecursiveDeref( dd, bCube0 );
1334
1335 bCube1 = Extra_bddFindOneCube( dd, pNode->pDecs[i]->G ); Cudd_Ref( bCube1 );
1336 bCof1 = Cudd_Cofactor( dd, bNewFunc, bCube1 ); Cudd_Ref( bCof1 );
1337 Cudd_RecursiveDeref( dd, bCube1 );
1338
1339 Cudd_RecursiveDeref( dd, bNewFunc );
1340
1341 // use the variable in the i-th level of the manager
1342// bNewFunc = Cudd_bddIte( dd, dd->vars[dd->invperm[i]],bCof1,bCof0 ); Cudd_Ref( bNewFunc );
1343 // use the first variale in the support of the component
1344 bNewFunc = Cudd_bddIte( dd, dd->vars[pNode->pDecs[i]->S->index],bCof1,bCof0 ); Cudd_Ref( bNewFunc );
1345 Cudd_RecursiveDeref( dd, bCof0 );
1346 Cudd_RecursiveDeref( dd, bCof1 );
1347 }
1348
1349 if ( fRemap )
1350 {
1351 // remap the function to the top of the manager
1352 // remap the function to the first variables of the manager
1353 for ( i = 0; i < pNode->nDecs; i++ )
1354 // Permute[ pNode->pDecs[i]->S->index ] = dd->invperm[i];
1355 Permute[ pNode->pDecs[i]->S->index ] = i;
1356
1357 bNewFunc = Cudd_bddPermute( dd, bTemp = bNewFunc, Permute ); Cudd_Ref( bNewFunc );
1358 Cudd_RecursiveDeref( dd, bTemp );
1359 }
1360
1361 Cudd_Deref( bNewFunc );
1362 return bNewFunc;
1363}
#define MAXINPUTS
INCLUDES ///.
Definition cas.h:38
@ DSD_NODE_BUF
Definition dsd.h:49
DdNode * Extra_bddFindOneCube(DdManager *dd, DdNode *bF)
DdNode * G
Definition dsdInt.h:57
DdNode * S
Definition dsdInt.h:58
Here is the call graph for this function:

◆ Dsd_TreeNodeCreate()

Dsd_Node_t * Dsd_TreeNodeCreate ( int Type,
int nDecs,
int BlockNum )

FUNCTION DEFINITIONS ///.

Function*************************************************************

Synopsis [Create the DSD node.]

Description []

SideEffects []

SeeAlso []

Definition at line 61 of file dsdTree.c.

62{
63 // allocate memory for this node
64 Dsd_Node_t * p = (Dsd_Node_t *) ABC_ALLOC( char, sizeof(Dsd_Node_t) );
65 memset( p, 0, sizeof(Dsd_Node_t) );
66 p->Type = (Dsd_Type_t)Type; // the type of this block
67 p->nDecs = nDecs; // the number of decompositions
68 if ( p->nDecs )
69 {
70 p->pDecs = (Dsd_Node_t **) ABC_ALLOC( char, p->nDecs * sizeof(Dsd_Node_t *) );
71 p->pDecs[0] = NULL;
72 }
73 return p;
74}
enum Dsd_Type_t_ Dsd_Type_t
Definition dsd.h:61
Cube * p
Definition exorList.c:222
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Dsd_TreeNodeDelete()

void Dsd_TreeNodeDelete ( DdManager * dd,
Dsd_Node_t * pNode )

Function*************************************************************

Synopsis [Frees the DSD node.]

Description []

SideEffects []

SeeAlso []

Definition at line 87 of file dsdTree.c.

88{
89 if ( pNode->G ) Cudd_RecursiveDeref( dd, pNode->G );
90 if ( pNode->S ) Cudd_RecursiveDeref( dd, pNode->S );
91 ABC_FREE( pNode->pDecs );
92 ABC_FREE( pNode );
93}
#define ABC_FREE(obj)
Definition abc_global.h:267
Here is the caller graph for this function:

◆ Dsd_TreeNodeGetInfo()

void Dsd_TreeNodeGetInfo ( Dsd_Manager_t * pDsdMan,
int * DepthMax,
int * GateSizeMax )

Function*************************************************************

Synopsis [Getting information about the node.]

Description [This function computes the max depth and the max gate size of the tree rooted at the node.]

SideEffects []

SeeAlso []

Definition at line 156 of file dsdTree.c.

157{
158 int i;
159 s_DepthMax = 0;
160 s_GateSizeMax = 0;
161
162 for ( i = 0; i < pDsdMan->nRoots; i++ )
163 Dsd_TreeGetInfo_rec( Dsd_Regular( pDsdMan->pRoots[i] ), 0 );
164
165 if ( DepthMax )
166 *DepthMax = s_DepthMax;
167 if ( GateSizeMax )
168 *GateSizeMax = s_GateSizeMax;
169}

◆ Dsd_TreeNodeGetInfoOne()

void Dsd_TreeNodeGetInfoOne ( Dsd_Node_t * pNode,
int * DepthMax,
int * GateSizeMax )

Function*************************************************************

Synopsis [Getting information about the node.]

Description [This function computes the max depth and the max gate size of the tree rooted at the node.]

SideEffects []

SeeAlso []

Definition at line 183 of file dsdTree.c.

184{
185 s_DepthMax = 0;
186 s_GateSizeMax = 0;
187
188 Dsd_TreeGetInfo_rec( Dsd_Regular(pNode), 0 );
189
190 if ( DepthMax )
191 *DepthMax = s_DepthMax;
192 if ( GateSizeMax )
193 *GateSizeMax = s_GateSizeMax;
194}
Here is the caller graph for this function:

◆ Dsd_TreeNonDsdMax()

int Dsd_TreeNonDsdMax ( Dsd_Manager_t * pDsdMan,
int Output )

Definition at line 655 of file dsdTree.c.

656{
657 if ( Output == -1 )
658 {
659 int i, Res = 0;
660 for ( i = 0; i < pDsdMan->nRoots; i++ )
661 Res = Abc_MaxInt( Res, Dsd_TreeNonDsdMax_rec( Dsd_Regular( pDsdMan->pRoots[i] ) ) );
662 return Res;
663 }
664 else
665 {
666 assert( Output >= 0 && Output < pDsdMan->nRoots );
667 return Dsd_TreeNonDsdMax_rec( Dsd_Regular( pDsdMan->pRoots[Output] ) );
668 }
669}
int Dsd_TreeNonDsdMax_rec(Dsd_Node_t *pNode)
Definition dsdTree.c:641
Here is the call graph for this function:

◆ Dsd_TreeNonDsdMax_rec()

int Dsd_TreeNonDsdMax_rec ( Dsd_Node_t * pNode)

Function*************************************************************

Synopsis [Returns the size of the largest non-DSD block.]

Description []

SideEffects []

SeeAlso []

Definition at line 641 of file dsdTree.c.

642{
643 if ( pNode->Type == DSD_NODE_CONST1 )
644 return 0;
645 if ( pNode->Type == DSD_NODE_BUF )
646 return 0;
647 int MaxBlock = pNode->Type == DSD_NODE_PRIME ? pNode->nDecs : 0;
648 for ( int i = 0; i < pNode->nDecs; i++ )
649 {
650 int MaxThis = Dsd_TreeNonDsdMax_rec( Dsd_Regular( pNode->pDecs[i] ) );
651 MaxBlock = Abc_MaxInt( MaxBlock, MaxThis );
652 }
653 return MaxBlock;
654}
@ DSD_NODE_CONST1
Definition dsd.h:48
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Dsd_TreePrint()

void Dsd_TreePrint ( FILE * pFile,
Dsd_Manager_t * pDsdMan,
char * pInputNames[],
char * pOutputNames[],
int fShortNames,
int Output,
int OffSet )

Function*************************************************************

Synopsis [Prints the decompostion tree into file.]

Description []

SideEffects []

SeeAlso []

Definition at line 830 of file dsdTree.c.

831{
832 Dsd_Node_t * pNode;
833 int SigCounter;
834 int i;
835 SigCounter = 1;
836
837 if ( Output == -1 )
838 {
839 for ( i = 0; i < pDsdMan->nRoots; i++ )
840 {
841 pNode = Dsd_Regular( pDsdMan->pRoots[i] );
842 Dsd_TreePrint_rec( pFile, pNode, (pNode != pDsdMan->pRoots[i]), pInputNames, pOutputNames[i], OffSet, &SigCounter, fShortNames );
843 }
844 }
845 else
846 {
847 assert( Output >= 0 && Output < pDsdMan->nRoots );
848 pNode = Dsd_Regular( pDsdMan->pRoots[Output] );
849 Dsd_TreePrint_rec( pFile, pNode, (pNode != pDsdMan->pRoots[Output]), pInputNames, pOutputNames[Output], OffSet, &SigCounter, fShortNames );
850 }
851}
Here is the caller graph for this function:

◆ Dsd_TreePrint2()

void Dsd_TreePrint2 ( FILE * pFile,
Dsd_Manager_t * pDsdMan,
char * pInputNames[],
char * pOutputNames[],
int Output )

Definition at line 1106 of file dsdTree.c.

1107{
1108 if ( Output == -1 )
1109 {
1110 int i;
1111 for ( i = 0; i < pDsdMan->nRoots; i++ )
1112 {
1113 fprintf( pFile, "%8s = ", pOutputNames[i] );
1114 Dsd_TreePrint2_rec( pFile, pDsdMan->dd, Dsd_Regular(pDsdMan->pRoots[i]), Dsd_IsComplement(pDsdMan->pRoots[i]), pInputNames );
1115 fprintf( pFile, "\n" );
1116 }
1117 }
1118 else
1119 {
1120 assert( Output >= 0 && Output < pDsdMan->nRoots );
1121 fprintf( pFile, "%8s = ", pOutputNames[Output] );
1122 Dsd_TreePrint2_rec( pFile, pDsdMan->dd, Dsd_Regular(pDsdMan->pRoots[Output]), Dsd_IsComplement(pDsdMan->pRoots[Output]), pInputNames );
1123 fprintf( pFile, "\n" );
1124 }
1125}
void Dsd_TreePrint2_rec(FILE *pFile, DdManager *dd, Dsd_Node_t *pNode, int fComp, char *pInputNames[])
Definition dsdTree.c:1042
Here is the call graph for this function:

◆ Dsd_TreePrint2_rec()

void Dsd_TreePrint2_rec ( FILE * pFile,
DdManager * dd,
Dsd_Node_t * pNode,
int fComp,
char * pInputNames[] )

Definition at line 1042 of file dsdTree.c.

1043{
1044 int i;
1045 if ( pNode->Type == DSD_NODE_CONST1 )
1046 {
1047 fprintf( pFile, "Const%d", !fComp );
1048 return;
1049 }
1050 assert( pNode->Type == DSD_NODE_BUF || pNode->Type == DSD_NODE_PRIME || pNode->Type == DSD_NODE_OR || pNode->Type == DSD_NODE_EXOR );
1051// fprintf( pFile, "%s", (fComp ^ (pNode->Type == DSD_NODE_OR))? "!" : "" );
1052 if ( pNode->Type == DSD_NODE_BUF )
1053 {
1054 fprintf( pFile, "%s", fComp? "!" : "" );
1055 fprintf( pFile, "%s", pInputNames[pNode->S->index] );
1056 }
1057 else if ( pNode->Type == DSD_NODE_PRIME )
1058 {
1059 fprintf( pFile, " " );
1060 if ( pNode->nDecs <= 6 )
1061 {
1062 char pCanonPerm[6]; int uCanonPhase;
1063 // compute truth table
1064 DdNode * bFunc = Dsd_TreeGetPrimeFunction( dd, pNode );
1065 word uTruth = Dsd_TreeFunc2Truth_rec( dd, bFunc );
1066 Cudd_Ref( bFunc );
1067 Cudd_RecursiveDeref( dd, bFunc );
1068 // canonicize truth table
1069 uCanonPhase = Abc_TtCanonicize( &uTruth, pNode->nDecs, pCanonPerm );
1070 fprintf( pFile, "%s", (fComp ^ ((uCanonPhase >> pNode->nDecs) & 1)) ? "!" : "" );
1071 Abc_TtPrintHexRev( pFile, &uTruth, pNode->nDecs );
1072 fprintf( pFile, "{" );
1073 for ( i = 0; i < pNode->nDecs; i++ )
1074 {
1075 Dsd_Node_t * pInput = pNode->pDecs[(int)pCanonPerm[i]];
1076 Dsd_TreePrint2_rec( pFile, dd, Dsd_Regular(pInput), Dsd_IsComplement(pInput) ^ ((uCanonPhase>>i)&1), pInputNames );
1077 }
1078 fprintf( pFile, "} " );
1079 }
1080 else
1081 {
1082 fprintf( pFile, "|%d|", pNode->nDecs );
1083 fprintf( pFile, "{" );
1084 for ( i = 0; i < pNode->nDecs; i++ )
1085 Dsd_TreePrint2_rec( pFile, dd, Dsd_Regular(pNode->pDecs[i]), Dsd_IsComplement(pNode->pDecs[i]), pInputNames );
1086 fprintf( pFile, "} " );
1087 }
1088 }
1089 else if ( pNode->Type == DSD_NODE_OR )
1090 {
1091 fprintf( pFile, "%s", !fComp? "!" : "" );
1092 fprintf( pFile, "(" );
1093 for ( i = 0; i < pNode->nDecs; i++ )
1094 Dsd_TreePrint2_rec( pFile, dd, Dsd_Regular(pNode->pDecs[i]), !Dsd_IsComplement(pNode->pDecs[i]), pInputNames );
1095 fprintf( pFile, ")" );
1096 }
1097 else if ( pNode->Type == DSD_NODE_EXOR )
1098 {
1099 fprintf( pFile, "%s", fComp? "!" : "" );
1100 fprintf( pFile, "[" );
1101 for ( i = 0; i < pNode->nDecs; i++ )
1102 Dsd_TreePrint2_rec( pFile, dd, Dsd_Regular(pNode->pDecs[i]), Dsd_IsComplement(pNode->pDecs[i]), pInputNames );
1103 fprintf( pFile, "]" );
1104 }
1105}
unsigned Abc_TtCanonicize(word *pTruth, int nVars, char *pCanonPerm)
FUNCTION DECLARATIONS ///.
Definition dauCanon.c:1036
DdNode * Dsd_TreeGetPrimeFunction(DdManager *dd, Dsd_Node_t *pNode)
FUNCTION DEFINITIONS ///.
Definition dsdLocal.c:54
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Dsd_TreePrint3()

void Dsd_TreePrint3 ( void * pStr,
Dsd_Manager_t * pDsdMan,
int Output )

Definition at line 748 of file dsdTree.c.

749{
750 Vec_Str_t * p = (Vec_Str_t *)pStr;
751 assert( Output >= 0 && Output < pDsdMan->nRoots );
752 Dsd_Node_t * pNode = Dsd_Regular( pDsdMan->pRoots[Output] );
753 int fCompl = pNode != pDsdMan->pRoots[Output];
754 if ( pNode->Type == DSD_NODE_CONST1 )
755 Vec_StrPush( p, fCompl ? '0' : '1' );
756 else {
757 if ( fCompl )
758 Vec_StrPush( p, '~' );
759 Dsd_TreePrint3_rec( p, pNode );
760 }
761 Vec_StrPush( p, '\0' );
762}
struct Vec_Str_t_ Vec_Str_t
Definition bblif.c:46
void Dsd_TreePrint3_rec(Vec_Str_t *p, Dsd_Node_t *pNode)
Definition dsdTree.c:720
Here is the call graph for this function:

◆ Dsd_TreePrint3_rec()

void Dsd_TreePrint3_rec ( Vec_Str_t * p,
Dsd_Node_t * pNode )

Function*************************************************************

Synopsis [Prints the decompostion tree into a string.]

Description []

SideEffects []

SeeAlso []

Definition at line 720 of file dsdTree.c.

721{
722 if ( pNode->Type == DSD_NODE_BUF ) {
723 Vec_StrPush( p, (int)(pNode->S->index >= 26 ? 'A' - 26 : 'a') + pNode->S->index );
724 return;
725 }
726 if ( pNode->Type == DSD_NODE_PRIME )
727 Vec_StrPush( p, '{' );
728 else if ( pNode->Type == DSD_NODE_OR )
729 Vec_StrPush( p, '(' );
730 else if ( pNode->Type == DSD_NODE_EXOR )
731 Vec_StrPush( p, '[' );
732 else assert( 0 );
733 for ( int i = 0; i < pNode->nDecs; i++ )
734 {
735 Dsd_Node_t * pInput = Dsd_Regular( pNode->pDecs[i] );
736 if ( pInput != pNode->pDecs[i] )
737 Vec_StrPush( p, '~' );
738 Dsd_TreePrint3_rec( p, pInput );
739 }
740 if ( pNode->Type == DSD_NODE_PRIME )
741 Vec_StrPush( p, '}' );
742 else if ( pNode->Type == DSD_NODE_OR )
743 Vec_StrPush( p, ')' );
744 else if ( pNode->Type == DSD_NODE_EXOR )
745 Vec_StrPush( p, ']' );
746 else assert( 0 );
747}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Dsd_TreePrint4()

void Dsd_TreePrint4 ( void * pStr,
Dsd_Manager_t * pDsdMan,
int Output )

Definition at line 803 of file dsdTree.c.

804{
805 Vec_Str_t * p = (Vec_Str_t *)pStr;
806 assert( Output >= 0 && Output < pDsdMan->nRoots );
807 Dsd_Node_t * pNode = Dsd_Regular( pDsdMan->pRoots[Output] );
808 int fCompl = pNode != pDsdMan->pRoots[Output];
809 if ( pNode->Type == DSD_NODE_CONST1 )
810 Vec_StrPush( p, fCompl ? '0' : '1' );
811 else {
812 if ( fCompl ^ (pNode->Type == DSD_NODE_OR) )
813 Vec_StrPush( p, '~' );
814 Dsd_TreePrint4_rec( p, pNode );
815 }
816 Vec_StrPush( p, '\0' );
817}
void Dsd_TreePrint4_rec(Vec_Str_t *p, Dsd_Node_t *pNode)
Definition dsdTree.c:775
Here is the call graph for this function:

◆ Dsd_TreePrint4_rec()

void Dsd_TreePrint4_rec ( Vec_Str_t * p,
Dsd_Node_t * pNode )

Function*************************************************************

Synopsis [Prints the decompostion tree into a string.]

Description []

SideEffects []

SeeAlso []

Definition at line 775 of file dsdTree.c.

776{
777 if ( pNode->Type == DSD_NODE_BUF ) {
778 Vec_StrPush( p, (int)(pNode->S->index >= 26 ? 'A' - 26 : 'a') + pNode->S->index );
779 return;
780 }
781 if ( pNode->Type == DSD_NODE_PRIME )
782 Vec_StrPush( p, '{' );
783 else if ( pNode->Type == DSD_NODE_OR )
784 Vec_StrPush( p, '(' );
785 else if ( pNode->Type == DSD_NODE_EXOR )
786 Vec_StrPush( p, '[' );
787 else assert( 0 );
788 for ( int i = 0; i < pNode->nDecs; i++ )
789 {
790 Dsd_Node_t * pInput = Dsd_Regular( pNode->pDecs[i] );
791 if ( (pInput != pNode->pDecs[i]) ^ (pNode->Type == DSD_NODE_OR) ^ (pInput->Type == DSD_NODE_OR) )
792 Vec_StrPush( p, '~' );
793 Dsd_TreePrint4_rec( p, pInput );
794 }
795 if ( pNode->Type == DSD_NODE_PRIME )
796 Vec_StrPush( p, '}' );
797 else if ( pNode->Type == DSD_NODE_OR )
798 Vec_StrPush( p, ')' );
799 else if ( pNode->Type == DSD_NODE_EXOR )
800 Vec_StrPush( p, ']' );
801 else assert( 0 );
802}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Dsd_TreeSuppSize()

int Dsd_TreeSuppSize ( Dsd_Manager_t * pDsdMan,
int Output )

Definition at line 693 of file dsdTree.c.

694{
695 if ( Output == -1 )
696 {
697 int i, Res = 0;
698 for ( i = 0; i < pDsdMan->nRoots; i++ )
699 Res += Dsd_TreeSuppSize_rec( Dsd_Regular( pDsdMan->pRoots[i] ) );
700 return Res;
701 }
702 else
703 {
704 assert( Output >= 0 && Output < pDsdMan->nRoots );
705 return Dsd_TreeSuppSize_rec( Dsd_Regular( pDsdMan->pRoots[Output] ) );
706 }
707}
int Dsd_TreeSuppSize_rec(Dsd_Node_t *pNode)
Definition dsdTree.c:682
Here is the call graph for this function:

◆ Dsd_TreeSuppSize_rec()

int Dsd_TreeSuppSize_rec ( Dsd_Node_t * pNode)

Function*************************************************************

Synopsis [Returns the support size.]

Description []

SideEffects []

SeeAlso []

Definition at line 682 of file dsdTree.c.

683{
684 if ( pNode->Type == DSD_NODE_CONST1 )
685 return 0;
686 if ( pNode->Type == DSD_NODE_BUF )
687 return 1;
688 int nSuppSize = 0;
689 for ( int i = 0; i < pNode->nDecs; i++ )
690 nSuppSize += Dsd_TreeSuppSize_rec( Dsd_Regular( pNode->pDecs[i] ) );
691 return nSuppSize;
692}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Dsd_TreeUnmark()

void Dsd_TreeUnmark ( Dsd_Manager_t * pDsdMan)

Function*************************************************************

Synopsis [Unmarks the decomposition tree.]

Description [This function assumes that originally pNode->nVisits are set to zero!]

SideEffects []

SeeAlso []

Definition at line 107 of file dsdTree.c.

108{
109 int i;
110 for ( i = 0; i < pDsdMan->nRoots; i++ )
111 Dsd_TreeUnmark_rec( Dsd_Regular( pDsdMan->pRoots[i] ) );
112}
Here is the caller graph for this function: