abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
giaUtil.c File Reference
#include "gia.h"
#include "base/main/mainInt.h"

Go to the source code of this file.

Macros

#define NUMBER1   3716960521u
 DECLARATIONS ///. More...
 
#define NUMBER2   2174103536u
 

Functions

unsigned Gia_ManRandom (int fReset)
 FUNCTION DEFINITIONS ///. More...
 
word Gia_ManRandomW (int fReset)
 
void Gia_ManRandomInfo (Vec_Ptr_t *vInfo, int iInputStart, int iWordStart, int iWordStop)
 
char * Gia_TimeStamp ()
 
char * Gia_FileNameGenericAppend (char *pBase, char *pSuffix)
 
void Gia_ManIncrementTravId (Gia_Man_t *p)
 
void Gia_ManCleanMark01 (Gia_Man_t *p)
 
void Gia_ManSetMark0 (Gia_Man_t *p)
 
void Gia_ManCleanMark0 (Gia_Man_t *p)
 
void Gia_ManCheckMark0 (Gia_Man_t *p)
 
void Gia_ManSetMark1 (Gia_Man_t *p)
 
void Gia_ManCleanMark1 (Gia_Man_t *p)
 
void Gia_ManCheckMark1 (Gia_Man_t *p)
 
void Gia_ManCleanValue (Gia_Man_t *p)
 
void Gia_ManFillValue (Gia_Man_t *p)
 
void Gia_ObjSetPhase (Gia_Man_t *p, Gia_Obj_t *pObj)
 
void Gia_ManSetPhase (Gia_Man_t *p)
 
void Gia_ManSetPhasePattern (Gia_Man_t *p, Vec_Int_t *vCiValues)
 
void Gia_ManSetPhase1 (Gia_Man_t *p)
 
void Gia_ManCleanPhase (Gia_Man_t *p)
 
int Gia_ManCheckCoPhase (Gia_Man_t *p)
 
void Gia_ManCleanLevels (Gia_Man_t *p, int Size)
 
void Gia_ManCleanTruth (Gia_Man_t *p)
 
int Gia_ManLevelNum (Gia_Man_t *p)
 
float Gia_ManLevelAve (Gia_Man_t *p)
 
Vec_Int_tGia_ManGetCiLevels (Gia_Man_t *p)
 
int Gia_ManSetLevels (Gia_Man_t *p, Vec_Int_t *vCiLevels)
 
Vec_Int_tGia_ManReverseLevel (Gia_Man_t *p)
 
Vec_Int_tGia_ManRequiredLevel (Gia_Man_t *p)
 
Vec_Int_tGia_ManComputeSlacks (Gia_Man_t *p)
 
void Gia_ManCreateValueRefs (Gia_Man_t *p)
 
void Gia_ManCreateRefs (Gia_Man_t *p)
 
int * Gia_ManCreateMuxRefs (Gia_Man_t *p)
 
void Gia_ManDfsForCrossCut_rec (Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vNodes)
 
Vec_Int_tGia_ManDfsForCrossCut (Gia_Man_t *p, int fReverse)
 
int Gia_ManCrossCut (Gia_Man_t *p, int fReverse)
 
Vec_Int_tGia_ManCollectPoIds (Gia_Man_t *p)
 
int Gia_ObjIsMuxType (Gia_Obj_t *pNode)
 
int Gia_ObjRecognizeExor (Gia_Obj_t *pObj, Gia_Obj_t **ppFan0, Gia_Obj_t **ppFan1)
 
Gia_Obj_tGia_ObjRecognizeMux (Gia_Obj_t *pNode, Gia_Obj_t **ppNodeT, Gia_Obj_t **ppNodeE)
 
int Gia_ObjRecognizeMuxLits (Gia_Man_t *p, Gia_Obj_t *pNode, int *iLitT, int *iLitE)
 
int Gia_NodeDeref_rec (Gia_Man_t *p, Gia_Obj_t *pNode)
 
int Gia_NodeRef_rec (Gia_Man_t *p, Gia_Obj_t *pNode)
 
int Gia_ManPoMffcSize (Gia_Man_t *p)
 
int Gia_NodeMffcSize (Gia_Man_t *p, Gia_Obj_t *pNode)
 
int Gia_ManHasDangling (Gia_Man_t *p)
 
int Gia_ManMarkDangling (Gia_Man_t *p)
 
Vec_Int_tGia_ManGetDangling (Gia_Man_t *p)
 
void Gia_ObjPrint (Gia_Man_t *p, Gia_Obj_t *pObj)
 
void Gia_ManPrint (Gia_Man_t *p)
 
void Gia_ManPrintCo_rec (Gia_Man_t *p, Gia_Obj_t *pObj)
 
void Gia_ManPrintCo (Gia_Man_t *p, Gia_Obj_t *pObj)
 
void Gia_ManPrintCollect_rec (Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vNodes)
 
void Gia_ManPrintCone (Gia_Man_t *p, Gia_Obj_t *pObj, int *pLeaves, int nLeaves, Vec_Int_t *vNodes)
 
void Gia_ManPrintCollect2_rec (Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vNodes)
 
void Gia_ManPrintCone2 (Gia_Man_t *p, Gia_Obj_t *pObj)
 
void Gia_ManInvertConstraints (Gia_Man_t *pAig)
 
void Gia_ManInvertPos (Gia_Man_t *pAig)
 
void Gia_ManCollectObjs_rec (Gia_Man_t *p, int iObjId, Vec_Int_t *vObjs, int Limit)
 
unsigned * Gia_ManComputePoTruthTables (Gia_Man_t *p, int nBytesMax)
 
int Gia_ManCompare (Gia_Man_t *p1, Gia_Man_t *p2)
 
void Gia_ManMarkFanoutDrivers (Gia_Man_t *p)
 
void Gia_ManSwapPos (Gia_Man_t *p, int i)
 
Vec_Int_tGia_ManSaveValue (Gia_Man_t *p)
 
void Gia_ManLoadValue (Gia_Man_t *p, Vec_Int_t *vValues)
 
Vec_Int_tGia_ManFirstFanouts (Gia_Man_t *p)
 
int Gia_ManHasChoices_very_old (Gia_Man_t *p)
 
Vec_Int_tGia_ManGroupProve (Gia_Man_t *pInit, char *pCommLine, int nGroupSize, int fVerbose)
 
Vec_Int_tGia_ManPoXSim (Gia_Man_t *p, int nFrames, int fVerbose)
 

Macro Definition Documentation

#define NUMBER1   3716960521u

DECLARATIONS ///.

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

FileName [giaUtil.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Scalable AIG package.]

Synopsis [Various utilities.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id:
giaUtil.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

]

Definition at line 31 of file giaUtil.c.

#define NUMBER2   2174103536u

Definition at line 32 of file giaUtil.c.

Function Documentation

char* Gia_FileNameGenericAppend ( char *  pBase,
char *  pSuffix 
)

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

Synopsis [Returns the composite name of the file.]

Description []

SideEffects []

SeeAlso []

Definition at line 125 of file giaUtil.c.

126 {
127  static char Buffer[1000];
128  char * pDot;
129  strcpy( Buffer, pBase );
130  if ( (pDot = strrchr( Buffer, '.' )) )
131  *pDot = 0;
132  strcat( Buffer, pSuffix );
133  if ( (pDot = strrchr( Buffer, '\\' )) || (pDot = strrchr( Buffer, '/' )) )
134  return pDot+1;
135  return Buffer;
136 }
char * strcpy()
char * strcat()
char * strrchr()
int Gia_ManCheckCoPhase ( Gia_Man_t p)

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

Synopsis [Returns the number of COs whose value is 1.]

Description []

SideEffects []

SeeAlso []

Definition at line 450 of file giaUtil.c.

451 {
452  Gia_Obj_t * pObj;
453  int i, Counter = 0;
454  Gia_ManForEachCo( p, pObj, i )
455  Counter += pObj->fPhase;
456  return Counter;
457 }
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
Definition: gia.h:75
static int Counter
void Gia_ManCheckMark0 ( Gia_Man_t p)

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

