31 #define BUF_SCALE 1000
97 if ( k != k2 && pFanin == pFanin2 )
98 printf(
"Node %d has dup fanin %d.\n", i,
Abc_ObjId(pFanin) );
142 if ( i >= nNodesOld )
161 if ( pFanin != pFaninNew )
185 int i, k, Max = 0, MaxAll = 0;
204 int i, k,
Counter = 0, Counter2 = 0, Total = 0;
209 if ( i >= nNodesOld )
228 printf(
"Added %d inverters (%.2f %% fanins) (%.2f %% compl fanins).\n",
229 Counter, 100.0 * Counter / Total, 100.0 * Counter2 / Total );
243 int i, k, iLit,
Counter = 0, Total = 0;
255 if ( pFaninNew == pFanin )
266 printf(
"Saved %d (%.2f %%) fanin phase bits. ", Counter, 100.0 * Counter / Total );
297 printf(
"obj %d and its fanin %d are not in the topo order\n",
Abc_ObjId(pObj),
Abc_ObjId(pFanin) ), fFlag = 0;
300 printf(
"node %d has no fanout\n",
Abc_ObjId(pObj) ), fFlag = 0;
304 if ( fFlag && fVerbose )
305 printf(
"The network is in topo order and no dangling nodes.\n" );
348 Diff = (*pp1)->Id - (*pp2)->Id;
367 int i, Degree0 = Degree;
396 if ( Degree == Degree0 && Degree >
Vec_PtrSize(vFanouts) - Degree )
398 assert( Degree <= Degree0 );
407 printf(
"%d%s ",
Abc_ObjLevel(pFanout), i == Degree-1 ?
" " :
"" );
438 if ( DegreeR && nOldFanNum > DegreeR )
466 printf(
"Warning!!! Using inverters instead of buffers.\n" );
468 printf(
"The phases are not given. The result will not verify.\n" );
517 if ( Delay < DelayF )
533 if ( Delay < DelayF )
725 printf(
"Sep = %d. Dup = %d. Br0 = %d. Br1 = %d. BrC = %d. ",
727 printf(
"Orig = %d. Add = %d. Rem = %d.\n",
759 int i, Slack, * pOrder;
788 printf(
" %d(%d)",
Abc_ObjId(pFanout), Slack );
818 printf(
"Replaced %d buffers by invertor pairs.\n", Counter );
870 int i, j, nCrit, nNonCrit;
880 printf(
"ObjId = %6d : %-10s FI = %d. FO =%4d. Crit =%4d. ",
884 if ( nCrit > 0 && nNonCrit > 1 )
899 printf(
"Adding buffer\n" );
923 printf(
"Duplicating node\n" );
928 int nDegree, n1Degree, n1Number, nFirst;
934 nFirst = n1Degree * n1Number;
944 for ( i = 0; i < nDegree; i++ )
947 printf(
"Adding %d inverters\n", nDegree );
952 for ( i = 0; i < nDegree; i++ )
955 printf(
"Adding %d buffers\n", nDegree );
960 j = (i < nFirst) ? i/n1Degree : n1Number + ((i - nFirst)/(n1Degree - 1));
961 assert( j >= 0 && j < nDegree );
965 for ( i = 0; i < nDegree; i++ )
968 for ( i = 0; i < nDegree; i++ )
971 for ( i = 0; i < nDegree; i++ )
973 for ( i = 0; i < nDegree; i++ )
979 printf(
"Doing nothing\n" );
Mio_Gate_t * Mio_LibraryReadBuf(Mio_Library_t *pLib)
Buf_Man_t * Buf_ManStart(Abc_Ntk_t *pNtk, int FanMin, int FanMax, int fBufPis)
static void Abc_BufSetEdgeDelay(Buf_Man_t *p, Abc_Obj_t *pObj, int i, int f)
float Abc_BufComputeDep(Buf_Man_t *p, Abc_Obj_t *pObj)
void Abc_SclPerformBuffering_rec(Abc_Obj_t *pObj, int DegreeR, int Degree, int fUseInvs, int fVerbose)
static int * Vec_IntArray(Vec_Int_t *p)
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
int * Abc_QuickSortCost(int *pCosts, int nSize, int fDecrease)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
int Abc_SclIsInv(Abc_Obj_t *pObj)
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
void Abc_BufPerformOne(Buf_Man_t *p, int iPivot, int fSkipDup, int fVerbose)
static void Vec_FltWriteEntry(Vec_Flt_t *p, int i, float Entry)
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
float Mio_GateReadPinDelay(Mio_Gate_t *pGate, int iPin)
static void Vec_IntFillExtra(Vec_Int_t *p, int nSize, int Fill)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
int Abc_SclCheckNtk(Abc_Ntk_t *p, int fVerbose)
#define Vec_PtrForEachEntryReverse(Type, vVec, pEntry, i)
static int Abc_BufEdgeSlack(Buf_Man_t *p, Abc_Obj_t *pObj, Abc_Obj_t *pFan)
void Abc_NodeInvUpdateObjFanoutPolarity(Abc_Obj_t *pObj, Abc_Obj_t *pFanout)
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
void Abc_BufCollectTfoCone_rec(Abc_Obj_t *pNode, Vec_Int_t *vNodes)
ABC_DLL int Abc_NodeFindFanin(Abc_Obj_t *pNode, Abc_Obj_t *pFanin)
static void Vec_FltFree(Vec_Flt_t *p)
static int Abc_Var2Lit(int Var, int fCompl)
Abc_Ntk_t * Abc_SclUnBufferPhase(Abc_Ntk_t *pNtk, int fVerbose)
void Abc_BufUpdateGlobal(Buf_Man_t *p)
int Abc_NodeCompareLevels(Abc_Obj_t **pp1, Abc_Obj_t **pp2)
static void Abc_BufSetNodeDep(Buf_Man_t *p, Abc_Obj_t *pObj, int f)
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
static void Vec_PtrSort(Vec_Ptr_t *p, int(*Vec_PtrSortCompare)()) ___unused
typedefABC_NAMESPACE_HEADER_START struct Vec_Que_t_ Vec_Que_t
INCLUDES ///.
int Abc_SclComputeReverseLevel(Abc_Obj_t *pObj)
static Vec_Flt_t * Vec_FltAlloc(int nCap)
FUNCTION DEFINITIONS ///.
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
#define Abc_NtkForEachCo(pNtk, pCo, i)
static int Abc_BufNodeSlack(Buf_Man_t *p, Abc_Obj_t *pObj)
word Mio_GateReadTruth(Mio_Gate_t *pGate)
static int Vec_QuePop(Vec_Que_t *p)
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
static int Abc_MaxInt(int a, int b)
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
void Abc_BufCollectTfiCone_rec(Abc_Obj_t *pNode, Vec_Int_t *vNodes)
static int Vec_PtrSize(Vec_Ptr_t *p)
float Abc_BufComputeArr(Buf_Man_t *p, Abc_Obj_t *pObj)
void Abc_SclTimeIncUpdateLevel(Abc_Obj_t *pObj)
static void Vec_FltFill(Vec_Flt_t *p, int nSize, float Entry)
static Vec_Int_t * Vec_IntStartFull(int nSize)
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Abc_Obj_t * Abc_BufFindNonBuffDriver(Buf_Man_t *p, Abc_Obj_t *pObj)
static void Vec_IntReverseOrder(Vec_Int_t *p)
static int Abc_ObjFaninId0(Abc_Obj_t *pObj)
static int Abc_LitNotCond(int Lit, int c)
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
void Abc_BufCollectTfoCone(Buf_Man_t *p, Abc_Obj_t *pObj)
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
ABC_DLL int Abc_NodeIsBuf(Abc_Obj_t *pNode)
void Abc_SclReportDupFanins(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
void Abc_BufUpdateArr(Buf_Man_t *p, Abc_Obj_t *pObj)
static int Abc_BufNodeDep(Buf_Man_t *p, Abc_Obj_t *pObj)
ABC_DLL void Abc_ObjPatchFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFaninOld, Abc_Obj_t *pFaninNew)
static int Vec_QueSize(Vec_Que_t *p)
int Abc_SclCountMaxPhases(Abc_Ntk_t *pNtk)
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
static int Abc_MinInt(int a, int b)
Abc_Ntk_t * Abc_SclBufferPhase(Abc_Ntk_t *pNtk, int fVerbose)
static Vec_Int_t * Vec_IntStart(int nSize)
static int Abc_LitIsCompl(int Lit)
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
static void * Vec_PtrEntryLast(Vec_Ptr_t *p)
void Abc_BufAddToQue(Buf_Man_t *p, Abc_Obj_t *pObj)
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeInv(Abc_Ntk_t *pNtk, Abc_Obj_t *pFanin)
Abc_Ntk_t * Abc_SclUnBufferPerform(Abc_Ntk_t *pNtk, int fVerbose)
static int Abc_ObjLevel(Abc_Obj_t *pObj)
#define Abc_NtkForEachObjVec(vIds, pNtk, pObj, i)
static int Vec_IntEntry(Vec_Int_t *p, int i)
#define ABC_NAMESPACE_IMPL_END
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeBuf(Abc_Ntk_t *pNtk, Abc_Obj_t *pFanin)
void Abc_BufPrintOne(Buf_Man_t *p, int iPivot)
STRUCTURE DEFINITIONS ///.
static void Vec_IntPush(Vec_Int_t *p, int Entry)
void Buf_ManStop(Buf_Man_t *p)
int Abc_BufComputeAverage(Buf_Man_t *p, int iPivot, Vec_Int_t *vOrder)
ABC_DLL Abc_Ntk_t * Abc_NtkDupDfs(Abc_Ntk_t *pNtk)
static int Abc_BufNodeArr(Buf_Man_t *p, Abc_Obj_t *pObj)
#define Abc_NtkForEachNode(pNtk, pNode, i)
#define BUF_SCALE
DECLARATIONS ///.
#define ABC_NAMESPACE_IMPL_START
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Abc_Ntk_t * Abc_SclBufPerform(Abc_Ntk_t *pNtk, int FanMin, int FanMax, int fBufPis, int fSkipDup, int fVerbose)
int Abc_BufCountNonCritical(Buf_Man_t *p, Abc_Obj_t *pObj)
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
static int Vec_IntSize(Vec_Int_t *p)
#define Vec_PtrForEachEntryStop(Type, vVec, pEntry, i, Stop)
ABC_DLL int Abc_NodeIsInv(Abc_Obj_t *pNode)
#define Abc_ObjForEachFanout(pObj, pFanout, i)
#define Abc_NtkForEachCi(pNtk, pCi, i)
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
static float ** Vec_FltArrayP(Vec_Flt_t *p)
void Abc_BufCollectTfiCone(Buf_Man_t *p, Abc_Obj_t *pObj)
#define Abc_ObjForEachFanin(pObj, pFanin, i)
#define ABC_CONST(number)
PARAMETERS ///.
void Abc_BufReplaceBufsByInvs(Abc_Ntk_t *pNtk)
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Abc_Obj_t * Abc_SclPerformBufferingOne(Abc_Obj_t *pObj, int Degree, int fUseInvs, int fVerbose)
static void Vec_QueUpdate(Vec_Que_t *p, int v)
static void Abc_BufSetNodeArr(Buf_Man_t *p, Abc_Obj_t *pObj, int f)
#define ABC_CALLOC(type, num)
static int Abc_Lit2Var(int Lit)
typedefABC_NAMESPACE_HEADER_START struct Vec_Flt_t_ Vec_Flt_t
INCLUDES ///.
static int Vec_QueIsMember(Vec_Que_t *p, int v)
static int Abc_SclObjIsBufInv(Abc_Obj_t *pObj)
static void Vec_QueFree(Vec_Que_t *p)
#define ABC_INFINITY
MACRO DEFINITIONS ///.
#define Abc_NtkForEachNodeCo(pNtk, pNode, i)
void Abc_BufUpdateDep(Buf_Man_t *p, Abc_Obj_t *pObj)
static int Abc_ObjFaninPhase(Abc_Obj_t *p, int i)
static void Abc_ObjFaninFlipPhase(Abc_Obj_t *p, int i)
Vec_Int_t * Abc_BufSortByDelay(Buf_Man_t *p, int iPivot)
static Abc_Obj_t * Abc_ObjFanout(Abc_Obj_t *pObj, int i)
ABC_DLL void Abc_NodeCollectFanouts(Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
static void Vec_IntFree(Vec_Int_t *p)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Abc_Ntk_t * Abc_SclPerformBuffering(Abc_Ntk_t *p, int DegreeR, int Degree, int fUseInvs, int fVerbose)
static void Vec_IntClear(Vec_Int_t *p)
void Abc_BufCreateEdges(Buf_Man_t *p, Abc_Obj_t *pObj)
ABC_DLL int Abc_NtkLevel(Abc_Ntk_t *pNtk)
static Vec_Que_t * Vec_QueAlloc(int nCap)
MACRO DEFINITIONS ///.
char * Mio_GateReadName(Mio_Gate_t *pGate)
Mio_Gate_t * Mio_LibraryReadInv(Mio_Library_t *pLib)
static void Vec_QuePush(Vec_Que_t *p, int v)
void Abc_NodeInvUpdateFanPolarity(Abc_Obj_t *pObj)
int Abc_SclGetRealFaninLit(Abc_Obj_t *pObj)
ABC_DLL int Abc_ObjLevelNew(Abc_Obj_t *pObj)
static void Vec_QueSetPriority(Vec_Que_t *p, float **pCosts)
static void Abc_NodeSetTravIdCurrent(Abc_Obj_t *p)
static void Vec_PtrFree(Vec_Ptr_t *p)
static int Abc_BufEdgeDelay(Buf_Man_t *p, Abc_Obj_t *pObj, int i)