abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
sclBuffer.c File Reference
#include "sclSize.h"
#include "map/mio/mio.h"

Go to the source code of this file.

Data Structures

struct  Buf_Man_t_
 

Macros

#define BUF_SCALE   1000
 DECLARATIONS ///. More...
 

Typedefs

typedef struct Buf_Man_t_ Buf_Man_t
 

Functions

static int Abc_BufNodeArr (Buf_Man_t *p, Abc_Obj_t *pObj)
 
static int Abc_BufNodeDep (Buf_Man_t *p, Abc_Obj_t *pObj)
 
static void Abc_BufSetNodeArr (Buf_Man_t *p, Abc_Obj_t *pObj, int f)
 
static void Abc_BufSetNodeDep (Buf_Man_t *p, Abc_Obj_t *pObj, int f)
 
static int Abc_BufEdgeDelay (Buf_Man_t *p, Abc_Obj_t *pObj, int i)
 
static void Abc_BufSetEdgeDelay (Buf_Man_t *p, Abc_Obj_t *pObj, int i, int f)
 
static int Abc_BufNodeSlack (Buf_Man_t *p, Abc_Obj_t *pObj)
 
static int Abc_BufEdgeSlack (Buf_Man_t *p, Abc_Obj_t *pObj, Abc_Obj_t *pFan)
 
void Abc_SclReportDupFanins (Abc_Ntk_t *pNtk)
 FUNCTION DEFINITIONS ///. More...
 
static int Abc_SclObjIsBufInv (Abc_Obj_t *pObj)
 
int Abc_SclIsInv (Abc_Obj_t *pObj)
 
int Abc_SclGetRealFaninLit (Abc_Obj_t *pObj)
 
Abc_Ntk_tAbc_SclUnBufferPerform (Abc_Ntk_t *pNtk, int fVerbose)
 
int Abc_SclCountMaxPhases (Abc_Ntk_t *pNtk)
 
Abc_Ntk_tAbc_SclBufferPhase (Abc_Ntk_t *pNtk, int fVerbose)
 
Abc_Ntk_tAbc_SclUnBufferPhase (Abc_Ntk_t *pNtk, int fVerbose)
 
int Abc_SclCheckNtk (Abc_Ntk_t *p, int fVerbose)
 
void Abc_NodeInvUpdateFanPolarity (Abc_Obj_t *pObj)
 
void Abc_NodeInvUpdateObjFanoutPolarity (Abc_Obj_t *pObj, Abc_Obj_t *pFanout)
 
int Abc_NodeCompareLevels (Abc_Obj_t **pp1, Abc_Obj_t **pp2)
 
int Abc_SclComputeReverseLevel (Abc_Obj_t *pObj)
 
Abc_Obj_tAbc_SclPerformBufferingOne (Abc_Obj_t *pObj, int Degree, int fUseInvs, int fVerbose)
 
void Abc_SclPerformBuffering_rec (Abc_Obj_t *pObj, int DegreeR, int Degree, int fUseInvs, int fVerbose)
 
Abc_Ntk_tAbc_SclPerformBuffering (Abc_Ntk_t *p, int DegreeR, int Degree, int fUseInvs, int fVerbose)
 
float Abc_BufComputeArr (Buf_Man_t *p, Abc_Obj_t *pObj)
 
float Abc_BufComputeDep (Buf_Man_t *p, Abc_Obj_t *pObj)
 
void Abc_BufUpdateGlobal (Buf_Man_t *p)
 
void Abc_BufCreateEdges (Buf_Man_t *p, Abc_Obj_t *pObj)
 
void Abc_BufAddToQue (Buf_Man_t *p, Abc_Obj_t *pObj)
 
void Abc_BufCollectTfoCone_rec (Abc_Obj_t *pNode, Vec_Int_t *vNodes)
 
void Abc_BufCollectTfoCone (Buf_Man_t *p, Abc_Obj_t *pObj)
 
void Abc_BufUpdateArr (Buf_Man_t *p, Abc_Obj_t *pObj)
 
void Abc_BufCollectTfiCone_rec (Abc_Obj_t *pNode, Vec_Int_t *vNodes)
 
void Abc_BufCollectTfiCone (Buf_Man_t *p, Abc_Obj_t *pObj)
 
void Abc_BufUpdateDep (Buf_Man_t *p, Abc_Obj_t *pObj)
 
Buf_Man_tBuf_ManStart (Abc_Ntk_t *pNtk, int FanMin, int FanMax, int fBufPis)
 
void Buf_ManStop (Buf_Man_t *p)
 
Vec_Int_tAbc_BufSortByDelay (Buf_Man_t *p, int iPivot)
 
void Abc_BufPrintOne (Buf_Man_t *p, int iPivot)
 
void Abc_BufReplaceBufsByInvs (Abc_Ntk_t *pNtk)
 
int Abc_BufComputeAverage (Buf_Man_t *p, int iPivot, Vec_Int_t *vOrder)
 
Abc_Obj_tAbc_BufFindNonBuffDriver (Buf_Man_t *p, Abc_Obj_t *pObj)
 
int Abc_BufCountNonCritical (Buf_Man_t *p, Abc_Obj_t *pObj)
 
void Abc_BufPerformOne (Buf_Man_t *p, int iPivot, int fSkipDup, int fVerbose)
 
Abc_Ntk_tAbc_SclBufPerform (Abc_Ntk_t *pNtk, int FanMin, int FanMax, int fBufPis, int fSkipDup, int fVerbose)
 

Macro Definition Documentation

#define BUF_SCALE   1000

DECLARATIONS ///.

CFile****************************************************************

FileName [sclBuffer.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Standard-cell library representation.]

Synopsis [Buffering algorithms.]

Author [Alan Mishchenko, Niklas Een]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - August 24, 2012.]

Revision [

Id:
sclBuffer.c,v 1.0 2012/08/24 00:00:00 alanmi Exp

]

Definition at line 31 of file sclBuffer.c.

Typedef Documentation

typedef struct Buf_Man_t_ Buf_Man_t

Definition at line 33 of file sclBuffer.c.

Function Documentation

void Abc_BufAddToQue ( Buf_Man_t p,
Abc_Obj_t pObj 
)

Definition at line 555 of file sclBuffer.c.

556 {
557  if ( Abc_ObjFanoutNum(pObj) < p->nFanMin || (!p->fBufPis && Abc_ObjIsCi(pObj)) )
558  return;
560  if ( Vec_QueIsMember(p->vQue, Abc_ObjId(pObj)) )
561  Vec_QueUpdate( p->vQue, Abc_ObjId(pObj) );
562  else
563  Vec_QuePush( p->vQue, Abc_ObjId(pObj) );
564 }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
Definition: abc.h:351
int nFanMin
Definition: sclBuffer.c:37
static void Vec_FltWriteEntry(Vec_Flt_t *p, int i, float Entry)
Definition: vecFlt.h:364
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
Vec_Que_t * vQue
Definition: sclBuffer.c:47
int fBufPis
Definition: sclBuffer.c:39
static void Vec_QueUpdate(Vec_Que_t *p, int v)
Definition: vecQue.h:199
static int Vec_QueIsMember(Vec_Que_t *p, int v)
Definition: vecQue.h:216
Vec_Flt_t * vCounts
Definition: sclBuffer.c:46
static void Vec_QuePush(Vec_Que_t *p, int v)
Definition: vecQue.h:221
void Abc_BufCollectTfiCone ( Buf_Man_t p,
Abc_Obj_t pObj 
)

Definition at line 638 of file sclBuffer.c.

639 {
640  Vec_IntClear( p->vTfCone );
643 }
void Abc_BufCollectTfiCone_rec(Abc_Obj_t *pNode, Vec_Int_t *vNodes)
Definition: sclBuffer.c:624
Vec_Int_t * vTfCone
Definition: sclBuffer.c:56
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
Abc_Ntk_t * pNtk
Definition: sclBuffer.c:41
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
void Abc_BufCollectTfiCone_rec ( Abc_Obj_t pNode,
Vec_Int_t vNodes 
)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 624 of file sclBuffer.c.

625 {
626  Abc_Obj_t * pNext;
627  int i;
628  if ( Abc_NodeIsTravIdCurrent( pNode ) )
629  return;
630  Abc_NodeSetTravIdCurrent( pNode );
631  if ( Abc_ObjIsCi(pNode) )
632  return;
633  assert( Abc_ObjIsNode(pNode) );
634  Abc_ObjForEachFanin( pNode, pNext, i )
635  Abc_BufCollectTfiCone_rec( pNext, vNodes );
636  Vec_IntPush( vNodes, Abc_ObjId(pNode) );
637 }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
Definition: abc.h:351
void Abc_BufCollectTfiCone_rec(Abc_Obj_t *pNode, Vec_Int_t *vNodes)
Definition: sclBuffer.c:624
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:411
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
#define assert(ex)
Definition: util_old.h:213
static void Abc_NodeSetTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:409
void Abc_BufCollectTfoCone ( Buf_Man_t p,
Abc_Obj_t pObj 
)

Definition at line 593 of file sclBuffer.c.

594 {
595  Vec_IntClear( p->vTfCone );
598 }
void Abc_BufCollectTfoCone_rec(Abc_Obj_t *pNode, Vec_Int_t *vNodes)
Definition: sclBuffer.c:578
Vec_Int_t * vTfCone
Definition: sclBuffer.c:56
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
Abc_Ntk_t * pNtk
Definition: sclBuffer.c:41
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
void Abc_BufCollectTfoCone_rec ( Abc_Obj_t pNode,
Vec_Int_t vNodes 
)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 578 of file sclBuffer.c.

