abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
aigDoms.c File Reference
#include "aig.h"
#include "aig/saig/saig.h"

Go to the source code of this file.

Data Structures

struct  Aig_Dom_t_
 
struct  Aig_Sto_t_
 

Macros

#define Aig_DomForEachNode(pAig, pDom, pNode, i)   for ( i = 0; (i < pDom->nNodes) && ((pNode) = Aig_ManObj(pAig, (pDom)->pNodes[i])); i++ )
 

Typedefs

typedef
typedefABC_NAMESPACE_IMPL_START
struct Aig_Sto_t_ 
Aig_Sto_t
 DECLARATIONS ///. More...
 
typedef struct Aig_Dom_t_ Aig_Dom_t
 

Functions

Aig_Sto_tAig_ManDomStart (Aig_Man_t *pAig, int Limit)
 FUNCTION DEFINITIONS ///. More...
 
void Aig_ObjAddTriv (Aig_Sto_t *pSto, int Id, Vec_Ptr_t *vDoms)
 
Vec_Ptr_tAig_ObjDomVecDup (Aig_Sto_t *pSto, Vec_Ptr_t *vDoms, int fSkip1)
 
void Aig_ObjDomVecRecycle (Aig_Sto_t *pSto, Vec_Ptr_t *vDoms)
 
void Aig_ObjDomPrint (Aig_Sto_t *pSto, Aig_Dom_t *pDom, int Num)
 
void Aig_ObjDomVecPrint (Aig_Sto_t *pSto, Vec_Ptr_t *vDoms)
 
void Aig_ManDomPrint (Aig_Sto_t *pSto)
 
void Aig_ManDomStop (Aig_Sto_t *pSto)
 
int Aig_ObjDomCheck (Aig_Dom_t *pDom)
 
static int Aig_ObjDomCheckDominance (Aig_Dom_t *pDom, Aig_Dom_t *pCut)
 
int Aig_ObjDomFilter (Aig_Sto_t *pSto, Vec_Ptr_t *vDoms, Aig_Dom_t *pDom)
 
static int Aig_ObjDomMergeOrdered (Aig_Dom_t *pD0, Aig_Dom_t *pD1, Aig_Dom_t *pD, int Limit)
 
int Aig_ObjDomMergeTwo (Aig_Dom_t *pDom0, Aig_Dom_t *pDom1, Aig_Dom_t *pDom, int Limit)
 
Vec_Ptr_tAig_ObjDomMerge (Aig_Sto_t *pSto, Vec_Ptr_t *vDoms0, Vec_Ptr_t *vDoms1)
 
void Aig_ObjDomUnion (Aig_Sto_t *pSto, Vec_Ptr_t *vDoms2, Vec_Ptr_t *vDoms1)
 
void Aig_ObjDomCompute (Aig_Sto_t *pSto, Aig_Obj_t *pObj)
 
int Aig_ManMarkFlopTfi_rec (Aig_Man_t *p, Aig_Obj_t *pObj)
 
void Aig_ManMarkFlopTfi (Aig_Man_t *p)
 
Aig_Sto_tAig_ManComputeDomsFlops (Aig_Man_t *pAig, int Limit)
 
Aig_Sto_tAig_ManComputeDomsPis (Aig_Man_t *pAig, int Limit)
 
Aig_Sto_tAig_ManComputeDomsNodes (Aig_Man_t *pAig, int Limit)
 
Vec_Ptr_tAig_ObjDomCollect (Aig_Sto_t *pSto, Vec_Int_t *vCut)
 
int Aig_ObjDomVolume_rec (Aig_Man_t *p, Aig_Obj_t *pObj)
 
int Aig_ObjDomVolume (Aig_Sto_t *pSto, Aig_Dom_t *pDom)
 
int Aig_ObjDomDeref_rec (Aig_Obj_t *pNode)
 
int Aig_ObjDomRef_rec (Aig_Obj_t *pNode)
 
int Aig_ObjDomDomed (Aig_Sto_t *pSto, Aig_Dom_t *pDom)
 
Vec_Int_tAig_ObjDomCollectLos (Aig_Sto_t *pSto)
 
void Aig_ObjPoLogicDeref (Aig_Sto_t *pSto)
 
void Aig_ObjPoLogicRef (Aig_Sto_t *pSto)
 
void Aig_ObjDomFindGood (Aig_Sto_t *pSto)
 
void Aig_ManComputeDomsTest2 (Aig_Man_t *pAig, int Num)
 
void Aig_ManComputeDomsTest (Aig_Man_t *pAig)
 
void Aig_ObjDomCount (Aig_Sto_t *pSto, Aig_Obj_t *pObj)
 
void Aig_ManComputeDomsForCofactoring (Aig_Man_t *pAig)
 

Macro Definition Documentation

#define Aig_DomForEachNode (   pAig,
  pDom,
  pNode,
 
)    for ( i = 0; (i < pDom->nNodes) && ((pNode) = Aig_ManObj(pAig, (pDom)->pNodes[i])); i++ )

Definition at line 54 of file aigDoms.c.

Typedef Documentation

typedef struct Aig_Dom_t_ Aig_Dom_t

Definition at line 31 of file aigDoms.c.

typedef typedefABC_NAMESPACE_IMPL_START struct Aig_Sto_t_ Aig_Sto_t

DECLARATIONS ///.

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

