mirror of https://github.com/YosysHQ/abc.git
Improving switching activity computation.
This commit is contained in:
parent
efc1c8588e
commit
15a356fa4d
|
|
@ -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 );
|
||||
|
|
|
|||
|
|
@ -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 ) )
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue