106 Vec_Int_t * vSwitching = NULL, * vSwitching2 = NULL;
107 float * pSwitching = NULL, * pSwitching2 = NULL;
120 ABC_PRT(
"Computing switching activity", Abc_Clock() - clk );
122 pSwitching = (
float *)vSwitching->pArray;
123 vSwitching2 = Vec_IntStart( Aig_ManObjNumMax(
p) );
124 pSwitching2 = (
float *)vSwitching2->pArray;
132 if ( Aig_ObjIsAnd(pNode) )
135 If_NotCond( (
If_Obj_t *)Aig_ObjFanin0(pNode)->pData, Aig_ObjFaninC0(pNode) ),
136 If_NotCond( (
If_Obj_t *)Aig_ObjFanin1(pNode)->pData, Aig_ObjFaninC1(pNode) ) );
139 else if ( Aig_ObjIsCi(pNode) )
142 If_ObjSetLevel( pIfObj, Aig_ObjLevel(pNode) );
147 else if ( Aig_ObjIsCo(pNode) )
149 pIfObj =
If_ManCreateCo( pIfMan, If_NotCond( (
If_Obj_t *)Aig_ObjFanin0(pNode)->pData, Aig_ObjFaninC0(pNode) ) );
152 else if ( Aig_ObjIsConst1(pNode) )
153 pIfObj = If_ManConst1( pIfMan );
157 assert( Vec_PtrEntry(vAigToIf, i) == NULL );
158 Vec_PtrWriteEntry( vAigToIf, i, pIfObj );
159 pNode->
pData = pIfObj;
161 pSwitching2[pIfObj->
Id] = pSwitching[pNode->
Id];
163 if ( Aig_ObjIsChoice(
p, pNode ) )
165 for ( pPrev = pNode, pFanin = Aig_ObjEquiv(
p, pNode); pFanin; pPrev = pFanin, pFanin = Aig_ObjEquiv(
p, pFanin) )
172 Vec_IntFree( vSwitching );
194 pCut = If_ObjCutBest(pIfObj);
196 if ( If_CutData(pCut) )
199 Vec_PtrPush( vVisited, pCut );
201 If_CutSetData( pCut, (
void *)1 );
203 if ( If_ObjIsCi(pIfObj) )
206 for ( pTemp = pIfObj; pTemp; pTemp = pTemp->
pEquiv )
209 if ( gFunc0 == (
void *)1 )
212 if ( gFunc1 == (
void *)1 )
215 gFunc =
Hop_And( pHopMan, Hop_NotCond(gFunc0, pTemp->
fCompl0), Hop_NotCond(gFunc1, pTemp->
fCompl1) );
217 gFunc = Hop_Not(gFunc);
218 If_CutSetData( pCut, gFunc );
242 pCut = If_ObjCutBest(pIfObj);
246 If_CutSetData( If_ObjCutBest(pLeaf),
Hop_IthVar(pHopMan, i) );
248 Vec_PtrClear( pIfMan->
vTemp );
250 if ( gFunc == (
void *)1 )
252 printf(
"Nwk_NodeIfToHop(): Computing local AIG has failed.\n" );
258 If_CutSetData( If_ObjCutBest(pLeaf), NULL );
260 If_CutSetData( pCut, NULL );
283 int i, k, nLeaves, * ppLeaves;
284 assert( Aig_ManCiNum(
p) == If_ManCiNum(pIfMan) );
285 assert( Aig_ManCoNum(
p) == If_ManCoNum(pIfMan) );
286 assert( Aig_ManNodeNum(
p) == If_ManAndNum(pIfMan) );
290 vIfToAig = Vec_PtrStart( If_ManObjNum(pIfMan) );
293 pIfObj = (
If_Obj_t *)Vec_PtrEntry( vAigToIf, i );
294 Vec_PtrWriteEntry( vIfToAig, pIfObj->
Id, pObj );
298 pNtk->
pName = Abc_UtilStrsav(
p->pName );
299 pNtk->
pSpec = Abc_UtilStrsav(
p->pSpec );
305 pIfObj = (
If_Obj_t *)Vec_PtrEntry( vAigToIf, i );
306 if ( pIfObj->
nRefs == 0 && !If_ObjIsTerm(pIfObj) )
308 if ( Aig_ObjIsNode(pObj) )
310 pCutBest = If_ObjCutBest( pIfObj );
311 nLeaves = If_CutLeaveNum( pCutBest );
312 ppLeaves = If_CutLeaves( pCutBest );
315 for ( k = 0; k < nLeaves; k++ )
317 pObjRepr = (
Aig_Obj_t *)Vec_PtrEntry( vIfToAig, ppLeaves[k] );
323 else if ( Aig_ObjIsCi(pObj) )
325 else if ( Aig_ObjIsCo(pObj) )
328 pObjNew->fInvert = Aig_ObjFaninC0(pObj);
332 else if ( Aig_ObjIsConst1(pObj) )
335 pObjNew->pFunc = Hop_ManConst1( pNtk->
pManHop );
339 pObj->
pData = pObjNew;
342 Vec_PtrFree( vIfToAig );
369 vAigToIf = Vec_PtrStart( Aig_ManObjNumMax(
p) );
371 if ( pIfMan == NULL )
385 Vec_PtrFree( vAigToIf );
#define ABC_ALLOC(type, num)
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
#define Aig_ManForEachObj(p, pObj, i)
struct Aig_Obj_t_ Aig_Obj_t
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
void Aig_ManCleanData(Aig_Man_t *p)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Vec_Int_t * Saig_ManComputeSwitchProbs(Aig_Man_t *pAig, int nFrames, int nPref, int fProbOne)
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Hop_Obj_t * Hop_IthVar(Hop_Man_t *p, int i)
FUNCTION DEFINITIONS ///.
Hop_Obj_t * Hop_And(Hop_Man_t *p, Hop_Obj_t *p0, Hop_Obj_t *p1)
struct Hop_Obj_t_ Hop_Obj_t
void If_ManCleanCutData(If_Man_t *p)
void If_ManCreateChoice(If_Man_t *p, If_Obj_t *pRepr)
If_Obj_t * If_ManCreateCo(If_Man_t *p, If_Obj_t *pDriver)
struct If_Par_t_ If_Par_t
struct If_Cut_t_ If_Cut_t
If_Obj_t * If_ManCreateAnd(If_Man_t *p, If_Obj_t *pFan0, If_Obj_t *pFan1)
#define If_CutForEachLeaf(p, pCut, pLeaf, i)
void If_ManStop(If_Man_t *p)
int If_ManPerformMapping(If_Man_t *p)
struct If_Man_t_ If_Man_t
BASIC TYPES ///.
If_Man_t * If_ManStart(If_Par_t *pPars)
FUNCTION DEFINITIONS ///.
If_Obj_t * If_ManCreateCi(If_Man_t *p)
struct If_Obj_t_ If_Obj_t
ABC_DLL int Nwk_ManCheck(Nwk_Man_t *p)
DECLARATIONS ///.
struct Nwk_Man_t_ Nwk_Man_t
ABC_DLL void Nwk_ManBidecResyn(Nwk_Man_t *p, int fVerbose)
If_Man_t * Nwk_ManToIf(Aig_Man_t *p, If_Par_t *pPars, Vec_Ptr_t *vAigToIf)
Hop_Obj_t * Nwk_NodeIfToHop2_rec(Hop_Man_t *pHopMan, If_Man_t *pIfMan, If_Obj_t *pIfObj, Vec_Ptr_t *vVisited)
Nwk_Man_t * Nwk_ManFromIf(If_Man_t *pIfMan, Aig_Man_t *p, Vec_Ptr_t *vAigToIf)
Nwk_Man_t * Nwk_MappingIf(Aig_Man_t *p, Tim_Man_t *pManTime, If_Par_t *pPars)
ABC_NAMESPACE_IMPL_START void Nwk_ManSetIfParsDefault(If_Par_t *pPars)
DECLARATIONS ///.
Hop_Obj_t * Nwk_NodeIfToHop(Hop_Man_t *pHopMan, If_Man_t *pIfMan, If_Obj_t *pIfObj)
ABC_DLL Nwk_Obj_t * Nwk_ManCreateNode(Nwk_Man_t *pMan, int nFanins, int nFanouts)
ABC_DLL Nwk_Obj_t * Nwk_ManCreateCi(Nwk_Man_t *pMan, int nFanouts)
ABC_DLL Nwk_Obj_t * Nwk_ManCreateCo(Nwk_Man_t *pMan)
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
ABC_DLL Nwk_Man_t * Nwk_ManAlloc()
DECLARATIONS ///.
ABC_DLL void Nwk_ObjAddFanin(Nwk_Obj_t *pObj, Nwk_Obj_t *pFanin)
ABC_DLL void Nwk_ManMinimumBase(Nwk_Man_t *pNtk, int fVerbose)
int(* pFuncCost)(If_Man_t *, If_Cut_t *)
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Tim_Man_t * Tim_ManDup(Tim_Man_t *p, int fUnitDelay)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.