59 int i, j, best_i, temp;
72 if ( pPinDelays[pPinPerm[j]] > pPinDelays[pPinPerm[best_i]] )
77 pPinPerm[i] = pPinPerm[best_i];
78 pPinPerm[best_i] = temp;
85 assert( pPinDelays[pPinPerm[i-1]] >= pPinDelays[pPinPerm[i]] );
104 float pPinDelays[32];
108 float tArrival, tRequired, tSlack, * pDelays;
116 printf(
"The max LUT size (%d) is less than the max fanin count (%d).\n",
135 if ( pLutLib == NULL )
186 if ( pLutLib == NULL )
226 assert( tSlack + 0.001 > 0.0 );
248 int i, Nodes, * pCounters;
249 float tArrival, tDelta, nSteps, Num;
254 printf(
"The max LUT size (%d) is less than the max fanin count (%d).\n",
260 pCounters =
ABC_ALLOC(
int, nSteps + 1 );
261 memset( pCounters, 0,
sizeof(
int)*(nSteps + 1) );
264 tDelta = tArrival / nSteps;
271 assert( Num >=0 && Num <= nSteps );
272 pCounters[(int)Num]++;
275 printf(
"Max delay = %6.2f. Delay trace using %s model:\n", tArrival, fUseLutLib?
"LUT library" :
"unit-delay" );
277 for ( i = 0; i < nSteps; i++ )
279 Nodes += pCounters[i];
280 printf(
"%3d %s : %5d (%6.2f %%)\n", fUseLutLib? 5*(i+1) : i+1,
381 int nCofs, i, k, nSkip;
412 for ( i = 0; i < nCofs; i++ )
437 for ( nSkip = (1<<k), i = 0; i < nCofs; i += 2*nSkip )
469 float pPinDelays[32];
472 unsigned uResult = 0;
473 float tRequired, * pDelays;
477 if ( pLutLib == NULL )
496 uResult |= (1 << pPinPerm[k]);
517 float tDelta, tArrival;
518 int i, k, k2,
Counter, CounterRes, nTimeCris;
519 unsigned * puTCEdges;
522 tDelta = fUseLutLib ? tArrival*Percentage/100.0 : 1.0;
525 printf(
"Max delay = %.2f. Delta = %.2f. ", tArrival, tDelta );
526 printf(
"Using %s model. ", fUseLutLib?
"LUT library" :
"unit-delay" );
528 printf(
"Percentage = %d. ", Percentage );
542 Counter = CounterRes = 0;
550 printf(
"Edges: Total = %7d. 0-slack = %7d. Critical = %7d. Ratio = %4.2f\n",
557 Counter = CounterRes = 0;
567 if ( !
Abc_ObjIsCi(pFanin) && (puTCEdges[pNode->
Id] & (1<<k)) )
569 if ( !fVeryVerbose && nTimeCris == 0 )
577 if ( !
Abc_ObjIsCi(pFanin) && (puTCEdges[pNode->
Id] & (1<<k)) )
579 if ( puTCEdges[pFanin->
Id] & (1<<k2) )
599 printf(
"%5d Node %5d : %d %2d %2d ", Counter, pNode->
Id,
602 printf(
"%d(%.2f)%s ", pFanin->
Id,
Abc_ObjSlack(pFanin), (puTCEdges[pNode->
Id] & (1<<k))?
"*":
"" );
643 printf(
"Nodes: Total = %7d. 0-slack = %7d. Workable = %7d. Ratio = %4.2f\n",
644 Abc_NtkNodeNum(pNtk), Counter, CounterRes, 1.0*CounterRes/Counter );
675 float * pProbability;
684 pProbability = (
float *)vProbs->pArray;
689 pObjAbc->
pTemp = NULL;
693 pSwitching = (
float *)vSwitching->pArray;
697 pProbability[pObjAbc->
Id] = pSwitching[pObjAig->
Id];
719 float * pProb, TotalProb = 0.0, ProbThis, Probs[6] = {0.0};
720 int i, nNodes = 0, nEdges = 0,
Counter[6] = {0};
721 pProb = (
float *)vProbs->pArray;
730 TotalProb += ProbThis;
731 assert( pProb[i] >= 0.0 && pProb[i] <= 1.0 );
732 if ( pProb[i] >= 0.5 )
735 Probs[5] += ProbThis;
737 else if ( pProb[i] >= 0.4 )
740 Probs[4] += ProbThis;
742 else if ( pProb[i] >= 0.3 )
745 Probs[3] += ProbThis;
747 else if ( pProb[i] >= 0.2 )
750 Probs[2] += ProbThis;
752 else if ( pProb[i] >= 0.1 )
755 Probs[1] += ProbThis;
760 Probs[0] += ProbThis;
763 printf(
"Node distribution: " );
764 for ( i = 0; i < 6; i++ )
765 printf(
"n%d%d = %6.2f%% ", i, i+1, 100.0 *
Counter[i]/nNodes );
767 printf(
"Power distribution: " );
768 for ( i = 0; i < 6; i++ )
769 printf(
"p%d%d = %6.2f%% ", i, i+1, 100.0 * Probs[i]/TotalProb );
771 printf(
"Total probs = %7.2f. ", TotalProb );
772 printf(
"Total edges = %d. ", nEdges );
773 printf(
"Average = %7.2f. ", TotalProb / nEdges );
791 float * pProb = (
float *)vProbs->pArray;
792 unsigned uResult = 0;
795 if ( pProb[pFanin->
Id] >= Limit )
817 float * pProb, Limit;
818 int i, k, k2,
Counter, CounterRes, nTimeCris;
819 unsigned * puPCEdges;
821 Limit = 0.5 - (1.0 * Percentage / 100);
824 pProb = (
float *)vProbs->pArray;
833 if ( pProb[pNode->
Id] < Limit )
854 Counter = CounterRes = 0;
864 if ( !
Abc_ObjIsCi(pFanin) && (puPCEdges[pNode->
Id] & (1<<k)) )
866 if ( !fVeryVerbose && nTimeCris == 0 )
874 if ( !
Abc_ObjIsCi(pFanin) && (puPCEdges[pNode->
Id] & (1<<k)) )
876 if ( puPCEdges[pFanin->
Id] & (1<<k2) )
896 printf(
"%5d Node %5d : %d %2d %2d ", Counter, pNode->
Id,
899 printf(
"%d(%.2f)%s ", pFanin->
Id, pProb[pFanin->
Id], (puPCEdges[pNode->
Id] & (1<<k))?
"*":
"" );
911 if ( pProb[pFanin->
Id] > pProb[pFanin2->
Id] )
922 if ( pProb[pFanin->
Id] > pProb[pFanin2->
Id] )
930 if ( pProb[pFanin->
Id] > pProb[pFanin2->
Id] )
943 printf(
"Nodes: Total = %7d. Power-critical = %7d. Workable = %7d. Ratio = %4.2f\n",
944 Abc_NtkNodeNum(pNtk), Counter, CounterRes, 1.0*CounterRes/Counter );
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
static Abc_Obj_t * Abc_ObjFanin1(Abc_Obj_t *pObj)
unsigned Abc_NtkDelayTraceTCEdges(Abc_Ntk_t *pNtk, Abc_Obj_t *pNode, float tDelta, int fUseLutLib)
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
void Aig_ManStop(Aig_Man_t *p)
static int Vec_PtrPushUnique(Vec_Ptr_t *p, void *Entry)
int Abc_NtkSpeedupNode_rec(Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
static void Abc_ObjSetSlack(Abc_Obj_t *pNode, float Time)
ABC_DLL Abc_Ntk_t * Abc_NtkStrash(Abc_Ntk_t *pNtk, int fAllNodes, int fCleanup, int fRecord)
static Abc_Obj_t * Abc_ObjChild1Copy(Abc_Obj_t *pObj)
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
ABC_DLL int Abc_NtkGetFaninMax(Abc_Ntk_t *pNtk)
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
static int Abc_ObjIsPi(Abc_Obj_t *pObj)
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
static int Abc_AigNodeIsConst(Abc_Obj_t *pNode)
float pLutDelays[IF_MAX_LUTSIZE+1][IF_MAX_LUTSIZE+1]
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
#define ABC_ALLOC(type, num)
int Abc_AigCheckTfi(Abc_Obj_t *pNew, Abc_Obj_t *pOld)
#define Abc_NtkForEachCo(pNtk, pCo, i)
static ABC_NAMESPACE_IMPL_START float Abc_ObjArrival(Abc_Obj_t *pNode)
DECLARATIONS ///.
static void Abc_ObjSetArrival(Abc_Obj_t *pNode, float Time)
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
float Abc_NtkDelayTraceLut(Abc_Ntk_t *pNtk, int fUseLutLib)
static int Vec_PtrSize(Vec_Ptr_t *p)
ABC_DLL Abc_Obj_t * Abc_AigMux(Abc_Aig_t *pMan, Abc_Obj_t *pC, Abc_Obj_t *p1, Abc_Obj_t *p0)
ABC_DLL int Abc_NtkGetTotalFanins(Abc_Ntk_t *pNtk)
static float Abc_ObjRequired(Abc_Obj_t *pNode)
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
int Abc_AigCheckTfi_rec(Abc_Obj_t *pNode, Abc_Obj_t *pOld)
ABC_DLL Vec_Ptr_t * Abc_NtkDfsReverse(Abc_Ntk_t *pNtk)
static void Abc_ObjSetRequired(Abc_Obj_t *pNode, float Time)
void Abc_NtkSpeedupNode(Abc_Ntk_t *pNtk, Abc_Ntk_t *pAig, Abc_Obj_t *pNode, Vec_Ptr_t *vLeaves, Vec_Ptr_t *vTimes)
#define Abc_AigForEachAnd(pNtk, pNode, i)
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
static Vec_Int_t * Vec_IntStart(int nSize)
unsigned Abc_NtkPowerCriticalEdges(Abc_Ntk_t *pNtk, Abc_Obj_t *pNode, float Limit, Vec_Int_t *vProbs)
static Abc_Obj_t * Abc_ObjChild0Copy(Abc_Obj_t *pObj)
Abc_Ntk_t * Abc_NtkPowerdown(Abc_Ntk_t *pNtk, int fUseLutLib, int Percentage, int Degree, int fVerbose, int fVeryVerbose)
Vec_Int_t * Abc_NtkPowerEstimate(Abc_Ntk_t *pNtk, int fProbOne)
Vec_Int_t * Saig_ManComputeSwitchProbs(Aig_Man_t *pAig, int nFrames, int nPref, int fProbOne)
Aig_Man_t * Abc_NtkToDar(Abc_Ntk_t *pNtk, int fExors, int fRegisters)
#define ABC_NAMESPACE_IMPL_END
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
#define Abc_NtkForEachNode(pNtk, pNode, i)
#define ABC_NAMESPACE_IMPL_START
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
static float Abc_ObjSlack(Abc_Obj_t *pNode)
static Abc_Obj_t * Abc_ObjRegular(Abc_Obj_t *p)
static int Vec_IntSize(Vec_Int_t *p)
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
void Abc_NtkDelayTraceSortPins(Abc_Obj_t *pNode, int *pPinPerm, float *pPinDelays)
FUNCTION DEFINITIONS ///.
#define Abc_ObjForEachFanin(pObj, pFanin, i)
void Abc_NtkDelayTracePrint(Abc_Ntk_t *pNtk, int fUseLutLib, int fVerbose)
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
#define ABC_INFINITY
MACRO DEFINITIONS ///.
static Abc_Obj_t * Abc_ObjNotCond(Abc_Obj_t *p, int c)
static void Vec_PtrClear(Vec_Ptr_t *p)
static Abc_Obj_t * Abc_ObjFanin(Abc_Obj_t *pObj, int i)
static void Vec_IntFree(Vec_Int_t *p)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
static int Abc_ObjIsComplement(Abc_Obj_t *p)
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
ABC_DLL int Abc_NtkLevel(Abc_Ntk_t *pNtk)
ABC_DLL void * Abc_FrameReadLibLut()
Abc_Ntk_t * Abc_NtkSpeedup(Abc_Ntk_t *pNtk, int fUseLutLib, int Percentage, int Degree, int fVerbose, int fVeryVerbose)
static void Abc_NodeSetTravIdCurrent(Abc_Obj_t *p)
void Abc_NtkPowerPrint(Abc_Ntk_t *pNtk, Vec_Int_t *vProbs)
static void Vec_PtrFree(Vec_Ptr_t *p)