FileName [aigDoms.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [AIG package.]

Synopsis [Computing multi-output dominators.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - April 28, 2007.]

Revision [

Id:
aigDoms.c,v 1.00 2007/04/28 00:00:00 alanmi Exp

]

Definition at line 30 of file aigDoms.c.

Function Documentation

Aig_Sto_t* Aig_ManComputeDomsFlops ( Aig_Man_t pAig,
int  Limit 
)

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

Synopsis [Computes multi-node dominators.]

Description []

SideEffects []

SeeAlso []

Definition at line 621 of file aigDoms.c.

622 {
623  Aig_Sto_t * pSto;
624  Vec_Ptr_t * vNodes;
625  Aig_Obj_t * pObj;
626  int i;
627  abctime clk = Abc_Clock();
628  pSto = Aig_ManDomStart( pAig, Limit );
629  // initialize flop inputs
630  Saig_ManForEachLi( pAig, pObj, i )
631  Aig_ObjAddTriv( pSto, pObj->Id, Vec_PtrAlloc(1) );
632  // compute internal nodes
633  vNodes = Aig_ManDfsReverse( pAig );
634  Aig_ManMarkFlopTfi( pAig );
635  Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
636  if ( Aig_ObjIsTravIdCurrent(pSto->pAig, pObj) )
637  Aig_ObjDomCompute( pSto, pObj );
638  Vec_PtrFree( vNodes );
639  // compute combinational inputs
640  Aig_ManForEachCi( pAig, pObj, i )
641  Aig_ObjDomCompute( pSto, pObj );
642  // print statistics
643  printf( "Nodes =%4d. Flops =%4d. Doms =%9d. Ave =%8.2f. ",
644  pSto->nDomNodes, Aig_ManRegNum(pSto->pAig), pSto->nDomsTotal,
645 // pSto->nDomsFilter1, pSto->nDomsFilter2,
646  1.0 * pSto->nDomsTotal / (pSto->nDomNodes + Aig_ManRegNum(pSto->pAig)) );
647  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
648  return pSto;
649 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
void Aig_ManMarkFlopTfi(Aig_Man_t *p)
Definition: aigDoms.c:601
void Aig_ObjAddTriv(Aig_Sto_t *pSto, int Id, Vec_Ptr_t *vDoms)
Definition: aigDoms.c:96
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
static abctime Abc_Clock()
Definition: abc_global.h:279
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
#define Saig_ManForEachLi(p, pObj, i)
Definition: saig.h:98
void Aig_ObjDomCompute(Aig_Sto_t *pSto, Aig_Obj_t *pObj)
Definition: aigDoms.c:540
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
Vec_Ptr_t * Aig_ManDfsReverse(Aig_Man_t *p)
Definition: aigDfs.c:458
Aig_Sto_t * Aig_ManDomStart(Aig_Man_t *pAig, int Limit)
FUNCTION DEFINITIONS ///.
Definition: aigDoms.c:72
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
typedefABC_NAMESPACE_IMPL_START struct Aig_Sto_t_ Aig_Sto_t
DECLARATIONS ///.
Definition: aigDoms.c:30
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
ABC_INT64_T abctime
Definition: abc_global.h:278
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Aig_ManComputeDomsForCofactoring ( Aig_Man_t pAig)

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

Synopsis [Computes multi-node dominators.]

Description []

SideEffects []

SeeAlso []

Definition at line 1120 of file aigDoms.c.

1121 {
1122  Vec_Ptr_t * vDoms;
1123  Aig_Sto_t * pSto;
1124  Aig_Obj_t * pObj;
1125  int i;
1126  Aig_ManFanoutStart( pAig );
1127  pSto = Aig_ManComputeDomsNodes( pAig, 1 );
1128  Aig_ManForEachObj( pAig, pObj, i )
1129  {
1130  if ( !Aig_ObjIsCi(pObj) && !Aig_ObjIsNode(pObj) )
1131  continue;
1132  if ( Aig_ObjRefs(pObj) < 10 )
1133  continue;
1134  vDoms = (Vec_Ptr_t *)Vec_PtrEntry( pSto->vDoms, Aig_ObjId(pObj) );
1135 // printf( "%6d : Level =%4d. Fanout =%6d.\n",
1136 // Aig_ObjId(pObj), Aig_ObjLevel(pObj), Aig_ObjRefs(pObj) );
1137 
1138  Aig_ObjDomCount( pSto, pObj );
1139  }
1140  Aig_ManDomStop( pSto );
1141  Aig_ManFanoutStop( pAig );
1142 }
void Aig_ManDomStop(Aig_Sto_t *pSto)
Definition: aigDoms.c:228
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
void Aig_ObjDomCount(Aig_Sto_t *pSto, Aig_Obj_t *pObj)
Definition: aigDoms.c:1069
void Aig_ManFanoutStart(Aig_Man_t *p)
FUNCTION DEFINITIONS ///.
Definition: aigFanout.c:56
void Aig_ManFanoutStop(Aig_Man_t *p)
Definition: aigFanout.c:89
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
Definition: aig.h:69
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
typedefABC_NAMESPACE_IMPL_START struct Aig_Sto_t_ Aig_Sto_t
DECLARATIONS ///.
Definition: aigDoms.c:30
static int Aig_ObjRefs(Aig_Obj_t *pObj)
Definition: aig.h:300
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
Aig_Sto_t * Aig_ManComputeDomsNodes(Aig_Man_t *pAig, int Limit)
Definition: aigDoms.c:703
Aig_Sto_t* Aig_ManComputeDomsNodes ( Aig_Man_t pAig,
int  Limit 
)

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

Synopsis [Computes multi-node dominators.]

Description []

SideEffects []

SeeAlso []

Definition at line 703 of file aigDoms.c.

704 {
705  Aig_Sto_t * pSto;
706  Vec_Ptr_t * vNodes;
707  Aig_Obj_t * pObj;
708  int i;
709  abctime clk = Abc_Clock();
710  pSto = Aig_ManDomStart( pAig, Limit );
711  // initialize flop inputs
712  Aig_ManForEachCo( pAig, pObj, i )
713  Aig_ObjAddTriv( pSto, pObj->Id, Vec_PtrAlloc(1) );
714  // compute internal nodes
715  vNodes = Aig_ManDfsReverse( pAig );
716  Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
717  Aig_ObjDomCompute( pSto, pObj );
718  Vec_PtrFree( vNodes );
719  // compute combinational inputs
720  Aig_ManForEachCi( pAig, pObj, i )
721  Aig_ObjDomCompute( pSto, pObj );
722  // print statistics
723  printf( "Nodes =%6d. Doms =%9d. Ave =%8.2f. ",
724  pSto->nDomNodes, pSto->nDomsTotal,
725 // pSto->nDomsFilter1, pSto->nDomsFilter2,
726  1.0 * pSto->nDomsTotal / pSto->nDomNodes );
727  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
728  return pSto;
729 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
void Aig_ObjAddTriv(Aig_Sto_t *pSto, int Id, Vec_Ptr_t *vDoms)
Definition: aigDoms.c:96
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static abctime Abc_Clock()
Definition: abc_global.h:279
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
void Aig_ObjDomCompute(Aig_Sto_t *pSto, Aig_Obj_t *pObj)
Definition: aigDoms.c:540
Definition: aig.h:69
Vec_Ptr_t * Aig_ManDfsReverse(Aig_Man_t *p)
Definition: aigDfs.c:458
Aig_Sto_t * Aig_ManDomStart(Aig_Man_t *pAig, int Limit)
FUNCTION DEFINITIONS ///.
Definition: aigDoms.c:72
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
typedefABC_NAMESPACE_IMPL_START struct Aig_Sto_t_ Aig_Sto_t
DECLARATIONS ///.
Definition: aigDoms.c:30
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
ABC_INT64_T abctime
Definition: abc_global.h:278
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Aig_Sto_t* Aig_ManComputeDomsPis ( Aig_Man_t pAig,
int  Limit 
)

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

Synopsis [Computes multi-node dominators.]

Description []

SideEffects []

SeeAlso []

Definition at line 662 of file aigDoms.c.

663 {
664  Aig_Sto_t * pSto;
665  Vec_Ptr_t * vNodes;
666  Aig_Obj_t * pObj;
667  int i;
668  abctime clk = Abc_Clock();
669  pSto = Aig_ManDomStart( pAig, Limit );
670  // initialize flop inputs
671  Aig_ManForEachCo( pAig, pObj, i )
672  Aig_ObjAddTriv( pSto, pObj->Id, Vec_PtrAlloc(1) );
673  // compute internal nodes
674  vNodes = Aig_ManDfsReverse( pAig );
675  Aig_ManMarkFlopTfi( pAig );
676  Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
677  if ( Aig_ObjIsTravIdCurrent(pSto->pAig, pObj) )
678  Aig_ObjDomCompute( pSto, pObj );
679  Vec_PtrFree( vNodes );
680  // compute combinational inputs
681  Saig_ManForEachPi( pAig, pObj, i )
682  Aig_ObjDomCompute( pSto, pObj );
683  // print statistics
684  printf( "Nodes =%4d. PIs =%4d. Doms =%9d. Ave =%8.2f. ",
685  pSto->nDomNodes, Saig_ManPiNum(pSto->pAig), pSto->nDomsTotal,
686 // pSto->nDomsFilter1, pSto->nDomsFilter2,
687  1.0 * pSto->nDomsTotal / (pSto->nDomNodes + Saig_ManPiNum(pSto->pAig)) );
688  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
689  return pSto;
690 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
void Aig_ManMarkFlopTfi(Aig_Man_t *p)
Definition: aigDoms.c:601
void Aig_ObjAddTriv(Aig_Sto_t *pSto, int Id, Vec_Ptr_t *vDoms)
Definition: aigDoms.c:96
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static abctime Abc_Clock()
Definition: abc_global.h:279
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
void Aig_ObjDomCompute(Aig_Sto_t *pSto, Aig_Obj_t *pObj)
Definition: aigDoms.c:540
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
Vec_Ptr_t * Aig_ManDfsReverse(Aig_Man_t *p)
Definition: aigDfs.c:458
Aig_Sto_t * Aig_ManDomStart(Aig_Man_t *pAig, int Limit)
FUNCTION DEFINITIONS ///.
Definition: aigDoms.c:72
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
typedefABC_NAMESPACE_IMPL_START struct Aig_Sto_t_ Aig_Sto_t
DECLARATIONS ///.
Definition: aigDoms.c:30
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
ABC_INT64_T abctime
Definition: abc_global.h:278
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
#define Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91
void Aig_ManComputeDomsTest ( Aig_Man_t pAig)

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

Synopsis [Computes multi-node dominators.]

Description []

SideEffects []

SeeAlso []

Definition at line 1044 of file aigDoms.c.

1045 {
1046  Aig_Sto_t * pSto;
1047  Aig_ManFanoutStart( pAig );
1048  pSto = Aig_ManComputeDomsPis( pAig, 1 );
1049  Aig_ManDomPrint( pSto );
1050  Aig_ManDomStop( pSto );
1051  Aig_ManFanoutStop( pAig );
1052 }
void Aig_ManDomStop(Aig_Sto_t *pSto)
Definition: aigDoms.c:228
void Aig_ManDomPrint(Aig_Sto_t *pSto)
Definition: aigDoms.c:206
void Aig_ManFanoutStart(Aig_Man_t *p)
FUNCTION DEFINITIONS ///.
Definition: aigFanout.c:56
void Aig_ManFanoutStop(Aig_Man_t *p)
Definition: aigFanout.c:89
Aig_Sto_t * Aig_ManComputeDomsPis(Aig_Man_t *pAig, int Limit)
Definition: aigDoms.c:662
typedefABC_NAMESPACE_IMPL_START struct Aig_Sto_t_ Aig_Sto_t
DECLARATIONS ///.
Definition: aigDoms.c:30
void Aig_ManComputeDomsTest2 ( Aig_Man_t pAig,
int  Num 
)

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

Synopsis [Computes multi-node dominators.]

Description []

SideEffects []

SeeAlso []

Definition at line 1016 of file aigDoms.c.

1017 {
1018  Aig_Sto_t * pSto;
1019 // int i;
1020 //Aig_ManShow( pAig, 0, NULL );
1021  Aig_ManFanoutStart( pAig );
1022 // for ( i = 1; i < 9; i++ )
1023  {
1024  printf( "ITERATION %d:\n", Num );
1025  pSto = Aig_ManComputeDomsFlops( pAig, Num );
1026  Aig_ObjDomFindGood( pSto );
1027 // Aig_ManDomPrint( pSto );
1028  Aig_ManDomStop( pSto );
1029  }
1030  Aig_ManFanoutStop( pAig );
1031 }
void Aig_ManDomStop(Aig_Sto_t *pSto)
Definition: aigDoms.c:228
Aig_Sto_t * Aig_ManComputeDomsFlops(Aig_Man_t *pAig, int Limit)
Definition: aigDoms.c:621
void Aig_ManFanoutStart(Aig_Man_t *p)
FUNCTION DEFINITIONS ///.
Definition: aigFanout.c:56
void Aig_ManFanoutStop(Aig_Man_t *p)
Definition: aigFanout.c:89
void Aig_ObjDomFindGood(Aig_Sto_t *pSto)
Definition: aigDoms.c:978
typedefABC_NAMESPACE_IMPL_START struct Aig_Sto_t_ Aig_Sto_t
DECLARATIONS ///.
Definition: aigDoms.c:30
void Aig_ManDomPrint ( Aig_Sto_t pSto)

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

Synopsis [Computes multi-node dominators.]

Description []

SideEffects []

SeeAlso []

Definition at line 206 of file aigDoms.c.

207 {
208  Aig_Obj_t * pObj;
209  int i;
210  Saig_ManForEachPi( pSto->pAig, pObj, i )
211  {
212  printf( "*** PI %4d %4d :\n", i, pObj->Id );
213  Aig_ObjDomVecPrint( pSto, (Vec_Ptr_t *)Vec_PtrEntry(pSto->vDoms, pObj->Id) );
214  }
215 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
Definition: aig.h:69
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
void Aig_ObjDomVecPrint(Aig_Sto_t *pSto, Vec_Ptr_t *vDoms)
Definition: aigDoms.c:187
int Id
Definition: aig.h:85
#define Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91
Aig_Sto_t* Aig_ManDomStart ( Aig_Man_t pAig,
int  Limit 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Creates dominator manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 72 of file aigDoms.c.

73 {
74  Aig_Sto_t * pSto;
75  pSto = ABC_CALLOC( Aig_Sto_t, 1 );
76  pSto->pAig = pAig;
77  pSto->Limit = Limit;
78  pSto->pMem = Aig_MmFixedStart( sizeof(Aig_Dom_t) + sizeof(int) * Limit, 10000 );
79  pSto->vDoms = Vec_PtrStart( Aig_ManObjNumMax(pAig) );
80  pSto->vFans = Vec_IntAlloc( 100 );
81  pSto->vTimes = Vec_IntStart( Aig_ManObjNumMax(pAig) );
82  return pSto;
83 }
static Vec_Ptr_t * Vec_PtrStart(int nSize)
Definition: vecPtr.h:106
Aig_MmFixed_t * Aig_MmFixedStart(int nEntrySize, int nEntriesMax)
FUNCTION DEFINITIONS ///.
Definition: aigMem.c:96
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
typedefABC_NAMESPACE_IMPL_START struct Aig_Sto_t_ Aig_Sto_t
DECLARATIONS ///.
Definition: aigDoms.c:30
void Aig_ManDomStop ( Aig_Sto_t pSto)

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

Synopsis [Divides the circuit into well-balanced parts.]

Description []

SideEffects []

SeeAlso []

Definition at line 228 of file aigDoms.c.

229 {
230  Vec_Ptr_t * vDoms;
231  int i;
232  Vec_PtrForEachEntry( Vec_Ptr_t *, pSto->vDoms, vDoms, i )
233  if ( vDoms )
234  Aig_ObjDomVecRecycle( pSto, vDoms );
235  Vec_PtrFree( pSto->vDoms );
236  Vec_IntFree( pSto->vFans );
237  Vec_IntFree( pSto->vTimes );
238  Aig_MmFixedStop( pSto->pMem, 0 );
239  ABC_FREE( pSto );
240 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
void Aig_MmFixedStop(Aig_MmFixed_t *p, int fVerbose)
Definition: aigMem.c:132
if(last==0)
Definition: sparse_int.h:34
void Aig_ObjDomVecRecycle(Aig_Sto_t *pSto, Vec_Ptr_t *vDoms)
Definition: aigDoms.c:145
#define ABC_FREE(obj)
Definition: abc_global.h:232
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Aig_ManMarkFlopTfi ( Aig_Man_t p)

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

Synopsis [Marks the flop TFI with the current traversal ID.]

Description []

SideEffects []

SeeAlso []

Definition at line 601 of file aigDoms.c.

602 {
603  Aig_Obj_t * pObj;
604  int i;
606  Saig_ManForEachLi( p, pObj, i )
607  Aig_ManMarkFlopTfi_rec( p, pObj );
608 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Aig_ManMarkFlopTfi_rec(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigDoms.c:575
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
#define Saig_ManForEachLi(p, pObj, i)
Definition: saig.h:98
Definition: aig.h:69
int Aig_ManMarkFlopTfi_rec ( Aig_Man_t p,
Aig_Obj_t pObj 
)

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

Synopsis [Marks the flop TFI with the current traversal ID.]

Description []

SideEffects []

SeeAlso []

Definition at line 575 of file aigDoms.c.

576 {
577  int Count;
578  assert( !Aig_IsComplement(pObj) );
579  if ( Aig_ObjIsTravIdCurrent(p, pObj) )
580  return 0;
581  Aig_ObjSetTravIdCurrent(p, pObj);
582  if ( Aig_ObjIsCi(pObj) || Aig_ObjIsConst1(pObj) )
583  return 1;
584  Count = Aig_ManMarkFlopTfi_rec( p, Aig_ObjFanin0(pObj) );
585  if ( Aig_ObjIsNode(pObj) )
586  Count += Aig_ManMarkFlopTfi_rec( p, Aig_ObjFanin1(pObj) );
587  return Count;
588 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
int Aig_ManMarkFlopTfi_rec(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigDoms.c:575
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
void Aig_ObjAddTriv ( Aig_Sto_t pSto,
int  Id,
Vec_Ptr_t vDoms 
)

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

Synopsis [Adds trivial dominator.]

Description []

SideEffects []

SeeAlso []

Definition at line 96 of file aigDoms.c.

97 {
98  Aig_Dom_t * pDom;
99  pDom = (Aig_Dom_t *)Aig_MmFixedEntryFetch( pSto->pMem );
100  pDom->uSign = (1 << (Id % 63));
101  pDom->nNodes = 1;
102  pDom->pNodes[0] = Id;
103  Vec_PtrPushFirst( vDoms, pDom );
104  assert( Vec_PtrEntry( pSto->vDoms, Id ) == NULL );
105  Vec_PtrWriteEntry( pSto->vDoms, Id, vDoms );
106 }
int uSign
Definition: aigDoms.c:35
int nNodes
Definition: aigDoms.c:36
static void Vec_PtrPushFirst(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:629
char * Aig_MmFixedEntryFetch(Aig_MmFixed_t *p)
Definition: aigMem.c:161
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
#define assert(ex)
Definition: util_old.h:213
int pNodes[0]
Definition: aigDoms.c:37
int Aig_ObjDomCheck ( Aig_Dom_t pDom)

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

Synopsis [Checks correctness of the cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 254 of file aigDoms.c.

255 {
256  int i;
257  for ( i = 1; i < pDom->nNodes; i++ )
258  {
259  if ( pDom->pNodes[i-1] >= pDom->pNodes[i] )
260  {
261  Abc_Print( -1, "Aig_ObjDomCheck(): Cut has wrong ordering of inputs.\n" );
262  return 0;
263  }
264  assert( pDom->pNodes[i-1] < pDom->pNodes[i] );
265  }
266  return 1;
267 }
int nNodes
Definition: aigDoms.c:36
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
#define assert(ex)
Definition: util_old.h:213
int pNodes[0]
Definition: aigDoms.c:37
static int Aig_ObjDomCheckDominance ( Aig_Dom_t pDom,
Aig_Dom_t pCut 
)
inlinestatic

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

Synopsis [Returns 1 if pDom is contained in pCut.]

Description []

SideEffects []

SeeAlso []

Definition at line 280 of file aigDoms.c.

281 {
282  int i, k;
283  for ( i = 0; i < pDom->nNodes; i++ )
284  {
285  for ( k = 0; k < (int)pCut->nNodes; k++ )
286  if ( pDom->pNodes[i] == pCut->pNodes[k] )
287  break;
288  if ( k == (int)pCut->nNodes ) // node i in pDom is not contained in pCut
289  return 0;
290  }
291  // every node in pDom is contained in pCut
292  return 1;
293 }
int nNodes
Definition: aigDoms.c:36
int pNodes[0]
Definition: aigDoms.c:37
Vec_Ptr_t* Aig_ObjDomCollect ( Aig_Sto_t pSto,
Vec_Int_t vCut 
)

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

Synopsis [Collects dominators from the cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 742 of file aigDoms.c.

743 {
744  Vec_Ptr_t * vDoms0, * vDoms1, * vDoms2;
745  int i, ObjId;
746  vDoms0 = (Vec_Ptr_t *)Vec_PtrEntry( pSto->vDoms, Vec_IntEntry(vCut, 0) );
747  vDoms2 = Aig_ObjDomVecDup( pSto, vDoms0, 1 );
748  Vec_IntForEachEntryStart( vCut, ObjId, i, 1 )
749  {
750  vDoms1 = (Vec_Ptr_t *)Vec_PtrEntry( pSto->vDoms, ObjId );
751  if ( vDoms1 == NULL )
752  continue;
753  Aig_ObjDomUnion( pSto, vDoms2, vDoms1 );
754  }
755  return vDoms2;
756 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
Vec_Ptr_t * Aig_ObjDomVecDup(Aig_Sto_t *pSto, Vec_Ptr_t *vDoms, int fSkip1)
Definition: aigDoms.c:119
void Aig_ObjDomUnion(Aig_Sto_t *pSto, Vec_Ptr_t *vDoms2, Vec_Ptr_t *vDoms1)
Definition: aigDoms.c:512
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
Definition: vecInt.h:56
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
Vec_Int_t* Aig_ObjDomCollectLos ( Aig_Sto_t pSto)

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

Synopsis [Collects dominators from the cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 915 of file aigDoms.c.

916 {
917  Vec_Int_t * vCut;
918  Aig_Obj_t * pObj;
919  int i;
920  vCut = Vec_IntAlloc( Aig_ManRegNum(pSto->pAig) );
921  Saig_ManForEachLo( pSto->pAig, pObj, i )
922  {
923  Vec_IntPush( vCut, pObj->Id );
924  pObj->fMarkA = 1;
925  }
926  return vCut;
927 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
unsigned int fMarkA
Definition: aig.h:79
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
Definition: aig.h:69
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
#define Saig_ManForEachLo(p, pObj, i)
Definition: saig.h:96
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
int Id
Definition: aig.h:85
void Aig_ObjDomCompute ( Aig_Sto_t pSto,
Aig_Obj_t pObj 
)

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

Synopsis [Computes multi-node dominators.]

Description []

SideEffects []

SeeAlso []

Definition at line 540 of file aigDoms.c.

541 {
542  Vec_Ptr_t * vDoms0, * vDoms1, * vDoms2, * vDomsT;
543  Aig_Obj_t * pFanout;
544  int i, iFanout;
545  pSto->nDomNodes += Aig_ObjIsNode(pObj);
546  Vec_IntClear( pSto->vFans );
547  Aig_ObjForEachFanout( pSto->pAig, pObj, pFanout, iFanout, i )
548  if ( Aig_ObjIsTravIdCurrent(pSto->pAig, pFanout) )
549  Vec_IntPush( pSto->vFans, iFanout>>1 );
550  if ( Vec_IntSize(pSto->vFans) == 0 )
551  return;
552  vDoms0 = (Vec_Ptr_t *)Vec_PtrEntry( pSto->vDoms, Vec_IntEntry(pSto->vFans, 0) );
553  vDoms2 = Aig_ObjDomVecDup( pSto, vDoms0, 0 );
554  Vec_IntForEachEntryStart( pSto->vFans, iFanout, i, 1 )
555  {
556  vDoms1 = (Vec_Ptr_t *)Vec_PtrEntry( pSto->vDoms, iFanout );
557  vDoms2 = Aig_ObjDomMerge( pSto, vDomsT = vDoms2, vDoms1 );
558  Aig_ObjDomVecRecycle( pSto, vDomsT );
559  }
560  Aig_ObjAddTriv( pSto, pObj->Id, vDoms2 );
561  pSto->nDomsTotal += Vec_PtrSize(vDoms2);
562 }
#define Aig_ObjForEachFanout(p, pObj, pFanout, iFan, i)
Definition: aig.h:427
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
void Aig_ObjAddTriv(Aig_Sto_t *pSto, int Id, Vec_Ptr_t *vDoms)
Definition: aigDoms.c:96
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Vec_Ptr_t * Aig_ObjDomVecDup(Aig_Sto_t *pSto, Vec_Ptr_t *vDoms, int fSkip1)
Definition: aigDoms.c:119
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
void Aig_ObjDomVecRecycle(Aig_Sto_t *pSto, Vec_Ptr_t *vDoms)
Definition: aigDoms.c:145
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
Definition: vecInt.h:56
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Vec_Ptr_t * Aig_ObjDomMerge(Aig_Sto_t *pSto, Vec_Ptr_t *vDoms0, Vec_Ptr_t *vDoms1)
Definition: aigDoms.c:472
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
int Id
Definition: aig.h:85
void Aig_ObjDomCount ( Aig_Sto_t pSto,
Aig_Obj_t pObj 
)

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

Synopsis [Collects dominators from the cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 1069 of file aigDoms.c.

1070 {
1071  Aig_Dom_t * pDom;
1072  Aig_Obj_t * pFanout;
1073  Vec_Int_t * vSingles;
1074  Vec_Ptr_t * vDoms;
1075  int i, k, Entry, iFanout, fPrint = 0;
1076  vSingles = Vec_IntAlloc( 100 );
1077  // for each dominator of a fanout, count how many fanouts have it as a dominator
1078  Aig_ObjForEachFanout( pSto->pAig, pObj, pFanout, iFanout, i )
1079  {
1080  vDoms = (Vec_Ptr_t *)Vec_PtrEntry( pSto->vDoms, Aig_ObjId(pFanout) );
1081  Vec_PtrForEachEntryStart( Aig_Dom_t *, vDoms, pDom, k, 1 )
1082  {
1083 // printf( "Fanout %d Dominator %d\n", Aig_ObjId(pFanout), pDom->pNodes[0] );
1084  Vec_IntAddToEntry( pSto->vTimes, pDom->pNodes[0], 1 );
1085  Vec_IntPushUnique( vSingles, pDom->pNodes[0] );
1086  }
1087  }
1088  // clear storage
1089  Vec_IntForEachEntry( vSingles, Entry, i )
1090  {
1091  if ( Vec_IntEntry(pSto->vTimes, Entry) > 5 )
1092  {
1093  if ( fPrint == 0 )
1094  {
1095  printf( "%6d : Level =%4d. Fanout =%6d.\n",
1096  Aig_ObjId(pObj), Aig_ObjLevel(pObj), Aig_ObjRefs(pObj) );
1097  }
1098  fPrint = 1;
1099  printf( "%d(%d) ", Entry, Vec_IntEntry(pSto->vTimes, Entry) );
1100  }
1101  Vec_IntWriteEntry( pSto->vTimes, Entry, 0);
1102  }
1103  if ( fPrint )
1104  printf( "\n" );
1105  Vec_IntFree( vSingles );
1106 }
#define Aig_ObjForEachFanout(p, pObj, pFanout, iFan, i)
Definition: aig.h:427
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
#define Vec_PtrForEachEntryStart(Type, vVec, pEntry, i, Start)
Definition: vecPtr.h:57
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Vec_IntAddToEntry(Vec_Int_t *p, int i, int Addition)
Definition: bblif.c:302
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Definition: aig.h:69
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Aig_ObjLevel(Aig_Obj_t *pObj)
Definition: aig.h:323
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
int pNodes[0]
Definition: aigDoms.c:37
static int Aig_ObjRefs(Aig_Obj_t *pObj)
Definition: aig.h:300
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static int Vec_IntPushUnique(Vec_Int_t *p, int Entry)
Definition: vecInt.h:832
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
int Aig_ObjDomDeref_rec ( Aig_Obj_t pNode)

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

Synopsis [Dereferences the node's MFFC.]

Description []

SideEffects []

SeeAlso []

Definition at line 823 of file aigDoms.c.

824 {
825  int Counter = 0;
826  assert( pNode->nRefs > 0 );
827  if ( --pNode->nRefs > 0 )
828  return 0;
829  assert( pNode->nRefs == 0 );
830  if ( pNode->fMarkA )
831  return 1;
832  if ( Aig_ObjIsCi(pNode) )
833  return 0;
834  Counter += Aig_ObjDomDeref_rec( Aig_ObjFanin0(pNode) );
835  if ( Aig_ObjIsNode(pNode) )
836  Counter += Aig_ObjDomDeref_rec( Aig_ObjFanin1(pNode) );
837  return Counter;
838 }
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
unsigned int fMarkA
Definition: aig.h:79
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
int Aig_ObjDomDeref_rec(Aig_Obj_t *pNode)
Definition: aigDoms.c:823
static int Counter
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
unsigned int nRefs
Definition: aig.h:81
int Aig_ObjDomDomed ( Aig_Sto_t pSto,
Aig_Dom_t pDom 
)

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

Synopsis [Count the number of nodes in the dominator.]

Description []

SideEffects []

SeeAlso []

Definition at line 879 of file aigDoms.c.

880 {
881  Aig_Obj_t * pObj;
882  int i, Counter0, Counter1;
883  Counter0 = 0;
884  Aig_DomForEachNode( pSto->pAig, pDom, pObj, i )
885  {
886  assert( !Aig_ObjIsCi(pObj) );
887  Counter0 += Aig_ObjDomDeref_rec( Aig_ObjFanin0(pObj) );
888  if ( Aig_ObjIsNode(pObj) )
889  Counter0 += Aig_ObjDomDeref_rec( Aig_ObjFanin1(pObj) );
890  }
891  Counter1 = 0;
892  Aig_DomForEachNode( pSto->pAig, pDom, pObj, i )
893  {
894  assert( !Aig_ObjIsCi(pObj) );
895  Counter1 += Aig_ObjDomRef_rec( Aig_ObjFanin0(pObj) );
896  if ( Aig_ObjIsNode(pObj) )
897  Counter1 += Aig_ObjDomRef_rec( Aig_ObjFanin1(pObj) );
898  }
899  assert( Counter0 == Counter1 );
900  return Counter0;
901 }
int Aig_ObjDomRef_rec(Aig_Obj_t *pNode)
Definition: aigDoms.c:851
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
int Aig_ObjDomDeref_rec(Aig_Obj_t *pNode)
Definition: aigDoms.c:823
Definition: aig.h:69
#define assert(ex)
Definition: util_old.h:213
#define Aig_DomForEachNode(pAig, pDom, pNode, i)
Definition: aigDoms.c:54
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
int Aig_ObjDomFilter ( Aig_Sto_t pSto,
Vec_Ptr_t vDoms,
Aig_Dom_t pDom 
)

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

Synopsis [Returns 1 if the cut is contained.]

Description []

SideEffects []

SeeAlso []

Definition at line 306 of file aigDoms.c.

307 {
308  Aig_Dom_t * pTemp;
309  int i;
310  Vec_PtrForEachEntry( Aig_Dom_t *, vDoms, pTemp, i )
311  {
312  if ( pTemp->nNodes > pDom->nNodes )
313  {
314  // do not fiter the first cut
315  if ( i == 0 )
316  continue;
317  // skip the non-contained cuts
318  if ( (pTemp->uSign & pDom->uSign) != pDom->uSign )
319  continue;
320  // check containment seriously
321  if ( Aig_ObjDomCheckDominance( pDom, pTemp ) )
322  {
323  Vec_PtrRemove( vDoms, pTemp );
324  Aig_MmFixedEntryRecycle( pSto->pMem, (char *)pTemp );
325  i--;
326  pSto->nDomsFilter1++;
327  }
328  }
329  else
330  {
331  // skip the non-contained cuts
332  if ( (pTemp->uSign & pDom->uSign) != pTemp->uSign )
333  continue;
334  // check containment seriously
335  if ( Aig_ObjDomCheckDominance( pTemp, pDom ) )
336  {
337  pSto->nDomsFilter2++;
338  return 1;
339  }
340  }
341  }
342  return 0;
343 }
int uSign
Definition: aigDoms.c:35
static int Aig_ObjDomCheckDominance(Aig_Dom_t *pDom, Aig_Dom_t *pCut)
Definition: aigDoms.c:280
int nNodes
Definition: aigDoms.c:36
void Aig_MmFixedEntryRecycle(Aig_MmFixed_t *p, char *pEntry)
Definition: aigMem.c:212
static void Vec_PtrRemove(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:714
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
void Aig_ObjDomFindGood ( Aig_Sto_t pSto)

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

Synopsis [Collects dominators from the cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 978 of file aigDoms.c.

979 {
980  Aig_Dom_t * pDom;
981  Vec_Int_t * vCut;
982  Vec_Ptr_t * vDoms;
983  int i;
984  vCut = Aig_ObjDomCollectLos( pSto );
985  vDoms = Aig_ObjDomCollect( pSto, vCut );
986  Vec_IntFree( vCut );
987  printf( "The cut has %d non-trivial %d-dominators.\n", Vec_PtrSize(vDoms), pSto->Limit );
988 
989  Aig_ObjPoLogicDeref( pSto );
990  Vec_PtrForEachEntry( Aig_Dom_t *, vDoms, pDom, i )
991  {
992 // if ( Aig_ObjDomDomed(pSto, pDom) <= 1 )
993 // continue;
994  printf( "Vol =%3d. ", Aig_ObjDomVolume(pSto, pDom) );
995  printf( "Dom =%3d. ", Aig_ObjDomDomed(pSto, pDom) );
996  Aig_ObjDomPrint( pSto, pDom, i );
997  }
998  Aig_ObjPoLogicRef( pSto );
999 
1000  Aig_ObjDomVecRecycle( pSto, vDoms );
1001  Aig_ManCleanMarkA( pSto->pAig );
1002 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
void Aig_ObjPoLogicRef(Aig_Sto_t *pSto)
Definition: aigDoms.c:959
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
int Aig_ObjDomDomed(Aig_Sto_t *pSto, Aig_Dom_t *pDom)
Definition: aigDoms.c:879
void Aig_ObjPoLogicDeref(Aig_Sto_t *pSto)
Definition: aigDoms.c:940
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Vec_Ptr_t * Aig_ObjDomCollect(Aig_Sto_t *pSto, Vec_Int_t *vCut)
Definition: aigDoms.c:742
Vec_Int_t * Aig_ObjDomCollectLos(Aig_Sto_t *pSto)
Definition: aigDoms.c:915
int Aig_ObjDomVolume(Aig_Sto_t *pSto, Aig_Dom_t *pDom)
Definition: aigDoms.c:799
void Aig_ObjDomVecRecycle(Aig_Sto_t *pSto, Vec_Ptr_t *vDoms)
Definition: aigDoms.c:145
void Aig_ObjDomPrint(Aig_Sto_t *pSto, Aig_Dom_t *pDom, int Num)
Definition: aigDoms.c:165
void Aig_ManCleanMarkA(Aig_Man_t *p)
Definition: aigUtil.c:148
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
Vec_Ptr_t* Aig_ObjDomMerge ( Aig_Sto_t pSto,
Vec_Ptr_t vDoms0,
Vec_Ptr_t vDoms1 
)

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

Synopsis [Merge two arrays of dominators.]

Description []

SideEffects []

SeeAlso []

Definition at line 472 of file aigDoms.c.

473 {
474  Vec_Ptr_t * vDoms;
475  Aig_Dom_t * pDom0, * pDom1, * pDom;
476  int i, k;
477  vDoms = Vec_PtrAlloc( 16 );
478  Vec_PtrForEachEntry( Aig_Dom_t *, vDoms0, pDom0, i )
479  Vec_PtrForEachEntry( Aig_Dom_t *, vDoms1, pDom1, k )
480  {
481  if ( Aig_WordCountOnes( pDom0->uSign | pDom1->uSign ) > pSto->Limit )
482  continue;
483  // check if the cut exists
484  pDom = (Aig_Dom_t *)Aig_MmFixedEntryFetch( pSto->pMem );
485  if ( !Aig_ObjDomMergeTwo( pDom0, pDom1, pDom, pSto->Limit ) )
486  {
487  Aig_MmFixedEntryRecycle( pSto->pMem, (char *)pDom );
488  continue;
489  }
490  // check if this cut is contained in any of the available cuts
491  if ( Aig_ObjDomFilter( pSto, vDoms, pDom ) )
492  {
493  Aig_MmFixedEntryRecycle( pSto->pMem, (char *)pDom );
494  continue;
495  }
496  Vec_PtrPush( vDoms, pDom );
497  }
498  return vDoms;
499 }
int uSign
Definition: aigDoms.c:35
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
void Aig_MmFixedEntryRecycle(Aig_MmFixed_t *p, char *pEntry)
Definition: aigMem.c:212
int Aig_ObjDomMergeTwo(Aig_Dom_t *pDom0, Aig_Dom_t *pDom1, Aig_Dom_t *pDom, int Limit)
Definition: aigDoms.c:442
static int Aig_WordCountOnes(unsigned uWord)
Definition: aig.h:229
char * Aig_MmFixedEntryFetch(Aig_MmFixed_t *p)
Definition: aigMem.c:161
int Aig_ObjDomFilter(Aig_Sto_t *pSto, Vec_Ptr_t *vDoms, Aig_Dom_t *pDom)
Definition: aigDoms.c:306
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static int Aig_ObjDomMergeOrdered ( Aig_Dom_t pD0,
Aig_Dom_t pD1,
Aig_Dom_t pD,
int  Limit 
)
inlinestatic

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

Synopsis [Merges two cuts.]

Description []

SideEffects []

SeeAlso []

Definition at line 356 of file aigDoms.c.

357 {
358  int i, k, c;
359  assert( pD0->nNodes >= pD1->nNodes );
360  // the case of the largest cut sizes
361  if ( pD0->nNodes == Limit && pD1->nNodes == Limit )
362  {
363  for ( i = 0; i < pD0->nNodes; i++ )
364  if ( pD0->pNodes[i] != pD1->pNodes[i] )
365  return 0;
366  for ( i = 0; i < pD0->nNodes; i++ )
367  pD->pNodes[i] = pD0->pNodes[i];
368  pD->nNodes = pD0->nNodes;
369  return 1;
370  }
371  // the case when one of the cuts is the largest
372  if ( pD0->nNodes == Limit )
373  {
374  for ( i = 0; i < pD1->nNodes; i++ )
375  {
376  for ( k = pD0->nNodes - 1; k >= 0; k-- )
377  if ( pD0->pNodes[k] == pD1->pNodes[i] )
378  break;
379  if ( k == -1 ) // did not find
380  return 0;
381  }
382  for ( i = 0; i < pD0->nNodes; i++ )
383  pD->pNodes[i] = pD0->pNodes[i];
384  pD->nNodes = pD0->nNodes;
385  return 1;
386  }
387 
388  // compare two cuts with different numbers
389  i = k = 0;
390  for ( c = 0; c < (int)Limit; c++ )
391  {
392  if ( k == pD1->nNodes )
393  {
394  if ( i == pD0->nNodes )
395  {
396  pD->nNodes = c;
397  return 1;
398  }
399  pD->pNodes[c] = pD0->pNodes[i++];
400  continue;
401  }
402  if ( i == pD0->nNodes )
403  {
404  if ( k == pD1->nNodes )
405  {
406  pD->nNodes = c;
407  return 1;
408  }
409  pD->pNodes[c] = pD1->pNodes[k++];
410  continue;
411  }
412  if ( pD0->pNodes[i] < pD1->pNodes[k] )
413  {
414  pD->pNodes[c] = pD0->pNodes[i++];
415  continue;
416  }
417  if ( pD0->pNodes[i] > pD1->pNodes[k] )
418  {
419  pD->pNodes[c] = pD1->pNodes[k++];
420  continue;
421  }
422  pD->pNodes[c] = pD0->pNodes[i++];
423  k++;
424  }
425  if ( i < pD0->nNodes || k < pD1->nNodes )
426  return 0;
427  pD->nNodes = c;
428  return 1;
429 }
int nNodes
Definition: aigDoms.c:36
#define assert(ex)
Definition: util_old.h:213
int pNodes[0]
Definition: aigDoms.c:37
int Aig_ObjDomMergeTwo ( Aig_Dom_t pDom0,
Aig_Dom_t pDom1,
Aig_Dom_t pDom,
int  Limit 
)

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

Synopsis [Prepares the object for FPGA mapping.]

Description []

SideEffects []

SeeAlso []

Definition at line 442 of file aigDoms.c.

443 {
444  assert( Limit > 0 );
445  if ( pDom0->nNodes < pDom1->nNodes )
446  {
447  if ( !Aig_ObjDomMergeOrdered( pDom1, pDom0, pDom, Limit ) )
448  return 0;
449  }
450  else
451  {
452  if ( !Aig_ObjDomMergeOrdered( pDom0, pDom1, pDom, Limit ) )
453  return 0;
454  }
455  pDom->uSign = pDom0->uSign | pDom1->uSign;
456  assert( pDom->nNodes <= Limit );
457  assert( Aig_ObjDomCheck( pDom ) );
458  return 1;
459 }
int uSign
Definition: aigDoms.c:35
static int Aig_ObjDomMergeOrdered(Aig_Dom_t *pD0, Aig_Dom_t *pD1, Aig_Dom_t *pD, int Limit)
Definition: aigDoms.c:356
int nNodes
Definition: aigDoms.c:36
int Aig_ObjDomCheck(Aig_Dom_t *pDom)
Definition: aigDoms.c:254
#define assert(ex)
Definition: util_old.h:213
void Aig_ObjDomPrint ( Aig_Sto_t pSto,
Aig_Dom_t pDom,
int  Num 
)

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

Synopsis [Duplicates the vector of doms.]

Description []

SideEffects []

SeeAlso []

Definition at line 165 of file aigDoms.c.

166 {
167  int k;
168  printf( "%4d : {", Num );
169  for ( k = 0; k < pDom->nNodes; k++ )
170  printf( " %4d", pDom->pNodes[k] );
171  for ( ; k < pSto->Limit; k++ )
172  printf( " " );
173  printf( " }\n" );
174 }
int nNodes
Definition: aigDoms.c:36
int pNodes[0]
Definition: aigDoms.c:37
int Aig_ObjDomRef_rec ( Aig_Obj_t pNode)

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

Synopsis [References the node's MFFC.]

Description []

SideEffects []

SeeAlso []

Definition at line 851 of file aigDoms.c.

852 {
853  int Counter = 0;
854  assert( pNode->nRefs >= 0 );
855  if ( pNode->nRefs++ > 0 )
856  return 0;
857  assert( pNode->nRefs == 1 );
858  if ( pNode->fMarkA )
859  return 1;
860  if ( Aig_ObjIsCi(pNode) )
861  return 0;
862  Counter += Aig_ObjDomRef_rec( Aig_ObjFanin0(pNode) );
863  if ( Aig_ObjIsNode(pNode) )
864  Counter += Aig_ObjDomRef_rec( Aig_ObjFanin1(pNode) );
865  return Counter;
866 }
int Aig_ObjDomRef_rec(Aig_Obj_t *pNode)
Definition: aigDoms.c:851
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
unsigned int fMarkA
Definition: aig.h:79
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Counter
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
unsigned int nRefs
Definition: aig.h:81
void Aig_ObjDomUnion ( Aig_Sto_t pSto,
Vec_Ptr_t vDoms2,
Vec_Ptr_t vDoms1 
)

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

Synopsis [Union two arrays of dominators.]

Description []

SideEffects []

SeeAlso []

Definition at line 512 of file aigDoms.c.

513 {
514  Aig_Dom_t * pDom1, * pDom2;
515  int i;
516  Vec_PtrForEachEntry( Aig_Dom_t *, vDoms1, pDom1, i )
517  {
518  if ( i == 0 )
519  continue;
520  if ( Aig_ObjDomFilter( pSto, vDoms2, pDom1 ) )
521  continue;
522  pDom2 = (Aig_Dom_t *)Aig_MmFixedEntryFetch( pSto->pMem );
523  memcpy( pDom2, pDom1, sizeof(Aig_Dom_t) + sizeof(int) * pSto->Limit );
524  Vec_PtrPush( vDoms2, pDom2 );
525  }
526 }
char * memcpy()
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
char * Aig_MmFixedEntryFetch(Aig_MmFixed_t *p)
Definition: aigMem.c:161
int Aig_ObjDomFilter(Aig_Sto_t *pSto, Vec_Ptr_t *vDoms, Aig_Dom_t *pDom)
Definition: aigDoms.c:306
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
Vec_Ptr_t* Aig_ObjDomVecDup ( Aig_Sto_t pSto,
Vec_Ptr_t vDoms,
int  fSkip1 
)

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

Synopsis [Duplicates vector of doms.]

Description []

SideEffects []

SeeAlso []

Definition at line 119 of file aigDoms.c.

120 {
121  Vec_Ptr_t * vDoms2;
122  Aig_Dom_t * pDom, * pDom2;
123  int i;
124  vDoms2 = Vec_PtrAlloc( 0 );
125  Vec_PtrForEachEntryStart( Aig_Dom_t *, vDoms, pDom, i, fSkip1 )
126  {
127  pDom2 = (Aig_Dom_t *)Aig_MmFixedEntryFetch( pSto->pMem );
128  memcpy( pDom2, pDom, sizeof(Aig_Dom_t) + sizeof(int) * pSto->Limit );
129  Vec_PtrPush( vDoms2, pDom2 );
130  }
131  return vDoms2;
132 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
#define Vec_PtrForEachEntryStart(Type, vVec, pEntry, i, Start)
Definition: vecPtr.h:57
char * memcpy()
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
char * Aig_MmFixedEntryFetch(Aig_MmFixed_t *p)
Definition: aigMem.c:161
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
void Aig_ObjDomVecPrint ( Aig_Sto_t pSto,
Vec_Ptr_t vDoms 
)

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

Synopsis [Duplicates the vector of doms.]

Description []

SideEffects []

SeeAlso []

Definition at line 187 of file aigDoms.c.

188 {
189  Aig_Dom_t * pDom;
190  int i;
191  Vec_PtrForEachEntry( Aig_Dom_t *, vDoms, pDom, i )
192  Aig_ObjDomPrint( pSto, pDom, i );
193 }
void Aig_ObjDomPrint(Aig_Sto_t *pSto, Aig_Dom_t *pDom, int Num)
Definition: aigDoms.c:165
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
void Aig_ObjDomVecRecycle ( Aig_Sto_t pSto,
Vec_Ptr_t vDoms 
)

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

Synopsis [Recycles vector of doms.]

Description []

SideEffects []

SeeAlso []

Definition at line 145 of file aigDoms.c.

146 {
147  Aig_Dom_t * pDom;
148  int i;
149  Vec_PtrForEachEntry( Aig_Dom_t *, vDoms, pDom, i )
150  Aig_MmFixedEntryRecycle( pSto->pMem, (char *)pDom );
151  Vec_PtrFree( vDoms );
152 }
void Aig_MmFixedEntryRecycle(Aig_MmFixed_t *p, char *pEntry)
Definition: aigMem.c:212
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
int Aig_ObjDomVolume ( Aig_Sto_t pSto,
Aig_Dom_t pDom 
)

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

Synopsis [Count the number of nodes in the dominator.]

Description []

SideEffects []

SeeAlso []

Definition at line 799 of file aigDoms.c.

800 {
801  Aig_Obj_t * pObj;
802  int i, Counter = 0;
803  Aig_ManIncrementTravId( pSto->pAig );
804  Aig_DomForEachNode( pSto->pAig, pDom, pObj, i )
805  Counter += Aig_ObjDomVolume_rec( pSto->pAig, pObj );
806  return Counter;
807 }
int Aig_ObjDomVolume_rec(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigDoms.c:770
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
Definition: aig.h:69
static int Counter
#define Aig_DomForEachNode(pAig, pDom, pNode, i)
Definition: aigDoms.c:54
int Aig_ObjDomVolume_rec ( Aig_Man_t p,
Aig_Obj_t pObj 
)

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

Synopsis [Marks the flop TFI with the current traversal ID.]

Description []

SideEffects []

SeeAlso []

Definition at line 770 of file aigDoms.c.

771 {
772  int Count;
773  assert( !Aig_IsComplement(pObj) );
774  if ( Aig_ObjIsTravIdCurrent(p, pObj) )
775  return 0;
776  Aig_ObjSetTravIdCurrent(p, pObj);
777  if ( pObj->fMarkA )
778  return 1;
779 // assert( !Aig_ObjIsCi(pObj) && !Aig_ObjIsConst1(pObj) );
780  if ( Aig_ObjIsCi(pObj) || Aig_ObjIsConst1(pObj) )
781  return 1;
782  Count = Aig_ObjDomVolume_rec( p, Aig_ObjFanin0(pObj) );
783  if ( Aig_ObjIsNode(pObj) )
784  Count += Aig_ObjDomVolume_rec( p, Aig_ObjFanin1(pObj) );
785  return Count;
786 }
int Aig_ObjDomVolume_rec(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigDoms.c:770
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
unsigned int fMarkA
Definition: aig.h:79
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
void Aig_ObjPoLogicDeref ( Aig_Sto_t pSto)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 940 of file aigDoms.c.

941 {
942  Aig_Obj_t * pObj;
943  int i;
944  Saig_ManForEachPo( pSto->pAig, pObj, i )
946 }
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
int Aig_ObjDomDeref_rec(Aig_Obj_t *pNode)
Definition: aigDoms.c:823
Definition: aig.h:69
#define Saig_ManForEachPo(p, pObj, i)
Definition: saig.h:93
void Aig_ObjPoLogicRef ( Aig_Sto_t pSto)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 959 of file aigDoms.c.

960 {
961  Aig_Obj_t * pObj;
962  int i;
963  Saig_ManForEachPo( pSto->pAig, pObj, i )
965 }
int Aig_ObjDomRef_rec(Aig_Obj_t *pNode)
Definition: aigDoms.c:851
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
Definition: aig.h:69
#define Saig_ManForEachPo(p, pObj, i)
Definition: saig.h:93