579 {
580  Abc_Obj_t * pNext;
581  int i;
582  if ( Abc_NodeIsTravIdCurrent( pNode ) )
583  return;
584  Abc_NodeSetTravIdCurrent( pNode );
585  if ( Abc_ObjIsCo(pNode) )
586  return;
587  assert( Abc_ObjIsCi(pNode) || Abc_ObjIsNode(pNode) );
588  Abc_ObjForEachFanout( pNode, pNext, i )
589  Abc_BufCollectTfoCone_rec( pNext, vNodes );
590  if ( Abc_ObjIsNode(pNode) )
591  Vec_IntPush( vNodes, Abc_ObjId(pNode) );
592 }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
Definition: abc.h:351
void Abc_BufCollectTfoCone_rec(Abc_Obj_t *pNode, Vec_Int_t *vNodes)
Definition: sclBuffer.c:578
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
Definition: abc.h:352
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
if(last==0)
Definition: sparse_int.h:34
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:411
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition: abc.h:526
#define assert(ex)
Definition: util_old.h:213
static void Abc_NodeSetTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:409
float Abc_BufComputeArr ( Buf_Man_t p,
Abc_Obj_t pObj 
)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 507 of file sclBuffer.c.

508 {
509  Abc_Obj_t * pFanin;
510  int i;
511  float DelayF, Delay = -ABC_INFINITY;
512  Abc_ObjForEachFanin( pObj, pFanin, i )
513  {
514  if ( Vec_IntEntry(p->vOffsets, Abc_ObjId(pObj)) == -ABC_INFINITY )
515  continue;
516  DelayF = Abc_BufNodeArr(p, pFanin) + Abc_BufEdgeDelay(p, pObj, i);
517  if ( Delay < DelayF )
518  Delay = DelayF;
519  }
520  Abc_BufSetNodeArr( p, pObj, Delay );
521  return Delay;
522 }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
Vec_Int_t * vOffsets
Definition: sclBuffer.c:42
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Abc_BufNodeArr(Buf_Man_t *p, Abc_Obj_t *pObj)
Definition: sclBuffer.c:66
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
static void Abc_BufSetNodeArr(Buf_Man_t *p, Abc_Obj_t *pObj, int f)
Definition: sclBuffer.c:68
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
static int Abc_BufEdgeDelay(Buf_Man_t *p, Abc_Obj_t *pObj, int i)
Definition: sclBuffer.c:70
int Abc_BufComputeAverage ( Buf_Man_t p,
int  iPivot,
Vec_Int_t vOrder 
)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 832 of file sclBuffer.c.

833 {
834  Abc_Obj_t * pObj, * pFanout;
835  int i, Average = 0;
836  pObj = Abc_NtkObj( p->pNtk, iPivot );
837  Abc_NtkForEachObjVec( vOrder, p->pNtk, pFanout, i )
838  Average += Abc_BufEdgeSlack( p, pObj, pFanout );
839  return Average / Vec_IntSize(vOrder);
840 }
static int Abc_BufEdgeSlack(Buf_Man_t *p, Abc_Obj_t *pObj, Abc_Obj_t *pFan)
Definition: sclBuffer.c:73
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
#define Abc_NtkForEachObjVec(vIds, pNtk, pObj, i)
Definition: abc.h:452
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Abc_Ntk_t * pNtk
Definition: sclBuffer.c:41
float Abc_BufComputeDep ( Buf_Man_t p,
Abc_Obj_t pObj 
)

Definition at line 523 of file sclBuffer.c.

524 {
525  Abc_Obj_t * pFanout;
526  int i;
527  float DelayF, Delay = -ABC_INFINITY;
528  Abc_ObjForEachFanout( pObj, pFanout, i )
529  {
530  if ( Vec_IntEntry(p->vOffsets, Abc_ObjId(pFanout)) == -ABC_INFINITY )
531  continue;
532  DelayF = Abc_BufNodeDep(p, pFanout) + Abc_BufEdgeDelay(p, pFanout, Abc_NodeFindFanin(pFanout, pObj));
533  if ( Delay < DelayF )
534  Delay = DelayF;
535  }
536  Abc_BufSetNodeDep( p, pObj, Delay );
537  return Delay;
538 }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
Vec_Int_t * vOffsets
Definition: sclBuffer.c:42
ABC_DLL int Abc_NodeFindFanin(Abc_Obj_t *pNode, Abc_Obj_t *pFanin)
Definition: abcUtil.c:758
static void Abc_BufSetNodeDep(Buf_Man_t *p, Abc_Obj_t *pObj, int f)
Definition: sclBuffer.c:69
static int Abc_BufNodeDep(Buf_Man_t *p, Abc_Obj_t *pObj)
Definition: sclBuffer.c:67
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition: abc.h:526
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
static int Abc_BufEdgeDelay(Buf_Man_t *p, Abc_Obj_t *pObj, int i)
Definition: sclBuffer.c:70
int Abc_BufCountNonCritical ( Buf_Man_t p,
Abc_Obj_t pObj 
)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 857 of file sclBuffer.c.

858 {
859  Abc_Obj_t * pFanout;
860  int i;
861  Vec_IntClear( p->vNonCrit );
862  Abc_ObjForEachFanout( pObj, pFanout, i )
863  if ( Abc_BufEdgeSlack( p, pObj, pFanout ) > 7*BUF_SCALE/2 )
864  Vec_IntPush( p->vNonCrit, Abc_ObjId(pFanout) );
865  return Vec_IntSize(p->vNonCrit);
866 }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
static int Abc_BufEdgeSlack(Buf_Man_t *p, Abc_Obj_t *pObj, Abc_Obj_t *pFan)
Definition: sclBuffer.c:73
if(last==0)
Definition: sparse_int.h:34
Vec_Int_t * vNonCrit
Definition: sclBuffer.c:55
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
#define BUF_SCALE
DECLARATIONS ///.
Definition: sclBuffer.c:31
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition: abc.h:526
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
void Abc_BufCreateEdges ( Buf_Man_t p,
Abc_Obj_t pObj 
)

Definition at line 547 of file sclBuffer.c.

548 {
549  int k;
550  Mio_Gate_t * pGate = Abc_ObjIsCo(pObj) ? NULL : (Mio_Gate_t *)pObj->pData;
552  for ( k = 0; k < Abc_ObjFaninNum(pObj); k++ )
553  Vec_IntPush( p->vEdges, pGate ? (int)(1.0 * BUF_SCALE * Mio_GateReadPinDelay(pGate, k) / p->DelayInv) : 0 );
554 }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
Vec_Int_t * vOffsets
Definition: sclBuffer.c:42
float Mio_GateReadPinDelay(Mio_Gate_t *pGate, int iPin)
Definition: mioApi.c:201
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
Definition: abc.h:352
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
#define BUF_SCALE
DECLARATIONS ///.
Definition: sclBuffer.c:31
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
void * pData
Definition: abc.h:145
Vec_Int_t * vEdges
Definition: sclBuffer.c:43
float DelayInv
Definition: sclBuffer.c:51
static int Abc_BufEdgeDelay ( Buf_Man_t p,
Abc_Obj_t pObj,
int  i 
)
inlinestatic

Definition at line 70 of file sclBuffer.c.

70 { return Vec_IntEntry( p->vEdges, Vec_IntEntry(p->vOffsets, Abc_ObjId(pObj)) + i ); }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
Vec_Int_t * vOffsets
Definition: sclBuffer.c:42
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Vec_Int_t * vEdges
Definition: sclBuffer.c:43
static int Abc_BufEdgeSlack ( Buf_Man_t p,
Abc_Obj_t pObj,
Abc_Obj_t pFan 
)
inlinestatic

Definition at line 73 of file sclBuffer.c.

73 { return p->DelayMax - Abc_BufNodeArr(p, pObj) - Abc_BufNodeDep(p, pFan) - Abc_BufEdgeDelay(p, pFan, Abc_NodeFindFanin(pFan, pObj)); }
int DelayMax
Definition: sclBuffer.c:50
ABC_DLL int Abc_NodeFindFanin(Abc_Obj_t *pNode, Abc_Obj_t *pFanin)
Definition: abcUtil.c:758
static int Abc_BufNodeDep(Buf_Man_t *p, Abc_Obj_t *pObj)
Definition: sclBuffer.c:67
static int Abc_BufNodeArr(Buf_Man_t *p, Abc_Obj_t *pObj)
Definition: sclBuffer.c:66
static int Abc_BufEdgeDelay(Buf_Man_t *p, Abc_Obj_t *pObj, int i)
Definition: sclBuffer.c:70
Abc_Obj_t* Abc_BufFindNonBuffDriver ( Buf_Man_t p,
Abc_Obj_t pObj 
)

Definition at line 841 of file sclBuffer.c.

842 {
843  return (Abc_ObjIsNode(pObj) && Abc_NodeIsBuf(pObj)) ? Abc_BufFindNonBuffDriver(p, Abc_ObjFanin0(pObj)) : pObj;
844 }
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
Abc_Obj_t * Abc_BufFindNonBuffDriver(Buf_Man_t *p, Abc_Obj_t *pObj)
Definition: sclBuffer.c:841
ABC_DLL int Abc_NodeIsBuf(Abc_Obj_t *pNode)
Definition: abcObj.c:920
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
static int Abc_BufNodeArr ( Buf_Man_t p,
Abc_Obj_t pObj 
)
inlinestatic

Definition at line 66 of file sclBuffer.c.

66 { return Vec_IntEntry( p->vArr, Abc_ObjId(pObj) ); }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Vec_Int_t * vArr
Definition: sclBuffer.c:44
static int Abc_BufNodeDep ( Buf_Man_t p,
Abc_Obj_t pObj 
)
inlinestatic

Definition at line 67 of file sclBuffer.c.

67 { return Vec_IntEntry( p->vDep, Abc_ObjId(pObj) ); }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
Vec_Int_t * vDep
Definition: sclBuffer.c:45
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Abc_BufNodeSlack ( Buf_Man_t p,
Abc_Obj_t pObj 
)
inlinestatic

Definition at line 72 of file sclBuffer.c.

72 { return p->DelayMax - Abc_BufNodeArr(p, pObj) - Abc_BufNodeDep(p, pObj); }
int DelayMax
Definition: sclBuffer.c:50
static int Abc_BufNodeDep(Buf_Man_t *p, Abc_Obj_t *pObj)
Definition: sclBuffer.c:67
static int Abc_BufNodeArr(Buf_Man_t *p, Abc_Obj_t *pObj)
Definition: sclBuffer.c:66
void Abc_BufPerformOne ( Buf_Man_t p,
int  iPivot,
int  fSkipDup,
int  fVerbose 
)

