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

Go to the source code of this file.

Data Structures

struct  Dar_LibObj_t_
 
struct  Dar_LibDat_t_
 
struct  Dar_Lib_t_
 

Typedefs

typedef
typedefABC_NAMESPACE_IMPL_START
struct Dar_Lib_t_ 
Dar_Lib_t
 DECLARATIONS ///. More...
 
typedef struct Dar_LibObj_t_ Dar_LibObj_t
 
typedef struct Dar_LibDat_t_ Dar_LibDat_t
 

Functions

static Dar_LibObj_tDar_LibObj (Dar_Lib_t *p, int Id)
 
static int Dar_LibObjTruth (Dar_LibObj_t *pObj)
 
Dar_Lib_tDar_LibAlloc (int nObjs)
 FUNCTION DEFINITIONS ///. More...
 
void Dar_LibFree (Dar_Lib_t *p)
 
int Dar_LibReturnClass (unsigned uTruth)
 
void Dar_LibReturnCanonicals (unsigned *pCanons)
 
void Dar_LibAddNode (Dar_Lib_t *p, int Id0, int Id1, int fCompl0, int fCompl1)
 
void Dar_LibSetup_rec (Dar_Lib_t *p, Dar_LibObj_t *pObj, int Class, int fCollect)
 
void Dar_LibSetup (Dar_Lib_t *p, Vec_Int_t *vOuts, Vec_Int_t *vPrios)
 
void Dar_LibCreateData (Dar_Lib_t *p, int nDatas)
 
void Dar_LibSetup0_rec (Dar_Lib_t *p, Dar_LibObj_t *pObj, int Class, int fCollect)
 
void Dar_LibPrepare (int nSubgraphs)
 
Dar_Lib_tDar_LibRead ()
 
void Dar_LibStart ()
 MACRO DEFINITIONS ///. More...
 
void Dar_LibStop ()
 
void Dar_LibIncrementScore (int Class, int Out, int Gain)
 
void Dar_LibDumpPriorities ()
 
int Dar_LibCutMatch (Dar_Man_t *p, Dar_Cut_t *pCut)
 
int Dar_LibCutMarkMffc (Aig_Man_t *p, Aig_Obj_t *pRoot, int nLeaves, float *pPower)
 
void Dar_LibObjPrint_rec (Dar_LibObj_t *pObj)
 
void Dar_LibEvalAssignNums (Dar_Man_t *p, int Class, Aig_Obj_t *pRoot)
 
int Dar_LibEval_rec (Dar_LibObj_t *pObj, int Out, int nNodesSaved, int Required, float *pPower)
 
void Dar_LibEval (Dar_Man_t *p, Aig_Obj_t *pRoot, Dar_Cut_t *pCut, int Required, int *pnMffcSize)
 
void Dar_LibBuildClear_rec (Dar_LibObj_t *pObj, int *pCounter)
 
Aig_Obj_tDar_LibBuildBest_rec (Dar_Man_t *p, Dar_LibObj_t *pObj)
 
Aig_Obj_tDar_LibBuildBest (Dar_Man_t *p)
 
int Dar2_LibCutMatch (Gia_Man_t *p, Vec_Int_t *vCutLits, unsigned uTruth)
 
void Dar2_LibEvalAssignNums (Gia_Man_t *p, int Class)
 
int Dar2_LibEval_rec (Dar_LibObj_t *pObj, int Out)
 
int Dar2_LibEval (Gia_Man_t *p, Vec_Int_t *vCutLits, unsigned uTruth, int fKeepLevel, Vec_Int_t *vLeavesBest2)
 
void Dar2_LibBuildClear_rec (Dar_LibObj_t *pObj, int *pCounter)
 
int Dar2_LibBuildBest_rec (Gia_Man_t *p, Dar_LibObj_t *pObj)
 
int Dar2_LibBuildBest (Gia_Man_t *p, Vec_Int_t *vLeavesBest2, int OutBest)
 
int Dar_LibEvalBuild (Gia_Man_t *p, Vec_Int_t *vCutLits, unsigned uTruth, int fKeepLevel, Vec_Int_t *vLeavesBest2)
 DECLARATIONS ///. More...
 

Variables

static Dar_Lib_ts_DarLib = NULL
 

Typedef Documentation

typedef typedefABC_NAMESPACE_IMPL_START struct Dar_Lib_t_ Dar_Lib_t

DECLARATIONS ///.

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

