src/base/abci/abcReconv.c File Reference

#include "abc.h"
Include dependency graph for abcReconv.c:

Go to the source code of this file.

Data Structures

struct  Abc_ManCut_t_

Functions

static int Abc_NodeBuildCutLevelOne_int (Vec_Ptr_t *vVisited, Vec_Ptr_t *vLeaves, int nSizeLimit, int nFaninLimit)
static int Abc_NodeBuildCutLevelTwo_int (Vec_Ptr_t *vVisited, Vec_Ptr_t *vLeaves, int nFaninLimit)
static void Abc_NodeConeMarkCollect_rec (Abc_Obj_t *pNode, Vec_Ptr_t *vVisited)
static void Abc_NodesMark (Vec_Ptr_t *vVisited)
static void Abc_NodesUnmark (Vec_Ptr_t *vVisited)
static void Abc_NodesUnmarkB (Vec_Ptr_t *vVisited)
static int Abc_NodeGetLeafCostOne (Abc_Obj_t *pNode, int nFaninLimit)
static int Abc_NodeGetLeafCostTwo (Abc_Obj_t *pNode, int nFaninLimit, Abc_Obj_t **ppLeafToAdd, Abc_Obj_t **pNodeToMark1, Abc_Obj_t **pNodeToMark2)
Vec_Ptr_tAbc_NodeFindCut (Abc_ManCut_t *p, Abc_Obj_t *pRoot, bool fContain)
void Abc_NodeConeCollect (Abc_Obj_t **ppRoots, int nRoots, Vec_Ptr_t *vLeaves, Vec_Ptr_t *vVisited, int fIncludeFanins)
DdNodeAbc_NodeConeBdd (DdManager *dd, DdNode **pbVars, Abc_Obj_t *pRoot, Vec_Ptr_t *vLeaves, Vec_Ptr_t *vVisited)
DdNodeAbc_NodeConeDcs (DdManager *dd, DdNode **pbVarsX, DdNode **pbVarsY, Vec_Ptr_t *vLeaves, Vec_Ptr_t *vRoots, Vec_Ptr_t *vVisited)
Abc_ManCut_tAbc_NtkManCutStart (int nNodeSizeMax, int nConeSizeMax, int nNodeFanStop, int nConeFanStop)
void Abc_NtkManCutStop (Abc_ManCut_t *p)
Vec_Ptr_tAbc_NtkManCutReadCutLarge (Abc_ManCut_t *p)
Vec_Ptr_tAbc_NtkManCutReadCutSmall (Abc_ManCut_t *p)
Vec_Ptr_tAbc_NtkManCutReadVisited (Abc_ManCut_t *p)
Vec_Ptr_tAbc_NodeCollectTfoCands (Abc_ManCut_t *p, Abc_Obj_t *pRoot, Vec_Ptr_t *vLeaves, int LevelMax)

Function Documentation

int Abc_NodeBuildCutLevelOne_int ( Vec_Ptr_t vVisited,
Vec_Ptr_t vLeaves,
int  nSizeLimit,
int  nFaninLimit 
) [static]

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

Synopsis [Builds reconvergence-driven cut by changing one leaf at a time.]

Description [This procedure looks at the current leaves and tries to change one leaf at a time in such a way that the cut grows as little as possible. In evaluating the fanins, this procedure looks only at their immediate predecessors (this is why it is called a one-level construction procedure).]

SideEffects []

SeeAlso []

Definition at line 312 of file abcReconv.c.