Definition at line 867 of file sclBuffer.c.

868 {
869  Abc_Obj_t * pObj, * pFanout;
870  int i, j, nCrit, nNonCrit;
871 // int DelayMax = p->DelayMax;
872  assert( Abc_NtkObjNumMax(p->pNtk) + 30 < p->nObjAlloc );
873  pObj = Abc_NtkObj( p->pNtk, iPivot );
874 // assert( Vec_FltEntry(p->vCounts, iPivot) == (float)Abc_ObjFanoutNum(pObj) );
875  nNonCrit = Abc_BufCountNonCritical( p, pObj );
876  nCrit = Abc_ObjFanoutNum(pObj) - nNonCrit;
877 if ( fVerbose )
878 {
879 //Abc_BufPrintOne( p, iPivot );
880 printf( "ObjId = %6d : %-10s FI = %d. FO =%4d. Crit =%4d. ",
881  Abc_ObjId(pObj), Mio_GateReadName((Mio_Gate_t *)pObj->pData), Abc_ObjFaninNum(pObj), Abc_ObjFanoutNum(pObj), nCrit );
882 }
883  // consider three cases
884  if ( nCrit > 0 && nNonCrit > 1 )
885  {
886  // (1) both critical and non-critical are present - split them by adding buffer
887  Abc_Obj_t * pBuffer = Abc_NtkCreateNodeBuf( p->pNtk, pObj );
888  Abc_NtkForEachObjVec( p->vNonCrit, p->pNtk, pFanout, i )
889  Abc_ObjPatchFanin( pFanout, pObj, pBuffer );
890  // update timing
891  Abc_BufCreateEdges( p, pBuffer );
892  Abc_BufUpdateArr( p, pBuffer );
893  Abc_BufUpdateDep( p, pBuffer );
894  Abc_BufAddToQue( p, pObj );
895  Abc_BufAddToQue( p, pBuffer );
896  Abc_SclTimeIncUpdateLevel( pBuffer );
897  p->nSeparate++;
898 if ( fVerbose )
899 printf( "Adding buffer\n" );
900  }
901  else if ( !fSkipDup && nCrit > 0 && Abc_ObjIsNode(pObj) && Abc_ObjFanoutNum(pObj) > p->nFanMin )//&& Abc_ObjLevel(pObj) < 4 )//&& Abc_ObjFaninNum(pObj) < 2 )
902  {
903  // (2) only critical are present - duplicate
904  Abc_Obj_t * pClone = Abc_NtkDupObj( p->pNtk, pObj, 0 );
905  Abc_ObjForEachFanin( pObj, pFanout, i )
906  Abc_ObjAddFanin( pClone, pFanout );
907  Abc_NodeCollectFanouts( pObj, p->vFanouts );
908  Vec_PtrForEachEntryStop( Abc_Obj_t *, p->vFanouts, pFanout, i, Vec_PtrSize(p->vFanouts)/2 )
909  Abc_ObjPatchFanin( pFanout, pObj, pClone );
910  // update timing
911  Abc_BufCreateEdges( p, pClone );
912  Abc_BufSetNodeArr( p, pClone, Abc_BufNodeArr(p, pObj) );
913  Abc_BufUpdateDep( p, pObj );
914  Abc_BufUpdateDep( p, pClone );
915  Abc_BufAddToQue( p, pObj );
916  Abc_BufAddToQue( p, pClone );
917  Abc_ObjForEachFanin( pObj, pFanout, i )
918  Abc_BufAddToQue( p, pFanout );
919  Abc_SclTimeIncUpdateLevel( pClone );
920  p->nDuplicate++;
921 // printf( "Duplicating %s on level %d\n", Mio_GateReadName((Mio_Gate_t *)pObj->pData), Abc_ObjLevel(pObj) );
922 if ( fVerbose )
923 printf( "Duplicating node\n" );
924  }
925  else if ( (nCrit > 0 && Abc_ObjFanoutNum(pObj) > 8) || Abc_ObjFanoutNum(pObj) > p->nFanMax )
926  {
927  // (2) only critical or only non-critical - add buffer/inverter tree
928  int nDegree, n1Degree, n1Number, nFirst;
929  int iFirstBuf = Abc_NtkObjNumMax( p->pNtk );
930 // nDegree = Abc_MinInt( 3, (int)pow(Abc_ObjFanoutNum(pObj), 0.34) );
931  nDegree = Abc_MinInt( 10, (int)pow(Abc_ObjFanoutNum(pObj), 0.5) );
932  n1Degree = Abc_ObjFanoutNum(pObj) / nDegree + 1;
933  n1Number = Abc_ObjFanoutNum(pObj) % nDegree;
934  nFirst = n1Degree * n1Number;
935  p->nBranchCrit += (nCrit > 0);
936  // create inverters
937  Abc_NodeCollectFanouts( pObj, p->vFanouts );
938  if ( Abc_ObjIsNode(pObj) && Abc_NodeIsBuf(pObj) )
939  {
940  p->nBranch0++;
941  pObj->pData = Mio_LibraryReadInv((Mio_Library_t *)p->pNtk->pManFunc);
942  Abc_BufSetEdgeDelay( p, pObj, 0, BUF_SCALE );
943  assert( Abc_NodeIsInv(pObj) );
944  for ( i = 0; i < nDegree; i++ )
945  Abc_NtkCreateNodeInv( p->pNtk, pObj );
946 if ( fVerbose )
947 printf( "Adding %d inverters\n", nDegree );
948  }
949  else
950  {
951  p->nBranch1++;
952  for ( i = 0; i < nDegree; i++ )
953  Abc_NtkCreateNodeBuf( p->pNtk, pObj );
954 if ( fVerbose )
955 printf( "Adding %d buffers\n", nDegree );
956  }
957  // connect inverters
958  Vec_PtrForEachEntry( Abc_Obj_t *, p->vFanouts, pFanout, i )
959  {
960  j = (i < nFirst) ? i/n1Degree : n1Number + ((i - nFirst)/(n1Degree - 1));
961  assert( j >= 0 && j < nDegree );
962  Abc_ObjPatchFanin( pFanout, pObj, Abc_NtkObj(p->pNtk, iFirstBuf + j) );
963  }
964  // update timing
965  for ( i = 0; i < nDegree; i++ )
966  Abc_BufCreateEdges( p, Abc_NtkObj(p->pNtk, iFirstBuf + i) );
967  Abc_BufUpdateArr( p, pObj );
968  for ( i = 0; i < nDegree; i++ )
969  Abc_BufComputeDep( p, Abc_NtkObj(p->pNtk, iFirstBuf + i) );
970  Abc_BufUpdateDep( p, pObj );
971  for ( i = 0; i < nDegree; i++ )
972  Abc_BufAddToQue( p, Abc_NtkObj(p->pNtk, iFirstBuf + i) );
973  for ( i = 0; i < nDegree; i++ )
974  Abc_SclTimeIncUpdateLevel( Abc_NtkObj(p->pNtk, iFirstBuf + i) );
975  }
976  else
977  {
978 if ( fVerbose )
979 printf( "Doing nothing\n" );
980  }
981 // if ( DelayMax != p->DelayMax )
982 // printf( "%d (%.2f) ", p->DelayMax, 1.0 * p->DelayMax * p->DelayInv / BUF_SCALE );
983 }
static void Abc_BufSetEdgeDelay(Buf_Man_t *p, Abc_Obj_t *pObj, int i, int f)
Definition: sclBuffer.c:71
float Abc_BufComputeDep(Buf_Man_t *p, Abc_Obj_t *pObj)
Definition: sclBuffer.c:523
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition: abcObj.c:337
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
void Abc_SclTimeIncUpdateLevel(Abc_Obj_t *pObj)
Definition: sclSize.c:576
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
ABC_DLL int Abc_NodeIsBuf(Abc_Obj_t *pNode)
Definition: abcObj.c:920
void Abc_BufUpdateArr(Buf_Man_t *p, Abc_Obj_t *pObj)
Definition: sclBuffer.c:599
ABC_DLL void Abc_ObjPatchFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFaninOld, Abc_Obj_t *pFaninNew)
Definition: abcFanio.c:172
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
static int Abc_MinInt(int a, int b)
Definition: abc_global.h:239
void Abc_BufAddToQue(Buf_Man_t *p, Abc_Obj_t *pObj)
Definition: sclBuffer.c:555
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeInv(Abc_Ntk_t *pNtk, Abc_Obj_t *pFanin)
Definition: abcObj.c:662
#define Abc_NtkForEachObjVec(vIds, pNtk, pObj, i)
Definition: abc.h:452
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeBuf(Abc_Ntk_t *pNtk, Abc_Obj_t *pFanin)
Definition: abcObj.c:692
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
Vec_Int_t * vNonCrit
Definition: sclBuffer.c:55
STRUCTURE DEFINITIONS ///.
Definition: mioInt.h:61
static int Abc_BufNodeArr(Buf_Man_t *p, Abc_Obj_t *pObj)
Definition: sclBuffer.c:66
#define BUF_SCALE
DECLARATIONS ///.
Definition: sclBuffer.c:31
int Abc_BufCountNonCritical(Buf_Man_t *p, Abc_Obj_t *pObj)
Definition: sclBuffer.c:857
#define Vec_PtrForEachEntryStop(Type, vVec, pEntry, i, Stop)
Definition: vecPtr.h:59
ABC_DLL int Abc_NodeIsInv(Abc_Obj_t *pNode)
Definition: abcObj.c:950
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
static void Abc_BufSetNodeArr(Buf_Man_t *p, Abc_Obj_t *pObj, int f)
Definition: sclBuffer.c:68
void Abc_BufUpdateDep(Buf_Man_t *p, Abc_Obj_t *pObj)
Definition: sclBuffer.c:644
#define assert(ex)
Definition: util_old.h:213
Abc_Ntk_t * pNtk
Definition: sclBuffer.c:41
void * pData
Definition: abc.h:145
ABC_DLL void Abc_NodeCollectFanouts(Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
Definition: abcUtil.c:1607
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
void Abc_BufCreateEdges(Buf_Man_t *p, Abc_Obj_t *pObj)
Definition: sclBuffer.c:547
char * Mio_GateReadName(Mio_Gate_t *pGate)
Definition: mioApi.c:143
Mio_Gate_t * Mio_LibraryReadInv(Mio_Library_t *pLib)
Definition: mioApi.c:48
int nObjAlloc
Definition: sclBuffer.c:49
void Abc_BufPrintOne ( Buf_Man_t p,
int  iPivot 
)

Definition at line 777 of file sclBuffer.c.

778 {
779  Abc_Obj_t * pObj, * pFanout;
780  Vec_Int_t * vOrder;
781  int i, Slack;
782  pObj = Abc_NtkObj( p->pNtk, iPivot );
783  vOrder = Abc_BufSortByDelay( p, iPivot );
784  printf( "Node %5d Fi = %d Fo = %3d Lev = %3d : {", iPivot, Abc_ObjFaninNum(pObj), Abc_ObjFanoutNum(pObj), Abc_ObjLevel(pObj) );
785  Abc_NtkForEachObjVec( vOrder, p->pNtk, pFanout, i )
786  {
787  Slack = Abc_BufEdgeSlack( p, pObj, pFanout );
788  printf( " %d(%d)", Abc_ObjId(pFanout), Slack );
789  }
790  printf( " }\n" );
791 }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Abc_BufEdgeSlack(Buf_Man_t *p, Abc_Obj_t *pObj, Abc_Obj_t *pFan)
Definition: sclBuffer.c:73
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
static int Abc_ObjLevel(Abc_Obj_t *pObj)
Definition: abc.h:330
#define Abc_NtkForEachObjVec(vIds, pNtk, pObj, i)
Definition: abc.h:452
Abc_Ntk_t * pNtk
Definition: sclBuffer.c:41
Vec_Int_t * Abc_BufSortByDelay(Buf_Man_t *p, int iPivot)
Definition: sclBuffer.c:756
void Abc_BufReplaceBufsByInvs ( Abc_Ntk_t pNtk)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 804 of file sclBuffer.c.

805 {
806  Abc_Obj_t * pObj, * pInv;
807  int i, Counter = 0;
808  Abc_NtkForEachNode( pNtk, pObj, i )
809  {
810  if ( !Abc_NodeIsBuf(pObj) )
811  continue;
812  assert( pObj->pData == Mio_LibraryReadBuf((Mio_Library_t *)pNtk->pManFunc) );
814  pInv = Abc_NtkCreateNodeInv( pNtk, Abc_ObjFanin0(pObj) );
815  Abc_ObjPatchFanin( pObj, Abc_ObjFanin0(pObj), pInv );
816  Counter++;
817  }
818  printf( "Replaced %d buffers by invertor pairs.\n", Counter );
819 }
Mio_Gate_t * Mio_LibraryReadBuf(Mio_Library_t *pLib)
Definition: mioApi.c:47
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
ABC_DLL int Abc_NodeIsBuf(Abc_Obj_t *pNode)
Definition: abcObj.c:920
ABC_DLL void Abc_ObjPatchFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFaninOld, Abc_Obj_t *pFaninNew)
Definition: abcFanio.c:172
void * pManFunc
Definition: abc.h:191
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeInv(Abc_Ntk_t *pNtk, Abc_Obj_t *pFanin)
Definition: abcObj.c:662
STRUCTURE DEFINITIONS ///.
Definition: mioInt.h:61
static int Counter
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
Mio_Gate_t * Mio_LibraryReadInv(Mio_Library_t *pLib)
Definition: mioApi.c:48
static void Abc_BufSetEdgeDelay ( Buf_Man_t p,
Abc_Obj_t pObj,
int  i,
int  f 
)
inlinestatic

