New API to print internal nodes.

This commit is contained in:
Alan Mishchenko 2024-05-28 22:23:07 +02:00
parent 1e58dc6b00
commit fb4988bb13
3 changed files with 45 additions and 0 deletions

View File

@ -420,6 +420,7 @@ Abc_Obj_t * Abc_NodeFromMapPhase_rec( Abc_Ntk_t * pNtkNew, Map_Node_t * pNodeMap
uPhaseBest = Map_CutReadPhaseBest( pCutBest, fPhase );
nLeaves = Map_CutReadLeavesNum( pCutBest );
ppLeaves = Map_CutReadLeaves( pCutBest );
//Vec_Ptr_t * vAnds = Map_CutInternalNodes( pNodeMap, pCutBest );
// collect the PI nodes
for ( i = 0; i < nLeaves; i++ )

View File

@ -167,6 +167,7 @@ extern Map_Cut_t * Map_CutAlloc( Map_Man_t * p );
/*=== mapperCutUtils.c =============================================================*/
extern void Map_CutCreateFromNode( Map_Man_t * p, Map_Super_t * pSuper, int iRoot, unsigned uPhaseRoot,
int * pLeaves, int nLeaves, unsigned uPhaseLeaves );
extern Vec_Ptr_t * Map_CutInternalNodes( Map_Node_t * pObj, Map_Cut_t * pCut );
/*=== mapperCore.c =============================================================*/
extern int Map_Mapping( Map_Man_t * p );
/*=== mapperLib.c =============================================================*/

View File

@ -219,6 +219,49 @@ int Map_CutListCount( Map_Cut_t * pSets )
return i;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Map_CutInternalNodes_rec( Map_Node_t * pObj, Vec_Ptr_t * vAnds )
{
if ( pObj->TravId == pObj->p->nTravIds )
return;
pObj->TravId = pObj->p->nTravIds;
Map_CutInternalNodes_rec( pObj->p1, vAnds );
Map_CutInternalNodes_rec( pObj->p2, vAnds );
Vec_PtrPush( vAnds, pObj );
}
Vec_Ptr_t * Map_CutInternalNodes( Map_Node_t * pObj, Map_Cut_t * pCut )
{
Vec_Ptr_t * vAnds = Vec_PtrAlloc( 4 );
Map_Node_t * pTemp; int i;
pObj->p->nTravIds++;
for ( i = 0; i < pCut->nLeaves; i++ )
pCut->ppLeaves[i]->TravId = pObj->p->nTravIds;
Map_CutInternalNodes_rec( pObj, vAnds );
if ( 1 )
{
printf( "Leaves:\n" );
for ( i = 0; i < pCut->nLeaves; i++ )
printf( " %d", pCut->ppLeaves[i]->Num );
printf( "\n" );
printf( "Nodes:\n" );
Vec_PtrForEachEntry( Map_Node_t *, vAnds, pTemp, i )
printf( "%d=(%d,%d)\n", pTemp->Num, pTemp->p1->Num, pTemp->p2->Num );
printf( "\n" );
}
return vAnds;
}
#if 0
/**function*************************************************************