00313 {
00314     Abc_Obj_t * pNode, * pFaninBest, * pNext;
00315     int CostBest, CostCur, i;
00316     // find the best fanin
00317     CostBest   = 100;
00318     pFaninBest = NULL;
00319 //printf( "Evaluating fanins of the cut:\n" );
00320     Vec_PtrForEachEntry( vLeaves, pNode, i )
00321     {
00322         CostCur = Abc_NodeGetLeafCostOne( pNode, nFaninLimit );
00323 //printf( "    Fanin %s has cost %d.\n", Abc_ObjName(pNode), CostCur );
00324 //        if ( CostBest > CostCur ) // performance improvement: expand the variable with the smallest level
00325         if ( CostBest > CostCur ||
00326              (CostBest == CostCur && pNode->Level > pFaninBest->Level) )
00327         {
00328             CostBest   = CostCur;
00329             pFaninBest = pNode;
00330         }
00331         if ( CostBest == 0 )
00332             break;
00333     }
00334     if ( pFaninBest == NULL )
00335         return 0;
00336 //        return Abc_NodeBuildCutLevelTwo_int( vVisited, vLeaves, nFaninLimit );
00337 
00338     assert( CostBest < 3 );
00339     if ( vLeaves->nSize - 1 + CostBest > nSizeLimit )
00340         return 0;
00341 //        return Abc_NodeBuildCutLevelTwo_int( vVisited, vLeaves, nFaninLimit );
00342 
00343     assert( Abc_ObjIsNode(pFaninBest) );
00344     // remove the node from the array
00345     Vec_PtrRemove( vLeaves, pFaninBest );
00346 //printf( "Removing fanin %s.\n", Abc_ObjName(pFaninBest) );
00347 
00348     // add the left child to the fanins
00349     pNext = Abc_ObjFanin0(pFaninBest);
00350     if ( !pNext->fMarkB )
00351     {
00352 //printf( "Adding fanin %s.\n", Abc_ObjName(pNext) );
00353         pNext->fMarkB = 1;
00354         Vec_PtrPush( vLeaves, pNext );
00355         Vec_PtrPush( vVisited, pNext );
00356     }
00357     // add the right child to the fanins
00358     pNext = Abc_ObjFanin1(pFaninBest);
00359     if ( !pNext->fMarkB )
00360     {
00361 //printf( "Adding fanin %s.\n", Abc_ObjName(pNext) );
00362         pNext->fMarkB = 1;
00363         Vec_PtrPush( vLeaves, pNext );
00364         Vec_PtrPush( vVisited, pNext );
00365     }
00366     assert( vLeaves->nSize <= nSizeLimit );
00367     // keep doing this
00368     return 1;
00369 }

int Abc_NodeBuildCutLevelTwo_int ( Vec_Ptr_t vVisited,
Vec_Ptr_t vLeaves,
int  nFaninLimit 
) [static]

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

Synopsis [Builds reconvergence-driven cut by changing one leaf at a time.]

Description [This procedure looks at the current leaves and tries to change one leaf at a time in such a way that the cut grows as little as possible. In evaluating the fanins, this procedure looks across two levels of fanins (this is why it is called a two-level construction procedure).]

SideEffects []

SeeAlso []

Definition at line 385 of file abcReconv.c.

00386 {
00387     Abc_Obj_t * pNode, * pLeafToAdd, * pNodeToMark1, * pNodeToMark2;
00388     int CostCur, i;
00389     // find the best fanin
00390     Vec_PtrForEachEntry( vLeaves, pNode, i )
00391     {
00392         CostCur = Abc_NodeGetLeafCostTwo( pNode, nFaninLimit, &pLeafToAdd, &pNodeToMark1, &pNodeToMark2 );
00393         if ( CostCur < 2 )
00394             break;
00395     }
00396     if ( CostCur > 2 )
00397         return 0;
00398     // remove the node from the array
00399     Vec_PtrRemove( vLeaves, pNode );
00400     // add the node to the leaves
00401     if ( pLeafToAdd )
00402     {
00403         assert( !pLeafToAdd->fMarkB );
00404         pLeafToAdd->fMarkB = 1;
00405         Vec_PtrPush( vLeaves, pLeafToAdd );
00406         Vec_PtrPush( vVisited, pLeafToAdd );
00407     }
00408     // mark the other nodes
00409     if ( pNodeToMark1 )
00410     {
00411         assert( !pNodeToMark1->fMarkB );
00412         pNodeToMark1->fMarkB = 1;
00413         Vec_PtrPush( vVisited, pNodeToMark1 );
00414     }
00415     if ( pNodeToMark2 )
00416     {
00417         assert( !pNodeToMark2->fMarkB );
00418         pNodeToMark2->fMarkB = 1;
00419         Vec_PtrPush( vVisited, pNodeToMark2 );
00420     }
00421     // keep doing this
00422     return 1;
00423 }