Definition at line 71 of file sclBuffer.c.

71 { Vec_IntWriteEntry( p->vEdges, Vec_IntEntry(p->vOffsets, Abc_ObjId(pObj)) + i, f ); }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
Vec_Int_t * vOffsets
Definition: sclBuffer.c:42
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Vec_Int_t * vEdges
Definition: sclBuffer.c:43
static void Abc_BufSetNodeArr ( Buf_Man_t p,
Abc_Obj_t pObj,
int  f 
)
inlinestatic

Definition at line 68 of file sclBuffer.c.

68 { Vec_IntWriteEntry( p->vArr, Abc_ObjId(pObj), f ); }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
Vec_Int_t * vArr
Definition: sclBuffer.c:44
static void Abc_BufSetNodeDep ( Buf_Man_t p,
Abc_Obj_t pObj,
int  f 
)
inlinestatic

Definition at line 69 of file sclBuffer.c.

69 { Vec_IntWriteEntry( p->vDep, Abc_ObjId(pObj), f ); }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
Vec_Int_t * vDep
Definition: sclBuffer.c:45
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
Vec_Int_t* Abc_BufSortByDelay ( Buf_Man_t p,
int  iPivot 
)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 756 of file sclBuffer.c.

757 {
758  Abc_Obj_t * pObj, * pFanout;
759  int i, Slack, * pOrder;
760  Vec_IntClear( p->vDelays );
761  pObj = Abc_NtkObj( p->pNtk, iPivot );
762  Abc_ObjForEachFanout( pObj, pFanout, i )
763  {
764  Slack = Abc_BufEdgeSlack(p, pObj, pFanout);
765  assert( Slack >= 0 );
766  Vec_IntPush( p->vDelays, Abc_MaxInt(0, Slack) );
767  }
768  pOrder = Abc_QuickSortCost( Vec_IntArray(p->vDelays), Vec_IntSize(p->vDelays), 0 );
769  Vec_IntClear( p->vOrder );
770  for ( i = 0; i < Vec_IntSize(p->vDelays); i++ )
771  Vec_IntPush( p->vOrder, Abc_ObjId(Abc_ObjFanout(pObj, pOrder[i])) );
772  ABC_FREE( pOrder );
773 // for ( i = 0; i < Vec_IntSize(p->vDelays); i++ )
774 // printf( "%5d - %5d ", Vec_IntEntry(p->vOrder, i), Abc_BufEdgeSlack(p, pObj, Abc_NtkObj(p->pNtk, Vec_IntEntry(p->vOrder, i))) );
775  return p->vOrder;
776 }
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
int * Abc_QuickSortCost(int *pCosts, int nSize, int fDecrease)
Definition: utilSort.c:719
Vec_Int_t * vDelays
Definition: sclBuffer.c:54
static int Abc_BufEdgeSlack(Buf_Man_t *p, Abc_Obj_t *pObj, Abc_Obj_t *pFan)
Definition: sclBuffer.c:73
Vec_Int_t * vOrder
Definition: sclBuffer.c:53
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition: abc.h:526
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define assert(ex)
Definition: util_old.h:213
Abc_Ntk_t * pNtk
Definition: sclBuffer.c:41
static Abc_Obj_t * Abc_ObjFanout(Abc_Obj_t *pObj, int i)
Definition: abc.h:370
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
void Abc_BufUpdateArr ( Buf_Man_t p,
Abc_Obj_t pObj 
)

Definition at line 599 of file sclBuffer.c.

600 {
601  Abc_Obj_t * pNext;
602  int i, Delay;
603 // assert( Abc_ObjIsNode(pObj) );
604  Abc_BufCollectTfoCone( p, pObj );
606  Abc_NtkForEachObjVec( p->vTfCone, p->pNtk, pNext, i )
607  {
608  Delay = Abc_BufComputeArr( p, pNext );
609  p->DelayMax = Abc_MaxInt( p->DelayMax, Delay );
610  }
611 }
int DelayMax
Definition: sclBuffer.c:50
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
float Abc_BufComputeArr(Buf_Man_t *p, Abc_Obj_t *pObj)
Definition: sclBuffer.c:507
static void Vec_IntReverseOrder(Vec_Int_t *p)
Definition: vecInt.h:1042
void Abc_BufCollectTfoCone(Buf_Man_t *p, Abc_Obj_t *pObj)
Definition: sclBuffer.c:593
#define Abc_NtkForEachObjVec(vIds, pNtk, pObj, i)
Definition: abc.h:452
Vec_Int_t * vTfCone
Definition: sclBuffer.c:56
Abc_Ntk_t * pNtk
Definition: sclBuffer.c:41
void Abc_BufUpdateDep ( Buf_Man_t p,
Abc_Obj_t pObj 
)

Definition at line 644 of file sclBuffer.c.

645 {
646  Abc_Obj_t * pNext;
647  int i, Delay;
648 // assert( Abc_ObjIsNode(pObj) );
649  Abc_BufCollectTfiCone( p, pObj );
651  Abc_NtkForEachObjVec( p->vTfCone, p->pNtk, pNext, i )
652  {
653  Delay = Abc_BufComputeDep( p, pNext );
654  p->DelayMax = Abc_MaxInt( p->DelayMax, Delay );
655  }
656 }
float Abc_BufComputeDep(Buf_Man_t *p, Abc_Obj_t *pObj)
Definition: sclBuffer.c:523
int DelayMax
Definition: sclBuffer.c:50
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static void Vec_IntReverseOrder(Vec_Int_t *p)
Definition: vecInt.h:1042
#define Abc_NtkForEachObjVec(vIds, pNtk, pObj, i)
Definition: abc.h:452
Vec_Int_t * vTfCone
Definition: sclBuffer.c:56
void Abc_BufCollectTfiCone(Buf_Man_t *p, Abc_Obj_t *pObj)
Definition: sclBuffer.c:638
Abc_Ntk_t * pNtk
Definition: sclBuffer.c:41
void Abc_BufUpdateGlobal ( Buf_Man_t p)

Definition at line 539 of file sclBuffer.c.

