summaryrefslogtreecommitdiffstats
path: root/src/aig/gia
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2014-08-25 16:55:39 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2014-08-25 16:55:39 -0700
commit47dde4e4789c4c068f3c8ebe77a5a629da48936b (patch)
treebf6af774173dedb5470dd376af14883ee2868e71 /src/aig/gia
parentcbbf78e6f4d8acd32b0afcdc0e4e87bc318a2590 (diff)
downloadabc-47dde4e4789c4c068f3c8ebe77a5a629da48936b.tar.gz
abc-47dde4e4789c4c068f3c8ebe77a5a629da48936b.tar.bz2
abc-47dde4e4789c4c068f3c8ebe77a5a629da48936b.zip
Correcting incorrect handling of timing in several &-commands.
Diffstat (limited to 'src/aig/gia')
-rw-r--r--src/aig/gia/gia.h5
-rw-r--r--src/aig/gia/giaBalance.c42
-rw-r--r--src/aig/gia/giaFx.c1
-rw-r--r--src/aig/gia/giaIf.c9
-rw-r--r--src/aig/gia/giaSopb.c41
5 files changed, 55 insertions, 43 deletions
diff --git a/src/aig/gia/gia.h b/src/aig/gia/gia.h
index d7ad4300..7dc209a7 100644
--- a/src/aig/gia/gia.h
+++ b/src/aig/gia/gia.h
@@ -1188,7 +1188,7 @@ extern void Gia_ManTransferPacking( Gia_Man_t * pGia, Gia_Man_t *
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 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 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 ===========================================================*/
extern void Jf_ManSetDefaultPars( Jf_Par_t * pPars );
extern Gia_Man_t * Jf_ManPerformMapping( Gia_Man_t * pGia, Jf_Par_t * pPars );
@@ -1262,8 +1262,9 @@ extern Gia_Man_t * Gia_ManSeqStructSweep( Gia_Man_t * p, int fConst, int
extern Gia_Man_t * Gia_ManMapShrink4( Gia_Man_t * p, int fKeepLevel, int fVerbose );
extern Gia_Man_t * Gia_ManMapShrink6( Gia_Man_t * p, int nFanoutMax, int fKeepLevel, int fVerbose );
/*=== giaSopb.c ============================================================*/
-extern Gia_Man_t * Gia_ManPerformSopBalanceWin( Gia_Man_t * p, int LevelMax, int nTimeWindow, int nCutNum, int nRelaxRatio, int fVerbose );
extern Gia_Man_t * Gia_ManExtractWindow( Gia_Man_t * p, int LevelMax, int nTimeWindow, int fVerbose );
+extern Gia_Man_t * Gia_ManPerformSopBalanceWin( Gia_Man_t * p, int LevelMax, int nTimeWindow, int nCutNum, int nRelaxRatio, int fVerbose );
+extern Gia_Man_t * Gia_ManPerformDsdBalanceWin( Gia_Man_t * p, int LevelMax, int nTimeWindow, int nLutSize, int nCutNum, int nRelaxRatio, int fVerbose );
/*=== giaSort.c ============================================================*/
extern int * Gia_SortFloats( float * pArray, int * pPerm, int nSize );
/*=== giaSim.c ============================================================*/
diff --git a/src/aig/gia/giaBalance.c b/src/aig/gia/giaBalance.c
index 918b3009..16d69920 100644
--- a/src/aig/gia/giaBalance.c
+++ b/src/aig/gia/giaBalance.c
@@ -976,6 +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 );
return pNew2;
}
@@ -998,19 +999,6 @@ void Gia_ManAigPrintPiLevels( Gia_Man_t * p )
printf( "%d ", Gia_ObjLevel(p, pObj) );
printf( "\n" );
}
-void Gia_ManAigTransferPiLevels( Gia_Man_t * pNew, Gia_Man_t * p )
-{
-/*
- Gia_Obj_t * pObj;
- int i;
- if ( p->vLevels == NULL )
- return;
- Gia_ManCleanLevels( pNew, Gia_ManObjNum(pNew) );
- Gia_ManForEachCi( pNew, pObj, i )
- Gia_ObjSetLevel( pNew, pObj, Gia_ObjLevel(p, Gia_ManCi(p, i)) );
-*/
- if ( p->pManTime ) pNew->pManTime = p->pManTime, p->pManTime = NULL;
-}
/**Function*************************************************************
@@ -1023,9 +1011,9 @@ void Gia_ManAigTransferPiLevels( Gia_Man_t * pNew, Gia_Man_t * p )
SeeAlso []
***********************************************************************/
-Gia_Man_t * Gia_ManAigSyn2( Gia_Man_t * p, int fOldAlgo, int fCoarsen, int fCutMin, int nRelaxRatio, int fDelayMin, int fVerbose, int fVeryVerbose )
+Gia_Man_t * Gia_ManAigSyn2( Gia_Man_t * pInit, int fOldAlgo, int fCoarsen, int fCutMin, int nRelaxRatio, int fDelayMin, int fVerbose, int fVeryVerbose )
{
- Gia_Man_t * pNew, * pTemp;
+ Gia_Man_t * p, * pNew, * pTemp;
Jf_Par_t Pars, * pPars = &Pars;
if ( fOldAlgo )
{
@@ -1041,13 +1029,13 @@ Gia_Man_t * Gia_ManAigSyn2( Gia_Man_t * p, int fOldAlgo, int fCoarsen, int fCutM
pPars->nAreaTuner = 1;
pPars->nCutNum = 4;
}
- if ( fVerbose ) Gia_ManPrintStats( p, NULL );
- p = Gia_ManDup( pTemp = p );
- Gia_ManAigTransferPiLevels( p, pTemp );
+ if ( fVerbose ) Gia_ManPrintStats( pInit, NULL );
+ p = Gia_ManDup( pInit );
+ Gia_ManTransferTiming( pInit, p );
if ( Gia_ManAndNum(p) == 0 )
return p;
// delay optimization
- if ( fDelayMin )
+ if ( fDelayMin && p->pManTime == NULL )
{
int Area0, Area1, Delay0, Delay1;
int fCutMin = pPars->fCutMin;
@@ -1064,7 +1052,7 @@ Gia_Man_t * Gia_ManAigSyn2( Gia_Man_t * p, int fOldAlgo, int fCoarsen, int fCutM
Area0 = (int)pPars->Area;
Delay0 = (int)pPars->Delay;
// perform balancing
- pNew = Gia_ManPerformDsdBalance( p, 4, 0, 0 );
+ pNew = Gia_ManPerformDsdBalance( p, 6, 4, 0, 0 );
// perform mapping again
if ( fOldAlgo )
Jf_ManPerformMapping( pNew, pPars );
@@ -1075,7 +1063,6 @@ Gia_Man_t * Gia_ManAigSyn2( Gia_Man_t * p, int fOldAlgo, int fCoarsen, int fCutM
// choose the best result
if ( Delay1 < Delay0 - 1 || (Delay1 == Delay0 + 1 && 100.0 * (Area1 - Area0) / Area1 < 3.0) )
{
- Gia_ManAigTransferPiLevels( pNew, p );
Gia_ManStop( p );
p = pNew;
}
@@ -1092,7 +1079,6 @@ Gia_Man_t * Gia_ManAigSyn2( Gia_Man_t * p, int fOldAlgo, int fCoarsen, int fCutM
// perform balancing
pNew = Gia_ManAreaBalance( p, 0, ABC_INFINITY, fVeryVerbose, 0 );
if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
- Gia_ManAigTransferPiLevels( pNew, p );
Gia_ManStop( p );
// perform mapping
if ( fOldAlgo )
@@ -1101,14 +1087,10 @@ Gia_Man_t * Gia_ManAigSyn2( Gia_Man_t * p, int fOldAlgo, int fCoarsen, int fCutM
pNew = Lf_ManPerformMapping( pTemp = pNew, pPars );
if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
if ( pTemp != pNew )
- {
- Gia_ManAigTransferPiLevels( pNew, pTemp );
Gia_ManStop( pTemp );
- }
// perform balancing
pNew = Gia_ManAreaBalance( pTemp = pNew, 0, ABC_INFINITY, fVeryVerbose, 0 );
if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
- Gia_ManAigTransferPiLevels( pNew, pTemp );
Gia_ManStop( pTemp );
return pNew;
}
@@ -1124,7 +1106,6 @@ Gia_Man_t * Gia_ManAigSyn3( Gia_Man_t * p, int fVerbose, int fVeryVerbose )
// perform balancing
pNew = Gia_ManAreaBalance( p, 0, ABC_INFINITY, fVeryVerbose, 0 );
if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
- Gia_ManAigTransferPiLevels( pNew, p );
// perform mapping
pPars->nLutSize = 6;
pNew = Jf_ManPerformMapping( pTemp = pNew, pPars );
@@ -1133,7 +1114,6 @@ Gia_Man_t * Gia_ManAigSyn3( Gia_Man_t * p, int fVerbose, int fVeryVerbose )
// perform balancing
pNew = Gia_ManAreaBalance( pTemp = pNew, 0, ABC_INFINITY, fVeryVerbose, 0 );
if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
- Gia_ManAigTransferPiLevels( pNew, pTemp );
Gia_ManStop( pTemp );
// perform mapping
pPars->nLutSize = 4;
@@ -1143,7 +1123,6 @@ Gia_Man_t * Gia_ManAigSyn3( Gia_Man_t * p, int fVerbose, int fVeryVerbose )
// perform balancing
pNew = Gia_ManAreaBalance( pTemp = pNew, 0, ABC_INFINITY, fVeryVerbose, 0 );
if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
- Gia_ManAigTransferPiLevels( pNew, pTemp );
Gia_ManStop( pTemp );
return pNew;
}
@@ -1160,7 +1139,6 @@ Gia_Man_t * Gia_ManAigSyn4( Gia_Man_t * p, int fVerbose, int fVeryVerbose )
// perform balancing
pNew = Gia_ManAreaBalance( p, 0, ABC_INFINITY, fVeryVerbose, 0 );
if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
- Gia_ManAigTransferPiLevels( pNew, p );
// perform mapping
pPars->nLutSize = 7;
pNew = Jf_ManPerformMapping( pTemp = pNew, pPars );
@@ -1169,12 +1147,10 @@ Gia_Man_t * Gia_ManAigSyn4( Gia_Man_t * p, int fVerbose, int fVeryVerbose )
// perform extraction
pNew = Gia_ManPerformFx( pTemp = pNew, ABC_INFINITY, 0, 0, fVeryVerbose, 0 );
if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
- Gia_ManAigTransferPiLevels( pNew, pTemp );
Gia_ManStop( pTemp );
// perform balancing
pNew = Gia_ManAreaBalance( pTemp = pNew, 0, ABC_INFINITY, fVeryVerbose, 0 );
if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
- Gia_ManAigTransferPiLevels( pNew, pTemp );
Gia_ManStop( pTemp );
// perform mapping
pPars->nLutSize = 5;
@@ -1184,12 +1160,10 @@ Gia_Man_t * Gia_ManAigSyn4( Gia_Man_t * p, int fVerbose, int fVeryVerbose )
// perform extraction
pNew = Gia_ManPerformFx( pTemp = pNew, ABC_INFINITY, 0, 0, fVeryVerbose, 0 );
if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
- Gia_ManAigTransferPiLevels( pNew, pTemp );
Gia_ManStop( pTemp );
// perform balancing
pNew = Gia_ManAreaBalance( pTemp = pNew, 0, ABC_INFINITY, fVeryVerbose, 0 );
if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
- Gia_ManAigTransferPiLevels( pNew, pTemp );
Gia_ManStop( pTemp );
//Gia_ManAigPrintPiLevels( pNew );
return pNew;
diff --git a/src/aig/gia/giaFx.c b/src/aig/gia/giaFx.c
index 7c5ae010..cd81aa54 100644
--- a/src/aig/gia/giaFx.c
+++ b/src/aig/gia/giaFx.c
@@ -464,6 +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 );
// cleanup
Vec_WecFree( vCubes );
Vec_StrFree( vCompl );
diff --git a/src/aig/gia/giaIf.c b/src/aig/gia/giaIf.c
index 6e04efd4..4ed46e96 100644
--- a/src/aig/gia/giaIf.c
+++ b/src/aig/gia/giaIf.c
@@ -1619,12 +1619,13 @@ void Gia_ManTransferPacking( Gia_Man_t * pGia, Gia_Man_t * p )
}
void Gia_ManTransferTiming( Gia_Man_t * pGia, Gia_Man_t * p )
{
+ if ( pGia->pManTime == NULL )
+ return;
p->pManTime = pGia->pManTime; pGia->pManTime = NULL;
p->pAigExtra = pGia->pAigExtra; pGia->pAigExtra = NULL;
p->nAnd2Delay = pGia->nAnd2Delay; pGia->nAnd2Delay = 0;
}
-
/**Function*************************************************************
Synopsis [Interface of LUT mapping package.]
@@ -1741,6 +1742,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 );
// transfer name
assert( pNew->pName == NULL );
pNew->pName = Abc_UtilStrsav( p->pName );
@@ -1748,7 +1750,7 @@ Gia_Man_t * Gia_ManPerformSopBalance( Gia_Man_t * p, int nCutNum, int nRelaxRati
Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
return pNew;
}
-Gia_Man_t * Gia_ManPerformDsdBalance( Gia_Man_t * p, int nCutNum, int nRelaxRatio, int fVerbose )
+Gia_Man_t * Gia_ManPerformDsdBalance( Gia_Man_t * p, int nLutSize, int nCutNum, int nRelaxRatio, int fVerbose )
{
Gia_Man_t * pNew;
If_Man_t * pIfMan;
@@ -1757,7 +1759,7 @@ Gia_Man_t * Gia_ManPerformDsdBalance( Gia_Man_t * p, int nCutNum, int nRelaxRati
pPars->nCutsMax = nCutNum;
pPars->nRelaxRatio = nRelaxRatio;
pPars->fVerbose = fVerbose;
- pPars->nLutSize = 6;
+ pPars->nLutSize = nLutSize;
pPars->fDsdBalance = 1;
pPars->fUseDsd = 1;
pPars->fCutMin = 1;
@@ -1773,6 +1775,7 @@ Gia_Man_t * Gia_ManPerformDsdBalance( Gia_Man_t * p, int nCutNum, int nRelaxRati
If_ManPerformMapping( pIfMan );
pNew = Gia_ManFromIfAig( pIfMan );
If_ManStop( pIfMan );
+ Gia_ManTransferTiming( p, pNew );
// transfer name
assert( pNew->pName == NULL );
pNew->pName = Abc_UtilStrsav( p->pName );
diff --git a/src/aig/gia/giaSopb.c b/src/aig/gia/giaSopb.c
index 318e9bd9..b285daea 100644
--- a/src/aig/gia/giaSopb.c
+++ b/src/aig/gia/giaSopb.c
@@ -233,6 +233,35 @@ Vec_Int_t * Gia_ManFindLatest( Gia_Man_t * p, int LevelMax, int nTimeWindow )
SeeAlso []
***********************************************************************/
+Gia_Man_t * Gia_ManExtractWindow( Gia_Man_t * p, int LevelMax, int nTimeWindow, int fVerbose )
+{
+ Vec_Int_t * vOuts;
+ Gia_Man_t * pWin;
+ assert( !LevelMax != !nTimeWindow );
+ vOuts = Gia_ManFindLatest( p, LevelMax, nTimeWindow );
+ if ( fVerbose )
+ printf( "Collected %d outputs to extract.\n", Vec_IntSize(vOuts) );
+ if ( Vec_IntSize(vOuts) == 0 )
+ {
+ Vec_IntFree( vOuts );
+ return Gia_ManDup( p );
+ }
+ pWin = Gia_ManExtractWin( p, vOuts, 1 );
+ Vec_IntFree( vOuts );
+ return pWin;
+}
+
+/**Function*************************************************************
+
+ Synopsis []
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
Gia_Man_t * Gia_ManPerformSopBalanceWin( Gia_Man_t * p, int LevelMax, int nTimeWindow, int nCutNum, int nRelaxRatio, int fVerbose )
{
Vec_Int_t * vOuts;
@@ -266,10 +295,10 @@ Gia_Man_t * Gia_ManPerformSopBalanceWin( Gia_Man_t * p, int LevelMax, int nTimeW
SeeAlso []
***********************************************************************/
-Gia_Man_t * Gia_ManExtractWindow( Gia_Man_t * p, int LevelMax, int nTimeWindow, int fVerbose )
+Gia_Man_t * Gia_ManPerformDsdBalanceWin( Gia_Man_t * p, int LevelMax, int nTimeWindow, int nLutSize, int nCutNum, int nRelaxRatio, int fVerbose )
{
Vec_Int_t * vOuts;
- Gia_Man_t * pWin;
+ Gia_Man_t * pNew, * pWin, * pWinNew;
assert( !LevelMax != !nTimeWindow );
vOuts = Gia_ManFindLatest( p, LevelMax, nTimeWindow );
if ( fVerbose )
@@ -279,9 +308,13 @@ Gia_Man_t * Gia_ManExtractWindow( Gia_Man_t * p, int LevelMax, int nTimeWindow,
Vec_IntFree( vOuts );
return Gia_ManDup( p );
}
- pWin = Gia_ManExtractWin( p, vOuts, 1 );
+ pWin = Gia_ManExtractWin( p, vOuts, 0 );
+ pWinNew = Gia_ManPerformDsdBalance( pWin, nLutSize, nCutNum, nRelaxRatio, fVerbose );
+ Gia_ManStop( pWin );
+ pNew = Gia_ManInsertWin( p, vOuts, pWinNew );
+ Gia_ManStop( pWinNew );
Vec_IntFree( vOuts );
- return pWin;
+ return pNew;
}
////////////////////////////////////////////////////////////////////////