diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2008-03-07 20:01:00 -0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2008-03-07 20:01:00 -0800 |
commit | d5495ad3266e5747d4de74b409367f7b501f87f6 (patch) | |
tree | 872d78dd4127d4d92ccc1e996ad969ca17be0bd6 /src/map/if | |
parent | 8eeecc517568a1bd2a6f8379f81303a7c7c57d1b (diff) | |
download | abc-d5495ad3266e5747d4de74b409367f7b501f87f6.tar.gz abc-d5495ad3266e5747d4de74b409367f7b501f87f6.tar.bz2 abc-d5495ad3266e5747d4de74b409367f7b501f87f6.zip |
Version abc80307_2
Diffstat (limited to 'src/map/if')
-rw-r--r-- | src/map/if/if.h | 2 | ||||
-rw-r--r-- | src/map/if/ifCore.c | 13 | ||||
-rw-r--r-- | src/map/if/ifCut.c | 143 | ||||
-rw-r--r-- | src/map/if/ifMan.c | 1 | ||||
-rw-r--r-- | src/map/if/ifMap.c | 4 |
5 files changed, 160 insertions, 3 deletions
diff --git a/src/map/if/if.h b/src/map/if/if.h index 32d458dc..6c33e03f 100644 --- a/src/map/if/if.h +++ b/src/map/if/if.h @@ -166,6 +166,8 @@ struct If_Man_t_ int nSmallSupp; // the small support // timing manager Tim_Man_t * pManTim; + // statistics +// int timeTruth; }; // priority cut diff --git a/src/map/if/ifCore.c b/src/map/if/ifCore.c index 16a14153..99b99af7 100644 --- a/src/map/if/ifCore.c +++ b/src/map/if/ifCore.c @@ -110,14 +110,14 @@ int If_ManPerformMappingComb( If_Man_t * p ) If_ManPerformMappingRound( p, p->pPars->nCutsMax, 0, 0, "Delay" ); // try to improve area by expanding and reducing the cuts - if ( p->pPars->fExpRed && !p->pPars->fTruth ) + if ( p->pPars->fExpRed ) If_ManImproveMapping( p ); // area flow oriented mapping for ( i = 0; i < p->pPars->nFlowIters; i++ ) { If_ManPerformMappingRound( p, p->pPars->nCutsMax, 1, 0, "Flow" ); - if ( p->pPars->fExpRed && !p->pPars->fTruth ) + if ( p->pPars->fExpRed ) If_ManImproveMapping( p ); } @@ -125,7 +125,7 @@ int If_ManPerformMappingComb( If_Man_t * p ) for ( i = 0; i < p->pPars->nAreaIters; i++ ) { If_ManPerformMappingRound( p, p->pPars->nCutsMax, 2, 0, "Area" ); - if ( p->pPars->fExpRed && !p->pPars->fTruth ) + if ( p->pPars->fExpRed ) If_ManImproveMapping( p ); } @@ -139,6 +139,13 @@ int If_ManPerformMappingComb( If_Man_t * p ) // printf( "Cross cut memory = %d.\n", Mem_FixedReadMaxEntriesUsed(p->pMemSet) ); s_MappingTime = clock() - clkTotal; // printf( "Special POs = %d.\n", If_ManCountSpecialPos(p) ); + { + extern int If_CutGetCones( If_Man_t * p ); + extern int If_CutCountTotalFanins( If_Man_t * p ); +// If_CutGetCones( p ); +// If_CutCountTotalFanins( p ); + } + return 1; } diff --git a/src/map/if/ifCut.c b/src/map/if/ifCut.c index cc842c19..08653d95 100644 --- a/src/map/if/ifCut.c +++ b/src/map/if/ifCut.c @@ -980,6 +980,149 @@ float If_CutEdgeRefed( If_Man_t * p, If_Cut_t * pCut ) return aResult; } +/**Function************************************************************* + + Synopsis [Computes the cone of the cut in AIG with choices.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int If_CutGetCutMinLevel( If_Man_t * p, If_Cut_t * pCut ) +{ + If_Obj_t * pLeaf; + int i, nMinLevel = IF_INFINITY; + If_CutForEachLeaf( p, pCut, pLeaf, i ) + nMinLevel = IF_MIN( nMinLevel, (int)pLeaf->Level ); + return nMinLevel; +} + +/**Function************************************************************* + + Synopsis [Computes the cone of the cut in AIG with choices.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int If_CutGetCone_rec( If_Man_t * p, If_Obj_t * pObj, If_Cut_t * pCut ) +{ + If_Obj_t * pTemp; + int i, RetValue; + // check if the node is in the cut + for ( i = 0; i < (int)pCut->nLeaves; i++ ) + if ( pCut->pLeaves[i] == pObj->Id ) + return 1; + else if ( pCut->pLeaves[i] > pObj->Id ) + break; + // return if we reached the boundary + if ( If_ObjIsCi(pObj) ) + return 0; + // check the choice node + for ( pTemp = pObj; pTemp; pTemp = pTemp->pEquiv ) + { + // check if the node itself is bound + RetValue = If_CutGetCone_rec( p, If_ObjFanin0(pTemp), pCut ); + if ( RetValue ) + RetValue &= If_CutGetCone_rec( p, If_ObjFanin1(pTemp), pCut ); + if ( RetValue ) + return 1; + } + return 0; +} + +/**Function************************************************************* + + Synopsis [Computes the cone of the cut in AIG with choices.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int If_CutGetCones( If_Man_t * p ) +{ + If_Obj_t * pObj; + int i, Counter = 0; + int clk = clock(); + If_ManForEachObj( p, pObj, i ) + { + if ( If_ObjIsAnd(pObj) && pObj->nRefs ) + { + Counter += !If_CutGetCone_rec( p, pObj, If_ObjCutBest(pObj) ); +// printf( "%d ", If_CutGetCutMinLevel( p, If_ObjCutBest(pObj) ) ); + } + } + printf( "Cound not find boundary for %d nodes.\n", Counter ); + PRT( "Cones", clock() - clk ); + return 1; +} + + +/**Function************************************************************* + + Synopsis [Computes the cone of the cut in AIG with choices.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void If_CutFoundFanins_rec( If_Obj_t * pObj, Vec_Int_t * vLeaves ) +{ + if ( pObj->nRefs || If_ObjIsCi(pObj) ) + { + Vec_IntPushUnique( vLeaves, pObj->Id ); + return; + } + If_CutFoundFanins_rec( If_ObjFanin0(pObj), vLeaves ); + If_CutFoundFanins_rec( If_ObjFanin1(pObj), vLeaves ); +} + +/**Function************************************************************* + + Synopsis [Computes the cone of the cut in AIG with choices.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int If_CutCountTotalFanins( If_Man_t * p ) +{ + If_Obj_t * pObj; + Vec_Int_t * vLeaves; + int i, nFaninsTotal = 0, Counter = 0; + int clk = clock(); + vLeaves = Vec_IntAlloc( 100 ); + If_ManForEachObj( p, pObj, i ) + { + if ( If_ObjIsAnd(pObj) && pObj->nRefs ) + { + nFaninsTotal += If_ObjCutBest(pObj)->nLeaves; + Vec_IntClear( vLeaves ); + If_CutFoundFanins_rec( If_ObjFanin0(pObj), vLeaves ); + If_CutFoundFanins_rec( If_ObjFanin1(pObj), vLeaves ); + Counter += Vec_IntSize(vLeaves); + } + } + printf( "Total cut inputs = %d. Total fanins incremental = %d.\n", nFaninsTotal, Counter ); + PRT( "Fanins", clock() - clk ); + Vec_IntFree( vLeaves ); + return 1; +} //////////////////////////////////////////////////////////////////////// /// END OF FILE /// diff --git a/src/map/if/ifMan.c b/src/map/if/ifMan.c index 1528b08c..7bb7fcd1 100644 --- a/src/map/if/ifMan.c +++ b/src/map/if/ifMan.c @@ -124,6 +124,7 @@ void If_ManRestart( If_Man_t * p ) ***********************************************************************/ void If_ManStop( If_Man_t * p ) { +// PRT( "Truth", p->timeTruth ); // printf( "Small support = %d.\n", p->nSmallSupp ); Vec_PtrFree( p->vCis ); Vec_PtrFree( p->vCos ); diff --git a/src/map/if/ifMap.c b/src/map/if/ifMap.c index 1ac5ef21..fafd454d 100644 --- a/src/map/if/ifMap.c +++ b/src/map/if/ifMap.c @@ -119,7 +119,11 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep // compute the truth table pCut->fCompl = 0; if ( p->pPars->fTruth ) + { +// int clk = clock(); If_CutComputeTruth( p, pCut, pCut0, pCut1, pObj->fCompl0, pObj->fCompl1 ); +// p->timeTruth += clock() - clk; + } // compute the application-specific cost and depth pCut->fUser = (p->pPars->pFuncCost != NULL); pCut->Cost = p->pPars->pFuncCost? p->pPars->pFuncCost(pCut) : 0; |