540 {
541  Abc_Obj_t * pObj;
542  int i;
543  p->DelayMax = 0;
544  Abc_NtkForEachCo( p->pNtk, pObj, i )
545  p->DelayMax = Abc_MaxInt( p->DelayMax, Abc_BufNodeArr(p, Abc_ObjFanin0(pObj)) );
546 }
int DelayMax
Definition: sclBuffer.c:50
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_BufNodeArr(Buf_Man_t *p, Abc_Obj_t *pObj)
Definition: sclBuffer.c:66
Abc_Ntk_t * pNtk
Definition: sclBuffer.c:41
int Abc_NodeCompareLevels ( Abc_Obj_t **  pp1,
Abc_Obj_t **  pp2 
)

Definition at line 341 of file sclBuffer.c.

342 {
343  int Diff = Abc_ObjLevel(*pp1) - Abc_ObjLevel(*pp2);
344  if ( Diff < 0 )
345  return -1;
346  if ( Diff > 0 )
347  return 1;
348  Diff = (*pp1)->Id - (*pp2)->Id; // needed to make qsort() platform-infependent
349  if ( Diff < 0 )
350  return -1;
351  if ( Diff > 0 )
352  return 1;
353  return 0;
354 }
static int Abc_ObjLevel(Abc_Obj_t *pObj)
Definition: abc.h:330
void Abc_NodeInvUpdateFanPolarity ( Abc_Obj_t pObj)

Function*************************************************************

Synopsis [Performs buffering of the mapped network (old code).]

Description []

SideEffects []

SeeAlso []

Definition at line 320 of file sclBuffer.c.

321 {
322  Abc_Obj_t * pFanout;
323  int i;
324  assert( Abc_ObjFaninNum(pObj) == 0 || Abc_SclObjIsBufInv(pObj) );
325  Abc_ObjForEachFanout( pObj, pFanout, i )
326  {
327  assert( Abc_ObjFaninNum(pFanout) > 0 );
328  if ( Abc_SclObjIsBufInv(pFanout) )
329  Abc_NodeInvUpdateFanPolarity( pFanout );
330  else
331  Abc_ObjFaninFlipPhase( pFanout, Abc_NodeFindFanin(pFanout, pObj) );
332  }
333 }
ABC_DLL int Abc_NodeFindFanin(Abc_Obj_t *pNode, Abc_Obj_t *pFanin)
Definition: abcUtil.c:758
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition: abc.h:526
static int Abc_SclObjIsBufInv(Abc_Obj_t *pObj)
Definition: sclBuffer.c:112
#define assert(ex)
Definition: util_old.h:213
static void Abc_ObjFaninFlipPhase(Abc_Obj_t *p, int i)
Definition: abc.h:393
void Abc_NodeInvUpdateFanPolarity(Abc_Obj_t *pObj)
Definition: sclBuffer.c:320
void Abc_NodeInvUpdateObjFanoutPolarity ( Abc_Obj_t pObj,
Abc_Obj_t pFanout 
)

Definition at line 334 of file sclBuffer.c.

335 {
336  if ( Abc_SclObjIsBufInv(pFanout) )
337  Abc_NodeInvUpdateFanPolarity( pFanout );
338  else
339  Abc_ObjFaninFlipPhase( pFanout, Abc_NodeFindFanin(pFanout, pObj) );
340 }
ABC_DLL int Abc_NodeFindFanin(Abc_Obj_t *pNode, Abc_Obj_t *pFanin)
Definition: abcUtil.c:758
static int Abc_SclObjIsBufInv(Abc_Obj_t *pObj)
Definition: sclBuffer.c:112
static void Abc_ObjFaninFlipPhase(Abc_Obj_t *p, int i)
Definition: abc.h:393
void Abc_NodeInvUpdateFanPolarity(Abc_Obj_t *pObj)
Definition: sclBuffer.c:320
Abc_Ntk_t* Abc_SclBufferPhase ( Abc_Ntk_t pNtk,
int  fVerbose 
)

Definition at line 198 of file sclBuffer.c.