Vec_Ptr_t* Abc_NodeCollectTfoCands ( Abc_ManCut_t p,
Abc_Obj_t pRoot,
Vec_Ptr_t vLeaves,
int  LevelMax 
)

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

Synopsis [Collects the TFO of the cut in the topological order.]

Description [TFO of the cut is defined as a set of nodes, for which the cut is a cut, that is, every path from the collected nodes to the CIs goes through a node in the cut. The nodes are collected if their level does not exceed the given number (LevelMax). The nodes are returned in the topological order. If the root node is given, its MFFC is marked, so that the collected nodes do not contain any nodes in the MFFC.]

SideEffects []

SeeAlso []

Definition at line 687 of file abcReconv.c.

00688 {
00689     Abc_Ntk_t * pNtk = pRoot->pNtk;
00690     Vec_Ptr_t * vVec;
00691     Abc_Obj_t * pNode, * pFanout;
00692     int i, k, v, LevelMin;
00693     assert( Abc_NtkIsStrash(pNtk) );
00694 
00695     // assuming that the structure is clean
00696     Vec_VecForEachLevel( p->vLevels, vVec, i )
00697         assert( vVec->nSize == 0 );
00698 
00699     // put fanins into the structure while labeling them
00700     Abc_NtkIncrementTravId( pNtk );
00701     LevelMin = -1;
00702     Vec_PtrForEachEntry( vLeaves, pNode, i )
00703     {
00704         if ( pNode->Level > (unsigned)LevelMax )
00705             continue;
00706         Abc_NodeSetTravIdCurrent( pNode );
00707         Vec_VecPush( p->vLevels, pNode->Level, pNode );
00708         if ( LevelMin < (int)pNode->Level )
00709             LevelMin = pNode->Level;
00710     }
00711     assert( LevelMin >= 0 );
00712 
00713     // mark MFFC 
00714     if ( pRoot )
00715         Abc_NodeMffcLabelAig( pRoot );
00716 
00717     // go through the levels up
00718     Vec_PtrClear( p->vNodesTfo );
00719     Vec_VecForEachEntryStart( p->vLevels, pNode, i, k, LevelMin )
00720     {
00721         if ( i > LevelMax )
00722             break;
00723         // if the node is not marked, it is not a fanin
00724         if ( !Abc_NodeIsTravIdCurrent(pNode) )
00725         {
00726             // check if it belongs to the TFO
00727             if ( !Abc_NodeIsTravIdCurrent(Abc_ObjFanin0(pNode)) || 
00728                  !Abc_NodeIsTravIdCurrent(Abc_ObjFanin1(pNode)) )
00729                  continue;
00730             // save the node in the TFO and label it
00731             Vec_PtrPush( p->vNodesTfo, pNode );
00732             Abc_NodeSetTravIdCurrent( pNode );
00733         }
00734         // go through the fanouts and add them to the structure if they meet the conditions
00735         Abc_ObjForEachFanout( pNode, pFanout, v )
00736         {
00737             // skip if fanout is a CO or its level exceeds
00738             if ( Abc_ObjIsCo(pFanout) || pFanout->Level > (unsigned)LevelMax )
00739                 continue;
00740             // skip if it is already added or if it is in MFFC
00741             if ( Abc_NodeIsTravIdCurrent(pFanout) )
00742                 continue;
00743             // add it to the structure but do not mark it (until tested later)
00744             Vec_VecPushUnique( p->vLevels, pFanout->Level, pFanout );
00745         }
00746     }
00747 
00748     // clear the levelized structure
00749     Vec_VecForEachLevelStart( p->vLevels, vVec, i, LevelMin )
00750     {
00751         if ( i > LevelMax )
00752             break;
00753         Vec_PtrClear( vVec );
00754     }
00755     return p->vNodesTfo;
00756 }