FileName [darLib.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [DAG-aware AIG rewriting.]

Synopsis [Library of AIG subgraphs used for rewriting.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]

Definition at line 32 of file darLib.c.

typedef struct Dar_LibDat_t_ Dar_LibDat_t

Definition at line 34 of file darLib.c.

typedef struct Dar_LibObj_t_ Dar_LibObj_t

Definition at line 33 of file darLib.c.

Function Documentation

int Dar2_LibBuildBest ( Gia_Man_t p,
Vec_Int_t vLeavesBest2,
int  OutBest 
)

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

Synopsis [Reconstructs the best cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 1308 of file darLib.c.

1309 {
1310  int i, iLeaf, Counter = 4;
1311  assert( Vec_IntSize(vLeavesBest2) == 4 );
1312  Vec_IntForEachEntry( vLeavesBest2, iLeaf, i )
1313  s_DarLib->pDatas[i].iGunc = iLeaf;
1314  Dar2_LibBuildClear_rec( Dar_LibObj(s_DarLib, OutBest), &Counter );
1315  return Dar2_LibBuildBest_rec( p, Dar_LibObj(s_DarLib, OutBest) );
1316 }
static Dar_LibObj_t * Dar_LibObj(Dar_Lib_t *p, int Id)
Definition: darLib.c:110
int Dar2_LibBuildBest_rec(Gia_Man_t *p, Dar_LibObj_t *pObj)
Definition: darLib.c:1277
static int Counter
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static Dar_Lib_t * s_DarLib
Definition: darLib.c:108
#define assert(ex)
Definition: util_old.h:213
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
void Dar2_LibBuildClear_rec(Dar_LibObj_t *pObj, int *pCounter)
Definition: darLib.c:1256
int Dar2_LibBuildBest_rec ( Gia_Man_t p,
Dar_LibObj_t pObj 
)

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

Synopsis [Reconstructs the best cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 1277 of file darLib.c.

1278 {
1279  Gia_Obj_t * pNode;
1280  Dar_LibDat_t * pData;
1281  int iFanin0, iFanin1;
1282  pData = s_DarLib->pDatas + pObj->Num;
1283  if ( pData->iGunc >= 0 )
1284  return pData->iGunc;
1285  iFanin0 = Dar2_LibBuildBest_rec( p, Dar_LibObj(s_DarLib, pObj->Fan0) );
1286  iFanin1 = Dar2_LibBuildBest_rec( p, Dar_LibObj(s_DarLib, pObj->Fan1) );
1287  iFanin0 = Abc_LitNotCond( iFanin0, pObj->fCompl0 );
1288  iFanin1 = Abc_LitNotCond( iFanin1, pObj->fCompl1 );
1289  pData->iGunc = Gia_ManHashAnd( p, iFanin0, iFanin1 );
1290  pNode = Gia_ManObj( p, Abc_Lit2Var(pData->iGunc) );
1291  if ( Gia_ObjIsAnd( pNode ) )
1292  Gia_ObjSetAndLevel( p, pNode );
1293  Gia_ObjSetPhase( p, pNode );
1294  return pData->iGunc;
1295 }
int iGunc
Definition: darLib.c:51
static Dar_LibObj_t * Dar_LibObj(Dar_Lib_t *p, int Id)
Definition: darLib.c:110
int Dar2_LibBuildBest_rec(Gia_Man_t *p, Dar_LibObj_t *pObj)
Definition: darLib.c:1277
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
Definition: gia.h:75
unsigned Fan0
Definition: darLib.c:38
unsigned Fan1
Definition: darLib.c:39
unsigned Num
Definition: darLib.c:44
void Gia_ObjSetPhase(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaUtil.c:346
static void Gia_ObjSetAndLevel(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:506
unsigned fCompl0
Definition: darLib.c:40
unsigned fCompl1
Definition: darLib.c:41
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Dar_Lib_t * s_DarLib
Definition: darLib.c:108
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
void Dar2_LibBuildClear_rec ( Dar_LibObj_t pObj,
int *  pCounter 
)

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

Synopsis [Clears the fields of the nodes used i this cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 1256 of file darLib.c.

1257 {
1258  if ( pObj->fTerm )
1259  return;
1260  pObj->Num = (*pCounter)++;
1261  s_DarLib->pDatas[ pObj->Num ].iGunc = -1;
1262  Dar2_LibBuildClear_rec( Dar_LibObj(s_DarLib, pObj->Fan0), pCounter );
1263  Dar2_LibBuildClear_rec( Dar_LibObj(s_DarLib, pObj->Fan1), pCounter );
1264 }
unsigned fTerm
Definition: darLib.c:43
static Dar_LibObj_t * Dar_LibObj(Dar_Lib_t *p, int Id)
Definition: darLib.c:110
unsigned Fan0
Definition: darLib.c:38
unsigned Fan1
Definition: darLib.c:39
unsigned Num
Definition: darLib.c:44
static Dar_Lib_t * s_DarLib
Definition: darLib.c:108
void Dar2_LibBuildClear_rec(Dar_LibObj_t *pObj, int *pCounter)
Definition: darLib.c:1256
int Dar2_LibCutMatch ( Gia_Man_t p,
Vec_Int_t vCutLits,
unsigned  uTruth 
)

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

Synopsis [Matches the cut with its canonical form.]

Description []

SideEffects []

SeeAlso []

Definition at line 1056 of file darLib.c.

1057 {
1058  unsigned uPhase;
1059  char * pPerm;
1060  int i;
1061  assert( Vec_IntSize(vCutLits) == 4 );
1062  // get the fanin permutation
1063  uPhase = s_DarLib->pPhases[uTruth];
1064  pPerm = s_DarLib->pPerms4[ (int)s_DarLib->pPerms[uTruth] ];
1065  // collect fanins with the corresponding permutation/phase
1066  for ( i = 0; i < Vec_IntSize(vCutLits); i++ )
1067  {
1068 // pFanin = Gia_ManObj( p, pCut->pLeaves[ (int)pPerm[i] ] );
1069 // pFanin = Gia_ManObj( p, Vec_IntEntry( vCutLits, (int)pPerm[i] ) );
1070 // pFanin = Gia_ObjFromLit( p, Vec_IntEntry( vCutLits, (int)pPerm[i] ) );
1071  s_DarLib->pDatas[i].iGunc = Abc_LitNotCond( Vec_IntEntry(vCutLits, (int)pPerm[i]), ((uPhase >> i) & 1) );
1072  s_DarLib->pDatas[i].Level = Gia_ObjLevel( p, Gia_Regular(Gia_ObjFromLit(p, s_DarLib->pDatas[i].iGunc)) );
1073  }
1074  return 1;
1075 }
static Gia_Obj_t * Gia_Regular(Gia_Obj_t *p)
Definition: gia.h:377
static Gia_Obj_t * Gia_ObjFromLit(Gia_Man_t *p, int iLit)
Definition: gia.h:496
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
for(p=first;p->value< newval;p=p->next)
static int Gia_ObjLevel(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:501
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int pPerm[13719]
Definition: rwrTemp.c:32
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static Dar_Lib_t * s_DarLib
Definition: darLib.c:108
#define assert(ex)
Definition: util_old.h:213
int Dar2_LibEval ( Gia_Man_t p,
Vec_Int_t vCutLits,
unsigned  uTruth,
int  fKeepLevel,
Vec_Int_t vLeavesBest2 
)

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

Synopsis [Evaluates one cut.]

Description [Returns the best gain.]

SideEffects []

SeeAlso []

Definition at line 1184 of file darLib.c.

1185 {
1186  int p_OutBest = -1;
1187  int p_OutNumBest = -1;
1188  int p_LevelBest = 1000000;
1189  int p_GainBest = -1000000;
1190  int p_ClassBest = -1;
1191 // int fTraining = 0;
1192  Dar_LibObj_t * pObj;
1193  int Out, k, Class, nNodesSaved, nNodesAdded, nNodesGained;
1194 // abctime clk = Abc_Clock();
1195  assert( Vec_IntSize(vCutLits) == 4 );
1196  assert( (uTruth >> 16) == 0 );
1197  // check if the cut exits and assigns leaves and their levels
1198  if ( !Dar2_LibCutMatch(p, vCutLits, uTruth) )
1199  return -1;
1200  // mark MFFC of the node
1201 // nNodesSaved = Dar2_LibCutMarkMffc( p->pAig, pRoot, pCut->nLeaves, p->pPars->fPower? &PowerSaved : NULL );
1202  nNodesSaved = 0;
1203  // evaluate the cut
1204  Class = s_DarLib->pMap[uTruth];
1205  Dar2_LibEvalAssignNums( p, Class );
1206  // profile outputs by their savings
1207 // p->nTotalSubgs += s_DarLib->nSubgr0[Class];
1208 // p->ClassSubgs[Class] += s_DarLib->nSubgr0[Class];
1209  for ( Out = 0; Out < s_DarLib->nSubgr0[Class]; Out++ )
1210  {
1211  pObj = Dar_LibObj(s_DarLib, s_DarLib->pSubgr0[Class][Out]);
1212 // nNodesAdded = Dar2_LibEval_rec( pObj, Out, nNodesSaved - !p->pPars->fUseZeros, Required, p->pPars->fPower? &PowerAdded : NULL );
1213  nNodesAdded = Dar2_LibEval_rec( pObj, Out );
1214  nNodesGained = nNodesSaved - nNodesAdded;
1215  if ( fKeepLevel )
1216  {
1217  if ( s_DarLib->pDatas[pObj->Num].Level > p_LevelBest ||
1218  (s_DarLib->pDatas[pObj->Num].Level == p_LevelBest && nNodesGained <= p_GainBest) )
1219  continue;
1220  }
1221  else
1222  {
1223  if ( nNodesGained < p_GainBest ||
1224  (nNodesGained == p_GainBest && s_DarLib->pDatas[pObj->Num].Level >= p_LevelBest) )
1225  continue;
1226  }
1227  // remember this possibility
1228  Vec_IntClear( vLeavesBest2 );
1229  for ( k = 0; k < Vec_IntSize(vCutLits); k++ )
1230  Vec_IntPush( vLeavesBest2, s_DarLib->pDatas[k].iGunc );
1231  p_OutBest = s_DarLib->pSubgr0[Class][Out];
1232  p_OutNumBest = Out;
1233  p_LevelBest = s_DarLib->pDatas[pObj->Num].Level;
1234  p_GainBest = nNodesGained;
1235  p_ClassBest = Class;
1236 // assert( p_LevelBest <= Required );
1237  }
1238 //clk = Abc_Clock() - clk;
1239 //p->ClassTimes[Class] += clk;
1240 //p->timeEval += clk;
1241  assert( p_OutBest != -1 );
1242  return p_OutBest;
1243 }
void Dar2_LibEvalAssignNums(Gia_Man_t *p, int Class)
Definition: darLib.c:1088
static Dar_LibObj_t * Dar_LibObj(Dar_Lib_t *p, int Id)
Definition: darLib.c:110
unsigned Num
Definition: darLib.c:44
int Dar2_LibEval_rec(Dar_LibObj_t *pObj, int Out)
Definition: darLib.c:1149
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
static Dar_Lib_t * s_DarLib
Definition: darLib.c:108
#define assert(ex)
Definition: util_old.h:213
int Dar2_LibCutMatch(Gia_Man_t *p, Vec_Int_t *vCutLits, unsigned uTruth)
Definition: darLib.c:1056
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
int Dar2_LibEval_rec ( Dar_LibObj_t pObj,
int  Out 
)

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

Synopsis [Evaluates one cut.]

Description [Returns the best gain.]

SideEffects []

SeeAlso []

Definition at line 1149 of file darLib.c.

1150 {
1151  Dar_LibDat_t * pData;
1152  int Area;
1153  pData = s_DarLib->pDatas + pObj->Num;
1154  if ( pData->TravId == Out )
1155  return 0;
1156  pData->TravId = Out;
1157  if ( pObj->fTerm )
1158  return 0;
1159  assert( pObj->Num > 3 );
1160  if ( pData->iGunc >= 0 )//&& !pData->fMffc )
1161  return 0;
1162  // this is a new node - get a bound on the area of its branches
1163 // nNodesSaved--;
1164  Area = Dar2_LibEval_rec( Dar_LibObj(s_DarLib, pObj->Fan0), Out );
1165 // if ( Area > nNodesSaved )
1166 // return 0xff;
1167  Area += Dar2_LibEval_rec( Dar_LibObj(s_DarLib, pObj->Fan1), Out );
1168 // if ( Area > nNodesSaved )
1169 // return 0xff;
1170  return Area + 1;
1171 }
unsigned fTerm
Definition: darLib.c:43
int TravId
Definition: darLib.c:53
int iGunc
Definition: darLib.c:51
static Dar_LibObj_t * Dar_LibObj(Dar_Lib_t *p, int Id)
Definition: darLib.c:110
unsigned Fan0
Definition: darLib.c:38
unsigned Fan1
Definition: darLib.c:39
unsigned Num
Definition: darLib.c:44
int Dar2_LibEval_rec(Dar_LibObj_t *pObj, int Out)
Definition: darLib.c:1149
static Dar_Lib_t * s_DarLib
Definition: darLib.c:108
#define assert(ex)
Definition: util_old.h:213
void Dar2_LibEvalAssignNums ( Gia_Man_t p,
int  Class 
)

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

Synopsis [Assigns numbers to the nodes of one class.]

Description []

SideEffects []

SeeAlso []

Definition at line 1088 of file darLib.c.

1089 {
1090  Dar_LibObj_t * pObj;
1091  Dar_LibDat_t * pData, * pData0, * pData1;
1092  int iFanin0, iFanin1, i, iLit;
1093  for ( i = 0; i < s_DarLib->nNodes0[Class]; i++ )
1094  {
1095  // get one class node, assign its temporary number and set its data
1096  pObj = Dar_LibObj(s_DarLib, s_DarLib->pNodes0[Class][i]);
1097  pObj->Num = 4 + i;
1098  assert( (int)pObj->Num < s_DarLib->nNodes0Max + 4 );
1099  pData = s_DarLib->pDatas + pObj->Num;
1100  pData->fMffc = 0;
1101  pData->iGunc = -1;
1102  pData->TravId = 0xFFFF;
1103 
1104  // explore the fanins
1105  assert( (int)Dar_LibObj(s_DarLib, pObj->Fan0)->Num < s_DarLib->nNodes0Max + 4 );
1106  assert( (int)Dar_LibObj(s_DarLib, pObj->Fan1)->Num < s_DarLib->nNodes0Max + 4 );
1107  pData0 = s_DarLib->pDatas + Dar_LibObj(s_DarLib, pObj->Fan0)->Num;
1108  pData1 = s_DarLib->pDatas + Dar_LibObj(s_DarLib, pObj->Fan1)->Num;
1109  pData->Level = 1 + Abc_MaxInt(pData0->Level, pData1->Level);
1110  if ( pData0->iGunc == -1 || pData1->iGunc == -1 )
1111  continue;
1112  iFanin0 = Abc_LitNotCond( pData0->iGunc, pObj->fCompl0 );
1113  iFanin1 = Abc_LitNotCond( pData1->iGunc, pObj->fCompl1 );
1114  // compute the resulting literal
1115  if ( iFanin0 == 0 || iFanin1 == 0 || iFanin0 == Abc_LitNot(iFanin1) )
1116  iLit = 0;
1117  else if ( iFanin0 == 1 || iFanin0 == iFanin1 )
1118  iLit = iFanin1;
1119  else if ( iFanin1 == 1 )
1120  iLit = iFanin0;
1121  else
1122  {
1123  iLit = Gia_ManHashLookup( p, Gia_ObjFromLit(p, iFanin0), Gia_ObjFromLit(p, iFanin1) );
1124  if ( iLit == 0 )
1125  iLit = -1;
1126  }
1127  pData->iGunc = iLit;
1128  if ( pData->iGunc >= 0 )
1129  {
1130  // update the level to be more accurate
1131  pData->Level = Gia_ObjLevel( p, Gia_Regular(Gia_ObjFromLit(p, pData->iGunc)) );
1132  // mark the node if it is part of MFFC
1133 // pData->fMffc = Gia_ObjIsTravIdCurrentArray(p, Gia_Regular(pData->pGunc));
1134  }
1135  }
1136 }
int Level
Definition: darLib.c:52
int TravId
Definition: darLib.c:53
static Gia_Obj_t * Gia_Regular(Gia_Obj_t *p)
Definition: gia.h:377
int iGunc
Definition: darLib.c:51
static Gia_Obj_t * Gia_ObjFromLit(Gia_Man_t *p, int iLit)
Definition: gia.h:496
static Dar_LibObj_t * Dar_LibObj(Dar_Lib_t *p, int Id)
Definition: darLib.c:110
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
unsigned Fan0
Definition: darLib.c:38
unsigned char fMffc
Definition: darLib.c:55
unsigned Fan1
Definition: darLib.c:39
static int Gia_ObjLevel(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:501
unsigned Num
Definition: darLib.c:44
unsigned fCompl0
Definition: darLib.c:40
static int Abc_LitNot(int Lit)
Definition: abc_global.h:266
unsigned fCompl1
Definition: darLib.c:41
int Gia_ManHashLookup(Gia_Man_t *p, Gia_Obj_t *p0, Gia_Obj_t *p1)
Definition: giaHash.c:79
static Dar_Lib_t * s_DarLib
Definition: darLib.c:108
#define assert(ex)
Definition: util_old.h:213
void Dar_LibAddNode ( Dar_Lib_t p,
int  Id0,
int  Id1,
int  fCompl0,
int  fCompl1 
)

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

Synopsis [Adds one AND to the library.]

Description []

SideEffects []

SeeAlso []

Definition at line 236 of file darLib.c.

237 {
238  Dar_LibObj_t * pFan0 = Dar_LibObj( p, Id0 );
239  Dar_LibObj_t * pFan1 = Dar_LibObj( p, Id1 );
240  Dar_LibObj_t * pObj = p->pObjs + p->iObj++;
241  pObj->Fan0 = Id0;
242  pObj->Fan1 = Id1;
243  pObj->fCompl0 = fCompl0;
244  pObj->fCompl1 = fCompl1;
245  pObj->fPhase = (fCompl0 ^ pFan0->fPhase) & (fCompl1 ^ pFan1->fPhase);
246  pObj->Num = 0xFFFF & (fCompl0? ~pFan0->Num : pFan0->Num) & (fCompl1? ~pFan1->Num : pFan1->Num);
247 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Dar_LibObj_t * Dar_LibObj(Dar_Lib_t *p, int Id)
Definition: darLib.c:110
unsigned Fan0
Definition: darLib.c:38
unsigned Fan1
Definition: darLib.c:39
unsigned Num
Definition: darLib.c:44
unsigned fCompl0
Definition: darLib.c:40
unsigned fCompl1
Definition: darLib.c:41
unsigned fPhase
Definition: darLib.c:42
Dar_Lib_t* Dar_LibAlloc ( int  nObjs)

FUNCTION DEFINITIONS ///.

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

Synopsis [Starts the library.]

Description []

SideEffects []

SeeAlso []

Definition at line 128 of file darLib.c.

129 {
130  unsigned uTruths[4] = { 0xAAAA, 0xCCCC, 0xF0F0, 0xFF00 };
131  Dar_Lib_t * p;
132  int i;//, clk = Abc_Clock();
133  p = ABC_ALLOC( Dar_Lib_t, 1 );
134  memset( p, 0, sizeof(Dar_Lib_t) );
135  // allocate objects
136  p->nObjs = nObjs;
137  p->pObjs = ABC_ALLOC( Dar_LibObj_t, nObjs );
138  memset( p->pObjs, 0, sizeof(Dar_LibObj_t) * nObjs );
139  // allocate canonical data
140  p->pPerms4 = Dar_Permutations( 4 );
141  Dar_Truth4VarNPN( &p->puCanons, &p->pPhases, &p->pPerms, &p->pMap );
142  // start the elementary objects
143  p->iObj = 4;
144  for ( i = 0; i < 4; i++ )
145  {
146  p->pObjs[i].fTerm = 1;
147  p->pObjs[i].Num = uTruths[i];
148  }
149 // ABC_PRT( "Library start", Abc_Clock() - clk );
150  return p;
151 }
char * memset()
typedefABC_NAMESPACE_IMPL_START struct Dar_Lib_t_ Dar_Lib_t
DECLARATIONS ///.
Definition: darLib.c:32
void Dar_Truth4VarNPN(unsigned short **puCanons, char **puPhases, char **puPerms, unsigned char **puMap)
Definition: darPrec.c:293
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
char ** Dar_Permutations(int n)
Definition: darPrec.c:144
Aig_Obj_t* Dar_LibBuildBest ( Dar_Man_t p)

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

Synopsis [Reconstructs the best cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 1031 of file darLib.c.

1032 {
1033  int i, Counter = 4;
1034  for ( i = 0; i < Vec_PtrSize(p->vLeavesBest); i++ )
1035  s_DarLib->pDatas[i].pFunc = (Aig_Obj_t *)Vec_PtrEntry( p->vLeavesBest, i );
1036  Dar_LibBuildClear_rec( Dar_LibObj(s_DarLib, p->OutBest), &Counter );
1037  return Dar_LibBuildBest_rec( p, Dar_LibObj(s_DarLib, p->OutBest) );
1038 }
Aig_Obj_t * Dar_LibBuildBest_rec(Dar_Man_t *p, Dar_LibObj_t *pObj)
Definition: darLib.c:1005
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Dar_LibObj_t * Dar_LibObj(Dar_Lib_t *p, int Id)
Definition: darLib.c:110
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Definition: aig.h:69
void Dar_LibBuildClear_rec(Dar_LibObj_t *pObj, int *pCounter)
Definition: darLib.c:984
static int Counter
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static Dar_Lib_t * s_DarLib
Definition: darLib.c:108
Aig_Obj_t* Dar_LibBuildBest_rec ( Dar_Man_t p,
Dar_LibObj_t pObj 
)

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

Synopsis [Reconstructs the best cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 1005 of file darLib.c.

1006 {
1007  Aig_Obj_t * pFanin0, * pFanin1;
1008  Dar_LibDat_t * pData = s_DarLib->pDatas + pObj->Num;
1009  if ( pData->pFunc )
1010  return pData->pFunc;
1011  pFanin0 = Dar_LibBuildBest_rec( p, Dar_LibObj(s_DarLib, pObj->Fan0) );
1012  pFanin1 = Dar_LibBuildBest_rec( p, Dar_LibObj(s_DarLib, pObj->Fan1) );
1013  pFanin0 = Aig_NotCond( pFanin0, pObj->fCompl0 );
1014  pFanin1 = Aig_NotCond( pFanin1, pObj->fCompl1 );
1015  pData->pFunc = Aig_And( p->pAig, pFanin0, pFanin1 );
1016 // assert( pData->Level == (int)Aig_Regular(pData->pFunc)->Level );
1017  return pData->pFunc;
1018 }
Aig_Man_t * pAig
Definition: llb3Image.c:49
Aig_Obj_t * Dar_LibBuildBest_rec(Dar_Man_t *p, Dar_LibObj_t *pObj)
Definition: darLib.c:1005
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Dar_LibObj_t * Dar_LibObj(Dar_Lib_t *p, int Id)
Definition: darLib.c:110
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
unsigned Fan0
Definition: darLib.c:38
unsigned Fan1
Definition: darLib.c:39
unsigned Num
Definition: darLib.c:44
unsigned fCompl0
Definition: darLib.c:40
Definition: aig.h:69
unsigned fCompl1
Definition: darLib.c:41
static Dar_Lib_t * s_DarLib
Definition: darLib.c:108
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
Aig_Obj_t * pFunc
Definition: darLib.c:50
void Dar_LibBuildClear_rec ( Dar_LibObj_t pObj,
int *  pCounter 
)

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

Synopsis [Clears the fields of the nodes used in this cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 984 of file darLib.c.

985 {
986  if ( pObj->fTerm )
987  return;
988  pObj->Num = (*pCounter)++;
989  s_DarLib->pDatas[ pObj->Num ].pFunc = NULL;
990  Dar_LibBuildClear_rec( Dar_LibObj(s_DarLib, pObj->Fan0), pCounter );
991  Dar_LibBuildClear_rec( Dar_LibObj(s_DarLib, pObj->Fan1), pCounter );
992 }
unsigned fTerm
Definition: darLib.c:43
static Dar_LibObj_t * Dar_LibObj(Dar_Lib_t *p, int Id)
Definition: darLib.c:110
unsigned Fan0
Definition: darLib.c:38
unsigned Fan1
Definition: darLib.c:39
unsigned Num
Definition: darLib.c:44
void Dar_LibBuildClear_rec(Dar_LibObj_t *pObj, int *pCounter)
Definition: darLib.c:984
static Dar_Lib_t * s_DarLib
Definition: darLib.c:108
void Dar_LibCreateData ( Dar_Lib_t p,
int  nDatas 
)

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

Synopsis [Starts the library.]

Description []

SideEffects []

SeeAlso []

Definition at line 432 of file darLib.c.

433 {
434  if ( p->nDatas == nDatas )
435  return;
436  ABC_FREE( p->pDatas );
437  // allocate datas
438  p->nDatas = nDatas;
439  p->pDatas = ABC_ALLOC( Dar_LibDat_t, nDatas );
440  memset( p->pDatas, 0, sizeof(Dar_LibDat_t) * nDatas );
441 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
#define ABC_FREE(obj)
Definition: abc_global.h:232
int Dar_LibCutMarkMffc ( Aig_Man_t p,
Aig_Obj_t pRoot,
int  nLeaves,
float *  pPower 
)

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

Synopsis [Marks the MFFC of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 752 of file darLib.c.

753 {
754  int i, nNodes;
755  // mark the cut leaves
756  for ( i = 0; i < nLeaves; i++ )
757  Aig_Regular(s_DarLib->pDatas[i].pFunc)->nRefs++;
758  // label MFFC with current ID
759  nNodes = Aig_NodeMffcLabel( p, pRoot, pPower );
760  // unmark the cut leaves
761  for ( i = 0; i < nLeaves; i++ )
762  Aig_Regular(s_DarLib->pDatas[i].pFunc)->nRefs--;
763  return nNodes;
764 }
int Aig_NodeMffcLabel(Aig_Man_t *p, Aig_Obj_t *pNode, float *pPower)
Definition: aigMffc.c:211
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static Dar_Lib_t * s_DarLib
Definition: darLib.c:108
unsigned int nRefs
Definition: aig.h:81
int Dar_LibCutMatch ( Dar_Man_t p,
Dar_Cut_t pCut 
)

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

Synopsis [Matches the cut with its canonical form.]

Description []

SideEffects []

SeeAlso []

Definition at line 706 of file darLib.c.

707 {
708  Aig_Obj_t * pFanin;
709  unsigned uPhase;
710  char * pPerm;
711  int i;
712  assert( pCut->nLeaves == 4 );
713  // get the fanin permutation
714  uPhase = s_DarLib->pPhases[pCut->uTruth];
715  pPerm = s_DarLib->pPerms4[ (int)s_DarLib->pPerms[pCut->uTruth] ];
716  // collect fanins with the corresponding permutation/phase
717  for ( i = 0; i < (int)pCut->nLeaves; i++ )
718  {
719  pFanin = Aig_ManObj( p->pAig, pCut->pLeaves[ (int)pPerm[i] ] );
720  if ( pFanin == NULL )
721  {
722  p->nCutsBad++;
723  return 0;
724  }
725  pFanin = Aig_NotCond(pFanin, ((uPhase >> i) & 1) );
726  s_DarLib->pDatas[i].pFunc = pFanin;
727  s_DarLib->pDatas[i].Level = Aig_Regular(pFanin)->Level;
728  // copy the propability of node being one
729  if ( p->pPars->fPower )
730  {
731  float Prob = Abc_Int2Float( Vec_IntEntry( p->pAig->vProbs, Aig_ObjId(Aig_Regular(pFanin)) ) );
732  s_DarLib->pDatas[i].dProb = Aig_IsComplement(pFanin)? 1.0-Prob : Prob;
733  }
734  }
735  p->nCutsGood++;
736  return 1;
737 }
unsigned Level
Definition: aig.h:82
Aig_Man_t * pAig
Definition: llb3Image.c:49
static Llb_Mgr_t * p
Definition: llb3Image.c:950
unsigned uTruth
Definition: darInt.h:58
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static Aig_Obj_t * Aig_ManObj(Aig_Man_t *p, int i)
Definition: aig.h:270
for(p=first;p->value< newval;p=p->next)
int pLeaves[4]
Definition: darInt.h:63
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Definition: aig.h:69
unsigned nLeaves
Definition: darInt.h:62
static int pPerm[13719]
Definition: rwrTemp.c:32
static Dar_Lib_t * s_DarLib
Definition: darLib.c:108
static float Abc_Int2Float(int Num)
Definition: abc_global.h:250
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
#define assert(ex)
Definition: util_old.h:213
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
void Dar_LibDumpPriorities ( )

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

Synopsis [Prints out the priorities into the file.]

Description []

SideEffects []

SeeAlso []

Definition at line 668 of file darLib.c.

669 {
670  int i, k, Out, Out2, Counter = 0, Printed = 0;
671  printf( "\nOutput priorities (total = %d):\n", s_DarLib->nSubgrTotal );
672  for ( i = 0; i < 222; i++ )
673  {
674 // printf( "Class%d: ", i );
675  for ( k = 0; k < s_DarLib->nSubgr[i]; k++ )
676  {
677  Out = s_DarLib->pPrios[i][k];
678  Out2 = k == 0 ? Out : s_DarLib->pPrios[i][k-1];
679  assert( s_DarLib->pScore[i][Out2] >= s_DarLib->pScore[i][Out] );
680 // printf( "%d(%d), ", Out, s_DarLib->pScore[i][Out] );
681  printf( "%d, ", Out );
682  Printed++;
683  if ( ++Counter == 15 )
684  {
685  printf( "\n" );
686  Counter = 0;
687  }
688  }
689  }
690  printf( "\n" );
691  assert( Printed == s_DarLib->nSubgrTotal );
692 }
static int Counter
static Dar_Lib_t * s_DarLib
Definition: darLib.c:108
#define assert(ex)
Definition: util_old.h:213
void Dar_LibEval ( Dar_Man_t p,
Aig_Obj_t pRoot,
Dar_Cut_t pCut,
int  Required,
int *  pnMffcSize 
)

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

Synopsis [Evaluates one cut.]

Description [Returns the best gain.]

SideEffects []

SeeAlso []

Definition at line 920 of file darLib.c.

921 {
922  int fTraining = 0;
923  float PowerSaved, PowerAdded;
924  Dar_LibObj_t * pObj;
925  int Out, k, Class, nNodesSaved, nNodesAdded, nNodesGained;
926  abctime clk = Abc_Clock();
927  if ( pCut->nLeaves != 4 )
928  return;
929  // check if the cut exits and assigns leaves and their levels
930  if ( !Dar_LibCutMatch(p, pCut) )
931  return;
932  // mark MFFC of the node
933  nNodesSaved = Dar_LibCutMarkMffc( p->pAig, pRoot, pCut->nLeaves, p->pPars->fPower? &PowerSaved : NULL );
934  // evaluate the cut
935  Class = s_DarLib->pMap[pCut->uTruth];
936  Dar_LibEvalAssignNums( p, Class, pRoot );
937  // profile outputs by their savings
938  p->nTotalSubgs += s_DarLib->nSubgr0[Class];
939  p->ClassSubgs[Class] += s_DarLib->nSubgr0[Class];
940  for ( Out = 0; Out < s_DarLib->nSubgr0[Class]; Out++ )
941  {
942  pObj = Dar_LibObj(s_DarLib, s_DarLib->pSubgr0[Class][Out]);
943  if ( Aig_Regular(s_DarLib->pDatas[pObj->Num].pFunc) == pRoot )
944  continue;
945  nNodesAdded = Dar_LibEval_rec( pObj, Out, nNodesSaved - !p->pPars->fUseZeros, Required, p->pPars->fPower? &PowerAdded : NULL );
946  nNodesGained = nNodesSaved - nNodesAdded;
947  if ( p->pPars->fPower && PowerSaved < PowerAdded )
948  continue;
949  if ( fTraining && nNodesGained >= 0 )
950  Dar_LibIncrementScore( Class, Out, nNodesGained + 1 );
951  if ( nNodesGained < 0 || (nNodesGained == 0 && !p->pPars->fUseZeros) )
952  continue;
953  if ( nNodesGained < p->GainBest ||
954  (nNodesGained == p->GainBest && s_DarLib->pDatas[pObj->Num].Level >= p->LevelBest) )
955  continue;
956  // remember this possibility
957  Vec_PtrClear( p->vLeavesBest );
958  for ( k = 0; k < (int)pCut->nLeaves; k++ )
959  Vec_PtrPush( p->vLeavesBest, s_DarLib->pDatas[k].pFunc );
960  p->OutBest = s_DarLib->pSubgr0[Class][Out];
961  p->OutNumBest = Out;
962  p->LevelBest = s_DarLib->pDatas[pObj->Num].Level;
963  p->GainBest = nNodesGained;
964  p->ClassBest = Class;
965  assert( p->LevelBest <= Required );
966  *pnMffcSize = nNodesSaved;
967  }
968 clk = Abc_Clock() - clk;
969 p->ClassTimes[Class] += clk;
970 p->timeEval += clk;
971 }
Aig_Man_t * pAig
Definition: llb3Image.c:49
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Dar_LibObj_t * Dar_LibObj(Dar_Lib_t *p, int Id)
Definition: darLib.c:110
unsigned uTruth
Definition: darInt.h:58
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static abctime Abc_Clock()
Definition: abc_global.h:279
int Dar_LibEval_rec(Dar_LibObj_t *pObj, int Out, int nNodesSaved, int Required, float *pPower)
Definition: darLib.c:863
int Dar_LibCutMarkMffc(Aig_Man_t *p, Aig_Obj_t *pRoot, int nLeaves, float *pPower)
Definition: darLib.c:752
unsigned Num
Definition: darLib.c:44
void Dar_LibIncrementScore(int Class, int Out, int Gain)
Definition: darLib.c:633
unsigned nLeaves
Definition: darInt.h:62
int Dar_LibCutMatch(Dar_Man_t *p, Dar_Cut_t *pCut)
Definition: darLib.c:706
void Dar_LibEvalAssignNums(Dar_Man_t *p, int Class, Aig_Obj_t *pRoot)
Definition: darLib.c:806
static Dar_Lib_t * s_DarLib
Definition: darLib.c:108
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
ABC_INT64_T abctime
Definition: abc_global.h:278
int Dar_LibEval_rec ( Dar_LibObj_t pObj,
int  Out,
int  nNodesSaved,
int  Required,
float *  pPower 
)

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

Synopsis [Evaluates one cut.]

Description [Returns the best gain.]

SideEffects []

SeeAlso []

Definition at line 863 of file darLib.c.

864 {
865  Dar_LibDat_t * pData;
866  float Power0, Power1;
867  int Area;
868  if ( pPower )
869  *pPower = (float)0.0;
870  pData = s_DarLib->pDatas + pObj->Num;
871  if ( pData->TravId == Out )
872  return 0;
873  pData->TravId = Out;
874  if ( pObj->fTerm )
875  {
876  if ( pPower )
877  *pPower = pData->dProb;
878  return 0;
879  }
880  assert( pObj->Num > 3 );
881  if ( pData->Level > Required )
882  return 0xff;
883  if ( pData->pFunc && !pData->fMffc )
884  {
885  if ( pPower )
886  *pPower = pData->dProb;
887  return 0;
888  }
889  // this is a new node - get a bound on the area of its branches
890  nNodesSaved--;
891  Area = Dar_LibEval_rec( Dar_LibObj(s_DarLib, pObj->Fan0), Out, nNodesSaved, Required+1, pPower? &Power0 : NULL );
892  if ( Area > nNodesSaved )
893  return 0xff;
894  Area += Dar_LibEval_rec( Dar_LibObj(s_DarLib, pObj->Fan1), Out, nNodesSaved, Required+1, pPower? &Power1 : NULL );
895  if ( Area > nNodesSaved )
896  return 0xff;
897  if ( pPower )
898  {
899  Dar_LibDat_t * pData0 = s_DarLib->pDatas + Dar_LibObj(s_DarLib, pObj->Fan0)->Num;
900  Dar_LibDat_t * pData1 = s_DarLib->pDatas + Dar_LibObj(s_DarLib, pObj->Fan1)->Num;
901  pData->dProb = (pObj->fCompl0? 1.0 - pData0->dProb : pData0->dProb)*
902  (pObj->fCompl1? 1.0 - pData1->dProb : pData1->dProb);
903  *pPower = Power0 + 2.0 * pData0->dProb * (1.0 - pData0->dProb) +
904  Power1 + 2.0 * pData1->dProb * (1.0 - pData1->dProb);
905  }
906  return Area + 1;
907 }
int Level
Definition: darLib.c:52
unsigned fTerm
Definition: darLib.c:43
int TravId
Definition: darLib.c:53
static Dar_LibObj_t * Dar_LibObj(Dar_Lib_t *p, int Id)
Definition: darLib.c:110
unsigned Fan0
Definition: darLib.c:38
unsigned char fMffc
Definition: darLib.c:55
unsigned Fan1
Definition: darLib.c:39
int Dar_LibEval_rec(Dar_LibObj_t *pObj, int Out, int nNodesSaved, int Required, float *pPower)
Definition: darLib.c:863
unsigned Num
Definition: darLib.c:44
float dProb
Definition: darLib.c:54
unsigned fCompl0
Definition: darLib.c:40
unsigned fCompl1
Definition: darLib.c:41
static Dar_Lib_t * s_DarLib
Definition: darLib.c:108
#define assert(ex)
Definition: util_old.h:213
Aig_Obj_t * pFunc
Definition: darLib.c:50
void Dar_LibEvalAssignNums ( Dar_Man_t p,
int  Class,
Aig_Obj_t pRoot 
)

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

Synopsis [Assigns numbers to the nodes of one class.]

Description []

SideEffects []

SeeAlso []

Definition at line 806 of file darLib.c.

807 {
808  Dar_LibObj_t * pObj;
809  Dar_LibDat_t * pData, * pData0, * pData1;
810  Aig_Obj_t * pFanin0, * pFanin1;
811  int i;
812  for ( i = 0; i < s_DarLib->nNodes0[Class]; i++ )
813  {
814  // get one class node, assign its temporary number and set its data
815  pObj = Dar_LibObj(s_DarLib, s_DarLib->pNodes0[Class][i]);
816  pObj->Num = 4 + i;
817  assert( (int)pObj->Num < s_DarLib->nNodes0Max + 4 );
818  pData = s_DarLib->pDatas + pObj->Num;
819  pData->fMffc = 0;
820  pData->pFunc = NULL;
821  pData->TravId = 0xFFFF;
822 
823  // explore the fanins
824  assert( (int)Dar_LibObj(s_DarLib, pObj->Fan0)->Num < s_DarLib->nNodes0Max + 4 );
825  assert( (int)Dar_LibObj(s_DarLib, pObj->Fan1)->Num < s_DarLib->nNodes0Max + 4 );
826  pData0 = s_DarLib->pDatas + Dar_LibObj(s_DarLib, pObj->Fan0)->Num;
827  pData1 = s_DarLib->pDatas + Dar_LibObj(s_DarLib, pObj->Fan1)->Num;
828  pData->Level = 1 + Abc_MaxInt(pData0->Level, pData1->Level);
829  if ( pData0->pFunc == NULL || pData1->pFunc == NULL )
830  continue;
831  pFanin0 = Aig_NotCond( pData0->pFunc, pObj->fCompl0 );
832  pFanin1 = Aig_NotCond( pData1->pFunc, pObj->fCompl1 );
833  if ( Aig_Regular(pFanin0) == pRoot || Aig_Regular(pFanin1) == pRoot )
834  continue;
835  pData->pFunc = Aig_TableLookupTwo( p->pAig, pFanin0, pFanin1 );
836  if ( pData->pFunc )
837  {
838  // update the level to be more accurate
839  pData->Level = Aig_Regular(pData->pFunc)->Level;
840  // mark the node if it is part of MFFC
841  pData->fMffc = Aig_ObjIsTravIdCurrent(p->pAig, Aig_Regular(pData->pFunc));
842  // assign the probability
843  if ( p->pPars->fPower )
844  {
845  float Prob = Abc_Int2Float( Vec_IntEntry( p->pAig->vProbs, Aig_ObjId(Aig_Regular(pData->pFunc)) ) );
846  pData->dProb = Aig_IsComplement(pData->pFunc)? 1.0-Prob : Prob;
847  }
848  }
849  }
850 }
int Level
Definition: darLib.c:52
unsigned Level
Definition: aig.h:82
Aig_Man_t * pAig
Definition: llb3Image.c:49
int TravId
Definition: darLib.c:53
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 Dar_LibObj_t * Dar_LibObj(Dar_Lib_t *p, int Id)
Definition: darLib.c:110
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
unsigned Fan0
Definition: darLib.c:38
unsigned char fMffc
Definition: darLib.c:55
unsigned Fan1
Definition: darLib.c:39
unsigned Num
Definition: darLib.c:44
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
float dProb
Definition: darLib.c:54
unsigned fCompl0
Definition: darLib.c:40
Definition: aig.h:69
Aig_Obj_t * Aig_TableLookupTwo(Aig_Man_t *p, Aig_Obj_t *pFanin0, Aig_Obj_t *pFanin1)
Definition: aigTable.c:146
unsigned fCompl1
Definition: darLib.c:41
static Dar_Lib_t * s_DarLib
Definition: darLib.c:108
static float Abc_Int2Float(int Num)
Definition: abc_global.h:250
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
#define assert(ex)
Definition: util_old.h:213
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
Aig_Obj_t * pFunc
Definition: darLib.c:50
int Dar_LibEvalBuild ( Gia_Man_t p,
Vec_Int_t vCutLits,
unsigned  uTruth,
int  fKeepLevel,
Vec_Int_t vLeavesBest2 
)

DECLARATIONS ///.

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

Synopsis [Evaluate and build the new node.]

Description []

SideEffects []

SeeAlso []

Definition at line 1329 of file darLib.c.

1330 {
1331  int OutBest = Dar2_LibEval( p, vCutLits, uTruth, fKeepLevel, vLeavesBest2 );
1332  return Dar2_LibBuildBest( p, vLeavesBest2, OutBest );
1333 }
int Dar2_LibEval(Gia_Man_t *p, Vec_Int_t *vCutLits, unsigned uTruth, int fKeepLevel, Vec_Int_t *vLeavesBest2)
Definition: darLib.c:1184
int Dar2_LibBuildBest(Gia_Man_t *p, Vec_Int_t *vLeavesBest2, int OutBest)
Definition: darLib.c:1308
void Dar_LibFree ( Dar_Lib_t p)

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

Synopsis [Frees the library.]

Description []

SideEffects []

SeeAlso []

Definition at line 164 of file darLib.c.

165 {
166  ABC_FREE( p->pObjs );
167  ABC_FREE( p->pDatas );
168  ABC_FREE( p->pNodesMem );
169  ABC_FREE( p->pNodes0Mem );
170  ABC_FREE( p->pSubgrMem );
171  ABC_FREE( p->pSubgr0Mem );
172  ABC_FREE( p->pPriosMem );
173  ABC_FREE( p->pPlaceMem );
174  ABC_FREE( p->pScoreMem );
175  ABC_FREE( p->pPerms4 );
176  ABC_FREE( p->puCanons );
177  ABC_FREE( p->pPhases );
178  ABC_FREE( p->pPerms );
179  ABC_FREE( p->pMap );
180  ABC_FREE( p );
181 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_FREE(obj)
Definition: abc_global.h:232
void Dar_LibIncrementScore ( int  Class,
int  Out,
int  Gain 
)

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

Synopsis [Updates the score of the class and adjusts the priority of this class.]

Description []

SideEffects []

SeeAlso []

Definition at line 633 of file darLib.c.

634 {
635  int * pPrios = s_DarLib->pPrios[Class]; // pPrios[i] = Out
636  int * pPlace = s_DarLib->pPlace[Class]; // pPlace[Out] = i
637  int * pScore = s_DarLib->pScore[Class]; // score of Out
638  int Out2;
639  assert( Class >= 0 && Class < 222 );
640  assert( Out >= 0 && Out < s_DarLib->nSubgr[Class] );
641  assert( pPlace[pPrios[Out]] == Out );
642  // increment the score
643  pScore[Out] += Gain;
644  // move the out in the order
645  while ( pPlace[Out] > 0 && pScore[Out] > pScore[ pPrios[pPlace[Out]-1] ] )
646  {
647  // get the previous output in the priority list
648  Out2 = pPrios[pPlace[Out]-1];
649  // swap Out and Out2
650  pPlace[Out]--;
651  pPlace[Out2]++;
652  pPrios[pPlace[Out]] = Out;
653  pPrios[pPlace[Out2]] = Out2;
654  }
655 }
static Dar_Lib_t * s_DarLib
Definition: darLib.c:108
#define assert(ex)
Definition: util_old.h:213
static Dar_LibObj_t* Dar_LibObj ( Dar_Lib_t p,
int  Id 
)
inlinestatic

Definition at line 110 of file darLib.c.

110 { return p->pObjs + Id; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Dar_LibObjPrint_rec ( Dar_LibObj_t pObj)

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

Synopsis [Evaluates one cut.]

Description [Returns the best gain.]

SideEffects []

SeeAlso []

Definition at line 777 of file darLib.c.

778 {
779  if ( pObj->fTerm )
780  {
781  printf( "%c", 'a' + (int)(pObj - s_DarLib->pObjs) );
782  return;
783  }
784  printf( "(" );
786  if ( pObj->fCompl0 )
787  printf( "\'" );
789  if ( pObj->fCompl0 )
790  printf( "\'" );
791  printf( ")" );
792 }
void Dar_LibObjPrint_rec(Dar_LibObj_t *pObj)
Definition: darLib.c:777
unsigned fTerm
Definition: darLib.c:43
static Dar_LibObj_t * Dar_LibObj(Dar_Lib_t *p, int Id)
Definition: darLib.c:110
unsigned Fan0
Definition: darLib.c:38
unsigned Fan1
Definition: darLib.c:39
unsigned fCompl0
Definition: darLib.c:40
static Dar_Lib_t * s_DarLib
Definition: darLib.c:108
static int Dar_LibObjTruth ( Dar_LibObj_t pObj)
inlinestatic

Definition at line 111 of file darLib.c.

111 { return pObj->Num < (0xFFFF & ~pObj->Num) ? pObj->Num : (0xFFFF & ~pObj->Num); }
unsigned Num
Definition: darLib.c:44
void Dar_LibPrepare ( int  nSubgraphs)

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

Synopsis [Starts the library.]

Description []

SideEffects []

SeeAlso []

Definition at line 478 of file darLib.c.

479 {
480  Dar_Lib_t * p = s_DarLib;
481  int i, k, nNodes0Total;
482  if ( p->nSubgraphs == nSubgraphs )
483  return;
484 
485  // favor special classes:
486  // 1 : F = (!d*!c*!b*!a)
487  // 4 : F = (!d*!c*!(b*a))
488  // 12 : F = (!d*!(c*!(!b*!a)))
489  // 20 : F = (!d*!(c*b*a))
490 
491  // set the subgraph counters
492  p->nSubgr0Total = 0;
493  for ( i = 0; i < 222; i++ )
494  {
495 // if ( i == 1 || i == 4 || i == 12 || i == 20 ) // special classes
496  if ( i == 1 ) // special classes
497  p->nSubgr0[i] = p->nSubgr[i];
498  else
499  p->nSubgr0[i] = Abc_MinInt( p->nSubgr[i], nSubgraphs );
500  p->nSubgr0Total += p->nSubgr0[i];
501  for ( k = 0; k < p->nSubgr0[i]; k++ )
502  p->pSubgr0[i][k] = p->pSubgr[i][ p->pPrios[i][k] ];
503  }
504 
505  // count the number of nodes
506  // clean node counters
507  for ( i = 0; i < 222; i++ )
508  p->nNodes0[i] = 0;
509  // create traversal IDs
510  for ( i = 0; i < p->iObj; i++ )
511  Dar_LibObj(p, i)->Num = 0xff;
512  // count nodes in each class
513  // count the total number of nodes and the largest class
514  p->nNodes0Total = 0;
515  p->nNodes0Max = 0;
516  for ( i = 0; i < 222; i++ )
517  {
518  for ( k = 0; k < p->nSubgr0[i]; k++ )
519  Dar_LibSetup0_rec( p, Dar_LibObj(p, p->pSubgr0[i][k]), i, 0 );
520  p->nNodes0Total += p->nNodes0[i];
521  p->nNodes0Max = Abc_MaxInt( p->nNodes0Max, p->nNodes0[i] );
522  }
523 
524  // clean node counters
525  for ( i = 0; i < 222; i++ )
526  p->nNodes0[i] = 0;
527  // create traversal IDs
528  for ( i = 0; i < p->iObj; i++ )
529  Dar_LibObj(p, i)->Num = 0xff;
530  // add the nodes to storage
531  nNodes0Total = 0;
532  for ( i = 0; i < 222; i++ )
533  {
534  for ( k = 0; k < p->nSubgr0[i]; k++ )
535  Dar_LibSetup0_rec( p, Dar_LibObj(p, p->pSubgr0[i][k]), i, 1 );
536  nNodes0Total += p->nNodes0[i];
537  }
538  assert( nNodes0Total == p->nNodes0Total );
539  // prepare the number of the PI nodes
540  for ( i = 0; i < 4; i++ )
541  Dar_LibObj(p, i)->Num = i;
542 
543  // realloc the datas
544  Dar_LibCreateData( p, p->nNodes0Max + 32 );
545  // allocated more because Dar_LibBuildBest() sometimes requires more entries
546 }
typedefABC_NAMESPACE_IMPL_START struct Dar_Lib_t_ Dar_Lib_t
DECLARATIONS ///.
Definition: darLib.c:32
void Dar_LibCreateData(Dar_Lib_t *p, int nDatas)
Definition: darLib.c:432
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Dar_LibObj_t * Dar_LibObj(Dar_Lib_t *p, int Id)
Definition: darLib.c:110
void Dar_LibSetup0_rec(Dar_Lib_t *p, Dar_LibObj_t *pObj, int Class, int fCollect)
Definition: darLib.c:454
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
for(p=first;p->value< newval;p=p->next)
static int Abc_MinInt(int a, int b)
Definition: abc_global.h:239
unsigned Num
Definition: darLib.c:44
static Dar_Lib_t * s_DarLib
Definition: darLib.c:108
#define assert(ex)
Definition: util_old.h:213
Dar_Lib_t* Dar_LibRead ( )

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

Synopsis [Reads library from array.]

Description []

SideEffects []

SeeAlso []

Definition at line 559 of file darLib.c.

560 {
561  Vec_Int_t * vObjs, * vOuts, * vPrios;
562  Dar_Lib_t * p;
563  int i;
564  // read nodes and outputs
565  vObjs = Dar_LibReadNodes();
566  vOuts = Dar_LibReadOuts();
567  vPrios = Dar_LibReadPrios();
568  // create library
569  p = Dar_LibAlloc( Vec_IntSize(vObjs)/2 + 4 );
570  // create nodes
571  for ( i = 0; i < vObjs->nSize; i += 2 )
572  Dar_LibAddNode( p, vObjs->pArray[i] >> 1, vObjs->pArray[i+1] >> 1,
573  vObjs->pArray[i] & 1, vObjs->pArray[i+1] & 1 );
574  // create outputs
575  Dar_LibSetup( p, vOuts, vPrios );
576  Vec_IntFree( vObjs );
577  Vec_IntFree( vOuts );
578  Vec_IntFree( vPrios );
579  return p;
580 }
typedefABC_NAMESPACE_IMPL_START struct Dar_Lib_t_ Dar_Lib_t
DECLARATIONS ///.
Definition: darLib.c:32
Vec_Int_t * Dar_LibReadNodes()
Definition: darData.c:11094
void Dar_LibSetup(Dar_Lib_t *p, Vec_Int_t *vOuts, Vec_Int_t *vPrios)
Definition: darLib.c:284
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Vec_Int_t * Dar_LibReadOuts()
Definition: darData.c:11115
void Dar_LibAddNode(Dar_Lib_t *p, int Id0, int Id1, int fCompl0, int fCompl1)
Definition: darLib.c:236
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Dar_Lib_t * Dar_LibAlloc(int nObjs)
FUNCTION DEFINITIONS ///.
Definition: darLib.c:128
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Vec_Int_t * Dar_LibReadPrios()
Definition: darData.c:11136
void Dar_LibReturnCanonicals ( unsigned *  pCanons)

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

Synopsis [Returns canonical truth tables.]

Description []

SideEffects []

SeeAlso []

Definition at line 211 of file darLib.c.

212 {
213  int Visits[222] = {0};
214  int i, k;
215  // find canonical truth tables
216  for ( i = k = 0; i < (1<<16); i++ )
217  if ( !Visits[s_DarLib->pMap[i]] )
218  {
219  Visits[s_DarLib->pMap[i]] = 1;
220  pCanons[k++] = ((i<<16) | i);
221  }
222  assert( k == 222 );
223 }
static Dar_Lib_t * s_DarLib
Definition: darLib.c:108
#define assert(ex)
Definition: util_old.h:213
int Dar_LibReturnClass ( unsigned  uTruth)

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

Synopsis [Returns canonical truth tables.]

Description []

SideEffects []

SeeAlso []

Definition at line 194 of file darLib.c.

195 {
196  return s_DarLib->pMap[uTruth & 0xffff];
197 }
static Dar_Lib_t * s_DarLib
Definition: darLib.c:108
void Dar_LibSetup ( Dar_Lib_t p,
Vec_Int_t vOuts,
Vec_Int_t vPrios 
)

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

Synopsis [Adds one AND to the library.]

Description []

SideEffects []

SeeAlso []

Definition at line 284 of file darLib.c.

285 {
286  int fTraining = 0;
287  Dar_LibObj_t * pObj;
288  int nNodesTotal, uTruth, Class, Out, i, k;
289  assert( p->iObj == p->nObjs );
290 
291  // count the number of representatives of each class
292  for ( i = 0; i < 222; i++ )
293  p->nSubgr[i] = p->nNodes[i] = 0;
294  Vec_IntForEachEntry( vOuts, Out, i )
295  {
296  pObj = Dar_LibObj( p, Out );
297  uTruth = Dar_LibObjTruth( pObj );
298  Class = p->pMap[uTruth];
299  p->nSubgr[Class]++;
300  }
301  // allocate memory for the roots of each class
302  p->pSubgrMem = ABC_ALLOC( int, Vec_IntSize(vOuts) );
303  p->pSubgr0Mem = ABC_ALLOC( int, Vec_IntSize(vOuts) );
304  p->nSubgrTotal = 0;
305  for ( i = 0; i < 222; i++ )
306  {
307  p->pSubgr[i] = p->pSubgrMem + p->nSubgrTotal;
308  p->pSubgr0[i] = p->pSubgr0Mem + p->nSubgrTotal;
309  p->nSubgrTotal += p->nSubgr[i];
310  p->nSubgr[i] = 0;
311  }
312  assert( p->nSubgrTotal == Vec_IntSize(vOuts) );
313  // add the outputs to storage
314  Vec_IntForEachEntry( vOuts, Out, i )
315  {
316  pObj = Dar_LibObj( p, Out );
317  uTruth = Dar_LibObjTruth( pObj );
318  Class = p->pMap[uTruth];
319  p->pSubgr[Class][ p->nSubgr[Class]++ ] = Out;
320  }
321 
322  if ( fTraining )
323  {
324  // allocate memory for the priority of roots of each class
325  p->pPriosMem = ABC_ALLOC( int, Vec_IntSize(vOuts) );
326  p->nSubgrTotal = 0;
327  for ( i = 0; i < 222; i++ )
328  {
329  p->pPrios[i] = p->pPriosMem + p->nSubgrTotal;
330  p->nSubgrTotal += p->nSubgr[i];
331  for ( k = 0; k < p->nSubgr[i]; k++ )
332  p->pPrios[i][k] = k;
333 
334  }
335  assert( p->nSubgrTotal == Vec_IntSize(vOuts) );
336 
337  // allocate memory for the priority of roots of each class
338  p->pPlaceMem = ABC_ALLOC( int, Vec_IntSize(vOuts) );
339  p->nSubgrTotal = 0;
340  for ( i = 0; i < 222; i++ )
341  {
342  p->pPlace[i] = p->pPlaceMem + p->nSubgrTotal;
343  p->nSubgrTotal += p->nSubgr[i];
344  for ( k = 0; k < p->nSubgr[i]; k++ )
345  p->pPlace[i][k] = k;
346 
347  }
348  assert( p->nSubgrTotal == Vec_IntSize(vOuts) );
349 
350  // allocate memory for the priority of roots of each class
351  p->pScoreMem = ABC_ALLOC( int, Vec_IntSize(vOuts) );
352  p->nSubgrTotal = 0;
353  for ( i = 0; i < 222; i++ )
354  {
355  p->pScore[i] = p->pScoreMem + p->nSubgrTotal;
356  p->nSubgrTotal += p->nSubgr[i];
357  for ( k = 0; k < p->nSubgr[i]; k++ )
358  p->pScore[i][k] = 0;
359 
360  }
361  assert( p->nSubgrTotal == Vec_IntSize(vOuts) );
362  }
363  else
364  {
365  int Counter = 0;
366  // allocate memory for the priority of roots of each class
367  p->pPriosMem = ABC_ALLOC( int, Vec_IntSize(vOuts) );
368  p->nSubgrTotal = 0;
369  for ( i = 0; i < 222; i++ )
370  {
371  p->pPrios[i] = p->pPriosMem + p->nSubgrTotal;
372  p->nSubgrTotal += p->nSubgr[i];
373  for ( k = 0; k < p->nSubgr[i]; k++ )
374  p->pPrios[i][k] = Vec_IntEntry(vPrios, Counter++);
375 
376  }
377  assert( p->nSubgrTotal == Vec_IntSize(vOuts) );
378  assert( Counter == Vec_IntSize(vPrios) );
379  }
380 
381  // create traversal IDs
382  for ( i = 0; i < p->iObj; i++ )
383  Dar_LibObj(p, i)->Num = 0xff;
384  // count nodes in each class
385  for ( i = 0; i < 222; i++ )
386  for ( k = 0; k < p->nSubgr[i]; k++ )
387  Dar_LibSetup_rec( p, Dar_LibObj(p, p->pSubgr[i][k]), i, 0 );
388  // count the total number of nodes
389  p->nNodesTotal = 0;
390  for ( i = 0; i < 222; i++ )
391  p->nNodesTotal += p->nNodes[i];
392  // allocate memory for the nodes of each class
393  p->pNodesMem = ABC_ALLOC( int, p->nNodesTotal );
394  p->pNodes0Mem = ABC_ALLOC( int, p->nNodesTotal );
395  p->nNodesTotal = 0;
396  for ( i = 0; i < 222; i++ )
397  {
398  p->pNodes[i] = p->pNodesMem + p->nNodesTotal;
399  p->pNodes0[i] = p->pNodes0Mem + p->nNodesTotal;
400  p->nNodesTotal += p->nNodes[i];
401  p->nNodes[i] = 0;
402  }
403  // create traversal IDs
404  for ( i = 0; i < p->iObj; i++ )
405  Dar_LibObj(p, i)->Num = 0xff;
406  // add the nodes to storage
407  nNodesTotal = 0;
408  for ( i = 0; i < 222; i++ )
409  {
410  for ( k = 0; k < p->nSubgr[i]; k++ )
411  Dar_LibSetup_rec( p, Dar_LibObj(p, p->pSubgr[i][k]), i, 1 );
412  nNodesTotal += p->nNodes[i];
413 //printf( "Class %3d : Subgraphs = %4d. Nodes = %5d.\n", i, p->nSubgr[i], p->nNodes[i] );
414  }
415  assert( nNodesTotal == p->nNodesTotal );
416  // prepare the number of the PI nodes
417  for ( i = 0; i < 4; i++ )
418  Dar_LibObj(p, i)->Num = i;
419 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Dar_LibObj_t * Dar_LibObj(Dar_Lib_t *p, int Id)
Definition: darLib.c:110
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
void Dar_LibSetup_rec(Dar_Lib_t *p, Dar_LibObj_t *pObj, int Class, int fCollect)
Definition: darLib.c:260
unsigned Num
Definition: darLib.c:44
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Counter
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define assert(ex)
Definition: util_old.h:213
static int Dar_LibObjTruth(Dar_LibObj_t *pObj)
Definition: darLib.c:111
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
void Dar_LibSetup0_rec ( Dar_Lib_t p,
Dar_LibObj_t pObj,
int  Class,
int  fCollect 
)

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

Synopsis [Adds one AND to the library.]

Description []

SideEffects []

SeeAlso []

Definition at line 454 of file darLib.c.

455 {
456  if ( pObj->fTerm || (int)pObj->Num == Class )
457  return;
458  pObj->Num = Class;
459  Dar_LibSetup0_rec( p, Dar_LibObj(p, pObj->Fan0), Class, fCollect );
460  Dar_LibSetup0_rec( p, Dar_LibObj(p, pObj->Fan1), Class, fCollect );
461  if ( fCollect )
462  p->pNodes0[Class][ p->nNodes0[Class]++ ] = pObj-p->pObjs;
463  else
464  p->nNodes0[Class]++;
465 }
unsigned fTerm
Definition: darLib.c:43
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Dar_LibObj_t * Dar_LibObj(Dar_Lib_t *p, int Id)
Definition: darLib.c:110
void Dar_LibSetup0_rec(Dar_Lib_t *p, Dar_LibObj_t *pObj, int Class, int fCollect)
Definition: darLib.c:454
unsigned Fan0
Definition: darLib.c:38
unsigned Fan1
Definition: darLib.c:39
unsigned Num
Definition: darLib.c:44
void Dar_LibSetup_rec ( Dar_Lib_t p,
Dar_LibObj_t pObj,
int  Class,
int  fCollect 
)

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

Synopsis [Adds one AND to the library.]

Description []

SideEffects []

SeeAlso []

Definition at line 260 of file darLib.c.

261 {
262  if ( pObj->fTerm || (int)pObj->Num == Class )
263  return;
264  pObj->Num = Class;
265  Dar_LibSetup_rec( p, Dar_LibObj(p, pObj->Fan0), Class, fCollect );
266  Dar_LibSetup_rec( p, Dar_LibObj(p, pObj->Fan1), Class, fCollect );
267  if ( fCollect )
268  p->pNodes[Class][ p->nNodes[Class]++ ] = pObj-p->pObjs;
269  else
270  p->nNodes[Class]++;
271 }
unsigned fTerm
Definition: darLib.c:43
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Dar_LibObj_t * Dar_LibObj(Dar_Lib_t *p, int Id)
Definition: darLib.c:110
unsigned Fan0
Definition: darLib.c:38
unsigned Fan1
Definition: darLib.c:39
void Dar_LibSetup_rec(Dar_Lib_t *p, Dar_LibObj_t *pObj, int Class, int fCollect)
Definition: darLib.c:260
unsigned Num
Definition: darLib.c:44
void Dar_LibStart ( )

MACRO DEFINITIONS ///.

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

Synopsis [Starts the library.]

Description []

SideEffects []

SeeAlso []

Definition at line 593 of file darLib.c.

594 {
595 // abctime clk = Abc_Clock();
596  if ( s_DarLib != NULL )
597  return;
598  assert( s_DarLib == NULL );
599  s_DarLib = Dar_LibRead();
600 // printf( "The 4-input library started with %d nodes and %d subgraphs. ", s_DarLib->nObjs - 4, s_DarLib->nSubgrTotal );
601 // ABC_PRT( "Time", Abc_Clock() - clk );
602 }
static Dar_Lib_t * s_DarLib
Definition: darLib.c:108
#define assert(ex)
Definition: util_old.h:213
Dar_Lib_t * Dar_LibRead()
Definition: darLib.c:559
void Dar_LibStop ( )

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

Synopsis [Stops the library.]

Description []

SideEffects []

SeeAlso []

Definition at line 615 of file darLib.c.

616 {
617  assert( s_DarLib != NULL );
619  s_DarLib = NULL;
620 }
static Dar_Lib_t * s_DarLib
Definition: darLib.c:108
#define assert(ex)
Definition: util_old.h:213
void Dar_LibFree(Dar_Lib_t *p)
Definition: darLib.c:164

Variable Documentation

Dar_Lib_t* s_DarLib = NULL
static

Definition at line 108 of file darLib.c.