ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
ivy.h File Reference
#include <stdio.h>
#include "misc/extra/extra.h"
#include "misc/vec/vec.h"
Include dependency graph for ivy.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Ivy_Obj_t_
 
struct  Ivy_Man_t_
 
struct  Ivy_FraigParams_t_
 
struct  Ivy_Cut_t_
 
struct  Ivy_Store_t_
 

Macros

#define IVY_CUT_LIMIT   256
 
#define IVY_CUT_INPUT   6
 
#define IVY_LEAF_MASK   255
 
#define IVY_LEAF_BITS   8
 
#define IVY_MIN(a, b)
 MACRO DEFINITIONS ///.
 
#define IVY_MAX(a, b)
 
#define Ivy_ManForEachPi(p, pObj, i)
 ITERATORS ///.
 
#define Ivy_ManForEachPo(p, pObj, i)
 
#define Ivy_ManForEachObj(p, pObj, i)
 
#define Ivy_ManForEachCi(p, pObj, i)
 
#define Ivy_ManForEachCo(p, pObj, i)
 
#define Ivy_ManForEachNode(p, pObj, i)
 
#define Ivy_ManForEachLatch(p, pObj, i)
 
#define Ivy_ManForEachNodeVec(p, vIds, pObj, i)
 
#define Ivy_ObjForEachFanout(p, pObj, vArray, pFanout, i)
 

Typedefs

typedef typedefABC_NAMESPACE_HEADER_START struct Ivy_Man_t_ Ivy_Man_t
 INCLUDES ///.
 
typedef struct Ivy_Obj_t_ Ivy_Obj_t
 
typedef int Ivy_Edge_t
 
typedef struct Ivy_FraigParams_t_ Ivy_FraigParams_t
 
typedef struct Ivy_Cut_t_ Ivy_Cut_t
 
typedef struct Ivy_Store_t_ Ivy_Store_t
 

Enumerations

enum  Ivy_Type_t {
  IVY_NONE , IVY_PI , IVY_PO , IVY_ASSERT ,
  IVY_LATCH , IVY_AND , IVY_EXOR , IVY_BUF ,
  IVY_VOID
}
 
enum  Ivy_Init_t { IVY_INIT_NONE , IVY_INIT_0 , IVY_INIT_1 , IVY_INIT_DC }
 

Functions

void Ivy_ManAddMemory (Ivy_Man_t *p)
 
Ivy_Man_tIvy_ManBalance (Ivy_Man_t *p, int fUpdateLevel)
 FUNCTION DECLARATIONS ///.
 
Ivy_Obj_tIvy_NodeBalanceBuildSuper (Ivy_Man_t *p, Vec_Ptr_t *vSuper, Ivy_Type_t Type, int fUpdateLevel)
 
Ivy_Obj_tIvy_CanonAnd (Ivy_Man_t *p, Ivy_Obj_t *p0, Ivy_Obj_t *p1)
 
Ivy_Obj_tIvy_CanonExor (Ivy_Man_t *p, Ivy_Obj_t *p0, Ivy_Obj_t *p1)
 
Ivy_Obj_tIvy_CanonLatch (Ivy_Man_t *p, Ivy_Obj_t *pObj, Ivy_Init_t Init)
 
int Ivy_ManCheck (Ivy_Man_t *p)
 DECLARATIONS ///.
 
int Ivy_ManCheckFanoutNums (Ivy_Man_t *p)
 
int Ivy_ManCheckFanouts (Ivy_Man_t *p)
 
int Ivy_ManCheckChoices (Ivy_Man_t *p)
 
void Ivy_ManSeqFindCut (Ivy_Man_t *p, Ivy_Obj_t *pNode, Vec_Int_t *vFront, Vec_Int_t *vInside, int nSize)
 
Ivy_Store_tIvy_NodeFindCutsAll (Ivy_Man_t *p, Ivy_Obj_t *pObj, int nLeaves)
 
Vec_Int_tIvy_ManDfs (Ivy_Man_t *p)
 
Vec_Int_tIvy_ManDfsSeq (Ivy_Man_t *p, Vec_Int_t **pvLatches)
 
void Ivy_ManCollectCone (Ivy_Obj_t *pObj, Vec_Ptr_t *vFront, Vec_Ptr_t *vCone)
 
Vec_Vec_tIvy_ManLevelize (Ivy_Man_t *p)
 
Vec_Int_tIvy_ManRequiredLevels (Ivy_Man_t *p)
 
int Ivy_ManIsAcyclic (Ivy_Man_t *p)
 
int Ivy_ManSetLevels (Ivy_Man_t *p, int fHaig)
 
int Ivy_TruthDsd (unsigned uTruth, Vec_Int_t *vTree)
 FUNCTION DEFINITIONS ///.
 
void Ivy_TruthDsdPrint (FILE *pFile, Vec_Int_t *vTree)
 
unsigned Ivy_TruthDsdCompute (Vec_Int_t *vTree)
 
void Ivy_TruthDsdComputePrint (unsigned uTruth)
 
Ivy_Obj_tIvy_ManDsdConstruct (Ivy_Man_t *p, Vec_Int_t *vFront, Vec_Int_t *vTree)
 
void Ivy_ManStartFanout (Ivy_Man_t *p)
 FUNCTION DEFINITIONS ///.
 
void Ivy_ManStopFanout (Ivy_Man_t *p)
 
void Ivy_ObjAddFanout (Ivy_Man_t *p, Ivy_Obj_t *pObj, Ivy_Obj_t *pFanout)
 
void Ivy_ObjDeleteFanout (Ivy_Man_t *p, Ivy_Obj_t *pObj, Ivy_Obj_t *pFanout)
 
void Ivy_ObjPatchFanout (Ivy_Man_t *p, Ivy_Obj_t *pObj, Ivy_Obj_t *pFanoutOld, Ivy_Obj_t *pFanoutNew)
 
void Ivy_ObjCollectFanouts (Ivy_Man_t *p, Ivy_Obj_t *pObj, Vec_Ptr_t *vArray)
 
Ivy_Obj_tIvy_ObjReadFirstFanout (Ivy_Man_t *p, Ivy_Obj_t *pObj)
 
int Ivy_ObjFanoutNum (Ivy_Man_t *p, Ivy_Obj_t *pObj)
 
void Ivy_FastMapPerform (Ivy_Man_t *pAig, int nLimit, int fRecovery, int fVerbose)
 FUNCTION DEFINITIONS ///.
 
void Ivy_FastMapStop (Ivy_Man_t *pAig)
 
void Ivy_FastMapReadSupp (Ivy_Man_t *pAig, Ivy_Obj_t *pObj, Vec_Int_t *vLeaves)
 
void Ivy_FastMapReverseLevel (Ivy_Man_t *pAig)
 
int Ivy_FraigProve (Ivy_Man_t **ppManAig, void *pPars)
 
Ivy_Man_tIvy_FraigPerform (Ivy_Man_t *pManAig, Ivy_FraigParams_t *pParams)
 
Ivy_Man_tIvy_FraigMiter (Ivy_Man_t *pManAig, Ivy_FraigParams_t *pParams)
 
void Ivy_FraigParamsDefault (Ivy_FraigParams_t *pParams)
 FUNCTION DEFINITIONS ///.
 
void Ivy_ManHaigStart (Ivy_Man_t *p, int fVerbose)
 FUNCTION DEFINITIONS ///.
 
void Ivy_ManHaigTrasfer (Ivy_Man_t *p, Ivy_Man_t *pNew)
 
void Ivy_ManHaigStop (Ivy_Man_t *p)
 
void Ivy_ManHaigPostprocess (Ivy_Man_t *p, int fVerbose)
 
void Ivy_ManHaigCreateObj (Ivy_Man_t *p, Ivy_Obj_t *pObj)
 
void Ivy_ManHaigCreateChoice (Ivy_Man_t *p, Ivy_Obj_t *pObjOld, Ivy_Obj_t *pObjNew)
 
void Ivy_ManHaigSimulate (Ivy_Man_t *p)
 
Ivy_Man_tIvy_ManStart ()
 DECLARATIONS ///.
 
Ivy_Man_tIvy_ManStartFrom (Ivy_Man_t *p)
 
Ivy_Man_tIvy_ManDup (Ivy_Man_t *p)
 
Ivy_Man_tIvy_ManFrames (Ivy_Man_t *pMan, int nLatches, int nFrames, int fInit, Vec_Ptr_t **pvMapping)
 
void Ivy_ManStop (Ivy_Man_t *p)
 
int Ivy_ManCleanup (Ivy_Man_t *p)
 
int Ivy_ManPropagateBuffers (Ivy_Man_t *p, int fUpdateLevel)
 
void Ivy_ManPrintStats (Ivy_Man_t *p)
 
void Ivy_ManMakeSeq (Ivy_Man_t *p, int nLatches, int *pInits)
 
void Ivy_ManStartMemory (Ivy_Man_t *p)
 FUNCTION DEFINITIONS ///.
 
void Ivy_ManStopMemory (Ivy_Man_t *p)
 
Ivy_Obj_tIvy_Multi (Ivy_Man_t *p, Ivy_Obj_t **pArgs, int nArgs, Ivy_Type_t Type)
 
Ivy_Obj_tIvy_Multi1 (Ivy_Man_t *p, Ivy_Obj_t **pArgs, int nArgs, Ivy_Type_t Type)
 
Ivy_Obj_tIvy_Multi_rec (Ivy_Man_t *p, Ivy_Obj_t **ppObjs, int nObjs, Ivy_Type_t Type)
 
Ivy_Obj_tIvy_MultiBalance_rec (Ivy_Man_t *p, Ivy_Obj_t **pArgs, int nArgs, Ivy_Type_t Type)
 
int Ivy_MultiPlus (Ivy_Man_t *p, Vec_Ptr_t *vLeaves, Vec_Ptr_t *vCone, Ivy_Type_t Type, int nLimit, Vec_Ptr_t *vSol)
 FUNCTION DEFINITIONS ///.
 
Ivy_Obj_tIvy_ObjCreatePi (Ivy_Man_t *p)
 DECLARATIONS ///.
 
Ivy_Obj_tIvy_ObjCreatePo (Ivy_Man_t *p, Ivy_Obj_t *pDriver)
 
Ivy_Obj_tIvy_ObjCreate (Ivy_Man_t *p, Ivy_Obj_t *pGhost)
 
void Ivy_ObjConnect (Ivy_Man_t *p, Ivy_Obj_t *pObj, Ivy_Obj_t *pFan0, Ivy_Obj_t *pFan1)
 
void Ivy_ObjDisconnect (Ivy_Man_t *p, Ivy_Obj_t *pObj)
 
void Ivy_ObjPatchFanin0 (Ivy_Man_t *p, Ivy_Obj_t *pObj, Ivy_Obj_t *pFaninNew)
 
void Ivy_ObjDelete (Ivy_Man_t *p, Ivy_Obj_t *pObj, int fFreeTop)
 
void Ivy_ObjDelete_rec (Ivy_Man_t *p, Ivy_Obj_t *pObj, int fFreeTop)
 
void Ivy_ObjReplace (Ivy_Man_t *p, Ivy_Obj_t *pObjOld, Ivy_Obj_t *pObjNew, int fDeleteOld, int fFreeTop, int fUpdateLevel)
 
void Ivy_NodeFixBufferFanins (Ivy_Man_t *p, Ivy_Obj_t *pNode, int fUpdateLevel)
 
Ivy_Obj_tIvy_Oper (Ivy_Man_t *p, Ivy_Obj_t *p0, Ivy_Obj_t *p1, Ivy_Type_t Type)
 FUNCTION DEFINITIONS ///.
 
Ivy_Obj_tIvy_And (Ivy_Man_t *p, Ivy_Obj_t *p0, Ivy_Obj_t *p1)
 
Ivy_Obj_tIvy_Or (Ivy_Man_t *p, Ivy_Obj_t *p0, Ivy_Obj_t *p1)
 
Ivy_Obj_tIvy_Exor (Ivy_Man_t *p, Ivy_Obj_t *p0, Ivy_Obj_t *p1)
 
Ivy_Obj_tIvy_Mux (Ivy_Man_t *p, Ivy_Obj_t *pC, Ivy_Obj_t *p1, Ivy_Obj_t *p0)
 
Ivy_Obj_tIvy_Maj (Ivy_Man_t *p, Ivy_Obj_t *pA, Ivy_Obj_t *pB, Ivy_Obj_t *pC)
 
Ivy_Obj_tIvy_Miter (Ivy_Man_t *p, Vec_Ptr_t *vPairs)
 
Ivy_Obj_tIvy_Latch (Ivy_Man_t *p, Ivy_Obj_t *pObj, Ivy_Init_t Init)
 
Ivy_Man_tIvy_ManResyn0 (Ivy_Man_t *p, int fUpdateLevel, int fVerbose)
 DECLARATIONS ///.
 
Ivy_Man_tIvy_ManResyn (Ivy_Man_t *p, int fUpdateLevel, int fVerbose)
 
Ivy_Man_tIvy_ManRwsat (Ivy_Man_t *pMan, int fVerbose)
 
int Ivy_ManSeqRewrite (Ivy_Man_t *p, int fUpdateLevel, int fUseZeroCost)
 
int Ivy_ManRewriteAlg (Ivy_Man_t *p, int fUpdateLevel, int fUseZeroCost)
 FUNCTION DEFINITIONS ///.
 
int Ivy_ManRewritePre (Ivy_Man_t *p, int fUpdateLevel, int fUseZeroCost, int fVerbose)
 FUNCTION DEFINITIONS ///.
 
int Ivy_ManRewriteSeq (Ivy_Man_t *p, int fUseZeroCost, int fVerbose)
 FUNCTION DEFINITIONS ///.
 
void Ivy_ManShow (Ivy_Man_t *pMan, int fHaig, Vec_Ptr_t *vBold)
 FUNCTION DEFINITIONS ///.
 
Ivy_Obj_tIvy_TableLookup (Ivy_Man_t *p, Ivy_Obj_t *pObj)
 FUNCTION DEFINITIONS ///.
 
void Ivy_TableInsert (Ivy_Man_t *p, Ivy_Obj_t *pObj)
 
void Ivy_TableDelete (Ivy_Man_t *p, Ivy_Obj_t *pObj)
 
void Ivy_TableUpdate (Ivy_Man_t *p, Ivy_Obj_t *pObj, int ObjIdNew)
 
int Ivy_TableCountEntries (Ivy_Man_t *p)
 
void Ivy_TableProfile (Ivy_Man_t *p)
 
void Ivy_ManIncrementTravId (Ivy_Man_t *p)
 DECLARATIONS ///.
 
void Ivy_ManCleanTravId (Ivy_Man_t *p)
 
unsigned * Ivy_ManCutTruth (Ivy_Man_t *p, Ivy_Obj_t *pRoot, Vec_Int_t *vLeaves, Vec_Int_t *vNodes, Vec_Int_t *vTruth)
 
void Ivy_ManCollectCut (Ivy_Man_t *p, Ivy_Obj_t *pRoot, Vec_Int_t *vLeaves, Vec_Int_t *vNodes)
 
Vec_Int_tIvy_ManLatches (Ivy_Man_t *p)
 
int Ivy_ManLevels (Ivy_Man_t *p)
 
void Ivy_ManResetLevels (Ivy_Man_t *p)
 
int Ivy_ObjMffcLabel (Ivy_Man_t *p, Ivy_Obj_t *pObj)
 
void Ivy_ObjUpdateLevel_rec (Ivy_Man_t *p, Ivy_Obj_t *pObj)
 
void Ivy_ObjUpdateLevelR_rec (Ivy_Man_t *p, Ivy_Obj_t *pObj, int ReqNew)
 
int Ivy_ObjIsMuxType (Ivy_Obj_t *pObj)
 
Ivy_Obj_tIvy_ObjRecognizeMux (Ivy_Obj_t *pObj, Ivy_Obj_t **ppObjT, Ivy_Obj_t **ppObjE)
 
Ivy_Obj_tIvy_ObjReal (Ivy_Obj_t *pObj)
 
void Ivy_ObjPrintVerbose (Ivy_Man_t *p, Ivy_Obj_t *pObj, int fHaig)
 
void Ivy_ManPrintVerbose (Ivy_Man_t *p, int fHaig)
 
int Ivy_CutTruthPrint (Ivy_Man_t *p, Ivy_Cut_t *pCut, unsigned uTruth)
 

Macro Definition Documentation

◆ IVY_CUT_INPUT

#define IVY_CUT_INPUT   6

Definition at line 153 of file ivy.h.

◆ IVY_CUT_LIMIT

#define IVY_CUT_LIMIT   256

Definition at line 152 of file ivy.h.

◆ IVY_LEAF_BITS

#define IVY_LEAF_BITS   8

Definition at line 176 of file ivy.h.

◆ IVY_LEAF_MASK

#define IVY_LEAF_MASK   255

Definition at line 175 of file ivy.h.

◆ Ivy_ManForEachCi

#define Ivy_ManForEachCi ( p,
pObj,
i )
Value:
Ivy_ManForEachObj( p, pObj, i ) if ( !Ivy_ObjIsCi(pObj) ) {} else
Cube * p
Definition exorList.c:222
#define Ivy_ManForEachObj(p, pObj, i)
Definition ivy.h:393

Definition at line 396 of file ivy.h.

396#define Ivy_ManForEachCi( p, pObj, i ) \
397 Ivy_ManForEachObj( p, pObj, i ) if ( !Ivy_ObjIsCi(pObj) ) {} else

◆ Ivy_ManForEachCo

#define Ivy_ManForEachCo ( p,
pObj,
i )
Value:
Ivy_ManForEachObj( p, pObj, i ) if ( !Ivy_ObjIsCo(pObj) ) {} else

Definition at line 399 of file ivy.h.

399#define Ivy_ManForEachCo( p, pObj, i ) \
400 Ivy_ManForEachObj( p, pObj, i ) if ( !Ivy_ObjIsCo(pObj) ) {} else

◆ Ivy_ManForEachLatch

#define Ivy_ManForEachLatch ( p,
pObj,
i )
Value:
Ivy_ManForEachObj( p, pObj, i ) if ( !Ivy_ObjIsLatch(pObj) ) {} else

Definition at line 405 of file ivy.h.

405#define Ivy_ManForEachLatch( p, pObj, i ) \
406 Ivy_ManForEachObj( p, pObj, i ) if ( !Ivy_ObjIsLatch(pObj) ) {} else

◆ Ivy_ManForEachNode

#define Ivy_ManForEachNode ( p,
pObj,
i )
Value:
Ivy_ManForEachObj( p, pObj, i ) if ( !Ivy_ObjIsNode(pObj) ) {} else

Definition at line 402 of file ivy.h.

402#define Ivy_ManForEachNode( p, pObj, i ) \
403 Ivy_ManForEachObj( p, pObj, i ) if ( !Ivy_ObjIsNode(pObj) ) {} else

◆ Ivy_ManForEachNodeVec

#define Ivy_ManForEachNodeVec ( p,
vIds,
pObj,
i )
Value:
for ( i = 0; i < Vec_IntSize(vIds) && ((pObj) = Ivy_ManObj(p, Vec_IntEntry(vIds,i))); i++ )

Definition at line 408 of file ivy.h.

408#define Ivy_ManForEachNodeVec( p, vIds, pObj, i ) \
409 for ( i = 0; i < Vec_IntSize(vIds) && ((pObj) = Ivy_ManObj(p, Vec_IntEntry(vIds,i))); i++ )

◆ Ivy_ManForEachObj

#define Ivy_ManForEachObj ( p,
pObj,
i )
Value:
Vec_PtrForEachEntry( Ivy_Obj_t *, p->vObjs, pObj, i ) if ( (pObj) == NULL ) {} else
struct Ivy_Obj_t_ Ivy_Obj_t
Definition ivy.h:47
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55

Definition at line 393 of file ivy.h.

393#define Ivy_ManForEachObj( p, pObj, i ) \
394 Vec_PtrForEachEntry( Ivy_Obj_t *, p->vObjs, pObj, i ) if ( (pObj) == NULL ) {} else

◆ Ivy_ManForEachPi

#define Ivy_ManForEachPi ( p,
pObj,
i )
Value:
Vec_PtrForEachEntry( Ivy_Obj_t *, p->vPis, pObj, i )

ITERATORS ///.

Definition at line 387 of file ivy.h.

387#define Ivy_ManForEachPi( p, pObj, i ) \
388 Vec_PtrForEachEntry( Ivy_Obj_t *, p->vPis, pObj, i )

◆ Ivy_ManForEachPo

#define Ivy_ManForEachPo ( p,
pObj,
i )
Value:
Vec_PtrForEachEntry( Ivy_Obj_t *, p->vPos, pObj, i )

Definition at line 390 of file ivy.h.

390#define Ivy_ManForEachPo( p, pObj, i ) \
391 Vec_PtrForEachEntry( Ivy_Obj_t *, p->vPos, pObj, i )

◆ IVY_MAX

#define IVY_MAX ( a,
b )
Value:
(((a) > (b))? (a) : (b))

Definition at line 183 of file ivy.h.

◆ IVY_MIN

#define IVY_MIN ( a,
b )
Value:
(((a) < (b))? (a) : (b))

MACRO DEFINITIONS ///.

Definition at line 182 of file ivy.h.

◆ Ivy_ObjForEachFanout

#define Ivy_ObjForEachFanout ( p,
pObj,
vArray,
pFanout,
i )
Value:
for ( i = 0, Ivy_ObjCollectFanouts(p, pObj, vArray); \
i < Vec_PtrSize(vArray) && ((pFanout) = (Ivy_Obj_t *)Vec_PtrEntry(vArray,i)); i++ )
void Ivy_ObjCollectFanouts(Ivy_Man_t *p, Ivy_Obj_t *pObj, Vec_Ptr_t *vArray)
Definition ivyFanout.c:262

Definition at line 411 of file ivy.h.

411#define Ivy_ObjForEachFanout( p, pObj, vArray, pFanout, i ) \
412 for ( i = 0, Ivy_ObjCollectFanouts(p, pObj, vArray); \
413 i < Vec_PtrSize(vArray) && ((pFanout) = (Ivy_Obj_t *)Vec_PtrEntry(vArray,i)); i++ )

Typedef Documentation

◆ Ivy_Cut_t

typedef struct Ivy_Cut_t_ Ivy_Cut_t

Definition at line 155 of file ivy.h.

◆ Ivy_Edge_t

typedef int Ivy_Edge_t

Definition at line 48 of file ivy.h.

◆ Ivy_FraigParams_t

Definition at line 49 of file ivy.h.

◆ Ivy_Man_t

typedef typedefABC_NAMESPACE_HEADER_START struct Ivy_Man_t_ Ivy_Man_t

INCLUDES ///.

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