DdNode* Abc_NodeConeBdd ( DdManager dd,
DdNode **  pbVars,
Abc_Obj_t pRoot,
Vec_Ptr_t vLeaves,
Vec_Ptr_t vVisited 
)

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

Synopsis [Returns BDD representing the logic function of the cone.]

Description []

SideEffects []

SeeAlso []

Definition at line 494 of file abcReconv.c.

00495 {
00496     Abc_Obj_t * pNode;
00497     DdNode * bFunc0, * bFunc1, * bFunc;
00498     int i;
00499     // get the nodes in the cut without fanins in the DFS order
00500     Abc_NodeConeCollect( &pRoot, 1, vLeaves, vVisited, 0 );
00501     // set the elementary BDDs
00502     Vec_PtrForEachEntry( vLeaves, pNode, i )
00503         pNode->pCopy = (Abc_Obj_t *)pbVars[i];
00504     // compute the BDDs for the collected nodes
00505     Vec_PtrForEachEntry( vVisited, pNode, i )
00506     {
00507         assert( !Abc_ObjIsPi(pNode) );
00508         bFunc0 = Cudd_NotCond( Abc_ObjFanin0(pNode)->pCopy, Abc_ObjFaninC0(pNode) );
00509         bFunc1 = Cudd_NotCond( Abc_ObjFanin1(pNode)->pCopy, Abc_ObjFaninC1(pNode) );
00510         bFunc  = Cudd_bddAnd( dd, bFunc0, bFunc1 );    Cudd_Ref( bFunc );
00511         pNode->pCopy = (Abc_Obj_t *)bFunc;
00512     }
00513     Cudd_Ref( bFunc );
00514     // dereference the intermediate ones
00515     Vec_PtrForEachEntry( vVisited, pNode, i )
00516         Cudd_RecursiveDeref( dd, (DdNode *)pNode->pCopy );
00517     Cudd_Deref( bFunc );
00518     return bFunc;
00519 }

void Abc_NodeConeCollect ( Abc_Obj_t **  ppRoots,
int  nRoots,
Vec_Ptr_t vLeaves,
Vec_Ptr_t vVisited,
int  fIncludeFanins 
)

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

