summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2013-12-26 17:14:40 +0700
committerAlan Mishchenko <alanmi@berkeley.edu>2013-12-26 17:14:40 +0700
commit15a356fa4dd1dddd6a42702f0431fe0aa773516d (patch)
tree12df466309fbdc148c82168109eeec9ded7936fe /src
parentefc1c8588e674d4bd4df1aaaa81f2892da56e0f7 (diff)
downloadabc-15a356fa4dd1dddd6a42702f0431fe0aa773516d.tar.gz
abc-15a356fa4dd1dddd6a42702f0431fe0aa773516d.tar.bz2
abc-15a356fa4dd1dddd6a42702f0431fe0aa773516d.zip
Improving switching activity computation.
Diffstat (limited to 'src')
-rw-r--r--src/aig/gia/gia.h2
-rw-r--r--src/aig/gia/giaIf.c11
-rw-r--r--src/aig/gia/giaMan.c1
-rw-r--r--src/aig/gia/giaSwitch.c39
4 files changed, 26 insertions, 27 deletions
diff --git a/src/aig/gia/gia.h b/src/aig/gia/gia.h
index c6ace8db..addf27f3 100644
--- a/src/aig/gia/gia.h
+++ b/src/aig/gia/gia.h
@@ -145,6 +145,7 @@ struct Gia_Man_t_
Gia_Man_t * pAigExtra; // combinational logic of holes
Vec_Flt_t * vInArrs; // PI arrival times
Vec_Flt_t * vOutReqs; // PO required times
+ Vec_Int_t * vSwitching; // switching activity
int * pTravIds; // separate traversal ID representation
int nTravIdsAlloc; // the number of trav IDs allocated
Vec_Ptr_t * vNamesIn; // the input names
@@ -1201,6 +1202,7 @@ extern int Gia_SweeperRun( Gia_Man_t * p, Vec_Int_t * vProbeIds,
/*=== giaSwitch.c ============================================================*/
extern float Gia_ManEvaluateSwitching( Gia_Man_t * p );
extern float Gia_ManComputeSwitching( Gia_Man_t * p, int nFrames, int nPref, int fProbOne );
+extern Vec_Int_t * Gia_ManComputeSwitchProbs( Gia_Man_t * pGia, int nFrames, int nPref, int fProbOne );
/*=== giaTim.c ===========================================================*/
extern Gia_Man_t * Gia_ManDupNormalize( Gia_Man_t * p );
extern Gia_Man_t * Gia_ManDupUnnormalize( Gia_Man_t * p );
diff --git a/src/aig/gia/giaIf.c b/src/aig/gia/giaIf.c
index 1733b4b2..51668cba 100644
--- a/src/aig/gia/giaIf.c
+++ b/src/aig/gia/giaIf.c
@@ -1496,6 +1496,17 @@ Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pp, int fNormalized )
Gia_ManStop( p );
return NULL;
}
+ // compute switching for the IF objects
+ if ( pPars->fPower )
+ {
+ Gia_Obj_t * pObj; int i;
+ assert( pIfMan->vSwitching == NULL );
+ pIfMan->vSwitching = Vec_IntStart( If_ManObjNum(pIfMan) );
+ Gia_ManForEachObj( p, pObj, i )
+ if ( ~Gia_ObjValue(pObj) )
+ Vec_IntWriteEntry( pIfMan->vSwitching, Gia_ObjValue(pObj), Vec_IntEntry(p->vSwitching, i) );
+// Vec_IntFreeP( &p->vSwitching );
+ }
if ( p->pManTime )
pIfMan->pManTim = Tim_ManDup( (Tim_Man_t *)p->pManTime, 0 );
if ( !If_ManPerformMapping( pIfMan ) )
diff --git a/src/aig/gia/giaMan.c b/src/aig/gia/giaMan.c
index 71becf0b..00ab594e 100644
--- a/src/aig/gia/giaMan.c
+++ b/src/aig/gia/giaMan.c
@@ -79,6 +79,7 @@ void Gia_ManStop( Gia_Man_t * p )
assert( p->pManTime == NULL );
Vec_PtrFreeFree( p->vNamesIn );
Vec_PtrFreeFree( p->vNamesOut );
+ Vec_IntFreeP( &p->vSwitching );
Vec_IntFreeP( &p->vSuper );
Vec_IntFreeP( &p->vStore );
Vec_IntFreeP( &p->vClassNew );
diff --git a/src/aig/gia/giaSwitch.c b/src/aig/gia/giaSwitch.c
index d5307461..18ff0a89 100644
--- a/src/aig/gia/giaSwitch.c
+++ b/src/aig/gia/giaSwitch.c
@@ -655,13 +655,9 @@ Vec_Int_t * Gia_ManSwiSimulate( Gia_Man_t * pAig, Gia_ParSwi_t * pPars )
SeeAlso []
***********************************************************************/
-Vec_Int_t * Saig_ManComputeSwitchProbs( Aig_Man_t * pAig, int nFrames, int nPref, int fProbOne )
+Vec_Int_t * Gia_ManComputeSwitchProbs( Gia_Man_t * pGia, int nFrames, int nPref, int fProbOne )
{
Gia_ParSwi_t Pars, * pPars = &Pars;
- Vec_Int_t * vSwitching, * vResult;
- Gia_Man_t * p;
- Aig_Obj_t * pObj;
- int i;
// set the default parameters
Gia_ManSetDefaultParamsSwi( pPars );
// override some of the defaults
@@ -682,10 +678,19 @@ Vec_Int_t * Saig_ManComputeSwitchProbs( Aig_Man_t * pAig, int nFrames, int nPref
pPars->fProbOne = 0; // disable computing probabiblity of being one
pPars->fProbTrans = 1; // enable computing transition probability
}
+ // perform the computation of switching activity
+ return Gia_ManSwiSimulate( pGia, pPars );
+}
+Vec_Int_t * Saig_ManComputeSwitchProbs( Aig_Man_t * pAig, int nFrames, int nPref, int fProbOne )
+{
+ Vec_Int_t * vSwitching, * vResult;
+ Gia_Man_t * p;
+ Aig_Obj_t * pObj;
+ int i;
// translate AIG into the intermediate form (takes care of choices if present!)
p = Gia_ManFromAigSwitch( pAig );
// perform the computation of switching activity
- vSwitching = Gia_ManSwiSimulate( p, pPars );
+ vSwitching = Gia_ManComputeSwitchProbs( p, nFrames, nPref, fProbOne );
// transfer the computed result to the original AIG
vResult = Vec_IntStart( Aig_ManObjNumMax(pAig) );
Aig_ManForEachObj( pAig, pObj, i )
@@ -742,33 +747,13 @@ float Gia_ManComputeSwitching( Gia_Man_t * p, int nFrames, int nPref, int fProbO
Vec_Int_t * vSwitching;
float * pSwitching, Switch, SwitchTotal = 0.0;//, SwitchTotal2 = 0.0;
int i;
- Gia_ParSwi_t Pars, * pPars = &Pars;
- ABC_FREE( p->pSwitching );
- // set the default parameters
- Gia_ManSetDefaultParamsSwi( pPars );
- // override some of the defaults
- pPars->nIters = nFrames; // set number of total timeframes
- pPars->nPref = nPref; // set number of first timeframes to skip
- // decide what should be computed
- if ( fProbOne )
- {
- // if the user asked to compute propability of 1, we do not need transition information
- pPars->fProbOne = 1; // enable computing probabiblity of being one
- pPars->fProbTrans = 0; // disable computing transition probability
- }
- else
- {
- // if the user asked for transition propabability, we do not need to compute probability of 1
- pPars->fProbOne = 0; // disable computing probabiblity of being one
- pPars->fProbTrans = 1; // enable computing transition probability
- }
// derives the DFS ordered AIG
Gia_ManCreateRefs( p );
// pDfs = Gia_ManDupOrderDfs( p );
pDfs = Gia_ManDup( p );
assert( Gia_ManObjNum(pDfs) == Gia_ManObjNum(p) );
// perform the computation of switching activity
- vSwitching = Gia_ManSwiSimulate( pDfs, pPars );
+ vSwitching = Gia_ManComputeSwitchProbs( pDfs, nFrames, nPref, fProbOne );
// transfer the computed result to the original AIG
p->pSwitching = ABC_CALLOC( unsigned char, Gia_ManObjNum(p) );
pSwitching = (float *)vSwitching->pArray;