Synopsis [Sets phases of the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 234 of file giaUtil.c.

235 {
236  Gia_Obj_t * pObj;
237  int i;
238  Gia_ManForEachObj( p, pObj, i )
239  assert( pObj->fMark0 == 0 );
240 }
Definition: gia.h:75
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
#define assert(ex)
Definition: util_old.h:213
void Gia_ManCheckMark1 ( Gia_Man_t p)

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

Synopsis [Sets phases of the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 291 of file giaUtil.c.

292 {
293  Gia_Obj_t * pObj;
294  int i;
295  Gia_ManForEachObj( p, pObj, i )
296  assert( pObj->fMark1 == 0 );
297 }
Definition: gia.h:75
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
#define assert(ex)
Definition: util_old.h:213
void Gia_ManCleanLevels ( Gia_Man_t p,
int  Size 
)

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

Synopsis [Prepares copies for the model.]

Description []

SideEffects []

SeeAlso []

Definition at line 470 of file giaUtil.c.

471 {
472  if ( p->vLevels == NULL )
473  p->vLevels = Vec_IntAlloc( Size );
474  Vec_IntFill( p->vLevels, Size, 0 );
475 }
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
Vec_Int_t * vLevels
Definition: gia.h:115
void Gia_ManCleanMark0 ( Gia_Man_t p)

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

Synopsis [Sets phases of the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 215 of file giaUtil.c.

216 {
217  Gia_Obj_t * pObj;
218  int i;
219  Gia_ManForEachObj( p, pObj, i )
220  pObj->fMark0 = 0;
221 }
Definition: gia.h:75
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
void Gia_ManCleanMark01 ( Gia_Man_t p)

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

Synopsis [Sets phases of the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 177 of file giaUtil.c.

178 {
179  Gia_Obj_t * pObj;
180  int i;
181  Gia_ManForEachObj( p, pObj, i )
182  pObj->fMark0 = pObj->fMark1 = 0;
183 }
Definition: gia.h:75
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
void Gia_ManCleanMark1 ( Gia_Man_t p)

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

Synopsis [Sets phases of the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 272 of file giaUtil.c.

273 {
274  Gia_Obj_t * pObj;
275  int i;
276  Gia_ManForEachObj( p, pObj, i )
277  pObj->fMark1 = 0;
278 }
Definition: gia.h:75
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
void Gia_ManCleanPhase ( Gia_Man_t p)

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

Synopsis [Sets phases of the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 431 of file giaUtil.c.

432 {
433  Gia_Obj_t * pObj;
434  int i;
435  Gia_ManForEachObj( p, pObj, i )
436  pObj->fPhase = 0;
437 }
Definition: gia.h:75
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
void Gia_ManCleanTruth ( Gia_Man_t p)

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

Synopsis [Prepares copies for the model.]

Description []

SideEffects []

SeeAlso []

Definition at line 487 of file giaUtil.c.

488 {
489  if ( p->vTruths == NULL )
491  Vec_IntFill( p->vTruths, Gia_ManObjNum(p), -1 );
492 }
Vec_Int_t * vTruths
Definition: gia.h:139
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManCleanValue ( Gia_Man_t p)

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

Synopsis [Cleans the value.]

Description []

SideEffects []

SeeAlso []

Definition at line 310 of file giaUtil.c.

311 {
312  int i;
313  for ( i = 0; i < p->nObjs; i++ )
314  p->pObjs[i].Value = 0;
315 }
Gia_Obj_t * pObjs
Definition: gia.h:103
int nObjs
Definition: gia.h:101
unsigned Value
Definition: gia.h:87
void Gia_ManCollectObjs_rec ( Gia_Man_t p,
int  iObjId,
Vec_Int_t vObjs,
int  Limit 
)

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

Synopsis [Testing the speedup due to grouping POs into batches.]

Description []

SideEffects []

SeeAlso []

Definition at line 1444 of file giaUtil.c.

1445 {
1446  Gia_Obj_t * pObj;
1447  if ( Vec_IntSize(vObjs) == Limit )
1448  return;
1449  if ( Gia_ObjIsTravIdCurrentId(p, iObjId) )
1450  return;
1451  Gia_ObjSetTravIdCurrentId(p, iObjId);
1452  pObj = Gia_ManObj( p, iObjId );
1453  if ( Gia_ObjIsAnd(pObj) )
1454  {
1455  Gia_ManCollectObjs_rec( p, Gia_ObjFaninId0p(p, pObj), vObjs, Limit );
1456  if ( Vec_IntSize(vObjs) == Limit )
1457  return;
1458  Gia_ManCollectObjs_rec( p, Gia_ObjFaninId1p(p, pObj), vObjs, Limit );
1459  if ( Vec_IntSize(vObjs) == Limit )
1460  return;
1461  }
1462  Vec_IntPush( vObjs, iObjId );
1463 }
static int Gia_ObjFaninId1p(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:464
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjIsTravIdCurrentId(Gia_Man_t *p, int Id)
Definition: gia.h:536
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static int Gia_ObjFaninId0p(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:463
void Gia_ManCollectObjs_rec(Gia_Man_t *p, int iObjId, Vec_Int_t *vObjs, int Limit)
Definition: giaUtil.c:1444
static void Gia_ObjSetTravIdCurrentId(Gia_Man_t *p, int Id)
Definition: gia.h:535
Vec_Int_t* Gia_ManCollectPoIds ( Gia_Man_t p)

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

Synopsis [Collects PO Ids into one array.]

Description []

SideEffects []

SeeAlso []

Definition at line 863 of file giaUtil.c.

864 {
865  Vec_Int_t * vStart;
866  int Entry, i;
867  vStart = Vec_IntAlloc( Gia_ManPoNum(p) );
868  Vec_IntForEachEntryStop( p->vCos, Entry, i, Gia_ManPoNum(p) )
869  Vec_IntPush( vStart, Entry );
870  return vStart;
871 }
#define Vec_IntForEachEntryStop(vVec, Entry, i, Stop)
Definition: vecInt.h:58
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Vec_Int_t * vCos
Definition: gia.h:109
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
int Gia_ManCompare ( Gia_Man_t p1,
Gia_Man_t p2 
)

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

Synopsis [Returns 1 if the manager are structural identical.]

Description []

SideEffects []

SeeAlso []

Definition at line 1511 of file giaUtil.c.

1512 {
1513  Gia_Obj_t * pObj1, * pObj2;
1514  int i;
1515  if ( Gia_ManObjNum(p1) != Gia_ManObjNum(p2) )
1516  {
1517  printf( "AIGs have different number of objects.\n" );
1518  return 0;
1519  }
1520  Gia_ManCleanValue( p1 );
1521  Gia_ManCleanValue( p2 );
1522  Gia_ManForEachObj( p1, pObj1, i )
1523  {
1524  pObj2 = Gia_ManObj( p2, i );
1525  if ( memcmp( pObj1, pObj2, sizeof(Gia_Obj_t) ) )
1526  {
1527  printf( "Objects %d are different.\n", i );
1528  return 0;
1529  }
1530  if ( p1->pReprs && p2->pReprs )
1531  {
1532  if ( memcmp( &p1->pReprs[i], &p2->pReprs[i], sizeof(Gia_Rpr_t) ) )
1533  {
1534  printf( "Representatives of objects %d are different.\n", i );
1535  return 0;
1536  }
1537  }
1538  }
1539  return 1;
1540 }
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
void Gia_ManCleanValue(Gia_Man_t *p)
Definition: giaUtil.c:310
int memcmp()
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
Gia_Rpr_t * pReprs
Definition: gia.h:121
Definition: gia.h:56
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
unsigned* Gia_ManComputePoTruthTables ( Gia_Man_t p,
int  nBytesMax 
)

Definition at line 1464 of file giaUtil.c.

1465 {
1466  int nVars = Gia_ManPiNum(p);
1467  int nTruthWords = Abc_TruthWordNum( nVars );
1468  int nTruths = nBytesMax / (sizeof(unsigned) * nTruthWords);
1469  int nTotalNodes = 0, nRounds = 0;
1470  Vec_Int_t * vObjs;
1471  Gia_Obj_t * pObj;
1472  abctime clk = Abc_Clock();
1473  int i;
1474  printf( "Var = %d. Words = %d. Truths = %d.\n", nVars, nTruthWords, nTruths );
1475  vObjs = Vec_IntAlloc( nTruths );
1477  Gia_ManForEachPo( p, pObj, i )
1478  {
1479  Gia_ManCollectObjs_rec( p, Gia_ObjFaninId0p(p, pObj), vObjs, nTruths );
1480  if ( Vec_IntSize(vObjs) == nTruths )
1481  {
1482  nRounds++;
1483 // printf( "%d ", i );
1484  nTotalNodes += Vec_IntSize( vObjs );
1485  Vec_IntClear( vObjs );
1487  }
1488  }
1489 // printf( "\n" );
1490  nTotalNodes += Vec_IntSize( vObjs );
1491  Vec_IntFree( vObjs );
1492 
1493  printf( "Rounds = %d. Objects = %d. Total = %d. ", nRounds, Gia_ManObjNum(p), nTotalNodes );
1494  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
1495 
1496  return NULL;
1497 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Abc_TruthWordNum(int nVars)
Definition: abc_global.h:256
static abctime Abc_Clock()
Definition: abc_global.h:279
Definition: gia.h:75
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Gia_ObjFaninId0p(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:463
void Gia_ManCollectObjs_rec(Gia_Man_t *p, int iObjId, Vec_Int_t *vObjs, int Limit)
Definition: giaUtil.c:1444
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
ABC_INT64_T abctime
Definition: abc_global.h:278
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
Vec_Int_t* Gia_ManComputeSlacks ( Gia_Man_t p)

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

Synopsis [Compute slacks measured using the number of AIG levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 663 of file giaUtil.c.

664 {
665  Gia_Obj_t * pObj;
666  int i, nLevels = Gia_ManLevelNum( p );
667  Vec_Int_t * vLevelR = Gia_ManReverseLevel( p );
668  Vec_Int_t * vSlacks = Vec_IntAlloc( Gia_ManObjNum(p) );
669  Gia_ManForEachObj( p, pObj, i )
670  Vec_IntPush( vSlacks, nLevels - Gia_ObjLevelId(p, i) - Vec_IntEntry(vLevelR, i) );
671  assert( Vec_IntSize(vSlacks) == Gia_ManObjNum(p) );
672  Vec_IntFree( vLevelR );
673  return vSlacks;
674 }
static int Gia_ObjLevelId(Gia_Man_t *p, int Id)
Definition: gia.h:500
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Vec_Int_t * Gia_ManReverseLevel(Gia_Man_t *p)
Definition: giaUtil.c:595
int Gia_ManLevelNum(Gia_Man_t *p)
Definition: giaUtil.c:505
Definition: gia.h:75
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
int* Gia_ManCreateMuxRefs ( Gia_Man_t p)

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

Synopsis [Assigns references.]

Description []

SideEffects []

SeeAlso []

Definition at line 746 of file giaUtil.c.

747 {
748  Gia_Obj_t * pObj, * pCtrl, * pFan0, * pFan1;
749  int i, * pMuxRefs;
750  pMuxRefs = ABC_CALLOC( int, Gia_ManObjNum(p) );
751  Gia_ManForEachObj( p, pObj, i )
752  {
753  if ( Gia_ObjRecognizeExor( pObj, &pFan0, &pFan1 ) )
754  continue;
755  if ( !Gia_ObjIsMuxType(pObj) )
756  continue;
757  pCtrl = Gia_ObjRecognizeMux( pObj, &pFan0, &pFan1 );
758  pMuxRefs[ Gia_ObjId(p, Gia_Regular(pCtrl)) ]++;
759  }
760  return pMuxRefs;
761 }
static Gia_Obj_t * Gia_Regular(Gia_Obj_t *p)
Definition: gia.h:377
int Gia_ObjIsMuxType(Gia_Obj_t *pNode)
Definition: giaUtil.c:885
int Gia_ObjRecognizeExor(Gia_Obj_t *pObj, Gia_Obj_t **ppFan0, Gia_Obj_t **ppFan1)
Definition: giaUtil.c:921
Definition: gia.h:75
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
Gia_Obj_t * Gia_ObjRecognizeMux(Gia_Obj_t *pNode, Gia_Obj_t **ppNodeT, Gia_Obj_t **ppNodeE)
Definition: giaUtil.c:959
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManCreateRefs ( Gia_Man_t p)

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

Synopsis [Assigns references.]

Description []

SideEffects []

SeeAlso []

Definition at line 715 of file giaUtil.c.

716 {
717  Gia_Obj_t * pObj;
718  int i;
719  assert( p->pRefs == NULL );
720  p->pRefs = ABC_CALLOC( int, Gia_ManObjNum(p) );
721  Gia_ManForEachObj( p, pObj, i )
722  {
723  if ( Gia_ObjIsAnd(pObj) )
724  {
725  Gia_ObjRefFanin0Inc( p, pObj );
726  Gia_ObjRefFanin1Inc( p, pObj );
727  if ( Gia_ObjIsMuxId(p, i) )
728  Gia_ObjRefFanin2Inc( p, pObj );
729  }
730  else if ( Gia_ObjIsCo(pObj) )
731  Gia_ObjRefFanin0Inc( p, pObj );
732  }
733 }
static void Gia_ObjRefFanin2Inc(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:526
static void Gia_ObjRefFanin0Inc(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:524
static void Gia_ObjRefFanin1Inc(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:525
int * pRefs
Definition: gia.h:114
Definition: gia.h:75
static int Gia_ObjIsMuxId(Gia_Man_t *p, int iObj)
Definition: gia.h:424
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define assert(ex)
Definition: util_old.h:213
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManCreateValueRefs ( Gia_Man_t p)

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

Synopsis [Assigns levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 687 of file giaUtil.c.

688 {
689  Gia_Obj_t * pObj;
690  int i;
691  Gia_ManForEachObj( p, pObj, i )
692  {
693  pObj->Value = 0;
694  if ( Gia_ObjIsAnd(pObj) )
695  {
696  Gia_ObjFanin0(pObj)->Value++;
697  Gia_ObjFanin1(pObj)->Value++;
698  }
699  else if ( Gia_ObjIsCo(pObj) )
700  Gia_ObjFanin0(pObj)->Value++;
701  }
702 }
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
unsigned Value
Definition: gia.h:87
int Gia_ManCrossCut ( Gia_Man_t p,
int  fReverse 
)

Definition at line 820 of file giaUtil.c.

821 {
822  Vec_Int_t * vNodes;
823  Gia_Obj_t * pObj;
824  int i, nCutCur = 0, nCutMax = 0;
825  vNodes = Gia_ManDfsForCrossCut( p, fReverse );
826  Gia_ManForEachObjVec( vNodes, p, pObj, i )
827  {
828  if ( pObj->Value )
829  nCutCur++;
830  if ( nCutMax < nCutCur )
831  nCutMax = nCutCur;
832  if ( Gia_ObjIsAnd(pObj) )
833  {
834  if ( --Gia_ObjFanin0(pObj)->Value == 0 )
835  nCutCur--;
836  if ( --Gia_ObjFanin1(pObj)->Value == 0 )
837  nCutCur--;
838  }
839  else if ( Gia_ObjIsCo(pObj) )
840  {
841  if ( --Gia_ObjFanin0(pObj)->Value == 0 )
842  nCutCur--;
843  }
844  }
845  Vec_IntFree( vNodes );
846  Gia_ManForEachObj( p, pObj, i )
847  assert( pObj->Value == 0 );
848  return nCutMax;
849 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
Vec_Int_t * Gia_ManDfsForCrossCut(Gia_Man_t *p, int fReverse)
Definition: giaUtil.c:798
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition: gia.h:988
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Vec_Int_t* Gia_ManDfsForCrossCut ( Gia_Man_t p,
int  fReverse 
)

Definition at line 798 of file giaUtil.c.

799 {
800  Vec_Int_t * vNodes;
801  Gia_Obj_t * pObj;
802  int i;
803  Gia_ManCleanValue( p );
804  vNodes = Vec_IntAlloc( Gia_ManObjNum(p) );
806  if ( fReverse )
807  {
808  Gia_ManForEachCoReverse( p, pObj, i )
809  if ( !Gia_ObjIsConst0(Gia_ObjFanin0(pObj)) )
810  Gia_ManDfsForCrossCut_rec( p, pObj, vNodes );
811  }
812  else
813  {
814  Gia_ManForEachCo( p, pObj, i )
815  if ( !Gia_ObjIsConst0(Gia_ObjFanin0(pObj)) )
816  Gia_ManDfsForCrossCut_rec( p, pObj, vNodes );
817  }
818  return vNodes;
819 }
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Gia_ObjIsConst0(Gia_Obj_t *pObj)
Definition: gia.h:430
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
void Gia_ManCleanValue(Gia_Man_t *p)
Definition: giaUtil.c:310
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
#define Gia_ManForEachCoReverse(p, pObj, i)
Definition: gia.h:1028
void Gia_ManDfsForCrossCut_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vNodes)
Definition: giaUtil.c:774
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManDfsForCrossCut_rec ( Gia_Man_t p,
Gia_Obj_t pObj,
Vec_Int_t vNodes 
)

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

Synopsis [Computes the maximum frontier size.]

Description []

SideEffects []

SeeAlso []

Definition at line 774 of file giaUtil.c.

775 {
776  if ( Gia_ObjIsTravIdCurrent(p, pObj) )
777  return;
778  Gia_ObjSetTravIdCurrent(p, pObj);
779  if ( Gia_ObjIsCi(pObj) )
780  {
781  Vec_IntPush( vNodes, Gia_ObjId(p, pObj) );
782  return;
783  }
784  if ( Gia_ObjIsCo(pObj) )
785  {
786  Gia_ObjFanin0(pObj)->Value++;
787  Gia_ManDfsForCrossCut_rec( p, Gia_ObjFanin0(pObj), vNodes );
788  Vec_IntPush( vNodes, Gia_ObjId(p, pObj) );
789  return;
790  }
791  assert( Gia_ObjIsAnd(pObj) );
792  Gia_ObjFanin0(pObj)->Value++;
793  Gia_ObjFanin1(pObj)->Value++;
794  Gia_ManDfsForCrossCut_rec( p, Gia_ObjFanin0(pObj), vNodes );
795  Gia_ManDfsForCrossCut_rec( p, Gia_ObjFanin1(pObj), vNodes );
796  Vec_IntPush( vNodes, Gia_ObjId(p, pObj) );
797 }
static int Gia_ObjIsTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:533
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
void Gia_ManDfsForCrossCut_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vNodes)
Definition: giaUtil.c:774
void Gia_ManFillValue ( Gia_Man_t p)

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

Synopsis [Cleans the value.]

Description []

SideEffects []

SeeAlso []

Definition at line 328 of file giaUtil.c.

329 {
330  int i;
331  for ( i = 0; i < p->nObjs; i++ )
332  p->pObjs[i].Value = ~0;
333 }
Gia_Obj_t * pObjs
Definition: gia.h:103
int nObjs
Definition: gia.h:101
unsigned Value
Definition: gia.h:87
Vec_Int_t* Gia_ManFirstFanouts ( Gia_Man_t p)

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

Synopsis [Returns the array containing the first fanout of each object.]

Description []

SideEffects []

SeeAlso []

Definition at line 1635 of file giaUtil.c.

1636 {
1637  Vec_Int_t * vFans = Vec_IntStart( Gia_ManObjNum(p) );
1638  Gia_Obj_t * pObj;
1639  int i;
1640  Gia_ManForEachObj( p, pObj, i )
1641  {
1642  if ( Gia_ObjIsAnd(pObj) )
1643  {
1644  if ( Vec_IntEntry(vFans, Gia_ObjFaninId0p(p, pObj)) == 0 )
1645  Vec_IntWriteEntry(vFans, Gia_ObjFaninId0p(p, pObj), i);
1646  if ( Vec_IntEntry(vFans, Gia_ObjFaninId1p(p, pObj)) == 0 )
1647  Vec_IntWriteEntry(vFans, Gia_ObjFaninId1p(p, pObj), i);
1648  if ( Gia_ObjIsMuxId(p, i) && Vec_IntEntry(vFans, Gia_ObjFaninId2p(p, pObj)) == 0 )
1649  Vec_IntWriteEntry(vFans, Gia_ObjFaninId2p(p, pObj), i);
1650  }
1651  else if ( Gia_ObjIsCo(pObj) )
1652  {
1653  if ( Vec_IntEntry(vFans, Gia_ObjFaninId0p(p, pObj)) == 0 )
1654  Vec_IntWriteEntry(vFans, Gia_ObjFaninId0p(p, pObj), i);
1655  }
1656  }
1657  return vFans;
1658 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Gia_ObjFaninId1p(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:464
Definition: gia.h:75
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
static int Gia_ObjIsMuxId(Gia_Man_t *p, int iObj)
Definition: gia.h:424
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
static int Gia_ObjFaninId0p(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:463
static int Gia_ObjFaninId2p(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:465
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
Vec_Int_t* Gia_ManGetCiLevels ( Gia_Man_t p)

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

Synopsis [Assigns levels using CI level information.]

Description []

SideEffects []

SeeAlso []

Definition at line 546 of file giaUtil.c.

547 {
548  Vec_Int_t * vCiLevels;
549  Gia_Obj_t * pObj;
550  int i;
551  if ( p->vLevels == NULL )
552  return NULL;
553  vCiLevels = Vec_IntAlloc( Gia_ManCiNum(p) );
554  Gia_ManForEachCi( p, pObj, i )
555  Vec_IntPush( vCiLevels, Gia_ObjLevel(p, pObj) );
556  return vCiLevels;
557 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
static int Gia_ObjLevel(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:501
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
Vec_Int_t * vLevels
Definition: gia.h:115
Vec_Int_t* Gia_ManGetDangling ( Gia_Man_t p)

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

Synopsis [Returns 1 if AIG has dangling nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1224 of file giaUtil.c.

1225 {
1226  Vec_Int_t * vDangles;
1227  Gia_Obj_t * pObj;
1228  int i;
1229  Gia_ManForEachObj( p, pObj, i )
1230  {
1231  pObj->fMark0 = 0;
1232  if ( Gia_ObjIsAnd(pObj) )
1233  {
1234  Gia_ObjFanin0(pObj)->fMark0 = 1;
1235  Gia_ObjFanin1(pObj)->fMark0 = 1;
1236  }
1237  else if ( Gia_ObjIsCo(pObj) )
1238  Gia_ObjFanin0(pObj)->fMark0 = 1;
1239  }
1240  vDangles = Vec_IntAlloc( 100 );
1241  Gia_ManForEachAnd( p, pObj, i )
1242  if ( !pObj->fMark0 )
1243  Vec_IntPush( vDangles, i );
1244  Gia_ManCleanMark0( p );
1245  return vDangles;
1246 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
if(last==0)
Definition: sparse_int.h:34
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
unsigned fMark0
Definition: gia.h:79
void Gia_ManCleanMark0(Gia_Man_t *p)
Definition: giaUtil.c:215
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
Vec_Int_t* Gia_ManGroupProve ( Gia_Man_t pInit,
char *  pCommLine,
int  nGroupSize,
int  fVerbose 
)

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

Synopsis [Proving multi-output properties.]

Description []

SideEffects []

SeeAlso []

Definition at line 1763 of file giaUtil.c.

1764 {
1766  Gia_Man_t * p = Gia_ManDup( pInit );
1767  Gia_Man_t * pGroup;
1768  Vec_Int_t * vOuts;
1769  Vec_Int_t * vOutMap;
1770  Vec_Ptr_t * vCexes;
1771  int i, k, nGroupCur, nGroups;
1772  abctime clk, timeComm = 0;
1773  abctime timeStart = Abc_Clock();
1774  // pre-conditions
1775  assert( nGroupSize > 0 );
1776  assert( pCommLine != NULL );
1777  assert( p->nConstrs == 0 );
1778  Abc_Print( 1, "RUNNING MultiProve: Group size = %d. Command line = \"%s\".\n", nGroupSize, pCommLine );
1779  // create output map
1780  vOuts = Vec_IntStartNatural( Gia_ManPoNum(p) );
1781  vOutMap = Vec_IntAlloc( Gia_ManPoNum(p) );
1782  vCexes = Vec_PtrAlloc( Gia_ManPoNum(p) );
1783  nGroups = Gia_ManPoNum(p) / nGroupSize + (int)((Gia_ManPoNum(p) % nGroupSize) > 0);
1784  for ( i = 0; i < nGroups; i++ )
1785  {
1786  // derive the group
1787  nGroupCur = ((i + 1) * nGroupSize < Gia_ManPoNum(p)) ? nGroupSize : Gia_ManPoNum(p) - i * nGroupSize;
1788  pGroup = Gia_ManDupCones( p, Vec_IntArray(vOuts) + i * nGroupSize, nGroupCur, 0 );
1789  Abc_Print( 1, "GROUP %4d : %4d <= PoId < %4d : ", i, i * nGroupSize, i * nGroupSize + nGroupCur );
1790  // set the current GIA
1791  Abc_FrameUpdateGia( pAbc, pGroup );
1792  // solve the group
1793  clk = Abc_Clock();
1794  Cmd_CommandExecute( pAbc, pCommLine );
1795  timeComm += Abc_Clock() - clk;
1796  // get the solution status
1797  if ( nGroupSize == 1 )
1798  {
1799  Vec_IntPush( vOutMap, Abc_FrameReadProbStatus(pAbc) );
1800  Vec_PtrPush( vCexes, Abc_FrameReadCex(pAbc) );
1801  }
1802  else // if ( nGroupSize > 1 )
1803  {
1804  Vec_Int_t * vStatusCur = Abc_FrameReadPoStatuses( pAbc );
1805  Vec_Ptr_t * vCexesCur = Abc_FrameReadCexVec( pAbc );
1806  assert( vStatusCur != NULL ); // only works for "bmc3" and "pdr"
1807 // assert( vCexesCur != NULL );
1808  for ( k = 0; k < nGroupCur; k++ )
1809  {
1810  Vec_IntPush( vOutMap, Vec_IntEntry(vStatusCur, k) );
1811  Vec_PtrPush( vCexes, vCexesCur ? Vec_PtrEntry(vCexesCur, k) : NULL );
1812  }
1813  }
1814  }
1815  assert( Vec_PtrSize(vCexes) == Gia_ManPoNum(p) );
1816  assert( Vec_IntSize(vOutMap) == Gia_ManPoNum(p) );
1817  // set CEXes
1818  if ( Vec_PtrCountZero(vCexes) < Vec_PtrSize(vCexes) )
1819  Abc_FrameReplaceCexVec( pAbc, &vCexes );
1820  else // there is no CEXes
1821  Vec_PtrFree( vCexes );
1822  // report the result
1823  Abc_Print( 1, "SUMMARY: " );
1824  Abc_Print( 1, "Properties = %6d. ", Gia_ManPoNum(p) );
1825  Abc_Print( 1, "UNSAT = %6d. ", Vec_IntCountEntry(vOutMap, 1) );
1826  Abc_Print( 1, "SAT = %6d. ", Vec_IntCountEntry(vOutMap, 0) );
1827  Abc_Print( 1, "UNDEC = %6d. ", Vec_IntCountEntry(vOutMap, -1) );
1828  Abc_Print( 1, "\n" );
1829  Abc_PrintTime( 1, "Command time", timeComm );
1830  Abc_PrintTime( 1, "Total time ", Abc_Clock() - timeStart );
1831  // cleanup
1832  Vec_IntFree( vOuts );
1833  Gia_ManStop( p );
1834  return vOutMap;
1835 }
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
void Abc_FrameReplaceCexVec(Abc_Frame_t *pAbc, Vec_Ptr_t **pvCexVec)
Definition: abc.c:515
Gia_Man_t * Gia_ManDupCones(Gia_Man_t *p, int *pPos, int nPos, int fTrimPis)
Definition: giaDup.c:2691
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
ABC_DLL Vec_Int_t * Abc_FrameReadPoStatuses(Abc_Frame_t *p)
Definition: mainFrame.c:72
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition: giaDup.c:552
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
void * Abc_FrameReadCex(void *pAbc)
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
static int Vec_IntCountEntry(Vec_Int_t *p, int Entry)
Definition: vecInt.h:1156
int Cmd_CommandExecute(void *pAbc, char *pCommandLine)
ABC_DLL Vec_Ptr_t * Abc_FrameReadCexVec(Abc_Frame_t *p)
Definition: mainFrame.c:69
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static Vec_Int_t * Vec_IntStartNatural(int nSize)
Definition: bblif.c:192
int Abc_FrameReadProbStatus(void *pAbc)
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
typedefABC_NAMESPACE_HEADER_START struct Abc_Frame_t_ Abc_Frame_t
INCLUDES ///.
int nConstrs
Definition: gia.h:117
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static int Vec_PtrCountZero(Vec_Ptr_t *p)
Definition: vecPtr.h:343
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
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
Definition: gia.h:95
ABC_DLL Abc_Frame_t * Abc_FrameReadGlobalFrame()
Definition: mainFrame.c:616
void Abc_FrameUpdateGia(Abc_Frame_t *pAbc, Gia_Man_t *pNew)
Definition: abc.c:616
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
ABC_INT64_T abctime
Definition: abc_global.h:278
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
int Gia_ManHasChoices_very_old ( Gia_Man_t p)

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

Synopsis [Returns 1 if AIG has choices.]

Description []

SideEffects []

SeeAlso []

Definition at line 1671 of file giaUtil.c.

1672 {
1673  Gia_Obj_t * pObj;
1674  int i, Counter1 = 0, Counter2 = 0;
1675  int nFailNoRepr = 0;
1676  int nFailHaveRepr = 0;
1677  int nChoiceNodes = 0;
1678  int nChoices = 0;
1679  if ( p->pReprs == NULL || p->pNexts == NULL )
1680  return 0;
1681  // check if there are any representatives
1682  Gia_ManForEachObj( p, pObj, i )
1683  {
1684  if ( Gia_ObjReprObj( p, Gia_ObjId(p, pObj) ) )
1685  {
1686 // printf( "%d ", i );
1687  Counter1++;
1688  }
1689 // if ( Gia_ObjNext( p, Gia_ObjId(p, pObj) ) )
1690 // Counter2++;
1691  }
1692 // printf( "\n" );
1693  Gia_ManForEachObj( p, pObj, i )
1694  {
1695 // if ( Gia_ObjReprObj( p, Gia_ObjId(p, pObj) ) )
1696 // Counter1++;
1697  if ( Gia_ObjNext( p, Gia_ObjId(p, pObj) ) )
1698  {
1699 // printf( "%d ", i );
1700  Counter2++;
1701  }
1702  }
1703 // printf( "\n" );
1704  if ( Counter1 == 0 )
1705  {
1706  printf( "Warning: AIG has repr data-strucure but not reprs.\n" );
1707  return 0;
1708  }
1709  printf( "%d nodes have reprs.\n", Counter1 );
1710  printf( "%d nodes have nexts.\n", Counter2 );
1711  // check if there are any internal nodes without fanout
1712  // make sure all nodes without fanout have representatives
1713  // make sure all nodes with fanout have no representatives
1714  ABC_FREE( p->pRefs );
1715  Gia_ManCreateRefs( p );
1716  Gia_ManForEachAnd( p, pObj, i )
1717  {
1718  if ( Gia_ObjRefNum(p, pObj) == 0 )
1719  {
1720  if ( Gia_ObjReprObj( p, Gia_ObjId(p, pObj) ) == NULL )
1721  nFailNoRepr++;
1722  else
1723  nChoices++;
1724  }
1725  else
1726  {
1727  if ( Gia_ObjReprObj( p, Gia_ObjId(p, pObj) ) != NULL )
1728  nFailHaveRepr++;
1729  if ( Gia_ObjNextObj( p, Gia_ObjId(p, pObj) ) != NULL )
1730  nChoiceNodes++;
1731  }
1732  if ( Gia_ObjReprObj( p, i ) )
1733  assert( Gia_ObjRepr(p, i) < i );
1734  }
1735  if ( nChoices == 0 )
1736  return 0;
1737  if ( nFailNoRepr )
1738  {
1739  printf( "Gia_ManHasChoices_very_old(): Error: %d internal nodes have no fanout and no repr.\n", nFailNoRepr );
1740 // return 0;
1741  }
1742  if ( nFailHaveRepr )
1743  {
1744  printf( "Gia_ManHasChoices_very_old(): Error: %d internal nodes have both fanout and repr.\n", nFailHaveRepr );
1745 // return 0;
1746  }
1747 // printf( "Gia_ManHasChoices_very_old(): AIG has %d choice nodes with %d choices.\n", nChoiceNodes, nChoices );
1748  return 1;
1749 }
void Gia_ManCreateRefs(Gia_Man_t *p)
Definition: giaUtil.c:715
int * pNexts
Definition: gia.h:122
static int Gia_ObjRefNum(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:521
int * pRefs
Definition: gia.h:114
Definition: gia.h:75
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static Gia_Obj_t * Gia_ObjNextObj(Gia_Man_t *p, int Id)
Definition: gia.h:911
static int Gia_ObjNext(Gia_Man_t *p, int Id)
Definition: gia.h:912
static Gia_Obj_t * Gia_ObjReprObj(Gia_Man_t *p, int Id)
Definition: gia.h:886
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
Gia_Rpr_t * pReprs
Definition: gia.h:121
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjRepr(Gia_Man_t *p, int Id)
Definition: gia.h:887
int Gia_ManHasDangling ( Gia_Man_t p)

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

Synopsis [Returns 1 if AIG has dangling nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1155 of file giaUtil.c.

1156 {
1157  Gia_Obj_t * pObj;
1158  int i, Counter = 0;
1159  Gia_ManForEachObj( p, pObj, i )
1160  {
1161  pObj->fMark0 = 0;
1162  if ( Gia_ObjIsCo(pObj) )
1163  Gia_ObjFanin0(pObj)->fMark0 = 1;
1164  else if ( Gia_ObjIsMux(p, pObj) )
1165  {
1166  Gia_ObjFanin0(pObj)->fMark0 = 1;
1167  Gia_ObjFanin1(pObj)->fMark0 = 1;
1168  Gia_ObjFanin2(p, pObj)->fMark0 = 1;
1169  }
1170  else if ( Gia_ObjIsAnd(pObj) )
1171  {
1172  Gia_ObjFanin0(pObj)->fMark0 = 1;
1173  Gia_ObjFanin1(pObj)->fMark0 = 1;
1174  }
1175  }
1176  Gia_ManForEachAnd( p, pObj, i )
1177  Counter += !pObj->fMark0;
1178  Gia_ManCleanMark0( p );
1179  return Counter;
1180 }
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
static int Counter
static Gia_Obj_t * Gia_ObjFanin2(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:456
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
unsigned fMark0
Definition: gia.h:79
void Gia_ManCleanMark0(Gia_Man_t *p)
Definition: giaUtil.c:215
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
static int Gia_ObjIsMux(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:425
void Gia_ManIncrementTravId ( Gia_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 149 of file giaUtil.c.

150 {
151  if ( p->pTravIds == NULL )
152  {
153  p->nTravIdsAlloc = Gia_ManObjNum(p) + 100;
154  p->pTravIds = ABC_CALLOC( int, p->nTravIdsAlloc );
155  p->nTravIds = 0;
156  }
157  while ( p->nTravIdsAlloc < Gia_ManObjNum(p) )
158  {
159  p->nTravIdsAlloc *= 2;
160  p->pTravIds = ABC_REALLOC( int, p->pTravIds, p->nTravIdsAlloc );
161  memset( p->pTravIds + p->nTravIdsAlloc/2, 0, sizeof(int) * p->nTravIdsAlloc/2 );
162  }
163  p->nTravIds++;
164 }
char * memset()
int * pTravIds
Definition: gia.h:153
#define ABC_REALLOC(type, obj, num)
Definition: abc_global.h:233
int nTravIds
Definition: gia.h:118
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
int nTravIdsAlloc
Definition: gia.h:154
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManInvertConstraints ( Gia_Man_t pAig)

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

Synopsis [Complements the constraint outputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 1415 of file giaUtil.c.

1416 {
1417  Gia_Obj_t * pObj;
1418  int i;
1419  if ( Gia_ManConstrNum(pAig) == 0 )
1420  return;
1421  Gia_ManForEachPo( pAig, pObj, i )
1422  if ( i >= Gia_ManPoNum(pAig) - Gia_ManConstrNum(pAig) )
1423  Gia_ObjFlipFaninC0( pObj );
1424 }
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static int Gia_ManConstrNum(Gia_Man_t *p)
Definition: gia.h:395
Definition: gia.h:75
static void Gia_ObjFlipFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:472
if(last==0)
Definition: sparse_int.h:34
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
void Gia_ManInvertPos ( Gia_Man_t pAig)

Definition at line 1425 of file giaUtil.c.

1426 {
1427  Gia_Obj_t * pObj;
1428  int i;
1429  Gia_ManForEachPo( pAig, pObj, i )
1430  Gia_ObjFlipFaninC0( pObj );
1431 }
Definition: gia.h:75
static void Gia_ObjFlipFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:472
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
float Gia_ManLevelAve ( Gia_Man_t p)

Definition at line 525 of file giaUtil.c.

526 {
527  Gia_Obj_t * pObj;
528  int i, Ave = 0;
529  assert( p->vLevels );
530  Gia_ManForEachCo( p, pObj, i )
531  Ave += Gia_ObjLevel(p, pObj);
532  return (float)Ave / Gia_ManCoNum(p);
533 }
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
Definition: gia.h:75
static int Gia_ObjLevel(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:501
#define assert(ex)
Definition: util_old.h:213
Vec_Int_t * vLevels
Definition: gia.h:115
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
int Gia_ManLevelNum ( Gia_Man_t p)

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

Synopsis [Assigns levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 505 of file giaUtil.c.

506 {
507  Gia_Obj_t * pObj;
508  int i;
510  p->nLevels = 0;
511  Gia_ManForEachObj( p, pObj, i )
512  {
513  if ( Gia_ObjIsBuf(pObj) )
514  Gia_ObjSetBufLevel( p, pObj );
515  else if ( Gia_ObjIsAnd(pObj) )
516  Gia_ObjSetGateLevel( p, pObj );
517  else if ( Gia_ObjIsCo(pObj) )
518  Gia_ObjSetCoLevel( p, pObj );
519  else
520  Gia_ObjSetLevel( p, pObj, 0 );
521  p->nLevels = Abc_MaxInt( p->nLevels, Gia_ObjLevel(p, pObj) );
522  }
523  return p->nLevels;
524 }
void Gia_ManCleanLevels(Gia_Man_t *p, int Size)
Definition: giaUtil.c:470
static void Gia_ObjSetGateLevel(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:509
static int Gia_ObjIsBuf(Gia_Obj_t *pObj)
Definition: gia.h:427
int nLevels
Definition: gia.h:116
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
Definition: gia.h:75
static void Gia_ObjSetBufLevel(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:505
static int Gia_ObjLevel(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:501
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static void Gia_ObjSetCoLevel(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:504
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static void Gia_ObjSetLevel(Gia_Man_t *p, Gia_Obj_t *pObj, int l)
Definition: gia.h:503
void Gia_ManLoadValue ( Gia_Man_t p,
Vec_Int_t vValues 
)

Definition at line 1615 of file giaUtil.c.

1616 {
1617  Gia_Obj_t * pObj;
1618  int i;
1619  Gia_ManForEachObj( p, pObj, i )
1620  pObj->Value = Vec_IntEntry(vValues, i);
1621 }
Definition: gia.h:75
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
int Gia_ManMarkDangling ( Gia_Man_t p)

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

Synopsis [Returns 1 if AIG has dangling nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1193 of file giaUtil.c.

1194 {
1195  Gia_Obj_t * pObj;
1196  int i, Counter = 0;
1197  Gia_ManForEachObj( p, pObj, i )
1198  {
1199  pObj->fMark0 = 0;
1200  if ( Gia_ObjIsAnd(pObj) )
1201  {
1202  Gia_ObjFanin0(pObj)->fMark0 = 1;
1203  Gia_ObjFanin1(pObj)->fMark0 = 1;
1204  }
1205  else if ( Gia_ObjIsCo(pObj) )
1206  Gia_ObjFanin0(pObj)->fMark0 = 1;
1207  }
1208  Gia_ManForEachAnd( p, pObj, i )
1209  Counter += !pObj->fMark0;
1210  return Counter;
1211 }
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
static int Counter
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
unsigned fMark0
Definition: gia.h:79
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
void Gia_ManMarkFanoutDrivers ( Gia_Man_t p)

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

Synopsis [Marks nodes that appear as faninis of other nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1553 of file giaUtil.c.

1554 {
1555  Gia_Obj_t * pObj;
1556  int i;
1557  Gia_ManForEachObj( p, pObj, i )
1558  {
1559  pObj->fMark0 = 0;
1560  if ( Gia_ObjIsAnd(pObj) )
1561  {
1562  Gia_ObjFanin0(pObj)->fMark0 = 1;
1563  Gia_ObjFanin1(pObj)->fMark0 = 1;
1564  }
1565  else if ( Gia_ObjIsCo(pObj) )
1566  Gia_ObjFanin0(pObj)->fMark0 = 1;
1567  }
1568 }
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
unsigned fMark0
Definition: gia.h:79
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
int Gia_ManPoMffcSize ( Gia_Man_t p)

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

Synopsis [References the node's MFFC.]

Description []

SideEffects []

SeeAlso []

Definition at line 1115 of file giaUtil.c.

1116 {
1117  Gia_ManCreateRefs( p );
1118  return Gia_NodeDeref_rec( p, Gia_ObjFanin0(Gia_ManPo(p, 0)) );
1119 }
void Gia_ManCreateRefs(Gia_Man_t *p)
Definition: giaUtil.c:715
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
int Gia_NodeDeref_rec(Gia_Man_t *p, Gia_Obj_t *pNode)
Definition: giaUtil.c:1058
Vec_Int_t* Gia_ManPoXSim ( Gia_Man_t p,
int  nFrames,
int  fVerbose 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1849 of file giaUtil.c.

1850 {
1851  Vec_Int_t * vRes;
1852  Gia_Obj_t * pObj;
1853  int f, k, nLeft = Gia_ManPoNum(p);
1854  vRes = Vec_IntAlloc( Gia_ManPoNum(p) );
1855  Vec_IntFill( vRes, Gia_ManPoNum(p), nFrames );
1857  Gia_ManForEachRi( p, pObj, k )
1858  Gia_ObjTerSimSet0( pObj );
1859  for ( f = 0; f < nFrames; f++ )
1860  {
1861  Gia_ManForEachPi( p, pObj, k )
1862  Gia_ObjTerSimSetX( pObj );
1863  Gia_ManForEachRo( p, pObj, k )
1864  Gia_ObjTerSimRo( p, pObj );
1865  Gia_ManForEachAnd( p, pObj, k )
1866  Gia_ObjTerSimAnd( pObj );
1867  Gia_ManForEachCo( p, pObj, k )
1868  Gia_ObjTerSimCo( pObj );
1869  if ( fVerbose )
1870  {
1871  Gia_ManForEachPo( p, pObj, k )
1872  Gia_ObjTerSimPrint( pObj );
1873  printf( "\n" );
1874  }
1875  Gia_ManForEachPo( p, pObj, k )
1876  if ( Vec_IntEntry(vRes, k) == nFrames && Gia_ObjTerSimGetX(pObj) )
1877  Vec_IntWriteEntry(vRes, k, f), nLeft--;
1878  if ( nLeft == 0 )
1879  break;
1880  }
1881  if ( fVerbose )
1882  {
1883  if ( nLeft == 0 )
1884  printf( "Simulation converged after %d frames.\n", f+1 );
1885  else
1886  printf( "Simulation terminated after %d frames.\n", nFrames );
1887  }
1888 // Vec_IntPrint( vRes );
1889  return vRes;
1890 }
static void Gia_ObjTerSimCo(Gia_Obj_t *pObj)
Definition: gia.h:797
static void Gia_ObjTerSimRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:808
static void Gia_ObjTerSimSet0(Gia_Obj_t *pObj)
Definition: gia.h:770
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static void Gia_ObjTerSimPrint(Gia_Obj_t *pObj)
Definition: gia.h:817
static int Gia_ObjTerSimGetX(Gia_Obj_t *pObj)
Definition: gia.h:777
for(p=first;p->value< newval;p=p->next)
Definition: gia.h:75
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 int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
if(last==0)
Definition: sparse_int.h:34
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define Gia_ManForEachRo(p, pObj, i)
Definition: gia.h:1038
#define Gia_ManForEachRi(p, pObj, i)
Definition: gia.h:1040
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
static void Gia_ObjTerSimSetX(Gia_Obj_t *pObj)
Definition: gia.h:772
static void Gia_ObjTerSimAnd(Gia_Obj_t *pObj)
Definition: gia.h:785
void Gia_ManPrint ( Gia_Man_t p)

Definition at line 1329 of file giaUtil.c.

1330 {
1331  Gia_Obj_t * pObj;
1332  int i;
1333  printf( "GIA manager has %d ANDs, %d XORs, %d MUXes.\n",
1335  Gia_ManForEachObj( p, pObj, i )
1336  Gia_ObjPrint( p, pObj );
1337 }
static int Gia_ManMuxNum(Gia_Man_t *p)
Definition: gia.h:391
Definition: gia.h:75
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
void Gia_ObjPrint(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaUtil.c:1258
static int Gia_ManXorNum(Gia_Man_t *p)
Definition: gia.h:390
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
void Gia_ManPrintCo ( Gia_Man_t p,
Gia_Obj_t pObj 
)

Definition at line 1349 of file giaUtil.c.

1350 {
1351  assert( Gia_ObjIsCo(pObj) );
1352  printf( "TFI cone of CO number %d:\n", Gia_ObjCioId(pObj) );
1353  Gia_ManPrintCo_rec( p, Gia_ObjFanin0(pObj) );
1354  Gia_ObjPrint( p, pObj );
1355 }
void Gia_ManPrintCo_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaUtil.c:1338
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
void Gia_ObjPrint(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaUtil.c:1258
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjCioId(Gia_Obj_t *pObj)
Definition: gia.h:411
void Gia_ManPrintCo_rec ( Gia_Man_t p,
Gia_Obj_t pObj 
)

Definition at line 1338 of file giaUtil.c.

1339 {
1340  if ( Gia_ObjIsAnd(pObj) )
1341  {
1342  Gia_ManPrintCo_rec( p, Gia_ObjFanin0(pObj) );
1343  Gia_ManPrintCo_rec( p, Gia_ObjFanin1(pObj) );
1344  if ( Gia_ObjIsMux(p, pObj) )
1345  Gia_ManPrintCo_rec( p, Gia_ObjFanin2(p, pObj) );
1346  }
1347  Gia_ObjPrint( p, pObj );
1348 }
void Gia_ManPrintCo_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaUtil.c:1338
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
void Gia_ObjPrint(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaUtil.c:1258
static Gia_Obj_t * Gia_ObjFanin2(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:456
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
static int Gia_ObjIsMux(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:425
void Gia_ManPrintCollect2_rec ( Gia_Man_t p,
Gia_Obj_t pObj,
Vec_Int_t vNodes 
)

Definition at line 1380 of file giaUtil.c.

1381 {
1382  if ( Vec_IntFind(vNodes, Gia_ObjId(p, pObj)) >= 0 )
1383  return;
1384  if ( Gia_ObjIsCo(pObj) || Gia_ObjIsAnd(pObj) )
1385  Gia_ManPrintCollect2_rec( p, Gia_ObjFanin0(pObj), vNodes );
1386  if ( Gia_ObjIsAnd(pObj) )
1387  Gia_ManPrintCollect2_rec( p, Gia_ObjFanin1(pObj), vNodes );
1388  if ( Gia_ObjIsMux(p, pObj) )
1389  Gia_ManPrintCollect2_rec( p, Gia_ObjFanin2(p, pObj), vNodes );
1390  Vec_IntPush( vNodes, Gia_ObjId(p, pObj) );
1391 }
static int Vec_IntFind(Vec_Int_t *p, int Entry)
Definition: vecInt.h:895
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
void Gia_ManPrintCollect2_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vNodes)
Definition: giaUtil.c:1380
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static Gia_Obj_t * Gia_ObjFanin2(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:456
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
static int Gia_ObjIsMux(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:425
void Gia_ManPrintCollect_rec ( Gia_Man_t p,
Gia_Obj_t pObj,
Vec_Int_t vNodes 
)

Definition at line 1357 of file giaUtil.c.

1358 {
1359  if ( Vec_IntFind(vNodes, Gia_ObjId(p, pObj)) >= 0 )
1360  return;
1361  assert( Gia_ObjIsAnd(pObj) );
1362  Gia_ManPrintCollect_rec( p, Gia_ObjFanin0(pObj), vNodes );
1363  Gia_ManPrintCollect_rec( p, Gia_ObjFanin1(pObj), vNodes );
1364  if ( Gia_ObjIsMux(p, pObj) )
1365  Gia_ManPrintCollect_rec( p, Gia_ObjFanin2(p, pObj), vNodes );
1366  Vec_IntPush( vNodes, Gia_ObjId(p, pObj) );
1367 }
static int Vec_IntFind(Vec_Int_t *p, int Entry)
Definition: vecInt.h:895
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static Gia_Obj_t * Gia_ObjFanin2(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:456
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
void Gia_ManPrintCollect_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vNodes)
Definition: giaUtil.c:1357
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjIsMux(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:425
void Gia_ManPrintCone ( Gia_Man_t p,
Gia_Obj_t pObj,
int *  pLeaves,
int  nLeaves,
Vec_Int_t vNodes 
)

Definition at line 1368 of file giaUtil.c.

1369 {
1370  int i;
1371  Vec_IntClear( vNodes );
1372  for ( i = 0; i < nLeaves; i++ )
1373  Vec_IntPush( vNodes, pLeaves[i] );
1374  Gia_ManPrintCollect_rec( p, pObj, vNodes );
1375  printf( "GIA logic cone for node %d:\n", Gia_ObjId(p, pObj) );
1376  Gia_ManForEachObjVec( vNodes, p, pObj, i )
1377  Gia_ObjPrint( p, pObj );
1378 }
void Gia_ObjPrint(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaUtil.c:1258
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition: gia.h:988
void Gia_ManPrintCollect_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vNodes)
Definition: giaUtil.c:1357
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
void Gia_ManPrintCone2 ( Gia_Man_t p,
Gia_Obj_t pObj 
)

Definition at line 1392 of file giaUtil.c.

1393 {
1394  Vec_Int_t * vNodes;
1395  int i;
1396  vNodes = Vec_IntAlloc( 100 );
1397  Gia_ManPrintCollect2_rec( p, pObj, vNodes );
1398  printf( "GIA logic cone for node %d:\n", Gia_ObjId(p, pObj) );
1399  Gia_ManForEachObjVec( vNodes, p, pObj, i )
1400  Gia_ObjPrint( p, pObj );
1401  Vec_IntFree( vNodes );
1402 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
void Gia_ManPrintCollect2_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vNodes)
Definition: giaUtil.c:1380
void Gia_ObjPrint(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaUtil.c:1258
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition: gia.h:988
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
unsigned Gia_ManRandom ( int  fReset)

FUNCTION DEFINITIONS ///.

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

Synopsis [Creates a sequence or random numbers.]

Description []

SideEffects []

SeeAlso [http://www.codeproject.com/KB/recipes/SimpleRNG.aspx]

Definition at line 49 of file giaUtil.c.

50 {
51  static unsigned int m_z = NUMBER1;
52  static unsigned int m_w = NUMBER2;
53  if ( fReset )
54  {
55  m_z = NUMBER1;
56  m_w = NUMBER2;
57  }
58  m_z = 36969 * (m_z & 65535) + (m_z >> 16);
59  m_w = 18000 * (m_w & 65535) + (m_w >> 16);
60  return (m_z << 16) + m_w;
61 }
#define NUMBER2
Definition: giaUtil.c:32
#define NUMBER1
DECLARATIONS ///.
Definition: giaUtil.c:31
void Gia_ManRandomInfo ( Vec_Ptr_t vInfo,
int  iInputStart,
int  iWordStart,
int  iWordStop 
)

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

Synopsis [Creates random info for the primary inputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 80 of file giaUtil.c.

81 {
82  unsigned * pInfo;
83  int i, w;
84  Vec_PtrForEachEntryStart( unsigned *, vInfo, pInfo, i, iInputStart )
85  for ( w = iWordStart; w < iWordStop; w++ )
86  pInfo[w] = Gia_ManRandom(0);
87 }
#define Vec_PtrForEachEntryStart(Type, vVec, pEntry, i, Start)
Definition: vecPtr.h:57
for(p=first;p->value< newval;p=p->next)
unsigned Gia_ManRandom(int fReset)
FUNCTION DEFINITIONS ///.
Definition: giaUtil.c:49
word Gia_ManRandomW ( int  fReset)

Definition at line 62 of file giaUtil.c.

63 {
64  return ((word)Gia_ManRandom(fReset) << 32) | ((word)Gia_ManRandom(fReset) << 0);
65 }
unsigned Gia_ManRandom(int fReset)
FUNCTION DEFINITIONS ///.
Definition: giaUtil.c:49
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
Vec_Int_t* Gia_ManRequiredLevel ( Gia_Man_t p)

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

Synopsis [Compute required levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 639 of file giaUtil.c.

640 {
641  Vec_Int_t * vRequired;
642  Gia_Obj_t * pObj;
643  int i, LevelMax = 0;
644  vRequired = Gia_ManReverseLevel( p );
645  Gia_ManForEachCi( p, pObj, i )
646  LevelMax = Abc_MaxInt( LevelMax, Vec_IntEntry(vRequired, Gia_ObjId(p, pObj)) );
647  Gia_ManForEachObj( p, pObj, i )
648  Vec_IntWriteEntry( vRequired, i, LevelMax - Vec_IntEntry(vRequired, i) );
649  return vRequired;
650 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Vec_Int_t * Gia_ManReverseLevel(Gia_Man_t *p)
Definition: giaUtil.c:595
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
Vec_Int_t* Gia_ManReverseLevel ( Gia_Man_t p)

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

Synopsis [Compute reverse levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 595 of file giaUtil.c.

596 {
597  Vec_Int_t * vLevelRev;
598  Gia_Obj_t * pObj;
599  int i;
600  vLevelRev = Vec_IntStart( Gia_ManObjNum(p) );
601  Gia_ManForEachAndReverse( p, pObj, i )
602  {
603  int LevelR = Vec_IntEntry( vLevelRev, i );
604  if ( Gia_ObjIsMux(p, pObj) )
605  {
606  Vec_IntUpdateEntry( vLevelRev, Gia_ObjFaninId0(pObj, i), LevelR + 2 );
607  Vec_IntUpdateEntry( vLevelRev, Gia_ObjFaninId1(pObj, i), LevelR + 2 );
608  Vec_IntUpdateEntry( vLevelRev, Gia_ObjFaninId2(p, i), LevelR + 2 );
609  }
610  else if ( Gia_ObjIsXor(pObj) )
611  {
612  Vec_IntUpdateEntry( vLevelRev, Gia_ObjFaninId0(pObj, i), LevelR + 2 );
613  Vec_IntUpdateEntry( vLevelRev, Gia_ObjFaninId1(pObj, i), LevelR + 2 );
614  }
615  else if ( Gia_ObjIsBuf(pObj) )
616  {
617  Vec_IntUpdateEntry( vLevelRev, Gia_ObjFaninId0(pObj, i), LevelR );
618  }
619  else
620  {
621  Vec_IntUpdateEntry( vLevelRev, Gia_ObjFaninId0(pObj, i), LevelR + 1 );
622  Vec_IntUpdateEntry( vLevelRev, Gia_ObjFaninId1(pObj, i), LevelR + 1 );
623  }
624  }
625  return vLevelRev;
626 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Gia_ObjIsBuf(Gia_Obj_t *pObj)
Definition: gia.h:427
Definition: gia.h:75
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
#define Gia_ManForEachAndReverse(p, pObj, i)
Definition: gia.h:1010
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static void Vec_IntUpdateEntry(Vec_Int_t *p, int i, int Value)
Definition: vecInt.h:468
static int Gia_ObjIsXor(Gia_Obj_t *pObj)
Definition: gia.h:423
static int Gia_ObjFaninId2(Gia_Man_t *p, int ObjId)
Definition: gia.h:462
static int Gia_ObjFaninId1(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:461
static int Gia_ObjIsMux(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:425
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ObjFaninId0(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:460
Vec_Int_t* Gia_ManSaveValue ( Gia_Man_t p)

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

Synopsis [Save/load value from file.]

Description []

SideEffects []

SeeAlso []

Definition at line 1605 of file giaUtil.c.

1606 {
1607  Vec_Int_t * vValues;
1608  Gia_Obj_t * pObj;
1609  int i;
1610  vValues = Vec_IntAlloc( Gia_ManObjNum(p) );
1611  Gia_ManForEachObj( p, pObj, i )
1612  Vec_IntPush( vValues, pObj->Value );
1613  return vValues;
1614 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Definition: gia.h:75
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
int Gia_ManSetLevels ( Gia_Man_t p,
Vec_Int_t vCiLevels 
)

Definition at line 558 of file giaUtil.c.

559 {
560  Gia_Obj_t * pObj;
561  int i;
562  if ( vCiLevels == NULL )
563  return Gia_ManLevelNum( p );
564  assert( Vec_IntSize(vCiLevels) == Gia_ManCiNum(p) );
566  p->nLevels = 0;
567  Gia_ManForEachCi( p, pObj, i )
568  {
569  Gia_ObjSetLevel( p, pObj, Vec_IntEntry(vCiLevels, i) );
570  p->nLevels = Abc_MaxInt( p->nLevels, Gia_ObjLevel(p, pObj) );
571  }
572  Gia_ManForEachObj( p, pObj, i )
573  {
574  if ( Gia_ObjIsAnd(pObj) )
575  Gia_ObjSetGateLevel( p, pObj );
576  else if ( Gia_ObjIsCo(pObj) )
577  Gia_ObjSetCoLevel( p, pObj );
578  else continue;
579  p->nLevels = Abc_MaxInt( p->nLevels, Gia_ObjLevel(p, pObj) );
580  }
581  return p->nLevels;
582 }
void Gia_ManCleanLevels(Gia_Man_t *p, int Size)
Definition: giaUtil.c:470
static void Gia_ObjSetGateLevel(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:509
int Gia_ManLevelNum(Gia_Man_t *p)
Definition: giaUtil.c:505
int nLevels
Definition: gia.h:116
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
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 Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static void Gia_ObjSetCoLevel(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:504
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
#define assert(ex)
Definition: util_old.h:213
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static void Gia_ObjSetLevel(Gia_Man_t *p, Gia_Obj_t *pObj, int l)
Definition: gia.h:503
void Gia_ManSetMark0 ( Gia_Man_t p)

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

Synopsis [Sets phases of the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 196 of file giaUtil.c.

197 {
198  Gia_Obj_t * pObj;
199  int i;
200  Gia_ManForEachObj( p, pObj, i )
201  pObj->fMark0 = 1;
202 }
Definition: gia.h:75
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
void Gia_ManSetMark1 ( Gia_Man_t p)

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

Synopsis [Sets phases of the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 253 of file giaUtil.c.

254 {
255  Gia_Obj_t * pObj;
256  int i;
257  Gia_ManForEachObj( p, pObj, i )
258  pObj->fMark1 = 1;
259 }
Definition: gia.h:75
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
void Gia_ManSetPhase ( Gia_Man_t p)

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

Synopsis [Sets phases of the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 379 of file giaUtil.c.

380 {
381  Gia_Obj_t * pObj;
382  int i;
383  Gia_ManForEachObj( p, pObj, i )
384  Gia_ObjSetPhase( p, pObj );
385 }
Definition: gia.h:75
void Gia_ObjSetPhase(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaUtil.c:346
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
void Gia_ManSetPhase1 ( Gia_Man_t p)

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

Synopsis [Sets phases of the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 409 of file giaUtil.c.

410 {
411  Gia_Obj_t * pObj;
412  int i;
413  Gia_ManForEachCi( p, pObj, i )
414  pObj->fPhase = 1;
415  Gia_ManForEachObj( p, pObj, i )
416  if ( !Gia_ObjIsCi(pObj) )
417  Gia_ObjSetPhase( p, pObj );
418 }
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
if(last==0)
Definition: sparse_int.h:34
void Gia_ObjSetPhase(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaUtil.c:346
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
void Gia_ManSetPhasePattern ( Gia_Man_t p,
Vec_Int_t vCiValues 
)

Definition at line 386 of file giaUtil.c.

387 {
388  Gia_Obj_t * pObj;
389  int i;
390  assert( Gia_ManCiNum(p) == Vec_IntSize(vCiValues) );
391  Gia_ManForEachObj( p, pObj, i )
392  if ( Gia_ObjIsCi(pObj) )
393  pObj->fPhase = Vec_IntEntry( vCiValues, Gia_ObjCioId(pObj) );
394  else
395  Gia_ObjSetPhase( p, pObj );
396 }
Definition: gia.h:75
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
void Gia_ObjSetPhase(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaUtil.c:346
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
static int Gia_ObjCioId(Gia_Obj_t *pObj)
Definition: gia.h:411
void Gia_ManSwapPos ( Gia_Man_t p,
int  i 
)

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

Synopsis [Swaps PO number 0 with PO number i.]

Description []

SideEffects []

SeeAlso []

Definition at line 1582 of file giaUtil.c.

1583 {
1584  int Lit0, LitI;
1585  assert( i >= 0 && i < Gia_ManPoNum(p) );
1586  if ( i == 0 )
1587  return;
1588  Lit0 = Gia_ObjFaninLit0p( p, Gia_ManPo(p, 0) );
1589  LitI = Gia_ObjFaninLit0p( p, Gia_ManPo(p, i) );
1590  Gia_ManPatchCoDriver( p, 0, LitI );
1591  Gia_ManPatchCoDriver( p, i, Lit0 );
1592 }
static void Gia_ManPatchCoDriver(Gia_Man_t *p, int iCoIndex, int iLit0)
Definition: gia.h:739
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
static int Gia_ObjFaninLit0p(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:469
#define assert(ex)
Definition: util_old.h:213
int Gia_NodeDeref_rec ( Gia_Man_t p,
Gia_Obj_t pNode 
)

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

Synopsis [Dereferences the node's MFFC.]

Description []

SideEffects []

SeeAlso []

Definition at line 1058 of file giaUtil.c.

1059 {
1060  Gia_Obj_t * pFanin;
1061  int Counter = 0;
1062  if ( Gia_ObjIsCi(pNode) )
1063  return 0;
1064  assert( Gia_ObjIsAnd(pNode) );
1065  pFanin = Gia_ObjFanin0(pNode);
1066  assert( Gia_ObjRefNum(p, pFanin) > 0 );
1067  if ( Gia_ObjRefDec(p, pFanin) == 0 )
1068  Counter += Gia_NodeDeref_rec( p, pFanin );
1069  pFanin = Gia_ObjFanin1(pNode);
1070  assert( Gia_ObjRefNum(p, pFanin) > 0 );
1071  if ( Gia_ObjRefDec(p, pFanin) == 0 )
1072  Counter += Gia_NodeDeref_rec( p, pFanin );
1073  return Counter + 1;
1074 }
static int Gia_ObjRefNum(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:521
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Counter
int Gia_NodeDeref_rec(Gia_Man_t *p, Gia_Obj_t *pNode)
Definition: giaUtil.c:1058
static int Gia_ObjRefDec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:523
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
int Gia_NodeMffcSize ( Gia_Man_t p,
Gia_Obj_t pNode 
)

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

Synopsis [Returns the number of internal nodes in the MFFC.]

Description []

SideEffects []

SeeAlso []

Definition at line 1132 of file giaUtil.c.

1133 {
1134  int ConeSize1, ConeSize2;
1135  assert( !Gia_IsComplement(pNode) );
1136  assert( Gia_ObjIsCand(pNode) );
1137  ConeSize1 = Gia_NodeDeref_rec( p, pNode );
1138  ConeSize2 = Gia_NodeRef_rec( p, pNode );
1139  assert( ConeSize1 == ConeSize2 );
1140  assert( ConeSize1 >= 0 );
1141  return ConeSize1;
1142 }
static int Gia_ObjIsCand(Gia_Obj_t *pObj)
Definition: gia.h:429
int Gia_NodeRef_rec(Gia_Man_t *p, Gia_Obj_t *pNode)
Definition: giaUtil.c:1087
int Gia_NodeDeref_rec(Gia_Man_t *p, Gia_Obj_t *pNode)
Definition: giaUtil.c:1058
static int Gia_IsComplement(Gia_Obj_t *p)
Definition: gia.h:380
#define assert(ex)
Definition: util_old.h:213
int Gia_NodeRef_rec ( Gia_Man_t p,
Gia_Obj_t pNode 
)

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

Synopsis [References the node's MFFC.]

Description []

SideEffects []

SeeAlso []

Definition at line 1087 of file giaUtil.c.

1088 {
1089  Gia_Obj_t * pFanin;
1090  int Counter = 0;
1091  if ( Gia_ObjIsCi(pNode) )
1092  return 0;
1093  assert( Gia_ObjIsAnd(pNode) );
1094  pFanin = Gia_ObjFanin0(pNode);
1095  if ( Gia_ObjRefInc(p, pFanin) == 0 )
1096  Counter += Gia_NodeRef_rec( p, pFanin );
1097  pFanin = Gia_ObjFanin1(pNode);
1098  if ( Gia_ObjRefInc(p, pFanin) == 0 )
1099  Counter += Gia_NodeRef_rec( p, pFanin );
1100  return Counter + 1;
1101 }
int Gia_NodeRef_rec(Gia_Man_t *p, Gia_Obj_t *pNode)
Definition: giaUtil.c:1087
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjRefInc(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:522
static int Counter
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
int Gia_ObjIsMuxType ( Gia_Obj_t pNode)

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

Synopsis [Returns 1 if the node is the root of MUX or EXOR/NEXOR.]

Description []

SideEffects []

SeeAlso []

Definition at line 885 of file giaUtil.c.

886 {
887  Gia_Obj_t * pNode0, * pNode1;
888  // check that the node is regular
889  assert( !Gia_IsComplement(pNode) );
890  // if the node is not AND, this is not MUX
891  if ( !Gia_ObjIsAnd(pNode) || Gia_ObjIsBuf(pNode) )
892  return 0;
893  // if the children are not complemented, this is not MUX
894  if ( !Gia_ObjFaninC0(pNode) || !Gia_ObjFaninC1(pNode) )
895  return 0;
896  // get children
897  pNode0 = Gia_ObjFanin0(pNode);
898  pNode1 = Gia_ObjFanin1(pNode);
899  // if the children are not ANDs, this is not MUX
900  if ( !Gia_ObjIsAnd(pNode0) || !Gia_ObjIsAnd(pNode1) )
901  return 0;
902  // otherwise the node is MUX iff it has a pair of equal grandchildren
903  return (Gia_ObjFanin0(pNode0) == Gia_ObjFanin0(pNode1) && (Gia_ObjFaninC0(pNode0) ^ Gia_ObjFaninC0(pNode1))) ||
904  (Gia_ObjFanin0(pNode0) == Gia_ObjFanin1(pNode1) && (Gia_ObjFaninC0(pNode0) ^ Gia_ObjFaninC1(pNode1))) ||
905  (Gia_ObjFanin1(pNode0) == Gia_ObjFanin0(pNode1) && (Gia_ObjFaninC1(pNode0) ^ Gia_ObjFaninC0(pNode1))) ||
906  (Gia_ObjFanin1(pNode0) == Gia_ObjFanin1(pNode1) && (Gia_ObjFaninC1(pNode0) ^ Gia_ObjFaninC1(pNode1)));
907 }
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static int Gia_ObjIsBuf(Gia_Obj_t *pObj)
Definition: gia.h:427
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_IsComplement(Gia_Obj_t *p)
Definition: gia.h:380
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
void Gia_ObjPrint ( Gia_Man_t p,
Gia_Obj_t pObj 
)

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

Synopsis [Verbose printing of the AIG node.]

Description []

SideEffects []

SeeAlso []

Definition at line 1258 of file giaUtil.c.

1259 {
1260  if ( pObj == NULL )
1261  {
1262  printf( "Object is NULL." );
1263  return;
1264  }
1265  if ( Gia_IsComplement(pObj) )
1266  {
1267  printf( "Compl " );
1268  pObj = Gia_Not(pObj);
1269  }
1270  assert( !Gia_IsComplement(pObj) );
1271  printf( "Obj %4d : ", Gia_ObjId(p, pObj) );
1272  if ( Gia_ObjIsConst0(pObj) )
1273  printf( "constant 0" );
1274  else if ( Gia_ObjIsPi(p, pObj) )
1275  printf( "PI" );
1276  else if ( Gia_ObjIsPo(p, pObj) )
1277  printf( "PO( %4d%s )", Gia_ObjFaninId0p(p, pObj), (Gia_ObjFaninC0(pObj)? "\'" : " ") );
1278  else if ( Gia_ObjIsCi(pObj) )
1279  printf( "RO( %4d%s )", Gia_ObjFaninId0p(p, Gia_ObjRoToRi(p, pObj)), (Gia_ObjFaninC0(Gia_ObjRoToRi(p, pObj))? "\'" : " ") );
1280  else if ( Gia_ObjIsCo(pObj) )
1281  printf( "RI( %4d%s )", Gia_ObjFaninId0p(p, pObj), (Gia_ObjFaninC0(pObj)? "\'" : " ") );
1282 // else if ( Gia_ObjIsBuf(pObj) )
1283 // printf( "BUF( %d%s )", Gia_ObjFaninId0p(p, pObj), (Gia_ObjFaninC0(pObj)? "\'" : " ") );
1284  else if ( Gia_ObjIsXor(pObj) )
1285  printf( "XOR( %4d%s, %4d%s )",
1286  Gia_ObjFaninId0p(p, pObj), (Gia_ObjFaninC0(pObj)? "\'" : " "),
1287  Gia_ObjFaninId1p(p, pObj), (Gia_ObjFaninC1(pObj)? "\'" : " ") );
1288  else if ( Gia_ObjIsMuxId(p, Gia_ObjId(p, pObj)) )
1289  printf( "MUX( %4d%s, %4d%s, %4d%s )",
1290  Gia_ObjFaninId2p(p, pObj), (Gia_ObjFaninC2(p, pObj)? "\'" : " "),
1291  Gia_ObjFaninId1p(p, pObj), (Gia_ObjFaninC1(pObj)? "\'" : " "),
1292  Gia_ObjFaninId0p(p, pObj), (Gia_ObjFaninC0(pObj)? "\'" : " ") );
1293  else
1294  printf( "AND( %4d%s, %4d%s )",
1295  Gia_ObjFaninId0p(p, pObj), (Gia_ObjFaninC0(pObj)? "\'" : " "),
1296  Gia_ObjFaninId1p(p, pObj), (Gia_ObjFaninC1(pObj)? "\'" : " ") );
1297  if ( p->pRefs )
1298  printf( " (refs = %3d)", Gia_ObjRefNum(p, pObj) );
1299  if ( pObj->fMark0 )
1300  printf( " mark0" );
1301  if ( pObj->fMark1 )
1302  printf( " mark1" );
1303  printf( "\n" );
1304 /*
1305  if ( p->pRefs )
1306  {
1307  Gia_Obj_t * pFanout;
1308  int i;
1309  int iFan = -1; // Suppress "might be used uninitialized"
1310  printf( "\nFanouts:\n" );
1311  Gia_ObjForEachFanout( p, pObj, pFanout, iFan, i )
1312  {
1313  printf( " " );
1314  printf( "Node %4d : ", Gia_ObjId(pFanout) );
1315  if ( Gia_ObjIsPo(pFanout) )
1316  printf( "PO( %4d%s )", Gia_ObjFanin0(pFanout)->Id, (Gia_ObjFaninC0(pFanout)? "\'" : " ") );
1317  else if ( Gia_ObjIsBuf(pFanout) )
1318  printf( "BUF( %d%s )", Gia_ObjFanin0(pFanout)->Id, (Gia_ObjFaninC0(pFanout)? "\'" : " ") );
1319  else
1320  printf( "AND( %4d%s, %4d%s )",
1321  Gia_ObjFanin0(pFanout)->Id, (Gia_ObjFaninC0(pFanout)? "\'" : " "),
1322  Gia_ObjFanin1(pFanout)->Id, (Gia_ObjFaninC1(pFanout)? "\'" : " ") );
1323  printf( "\n" );
1324  }
1325  return;
1326  }
1327 */
1328 }
static int Gia_ObjFaninC2(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:453
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static int Gia_ObjIsConst0(Gia_Obj_t *pObj)
Definition: gia.h:430
static int Gia_ObjFaninId1p(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:464
static int Gia_ObjRefNum(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:521
unsigned fMark1
Definition: gia.h:84
int * pRefs
Definition: gia.h:114
static Gia_Obj_t * Gia_Not(Gia_Obj_t *p)
Definition: gia.h:378
static int Gia_ObjIsMuxId(Gia_Man_t *p, int iObj)
Definition: gia.h:424
static Gia_Obj_t * Gia_ObjRoToRi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:446
static int Gia_ObjIsXor(Gia_Obj_t *pObj)
Definition: gia.h:423
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static int Gia_IsComplement(Gia_Obj_t *p)
Definition: gia.h:380
unsigned fMark0
Definition: gia.h:79
static int Gia_ObjFaninId0p(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:463
static int Gia_ObjIsPo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:442
static int Gia_ObjFaninId2p(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:465
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
static int Gia_ObjIsPi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:441
int Gia_ObjRecognizeExor ( Gia_Obj_t pObj,
Gia_Obj_t **  ppFan0,
Gia_Obj_t **  ppFan1 
)

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

Synopsis [Recognizes what nodes are inputs of the EXOR.]

Description []

SideEffects []

SeeAlso []

Definition at line 921 of file giaUtil.c.

922 {
923  Gia_Obj_t * p0, * p1;
924  assert( !Gia_IsComplement(pObj) );
925  if ( !Gia_ObjIsAnd(pObj) || Gia_ObjIsBuf(pObj) )
926  return 0;
927  assert( Gia_ObjIsAnd(pObj) );
928  p0 = Gia_ObjChild0(pObj);
929  p1 = Gia_ObjChild1(pObj);
930  if ( !Gia_IsComplement(p0) || !Gia_IsComplement(p1) )
931  return 0;
932  p0 = Gia_Regular(p0);
933  p1 = Gia_Regular(p1);
934  if ( !Gia_ObjIsAnd(p0) || !Gia_ObjIsAnd(p1) )
935  return 0;
936  if ( Gia_ObjFanin0(p0) != Gia_ObjFanin0(p1) || Gia_ObjFanin1(p0) != Gia_ObjFanin1(p1) )
937  return 0;
938  if ( Gia_ObjFaninC0(p0) == Gia_ObjFaninC0(p1) || Gia_ObjFaninC1(p0) == Gia_ObjFaninC1(p1) )
939  return 0;
940  *ppFan0 = Gia_ObjChild0(p0);
941  *ppFan1 = Gia_ObjChild1(p0);
942  return 1;
943 }
static Gia_Obj_t * Gia_ObjChild0(Gia_Obj_t *pObj)
Definition: gia.h:457
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static Gia_Obj_t * Gia_Regular(Gia_Obj_t *p)
Definition: gia.h:377
static int Gia_ObjIsBuf(Gia_Obj_t *pObj)
Definition: gia.h:427
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjChild1(Gia_Obj_t *pObj)
Definition: gia.h:458
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_IsComplement(Gia_Obj_t *p)
Definition: gia.h:380
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
Gia_Obj_t* Gia_ObjRecognizeMux ( Gia_Obj_t pNode,
Gia_Obj_t **  ppNodeT,
Gia_Obj_t **  ppNodeE 
)

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

Synopsis [Recognizes what nodes are control and data inputs of a MUX.]

Description [If the node is a MUX, returns the control variable C. Assigns nodes T and E to be the then and else variables of the MUX. Node C is never complemented. Nodes T and E can be complemented. This function also recognizes EXOR/NEXOR gates as MUXes.]

SideEffects []

SeeAlso []

Definition at line 959 of file giaUtil.c.

960 {
961  Gia_Obj_t * pNode0, * pNode1;
962  assert( !Gia_IsComplement(pNode) );
963  assert( Gia_ObjIsMuxType(pNode) );
964  // get children
965  pNode0 = Gia_ObjFanin0(pNode);
966  pNode1 = Gia_ObjFanin1(pNode);
967 
968  // find the control variable
969  if ( Gia_ObjFanin1(pNode0) == Gia_ObjFanin1(pNode1) && (Gia_ObjFaninC1(pNode0) ^ Gia_ObjFaninC1(pNode1)) )
970  {
971 // if ( FrGia_IsComplement(pNode1->p2) )
972  if ( Gia_ObjFaninC1(pNode0) )
973  { // pNode2->p2 is positive phase of C
974  *ppNodeT = Gia_Not(Gia_ObjChild0(pNode1));//pNode2->p1);
975  *ppNodeE = Gia_Not(Gia_ObjChild0(pNode0));//pNode1->p1);
976  return Gia_ObjChild1(pNode1);//pNode2->p2;
977  }
978  else
979  { // pNode1->p2 is positive phase of C
980  *ppNodeT = Gia_Not(Gia_ObjChild0(pNode0));//pNode1->p1);
981  *ppNodeE = Gia_Not(Gia_ObjChild0(pNode1));//pNode2->p1);
982  return Gia_ObjChild1(pNode0);//pNode1->p2;
983  }
984  }
985  else if ( Gia_ObjFanin0(pNode0) == Gia_ObjFanin0(pNode1) && (Gia_ObjFaninC0(pNode0) ^ Gia_ObjFaninC0(pNode1)) )
986  {
987 // if ( FrGia_IsComplement(pNode1->p1) )
988  if ( Gia_ObjFaninC0(pNode0) )
989  { // pNode2->p1 is positive phase of C
990  *ppNodeT = Gia_Not(Gia_ObjChild1(pNode1));//pNode2->p2);
991  *ppNodeE = Gia_Not(Gia_ObjChild1(pNode0));//pNode1->p2);
992  return Gia_ObjChild0(pNode1);//pNode2->p1;
993  }
994  else
995  { // pNode1->p1 is positive phase of C
996  *ppNodeT = Gia_Not(Gia_ObjChild1(pNode0));//pNode1->p2);
997  *ppNodeE = Gia_Not(Gia_ObjChild1(pNode1));//pNode2->p2);
998  return Gia_ObjChild0(pNode0);//pNode1->p1;
999  }
1000  }
1001  else if ( Gia_ObjFanin0(pNode0) == Gia_ObjFanin1(pNode1) && (Gia_ObjFaninC0(pNode0) ^ Gia_ObjFaninC1(pNode1)) )
1002  {
1003 // if ( FrGia_IsComplement(pNode1->p1) )
1004  if ( Gia_ObjFaninC0(pNode0) )
1005  { // pNode2->p2 is positive phase of C
1006  *ppNodeT = Gia_Not(Gia_ObjChild0(pNode1));//pNode2->p1);
1007  *ppNodeE = Gia_Not(Gia_ObjChild1(pNode0));//pNode1->p2);
1008  return Gia_ObjChild1(pNode1);//pNode2->p2;
1009  }
1010  else
1011  { // pNode1->p1 is positive phase of C
1012  *ppNodeT = Gia_Not(Gia_ObjChild1(pNode0));//pNode1->p2);
1013  *ppNodeE = Gia_Not(Gia_ObjChild0(pNode1));//pNode2->p1);
1014  return Gia_ObjChild0(pNode0);//pNode1->p1;
1015  }
1016  }
1017  else if ( Gia_ObjFanin1(pNode0) == Gia_ObjFanin0(pNode1) && (Gia_ObjFaninC1(pNode0) ^ Gia_ObjFaninC0(pNode1)) )
1018  {
1019 // if ( FrGia_IsComplement(pNode1->p2) )
1020  if ( Gia_ObjFaninC1(pNode0) )
1021  { // pNode2->p1 is positive phase of C
1022  *ppNodeT = Gia_Not(Gia_ObjChild1(pNode1));//pNode2->p2);
1023  *ppNodeE = Gia_Not(Gia_ObjChild0(pNode0));//pNode1->p1);
1024  return Gia_ObjChild0(pNode1);//pNode2->p1;
1025  }
1026  else
1027  { // pNode1->p2 is positive phase of C
1028  *ppNodeT = Gia_Not(Gia_ObjChild0(pNode0));//pNode1->p1);
1029  *ppNodeE = Gia_Not(Gia_ObjChild1(pNode1));//pNode2->p2);
1030  return Gia_ObjChild1(pNode0);//pNode1->p2;
1031  }
1032  }
1033  assert( 0 ); // this is not MUX
1034  return NULL;
1035 }
static Gia_Obj_t * Gia_ObjChild0(Gia_Obj_t *pObj)
Definition: gia.h:457
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
int Gia_ObjIsMuxType(Gia_Obj_t *pNode)
Definition: giaUtil.c:885
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjChild1(Gia_Obj_t *pObj)
Definition: gia.h:458
static Gia_Obj_t * Gia_Not(Gia_Obj_t *p)
Definition: gia.h:378
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_IsComplement(Gia_Obj_t *p)
Definition: gia.h:380
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
int Gia_ObjRecognizeMuxLits ( Gia_Man_t p,
Gia_Obj_t pNode,
int *  iLitT,
int *  iLitE 
)

Definition at line 1036 of file giaUtil.c.

1037 {
1038  Gia_Obj_t * pNodeT, * pNodeE;
1039  Gia_Obj_t * pCtrl = Gia_ObjRecognizeMux( pNode, &pNodeT, &pNodeE );
1040  assert( pCtrl != NULL );
1041  *iLitT = Gia_Obj2Lit( p, pNodeT );
1042  *iLitE = Gia_Obj2Lit( p, pNodeE );
1043  return Gia_Obj2Lit( p, pCtrl );
1044 }
Definition: gia.h:75
Gia_Obj_t * Gia_ObjRecognizeMux(Gia_Obj_t *pNode, Gia_Obj_t **ppNodeT, Gia_Obj_t **ppNodeE)
Definition: giaUtil.c:959
#define assert(ex)
Definition: util_old.h:213
static int Gia_Obj2Lit(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:433
void Gia_ObjSetPhase ( Gia_Man_t p,
Gia_Obj_t pObj 
)

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

Synopsis [Sets the phase of one object.]

Description []

SideEffects []

SeeAlso []

Definition at line 346 of file giaUtil.c.

347 {
348  if ( Gia_ObjIsAnd(pObj) )
349  {
350  int fPhase0 = Gia_ObjPhase(Gia_ObjFanin0(pObj)) ^ Gia_ObjFaninC0(pObj);
351  int fPhase1 = Gia_ObjPhase(Gia_ObjFanin1(pObj)) ^ Gia_ObjFaninC1(pObj);
352  if ( Gia_ObjIsMux(p, pObj) )
353  {
354  int fPhase2 = Gia_ObjPhase(Gia_ObjFanin2(p, pObj)) ^ Gia_ObjFaninC2(p, pObj);
355  pObj->fPhase = (fPhase2 && fPhase1) || (!fPhase2 && fPhase0);
356  }
357  else if ( Gia_ObjIsXor(pObj) )
358  pObj->fPhase = fPhase0 ^ fPhase1;
359  else
360  pObj->fPhase = fPhase0 & fPhase1;
361  }
362  else if ( Gia_ObjIsCo(pObj) )
363  pObj->fPhase = (Gia_ObjPhase(Gia_ObjFanin0(pObj)) ^ Gia_ObjFaninC0(pObj));
364  else
365  pObj->fPhase = 0;
366 }
static int Gia_ObjFaninC2(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:453
static int Gia_ObjPhase(Gia_Obj_t *pObj)
Definition: gia.h:415
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjIsXor(Gia_Obj_t *pObj)
Definition: gia.h:423
static Gia_Obj_t * Gia_ObjFanin2(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:456
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
unsigned fPhase
Definition: gia.h:85
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static int Gia_ObjIsMux(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:425
char* Gia_TimeStamp ( )

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

Synopsis [Returns the time stamp.]

Description [The file should be closed.]

SideEffects []

SeeAlso []

Definition at line 101 of file giaUtil.c.

102 {
103  static char Buffer[100];
104  char * TimeStamp;
105  time_t ltime;
106  // get the current time
107  time( &ltime );
108  TimeStamp = asctime( localtime( &ltime ) );
109  TimeStamp[ strlen(TimeStamp) - 1 ] = 0;
110  strcpy( Buffer, TimeStamp );
111  return Buffer;
112 }
char * strcpy()
int strlen()