Synopsis [Get the nodes contained in the cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 437 of file abcReconv.c.

00438 {
00439     Abc_Obj_t * pTemp;
00440     int i;
00441     // mark the fanins of the cone
00442     Abc_NodesMark( vLeaves );
00443     // collect the nodes in the DFS order
00444     Vec_PtrClear( vVisited );
00445     // add the fanins
00446     if ( fIncludeFanins )
00447         Vec_PtrForEachEntry( vLeaves, pTemp, i )
00448             Vec_PtrPush( vVisited, pTemp );
00449     // add other nodes
00450     for ( i = 0; i < nRoots; i++ )
00451         Abc_NodeConeMarkCollect_rec( ppRoots[i], vVisited );
00452     // unmark both sets
00453     Abc_NodesUnmark( vLeaves );
00454     Abc_NodesUnmark( vVisited );
00455 }

DdNode* Abc_NodeConeDcs ( DdManager dd,
DdNode **  pbVarsX,
DdNode **  pbVarsY,
Vec_Ptr_t vLeaves,
Vec_Ptr_t vRoots,
Vec_Ptr_t vVisited 
)

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

Synopsis [Returns BDD representing the transition relation of the cone.]

Description []

SideEffects []

SeeAlso []

Definition at line 532 of file abcReconv.c.

00533 {
00534     DdNode * bFunc0, * bFunc1, * bFunc, * bTrans, * bTemp, * bCube, * bResult;
00535     Abc_Obj_t * pNode;
00536     int i;
00537     // get the nodes in the cut without fanins in the DFS order
00538     Abc_NodeConeCollect( (Abc_Obj_t **)vRoots->pArray, vRoots->nSize, vLeaves, vVisited, 0 );
00539     // set the elementary BDDs
00540     Vec_PtrForEachEntry( vLeaves, pNode, i )
00541         pNode->pCopy = (Abc_Obj_t *)pbVarsX[i];
00542     // compute the BDDs for the collected nodes
00543     Vec_PtrForEachEntry( vVisited, pNode, i )
00544     {
00545         bFunc0 = Cudd_NotCond( Abc_ObjFanin0(pNode)->pCopy, Abc_ObjFaninC0(pNode) );
00546         bFunc1 = Cudd_NotCond( Abc_ObjFanin1(pNode)->pCopy, Abc_ObjFaninC1(pNode) );
00547         bFunc  = Cudd_bddAnd( dd, bFunc0, bFunc1 );    Cudd_Ref( bFunc );
00548         pNode->pCopy = (Abc_Obj_t *)bFunc;
00549     }
00550     // compute the transition relation of the cone
00551     bTrans = b1;    Cudd_Ref( bTrans );
00552     Vec_PtrForEachEntry( vRoots, pNode, i )
00553     {
00554         bFunc = Cudd_bddXnor( dd, (DdNode *)pNode->pCopy, pbVarsY[i] );  Cudd_Ref( bFunc );
00555                 bTrans = Cudd_bddAnd( dd, bTemp = bTrans, bFunc );               Cudd_Ref( bTrans );
00556                 Cudd_RecursiveDeref( dd, bTemp );
00557                 Cudd_RecursiveDeref( dd, bFunc );
00558     }
00559     // dereference the intermediate ones
00560     Vec_PtrForEachEntry( vVisited, pNode, i )
00561         Cudd_RecursiveDeref( dd, (DdNode *)pNode->pCopy );
00562     // compute don't-cares
00563     bCube = Extra_bddComputeRangeCube( dd, vRoots->nSize, vRoots->nSize + vLeaves->nSize );  Cudd_Ref( bCube );
00564     bResult = Cudd_bddExistAbstract( dd, bTrans, bCube );                Cudd_Ref( bResult );
00565     bResult = Cudd_Not( bResult );
00566         Cudd_RecursiveDeref( dd, bCube );
00567         Cudd_RecursiveDeref( dd, bTrans );
00568     Cudd_Deref( bResult );
00569     return bResult;
00570 }

void Abc_NodeConeMarkCollect_rec ( Abc_Obj_t pNode,
Vec_Ptr_t vVisited 
) [static]

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

Synopsis [Marks the TFI cone.]

Description []

SideEffects []

SeeAlso []

Definition at line 468 of file abcReconv.c.

00469 {
00470     if ( pNode->fMarkA == 1 )
00471         return;
00472     // visit transitive fanin 
00473     if ( Abc_ObjIsNode(pNode) )
00474     {
00475         Abc_NodeConeMarkCollect_rec( Abc_ObjFanin0(pNode), vVisited );
00476         Abc_NodeConeMarkCollect_rec( Abc_ObjFanin1(pNode), vVisited );
00477     }
00478     assert( pNode->fMarkA == 0 );
00479     pNode->fMarkA = 1;
00480     Vec_PtrPush( vVisited, pNode );
00481 }

Vec_Ptr_t* Abc_NodeFindCut ( Abc_ManCut_t p,
Abc_Obj_t pRoot,
bool  fContain 
)

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

Synopsis [Finds a fanin-limited, reconvergence-driven cut for the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 249 of file abcReconv.c.

00250 {
00251     Abc_Obj_t * pNode;
00252     int i;
00253 
00254     assert( !Abc_ObjIsComplement(pRoot) );
00255     assert( Abc_ObjIsNode(pRoot) );
00256 
00257     // start the visited nodes and mark them
00258     Vec_PtrClear( p->vVisited );
00259     Vec_PtrPush( p->vVisited, pRoot );
00260     Vec_PtrPush( p->vVisited, Abc_ObjFanin0(pRoot) );
00261     Vec_PtrPush( p->vVisited, Abc_ObjFanin1(pRoot) );
00262     pRoot->fMarkB = 1;
00263     Abc_ObjFanin0(pRoot)->fMarkB = 1;
00264     Abc_ObjFanin1(pRoot)->fMarkB = 1;
00265 
00266     // start the cut 
00267     Vec_PtrClear( p->vNodeLeaves );
00268     Vec_PtrPush( p->vNodeLeaves, Abc_ObjFanin0(pRoot) );
00269     Vec_PtrPush( p->vNodeLeaves, Abc_ObjFanin1(pRoot) );
00270 
00271     // compute the cut
00272     while ( Abc_NodeBuildCutLevelOne_int( p->vVisited, p->vNodeLeaves, p->nNodeSizeMax, p->nNodeFanStop ) );
00273     assert( Vec_PtrSize(p->vNodeLeaves) <= p->nNodeSizeMax );
00274 
00275     // return if containing cut is not requested
00276     if ( !fContain )
00277     {
00278         // unmark both fMarkA and fMarkB in tbe TFI
00279         Abc_NodesUnmarkB( p->vVisited );
00280         return p->vNodeLeaves;
00281     }
00282 
00283 //printf( "\n\n\n" );
00284     // compute the containing cut
00285     assert( p->nNodeSizeMax < p->nConeSizeMax );
00286     // copy the current boundary
00287     Vec_PtrClear( p->vConeLeaves );
00288     Vec_PtrForEachEntry( p->vNodeLeaves, pNode, i )
00289         Vec_PtrPush( p->vConeLeaves, pNode );
00290     // compute the containing cut
00291     while ( Abc_NodeBuildCutLevelOne_int( p->vVisited, p->vConeLeaves, p->nConeSizeMax, p->nConeFanStop ) );
00292     assert( Vec_PtrSize(p->vConeLeaves) <= p->nConeSizeMax );
00293     // unmark TFI using fMarkA and fMarkB
00294     Abc_NodesUnmarkB( p->vVisited );
00295     return p->vNodeLeaves;
00296 }

static int Abc_NodeGetLeafCostOne ( Abc_Obj_t pNode,
int  nFaninLimit 
) [inline, static]

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

Synopsis [Evaluate the cost of removing the node from the set of leaves.]

Description [Returns the number of new leaves that will be brought in. Returns large number if the node cannot be removed from the set of leaves.]

SideEffects []

SeeAlso []

Definition at line 119 of file abcReconv.c.

00120 {
00121     int Cost;
00122     // make sure the node is in the construction zone
00123     assert( pNode->fMarkB == 1 );  
00124     // cannot expand over the PI node
00125     if ( Abc_ObjIsCi(pNode) )
00126         return 999;
00127     // get the cost of the cone
00128     Cost = (!Abc_ObjFanin0(pNode)->fMarkB) + (!Abc_ObjFanin1(pNode)->fMarkB);
00129     // always accept if the number of leaves does not increase
00130     if ( Cost < 2 )
00131         return Cost;
00132     // skip nodes with many fanouts
00133     if ( Abc_ObjFanoutNum(pNode) > nFaninLimit )
00134         return 999;
00135     // return the number of nodes that will be on the leaves if this node is removed
00136     return Cost;
00137 }

static int Abc_NodeGetLeafCostTwo ( Abc_Obj_t pNode,
int  nFaninLimit,
Abc_Obj_t **  ppLeafToAdd,
Abc_Obj_t **  pNodeToMark1,
Abc_Obj_t **  pNodeToMark2 
) [inline, static]

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

Synopsis [Evaluate the cost of removing the node from the set of leaves.]

Description [Returns the number of new leaves that will be brought in. Returns large number if the node cannot be removed from the set of leaves.]

SideEffects []

SeeAlso []

Definition at line 151 of file abcReconv.c.

00153 {
00154     Abc_Obj_t * pFanin0, * pFanin1, * pTemp;
00155     Abc_Obj_t * pGrand, * pGrandToAdd;
00156     // make sure the node is in the construction zone
00157     assert( pNode->fMarkB == 1 );  
00158     // cannot expand over the PI node
00159     if ( Abc_ObjIsCi(pNode) )
00160         return 999;
00161     // skip nodes with many fanouts
00162 //    if ( Abc_ObjFanoutNum(pNode) > nFaninLimit )
00163 //        return 999;
00164     // get the children
00165     pFanin0 = Abc_ObjFanin0(pNode);
00166     pFanin1 = Abc_ObjFanin1(pNode);
00167     assert( !pFanin0->fMarkB && !pFanin1->fMarkB );
00168     // count the number of unique grandchildren that will be included
00169     // return infinite cost if this number if more than 1
00170     if ( Abc_ObjIsCi(pFanin0) && Abc_ObjIsCi(pFanin1) )
00171         return 999;
00172     // consider the special case when a non-CI fanin can be dropped
00173     if ( !Abc_ObjIsCi(pFanin0) && Abc_ObjFanin0(pFanin0)->fMarkB && Abc_ObjFanin1(pFanin0)->fMarkB )
00174     {
00175         *ppLeafToAdd  = pFanin1;
00176         *pNodeToMark1 = pFanin0;
00177         *pNodeToMark2 = NULL;
00178         return 1;
00179     }
00180     if ( !Abc_ObjIsCi(pFanin1) && Abc_ObjFanin0(pFanin1)->fMarkB && Abc_ObjFanin1(pFanin1)->fMarkB )
00181     {
00182         *ppLeafToAdd  = pFanin0;
00183         *pNodeToMark1 = pFanin1;
00184         *pNodeToMark2 = NULL;
00185         return 1;
00186     }
00187 
00188     // make the first node CI if any
00189     if ( Abc_ObjIsCi(pFanin1) )
00190         pTemp = pFanin0, pFanin0 = pFanin1, pFanin1 = pTemp;
00191     // consider the first node
00192     pGrandToAdd = NULL;
00193     if ( Abc_ObjIsCi(pFanin0) )
00194     {
00195         *pNodeToMark1 = NULL;
00196         pGrandToAdd = pFanin0;
00197     }
00198     else
00199     {
00200         *pNodeToMark1 = pFanin0;
00201         pGrand = Abc_ObjFanin0(pFanin0);
00202         if ( !pGrand->fMarkB )
00203         {
00204             if ( pGrandToAdd && pGrandToAdd != pGrand )
00205                 return 999;
00206             pGrandToAdd = pGrand;
00207         }
00208         pGrand = Abc_ObjFanin1(pFanin0);
00209         if ( !pGrand->fMarkB )
00210         {
00211             if ( pGrandToAdd && pGrandToAdd != pGrand )
00212                 return 999;
00213             pGrandToAdd = pGrand;
00214         }
00215     }
00216     // consider the second node
00217     *pNodeToMark2 = pFanin1;
00218     pGrand = Abc_ObjFanin0(pFanin1);
00219     if ( !pGrand->fMarkB )
00220     {
00221         if ( pGrandToAdd && pGrandToAdd != pGrand )
00222             return 999;
00223         pGrandToAdd = pGrand;
00224     }
00225     pGrand = Abc_ObjFanin1(pFanin1);
00226     if ( !pGrand->fMarkB )
00227     {
00228         if ( pGrandToAdd && pGrandToAdd != pGrand )
00229             return 999;
00230         pGrandToAdd = pGrand;
00231     }
00232     assert( pGrandToAdd != NULL );
00233     *ppLeafToAdd = pGrandToAdd;
00234     return 1;
00235 }

static void Abc_NodesMark ( Vec_Ptr_t vVisited  )  [inline, static]

FUNCTION DEFINITIONS ///Function*************************************************************

Synopsis [Unmarks the TFI cone.]

Description []

SideEffects []

SeeAlso []

Definition at line 61 of file abcReconv.c.

00062 {
00063     Abc_Obj_t * pNode;
00064     int i;
00065     Vec_PtrForEachEntry( vVisited, pNode, i )
00066         pNode->fMarkA = 1;
00067 }

static void Abc_NodesUnmark ( Vec_Ptr_t vVisited  )  [inline, static]

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

Synopsis [Unmarks the TFI cone.]

Description []

SideEffects []

SeeAlso []

Definition at line 80 of file abcReconv.c.

00081 {
00082     Abc_Obj_t * pNode;
00083     int i;
00084     Vec_PtrForEachEntry( vVisited, pNode, i )
00085         pNode->fMarkA = 0;
00086 }

static void Abc_NodesUnmarkB ( Vec_Ptr_t vVisited  )  [inline, static]

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

Synopsis [Unmarks the TFI cone.]

Description []

SideEffects []

SeeAlso []

Definition at line 99 of file abcReconv.c.

00100 {
00101     Abc_Obj_t * pNode;
00102     int i;
00103     Vec_PtrForEachEntry( vVisited, pNode, i )
00104         pNode->fMarkB = 0;
00105 }

Vec_Ptr_t* Abc_NtkManCutReadCutLarge ( Abc_ManCut_t p  ) 

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

Synopsis [Returns the leaves of the cone.]

Description []

SideEffects []

SeeAlso []

Definition at line 632 of file abcReconv.c.

00633 {
00634     return p->vConeLeaves;
00635 }

Vec_Ptr_t* Abc_NtkManCutReadCutSmall ( Abc_ManCut_t p  ) 

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

Synopsis [Returns the leaves of the cone.]

Description []

SideEffects []

SeeAlso []

Definition at line 648 of file abcReconv.c.

00649 {
00650     return p->vNodeLeaves;
00651 }

Vec_Ptr_t* Abc_NtkManCutReadVisited ( Abc_ManCut_t p  ) 

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

Synopsis [Returns the leaves of the cone.]

Description []

SideEffects []

SeeAlso []

Definition at line 664 of file abcReconv.c.

00665 {
00666     return p->vVisited;
00667 }

Abc_ManCut_t* Abc_NtkManCutStart ( int  nNodeSizeMax,
int  nConeSizeMax,
int  nNodeFanStop,
int  nConeFanStop 
)

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

Synopsis [Starts the resynthesis manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 583 of file abcReconv.c.

00584 {
00585     Abc_ManCut_t * p;
00586     p = ALLOC( Abc_ManCut_t, 1 );
00587     memset( p, 0, sizeof(Abc_ManCut_t) );
00588     p->vNodeLeaves  = Vec_PtrAlloc( 100 );
00589     p->vConeLeaves  = Vec_PtrAlloc( 100 );
00590     p->vVisited     = Vec_PtrAlloc( 100 );
00591     p->vLevels      = Vec_VecAlloc( 100 );
00592     p->vNodesTfo    = Vec_PtrAlloc( 100 );
00593     p->nNodeSizeMax = nNodeSizeMax;
00594     p->nConeSizeMax = nConeSizeMax;
00595     p->nNodeFanStop = nNodeFanStop;
00596     p->nConeFanStop = nConeFanStop;
00597     return p;
00598 }

void Abc_NtkManCutStop ( Abc_ManCut_t p  ) 

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

Synopsis [Stops the resynthesis manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 611 of file abcReconv.c.

00612 {
00613     Vec_PtrFree( p->vNodeLeaves );
00614     Vec_PtrFree( p->vConeLeaves );
00615     Vec_PtrFree( p->vVisited    );
00616     Vec_VecFree( p->vLevels );
00617     Vec_PtrFree( p->vNodesTfo );
00618     free( p );
00619 }


Generated on Tue Jan 5 12:18:40 2010 for abc70930 by  doxygen 1.6.1