FileName [ivy.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [And-Inverter Graph package.]

Synopsis [External declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - May 11, 2006.]

Revision [

Id
ivy.c,v 1.00 2006/05/11 00:00:00 alanmi Exp

] PARAMETERS /// BASIC TYPES ///

Definition at line 46 of file ivy.h.

◆ Ivy_Obj_t

typedef struct Ivy_Obj_t_ Ivy_Obj_t

Definition at line 47 of file ivy.h.

◆ Ivy_Store_t

typedef struct Ivy_Store_t_ Ivy_Store_t

Definition at line 165 of file ivy.h.

Enumeration Type Documentation

◆ Ivy_Init_t

enum Ivy_Init_t
Enumerator
IVY_INIT_NONE 
IVY_INIT_0 
IVY_INIT_1 
IVY_INIT_DC 

Definition at line 65 of file ivy.h.

65 {
66 IVY_INIT_NONE, // 0: not a latch
67 IVY_INIT_0, // 1: zero
68 IVY_INIT_1, // 2: one
69 IVY_INIT_DC // 3: don't-care
Ivy_Init_t
Definition ivy.h:65
@ IVY_INIT_0
Definition ivy.h:67
@ IVY_INIT_1
Definition ivy.h:68
@ IVY_INIT_DC
Definition ivy.h:69
@ IVY_INIT_NONE
Definition ivy.h:66

◆ Ivy_Type_t

enum Ivy_Type_t
Enumerator
IVY_NONE 
IVY_PI 
IVY_PO 
IVY_ASSERT 
IVY_LATCH 
IVY_AND 
IVY_EXOR 
IVY_BUF 
IVY_VOID 

Definition at line 52 of file ivy.h.

52 {
53 IVY_NONE, // 0: non-existent object
54 IVY_PI, // 1: primary input (and constant 1 node)
55 IVY_PO, // 2: primary output
56 IVY_ASSERT, // 3: assertion
57 IVY_LATCH, // 4: sequential element
58 IVY_AND, // 5: AND node
59 IVY_EXOR, // 6: EXOR node
60 IVY_BUF, // 7: buffer (temporary)
61 IVY_VOID // 8: unused object
Ivy_Type_t
Definition ivy.h:52
@ IVY_AND
Definition ivy.h:58
@ IVY_ASSERT
Definition ivy.h:56
@ IVY_LATCH
Definition ivy.h:57
@ IVY_PO
Definition ivy.h:55
@ IVY_BUF
Definition ivy.h:60
@ IVY_VOID
Definition ivy.h:61
@ IVY_PI
Definition ivy.h:54
@ IVY_NONE
Definition ivy.h:53
@ IVY_EXOR
Definition ivy.h:59

Function Documentation

◆ Ivy_And()

Ivy_Obj_t * Ivy_And ( Ivy_Man_t * p,
Ivy_Obj_t * p0,
Ivy_Obj_t * p1 )
extern

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

Synopsis [Performs canonicization step.]

Description [The argument nodes can be complemented.]

SideEffects []

SeeAlso []

Definition at line 84 of file ivyOper.c.

85{
86// Ivy_Obj_t * pFan0, * pFan1;
87 // check trivial cases
88 if ( p0 == p1 )
89 return p0;
90 if ( p0 == Ivy_Not(p1) )
91 return Ivy_Not(p->pConst1);
92 if ( Ivy_Regular(p0) == p->pConst1 )
93 return p0 == p->pConst1 ? p1 : Ivy_Not(p->pConst1);
94 if ( Ivy_Regular(p1) == p->pConst1 )
95 return p1 == p->pConst1 ? p0 : Ivy_Not(p->pConst1);
96 // check if it can be an EXOR gate
97// if ( Ivy_ObjIsExorType( p0, p1, &pFan0, &pFan1 ) )
98// return Ivy_CanonExor( pFan0, pFan1 );
99 return Ivy_CanonAnd( p, p0, p1 );
100}
Ivy_Obj_t * Ivy_CanonAnd(Ivy_Man_t *p, Ivy_Obj_t *p0, Ivy_Obj_t *p1)
Definition ivyCanon.c:90
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_CanonAnd()

Ivy_Obj_t * Ivy_CanonAnd ( Ivy_Man_t * p,
Ivy_Obj_t * pObj0,
Ivy_Obj_t * pObj1 )
extern

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

Synopsis [Creates the canonical form of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 90 of file ivyCanon.c.

91{
92 Ivy_Obj_t * pGhost, * pResult;
93 pGhost = Ivy_ObjCreateGhost( p, pObj0, pObj1, IVY_AND, IVY_INIT_NONE );
94 pResult = Ivy_CanonPair_rec( p, pGhost );
95 return pResult;
96}
Ivy_Obj_t * Ivy_CanonPair_rec(Ivy_Man_t *p, Ivy_Obj_t *pGhost)
FUNCTION DEFINITIONS ///.
Definition ivyCanon.c:47
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_CanonExor()

Ivy_Obj_t * Ivy_CanonExor ( Ivy_Man_t * p,
Ivy_Obj_t * pObj0,
Ivy_Obj_t * pObj1 )
extern

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

Synopsis [Creates the canonical form of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 109 of file ivyCanon.c.

110{
111 Ivy_Obj_t * pGhost, * pResult;
112 int fCompl = Ivy_IsComplement(pObj0) ^ Ivy_IsComplement(pObj1);
113 pObj0 = Ivy_Regular(pObj0);
114 pObj1 = Ivy_Regular(pObj1);
115 pGhost = Ivy_ObjCreateGhost( p, pObj0, pObj1, IVY_EXOR, IVY_INIT_NONE );
116 pResult = Ivy_CanonPair_rec( p, pGhost );
117 return Ivy_NotCond( pResult, fCompl );
118}
Here is the call graph for this function:

◆ Ivy_CanonLatch()

Ivy_Obj_t * Ivy_CanonLatch ( Ivy_Man_t * p,
Ivy_Obj_t * pObj,
Ivy_Init_t Init )
extern

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

Synopsis [Creates the canonical form of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 131 of file ivyCanon.c.

132{
133 Ivy_Obj_t * pGhost, * pResult;
134 int fCompl = Ivy_IsComplement(pObj);
135 pObj = Ivy_Regular(pObj);
136 pGhost = Ivy_ObjCreateGhost( p, pObj, NULL, IVY_LATCH, Ivy_InitNotCond(Init, fCompl) );
137 pResult = Ivy_TableLookup( p, pGhost );
138 if ( pResult == NULL )
139 pResult = Ivy_ObjCreate( p, pGhost );
140 return Ivy_NotCond( pResult, fCompl );
141}
Ivy_Obj_t * Ivy_TableLookup(Ivy_Man_t *p, Ivy_Obj_t *pObj)
FUNCTION DEFINITIONS ///.
Definition ivyTable.c:71
Ivy_Obj_t * Ivy_ObjCreate(Ivy_Man_t *p, Ivy_Obj_t *pGhost)
Definition ivyObj.c:77
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_CutTruthPrint()

int Ivy_CutTruthPrint ( Ivy_Man_t * p,
Ivy_Cut_t * pCut,
unsigned uTruth )
extern

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

Synopsis [Performs incremental rewriting of the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 771 of file ivyUtil.c.

772{
773 Vec_Ptr_t * vArray;
774 Ivy_Obj_t * pObj, * pFanout;
775 int nLatches = 0;
776 int nPresent = 0;
777 int i, k;
778 int fVerbose = 0;
779
780 if ( fVerbose )
781 printf( "Trying cut : {" );
782 for ( i = 0; i < pCut->nSize; i++ )
783 {
784 if ( fVerbose )
785 printf( " %6d(%d)", Ivy_LeafId(pCut->pArray[i]), Ivy_LeafLat(pCut->pArray[i]) );
786 nLatches += Ivy_LeafLat(pCut->pArray[i]);
787 }
788 if ( fVerbose )
789 printf( " } " );
790 if ( fVerbose )
791 printf( "Latches = %d. ", nLatches );
792
793 // check if there are latches on the fanout edges
794 vArray = Vec_PtrAlloc( 100 );
795 for ( i = 0; i < pCut->nSize; i++ )
796 {
797 pObj = Ivy_ManObj( p, Ivy_LeafId(pCut->pArray[i]) );
798 Ivy_ObjForEachFanout( p, pObj, vArray, pFanout, k )
799 {
800 if ( Ivy_ObjIsLatch(pFanout) )
801 {
802 nPresent++;
803 break;
804 }
805 }
806 }
807 Vec_PtrSize( vArray );
808 if ( fVerbose )
809 {
810 printf( "Present = %d. ", nPresent );
811 if ( nLatches > nPresent )
812 printf( "Clauses = %d. ", 2*(nLatches - nPresent) );
813 printf( "\n" );
814 }
815 return ( nLatches > nPresent ) ? 2*(nLatches - nPresent) : 0;
816}
#define Ivy_ObjForEachFanout(p, pObj, vArray, pFanout, i)
Definition ivy.h:411
short nSize
Definition ivy.h:159
int pArray[IVY_CUT_INPUT]
Definition ivy.h:161
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42

◆ Ivy_Exor()

Ivy_Obj_t * Ivy_Exor ( Ivy_Man_t * p,
Ivy_Obj_t * p0,
Ivy_Obj_t * p1 )
extern

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

Synopsis [Performs canonicization step.]

Description [The argument nodes can be complemented.]

SideEffects []

SeeAlso []

Definition at line 113 of file ivyOper.c.

114{
115/*
116 // check trivial cases
117 if ( p0 == p1 )
118 return Ivy_Not(p->pConst1);
119 if ( p0 == Ivy_Not(p1) )
120 return p->pConst1;
121 if ( Ivy_Regular(p0) == p->pConst1 )
122 return Ivy_NotCond( p1, p0 == p->pConst1 );
123 if ( Ivy_Regular(p1) == p->pConst1 )
124 return Ivy_NotCond( p0, p1 == p->pConst1 );
125 // check the table
126 return Ivy_CanonExor( p, p0, p1 );
127*/
128 return Ivy_Or( p, Ivy_And(p, p0, Ivy_Not(p1)), Ivy_And(p, Ivy_Not(p0), p1) );
129}
Ivy_Obj_t * Ivy_Or(Ivy_Man_t *p, Ivy_Obj_t *p0, Ivy_Obj_t *p1)
Definition ivyOper.c:142
Ivy_Obj_t * Ivy_And(Ivy_Man_t *p, Ivy_Obj_t *p0, Ivy_Obj_t *p1)
Definition ivyOper.c:84
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_FastMapPerform()

void Ivy_FastMapPerform ( Ivy_Man_t * pAig,
int nLimit,
int fRecovery,
int fVerbose )
extern

FUNCTION DEFINITIONS ///.

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

Synopsis [Performs fast K-LUT mapping of the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 105 of file ivyFastMap.c.

106{
107 Ivy_SuppMan_t * pMan;
108 Ivy_Obj_t * pObj;
109 int i, Delay, Area;
110 abctime clk, clkTotal = Abc_Clock();
111 // start the memory for supports
112 pMan = ABC_ALLOC( Ivy_SuppMan_t, 1 );
113 memset( pMan, 0, sizeof(Ivy_SuppMan_t) );
114 pMan->nLimit = nLimit;
115 pMan->nObjs = Ivy_ManObjIdMax(pAig) + 1;
116 pMan->nSize = sizeof(Ivy_Supp_t) + nLimit * sizeof(int);
117 pMan->pMem = (char *)ABC_ALLOC( char, pMan->nObjs * pMan->nSize );
118 memset( pMan->pMem, 0, pMan->nObjs * pMan->nSize );
119 pMan->vLuts = Vec_VecAlloc( 100 );
120 pAig->pData = pMan;
121clk = Abc_Clock();
122 // set the PI mapping
123 Ivy_ObjSuppStart( pAig, Ivy_ManConst1(pAig) );
124 Ivy_ManForEachPi( pAig, pObj, i )
125 Ivy_ObjSuppStart( pAig, pObj );
126 // iterate through all nodes in the topological order
127 Ivy_ManForEachNode( pAig, pObj, i )
128 Ivy_FastMapNode( pAig, pObj, nLimit );
129 // find the best arrival time and area
130 Delay = Ivy_FastMapDelay( pAig );
131 Area = Ivy_FastMapArea(pAig);
132 if ( fVerbose )
133 Ivy_FastMapPrint( pAig, Delay, Area, Abc_Clock() - clk, "Delay oriented mapping: " );
134
135// 2-1-2 (doing 2-1-2-1-2 improves 0.5%)
136
137 if ( fRecovery )
138 {
139clk = Abc_Clock();
140 Ivy_FastMapRequired( pAig, Delay, 0 );
141 // remap the nodes
142 Ivy_FastMapRecover( pAig, nLimit );
143 Delay = Ivy_FastMapDelay( pAig );
144 Area = Ivy_FastMapArea(pAig);
145 if ( fVerbose )
146 Ivy_FastMapPrint( pAig, Delay, Area, Abc_Clock() - clk, "Area recovery 2 : " );
147
148clk = Abc_Clock();
149 Ivy_FastMapRequired( pAig, Delay, 0 );
150 // iterate through all nodes in the topological order
151 Ivy_ManForEachNode( pAig, pObj, i )
152 Ivy_FastMapNodeArea( pAig, pObj, nLimit );
153 Delay = Ivy_FastMapDelay( pAig );
154 Area = Ivy_FastMapArea(pAig);
155 if ( fVerbose )
156 Ivy_FastMapPrint( pAig, Delay, Area, Abc_Clock() - clk, "Area recovery 1 : " );
157
158clk = Abc_Clock();
159 Ivy_FastMapRequired( pAig, Delay, 0 );
160 // remap the nodes
161 Ivy_FastMapRecover( pAig, nLimit );
162 Delay = Ivy_FastMapDelay( pAig );
163 Area = Ivy_FastMapArea(pAig);
164 if ( fVerbose )
165 Ivy_FastMapPrint( pAig, Delay, Area, Abc_Clock() - clk, "Area recovery 2 : " );
166 }
167
168
169 s_MappingTime = Abc_Clock() - clkTotal;
170 s_MappingMem = pMan->nObjs * pMan->nSize;
171/*
172 {
173 Vec_Ptr_t * vNodes;
174 vNodes = Vec_PtrAlloc( 100 );
175 Vec_VecForEachEntry( Ivy_Obj_t *, pMan->vLuts, pObj, i, k )
176 Vec_PtrPush( vNodes, pObj );
177 Ivy_ManShow( pAig, 0, vNodes );
178 Vec_PtrFree( vNodes );
179 }
180*/
181}
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
abctime s_MappingTime
DECLARATIONS ///.
Definition abcPrint.c:47
int s_MappingMem
Definition abcPrint.c:48
struct Ivy_SuppMan_t_ Ivy_SuppMan_t
Definition ivyFastMap.c:32
struct Ivy_Supp_t_ Ivy_Supp_t
Definition ivyFastMap.c:42
#define Ivy_ManForEachNode(p, pObj, i)
Definition ivy.h:402
#define Ivy_ManForEachPi(p, pObj, i)
ITERATORS ///.
Definition ivy.h:387
Vec_Vec_t * vLuts
Definition ivyFastMap.c:39
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_FastMapReadSupp()

void Ivy_FastMapReadSupp ( Ivy_Man_t * pAig,
Ivy_Obj_t * pObj,
Vec_Int_t * vLeaves )
extern

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

Synopsis [Creates integer vector with the support of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 793 of file ivyFastMap.c.

794{
795 Ivy_Supp_t * pSupp;
796 pSupp = Ivy_ObjSupp( pAig, pObj );
797 vLeaves->nCap = 8;
798 vLeaves->nSize = pSupp->nSize;
799 vLeaves->pArray = pSupp->pArray;
800}
int pArray[0]
Definition ivyFastMap.c:52

◆ Ivy_FastMapReverseLevel()

void Ivy_FastMapReverseLevel ( Ivy_Man_t * pAig)
extern

◆ Ivy_FastMapStop()

void Ivy_FastMapStop ( Ivy_Man_t * pAig)
extern

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

Synopsis [Cleans memory used for decomposition.]

Description []

SideEffects []

SeeAlso []

Definition at line 194 of file ivyFastMap.c.

195{
196 Ivy_SuppMan_t * p = (Ivy_SuppMan_t *)pAig->pData;
197 Vec_VecFree( p->vLuts );
198 ABC_FREE( p->pMem );
199 ABC_FREE( p );
200 pAig->pData = NULL;
201}
#define ABC_FREE(obj)
Definition abc_global.h:267
Here is the caller graph for this function:

◆ Ivy_FraigMiter()

Ivy_Man_t * Ivy_FraigMiter ( Ivy_Man_t * pManAig,
Ivy_FraigParams_t * pParams )
extern

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

Synopsis [Applies brute-force SAT to the miter.]

Description []

SideEffects []

SeeAlso []

Definition at line 480 of file ivyFraig.c.

481{
483 Ivy_Man_t * pManAigNew;
484 Ivy_Obj_t * pObj;
485 int i;
486 abctime clk;
487clk = Abc_Clock();
488 assert( Ivy_ManLatchNum(pManAig) == 0 );
489 p = Ivy_FraigStartSimple( pManAig, pParams );
490 // set global limits
491 p->nBTLimitGlobal = s_nBTLimitGlobal;
492 p->nInsLimitGlobal = s_nInsLimitGlobal;
493 // duplicate internal nodes
494 Ivy_ManForEachNode( p->pManAig, pObj, i )
495 pObj->pEquiv = Ivy_And( p->pManFraig, Ivy_ObjChild0Equiv(pObj), Ivy_ObjChild1Equiv(pObj) );
496 // try to prove each output of the miter
497 Ivy_FraigMiterProve( p );
498 // add the POs
499 Ivy_ManForEachPo( p->pManAig, pObj, i )
500 Ivy_ObjCreatePo( p->pManFraig, Ivy_ObjChild0Equiv(pObj) );
501 // clean the new manager
502 Ivy_ManForEachObj( p->pManFraig, pObj, i )
503 {
504 if ( Ivy_ObjFaninVec(pObj) )
505 Vec_PtrFree( Ivy_ObjFaninVec(pObj) );
506 pObj->pNextFan0 = pObj->pNextFan1 = NULL;
507 }
508 // remove dangling nodes
509 Ivy_ManCleanup( p->pManFraig );
510 pManAigNew = p->pManFraig;
511p->timeTotal = Abc_Clock() - clk;
512
513//printf( "Final nodes = %6d. ", Ivy_ManNodeNum(pManAigNew) );
514//ABC_PRT( "Time", p->timeTotal );
515 Ivy_FraigStop( p );
516 return pManAigNew;
517}
typedefABC_NAMESPACE_IMPL_START struct Ivy_FraigMan_t_ Ivy_FraigMan_t
DECLARATIONS ///.
Definition ivyFraig.c:33
typedefABC_NAMESPACE_HEADER_START struct Ivy_Man_t_ Ivy_Man_t
INCLUDES ///.
Definition ivy.h:46
int Ivy_ManCleanup(Ivy_Man_t *p)
Definition ivyMan.c:265
Ivy_Obj_t * Ivy_ObjCreatePo(Ivy_Man_t *p, Ivy_Obj_t *pDriver)
Definition ivyObj.c:61
#define Ivy_ManForEachPo(p, pObj, i)
Definition ivy.h:390
Ivy_Obj_t * Ivy_And(Ivy_Man_t *p, Ivy_Obj_t *p0, Ivy_Obj_t *p1)
Definition ivyOper.c:84
Ivy_Obj_t * pNextFan1
Definition ivy.h:90
Ivy_Obj_t * pEquiv
Definition ivy.h:93
Ivy_Obj_t * pNextFan0
Definition ivy.h:89
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_FraigParamsDefault()

void Ivy_FraigParamsDefault ( Ivy_FraigParams_t * pParams)
extern

FUNCTION DEFINITIONS ///.

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

Synopsis [Sets the default solving parameters.]

Description []

SideEffects []

SeeAlso []

Definition at line 225 of file ivyFraig.c.

226{
227 memset( pParams, 0, sizeof(Ivy_FraigParams_t) );
228 pParams->nSimWords = 32; // the number of words in the simulation info
229 pParams->dSimSatur = 0.005; // the ratio of refined classes when saturation is reached
230 pParams->fPatScores = 0; // enables simulation pattern scoring
231 pParams->MaxScore = 25; // max score after which resimulation is used
232 pParams->fDoSparse = 1; // skips sparse functions
233// pParams->dActConeRatio = 0.05; // the ratio of cone to be bumped
234// pParams->dActConeBumpMax = 5.0; // the largest bump of activity
235 pParams->dActConeRatio = 0.3; // the ratio of cone to be bumped
236 pParams->dActConeBumpMax = 10.0; // the largest bump of activity
237
238 pParams->nBTLimitNode = 100; // conflict limit at a node
239 pParams->nBTLimitMiter = 500000; // conflict limit at an output
240// pParams->nBTLimitGlobal = 0; // conflict limit global
241// pParams->nInsLimitGlobal = 0; // inspection limit global
242}
struct Ivy_FraigParams_t_ Ivy_FraigParams_t
Definition ivy.h:49
double dActConeBumpMax
Definition ivy.h:139
double dActConeRatio
Definition ivy.h:138
double dSimSatur
Definition ivy.h:135
int nBTLimitMiter
Definition ivy.h:144
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_FraigPerform()

Ivy_Man_t * Ivy_FraigPerform ( Ivy_Man_t * pManAig,
Ivy_FraigParams_t * pParams )
extern

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

Synopsis [Performs fraiging of the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 451 of file ivyFraig.c.

452{
454 Ivy_Man_t * pManAigNew;
455 abctime clk;
456 if ( Ivy_ManNodeNum(pManAig) == 0 )
457 return Ivy_ManDup(pManAig);
458clk = Abc_Clock();
459 assert( Ivy_ManLatchNum(pManAig) == 0 );
460 p = Ivy_FraigStart( pManAig, pParams );
461 Ivy_FraigSimulate( p );
462 Ivy_FraigSweep( p );
463 pManAigNew = p->pManFraig;
464p->timeTotal = Abc_Clock() - clk;
465 Ivy_FraigStop( p );
466 return pManAigNew;
467}
Ivy_Man_t * Ivy_ManDup(Ivy_Man_t *p)
Definition ivyMan.c:110
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_FraigProve()

int Ivy_FraigProve ( Ivy_Man_t ** ppManAig,
void * pPars )
extern

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

Synopsis [Performs combinational equivalence checking for the miter.]

Description []

SideEffects []

SeeAlso []

Definition at line 255 of file ivyFraig.c.

256{
257 Prove_Params_t * pParams = (Prove_Params_t *)pPars;
258 Ivy_FraigParams_t Params, * pIvyParams = &Params;
259 Ivy_Man_t * pManAig, * pManTemp;
260 int RetValue, nIter;
261 abctime clk;//, Counter;
262 ABC_INT64_T nSatConfs = 0, nSatInspects = 0;
263
264 // start the network and parameters
265 pManAig = *ppManAig;
266 Ivy_FraigParamsDefault( pIvyParams );
267 pIvyParams->fVerbose = pParams->fVerbose;
268 pIvyParams->fProve = 1;
269
270 if ( pParams->fVerbose )
271 {
272 printf( "RESOURCE LIMITS: Iterations = %d. Rewriting = %s. Fraiging = %s.\n",
273 pParams->nItersMax, pParams->fUseRewriting? "yes":"no", pParams->fUseFraiging? "yes":"no" );
274 printf( "Miter = %d (%3.1f). Rwr = %d (%3.1f). Fraig = %d (%3.1f). Last = %d.\n",
275 pParams->nMiteringLimitStart, pParams->nMiteringLimitMulti,
277 pParams->nFraigingLimitStart, pParams->nFraigingLimitMulti, pParams->nMiteringLimitLast );
278 }
279
280 // if SAT only, solve without iteration
281 if ( !pParams->fUseRewriting && !pParams->fUseFraiging )
282 {
283 clk = Abc_Clock();
284 pIvyParams->nBTLimitMiter = pParams->nMiteringLimitLast / Ivy_ManPoNum(pManAig);
285 pManAig = Ivy_FraigMiter( pManTemp = pManAig, pIvyParams ); Ivy_ManStop( pManTemp );
286 RetValue = Ivy_FraigMiterStatus( pManAig );
287 Ivy_FraigMiterPrint( pManAig, "SAT solving", clk, pParams->fVerbose );
288 *ppManAig = pManAig;
289 return RetValue;
290 }
291
292 if ( Ivy_ManNodeNum(pManAig) < 500 )
293 {
294 // run the first mitering
295 clk = Abc_Clock();
296 pIvyParams->nBTLimitMiter = pParams->nMiteringLimitStart / Ivy_ManPoNum(pManAig);
297 pManAig = Ivy_FraigMiter( pManTemp = pManAig, pIvyParams ); Ivy_ManStop( pManTemp );
298 RetValue = Ivy_FraigMiterStatus( pManAig );
299 Ivy_FraigMiterPrint( pManAig, "SAT solving", clk, pParams->fVerbose );
300 if ( RetValue >= 0 )
301 {
302 *ppManAig = pManAig;
303 return RetValue;
304 }
305 }
306
307 // check the current resource limits
308 RetValue = -1;
309 for ( nIter = 0; nIter < pParams->nItersMax; nIter++ )
310 {
311 if ( pParams->fVerbose )
312 {
313 printf( "ITERATION %2d : Confs = %6d. FraigBTL = %3d. \n", nIter+1,
314 (int)(pParams->nMiteringLimitStart * pow(pParams->nMiteringLimitMulti,nIter)),
315 (int)(pParams->nFraigingLimitStart * pow(pParams->nFraigingLimitMulti,nIter)) );
316 fflush( stdout );
317 }
318
319 // try rewriting
320 if ( pParams->fUseRewriting )
321 { // bug in Ivy_NodeFindCutsAll() when leaves are identical!
322/*
323 clk = Abc_Clock();
324 Counter = (int)(pParams->nRewritingLimitStart * pow(pParams->nRewritingLimitMulti,nIter));
325 pManAig = Ivy_ManRwsat( pManAig, 0 );
326 RetValue = Ivy_FraigMiterStatus( pManAig );
327 Ivy_FraigMiterPrint( pManAig, "Rewriting ", clk, pParams->fVerbose );
328*/
329 }
330 if ( RetValue >= 0 )
331 break;
332
333 // catch the situation when ref pattern detects the bug
334 RetValue = Ivy_FraigMiterStatus( pManAig );
335 if ( RetValue >= 0 )
336 break;
337
338 // try fraiging followed by mitering
339 if ( pParams->fUseFraiging )
340 {
341 clk = Abc_Clock();
342 pIvyParams->nBTLimitNode = (int)(pParams->nFraigingLimitStart * pow(pParams->nFraigingLimitMulti,nIter));
343 pIvyParams->nBTLimitMiter = 1 + (int)(pParams->nMiteringLimitStart * pow(pParams->nMiteringLimitMulti,nIter)) / Ivy_ManPoNum(pManAig);
344 pManAig = Ivy_FraigPerform_int( pManTemp = pManAig, pIvyParams, pParams->nTotalBacktrackLimit, pParams->nTotalInspectLimit, &nSatConfs, &nSatInspects ); Ivy_ManStop( pManTemp );
345 RetValue = Ivy_FraigMiterStatus( pManAig );
346 Ivy_FraigMiterPrint( pManAig, "Fraiging ", clk, pParams->fVerbose );
347 }
348 if ( RetValue >= 0 )
349 break;
350
351 // add to the number of backtracks and inspects
352 pParams->nTotalBacktracksMade += nSatConfs;
353 pParams->nTotalInspectsMade += nSatInspects;
354 // check if global resource limit is reached
355 if ( (pParams->nTotalBacktrackLimit && pParams->nTotalBacktracksMade >= pParams->nTotalBacktrackLimit) ||
356 (pParams->nTotalInspectLimit && pParams->nTotalInspectsMade >= pParams->nTotalInspectLimit) )
357 {
358 printf( "Reached global limit on conflicts/inspects. Quitting.\n" );
359 *ppManAig = pManAig;
360 return -1;
361 }
362 }
363/*
364 if ( RetValue < 0 )
365 {
366 if ( pParams->fVerbose )
367 {
368 printf( "Attempting SAT with conflict limit %d ...\n", pParams->nMiteringLimitLast );
369 fflush( stdout );
370 }
371 clk = Abc_Clock();
372 pIvyParams->nBTLimitMiter = pParams->nMiteringLimitLast / Ivy_ManPoNum(pManAig);
373 if ( pParams->nTotalBacktrackLimit )
374 s_nBTLimitGlobal = pParams->nTotalBacktrackLimit - pParams->nTotalBacktracksMade;
375 if ( pParams->nTotalInspectLimit )
376 s_nInsLimitGlobal = pParams->nTotalInspectLimit - pParams->nTotalInspectsMade;
377 pManAig = Ivy_FraigMiter( pManTemp = pManAig, pIvyParams ); Ivy_ManStop( pManTemp );
378 s_nBTLimitGlobal = 0;
379 s_nInsLimitGlobal = 0;
380 RetValue = Ivy_FraigMiterStatus( pManAig );
381 Ivy_FraigMiterPrint( pManAig, "SAT solving", clk, pParams->fVerbose );
382 // make sure that the sover never returns "undecided" when infinite resource limits are set
383 if( RetValue == -1 && pParams->nTotalInspectLimit == 0 &&
384 pParams->nTotalBacktrackLimit == 0 )
385 {
386 extern void Prove_ParamsPrint( Prove_Params_t * pParams );
387 Prove_ParamsPrint( pParams );
388 printf("ERROR: ABC has returned \"undecided\" in spite of no limits...\n");
389 exit(1);
390 }
391 }
392*/
393 // assign the model if it was proved by rewriting (const 1 miter)
394 if ( RetValue == 0 && pManAig->pData == NULL )
395 {
396 pManAig->pData = ABC_ALLOC( int, Ivy_ManPiNum(pManAig) );
397 memset( pManAig->pData, 0, sizeof(int) * Ivy_ManPiNum(pManAig) );
398 }
399 *ppManAig = pManAig;
400 return RetValue;
401}
struct Prove_ParamsStruct_t_ Prove_Params_t
Definition ivyFraig.c:108
void Ivy_FraigParamsDefault(Ivy_FraigParams_t *pParams)
FUNCTION DEFINITIONS ///.
Definition ivyFraig.c:225
Ivy_Man_t * Ivy_FraigMiter(Ivy_Man_t *pManAig, Ivy_FraigParams_t *pParams)
Definition ivyFraig.c:480
void Ivy_ManStop(Ivy_Man_t *p)
Definition ivyMan.c:238
ABC_INT64_T nTotalBacktracksMade
Definition ivyFraig.c:136
ABC_INT64_T nTotalInspectsMade
Definition ivyFraig.c:137
ABC_INT64_T nTotalBacktrackLimit
Definition ivyFraig.c:133
ABC_INT64_T nTotalInspectLimit
Definition ivyFraig.c:134
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_Latch()

Ivy_Obj_t * Ivy_Latch ( Ivy_Man_t * p,
Ivy_Obj_t * pObj,
Ivy_Init_t Init )
extern

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

Synopsis [Performs canonicization step.]

Description []

SideEffects []

SeeAlso []

Definition at line 287 of file ivyOper.c.

288{
289 return Ivy_CanonLatch( p, pObj, Init );
290}
Ivy_Obj_t * Ivy_CanonLatch(Ivy_Man_t *p, Ivy_Obj_t *pObj, Ivy_Init_t Init)
Definition ivyCanon.c:131
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_Maj()

Ivy_Obj_t * Ivy_Maj ( Ivy_Man_t * p,
Ivy_Obj_t * pA,
Ivy_Obj_t * pB,
Ivy_Obj_t * pC )
extern

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

Synopsis [Implements ITE operation.]

Description []

SideEffects []

SeeAlso []

Definition at line 209 of file ivyOper.c.

210{
211 return Ivy_Or( p, Ivy_Or(p, Ivy_And(p, pA, pB), Ivy_And(p, pA, pC)), Ivy_And(p, pB, pC) );
212}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ManAddMemory()

void Ivy_ManAddMemory ( Ivy_Man_t * p)
extern

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

Synopsis [Allocates additional memory for the nodes.]

Description [Allocates IVY_PAGE_SIZE nodes. Aligns memory by 32 bytes. Records the pointer to the AIG manager in the -1 entry.]

SideEffects []

SeeAlso []

Definition at line 89 of file ivyMem.c.

90{
91 char * pMemory;
92 int i, nBytes;
93 int EntrySizeMax = 128;
94 assert( sizeof(Ivy_Obj_t) <= EntrySizeMax );
95 assert( p->pListFree == NULL );
96// assert( (Ivy_ManObjNum(p) & IVY_PAGE_MASK) == 0 );
97 // allocate new memory page
98 nBytes = sizeof(Ivy_Obj_t) * (1<<IVY_PAGE_SIZE) + EntrySizeMax;
99 pMemory = ABC_ALLOC( char, nBytes );
100 Vec_PtrPush( p->vChunks, pMemory );
101 // align memory at the 32-byte boundary
102 pMemory = pMemory + EntrySizeMax - (((int)(ABC_PTRUINT_T)pMemory) & (EntrySizeMax-1));
103 // remember the manager in the first entry
104 Vec_PtrPush( p->vPages, pMemory );
105 // break the memory down into nodes
106 p->pListFree = (Ivy_Obj_t *)pMemory;
107 for ( i = 1; i <= IVY_PAGE_MASK; i++ )
108 {
109 *((char **)pMemory) = pMemory + sizeof(Ivy_Obj_t);
110 pMemory += sizeof(Ivy_Obj_t);
111 }
112 *((char **)pMemory) = NULL;
113}
#define IVY_PAGE_SIZE
DECLARATIONS ///.
Definition hopMem.c:31
#define IVY_PAGE_MASK
Definition hopMem.c:32

◆ Ivy_ManBalance()

Ivy_Man_t * Ivy_ManBalance ( Ivy_Man_t * p,
int fUpdateLevel )
extern

FUNCTION DECLARATIONS ///.

FUNCTION DECLARATIONS ///.

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

Synopsis [Performs algebraic balancing of the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 51 of file ivyBalance.c.

52{
53 Ivy_Man_t * pNew;
54 Ivy_Obj_t * pObj, * pDriver;
55 Vec_Vec_t * vStore;
56 int i, NewNodeId;
57 // clean the old manager
59 // create the new manager
60 pNew = Ivy_ManStart();
61 // map the nodes
62 Ivy_ManConst1(p)->TravId = Ivy_EdgeFromNode( Ivy_ManConst1(pNew) );
63 Ivy_ManForEachPi( p, pObj, i )
64 pObj->TravId = Ivy_EdgeFromNode( Ivy_ObjCreatePi(pNew) );
65 // if HAIG is defined, trasfer the pointers to the PIs/latches
66// if ( p->pHaig )
67// Ivy_ManHaigTrasfer( p, pNew );
68 // balance the AIG
69 vStore = Vec_VecAlloc( 50 );
70 Ivy_ManForEachPo( p, pObj, i )
71 {
72 pDriver = Ivy_ObjReal( Ivy_ObjChild0(pObj) );
73 NewNodeId = Ivy_NodeBalance_rec( pNew, Ivy_Regular(pDriver), vStore, 0, fUpdateLevel );
74 NewNodeId = Ivy_EdgeNotCond( NewNodeId, Ivy_IsComplement(pDriver) );
75 Ivy_ObjCreatePo( pNew, Ivy_EdgeToNode(pNew, NewNodeId) );
76 }
77 Vec_VecFree( vStore );
78 if ( (i = Ivy_ManCleanup( pNew )) )
79 {
80// printf( "Cleanup after balancing removed %d dangling nodes.\n", i );
81 }
82 // check the resulting AIG
83 if ( !Ivy_ManCheck(pNew) )
84 printf( "Ivy_ManBalance(): The check has failed.\n" );
85 return pNew;
86}
int Ivy_ManCheck(Ivy_Man_t *p)
DECLARATIONS ///.
Definition ivyCheck.c:45
Ivy_Man_t * Ivy_ManStart()
DECLARATIONS ///.
Definition ivyMan.c:45
Ivy_Obj_t * Ivy_ObjReal(Ivy_Obj_t *pObj)
Definition ivyUtil.c:609
Ivy_Obj_t * Ivy_ObjCreatePi(Ivy_Man_t *p)
DECLARATIONS ///.
Definition ivyObj.c:45
void Ivy_ManCleanTravId(Ivy_Man_t *p)
Definition ivyUtil.c:63
int TravId
Definition ivy.h:76
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition vecVec.h:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ManCheck()

int Ivy_ManCheck ( Ivy_Man_t * p)
extern

DECLARATIONS ///.

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

FileName [ivyCheck.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [And-Inverter Graph package.]

Synopsis [AIG checking procedures.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - May 11, 2006.]

Revision [

Id
ivyCheck.c,v 1.00 2006/05/11 00:00:00 alanmi Exp

] FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Checks the consistency of the AIG manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file ivyCheck.c.

46{
47 Ivy_Obj_t * pObj, * pObj2;
48 int i;
49 Ivy_ManForEachObj( p, pObj, i )
50 {
51 // skip deleted nodes
52 if ( Ivy_ObjId(pObj) != i )
53 {
54 printf( "Ivy_ManCheck: Node with ID %d is listed as number %d in the array of objects.\n", pObj->Id, i );
55 return 0;
56 }
57 // consider the constant node and PIs
58 if ( i == 0 || Ivy_ObjIsPi(pObj) )
59 {
60 if ( Ivy_ObjFaninId0(pObj) || Ivy_ObjFaninId1(pObj) || Ivy_ObjLevel(pObj) )
61 {
62 printf( "Ivy_ManCheck: The AIG has non-standard constant or PI node with ID \"%d\".\n", pObj->Id );
63 return 0;
64 }
65 continue;
66 }
67 if ( Ivy_ObjIsPo(pObj) )
68 {
69 if ( Ivy_ObjFaninId1(pObj) )
70 {
71 printf( "Ivy_ManCheck: The AIG has non-standard PO node with ID \"%d\".\n", pObj->Id );
72 return 0;
73 }
74 continue;
75 }
76 if ( Ivy_ObjIsBuf(pObj) )
77 {
78 if ( Ivy_ObjFanin1(pObj) )
79 {
80 printf( "Ivy_ManCheck: The buffer with ID \"%d\" contains second fanin.\n", pObj->Id );
81 return 0;
82 }
83 continue;
84 }
85 if ( Ivy_ObjIsLatch(pObj) )
86 {
87 if ( Ivy_ObjFanin1(pObj) )
88 {
89 printf( "Ivy_ManCheck: The latch with ID \"%d\" contains second fanin.\n", pObj->Id );
90 return 0;
91 }
92 if ( Ivy_ObjInit(pObj) == IVY_INIT_NONE )
93 {
94 printf( "Ivy_ManCheck: The latch with ID \"%d\" does not have initial state.\n", pObj->Id );
95 return 0;
96 }
97 pObj2 = Ivy_TableLookup( p, pObj );
98 if ( pObj2 != pObj )
99 printf( "Ivy_ManCheck: Latch with ID \"%d\" is not in the structural hashing table.\n", pObj->Id );
100 continue;
101 }
102 // consider the AND node
103 if ( !Ivy_ObjFanin0(pObj) || !Ivy_ObjFanin1(pObj) )
104 {
105 printf( "Ivy_ManCheck: The AIG has internal node \"%d\" with a NULL fanin.\n", pObj->Id );
106 return 0;
107 }
108 if ( Ivy_ObjFaninId0(pObj) >= Ivy_ObjFaninId1(pObj) )
109 {
110 printf( "Ivy_ManCheck: The AIG has node \"%d\" with a wrong ordering of fanins.\n", pObj->Id );
111 return 0;
112 }
113 if ( Ivy_ObjLevel(pObj) != Ivy_ObjLevelNew(pObj) )
114 printf( "Ivy_ManCheck: Node with ID \"%d\" has level %d but should have level %d.\n", pObj->Id, Ivy_ObjLevel(pObj), Ivy_ObjLevelNew(pObj) );
115 pObj2 = Ivy_TableLookup( p, pObj );
116 if ( pObj2 != pObj )
117 printf( "Ivy_ManCheck: Node with ID \"%d\" is not in the structural hashing table.\n", pObj->Id );
118 if ( Ivy_ObjRefs(pObj) == 0 )
119 printf( "Ivy_ManCheck: Node with ID \"%d\" has no fanouts.\n", pObj->Id );
120 // check fanouts
121 if ( p->fFanout && Ivy_ObjRefs(pObj) != Ivy_ObjFanoutNum(p, pObj) )
122 printf( "Ivy_ManCheck: Node with ID \"%d\" has mismatch between the number of fanouts and refs.\n", pObj->Id );
123 }
124 // count the number of nodes in the table
125 if ( Ivy_TableCountEntries(p) != Ivy_ManAndNum(p) + Ivy_ManExorNum(p) + Ivy_ManLatchNum(p) )
126 {
127 printf( "Ivy_ManCheck: The number of nodes in the structural hashing table is wrong.\n" );
128 return 0;
129 }
130// if ( !Ivy_ManCheckFanouts(p) )
131// return 0;
132 if ( !Ivy_ManIsAcyclic(p) )
133 return 0;
134 return 1;
135}
int Ivy_ManIsAcyclic(Ivy_Man_t *p)
Definition ivyDfs.c:373
int Ivy_ObjFanoutNum(Ivy_Man_t *p, Ivy_Obj_t *pObj)
Definition ivyFanout.c:299
int Ivy_TableCountEntries(Ivy_Man_t *p)
Definition ivyTable.c:187
int Id
Definition ivy.h:75
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ManCheckChoices()

int Ivy_ManCheckChoices ( Ivy_Man_t * p)
extern

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

Synopsis [Checks that each choice node has exactly one node with fanouts.]

Description []

SideEffects []

SeeAlso []

Definition at line 255 of file ivyCheck.c.

256{
257 Ivy_Obj_t * pObj, * pTemp;
258 int i;
259 Ivy_ManForEachObj( p->pHaig, pObj, i )
260 {
261 if ( Ivy_ObjRefs(pObj) == 0 )
262 continue;
263 // count the number of nodes in the loop
264 assert( !Ivy_IsComplement(pObj->pEquiv) );
265 for ( pTemp = pObj->pEquiv; pTemp && pTemp != pObj; pTemp = Ivy_Regular(pTemp->pEquiv) )
266 if ( Ivy_ObjRefs(pTemp) > 1 )
267 printf( "Node %d has member %d in its equiv class with %d fanouts.\n", pObj->Id, pTemp->Id, Ivy_ObjRefs(pTemp) );
268 }
269 return 1;
270}
Here is the caller graph for this function:

◆ Ivy_ManCheckFanoutNums()

int Ivy_ManCheckFanoutNums ( Ivy_Man_t * p)
extern

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

Synopsis [Verifies the fanouts.]

Description []

SideEffects []

SeeAlso []

Definition at line 148 of file ivyCheck.c.

149{
150 Ivy_Obj_t * pObj;
151 int i, Counter = 0;
152 Ivy_ManForEachObj( p, pObj, i )
153 if ( Ivy_ObjIsNode(pObj) )
154 Counter += (Ivy_ObjRefs(pObj) == 0);
155 if ( Counter )
156 printf( "Sequential AIG has %d dangling nodes.\n", Counter );
157 return Counter;
158}

◆ Ivy_ManCheckFanouts()

int Ivy_ManCheckFanouts ( Ivy_Man_t * p)
extern

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

Synopsis [Verifies the fanouts.]

Description []

SideEffects []

SeeAlso []

Definition at line 171 of file ivyCheck.c.

172{
173 Vec_Ptr_t * vFanouts;
174 Ivy_Obj_t * pObj, * pFanout, * pFanin;
175 int i, k, RetValue = 1;
176 if ( !p->fFanout )
177 return 1;
178 vFanouts = Vec_PtrAlloc( 100 );
179 // make sure every fanin is a fanout
180 Ivy_ManForEachObj( p, pObj, i )
181 {
182 pFanin = Ivy_ObjFanin0(pObj);
183 if ( pFanin == NULL )
184 continue;
185 Ivy_ObjForEachFanout( p, pFanin, vFanouts, pFanout, k )
186 if ( pFanout == pObj )
187 break;
188 if ( k == Vec_PtrSize(vFanouts) )
189 {
190 printf( "Node %d is a fanin of node %d but the fanout is not there.\n", pFanin->Id, pObj->Id );
191 RetValue = 0;
192 }
193
194 pFanin = Ivy_ObjFanin1(pObj);
195 if ( pFanin == NULL )
196 continue;
197 Ivy_ObjForEachFanout( p, pFanin, vFanouts, pFanout, k )
198 if ( pFanout == pObj )
199 break;
200 if ( k == Vec_PtrSize(vFanouts) )
201 {
202 printf( "Node %d is a fanin of node %d but the fanout is not there.\n", pFanin->Id, pObj->Id );
203 RetValue = 0;
204 }
205 // check that the previous fanout has the same fanin
206 if ( pObj->pPrevFan0 )
207 {
208 if ( Ivy_ObjFanin0(pObj->pPrevFan0) != Ivy_ObjFanin0(pObj) &&
209 Ivy_ObjFanin0(pObj->pPrevFan0) != Ivy_ObjFanin1(pObj) &&
210 Ivy_ObjFanin1(pObj->pPrevFan0) != Ivy_ObjFanin0(pObj) &&
211 Ivy_ObjFanin1(pObj->pPrevFan0) != Ivy_ObjFanin1(pObj) )
212 {
213 printf( "Node %d has prev %d without common fanin.\n", pObj->Id, pObj->pPrevFan0->Id );
214 RetValue = 0;
215 }
216 }
217 // check that the previous fanout has the same fanin
218 if ( pObj->pPrevFan1 )
219 {
220 if ( Ivy_ObjFanin0(pObj->pPrevFan1) != Ivy_ObjFanin0(pObj) &&
221 Ivy_ObjFanin0(pObj->pPrevFan1) != Ivy_ObjFanin1(pObj) &&
222 Ivy_ObjFanin1(pObj->pPrevFan1) != Ivy_ObjFanin0(pObj) &&
223 Ivy_ObjFanin1(pObj->pPrevFan1) != Ivy_ObjFanin1(pObj) )
224 {
225 printf( "Node %d has prev %d without common fanin.\n", pObj->Id, pObj->pPrevFan1->Id );
226 RetValue = 0;
227 }
228 }
229 }
230 // make sure every fanout is a fanin
231 Ivy_ManForEachObj( p, pObj, i )
232 {
233 Ivy_ObjForEachFanout( p, pObj, vFanouts, pFanout, k )
234 if ( Ivy_ObjFanin0(pFanout) != pObj && Ivy_ObjFanin1(pFanout) != pObj )
235 {
236 printf( "Node %d is a fanout of node %d but the fanin is not there.\n", pFanout->Id, pObj->Id );
237 RetValue = 0;
238 }
239 }
240 Vec_PtrFree( vFanouts );
241 return RetValue;
242}
Ivy_Obj_t * pPrevFan0
Definition ivy.h:91
Ivy_Obj_t * pPrevFan1
Definition ivy.h:92

◆ Ivy_ManCleanTravId()

void Ivy_ManCleanTravId ( Ivy_Man_t * p)
extern

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

Synopsis [Sets the DFS ordering of the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 63 of file ivyUtil.c.

64{
65 Ivy_Obj_t * pObj;
66 int i;
67 p->nTravIds = 1;
68 Ivy_ManForEachObj( p, pObj, i )
69 pObj->TravId = 0;
70}
Here is the caller graph for this function:

◆ Ivy_ManCleanup()

int Ivy_ManCleanup ( Ivy_Man_t * p)
extern

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

Synopsis [Removes nodes without fanout.]

Description [Returns the number of dangling nodes removed.]

SideEffects []

SeeAlso []

Definition at line 265 of file ivyMan.c.

266{
267 Ivy_Obj_t * pNode;
268 int i, nNodesOld;
269 nNodesOld = Ivy_ManNodeNum(p);
270 Ivy_ManForEachObj( p, pNode, i )
271 if ( Ivy_ObjIsNode(pNode) || Ivy_ObjIsLatch(pNode) || Ivy_ObjIsBuf(pNode) )
272 if ( Ivy_ObjRefs(pNode) == 0 )
273 Ivy_ObjDelete_rec( p, pNode, 1 );
274//printf( "Cleanup removed %d nodes.\n", nNodesOld - Ivy_ManNodeNum(p) );
275 return nNodesOld - Ivy_ManNodeNum(p);
276}
void Ivy_ObjDelete_rec(Ivy_Man_t *p, Ivy_Obj_t *pObj, int fFreeTop)
Definition ivyObj.c:299
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ManCollectCone()

void Ivy_ManCollectCone ( Ivy_Obj_t * pObj,
Vec_Ptr_t * vFront,
Vec_Ptr_t * vCone )
extern

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

Synopsis [Collects nodes in the cone.]

Description []

SideEffects []

SeeAlso []

Definition at line 195 of file ivyDfs.c.

196{
197 Ivy_Obj_t * pTemp;
198 int i;
199 assert( !Ivy_IsComplement(pObj) );
200 assert( Ivy_ObjIsNode(pObj) );
201 // mark the nodes
202 Vec_PtrForEachEntry( Ivy_Obj_t *, vFront, pTemp, i )
203 Ivy_Regular(pTemp)->fMarkA = 1;
204 assert( pObj->fMarkA == 0 );
205 // collect the cone
206 Vec_PtrClear( vCone );
207 Ivy_ManCollectCone_rec( pObj, vCone );
208 // unmark the nodes
209 Vec_PtrForEachEntry( Ivy_Obj_t *, vFront, pTemp, i )
210 Ivy_Regular(pTemp)->fMarkA = 0;
211}
void Ivy_ManCollectCone_rec(Ivy_Obj_t *pObj, Vec_Ptr_t *vCone)
Definition ivyDfs.c:168
unsigned fMarkA
Definition ivy.h:78
Here is the call graph for this function:

◆ Ivy_ManCollectCut()

void Ivy_ManCollectCut ( Ivy_Man_t * p,
Ivy_Obj_t * pRoot,
Vec_Int_t * vLeaves,
Vec_Int_t * vNodes )
extern

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

Synopsis [Computes truth table of the cut.]

Description [Does not modify the array of leaves. Uses array vTruth to store temporary truth tables. The returned pointer should be used immediately.]

SideEffects []

SeeAlso []

Definition at line 106 of file ivyUtil.c.

107{
108 int i, Leaf;
109 // collect and mark the leaves
110 Vec_IntClear( vNodes );
111 Vec_IntForEachEntry( vLeaves, Leaf, i )
112 {
113 Vec_IntPush( vNodes, Leaf );
114 Ivy_ManObj(p, Leaf)->fMarkA = 1;
115 }
116 // collect and mark the nodes
117 Ivy_ManCollectCut_rec( p, pRoot, vNodes );
118 // clean the nodes
119 Vec_IntForEachEntry( vNodes, Leaf, i )
120 Ivy_ManObj(p, Leaf)->fMarkA = 0;
121}
void Ivy_ManCollectCut_rec(Ivy_Man_t *p, Ivy_Obj_t *pNode, Vec_Int_t *vNodes)
Definition ivyUtil.c:83
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ManCutTruth()

unsigned * Ivy_ManCutTruth ( Ivy_Man_t * p,
Ivy_Obj_t * pRoot,
Vec_Int_t * vLeaves,
Vec_Int_t * vNodes,
Vec_Int_t * vTruth )
extern

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

Synopsis [Computes truth table of the cut.]

Description [Does not modify the array of leaves. Uses array vTruth to store temporary truth tables. The returned pointer should be used immediately.]

SideEffects []

SeeAlso []

Definition at line 186 of file ivyUtil.c.

187{
188 static unsigned uTruths[8][8] = { // elementary truth tables
189 { 0xAAAAAAAA,0xAAAAAAAA,0xAAAAAAAA,0xAAAAAAAA,0xAAAAAAAA,0xAAAAAAAA,0xAAAAAAAA,0xAAAAAAAA },
190 { 0xCCCCCCCC,0xCCCCCCCC,0xCCCCCCCC,0xCCCCCCCC,0xCCCCCCCC,0xCCCCCCCC,0xCCCCCCCC,0xCCCCCCCC },
191 { 0xF0F0F0F0,0xF0F0F0F0,0xF0F0F0F0,0xF0F0F0F0,0xF0F0F0F0,0xF0F0F0F0,0xF0F0F0F0,0xF0F0F0F0 },
192 { 0xFF00FF00,0xFF00FF00,0xFF00FF00,0xFF00FF00,0xFF00FF00,0xFF00FF00,0xFF00FF00,0xFF00FF00 },
193 { 0xFFFF0000,0xFFFF0000,0xFFFF0000,0xFFFF0000,0xFFFF0000,0xFFFF0000,0xFFFF0000,0xFFFF0000 },
194 { 0x00000000,0xFFFFFFFF,0x00000000,0xFFFFFFFF,0x00000000,0xFFFFFFFF,0x00000000,0xFFFFFFFF },
195 { 0x00000000,0x00000000,0xFFFFFFFF,0xFFFFFFFF,0x00000000,0x00000000,0xFFFFFFFF,0xFFFFFFFF },
196 { 0x00000000,0x00000000,0x00000000,0x00000000,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF }
197 };
198 int i, Leaf;
199 // collect the cut
200 Ivy_ManCollectCut( p, pRoot, vLeaves, vNodes );
201 // set the node numbers
202 Vec_IntForEachEntry( vNodes, Leaf, i )
203 Ivy_ManObj(p, Leaf)->TravId = i;
204 // alloc enough memory
205 Vec_IntClear( vTruth );
206 Vec_IntGrow( vTruth, 8 * Vec_IntSize(vNodes) );
207 // set the elementary truth tables
208 Vec_IntForEachEntry( vLeaves, Leaf, i )
209 memcpy( Ivy_ObjGetTruthStore(i, vTruth), uTruths[i], 8 * sizeof(unsigned) );
210 // compute truths for other nodes
211 Vec_IntForEachEntryStart( vNodes, Leaf, i, Vec_IntSize(vLeaves) )
212 Ivy_ManCutTruthOne( p, Ivy_ManObj(p, Leaf), vTruth, 8 );
213 return Ivy_ObjGetTruthStore( pRoot->TravId, vTruth );
214}
void Ivy_ManCutTruthOne(Ivy_Man_t *p, Ivy_Obj_t *pNode, Vec_Int_t *vTruth, int nWords)
Definition ivyUtil.c:150
unsigned * Ivy_ObjGetTruthStore(int ObjNum, Vec_Int_t *vTruth)
Definition ivyUtil.c:134
void Ivy_ManCollectCut(Ivy_Man_t *p, Ivy_Obj_t *pRoot, Vec_Int_t *vLeaves, Vec_Int_t *vNodes)
Definition ivyUtil.c:106
char * memcpy()
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
Definition vecInt.h:56
Here is the call graph for this function:

◆ Ivy_ManDfs()

Vec_Int_t * Ivy_ManDfs ( Ivy_Man_t * p)
extern

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

Synopsis [Collects AND/EXOR nodes in the DFS order from CIs to COs.]

Description []

SideEffects []

SeeAlso []

Definition at line 87 of file ivyDfs.c.

88{
89 Vec_Int_t * vNodes;
90 Ivy_Obj_t * pObj;
91 int i;
92 assert( Ivy_ManLatchNum(p) == 0 );
93 // make sure the nodes are not marked
94 Ivy_ManForEachObj( p, pObj, i )
95 assert( !pObj->fMarkA && !pObj->fMarkB );
96 // collect the nodes
97 vNodes = Vec_IntAlloc( Ivy_ManNodeNum(p) );
98 Ivy_ManForEachPo( p, pObj, i )
99 Ivy_ManDfs_rec( p, Ivy_ObjFanin0(pObj), vNodes );
100 // unmark the collected nodes
101// Ivy_ManForEachNodeVec( p, vNodes, pObj, i )
102// Ivy_ObjClearMarkA(pObj);
103 Ivy_ManForEachObj( p, pObj, i )
104 Ivy_ObjClearMarkA(pObj);
105 // make sure network does not have dangling nodes
106 assert( Vec_IntSize(vNodes) == Ivy_ManNodeNum(p) + Ivy_ManBufNum(p) );
107 return vNodes;
108}
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
ABC_NAMESPACE_IMPL_START void Ivy_ManDfs_rec(Ivy_Man_t *p, Ivy_Obj_t *pObj, Vec_Int_t *vNodes)
DECLARATIONS ///.
Definition ivyDfs.c:45
unsigned fMarkB
Definition ivy.h:79
Here is the call graph for this function:

◆ Ivy_ManDfsSeq()

Vec_Int_t * Ivy_ManDfsSeq ( Ivy_Man_t * p,
Vec_Int_t ** pvLatches )
extern

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

Synopsis [Collects AND/EXOR nodes in the DFS order from CIs to COs.]

Description []

SideEffects []

SeeAlso []

Definition at line 121 of file ivyDfs.c.

122{
123 Vec_Int_t * vNodes, * vLatches;
124 Ivy_Obj_t * pObj;
125 int i;
126// assert( Ivy_ManLatchNum(p) > 0 );
127 // make sure the nodes are not marked
128 Ivy_ManForEachObj( p, pObj, i )
129 assert( !pObj->fMarkA && !pObj->fMarkB );
130 // collect the latches
131 vLatches = Vec_IntAlloc( Ivy_ManLatchNum(p) );
132 Ivy_ManForEachLatch( p, pObj, i )
133 Vec_IntPush( vLatches, pObj->Id );
134 // collect the nodes
135 vNodes = Vec_IntAlloc( Ivy_ManNodeNum(p) );
136 Ivy_ManForEachPo( p, pObj, i )
137 Ivy_ManDfs_rec( p, Ivy_ObjFanin0(pObj), vNodes );
138 Ivy_ManForEachNodeVec( p, vLatches, pObj, i )
139 Ivy_ManDfs_rec( p, Ivy_ObjFanin0(pObj), vNodes );
140 // unmark the collected nodes
141// Ivy_ManForEachNodeVec( p, vNodes, pObj, i )
142// Ivy_ObjClearMarkA(pObj);
143 Ivy_ManForEachObj( p, pObj, i )
144 Ivy_ObjClearMarkA(pObj);
145 // make sure network does not have dangling nodes
146// assert( Vec_IntSize(vNodes) == Ivy_ManNodeNum(p) + Ivy_ManBufNum(p) );
147
148// temporary!!!
149
150 if ( pvLatches == NULL )
151 Vec_IntFree( vLatches );
152 else
153 *pvLatches = vLatches;
154 return vNodes;
155}
#define Ivy_ManForEachLatch(p, pObj, i)
Definition ivy.h:405
#define Ivy_ManForEachNodeVec(p, vIds, pObj, i)
Definition ivy.h:408
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ManDsdConstruct()

Ivy_Obj_t * Ivy_ManDsdConstruct ( Ivy_Man_t * p,
Vec_Int_t * vFront,
Vec_Int_t * vTree )
extern

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

Synopsis [Implement DSD in the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 655 of file ivyDsd.c.

656{
657 int Entry, i;
658 // implement latches on the frontier (TEMPORARY!!!)
659 Vec_IntForEachEntry( vFront, Entry, i )
660 Vec_IntWriteEntry( vFront, i, Ivy_LeafId(Entry) );
661 // recursively construct the tree
662 return Ivy_ManDsdConstruct_rec( p, vFront, Vec_IntSize(vTree)-1, vTree );
663}
Ivy_Obj_t * Ivy_ManDsdConstruct_rec(Ivy_Man_t *p, Vec_Int_t *vFront, int iNode, Vec_Int_t *vTree)
Definition ivyDsd.c:586
Here is the call graph for this function:

◆ Ivy_ManDup()

Ivy_Man_t * Ivy_ManDup ( Ivy_Man_t * p)
extern

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

Synopsis [Duplicates the AIG manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 110 of file ivyMan.c.

111{
112 Vec_Int_t * vNodes, * vLatches;
113 Ivy_Man_t * pNew;
114 Ivy_Obj_t * pObj;
115 int i;
116 // collect latches and nodes in the DFS order
117 vNodes = Ivy_ManDfsSeq( p, &vLatches );
118 // create the new manager
119 pNew = Ivy_ManStart();
120 // create the PIs
121 Ivy_ManConst1(p)->pEquiv = Ivy_ManConst1(pNew);
122 Ivy_ManForEachPi( p, pObj, i )
123 pObj->pEquiv = Ivy_ObjCreatePi(pNew);
124 // create the fake PIs for latches
125 Ivy_ManForEachNodeVec( p, vLatches, pObj, i )
126 pObj->pEquiv = Ivy_ObjCreatePi(pNew);
127 // duplicate internal nodes
128 Ivy_ManForEachNodeVec( p, vNodes, pObj, i )
129 if ( Ivy_ObjIsBuf(pObj) )
130 pObj->pEquiv = Ivy_ObjChild0Equiv(pObj);
131 else
132 pObj->pEquiv = Ivy_And( pNew, Ivy_ObjChild0Equiv(pObj), Ivy_ObjChild1Equiv(pObj) );
133 // add the POs
134 Ivy_ManForEachPo( p, pObj, i )
135 Ivy_ObjCreatePo( pNew, Ivy_ObjChild0Equiv(pObj) );
136 // transform additional PI nodes into latches and connect them
137 Ivy_ManForEachNodeVec( p, vLatches, pObj, i )
138 {
139 assert( !Ivy_ObjFaninC0(pObj) );
140 pObj->pEquiv->Type = IVY_LATCH;
141 pObj->pEquiv->Init = pObj->Init;
142 Ivy_ObjConnect( pNew, pObj->pEquiv, Ivy_ObjChild0Equiv(pObj), NULL );
143 }
144 // shrink the arrays
145 Vec_PtrShrink( pNew->vPis, Ivy_ManPiNum(p) );
146 // update the counters of different objects
147 pNew->nObjs[IVY_PI] -= Ivy_ManLatchNum(p);
148 pNew->nObjs[IVY_LATCH] += Ivy_ManLatchNum(p);
149 // free arrays
150 Vec_IntFree( vNodes );
151 Vec_IntFree( vLatches );
152 // make sure structural hashing did not change anything
153 assert( Ivy_ManNodeNum(p) == Ivy_ManNodeNum(pNew) );
154 assert( Ivy_ManLatchNum(p) == Ivy_ManLatchNum(pNew) );
155 // check the resulting network
156 if ( !Ivy_ManCheck(pNew) )
157 printf( "Ivy_ManMakeSeq(): The check has failed.\n" );
158 return pNew;
159}
ABC_NAMESPACE_IMPL_START Ivy_Man_t * Ivy_ManStart()
DECLARATIONS ///.
Definition ivyMan.c:45
Vec_Int_t * Ivy_ManDfsSeq(Ivy_Man_t *p, Vec_Int_t **pvLatches)
Definition ivyDfs.c:121
void Ivy_ObjConnect(Ivy_Man_t *p, Ivy_Obj_t *pObj, Ivy_Obj_t *pFan0, Ivy_Obj_t *pFan1)
Definition ivyObj.c:150
unsigned Type
Definition ivy.h:77
unsigned Init
Definition ivy.h:83
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ManFrames()

Ivy_Man_t * Ivy_ManFrames ( Ivy_Man_t * pMan,
int nLatches,
int nFrames,
int fInit,
Vec_Ptr_t ** pvMapping )
extern

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

Synopsis [Stops the AIG manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 172 of file ivyMan.c.

173{
174 Vec_Ptr_t * vMapping;
175 Ivy_Man_t * pNew;
176 Ivy_Obj_t * pObj;
177 int i, f, nPis, nPos, nIdMax;
178 assert( Ivy_ManLatchNum(pMan) == 0 );
179 assert( nFrames > 0 );
180 // prepare the mapping
181 nPis = Ivy_ManPiNum(pMan) - nLatches;
182 nPos = Ivy_ManPoNum(pMan) - nLatches;
183 nIdMax = Ivy_ManObjIdMax(pMan);
184 // create the new manager
185 pNew = Ivy_ManStart();
186 // set the starting values of latch inputs
187 for ( i = 0; i < nLatches; i++ )
188 Ivy_ManPo(pMan, nPos+i)->pEquiv = fInit? Ivy_Not(Ivy_ManConst1(pNew)) : Ivy_ObjCreatePi(pNew);
189 // add timeframes
190 vMapping = Vec_PtrStart( nIdMax * nFrames + 1 );
191 for ( f = 0; f < nFrames; f++ )
192 {
193 // create PIs
194 Ivy_ManConst1(pMan)->pEquiv = Ivy_ManConst1(pNew);
195 for ( i = 0; i < nPis; i++ )
196 Ivy_ManPi(pMan, i)->pEquiv = Ivy_ObjCreatePi(pNew);
197 // transfer values to latch outputs
198 for ( i = 0; i < nLatches; i++ )
199 Ivy_ManPi(pMan, nPis+i)->pEquiv = Ivy_ManPo(pMan, nPos+i)->pEquiv;
200 // perform strashing
201 Ivy_ManForEachNode( pMan, pObj, i )
202 pObj->pEquiv = Ivy_And( pNew, Ivy_ObjChild0Equiv(pObj), Ivy_ObjChild1Equiv(pObj) );
203 // create POs
204 for ( i = 0; i < nPos; i++ )
205 Ivy_ManPo(pMan, i)->pEquiv = Ivy_ObjCreatePo( pNew, Ivy_ObjChild0Equiv(Ivy_ManPo(pMan, i)) );
206 // set the results of latch inputs
207 for ( i = 0; i < nLatches; i++ )
208 Ivy_ManPo(pMan, nPos+i)->pEquiv = Ivy_ObjChild0Equiv(Ivy_ManPo(pMan, nPos+i));
209 // save the pointers in this frame
210 Ivy_ManForEachObj( pMan, pObj, i )
211 Vec_PtrWriteEntry( vMapping, f * nIdMax + i, pObj->pEquiv );
212 }
213 // connect latches
214 if ( !fInit )
215 for ( i = 0; i < nLatches; i++ )
216 Ivy_ObjCreatePo( pNew, Ivy_ManPo(pMan, nPos+i)->pEquiv );
217 // remove dangling nodes
218 Ivy_ManCleanup(pNew);
219 *pvMapping = vMapping;
220 // check the resulting network
221 if ( !Ivy_ManCheck(pNew) )
222 printf( "Ivy_ManFrames(): The check has failed.\n" );
223 return pNew;
224}
int Ivy_ManCleanup(Ivy_Man_t *p)
Definition ivyMan.c:265
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ManHaigCreateChoice()

void Ivy_ManHaigCreateChoice ( Ivy_Man_t * p,
Ivy_Obj_t * pObjOld,
Ivy_Obj_t * pObjNew )
extern

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

Synopsis [Sets the pair of equivalent nodes in HAIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 246 of file ivyHaig.c.

247{
248 Ivy_Obj_t * pObjOldHaig, * pObjNewHaig;
249 Ivy_Obj_t * pObjOldHaigR, * pObjNewHaigR;
250 int fCompl;
251//printf( "\nCreating choice for %d and %d in AIG\n", pObjOld->Id, Ivy_Regular(pObjNew)->Id );
252
253 assert( p->pHaig != NULL );
254 assert( !Ivy_IsComplement(pObjOld) );
255 // get pointers to the representatives of pObjOld and pObjNew
256 pObjOldHaig = pObjOld->pEquiv;
257 pObjNewHaig = Ivy_NotCond( Ivy_Regular(pObjNew)->pEquiv, Ivy_IsComplement(pObjNew) );
258 // get the classes
259 pObjOldHaig = Ivy_NotCond( Ivy_HaigObjRepr(Ivy_Regular(pObjOldHaig)), Ivy_IsComplement(pObjOldHaig) );
260 pObjNewHaig = Ivy_NotCond( Ivy_HaigObjRepr(Ivy_Regular(pObjNewHaig)), Ivy_IsComplement(pObjNewHaig) );
261 // get regular pointers
262 pObjOldHaigR = Ivy_Regular(pObjOldHaig);
263 pObjNewHaigR = Ivy_Regular(pObjNewHaig);
264 // check if there is phase difference between them
265 fCompl = (Ivy_IsComplement(pObjOldHaig) != Ivy_IsComplement(pObjNewHaig));
266 // if the class is the same, nothing to do
267 if ( pObjOldHaigR == pObjNewHaigR )
268 return;
269 // if the second node belongs to a class, do not merge classes (for the time being)
270 if ( Ivy_ObjRefs(pObjOldHaigR) == 0 || pObjNewHaigR->pEquiv != NULL ||
271 Ivy_ObjRefs(pObjNewHaigR) > 0 ) //|| Ivy_ObjIsInTfi_rec(pObjNewHaigR, pObjOldHaigR, 10) )
272 {
273/*
274 if ( pObjNewHaigR->pEquiv != NULL )
275 printf( "c" );
276 if ( Ivy_ObjRefs(pObjNewHaigR) > 0 )
277 printf( "f" );
278 printf( " " );
279*/
280 p->pHaig->nClassesSkip++;
281 return;
282 }
283
284 // add this node to the class of pObjOldHaig
285 assert( Ivy_ObjRefs(pObjOldHaigR) > 0 );
286 assert( !Ivy_IsComplement(pObjOldHaigR->pEquiv) );
287 if ( pObjOldHaigR->pEquiv == NULL )
288 pObjNewHaigR->pEquiv = Ivy_NotCond( pObjOldHaigR, fCompl );
289 else
290 pObjNewHaigR->pEquiv = Ivy_NotCond( pObjOldHaigR->pEquiv, fCompl );
291 pObjOldHaigR->pEquiv = pObjNewHaigR;
292//printf( "Setting choice node %d -> %d.\n", pObjOldHaigR->Id, pObjNewHaigR->Id );
293 // update the class of the new node
294// Ivy_Regular(pObjNew)->pEquiv = Ivy_NotCond( pObjOldHaigR, fCompl ^ Ivy_IsComplement(pObjNew) );
295//printf( "Creating choice for %d and %d in HAIG\n", pObjOldHaigR->Id, pObjNewHaigR->Id );
296
297// if ( pObjOldHaigR->Id == 13 )
298// {
299// Ivy_ManShow( p, 0 );
300// Ivy_ManShow( p->pHaig, 1 );
301// }
302// if ( !Ivy_ManIsAcyclic( p->pHaig ) )
303// printf( "HAIG contains a cycle\n" );
304}
Here is the caller graph for this function:

◆ Ivy_ManHaigCreateObj()

void Ivy_ManHaigCreateObj ( Ivy_Man_t * p,
Ivy_Obj_t * pObj )
extern

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

Synopsis [Creates a new node in HAIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 183 of file ivyHaig.c.

184{
185 Ivy_Obj_t * pEquiv0, * pEquiv1;
186 assert( p->pHaig != NULL );
187 assert( !Ivy_IsComplement(pObj) );
188 if ( Ivy_ObjType(pObj) == IVY_BUF )
189 pObj->pEquiv = Ivy_ObjChild0Equiv(pObj);
190 else if ( Ivy_ObjType(pObj) == IVY_LATCH )
191 {
192// pObj->pEquiv = Ivy_Latch( p->pHaig, Ivy_ObjChild0Equiv(pObj), pObj->Init );
193 pEquiv0 = Ivy_ObjChild0Equiv(pObj);
194 pEquiv0 = Ivy_NotCond( Ivy_HaigObjRepr(Ivy_Regular(pEquiv0)), Ivy_IsComplement(pEquiv0) );
195 pObj->pEquiv = Ivy_Latch( p->pHaig, pEquiv0, (Ivy_Init_t)pObj->Init );
196 }
197 else if ( Ivy_ObjType(pObj) == IVY_AND )
198 {
199// pObj->pEquiv = Ivy_And( p->pHaig, Ivy_ObjChild0Equiv(pObj), Ivy_ObjChild1Equiv(pObj) );
200 pEquiv0 = Ivy_ObjChild0Equiv(pObj);
201 pEquiv0 = Ivy_NotCond( Ivy_HaigObjRepr(Ivy_Regular(pEquiv0)), Ivy_IsComplement(pEquiv0) );
202 pEquiv1 = Ivy_ObjChild1Equiv(pObj);
203 pEquiv1 = Ivy_NotCond( Ivy_HaigObjRepr(Ivy_Regular(pEquiv1)), Ivy_IsComplement(pEquiv1) );
204 pObj->pEquiv = Ivy_And( p->pHaig, pEquiv0, pEquiv1 );
205 }
206 else assert( 0 );
207 // make sure the node points to the representative
208// pObj->pEquiv = Ivy_NotCond( Ivy_HaigObjRepr(Ivy_Regular(pObj->pEquiv)), Ivy_IsComplement(pObj->pEquiv) );
209}
Ivy_Obj_t * Ivy_Latch(Ivy_Man_t *p, Ivy_Obj_t *pObj, Ivy_Init_t Init)
Definition ivyOper.c:287
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ManHaigPostprocess()

void Ivy_ManHaigPostprocess ( Ivy_Man_t * p,
int fVerbose )
extern

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

Synopsis [Prints statistics of the HAIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 350 of file ivyHaig.c.

351{
352 int nChoices, nChoiceNodes;
353
354 assert( p->pHaig != NULL );
355
356 if ( fVerbose )
357 {
358 printf( "Final : " );
360 printf( "HAIG : " );
361 Ivy_ManPrintStats( p->pHaig );
362
363 // print choice node stats
364 nChoiceNodes = Ivy_ManHaigCountChoices( p, &nChoices );
365 printf( "Total choice nodes = %d. Total choices = %d. Skipped classes = %d.\n",
366 nChoiceNodes, nChoices, p->pHaig->nClassesSkip );
367 }
368
369 if ( Ivy_ManIsAcyclic( p->pHaig ) )
370 {
371 if ( fVerbose )
372 printf( "HAIG is acyclic\n" );
373 }
374 else
375 printf( "HAIG contains a cycle\n" );
376
377// if ( fVerbose )
378// Ivy_ManHaigSimulate( p );
379}
int Ivy_ManHaigCountChoices(Ivy_Man_t *p, int *pnChoices)
Definition ivyHaig.c:317
void Ivy_ManPrintStats(Ivy_Man_t *p)
Definition ivyMan.c:456
Here is the call graph for this function:

◆ Ivy_ManHaigSimulate()

void Ivy_ManHaigSimulate ( Ivy_Man_t * p)
extern

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

Synopsis [Simulate HAIG using modified 3-valued simulation.]

Description []

SideEffects []

SeeAlso []

Definition at line 440 of file ivyHaig.c.

441{
442 Vec_Int_t * vNodes, * vLatches, * vLatchesD;
443 Ivy_Obj_t * pObj, * pTemp;
444 Ivy_Init_t In0, In1;
445 int i, k, Counter;
446 int fVerbose = 0;
447
448 // check choices
450
451 // switch to HAIG
452 assert( p->pHaig != NULL );
453 p = p->pHaig;
454
455if ( fVerbose )
456Ivy_ManForEachPi( p, pObj, i )
457printf( "Setting PI %d\n", pObj->Id );
458
459 // collect latches and nodes in the DFS order
460 vNodes = Ivy_ManDfsSeq( p, &vLatches );
461
462if ( fVerbose )
463Ivy_ManForEachNodeVec( p, vNodes, pObj, i )
464printf( "Collected node %d with fanins %d and %d\n", pObj->Id, Ivy_ObjFanin0(pObj)->Id, Ivy_ObjFanin1(pObj)->Id );
465
466 // set the PI values
467 Ivy_ManConst1(p)->Init = IVY_INIT_1;
468 Ivy_ManForEachPi( p, pObj, i )
469 pObj->Init = IVY_INIT_0;
470
471 // set the latch values
472 Ivy_ManForEachNodeVec( p, vLatches, pObj, i )
473 pObj->Init = IVY_INIT_DC;
474 // set the latches of D to be determinate
475 vLatchesD = (Vec_Int_t *)p->pData;
476 Ivy_ManForEachNodeVec( p, vLatchesD, pObj, i )
477 pObj->Init = IVY_INIT_0;
478
479 // perform several rounds of simulation
480 for ( k = 0; k < 10; k++ )
481 {
482 // count the number of non-determinate values
483 Counter = 0;
484 Ivy_ManForEachNodeVec( p, vLatches, pObj, i )
485 Counter += ( pObj->Init == IVY_INIT_DC );
486 printf( "Iter %d : Non-determinate = %d\n", k, Counter );
487
488 // simulate the internal nodes
489 Ivy_ManForEachNodeVec( p, vNodes, pObj, i )
490 {
491if ( fVerbose )
492printf( "Processing node %d with fanins %d and %d\n", pObj->Id, Ivy_ObjFanin0(pObj)->Id, Ivy_ObjFanin1(pObj)->Id );
493 In0 = Ivy_InitNotCond( (Ivy_Init_t)Ivy_ObjFanin0(pObj)->Init, Ivy_ObjFaninC0(pObj) );
494 In1 = Ivy_InitNotCond( (Ivy_Init_t)Ivy_ObjFanin1(pObj)->Init, Ivy_ObjFaninC1(pObj) );
495 pObj->Init = Ivy_ManHaigSimulateAnd( In0, In1 );
496 // simulate the equivalence class if the node is a representative
497 if ( pObj->pEquiv && Ivy_ObjRefs(pObj) > 0 )
498 {
499if ( fVerbose )
500printf( "Processing choice node %d\n", pObj->Id );
501 In0 = (Ivy_Init_t)pObj->Init;
502 assert( !Ivy_IsComplement(pObj->pEquiv) );
503 for ( pTemp = pObj->pEquiv; pTemp != pObj; pTemp = Ivy_Regular(pTemp->pEquiv) )
504 {
505if ( fVerbose )
506printf( "Processing secondary node %d\n", pTemp->Id );
507 In1 = Ivy_InitNotCond( (Ivy_Init_t)pTemp->Init, Ivy_IsComplement(pTemp->pEquiv) );
508 In0 = Ivy_ManHaigSimulateChoice( In0, In1 );
509 }
510 pObj->Init = In0;
511 }
512 }
513
514 // simulate the latches
515 Ivy_ManForEachNodeVec( p, vLatches, pObj, i )
516 {
517 pObj->Level = Ivy_ObjFanin0(pObj)->Init;
518if ( fVerbose )
519printf( "Using latch %d with fanin %d\n", pObj->Id, Ivy_ObjFanin0(pObj)->Id );
520 }
521 Ivy_ManForEachNodeVec( p, vLatches, pObj, i )
522 pObj->Init = pObj->Level, pObj->Level = 0;
523 }
524 // free arrays
525 Vec_IntFree( vNodes );
526 Vec_IntFree( vLatches );
527}
int Ivy_ManCheckChoices(Ivy_Man_t *p)
Definition ivyCheck.c:255
unsigned Level
Definition ivy.h:84
Here is the call graph for this function:

◆ Ivy_ManHaigStart()

void Ivy_ManHaigStart ( Ivy_Man_t * p,
int fVerbose )
extern

FUNCTION DEFINITIONS ///.

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

Synopsis [Starts HAIG for the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 94 of file ivyHaig.c.

95{
96 Vec_Int_t * vLatches;
97 Ivy_Obj_t * pObj;
98 int i;
99 assert( p->pHaig == NULL );
100 p->pHaig = Ivy_ManDup( p );
101
102 if ( fVerbose )
103 {
104 printf( "Starting : " );
105 Ivy_ManPrintStats( p->pHaig );
106 }
107
108 // collect latches of design D and set their values to be DC
109 vLatches = Vec_IntAlloc( 100 );
110 Ivy_ManForEachLatch( p->pHaig, pObj, i )
111 {
112 pObj->Init = IVY_INIT_DC;
113 Vec_IntPush( vLatches, pObj->Id );
114 }
115 p->pHaig->pData = vLatches;
116/*
117 {
118 int x;
119 Ivy_ManShow( p, 0, NULL );
120 Ivy_ManShow( p->pHaig, 1, NULL );
121 x = 0;
122 }
123*/
124}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ManHaigStop()

void Ivy_ManHaigStop ( Ivy_Man_t * p)
extern

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

Synopsis [Stops HAIG for the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 159 of file ivyHaig.c.

160{
161 Ivy_Obj_t * pObj;
162 int i;
163 assert( p->pHaig != NULL );
164 Vec_IntFree( (Vec_Int_t *)p->pHaig->pData );
165 Ivy_ManStop( p->pHaig );
166 p->pHaig = NULL;
167 // remove dangling pointers to the HAIG objects
168 Ivy_ManForEachObj( p, pObj, i )
169 pObj->pEquiv = NULL;
170}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ManHaigTrasfer()

void Ivy_ManHaigTrasfer ( Ivy_Man_t * p,
Ivy_Man_t * pNew )
extern

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

Synopsis [Transfers the HAIG to the newly created manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 137 of file ivyHaig.c.

138{
139 Ivy_Obj_t * pObj;
140 int i;
141 assert( p->pHaig != NULL );
142 Ivy_ManConst1(pNew)->pEquiv = Ivy_ManConst1(p)->pEquiv;
143 Ivy_ManForEachPi( pNew, pObj, i )
144 pObj->pEquiv = Ivy_ManPi( p, i )->pEquiv;
145 pNew->pHaig = p->pHaig;
146}

◆ Ivy_ManIncrementTravId()

void Ivy_ManIncrementTravId ( Ivy_Man_t * p)
extern

DECLARATIONS ///.

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

FileName [ivyUtil.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [And-Inverter Graph package.]

Synopsis [Various procedures.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - May 11, 2006.]

Revision [

Id
ivyUtil.c,v 1.00 2006/05/11 00:00:00 alanmi Exp

] FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Increments the current traversal ID of the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file ivyUtil.c.

46{
47 if ( p->nTravIds >= (1<<30)-1 - 1000 )
49 p->nTravIds++;
50}
void Ivy_ManCleanTravId(Ivy_Man_t *p)
Definition ivyUtil.c:63
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ManIsAcyclic()

int Ivy_ManIsAcyclic ( Ivy_Man_t * p)
extern

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

Synopsis [Detects combinational loops.]

Description [This procedure is based on the idea suggested by Donald Chai. As we traverse the network and visit the nodes, we need to distinquish three types of nodes: (1) those that are visited for the first time, (2) those that have been visited in this traversal but are currently not on the traversal path, (3) those that have been visited and are currently on the travesal path. When the node of type (3) is encountered, it means that there is a combinational loop. To mark the three types of nodes, two new values of the traversal IDs are used.]

SideEffects []

SeeAlso []

Definition at line 373 of file ivyDfs.c.

374{
375 Ivy_Obj_t * pObj;
376 int fAcyclic, i;
377 // set the traversal ID for this DFS ordering
380 // pObj->TravId == pNet->nTravIds means "pObj is on the path"
381 // pObj->TravId == pNet->nTravIds - 1 means "pObj is visited but is not on the path"
382 // pObj->TravId < pNet->nTravIds - 1 means "pObj is not visited"
383 // traverse the network to detect cycles
384 fAcyclic = 1;
385 Ivy_ManForEachCo( p, pObj, i )
386 {
387 // traverse the output logic cone
388 if ( (fAcyclic = Ivy_ManIsAcyclic_rec(p, Ivy_ObjFanin0(pObj))) )
389 continue;
390 // stop as soon as the first loop is detected
391 fprintf( stdout, " (cone of %s \"%d\")\n", Ivy_ObjIsLatch(pObj)? "latch" : "PO", Ivy_ObjId(pObj) );
392 break;
393 }
394 return fAcyclic;
395}
int Ivy_ManIsAcyclic_rec(Ivy_Man_t *p, Ivy_Obj_t *pObj)
Definition ivyDfs.c:294
#define Ivy_ManForEachCo(p, pObj, i)
Definition ivy.h:399
void Ivy_ManIncrementTravId(Ivy_Man_t *p)
DECLARATIONS ///.
Definition ivyUtil.c:45
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ManLatches()

Vec_Int_t * Ivy_ManLatches ( Ivy_Man_t * p)
extern

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

Synopsis [Collect the latches.]

Description []

SideEffects []

SeeAlso []

Definition at line 227 of file ivyUtil.c.

228{
229 Vec_Int_t * vLatches;
230 Ivy_Obj_t * pObj;
231 int i;
232 vLatches = Vec_IntAlloc( Ivy_ManLatchNum(p) );
233 Ivy_ManForEachLatch( p, pObj, i )
234 Vec_IntPush( vLatches, pObj->Id );
235 return vLatches;
236}

◆ Ivy_ManLevelize()

Vec_Vec_t * Ivy_ManLevelize ( Ivy_Man_t * p)
extern

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

Synopsis [Returns the nodes by level.]

Description []

SideEffects []

SeeAlso []

Definition at line 224 of file ivyDfs.c.

225{
226 Vec_Vec_t * vNodes;
227 Ivy_Obj_t * pObj;
228 int i;
229 vNodes = Vec_VecAlloc( 100 );
230 Ivy_ManForEachObj( p, pObj, i )
231 {
232 assert( !Ivy_ObjIsBuf(pObj) );
233 if ( Ivy_ObjIsNode(pObj) )
234 Vec_VecPush( vNodes, pObj->Level, pObj );
235 }
236 return vNodes;
237}
Here is the caller graph for this function:

◆ Ivy_ManLevels()

int Ivy_ManLevels ( Ivy_Man_t * p)
extern

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

Synopsis [Collect the latches.]

Description []

SideEffects []

SeeAlso []

Definition at line 249 of file ivyUtil.c.

250{
251 Ivy_Obj_t * pObj;
252 int i, LevelMax = 0;
253 Ivy_ManForEachPo( p, pObj, i )
254 LevelMax = IVY_MAX( LevelMax, (int)Ivy_ObjFanin0(pObj)->Level );
255 return LevelMax;
256}
#define IVY_MAX(a, b)
Definition ivy.h:183
Here is the caller graph for this function:

◆ Ivy_ManMakeSeq()

void Ivy_ManMakeSeq ( Ivy_Man_t * p,
int nLatches,
int * pInits )
extern

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

Synopsis [Converts a combinational AIG manager into a sequential one.]

Description []

SideEffects []

SeeAlso []

Definition at line 482 of file ivyMan.c.

483{
484 Ivy_Obj_t * pObj, * pLatch;
485 Ivy_Init_t Init;
486 int i;
487 if ( nLatches == 0 )
488 return;
489 assert( nLatches < Ivy_ManPiNum(p) && nLatches < Ivy_ManPoNum(p) );
490 assert( Ivy_ManPiNum(p) == Vec_PtrSize(p->vPis) );
491 assert( Ivy_ManPoNum(p) == Vec_PtrSize(p->vPos) );
492 assert( Vec_PtrSize( p->vBufs ) == 0 );
493 // create fanouts
494 if ( p->fFanout == 0 )
496 // collect the POs to be converted into latches
497 for ( i = 0; i < nLatches; i++ )
498 {
499 // get the latch value
500 Init = pInits? (Ivy_Init_t)pInits[i] : IVY_INIT_0;
501 // create latch
502 pObj = Ivy_ManPo( p, Ivy_ManPoNum(p) - nLatches + i );
503 pLatch = Ivy_Latch( p, Ivy_ObjChild0(pObj), Init );
504 Ivy_ObjDisconnect( p, pObj );
505 // recycle the old PO object
506 Vec_PtrWriteEntry( p->vObjs, pObj->Id, NULL );
507 Ivy_ManRecycleMemory( p, pObj );
508 // convert the corresponding PI to a buffer and connect it to the latch
509 pObj = Ivy_ManPi( p, Ivy_ManPiNum(p) - nLatches + i );
510 pObj->Type = IVY_BUF;
511 Ivy_ObjConnect( p, pObj, pLatch, NULL );
512 // save the buffer
513 Vec_PtrPush( p->vBufs, pObj );
514 }
515 // shrink the arrays
516 Vec_PtrShrink( p->vPis, Ivy_ManPiNum(p) - nLatches );
517 Vec_PtrShrink( p->vPos, Ivy_ManPoNum(p) - nLatches );
518 // update the counters of different objects
519 p->nObjs[IVY_PI] -= nLatches;
520 p->nObjs[IVY_PO] -= nLatches;
521 p->nObjs[IVY_BUF] += nLatches;
522 p->nDeleted -= 2 * nLatches;
523 // remove dangling nodes
526/*
527 // check for dangling nodes
528 Ivy_ManForEachObj( p, pObj, i )
529 if ( !Ivy_ObjIsPi(pObj) && !Ivy_ObjIsPo(pObj) && !Ivy_ObjIsConst1(pObj) )
530 {
531 assert( Ivy_ObjRefs(pObj) > 0 );
532 assert( Ivy_ObjRefs(pObj) == Ivy_ObjFanoutNum(p, pObj) );
533 }
534*/
535 // perform hashing by propagating the buffers
537 if ( Ivy_ManBufNum(p) )
538 printf( "The number of remaining buffers is %d.\n", Ivy_ManBufNum(p) );
539 // fix the levels
541 // check the resulting network
542 if ( !Ivy_ManCheck(p) )
543 printf( "Ivy_ManMakeSeq(): The check has failed.\n" );
544}
int Ivy_ManCleanupSeq(Ivy_Man_t *p)
Definition ivyMan.c:311
int Ivy_ManPropagateBuffers(Ivy_Man_t *p, int fUpdateLevel)
Definition ivyMan.c:414
void Ivy_ObjDisconnect(Ivy_Man_t *p, Ivy_Obj_t *pObj)
Definition ivyObj.c:185
void Ivy_ManResetLevels(Ivy_Man_t *p)
Definition ivyUtil.c:292
void Ivy_ManStartFanout(Ivy_Man_t *p)
FUNCTION DEFINITIONS ///.
Definition ivyFanout.c:136
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ManPrintStats()

void Ivy_ManPrintStats ( Ivy_Man_t * p)
extern

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

Synopsis [Stops the AIG manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 456 of file ivyMan.c.

457{
458 printf( "PI/PO = %d/%d ", Ivy_ManPiNum(p), Ivy_ManPoNum(p) );
459 printf( "A = %7d. ", Ivy_ManAndNum(p) );
460 printf( "L = %5d. ", Ivy_ManLatchNum(p) );
461// printf( "X = %d. ", Ivy_ManExorNum(p) );
462// printf( "B = %3d. ", Ivy_ManBufNum(p) );
463 printf( "MaxID = %7d. ", Ivy_ManObjIdMax(p) );
464// printf( "Cre = %d. ", p->nCreated );
465// printf( "Del = %d. ", p->nDeleted );
466 printf( "Lev = %3d. ", Ivy_ManLatchNum(p)? -1 : Ivy_ManLevels(p) );
467 printf( "\n" );
468 fflush( stdout );
469}
int Ivy_ManLevels(Ivy_Man_t *p)
Definition ivyUtil.c:249
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ManPrintVerbose()

void Ivy_ManPrintVerbose ( Ivy_Man_t * p,
int fHaig )
extern

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

Synopsis [Prints node in HAIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 714 of file ivyUtil.c.

715{
716 Vec_Int_t * vNodes;
717 Ivy_Obj_t * pObj;
718 int i;
719 printf( "PIs: " );
720 Ivy_ManForEachPi( p, pObj, i )
721 printf( " %d", pObj->Id );
722 printf( "\n" );
723 printf( "POs: " );
724 Ivy_ManForEachPo( p, pObj, i )
725 printf( " %d", pObj->Id );
726 printf( "\n" );
727 printf( "Latches: " );
728 Ivy_ManForEachLatch( p, pObj, i )
729 printf( " %d=%d%s", pObj->Id, Ivy_ObjFanin0(pObj)->Id, (Ivy_ObjFaninC0(pObj)? "\'" : " ") );
730 printf( "\n" );
731 vNodes = Ivy_ManDfsSeq( p, NULL );
732 Ivy_ManForEachNodeVec( p, vNodes, pObj, i )
733 Ivy_ObjPrintVerbose( p, pObj, fHaig ), printf( "\n" );
734 printf( "\n" );
735 Vec_IntFree( vNodes );
736}
void Ivy_ObjPrintVerbose(Ivy_Man_t *p, Ivy_Obj_t *pObj, int fHaig)
Definition ivyUtil.c:629
Here is the call graph for this function:

◆ Ivy_ManPropagateBuffers()

int Ivy_ManPropagateBuffers ( Ivy_Man_t * p,
int fUpdateLevel )
extern

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

Synopsis [Returns the number of dangling nodes removed.]

Description []

SideEffects []

SeeAlso []

Definition at line 414 of file ivyMan.c.

415{
416 Ivy_Obj_t * pNode;
417 int LimitFactor = 100;
418 int NodeBeg = Ivy_ManNodeNum(p);
419 int nSteps;
420 for ( nSteps = 0; Vec_PtrSize(p->vBufs) > 0; nSteps++ )
421 {
422 pNode = (Ivy_Obj_t *)Vec_PtrEntryLast(p->vBufs);
423 while ( Ivy_ObjIsBuf(pNode) )
424 pNode = Ivy_ObjReadFirstFanout( p, pNode );
425 // check if this buffer should remain
426 if ( Ivy_ManLatchIsSelfFeed(pNode) )
427 {
428 Vec_PtrPop(p->vBufs);
429 continue;
430 }
431//printf( "Propagating buffer %d with input %d and output %d\n", Ivy_ObjFaninId0(pNode), Ivy_ObjFaninId0(Ivy_ObjFanin0(pNode)), pNode->Id );
432//printf( "Latch num %d\n", Ivy_ManLatchNum(p) );
433 Ivy_NodeFixBufferFanins( p, pNode, fUpdateLevel );
434 if ( nSteps > NodeBeg * LimitFactor )
435 {
436 printf( "Structural hashing is not finished after %d forward latch moves.\n", NodeBeg * LimitFactor );
437 printf( "This circuit cannot be forward-retimed completely. Quitting.\n" );
438 break;
439 }
440 }
441// printf( "Number of steps = %d. Nodes beg = %d. Nodes end = %d.\n", nSteps, NodeBeg, Ivy_ManNodeNum(p) );
442 return nSteps;
443}
int Ivy_ManLatchIsSelfFeed(Ivy_Obj_t *pLatch)
Definition ivyMan.c:395
Ivy_Obj_t * Ivy_ObjReadFirstFanout(Ivy_Man_t *p, Ivy_Obj_t *pObj)
Definition ivyFanout.c:283
void Ivy_NodeFixBufferFanins(Ivy_Man_t *p, Ivy_Obj_t *pNode, int fUpdateLevel)
Definition ivyObj.c:442
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ManRequiredLevels()

Vec_Int_t * Ivy_ManRequiredLevels ( Ivy_Man_t * p)
extern

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

Synopsis [Computes required levels for each node.]

Description [Assumes topological ordering of the nodes.]

SideEffects []

SeeAlso []

Definition at line 250 of file ivyDfs.c.

251{
252 Ivy_Obj_t * pObj;
253 Vec_Int_t * vLevelsR;
254 Vec_Vec_t * vNodes;
255 int i, k, Level, LevelMax;
256 assert( p->vRequired == NULL );
257 // start the required times
258 vLevelsR = Vec_IntStart( Ivy_ManObjIdMax(p) + 1 );
259 // iterate through the nodes in the reverse order
260 vNodes = Ivy_ManLevelize( p );
261 Vec_VecForEachEntryReverseReverse( Ivy_Obj_t *, vNodes, pObj, i, k )
262 {
263 Level = Vec_IntEntry( vLevelsR, pObj->Id ) + 1 + Ivy_ObjIsExor(pObj);
264 if ( Vec_IntEntry( vLevelsR, Ivy_ObjFaninId0(pObj) ) < Level )
265 Vec_IntWriteEntry( vLevelsR, Ivy_ObjFaninId0(pObj), Level );
266 if ( Vec_IntEntry( vLevelsR, Ivy_ObjFaninId1(pObj) ) < Level )
267 Vec_IntWriteEntry( vLevelsR, Ivy_ObjFaninId1(pObj), Level );
268 }
269 Vec_VecFree( vNodes );
270 // convert it into the required times
271 LevelMax = Ivy_ManLevels( p );
272//printf( "max %5d\n",LevelMax );
273 Ivy_ManForEachObj( p, pObj, i )
274 {
275 Level = Vec_IntEntry( vLevelsR, pObj->Id );
276 Vec_IntWriteEntry( vLevelsR, pObj->Id, LevelMax - Level );
277//printf( "%5d : %5d %5d\n", pObj->Id, Level, LevelMax - Level );
278 }
279 p->vRequired = vLevelsR;
280 return vLevelsR;
281}
Vec_Vec_t * Ivy_ManLevelize(Ivy_Man_t *p)
Definition ivyDfs.c:224
#define Vec_VecForEachEntryReverseReverse(Type, vGlob, pEntry, i, k)
Definition vecVec.h:101
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ManResetLevels()

void Ivy_ManResetLevels ( Ivy_Man_t * p)
extern

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

Synopsis [Collect the latches.]

Description []

SideEffects []

SeeAlso []

Definition at line 292 of file ivyUtil.c.

293{
294 Ivy_Obj_t * pObj;
295 int i;
296 Ivy_ManForEachObj( p, pObj, i )
297 pObj->Level = 0;
298 Ivy_ManForEachCo( p, pObj, i )
299 Ivy_ManResetLevels_rec( Ivy_ObjFanin0(pObj) );
300}
int Ivy_ManResetLevels_rec(Ivy_Obj_t *pObj)
Definition ivyUtil.c:269
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ManResyn()

Ivy_Man_t * Ivy_ManResyn ( Ivy_Man_t * pMan,
int fUpdateLevel,
int fVerbose )
extern

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

Synopsis [Performs several passes of rewriting on the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 86 of file ivyResyn.c.

87{
88 abctime clk;
89 Ivy_Man_t * pTemp;
90
91if ( fVerbose ) { printf( "Original:\n" ); }
92if ( fVerbose ) Ivy_ManPrintStats( pMan );
93
94clk = Abc_Clock();
95 pMan = Ivy_ManBalance( pMan, fUpdateLevel );
96if ( fVerbose ) { printf( "\n" ); }
97if ( fVerbose ) { ABC_PRT( "Balance", Abc_Clock() - clk ); }
98if ( fVerbose ) Ivy_ManPrintStats( pMan );
99
100// Ivy_ManRewriteAlg( pMan, fUpdateLevel, 0 );
101clk = Abc_Clock();
102 Ivy_ManRewritePre( pMan, fUpdateLevel, 0, 0 );
103if ( fVerbose ) { printf( "\n" ); }
104if ( fVerbose ) { ABC_PRT( "Rewrite", Abc_Clock() - clk ); }
105if ( fVerbose ) Ivy_ManPrintStats( pMan );
106
107clk = Abc_Clock();
108 pMan = Ivy_ManBalance( pTemp = pMan, fUpdateLevel );
109 Ivy_ManStop( pTemp );
110if ( fVerbose ) { printf( "\n" ); }
111if ( fVerbose ) { ABC_PRT( "Balance", Abc_Clock() - clk ); }
112if ( fVerbose ) Ivy_ManPrintStats( pMan );
113
114// Ivy_ManRewriteAlg( pMan, fUpdateLevel, 1 );
115clk = Abc_Clock();
116 Ivy_ManRewritePre( pMan, fUpdateLevel, 1, 0 );
117if ( fVerbose ) { printf( "\n" ); }
118if ( fVerbose ) { ABC_PRT( "Rewrite", Abc_Clock() - clk ); }
119if ( fVerbose ) Ivy_ManPrintStats( pMan );
120
121clk = Abc_Clock();
122 pMan = Ivy_ManBalance( pTemp = pMan, fUpdateLevel );
123 Ivy_ManStop( pTemp );
124if ( fVerbose ) { printf( "\n" ); }
125if ( fVerbose ) { ABC_PRT( "Balance", Abc_Clock() - clk ); }
126if ( fVerbose ) Ivy_ManPrintStats( pMan );
127
128// Ivy_ManRewriteAlg( pMan, fUpdateLevel, 1 );
129clk = Abc_Clock();
130 Ivy_ManRewritePre( pMan, fUpdateLevel, 1, 0 );
131if ( fVerbose ) { printf( "\n" ); }
132if ( fVerbose ) { ABC_PRT( "Rewrite", Abc_Clock() - clk ); }
133if ( fVerbose ) Ivy_ManPrintStats( pMan );
134
135clk = Abc_Clock();
136 pMan = Ivy_ManBalance( pTemp = pMan, fUpdateLevel );
137 Ivy_ManStop( pTemp );
138if ( fVerbose ) { printf( "\n" ); }
139if ( fVerbose ) { ABC_PRT( "Balance", Abc_Clock() - clk ); }
140if ( fVerbose ) Ivy_ManPrintStats( pMan );
141 return pMan;
142}
#define ABC_PRT(a, t)
Definition abc_global.h:255
int Ivy_ManRewritePre(Ivy_Man_t *p, int fUpdateLevel, int fUseZeroCost, int fVerbose)
FUNCTION DEFINITIONS ///.
Definition ivyRwr.c:55
Ivy_Man_t * Ivy_ManBalance(Ivy_Man_t *p, int fUpdateLevel)
FUNCTION DECLARATIONS ///.
Definition ivyBalance.c:51
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ManResyn0()

Ivy_Man_t * Ivy_ManResyn0 ( Ivy_Man_t * pMan,
int fUpdateLevel,
int fVerbose )
extern

DECLARATIONS ///.

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

FileName [ivyResyn.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [And-Inverter Graph package.]

Synopsis [AIG rewriting script.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - May 11, 2006.]

Revision [

Id
ivyResyn.c,v 1.00 2006/05/11 00:00:00 alanmi Exp

] FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Performs several passes of rewriting on the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file ivyResyn.c.

46{
47 abctime clk;
48 Ivy_Man_t * pTemp;
49
50if ( fVerbose ) { printf( "Original:\n" ); }
51if ( fVerbose ) Ivy_ManPrintStats( pMan );
52
53clk = Abc_Clock();
54 pMan = Ivy_ManBalance( pMan, fUpdateLevel );
55if ( fVerbose ) { printf( "\n" ); }
56if ( fVerbose ) { ABC_PRT( "Balance", Abc_Clock() - clk ); }
57if ( fVerbose ) Ivy_ManPrintStats( pMan );
58
59// Ivy_ManRewriteAlg( pMan, fUpdateLevel, 0 );
60clk = Abc_Clock();
61 Ivy_ManRewritePre( pMan, fUpdateLevel, 0, 0 );
62if ( fVerbose ) { printf( "\n" ); }
63if ( fVerbose ) { ABC_PRT( "Rewrite", Abc_Clock() - clk ); }
64if ( fVerbose ) Ivy_ManPrintStats( pMan );
65
66clk = Abc_Clock();
67 pMan = Ivy_ManBalance( pTemp = pMan, fUpdateLevel );
68 Ivy_ManStop( pTemp );
69if ( fVerbose ) { printf( "\n" ); }
70if ( fVerbose ) { ABC_PRT( "Balance", Abc_Clock() - clk ); }
71if ( fVerbose ) Ivy_ManPrintStats( pMan );
72 return pMan;
73}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ManRewriteAlg()

int Ivy_ManRewriteAlg ( Ivy_Man_t * p,
int fUpdateLevel,
int fUseZeroCost )
extern

FUNCTION DEFINITIONS ///.

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

Synopsis [Algebraic AIG rewriting.]

Description []

SideEffects []

SeeAlso []

Definition at line 49 of file ivyRwrAlg.c.

50{
51 Vec_Int_t * vRequired;
52 Vec_Ptr_t * vFront, * vLeaves, * vCone, * vSol;
53 Ivy_Obj_t * pObj, * pResult;
54 int i, RetValue, LevelR, nNodesOld;
55 int CountUsed, CountUndo;
56 vRequired = fUpdateLevel? Ivy_ManRequiredLevels( p ) : NULL;
57 vFront = Vec_PtrAlloc( 100 );
58 vLeaves = Vec_PtrAlloc( 100 );
59 vCone = Vec_PtrAlloc( 100 );
60 vSol = Vec_PtrAlloc( 100 );
61 // go through the nodes in the topological order
62 CountUsed = CountUndo = 0;
63 nNodesOld = Ivy_ManObjIdNext(p);
64 Ivy_ManForEachObj( p, pObj, i )
65 {
66 assert( !Ivy_ObjIsBuf(pObj) );
67 if ( i >= nNodesOld )
68 break;
69 // skip no-nodes and MUX roots
70 if ( !Ivy_ObjIsNode(pObj) || Ivy_ObjIsExor(pObj) || Ivy_ObjIsMuxType(pObj) )
71 continue;
72// if ( pObj->Id > 297 ) // 296 --- 297
73// break;
74 if ( pObj->Id == 297 )
75 {
76 int x = 0;
77 }
78 // get the largest algebraic cut
79 RetValue = Ivy_ManFindAlgCut( pObj, vFront, vLeaves, vCone );
80 // the case of a trivial tree cut
81 if ( RetValue == 1 )
82 continue;
83 // the case of constant 0 cone
84 if ( RetValue == -1 )
85 {
86 Ivy_ObjReplace( pObj, Ivy_ManConst0(p), 1, 0, 1 );
87 continue;
88 }
89 assert( Vec_PtrSize(vLeaves) > 2 );
90 // get the required level for this node
91 LevelR = vRequired? Vec_IntEntry(vRequired, pObj->Id) : 1000000;
92 // create a new cone
93 pResult = Ivy_NodeRewriteAlg( pObj, vFront, vLeaves, vCone, vSol, LevelR, fUseZeroCost );
94 if ( pResult == NULL || pResult == pObj )
95 continue;
96 assert( Vec_PtrSize(vSol) == 1 || !Ivy_IsComplement(pResult) );
97 if ( Ivy_ObjLevel(Ivy_Regular(pResult)) > LevelR && Ivy_ObjRefs(Ivy_Regular(pResult)) == 0 )
98 Ivy_ObjDelete_rec(Ivy_Regular(pResult), 1), CountUndo++;
99 else
100 Ivy_ObjReplace( pObj, pResult, 1, 0, 1 ), CountUsed++;
101 }
102 printf( "Used = %d. Undo = %d.\n", CountUsed, CountUndo );
103 Vec_PtrFree( vFront );
104 Vec_PtrFree( vCone );
105 Vec_PtrFree( vSol );
106 if ( vRequired ) Vec_IntFree( vRequired );
107 if ( i = Ivy_ManCleanup(p) )
108 printf( "Cleanup after rewriting removed %d dangling nodes.\n", i );
109 if ( !Ivy_ManCheck(p) )
110 printf( "Ivy_ManRewriteAlg(): The check has failed.\n" );
111 return 1;
112}
Vec_Int_t * Ivy_ManRequiredLevels(Ivy_Man_t *p)
Definition ivyDfs.c:250
void Ivy_ObjReplace(Ivy_Man_t *p, Ivy_Obj_t *pObjOld, Ivy_Obj_t *pObjNew, int fDeleteOld, int fFreeTop, int fUpdateLevel)
Definition ivyObj.c:328
int Ivy_ObjIsMuxType(Ivy_Obj_t *pObj)
Definition ivyUtil.c:479
Here is the call graph for this function:

◆ Ivy_ManRewritePre()

int Ivy_ManRewritePre ( Ivy_Man_t * p,
int fUpdateLevel,
int fUseZeroCost,
int fVerbose )
extern

FUNCTION DEFINITIONS ///.

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

Synopsis [Performs incremental rewriting of the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 55 of file ivyRwr.c.

56{
57 Rwt_Man_t * pManRwt;
58 Ivy_Obj_t * pNode;
59 int i, nNodes, nGain;
60 abctime clk, clkStart = Abc_Clock();
61 // start the rewriting manager
62 pManRwt = Rwt_ManStart( 0 );
63 p->pData = pManRwt;
64 if ( pManRwt == NULL )
65 return 0;
66 // create fanouts
67 if ( fUpdateLevel && p->fFanout == 0 )
69 // compute the reverse levels if level update is requested
70 if ( fUpdateLevel )
72 // set the number of levels
73// p->nLevelMax = Ivy_ManLevels( p );
74 // resynthesize each node once
75 nNodes = Ivy_ManObjIdMax(p);
76 Ivy_ManForEachNode( p, pNode, i )
77 {
78 // fix the fanin buffer problem
79 Ivy_NodeFixBufferFanins( p, pNode, 1 );
80 if ( Ivy_ObjIsBuf(pNode) )
81 continue;
82 // stop if all nodes have been tried once
83 if ( i > nNodes )
84 break;
85 // for each cut, try to resynthesize it
86 nGain = Ivy_NodeRewrite( p, pManRwt, pNode, fUpdateLevel, fUseZeroCost );
87 if ( nGain > 0 || (nGain == 0 && fUseZeroCost) )
88 {
89 Dec_Graph_t * pGraph = (Dec_Graph_t *)Rwt_ManReadDecs(pManRwt);
90 int fCompl = Rwt_ManReadCompl(pManRwt);
91/*
92 {
93 Ivy_Obj_t * pObj;
94 int i;
95 printf( "USING: (" );
96 Vec_PtrForEachEntry( Ivy_Obj_t *, Rwt_ManReadLeaves(pManRwt), pObj, i )
97 printf( "%d ", Ivy_ObjFanoutNum(Ivy_Regular(pObj)) );
98 printf( ") Gain = %d.\n", nGain );
99 }
100 if ( nGain > 0 )
101 { // print stats on the MFFC
102 extern void Ivy_NodeMffcConeSuppPrint( Ivy_Obj_t * pNode );
103 printf( "Node %6d : Gain = %4d ", pNode->Id, nGain );
104 Ivy_NodeMffcConeSuppPrint( pNode );
105 }
106*/
107 // complement the FF if needed
108clk = Abc_Clock();
109 if ( fCompl ) Dec_GraphComplement( pGraph );
110 Ivy_GraphUpdateNetwork( p, pNode, pGraph, fUpdateLevel, nGain );
111 if ( fCompl ) Dec_GraphComplement( pGraph );
112Rwt_ManAddTimeUpdate( pManRwt, Abc_Clock() - clk );
113 }
114 }
115Rwt_ManAddTimeTotal( pManRwt, Abc_Clock() - clkStart );
116 // print stats
117 if ( fVerbose )
118 Rwt_ManPrintStats( pManRwt );
119 // delete the managers
120 Rwt_ManStop( pManRwt );
121 p->pData = NULL;
122 // fix the levels
123 if ( fUpdateLevel )
124 Vec_IntFree( p->vRequired ), p->vRequired = NULL;
125 else
127 // check
128 if ( (i = Ivy_ManCleanup(p)) )
129 printf( "Cleanup after rewriting removed %d dangling nodes.\n", i );
130 if ( !Ivy_ManCheck(p) )
131 printf( "Ivy_ManRewritePre(): The check has failed.\n" );
132 return 1;
133}
struct Dec_Graph_t_ Dec_Graph_t
Definition dec.h:68
struct Rwt_Man_t_ Rwt_Man_t
Definition rwt.h:55
void Rwt_ManPrintStats(Rwt_Man_t *p)
Definition rwtMan.c:183
int Rwt_ManReadCompl(Rwt_Man_t *p)
Definition rwtMan.c:285
void Rwt_ManAddTimeUpdate(Rwt_Man_t *p, abctime Time)
Definition rwtMan.c:317
void * Rwt_ManReadDecs(Rwt_Man_t *p)
Definition rwtMan.c:253
void Rwt_ManAddTimeTotal(Rwt_Man_t *p, abctime Time)
Definition rwtMan.c:333
void Rwt_ManStop(Rwt_Man_t *p)
Definition rwtMan.c:149
Rwt_Man_t * Rwt_ManStart(int fPrecompute)
Definition rwtMan.c:87
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ManRewriteSeq()

int Ivy_ManRewriteSeq ( Ivy_Man_t * p,
int fUseZeroCost,
int fVerbose )
extern

FUNCTION DEFINITIONS ///.

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

Synopsis [Performs incremental rewriting of the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 63 of file ivySeq.c.

64{
65 Rwt_Man_t * pManRwt;
66 Ivy_Obj_t * pNode;
67 int i, nNodes, nGain;
68 abctime clk, clkStart = Abc_Clock();
69
70 // set the DC latch values
71 Ivy_ManForEachLatch( p, pNode, i )
72 pNode->Init = IVY_INIT_DC;
73 // start the rewriting manager
74 pManRwt = Rwt_ManStart( 0 );
75 p->pData = pManRwt;
76 if ( pManRwt == NULL )
77 return 0;
78 // create fanouts
79 if ( p->fFanout == 0 )
81 // resynthesize each node once
82 nNodes = Ivy_ManObjIdMax(p);
83 Ivy_ManForEachNode( p, pNode, i )
84 {
85 assert( !Ivy_ObjIsBuf(pNode) );
86 assert( !Ivy_ObjIsBuf(Ivy_ObjFanin0(pNode)) );
87 assert( !Ivy_ObjIsBuf(Ivy_ObjFanin1(pNode)) );
88 // fix the fanin buffer problem
89// Ivy_NodeFixBufferFanins( p, pNode );
90// if ( Ivy_ObjIsBuf(pNode) )
91// continue;
92 // stop if all nodes have been tried once
93 if ( i > nNodes )
94 break;
95 // for each cut, try to resynthesize it
96 nGain = Ivy_NodeRewriteSeq( p, pManRwt, pNode, fUseZeroCost );
97 if ( nGain > 0 || (nGain == 0 && fUseZeroCost) )
98 {
99 Dec_Graph_t * pGraph = (Dec_Graph_t *)Rwt_ManReadDecs(pManRwt);
100 int fCompl = Rwt_ManReadCompl(pManRwt);
101 // complement the FF if needed
102clk = Abc_Clock();
103 if ( fCompl ) Dec_GraphComplement( pGraph );
104 Ivy_GraphUpdateNetworkSeq( p, pNode, pGraph, nGain );
105 if ( fCompl ) Dec_GraphComplement( pGraph );
106Rwt_ManAddTimeUpdate( pManRwt, Abc_Clock() - clk );
107 }
108 }
109Rwt_ManAddTimeTotal( pManRwt, Abc_Clock() - clkStart );
110 // print stats
111 if ( fVerbose )
112 Rwt_ManPrintStats( pManRwt );
113 // delete the managers
114 Rwt_ManStop( pManRwt );
115 p->pData = NULL;
116 // fix the levels
118// if ( Ivy_ManCheckFanoutNums(p) )
119// printf( "Ivy_ManRewritePre(): The check has failed.\n" );
120 // check
121 if ( !Ivy_ManCheck(p) )
122 printf( "Ivy_ManRewritePre(): The check has failed.\n" );
123 return 1;
124}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ManRwsat()

Ivy_Man_t * Ivy_ManRwsat ( Ivy_Man_t * pMan,
int fVerbose )
extern

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

Synopsis [Performs several passes of rewriting on the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 155 of file ivyResyn.c.

156{
157 abctime clk;
158 Ivy_Man_t * pTemp;
159
160if ( fVerbose ) { printf( "Original:\n" ); }
161if ( fVerbose ) Ivy_ManPrintStats( pMan );
162
163clk = Abc_Clock();
164 Ivy_ManRewritePre( pMan, 0, 0, 0 );
165if ( fVerbose ) { printf( "\n" ); }
166if ( fVerbose ) { ABC_PRT( "Rewrite", Abc_Clock() - clk ); }
167if ( fVerbose ) Ivy_ManPrintStats( pMan );
168
169clk = Abc_Clock();
170 pMan = Ivy_ManBalance( pTemp = pMan, 0 );
171// pMan = Ivy_ManDup( pTemp = pMan );
172 Ivy_ManStop( pTemp );
173if ( fVerbose ) { printf( "\n" ); }
174if ( fVerbose ) { ABC_PRT( "Balance", Abc_Clock() - clk ); }
175if ( fVerbose ) Ivy_ManPrintStats( pMan );
176
177/*
178clk = Abc_Clock();
179 Ivy_ManRewritePre( pMan, 0, 0, 0 );
180if ( fVerbose ) { printf( "\n" ); }
181if ( fVerbose ) { ABC_PRT( "Rewrite", Abc_Clock() - clk ); }
182if ( fVerbose ) Ivy_ManPrintStats( pMan );
183
184clk = Abc_Clock();
185 pMan = Ivy_ManBalance( pTemp = pMan, 0 );
186 Ivy_ManStop( pTemp );
187if ( fVerbose ) { printf( "\n" ); }
188if ( fVerbose ) { ABC_PRT( "Balance", Abc_Clock() - clk ); }
189if ( fVerbose ) Ivy_ManPrintStats( pMan );
190*/
191 return pMan;
192}
Here is the call graph for this function:

◆ Ivy_ManSeqFindCut()

void Ivy_ManSeqFindCut ( Ivy_Man_t * p,
Ivy_Obj_t * pRoot,
Vec_Int_t * vFront,
Vec_Int_t * vInside,
int nSize )
extern

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

Synopsis [Computes one sequential cut of the given size.]

Description []

SideEffects []

SeeAlso []

Definition at line 183 of file ivyCut.c.

184{
185 assert( !Ivy_IsComplement(pRoot) );
186 assert( Ivy_ObjIsNode(pRoot) );
187 assert( Ivy_ObjFaninId0(pRoot) );
188 assert( Ivy_ObjFaninId1(pRoot) );
189
190 // start the cut
191 Vec_IntClear( vFront );
192 Vec_IntPush( vFront, Ivy_LeafCreate(Ivy_ObjFaninId0(pRoot), 0) );
193 Vec_IntPush( vFront, Ivy_LeafCreate(Ivy_ObjFaninId1(pRoot), 0) );
194
195 // start the visited nodes
196 Vec_IntClear( vInside );
197 Vec_IntPush( vInside, Ivy_LeafCreate(pRoot->Id, 0) );
198 Vec_IntPush( vInside, Ivy_LeafCreate(Ivy_ObjFaninId0(pRoot), 0) );
199 Vec_IntPush( vInside, Ivy_LeafCreate(Ivy_ObjFaninId1(pRoot), 0) );
200
201 // compute the cut
202 while ( Ivy_ManSeqFindCut_int( p, vFront, vInside, nSize ) );
203 assert( Vec_IntSize(vFront) <= nSize );
204}
int Ivy_ManSeqFindCut_int(Ivy_Man_t *p, Vec_Int_t *vFront, Vec_Int_t *vInside, int nSizeLimit)
Definition ivyCut.c:90
Here is the call graph for this function:

◆ Ivy_ManSeqRewrite()

int Ivy_ManSeqRewrite ( Ivy_Man_t * p,
int fUpdateLevel,
int fUseZeroCost )
extern

◆ Ivy_ManSetLevels()

int Ivy_ManSetLevels ( Ivy_Man_t * p,
int fHaig )
extern

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

Synopsis [Sets the levels of the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 457 of file ivyDfs.c.

458{
459 Ivy_Obj_t * pObj;
460 int i, LevelMax;
461 // check if CIs have choices
462 if ( fHaig )
463 {
464 Ivy_ManForEachCi( p, pObj, i )
465 if ( pObj->pEquiv )
466 printf( "CI %d has a choice, which will not be visualized.\n", pObj->Id );
467 }
468 // clean the levels
469 Ivy_ManForEachObj( p, pObj, i )
470 pObj->Level = 0;
471 // compute the levels
472 LevelMax = 0;
473 Ivy_ManForEachCo( p, pObj, i )
474 {
475 Ivy_ManSetLevels_rec( Ivy_ObjFanin0(pObj), fHaig );
476 LevelMax = IVY_MAX( LevelMax, (int)Ivy_ObjFanin0(pObj)->Level );
477 }
478 // compute levels of nodes without fanout
479 Ivy_ManForEachObj( p, pObj, i )
480 if ( (Ivy_ObjIsNode(pObj) || Ivy_ObjIsBuf(pObj)) && Ivy_ObjRefs(pObj) == 0 )
481 {
482 Ivy_ManSetLevels_rec( pObj, fHaig );
483 LevelMax = IVY_MAX( LevelMax, (int)pObj->Level );
484 }
485 // clean the marks
486 Ivy_ManForEachObj( p, pObj, i )
487 Ivy_ObjClearMarkA(pObj);
488 return LevelMax;
489}
int Ivy_ManSetLevels_rec(Ivy_Obj_t *pObj, int fHaig)
Definition ivyDfs.c:408
#define Ivy_ManForEachCi(p, pObj, i)
Definition ivy.h:396
Here is the call graph for this function:

◆ Ivy_ManShow()

void Ivy_ManShow ( Ivy_Man_t * pMan,
int fHaig,
Vec_Ptr_t * vBold )
extern

FUNCTION DEFINITIONS ///.

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 47 of file ivyShow.c.

48{
49 extern void Abc_ShowFile( char * FileNameDot, int fKeepDot );
50 static int Counter = 0;
51 char FileNameDot[200];
52 FILE * pFile;
53 // create the file name
54// Ivy_ShowGetFileName( pMan->pName, FileNameDot );
55 sprintf( FileNameDot, "temp%02d.dot", Counter++ );
56 // check that the file can be opened
57 if ( (pFile = fopen( FileNameDot, "w" )) == NULL )
58 {
59 fprintf( stdout, "Cannot open the intermediate file \"%s\".\n", FileNameDot );
60 return;
61 }
62 fclose( pFile );
63 // generate the file
64 Ivy_WriteDotAig( pMan, FileNameDot, fHaig, vBold );
65 // visualize the file
66 Abc_ShowFile( FileNameDot, 0 );
67}
ABC_NAMESPACE_IMPL_START void Abc_ShowFile(char *FileNameDot, int fKeepDot)
DECLARATIONS ///.
Definition abcShow.c:326
char * sprintf()
Here is the call graph for this function:

◆ Ivy_ManStart()

Ivy_Man_t * Ivy_ManStart ( )
extern

DECLARATIONS ///.

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

FileName [ivyMan.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [And-Inverter Graph package.]

Synopsis [AIG manager.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - May 11, 2006.]

Revision [

Id
ivy_.c,v 1.00 2006/05/11 00:00:00 alanmi Exp

] FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Starts the AIG manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file ivyMan.c.

46{
47 Ivy_Man_t * p;
48 // start the manager
49 p = ABC_ALLOC( Ivy_Man_t, 1 );
50 memset( p, 0, sizeof(Ivy_Man_t) );
51 // perform initializations
52 p->Ghost.Id = -1;
53 p->nTravIds = 1;
54 p->fCatchExor = 1;
55 // allocate arrays for nodes
56 p->vPis = Vec_PtrAlloc( 100 );
57 p->vPos = Vec_PtrAlloc( 100 );
58 p->vBufs = Vec_PtrAlloc( 100 );
59 p->vObjs = Vec_PtrAlloc( 100 );
60 // prepare the internal memory manager
62 // create the constant node
63 p->pConst1 = Ivy_ManFetchMemory( p );
64 p->pConst1->fPhase = 1;
65 Vec_PtrPush( p->vObjs, p->pConst1 );
66 p->nCreated = 1;
67 // start the table
68 p->nTableSize = 10007;
69 p->pTable = ABC_ALLOC( int, p->nTableSize );
70 memset( p->pTable, 0, sizeof(int) * p->nTableSize );
71 return p;
72}
void Ivy_ManStartMemory(Ivy_Man_t *p)
FUNCTION DEFINITIONS ///.
Definition ivyMem.c:49
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ManStartFanout()

void Ivy_ManStartFanout ( Ivy_Man_t * p)
extern

FUNCTION DEFINITIONS ///.

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

Synopsis [Starts the fanout representation.]

Description []

SideEffects []

SeeAlso []

Definition at line 136 of file ivyFanout.c.

137{
138 Ivy_Obj_t * pObj;
139 int i;
140 assert( !p->fFanout );
141 p->fFanout = 1;
142 Ivy_ManForEachObj( p, pObj, i )
143 {
144 if ( Ivy_ObjFanin0(pObj) )
145 Ivy_ObjAddFanout( p, Ivy_ObjFanin0(pObj), pObj );
146 if ( Ivy_ObjFanin1(pObj) )
147 Ivy_ObjAddFanout( p, Ivy_ObjFanin1(pObj), pObj );
148 }
149}
void Ivy_ObjAddFanout(Ivy_Man_t *p, Ivy_Obj_t *pFanin, Ivy_Obj_t *pFanout)
Definition ivyFanout.c:183
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ManStartFrom()

Ivy_Man_t * Ivy_ManStartFrom ( Ivy_Man_t * p)
extern

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

Synopsis [Duplicates the AIG manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 85 of file ivyMan.c.

86{
87 Ivy_Man_t * pNew;
88 Ivy_Obj_t * pObj;
89 int i;
90 // create the new manager
91 pNew = Ivy_ManStart();
92 // create the PIs
93 Ivy_ManConst1(p)->pEquiv = Ivy_ManConst1(pNew);
94 Ivy_ManForEachPi( p, pObj, i )
95 pObj->pEquiv = Ivy_ObjCreatePi(pNew);
96 return pNew;
97}
Here is the call graph for this function:

◆ Ivy_ManStartMemory()

void Ivy_ManStartMemory ( Ivy_Man_t * p)
extern

FUNCTION DEFINITIONS ///.

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

Synopsis [Starts the internal memory manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 49 of file ivyMem.c.

50{
51 p->vChunks = Vec_PtrAlloc( 128 );
52 p->vPages = Vec_PtrAlloc( 128 );
53}
Here is the caller graph for this function:

◆ Ivy_ManStop()

void Ivy_ManStop ( Ivy_Man_t * p)
extern

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

Synopsis [Stops the AIG manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 238 of file ivyMan.c.

239{
240 if ( p->time1 ) { ABC_PRT( "Update lev ", p->time1 ); }
241 if ( p->time2 ) { ABC_PRT( "Update levR ", p->time2 ); }
242// Ivy_TableProfile( p );
243// if ( p->vFanouts ) Ivy_ManStopFanout( p );
244 if ( p->vChunks ) Ivy_ManStopMemory( p );
245 if ( p->vRequired ) Vec_IntFree( p->vRequired );
246 if ( p->vPis ) Vec_PtrFree( p->vPis );
247 if ( p->vPos ) Vec_PtrFree( p->vPos );
248 if ( p->vBufs ) Vec_PtrFree( p->vBufs );
249 if ( p->vObjs ) Vec_PtrFree( p->vObjs );
250 ABC_FREE( p->pTable );
251 ABC_FREE( p );
252}
void Ivy_ManStopMemory(Ivy_Man_t *p)
Definition ivyMem.c:66
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ManStopFanout()

void Ivy_ManStopFanout ( Ivy_Man_t * p)
extern

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

Synopsis [Stops the fanout representation.]

Description []

SideEffects []

SeeAlso []

Definition at line 162 of file ivyFanout.c.

163{
164 Ivy_Obj_t * pObj;
165 int i;
166 assert( p->fFanout );
167 p->fFanout = 0;
168 Ivy_ManForEachObj( p, pObj, i )
169 pObj->pFanout = pObj->pNextFan0 = pObj->pNextFan1 = pObj->pPrevFan0 = pObj->pPrevFan1 = NULL;
170}
Ivy_Obj_t * pFanout
Definition ivy.h:88

◆ Ivy_ManStopMemory()

void Ivy_ManStopMemory ( Ivy_Man_t * p)
extern

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

Synopsis [Stops the internal memory manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 66 of file ivyMem.c.

67{
68 void * pMemory;
69 int i;
70 Vec_PtrForEachEntry( void *, p->vChunks, pMemory, i )
71 ABC_FREE( pMemory );
72 Vec_PtrFree( p->vChunks );
73 Vec_PtrFree( p->vPages );
74 p->pListFree = NULL;
75}
Here is the caller graph for this function:

◆ Ivy_Miter()

Ivy_Obj_t * Ivy_Miter ( Ivy_Man_t * p,
Vec_Ptr_t * vPairs )
extern

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

Synopsis [Implements the miter.]

Description []

SideEffects []

SeeAlso []

Definition at line 264 of file ivyOper.c.

265{
266 int i;
267 assert( vPairs->nSize > 0 );
268 assert( vPairs->nSize % 2 == 0 );
269 // go through the cubes of the node's SOP
270 for ( i = 0; i < vPairs->nSize; i += 2 )
271 vPairs->pArray[i/2] = Ivy_Not( Ivy_Exor( p, (Ivy_Obj_t *)vPairs->pArray[i], (Ivy_Obj_t *)vPairs->pArray[i+1] ) );
272 vPairs->nSize = vPairs->nSize/2;
273 return Ivy_Not( Ivy_Multi_rec( p, (Ivy_Obj_t **)vPairs->pArray, vPairs->nSize, IVY_AND ) );
274}
Ivy_Obj_t * Ivy_Multi_rec(Ivy_Man_t *p, Ivy_Obj_t **ppObjs, int nObjs, Ivy_Type_t Type)
Definition ivyOper.c:225
Ivy_Obj_t * Ivy_Exor(Ivy_Man_t *p, Ivy_Obj_t *p0, Ivy_Obj_t *p1)
Definition ivyOper.c:113
Here is the call graph for this function:

◆ Ivy_Multi()

Ivy_Obj_t * Ivy_Multi ( Ivy_Man_t * p,
Ivy_Obj_t ** pArgs,
int nArgs,
Ivy_Type_t Type )
extern

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

Synopsis [Old code.]

Description []

SideEffects []

SeeAlso []

Definition at line 246 of file ivyOper.c.

247{
248 assert( Type == IVY_AND || Type == IVY_EXOR );
249 assert( nArgs > 0 );
250 return Ivy_Multi_rec( p, pArgs, nArgs, Type );
251}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_Multi1()

Ivy_Obj_t * Ivy_Multi1 ( Ivy_Man_t * p,
Ivy_Obj_t ** pArgs,
int nArgs,
Ivy_Type_t Type )
extern

◆ Ivy_Multi_rec()

Ivy_Obj_t * Ivy_Multi_rec ( Ivy_Man_t * p,
Ivy_Obj_t ** ppObjs,
int nObjs,
Ivy_Type_t Type )
extern

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

Synopsis [Constructs the well-balanced tree of gates.]

Description [Disregards levels and possible logic sharing.]

SideEffects []

SeeAlso []

Definition at line 225 of file ivyOper.c.

226{
227 Ivy_Obj_t * pObj1, * pObj2;
228 if ( nObjs == 1 )
229 return ppObjs[0];
230 pObj1 = Ivy_Multi_rec( p, ppObjs, nObjs/2, Type );
231 pObj2 = Ivy_Multi_rec( p, ppObjs + nObjs/2, nObjs - nObjs/2, Type );
232 return Ivy_Oper( p, pObj1, pObj2, Type );
233}
Ivy_Obj_t * Ivy_Oper(Ivy_Man_t *p, Ivy_Obj_t *p0, Ivy_Obj_t *p1, Ivy_Type_t Type)
FUNCTION DEFINITIONS ///.
Definition ivyOper.c:63
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_MultiBalance_rec()

Ivy_Obj_t * Ivy_MultiBalance_rec ( Ivy_Man_t * p,
Ivy_Obj_t ** pArgs,
int nArgs,
Ivy_Type_t Type )
extern

◆ Ivy_MultiPlus()

int Ivy_MultiPlus ( Ivy_Man_t * p,
Vec_Ptr_t * vLeaves,
Vec_Ptr_t * vCone,
Ivy_Type_t Type,
int nLimit,
Vec_Ptr_t * vSols )
extern

FUNCTION DEFINITIONS ///.

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

Synopsis [Constructs a balanced tree while taking sharing into account.]

Description [Returns 1 if the implementation exists.]

SideEffects []

SeeAlso []

Definition at line 58 of file ivyMulti.c.

59{
60 static Ivy_Eva_t pEvals[IVY_EVAL_LIMIT];
61 Ivy_Eva_t * pEval, * pFan0, * pFan1;
62 Ivy_Obj_t * pObj = NULL; // Suppress "might be used uninitialized"
63 Ivy_Obj_t * pTemp;
64 int nEvals, nEvalsOld, i, k, x, nLeaves;
65 unsigned uMaskAll;
66
67 // consider special cases
68 nLeaves = Vec_PtrSize(vLeaves);
69 assert( nLeaves > 2 );
70 if ( nLeaves > 32 || nLeaves + Vec_PtrSize(vCone) > IVY_EVAL_LIMIT )
71 return 0;
72// if ( nLeaves == 1 )
73// return Vec_PtrEntry( vLeaves, 0 );
74// if ( nLeaves == 2 )
75// return Ivy_Oper( Vec_PtrEntry(vLeaves, 0), Vec_PtrEntry(vLeaves, 1), Type );
76
77 // set the leaf entries
78 uMaskAll = ((1 << nLeaves) - 1);
79 nEvals = 0;
80 Vec_PtrForEachEntry( Ivy_Obj_t *, vLeaves, pObj, i )
81 {
82 pEval = pEvals + nEvals;
83 pEval->pArg = pObj;
84 pEval->Mask = (1 << nEvals);
85 pEval->Weight = 1;
86 // mark the leaf
87 Ivy_Regular(pObj)->TravId = nEvals;
88 nEvals++;
89 }
90
91 // propagate masks through the cone
92 Vec_PtrForEachEntry( Ivy_Obj_t *, vCone, pObj, i )
93 {
94 pObj->TravId = nEvals + i;
95 if ( Ivy_ObjIsBuf(pObj) )
96 pEvals[pObj->TravId].Mask = pEvals[Ivy_ObjFanin0(pObj)->TravId].Mask;
97 else
98 pEvals[pObj->TravId].Mask = pEvals[Ivy_ObjFanin0(pObj)->TravId].Mask | pEvals[Ivy_ObjFanin1(pObj)->TravId].Mask;
99 }
100
101 // set the internal entries
102 Vec_PtrForEachEntry( Ivy_Obj_t *, vCone, pObj, i )
103 {
104 if ( i == Vec_PtrSize(vCone) - 1 )
105 break;
106 // skip buffers
107 if ( Ivy_ObjIsBuf(pObj) )
108 continue;
109 // skip nodes without external fanout
110 if ( Ivy_ObjRefs(pObj) == 0 )
111 continue;
112 assert( !Ivy_IsComplement(pObj) );
113 pEval = pEvals + nEvals;
114 pEval->pArg = pObj;
115 pEval->Mask = pEvals[pObj->TravId].Mask;
116 pEval->Weight = Extra_WordCountOnes(pEval->Mask);
117 // mark the node
118 pObj->TravId = nEvals;
119 nEvals++;
120 }
121
122 // find the available nodes
123 nEvalsOld = nEvals;
124 for ( i = 1; i < nEvals; i++ )
125 for ( k = 0; k < i; k++ )
126 {
127 pFan0 = pEvals + i;
128 pFan1 = pEvals + k;
129 pTemp = Ivy_TableLookup(p, Ivy_ObjCreateGhost(p, pFan0->pArg, pFan1->pArg, Type, IVY_INIT_NONE));
130 // skip nodes in the cone
131 if ( pTemp == NULL || pTemp->fMarkB )
132 continue;
133 // skip the leaves
134 for ( x = 0; x < nLeaves; x++ )
135 if ( pTemp == Ivy_Regular((Ivy_Obj_t *)vLeaves->pArray[x]) )
136 break;
137 if ( x < nLeaves )
138 continue;
139 pEval = pEvals + nEvals;
140 pEval->pArg = pTemp;
141 pEval->Mask = pFan0->Mask | pFan1->Mask;
142 pEval->Weight = (pFan0->Mask & pFan1->Mask) ? Extra_WordCountOnes(pEval->Mask) : pFan0->Weight + pFan1->Weight;
143 // save the argument
144 pObj->TravId = nEvals;
145 nEvals++;
146 // quit if the number of entries exceeded the limit
147 if ( nEvals == IVY_EVAL_LIMIT )
148 goto Outside;
149 // quit if we found an acceptable implementation
150 if ( pEval->Mask == uMaskAll )
151 goto Outside;
152 }
153Outside:
154
155// Ivy_MultiPrint( pEvals, nLeaves, nEvals );
156 if ( !Ivy_MultiCover( p, pEvals, nLeaves, nEvals, nLimit, vSols ) )
157 return 0;
158 assert( Vec_PtrSize( vSols ) > 0 );
159 return 1;
160}
struct Ivy_Eva_t_ Ivy_Eva_t
Definition ivyMulti.c:32
#define IVY_EVAL_LIMIT
DECLARATIONS ///.
Definition ivyMulti.c:30
unsigned Mask
Definition ivyMulti.c:36
int Weight
Definition ivyMulti.c:37
Ivy_Obj_t * pArg
Definition ivyMulti.c:35
Here is the call graph for this function:

◆ Ivy_Mux()

Ivy_Obj_t * Ivy_Mux ( Ivy_Man_t * p,
Ivy_Obj_t * pC,
Ivy_Obj_t * p1,
Ivy_Obj_t * p0 )
extern

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

Synopsis [Implements ITE operation.]

Description []

SideEffects []

SeeAlso []

Definition at line 158 of file ivyOper.c.

159{
160 Ivy_Obj_t * pTempA1, * pTempA2, * pTempB1, * pTempB2, * pTemp;
161 int Count0, Count1;
162 // consider trivial cases
163 if ( p0 == Ivy_Not(p1) )
164 return Ivy_Exor( p, pC, p0 );
165 // other cases can be added
166 // implement the first MUX (F = C * x1 + C' * x0)
167 pTempA1 = Ivy_TableLookup( p, Ivy_ObjCreateGhost(p, pC, p1, IVY_AND, IVY_INIT_NONE) );
168 pTempA2 = Ivy_TableLookup( p, Ivy_ObjCreateGhost(p, Ivy_Not(pC), p0, IVY_AND, IVY_INIT_NONE) );
169 if ( pTempA1 && pTempA2 )
170 {
171 pTemp = Ivy_TableLookup( p, Ivy_ObjCreateGhost(p, Ivy_Not(pTempA1), Ivy_Not(pTempA2), IVY_AND, IVY_INIT_NONE) );
172 if ( pTemp ) return Ivy_Not(pTemp);
173 }
174 Count0 = (pTempA1 != NULL) + (pTempA2 != NULL);
175 // implement the second MUX (F' = C * x1' + C' * x0')
176 pTempB1 = Ivy_TableLookup( p, Ivy_ObjCreateGhost(p, pC, Ivy_Not(p1), IVY_AND, IVY_INIT_NONE) );
177 pTempB2 = Ivy_TableLookup( p, Ivy_ObjCreateGhost(p, Ivy_Not(pC), Ivy_Not(p0), IVY_AND, IVY_INIT_NONE) );
178 if ( pTempB1 && pTempB2 )
179 {
180 pTemp = Ivy_TableLookup( p, Ivy_ObjCreateGhost(p, Ivy_Not(pTempB1), Ivy_Not(pTempB2), IVY_AND, IVY_INIT_NONE) );
181 if ( pTemp ) return pTemp;
182 }
183 Count1 = (pTempB1 != NULL) + (pTempB2 != NULL);
184 // compare and decide which one to implement
185 if ( Count0 >= Count1 )
186 {
187 pTempA1 = pTempA1? pTempA1 : Ivy_And(p, pC, p1);
188 pTempA2 = pTempA2? pTempA2 : Ivy_And(p, Ivy_Not(pC), p0);
189 return Ivy_Or( p, pTempA1, pTempA2 );
190 }
191 pTempB1 = pTempB1? pTempB1 : Ivy_And(p, pC, Ivy_Not(p1));
192 pTempB2 = pTempB2? pTempB2 : Ivy_And(p, Ivy_Not(pC), Ivy_Not(p0));
193 return Ivy_Not( Ivy_Or( p, pTempB1, pTempB2 ) );
194
195// return Ivy_Or( Ivy_And(pC, p1), Ivy_And(Ivy_Not(pC), p0) );
196}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_NodeBalanceBuildSuper()

Ivy_Obj_t * Ivy_NodeBalanceBuildSuper ( Ivy_Man_t * p,
Vec_Ptr_t * vSuper,
Ivy_Type_t Type,
int fUpdateLevel )
extern

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

Synopsis [Builds implication supergate.]

Description []

SideEffects []

SeeAlso []

Definition at line 175 of file ivyBalance.c.

176{
177 Ivy_Obj_t * pObj1, * pObj2;
178 int LeftBound;
179 assert( vSuper->nSize > 1 );
180 // sort the new nodes by level in the decreasing order
181 Vec_PtrSort( vSuper, (int (*)(const void *, const void *))Ivy_NodeCompareLevelsDecrease );
182 // balance the nodes
183 while ( vSuper->nSize > 1 )
184 {
185 // find the left bound on the node to be paired
186 LeftBound = (!fUpdateLevel)? 0 : Ivy_NodeBalanceFindLeft( vSuper );
187 // find the node that can be shared (if no such node, randomize choice)
188 Ivy_NodeBalancePermute( p, vSuper, LeftBound, Type == IVY_EXOR );
189 // pull out the last two nodes
190 pObj1 = (Ivy_Obj_t *)Vec_PtrPop(vSuper);
191 pObj2 = (Ivy_Obj_t *)Vec_PtrPop(vSuper);
192 Ivy_NodeBalancePushUniqueOrderByLevel( vSuper, Ivy_Oper(p, pObj1, pObj2, Type) );
193 }
194 return (Ivy_Obj_t *)Vec_PtrEntry(vSuper, 0);
195}
int Ivy_NodeCompareLevelsDecrease(Ivy_Obj_t **pp1, Ivy_Obj_t **pp2)
Definition ivyBalance.c:99
Ivy_Obj_t * Ivy_Oper(Ivy_Man_t *p, Ivy_Obj_t *p0, Ivy_Obj_t *p1, Ivy_Type_t Type)
FUNCTION DEFINITIONS ///.
Definition ivyOper.c:63
Here is the call graph for this function:

◆ Ivy_NodeFindCutsAll()

Ivy_Store_t * Ivy_NodeFindCutsAll ( Ivy_Man_t * p,
Ivy_Obj_t * pObj,
int nLeaves )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 892 of file ivyCut.c.

893{
894 static Ivy_Store_t CutStore, * pCutStore = &CutStore;
895 Ivy_Cut_t CutNew, * pCutNew = &CutNew, * pCut;
896 Ivy_Obj_t * pLeaf;
897 int i, k, iLeaf0, iLeaf1;
898
899 assert( nLeaves <= IVY_CUT_INPUT );
900
901 // start the structure
902 pCutStore->nCuts = 0;
903 pCutStore->nCutsMax = IVY_CUT_LIMIT;
904 // start the trivial cut
905 pCutNew->uHash = 0;
906 pCutNew->nSize = 1;
907 pCutNew->nSizeMax = nLeaves;
908 pCutNew->pArray[0] = pObj->Id;
909 Ivy_NodeCutHash( pCutNew );
910 // add the trivial cut
911 Ivy_NodeCutFindOrAdd( pCutStore, pCutNew );
912 assert( pCutStore->nCuts == 1 );
913
914 // explore the cuts
915 for ( i = 0; i < pCutStore->nCuts; i++ )
916 {
917 // expand this cut
918 pCut = pCutStore->pCuts + i;
919 if ( pCut->nSize == 0 )
920 continue;
921 for ( k = 0; k < pCut->nSize; k++ )
922 {
923 pLeaf = Ivy_ManObj( p, pCut->pArray[k] );
924 if ( Ivy_ObjIsCi(pLeaf) )
925 continue;
926/*
927 *pCutNew = *pCut;
928 Ivy_NodeCutShrink( pCutNew, pLeaf->Id );
929 if ( !Ivy_NodeCutExtend( pCutNew, Ivy_ObjFaninId0(pLeaf) ) )
930 continue;
931 if ( Ivy_ObjIsNode(pLeaf) && !Ivy_NodeCutExtend( pCutNew, Ivy_ObjFaninId1(pLeaf) ) )
932 continue;
933 Ivy_NodeCutHash( pCutNew );
934*/
935 iLeaf0 = Ivy_ObjId( Ivy_ObjRealFanin(Ivy_ObjFanin0(pLeaf)) );
936 iLeaf1 = Ivy_ObjId( Ivy_ObjRealFanin(Ivy_ObjFanin1(pLeaf)) );
937// if ( iLeaf0 == iLeaf1 ) // strange situation observed on Jan 18, 2007
938// continue;
939 if ( !Ivy_NodeCutPrescreen( pCut, iLeaf0, iLeaf1 ) )
940 continue;
941 if ( iLeaf0 > iLeaf1 )
942 Ivy_NodeCutDeriveNew( pCut, pCutNew, pCut->pArray[k], iLeaf1, iLeaf0 );
943 else
944 Ivy_NodeCutDeriveNew( pCut, pCutNew, pCut->pArray[k], iLeaf0, iLeaf1 );
945 Ivy_NodeCutFindOrAddFilter( pCutStore, pCutNew );
946 if ( pCutStore->nCuts == IVY_CUT_LIMIT )
947 break;
948 }
949 if ( pCutStore->nCuts == IVY_CUT_LIMIT )
950 break;
951 }
952 Ivy_NodeCompactCuts( pCutStore );
953// Ivy_NodePrintCuts( pCutStore );
954 return pCutStore;
955}
int Ivy_NodeCutFindOrAdd(Ivy_Store_t *pCutStore, Ivy_Cut_t *pCutNew)
Definition ivyCut.c:680
int Ivy_NodeCutFindOrAddFilter(Ivy_Store_t *pCutStore, Ivy_Cut_t *pCutNew)
Definition ivyCut.c:742
void Ivy_NodeCompactCuts(Ivy_Store_t *pCutStore)
Definition ivyCut.c:809
struct Ivy_Cut_t_ Ivy_Cut_t
Definition ivy.h:155
#define IVY_CUT_INPUT
Definition ivy.h:153
struct Ivy_Store_t_ Ivy_Store_t
Definition ivy.h:165
#define IVY_CUT_LIMIT
Definition ivy.h:152
unsigned uHash
Definition ivy.h:162
short nSizeMax
Definition ivy.h:160
Ivy_Cut_t pCuts[IVY_CUT_LIMIT]
Definition ivy.h:172
int nCutsMax
Definition ivy.h:170
int nCuts
Definition ivy.h:168
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_NodeFixBufferFanins()

void Ivy_NodeFixBufferFanins ( Ivy_Man_t * p,
Ivy_Obj_t * pNode,
int fUpdateLevel )
extern

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

Synopsis [Fixes buffer fanins.]

Description [This situation happens because NodeReplace is a lazy procedure, which does not propagate the change to the fanouts but instead records the change in the form of a buf/inv node.]

SideEffects []

SeeAlso []

Definition at line 442 of file ivyObj.c.

443{
444 Ivy_Obj_t * pFanReal0, * pFanReal1, * pResult = NULL;
445 if ( Ivy_ObjIsPo(pNode) )
446 {
447 if ( !Ivy_ObjIsBuf(Ivy_ObjFanin0(pNode)) )
448 return;
449 pFanReal0 = Ivy_ObjReal( Ivy_ObjChild0(pNode) );
450 Ivy_ObjPatchFanin0( p, pNode, pFanReal0 );
451// Ivy_ManCheckFanouts( p );
452 return;
453 }
454 if ( !Ivy_ObjIsBuf(Ivy_ObjFanin0(pNode)) && !Ivy_ObjIsBuf(Ivy_ObjFanin1(pNode)) )
455 return;
456 // get the real fanins
457 pFanReal0 = Ivy_ObjReal( Ivy_ObjChild0(pNode) );
458 pFanReal1 = Ivy_ObjReal( Ivy_ObjChild1(pNode) );
459 // get the new node
460 if ( Ivy_ObjIsNode(pNode) )
461 pResult = Ivy_Oper( p, pFanReal0, pFanReal1, Ivy_ObjType(pNode) );
462 else if ( Ivy_ObjIsLatch(pNode) )
463 pResult = Ivy_Latch( p, pFanReal0, Ivy_ObjInit(pNode) );
464 else
465 assert( 0 );
466
467//printf( "===== Replacing %d by %d.\n", pNode->Id, pResult->Id );
468//Ivy_ObjPrintVerbose( p, pNode, 0 ); printf( "\n" );
469//Ivy_ObjPrintVerbose( p, pResult, 0 ); printf( "\n" );
470
471 // perform the replacement
472 Ivy_ObjReplace( p, pNode, pResult, 1, 0, fUpdateLevel );
473}
void Ivy_ObjReplace(Ivy_Man_t *p, Ivy_Obj_t *pObjOld, Ivy_Obj_t *pObjNew, int fDeleteOld, int fFreeTop, int fUpdateLevel)
Definition ivyObj.c:328
void Ivy_ObjPatchFanin0(Ivy_Man_t *p, Ivy_Obj_t *pObj, Ivy_Obj_t *pFaninNew)
Definition ivyObj.c:224
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ObjAddFanout()

void Ivy_ObjAddFanout ( Ivy_Man_t * p,
Ivy_Obj_t * pFanin,
Ivy_Obj_t * pFanout )
extern

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

Synopsis [Add the fanout.]

Description []

SideEffects []

SeeAlso []

Definition at line 183 of file ivyFanout.c.

184{
185 assert( p->fFanout );
186 if ( pFanin->pFanout )
187 {
188 *Ivy_ObjNextFanoutPlace(pFanin, pFanout) = pFanin->pFanout;
189 *Ivy_ObjPrevFanoutPlace(pFanin, pFanin->pFanout) = pFanout;
190 }
191 pFanin->pFanout = pFanout;
192}
Here is the caller graph for this function:

◆ Ivy_ObjCollectFanouts()

void Ivy_ObjCollectFanouts ( Ivy_Man_t * p,
Ivy_Obj_t * pObj,
Vec_Ptr_t * vArray )
extern

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

Synopsis [Starts iteration through the fanouts.]

Description [Copies the currently available fanouts into the array.]

SideEffects [Can be used while the fanouts are being removed.]

SeeAlso []

Definition at line 262 of file ivyFanout.c.

263{
264 Ivy_Obj_t * pFanout;
265 assert( p->fFanout );
266 assert( !Ivy_IsComplement(pObj) );
267 Vec_PtrClear( vArray );
268 Ivy_ObjForEachFanoutInt( pObj, pFanout )
269 Vec_PtrPush( vArray, pFanout );
270}
#define Ivy_ObjForEachFanoutInt(pObj, pFanout)
Definition ivyFanout.c:109

◆ Ivy_ObjConnect()

void Ivy_ObjConnect ( Ivy_Man_t * p,
Ivy_Obj_t * pObj,
Ivy_Obj_t * pFan0,
Ivy_Obj_t * pFan1 )
extern

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

Synopsis [Connect the object to the fanin.]

Description []

SideEffects []

SeeAlso []

Definition at line 150 of file ivyObj.c.

151{
152 assert( !Ivy_IsComplement(pObj) );
153 assert( Ivy_ObjIsPi(pObj) || Ivy_ObjIsOneFanin(pObj) || pFan1 != NULL );
154 // add the first fanin
155 pObj->pFanin0 = pFan0;
156 pObj->pFanin1 = pFan1;
157 // increment references of the fanins and add their fanouts
158 if ( Ivy_ObjFanin0(pObj) != NULL )
159 {
160 Ivy_ObjRefsInc( Ivy_ObjFanin0(pObj) );
161 if ( p->fFanout )
162 Ivy_ObjAddFanout( p, Ivy_ObjFanin0(pObj), pObj );
163 }
164 if ( Ivy_ObjFanin1(pObj) != NULL )
165 {
166 Ivy_ObjRefsInc( Ivy_ObjFanin1(pObj) );
167 if ( p->fFanout )
168 Ivy_ObjAddFanout( p, Ivy_ObjFanin1(pObj), pObj );
169 }
170 // add the node to the structural hash table
171 Ivy_TableInsert( p, pObj );
172}
void Ivy_TableInsert(Ivy_Man_t *p, Ivy_Obj_t *pObj)
Definition ivyTable.c:105
void Ivy_ObjAddFanout(Ivy_Man_t *p, Ivy_Obj_t *pObj, Ivy_Obj_t *pFanout)
Definition ivyFanout.c:183
Ivy_Obj_t * pFanin0
Definition ivy.h:86
Ivy_Obj_t * pFanin1
Definition ivy.h:87
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ObjCreate()

Ivy_Obj_t * Ivy_ObjCreate ( Ivy_Man_t * p,
Ivy_Obj_t * pGhost )
extern

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

Synopsis [Create the new node assuming it does not exist.]

Description []

SideEffects []

SeeAlso []

Definition at line 77 of file ivyObj.c.

78{
79 Ivy_Obj_t * pObj;
80 assert( !Ivy_IsComplement(pGhost) );
81 assert( Ivy_ObjIsGhost(pGhost) );
82 assert( Ivy_TableLookup(p, pGhost) == NULL );
83 // get memory for the new object
84 pObj = Ivy_ManFetchMemory( p );
85 assert( Ivy_ObjIsNone(pObj) );
86 pObj->Id = Vec_PtrSize(p->vObjs);
87 Vec_PtrPush( p->vObjs, pObj );
88 // add basic info (fanins, compls, type, init)
89 pObj->Type = pGhost->Type;
90 pObj->Init = pGhost->Init;
91 // add connections
92 Ivy_ObjConnect( p, pObj, pGhost->pFanin0, pGhost->pFanin1 );
93 // compute level
94 if ( Ivy_ObjIsNode(pObj) )
95 pObj->Level = Ivy_ObjLevelNew(pObj);
96 else if ( Ivy_ObjIsLatch(pObj) )
97 pObj->Level = 0;
98 else if ( Ivy_ObjIsOneFanin(pObj) )
99 pObj->Level = Ivy_ObjFanin0(pObj)->Level;
100 else if ( !Ivy_ObjIsPi(pObj) )
101 assert( 0 );
102 // create phase
103 if ( Ivy_ObjIsNode(pObj) )
104 pObj->fPhase = Ivy_ObjFaninPhase(Ivy_ObjChild0(pObj)) & Ivy_ObjFaninPhase(Ivy_ObjChild1(pObj));
105 else if ( Ivy_ObjIsOneFanin(pObj) )
106 pObj->fPhase = Ivy_ObjFaninPhase(Ivy_ObjChild0(pObj));
107 // set the fail TFO flag
108 if ( Ivy_ObjIsNode(pObj) )
109 pObj->fFailTfo = Ivy_ObjFanin0(pObj)->fFailTfo | Ivy_ObjFanin1(pObj)->fFailTfo;
110 // mark the fanins in a special way if the node is EXOR
111 if ( Ivy_ObjIsExor(pObj) )
112 {
113 Ivy_ObjFanin0(pObj)->fExFan = 1;
114 Ivy_ObjFanin1(pObj)->fExFan = 1;
115 }
116 // add PIs/POs to the arrays
117 if ( Ivy_ObjIsPi(pObj) )
118 Vec_PtrPush( p->vPis, pObj );
119 else if ( Ivy_ObjIsPo(pObj) )
120 Vec_PtrPush( p->vPos, pObj );
121// else if ( Ivy_ObjIsBuf(pObj) )
122// Vec_PtrPush( p->vBufs, pObj );
123 if ( p->vRequired && Vec_IntSize(p->vRequired) <= pObj->Id )
124 Vec_IntFillExtra( p->vRequired, 2 * Vec_IntSize(p->vRequired), 1000000 );
125 // update node counters of the manager
126 p->nObjs[Ivy_ObjType(pObj)]++;
127 p->nCreated++;
128
129// printf( "Adding %sAIG node: ", p->pHaig==NULL? "H":" " );
130// Ivy_ObjPrintVerbose( p, pObj, p->pHaig==NULL );
131// printf( "\n" );
132
133 // if HAIG is defined, create a corresponding node
134 if ( p->pHaig )
135 Ivy_ManHaigCreateObj( p, pObj );
136 return pObj;
137}
void Ivy_ObjConnect(Ivy_Man_t *p, Ivy_Obj_t *pObj, Ivy_Obj_t *pFan0, Ivy_Obj_t *pFan1)
Definition ivyObj.c:150
void Ivy_ManHaigCreateObj(Ivy_Man_t *p, Ivy_Obj_t *pObj)
Definition ivyHaig.c:183
unsigned fFailTfo
Definition ivy.h:82
unsigned fPhase
Definition ivy.h:81
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ObjCreatePi()

Ivy_Obj_t * Ivy_ObjCreatePi ( Ivy_Man_t * p)
extern

DECLARATIONS ///.

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

FileName [ivyObj.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [And-Inverter Graph package.]

Synopsis [Adding/removing objects.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - May 11, 2006.]

Revision [

Id
ivyObj.c,v 1.00 2006/05/11 00:00:00 alanmi Exp

] FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Create the new node assuming it does not exist.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file ivyObj.c.

46{
47 return Ivy_ObjCreate( p, Ivy_ObjCreateGhost(p, NULL, NULL, IVY_PI, IVY_INIT_NONE) );
48}
Ivy_Obj_t * Ivy_ObjCreate(Ivy_Man_t *p, Ivy_Obj_t *pGhost)
Definition ivyObj.c:77
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ObjCreatePo()

Ivy_Obj_t * Ivy_ObjCreatePo ( Ivy_Man_t * p,
Ivy_Obj_t * pDriver )
extern

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

Synopsis [Create the new node assuming it does not exist.]

Description []

SideEffects []

SeeAlso []

Definition at line 61 of file ivyObj.c.

62{
63 return Ivy_ObjCreate( p, Ivy_ObjCreateGhost(p, pDriver, NULL, IVY_PO, IVY_INIT_NONE) );
64}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ObjDelete()

void Ivy_ObjDelete ( Ivy_Man_t * p,
Ivy_Obj_t * pObj,
int fFreeTop )
extern

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

Synopsis [Deletes the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 255 of file ivyObj.c.

256{
257 assert( !Ivy_IsComplement(pObj) );
258 assert( Ivy_ObjRefs(pObj) == 0 || !fFreeTop );
259 // update node counters of the manager
260 p->nObjs[pObj->Type]--;
261 p->nDeleted++;
262 // remove connections
263 Ivy_ObjDisconnect( p, pObj );
264 // remove PIs/POs from the arrays
265 if ( Ivy_ObjIsPi(pObj) )
266 Vec_PtrRemove( p->vPis, pObj );
267 else if ( Ivy_ObjIsPo(pObj) )
268 Vec_PtrRemove( p->vPos, pObj );
269 else if ( p->fFanout && Ivy_ObjIsBuf(pObj) )
270 Vec_PtrRemove( p->vBufs, pObj );
271 // clean and recycle the entry
272 if ( fFreeTop )
273 {
274 // free the node
275 Vec_PtrWriteEntry( p->vObjs, pObj->Id, NULL );
276 Ivy_ManRecycleMemory( p, pObj );
277 }
278 else
279 {
280 int nRefsOld = pObj->nRefs;
281 Ivy_Obj_t * pFanout = pObj->pFanout;
282 Ivy_ObjClean( pObj );
283 pObj->pFanout = pFanout;
284 pObj->nRefs = nRefsOld;
285 }
286}
void Ivy_ObjDisconnect(Ivy_Man_t *p, Ivy_Obj_t *pObj)
Definition ivyObj.c:185
int nRefs
Definition ivy.h:85
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ObjDelete_rec()

void Ivy_ObjDelete_rec ( Ivy_Man_t * p,
Ivy_Obj_t * pObj,
int fFreeTop )
extern

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

Synopsis [Deletes the MFFC of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 299 of file ivyObj.c.

300{
301 Ivy_Obj_t * pFanin0, * pFanin1;
302 assert( !Ivy_IsComplement(pObj) );
303 assert( !Ivy_ObjIsNone(pObj) );
304 if ( Ivy_ObjIsConst1(pObj) || Ivy_ObjIsPi(pObj) )
305 return;
306 pFanin0 = Ivy_ObjFanin0(pObj);
307 pFanin1 = Ivy_ObjFanin1(pObj);
308 Ivy_ObjDelete( p, pObj, fFreeTop );
309 if ( pFanin0 && !Ivy_ObjIsNone(pFanin0) && Ivy_ObjRefs(pFanin0) == 0 )
310 Ivy_ObjDelete_rec( p, pFanin0, 1 );
311 if ( pFanin1 && !Ivy_ObjIsNone(pFanin1) && Ivy_ObjRefs(pFanin1) == 0 )
312 Ivy_ObjDelete_rec( p, pFanin1, 1 );
313}
void Ivy_ObjDelete(Ivy_Man_t *p, Ivy_Obj_t *pObj, int fFreeTop)
Definition ivyObj.c:255
void Ivy_ObjDelete_rec(Ivy_Man_t *p, Ivy_Obj_t *pObj, int fFreeTop)
Definition ivyObj.c:299
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ObjDeleteFanout()

void Ivy_ObjDeleteFanout ( Ivy_Man_t * p,
Ivy_Obj_t * pFanin,
Ivy_Obj_t * pFanout )
extern

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

Synopsis [Removes the fanout.]

Description []

SideEffects []

SeeAlso []

Definition at line 205 of file ivyFanout.c.

206{
207 Ivy_Obj_t ** ppPlace1, ** ppPlace2, ** ppPlaceN;
208 assert( pFanin->pFanout != NULL );
209
210 ppPlace1 = Ivy_ObjNextFanoutPlace(pFanin, pFanout);
211 ppPlaceN = Ivy_ObjPrevNextFanoutPlace(pFanin, pFanout);
212 assert( *ppPlaceN == pFanout );
213 if ( ppPlaceN )
214 *ppPlaceN = *ppPlace1;
215
216 ppPlace2 = Ivy_ObjPrevFanoutPlace(pFanin, pFanout);
217 ppPlaceN = Ivy_ObjNextPrevFanoutPlace(pFanin, pFanout);
218 assert( ppPlaceN == NULL || *ppPlaceN == pFanout );
219 if ( ppPlaceN )
220 *ppPlaceN = *ppPlace2;
221
222 *ppPlace1 = NULL;
223 *ppPlace2 = NULL;
224}
Here is the caller graph for this function:

◆ Ivy_ObjDisconnect()

void Ivy_ObjDisconnect ( Ivy_Man_t * p,
Ivy_Obj_t * pObj )
extern

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

Synopsis [Connect the object to the fanin.]

Description []

SideEffects []

SeeAlso []

Definition at line 185 of file ivyObj.c.

186{
187 assert( !Ivy_IsComplement(pObj) );
188 assert( Ivy_ObjIsPi(pObj) || Ivy_ObjIsOneFanin(pObj) || Ivy_ObjFanin1(pObj) != NULL );
189 // remove connections
190 if ( pObj->pFanin0 != NULL )
191 {
192 Ivy_ObjRefsDec(Ivy_ObjFanin0(pObj));
193 if ( p->fFanout )
194 Ivy_ObjDeleteFanout( p, Ivy_ObjFanin0(pObj), pObj );
195 }
196 if ( pObj->pFanin1 != NULL )
197 {
198 Ivy_ObjRefsDec(Ivy_ObjFanin1(pObj));
199 if ( p->fFanout )
200 Ivy_ObjDeleteFanout( p, Ivy_ObjFanin1(pObj), pObj );
201 }
202 assert( pObj->pNextFan0 == NULL );
203 assert( pObj->pNextFan1 == NULL );
204 assert( pObj->pPrevFan0 == NULL );
205 assert( pObj->pPrevFan1 == NULL );
206 // remove the node from the structural hash table
207 Ivy_TableDelete( p, pObj );
208 // add the first fanin
209 pObj->pFanin0 = NULL;
210 pObj->pFanin1 = NULL;
211}
void Ivy_ObjDeleteFanout(Ivy_Man_t *p, Ivy_Obj_t *pObj, Ivy_Obj_t *pFanout)
Definition ivyFanout.c:205
void Ivy_TableDelete(Ivy_Man_t *p, Ivy_Obj_t *pObj)
Definition ivyTable.c:132
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ObjFanoutNum()

int Ivy_ObjFanoutNum ( Ivy_Man_t * p,
Ivy_Obj_t * pObj )
extern

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

Synopsis [Reads one fanout.]

Description [Returns fanout if there is only one fanout.]

SideEffects []

SeeAlso []

Definition at line 299 of file ivyFanout.c.

300{
301 Ivy_Obj_t * pFanout;
302 int Counter = 0;
303 Ivy_ObjForEachFanoutInt( pObj, pFanout )
304 Counter++;
305 return Counter;
306}
Here is the caller graph for this function:

◆ Ivy_ObjIsMuxType()

int Ivy_ObjIsMuxType ( Ivy_Obj_t * pNode)
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 479 of file ivyUtil.c.

480{
481 Ivy_Obj_t * pNode0, * pNode1;
482 // check that the node is regular
483 assert( !Ivy_IsComplement(pNode) );
484 // if the node is not AND, this is not MUX
485 if ( !Ivy_ObjIsAnd(pNode) )
486 return 0;
487 // if the children are not complemented, this is not MUX
488 if ( !Ivy_ObjFaninC0(pNode) || !Ivy_ObjFaninC1(pNode) )
489 return 0;
490 // get children
491 pNode0 = Ivy_ObjFanin0(pNode);
492 pNode1 = Ivy_ObjFanin1(pNode);
493 // if the children are not ANDs, this is not MUX
494 if ( !Ivy_ObjIsAnd(pNode0) || !Ivy_ObjIsAnd(pNode1) )
495 return 0;
496 // otherwise the node is MUX iff it has a pair of equal grandchildren
497 return (Ivy_ObjFaninId0(pNode0) == Ivy_ObjFaninId0(pNode1) && (Ivy_ObjFaninC0(pNode0) ^ Ivy_ObjFaninC0(pNode1))) ||
498 (Ivy_ObjFaninId0(pNode0) == Ivy_ObjFaninId1(pNode1) && (Ivy_ObjFaninC0(pNode0) ^ Ivy_ObjFaninC1(pNode1))) ||
499 (Ivy_ObjFaninId1(pNode0) == Ivy_ObjFaninId0(pNode1) && (Ivy_ObjFaninC1(pNode0) ^ Ivy_ObjFaninC0(pNode1))) ||
500 (Ivy_ObjFaninId1(pNode0) == Ivy_ObjFaninId1(pNode1) && (Ivy_ObjFaninC1(pNode0) ^ Ivy_ObjFaninC1(pNode1)));
501}
Here is the caller graph for this function:

◆ Ivy_ObjMffcLabel()

int Ivy_ObjMffcLabel ( Ivy_Man_t * p,
Ivy_Obj_t * pNode )
extern

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

Synopsis [Labels MFFC with the current label.]

Description []

SideEffects []

SeeAlso []

Definition at line 359 of file ivyUtil.c.

360{
361 int nConeSize1, nConeSize2;
362 assert( !Ivy_IsComplement( pNode ) );
363 assert( Ivy_ObjIsNode( pNode ) );
364 nConeSize1 = Ivy_ObjRefDeref( p, pNode, 0, 1 ); // dereference
365 nConeSize2 = Ivy_ObjRefDeref( p, pNode, 1, 0 ); // reference
366 assert( nConeSize1 == nConeSize2 );
367 assert( nConeSize1 > 0 );
368 return nConeSize1;
369}
int Ivy_ObjRefDeref(Ivy_Man_t *p, Ivy_Obj_t *pNode, int fReference, int fLabel)
Definition ivyUtil.c:313
Here is the call graph for this function:

◆ Ivy_ObjPatchFanin0()

void Ivy_ObjPatchFanin0 ( Ivy_Man_t * p,
Ivy_Obj_t * pObj,
Ivy_Obj_t * pFaninNew )
extern

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

Synopsis [Replaces the first fanin of the node by the new fanin.]

Description []

SideEffects []

SeeAlso []

Definition at line 224 of file ivyObj.c.

225{
226 Ivy_Obj_t * pFaninOld;
227 assert( !Ivy_IsComplement(pObj) );
228 pFaninOld = Ivy_ObjFanin0(pObj);
229 // decrement ref and remove fanout
230 Ivy_ObjRefsDec( pFaninOld );
231 if ( p->fFanout )
232 Ivy_ObjDeleteFanout( p, pFaninOld, pObj );
233 // update the fanin
234 pObj->pFanin0 = pFaninNew;
235 // increment ref and add fanout
236 Ivy_ObjRefsInc( Ivy_Regular(pFaninNew) );
237 if ( p->fFanout )
238 Ivy_ObjAddFanout( p, Ivy_Regular(pFaninNew), pObj );
239 // get rid of old fanin
240 if ( !Ivy_ObjIsPi(pFaninOld) && !Ivy_ObjIsConst1(pFaninOld) && Ivy_ObjRefs(pFaninOld) == 0 )
241 Ivy_ObjDelete_rec( p, pFaninOld, 1 );
242}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ObjPatchFanout()

void Ivy_ObjPatchFanout ( Ivy_Man_t * p,
Ivy_Obj_t * pFanin,
Ivy_Obj_t * pFanoutOld,
Ivy_Obj_t * pFanoutNew )
extern

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

Synopsis [Replaces the fanout of pOld to be pFanoutNew.]

Description []

SideEffects []

SeeAlso []

Definition at line 237 of file ivyFanout.c.

238{
239 Ivy_Obj_t ** ppPlace;
240 ppPlace = Ivy_ObjPrevNextFanoutPlace(pFanin, pFanoutOld);
241 assert( *ppPlace == pFanoutOld );
242 if ( ppPlace )
243 *ppPlace = pFanoutNew;
244 ppPlace = Ivy_ObjNextPrevFanoutPlace(pFanin, pFanoutOld);
245 assert( ppPlace == NULL || *ppPlace == pFanoutOld );
246 if ( ppPlace )
247 *ppPlace = pFanoutNew;
248 // assuming that pFanoutNew already points to the next fanout
249}
Here is the caller graph for this function:

◆ Ivy_ObjPrintVerbose()

void Ivy_ObjPrintVerbose ( Ivy_Man_t * p,
Ivy_Obj_t * pObj,
int fHaig )
extern

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

Synopsis [Prints node in HAIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 629 of file ivyUtil.c.

630{
631 Ivy_Obj_t * pTemp;
632 int fShowFanouts = 0;
633 assert( !Ivy_IsComplement(pObj) );
634 printf( "Node %5d : ", Ivy_ObjId(pObj) );
635 if ( Ivy_ObjIsConst1(pObj) )
636 printf( "constant 1" );
637 else if ( Ivy_ObjIsPi(pObj) )
638 printf( "PI" );
639 else if ( Ivy_ObjIsPo(pObj) )
640 printf( "PO" );
641 else if ( Ivy_ObjIsLatch(pObj) )
642 printf( "latch (%d%s)", Ivy_ObjFanin0(pObj)->Id, (Ivy_ObjFaninC0(pObj)? "\'" : " ") );
643 else if ( Ivy_ObjIsBuf(pObj) )
644 printf( "buffer (%d%s)", Ivy_ObjFanin0(pObj)->Id, (Ivy_ObjFaninC0(pObj)? "\'" : " ") );
645 else
646 printf( "AND( %5d%s, %5d%s )",
647 Ivy_ObjFanin0(pObj)->Id, (Ivy_ObjFaninC0(pObj)? "\'" : " "),
648 Ivy_ObjFanin1(pObj)->Id, (Ivy_ObjFaninC1(pObj)? "\'" : " ") );
649 printf( " (refs = %3d)", Ivy_ObjRefs(pObj) );
650 if ( fShowFanouts )
651 {
652 Vec_Ptr_t * vFanouts;
653 Ivy_Obj_t * pFanout;
654 int i;
655 vFanouts = Vec_PtrAlloc( 10 );
656 printf( "\nFanouts:\n" );
657 Ivy_ObjForEachFanout( p, pObj, vFanouts, pFanout, i )
658 {
659 printf( " " );
660 printf( "Node %5d : ", Ivy_ObjId(pFanout) );
661 if ( Ivy_ObjIsPo(pFanout) )
662 printf( "PO" );
663 else if ( Ivy_ObjIsLatch(pFanout) )
664 printf( "latch (%d%s)", Ivy_ObjFanin0(pFanout)->Id, (Ivy_ObjFaninC0(pFanout)? "\'" : " ") );
665 else if ( Ivy_ObjIsBuf(pFanout) )
666 printf( "buffer (%d%s)", Ivy_ObjFanin0(pFanout)->Id, (Ivy_ObjFaninC0(pFanout)? "\'" : " ") );
667 else
668 printf( "AND( %5d%s, %5d%s )",
669 Ivy_ObjFanin0(pFanout)->Id, (Ivy_ObjFaninC0(pFanout)? "\'" : " "),
670 Ivy_ObjFanin1(pFanout)->Id, (Ivy_ObjFaninC1(pFanout)? "\'" : " ") );
671 printf( "\n" );
672 }
673 Vec_PtrFree( vFanouts );
674 return;
675 }
676 if ( !fHaig )
677 {
678 if ( pObj->pEquiv == NULL )
679 printf( " HAIG node not given" );
680 else
681 printf( " HAIG node = %d%s", Ivy_Regular(pObj->pEquiv)->Id, (Ivy_IsComplement(pObj->pEquiv)? "\'" : " ") );
682 return;
683 }
684 if ( pObj->pEquiv == NULL )
685 return;
686 // there are choices
687 if ( Ivy_ObjRefs(pObj) > 0 )
688 {
689 // print equivalence class
690 printf( " { %5d ", pObj->Id );
691 assert( !Ivy_IsComplement(pObj->pEquiv) );
692 for ( pTemp = pObj->pEquiv; pTemp != pObj; pTemp = Ivy_Regular(pTemp->pEquiv) )
693 printf( " %5d%s", pTemp->Id, (Ivy_IsComplement(pTemp->pEquiv)? "\'" : " ") );
694 printf( " }" );
695 return;
696 }
697 // this is a secondary node
698 for ( pTemp = Ivy_Regular(pObj->pEquiv); Ivy_ObjRefs(pTemp) == 0; pTemp = Ivy_Regular(pTemp->pEquiv) );
699 assert( Ivy_ObjRefs(pTemp) > 0 );
700 printf( " class of %d", pTemp->Id );
701}
Here is the caller graph for this function:

◆ Ivy_ObjReadFirstFanout()

Ivy_Obj_t * Ivy_ObjReadFirstFanout ( Ivy_Man_t * p,
Ivy_Obj_t * pObj )
extern

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

Synopsis [Reads one fanout.]

Description [Returns fanout if there is only one fanout.]

SideEffects []

SeeAlso []

Definition at line 283 of file ivyFanout.c.

284{
285 return pObj->pFanout;
286}
Here is the caller graph for this function:

◆ Ivy_ObjReal()

Ivy_Obj_t * Ivy_ObjReal ( Ivy_Obj_t * pObj)
extern

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

Synopsis [Returns the real fanin.]

Description []

SideEffects []

SeeAlso []

Definition at line 609 of file ivyUtil.c.

610{
611 Ivy_Obj_t * pFanin;
612 if ( pObj == NULL || !Ivy_ObjIsBuf( Ivy_Regular(pObj) ) )
613 return pObj;
614 pFanin = Ivy_ObjReal( Ivy_ObjChild0(Ivy_Regular(pObj)) );
615 return Ivy_NotCond( pFanin, Ivy_IsComplement(pObj) );
616}
Ivy_Obj_t * Ivy_ObjReal(Ivy_Obj_t *pObj)
Definition ivyUtil.c:609
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ObjRecognizeMux()

Ivy_Obj_t * Ivy_ObjRecognizeMux ( Ivy_Obj_t * pNode,
Ivy_Obj_t ** ppNodeT,
Ivy_Obj_t ** ppNodeE )
extern

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 517 of file ivyUtil.c.

518{
519 Ivy_Obj_t * pNode0, * pNode1;
520 assert( !Ivy_IsComplement(pNode) );
521 assert( Ivy_ObjIsMuxType(pNode) );
522 // get children
523 pNode0 = Ivy_ObjFanin0(pNode);
524 pNode1 = Ivy_ObjFanin1(pNode);
525 // find the control variable
526// if ( pNode1->p1 == Fraig_Not(pNode2->p1) )
527 if ( Ivy_ObjFaninId0(pNode0) == Ivy_ObjFaninId0(pNode1) && (Ivy_ObjFaninC0(pNode0) ^ Ivy_ObjFaninC0(pNode1)) )
528 {
529// if ( Fraig_IsComplement(pNode1->p1) )
530 if ( Ivy_ObjFaninC0(pNode0) )
531 { // pNode2->p1 is positive phase of C
532 *ppNodeT = Ivy_Not(Ivy_ObjChild1(pNode1));//pNode2->p2);
533 *ppNodeE = Ivy_Not(Ivy_ObjChild1(pNode0));//pNode1->p2);
534 return Ivy_ObjChild0(pNode1);//pNode2->p1;
535 }
536 else
537 { // pNode1->p1 is positive phase of C
538 *ppNodeT = Ivy_Not(Ivy_ObjChild1(pNode0));//pNode1->p2);
539 *ppNodeE = Ivy_Not(Ivy_ObjChild1(pNode1));//pNode2->p2);
540 return Ivy_ObjChild0(pNode0);//pNode1->p1;
541 }
542 }
543// else if ( pNode1->p1 == Fraig_Not(pNode2->p2) )
544 else if ( Ivy_ObjFaninId0(pNode0) == Ivy_ObjFaninId1(pNode1) && (Ivy_ObjFaninC0(pNode0) ^ Ivy_ObjFaninC1(pNode1)) )
545 {
546// if ( Fraig_IsComplement(pNode1->p1) )
547 if ( Ivy_ObjFaninC0(pNode0) )
548 { // pNode2->p2 is positive phase of C
549 *ppNodeT = Ivy_Not(Ivy_ObjChild0(pNode1));//pNode2->p1);
550 *ppNodeE = Ivy_Not(Ivy_ObjChild1(pNode0));//pNode1->p2);
551 return Ivy_ObjChild1(pNode1);//pNode2->p2;
552 }
553 else
554 { // pNode1->p1 is positive phase of C
555 *ppNodeT = Ivy_Not(Ivy_ObjChild1(pNode0));//pNode1->p2);
556 *ppNodeE = Ivy_Not(Ivy_ObjChild0(pNode1));//pNode2->p1);
557 return Ivy_ObjChild0(pNode0);//pNode1->p1;
558 }
559 }
560// else if ( pNode1->p2 == Fraig_Not(pNode2->p1) )
561 else if ( Ivy_ObjFaninId1(pNode0) == Ivy_ObjFaninId0(pNode1) && (Ivy_ObjFaninC1(pNode0) ^ Ivy_ObjFaninC0(pNode1)) )
562 {
563// if ( Fraig_IsComplement(pNode1->p2) )
564 if ( Ivy_ObjFaninC1(pNode0) )
565 { // pNode2->p1 is positive phase of C
566 *ppNodeT = Ivy_Not(Ivy_ObjChild1(pNode1));//pNode2->p2);
567 *ppNodeE = Ivy_Not(Ivy_ObjChild0(pNode0));//pNode1->p1);
568 return Ivy_ObjChild0(pNode1);//pNode2->p1;
569 }
570 else
571 { // pNode1->p2 is positive phase of C
572 *ppNodeT = Ivy_Not(Ivy_ObjChild0(pNode0));//pNode1->p1);
573 *ppNodeE = Ivy_Not(Ivy_ObjChild1(pNode1));//pNode2->p2);
574 return Ivy_ObjChild1(pNode0);//pNode1->p2;
575 }
576 }
577// else if ( pNode1->p2 == Fraig_Not(pNode2->p2) )
578 else if ( Ivy_ObjFaninId1(pNode0) == Ivy_ObjFaninId1(pNode1) && (Ivy_ObjFaninC1(pNode0) ^ Ivy_ObjFaninC1(pNode1)) )
579 {
580// if ( Fraig_IsComplement(pNode1->p2) )
581 if ( Ivy_ObjFaninC1(pNode0) )
582 { // pNode2->p2 is positive phase of C
583 *ppNodeT = Ivy_Not(Ivy_ObjChild0(pNode1));//pNode2->p1);
584 *ppNodeE = Ivy_Not(Ivy_ObjChild0(pNode0));//pNode1->p1);
585 return Ivy_ObjChild1(pNode1);//pNode2->p2;
586 }
587 else
588 { // pNode1->p2 is positive phase of C
589 *ppNodeT = Ivy_Not(Ivy_ObjChild0(pNode0));//pNode1->p1);
590 *ppNodeE = Ivy_Not(Ivy_ObjChild0(pNode1));//pNode2->p1);
591 return Ivy_ObjChild1(pNode0);//pNode1->p2;
592 }
593 }
594 assert( 0 ); // this is not MUX
595 return NULL;
596}
int Ivy_ObjIsMuxType(Ivy_Obj_t *pNode)
Definition ivyUtil.c:479
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ObjReplace()

void Ivy_ObjReplace ( Ivy_Man_t * p,
Ivy_Obj_t * pObjOld,
Ivy_Obj_t * pObjNew,
int fDeleteOld,
int fFreeTop,
int fUpdateLevel )
extern

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

Synopsis [Replaces one object by another.]

Description [Both objects are currently in the manager. The new object (pObjNew) should be used instead of the old object (pObjOld). If the new object is complemented or used, the buffer is added.]

SideEffects []

SeeAlso []

Definition at line 328 of file ivyObj.c.

329{
330 int nRefsOld;//, clk;
331 // the object to be replaced cannot be complemented
332 assert( !Ivy_IsComplement(pObjOld) );
333 // the object to be replaced cannot be a terminal
334 assert( Ivy_ObjIsNone(pObjOld) || !Ivy_ObjIsPi(pObjOld) );
335 // the object to be used cannot be a PO or assert
336 assert( !Ivy_ObjIsBuf(Ivy_Regular(pObjNew)) );
337 // the object cannot be the same
338 assert( pObjOld != Ivy_Regular(pObjNew) );
339//printf( "Replacing %d by %d.\n", Ivy_Regular(pObjOld)->Id, Ivy_Regular(pObjNew)->Id );
340
341 // if HAIG is defined, create the choice node
342 if ( p->pHaig )
343 {
344// if ( pObjOld->Id == 31 )
345// {
346// Ivy_ManShow( p, 0 );
347// Ivy_ManShow( p->pHaig, 1 );
348// }
349 Ivy_ManHaigCreateChoice( p, pObjOld, pObjNew );
350 }
351 // if the new object is complemented or already used, add the buffer
352 if ( Ivy_IsComplement(pObjNew) || Ivy_ObjIsLatch(pObjNew) || Ivy_ObjRefs(pObjNew) > 0 || Ivy_ObjIsPi(pObjNew) || Ivy_ObjIsConst1(pObjNew) )
353 pObjNew = Ivy_ObjCreate( p, Ivy_ObjCreateGhost(p, pObjNew, NULL, IVY_BUF, IVY_INIT_NONE) );
354 assert( !Ivy_IsComplement(pObjNew) );
355 if ( fUpdateLevel )
356 {
357//clk = Abc_Clock();
358 // if the new node's arrival time is different, recursively update arrival time of the fanouts
359 if ( p->fFanout && !Ivy_ObjIsBuf(pObjNew) && pObjOld->Level != pObjNew->Level )
360 {
361 assert( Ivy_ObjIsNode(pObjOld) );
362 pObjOld->Level = pObjNew->Level;
363 Ivy_ObjUpdateLevel_rec( p, pObjOld );
364 }
365//p->time1 += Abc_Clock() - clk;
366 // if the new node's required time has changed, recursively update required time of the fanins
367//clk = Abc_Clock();
368 if ( p->vRequired )
369 {
370 int ReqNew = Vec_IntEntry(p->vRequired, pObjOld->Id);
371 if ( ReqNew < Vec_IntEntry(p->vRequired, pObjNew->Id) )
372 {
373 Vec_IntWriteEntry( p->vRequired, pObjNew->Id, ReqNew );
374 Ivy_ObjUpdateLevelR_rec( p, pObjNew, ReqNew );
375 }
376 }
377//p->time2 += Abc_Clock() - clk;
378 }
379 // delete the old object
380 if ( fDeleteOld )
381 Ivy_ObjDelete_rec( p, pObjOld, fFreeTop );
382 // make sure object is not pointing to itself
383 assert( Ivy_ObjFanin0(pObjNew) == NULL || pObjOld != Ivy_ObjFanin0(pObjNew) );
384 assert( Ivy_ObjFanin1(pObjNew) == NULL || pObjOld != Ivy_ObjFanin1(pObjNew) );
385 // make sure the old node has no fanin fanout pointers
386 if ( p->fFanout )
387 {
388 assert( pObjOld->pFanout != NULL );
389 assert( pObjNew->pFanout == NULL );
390 pObjNew->pFanout = pObjOld->pFanout;
391 }
392 // transfer the old object
393 assert( Ivy_ObjRefs(pObjNew) == 0 );
394 nRefsOld = pObjOld->nRefs;
395 Ivy_ObjOverwrite( pObjOld, pObjNew );
396 pObjOld->nRefs = nRefsOld;
397 // patch the fanout of the fanins
398 if ( p->fFanout )
399 {
400 Ivy_ObjPatchFanout( p, Ivy_ObjFanin0(pObjOld), pObjNew, pObjOld );
401 if ( Ivy_ObjFanin1(pObjOld) )
402 Ivy_ObjPatchFanout( p, Ivy_ObjFanin1(pObjOld), pObjNew, pObjOld );
403 }
404 // update the hash table
405 Ivy_TableUpdate( p, pObjNew, pObjOld->Id );
406 // recycle the object that was taken over by pObjOld
407 Vec_PtrWriteEntry( p->vObjs, pObjNew->Id, NULL );
408 Ivy_ManRecycleMemory( p, pObjNew );
409 // if the new node is the buffer propagate it
410 if ( p->fFanout && Ivy_ObjIsBuf(pObjOld) )
411 Vec_PtrPush( p->vBufs, pObjOld );
412// Ivy_ManCheckFanouts( p );
413// printf( "\n" );
414/*
415 if ( p->pHaig )
416 {
417 int x;
418 Ivy_ManShow( p, 0, NULL );
419 Ivy_ManShow( p->pHaig, 1, NULL );
420 x = 0;
421 }
422*/
423// if ( Ivy_ManCheckFanoutNums(p) )
424// {
425// int x = 0;
426// }
427}
void Ivy_TableUpdate(Ivy_Man_t *p, Ivy_Obj_t *pObj, int ObjIdNew)
Definition ivyTable.c:165
void Ivy_ManHaigCreateChoice(Ivy_Man_t *p, Ivy_Obj_t *pObjOld, Ivy_Obj_t *pObjNew)
Definition ivyHaig.c:246
void Ivy_ObjUpdateLevel_rec(Ivy_Man_t *p, Ivy_Obj_t *pObj)
Definition ivyUtil.c:382
void Ivy_ObjPatchFanout(Ivy_Man_t *p, Ivy_Obj_t *pObj, Ivy_Obj_t *pFanoutOld, Ivy_Obj_t *pFanoutNew)
Definition ivyFanout.c:237
void Ivy_ObjUpdateLevelR_rec(Ivy_Man_t *p, Ivy_Obj_t *pObj, int ReqNew)
Definition ivyUtil.c:444
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ObjUpdateLevel_rec()

void Ivy_ObjUpdateLevel_rec ( Ivy_Man_t * p,
Ivy_Obj_t * pObj )
extern

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

Synopsis [Recursively updates fanout levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 382 of file ivyUtil.c.

383{
384 Ivy_Obj_t * pFanout;
385 Vec_Ptr_t * vFanouts;
386 int i, LevelNew;
387 assert( p->fFanout );
388 assert( Ivy_ObjIsNode(pObj) );
389 vFanouts = Vec_PtrAlloc( 10 );
390 Ivy_ObjForEachFanout( p, pObj, vFanouts, pFanout, i )
391 {
392 if ( Ivy_ObjIsCo(pFanout) )
393 {
394// assert( (int)Ivy_ObjFanin0(pFanout)->Level <= p->nLevelMax );
395 continue;
396 }
397 LevelNew = Ivy_ObjLevelNew( pFanout );
398 if ( (int)pFanout->Level == LevelNew )
399 continue;
400 pFanout->Level = LevelNew;
401 Ivy_ObjUpdateLevel_rec( p, pFanout );
402 }
403 Vec_PtrFree( vFanouts );
404}
void Ivy_ObjUpdateLevel_rec(Ivy_Man_t *p, Ivy_Obj_t *pObj)
Definition ivyUtil.c:382
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_ObjUpdateLevelR_rec()

void Ivy_ObjUpdateLevelR_rec ( Ivy_Man_t * p,
Ivy_Obj_t * pObj,
int ReqNew )
extern

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

Synopsis [Recursively updates fanout levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 444 of file ivyUtil.c.

445{
446 Ivy_Obj_t * pFanin;
447 if ( Ivy_ObjIsConst1(pObj) || Ivy_ObjIsCi(pObj) )
448 return;
449 assert( Ivy_ObjIsNode(pObj) || Ivy_ObjIsBuf(pObj) );
450 // process the first fanin
451 pFanin = Ivy_ObjFanin0(pObj);
452 if ( Vec_IntEntry(p->vRequired, pFanin->Id) > ReqNew - 1 )
453 {
454 Vec_IntWriteEntry( p->vRequired, pFanin->Id, ReqNew - 1 );
455 Ivy_ObjUpdateLevelR_rec( p, pFanin, ReqNew - 1 );
456 }
457 if ( Ivy_ObjIsBuf(pObj) )
458 return;
459 // process the second fanin
460 pFanin = Ivy_ObjFanin1(pObj);
461 if ( Vec_IntEntry(p->vRequired, pFanin->Id) > ReqNew - 1 )
462 {
463 Vec_IntWriteEntry( p->vRequired, pFanin->Id, ReqNew - 1 );
464 Ivy_ObjUpdateLevelR_rec( p, pFanin, ReqNew - 1 );
465 }
466}
void Ivy_ObjUpdateLevelR_rec(Ivy_Man_t *p, Ivy_Obj_t *pObj, int ReqNew)
Definition ivyUtil.c:444
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_Oper()

Ivy_Obj_t * Ivy_Oper ( Ivy_Man_t * p,
Ivy_Obj_t * p0,
Ivy_Obj_t * p1,
Ivy_Type_t Type )
extern

FUNCTION DEFINITIONS ///.

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

Synopsis [Perform one operation.]

Description [The argument nodes can be complemented.]

SideEffects []

SeeAlso []

Definition at line 63 of file ivyOper.c.

64{
65 if ( Type == IVY_AND )
66 return Ivy_And( p, p0, p1 );
67 if ( Type == IVY_EXOR )
68 return Ivy_Exor( p, p0, p1 );
69 assert( 0 );
70 return NULL;
71}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_Or()

Ivy_Obj_t * Ivy_Or ( Ivy_Man_t * p,
Ivy_Obj_t * p0,
Ivy_Obj_t * p1 )
extern

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

Synopsis [Implements Boolean OR.]

Description []

SideEffects []

SeeAlso []

Definition at line 142 of file ivyOper.c.

143{
144 return Ivy_Not( Ivy_And( p, Ivy_Not(p0), Ivy_Not(p1) ) );
145}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_TableCountEntries()

int Ivy_TableCountEntries ( Ivy_Man_t * p)
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 187 of file ivyTable.c.

188{
189 int i, Counter = 0;
190 for ( i = 0; i < p->nTableSize; i++ )
191 Counter += (p->pTable[i] != 0);
192 return Counter;
193}
Here is the caller graph for this function:

◆ Ivy_TableDelete()

void Ivy_TableDelete ( Ivy_Man_t * p,
Ivy_Obj_t * pObj )
extern

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

Synopsis [Deletes the node from the hash table.]

Description []

SideEffects []

SeeAlso []

Definition at line 132 of file ivyTable.c.

133{
134 Ivy_Obj_t * pEntry;
135 int i, * pPlace;
136 assert( !Ivy_IsComplement(pObj) );
137 if ( !Ivy_ObjIsHash(pObj) )
138 return;
139 pPlace = Ivy_TableFind( p, pObj );
140 assert( *pPlace == pObj->Id ); // node should be in the table
141 *pPlace = 0;
142 // rehash the adjacent entries
143 i = pPlace - p->pTable;
144 for ( i = (i+1) % p->nTableSize; p->pTable[i]; i = (i+1) % p->nTableSize )
145 {
146 pEntry = Ivy_ManObj( p, p->pTable[i] );
147 p->pTable[i] = 0;
148 Ivy_TableInsert( p, pEntry );
149 }
150}
void Ivy_TableInsert(Ivy_Man_t *p, Ivy_Obj_t *pObj)
Definition ivyTable.c:105
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_TableInsert()

void Ivy_TableInsert ( Ivy_Man_t * p,
Ivy_Obj_t * pObj )
extern

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

Synopsis [Adds the node to the hash table.]

Description []

SideEffects []

SeeAlso []

Definition at line 105 of file ivyTable.c.

106{
107 int * pPlace;
108 assert( !Ivy_IsComplement(pObj) );
109 if ( !Ivy_ObjIsHash(pObj) )
110 return;
111 if ( (pObj->Id & 63) == 0 )
112 {
113 if ( p->nTableSize < 2 * Ivy_ManHashObjNum(p) )
114 Ivy_TableResize( p );
115 }
116 pPlace = Ivy_TableFind( p, pObj );
117 assert( *pPlace == 0 );
118 *pPlace = pObj->Id;
119}
Here is the caller graph for this function:

◆ Ivy_TableLookup()

Ivy_Obj_t * Ivy_TableLookup ( Ivy_Man_t * p,
Ivy_Obj_t * pObj )
extern

FUNCTION DEFINITIONS ///.

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

Synopsis [Checks if node with the given attributes is in the hash table.]

Description []

SideEffects []

SeeAlso []

Definition at line 71 of file ivyTable.c.

72{
73 Ivy_Obj_t * pEntry;
74 int i;
75 assert( !Ivy_IsComplement(pObj) );
76 if ( !Ivy_ObjIsHash(pObj) )
77 return NULL;
78 assert( Ivy_ObjIsLatch(pObj) || Ivy_ObjFaninId0(pObj) > 0 );
79 assert( Ivy_ObjFaninId1(pObj) == 0 || Ivy_ObjFaninId0(pObj) < Ivy_ObjFaninId1(pObj) );
80 if ( Ivy_ObjFanin0(pObj)->nRefs == 0 || (Ivy_ObjChild1(pObj) && Ivy_ObjFanin1(pObj)->nRefs == 0) )
81 return NULL;
82 for ( i = Ivy_Hash(pObj, p->nTableSize); p->pTable[i]; i = (i+1) % p->nTableSize )
83 {
84 pEntry = Ivy_ManObj( p, p->pTable[i] );
85 if ( Ivy_ObjChild0(pEntry) == Ivy_ObjChild0(pObj) &&
86 Ivy_ObjChild1(pEntry) == Ivy_ObjChild1(pObj) &&
87 Ivy_ObjInit(pEntry) == Ivy_ObjInit(pObj) &&
88 Ivy_ObjType(pEntry) == Ivy_ObjType(pObj) )
89 return pEntry;
90 }
91 return NULL;
92}
Here is the caller graph for this function:

◆ Ivy_TableProfile()

void Ivy_TableProfile ( Ivy_Man_t * p)
extern

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

Synopsis [Profiles the hash table.]

Description []

SideEffects []

SeeAlso []

Definition at line 250 of file ivyTable.c.

251{
252 int i, Counter = 0;
253 for ( i = 0; i < p->nTableSize; i++ )
254 {
255 if ( p->pTable[i] )
256 Counter++;
257 else if ( Counter )
258 {
259 printf( "%d ", Counter );
260 Counter = 0;
261 }
262 }
263}

◆ Ivy_TableUpdate()

void Ivy_TableUpdate ( Ivy_Man_t * p,
Ivy_Obj_t * pObj,
int ObjIdNew )
extern

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

Synopsis [Updates the table to point to the new node.]

Description [If the old node (pObj) is in the table, updates the table to point to an object with different ID (ObjIdNew). The table should not contain an object with ObjIdNew (this is currently not checked).]

SideEffects []

SeeAlso []

Definition at line 165 of file ivyTable.c.

166{
167 int * pPlace;
168 assert( !Ivy_IsComplement(pObj) );
169 if ( !Ivy_ObjIsHash(pObj) )
170 return;
171 pPlace = Ivy_TableFind( p, pObj );
172 assert( *pPlace == pObj->Id ); // node should be in the table
173 *pPlace = ObjIdNew;
174}
Here is the caller graph for this function:

◆ Ivy_TruthDsd()

int Ivy_TruthDsd ( unsigned uTruth,
Vec_Int_t * vTree )
extern

FUNCTION DEFINITIONS ///.

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

Synopsis [Computes DSD of truth table of 5 variables or less.]

Description [Returns 1 if the function is a constant or is fully DSD decomposable using AND/EXOR/MUX gates.]

SideEffects []

SeeAlso []

Definition at line 166 of file ivyDsd.c.

167{
168 Ivy_Dec_t Node;
169 int i, RetValue;
170 // set the PI variables
171 Vec_IntClear( vTree );
172 for ( i = 0; i < 5; i++ )
173 Vec_IntPush( vTree, 0 );
174 // check if it is a constant
175 if ( uTruth == 0 || ~uTruth == 0 )
176 {
177 Ivy_DecClear( &Node );
178 Node.Type = IVY_DEC_CONST1;
179 Node.fCompl = (uTruth == 0);
180 Vec_IntPush( vTree, Ivy_DecToInt(Node) );
181 return 1;
182 }
183 // perform the decomposition
184 RetValue = Ivy_TruthDecompose_rec( uTruth, vTree );
185 if ( RetValue == -1 )
186 return 0;
187 // get the topmost node
188 if ( (RetValue >> 1) < 5 )
189 { // add buffer
190 Ivy_DecClear( &Node );
191 Node.Type = IVY_DEC_BUF;
192 Node.fCompl = (RetValue & 1);
193 Node.Fan0 = ((RetValue >> 1) << 1);
194 Vec_IntPush( vTree, Ivy_DecToInt(Node) );
195 }
196 else if ( RetValue & 1 )
197 { // check if the topmost node has to be complemented
198 Node = Ivy_IntToDec( Vec_IntPop(vTree) );
199 assert( Node.fCompl == 0 );
200 Node.fCompl = (RetValue & 1);
201 Vec_IntPush( vTree, Ivy_DecToInt(Node) );
202 }
203 if ( uTruth != Ivy_TruthDsdCompute(vTree) )
204 printf( "Verification failed.\n" );
205 return 1;
206}
@ IVY_DEC_BUF
Definition ivyDsd.c:34
@ IVY_DEC_CONST1
Definition ivyDsd.c:33
struct Ivy_Dec_t_ Ivy_Dec_t
Definition ivyDsd.c:42
unsigned Ivy_TruthDsdCompute(Vec_Int_t *vTree)
Definition ivyDsd.c:478
unsigned Type
Definition ivyDsd.c:45
unsigned Fan0
Definition ivyDsd.c:48
unsigned fCompl
Definition ivyDsd.c:46
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_TruthDsdCompute()

unsigned Ivy_TruthDsdCompute ( Vec_Int_t * vTree)
extern

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

Synopsis [Computes truth table of decomposition tree for verification.]

Description []

SideEffects []

SeeAlso []

Definition at line 478 of file ivyDsd.c.

479{
480 return Ivy_TruthDsdCompute_rec( Vec_IntSize(vTree)-1, vTree );
481}
unsigned Ivy_TruthDsdCompute_rec(int iNode, Vec_Int_t *vTree)
Definition ivyDsd.c:404
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_TruthDsdComputePrint()

void Ivy_TruthDsdComputePrint ( unsigned uTruth)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 678 of file ivyDsd.c.

679{
680 static Vec_Int_t * vTree = NULL;
681 if ( vTree == NULL )
682 vTree = Vec_IntAlloc( 12 );
683 if ( Ivy_TruthDsd( uTruth, vTree ) )
684 Ivy_TruthDsdPrint( stdout, vTree );
685 else
686 printf( "Undecomposable\n" );
687}
void Ivy_TruthDsdPrint(FILE *pFile, Vec_Int_t *vTree)
Definition ivyDsd.c:568
int Ivy_TruthDsd(unsigned uTruth, Vec_Int_t *vTree)
FUNCTION DEFINITIONS ///.
Definition ivyDsd.c:166
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_TruthDsdPrint()

void Ivy_TruthDsdPrint ( FILE * pFile,
Vec_Int_t * vTree )
extern

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

Synopsis [Prints the decomposition tree.]

Description []

SideEffects []

SeeAlso []

Definition at line 568 of file ivyDsd.c.

569{
570 fprintf( pFile, "F = " );
571 Ivy_TruthDsdPrint_rec( pFile, Vec_IntSize(vTree)-1, vTree );
572 fprintf( pFile, "\n" );
573}
void Ivy_TruthDsdPrint_rec(FILE *pFile, int iNode, Vec_Int_t *vTree)
Definition ivyDsd.c:494
Here is the call graph for this function:
Here is the caller graph for this function: