summaryrefslogtreecommitdiffstats
path: root/src/aig/gia
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2014-06-23 18:05:51 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2014-06-23 18:05:51 -0700
commit2edf2a970ee3663ef0725f22972a10083ed81fbf (patch)
tree2402fa5950e37128a19d279a52cffdd4613cfa52 /src/aig/gia
parentf79d8e4b0443bda2249735e34545ed2197cbe5ea (diff)
downloadabc-2edf2a970ee3663ef0725f22972a10083ed81fbf.tar.gz
abc-2edf2a970ee3663ef0725f22972a10083ed81fbf.tar.bz2
abc-2edf2a970ee3663ef0725f22972a10083ed81fbf.zip
Improvements to power-aware mapping.
Diffstat (limited to 'src/aig/gia')
-rw-r--r--src/aig/gia/gia.h1
-rw-r--r--src/aig/gia/giaMan.c14
-rw-r--r--src/aig/gia/giaMuxes.c2
-rw-r--r--src/aig/gia/giaSwitch.c24
4 files changed, 34 insertions, 7 deletions
diff --git a/src/aig/gia/gia.h b/src/aig/gia/gia.h
index ac0529ce..0dd657aa 100644
--- a/src/aig/gia/gia.h
+++ b/src/aig/gia/gia.h
@@ -199,6 +199,7 @@ struct Gps_Par_t_
int fLutProf;
int fMuxXor;
int fMiter;
+ int fSkipMap;
char * pDumpFile;
};
diff --git a/src/aig/gia/giaMan.c b/src/aig/gia/giaMan.c
index 51a78472..b229b189 100644
--- a/src/aig/gia/giaMan.c
+++ b/src/aig/gia/giaMan.c
@@ -430,10 +430,14 @@ void Gia_ManPrintStats( Gia_Man_t * p, Gps_Par_t * pPars )
printf( "\nXOR/MUX " ), Gia_ManPrintMuxStats( p );
if ( pPars && pPars->fSwitch )
{
-// if ( p->pSwitching )
-// Abc_Print( 1, " power =%7.2f", Gia_ManEvaluateSwitching(p) );
-// else
- Abc_Print( 1, " power =%7.2f", Gia_ManComputeSwitching(p, 48, 16, 0) );
+ static int nPiPo = 0;
+ static float PrevSwiTotal = 0;
+ float SwiTotal = Gia_ManComputeSwitching( p, 48, 16, 0 );
+ Abc_Print( 1, " power =%8.1f", SwiTotal );
+ if ( PrevSwiTotal > 0 && nPiPo == Gia_ManCiNum(p) + Gia_ManCoNum(p) )
+ Abc_Print( 1, " %6.2f %%", 100.0*(PrevSwiTotal-SwiTotal)/PrevSwiTotal );
+ else if ( PrevSwiTotal == 0 || nPiPo != Gia_ManCiNum(p) + Gia_ManCoNum(p) )
+ PrevSwiTotal = SwiTotal, nPiPo = Gia_ManCiNum(p) + Gia_ManCoNum(p);
}
// Abc_Print( 1, "obj =%5d ", Gia_ManObjNum(p) );
Abc_Print( 1, "\n" );
@@ -443,7 +447,7 @@ void Gia_ManPrintStats( Gia_Man_t * p, Gps_Par_t * pPars )
Gia_ManEquivPrintClasses( p, 0, 0.0 );
if ( p->pSibls )
Gia_ManPrintChoiceStats( p );
- if ( Gia_ManHasMapping(p) )
+ if ( Gia_ManHasMapping(p) && (pPars == NULL || !pPars->fSkipMap) )
Gia_ManPrintMappingStats( p, pPars ? pPars->pDumpFile : NULL );
if ( pPars && pPars->fNpn && Gia_ManHasMapping(p) && Gia_ManLutSizeMax(p) <= 4 )
Gia_ManPrintNpnClasses( p );
diff --git a/src/aig/gia/giaMuxes.c b/src/aig/gia/giaMuxes.c
index 7834fdea..897f3388 100644
--- a/src/aig/gia/giaMuxes.c
+++ b/src/aig/gia/giaMuxes.c
@@ -562,7 +562,7 @@ void Gia_ManMuxProfiling( Gia_Man_t * p )
// short the first ones
printf( "The first %d structures: \n", 10 );
- Vec_WecForEachLevelStartStop( pMan->vTops, vVec, i, 1, 10 )
+ Vec_WecForEachLevelStartStop( pMan->vTops, vVec, i, 1, Abc_MinInt(Vec_WecSize(pMan->vTops), 10) )
{
char * pTemp = Abc_NamStr(pMan->pNames, i);
printf( "%5d : ", i );
diff --git a/src/aig/gia/giaSwitch.c b/src/aig/gia/giaSwitch.c
index e5b1eb22..58acbb69 100644
--- a/src/aig/gia/giaSwitch.c
+++ b/src/aig/gia/giaSwitch.c
@@ -80,7 +80,7 @@ void Gia_ManSetDefaultParamsSwi( Gia_ParSwi_t * p )
p->nWords = 10; // the number of machine words of simulatation data
p->nIters = 48; // the number of all timeframes to simulate
p->nPref = 16; // the number of first timeframes to skip when computing switching
- p->nRandPiFactor = 2; // primary input transition probability (-1=3/8; 0=1/2; 1=1/4; 2=1/8, etc)
+ p->nRandPiFactor = 0; // primary input transition probability (-1=3/8; 0=1/2; 1=1/4; 2=1/8, etc)
p->fProbOne = 0; // compute probability of signal being one (if 0, compute probability of switching)
p->fProbTrans = 1; // compute signal transition probability (if 0, compute transition probability using probability of being one)
p->fVerbose = 0; // enables verbose output
@@ -740,6 +740,7 @@ float Gia_ManEvaluateSwitching( Gia_Man_t * p )
SeeAlso []
***********************************************************************/
+/*
float Gia_ManComputeSwitching( Gia_Man_t * p, int nFrames, int nPref, int fProbOne )
{
Gia_Man_t * pDfs;
@@ -776,6 +777,27 @@ float Gia_ManComputeSwitching( Gia_Man_t * p, int nFrames, int nPref, int fProbO
Gia_ManStop( pDfs );
return SwitchTotal;
}
+*/
+float Gia_ManComputeSwitching( Gia_Man_t * p, int nFrames, int nPref, int fProbOne )
+{
+ Vec_Int_t * vSwitching = Gia_ManComputeSwitchProbs( p, nFrames, nPref, fProbOne );
+ float * pSwi = (float *)Vec_IntArray(vSwitching), SwiTotal = 0;
+ Gia_Obj_t * pObj;
+ int i, k, iFan;
+ if ( Gia_ManHasMapping(p) )
+ {
+ Gia_ManForEachLut( p, i )
+ Gia_LutForEachFanin( p, i, iFan, k )
+ SwiTotal += pSwi[iFan];
+ }
+ else
+ {
+ Gia_ManForEachAnd( p, pObj, i )
+ SwiTotal += pSwi[Gia_ObjFaninId0(pObj, i)] + pSwi[Gia_ObjFaninId1(pObj, i)];
+ }
+ Vec_IntFree( vSwitching );
+ return SwiTotal;
+}
/**Function*************************************************************