diff options
Diffstat (limited to 'src/aig/gia')
-rw-r--r-- | src/aig/gia/gia.h | 8 | ||||
-rw-r--r-- | src/aig/gia/giaAig.c | 4 | ||||
-rw-r--r-- | src/aig/gia/giaAiger.c | 2 | ||||
-rw-r--r-- | src/aig/gia/giaBalance.c | 4 | ||||
-rw-r--r-- | src/aig/gia/giaFx.c | 2 | ||||
-rw-r--r-- | src/aig/gia/giaIf.c | 100 | ||||
-rw-r--r-- | src/aig/gia/giaSweep.c | 2 |
7 files changed, 69 insertions, 53 deletions
diff --git a/src/aig/gia/gia.h b/src/aig/gia/gia.h index 7dc209a7..fa8a6026 100644 --- a/src/aig/gia/gia.h +++ b/src/aig/gia/gia.h @@ -1183,10 +1183,10 @@ extern int Gia_ManLutLevel( Gia_Man_t * p ); extern void Gia_ManSetRefsMapped( Gia_Man_t * p ); extern void Gia_ManSetIfParsDefault( void * pIfPars ); extern void Gia_ManMappingVerify( Gia_Man_t * p ); -extern void Gia_ManTransferMapping( Gia_Man_t * pGia, Gia_Man_t * p ); -extern void Gia_ManTransferPacking( Gia_Man_t * pGia, Gia_Man_t * p ); -extern void Gia_ManTransferTiming( Gia_Man_t * pGia, Gia_Man_t * p ); -extern Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pIfPars, int fNormalized ); +extern void Gia_ManTransferMapping( Gia_Man_t * p, Gia_Man_t * pGia ); +extern void Gia_ManTransferPacking( Gia_Man_t * p, Gia_Man_t * pGia ); +extern void Gia_ManTransferTiming( Gia_Man_t * p, Gia_Man_t * pGia ); +extern Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pIfPars ); extern Gia_Man_t * Gia_ManPerformSopBalance( Gia_Man_t * p, int nCutNum, int nRelaxRatio, int fVerbose ); extern Gia_Man_t * Gia_ManPerformDsdBalance( Gia_Man_t * p, int nLutSize, int nCutNum, int nRelaxRatio, int fVerbose ); /*=== giaJf.c ===========================================================*/ diff --git a/src/aig/gia/giaAig.c b/src/aig/gia/giaAig.c index 06c91853..23ffed99 100644 --- a/src/aig/gia/giaAig.c +++ b/src/aig/gia/giaAig.c @@ -559,7 +559,7 @@ Gia_Man_t * Gia_ManCompress2( Gia_Man_t * p, int fUpdateLevel, int fVerbose ) Aig_ManStop( pTemp ); pGia = Gia_ManFromAig( pNew ); Aig_ManStop( pNew ); - Gia_ManTransferTiming( p, pGia ); + Gia_ManTransferTiming( pGia, p ); return pGia; } @@ -585,7 +585,7 @@ Gia_Man_t * Gia_ManPerformDch( Gia_Man_t * p, void * pPars ) // pGia = Gia_ManFromAig( pNew ); pGia = Gia_ManFromAigChoices( pNew ); Aig_ManStop( pNew ); - Gia_ManTransferTiming( p, pGia ); + Gia_ManTransferTiming( pGia, p ); return pGia; } diff --git a/src/aig/gia/giaAiger.c b/src/aig/gia/giaAiger.c index e1833310..2fae2e34 100644 --- a/src/aig/gia/giaAiger.c +++ b/src/aig/gia/giaAiger.c @@ -1038,7 +1038,7 @@ void Gia_AigerWrite( Gia_Man_t * pInit, char * pFileName, int fWriteSymbols, int { // printf( "Gia_AigerWrite(): Normalizing AIG for writing.\n" ); p = Gia_ManDupNormalize( pInit ); - Gia_ManTransferTiming( pInit, p ); + Gia_ManTransferTiming( p, pInit ); p->vNamesIn = pInit->vNamesIn; pInit->vNamesIn = NULL; p->vNamesOut = pInit->vNamesOut; pInit->vNamesOut = NULL; p->nConstrs = pInit->nConstrs; pInit->nConstrs = 0; diff --git a/src/aig/gia/giaBalance.c b/src/aig/gia/giaBalance.c index 16d69920..2ea0f5d0 100644 --- a/src/aig/gia/giaBalance.c +++ b/src/aig/gia/giaBalance.c @@ -976,7 +976,7 @@ Gia_Man_t * Gia_ManAreaBalance( Gia_Man_t * p, int fSimpleAnd, int nNewNodesMax, pNew2 = Gia_ManDupNormalize( pNew1 = pNew2 ); Gia_ManStop( pNew1 ); } - Gia_ManTransferTiming( p, pNew2 ); + Gia_ManTransferTiming( pNew2, p ); return pNew2; } @@ -1031,7 +1031,7 @@ Gia_Man_t * Gia_ManAigSyn2( Gia_Man_t * pInit, int fOldAlgo, int fCoarsen, int f } if ( fVerbose ) Gia_ManPrintStats( pInit, NULL ); p = Gia_ManDup( pInit ); - Gia_ManTransferTiming( pInit, p ); + Gia_ManTransferTiming( p, pInit ); if ( Gia_ManAndNum(p) == 0 ) return p; // delay optimization diff --git a/src/aig/gia/giaFx.c b/src/aig/gia/giaFx.c index cd81aa54..9879b636 100644 --- a/src/aig/gia/giaFx.c +++ b/src/aig/gia/giaFx.c @@ -464,7 +464,7 @@ Gia_Man_t * Gia_ManPerformFx( Gia_Man_t * p, int nNewNodesMax, int LitCountMax, // Abc_PrintTime( 1, "Fx runtime", Abc_Clock() - clk ); // insert information pNew = Gia_ManFxInsert( p, vCubes, vCompl ); - Gia_ManTransferTiming( p, pNew ); + Gia_ManTransferTiming( pNew, p ); // cleanup Vec_WecFree( vCubes ); Vec_StrFree( vCompl ); diff --git a/src/aig/gia/giaIf.c b/src/aig/gia/giaIf.c index 4ed46e96..839fa4c1 100644 --- a/src/aig/gia/giaIf.c +++ b/src/aig/gia/giaIf.c @@ -1561,7 +1561,7 @@ void Gia_ManMappingVerify( Gia_Man_t * p ) SeeAlso [] ***********************************************************************/ -void Gia_ManTransferMapping( Gia_Man_t * pGia, Gia_Man_t * p ) +void Gia_ManTransferMapping( Gia_Man_t * p, Gia_Man_t * pGia ) { Gia_Obj_t * pObj; int i, k, iFan; @@ -1583,7 +1583,7 @@ void Gia_ManTransferMapping( Gia_Man_t * pGia, Gia_Man_t * p ) } Gia_ManMappingVerify( p ); } -void Gia_ManTransferPacking( Gia_Man_t * pGia, Gia_Man_t * p ) +void Gia_ManTransferPacking( Gia_Man_t * p, Gia_Man_t * pGia ) { Vec_Int_t * vPackingNew; Gia_Obj_t * pObj, * pObjNew; @@ -1617,7 +1617,7 @@ void Gia_ManTransferPacking( Gia_Man_t * pGia, Gia_Man_t * p ) assert( p->vPacking == NULL ); p->vPacking = vPackingNew; } -void Gia_ManTransferTiming( Gia_Man_t * pGia, Gia_Man_t * p ) +void Gia_ManTransferTiming( Gia_Man_t * p, Gia_Man_t * pGia ) { if ( pGia->pManTime == NULL ) return; @@ -1637,44 +1637,20 @@ void Gia_ManTransferTiming( Gia_Man_t * pGia, Gia_Man_t * p ) SeeAlso [] ***********************************************************************/ -Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pp, int fNormalized ) +Gia_Man_t * Gia_ManPerformMappingInt( Gia_Man_t * p, If_Par_t * pPars ) { extern void Gia_ManIffTest( Gia_Man_t * pGia, If_LibLut_t * pLib, int fVerbose ); Gia_Man_t * pNew; If_Man_t * pIfMan; - If_Par_t * pPars = (If_Par_t *)pp; + assert( pPars->pTimesArr == NULL ); + assert( pPars->pTimesReq == NULL ); // disable cut minimization when GIA strucure is needed if ( !pPars->fDelayOpt && !pPars->fDelayOptLut && !pPars->fDsdBalance && !pPars->fUserRecLib && !pPars->fDeriveLuts && !pPars->fUseDsd && !pPars->fUseTtPerm ) pPars->fCutMin = 0; - - // reconstruct GIA according to the hierarchy manager - assert( pPars->pTimesArr == NULL ); - assert( pPars->pTimesReq == NULL ); - if ( p->pManTime ) - { - if ( fNormalized ) - { - pNew = Gia_ManDupUnnormalize( p ); - if ( pNew == NULL ) - return NULL; - pNew->pManTime = p->pManTime; p->pManTime = NULL; - pNew->pAigExtra = p->pAigExtra; p->pAigExtra = NULL; - pNew->nAnd2Delay = p->nAnd2Delay; p->nAnd2Delay = 0; - p = pNew; - // set arrival and required times - pPars->pTimesArr = Tim_ManGetArrTimes( (Tim_Man_t *)p->pManTime ); - pPars->pTimesReq = Tim_ManGetReqTimes( (Tim_Man_t *)p->pManTime ); - } - } - else - p = Gia_ManDup( p ); // translate into the mapper pIfMan = Gia_ManToIf( p, pPars ); if ( pIfMan == NULL ) - { - Gia_ManStop( p ); return NULL; - } // create DSD manager if ( pPars->fUseDsd ) { @@ -1698,7 +1674,6 @@ Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pp, int fNormalized ) if ( !If_ManPerformMapping( pIfMan ) ) { If_ManStop( pIfMan ); - Gia_ManStop( p ); return NULL; } // transform the result of mapping into the new network @@ -1712,17 +1687,58 @@ Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pp, int fNormalized ) pNew->pName = Abc_UtilStrsav( p->pName ); pNew->pSpec = Abc_UtilStrsav( p->pSpec ); Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) ); - // return the original (unmodified by the mapper) timing manager - Gia_ManTransferTiming( p, pNew ); - Gia_ManStop( p ); - // normalize and transfer mapping - pNew = Gia_ManDupNormalize( p = pNew ); - Gia_ManTransferMapping( p, pNew ); - Gia_ManTransferPacking( p, pNew ); - Gia_ManTransferTiming( p, pNew ); - Gia_ManStop( p ); return pNew; } +Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pp ) +{ + Gia_Man_t * pNew; + if ( p->pManTime && Tim_ManBoxNum(p->pManTime) && Gia_ManIsNormalized(p) ) + { + Tim_Man_t * pTimOld = (Tim_Man_t *)p->pManTime; + p->pManTime = Tim_ManDup( pTimOld, 1 ); + pNew = Gia_ManDupUnnormalize( p ); + if ( pNew == NULL ) + return NULL; + Gia_ManTransferTiming( pNew, p ); + p = pNew; + // mapping + pNew = Gia_ManPerformMappingInt( p, (If_Par_t *)pp ); + if ( pNew != p ) + { + Gia_ManTransferTiming( pNew, p ); + Gia_ManStop( p ); + } + // normalize + pNew = Gia_ManDupNormalize( p = pNew ); + Gia_ManTransferMapping( pNew, p ); + Gia_ManTransferPacking( pNew, p ); + Gia_ManTransferTiming( pNew, p ); + Gia_ManStop( p ); + // cleanup + Tim_ManStop( (Tim_Man_t *)pNew->pManTime ); + pNew->pManTime = pTimOld; + assert( Gia_ManIsNormalized(pNew) ); + } + else + { + // mapping + pNew = Gia_ManPerformMappingInt( p, (If_Par_t *)pp ); + Gia_ManTransferTiming( pNew, p ); + } + return pNew; +} + +/**Function************************************************************* + + Synopsis [Interface of other mapping-based procedures.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ Gia_Man_t * Gia_ManPerformSopBalance( Gia_Man_t * p, int nCutNum, int nRelaxRatio, int fVerbose ) { Gia_Man_t * pNew; @@ -1742,7 +1758,7 @@ Gia_Man_t * Gia_ManPerformSopBalance( Gia_Man_t * p, int nCutNum, int nRelaxRati If_ManPerformMapping( pIfMan ); pNew = Gia_ManFromIfAig( pIfMan ); If_ManStop( pIfMan ); - Gia_ManTransferTiming( p, pNew ); + Gia_ManTransferTiming( pNew, p ); // transfer name assert( pNew->pName == NULL ); pNew->pName = Abc_UtilStrsav( p->pName ); @@ -1775,7 +1791,7 @@ Gia_Man_t * Gia_ManPerformDsdBalance( Gia_Man_t * p, int nLutSize, int nCutNum, If_ManPerformMapping( pIfMan ); pNew = Gia_ManFromIfAig( pIfMan ); If_ManStop( pIfMan ); - Gia_ManTransferTiming( p, pNew ); + Gia_ManTransferTiming( pNew, p ); // transfer name assert( pNew->pName == NULL ); pNew->pName = Abc_UtilStrsav( p->pName ); diff --git a/src/aig/gia/giaSweep.c b/src/aig/gia/giaSweep.c index d8bafca9..0094de88 100644 --- a/src/aig/gia/giaSweep.c +++ b/src/aig/gia/giaSweep.c @@ -328,7 +328,7 @@ Gia_Man_t * Gia_ManFraigSweep( Gia_Man_t * p, void * pPars ) Gia_ManStop( pTemp ); // normalize the result pNew = Gia_ManDupNormalize( pTemp = pNew ); - Gia_ManTransferTiming( pTemp, pNew ); + Gia_ManTransferTiming( pNew, pTemp ); Gia_ManStop( pTemp ); // return the result assert( pNew->pManTime != NULL ); |