199 {
200  Abc_Ntk_t * pNtkNew;
201  Vec_Int_t * vInvs;
202  Abc_Obj_t * pObj, * pFanin, * pFaninNew;
203  int nNodesOld = Abc_NtkObjNumMax(pNtk);
204  int i, k, Counter = 0, Counter2 = 0, Total = 0;
205  assert( pNtk->vPhases != NULL );
206  vInvs = Vec_IntStart( Abc_NtkObjNumMax(pNtk) );
207  Abc_NtkForEachNodeCo( pNtk, pObj, i )
208  {
209  if ( i >= nNodesOld )
210  break;
211  Abc_ObjForEachFanin( pObj, pFanin, k )
212  {
213  Total++;
214  if ( !Abc_ObjFaninPhase(pObj, k) )
215  continue;
216  if ( Vec_IntEntry(vInvs, Abc_ObjId(pFanin)) == 0 || Abc_ObjIsCi(pFanin) ) // allow PIs to have high fanout - to be fixed later
217  {
218  pFaninNew = Abc_NtkCreateNodeInv( pNtk, pFanin );
219  Vec_IntWriteEntry( vInvs, Abc_ObjId(pFanin), Abc_ObjId(pFaninNew) );
220  Counter++;
221  }
222  pFaninNew = Abc_NtkObj( pNtk, Vec_IntEntry(vInvs, Abc_ObjId(pFanin)) );
223  Abc_ObjPatchFanin( pObj, pFanin, pFaninNew );
224  Counter2++;
225  }
226  }
227  if ( fVerbose )
228  printf( "Added %d inverters (%.2f %% fanins) (%.2f %% compl fanins).\n",
229  Counter, 100.0 * Counter / Total, 100.0 * Counter2 / Total );
230  Vec_IntFree( vInvs );
231  Vec_IntFillExtra( pNtk->vPhases, Abc_NtkObjNumMax(pNtk), 0 );
232  // duplicate network in topo order
233  vInvs = pNtk->vPhases;
234  pNtk->vPhases = NULL;
235  pNtkNew = Abc_NtkDupDfs( pNtk );
236  pNtk->vPhases = vInvs;
237  return pNtkNew;
238 }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
Definition: abc.h:351
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
static void Vec_IntFillExtra(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:376
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
ABC_DLL void Abc_ObjPatchFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFaninOld, Abc_Obj_t *pFaninNew)
Definition: abcFanio.c:172
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeInv(Abc_Ntk_t *pNtk, Abc_Obj_t *pFanin)
Definition: abcObj.c:662
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Vec_Int_t * vPhases
Definition: abc.h:208
static int Counter
ABC_DLL Abc_Ntk_t * Abc_NtkDupDfs(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:476
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
#define Abc_NtkForEachNodeCo(pNtk, pNode, i)
Definition: abc.h:491
#define assert(ex)
Definition: util_old.h:213
static int Abc_ObjFaninPhase(Abc_Obj_t *p, int i)
Definition: abc.h:392
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Abc_Ntk_t* Abc_SclBufPerform ( Abc_Ntk_t pNtk,
int  FanMin,
int  FanMax,
int  fBufPis,
int  fSkipDup,
int  fVerbose 
)

Definition at line 984 of file sclBuffer.c.

985 {
986  Abc_Ntk_t * pNew;
987  Buf_Man_t * p = Buf_ManStart( pNtk, FanMin, FanMax, fBufPis );
988  int i, Limit = ABC_INFINITY;
989  Abc_NtkLevel( pNtk );
990 // if ( Abc_NtkNodeNum(pNtk) < 1000 )
991 // fSkipDup = 1;
992  for ( i = 0; i < Limit && Vec_QueSize(p->vQue); i++ )
993  Abc_BufPerformOne( p, Vec_QuePop(p->vQue), fSkipDup, fVerbose );
994  Buf_ManStop( p );
995 // Abc_BufReplaceBufsByInvs( pNtk );
996  // duplicate network in topo order
997  pNew = Abc_NtkDupDfs( pNtk );
998  Abc_SclCheckNtk( pNew, fVerbose );
999  return pNew;
1000 }
Buf_Man_t * Buf_ManStart(Abc_Ntk_t *pNtk, int FanMin, int FanMax, int fBufPis)
Definition: sclBuffer.c:669
void Abc_BufPerformOne(Buf_Man_t *p, int iPivot, int fSkipDup, int fVerbose)
Definition: sclBuffer.c:867
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Abc_SclCheckNtk(Abc_Ntk_t *p, int fVerbose)
Definition: sclBuffer.c:286
static int Vec_QuePop(Vec_Que_t *p)
Definition: vecQue.h:234
static int Vec_QueSize(Vec_Que_t *p)
Definition: vecQue.h:134
void Buf_ManStop(Buf_Man_t *p)
Definition: sclBuffer.c:723
Vec_Que_t * vQue
Definition: sclBuffer.c:47
ABC_DLL Abc_Ntk_t * Abc_NtkDupDfs(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:476
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
ABC_DLL int Abc_NtkLevel(Abc_Ntk_t *pNtk)
Definition: abcDfs.c:1265
int Abc_SclCheckNtk ( Abc_Ntk_t p,
int  fVerbose 
)

Function*************************************************************

Synopsis [Make sure the network is in topo order without dangling nodes.]

Description [Returns 1 iff the network is fine.]

SideEffects []

SeeAlso []

Definition at line 286 of file sclBuffer.c.

287 {
288  Abc_Obj_t * pObj, * pFanin;
289  int i, k, fFlag = 1;
291  Abc_NtkForEachCi( p, pObj, i )
292  Abc_NodeSetTravIdCurrent( pObj );
293  Abc_NtkForEachNode( p, pObj, i )
294  {
295  Abc_ObjForEachFanin( pObj, pFanin, k )
296  if ( !Abc_NodeIsTravIdCurrent( pFanin ) )
297  printf( "obj %d and its fanin %d are not in the topo order\n", Abc_ObjId(pObj), Abc_ObjId(pFanin) ), fFlag = 0;
298  Abc_NodeSetTravIdCurrent( pObj );
299  if ( Abc_ObjFanoutNum(pObj) == 0 )
300  printf( "node %d has no fanout\n", Abc_ObjId(pObj) ), fFlag = 0;
301  if ( !fFlag )
302  break;
303  }
304  if ( fFlag && fVerbose )
305  printf( "The network is in topo order and no dangling nodes.\n" );
306  return fFlag;
307 }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
ConcreteCell * obj
Definition: place_test.c:26
if(last==0)
Definition: sparse_int.h:34
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:411
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
static void Abc_NodeSetTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:409
int Abc_SclComputeReverseLevel ( Abc_Obj_t pObj)

Definition at line 355 of file sclBuffer.c.

356 {
357  Abc_Obj_t * pFanout;
358  int i, Level = 0;
359  Abc_ObjForEachFanout( pObj, pFanout, i )
360  Level = Abc_MaxInt( Level, pFanout->Level );
361  return Level + 1;
362 }
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition: abc.h:526
int Abc_SclCountMaxPhases ( Abc_Ntk_t pNtk)

Function*************************************************************

Synopsis [Removes buffers and inverters.]

Description []

SideEffects []

SeeAlso []

Definition at line 181 of file sclBuffer.c.

182 {
183  Vec_Int_t * vPhLevel;
184  Abc_Obj_t * pObj, * pFanin;
185  int i, k, Max = 0, MaxAll = 0;
186  vPhLevel = Vec_IntStart( Abc_NtkObjNumMax(pNtk) );
187  Abc_NtkForEachNodeCo( pNtk, pObj, i )
188  {
189  Max = 0;
190  Abc_ObjForEachFanin( pObj, pFanin, k )
191  Max = Abc_MaxInt( Max, Vec_IntEntry(vPhLevel, Abc_ObjId(pFanin)) + Abc_ObjFaninPhase(pObj, k) );
192  Vec_IntWriteEntry( vPhLevel, i, Max );
193  MaxAll = Abc_MaxInt( MaxAll, Max );
194  }
195  Vec_IntFree( vPhLevel );
196  return MaxAll;
197 }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
#define Abc_NtkForEachNodeCo(pNtk, pNode, i)
Definition: abc.h:491
static int Abc_ObjFaninPhase(Abc_Obj_t *p, int i)
Definition: abc.h:392
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
int Abc_SclGetRealFaninLit ( Abc_Obj_t pObj)

Definition at line 121 of file sclBuffer.c.

122 {
123  int iLit;
124  if ( !Abc_SclObjIsBufInv(pObj) )
125  return Abc_Var2Lit( Abc_ObjId(pObj), 0 );
126  iLit = Abc_SclGetRealFaninLit( Abc_ObjFanin0(pObj) );
127  return Abc_LitNotCond( iLit, Abc_SclIsInv(pObj) );
128 }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
int Abc_SclIsInv(Abc_Obj_t *pObj)
Definition: sclBuffer.c:116
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
static int Abc_SclObjIsBufInv(Abc_Obj_t *pObj)
Definition: sclBuffer.c:112
int Abc_SclGetRealFaninLit(Abc_Obj_t *pObj)
Definition: sclBuffer.c:121
int Abc_SclIsInv ( Abc_Obj_t pObj)

Definition at line 116 of file sclBuffer.c.

117 {
118  assert( Abc_ObjIsNode(pObj) );
119  return Mio_GateReadTruth((Mio_Gate_t *)pObj->pData) == ABC_CONST(0x5555555555555555);
120 }
word Mio_GateReadTruth(Mio_Gate_t *pGate)
Definition: mioApi.c:154
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
#define ABC_CONST(number)
PARAMETERS ///.
Definition: abc_global.h:206
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
static int Abc_SclObjIsBufInv ( Abc_Obj_t pObj)
inlinestatic

Function*************************************************************

Synopsis [Removes buffers and inverters.]

Description []

SideEffects []

SeeAlso []

Definition at line 112 of file sclBuffer.c.

113 {
114  return Abc_ObjIsNode(pObj) && Abc_ObjFaninNum(pObj) == 1;
115 }
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
Abc_Ntk_t* Abc_SclPerformBuffering ( Abc_Ntk_t p,
int  DegreeR,
int  Degree,
int  fUseInvs,
int  fVerbose 
)

Definition at line 457 of file sclBuffer.c.

458 {
459  Vec_Int_t * vCiLevs;
460  Abc_Ntk_t * pNew;
461  Abc_Obj_t * pObj;
462  int i;
464  if ( fUseInvs )
465  {
466  printf( "Warning!!! Using inverters instead of buffers.\n" );
467  if ( p->vPhases == NULL )
468  printf( "The phases are not given. The result will not verify.\n" );
469  }
470  // remember CI levels
471  vCiLevs = Vec_IntAlloc( Abc_NtkCiNum(p) );
472  Abc_NtkForEachCi( p, pObj, i )
473  Vec_IntPush( vCiLevs, Abc_ObjLevel(pObj) );
474  // perform buffering
476  Abc_NtkForEachCi( p, pObj, i )
477  Abc_SclPerformBuffering_rec( pObj, DegreeR, Degree, fUseInvs, fVerbose );
478  // recompute logic levels
479  Abc_NtkForEachCi( p, pObj, i )
480  pObj->Level = Vec_IntEntry( vCiLevs, i );
481  Abc_NtkForEachNode( p, pObj, i )
482  Abc_ObjLevelNew( pObj );
483  Vec_IntFree( vCiLevs );
484  // if phases are present
485  if ( p->vPhases )
486  Vec_IntFillExtra( p->vPhases, Abc_NtkObjNumMax(p), 0 );
487  // duplication in topo order
488  pNew = Abc_NtkDupDfs( p );
489  Abc_SclCheckNtk( pNew, fVerbose );
490 // Abc_NtkDelete( pNew );
491  return pNew;
492 }
void Abc_SclPerformBuffering_rec(Abc_Obj_t *pObj, int DegreeR, int Degree, int fUseInvs, int fVerbose)
Definition: sclBuffer.c:417
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
static void Vec_IntFillExtra(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:376
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
int Abc_SclCheckNtk(Abc_Ntk_t *p, int fVerbose)
Definition: sclBuffer.c:286
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Abc_ObjLevel(Abc_Obj_t *pObj)
Definition: abc.h:330
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
if(last==0)
Definition: sparse_int.h:34
Vec_Int_t * vPhases
Definition: abc.h:208
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
ABC_DLL Abc_Ntk_t * Abc_NtkDupDfs(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:476
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
ABC_DLL int Abc_ObjLevelNew(Abc_Obj_t *pObj)
Definition: abcTiming.c:1058
void Abc_SclPerformBuffering_rec ( Abc_Obj_t pObj,
int  DegreeR,
int  Degree,
int  fUseInvs,
int  fVerbose 
)

Definition at line 417 of file sclBuffer.c.

418 {
419  Vec_Ptr_t * vFanouts;
420  Abc_Obj_t * pBuffer;
421  Abc_Obj_t * pFanout;
422  int i, nOldFanNum;
423  if ( Abc_NodeIsTravIdCurrent( pObj ) )
424  return;
425  Abc_NodeSetTravIdCurrent( pObj );
426  pObj->Level = 0;
427  if ( Abc_ObjIsCo(pObj) )
428  return;
429  assert( Abc_ObjIsCi(pObj) || Abc_ObjIsNode(pObj) );
430  // buffer fanouts and collect reverse levels
431  Abc_ObjForEachFanout( pObj, pFanout, i )
432  Abc_SclPerformBuffering_rec( pFanout, DegreeR, Degree, fUseInvs, fVerbose );
433  // perform buffering as long as needed
434  nOldFanNum = Abc_ObjFanoutNum(pObj);
435  while ( Abc_ObjFanoutNum(pObj) > Degree )
436  Abc_SclPerformBufferingOne( pObj, Degree, fUseInvs, fVerbose );
437  // add yet another level of buffers
438  if ( DegreeR && nOldFanNum > DegreeR )
439  {
440  if ( fUseInvs )
441  pBuffer = Abc_NtkCreateNodeInv( pObj->pNtk, NULL );
442  else
443  pBuffer = Abc_NtkCreateNodeBuf( pObj->pNtk, NULL );
444  vFanouts = Vec_PtrAlloc( Abc_ObjFanoutNum(pObj) );
445  Abc_NodeCollectFanouts( pObj, vFanouts );
446  Vec_PtrForEachEntry( Abc_Obj_t *, vFanouts, pFanout, i )
447  Abc_ObjPatchFanin( pFanout, pObj, pBuffer );
448  Vec_PtrFree( vFanouts );
449  Abc_ObjAddFanin( pBuffer, pObj );
450  pBuffer->Level = Abc_SclComputeReverseLevel( pBuffer );
451  if ( fUseInvs )
452  Abc_NodeInvUpdateFanPolarity( pBuffer );
453  }
454  // compute the new level of the node
455  pObj->Level = Abc_SclComputeReverseLevel( pObj );
456 }
void Abc_SclPerformBuffering_rec(Abc_Obj_t *pObj, int DegreeR, int Degree, int fUseInvs, int fVerbose)
Definition: sclBuffer.c:417
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
Definition: abc.h:351
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
int Abc_SclComputeReverseLevel(Abc_Obj_t *pObj)
Definition: sclBuffer.c:355
unsigned Level
Definition: abc.h:142
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
Definition: abc.h:352
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
ABC_DLL void Abc_ObjPatchFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFaninOld, Abc_Obj_t *pFaninNew)
Definition: abcFanio.c:172
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeInv(Abc_Ntk_t *pNtk, Abc_Obj_t *pFanin)
Definition: abcObj.c:662
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeBuf(Abc_Ntk_t *pNtk, Abc_Obj_t *pFanin)
Definition: abcObj.c:692
if(last==0)
Definition: sparse_int.h:34
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:411
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition: abc.h:526
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
Abc_Obj_t * Abc_SclPerformBufferingOne(Abc_Obj_t *pObj, int Degree, int fUseInvs, int fVerbose)
Definition: sclBuffer.c:363
#define assert(ex)
Definition: util_old.h:213
ABC_DLL void Abc_NodeCollectFanouts(Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
Definition: abcUtil.c:1607
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
void Abc_NodeInvUpdateFanPolarity(Abc_Obj_t *pObj)
Definition: sclBuffer.c:320
static void Abc_NodeSetTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:409
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Abc_Obj_t* Abc_SclPerformBufferingOne ( Abc_Obj_t pObj,
int  Degree,
int  fUseInvs,
int  fVerbose 
)

Definition at line 363 of file sclBuffer.c.

364 {
365  Vec_Ptr_t * vFanouts;
366  Abc_Obj_t * pBuffer, * pFanout;
367  int i, Degree0 = Degree;
368  assert( Abc_ObjFanoutNum(pObj) > Degree );
369  // collect fanouts and sort by reverse level
370  vFanouts = Vec_PtrAlloc( Abc_ObjFanoutNum(pObj) );
371  Abc_NodeCollectFanouts( pObj, vFanouts );
372  Vec_PtrSort( vFanouts, (int (*)(void))Abc_NodeCompareLevels );
373  // select the first Degree fanouts
374  if ( fUseInvs )
375  pBuffer = Abc_NtkCreateNodeInv( pObj->pNtk, NULL );
376  else
377  pBuffer = Abc_NtkCreateNodeBuf( pObj->pNtk, NULL );
378  // check if it is possible to not increase level
379  if ( Vec_PtrSize(vFanouts) < 2 * Degree )
380  {
381  Abc_Obj_t * pFanPrev = (Abc_Obj_t *)Vec_PtrEntry(vFanouts, Vec_PtrSize(vFanouts)-1-Degree);
382  Abc_Obj_t * pFanThis = (Abc_Obj_t *)Vec_PtrEntry(vFanouts, Degree-1);
383  Abc_Obj_t * pFanLast = (Abc_Obj_t *)Vec_PtrEntryLast(vFanouts);
384  if ( Abc_ObjLevel(pFanThis) == Abc_ObjLevel(pFanLast) &&
385  Abc_ObjLevel(pFanPrev) < Abc_ObjLevel(pFanThis) )
386  {
387  // find the first one whose level is the same as last
388  Vec_PtrForEachEntry( Abc_Obj_t *, vFanouts, pFanout, i )
389  if ( Abc_ObjLevel(pFanout) == Abc_ObjLevel(pFanLast) )
390  break;
391  assert( i < Vec_PtrSize(vFanouts) );
392  if ( i > 1 )
393  Degree = i;
394  }
395  // make the last two more well-balanced
396  if ( Degree == Degree0 && Degree > Vec_PtrSize(vFanouts) - Degree )
397  Degree = Vec_PtrSize(vFanouts)/2 + (Vec_PtrSize(vFanouts) & 1);
398  assert( Degree <= Degree0 );
399  }
400  // select fanouts
401  Vec_PtrForEachEntryStop( Abc_Obj_t *, vFanouts, pFanout, i, Degree )
402  Abc_ObjPatchFanin( pFanout, pObj, pBuffer );
403  if ( fVerbose )
404  {
405  printf( "%5d : ", Abc_ObjId(pObj) );
406  Vec_PtrForEachEntry( Abc_Obj_t *, vFanouts, pFanout, i )
407  printf( "%d%s ", Abc_ObjLevel(pFanout), i == Degree-1 ? " " : "" );
408  printf( "\n" );
409  }
410  Vec_PtrFree( vFanouts );
411  Abc_ObjAddFanin( pBuffer, pObj );
412  pBuffer->Level = Abc_SclComputeReverseLevel( pBuffer );
413  if ( fUseInvs )
414  Abc_NodeInvUpdateFanPolarity( pBuffer );
415  return pBuffer;
416 }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
int Abc_NodeCompareLevels(Abc_Obj_t **pp1, Abc_Obj_t **pp2)
Definition: sclBuffer.c:341
static void Vec_PtrSort(Vec_Ptr_t *p, int(*Vec_PtrSortCompare)()) ___unused
Definition: vecPtr.h:851
int Abc_SclComputeReverseLevel(Abc_Obj_t *pObj)
Definition: sclBuffer.c:355
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
ABC_DLL void Abc_ObjPatchFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFaninOld, Abc_Obj_t *pFaninNew)
Definition: abcFanio.c:172
static void * Vec_PtrEntryLast(Vec_Ptr_t *p)
Definition: vecPtr.h:413
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeInv(Abc_Ntk_t *pNtk, Abc_Obj_t *pFanin)
Definition: abcObj.c:662
static int Abc_ObjLevel(Abc_Obj_t *pObj)
Definition: abc.h:330
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeBuf(Abc_Ntk_t *pNtk, Abc_Obj_t *pFanin)
Definition: abcObj.c:692
if(last==0)
Definition: sparse_int.h:34
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
Abc_Ntk_t * pNtk
Definition: abc.h:130
#define Vec_PtrForEachEntryStop(Type, vVec, pEntry, i, Stop)
Definition: vecPtr.h:59
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define assert(ex)
Definition: util_old.h:213
ABC_DLL void Abc_NodeCollectFanouts(Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
Definition: abcUtil.c:1607
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
void Abc_NodeInvUpdateFanPolarity(Abc_Obj_t *pObj)
Definition: sclBuffer.c:320
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Abc_SclReportDupFanins ( Abc_Ntk_t pNtk)

FUNCTION DEFINITIONS ///.

Function*************************************************************

Synopsis [Make sure fanins of gates are not duplicated.]

Description []

SideEffects []

SeeAlso []

Definition at line 90 of file sclBuffer.c.

91 {
92  Abc_Obj_t * pObj, * pFanin, * pFanin2;
93  int i, k, k2;
94  Abc_NtkForEachNode( pNtk, pObj, i )
95  Abc_ObjForEachFanin( pObj, pFanin, k )
96  Abc_ObjForEachFanin( pObj, pFanin2, k2 )
97  if ( k != k2 && pFanin == pFanin2 )
98  printf( "Node %d has dup fanin %d.\n", i, Abc_ObjId(pFanin) );
99 }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
if(last==0)
Definition: sparse_int.h:34
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
Abc_Ntk_t* Abc_SclUnBufferPerform ( Abc_Ntk_t pNtk,
int  fVerbose 
)

Definition at line 129 of file sclBuffer.c.

130 {
131  Vec_Int_t * vLits;
132  Abc_Obj_t * pObj, * pFanin, * pFaninNew;
133  int i, k, iLit, nNodesOld = Abc_NtkObjNumMax(pNtk);
134  // assign inverters
135  vLits = Vec_IntStartFull( Abc_NtkObjNumMax(pNtk) );
136  Abc_NtkForEachNode( pNtk, pObj, i )
137  if ( Abc_SclIsInv(pObj) && !Abc_SclObjIsBufInv(Abc_ObjFanin0(pObj)) )
138  Vec_IntWriteEntry( vLits, Abc_ObjFaninId0(pObj), Abc_ObjId(pObj) );
139  // transfer fanins
140  Abc_NtkForEachNodeCo( pNtk, pObj, i )
141  {
142  if ( i >= nNodesOld )
143  break;
144  Abc_ObjForEachFanin( pObj, pFanin, k )
145  {
146  if ( !Abc_SclObjIsBufInv(pFanin) )
147  continue;
148  iLit = Abc_SclGetRealFaninLit( pFanin );
149  pFaninNew = Abc_NtkObj( pNtk, Abc_Lit2Var(iLit) );
150  if ( Abc_LitIsCompl(iLit) )
151  {
152  if ( Vec_IntEntry( vLits, Abc_Lit2Var(iLit) ) == -1 )
153  {
154  pFaninNew = Abc_NtkCreateNodeInv( pNtk, pFaninNew );
155  Vec_IntWriteEntry( vLits, Abc_Lit2Var(iLit), Abc_ObjId(pFaninNew) );
156  }
157  else
158  pFaninNew = Abc_NtkObj( pNtk, Vec_IntEntry( vLits, Abc_Lit2Var(iLit) ) );
159  assert( Abc_ObjFaninNum(pFaninNew) == 1 );
160  }
161  if ( pFanin != pFaninNew )
162  Abc_ObjPatchFanin( pObj, pFanin, pFaninNew );
163  }
164  }
165  Vec_IntFree( vLits );
166  // duplicate network in topo order
167  return Abc_NtkDupDfs( pNtk );
168 }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
int Abc_SclIsInv(Abc_Obj_t *pObj)
Definition: sclBuffer.c:116
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
static Vec_Int_t * Vec_IntStartFull(int nSize)
Definition: vecInt.h:119
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_ObjFaninId0(Abc_Obj_t *pObj)
Definition: abc.h:367
ABC_DLL void Abc_ObjPatchFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFaninOld, Abc_Obj_t *pFaninNew)
Definition: abcFanio.c:172
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeInv(Abc_Ntk_t *pNtk, Abc_Obj_t *pFanin)
Definition: abcObj.c:662
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
if(last==0)
Definition: sparse_int.h:34
ABC_DLL Abc_Ntk_t * Abc_NtkDupDfs(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:476
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
static int Abc_SclObjIsBufInv(Abc_Obj_t *pObj)
Definition: sclBuffer.c:112
#define Abc_NtkForEachNodeCo(pNtk, pNode, i)
Definition: abc.h:491
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
int Abc_SclGetRealFaninLit(Abc_Obj_t *pObj)
Definition: sclBuffer.c:121
Abc_Ntk_t* Abc_SclUnBufferPhase ( Abc_Ntk_t pNtk,
int  fVerbose 
)

Definition at line 239 of file sclBuffer.c.

240 {
241  Abc_Ntk_t * pNtkNew;
242  Abc_Obj_t * pObj, * pFanin, * pFaninNew;
243  int i, k, iLit, Counter = 0, Total = 0;
244  assert( pNtk->vPhases == NULL );
245  pNtk->vPhases = Vec_IntStart( Abc_NtkObjNumMax(pNtk) );
246  Abc_NtkForEachNodeCo( pNtk, pObj, i )
247  {
248  if ( Abc_SclObjIsBufInv(pObj) )
249  continue;
250  Abc_ObjForEachFanin( pObj, pFanin, k )
251  {
252  Total++;
253  iLit = Abc_SclGetRealFaninLit( pFanin );
254  pFaninNew = Abc_NtkObj( pNtk, Abc_Lit2Var(iLit) );
255  if ( pFaninNew == pFanin )
256  continue;
257  // skip fanins which are already fanins of the node
258  if ( Abc_NodeFindFanin( pObj, pFaninNew ) >= 0 )
259  continue;
260  Abc_ObjPatchFanin( pObj, pFanin, pFaninNew );
261  if ( Abc_LitIsCompl(iLit) )
262  Abc_ObjFaninFlipPhase( pObj, k ), Counter++;
263  }
264  }
265  if ( fVerbose )
266  printf( "Saved %d (%.2f %%) fanin phase bits. ", Counter, 100.0 * Counter / Total );
267  // duplicate network in topo order
268  pNtkNew = Abc_NtkDupDfs( pNtk );
269  if ( fVerbose )
270  printf( "Max depth = %d.\n", Abc_SclCountMaxPhases(pNtkNew) );
271  Abc_SclReportDupFanins( pNtkNew );
272  return pNtkNew;
273 }
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
ABC_DLL int Abc_NodeFindFanin(Abc_Obj_t *pNode, Abc_Obj_t *pFanin)
Definition: abcUtil.c:758
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
void Abc_SclReportDupFanins(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: sclBuffer.c:90
ABC_DLL void Abc_ObjPatchFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFaninOld, Abc_Obj_t *pFaninNew)
Definition: abcFanio.c:172
int Abc_SclCountMaxPhases(Abc_Ntk_t *pNtk)
Definition: sclBuffer.c:181
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
Vec_Int_t * vPhases
Definition: abc.h:208
static int Counter
ABC_DLL Abc_Ntk_t * Abc_NtkDupDfs(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:476
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
static int Abc_SclObjIsBufInv(Abc_Obj_t *pObj)
Definition: sclBuffer.c:112
#define Abc_NtkForEachNodeCo(pNtk, pNode, i)
Definition: abc.h:491
#define assert(ex)
Definition: util_old.h:213
static void Abc_ObjFaninFlipPhase(Abc_Obj_t *p, int i)
Definition: abc.h:393
int Abc_SclGetRealFaninLit(Abc_Obj_t *pObj)
Definition: sclBuffer.c:121
Buf_Man_t* Buf_ManStart ( Abc_Ntk_t pNtk,
int  FanMin,
int  FanMax,
int  fBufPis 
)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 669 of file sclBuffer.c.

670 {
671  Buf_Man_t * p;
672  Abc_Obj_t * pObj;
673  Vec_Ptr_t * vNodes;
674  int i;
675  p = ABC_CALLOC( Buf_Man_t, 1 );
676  p->pNtk = pNtk;
677  p->nFanMin = FanMin;
678  p->nFanMax = FanMax;
679  p->fBufPis = fBufPis;
680  // allocate arrays
682  p->nObjAlloc = (6 * Abc_NtkObjNumMax(p->pNtk) / 3) + 100;
683  p->vOffsets = Vec_IntAlloc( p->nObjAlloc );
684  p->vArr = Vec_IntAlloc( p->nObjAlloc );
685  p->vDep = Vec_IntAlloc( p->nObjAlloc );
686  p->vCounts = Vec_FltAlloc( p->nObjAlloc );
687  p->vQue = Vec_QueAlloc( p->nObjAlloc );
689  Vec_IntFill( p->vArr, p->nObjAlloc, 0 );
690  Vec_IntFill( p->vDep, p->nObjAlloc, 0 );
693  // collect edge delays
695  p->vEdges = Vec_IntAlloc( 1000 );
696  // create edges
697  vNodes = Abc_NtkDfs( p->pNtk, 0 );
698  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
699  Abc_BufCreateEdges( p, pObj );
700  Abc_NtkForEachCo( p->pNtk, pObj, i )
701  Abc_BufCreateEdges( p, pObj );
702  // derive delays
703  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
704  Abc_BufComputeArr( p, pObj );
705  Vec_PtrForEachEntryReverse( Abc_Obj_t *, vNodes, pObj, i )
706  Abc_BufComputeDep( p, pObj );
707  Abc_BufUpdateGlobal( p );
708 // Abc_NtkForEachNode( p->pNtk, pObj, i )
709 // printf( "%4d : %4d %4d\n", i, Abc_BufNodeArr(p, pObj), Abc_BufNodeDep(p, pObj) );
710  // create fanout queue
711 // Abc_NtkForEachCi( p->pNtk, pObj, i )
712 // Abc_BufAddToQue( p, pObj );
713  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
714  Abc_BufAddToQue( p, pObj );
715  Vec_PtrFree( vNodes );
716  p->vDelays = Vec_IntAlloc( 100 );
717  p->vOrder = Vec_IntAlloc( 100 );
718  p->vNonCrit = Vec_IntAlloc( 100 );
719  p->vTfCone = Vec_IntAlloc( 100 );
720  p->vFanouts = Vec_PtrAlloc( 100 );
721  return p;
722 }
float Abc_BufComputeDep(Buf_Man_t *p, Abc_Obj_t *pObj)
Definition: sclBuffer.c:523
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
Vec_Int_t * vOffsets
Definition: sclBuffer.c:42
int nFanMin
Definition: sclBuffer.c:37
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
static Llb_Mgr_t * p
Definition: llb3Image.c:950
float Mio_GateReadPinDelay(Mio_Gate_t *pGate, int iPin)
Definition: mioApi.c:201
#define Vec_PtrForEachEntryReverse(Type, vVec, pEntry, i)
Definition: vecPtr.h:63
int nObjStart
Definition: sclBuffer.c:48
Vec_Int_t * vDep
Definition: sclBuffer.c:45
void Abc_BufUpdateGlobal(Buf_Man_t *p)
Definition: sclBuffer.c:539
int nFanMax
Definition: sclBuffer.c:38
static Vec_Flt_t * Vec_FltAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecFlt.h:78
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
Definition: abcDfs.c:81
float Abc_BufComputeArr(Buf_Man_t *p, Abc_Obj_t *pObj)
Definition: sclBuffer.c:507
static void Vec_FltFill(Vec_Flt_t *p, int nSize, float Entry)
Definition: vecFlt.h:450
void * pManFunc
Definition: abc.h:191
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
void Abc_BufAddToQue(Buf_Man_t *p, Abc_Obj_t *pObj)
Definition: sclBuffer.c:555
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
STRUCTURE DEFINITIONS ///.
Definition: mioInt.h:61
Vec_Que_t * vQue
Definition: sclBuffer.c:47
int fBufPis
Definition: sclBuffer.c:39
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static float ** Vec_FltArrayP(Vec_Flt_t *p)
Definition: vecFlt.h:278
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
Abc_Ntk_t * pNtk
Definition: sclBuffer.c:41
Vec_Flt_t * vCounts
Definition: sclBuffer.c:46
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
void Abc_BufCreateEdges(Buf_Man_t *p, Abc_Obj_t *pObj)
Definition: sclBuffer.c:547
static Vec_Que_t * Vec_QueAlloc(int nCap)
MACRO DEFINITIONS ///.
Definition: vecQue.h:71
Vec_Int_t * vArr
Definition: sclBuffer.c:44
Vec_Int_t * vEdges
Definition: sclBuffer.c:43
Mio_Gate_t * Mio_LibraryReadInv(Mio_Library_t *pLib)
Definition: mioApi.c:48
float DelayInv
Definition: sclBuffer.c:51
static void Vec_QueSetPriority(Vec_Que_t *p, float **pCosts)
Definition: vecQue.h:95
int nObjAlloc
Definition: sclBuffer.c:49
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Buf_ManStop ( Buf_Man_t p)

Definition at line 723 of file sclBuffer.c.

724 {
725  printf( "Sep = %d. Dup = %d. Br0 = %d. Br1 = %d. BrC = %d. ",
726  p->nSeparate, p->nDuplicate, p->nBranch0, p->nBranch1, p->nBranchCrit );
727  printf( "Orig = %d. Add = %d. Rem = %d.\n",
729  p->nObjAlloc - Abc_NtkObjNumMax(p->pNtk) );
730  Vec_PtrFree( p->vFanouts );
731  Vec_IntFree( p->vTfCone );
732  Vec_IntFree( p->vNonCrit );
733  Vec_IntFree( p->vDelays );
734  Vec_IntFree( p->vOrder );
735  Vec_IntFree( p->vOffsets );
736  Vec_IntFree( p->vEdges );
737  Vec_IntFree( p->vArr );
738  Vec_IntFree( p->vDep );
739 // Vec_QueCheck( p->vQue );
740  Vec_QueFree( p->vQue );
741  Vec_FltFree( p->vCounts );
742  ABC_FREE( p );
743 }
Vec_Int_t * vDelays
Definition: sclBuffer.c:54
Vec_Int_t * vOffsets
Definition: sclBuffer.c:42
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
int nDuplicate
Definition: sclBuffer.c:60
static void Vec_FltFree(Vec_Flt_t *p)
Definition: vecFlt.h:218
int nObjStart
Definition: sclBuffer.c:48
Vec_Int_t * vDep
Definition: sclBuffer.c:45
Vec_Int_t * vOrder
Definition: sclBuffer.c:53
int nBranchCrit
Definition: sclBuffer.c:63
int nBranch1
Definition: sclBuffer.c:62
Vec_Ptr_t * vFanouts
Definition: sclBuffer.c:57
int nBranch0
Definition: sclBuffer.c:61
Vec_Int_t * vNonCrit
Definition: sclBuffer.c:55
int nSeparate
Definition: sclBuffer.c:59
Vec_Que_t * vQue
Definition: sclBuffer.c:47
Vec_Int_t * vTfCone
Definition: sclBuffer.c:56
#define ABC_FREE(obj)
Definition: abc_global.h:232
static void Vec_QueFree(Vec_Que_t *p)
Definition: vecQue.h:83
Abc_Ntk_t * pNtk
Definition: sclBuffer.c:41
Vec_Flt_t * vCounts
Definition: sclBuffer.c:46
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Vec_Int_t * vArr
Definition: sclBuffer.c:44
Vec_Int_t * vEdges
Definition: sclBuffer.c:43
int nObjAlloc
Definition: sclBuffer.c:49
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223