/**Function************************************************************* Synopsis [Computes the DFS ordering of the nodes.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Map_MappingDfs_rec( Map_Node_t * pNode, Map_NodeVec_t * vNodes, int fCollectEquiv ) { assert( !Map_IsComplement(pNode) ); if ( pNode->fMark0 ) return; // visit the transitive fanin if ( Map_NodeIsAnd(pNode) ) { Map_MappingDfs_rec( Map_Regular(pNode->p1), vNodes, fCollectEquiv ); Map_MappingDfs_rec( Map_Regular(pNode->p2), vNodes, fCollectEquiv ); } // visit the equivalent nodes if ( fCollectEquiv && pNode->pNextE ) Map_MappingDfs_rec( pNode->pNextE, vNodes, fCollectEquiv ); // make sure the node is not visited through the equivalent nodes assert( pNode->fMark0 == 0 ); // mark the node as visited pNode->fMark0 = 1; // add the node to the list Map_NodeVecPush( vNodes, pNode ); }
/**Function************************************************************* Synopsis [Computes the DFS ordering of the nodes.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ Map_NodeVec_t * Map_MappingDfsNodes( Map_Man_t * pMan, Map_Node_t ** ppCuts, int nNodes, int fEquiv ) { Map_NodeVec_t * vNodes; int i; // perform the traversal vNodes = Map_NodeVecAlloc( 200 ); for ( i = 0; i < nNodes; i++ ) Map_MappingDfs_rec( ppCuts[i], vNodes, fEquiv ); for ( i = 0; i < vNodes->nSize; i++ ) vNodes->pArray[i]->fMark0 = 0; return vNodes; }
Map_NodeVec_t * Map_MappingDfs( Map_Man_t * pMan, int fCollectEquiv ) { Map_NodeVec_t * vNodes; int i; // perform the traversal vNodes = Map_NodeVecAlloc( 100 ); for ( i = 0; i < pMan->nOutputs; i++ ) Map_MappingDfs_rec( Map_Regular(pMan->pOutputs[i]), vNodes, fCollectEquiv ); for ( i = 0; i < vNodes->nSize; i++ ) vNodes->pArray[i]->fMark0 = 0; // for ( i = 0; i < pMan->nOutputs; i++ ) // Map_MappingUnmark_rec( Map_Regular(pMan->pOutputs[i]) ); return vNodes; }