abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
aig.h File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "misc/vec/vec.h"
#include "misc/util/utilCex.h"

Go to the source code of this file.

Data Structures

struct  Aig_Obj_t_
 
struct  Aig_Man_t_
 
struct  Aig_Cut_t_
 
struct  Aig_ManCut_t_
 

Macros

#define Aig_ObjForEachCut(p, pObj, pCut, i)   for ( i = 0, pCut = Aig_ObjCuts(p, pObj); i < p->nCutsMax; i++, pCut = Aig_CutNext(pCut) )
 
#define Aig_CutForEachLeaf(p, pCut, pLeaf, i)   for ( i = 0; (i < (int)(pCut)->nFanins) && ((pLeaf) = Aig_ManObj(p, (pCut)->pFanins[i])); i++ )
 
#define Aig_ManForEachCi(p, pObj, i)   Vec_PtrForEachEntry( Aig_Obj_t *, p->vCis, pObj, i )
 ITERATORS ///. More...
 
#define Aig_ManForEachCiReverse(p, pObj, i)   Vec_PtrForEachEntryReverse( Aig_Obj_t *, p->vCis, pObj, i )
 
#define Aig_ManForEachCo(p, pObj, i)   Vec_PtrForEachEntry( Aig_Obj_t *, p->vCos, pObj, i )
 
#define Aig_ManForEachCoReverse(p, pObj, i)   Vec_PtrForEachEntryReverse( Aig_Obj_t *, p->vCos, pObj, i )
 
#define Aig_ManForEachObj(p, pObj, i)   Vec_PtrForEachEntry( Aig_Obj_t *, p->vObjs, pObj, i ) if ( (pObj) == NULL ) {} else
 
#define Aig_ManForEachObjReverse(p, pObj, i)   Vec_PtrForEachEntryReverse( Aig_Obj_t *, p->vObjs, pObj, i ) if ( (pObj) == NULL ) {} else
 
#define Aig_ManForEachObjVec(vIds, p, pObj, i)   for ( i = 0; i < Vec_IntSize(vIds) && (((pObj) = Aig_ManObj(p, Vec_IntEntry(vIds,i))), 1); i++ )
 
#define Aig_ManForEachObjVecReverse(vIds, p, pObj, i)   for ( i = Vec_IntSize(vIds) - 1; i >= 0 && (((pObj) = Aig_ManObj(p, Vec_IntEntry(vIds,i))), 1); i-- )
 
#define Aig_ManForEachNode(p, pObj, i)   Vec_PtrForEachEntry( Aig_Obj_t *, p->vObjs, pObj, i ) if ( (pObj) == NULL || !Aig_ObjIsNode(pObj) ) {} else
 
#define Aig_ManForEachNodeReverse(p, pObj, i)   Vec_PtrForEachEntryReverse( Aig_Obj_t *, p->vObjs, pObj, i ) if ( (pObj) == NULL || !Aig_ObjIsNode(pObj) ) {} else
 
#define Aig_ManForEachExor(p, pObj, i)   Vec_PtrForEachEntry( Aig_Obj_t *, p->vObjs, pObj, i ) if ( (pObj) == NULL || !Aig_ObjIsExor(pObj) ) {} else
 
#define Aig_ManForEachExorReverse(p, pObj, i)   Vec_PtrForEachEntryReverse( Aig_Obj_t *, p->vObjs, pObj, i ) if ( (pObj) == NULL || !Aig_ObjIsExor(pObj) ) {} else
 
#define Aig_ObjForEachFanout(p, pObj, pFanout, iFan, i)
 
#define Aig_ManForEachPiSeq(p, pObj, i)   Vec_PtrForEachEntryStop( Aig_Obj_t *, p->vCis, pObj, i, Aig_ManCiNum(p)-Aig_ManRegNum(p) )
 SEQUENTIAL ITERATORS ///. More...
 
#define Aig_ManForEachLoSeq(p, pObj, i)   Vec_PtrForEachEntryStart( Aig_Obj_t *, p->vCis, pObj, i, Aig_ManCiNum(p)-Aig_ManRegNum(p) )
 
#define Aig_ManForEachPoSeq(p, pObj, i)   Vec_PtrForEachEntryStop( Aig_Obj_t *, p->vCos, pObj, i, Aig_ManCoNum(p)-Aig_ManRegNum(p) )
 
#define Aig_ManForEachLiSeq(p, pObj, i)   Vec_PtrForEachEntryStart( Aig_Obj_t *, p->vCos, pObj, i, Aig_ManCoNum(p)-Aig_ManRegNum(p) )
 
#define Aig_ManForEachLiLoSeq(p, pObjLi, pObjLo, k)
 

Typedefs

typedef
typedefABC_NAMESPACE_HEADER_START
struct Aig_Man_t_ 
Aig_Man_t
 INCLUDES ///. More...
 
typedef struct Aig_Obj_t_ Aig_Obj_t
 
typedef struct Aig_MmFixed_t_ Aig_MmFixed_t
 
typedef struct Aig_MmFlex_t_ Aig_MmFlex_t
 
typedef struct Aig_MmStep_t_ Aig_MmStep_t
 
typedef struct Aig_ManCut_t_ Aig_ManCut_t
 
typedef struct Aig_Cut_t_ Aig_Cut_t
 

Enumerations

enum  Aig_Type_t {
  AIG_OBJ_NONE, AIG_OBJ_CONST1, AIG_OBJ_CI, AIG_OBJ_CO,
  AIG_OBJ_BUF, AIG_OBJ_AND, AIG_OBJ_EXOR, AIG_OBJ_VOID
}
 

Functions

static Aig_Cut_tAig_ObjCuts (Aig_ManCut_t *p, Aig_Obj_t *pObj)
 
static void Aig_ObjSetCuts (Aig_ManCut_t *p, Aig_Obj_t *pObj, Aig_Cut_t *pCuts)
 
static int Aig_CutLeaveNum (Aig_Cut_t *pCut)
 
static int * Aig_CutLeaves (Aig_Cut_t *pCut)
 
static unsigned * Aig_CutTruth (Aig_Cut_t *pCut)
 
static Aig_Cut_tAig_CutNext (Aig_Cut_t *pCut)
 
static unsigned Aig_ObjCutSign (unsigned ObjId)
 MACRO DEFINITIONS ///. More...
 
static int Aig_WordCountOnes (unsigned uWord)
 
static int Aig_WordFindFirstBit (unsigned uWord)
 
static Aig_Obj_tAig_Regular (Aig_Obj_t *p)
 
static Aig_Obj_tAig_Not (Aig_Obj_t *p)
 
static Aig_Obj_tAig_NotCond (Aig_Obj_t *p, int c)
 
static int Aig_IsComplement (Aig_Obj_t *p)
 
static int Aig_ManCiNum (Aig_Man_t *p)
 
static int Aig_ManCoNum (Aig_Man_t *p)
 
static int Aig_ManBufNum (Aig_Man_t *p)
 
static int Aig_ManAndNum (Aig_Man_t *p)
 
static int Aig_ManExorNum (Aig_Man_t *p)
 
static int Aig_ManNodeNum (Aig_Man_t *p)
 
static int Aig_ManGetCost (Aig_Man_t *p)
 
static int Aig_ManObjNum (Aig_Man_t *p)
 
static int Aig_ManObjNumMax (Aig_Man_t *p)
 
static int Aig_ManRegNum (Aig_Man_t *p)
 
static int Aig_ManConstrNum (Aig_Man_t *p)
 
static Aig_Obj_tAig_ManConst0 (Aig_Man_t *p)
 
static Aig_Obj_tAig_ManConst1 (Aig_Man_t *p)
 
static Aig_Obj_tAig_ManGhost (Aig_Man_t *p)
 
static Aig_Obj_tAig_ManCi (Aig_Man_t *p, int i)
 
static Aig_Obj_tAig_ManCo (Aig_Man_t *p, int i)
 
static Aig_Obj_tAig_ManLo (Aig_Man_t *p, int i)
 
static Aig_Obj_tAig_ManLi (Aig_Man_t *p, int i)
 
static Aig_Obj_tAig_ManObj (Aig_Man_t *p, int i)
 
static Aig_Type_t Aig_ObjType (Aig_Obj_t *pObj)
 
static int Aig_ObjIsNone (Aig_Obj_t *pObj)
 
static int Aig_ObjIsConst1 (Aig_Obj_t *pObj)
 
static int Aig_ObjIsCi (Aig_Obj_t *pObj)
 
static int Aig_ObjIsCo (Aig_Obj_t *pObj)
 
static int Aig_ObjIsBuf (Aig_Obj_t *pObj)
 
static int Aig_ObjIsAnd (Aig_Obj_t *pObj)
 
static int Aig_ObjIsExor (Aig_Obj_t *pObj)
 
static int Aig_ObjIsNode (Aig_Obj_t *pObj)
 
static int Aig_ObjIsTerm (Aig_Obj_t *pObj)
 
static int Aig_ObjIsHash (Aig_Obj_t *pObj)
 
static int Aig_ObjIsChoice (Aig_Man_t *p, Aig_Obj_t *pObj)
 
static int Aig_ObjIsCand (Aig_Obj_t *pObj)
 
static int Aig_ObjCioId (Aig_Obj_t *pObj)
 
static int Aig_ObjId (Aig_Obj_t *pObj)
 
static int Aig_ObjIsMarkA (Aig_Obj_t *pObj)
 
static void Aig_ObjSetMarkA (Aig_Obj_t *pObj)
 
static void Aig_ObjClearMarkA (Aig_Obj_t *pObj)
 
static void Aig_ObjSetTravId (Aig_Obj_t *pObj, int TravId)
 
static void Aig_ObjSetTravIdCurrent (Aig_Man_t *p, Aig_Obj_t *pObj)
 
static void Aig_ObjSetTravIdPrevious (Aig_Man_t *p, Aig_Obj_t *pObj)
 
static int Aig_ObjIsTravIdCurrent (Aig_Man_t *p, Aig_Obj_t *pObj)
 
static int Aig_ObjIsTravIdPrevious (Aig_Man_t *p, Aig_Obj_t *pObj)
 
static int Aig_ObjPhase (Aig_Obj_t *pObj)
 
static int Aig_ObjPhaseReal (Aig_Obj_t *pObj)
 
static int Aig_ObjRefs (Aig_Obj_t *pObj)
 
static void Aig_ObjRef (Aig_Obj_t *pObj)
 
static void Aig_ObjDeref (Aig_Obj_t *pObj)
 
static void Aig_ObjClearRef (Aig_Obj_t *pObj)
 
static int Aig_ObjFaninId0 (Aig_Obj_t *pObj)
 
static int Aig_ObjFaninId1 (Aig_Obj_t *pObj)
 
static int Aig_ObjFaninC0 (Aig_Obj_t *pObj)
 
static int Aig_ObjFaninC1 (Aig_Obj_t *pObj)
 
static Aig_Obj_tAig_ObjFanin0 (Aig_Obj_t *pObj)
 
static Aig_Obj_tAig_ObjFanin1 (Aig_Obj_t *pObj)
 
static Aig_Obj_tAig_ObjChild0 (Aig_Obj_t *pObj)
 
static Aig_Obj_tAig_ObjChild1 (Aig_Obj_t *pObj)
 
static Aig_Obj_tAig_ObjChild0Copy (Aig_Obj_t *pObj)
 
static Aig_Obj_tAig_ObjChild1Copy (Aig_Obj_t *pObj)
 
static Aig_Obj_tAig_ObjChild0Next (Aig_Obj_t *pObj)
 
static Aig_Obj_tAig_ObjChild1Next (Aig_Obj_t *pObj)
 
static void Aig_ObjChild0Flip (Aig_Obj_t *pObj)
 
static void Aig_ObjChild1Flip (Aig_Obj_t *pObj)
 
static Aig_Obj_tAig_ObjCopy (Aig_Obj_t *pObj)
 
static void Aig_ObjSetCopy (Aig_Obj_t *pObj, Aig_Obj_t *pCopy)
 
static Aig_Obj_tAig_ObjRealCopy (Aig_Obj_t *pObj)
 
static int Aig_ObjToLit (Aig_Obj_t *pObj)
 
static Aig_Obj_tAig_ObjFromLit (Aig_Man_t *p, int iLit)
 
static int Aig_ObjLevel (Aig_Obj_t *pObj)
 
static int Aig_ObjLevelNew (Aig_Obj_t *pObj)
 
static int Aig_ObjSetLevel (Aig_Obj_t *pObj, int i)
 
static void Aig_ObjClean (Aig_Obj_t *pObj)
 
static Aig_Obj_tAig_ObjFanout0 (Aig_Man_t *p, Aig_Obj_t *pObj)
 
static Aig_Obj_tAig_ObjEquiv (Aig_Man_t *p, Aig_Obj_t *pObj)
 
static void Aig_ObjSetEquiv (Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pEqu)
 
static Aig_Obj_tAig_ObjRepr (Aig_Man_t *p, Aig_Obj_t *pObj)
 
static void Aig_ObjSetRepr (Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pRepr)
 
static int Aig_ObjWhatFanin (Aig_Obj_t *pObj, Aig_Obj_t *pFanin)
 
static int Aig_ObjFanoutC (Aig_Obj_t *pObj, Aig_Obj_t *pFanout)
 
static Aig_Obj_tAig_ObjCreateGhost (Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1, Aig_Type_t Type)
 
static Aig_Obj_tAig_ManFetchMemory (Aig_Man_t *p)
 
static void Aig_ManRecycleMemory (Aig_Man_t *p, Aig_Obj_t *pEntry)
 
static int Aig_ObjFanout0Int (Aig_Man_t *p, int ObjId)
 
static int Aig_ObjFanoutNext (Aig_Man_t *p, int iFan)
 
ABC_DLL int Aig_ManCheck (Aig_Man_t *p)
 FUNCTION DECLARATIONS ///. More...
 
void Aig_ManCheckMarkA (Aig_Man_t *p)
 
void Aig_ManCheckPhase (Aig_Man_t *p)
 
Aig_ManCut_tAig_ComputeCuts (Aig_Man_t *pAig, int nCutsMax, int nLeafMax, int fTruth, int fVerbose)
 
void Aig_ManCutStop (Aig_ManCut_t *p)
 
int Aig_ManVerifyTopoOrder (Aig_Man_t *p)
 DECLARATIONS ///. More...
 
Vec_Ptr_tAig_ManDfs (Aig_Man_t *p, int fNodesOnly)
 
Vec_Ptr_tAig_ManDfsAll (Aig_Man_t *p)
 
Vec_Ptr_tAig_ManDfsPreorder (Aig_Man_t *p, int fNodesOnly)
 
Vec_Vec_tAig_ManLevelize (Aig_Man_t *p)
 
Vec_Ptr_tAig_ManDfsNodes (Aig_Man_t *p, Aig_Obj_t **ppNodes, int nNodes)
 
Vec_Ptr_tAig_ManDfsChoices (Aig_Man_t *p)
 
Vec_Ptr_tAig_ManDfsReverse (Aig_Man_t *p)
 
int Aig_ManLevelNum (Aig_Man_t *p)
 
int Aig_ManChoiceLevel (Aig_Man_t *p)
 
int Aig_DagSize (Aig_Obj_t *pObj)
 
int Aig_SupportSize (Aig_Man_t *p, Aig_Obj_t *pObj)
 
Vec_Ptr_tAig_Support (Aig_Man_t *p, Aig_Obj_t *pObj)
 
void Aig_SupportNodes (Aig_Man_t *p, Aig_Obj_t **ppObjs, int nObjs, Vec_Ptr_t *vSupp)
 
void Aig_ConeUnmark_rec (Aig_Obj_t *pObj)
 
Aig_Obj_tAig_Transfer (Aig_Man_t *pSour, Aig_Man_t *pDest, Aig_Obj_t *pObj, int nVars)
 
Aig_Obj_tAig_Compose (Aig_Man_t *p, Aig_Obj_t *pRoot, Aig_Obj_t *pFunc, int iVar)
 
void Aig_ObjCollectCut (Aig_Obj_t *pRoot, Vec_Ptr_t *vLeaves, Vec_Ptr_t *vNodes)
 
int Aig_ObjCollectSuper (Aig_Obj_t *pObj, Vec_Ptr_t *vSuper)
 
Aig_Obj_tAig_ManDupSimpleDfs_rec (Aig_Man_t *pNew, Aig_Man_t *p, Aig_Obj_t *pObj)
 
Aig_Man_tAig_ManDupSimple (Aig_Man_t *p)
 DECLARATIONS ///. More...
 
Aig_Man_tAig_ManDupSimpleWithHints (Aig_Man_t *p, Vec_Int_t *vHints)
 
Aig_Man_tAig_ManDupSimpleDfs (Aig_Man_t *p)
 
Aig_Man_tAig_ManDupSimpleDfsPart (Aig_Man_t *p, Vec_Ptr_t *vPis, Vec_Ptr_t *vCos)
 
Aig_Man_tAig_ManDupOrdered (Aig_Man_t *p)
 
Aig_Man_tAig_ManDupCof (Aig_Man_t *p, int iInput, int Value)
 
Aig_Man_tAig_ManDupTrim (Aig_Man_t *p)
 
Aig_Man_tAig_ManDupExor (Aig_Man_t *p)
 
Aig_Man_tAig_ManDupDfs (Aig_Man_t *p)
 
Vec_Ptr_tAig_ManOrderPios (Aig_Man_t *p, Aig_Man_t *pOrder)
 
Aig_Man_tAig_ManDupDfsGuided (Aig_Man_t *p, Vec_Ptr_t *vPios)
 
Aig_Man_tAig_ManDupLevelized (Aig_Man_t *p)
 
Aig_Man_tAig_ManDupWithoutPos (Aig_Man_t *p)
 
Aig_Man_tAig_ManDupFlopsOnly (Aig_Man_t *p)
 
Aig_Man_tAig_ManDupRepres (Aig_Man_t *p)
 
Aig_Man_tAig_ManDupRepresDfs (Aig_Man_t *p)
 
Aig_Man_tAig_ManCreateMiter (Aig_Man_t *p1, Aig_Man_t *p2, int fImpl)
 
Aig_Man_tAig_ManDupOrpos (Aig_Man_t *p, int fAddRegs)
 
Aig_Man_tAig_ManDupOneOutput (Aig_Man_t *p, int iPoNum, int fAddRegs)
 
Aig_Man_tAig_ManDupUnsolvedOutputs (Aig_Man_t *p, int fAddRegs)
 
Aig_Man_tAig_ManDupArray (Vec_Ptr_t *vArray)
 
Aig_Man_tAig_ManDupNodes (Aig_Man_t *pMan, Vec_Ptr_t *vArray)
 
void Aig_ObjAddFanout (Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pFanout)
 
void Aig_ObjRemoveFanout (Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pFanout)
 
void Aig_ManFanoutStart (Aig_Man_t *p)
 FUNCTION DEFINITIONS ///. More...
 
void Aig_ManFanoutStop (Aig_Man_t *p)
 
Aig_Man_tAig_ManFrames (Aig_Man_t *pAig, int nFs, int fInit, int fOuts, int fRegs, int fEnlarge, Aig_Obj_t ***ppObjMap)
 FUNCTION DEFINITIONS ///. More...
 
Aig_Man_tAig_ManStart (int nNodesMax)
 DECLARATIONS ///. More...
 
Aig_Man_tAig_ManStartFrom (Aig_Man_t *p)
 
Aig_Man_tAig_ManExtractMiter (Aig_Man_t *p, Aig_Obj_t *pNode1, Aig_Obj_t *pNode2)
 
void Aig_ManStop (Aig_Man_t *p)
 
void Aig_ManStopP (Aig_Man_t **p)
 
int Aig_ManCleanup (Aig_Man_t *p)
 
int Aig_ManAntiCleanup (Aig_Man_t *p)
 
int Aig_ManCiCleanup (Aig_Man_t *p)
 
int Aig_ManCoCleanup (Aig_Man_t *p)
 
void Aig_ManPrintStats (Aig_Man_t *p)
 
void Aig_ManReportImprovement (Aig_Man_t *p, Aig_Man_t *pNew)
 
void Aig_ManSetRegNum (Aig_Man_t *p, int nRegs)
 
void Aig_ManFlipFirstPo (Aig_Man_t *p)
 
void * Aig_ManReleaseData (Aig_Man_t *p)
 
void Aig_ManStartMemory (Aig_Man_t *p)
 
void Aig_ManStopMemory (Aig_Man_t *p)
 
int Aig_NodeRef_rec (Aig_Obj_t *pNode, unsigned LevelMin)
 
int Aig_NodeDeref_rec (Aig_Obj_t *pNode, unsigned LevelMin, float *pPower, float *pProbs)
 DECLARATIONS ///. More...
 
int Aig_NodeMffcSupp (Aig_Man_t *p, Aig_Obj_t *pNode, int LevelMin, Vec_Ptr_t *vSupp)
 
int Aig_NodeMffcLabel (Aig_Man_t *p, Aig_Obj_t *pNode, float *pPower)
 
int Aig_NodeMffcLabelCut (Aig_Man_t *p, Aig_Obj_t *pNode, Vec_Ptr_t *vLeaves)
 
int Aig_NodeMffcExtendCut (Aig_Man_t *p, Aig_Obj_t *pNode, Vec_Ptr_t *vLeaves, Vec_Ptr_t *vResult)
 
Aig_Obj_tAig_ObjCreateCi (Aig_Man_t *p)
 DECLARATIONS ///. More...
 
Aig_Obj_tAig_ObjCreateCo (Aig_Man_t *p, Aig_Obj_t *pDriver)
 
Aig_Obj_tAig_ObjCreate (Aig_Man_t *p, Aig_Obj_t *pGhost)
 
void Aig_ObjConnect (Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pFan0, Aig_Obj_t *pFan1)
 
void Aig_ObjDisconnect (Aig_Man_t *p, Aig_Obj_t *pObj)
 
void Aig_ObjDelete (Aig_Man_t *p, Aig_Obj_t *pObj)
 
void Aig_ObjDelete_rec (Aig_Man_t *p, Aig_Obj_t *pObj, int fFreeTop)
 
void Aig_ObjDeletePo (Aig_Man_t *p, Aig_Obj_t *pObj)
 
void Aig_ObjPrint (Aig_Man_t *p, Aig_Obj_t *pObj)
 
void Aig_ObjPatchFanin0 (Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pFaninNew)
 
void Aig_ObjReplace (Aig_Man_t *p, Aig_Obj_t *pObjOld, Aig_Obj_t *pObjNew, int fUpdateLevel)
 
Aig_Obj_tAig_IthVar (Aig_Man_t *p, int i)
 FUNCTION DEFINITIONS ///. More...
 
Aig_Obj_tAig_Oper (Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1, Aig_Type_t Type)
 
Aig_Obj_tAig_And (Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
 
Aig_Obj_tAig_Or (Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
 
Aig_Obj_tAig_Exor (Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
 
Aig_Obj_tAig_Mux (Aig_Man_t *p, Aig_Obj_t *pC, Aig_Obj_t *p1, Aig_Obj_t *p0)
 
Aig_Obj_tAig_Maj (Aig_Man_t *p, Aig_Obj_t *pA, Aig_Obj_t *pB, Aig_Obj_t *pC)
 
Aig_Obj_tAig_Multi (Aig_Man_t *p, Aig_Obj_t **pArgs, int nArgs, Aig_Type_t Type)
 
Aig_Obj_tAig_Miter (Aig_Man_t *p, Vec_Ptr_t *vPairs)
 
Aig_Obj_tAig_MiterTwo (Aig_Man_t *p, Vec_Ptr_t *vNodes1, Vec_Ptr_t *vNodes2)
 
Aig_Obj_tAig_CreateAnd (Aig_Man_t *p, int nVars)
 
Aig_Obj_tAig_CreateOr (Aig_Man_t *p, int nVars)
 
Aig_Obj_tAig_CreateExor (Aig_Man_t *p, int nVars)
 
void Aig_ManOrderStart (Aig_Man_t *p)
 DECLARATIONS ///. More...
 
void Aig_ManOrderStop (Aig_Man_t *p)
 
void Aig_ObjOrderInsert (Aig_Man_t *p, int ObjId)
 
void Aig_ObjOrderRemove (Aig_Man_t *p, int ObjId)
 
void Aig_ObjOrderAdvance (Aig_Man_t *p)
 
Vec_Ptr_tAig_ManSupports (Aig_Man_t *p)
 
Vec_Ptr_tAig_ManSupportsInverse (Aig_Man_t *p)
 
Vec_Ptr_tAig_ManSupportsRegisters (Aig_Man_t *p)
 
Vec_Ptr_tAig_ManPartitionSmart (Aig_Man_t *p, int nPartSizeLimit, int fVerbose, Vec_Ptr_t **pvPartSupps)
 
Vec_Ptr_tAig_ManPartitionSmartRegisters (Aig_Man_t *pAig, int nSuppSizeLimit, int fVerbose)
 
Vec_Ptr_tAig_ManPartitionNaive (Aig_Man_t *p, int nPartSize)
 
Vec_Ptr_tAig_ManMiterPartitioned (Aig_Man_t *p1, Aig_Man_t *p2, int nPartSize, int fSmart)
 
Aig_Man_tAig_ManChoicePartitioned (Vec_Ptr_t *vAigs, int nPartSize, int nConfMax, int nLevelMax, int fVerbose)
 
Aig_Man_tAig_ManFraigPartitioned (Aig_Man_t *pAig, int nPartSize, int nConfMax, int nLevelMax, int fVerbose)
 
Aig_Man_tAig_ManChoiceConstructive (Vec_Ptr_t *vAigs, int fVerbose)
 
Vec_Ptr_tAig_ManRegPartitionSimple (Aig_Man_t *pAig, int nPartSize, int nOverSize)
 
void Aig_ManPartDivide (Vec_Ptr_t *vResult, Vec_Int_t *vDomain, int nPartSize, int nOverSize)
 
Vec_Ptr_tAig_ManRegPartitionSmart (Aig_Man_t *pAig, int nPartSize)
 
Aig_Man_tAig_ManRegCreatePart (Aig_Man_t *pAig, Vec_Int_t *vPart, int *pnCountPis, int *pnCountRegs, int **ppMapBack)
 
Vec_Ptr_tAig_ManRegProjectOnehots (Aig_Man_t *pAig, Aig_Man_t *pPart, Vec_Ptr_t *vOnehots, int fVerbose)
 
void Aig_ManReprStart (Aig_Man_t *p, int nIdMax)
 DECLARATIONS ///. More...
 
void Aig_ManReprStop (Aig_Man_t *p)
 
void Aig_ObjCreateRepr (Aig_Man_t *p, Aig_Obj_t *pNode1, Aig_Obj_t *pNode2)
 
void Aig_ManTransferRepr (Aig_Man_t *pNew, Aig_Man_t *p)
 
Aig_Man_tAig_ManDupRepr (Aig_Man_t *p, int fOrdered)
 
Aig_Man_tAig_ManDupReprBasic (Aig_Man_t *p)
 
int Aig_ManCountReprs (Aig_Man_t *p)
 
Aig_Man_tAig_ManRehash (Aig_Man_t *p)
 
int Aig_ObjCheckTfi (Aig_Man_t *p, Aig_Obj_t *pNew, Aig_Obj_t *pOld)
 
void Aig_ManMarkValidChoices (Aig_Man_t *p)
 
int Aig_TransferMappedClasses (Aig_Man_t *pAig, Aig_Man_t *pPart, int *pMapBack)
 
Aig_Man_tRtm_ManRetime (Aig_Man_t *p, int fForward, int nStepsMax, int fVerbose)
 
Aig_Man_tAig_ManRetimeFrontier (Aig_Man_t *p, int nStepsMax)
 
Aig_Man_tAig_ManRemap (Aig_Man_t *p, Vec_Ptr_t *vMap)
 DECLARATIONS ///. More...
 
int Aig_ManSeqCleanup (Aig_Man_t *p)
 
int Aig_ManSeqCleanupBasic (Aig_Man_t *p)
 
int Aig_ManCountMergeRegs (Aig_Man_t *p)
 
Aig_Man_tAig_ManReduceLaches (Aig_Man_t *p, int fVerbose)
 
void Aig_ManComputeSccs (Aig_Man_t *p)
 
Aig_Man_tAig_ManScl (Aig_Man_t *pAig, int fLatchConst, int fLatchEqual, int fUseMvSweep, int nFramesSymb, int nFramesSatur, int fVerbose, int fVeryVerbose)
 
void Aig_ManShow (Aig_Man_t *pMan, int fHaig, Vec_Ptr_t *vBold)
 
Aig_Obj_tAig_TableLookup (Aig_Man_t *p, Aig_Obj_t *pGhost)
 
Aig_Obj_tAig_TableLookupTwo (Aig_Man_t *p, Aig_Obj_t *pFanin0, Aig_Obj_t *pFanin1)
 
void Aig_TableInsert (Aig_Man_t *p, Aig_Obj_t *pObj)
 
void Aig_TableDelete (Aig_Man_t *p, Aig_Obj_t *pObj)
 
int Aig_TableCountEntries (Aig_Man_t *p)
 
void Aig_TableProfile (Aig_Man_t *p)
 
void Aig_TableClear (Aig_Man_t *p)
 
void Aig_ObjClearReverseLevel (Aig_Man_t *p, Aig_Obj_t *pObj)
 
int Aig_ObjRequiredLevel (Aig_Man_t *p, Aig_Obj_t *pObj)
 
void Aig_ManStartReverseLevels (Aig_Man_t *p, int nMaxLevelIncrease)
 
void Aig_ManStopReverseLevels (Aig_Man_t *p)
 
void Aig_ManUpdateLevel (Aig_Man_t *p, Aig_Obj_t *pObjNew)
 
void Aig_ManUpdateReverseLevel (Aig_Man_t *p, Aig_Obj_t *pObjNew)
 
void Aig_ManVerifyLevel (Aig_Man_t *p)
 
void Aig_ManVerifyReverseLevel (Aig_Man_t *p)
 
unsigned * Aig_ManCutTruth (Aig_Obj_t *pRoot, Vec_Ptr_t *vLeaves, Vec_Ptr_t *vNodes, Vec_Ptr_t *vTruthElem, Vec_Ptr_t *vTruthStore)
 
Aig_Man_tAig_ManConstReduce (Aig_Man_t *p, int fUseMvSweep, int nFramesSymb, int nFramesSatur, int fVerbose, int fVeryVerbose)
 
void Aig_ManIncrementTravId (Aig_Man_t *p)
 DECLARATIONS ///. More...
 
char * Aig_TimeStamp ()
 
int Aig_ManHasNoGaps (Aig_Man_t *p)
 
int Aig_ManLevels (Aig_Man_t *p)
 
void Aig_ManResetRefs (Aig_Man_t *p)
 
void Aig_ManCleanMarkA (Aig_Man_t *p)
 
void Aig_ManCleanMarkB (Aig_Man_t *p)
 
void Aig_ManCleanMarkAB (Aig_Man_t *p)
 
void Aig_ManCleanData (Aig_Man_t *p)
 
void Aig_ObjCleanData_rec (Aig_Obj_t *pObj)
 
void Aig_ManCleanNext (Aig_Man_t *p)
 
void Aig_ObjCollectMulti (Aig_Obj_t *pFunc, Vec_Ptr_t *vSuper)
 
int Aig_ObjIsMuxType (Aig_Obj_t *pObj)
 
int Aig_ObjRecognizeExor (Aig_Obj_t *pObj, Aig_Obj_t **ppFan0, Aig_Obj_t **ppFan1)
 
Aig_Obj_tAig_ObjRecognizeMux (Aig_Obj_t *pObj, Aig_Obj_t **ppObjT, Aig_Obj_t **ppObjE)
 
Aig_Obj_tAig_ObjReal_rec (Aig_Obj_t *pObj)
 
int Aig_ObjCompareIdIncrease (Aig_Obj_t **pp1, Aig_Obj_t **pp2)
 
void Aig_ObjPrintEqn (FILE *pFile, Aig_Obj_t *pObj, Vec_Vec_t *vLevels, int Level)
 
void Aig_ObjPrintVerilog (FILE *pFile, Aig_Obj_t *pObj, Vec_Vec_t *vLevels, int Level)
 
void Aig_ObjPrintVerbose (Aig_Obj_t *pObj, int fHaig)
 
void Aig_ManPrintVerbose (Aig_Man_t *p, int fHaig)
 
void Aig_ManDump (Aig_Man_t *p)
 
void Aig_ManDumpBlif (Aig_Man_t *p, char *pFileName, Vec_Ptr_t *vPiNames, Vec_Ptr_t *vPoNames)
 
void Aig_ManDumpVerilog (Aig_Man_t *p, char *pFileName)
 
void Aig_ManSetCioIds (Aig_Man_t *p)
 
void Aig_ManCleanCioIds (Aig_Man_t *p)
 
int Aig_ManChoiceNum (Aig_Man_t *p)
 
char * Aig_FileNameGenericAppend (char *pBase, char *pSuffix)
 
unsigned Aig_ManRandom (int fReset)
 
word Aig_ManRandom64 (int fReset)
 
void Aig_ManRandomInfo (Vec_Ptr_t *vInfo, int iInputStart, int iWordStart, int iWordStop)
 
void Aig_NodeUnionLists (Vec_Ptr_t *vArr1, Vec_Ptr_t *vArr2, Vec_Ptr_t *vArr)
 
void Aig_NodeIntersectLists (Vec_Ptr_t *vArr1, Vec_Ptr_t *vArr2, Vec_Ptr_t *vArr)
 
void Aig_ManSetPhase (Aig_Man_t *pAig)
 
Vec_Ptr_tAig_ManMuxesCollect (Aig_Man_t *pAig)
 
void Aig_ManMuxesDeref (Aig_Man_t *pAig, Vec_Ptr_t *vMuxes)
 
void Aig_ManMuxesRef (Aig_Man_t *pAig, Vec_Ptr_t *vMuxes)
 
void Aig_ManInvertConstraints (Aig_Man_t *pAig)
 
void Aig_ManFindCut (Aig_Obj_t *pRoot, Vec_Ptr_t *vFront, Vec_Ptr_t *vVisited, int nSizeLimit, int nFanoutLimit)
 
Aig_MmFixed_tAig_MmFixedStart (int nEntrySize, int nEntriesMax)
 FUNCTION DEFINITIONS ///. More...
 
void Aig_MmFixedStop (Aig_MmFixed_t *p, int fVerbose)
 
char * Aig_MmFixedEntryFetch (Aig_MmFixed_t *p)
 
void Aig_MmFixedEntryRecycle (Aig_MmFixed_t *p, char *pEntry)
 
void Aig_MmFixedRestart (Aig_MmFixed_t *p)
 
int Aig_MmFixedReadMemUsage (Aig_MmFixed_t *p)
 
int Aig_MmFixedReadMaxEntriesUsed (Aig_MmFixed_t *p)
 
Aig_MmFlex_tAig_MmFlexStart ()
 
void Aig_MmFlexStop (Aig_MmFlex_t *p, int fVerbose)
 
char * Aig_MmFlexEntryFetch (Aig_MmFlex_t *p, int nBytes)
 
void Aig_MmFlexRestart (Aig_MmFlex_t *p)
 
int Aig_MmFlexReadMemUsage (Aig_MmFlex_t *p)
 
Aig_MmStep_tAig_MmStepStart (int nSteps)
 
void Aig_MmStepStop (Aig_MmStep_t *p, int fVerbose)
 
char * Aig_MmStepEntryFetch (Aig_MmStep_t *p, int nBytes)
 
void Aig_MmStepEntryRecycle (Aig_MmStep_t *p, char *pEntry, int nBytes)
 
int Aig_MmStepReadMemUsage (Aig_MmStep_t *p)
 

Macro Definition Documentation

#define Aig_CutForEachLeaf (   p,
  pCut,
  pLeaf,
 
)    for ( i = 0; (i < (int)(pCut)->nFanins) && ((pLeaf) = Aig_ManObj(p, (pCut)->pFanins[i])); i++ )

Definition at line 221 of file aig.h.

#define Aig_ManForEachCi (   p,
  pObj,
 
)    Vec_PtrForEachEntry( Aig_Obj_t *, p->vCis, pObj, i )

ITERATORS ///.

Definition at line 393 of file aig.h.

#define Aig_ManForEachCiReverse (   p,
  pObj,
 
)    Vec_PtrForEachEntryReverse( Aig_Obj_t *, p->vCis, pObj, i )

Definition at line 395 of file aig.h.

#define Aig_ManForEachCo (   p,
  pObj,
 
)    Vec_PtrForEachEntry( Aig_Obj_t *, p->vCos, pObj, i )

Definition at line 398 of file aig.h.

#define Aig_ManForEachCoReverse (   p,
  pObj,
 
)    Vec_PtrForEachEntryReverse( Aig_Obj_t *, p->vCos, pObj, i )

Definition at line 400 of file aig.h.

#define Aig_ManForEachExor (   p,
  pObj,
 
)    Vec_PtrForEachEntry( Aig_Obj_t *, p->vObjs, pObj, i ) if ( (pObj) == NULL || !Aig_ObjIsExor(pObj) ) {} else

Definition at line 418 of file aig.h.

#define Aig_ManForEachExorReverse (   p,
  pObj,
 
)    Vec_PtrForEachEntryReverse( Aig_Obj_t *, p->vObjs, pObj, i ) if ( (pObj) == NULL || !Aig_ObjIsExor(pObj) ) {} else

Definition at line 420 of file aig.h.

#define Aig_ManForEachLiLoSeq (   p,
  pObjLi,
  pObjLo,
 
)
Value:
for ( k = 0; (k < Aig_ManRegNum(p)) && (((pObjLi) = Aig_ManLi(p, k)), 1) \
&& (((pObjLo)=Aig_ManLo(p, k)), 1); k++ )
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_ManLi(Aig_Man_t *p, int i)
Definition: aig.h:269
static Aig_Obj_t * Aig_ManLo(Aig_Man_t *p, int i)
Definition: aig.h:268
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260

Definition at line 450 of file aig.h.

#define Aig_ManForEachLiSeq (   p,
  pObj,
 
)    Vec_PtrForEachEntryStart( Aig_Obj_t *, p->vCos, pObj, i, Aig_ManCoNum(p)-Aig_ManRegNum(p) )

Definition at line 447 of file aig.h.

#define Aig_ManForEachLoSeq (   p,
  pObj,
 
)    Vec_PtrForEachEntryStart( Aig_Obj_t *, p->vCis, pObj, i, Aig_ManCiNum(p)-Aig_ManRegNum(p) )

Definition at line 441 of file aig.h.

#define Aig_ManForEachNode (   p,
  pObj,
 
)    Vec_PtrForEachEntry( Aig_Obj_t *, p->vObjs, pObj, i ) if ( (pObj) == NULL || !Aig_ObjIsNode(pObj) ) {} else

Definition at line 413 of file aig.h.

#define Aig_ManForEachNodeReverse (   p,
  pObj,
 
)    Vec_PtrForEachEntryReverse( Aig_Obj_t *, p->vObjs, pObj, i ) if ( (pObj) == NULL || !Aig_ObjIsNode(pObj) ) {} else

Definition at line 415 of file aig.h.

#define Aig_ManForEachObj (   p,
  pObj,
 
)    Vec_PtrForEachEntry( Aig_Obj_t *, p->vObjs, pObj, i ) if ( (pObj) == NULL ) {} else

Definition at line 403 of file aig.h.

#define Aig_ManForEachObjReverse (   p,
  pObj,
 
)    Vec_PtrForEachEntryReverse( Aig_Obj_t *, p->vObjs, pObj, i ) if ( (pObj) == NULL ) {} else

Definition at line 405 of file aig.h.

#define Aig_ManForEachObjVec (   vIds,
  p,
  pObj,
 
)    for ( i = 0; i < Vec_IntSize(vIds) && (((pObj) = Aig_ManObj(p, Vec_IntEntry(vIds,i))), 1); i++ )

Definition at line 408 of file aig.h.

#define Aig_ManForEachObjVecReverse (   vIds,
  p,
  pObj,
 
)    for ( i = Vec_IntSize(vIds) - 1; i >= 0 && (((pObj) = Aig_ManObj(p, Vec_IntEntry(vIds,i))), 1); i-- )

Definition at line 410 of file aig.h.

#define Aig_ManForEachPiSeq (   p,
  pObj,
 
)    Vec_PtrForEachEntryStop( Aig_Obj_t *, p->vCis, pObj, i, Aig_ManCiNum(p)-Aig_ManRegNum(p) )

SEQUENTIAL ITERATORS ///.

Definition at line 438 of file aig.h.

#define Aig_ManForEachPoSeq (   p,
  pObj,
 
)    Vec_PtrForEachEntryStop( Aig_Obj_t *, p->vCos, pObj, i, Aig_ManCoNum(p)-Aig_ManRegNum(p) )

Definition at line 444 of file aig.h.

#define Aig_ObjForEachCut (   p,
  pObj,
  pCut,
 
)    for ( i = 0, pCut = Aig_ObjCuts(p, pObj); i < p->nCutsMax; i++, pCut = Aig_CutNext(pCut) )

Definition at line 218 of file aig.h.

#define Aig_ObjForEachFanout (   p,
  pObj,
  pFanout,
  iFan,
 
)
Value:
for ( assert(p->pFanData), i = 0; (i < (int)(pObj)->nRefs) && \
(((iFan) = i? Aig_ObjFanoutNext(p, iFan) : Aig_ObjFanout0Int(p, pObj->Id)), 1) && \
(((pFanout) = Aig_ManObj(p, iFan>>1)), 1); i++ )
static int Aig_ObjFanoutNext(Aig_Man_t *p, int iFan)
Definition: aig.h:425
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_ManObj(Aig_Man_t *p, int i)
Definition: aig.h:270
static int Aig_ObjFanout0Int(Aig_Man_t *p, int ObjId)
Definition: aig.h:424
#define assert(ex)
Definition: util_old.h:213

Definition at line 427 of file aig.h.

Typedef Documentation

typedef struct Aig_Cut_t_ Aig_Cut_t

Definition at line 176 of file aig.h.

typedef typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t

INCLUDES ///.

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

FileName [aig.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [AIG package.]

Synopsis [External declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

Id:
aig.h,v 1.00 2007/04/28 00:00:00 alanmi Exp

]PARAMETERS ///BASIC TYPES ///

Definition at line 50 of file aig.h.

typedef struct Aig_ManCut_t_ Aig_ManCut_t

Definition at line 175 of file aig.h.

typedef struct Aig_MmFixed_t_ Aig_MmFixed_t

Definition at line 52 of file aig.h.

typedef struct Aig_MmFlex_t_ Aig_MmFlex_t

Definition at line 53 of file aig.h.

typedef struct Aig_MmStep_t_ Aig_MmStep_t

Definition at line 54 of file aig.h.

typedef struct Aig_Obj_t_ Aig_Obj_t

Definition at line 51 of file aig.h.

Enumeration Type Documentation

enum Aig_Type_t
Enumerator
AIG_OBJ_NONE 
AIG_OBJ_CONST1 
AIG_OBJ_CI 
AIG_OBJ_CO 
AIG_OBJ_BUF 
AIG_OBJ_AND 
AIG_OBJ_EXOR 
AIG_OBJ_VOID 

Definition at line 57 of file aig.h.

57  {
58  AIG_OBJ_NONE, // 0: non-existent object
59  AIG_OBJ_CONST1, // 1: constant 1
60  AIG_OBJ_CI, // 2: combinational input
61  AIG_OBJ_CO, // 3: combinational output
62  AIG_OBJ_BUF, // 4: buffer node
63  AIG_OBJ_AND, // 5: AND node
64  AIG_OBJ_EXOR, // 6: EXOR node
65  AIG_OBJ_VOID // 7: unused object
66 } Aig_Type_t;
Aig_Type_t
Definition: aig.h:57
Definition: aig.h:61
Definition: aig.h:60

Function Documentation

Aig_Obj_t* Aig_And ( Aig_Man_t p,
Aig_Obj_t p0,
Aig_Obj_t p1 
)

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

Synopsis [Performs canonicization step.]

Description [The argument nodes can be complemented.]

SideEffects []

SeeAlso []

Definition at line 104 of file aigOper.c.

105 {
106  Aig_Obj_t * pGhost, * pResult;
107  Aig_Obj_t * pFan0, * pFan1;
108  // check trivial cases
109  if ( p0 == p1 )
110  return p0;
111  if ( p0 == Aig_Not(p1) )
112  return Aig_Not(p->pConst1);
113  if ( Aig_Regular(p0) == p->pConst1 )
114  return p0 == p->pConst1 ? p1 : Aig_Not(p->pConst1);
115  if ( Aig_Regular(p1) == p->pConst1 )
116  return p1 == p->pConst1 ? p0 : Aig_Not(p->pConst1);
117  // check not so trivial cases
118  if ( p->fAddStrash && (Aig_ObjIsNode(Aig_Regular(p0)) || Aig_ObjIsNode(Aig_Regular(p1))) )
119  { // http://fmv.jku.at/papers/BrummayerBiere-MEMICS06.pdf
120  Aig_Obj_t * pFanA, * pFanB, * pFanC, * pFanD;
121  pFanA = Aig_ObjChild0(Aig_Regular(p0));
122  pFanB = Aig_ObjChild1(Aig_Regular(p0));
123  pFanC = Aig_ObjChild0(Aig_Regular(p1));
124  pFanD = Aig_ObjChild1(Aig_Regular(p1));
125  if ( Aig_IsComplement(p0) )
126  {
127  if ( pFanA == Aig_Not(p1) || pFanB == Aig_Not(p1) )
128  return p1;
129  if ( pFanB == p1 )
130  return Aig_And( p, Aig_Not(pFanA), pFanB );
131  if ( pFanA == p1 )
132  return Aig_And( p, Aig_Not(pFanB), pFanA );
133  }
134  else
135  {
136  if ( pFanA == Aig_Not(p1) || pFanB == Aig_Not(p1) )
137  return Aig_Not(p->pConst1);
138  if ( pFanA == p1 || pFanB == p1 )
139  return p0;
140  }
141  if ( Aig_IsComplement(p1) )
142  {
143  if ( pFanC == Aig_Not(p0) || pFanD == Aig_Not(p0) )
144  return p0;
145  if ( pFanD == p0 )
146  return Aig_And( p, Aig_Not(pFanC), pFanD );
147  if ( pFanC == p0 )
148  return Aig_And( p, Aig_Not(pFanD), pFanC );
149  }
150  else
151  {
152  if ( pFanC == Aig_Not(p0) || pFanD == Aig_Not(p0) )
153  return Aig_Not(p->pConst1);
154  if ( pFanC == p0 || pFanD == p0 )
155  return p1;
156  }
157  if ( !Aig_IsComplement(p0) && !Aig_IsComplement(p1) )
158  {
159  if ( pFanA == Aig_Not(pFanC) || pFanA == Aig_Not(pFanD) || pFanB == Aig_Not(pFanC) || pFanB == Aig_Not(pFanD) )
160  return Aig_Not(p->pConst1);
161  if ( pFanA == pFanC || pFanB == pFanC )
162  return Aig_And( p, p0, pFanD );
163  if ( pFanB == pFanC || pFanB == pFanD )
164  return Aig_And( p, pFanA, p1 );
165  if ( pFanA == pFanD || pFanB == pFanD )
166  return Aig_And( p, p0, pFanC );
167  if ( pFanA == pFanC || pFanA == pFanD )
168  return Aig_And( p, pFanB, p1 );
169  }
170  else if ( Aig_IsComplement(p0) && !Aig_IsComplement(p1) )
171  {
172  if ( pFanA == Aig_Not(pFanC) || pFanA == Aig_Not(pFanD) || pFanB == Aig_Not(pFanC) || pFanB == Aig_Not(pFanD) )
173  return p1;
174  if ( pFanB == pFanC || pFanB == pFanD )
175  return Aig_And( p, Aig_Not(pFanA), p1 );
176  if ( pFanA == pFanC || pFanA == pFanD )
177  return Aig_And( p, Aig_Not(pFanB), p1 );
178  }
179  else if ( !Aig_IsComplement(p0) && Aig_IsComplement(p1) )
180  {
181  if ( pFanC == Aig_Not(pFanA) || pFanC == Aig_Not(pFanB) || pFanD == Aig_Not(pFanA) || pFanD == Aig_Not(pFanB) )
182  return p0;
183  if ( pFanD == pFanA || pFanD == pFanB )
184  return Aig_And( p, Aig_Not(pFanC), p0 );
185  if ( pFanC == pFanA || pFanC == pFanB )
186  return Aig_And( p, Aig_Not(pFanD), p0 );
187  }
188  else // if ( Aig_IsComplement(p0) && Aig_IsComplement(p1) )
189  {
190  if ( pFanA == pFanD && pFanB == Aig_Not(pFanC) )
191  return Aig_Not(pFanA);
192  if ( pFanB == pFanC && pFanA == Aig_Not(pFanD) )
193  return Aig_Not(pFanB);
194  if ( pFanA == pFanC && pFanB == Aig_Not(pFanD) )
195  return Aig_Not(pFanA);
196  if ( pFanB == pFanD && pFanA == Aig_Not(pFanC) )
197  return Aig_Not(pFanB);
198  }
199  }
200  // check if it can be an EXOR gate
201  if ( p->fCatchExor && Aig_ObjIsExorType( p0, p1, &pFan0, &pFan1 ) )
202  return Aig_Exor( p, pFan0, pFan1 );
203  pGhost = Aig_ObjCreateGhost( p, p0, p1, AIG_OBJ_AND );
204  if ( (pResult = Aig_TableLookup( p, pGhost )) )
205  return pResult;
206  return Aig_ObjCreate( p, pGhost );
207 }
static ABC_NAMESPACE_IMPL_START int Aig_ObjIsExorType(Aig_Obj_t *p0, Aig_Obj_t *p1, Aig_Obj_t **ppFan0, Aig_Obj_t **ppFan1)
DECLARATIONS ///.
Definition: aigOper.c:31
static Aig_Obj_t * Aig_ObjChild0(Aig_Obj_t *pObj)
Definition: aig.h:310
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Aig_Obj_t * Aig_TableLookup(Aig_Man_t *p, Aig_Obj_t *pGhost)
Definition: aigTable.c:116
Aig_Obj_t * Aig_Exor(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:220
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static Aig_Obj_t * Aig_Not(Aig_Obj_t *p)
Definition: aig.h:247
Aig_Obj_t * Aig_ObjCreate(Aig_Man_t *p, Aig_Obj_t *pGhost)
Definition: aigObj.c:89
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static Aig_Obj_t * Aig_ObjChild1(Aig_Obj_t *pObj)
Definition: aig.h:311
Definition: aig.h:69
static Aig_Obj_t * Aig_ObjCreateGhost(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1, Aig_Type_t Type)
Definition: aig.h:346
Aig_Obj_t* Aig_Compose ( Aig_Man_t p,
Aig_Obj_t pRoot,
Aig_Obj_t pFunc,
int  iVar 
)

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

Synopsis [Composes the AIG (pRoot) with the function (pFunc) using PI var (iVar).]

Description []

SideEffects []

SeeAlso []

Definition at line 966 of file aigDfs.c.

967 {
968  // quit if the PI variable is not defined
969  if ( iVar >= Aig_ManCiNum(p) )
970  {
971  printf( "Aig_Compose(): The PI variable %d is not defined.\n", iVar );
972  return NULL;
973  }
974  // recursively perform composition
975  Aig_Compose_rec( p, Aig_Regular(pRoot), pFunc, Aig_ManCi(p, iVar) );
976  // clear the markings
978  return Aig_NotCond( (Aig_Obj_t *)Aig_Regular(pRoot)->pData, Aig_IsComplement(pRoot) );
979 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static Aig_Obj_t * Aig_ManCi(Aig_Man_t *p, int i)
Definition: aig.h:266
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
Definition: aig.h:69
void Aig_ConeUnmark_rec(Aig_Obj_t *pObj)
Definition: aigDfs.c:690
void Aig_Compose_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pFunc, Aig_Obj_t *pVar)
Definition: aigDfs.c:938
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
Aig_ManCut_t* Aig_ComputeCuts ( Aig_Man_t pAig,
int  nCutsMax,
int  nLeafMax,
int  fTruth,
int  fVerbose 
)

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

Synopsis [Computes the cuts for all nodes in the static AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 631 of file aigCuts.c.

632 {
633  Aig_ManCut_t * p;
634  Aig_Obj_t * pObj;
635  int i;
636  abctime clk = Abc_Clock();
637  assert( pAig->pManCuts == NULL );
638  // start the manager
639  p = Aig_ManCutStart( pAig, nCutsMax, nLeafMax, fTruth, fVerbose );
640  // set elementary cuts at the PIs
641  Aig_ManForEachCi( pAig, pObj, i )
642  Aig_ObjPrepareCuts( p, pObj, 1 );
643  // process the nodes
644  Aig_ManForEachNode( pAig, pObj, i )
645  Aig_ObjComputeCuts( p, pObj, 1 );
646  // print stats
647  if ( fVerbose )
648  {
649  int nCuts, nCutsK;
650  nCuts = Aig_ManCutCount( p, &nCutsK );
651  printf( "Nodes = %6d. Total cuts = %6d. %d-input cuts = %6d.\n",
652  Aig_ManObjNum(pAig), nCuts, nLeafMax, nCutsK );
653  printf( "Cut size = %2d. Truth size = %2d. Total mem = %5.2f MB ",
654  p->nCutSize, 4*p->nTruthWords, 1.0*Aig_MmFixedReadMemUsage(p->pMemCuts)/(1<<20) );
655  ABC_PRT( "Runtime", Abc_Clock() - clk );
656 /*
657  Aig_ManForEachNode( pAig, pObj, i )
658  if ( i % 300 == 0 )
659  Aig_ObjCutPrint( p, pObj );
660 */
661  }
662  // remember the cut manager
663  pAig->pManCuts = p;
664  return p;
665 }
void Aig_ObjComputeCuts(Aig_ManCut_t *p, Aig_Obj_t *pObj, int fTriv)
Definition: aigCuts.c:576
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ManObjNum(Aig_Man_t *p)
Definition: aig.h:258
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
static abctime Abc_Clock()
Definition: abc_global.h:279
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
Aig_Cut_t * Aig_ObjPrepareCuts(Aig_ManCut_t *p, Aig_Obj_t *pObj, int fTriv)
Definition: aigCuts.c:536
if(last==0)
Definition: sparse_int.h:34
ABC_NAMESPACE_IMPL_START Aig_ManCut_t * Aig_ManCutStart(Aig_Man_t *pMan, int nCutsMax, int nLeafMax, int fTruth, int fVerbose)
DECLARATIONS ///.
Definition: aigCuts.c:46
Definition: aig.h:69
int Aig_ManCutCount(Aig_ManCut_t *p, int *pnCutsK)
Definition: aigCuts.c:147
int Aig_MmFixedReadMemUsage(Aig_MmFixed_t *p)
Definition: aigMem.c:271
#define ABC_PRT(a, t)
Definition: abc_global.h:220
#define assert(ex)
Definition: util_old.h:213
ABC_INT64_T abctime
Definition: abc_global.h:278
void Aig_ConeUnmark_rec ( Aig_Obj_t pObj)

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

Synopsis [Counts the number of AIG nodes rooted at this cone.]

Description []

SideEffects []

SeeAlso []

Definition at line 690 of file aigDfs.c.

691 {
692  assert( !Aig_IsComplement(pObj) );
693  if ( !Aig_ObjIsNode(pObj) || !Aig_ObjIsMarkA(pObj) )
694  return;
697  assert( Aig_ObjIsMarkA(pObj) ); // loop detection
698  Aig_ObjClearMarkA( pObj );
699 }
static int Aig_ObjIsMarkA(Aig_Obj_t *pObj)
Definition: aig.h:288
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static void Aig_ObjClearMarkA(Aig_Obj_t *pObj)
Definition: aig.h:290
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
void Aig_ConeUnmark_rec(Aig_Obj_t *pObj)
Definition: aigDfs.c:690
#define assert(ex)
Definition: util_old.h:213
Aig_Obj_t* Aig_CreateAnd ( Aig_Man_t p,
int  nVars 
)

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

Synopsis [Creates AND function with nVars inputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 474 of file aigOper.c.

475 {
476  Aig_Obj_t * pFunc;
477  int i;
478  pFunc = Aig_ManConst1( p );
479  for ( i = 0; i < nVars; i++ )
480  pFunc = Aig_And( p, pFunc, Aig_IthVar(p, i) );
481  return pFunc;
482 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Aig_Obj_t * Aig_IthVar(Aig_Man_t *p, int i)
FUNCTION DEFINITIONS ///.
Definition: aigOper.c:63
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
Definition: aig.h:69
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
Aig_Obj_t* Aig_CreateExor ( Aig_Man_t p,
int  nVars 
)

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

Synopsis [Creates AND function with nVars inputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 516 of file aigOper.c.

517 {
518  Aig_Obj_t * pFunc;
519  int i;
520  pFunc = Aig_ManConst0( p );
521  for ( i = 0; i < nVars; i++ )
522  pFunc = Aig_Exor( p, pFunc, Aig_IthVar(p, i) );
523  return pFunc;
524 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Aig_Obj_t * Aig_Exor(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:220
static Aig_Obj_t * Aig_ManConst0(Aig_Man_t *p)
Definition: aig.h:263
Aig_Obj_t * Aig_IthVar(Aig_Man_t *p, int i)
FUNCTION DEFINITIONS ///.
Definition: aigOper.c:63
Definition: aig.h:69
Aig_Obj_t* Aig_CreateOr ( Aig_Man_t p,
int  nVars 
)

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

Synopsis [Creates AND function with nVars inputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 495 of file aigOper.c.

496 {
497  Aig_Obj_t * pFunc;
498  int i;
499  pFunc = Aig_ManConst0( p );
500  for ( i = 0; i < nVars; i++ )
501  pFunc = Aig_Or( p, pFunc, Aig_IthVar(p, i) );
502  return pFunc;
503 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_ManConst0(Aig_Man_t *p)
Definition: aig.h:263
Aig_Obj_t * Aig_IthVar(Aig_Man_t *p, int i)
FUNCTION DEFINITIONS ///.
Definition: aigOper.c:63
Definition: aig.h:69
Aig_Obj_t * Aig_Or(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:259
static int Aig_CutLeaveNum ( Aig_Cut_t pCut)
inlinestatic

Definition at line 212 of file aig.h.

212 { return pCut->nFanins; }
char nFanins
Definition: aig.h:187
static int* Aig_CutLeaves ( Aig_Cut_t pCut)
inlinestatic

Definition at line 213 of file aig.h.

213 { return pCut->pFanins; }
int pFanins[0]
Definition: aig.h:188
static Aig_Cut_t* Aig_CutNext ( Aig_Cut_t pCut)
inlinestatic

Definition at line 215 of file aig.h.

215 { return (Aig_Cut_t *)(((char *)pCut) + pCut->nCutSize); }
short nCutSize
Definition: aig.h:185
static unsigned* Aig_CutTruth ( Aig_Cut_t pCut)
inlinestatic

Definition at line 214 of file aig.h.

214 { return (unsigned *)(pCut->pFanins + pCut->nLeafMax); }
char nLeafMax
Definition: aig.h:186
int pFanins[0]
Definition: aig.h:188
int Aig_DagSize ( Aig_Obj_t pObj)

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

Synopsis [Counts the number of AIG nodes rooted at this cone.]

Description []

SideEffects []

SeeAlso []

Definition at line 712 of file aigDfs.c.

713 {
714  int Counter;
715  Counter = Aig_ConeCountAndMark_rec( Aig_Regular(pObj) );
717  return Counter;
718 }
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
int Aig_ConeCountAndMark_rec(Aig_Obj_t *pObj)
Definition: aigDfs.c:666
static int Counter
void Aig_ConeUnmark_rec(Aig_Obj_t *pObj)
Definition: aigDfs.c:690
Aig_Obj_t* Aig_Exor ( Aig_Man_t p,
Aig_Obj_t p0,
Aig_Obj_t p1 
)

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

Synopsis [Performs canonicization step.]

Description [The argument nodes can be complemented.]

SideEffects []

SeeAlso []

Definition at line 220 of file aigOper.c.

221 {
222  Aig_Obj_t * pGhost, * pResult;
223  int fCompl;
224  // check trivial cases
225  if ( p0 == p1 )
226  return Aig_Not(p->pConst1);
227  if ( p0 == Aig_Not(p1) )
228  return p->pConst1;
229  if ( Aig_Regular(p0) == p->pConst1 )
230  return Aig_NotCond( p1, p0 == p->pConst1 );
231  if ( Aig_Regular(p1) == p->pConst1 )
232  return Aig_NotCond( p0, p1 == p->pConst1 );
233  // when there is no special XOR gates
234  if ( !p->fCatchExor )
235  return Aig_Or( p, Aig_And(p, p0, Aig_Not(p1)), Aig_And(p, Aig_Not(p0), p1) );
236  // canonicize
237  fCompl = Aig_IsComplement(p0) ^ Aig_IsComplement(p1);
238  p0 = Aig_Regular(p0);
239  p1 = Aig_Regular(p1);
240  pGhost = Aig_ObjCreateGhost( p, p0, p1, AIG_OBJ_EXOR );
241  // check the table
242  if ( (pResult = Aig_TableLookup( p, pGhost )) )
243  return Aig_NotCond( pResult, fCompl );
244  pResult = Aig_ObjCreate( p, pGhost );
245  return Aig_NotCond( pResult, fCompl );
246 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Aig_Obj_t * Aig_TableLookup(Aig_Man_t *p, Aig_Obj_t *pGhost)
Definition: aigTable.c:116
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static Aig_Obj_t * Aig_Not(Aig_Obj_t *p)
Definition: aig.h:247
Aig_Obj_t * Aig_ObjCreate(Aig_Man_t *p, Aig_Obj_t *pGhost)
Definition: aigObj.c:89
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
Definition: aig.h:69
static Aig_Obj_t * Aig_ObjCreateGhost(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1, Aig_Type_t Type)
Definition: aig.h:346
Aig_Obj_t * Aig_Or(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:259
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
char* Aig_FileNameGenericAppend ( char *  pBase,
char *  pSuffix 
)

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

Synopsis [Returns the composite name of the file.]

Description []

SideEffects []

SeeAlso []

Definition at line 1070 of file aigUtil.c.

1071 {
1072  static char Buffer[1000];
1073  char * pDot;
1074  strcpy( Buffer, pBase );
1075  if ( (pDot = strrchr( Buffer, '.' )) )
1076  *pDot = 0;
1077  strcat( Buffer, pSuffix );
1078  if ( (pDot = strrchr( Buffer, '\\' )) || (pDot = strrchr( Buffer, '/' )) )
1079  return pDot+1;
1080  return Buffer;
1081 }
char * strcpy()
char * strcat()
char * strrchr()
static int Aig_IsComplement ( Aig_Obj_t p)
inlinestatic

Definition at line 249 of file aig.h.

249 { return (int)((ABC_PTRUINT_T)(p) & 01); }
Aig_Obj_t* Aig_IthVar ( Aig_Man_t p,
int  i 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Returns i-th elementary variable.]

Description []

SideEffects []

SeeAlso []

Definition at line 63 of file aigOper.c.

64 {
65  int v;
66  for ( v = Aig_ManCiNum(p); v <= i; v++ )
67  Aig_ObjCreateCi( p );
68  assert( i < Vec_PtrSize(p->vCis) );
69  return Aig_ManCi( p, i );
70 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static Aig_Obj_t * Aig_ManCi(Aig_Man_t *p, int i)
Definition: aig.h:266
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
#define assert(ex)
Definition: util_old.h:213
Aig_Obj_t* Aig_Maj ( Aig_Man_t p,
Aig_Obj_t pA,
Aig_Obj_t pB,
Aig_Obj_t pC 
)

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

Synopsis [Implements ITE operation.]

Description []

SideEffects []

SeeAlso []

Definition at line 376 of file aigOper.c.

377 {
378  return Aig_Or( p, Aig_Or(p, Aig_And(p, pA, pB), Aig_And(p, pA, pC)), Aig_And(p, pB, pC) );
379 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
Aig_Obj_t * Aig_Or(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:259
static int Aig_ManAndNum ( Aig_Man_t p)
inlinestatic

Definition at line 254 of file aig.h.

254 { return p->nObjs[AIG_OBJ_AND]; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Aig_ManAntiCleanup ( Aig_Man_t p)

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

Synopsis [Adds POs for the nodes that otherwise would be dangling.]

Description [Returns the number of POs added.]

SideEffects []

SeeAlso []

Definition at line 293 of file aigMan.c.

294 {
295  Aig_Obj_t * pNode;
296  int i, nNodesOld = Aig_ManCoNum(p);
297  Aig_ManForEachObj( p, pNode, i )
298  if ( Aig_ObjIsNode(pNode) && Aig_ObjRefs(pNode) == 0 )
299  Aig_ObjCreateCo( p, pNode );
300  return nNodesOld - Aig_ManCoNum(p);
301 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
static int Aig_ObjRefs(Aig_Obj_t *pObj)
Definition: aig.h:300
static int Aig_ManBufNum ( Aig_Man_t p)
inlinestatic

Definition at line 253 of file aig.h.

253 { return p->nObjs[AIG_OBJ_BUF]; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
ABC_DLL int Aig_ManCheck ( Aig_Man_t p)

FUNCTION DECLARATIONS ///.

FUNCTION DECLARATIONS ///.

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

FileName [aigCheck.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [AIG package.]

Synopsis [AIG checking procedures.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

Id:
aigCheck.c,v 1.00 2007/04/28 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 aigCheck.c.

46 {
47  Aig_Obj_t * pObj, * pObj2;
48  int i;
49  // check primary inputs
50  Aig_ManForEachCi( p, pObj, i )
51  {
52  if ( Aig_ObjFanin0(pObj) || Aig_ObjFanin1(pObj) )
53  {
54  printf( "Aig_ManCheck: The PI node \"%p\" has fanins.\n", pObj );
55  return 0;
56  }
57  }
58  // check primary outputs
59  Aig_ManForEachCo( p, pObj, i )
60  {
61  if ( !Aig_ObjFanin0(pObj) )
62  {
63  printf( "Aig_ManCheck: The PO node \"%p\" has NULL fanin.\n", pObj );
64  return 0;
65  }
66  if ( Aig_ObjFanin1(pObj) )
67  {
68  printf( "Aig_ManCheck: The PO node \"%p\" has second fanin.\n", pObj );
69  return 0;
70  }
71  }
72  // check internal nodes
73  Aig_ManForEachObj( p, pObj, i )
74  {
75  if ( !Aig_ObjIsNode(pObj) )
76  continue;
77  if ( !Aig_ObjFanin0(pObj) || !Aig_ObjFanin1(pObj) )
78  {
79  printf( "Aig_ManCheck: The AIG has internal node \"%p\" with a NULL fanin.\n", pObj );
80  return 0;
81  }
82  if ( Aig_ObjFanin0(pObj)->Id >= Aig_ObjFanin1(pObj)->Id )
83  {
84  printf( "Aig_ManCheck: The AIG has node \"%p\" with a wrong ordering of fanins.\n", pObj );
85  return 0;
86  }
87  pObj2 = Aig_TableLookup( p, pObj );
88  if ( pObj2 != pObj )
89  {
90  printf( "Aig_ManCheck: Node \"%p\" is not in the structural hashing table.\n", pObj );
91  return 0;
92  }
93  }
94  // count the total number of nodes
95  if ( Aig_ManObjNum(p) != 1 + Aig_ManCiNum(p) + Aig_ManCoNum(p) +
97  {
98  printf( "Aig_ManCheck: The number of created nodes is wrong.\n" );
99  printf( "C1 = %d. Pi = %d. Po = %d. Buf = %d. And = %d. Xor = %d. Total = %d.\n",
102  printf( "Created = %d. Deleted = %d. Existing = %d.\n",
103  Aig_ManObjNumMax(p), p->nDeleted, Aig_ManObjNum(p) );
104  return 0;
105  }
106  // count the number of nodes in the table
108  {
109  printf( "Aig_ManCheck: The number of nodes in the structural hashing table is wrong.\n" );
110  printf( "Entries = %d. And = %d. Xor = %d. Total = %d.\n",
113 
114  return 0;
115  }
116 // if ( !Aig_ManIsAcyclic(p) )
117 // return 0;
118  return 1;
119 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Aig_Obj_t * Aig_TableLookup(Aig_Man_t *p, Aig_Obj_t *pGhost)
Definition: aigTable.c:116
static int Aig_ManObjNum(Aig_Man_t *p)
Definition: aig.h:258
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static int Aig_ManBufNum(Aig_Man_t *p)
Definition: aig.h:253
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
Definition: aig.h:69
int Aig_TableCountEntries(Aig_Man_t *p)
Definition: aigTable.c:218
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
static int Aig_ManAndNum(Aig_Man_t *p)
Definition: aig.h:254
static int Aig_ManExorNum(Aig_Man_t *p)
Definition: aig.h:255
void Aig_ManCheckMarkA ( Aig_Man_t p)

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

Synopsis [Checks if the markA is reset.]

Description []

SideEffects []

SeeAlso []

Definition at line 132 of file aigCheck.c.

133 {
134  Aig_Obj_t * pObj;
135  int i;
136  Aig_ManForEachObj( p, pObj, i )
137  assert( pObj->fMarkA == 0 );
138 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Definition: aig.h:69
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
#define assert(ex)
Definition: util_old.h:213
void Aig_ManCheckPhase ( Aig_Man_t p)

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

Synopsis [Checks the consistency of phase assignment.]

Description []

SideEffects []

SeeAlso []

Definition at line 151 of file aigCheck.c.

152 {
153  Aig_Obj_t * pObj;
154  int i;
155  Aig_ManForEachObj( p, pObj, i )
156  if ( Aig_ObjIsCi(pObj) )
157  assert( (int)pObj->fPhase == 0 );
158  else
159  assert( (int)pObj->fPhase == (Aig_ObjPhaseReal(Aig_ObjChild0(pObj)) & Aig_ObjPhaseReal(Aig_ObjChild1(pObj))) );
160 }
static Aig_Obj_t * Aig_ObjChild0(Aig_Obj_t *pObj)
Definition: aig.h:310
static Llb_Mgr_t * p
Definition: llb3Image.c:950
if(last==0)
Definition: sparse_int.h:34
static Aig_Obj_t * Aig_ObjChild1(Aig_Obj_t *pObj)
Definition: aig.h:311
else
Definition: sparse_int.h:55
static int Aig_ObjPhaseReal(Aig_Obj_t *pObj)
Definition: aig.h:299
Definition: aig.h:69
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
Aig_Man_t* Aig_ManChoiceConstructive ( Vec_Ptr_t vAigs,
int  fVerbose 
)

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

Synopsis [Constructively accumulates choices.]

Description []

SideEffects []

SeeAlso []

Definition at line 1564 of file aigPart.c.

1565 {
1566  Vec_Ptr_t * vPios;
1567  Aig_Man_t * pNew, * pThis, * pPrev, * pTemp;
1568  int i;
1569  // start AIG with choices
1570  pPrev = (Aig_Man_t *)Vec_PtrEntry( vAigs, 0 );
1571  pNew = Aig_ManDupOrdered( pPrev );
1572  // create room for equivalent nodes and representatives
1573  assert( pNew->pReprs == NULL );
1574  pNew->nReprsAlloc = Vec_PtrSize(vAigs) * Aig_ManObjNumMax(pNew);
1575  pNew->pReprs = ABC_ALLOC( Aig_Obj_t *, pNew->nReprsAlloc );
1576  memset( pNew->pReprs, 0, sizeof(Aig_Obj_t *) * pNew->nReprsAlloc );
1577  // add other AIGs one by one
1578  Vec_PtrForEachEntryStart( Aig_Man_t *, vAigs, pThis, i, 1 )
1579  {
1580  Aig_ManChoiceConstructiveOne( pNew, pPrev, pThis );
1581  pPrev = pThis;
1582  }
1583  // derive the result of choicing
1584  pNew = Aig_ManRehash( pNew );
1585  // create the equivalent nodes lists
1586  Aig_ManMarkValidChoices( pNew );
1587  // reconstruct the network
1588  vPios = Aig_ManOrderPios( pNew, (Aig_Man_t *)Vec_PtrEntry( vAigs, 0 ) );
1589  pNew = Aig_ManDupDfsGuided( pTemp = pNew, vPios );
1590  Aig_ManStop( pTemp );
1591  Vec_PtrFree( vPios );
1592  // duplicate the timing manager
1593  pTemp = (Aig_Man_t *)Vec_PtrEntry( vAigs, 0 );
1594  if ( pTemp->pManTime )
1595  pNew->pManTime = Tim_ManDup( (Tim_Man_t *)pTemp->pManTime, 0 );
1596  // reset levels
1597  Aig_ManChoiceLevel( pNew );
1598  return pNew;
1599 }
char * memset()
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
#define Vec_PtrForEachEntryStart(Type, vVec, pEntry, i, Start)
Definition: vecPtr.h:57
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
Aig_Man_t * Aig_ManDupOrdered(Aig_Man_t *p)
Definition: aigDup.c:277
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
Aig_Man_t * Aig_ManRehash(Aig_Man_t *p)
Definition: aigRepr.c:454
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
int Aig_ManChoiceLevel(Aig_Man_t *p)
Definition: aigDfs.c:581
Aig_Man_t * Aig_ManDupDfsGuided(Aig_Man_t *p, Vec_Ptr_t *vPios)
Definition: aigDup.c:694
void Aig_ManMarkValidChoices(Aig_Man_t *p)
Definition: aigRepr.c:481
Vec_Ptr_t * Aig_ManOrderPios(Aig_Man_t *p, Aig_Man_t *pOrder)
Definition: aigDup.c:626
Tim_Man_t * Tim_ManDup(Tim_Man_t *p, int fUnitDelay)
Definition: timMan.c:86
Definition: aig.h:69
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
void Aig_ManChoiceConstructiveOne(Aig_Man_t *pNew, Aig_Man_t *pPrev, Aig_Man_t *pThis)
Definition: aigPart.c:1478
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
int Aig_ManChoiceLevel ( Aig_Man_t p)

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

Synopsis [Computes levels for AIG with choices and white boxes.]

Description []

SideEffects []

SeeAlso []

Definition at line 581 of file aigDfs.c.

582 {
583  Aig_Obj_t * pObj;
584  int i, LevelMax = 0;
585  Aig_ManForEachObj( p, pObj, i )
586  Aig_ObjSetLevel( pObj, 0 );
587  Aig_ManSetCioIds( p );
589  Aig_ManForEachCo( p, pObj, i )
590  {
591  Aig_ManChoiceLevel_rec( p, pObj );
592  if ( LevelMax < Aig_ObjLevel(pObj) )
593  LevelMax = Aig_ObjLevel(pObj);
594  }
595  // account for dangling boxes
596  Aig_ManForEachCi( p, pObj, i )
597  {
598  Aig_ManChoiceLevel_rec( p, pObj );
599  if ( LevelMax < Aig_ObjLevel(pObj) )
600  LevelMax = Aig_ObjLevel(pObj);
601  }
602  Aig_ManCleanCioIds( p );
603 // Aig_ManForEachNode( p, pObj, i )
604 // assert( Aig_ObjLevel(pObj) > 0 );
605  return LevelMax;
606 }
static int Aig_ObjSetLevel(Aig_Obj_t *pObj, int i)
Definition: aig.h:325
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
void Aig_ManChoiceLevel_rec(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigDfs.c:509
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
Definition: aig.h:69
void Aig_ManSetCioIds(Aig_Man_t *p)
Definition: aigUtil.c:965
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
static int Aig_ObjLevel(Aig_Obj_t *pObj)
Definition: aig.h:323
void Aig_ManCleanCioIds(Aig_Man_t *p)
Definition: aigUtil.c:986
int Aig_ManChoiceNum ( Aig_Man_t p)

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

Synopsis [Sets the PI/PO numbers.]

Description []

SideEffects []

SeeAlso []

Definition at line 1007 of file aigUtil.c.

1008 {
1009  Aig_Obj_t * pObj;
1010  int i, Counter = 0;
1011  Aig_ManForEachNode( p, pObj, i )
1012  Counter += Aig_ObjIsChoice( p, pObj );
1013  return Counter;
1014 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
Definition: aig.h:69
static int Counter
static int Aig_ObjIsChoice(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:283
Aig_Man_t* Aig_ManChoicePartitioned ( Vec_Ptr_t vAigs,
int  nPartSize,
int  nConfMax,
int  nLevelMax,
int  fVerbose 
)

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

Synopsis [Performs partitioned choice computation.]

Description [Assumes that each output in the second AIG cannot have more supp vars than the same output in the first AIG.]

SideEffects []

SeeAlso []

Definition at line 1247 of file aigPart.c.

1248 {
1249 // extern int Cmd_CommandExecute( void * pAbc, char * sCommand );
1250 // extern void * Abc_FrameGetGlobalFrame();
1251 // extern Aig_Man_t * Fra_FraigChoice( Aig_Man_t * pManAig, int nConfMax, int nLevelMax );
1252 
1253  Vec_Ptr_t * vPios;
1254  Vec_Ptr_t * vOutsTotal, * vOuts;
1255  Aig_Man_t * pAigTotal, * pAigPart, * pAig, * pTemp;
1256  Vec_Int_t * vPart, * vPartSupp;
1257  Vec_Ptr_t * vParts;
1258  Aig_Obj_t * pObj;
1259  void ** ppData;
1260  int i, k, m, nIdMax;
1261  assert( Vec_PtrSize(vAigs) > 1 );
1262 
1263  // compute the total number of IDs
1264  nIdMax = 0;
1265  Vec_PtrForEachEntry( Aig_Man_t *, vAigs, pAig, i )
1266  nIdMax += Aig_ManObjNumMax(pAig);
1267 
1268  // partition the first AIG in the array
1269  pAig = (Aig_Man_t *)Vec_PtrEntry( vAigs, 0 );
1270  vParts = Aig_ManPartitionSmart( pAig, nPartSize, 0, NULL );
1271 
1272  // start the total fraiged AIG
1273  pAigTotal = Aig_ManStartFrom( pAig );
1274  Aig_ManReprStart( pAigTotal, nIdMax );
1275  vOutsTotal = Vec_PtrStart( Aig_ManCoNum(pAig) );
1276 
1277  // set the PI numbers
1278  Vec_PtrForEachEntry( Aig_Man_t *, vAigs, pAig, i )
1279  Aig_ManForEachCi( pAig, pObj, k )
1280  pObj->pNext = (Aig_Obj_t *)(long)k;
1281 
1282 // Cmd_CommandExecute( Abc_FrameGetGlobalFrame(), "unset progressbar" );
1283 
1284  // create the total fraiged AIG
1285  vPartSupp = Vec_IntAlloc( 100 ); // maps part PI num into total PI num
1286  Vec_PtrForEachEntry( Vec_Int_t *, vParts, vPart, i )
1287  {
1288  // derive the partition AIG
1289  pAigPart = Aig_ManStart( 5000 );
1290 // pAigPart->pName = Extra_UtilStrsav( pAigPart->pName );
1291  Vec_IntClear( vPartSupp );
1292  Vec_PtrForEachEntry( Aig_Man_t *, vAigs, pAig, k )
1293  {
1294  vOuts = Aig_ManDupPart( pAigPart, pAig, vPart, vPartSupp, 0 );
1295  if ( k == 0 )
1296  {
1297  Vec_PtrForEachEntry( Aig_Obj_t *, vOuts, pObj, m )
1298  Aig_ObjCreateCo( pAigPart, pObj );
1299  }
1300  Vec_PtrFree( vOuts );
1301  }
1302  // derive the total AIG from the partitioned AIG
1303  vOuts = Aig_ManDupPart( pAigTotal, pAigPart, vPart, vPartSupp, 1 );
1304  // add to the outputs
1305  Vec_PtrForEachEntry( Aig_Obj_t *, vOuts, pObj, k )
1306  {
1307  assert( Vec_PtrEntry( vOutsTotal, Vec_IntEntry(vPart,k) ) == NULL );
1308  Vec_PtrWriteEntry( vOutsTotal, Vec_IntEntry(vPart,k), pObj );
1309  }
1310  Vec_PtrFree( vOuts );
1311  // store contents of pData pointers
1312  ppData = ABC_ALLOC( void *, Aig_ManObjNumMax(pAigPart) );
1313  Aig_ManForEachObj( pAigPart, pObj, k )
1314  ppData[k] = pObj->pData;
1315  // report the process
1316  if ( fVerbose )
1317  printf( "Part %4d (out of %4d) PI = %5d. PO = %5d. And = %6d. Lev = %4d.\r",
1318  i+1, Vec_PtrSize(vParts), Aig_ManCiNum(pAigPart), Aig_ManCoNum(pAigPart),
1319  Aig_ManNodeNum(pAigPart), Aig_ManLevelNum(pAigPart) );
1320  // compute equivalence classes (to be stored in pNew->pReprs)
1321  pAig = Fra_FraigChoice( pAigPart, nConfMax, nLevelMax );
1322  Aig_ManStop( pAig );
1323  // reset the pData pointers
1324  Aig_ManForEachObj( pAigPart, pObj, k )
1325  pObj->pData = ppData[k];
1326  ABC_FREE( ppData );
1327  // transfer representatives to the total AIG
1328  if ( pAigPart->pReprs )
1329  Aig_ManTransferRepr( pAigTotal, pAigPart );
1330  Aig_ManStop( pAigPart );
1331  }
1332  if ( fVerbose )
1333  printf( " \r" );
1334  Vec_VecFree( (Vec_Vec_t *)vParts );
1335  Vec_IntFree( vPartSupp );
1336 
1337 // Cmd_CommandExecute( Abc_FrameGetGlobalFrame(), "set progressbar" );
1338 
1339  // clear the PI numbers
1340  Vec_PtrForEachEntry( Aig_Man_t *, vAigs, pAig, i )
1341  Aig_ManForEachCi( pAig, pObj, k )
1342  pObj->pNext = NULL;
1343 
1344  // add the outputs in the same order
1345  Vec_PtrForEachEntry( Aig_Obj_t *, vOutsTotal, pObj, i )
1346  Aig_ObjCreateCo( pAigTotal, pObj );
1347  Vec_PtrFree( vOutsTotal );
1348 
1349  // derive the result of choicing
1350  pAig = Aig_ManRehash( pAigTotal );
1351  // create the equivalent nodes lists
1352  Aig_ManMarkValidChoices( pAig );
1353  // reconstruct the network
1354  vPios = Aig_ManOrderPios( pAig, (Aig_Man_t *)Vec_PtrEntry(vAigs,0) );
1355  pAig = Aig_ManDupDfsGuided( pTemp = pAig, vPios );
1356  Aig_ManStop( pTemp );
1357  Vec_PtrFree( vPios );
1358  // duplicate the timing manager
1359  pTemp = (Aig_Man_t *)Vec_PtrEntry( vAigs, 0 );
1360  if ( pTemp->pManTime )
1361  pAig->pManTime = Tim_ManDup( (Tim_Man_t *)pTemp->pManTime, 0 );
1362  // reset levels
1363  Aig_ManChoiceLevel( pAig );
1364  return pAig;
1365 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
static Vec_Ptr_t * Vec_PtrStart(int nSize)
Definition: vecPtr.h:106
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
Aig_Man_t * Aig_ManRehash(Aig_Man_t *p)
Definition: aigRepr.c:454
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void Vec_VecFree(Vec_Vec_t *p)
Definition: vecVec.h:347
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
int Aig_ManChoiceLevel(Aig_Man_t *p)
Definition: aigDfs.c:581
Aig_Man_t * Fra_FraigChoice(Aig_Man_t *pManAig, int nConfMax, int nLevelMax)
Definition: fraCore.c:442
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
Aig_Man_t * Aig_ManDupDfsGuided(Aig_Man_t *p, Vec_Ptr_t *vPios)
Definition: aigDup.c:694
void Aig_ManReprStart(Aig_Man_t *p, int nIdMax)
DECLARATIONS ///.
Definition: aigRepr.c:45
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
void Aig_ManMarkValidChoices(Aig_Man_t *p)
Definition: aigRepr.c:481
Vec_Ptr_t * Aig_ManOrderPios(Aig_Man_t *p, Aig_Man_t *pOrder)
Definition: aigDup.c:626
if(last==0)
Definition: sparse_int.h:34
Tim_Man_t * Tim_ManDup(Tim_Man_t *p, int fUnitDelay)
Definition: timMan.c:86
Definition: aig.h:69
Aig_Man_t * Aig_ManStartFrom(Aig_Man_t *p)
Definition: aigMan.c:92
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
int Aig_ManLevelNum(Aig_Man_t *p)
Definition: aigDfs.c:486
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
Vec_Ptr_t * Aig_ManPartitionSmart(Aig_Man_t *p, int nSuppSizeLimit, int fVerbose, Vec_Ptr_t **pvPartSupps)
Definition: aigPart.c:686
#define ABC_FREE(obj)
Definition: abc_global.h:232
void Aig_ManTransferRepr(Aig_Man_t *pNew, Aig_Man_t *p)
Definition: aigRepr.c:211
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
Vec_Ptr_t * Aig_ManDupPart(Aig_Man_t *pNew, Aig_Man_t *pOld, Vec_Int_t *vPart, Vec_Int_t *vSuppMap, int fInverse)
Definition: aigPart.c:995
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
static Aig_Obj_t* Aig_ManCi ( Aig_Man_t p,
int  i 
)
inlinestatic

Definition at line 266 of file aig.h.

266 { return (Aig_Obj_t *)Vec_PtrEntry(p->vCis, i); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Definition: aig.h:69
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
int Aig_ManCiCleanup ( Aig_Man_t p)

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

Synopsis [Removes PIs without fanouts.]

Description [Returns the number of PIs removed.]

SideEffects []

SeeAlso []

Definition at line 314 of file aigMan.c.

315 {
316  Aig_Obj_t * pObj;
317  int i, k = 0, nPisOld = Aig_ManCiNum(p);
318  Vec_PtrForEachEntry( Aig_Obj_t *, p->vCis, pObj, i )
319  {
320  if ( i >= Aig_ManCiNum(p) - Aig_ManRegNum(p) )
321  Vec_PtrWriteEntry( p->vCis, k++, pObj );
322  else if ( Aig_ObjRefs(pObj) > 0 )
323  Vec_PtrWriteEntry( p->vCis, k++, pObj );
324  else
325  Vec_PtrWriteEntry( p->vObjs, pObj->Id, NULL );
326  }
327  Vec_PtrShrink( p->vCis, k );
328  p->nObjs[AIG_OBJ_CI] = Vec_PtrSize( p->vCis );
329  if ( Aig_ManRegNum(p) )
330  p->nTruePis = Aig_ManCiNum(p) - Aig_ManRegNum(p);
331  return nPisOld - Aig_ManCiNum(p);
332 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
Definition: aig.h:69
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
Definition: aig.h:60
static int Aig_ObjRefs(Aig_Obj_t *pObj)
Definition: aig.h:300
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void Vec_PtrShrink(Vec_Ptr_t *p, int nSizeNew)
Definition: vecPtr.h:528
int Id
Definition: aig.h:85
static int Aig_ManCiNum ( Aig_Man_t p)
inlinestatic

Definition at line 251 of file aig.h.

251 { return p->nObjs[AIG_OBJ_CI]; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Definition: aig.h:60
void Aig_ManCleanCioIds ( Aig_Man_t p)

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

Synopsis [Sets the PI/PO numbers.]

Description []

SideEffects []

SeeAlso []

Definition at line 986 of file aigUtil.c.

987 {
988  Aig_Obj_t * pObj;
989  int i;
990  Aig_ManForEachCi( p, pObj, i )
991  pObj->pNext = NULL;
992  Aig_ManForEachCo( p, pObj, i )
993  pObj->pNext = NULL;
994 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
Definition: aig.h:69
void Aig_ManCleanData ( Aig_Man_t p)

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

Synopsis [Cleans the data pointers for the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 205 of file aigUtil.c.

206 {
207  Aig_Obj_t * pObj;
208  int i;
209  Aig_ManForEachObj( p, pObj, i )
210  pObj->pData = NULL;
211 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Definition: aig.h:69
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
void Aig_ManCleanMarkA ( Aig_Man_t p)

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

Synopsis [Cleans fMarkA.]

Description []

SideEffects []

SeeAlso []

Definition at line 148 of file aigUtil.c.

149 {
150  Aig_Obj_t * pObj;
151  int i;
152  Aig_ManForEachObj( p, pObj, i )
153  pObj->fMarkA = 0;
154 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Definition: aig.h:69
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
void Aig_ManCleanMarkAB ( Aig_Man_t p)

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

Synopsis [Cleans fMarkB.]

Description []

SideEffects []

SeeAlso []

Definition at line 186 of file aigUtil.c.

187 {
188  Aig_Obj_t * pObj;
189  int i;
190  Aig_ManForEachObj( p, pObj, i )
191  pObj->fMarkA = pObj->fMarkB = 0;
192 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Definition: aig.h:69
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
void Aig_ManCleanMarkB ( Aig_Man_t p)

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

Synopsis [Cleans fMarkB.]

Description []

SideEffects []

SeeAlso []

Definition at line 167 of file aigUtil.c.

168 {
169  Aig_Obj_t * pObj;
170  int i;
171  Aig_ManForEachObj( p, pObj, i )
172  pObj->fMarkB = 0;
173 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Definition: aig.h:69
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
void Aig_ManCleanNext ( Aig_Man_t p)

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

Synopsis [Cleans the data pointers for the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 224 of file aigUtil.c.

225 {
226  Aig_Obj_t * pObj;
227  int i;
228  Aig_ManForEachObj( p, pObj, i )
229  pObj->pNext = NULL;
230 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Definition: aig.h:69
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
int Aig_ManCleanup ( Aig_Man_t p)

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

Synopsis [Removes combinational logic that does not feed into POs.]

Description [Returns the number of dangling nodes removed.]

SideEffects []

SeeAlso []

Definition at line 265 of file aigMan.c.

266 {
267  Vec_Ptr_t * vObjs;
268  Aig_Obj_t * pNode;
269  int i, nNodesOld = Aig_ManNodeNum(p);
270  // collect roots of dangling nodes
271  vObjs = Vec_PtrAlloc( 100 );
272  Aig_ManForEachObj( p, pNode, i )
273  if ( Aig_ObjIsNode(pNode) && Aig_ObjRefs(pNode) == 0 )
274  Vec_PtrPush( vObjs, pNode );
275  // recursively remove dangling nodes
276  Vec_PtrForEachEntry( Aig_Obj_t *, vObjs, pNode, i )
277  Aig_ObjDelete_rec( p, pNode, 1 );
278  Vec_PtrFree( vObjs );
279  return nNodesOld - Aig_ManNodeNum(p);
280 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
void Aig_ObjDelete_rec(Aig_Man_t *p, Aig_Obj_t *pObj, int fFreeTop)
Definition: aigObj.c:232
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static int Aig_ObjRefs(Aig_Obj_t *pObj)
Definition: aig.h:300
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
static Aig_Obj_t* Aig_ManCo ( Aig_Man_t p,
int  i 
)
inlinestatic

Definition at line 267 of file aig.h.

267 { return (Aig_Obj_t *)Vec_PtrEntry(p->vCos, i); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Definition: aig.h:69
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
int Aig_ManCoCleanup ( Aig_Man_t p)

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

Synopsis [Removes POs with constant input.]

Description [Returns the number of POs removed.]

SideEffects []

SeeAlso []

Definition at line 345 of file aigMan.c.

346 {
347  Aig_Obj_t * pObj;
348  int i, k = 0, nPosOld = Aig_ManCoNum(p);
349  Vec_PtrForEachEntry( Aig_Obj_t *, p->vCos, pObj, i )
350  {
351  if ( i >= Aig_ManCoNum(p) - Aig_ManRegNum(p) )
352  Vec_PtrWriteEntry( p->vCos, k++, pObj );
353  else if ( !Aig_ObjIsConst1(Aig_ObjFanin0(pObj)) || !Aig_ObjFaninC0(pObj) ) // non-const or const1
354  Vec_PtrWriteEntry( p->vCos, k++, pObj );
355  else
356  {
357  Aig_ObjDisconnect( p, pObj );
358  Vec_PtrWriteEntry( p->vObjs, pObj->Id, NULL );
359  }
360  }
361  Vec_PtrShrink( p->vCos, k );
362  p->nObjs[AIG_OBJ_CO] = Vec_PtrSize( p->vCos );
363  if ( Aig_ManRegNum(p) )
364  p->nTruePos = Aig_ManCoNum(p) - Aig_ManRegNum(p);
365  return nPosOld - Aig_ManCoNum(p);
366 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Definition: aig.h:61
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
Definition: aig.h:69
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
void Aig_ObjDisconnect(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigObj.c:171
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void Vec_PtrShrink(Vec_Ptr_t *p, int nSizeNew)
Definition: vecPtr.h:528
int Id
Definition: aig.h:85
void Aig_ManComputeSccs ( Aig_Man_t p)

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

Synopsis [Computes strongly connected components of registers.]

Description []

SideEffects []

SeeAlso []

Definition at line 489 of file aigScl.c.

490 {
491  Vec_Ptr_t * vSupports, * vMatrix, * vMatrix2;
492  Vec_Int_t * vSupp, * vSupp2, * vComp;
493  char * pVarsTot;
494  int i, k, m, iOut, iIn, nComps;
495  if ( Aig_ManRegNum(p) == 0 )
496  {
497  printf( "The network is combinational.\n" );
498  return;
499  }
500  // get structural supports for each output
501  vSupports = Aig_ManSupports( p );
502  // transforms the supports into the latch dependency matrix
503  vMatrix = Vec_PtrStart( Aig_ManRegNum(p) );
504  Vec_PtrForEachEntry( Vec_Int_t *, vSupports, vSupp, i )
505  {
506  // skip true POs
507  iOut = Vec_IntPop( vSupp );
508  iOut -= Aig_ManCoNum(p) - Aig_ManRegNum(p);
509  if ( iOut < 0 )
510  continue;
511  // remove PIs
512  m = 0;
513  Vec_IntForEachEntry( vSupp, iIn, k )
514  {
515  iIn -= Aig_ManCiNum(p) - Aig_ManRegNum(p);
516  if ( iIn < 0 )
517  continue;
518  assert( iIn < Aig_ManRegNum(p) );
519  Vec_IntWriteEntry( vSupp, m++, iIn );
520  }
521  Vec_IntShrink( vSupp, m );
522  // store support in the matrix
523  assert( iOut < Aig_ManRegNum(p) );
524  Vec_PtrWriteEntry( vMatrix, iOut, vSupp );
525  }
526  // create the reverse matrix
527  vMatrix2 = Vec_PtrAlloc( Aig_ManRegNum(p) );
528  for ( i = 0; i < Aig_ManRegNum(p); i++ )
529  Vec_PtrPush( vMatrix2, Vec_IntAlloc(8) );
530  Vec_PtrForEachEntry( Vec_Int_t *, vMatrix, vSupp, i )
531  {
532  Vec_IntForEachEntry( vSupp, iIn, k )
533  {
534  vSupp2 = (Vec_Int_t *)Vec_PtrEntry( vMatrix2, iIn );
535  Vec_IntPush( vSupp2, i );
536  }
537  }
538 
539  // detect strongly connected components
540  vComp = Vec_IntAlloc( Aig_ManRegNum(p) );
541  pVarsTot = ABC_ALLOC( char, Aig_ManRegNum(p) );
542  memset( pVarsTot, 0, Aig_ManRegNum(p) * sizeof(char) );
543  for ( nComps = 0; ; nComps++ )
544  {
545  Vec_IntClear( vComp );
546  // get the first support
547  for ( iOut = 0; iOut < Aig_ManRegNum(p); iOut++ )
548  if ( pVarsTot[iOut] == 0 )
549  break;
550  if ( iOut == Aig_ManRegNum(p) )
551  break;
552  pVarsTot[iOut] = 1;
553  Vec_IntPush( vComp, iOut );
554  Vec_IntForEachEntry( vComp, iOut, i )
555  {
556  vSupp = (Vec_Int_t *)Vec_PtrEntry( vMatrix, iOut );
557  Vec_IntForEachEntry( vSupp, iIn, k )
558  {
559  if ( pVarsTot[iIn] )
560  continue;
561  pVarsTot[iIn] = 1;
562  Vec_IntPush( vComp, iIn );
563  }
564  vSupp2 = (Vec_Int_t *)Vec_PtrEntry( vMatrix2, iOut );
565  Vec_IntForEachEntry( vSupp2, iIn, k )
566  {
567  if ( pVarsTot[iIn] )
568  continue;
569  pVarsTot[iIn] = 1;
570  Vec_IntPush( vComp, iIn );
571  }
572  }
573  if ( Vec_IntSize(vComp) == Aig_ManRegNum(p) )
574  {
575  printf( "There is only one SCC of registers in this network.\n" );
576  break;
577  }
578  printf( "SCC #%d contains %5d registers.\n", nComps+1, Vec_IntSize(vComp) );
579  }
580  ABC_FREE( pVarsTot );
581  Vec_IntFree( vComp );
582  Vec_PtrFree( vMatrix );
583  Vec_VecFree( (Vec_Vec_t *)vMatrix2 );
584  Vec_VecFree( (Vec_Vec_t *)vSupports );
585 }
char * memset()
static Vec_Ptr_t * Vec_PtrStart(int nSize)
Definition: vecPtr.h:106
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Vec_Ptr_t * Aig_ManSupports(Aig_Man_t *p)
Definition: aigPart.c:273
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static void Vec_VecFree(Vec_Vec_t *p)
Definition: vecVec.h:347
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
static int Vec_IntPop(Vec_Int_t *p)
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static void Vec_IntShrink(Vec_Int_t *p, int nSizeNew)
Definition: bblif.c:435
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
static Aig_Obj_t* Aig_ManConst0 ( Aig_Man_t p)
inlinestatic

Definition at line 263 of file aig.h.

263 { return Aig_Not(p->pConst1); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_Not(Aig_Obj_t *p)
Definition: aig.h:247
static Aig_Obj_t* Aig_ManConst1 ( Aig_Man_t p)
inlinestatic

Definition at line 264 of file aig.h.

264 { return p->pConst1; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Aig_Man_t* Aig_ManConstReduce ( Aig_Man_t p,
int  fUseMvSweep,
int  nFramesSymb,
int  nFramesSatur,
int  fVerbose,
int  fVeryVerbose 
)

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

Synopsis [Reduces the circuit using ternary simulation.]

Description []

SideEffects []

SeeAlso []

Definition at line 498 of file aigTsim.c.

499 {
500  Aig_Man_t * pTemp;
501  Vec_Ptr_t * vMap;
502  while ( Aig_ManRegNum(p) > 0 )
503  {
504  if ( fUseMvSweep )
505  vMap = Saig_MvManSimulate( p, nFramesSymb, nFramesSatur, fVerbose, fVeryVerbose );
506  else
507  vMap = Aig_ManTernarySimulate( p, fVerbose, fVeryVerbose );
508  if ( vMap == NULL )
509  break;
510  p = Aig_ManRemap( pTemp = p, vMap );
511  Vec_PtrFree( vMap );
512  Aig_ManSeqCleanup( p );
513  if ( fVerbose )
514  Aig_ManReportImprovement( pTemp, p );
515  Aig_ManStop( pTemp );
516  }
517  return p;
518 }
Aig_Man_t * Aig_ManRemap(Aig_Man_t *p, Vec_Ptr_t *vMap)
DECLARATIONS ///.
Definition: aigScl.c:46
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
int Aig_ManSeqCleanup(Aig_Man_t *p)
Definition: aigScl.c:158
Vec_Ptr_t * Aig_ManTernarySimulate(Aig_Man_t *p, int fVerbose, int fVeryVerbose)
Definition: aigTsim.c:348
void Aig_ManReportImprovement(Aig_Man_t *p, Aig_Man_t *pNew)
Definition: aigMan.c:415
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
Vec_Ptr_t * Saig_MvManSimulate(Aig_Man_t *pAig, int nFramesSymb, int nFramesSatur, int fVerbose, int fVeryVerbose)
Definition: saigSimMv.c:879
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
static int Aig_ManConstrNum ( Aig_Man_t p)
inlinestatic

Definition at line 261 of file aig.h.

261 { return p->nConstrs; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ManCoNum ( Aig_Man_t p)
inlinestatic

Definition at line 252 of file aig.h.

252 { return p->nObjs[AIG_OBJ_CO]; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Definition: aig.h:61
int Aig_ManCountMergeRegs ( Aig_Man_t p)

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

Synopsis [Returns the number of dangling nodes removed.]

Description []

SideEffects []

SeeAlso []

Definition at line 310 of file aigScl.c.

311 {
312  Aig_Obj_t * pObj, * pFanin;
313  int i, Counter = 0, Const0 = 0, Const1 = 0;
315  Aig_ManForEachLiSeq( p, pObj, i )
316  {
317  pFanin = Aig_ObjFanin0(pObj);
318  if ( Aig_ObjIsConst1(pFanin) )
319  {
320  if ( Aig_ObjFaninC0(pObj) )
321  Const0++;
322  else
323  Const1++;
324  }
325  if ( Aig_ObjIsTravIdCurrent(p, pFanin) )
326  continue;
327  Aig_ObjSetTravIdCurrent(p, pFanin);
328  Counter++;
329  }
330  printf( "Regs = %d. Fanins = %d. Const0 = %d. Const1 = %d.\n",
331  Aig_ManRegNum(p), Counter, Const0, Const1 );
332  return 0;
333 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
Definition: aig.h:69
static int Counter
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#define Aig_ManForEachLiSeq(p, pObj, i)
Definition: aig.h:447
int Aig_ManCountReprs ( Aig_Man_t p)

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

Synopsis [Transfer representatives and return the number of critical fanouts.]

Description []

SideEffects []

SeeAlso []

Definition at line 378 of file aigRepr.c.

379 {
380  Aig_Obj_t * pObj;
381  int i, Counter = 0;
382  if ( p->pReprs == NULL )
383  return 0;
384  Aig_ManForEachObj( p, pObj, i )
385  Counter += (p->pReprs[i] != NULL);
386  return Counter;
387 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Definition: aig.h:69
static int Counter
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
Aig_Man_t* Aig_ManCreateMiter ( Aig_Man_t p1,
Aig_Man_t p2,
int  Oper 
)

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

Synopsis [Creates the miter of the two AIG managers.]

Description [Oper is the operation to perform on the outputs of the miter. Oper == 0 is XOR Oper == 1 is complemented implication (p1 => p2) Oper == 2 is OR Oper == 3 is AND ]

SideEffects []

SeeAlso []

Definition at line 1049 of file aigDup.c.

1050 {
1051  Aig_Man_t * pNew;
1052  Aig_Obj_t * pObj;
1053  int i;
1054  assert( Aig_ManRegNum(p1) == 0 );
1055  assert( Aig_ManRegNum(p2) == 0 );
1056  assert( Aig_ManCoNum(p1) == 1 );
1057  assert( Aig_ManCoNum(p2) == 1 );
1058  assert( Aig_ManCiNum(p1) == Aig_ManCiNum(p2) );
1059  pNew = Aig_ManStart( Aig_ManObjNumMax(p1) + Aig_ManObjNumMax(p2) );
1060  // add first AIG
1061  Aig_ManConst1(p1)->pData = Aig_ManConst1(pNew);
1062  Aig_ManForEachCi( p1, pObj, i )
1063  pObj->pData = Aig_ObjCreateCi( pNew );
1064  Aig_ManForEachNode( p1, pObj, i )
1065  pObj->pData = Aig_And( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
1066  // add second AIG
1067  Aig_ManConst1(p2)->pData = Aig_ManConst1(pNew);
1068  Aig_ManForEachCi( p2, pObj, i )
1069  pObj->pData = Aig_ManCi( pNew, i );
1070  Aig_ManForEachNode( p2, pObj, i )
1071  pObj->pData = Aig_And( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
1072  // add the output
1073  if ( Oper == 0 ) // XOR
1074  pObj = Aig_Exor( pNew, Aig_ObjChild0Copy(Aig_ManCo(p1,0)), Aig_ObjChild0Copy(Aig_ManCo(p2,0)) );
1075  else if ( Oper == 1 ) // implication is PO(p1) -> PO(p2) ... complement is PO(p1) & !PO(p2)
1076  pObj = Aig_And( pNew, Aig_ObjChild0Copy(Aig_ManCo(p1,0)), Aig_Not(Aig_ObjChild0Copy(Aig_ManCo(p2,0))) );
1077  else if ( Oper == 2 ) // OR
1078  pObj = Aig_Or( pNew, Aig_ObjChild0Copy(Aig_ManCo(p1,0)), Aig_ObjChild0Copy(Aig_ManCo(p2,0)) );
1079  else if ( Oper == 3 ) // AND
1080  pObj = Aig_And( pNew, Aig_ObjChild0Copy(Aig_ManCo(p1,0)), Aig_ObjChild0Copy(Aig_ManCo(p2,0)) );
1081  else
1082  assert( 0 );
1083  Aig_ObjCreateCo( pNew, pObj );
1084  Aig_ManCleanup( pNew );
1085  return pNew;
1086 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
void * pData
Definition: aig.h:87
Aig_Obj_t * Aig_Exor(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:220
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
static Aig_Obj_t * Aig_Not(Aig_Obj_t *p)
Definition: aig.h:247
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
static Aig_Obj_t * Aig_ManCi(Aig_Man_t *p, int i)
Definition: aig.h:266
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
Aig_Obj_t * Aig_Or(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:259
Definition: aig.h:69
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
Definition: aig.h:267
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#define assert(ex)
Definition: util_old.h:213
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
void Aig_ManCutStop ( Aig_ManCut_t p)

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

Synopsis [Stops the fraiging manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 86 of file aigCuts.c.

87 {
88  Aig_MmFixedStop( p->pMemCuts, 0 );
89  ABC_FREE( p->puTemp[0] );
90  ABC_FREE( p->pCuts );
91  ABC_FREE( p );
92 }
unsigned * puTemp[4]
Definition: aig.h:206
void Aig_MmFixedStop(Aig_MmFixed_t *p, int fVerbose)
Definition: aigMem.c:132
Aig_MmFixed_t * pMemCuts
Definition: aig.h:205
Aig_Cut_t ** pCuts
Definition: aig.h:196
#define ABC_FREE(obj)
Definition: abc_global.h:232
unsigned* Aig_ManCutTruth ( Aig_Obj_t pRoot,
Vec_Ptr_t vLeaves,
Vec_Ptr_t vNodes,
Vec_Ptr_t vTruthElem,
Vec_Ptr_t vTruthStore 
)

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

Synopsis [Computes truth table of the cut.]

Description [The returned pointer should be used immediately.]

SideEffects []

SeeAlso []

Definition at line 80 of file aigTruth.c.

81 {
82  Aig_Obj_t * pObj;
83  int i, nWords;
84  assert( Vec_PtrSize(vLeaves) <= Vec_PtrSize(vTruthElem) );
85  assert( Vec_PtrSize(vNodes) <= Vec_PtrSize(vTruthStore) );
86  assert( Vec_PtrSize(vNodes) == 0 || pRoot == Vec_PtrEntryLast(vNodes) );
87  // assign elementary truth tables
88  Vec_PtrForEachEntry( Aig_Obj_t *, vLeaves, pObj, i )
89  pObj->pData = Vec_PtrEntry( vTruthElem, i );
90  // compute truths for other nodes
91  nWords = Abc_TruthWordNum( Vec_PtrSize(vLeaves) );
92  Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
93  pObj->pData = Aig_ManCutTruthOne( pObj, (unsigned *)Vec_PtrEntry(vTruthStore, i), nWords );
94  return (unsigned *)pRoot->pData;
95 }
static int Abc_TruthWordNum(int nVars)
Definition: abc_global.h:256
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
int nWords
Definition: abcNpn.c:127
ABC_NAMESPACE_IMPL_START unsigned * Aig_ManCutTruthOne(Aig_Obj_t *pNode, unsigned *pTruth, int nWords)
DECLARATIONS ///.
Definition: aigTruth.c:45
static void * Vec_PtrEntryLast(Vec_Ptr_t *p)
Definition: vecPtr.h:413
Definition: aig.h:69
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
Vec_Ptr_t* Aig_ManDfs ( Aig_Man_t p,
int  fNodesOnly 
)

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

Synopsis [Collects objects of the AIG in the DFS order.]

Description [Works with choice nodes.]

SideEffects []

SeeAlso []

Definition at line 145 of file aigDfs.c.

146 {
147  Vec_Ptr_t * vNodes;
148  Aig_Obj_t * pObj;
149  int i;
152  // start the array of nodes
153  vNodes = Vec_PtrAlloc( Aig_ManObjNumMax(p) );
154  // mark PIs if they should not be collected
155  if ( fNodesOnly )
156  Aig_ManForEachCi( p, pObj, i )
157  Aig_ObjSetTravIdCurrent( p, pObj );
158  else
159  Vec_PtrPush( vNodes, Aig_ManConst1(p) );
160  // collect nodes reachable in the DFS order
161  Aig_ManForEachCo( p, pObj, i )
162  Aig_ManDfs_rec( p, fNodesOnly? Aig_ObjFanin0(pObj): pObj, vNodes );
163  if ( fNodesOnly )
164  assert( Vec_PtrSize(vNodes) == Aig_ManNodeNum(p) );
165  else
166  assert( Vec_PtrSize(vNodes) == Aig_ManObjNum(p) );
167  return vNodes;
168 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ManObjNum(Aig_Man_t *p)
Definition: aig.h:258
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
Definition: aig.h:69
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
void Aig_ManDfs_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vNodes)
Definition: aigDfs.c:119
#define assert(ex)
Definition: util_old.h:213
Vec_Ptr_t* Aig_ManDfsAll ( Aig_Man_t p)

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

Synopsis [Collects objects of the AIG in the DFS order.]

Description []

SideEffects []

SeeAlso []

Definition at line 214 of file aigDfs.c.

215 {
216  Vec_Ptr_t * vNodes;
217  Aig_Obj_t * pObj;
218  int i;
220  vNodes = Vec_PtrAlloc( Aig_ManObjNumMax(p) );
221  // add constant
223  Vec_PtrPush( vNodes, Aig_ManConst1(p) );
224  // collect nodes reachable in the DFS order
225  Aig_ManForEachCo( p, pObj, i )
226  Aig_ManDfsAll_rec( p, pObj, vNodes );
227  Aig_ManForEachCi( p, pObj, i )
228  if ( !Aig_ObjIsTravIdCurrent(p, pObj) )
229  Vec_PtrPush( vNodes, pObj );
230  assert( Vec_PtrSize(vNodes) == Aig_ManObjNum(p) );
231  return vNodes;
232 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
static int Aig_ManObjNum(Aig_Man_t *p)
Definition: aig.h:258
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
void Aig_ManDfsAll_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vNodes)
Definition: aigDfs.c:181
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define assert(ex)
Definition: util_old.h:213
Vec_Ptr_t* Aig_ManDfsChoices ( Aig_Man_t p)

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

Synopsis [Collects internal nodes in the DFS order.]

Description []

SideEffects []

SeeAlso []

Definition at line 391 of file aigDfs.c.

392 {
393  Vec_Ptr_t * vNodes;
394  Aig_Obj_t * pObj;
395  int i, Counter = 0;
396 
397  Aig_ManForEachNode( p, pObj, i )
398  {
399  if ( Aig_ObjEquiv(p, pObj) == NULL )
400  continue;
401  Counter = 0;
402  for ( pObj = Aig_ObjEquiv(p, pObj) ; pObj; pObj = Aig_ObjEquiv(p, pObj) )
403  Counter++;
404 // printf( "%d ", Counter );
405  }
406 // printf( "\n" );
407 
408  assert( p->pEquivs != NULL );
410  // mark constant and PIs
412  Aig_ManForEachCi( p, pObj, i )
413  Aig_ObjSetTravIdCurrent( p, pObj );
414  // go through the nodes
415  vNodes = Vec_PtrAlloc( Aig_ManNodeNum(p) );
416  Aig_ManForEachCo( p, pObj, i )
417  Aig_ManDfsChoices_rec( p, Aig_ObjFanin0(pObj), vNodes );
418  return vNodes;
419 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Aig_ManDfsChoices_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vNodes)
Definition: aigDfs.c:364
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
static Aig_Obj_t * Aig_ObjEquiv(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:328
Definition: aig.h:69
static int Counter
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define assert(ex)
Definition: util_old.h:213
Vec_Ptr_t* Aig_ManDfsNodes ( Aig_Man_t p,
Aig_Obj_t **  ppNodes,
int  nNodes 
)

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

Synopsis [Collects internal nodes and PIs in the DFS order.]

Description []

SideEffects []

SeeAlso []

Definition at line 333 of file aigDfs.c.

334 {
335  Vec_Ptr_t * vNodes;
336 // Aig_Obj_t * pObj;
337  int i;
339  // mark constant and PIs
341 // Aig_ManForEachCi( p, pObj, i )
342 // Aig_ObjSetTravIdCurrent( p, pObj );
343  // go through the nodes
344  vNodes = Vec_PtrAlloc( Aig_ManNodeNum(p) );
345  for ( i = 0; i < nNodes; i++ )
346  if ( Aig_ObjIsCo(ppNodes[i]) )
347  Aig_ManDfs_rec( p, Aig_ObjFanin0(ppNodes[i]), vNodes );
348  else
349  Aig_ManDfs_rec( p, ppNodes[i], vNodes );
350  return vNodes;
351 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
void Aig_ManDfs_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vNodes)
Definition: aigDfs.c:119
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
Vec_Ptr_t* Aig_ManDfsPreorder ( Aig_Man_t p,
int  fNodesOnly 
)

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

Synopsis [Collects objects of the AIG in the DFS order.]

Description [Works with choice nodes.]

SideEffects []

SeeAlso []

Definition at line 271 of file aigDfs.c.

272 {
273  Vec_Ptr_t * vNodes;
274  Aig_Obj_t * pObj;
275  int i;
278  // start the array of nodes
279  vNodes = Vec_PtrAlloc( Aig_ManObjNumMax(p) );
280  // mark PIs if they should not be collected
281  if ( fNodesOnly )
282  Aig_ManForEachCi( p, pObj, i )
283  Aig_ObjSetTravIdCurrent( p, pObj );
284  else
285  Vec_PtrPush( vNodes, Aig_ManConst1(p) );
286  // collect nodes reachable in the DFS order
287  Aig_ManForEachCo( p, pObj, i )
288  Aig_ManDfsPreorder_rec( p, fNodesOnly? Aig_ObjFanin0(pObj): pObj, vNodes );
289  if ( fNodesOnly )
290  assert( Vec_PtrSize(vNodes) == Aig_ManNodeNum(p) );
291  else
292  assert( Vec_PtrSize(vNodes) == Aig_ManObjNum(p) );
293  return vNodes;
294 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ManObjNum(Aig_Man_t *p)
Definition: aig.h:258
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
Definition: aig.h:69
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
void Aig_ManDfsPreorder_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vNodes)
Definition: aigDfs.c:245
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define assert(ex)
Definition: util_old.h:213
Vec_Ptr_t* Aig_ManDfsReverse ( Aig_Man_t p)

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

Synopsis [Collects internal nodes in the reverse DFS order.]

Description []

SideEffects []

SeeAlso []

Definition at line 458 of file aigDfs.c.

459 {
460  Vec_Ptr_t * vNodes;
461  Aig_Obj_t * pObj;
462  int i;
464  // mark POs
465  Aig_ManForEachCo( p, pObj, i )
466  Aig_ObjSetTravIdCurrent( p, pObj );
467  // go through the nodes
468  vNodes = Vec_PtrAlloc( Aig_ManNodeNum(p) );
469  Aig_ManForEachObj( p, pObj, i )
470  if ( Aig_ObjIsNode(pObj) || Aig_ObjIsBuf(pObj) )
471  Aig_ManDfsReverse_rec( p, pObj, vNodes );
472  return vNodes;
473 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Aig_ObjIsBuf(Aig_Obj_t *pObj)
Definition: aig.h:277
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
void Aig_ManDfsReverse_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vNodes)
Definition: aigDfs.c:432
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
void Aig_ManDump ( Aig_Man_t p)

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

Synopsis [Write speculative miter for one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 712 of file aigUtil.c.

713 {
714  static int Counter = 0;
715  char FileName[20];
716  // dump the logic into a file
717  sprintf( FileName, "aigbug\\%03d.blif", ++Counter );
718  Aig_ManDumpBlif( p, FileName, NULL, NULL );
719  printf( "Intermediate AIG with %d nodes was written into file \"%s\".\n", Aig_ManNodeNum(p), FileName );
720 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Aig_ManDumpBlif(Aig_Man_t *p, char *pFileName, Vec_Ptr_t *vPiNames, Vec_Ptr_t *vPoNames)
Definition: aigUtil.c:733
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
char * sprintf()
static int Counter
void Aig_ManDumpBlif ( Aig_Man_t p,
char *  pFileName,
Vec_Ptr_t vPiNames,
Vec_Ptr_t vPoNames 
)

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

Synopsis [Writes the AIG into a BLIF file.]

Description []

SideEffects []

SeeAlso []

Definition at line 733 of file aigUtil.c.

734 {
735  FILE * pFile;
736  Vec_Ptr_t * vNodes;
737  Aig_Obj_t * pObj, * pObjLi, * pObjLo, * pConst1 = NULL;
738  int i, nDigits, Counter = 0;
739  if ( Aig_ManCoNum(p) == 0 )
740  {
741  printf( "Aig_ManDumpBlif(): AIG manager does not have POs.\n" );
742  return;
743  }
744  // check if constant is used
745  Aig_ManForEachCo( p, pObj, i )
746  if ( Aig_ObjIsConst1(Aig_ObjFanin0(pObj)) )
747  pConst1 = Aig_ManConst1(p);
748  // collect nodes in the DFS order
749  vNodes = Aig_ManDfs( p, 1 );
750  // assign IDs to objects
751  Aig_ManConst1(p)->iData = Counter++;
752  Aig_ManForEachCi( p, pObj, i )
753  pObj->iData = Counter++;
754  Aig_ManForEachCo( p, pObj, i )
755  pObj->iData = Counter++;
756  Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
757  pObj->iData = Counter++;
758  nDigits = Abc_Base10Log( Counter );
759  // write the file
760  pFile = fopen( pFileName, "w" );
761  fprintf( pFile, "# BLIF file written by procedure Aig_ManDumpBlif()\n" );
762 // fprintf( pFile, "# http://www.eecs.berkeley.edu/~alanmi/abc/\n" );
763  fprintf( pFile, ".model %s\n", p->pName );
764  // write PIs
765  fprintf( pFile, ".inputs" );
766  Aig_ManForEachPiSeq( p, pObj, i )
767  if ( vPiNames )
768  fprintf( pFile, " %s", (char*)Vec_PtrEntry(vPiNames, i) );
769  else
770  fprintf( pFile, " n%0*d", nDigits, pObj->iData );
771  fprintf( pFile, "\n" );
772  // write POs
773  fprintf( pFile, ".outputs" );
774  Aig_ManForEachPoSeq( p, pObj, i )
775  if ( vPoNames )
776  fprintf( pFile, " %s", (char*)Vec_PtrEntry(vPoNames, i) );
777  else
778  fprintf( pFile, " n%0*d", nDigits, pObj->iData );
779  fprintf( pFile, "\n" );
780  // write latches
781  if ( Aig_ManRegNum(p) )
782  {
783  fprintf( pFile, "\n" );
784  Aig_ManForEachLiLoSeq( p, pObjLi, pObjLo, i )
785  {
786  fprintf( pFile, ".latch" );
787  if ( vPoNames )
788  fprintf( pFile, " %s", (char*)Vec_PtrEntry(vPoNames, Aig_ManCoNum(p)-Aig_ManRegNum(p)+i) );
789  else
790  fprintf( pFile, " n%0*d", nDigits, pObjLi->iData );
791  if ( vPiNames )
792  fprintf( pFile, " %s", (char*)Vec_PtrEntry(vPiNames, Aig_ManCiNum(p)-Aig_ManRegNum(p)+i) );
793  else
794  fprintf( pFile, " n%0*d", nDigits, pObjLo->iData );
795  fprintf( pFile, " 0\n" );
796  }
797  fprintf( pFile, "\n" );
798  }
799  // write nodes
800  if ( pConst1 )
801  fprintf( pFile, ".names n%0*d\n 1\n", nDigits, pConst1->iData );
802  Aig_ManSetCioIds( p );
803  Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
804  {
805  fprintf( pFile, ".names" );
806  if ( vPiNames && Aig_ObjIsCi(Aig_ObjFanin0(pObj)) )
807  fprintf( pFile, " %s", (char*)Vec_PtrEntry(vPiNames, Aig_ObjCioId(Aig_ObjFanin0(pObj))) );
808  else
809  fprintf( pFile, " n%0*d", nDigits, Aig_ObjFanin0(pObj)->iData );
810  if ( vPiNames && Aig_ObjIsCi(Aig_ObjFanin1(pObj)) )
811  fprintf( pFile, " %s", (char*)Vec_PtrEntry(vPiNames, Aig_ObjCioId(Aig_ObjFanin1(pObj))) );
812  else
813  fprintf( pFile, " n%0*d", nDigits, Aig_ObjFanin1(pObj)->iData );
814  fprintf( pFile, " n%0*d\n", nDigits, pObj->iData );
815  fprintf( pFile, "%d%d 1\n", !Aig_ObjFaninC0(pObj), !Aig_ObjFaninC1(pObj) );
816  }
817  // write POs
818  Aig_ManForEachCo( p, pObj, i )
819  {
820  fprintf( pFile, ".names" );
821  if ( vPiNames && Aig_ObjIsCi(Aig_ObjFanin0(pObj)) )
822  fprintf( pFile, " %s", (char*)Vec_PtrEntry(vPiNames, Aig_ObjCioId(Aig_ObjFanin0(pObj))) );
823  else
824  fprintf( pFile, " n%0*d", nDigits, Aig_ObjFanin0(pObj)->iData );
825  if ( vPoNames )
826  fprintf( pFile, " %s\n", (char*)Vec_PtrEntry(vPoNames, Aig_ObjCioId(pObj)) );
827  else
828  fprintf( pFile, " n%0*d\n", nDigits, pObj->iData );
829  fprintf( pFile, "%d 1\n", !Aig_ObjFaninC0(pObj) );
830  }
831  Aig_ManCleanCioIds( p );
832  fprintf( pFile, ".end\n\n" );
833  fclose( pFile );
834  Vec_PtrFree( vNodes );
835 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Aig_ManSetCioIds(Aig_Man_t *p)
Definition: aigUtil.c:965
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
#define Aig_ManForEachLiLoSeq(p, pObjLi, pObjLo, k)
Definition: aig.h:450
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
static int Abc_Base10Log(unsigned n)
Definition: abc_global.h:252
if(last==0)
Definition: sparse_int.h:34
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
else
Definition: sparse_int.h:55
Vec_Ptr_t * Aig_ManDfs(Aig_Man_t *p, int fNodesOnly)
Definition: aigDfs.c:145
Definition: aig.h:69
static int Counter
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
int iData
Definition: aig.h:88
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
#define Aig_ManForEachPoSeq(p, pObj, i)
Definition: aig.h:444
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
#define Aig_ManForEachPiSeq(p, pObj, i)
SEQUENTIAL ITERATORS ///.
Definition: aig.h:438
void Aig_ManCleanCioIds(Aig_Man_t *p)
Definition: aigUtil.c:986
static int Aig_ObjCioId(Aig_Obj_t *pObj)
Definition: aig.h:285
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Aig_ManDumpVerilog ( Aig_Man_t p,
char *  pFileName 
)

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

Synopsis [Writes the AIG into a Verilog file.]

Description []

SideEffects []

SeeAlso []

Definition at line 848 of file aigUtil.c.

849 {
850  FILE * pFile;
851  Vec_Ptr_t * vNodes;
852  Aig_Obj_t * pObj, * pObjLi, * pObjLo, * pConst1 = NULL;
853  int i, nDigits, Counter = 0;
854  if ( Aig_ManCoNum(p) == 0 )
855  {
856  printf( "Aig_ManDumpBlif(): AIG manager does not have POs.\n" );
857  return;
858  }
859  // check if constant is used
860  Aig_ManForEachCo( p, pObj, i )
861  if ( Aig_ObjIsConst1(Aig_ObjFanin0(pObj)) )
862  pConst1 = Aig_ManConst1(p);
863  // collect nodes in the DFS order
864  vNodes = Aig_ManDfs( p, 1 );
865  // assign IDs to objects
866  Aig_ManConst1(p)->iData = Counter++;
867  Aig_ManForEachCi( p, pObj, i )
868  pObj->iData = Counter++;
869  Aig_ManForEachCo( p, pObj, i )
870  pObj->iData = Counter++;
871  Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
872  pObj->iData = Counter++;
873  nDigits = Abc_Base10Log( Counter );
874  // write the file
875  pFile = fopen( pFileName, "w" );
876  fprintf( pFile, "// Verilog file written by procedure Aig_ManDumpVerilog()\n" );
877 // fprintf( pFile, "// http://www.eecs.berkeley.edu/~alanmi/abc/\n" );
878  if ( Aig_ManRegNum(p) )
879  fprintf( pFile, "module %s ( clock", p->pName? p->pName: "test" );
880  else
881  fprintf( pFile, "module %s (", p->pName? p->pName: "test" );
882  Aig_ManForEachPiSeq( p, pObj, i )
883  fprintf( pFile, "%s n%0*d", ((Aig_ManRegNum(p) || i)? ",":""), nDigits, pObj->iData );
884  Aig_ManForEachPoSeq( p, pObj, i )
885  fprintf( pFile, ", n%0*d", nDigits, pObj->iData );
886  fprintf( pFile, " );\n" );
887 
888  // write PIs
889  if ( Aig_ManRegNum(p) )
890  fprintf( pFile, "input clock;\n" );
891  Aig_ManForEachPiSeq( p, pObj, i )
892  fprintf( pFile, "input n%0*d;\n", nDigits, pObj->iData );
893  // write POs
894  Aig_ManForEachPoSeq( p, pObj, i )
895  fprintf( pFile, "output n%0*d;\n", nDigits, pObj->iData );
896  // write latches
897  if ( Aig_ManRegNum(p) )
898  {
899  Aig_ManForEachLiLoSeq( p, pObjLi, pObjLo, i )
900  fprintf( pFile, "reg n%0*d;\n", nDigits, pObjLo->iData );
901  Aig_ManForEachLiLoSeq( p, pObjLi, pObjLo, i )
902  fprintf( pFile, "wire n%0*d;\n", nDigits, pObjLi->iData );
903  }
904  // write nodes
905  Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
906  fprintf( pFile, "wire n%0*d;\n", nDigits, pObj->iData );
907  if ( pConst1 )
908  fprintf( pFile, "wire n%0*d;\n", nDigits, pConst1->iData );
909  // write nodes
910  if ( pConst1 )
911  fprintf( pFile, "assign n%0*d = 1\'b1;\n", nDigits, pConst1->iData );
912  Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
913  {
914  fprintf( pFile, "assign n%0*d = %sn%0*d & %sn%0*d;\n",
915  nDigits, pObj->iData,
916  !Aig_ObjFaninC0(pObj) ? " " : "~", nDigits, Aig_ObjFanin0(pObj)->iData,
917  !Aig_ObjFaninC1(pObj) ? " " : "~", nDigits, Aig_ObjFanin1(pObj)->iData
918  );
919  }
920  // write POs
921  Aig_ManForEachPoSeq( p, pObj, i )
922  {
923  fprintf( pFile, "assign n%0*d = %sn%0*d;\n",
924  nDigits, pObj->iData,
925  !Aig_ObjFaninC0(pObj) ? " " : "~", nDigits, Aig_ObjFanin0(pObj)->iData );
926  }
927  if ( Aig_ManRegNum(p) )
928  {
929  Aig_ManForEachLiLoSeq( p, pObjLi, pObjLo, i )
930  {
931  fprintf( pFile, "assign n%0*d = %sn%0*d;\n",
932  nDigits, pObjLi->iData,
933  !Aig_ObjFaninC0(pObjLi) ? " " : "~", nDigits, Aig_ObjFanin0(pObjLi)->iData );
934  }
935  }
936 
937  // write initial state
938  if ( Aig_ManRegNum(p) )
939  {
940  Aig_ManForEachLiLoSeq( p, pObjLi, pObjLo, i )
941  fprintf( pFile, "always @ (posedge clock) begin n%0*d <= n%0*d; end\n",
942  nDigits, pObjLo->iData,
943  nDigits, pObjLi->iData );
944  Aig_ManForEachLiLoSeq( p, pObjLi, pObjLo, i )
945  fprintf( pFile, "initial begin n%0*d <= 1\'b0; end\n",
946  nDigits, pObjLo->iData );
947  }
948 
949  fprintf( pFile, "endmodule\n\n" );
950  fclose( pFile );
951  Vec_PtrFree( vNodes );
952 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define b1
Definition: extraBdd.h:76
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
#define Aig_ManForEachLiLoSeq(p, pObjLi, pObjLo, k)
Definition: aig.h:450
static int Abc_Base10Log(unsigned n)
Definition: abc_global.h:252
if(last==0)
Definition: sparse_int.h:34
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
else
Definition: sparse_int.h:55
Vec_Ptr_t * Aig_ManDfs(Aig_Man_t *p, int fNodesOnly)
Definition: aigDfs.c:145
Definition: aig.h:69
static int Counter
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#define b0
Definition: extraBdd.h:75
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
#define Aig_ManForEachPoSeq(p, pObj, i)
Definition: aig.h:444
#define Aig_ManForEachPiSeq(p, pObj, i)
SEQUENTIAL ITERATORS ///.
Definition: aig.h:438
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Aig_Man_t* Aig_ManDupArray ( Vec_Ptr_t vArray)

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

Synopsis [Duplicates AIG with only one primary output.]

Description []

SideEffects []

SeeAlso []

Definition at line 1255 of file aigDup.c.

1256 {
1257  Aig_Man_t * p, * pNew;
1258  Aig_Obj_t * pObj;
1259  int i, k;
1260  if ( Vec_PtrSize(vArray) == 0 )
1261  return NULL;
1262  p = (Aig_Man_t *)Vec_PtrEntry( vArray, 0 );
1263  Vec_PtrForEachEntry( Aig_Man_t *, vArray, pNew, k )
1264  {
1265  assert( Aig_ManRegNum(pNew) == 0 );
1266  assert( Aig_ManCiNum(pNew) == Aig_ManCiNum(p) );
1267  }
1268  // create the new manager
1269  pNew = Aig_ManStart( 10000 );
1270  pNew->pName = Abc_UtilStrsav( p->pName );
1271  Aig_ManForEachCi( p, pObj, i )
1272  Aig_ObjCreateCi(pNew);
1273  // create the PIs
1274  Vec_PtrForEachEntry( Aig_Man_t *, vArray, p, k )
1275  {
1276  Aig_ManConst1(p)->pData = Aig_ManConst1(pNew);
1277  Aig_ManForEachCi( p, pObj, i )
1278  pObj->pData = Aig_ManCi( pNew, i );
1279  Aig_ManForEachNode( p, pObj, i )
1280  pObj->pData = Aig_And( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
1281  Aig_ManForEachCo( p, pObj, i )
1282  Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
1283  }
1284  Aig_ManSetRegNum( pNew, Aig_ManRegNum(p) );
1285  // check the resulting network
1286  if ( !Aig_ManCheck(pNew) )
1287  printf( "Aig_ManDupSimple(): The check has failed.\n" );
1288  return pNew;
1289 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void * pData
Definition: aig.h:87
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static void check(int expr)
Definition: satSolver.c:46
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
static Aig_Obj_t * Aig_ManCi(Aig_Man_t *p, int i)
Definition: aig.h:266
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
if(last==0)
Definition: sparse_int.h:34
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
ABC_NAMESPACE_IMPL_START Aig_Man_t * Aig_ManDupSimple(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigDup.c:46
Definition: aig.h:69
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
Aig_Man_t* Aig_ManDupCof ( Aig_Man_t p,
int  iInput,
int  Value 
)

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

Synopsis [Duplicates the AIG manager.]

Description [Orders nodes as follows: PIs, ANDs, POs.]

SideEffects []

SeeAlso []

Definition at line 345 of file aigDup.c.

346 {
347  Aig_Man_t * pNew;
348  Aig_Obj_t * pObj, * pObjNew;
349  int i;
350  assert( p->pManTime == NULL );
351  // create the new manager
352  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
353  pNew->pName = Abc_UtilStrsav( p->pName );
354  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
355  pNew->nAsserts = p->nAsserts;
356  pNew->nConstrs = p->nConstrs;
357  pNew->nBarBufs = p->nBarBufs;
358  if ( p->vFlopNums )
359  pNew->vFlopNums = Vec_IntDup( p->vFlopNums );
360  // create the PIs
361  Aig_ManCleanData( p );
363  Aig_ManForEachCi( p, pObj, i )
364  {
365  if ( i == iInput )
366  pObjNew = Value ? Aig_ManConst1(pNew) : Aig_ManConst0(pNew);
367  else
368  {
369  pObjNew = Aig_ObjCreateCi( pNew );
370  pObjNew->Level = pObj->Level;
371  }
372  pObj->pData = pObjNew;
373  }
374  // duplicate internal nodes
375  Aig_ManForEachObj( p, pObj, i )
376  if ( Aig_ObjIsBuf(pObj) )
377  {
378  pObjNew = Aig_ObjChild0Copy(pObj);
379  pObj->pData = pObjNew;
380  }
381  else if ( Aig_ObjIsNode(pObj) )
382  {
383  pObjNew = Aig_And( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
384  pObj->pData = pObjNew;
385  }
386  // add the POs
387  Aig_ManForEachCo( p, pObj, i )
388  {
389  pObjNew = Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
390  pObj->pData = pObjNew;
391  }
392 // assert( Aig_ManBufNum(p) != 0 || Aig_ManNodeNum(p) == Aig_ManNodeNum(pNew) );
393  Aig_ManCleanup( pNew );
394  Aig_ManSetRegNum( pNew, Aig_ManRegNum(p) );
395  // check the resulting network
396  if ( !Aig_ManCheck(pNew) )
397  printf( "Aig_ManDupSimple(): The check has failed.\n" );
398  return pNew;
399 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
unsigned Level
Definition: aig.h:82
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void * pData
Definition: aig.h:87
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
static Aig_Obj_t * Aig_ManConst0(Aig_Man_t *p)
Definition: aig.h:263
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Aig_ObjIsBuf(Aig_Obj_t *pObj)
Definition: aig.h:277
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
if(last==0)
Definition: sparse_int.h:34
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
Definition: aig.h:69
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
#define assert(ex)
Definition: util_old.h:213
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
Aig_Man_t* Aig_ManDupDfs ( Aig_Man_t p)

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

Synopsis [Duplicates the AIG manager.]

Description [This duplicator works for AIGs with choices.]

SideEffects []

SeeAlso []

Definition at line 563 of file aigDup.c.

564 {
565  Aig_Man_t * pNew;
566  Aig_Obj_t * pObj, * pObjNew;
567  int i, nNodes;
568  // create the new manager
569  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
570  pNew->pName = Abc_UtilStrsav( p->pName );
571  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
572  pNew->nAsserts = p->nAsserts;
573  pNew->nConstrs = p->nConstrs;
574  pNew->nBarBufs = p->nBarBufs;
575  if ( p->vFlopNums )
576  pNew->vFlopNums = Vec_IntDup( p->vFlopNums );
577  // duplicate representation of choice nodes
578  if ( p->pEquivs )
579  pNew->pEquivs = ABC_CALLOC( Aig_Obj_t *, Aig_ManObjNumMax(p) );
580  if ( p->pReprs )
581  pNew->pReprs = ABC_CALLOC( Aig_Obj_t *, Aig_ManObjNumMax(p) );
582  // create the PIs
583  Aig_ManCleanData( p );
584  // duplicate internal nodes
586  Aig_ManForEachObj( p, pObj, i )
587  {
588  if ( Aig_ObjIsCi(pObj) )
589  {
590  pObjNew = Aig_ObjCreateCi( pNew );
591  pObjNew->Level = pObj->Level;
592  pObj->pData = pObjNew;
593  }
594  else if ( Aig_ObjIsCo(pObj) )
595  {
596  Aig_ManDupDfs_rec( pNew, p, Aig_ObjFanin0(pObj) );
597 // assert( pObj->Level == ((Aig_Obj_t*)pObj->pData)->Level );
598  pObjNew = Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
599  pObj->pData = pObjNew;
600  }
601  }
602  assert( p->pEquivs != NULL || Aig_ManBufNum(p) != 0 || Aig_ManNodeNum(p) == Aig_ManNodeNum(pNew) );
603  if ( p->pEquivs == NULL && p->pReprs == NULL && (nNodes = Aig_ManCleanup( pNew )) )
604  printf( "Aig_ManDupDfs(): Cleanup after AIG duplication removed %d nodes.\n", nNodes );
605  Aig_ManSetRegNum( pNew, Aig_ManRegNum(p) );
606  // duplicate the timing manager
607  if ( p->pManTime )
608  pNew->pManTime = Tim_ManDup( (Tim_Man_t *)p->pManTime, 0 );
609  // check the resulting network
610  if ( !Aig_ManCheck(pNew) )
611  printf( "Aig_ManDupDfs(): The check has failed.\n" );
612  return pNew;
613 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
unsigned Level
Definition: aig.h:82
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void * pData
Definition: aig.h:87
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
static int Aig_ManBufNum(Aig_Man_t *p)
Definition: aig.h:253
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
Tim_Man_t * Tim_ManDup(Tim_Man_t *p, int fUnitDelay)
Definition: timMan.c:86
Definition: aig.h:69
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
Aig_Obj_t * Aig_ManDupDfs_rec(Aig_Man_t *pNew, Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigDup.c:529
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
Aig_Man_t* Aig_ManDupDfsGuided ( Aig_Man_t p,
Vec_Ptr_t vPios 
)

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

Synopsis [Duplicates the AIG manager.]

Description [This duplicator works for AIGs with choices.]

SideEffects []

SeeAlso []

Definition at line 694 of file aigDup.c.

695 {
696  Aig_Man_t * pNew;
697  Aig_Obj_t * pObj, * pObjNew;
698  int i, nNodes;
699  // create the new manager
700  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
701  pNew->pName = Abc_UtilStrsav( p->pName );
702  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
703  pNew->nAsserts = p->nAsserts;
704  pNew->nConstrs = p->nConstrs;
705  pNew->nBarBufs = p->nBarBufs;
706  if ( p->vFlopNums )
707  pNew->vFlopNums = Vec_IntDup( p->vFlopNums );
708  // duplicate representation of choice nodes
709  if ( p->pEquivs )
710  {
711  pNew->pEquivs = ABC_ALLOC( Aig_Obj_t *, Aig_ManObjNumMax(p) );
712  memset( pNew->pEquivs, 0, sizeof(Aig_Obj_t *) * Aig_ManObjNumMax(p) );
713  }
714  if ( p->pReprs )
715  {
716  pNew->pReprs = ABC_ALLOC( Aig_Obj_t *, Aig_ManObjNumMax(p) );
717  memset( pNew->pReprs, 0, sizeof(Aig_Obj_t *) * Aig_ManObjNumMax(p) );
718  }
719  // create the PIs
720  Aig_ManCleanData( p );
721  // duplicate internal nodes
723  Vec_PtrForEachEntry( Aig_Obj_t *, vPios, pObj, i )
724  {
725  if ( Aig_ObjIsCi(pObj) )
726  {
727  pObjNew = Aig_ObjCreateCi( pNew );
728  pObjNew->Level = pObj->Level;
729  pObj->pData = pObjNew;
730  }
731  else if ( Aig_ObjIsCo(pObj) )
732  {
733  Aig_ManDupDfsGuided_rec( pNew, p, Aig_ObjFanin0(pObj) );
734 // assert( pObj->Level == ((Aig_Obj_t*)pObj->pData)->Level );
735  pObjNew = Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
736  pObj->pData = pObjNew;
737  }
738  }
739 // assert( Aig_ManBufNum(p) != 0 || Aig_ManNodeNum(p) == Aig_ManNodeNum(pNew) );
740  if ( p->pEquivs == NULL && p->pReprs == NULL && (nNodes = Aig_ManCleanup( pNew )) )
741  printf( "Aig_ManDupDfs(): Cleanup after AIG duplication removed %d nodes.\n", nNodes );
742  Aig_ManSetRegNum( pNew, Aig_ManRegNum(p) );
743  // duplicate the timing manager
744  if ( p->pManTime )
745  pNew->pManTime = Tim_ManDup( (Tim_Man_t *)p->pManTime, 0 );
746  // check the resulting network
747  if ( !Aig_ManCheck(pNew) )
748  printf( "Aig_ManDupDfs(): The check has failed.\n" );
749  return pNew;
750 }
char * memset()
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
unsigned Level
Definition: aig.h:82
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void * pData
Definition: aig.h:87
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
Tim_Man_t * Tim_ManDup(Tim_Man_t *p, int fUnitDelay)
Definition: timMan.c:86
Definition: aig.h:69
Aig_Obj_t * Aig_ManDupDfsGuided_rec(Aig_Man_t *pNew, Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigDup.c:657
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
Aig_Man_t* Aig_ManDupExor ( Aig_Man_t p)

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

Synopsis [Duplicates the AIG manager to have EXOR gates.]

Description [Assumes topological ordering of the nodes.]

SideEffects []

SeeAlso []

Definition at line 462 of file aigDup.c.

463 {
464  Aig_Man_t * pNew;
465  Aig_Obj_t * pObj, * pObjNew;
466  int i;
467  // create the new manager
468  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
469  pNew->fCatchExor = 1;
470  pNew->pName = Abc_UtilStrsav( p->pName );
471  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
472  pNew->nAsserts = p->nAsserts;
473  pNew->nConstrs = p->nConstrs;
474  pNew->nBarBufs = p->nBarBufs;
475  if ( p->vFlopNums )
476  pNew->vFlopNums = Vec_IntDup( p->vFlopNums );
477  // create the PIs
478  Aig_ManCleanData( p );
479  // duplicate internal nodes
480  Aig_ManForEachObj( p, pObj, i )
481  {
482  if ( Aig_ObjIsBuf(pObj) )
483  {
484  pObjNew = Aig_ObjChild0Copy(pObj);
485  }
486  else if ( Aig_ObjIsNode(pObj) )
487  {
488  pObjNew = Aig_Oper( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj), Aig_ObjType(pObj) );
489  }
490  else if ( Aig_ObjIsCi(pObj) )
491  {
492  pObjNew = Aig_ObjCreateCi( pNew );
493  pObjNew->Level = pObj->Level;
494  }
495  else if ( Aig_ObjIsCo(pObj) )
496  {
497  pObjNew = Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
498  }
499  else if ( Aig_ObjIsConst1(pObj) )
500  {
501  pObjNew = Aig_ManConst1(pNew);
502  }
503  else
504  assert( 0 );
505  pObj->pData = pObjNew;
506  }
507  Aig_ManCleanup( pNew );
508  Aig_ManSetRegNum( pNew, Aig_ManRegNum(p) );
509  // duplicate the timing manager
510  if ( p->pManTime )
511  pNew->pManTime = Tim_ManDup( (Tim_Man_t *)p->pManTime, 0 );
512  // check the resulting network
513  if ( !Aig_ManCheck(pNew) )
514  printf( "Aig_ManDupExor(): The check has failed.\n" );
515  return pNew;
516 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
unsigned Level
Definition: aig.h:82
static Aig_Type_t Aig_ObjType(Aig_Obj_t *pObj)
Definition: aig.h:272
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void * pData
Definition: aig.h:87
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
Aig_Obj_t * Aig_Oper(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1, Aig_Type_t Type)
Definition: aigOper.c:83
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Aig_ObjIsBuf(Aig_Obj_t *pObj)
Definition: aig.h:277
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
Tim_Man_t * Tim_ManDup(Tim_Man_t *p, int fUnitDelay)
Definition: timMan.c:86
Definition: aig.h:69
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
Aig_Man_t* Aig_ManDupFlopsOnly ( Aig_Man_t p)

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

Synopsis [Duplicates the AIG manager.]

Description [Assumes topological ordering of nodes.]

SideEffects []

SeeAlso []

Definition at line 871 of file aigDup.c.

872 {
873  Aig_Man_t * pNew;
874  Aig_Obj_t * pObj;
875  int i;
876  pNew = Aig_ManDupWithoutPos( p );
877  Saig_ManForEachLi( p, pObj, i )
878  pObj->pData = Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
879  Aig_ManCleanup( pNew );
880  Aig_ManSetRegNum( pNew, Aig_ManRegNum(p) );
881  if ( !Aig_ManCheck(pNew) )
882  printf( "Aig_ManDupFlopsOnly(): The check has failed.\n" );
883  return pNew;
884 
885 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void check(int expr)
Definition: satSolver.c:46
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
#define Saig_ManForEachLi(p, pObj, i)
Definition: saig.h:98
Aig_Man_t * Aig_ManDupWithoutPos(Aig_Man_t *p)
Definition: aigDup.c:835
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
Aig_Man_t * Aig_ManDupFlopsOnly(Aig_Man_t *p)
Definition: aigDup.c:871
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
Aig_Man_t* Aig_ManDupLevelized ( Aig_Man_t p)

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

Synopsis [Duplicates the AIG manager.]

Description [This duplicator works for AIGs with choices.]

SideEffects []

SeeAlso []

Definition at line 763 of file aigDup.c.

764 {
765  Vec_Vec_t * vLevels;
766  Aig_Man_t * pNew;
767  Aig_Obj_t * pObj, * pObjNew;
768  int i, k;
769  // create the new manager
770  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
771  pNew->pName = Abc_UtilStrsav( p->pName );
772  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
773  pNew->nAsserts = p->nAsserts;
774  pNew->nConstrs = p->nConstrs;
775  pNew->nBarBufs = p->nBarBufs;
776  if ( p->vFlopNums )
777  pNew->vFlopNums = Vec_IntDup( p->vFlopNums );
778  // duplicate representation of choice nodes
779  if ( p->pEquivs )
780  {
781  pNew->pEquivs = ABC_ALLOC( Aig_Obj_t *, Aig_ManObjNumMax(p) );
782  memset( pNew->pEquivs, 0, sizeof(Aig_Obj_t *) * Aig_ManObjNumMax(p) );
783  }
784  if ( p->pReprs )
785  {
786  pNew->pReprs = ABC_ALLOC( Aig_Obj_t *, Aig_ManObjNumMax(p) );
787  memset( pNew->pReprs, 0, sizeof(Aig_Obj_t *) * Aig_ManObjNumMax(p) );
788  }
789  // create the PIs
791  Aig_ManForEachCi( p, pObj, i )
792  {
793  pObjNew = Aig_ObjCreateCi( pNew );
794  pObjNew->Level = pObj->Level;
795  pObj->pData = pObjNew;
796  }
797  // duplicate internal nodes
798  vLevels = Aig_ManLevelize( p );
799  Vec_VecForEachEntry( Aig_Obj_t *, vLevels, pObj, i, k )
800  {
801  pObjNew = Aig_Oper( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj), Aig_ObjType(pObj) );
802  pObj->pData = pObjNew;
803  }
804  Vec_VecFree( vLevels );
805  // duplicate POs
806  Aig_ManForEachCo( p, pObj, i )
807  {
808  pObjNew = Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
809  pObj->pData = pObjNew;
810  }
811  assert( Aig_ManBufNum(p) != 0 || Aig_ManNodeNum(p) == Aig_ManNodeNum(pNew) );
812 // if ( (nNodes = Aig_ManCleanup( pNew )) )
813 // printf( "Aig_ManDupLevelized(): Cleanup after AIG duplication removed %d nodes.\n", nNodes );
814  Aig_ManSetRegNum( pNew, Aig_ManRegNum(p) );
815  // duplicate the timing manager
816  if ( p->pManTime )
817  pNew->pManTime = Tim_ManDup( (Tim_Man_t *)p->pManTime, 0 );
818  // check the resulting network
819  if ( !Aig_ManCheck(pNew) )
820  printf( "Aig_ManDupLevelized(): The check has failed.\n" );
821  return pNew;
822 }
char * memset()
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
unsigned Level
Definition: aig.h:82
static Aig_Type_t Aig_ObjType(Aig_Obj_t *pObj)
Definition: aig.h:272
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void * pData
Definition: aig.h:87
#define Vec_VecForEachEntry(Type, vGlob, pEntry, i, k)
Definition: vecVec.h:87
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static void Vec_VecFree(Vec_Vec_t *p)
Definition: vecVec.h:347
Aig_Obj_t * Aig_Oper(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1, Aig_Type_t Type)
Definition: aigOper.c:83
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
static int Aig_ManBufNum(Aig_Man_t *p)
Definition: aig.h:253
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
Vec_Vec_t * Aig_ManLevelize(Aig_Man_t *p)
Definition: aigDfs.c:307
Tim_Man_t * Tim_ManDup(Tim_Man_t *p, int fUnitDelay)
Definition: timMan.c:86
Definition: aig.h:69
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
Aig_Man_t* Aig_ManDupNodes ( Aig_Man_t pMan,
Vec_Ptr_t vArray 
)

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

Synopsis [Duplicates AIG with only one primary output.]

Description []

SideEffects []

SeeAlso []

Definition at line 1302 of file aigDup.c.

1303 {
1304  Aig_Man_t * pNew;
1305  Vec_Ptr_t * vObjs;
1306  Aig_Obj_t * pObj;
1307  int i;
1308  if ( Vec_PtrSize(vArray) == 0 )
1309  return NULL;
1310  vObjs = Aig_ManDfsNodes( pMan, (Aig_Obj_t **)Vec_PtrArray(vArray), Vec_PtrSize(vArray) );
1311  // create the new manager
1312  pNew = Aig_ManStart( 10000 );
1313  pNew->pName = Abc_UtilStrsav( pMan->pName );
1314  Aig_ManConst1(pMan)->pData = Aig_ManConst1(pNew);
1315  Vec_PtrForEachEntry( Aig_Obj_t *, vObjs, pObj, i )
1316  if ( Aig_ObjIsCi(pObj) )
1317  pObj->pData = Aig_ObjCreateCi(pNew);
1318  Vec_PtrForEachEntry( Aig_Obj_t *, vObjs, pObj, i )
1319  if ( Aig_ObjIsNode(pObj) )
1320  pObj->pData = Aig_And( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
1321  Vec_PtrForEachEntry( Aig_Obj_t *, vArray, pObj, i )
1322  Aig_ObjCreateCo( pNew, (Aig_Obj_t *)pObj->pData );
1323  Aig_ManSetRegNum( pNew, 0 );
1324  Vec_PtrFree( vObjs );
1325  return pNew;
1326 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
void * pData
Definition: aig.h:87
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
Vec_Ptr_t * Aig_ManDfsNodes(Aig_Man_t *p, Aig_Obj_t **ppNodes, int nNodes)
Definition: aigDfs.c:333
if(last==0)
Definition: sparse_int.h:34
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
Definition: aig.h:69
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static void ** Vec_PtrArray(Vec_Ptr_t *p)
Definition: vecPtr.h:279
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Aig_Man_t* Aig_ManDupOneOutput ( Aig_Man_t p,
int  iPoNum,
int  fAddRegs 
)

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

Synopsis [Duplicates AIG with only one primary output.]

Description []

SideEffects []

SeeAlso []

Definition at line 1152 of file aigDup.c.

1153 {
1154  Aig_Man_t * pNew;
1155  Aig_Obj_t * pObj;
1156  int i;
1157  assert( Aig_ManRegNum(p) > 0 );
1158  assert( iPoNum < Aig_ManCoNum(p)-Aig_ManRegNum(p) );
1159  // create the new manager
1160  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
1161  pNew->pName = Abc_UtilStrsav( p->pName );
1162  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1163  // create the PIs
1164  Aig_ManCleanData( p );
1165  Aig_ManConst1(p)->pData = Aig_ManConst1(pNew);
1166  Aig_ManForEachCi( p, pObj, i )
1167  pObj->pData = Aig_ObjCreateCi( pNew );
1168  // set registers
1169  pNew->nRegs = fAddRegs? p->nRegs : 0;
1170  pNew->nTruePis = fAddRegs? p->nTruePis : p->nTruePis + p->nRegs;
1171  pNew->nTruePos = 1;
1172  // duplicate internal nodes
1173  Aig_ManForEachNode( p, pObj, i )
1174  pObj->pData = Aig_And( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
1175  // create the PO
1176  pObj = Aig_ManCo( p, iPoNum );
1177  Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
1178  // create register inputs with MUXes
1179  if ( fAddRegs )
1180  {
1181  Aig_ManForEachLiSeq( p, pObj, i )
1182  Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
1183  }
1184  Aig_ManCleanup( pNew );
1185  return pNew;
1186 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void * pData
Definition: aig.h:87
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
if(last==0)
Definition: sparse_int.h:34
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
Definition: aig.h:69
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
Definition: aig.h:267
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#define assert(ex)
Definition: util_old.h:213
#define Aig_ManForEachLiSeq(p, pObj, i)
Definition: aig.h:447
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
Aig_Man_t* Aig_ManDupOrdered ( Aig_Man_t p)

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

Synopsis [Duplicates the AIG manager.]

Description [Assumes topological ordering of the nodes.]

SideEffects []

SeeAlso []

Definition at line 277 of file aigDup.c.

278 {
279  Aig_Man_t * pNew;
280  Aig_Obj_t * pObj, * pObjNew;
281  int i, nNodes;
282  // create the new manager
283  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
284  pNew->pName = Abc_UtilStrsav( p->pName );
285  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
286  pNew->nAsserts = p->nAsserts;
287  pNew->nConstrs = p->nConstrs;
288  pNew->nBarBufs = p->nBarBufs;
289  if ( p->vFlopNums )
290  pNew->vFlopNums = Vec_IntDup( p->vFlopNums );
291  // create the PIs
292  Aig_ManCleanData( p );
293  // duplicate internal nodes
294  Aig_ManForEachObj( p, pObj, i )
295  {
296  if ( Aig_ObjIsBuf(pObj) )
297  {
298  pObjNew = Aig_ObjChild0Copy(pObj);
299  }
300  else if ( Aig_ObjIsNode(pObj) )
301  {
302  pObjNew = Aig_Oper( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj), Aig_ObjType(pObj) );
303  }
304  else if ( Aig_ObjIsCi(pObj) )
305  {
306  pObjNew = Aig_ObjCreateCi( pNew );
307  pObjNew->Level = pObj->Level;
308  }
309  else if ( Aig_ObjIsCo(pObj) )
310  {
311  pObjNew = Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
312  }
313  else if ( Aig_ObjIsConst1(pObj) )
314  {
315  pObjNew = Aig_ManConst1(pNew);
316  }
317  else
318  assert( 0 );
319  pObj->pData = pObjNew;
320  }
321  assert( Aig_ManBufNum(p) != 0 || Aig_ManNodeNum(p) == Aig_ManNodeNum(pNew) );
322  if ( (nNodes = Aig_ManCleanup( pNew )) )
323  printf( "Aig_ManDupOrdered(): Cleanup after AIG duplication removed %d nodes.\n", nNodes );
324  Aig_ManSetRegNum( pNew, Aig_ManRegNum(p) );
325  // duplicate the timing manager
326  if ( p->pManTime )
327  pNew->pManTime = Tim_ManDup( (Tim_Man_t *)p->pManTime, 0 );
328  // check the resulting network
329  if ( !Aig_ManCheck(pNew) )
330  printf( "Aig_ManDupOrdered(): The check has failed.\n" );
331  return pNew;
332 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
unsigned Level
Definition: aig.h:82
static Aig_Type_t Aig_ObjType(Aig_Obj_t *pObj)
Definition: aig.h:272
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void * pData
Definition: aig.h:87
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
Aig_Obj_t * Aig_Oper(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1, Aig_Type_t Type)
Definition: aigOper.c:83
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
static int Aig_ManBufNum(Aig_Man_t *p)
Definition: aig.h:253
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Aig_ObjIsBuf(Aig_Obj_t *pObj)
Definition: aig.h:277
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
Tim_Man_t * Tim_ManDup(Tim_Man_t *p, int fUnitDelay)
Definition: timMan.c:86
Definition: aig.h:69
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
Aig_Man_t* Aig_ManDupOrpos ( Aig_Man_t p,
int  fAddRegs 
)

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

Synopsis [Duplicates AIG with only one primary output.]

Description []

SideEffects []

SeeAlso []

Definition at line 1099 of file aigDup.c.

1100 {
1101  Aig_Man_t * pNew;
1102  Aig_Obj_t * pObj, * pMiter;
1103  int i;
1104  assert( Aig_ManRegNum(p) > 0 );
1105  if ( p->nConstrs > 0 )
1106  {
1107  printf( "The AIG manager should have no constraints.\n" );
1108  return NULL;
1109  }
1110  // create the new manager
1111  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
1112  pNew->pName = Abc_UtilStrsav( p->pName );
1113  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1114  // create the PIs
1115  Aig_ManCleanData( p );
1116  Aig_ManConst1(p)->pData = Aig_ManConst1(pNew);
1117  Aig_ManForEachCi( p, pObj, i )
1118  pObj->pData = Aig_ObjCreateCi( pNew );
1119  // set registers
1120  pNew->nRegs = fAddRegs? p->nRegs : 0;
1121  pNew->nTruePis = fAddRegs? p->nTruePis : p->nTruePis + p->nRegs;
1122  pNew->nTruePos = 1;
1123  // duplicate internal nodes
1124  Aig_ManForEachNode( p, pObj, i )
1125  pObj->pData = Aig_And( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
1126  // create the PO
1127  pMiter = Aig_ManConst0(pNew);
1128  Aig_ManForEachPoSeq( p, pObj, i )
1129  pMiter = Aig_Or( pNew, pMiter, Aig_ObjChild0Copy(pObj) );
1130  Aig_ObjCreateCo( pNew, pMiter );
1131  // create register inputs with MUXes
1132  if ( fAddRegs )
1133  {
1134  Aig_ManForEachLiSeq( p, pObj, i )
1135  Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
1136  }
1137  Aig_ManCleanup( pNew );
1138  return pNew;
1139 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void * pData
Definition: aig.h:87
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
static Aig_Obj_t * Aig_ManConst0(Aig_Man_t *p)
Definition: aig.h:263
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
if(last==0)
Definition: sparse_int.h:34
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
Aig_Obj_t * Aig_Or(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:259
Definition: aig.h:69
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#define assert(ex)
Definition: util_old.h:213
#define Aig_ManForEachLiSeq(p, pObj, i)
Definition: aig.h:447
#define Aig_ManForEachPoSeq(p, pObj, i)
Definition: aig.h:444
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
Aig_Man_t* Aig_ManDupRepr ( Aig_Man_t p,
int  fOrdered 
)

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

Synopsis [Duplicates AIG while substituting representatives.]

Description []

SideEffects []

SeeAlso []

Definition at line 267 of file aigRepr.c.

268 {
269  Aig_Man_t * pNew;
270  Aig_Obj_t * pObj;
271  int i;
272  // start the HOP package
273  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
274  pNew->pName = Abc_UtilStrsav( p->pName );
275  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
276  pNew->nConstrs = p->nConstrs;
277  pNew->nBarBufs = p->nBarBufs;
278  if ( p->vFlopNums )
279  pNew->vFlopNums = Vec_IntDup( p->vFlopNums );
280  // map the const and primary inputs
281  Aig_ManCleanData( p );
283  Aig_ManForEachCi( p, pObj, i )
284  pObj->pData = Aig_ObjCreateCi(pNew);
285 // Aig_ManForEachCi( p, pObj, i )
286 // pObj->pData = Aig_ObjGetRepr( p, pObj );
287  // map the internal nodes
288  if ( fOrdered )
289  {
290  Aig_ManForEachNode( p, pObj, i )
291  pObj->pData = Aig_And( pNew, Aig_ObjChild0Repr(p, pObj), Aig_ObjChild1Repr(p, pObj) );
292  }
293  else
294  {
295 // Aig_ManForEachObj( p, pObj, i )
296 // if ( p->pReprs[i] )
297 // printf( "Substituting %d for %d.\n", p->pReprs[i]->Id, pObj->Id );
298 
299  Aig_ManForEachCo( p, pObj, i )
300  Aig_ManDupRepr_rec( pNew, p, Aig_ObjFanin0(pObj) );
301  }
302  // transfer the POs
303  Aig_ManForEachCo( p, pObj, i )
304  Aig_ObjCreateCo( pNew, Aig_ObjChild0Repr(p, pObj) );
305  Aig_ManSetRegNum( pNew, Aig_ManRegNum(p) );
306  // check the new manager
307  if ( !Aig_ManCheck(pNew) )
308  printf( "Aig_ManDupRepr: Check has failed.\n" );
309  return pNew;
310 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void * pData
Definition: aig.h:87
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
Definition: aig.h:69
Aig_Man_t * Aig_ManDupRepr(Aig_Man_t *p, int fOrdered)
Definition: aigRepr.c:267
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
Aig_Obj_t * Aig_ManDupRepr_rec(Aig_Man_t *pNew, Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigRepr.c:241
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static Aig_Obj_t * Aig_ObjChild1Repr(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigRepr.c:198
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
static Aig_Obj_t * Aig_ObjChild0Repr(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigRepr.c:197
Aig_Man_t* Aig_ManDupReprBasic ( Aig_Man_t p)

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

Synopsis [Duplicates AIG with representatives without removing registers.]

Description []

SideEffects []

SeeAlso []

Definition at line 323 of file aigRepr.c.

324 {
325  Aig_Man_t * pNew;
326  Aig_Obj_t * pObj;
327  int i;
328  assert( p->pReprs != NULL );
329  // reconstruct AIG with representatives
330  pNew = Aig_ManDupRepr( p, 0 );
331  // perfrom sequential cleanup but do not remove registers
332  Aig_ManSeqCleanupBasic( pNew );
333  // remove pointers to the dead nodes
334  Aig_ManForEachObj( p, pObj, i )
335  if ( pObj->pData && Aig_ObjIsNone((Aig_Obj_t *)pObj->pData) )
336  pObj->pData = NULL;
337  return pNew;
338 }
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Aig_ManSeqCleanupBasic(Aig_Man_t *p)
Definition: aigScl.c:257
static int Aig_ObjIsNone(Aig_Obj_t *pObj)
Definition: aig.h:273
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
Aig_Man_t * Aig_ManDupRepr(Aig_Man_t *p, int fOrdered)
Definition: aigRepr.c:267
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
#define assert(ex)
Definition: util_old.h:213
Aig_Man_t* Aig_ManDupRepres ( Aig_Man_t p)

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

Synopsis [Duplicates AIG while substituting representatives.]

Description []

SideEffects []

SeeAlso []

Definition at line 920 of file aigDup.c.

921 {
922  Aig_Man_t * pNew;
923  Aig_Obj_t * pObj;
924  int i;
925  // start the HOP package
926  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
927  pNew->pName = Abc_UtilStrsav( p->pName );
928  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
929  pNew->nConstrs = p->nConstrs;
930  pNew->nBarBufs = p->nBarBufs;
931  if ( p->vFlopNums )
932  pNew->vFlopNums = Vec_IntDup( p->vFlopNums );
933  // map the const and primary inputs
934  Aig_ManCleanData( p );
935  Aig_ManForEachObj( p, pObj, i )
936  {
937  if ( Aig_ObjIsNode(pObj) )
938  pObj->pData = Aig_And( pNew, Aig_ObjChild0Repres(p, pObj), Aig_ObjChild1Repres(p, pObj) );
939  else if ( Aig_ObjIsCi(pObj) )
940  {
941  pObj->pData = Aig_ObjCreateCi(pNew);
942  pObj->pData = Aig_ObjGetRepres( p, pObj );
943  }
944  else if ( Aig_ObjIsCo(pObj) )
945  pObj->pData = Aig_ObjCreateCo( pNew, Aig_ObjChild0Repres(p, pObj) );
946  else if ( Aig_ObjIsConst1(pObj) )
947  pObj->pData = Aig_ManConst1(pNew);
948  else
949  assert( 0 );
950  }
951  Aig_ManSetRegNum( pNew, Aig_ManRegNum(p) );
952  // check the new manager
953  if ( !Aig_ManCheck(pNew) )
954  printf( "Aig_ManDupRepres: Check has failed.\n" );
955  return pNew;
956 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void * pData
Definition: aig.h:87
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
Definition: aig.h:69
static Aig_Obj_t * Aig_ObjChild0Repres(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigDup.c:906
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static Aig_Obj_t * Aig_ObjGetRepres(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigDup.c:899
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
static Aig_Obj_t * Aig_ObjChild1Repres(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigDup.c:907
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
Aig_Man_t* Aig_ManDupRepresDfs ( Aig_Man_t p)

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

Synopsis [Duplicates AIG while substituting representatives.]

Description []

SideEffects []

SeeAlso []

Definition at line 995 of file aigDup.c.

996 {
997  Aig_Man_t * pNew;
998  Aig_Obj_t * pObj;
999  int i;
1000  // start the HOP package
1001  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
1002  pNew->pName = Abc_UtilStrsav( p->pName );
1003  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1004  pNew->nConstrs = p->nConstrs;
1005  pNew->nBarBufs = p->nBarBufs;
1006  if ( p->vFlopNums )
1007  pNew->vFlopNums = Vec_IntDup( p->vFlopNums );
1008  // map the const and primary inputs
1009  Aig_ManCleanData( p );
1010  Aig_ManForEachObj( p, pObj, i )
1011  {
1012  if ( Aig_ObjIsNode(pObj) )
1013  continue;
1014  if ( Aig_ObjIsCi(pObj) )
1015  pObj->pData = Aig_ObjCreateCi(pNew);
1016  else if ( Aig_ObjIsCo(pObj) )
1017  {
1018  Aig_ManDupRepres_rec( pNew, p, Aig_ObjFanin0(pObj) );
1019  pObj->pData = Aig_ObjCreateCo( pNew, Aig_ObjChild0Repres(p, pObj) );
1020  }
1021  else if ( Aig_ObjIsConst1(pObj) )
1022  pObj->pData = Aig_ManConst1(pNew);
1023  else
1024  assert( 0 );
1025  }
1026  Aig_ManSetRegNum( pNew, Aig_ManRegNum(p) );
1027  // check the new manager
1028  if ( !Aig_ManCheck(pNew) )
1029  printf( "Aig_ManDupRepresDfs: Check has failed.\n" );
1030  return pNew;
1031 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
Aig_Obj_t * Aig_ManDupRepres_rec(Aig_Man_t *pNew, Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigDup.c:969
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void * pData
Definition: aig.h:87
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
Definition: aig.h:69
static Aig_Obj_t * Aig_ObjChild0Repres(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigDup.c:906
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
Aig_Man_t* Aig_ManDupSimple ( Aig_Man_t p)

DECLARATIONS ///.

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

FileName [aigDup.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [AIG package.]

Synopsis [AIG duplication (re-strashing).]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Duplicates the AIG manager.]

Description [Orders nodes as follows: PIs, ANDs, POs.]

SideEffects []

SeeAlso []

Definition at line 46 of file aigDup.c.

47 {
48  Aig_Man_t * pNew;
49  Aig_Obj_t * pObj, * pObjNew;
50  int i;
51  assert( p->pManTime == NULL );
52  // create the new manager
53  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
54  pNew->pName = Abc_UtilStrsav( p->pName );
55  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
56  pNew->nAsserts = p->nAsserts;
57  pNew->nConstrs = p->nConstrs;
58  pNew->nBarBufs = p->nBarBufs;
59  if ( p->vFlopNums )
60  pNew->vFlopNums = Vec_IntDup( p->vFlopNums );
61  // create the PIs
64  Aig_ManForEachCi( p, pObj, i )
65  {
66  pObjNew = Aig_ObjCreateCi( pNew );
67  pObjNew->Level = pObj->Level;
68  pObj->pData = pObjNew;
69  }
70  // duplicate internal nodes
71  Aig_ManForEachObj( p, pObj, i )
72  if ( Aig_ObjIsBuf(pObj) )
73  {
74  pObjNew = Aig_ObjChild0Copy(pObj);
75  pObj->pData = pObjNew;
76  }
77  else if ( Aig_ObjIsNode(pObj) )
78  {
79  pObjNew = Aig_And( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
80  pObj->pData = pObjNew;
81  }
82  // add the POs
83  Aig_ManForEachCo( p, pObj, i )
84  {
85  pObjNew = Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
86  pObj->pData = pObjNew;
87  }
88  assert( Aig_ManBufNum(p) != 0 || Aig_ManNodeNum(p) == Aig_ManNodeNum(pNew) );
90  // check the resulting network
91  if ( !Aig_ManCheck(pNew) )
92  printf( "Aig_ManDupSimple(): The check has failed.\n" );
93  return pNew;
94 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
unsigned Level
Definition: aig.h:82
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void * pData
Definition: aig.h:87
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static int Aig_ManBufNum(Aig_Man_t *p)
Definition: aig.h:253
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Aig_ObjIsBuf(Aig_Obj_t *pObj)
Definition: aig.h:277
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
if(last==0)
Definition: sparse_int.h:34
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
Definition: aig.h:69
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
#define assert(ex)
Definition: util_old.h:213
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
Aig_Man_t* Aig_ManDupSimpleDfs ( Aig_Man_t p)

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

Synopsis [Duplicates the AIG manager.]

Description [Orders nodes as follows: PIs, ANDs, POs.]

SideEffects [This procedure assumes that buffers are not used during HAIG recording. This way, each HAIG node is in one-to-one correspondence with old HAIG node. There is no need to create new nodes, just reassign the pointers. If it were not the case, we would need to create HAIG nodes for each new node duplicated. ]

SeeAlso []

Definition at line 184 of file aigDup.c.

185 {
186  Aig_Man_t * pNew;
187  Aig_Obj_t * pObj, * pObjNew;
188  int i;
189  assert( p->pManTime == NULL );
190  // create the new manager
191  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
192  pNew->pName = Abc_UtilStrsav( p->pName );
193  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
194  pNew->nAsserts = p->nAsserts;
195  pNew->nConstrs = p->nConstrs;
196  pNew->nBarBufs = p->nBarBufs;
197  if ( p->vFlopNums )
198  pNew->vFlopNums = Vec_IntDup( p->vFlopNums );
199  // create the PIs
200  Aig_ManCleanData( p );
202  Aig_ManForEachCi( p, pObj, i )
203  {
204  pObjNew = Aig_ObjCreateCi( pNew );
205  pObjNew->Level = pObj->Level;
206  pObj->pData = pObjNew;
207  }
208  // duplicate internal nodes
209  Aig_ManForEachObj( p, pObj, i )
210  if ( !Aig_ObjIsCo(pObj) )
211  {
212  Aig_ManDupSimpleDfs_rec( pNew, p, pObj );
213  assert( pObj->Level == ((Aig_Obj_t*)pObj->pData)->Level );
214  }
215  // add the POs
216  Aig_ManForEachCo( p, pObj, i )
217  {
218  pObjNew = Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
219  pObj->pData = pObjNew;
220  }
221  assert( Aig_ManBufNum(p) != 0 || Aig_ManNodeNum(p) == Aig_ManNodeNum(pNew) );
222  Aig_ManSetRegNum( pNew, Aig_ManRegNum(p) );
223  // check the resulting network
224  if ( !Aig_ManCheck(pNew) )
225  printf( "Aig_ManDupSimple(): The check has failed.\n" );
226  return pNew;
227 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
unsigned Level
Definition: aig.h:82
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void * pData
Definition: aig.h:87
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
static int Aig_ManBufNum(Aig_Man_t *p)
Definition: aig.h:253
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
#define assert(ex)
Definition: util_old.h:213
Aig_Obj_t * Aig_ManDupSimpleDfs_rec(Aig_Man_t *pNew, Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigDup.c:157
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
Aig_Obj_t* Aig_ManDupSimpleDfs_rec ( Aig_Man_t pNew,
Aig_Man_t p,
Aig_Obj_t pObj 
)

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

Synopsis [Duplicates the AIG manager recursively.]

Description []

SideEffects []

SeeAlso []

Definition at line 157 of file aigDup.c.

158 {
159  if ( pObj->pData )
160  return (Aig_Obj_t *)pObj->pData;
161  Aig_ManDupSimpleDfs_rec( pNew, p, Aig_ObjFanin0(pObj) );
162  if ( Aig_ObjIsBuf(pObj) )
163  return (Aig_Obj_t *)(pObj->pData = Aig_ObjChild0Copy(pObj));
164  Aig_ManDupSimpleDfs_rec( pNew, p, Aig_ObjFanin1(pObj) );
165  pObj->pData = Aig_And( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
166  return (Aig_Obj_t *)pObj->pData;
167 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void * pData
Definition: aig.h:87
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static int Aig_ObjIsBuf(Aig_Obj_t *pObj)
Definition: aig.h:277
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
Definition: aig.h:69
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
Aig_Obj_t * Aig_ManDupSimpleDfs_rec(Aig_Man_t *pNew, Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigDup.c:157
Aig_Man_t* Aig_ManDupSimpleDfsPart ( Aig_Man_t p,
Vec_Ptr_t vPis,
Vec_Ptr_t vPos 
)

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

Synopsis [Duplicates part of the AIG manager.]

Description [Orders nodes as follows: PIs, ANDs, POs.]

SideEffects []

SeeAlso []

Definition at line 240 of file aigDup.c.

241 {
242  Aig_Man_t * pNew;
243  Aig_Obj_t * pObj, * pObjNew;
244  int i;
245  // create the new manager
246  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
247  // create the PIs
248  Aig_ManCleanData( p );
249  Aig_ManConst1(p)->pData = Aig_ManConst1( pNew );
250  Vec_PtrForEachEntry( Aig_Obj_t *, vPis, pObj, i )
251  pObj->pData = Aig_ObjCreateCi( pNew );
252  // duplicate internal nodes
253  Vec_PtrForEachEntry( Aig_Obj_t *, vPos, pObj, i )
254  {
255  pObjNew = Aig_ManDupSimpleDfs_rec( pNew, p, Aig_ObjFanin0(pObj) );
256  pObjNew = Aig_NotCond( pObjNew, Aig_ObjFaninC0(pObj) );
257  Aig_ObjCreateCo( pNew, pObjNew );
258  }
259  Aig_ManSetRegNum( pNew, 0 );
260  // check the resulting network
261  if ( !Aig_ManCheck(pNew) )
262  printf( "Aig_ManDupSimple(): The check has failed.\n" );
263  return pNew;
264 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void * pData
Definition: aig.h:87
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
Definition: aig.h:69
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
Aig_Obj_t * Aig_ManDupSimpleDfs_rec(Aig_Man_t *pNew, Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigDup.c:157
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
Aig_Man_t* Aig_ManDupSimpleWithHints ( Aig_Man_t p,
Vec_Int_t vHints 
)

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

Synopsis [Derives AIG with hints.]

Description []

SideEffects []

SeeAlso []

Definition at line 107 of file aigDup.c.

108 {
109  Aig_Man_t * pNew;
110  Aig_Obj_t * pObj;
111  int i, Entry;
112  assert( p->nAsserts == 0 || p->nConstrs == 0 );
113  // create the new manager
114  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
115  pNew->pName = Abc_UtilStrsav( p->pName );
116  // create the PIs
117  Aig_ManCleanData( p );
119  Aig_ManForEachCi( p, pObj, i )
120  {
121  pObj->pData = Aig_ObjCreateCi( pNew );
122  Entry = Vec_IntEntry( vHints, Aig_ObjId(pObj) );
123  if ( Entry == 0 || Entry == 1 )
124  pObj->pData = Aig_NotCond( Aig_ManConst1(pNew), Entry ); // restrict to the complement of constraint!!!
125  }
126  // duplicate internal nodes
127  Aig_ManForEachNode( p, pObj, i )
128  {
129  pObj->pData = Aig_And( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
130  Entry = Vec_IntEntry( vHints, Aig_ObjId(pObj) );
131  if ( Entry == 0 || Entry == 1 )
132  pObj->pData = Aig_NotCond( Aig_ManConst1(pNew), Entry ); // restrict to the complement of constraint!!!
133  }
134  // add the POs
135  Aig_ManForEachCo( p, pObj, i )
136  pObj->pData = Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
137  Aig_ManCleanup( pNew );
138  Aig_ManSetRegNum( pNew, Aig_ManRegNum(p) );
139  // check the resulting network
140  if ( !Aig_ManCheck(pNew) )
141  printf( "Llb_ManDeriveAigWithHints(): The check has failed.\n" );
142  return pNew;
143 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void * pData
Definition: aig.h:87
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static void check(int expr)
Definition: satSolver.c:46
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
if(last==0)
Definition: sparse_int.h:34
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
Definition: aig.h:69
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
#define assert(ex)
Definition: util_old.h:213
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
Aig_Man_t* Aig_ManDupTrim ( Aig_Man_t p)

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

Synopsis [Duplicates the AIG manager.]

Description [Assumes topological ordering of the nodes.]

SideEffects []

SeeAlso []

Definition at line 413 of file aigDup.c.

414 {
415  Aig_Man_t * pNew;
416  Aig_Obj_t * pObj, * pObjNew;
417  int i, nNodes;
418  // create the new manager
419  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
420  pNew->pName = Abc_UtilStrsav( p->pName );
421  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
422  pNew->nConstrs = p->nConstrs;
423  pNew->nBarBufs = p->nBarBufs;
424  // create the PIs
425  Aig_ManCleanData( p );
426  // duplicate internal nodes
427  Aig_ManForEachObj( p, pObj, i )
428  {
429  if ( Aig_ObjIsNode(pObj) )
430  pObjNew = Aig_Oper( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj), Aig_ObjType(pObj) );
431  else if ( Aig_ObjIsCi(pObj) )
432  pObjNew = (Aig_ObjRefs(pObj) > 0 || Saig_ObjIsLo(p, pObj)) ? Aig_ObjCreateCi(pNew) : NULL;
433  else if ( Aig_ObjIsCo(pObj) )
434  pObjNew = Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
435  else if ( Aig_ObjIsConst1(pObj) )
436  pObjNew = Aig_ManConst1(pNew);
437  else
438  assert( 0 );
439  pObj->pData = pObjNew;
440  }
441  assert( Aig_ManNodeNum(p) == Aig_ManNodeNum(pNew) );
442  if ( (nNodes = Aig_ManCleanup( pNew )) )
443  printf( "Aig_ManDupTrim(): Cleanup after AIG duplication removed %d nodes.\n", nNodes );
444  Aig_ManSetRegNum( pNew, Aig_ManRegNum(p) );
445  // check the resulting network
446  if ( !Aig_ManCheck(pNew) )
447  printf( "Aig_ManDupTrim(): The check has failed.\n" );
448  return pNew;
449 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
static Aig_Type_t Aig_ObjType(Aig_Obj_t *pObj)
Definition: aig.h:272
static int Saig_ObjIsLo(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:84
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void * pData
Definition: aig.h:87
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
Aig_Obj_t * Aig_Oper(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1, Aig_Type_t Type)
Definition: aigOper.c:83
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
Definition: aig.h:69
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjRefs(Aig_Obj_t *pObj)
Definition: aig.h:300
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
Aig_Man_t* Aig_ManDupUnsolvedOutputs ( Aig_Man_t p,
int  fAddRegs 
)

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

Synopsis [Duplicates AIG with only one primary output.]

Description []

SideEffects []

SeeAlso []

Definition at line 1199 of file aigDup.c.

1200 {
1201  Aig_Man_t * pNew;
1202  Aig_Obj_t * pObj;
1203  int i, nOuts = 0;
1204  assert( Aig_ManRegNum(p) > 0 );
1205  if ( p->nConstrs > 0 )
1206  {
1207  printf( "The AIG manager should have no constraints.\n" );
1208  return NULL;
1209  }
1210  // create the new manager
1211  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
1212  pNew->pName = Abc_UtilStrsav( p->pName );
1213  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1214  // create the PIs
1215  Aig_ManCleanData( p );
1216  Aig_ManConst1(p)->pData = Aig_ManConst1(pNew);
1217  Aig_ManForEachCi( p, pObj, i )
1218  pObj->pData = Aig_ObjCreateCi( pNew );
1219  // create the POs
1220  nOuts = 0;
1221  Aig_ManForEachPoSeq( p, pObj, i )
1222  nOuts += ( Aig_ObjFanin0(pObj) != Aig_ManConst1(p) );
1223  // set registers
1224  pNew->nRegs = fAddRegs? p->nRegs : 0;
1225  pNew->nTruePis = fAddRegs? p->nTruePis : p->nTruePis + p->nRegs;
1226  pNew->nTruePos = nOuts;
1227  // duplicate internal nodes
1228  Aig_ManForEachNode( p, pObj, i )
1229  pObj->pData = Aig_And( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
1230  // create the PO
1231  Aig_ManForEachPoSeq( p, pObj, i )
1232  if ( Aig_ObjFanin0(pObj) != Aig_ManConst1(p) )
1233  Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
1234  // create register inputs with MUXes
1235  if ( fAddRegs )
1236  {
1237  Aig_ManForEachLiSeq( p, pObj, i )
1238  Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
1239  }
1240  Aig_ManCleanup( pNew );
1241  return pNew;
1242 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void * pData
Definition: aig.h:87
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
if(last==0)
Definition: sparse_int.h:34
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
Definition: aig.h:69
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#define assert(ex)
Definition: util_old.h:213
#define Aig_ManForEachLiSeq(p, pObj, i)
Definition: aig.h:447
#define Aig_ManForEachPoSeq(p, pObj, i)
Definition: aig.h:444
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
Aig_Man_t* Aig_ManDupWithoutPos ( Aig_Man_t p)

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

Synopsis [Duplicates the AIG manager.]

Description [Assumes topological ordering of nodes.]

SideEffects []

SeeAlso []

Definition at line 835 of file aigDup.c.

836 {
837  Aig_Man_t * pNew;
838  Aig_Obj_t * pObj;
839  int i;
840  // create the new manager
841  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
842  pNew->pName = Abc_UtilStrsav( p->pName );
843  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
844  // create the PIs
845  Aig_ManCleanData( p );
847  Aig_ManForEachCi( p, pObj, i )
848  pObj->pData = Aig_ObjCreateCi( pNew );
849  // duplicate internal nodes
850  Aig_ManForEachObj( p, pObj, i )
851  {
852  assert( !Aig_ObjIsBuf(pObj) );
853  if ( Aig_ObjIsNode(pObj) )
854  pObj->pData = Aig_Oper( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj), Aig_ObjType(pObj) );
855  }
856  assert( Aig_ManBufNum(p) != 0 || Aig_ManNodeNum(p) == Aig_ManNodeNum(pNew) );
857  return pNew;
858 }
static Aig_Type_t Aig_ObjType(Aig_Obj_t *pObj)
Definition: aig.h:272
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void * pData
Definition: aig.h:87
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
Aig_Obj_t * Aig_Oper(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1, Aig_Type_t Type)
Definition: aigOper.c:83
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
static int Aig_ManBufNum(Aig_Man_t *p)
Definition: aig.h:253
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Aig_ObjIsBuf(Aig_Obj_t *pObj)
Definition: aig.h:277
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
Definition: aig.h:69
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
#define assert(ex)
Definition: util_old.h:213
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
static int Aig_ManExorNum ( Aig_Man_t p)
inlinestatic

Definition at line 255 of file aig.h.

255 { return p->nObjs[AIG_OBJ_EXOR]; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Aig_Man_t* Aig_ManExtractMiter ( Aig_Man_t p,
Aig_Obj_t pNode1,
Aig_Obj_t pNode2 
)

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

Synopsis [Extracts the miter composed of XOR of the two nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 147 of file aigMan.c.

148 {
149  Aig_Man_t * pNew;
150  Aig_Obj_t * pObj;
151  int i;
152  // create the new manager
153  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
154  pNew->pName = Abc_UtilStrsav( p->pName );
155  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
156  // create the PIs
157  Aig_ManCleanData( p );
159  Aig_ManForEachCi( p, pObj, i )
160  pObj->pData = Aig_ObjCreateCi(pNew);
161  // dump the nodes
162  Aig_ManDup_rec( pNew, p, pNode1 );
163  Aig_ManDup_rec( pNew, p, pNode2 );
164  // construct the EXOR
165  pObj = Aig_Exor( pNew, (Aig_Obj_t *)pNode1->pData, (Aig_Obj_t *)pNode2->pData );
166  pObj = Aig_NotCond( pObj, Aig_Regular(pObj)->fPhase ^ Aig_IsComplement(pObj) );
167  // add the PO
168  Aig_ObjCreateCo( pNew, pObj );
169  // check the resulting network
170  if ( !Aig_ManCheck(pNew) )
171  printf( "Aig_ManExtractMiter(): The check has failed.\n" );
172  return pNew;
173 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void * pData
Definition: aig.h:87
Aig_Obj_t * Aig_Exor(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:220
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
Aig_Man_t * Aig_ManExtractMiter(Aig_Man_t *p, Aig_Obj_t *pNode1, Aig_Obj_t *pNode2)
Definition: aigMan.c:147
static void check(int expr)
Definition: satSolver.c:46
Aig_Obj_t * Aig_ManDup_rec(Aig_Man_t *pNew, Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigMan.c:123
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
ABC_NAMESPACE_IMPL_START Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
void Aig_ManFanoutStart ( Aig_Man_t p)

FUNCTION DEFINITIONS ///.

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

Synopsis [Create fanout for all objects in the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 56 of file aigFanout.c.

57 {
58  Aig_Obj_t * pObj;
59  int i;
60  assert( Aig_ManBufNum(p) == 0 );
61  // allocate fanout datastructure
62  assert( p->pFanData == NULL );
63  p->nFansAlloc = 2 * Aig_ManObjNumMax(p);
64  if ( p->nFansAlloc < (1<<12) )
65  p->nFansAlloc = (1<<12);
66  p->pFanData = ABC_ALLOC( int, 5 * p->nFansAlloc );
67  memset( p->pFanData, 0, sizeof(int) * 5 * p->nFansAlloc );
68  // add fanouts for all objects
69  Aig_ManForEachObj( p, pObj, i )
70  {
71  if ( Aig_ObjChild0(pObj) )
72  Aig_ObjAddFanout( p, Aig_ObjFanin0(pObj), pObj );
73  if ( Aig_ObjChild1(pObj) )
74  Aig_ObjAddFanout( p, Aig_ObjFanin1(pObj), pObj );
75  }
76 }
char * memset()
static Aig_Obj_t * Aig_ObjChild0(Aig_Obj_t *pObj)
Definition: aig.h:310
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static int Aig_ManBufNum(Aig_Man_t *p)
Definition: aig.h:253
void Aig_ObjAddFanout(Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pFanout)
Definition: aigFanout.c:107
static Aig_Obj_t * Aig_ObjChild1(Aig_Obj_t *pObj)
Definition: aig.h:311
Definition: aig.h:69
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
#define assert(ex)
Definition: util_old.h:213
void Aig_ManFanoutStop ( Aig_Man_t p)

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

Synopsis [Deletes fanout for all objects in the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 89 of file aigFanout.c.

90 {
91  assert( p->pFanData != NULL );
92  ABC_FREE( p->pFanData );
93  p->nFansAlloc = 0;
94 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define assert(ex)
Definition: util_old.h:213
static Aig_Obj_t* Aig_ManFetchMemory ( Aig_Man_t p)
inlinestatic

Definition at line 368 of file aig.h.

369 {
370  extern char * Aig_MmFixedEntryFetch( Aig_MmFixed_t * p );
371  Aig_Obj_t * pTemp;
372  pTemp = (Aig_Obj_t *)Aig_MmFixedEntryFetch( p->pMemObjs );
373  memset( pTemp, 0, sizeof(Aig_Obj_t) );
374  pTemp->Id = Vec_PtrSize(p->vObjs);
375  Vec_PtrPush( p->vObjs, pTemp );
376  return pTemp;
377 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
DECLARATIONS ///.
Definition: aigMem.c:30
char * Aig_MmFixedEntryFetch(Aig_MmFixed_t *p)
Definition: aigMem.c:161
Definition: aig.h:69
int Id
Definition: aig.h:85
void Aig_ManFindCut ( Aig_Obj_t pRoot,
Vec_Ptr_t vFront,
Vec_Ptr_t vVisited,
int  nSizeLimit,
int  nFanoutLimit 
)

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 145 of file aigWin.c.

146 {
147  Aig_Obj_t * pNode;
148  int i;
149 
150  assert( !Aig_IsComplement(pRoot) );
151  assert( Aig_ObjIsNode(pRoot) );
152  assert( Aig_ObjChild0(pRoot) );
153  assert( Aig_ObjChild1(pRoot) );
154 
155  // start the cut
156  Vec_PtrClear( vFront );
157  Vec_PtrPush( vFront, Aig_ObjFanin0(pRoot) );
158  Vec_PtrPush( vFront, Aig_ObjFanin1(pRoot) );
159 
160  // start the visited nodes
161  Vec_PtrClear( vVisited );
162  Vec_PtrPush( vVisited, pRoot );
163  Vec_PtrPush( vVisited, Aig_ObjFanin0(pRoot) );
164  Vec_PtrPush( vVisited, Aig_ObjFanin1(pRoot) );
165 
166  // mark these nodes
167  assert( !pRoot->fMarkA );
168  assert( !Aig_ObjFanin0(pRoot)->fMarkA );
169  assert( !Aig_ObjFanin1(pRoot)->fMarkA );
170  pRoot->fMarkA = 1;
171  Aig_ObjFanin0(pRoot)->fMarkA = 1;
172  Aig_ObjFanin1(pRoot)->fMarkA = 1;
173 
174  // compute the cut
175  while ( Aig_ManFindCut_int( vFront, vVisited, nSizeLimit, nFanoutLimit ) );
176  assert( Vec_PtrSize(vFront) <= nSizeLimit );
177 
178  // clean the visit markings
179  Vec_PtrForEachEntry( Aig_Obj_t *, vVisited, pNode, i )
180  pNode->fMarkA = 0;
181 }
static Aig_Obj_t * Aig_ObjChild0(Aig_Obj_t *pObj)
Definition: aig.h:310
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
unsigned int fMarkA
Definition: aig.h:79
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
int Aig_ManFindCut_int(Vec_Ptr_t *vFront, Vec_Ptr_t *vVisited, int nSizeLimit, int nFanoutLimit)
Definition: aigWin.c:80
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static Aig_Obj_t * Aig_ObjChild1(Aig_Obj_t *pObj)
Definition: aig.h:311
Definition: aig.h:69
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
void Aig_ManFlipFirstPo ( Aig_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 457 of file aigMan.c.

458 {
459  Aig_ObjChild0Flip( Aig_ManCo(p, 0) );
460 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Aig_ObjChild0Flip(Aig_Obj_t *pObj)
Definition: aig.h:316
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
Definition: aig.h:267
Aig_Man_t* Aig_ManFraigPartitioned ( Aig_Man_t pAig,
int  nPartSize,
int  nConfMax,
int  nLevelMax,
int  fVerbose 
)

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

Synopsis [Performs partitioned choice computation.]

Description [Assumes that each output in the second AIG cannot have more supp vars than the same output in the first AIG.]

SideEffects []

SeeAlso []

Definition at line 1379 of file aigPart.c.

1380 {
1381 // extern Aig_Man_t * Fra_FraigChoice( Aig_Man_t * pManAig, int nConfMax, int nLevelMax );
1382 
1383  Aig_Man_t * pAigPart, * pAigTemp;
1384  Vec_Int_t * vPart;
1385  Vec_Ptr_t * vParts;
1386  Aig_Obj_t * pObj;
1387  void ** ppData;
1388  int i, k;
1389 
1390  // partition the outputs of the AIG
1391  vParts = Aig_ManPartitionNaive( pAig, nPartSize );
1392 
1393  // start the equivalence classes
1394  Aig_ManReprStart( pAig, Aig_ManObjNumMax(pAig) );
1395 
1396  // set the PI numbers
1397  Aig_ManSetCioIds( pAig );
1398 
1399  // create the total fraiged AIG
1400  Vec_PtrForEachEntry( Vec_Int_t *, vParts, vPart, i )
1401  {
1402  // derive the partition AIG
1403  pAigPart = Aig_ManDupPartAll( pAig, vPart );
1404  // store contents of pData pointers
1405  ppData = ABC_ALLOC( void *, Aig_ManObjNumMax(pAigPart) );
1406  Aig_ManForEachObj( pAigPart, pObj, k )
1407  ppData[k] = pObj->pData;
1408  // report the process
1409  if ( fVerbose )
1410  printf( "Part %4d (out of %4d) PI = %5d. PO = %5d. And = %6d. Lev = %4d.\r",
1411  i+1, Vec_PtrSize(vParts), Aig_ManCiNum(pAigPart), Aig_ManCoNum(pAigPart),
1412  Aig_ManNodeNum(pAigPart), Aig_ManLevelNum(pAigPart) );
1413  // compute equivalence classes (to be stored in pNew->pReprs)
1414  pAigTemp = Fra_FraigChoice( pAigPart, nConfMax, nLevelMax );
1415  Aig_ManStop( pAigTemp );
1416  // reset the pData pointers
1417  Aig_ManForEachObj( pAigPart, pObj, k )
1418  pObj->pData = ppData[k];
1419  ABC_FREE( ppData );
1420  // transfer representatives to the total AIG
1421  if ( pAigPart->pReprs )
1422  Aig_ManTransferRepr( pAig, pAigPart );
1423  Aig_ManStop( pAigPart );
1424  }
1425  if ( fVerbose )
1426  printf( " \r" );
1427  Vec_VecFree( (Vec_Vec_t *)vParts );
1428 
1429  // clear the PI numbers
1430  Aig_ManCleanCioIds( pAig );
1431 
1432  // derive the result of choicing
1433  return Aig_ManDupRepr( pAig, 0 );
1434 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void Vec_VecFree(Vec_Vec_t *p)
Definition: vecVec.h:347
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
Aig_Man_t * Fra_FraigChoice(Aig_Man_t *pManAig, int nConfMax, int nLevelMax)
Definition: fraCore.c:442
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
void Aig_ManReprStart(Aig_Man_t *p, int nIdMax)
DECLARATIONS ///.
Definition: aigRepr.c:45
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
void Aig_ManSetCioIds(Aig_Man_t *p)
Definition: aigUtil.c:965
Aig_Man_t * Aig_ManDupRepr(Aig_Man_t *p, int fOrdered)
Definition: aigRepr.c:267
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
int Aig_ManLevelNum(Aig_Man_t *p)
Definition: aigDfs.c:486
Vec_Ptr_t * Aig_ManPartitionNaive(Aig_Man_t *p, int nPartSize)
Definition: aigPart.c:941
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
#define ABC_FREE(obj)
Definition: abc_global.h:232
void Aig_ManTransferRepr(Aig_Man_t *pNew, Aig_Man_t *p)
Definition: aigRepr.c:211
Aig_Man_t * Aig_ManDupPartAll(Aig_Man_t *pOld, Vec_Int_t *vPart)
Definition: aigPart.c:1098
void Aig_ManCleanCioIds(Aig_Man_t *p)
Definition: aigUtil.c:986
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
Aig_Man_t* Aig_ManFrames ( Aig_Man_t pAig,
int  nFs,
int  fInit,
int  fOuts,
int  fRegs,
int  fEnlarge,
Aig_Obj_t ***  ppObjMap 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Performs timeframe expansion of the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 51 of file aigFrames.c.

52 {
53  Aig_Man_t * pFrames;
54  Aig_Obj_t * pObj, * pObjLi, * pObjLo, * pObjNew;
55  Aig_Obj_t ** pObjMap;
56  int i, f;
57 
58  // create mapping for the frames nodes
59  pObjMap = ABC_ALLOC( Aig_Obj_t *, nFs * Aig_ManObjNumMax(pAig) );
60  memset( pObjMap, 0, sizeof(Aig_Obj_t *) * nFs * Aig_ManObjNumMax(pAig) );
61 
62  // start the fraig package
63  pFrames = Aig_ManStart( Aig_ManObjNumMax(pAig) * nFs );
64  pFrames->pName = Abc_UtilStrsav( pAig->pName );
65  pFrames->pSpec = Abc_UtilStrsav( pAig->pSpec );
66  // map constant nodes
67  for ( f = 0; f < nFs; f++ )
68  Aig_ObjSetFrames( pObjMap, nFs, Aig_ManConst1(pAig), f, Aig_ManConst1(pFrames) );
69  // create PI nodes for the frames
70  for ( f = 0; f < nFs; f++ )
71  Aig_ManForEachPiSeq( pAig, pObj, i )
72  Aig_ObjSetFrames( pObjMap, nFs, pObj, f, Aig_ObjCreateCi(pFrames) );
73  // set initial state for the latches
74  if ( fInit )
75  {
76  Aig_ManForEachLoSeq( pAig, pObj, i )
77  Aig_ObjSetFrames( pObjMap, nFs, pObj, 0, Aig_ManConst0(pFrames) );
78  }
79  else
80  {
81  Aig_ManForEachLoSeq( pAig, pObj, i )
82  Aig_ObjSetFrames( pObjMap, nFs, pObj, 0, Aig_ObjCreateCi(pFrames) );
83  }
84 
85  // add timeframes
86  for ( f = 0; f < nFs; f++ )
87  {
88 // printf( "Frame = %d.\n", f );
89  // add internal nodes of this frame
90  Aig_ManForEachNode( pAig, pObj, i )
91  {
92 // Aig_Obj_t * pFanin0 = Aig_ObjChild0Frames(pObjMap,nFs,pObj,f);
93 // Aig_Obj_t * pFanin1 = Aig_ObjChild1Frames(pObjMap,nFs,pObj,f);
94 // printf( "Node = %3d. Fanin0 = %3d. Fanin1 = %3d.\n", pObj->Id, Aig_Regular(pFanin0)->Id, Aig_Regular(pFanin1)->Id );
95  pObjNew = Aig_And( pFrames, Aig_ObjChild0Frames(pObjMap,nFs,pObj,f), Aig_ObjChild1Frames(pObjMap,nFs,pObj,f) );
96  Aig_ObjSetFrames( pObjMap, nFs, pObj, f, pObjNew );
97  }
98  // set the latch inputs and copy them into the latch outputs of the next frame
99  Aig_ManForEachLiLoSeq( pAig, pObjLi, pObjLo, i )
100  {
101  pObjNew = Aig_ObjChild0Frames(pObjMap,nFs,pObjLi,f);
102  if ( f < nFs - 1 )
103  Aig_ObjSetFrames( pObjMap, nFs, pObjLo, f+1, pObjNew );
104  }
105  }
106  if ( fOuts )
107  {
108  for ( f = fEnlarge?nFs-1:0; f < nFs; f++ )
109  Aig_ManForEachPoSeq( pAig, pObj, i )
110  {
111  pObjNew = Aig_ObjCreateCo( pFrames, Aig_ObjChild0Frames(pObjMap,nFs,pObj,f) );
112  Aig_ObjSetFrames( pObjMap, nFs, pObj, f, pObjNew );
113  }
114  }
115  if ( fRegs )
116  {
117  pFrames->nRegs = pAig->nRegs;
118  Aig_ManForEachLiSeq( pAig, pObj, i )
119  {
120  pObjNew = Aig_ObjCreateCo( pFrames, Aig_ObjChild0Frames(pObjMap,nFs,pObj,fEnlarge?0:nFs-1) );
121  Aig_ObjSetFrames( pObjMap, nFs, pObj, nFs-1, pObjNew );
122  }
123  Aig_ManSetRegNum( pFrames, Aig_ManRegNum(pAig) );
124  }
125  Aig_ManCleanup( pFrames );
126  // return the new manager
127  if ( ppObjMap )
128  *ppObjMap = pObjMap;
129  else
130  ABC_FREE( pObjMap );
131  return pFrames;
132 }
char * memset()
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
static Aig_Obj_t * Aig_ObjChild1Frames(Aig_Obj_t **pObjMap, int nFs, Aig_Obj_t *pObj, int i)
Definition: aigFrames.c:34
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
static Aig_Obj_t * Aig_ManConst0(Aig_Man_t *p)
Definition: aig.h:263
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static void Aig_ObjSetFrames(Aig_Obj_t **pObjMap, int nFs, Aig_Obj_t *pObj, int i, Aig_Obj_t *pNode)
Definition: aigFrames.c:31
for(p=first;p->value< newval;p=p->next)
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
#define Aig_ManForEachLiLoSeq(p, pObjLi, pObjLo, k)
Definition: aig.h:450
else
Definition: sparse_int.h:55
Definition: aig.h:69
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#define ABC_FREE(obj)
Definition: abc_global.h:232
static Aig_Obj_t * Aig_ObjChild0Frames(Aig_Obj_t **pObjMap, int nFs, Aig_Obj_t *pObj, int i)
Definition: aigFrames.c:33
#define Aig_ManForEachLoSeq(p, pObj, i)
Definition: aig.h:441
#define Aig_ManForEachLiSeq(p, pObj, i)
Definition: aig.h:447
#define Aig_ManForEachPoSeq(p, pObj, i)
Definition: aig.h:444
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
#define Aig_ManForEachPiSeq(p, pObj, i)
SEQUENTIAL ITERATORS ///.
Definition: aig.h:438
static int Aig_ManGetCost ( Aig_Man_t p)
inlinestatic

Definition at line 257 of file aig.h.

257 { return p->nObjs[AIG_OBJ_AND]+3*p->nObjs[AIG_OBJ_EXOR]; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t* Aig_ManGhost ( Aig_Man_t p)
inlinestatic

Definition at line 265 of file aig.h.

265 { return &p->Ghost; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Aig_ManHasNoGaps ( Aig_Man_t p)

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

Synopsis [Make sure AIG has not gaps in the numeric order.]

Description []

SideEffects []

SeeAlso []

Definition at line 86 of file aigUtil.c.

87 {
88  return (int)(Aig_ManObjNum(p) == Aig_ManCiNum(p) + Aig_ManCoNum(p) + Aig_ManNodeNum(p) + 1);
89 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ManObjNum(Aig_Man_t *p)
Definition: aig.h:258
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
void Aig_ManIncrementTravId ( Aig_Man_t p)

DECLARATIONS ///.

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

FileName [aigUtil.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [AIG package.]

Synopsis [Various procedures.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 44 of file aigUtil.c.

45 {
46  if ( p->nTravIds >= (1<<30)-1 )
48  p->nTravIds++;
49 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
void Aig_ManInvertConstraints ( Aig_Man_t pAig)

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

Synopsis [Complements the constraint outputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 1543 of file aigUtil.c.

1544 {
1545  Aig_Obj_t * pObj;
1546  int i;
1547  if ( Aig_ManConstrNum(pAig) == 0 )
1548  return;
1549  Saig_ManForEachPo( pAig, pObj, i )
1550  {
1551  if ( i >= Saig_ManPoNum(pAig) - Aig_ManConstrNum(pAig) )
1552  Aig_ObjChild0Flip( pObj );
1553  }
1554 }
static int Aig_ManConstrNum(Aig_Man_t *p)
Definition: aig.h:261
static int Saig_ManPoNum(Aig_Man_t *p)
Definition: saig.h:74
Definition: aig.h:69
static void Aig_ObjChild0Flip(Aig_Obj_t *pObj)
Definition: aig.h:316
#define Saig_ManForEachPo(p, pObj, i)
Definition: saig.h:93
Vec_Vec_t* Aig_ManLevelize ( Aig_Man_t p)

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

Synopsis [Levelizes the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 307 of file aigDfs.c.

308 {
309  Aig_Obj_t * pObj;
310  Vec_Vec_t * vLevels;
311  int nLevels, i;
312  nLevels = Aig_ManLevelNum( p );
313  vLevels = Vec_VecStart( nLevels + 1 );
314  Aig_ManForEachObj( p, pObj, i )
315  {
316  assert( (int)pObj->Level <= nLevels );
317  Vec_VecPush( vLevels, pObj->Level, pObj );
318  }
319  return vLevels;
320 }
unsigned Level
Definition: aig.h:82
static void Vec_VecPush(Vec_Vec_t *p, int Level, void *Entry)
Definition: vecVec.h:456
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Definition: aig.h:69
static Vec_Vec_t * Vec_VecStart(int nSize)
Definition: vecVec.h:168
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
#define assert(ex)
Definition: util_old.h:213
int Aig_ManLevelNum(Aig_Man_t *p)
Definition: aigDfs.c:486
int Aig_ManLevelNum ( Aig_Man_t p)

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

Synopsis [Computes the max number of levels in the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 486 of file aigDfs.c.

487 {
488  Aig_Obj_t * pObj;
489  int i, LevelsMax;
490  LevelsMax = 0;
491  Aig_ManForEachCo( p, pObj, i )
492  LevelsMax = Abc_MaxInt( LevelsMax, (int)Aig_ObjFanin0(pObj)->Level );
493  return LevelsMax;
494 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
Definition: aig.h:69
int Aig_ManLevels ( Aig_Man_t p)

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

Synopsis [Collect the latches.]

Description []

SideEffects []

SeeAlso []

Definition at line 102 of file aigUtil.c.

103 {
104  Aig_Obj_t * pObj;
105  int i, LevelMax = 0;
106  Aig_ManForEachCo( p, pObj, i )
107  LevelMax = Abc_MaxInt( LevelMax, (int)Aig_ObjFanin0(pObj)->Level );
108  return LevelMax;
109 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
Definition: aig.h:69
static Aig_Obj_t* Aig_ManLi ( Aig_Man_t p,
int  i 
)
inlinestatic

Definition at line 269 of file aig.h.

269 { return (Aig_Obj_t *)Vec_PtrEntry(p->vCos, Aig_ManCoNum(p)-Aig_ManRegNum(p)+i); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
Definition: aig.h:69
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static Aig_Obj_t* Aig_ManLo ( Aig_Man_t p,
int  i 
)
inlinestatic

Definition at line 268 of file aig.h.

268 { return (Aig_Obj_t *)Vec_PtrEntry(p->vCis, Aig_ManCiNum(p)-Aig_ManRegNum(p)+i); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
Definition: aig.h:69
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
void Aig_ManMarkValidChoices ( Aig_Man_t p)

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

Synopsis [Marks the nodes that are Creates choices.]

Description [The input AIG is assumed to have representatives assigned.]

SideEffects []

SeeAlso []

Definition at line 481 of file aigRepr.c.

482 {
483  Aig_Obj_t * pObj, * pRepr;
484  int i;
485  assert( p->pReprs != NULL );
486  // create equivalent nodes in the manager
487  assert( p->pEquivs == NULL );
488  p->pEquivs = ABC_ALLOC( Aig_Obj_t *, Aig_ManObjNumMax(p) );
489  memset( p->pEquivs, 0, sizeof(Aig_Obj_t *) * Aig_ManObjNumMax(p) );
490  // make the choice nodes
491  Aig_ManForEachNode( p, pObj, i )
492  {
493  pRepr = Aig_ObjFindRepr( p, pObj );
494  if ( pRepr == NULL )
495  continue;
496  // skip constant and PI classes
497  if ( !Aig_ObjIsNode(pRepr) )
498  {
499  Aig_ObjClearRepr( p, pObj );
500  continue;
501  }
502  // skip choices with combinatinal loops
503  if ( Aig_ObjCheckTfi( p, pObj, pRepr ) )
504  {
505  Aig_ObjClearRepr( p, pObj );
506  continue;
507  }
508 //printf( "Node %d is represented by node %d.\n", pObj->Id, pRepr->Id );
509  // add choice to the choice node
510  if ( pObj->nRefs > 0 )
511  {
512  Aig_ObjClearRepr( p, pObj );
513  continue;
514  }
515  assert( pObj->nRefs == 0 );
516  p->pEquivs[pObj->Id] = p->pEquivs[pRepr->Id];
517  p->pEquivs[pRepr->Id] = pObj;
518  }
519 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
int Aig_ObjCheckTfi(Aig_Man_t *p, Aig_Obj_t *pNew, Aig_Obj_t *pOld)
Definition: aigRepr.c:435
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
static Aig_Obj_t * Aig_ObjFindRepr(Aig_Man_t *p, Aig_Obj_t *pNode)
Definition: aigRepr.c:131
Definition: aig.h:69
static void Aig_ObjClearRepr(Aig_Man_t *p, Aig_Obj_t *pNode)
Definition: aigRepr.c:151
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
#define assert(ex)
Definition: util_old.h:213
int Id
Definition: aig.h:85
unsigned int nRefs
Definition: aig.h:81
Vec_Ptr_t* Aig_ManMiterPartitioned ( Aig_Man_t p1,
Aig_Man_t p2,
int  nPartSize,
int  fSmart 
)

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

Synopsis [Create partitioned miter of the two AIGs.]

Description [Assumes that each output in the second AIG cannot have more supp vars than the same output in the first AIG.]

SideEffects []

SeeAlso []

Definition at line 1189 of file aigPart.c.

1190 {
1191  Aig_Man_t * pNew;
1192  Aig_Obj_t * pMiter;
1193  Vec_Ptr_t * vMiters, * vNodes1, * vNodes2;
1194  Vec_Ptr_t * vParts, * vPartSupps;
1195  Vec_Int_t * vPart, * vPartSupp;
1196  int i, k;
1197  // partition the first manager
1198  if ( fSmart )
1199  vParts = Aig_ManPartitionSmart( p1, nPartSize, 0, &vPartSupps );
1200  else
1201  {
1202  vParts = Aig_ManPartitionNaive( p1, nPartSize );
1203  vPartSupps = Aig_ManSupportNodes( p1, vParts );
1204  }
1205  // derive miters
1206  vMiters = Vec_PtrAlloc( Vec_PtrSize(vParts) );
1207  for ( i = 0; i < Vec_PtrSize(vParts); i++ )
1208  {
1209  // get partition and its support
1210  vPart = (Vec_Int_t *)Vec_PtrEntry( vParts, i );
1211  vPartSupp = (Vec_Int_t *)Vec_PtrEntry( vPartSupps, i );
1212  // create the new miter
1213  pNew = Aig_ManStart( 1000 );
1214  // create the PIs
1215  for ( k = 0; k < Vec_IntSize(vPartSupp); k++ )
1216  Aig_ObjCreateCi( pNew );
1217  // copy the components
1218  vNodes1 = Aig_ManDupPart( pNew, p1, vPart, vPartSupp, 0 );
1219  vNodes2 = Aig_ManDupPart( pNew, p2, vPart, vPartSupp, 0 );
1220  // create the miter
1221  pMiter = Aig_MiterTwo( pNew, vNodes1, vNodes2 );
1222  Vec_PtrFree( vNodes1 );
1223  Vec_PtrFree( vNodes2 );
1224  // create the output
1225  Aig_ObjCreateCo( pNew, pMiter );
1226  // clean up
1227  Aig_ManCleanup( pNew );
1228  Vec_PtrPush( vMiters, pNew );
1229  }
1230  Vec_VecFree( (Vec_Vec_t *)vParts );
1231  Vec_VecFree( (Vec_Vec_t *)vPartSupps );
1232  return vMiters;
1233 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
Vec_Ptr_t * Aig_ManSupportNodes(Aig_Man_t *p, Vec_Ptr_t *vParts)
Definition: aigPart.c:1156
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void Vec_VecFree(Vec_Vec_t *p)
Definition: vecVec.h:347
Definition: aig.h:69
Aig_Obj_t * Aig_MiterTwo(Aig_Man_t *p, Vec_Ptr_t *vNodes1, Vec_Ptr_t *vNodes2)
Definition: aigOper.c:453
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
Vec_Ptr_t * Aig_ManPartitionNaive(Aig_Man_t *p, int nPartSize)
Definition: aigPart.c:941
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
Vec_Ptr_t * Aig_ManPartitionSmart(Aig_Man_t *p, int nSuppSizeLimit, int fVerbose, Vec_Ptr_t **pvPartSupps)
Definition: aigPart.c:686
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
Vec_Ptr_t * Aig_ManDupPart(Aig_Man_t *pNew, Aig_Man_t *pOld, Vec_Int_t *vPart, Vec_Int_t *vSuppMap, int fInverse)
Definition: aigPart.c:995
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Vec_Ptr_t* Aig_ManMuxesCollect ( Aig_Man_t pAig)

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

Synopsis [Collects muxes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1460 of file aigUtil.c.

1461 {
1462  Vec_Ptr_t * vMuxes;
1463  Aig_Obj_t * pObj;
1464  int i;
1465  vMuxes = Vec_PtrAlloc( 100 );
1466  Aig_ManForEachNode( pAig, pObj, i )
1467  if ( Aig_ObjIsMuxType(pObj) )
1468  Vec_PtrPush( vMuxes, pObj );
1469  return vMuxes;
1470 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
int Aig_ObjIsMuxType(Aig_Obj_t *pNode)
Definition: aigUtil.c:307
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
void Aig_ManMuxesDeref ( Aig_Man_t pAig,
Vec_Ptr_t vMuxes 
)

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

Synopsis [Dereferences muxes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1483 of file aigUtil.c.

1484 {
1485  Aig_Obj_t * pObj, * pNodeT, * pNodeE, * pNodeC;
1486  int i;
1487  Vec_PtrForEachEntry( Aig_Obj_t *, vMuxes, pObj, i )
1488  {
1489  if ( Aig_ObjRecognizeExor( pObj, &pNodeT, &pNodeE ) )
1490  {
1491  pNodeT->nRefs--;
1492  pNodeE->nRefs--;
1493  }
1494  else
1495  {
1496  pNodeC = Aig_ObjRecognizeMux( pObj, &pNodeT, &pNodeE );
1497  pNodeC->nRefs--;
1498  }
1499  }
1500 }
int Aig_ObjRecognizeExor(Aig_Obj_t *pObj, Aig_Obj_t **ppFan0, Aig_Obj_t **ppFan1)
Definition: aigUtil.c:343
Definition: aig.h:69
Aig_Obj_t * Aig_ObjRecognizeMux(Aig_Obj_t *pNode, Aig_Obj_t **ppNodeT, Aig_Obj_t **ppNodeE)
Definition: aigUtil.c:387
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
unsigned int nRefs
Definition: aig.h:81
void Aig_ManMuxesRef ( Aig_Man_t pAig,
Vec_Ptr_t vMuxes 
)

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

Synopsis [References muxes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1513 of file aigUtil.c.

1514 {
1515  Aig_Obj_t * pObj, * pNodeT, * pNodeE, * pNodeC;
1516  int i;
1517  Vec_PtrForEachEntry( Aig_Obj_t *, vMuxes, pObj, i )
1518  {
1519  if ( Aig_ObjRecognizeExor( pObj, &pNodeT, &pNodeE ) )
1520  {
1521  pNodeT->nRefs++;
1522  pNodeE->nRefs++;
1523  }
1524  else
1525  {
1526  pNodeC = Aig_ObjRecognizeMux( pObj, &pNodeT, &pNodeE );
1527  pNodeC->nRefs++;
1528  }
1529  }
1530 }
int Aig_ObjRecognizeExor(Aig_Obj_t *pObj, Aig_Obj_t **ppFan0, Aig_Obj_t **ppFan1)
Definition: aigUtil.c:343
Definition: aig.h:69
Aig_Obj_t * Aig_ObjRecognizeMux(Aig_Obj_t *pNode, Aig_Obj_t **ppNodeT, Aig_Obj_t **ppNodeE)
Definition: aigUtil.c:387
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
unsigned int nRefs
Definition: aig.h:81
static int Aig_ManNodeNum ( Aig_Man_t p)
inlinestatic

Definition at line 256 of file aig.h.

256 { return p->nObjs[AIG_OBJ_AND]+p->nObjs[AIG_OBJ_EXOR]; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t* Aig_ManObj ( Aig_Man_t p,
int  i 
)
inlinestatic

Definition at line 270 of file aig.h.

270 { return p->vObjs ? (Aig_Obj_t *)Vec_PtrEntry(p->vObjs, i) : NULL; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Definition: aig.h:69
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Aig_ManObjNum ( Aig_Man_t p)
inlinestatic

Definition at line 258 of file aig.h.

258 { return Vec_PtrSize(p->vObjs) - p->nDeleted; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static int Aig_ManObjNumMax ( Aig_Man_t p)
inlinestatic

Definition at line 259 of file aig.h.

259 { return Vec_PtrSize(p->vObjs); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Vec_Ptr_t* Aig_ManOrderPios ( Aig_Man_t p,
Aig_Man_t pOrder 
)

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

Synopsis [Duplicates the AIG manager.]

Description [This duplicator works for AIGs with choices.]

SideEffects []

SeeAlso []

Definition at line 626 of file aigDup.c.

627 {
628  Vec_Ptr_t * vPios;
629  Aig_Obj_t * pObj;
630  int i;
631  assert( Aig_ManCiNum(p) == Aig_ManCiNum(pOrder) );
632  assert( Aig_ManCoNum(p) == Aig_ManCoNum(pOrder) );
633  Aig_ManSetCioIds( pOrder );
634  vPios = Vec_PtrAlloc( Aig_ManCiNum(p) + Aig_ManCoNum(p) );
635  Aig_ManForEachObj( pOrder, pObj, i )
636  {
637  if ( Aig_ObjIsCi(pObj) )
638  Vec_PtrPush( vPios, Aig_ManCi(p, Aig_ObjCioId(pObj)) );
639  else if ( Aig_ObjIsCo(pObj) )
640  Vec_PtrPush( vPios, Aig_ManCo(p, Aig_ObjCioId(pObj)) );
641  }
642  Aig_ManCleanCioIds( pOrder );
643  return vPios;
644 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
static Aig_Obj_t * Aig_ManCi(Aig_Man_t *p, int i)
Definition: aig.h:266
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
Definition: aig.h:69
void Aig_ManSetCioIds(Aig_Man_t *p)
Definition: aigUtil.c:965
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
Definition: aig.h:267
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
void Aig_ManCleanCioIds(Aig_Man_t *p)
Definition: aigUtil.c:986
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
static int Aig_ObjCioId(Aig_Obj_t *pObj)
Definition: aig.h:285
void Aig_ManOrderStart ( Aig_Man_t p)

DECLARATIONS ///.

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

FileName [aigOrder.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [AIG package.]

Synopsis [Dynamically updated topological order.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Initializes the order datastructure.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file aigOrder.c.

46 {
47  Aig_Obj_t * pObj;
48  int i;
49  assert( Aig_ManBufNum(p) == 0 );
50  // allocate order datastructure
51  assert( p->pOrderData == NULL );
52  p->nOrderAlloc = 2 * Aig_ManObjNumMax(p);
53  if ( p->nOrderAlloc < (1<<12) )
54  p->nOrderAlloc = (1<<12);
55  p->pOrderData = ABC_ALLOC( unsigned, 2 * p->nOrderAlloc );
56  memset( p->pOrderData, 0xFF, sizeof(unsigned) * 2 * p->nOrderAlloc );
57  // add the constant node
58  p->pOrderData[0] = p->pOrderData[1] = 0;
59  p->iPrev = p->iNext = 0;
60  // add the internal nodes
61  Aig_ManForEachNode( p, pObj, i )
62  Aig_ObjOrderInsert( p, pObj->Id );
63 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static int Aig_ManBufNum(Aig_Man_t *p)
Definition: aig.h:253
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
Definition: aig.h:69
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
#define assert(ex)
Definition: util_old.h:213
void Aig_ObjOrderInsert(Aig_Man_t *p, int ObjId)
Definition: aigOrder.c:95
void Aig_ManOrderStop ( Aig_Man_t p)

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

Synopsis [Deletes the order datastructure.]

Description []

SideEffects []

SeeAlso []

Definition at line 76 of file aigOrder.c.

77 {
78  assert( p->pOrderData );
79  ABC_FREE( p->pOrderData );
80  p->nOrderAlloc = 0;
81  p->iPrev = p->iNext = 0;
82 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define assert(ex)
Definition: util_old.h:213
void Aig_ManPartDivide ( Vec_Ptr_t vResult,
Vec_Int_t vDomain,
int  nPartSize,
int  nOverSize 
)

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

Synopsis [Divides a large partition into several ones.]

Description []

SideEffects []

SeeAlso []

Definition at line 513 of file aigPartReg.c.

514 {
515  Vec_Int_t * vPart;
516  int i, Counter;
517  assert( nPartSize && Vec_IntSize(vDomain) > nPartSize );
518  if ( nOverSize >= nPartSize )
519  {
520  printf( "Overlap size (%d) is more or equal than the partition size (%d).\n", nOverSize, nPartSize );
521  printf( "Adjusting it to be equal to half of the partition size.\n" );
522  nOverSize = nPartSize/2;
523  }
524  assert( nOverSize < nPartSize );
525  for ( Counter = 0; Counter < Vec_IntSize(vDomain); Counter -= nOverSize )
526  {
527  vPart = Vec_IntAlloc( nPartSize );
528  for ( i = 0; i < nPartSize; i++, Counter++ )
529  if ( Counter < Vec_IntSize(vDomain) )
530  Vec_IntPush( vPart, Vec_IntEntry(vDomain, Counter) );
531  if ( Vec_IntSize(vPart) <= nOverSize )
532  Vec_IntFree(vPart);
533  else
534  Vec_PtrPush( vResult, vPart );
535  }
536 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Counter
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Vec_Ptr_t* Aig_ManPartitionNaive ( Aig_Man_t p,
int  nPartSize 
)

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

Synopsis [Perform the naive partitioning.]

Description []

SideEffects []

SeeAlso []

Definition at line 941 of file aigPart.c.

942 {
943  Vec_Ptr_t * vParts;
944  Aig_Obj_t * pObj;
945  int nParts, i;
946  nParts = (Aig_ManCoNum(p) / nPartSize) + ((Aig_ManCoNum(p) % nPartSize) > 0);
947  vParts = (Vec_Ptr_t *)Vec_VecStart( nParts );
948  Aig_ManForEachCo( p, pObj, i )
949  Vec_IntPush( (Vec_Int_t *)Vec_PtrEntry(vParts, i / nPartSize), i );
950  return vParts;
951 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
Definition: aig.h:69
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static Vec_Vec_t * Vec_VecStart(int nSize)
Definition: vecVec.h:168
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
Vec_Ptr_t* Aig_ManPartitionSmart ( Aig_Man_t p,
int  nSuppSizeLimit,
int  fVerbose,
Vec_Ptr_t **  pvPartSupps 
)

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

Synopsis [Perform the smart partitioning.]

Description []

SideEffects []

SeeAlso []

Definition at line 686 of file aigPart.c.

687 {
688  Vec_Ptr_t * vPartSuppsBit;
689  Vec_Ptr_t * vSupports, * vPartsAll, * vPartsAll2, * vPartSuppsAll;//, * vPartPtr;
690  Vec_Int_t * vOne, * vPart, * vPartSupp, * vTemp;
691  int i, iPart, iOut;
692  abctime clk;
693 
694  // compute the supports for all outputs
695 clk = Abc_Clock();
696  vSupports = Aig_ManSupports( p );
697 if ( fVerbose )
698 {
699 ABC_PRT( "Supps", Abc_Clock() - clk );
700 }
701  // start char-based support representation
702  vPartSuppsBit = Vec_PtrAlloc( 1000 );
703 
704  // create partitions
705 clk = Abc_Clock();
706  vPartsAll = Vec_PtrAlloc( 256 );
707  vPartSuppsAll = Vec_PtrAlloc( 256 );
708  Vec_PtrForEachEntry( Vec_Int_t *, vSupports, vOne, i )
709  {
710  // get the output number
711  iOut = Vec_IntPop(vOne);
712  // find closely matching part
713  iPart = Aig_ManPartitionSmartFindPart( vPartSuppsAll, vPartsAll, vPartSuppsBit, nSuppSizeLimit, vOne );
714  if ( iPart == -1 )
715  {
716  // create new partition
717  vPart = Vec_IntAlloc( 32 );
718  Vec_IntPush( vPart, iOut );
719  // create new partition support
720  vPartSupp = Vec_IntDup( vOne );
721  // add this partition and its support
722  Vec_PtrPush( vPartsAll, vPart );
723  Vec_PtrPush( vPartSuppsAll, vPartSupp );
724 
725  Vec_PtrPush( vPartSuppsBit, Aig_ManSuppCharStart(vOne, Aig_ManCiNum(p)) );
726  }
727  else
728  {
729  // add output to this partition
730  vPart = (Vec_Int_t *)Vec_PtrEntry( vPartsAll, iPart );
731  Vec_IntPush( vPart, iOut );
732  // merge supports
733  vPartSupp = (Vec_Int_t *)Vec_PtrEntry( vPartSuppsAll, iPart );
734  vPartSupp = Vec_IntTwoMerge( vTemp = vPartSupp, vOne );
735  Vec_IntFree( vTemp );
736  // reinsert new support
737  Vec_PtrWriteEntry( vPartSuppsAll, iPart, vPartSupp );
738 
739  Aig_ManSuppCharAdd( (unsigned *)Vec_PtrEntry(vPartSuppsBit, iPart), vOne, Aig_ManCiNum(p) );
740  }
741  }
742 
743  // stop char-based support representation
744  Vec_PtrForEachEntry( Vec_Int_t *, vPartSuppsBit, vTemp, i )
745  ABC_FREE( vTemp );
746  Vec_PtrFree( vPartSuppsBit );
747 
748 //printf( "\n" );
749 if ( fVerbose )
750 {
751 ABC_PRT( "Parts", Abc_Clock() - clk );
752 }
753 
754 clk = Abc_Clock();
755  // reorder partitions in the decreasing order of support sizes
756  // remember partition number in each partition support
757  Vec_PtrForEachEntry( Vec_Int_t *, vPartSuppsAll, vOne, i )
758  Vec_IntPush( vOne, i );
759  // sort the supports in the decreasing order
760  Vec_VecSort( (Vec_Vec_t *)vPartSuppsAll, 1 );
761  // reproduce partitions
762  vPartsAll2 = Vec_PtrAlloc( 256 );
763  Vec_PtrForEachEntry( Vec_Int_t *, vPartSuppsAll, vOne, i )
764  Vec_PtrPush( vPartsAll2, Vec_PtrEntry(vPartsAll, Vec_IntPop(vOne)) );
765  Vec_PtrFree( vPartsAll );
766  vPartsAll = vPartsAll2;
767 
768  // compact small partitions
769 // Aig_ManPartitionPrint( p, vPartsAll, vPartSuppsAll );
770  Aig_ManPartitionCompact( vPartsAll, vPartSuppsAll, nSuppSizeLimit );
771  if ( fVerbose )
772 // Aig_ManPartitionPrint( p, vPartsAll, vPartSuppsAll );
773  printf( "Created %d partitions.\n", Vec_PtrSize(vPartsAll) );
774 
775 if ( fVerbose )
776 {
777 //ABC_PRT( "Comps", Abc_Clock() - clk );
778 }
779 
780  // cleanup
781  Vec_VecFree( (Vec_Vec_t *)vSupports );
782  if ( pvPartSupps == NULL )
783  Vec_VecFree( (Vec_Vec_t *)vPartSuppsAll );
784  else
785  *pvPartSupps = vPartSuppsAll;
786 /*
787  // converts from intergers to nodes
788  Vec_PtrForEachEntry( Vec_Int_t *, vPartsAll, vPart, iPart )
789  {
790  vPartPtr = Vec_PtrAlloc( Vec_IntSize(vPart) );
791  Vec_IntForEachEntry( vPart, iOut, i )
792  Vec_PtrPush( vPartPtr, Aig_ManCo(p, iOut) );
793  Vec_IntFree( vPart );
794  Vec_PtrWriteEntry( vPartsAll, iPart, vPartPtr );
795  }
796 */
797  return vPartsAll;
798 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static void Vec_VecSort(Vec_Vec_t *p, int fReverse)
Definition: vecVec.h:546
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
unsigned * Aig_ManSuppCharStart(Vec_Int_t *vOne, int nPis)
Definition: aigPart.c:470
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
void Aig_ManSuppCharAdd(unsigned *pBuffer, Vec_Int_t *vOne, int nPis)
Definition: aigPart.c:496
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void Vec_VecFree(Vec_Vec_t *p)
Definition: vecVec.h:347
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
if(last==0)
Definition: sparse_int.h:34
static int Vec_IntPop(Vec_Int_t *p)
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static Vec_Int_t * Vec_IntTwoMerge(Vec_Int_t *vArr1, Vec_Int_t *vArr2)
Definition: vecInt.h:1684
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define ABC_PRT(a, t)
Definition: abc_global.h:220
int Aig_ManPartitionSmartFindPart(Vec_Ptr_t *vPartSuppsAll, Vec_Ptr_t *vPartsAll, Vec_Ptr_t *vPartSuppsBit, int nSuppSizeLimit, Vec_Int_t *vOne)
Definition: aigPart.c:536
void Aig_ManPartitionCompact(Vec_Ptr_t *vPartsAll, Vec_Ptr_t *vPartSuppsAll, int nSuppSizeLimit)
Definition: aigPart.c:614
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
ABC_INT64_T abctime
Definition: abc_global.h:278
Vec_Ptr_t * Aig_ManSupports(Aig_Man_t *pMan)
Definition: aigPart.c:273
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Vec_Ptr_t* Aig_ManPartitionSmartRegisters ( Aig_Man_t pAig,
int  nSuppSizeLimit,
int  fVerbose 
)

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

Synopsis [Perform the smart partitioning.]

Description []

SideEffects []

SeeAlso []

Definition at line 811 of file aigPart.c.

812 {
813  Vec_Ptr_t * vPartSuppsBit;
814  Vec_Ptr_t * vSupports, * vPartsAll, * vPartsAll2, * vPartSuppsAll;
815  Vec_Int_t * vOne, * vPart, * vPartSupp, * vTemp;
816  int i, iPart, iOut;
817  abctime clk;
818 
819  // add output number to each
820 clk = Abc_Clock();
821  vSupports = Aig_ManSupportsRegisters( pAig );
822  assert( Vec_PtrSize(vSupports) == Aig_ManRegNum(pAig) );
823  Vec_PtrForEachEntry( Vec_Int_t *, vSupports, vOne, i )
824  Vec_IntPush( vOne, i );
825 if ( fVerbose )
826 {
827 ABC_PRT( "Supps", Abc_Clock() - clk );
828 }
829 
830  // start char-based support representation
831  vPartSuppsBit = Vec_PtrAlloc( 1000 );
832 
833  // create partitions
834 clk = Abc_Clock();
835  vPartsAll = Vec_PtrAlloc( 256 );
836  vPartSuppsAll = Vec_PtrAlloc( 256 );
837  Vec_PtrForEachEntry( Vec_Int_t *, vSupports, vOne, i )
838  {
839  // get the output number
840  iOut = Vec_IntPop(vOne);
841  // find closely matching part
842  iPart = Aig_ManPartitionSmartFindPart( vPartSuppsAll, vPartsAll, vPartSuppsBit, nSuppSizeLimit, vOne );
843  if ( iPart == -1 )
844  {
845  // create new partition
846  vPart = Vec_IntAlloc( 32 );
847  Vec_IntPush( vPart, iOut );
848  // create new partition support
849  vPartSupp = Vec_IntDup( vOne );
850  // add this partition and its support
851  Vec_PtrPush( vPartsAll, vPart );
852  Vec_PtrPush( vPartSuppsAll, vPartSupp );
853 
854  Vec_PtrPush( vPartSuppsBit, Aig_ManSuppCharStart(vOne, Vec_PtrSize(vSupports)) );
855  }
856  else
857  {
858  // add output to this partition
859  vPart = (Vec_Int_t *)Vec_PtrEntry( vPartsAll, iPart );
860  Vec_IntPush( vPart, iOut );
861  // merge supports
862  vPartSupp = (Vec_Int_t *)Vec_PtrEntry( vPartSuppsAll, iPart );
863  vPartSupp = Vec_IntTwoMerge( vTemp = vPartSupp, vOne );
864  Vec_IntFree( vTemp );
865  // reinsert new support
866  Vec_PtrWriteEntry( vPartSuppsAll, iPart, vPartSupp );
867 
868  Aig_ManSuppCharAdd( (unsigned *)Vec_PtrEntry(vPartSuppsBit, iPart), vOne, Vec_PtrSize(vSupports) );
869  }
870  }
871 
872  // stop char-based support representation
873  Vec_PtrForEachEntry( Vec_Int_t *, vPartSuppsBit, vTemp, i )
874  ABC_FREE( vTemp );
875  Vec_PtrFree( vPartSuppsBit );
876 
877 //printf( "\n" );
878 if ( fVerbose )
879 {
880 ABC_PRT( "Parts", Abc_Clock() - clk );
881 }
882 
883 clk = Abc_Clock();
884  // reorder partitions in the decreasing order of support sizes
885  // remember partition number in each partition support
886  Vec_PtrForEachEntry( Vec_Int_t *, vPartSuppsAll, vOne, i )
887  Vec_IntPush( vOne, i );
888  // sort the supports in the decreasing order
889  Vec_VecSort( (Vec_Vec_t *)vPartSuppsAll, 1 );
890  // reproduce partitions
891  vPartsAll2 = Vec_PtrAlloc( 256 );
892  Vec_PtrForEachEntry( Vec_Int_t *, vPartSuppsAll, vOne, i )
893  Vec_PtrPush( vPartsAll2, Vec_PtrEntry(vPartsAll, Vec_IntPop(vOne)) );
894  Vec_PtrFree( vPartsAll );
895  vPartsAll = vPartsAll2;
896 
897  // compact small partitions
898 // Aig_ManPartitionPrint( p, vPartsAll, vPartSuppsAll );
899  Aig_ManPartitionCompact( vPartsAll, vPartSuppsAll, nSuppSizeLimit );
900  if ( fVerbose )
901 // Aig_ManPartitionPrint( p, vPartsAll, vPartSuppsAll );
902  printf( "Created %d partitions.\n", Vec_PtrSize(vPartsAll) );
903 
904 if ( fVerbose )
905 {
906 //ABC_PRT( "Comps", Abc_Clock() - clk );
907 }
908 
909  // cleanup
910  Vec_VecFree( (Vec_Vec_t *)vSupports );
911 // if ( pvPartSupps == NULL )
912  Vec_VecFree( (Vec_Vec_t *)vPartSuppsAll );
913 // else
914 // *pvPartSupps = vPartSuppsAll;
915 
916 /*
917  // converts from intergers to nodes
918  Vec_PtrForEachEntry( Vec_Int_t *, vPartsAll, vPart, iPart )
919  {
920  vPartPtr = Vec_PtrAlloc( Vec_IntSize(vPart) );
921  Vec_IntForEachEntry( vPart, iOut, i )
922  Vec_PtrPush( vPartPtr, Aig_ManCo(p, iOut) );
923  Vec_IntFree( vPart );
924  Vec_PtrWriteEntry( vPartsAll, iPart, vPartPtr );
925  }
926 */
927  return vPartsAll;
928 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static void Vec_VecSort(Vec_Vec_t *p, int fReverse)
Definition: vecVec.h:546
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
unsigned * Aig_ManSuppCharStart(Vec_Int_t *vOne, int nPis)
Definition: aigPart.c:470
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
Vec_Ptr_t * Aig_ManSupportsRegisters(Aig_Man_t *p)
Definition: aigPart.c:418
void Aig_ManSuppCharAdd(unsigned *pBuffer, Vec_Int_t *vOne, int nPis)
Definition: aigPart.c:496
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void Vec_VecFree(Vec_Vec_t *p)
Definition: vecVec.h:347
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
if(last==0)
Definition: sparse_int.h:34
static int Vec_IntPop(Vec_Int_t *p)
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static Vec_Int_t * Vec_IntTwoMerge(Vec_Int_t *vArr1, Vec_Int_t *vArr2)
Definition: vecInt.h:1684
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define ABC_PRT(a, t)
Definition: abc_global.h:220
#define assert(ex)
Definition: util_old.h:213
int Aig_ManPartitionSmartFindPart(Vec_Ptr_t *vPartSuppsAll, Vec_Ptr_t *vPartsAll, Vec_Ptr_t *vPartSuppsBit, int nSuppSizeLimit, Vec_Int_t *vOne)
Definition: aigPart.c:536
void Aig_ManPartitionCompact(Vec_Ptr_t *vPartsAll, Vec_Ptr_t *vPartSuppsAll, int nSuppSizeLimit)
Definition: aigPart.c:614
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
ABC_INT64_T abctime
Definition: abc_global.h:278
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Aig_ManPrintStats ( Aig_Man_t p)

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

Synopsis [Stops the AIG manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 379 of file aigMan.c.

380 {
381  int nChoices = Aig_ManChoiceNum(p);
382  printf( "%-15s : ", p->pName );
383  printf( "pi = %5d ", Aig_ManCiNum(p)-Aig_ManRegNum(p) );
384  printf( "po = %5d ", Aig_ManCoNum(p)-Aig_ManRegNum(p) );
385  if ( Aig_ManRegNum(p) )
386  printf( "lat = %5d ", Aig_ManRegNum(p) );
387  printf( "and = %7d ", Aig_ManAndNum(p) );
388 // printf( "Eq = %7d ", Aig_ManHaigCounter(p) );
389  if ( Aig_ManExorNum(p) )
390  printf( "xor = %5d ", Aig_ManExorNum(p) );
391  if ( nChoices )
392  printf( "ch = %5d ", nChoices );
393  if ( Aig_ManBufNum(p) )
394  printf( "buf = %5d ", Aig_ManBufNum(p) );
395 // printf( "Cre = %6d ", p->nCreated );
396 // printf( "Del = %6d ", p->nDeleted );
397 // printf( "Lev = %3d ", Aig_ManLevelNum(p) );
398 // printf( "Max = %7d ", Aig_ManObjNumMax(p) );
399  printf( "lev = %3d", Aig_ManLevels(p) );
400  printf( "\n" );
401  fflush( stdout );
402 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ManBufNum(Aig_Man_t *p)
Definition: aig.h:253
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
int Aig_ManChoiceNum(Aig_Man_t *p)
Definition: aigUtil.c:1007
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static int Aig_ManAndNum(Aig_Man_t *p)
Definition: aig.h:254
static int Aig_ManExorNum(Aig_Man_t *p)
Definition: aig.h:255
int Aig_ManLevels(Aig_Man_t *p)
Definition: aigUtil.c:102
void Aig_ManPrintVerbose ( Aig_Man_t p,
int  fHaig 
)

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

Synopsis [Prints node in HAIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 685 of file aigUtil.c.

686 {
687  Vec_Ptr_t * vNodes;
688  Aig_Obj_t * pObj;
689  int i;
690  printf( "PIs: " );
691  Aig_ManForEachCi( p, pObj, i )
692  printf( " %p", pObj );
693  printf( "\n" );
694  vNodes = Aig_ManDfs( p, 0 );
695  Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
696  Aig_ObjPrintVerbose( pObj, fHaig ), printf( "\n" );
697  printf( "\n" );
698  Vec_PtrFree( vNodes );
699 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
void Aig_ObjPrintVerbose(Aig_Obj_t *pObj, int fHaig)
Definition: aigUtil.c:653
Vec_Ptr_t * Aig_ManDfs(Aig_Man_t *p, int fNodesOnly)
Definition: aigDfs.c:145
Definition: aig.h:69
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
unsigned Aig_ManRandom ( int  fReset)

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

Synopsis [Creates a sequence of random numbers.]

Description []

SideEffects []

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

Definition at line 1157 of file aigUtil.c.

1158 {
1159  static unsigned int m_z = NUMBER1;
1160  static unsigned int m_w = NUMBER2;
1161  if ( fReset )
1162  {
1163  m_z = NUMBER1;
1164  m_w = NUMBER2;
1165  }
1166  m_z = 36969 * (m_z & 65535) + (m_z >> 16);
1167  m_w = 18000 * (m_w & 65535) + (m_w >> 16);
1168  return (m_z << 16) + m_w;
1169 }
#define NUMBER1
Definition: aigUtil.c:1143
#define NUMBER2
Definition: aigUtil.c:1144
word Aig_ManRandom64 ( int  fReset)

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

Synopsis [Creates a sequence of random numbers.]

Description []

SideEffects []

SeeAlso []

Definition at line 1182 of file aigUtil.c.

1183 {
1184  word Res = (word)Aig_ManRandom(fReset);
1185  return Res | ((word)Aig_ManRandom(0) << 32);
1186 }
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
unsigned Aig_ManRandom(int fReset)
GLOBAL VARIABLES ///.
Definition: aigUtil.c:1157
void Aig_ManRandomInfo ( Vec_Ptr_t vInfo,
int  iInputStart,
int  iWordStart,
int  iWordStop 
)

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

Synopsis [Creates random info for the primary inputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 1200 of file aigUtil.c.

1201 {
1202  unsigned * pInfo;
1203  int i, w;
1204  Vec_PtrForEachEntryStart( unsigned *, vInfo, pInfo, i, iInputStart )
1205  for ( w = iWordStart; w < iWordStop; w++ )
1206  pInfo[w] = Aig_ManRandom(0);
1207 }
#define Vec_PtrForEachEntryStart(Type, vVec, pEntry, i, Start)
Definition: vecPtr.h:57
for(p=first;p->value< newval;p=p->next)
unsigned Aig_ManRandom(int fReset)
GLOBAL VARIABLES ///.
Definition: aigUtil.c:1157
static void Aig_ManRecycleMemory ( Aig_Man_t p,
Aig_Obj_t pEntry 
)
inlinestatic

Definition at line 378 of file aig.h.

379 {
380  extern void Aig_MmFixedEntryRecycle( Aig_MmFixed_t * p, char * pEntry );
381  assert( pEntry->nRefs == 0 );
382  pEntry->Type = AIG_OBJ_NONE; // distinquishes a dead node from a live node
383  Aig_MmFixedEntryRecycle( p->pMemObjs, (char *)pEntry );
384  p->nDeleted++;
385 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
unsigned int Type
Definition: aig.h:77
void Aig_MmFixedEntryRecycle(Aig_MmFixed_t *p, char *pEntry)
Definition: aigMem.c:212
DECLARATIONS ///.
Definition: aigMem.c:30
#define assert(ex)
Definition: util_old.h:213
unsigned int nRefs
Definition: aig.h:81
Aig_Man_t* Aig_ManReduceLaches ( Aig_Man_t p,
int  fVerbose 
)

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

Synopsis [Reduces the latches.]

Description []

SideEffects []

SeeAlso []

Definition at line 455 of file aigScl.c.

456 {
457  Aig_Man_t * pTemp;
458  Vec_Ptr_t * vMap;
459  int nSaved, nCur;
460  if ( fVerbose )
461  printf( "Performing combinational register sweep:\n" );
462  for ( nSaved = 0; (nCur = Aig_ManReduceLachesCount(p)); nSaved += nCur )
463  {
464 // printf( "Reducible = %d\n", nCur );
465  vMap = Aig_ManReduceLachesOnce( p );
466  p = Aig_ManRemap( pTemp = p, vMap );
467  Vec_PtrFree( vMap );
468  Aig_ManSeqCleanup( p );
469  if ( fVerbose )
470  Aig_ManReportImprovement( pTemp, p );
471  Aig_ManStop( pTemp );
472  if ( p->nRegs == 0 )
473  break;
474  }
475  return p;
476 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
int Aig_ManReduceLachesCount(Aig_Man_t *p)
Definition: aigScl.c:347
Vec_Ptr_t * Aig_ManReduceLachesOnce(Aig_Man_t *p)
Definition: aigScl.c:394
void Aig_ManReportImprovement(Aig_Man_t *p, Aig_Man_t *pNew)
Definition: aigMan.c:415
int Aig_ManSeqCleanup(Aig_Man_t *p)
Definition: aigScl.c:158
ABC_NAMESPACE_IMPL_START Aig_Man_t * Aig_ManRemap(Aig_Man_t *p, Vec_Ptr_t *vMap)
DECLARATIONS ///.
Definition: aigScl.c:46
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Aig_Man_t* Aig_ManRegCreatePart ( Aig_Man_t pAig,
Vec_Int_t vPart,
int *  pnCountPis,
int *  pnCountRegs,
int **  ppMapBack 
)

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

Synopsis [Computes partitioning of registers.]

Description []

SideEffects []

SeeAlso []

Definition at line 308 of file aigPartReg.c.

309 {
310  Aig_Man_t * pNew;
311  Aig_Obj_t * pObj, * pObjNew;
312  Vec_Ptr_t * vNodes;
313  Vec_Ptr_t * vRoots;
314  int nOffset, iOut, i;
315  int nCountPis, nCountRegs;
316  int * pMapBack;
317  // collect roots
318  vRoots = Vec_PtrAlloc( Vec_IntSize(vPart) );
319  nOffset = Aig_ManCoNum(pAig)-Aig_ManRegNum(pAig);
320  Vec_IntForEachEntry( vPart, iOut, i )
321  {
322  pObj = Aig_ManCo(pAig, nOffset+iOut);
323  Vec_PtrPush( vRoots, Aig_ObjFanin0(pObj) );
324  }
325  // collect/mark nodes/PIs in the DFS order
326  vNodes = Aig_ManDfsNodes( pAig, (Aig_Obj_t **)Vec_PtrArray(vRoots), Vec_PtrSize(vRoots) );
327  Vec_PtrFree( vRoots );
328  // unmark register outputs
329  nOffset = Aig_ManCiNum(pAig)-Aig_ManRegNum(pAig);
330  Vec_IntForEachEntry( vPart, iOut, i )
331  {
332  pObj = Aig_ManCi(pAig, nOffset+iOut);
333  Aig_ObjSetTravIdPrevious( pAig, pObj );
334  }
335  // count pure PIs
336  nCountPis = nCountRegs = 0;
337  Aig_ManForEachPiSeq( pAig, pObj, i )
338  nCountPis += Aig_ObjIsTravIdCurrent(pAig, pObj);
339  // count outputs of other registers
340  Aig_ManForEachLoSeq( pAig, pObj, i )
341  nCountRegs += Aig_ObjIsTravIdCurrent(pAig, pObj);
342  if ( pnCountPis )
343  *pnCountPis = nCountPis;
344  if ( pnCountRegs )
345  *pnCountRegs = nCountRegs;
346  // create the new manager
347  pNew = Aig_ManStart( Vec_PtrSize(vNodes) );
348  Aig_ManConst1(pAig)->pData = Aig_ManConst1(pNew);
349  // create the PIs
350  Aig_ManForEachCi( pAig, pObj, i )
351  if ( Aig_ObjIsTravIdCurrent(pAig, pObj) )
352  pObj->pData = Aig_ObjCreateCi(pNew);
353  // add variables for the register outputs
354  // create fake POs to hold the register outputs
355  nOffset = Aig_ManCiNum(pAig)-Aig_ManRegNum(pAig);
356  Vec_IntForEachEntry( vPart, iOut, i )
357  {
358  pObj = Aig_ManCi(pAig, nOffset+iOut);
359  pObj->pData = Aig_ObjCreateCi(pNew);
360  Aig_ObjCreateCo( pNew, (Aig_Obj_t *)pObj->pData );
361  Aig_ObjSetTravIdCurrent( pAig, pObj ); // added
362  }
363  // create the nodes
364  Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
365  if ( Aig_ObjIsNode(pObj) )
366  pObj->pData = Aig_And(pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
367  // add real POs for the registers
368  nOffset = Aig_ManCoNum(pAig)-Aig_ManRegNum(pAig);
369  Vec_IntForEachEntry( vPart, iOut, i )
370  {
371  pObj = Aig_ManCo( pAig, nOffset+iOut );
372  Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
373  }
374  pNew->nRegs = Vec_IntSize(vPart);
375  // create map
376  if ( ppMapBack )
377  {
378  pMapBack = ABC_ALLOC( int, Aig_ManObjNumMax(pNew) );
379  memset( pMapBack, 0xff, sizeof(int) * Aig_ManObjNumMax(pNew) );
380  // map constant nodes
381  pMapBack[0] = 0;
382  // logic cones of register outputs
383  Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
384  {
385  pObjNew = Aig_Regular((Aig_Obj_t *)pObj->pData);
386  pMapBack[pObjNew->Id] = pObj->Id;
387  }
388  // map register outputs
389  nOffset = Aig_ManCiNum(pAig)-Aig_ManRegNum(pAig);
390  Vec_IntForEachEntry( vPart, iOut, i )
391  {
392  pObj = Aig_ManCi(pAig, nOffset+iOut);
393  pObjNew = (Aig_Obj_t *)pObj->pData;
394  pMapBack[pObjNew->Id] = pObj->Id;
395  }
396  *ppMapBack = pMapBack;
397  }
398  Vec_PtrFree( vNodes );
399  return pNew;
400 }
char * memset()
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
void * pData
Definition: aig.h:87
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
static Aig_Obj_t * Aig_ManCi(Aig_Man_t *p, int i)
Definition: aig.h:266
Vec_Ptr_t * Aig_ManDfsNodes(Aig_Man_t *p, Aig_Obj_t **ppNodes, int nNodes)
Definition: aigDfs.c:333
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
if(last==0)
Definition: sparse_int.h:34
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
Definition: aig.h:69
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static void Aig_ObjSetTravIdPrevious(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:294
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
Definition: aig.h:267
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define Aig_ManForEachLoSeq(p, pObj, i)
Definition: aig.h:441
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
int Id
Definition: aig.h:85
static void ** Vec_PtrArray(Vec_Ptr_t *p)
Definition: vecPtr.h:279
#define Aig_ManForEachPiSeq(p, pObj, i)
SEQUENTIAL ITERATORS ///.
Definition: aig.h:438
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
static int Aig_ManRegNum ( Aig_Man_t p)
inlinestatic

Definition at line 260 of file aig.h.

260 { return p->nRegs; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Vec_Ptr_t* Aig_ManRegPartitionSimple ( Aig_Man_t pAig,
int  nPartSize,
int  nOverSize 
)

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

Synopsis [Computes partitioning of registers.]

Description []

SideEffects []

SeeAlso []

Definition at line 474 of file aigPartReg.c.

475 {
476  Vec_Ptr_t * vResult;
477  Vec_Int_t * vPart;
478  int i, Counter;
479  if ( nOverSize >= nPartSize )
480  {
481  printf( "Overlap size (%d) is more or equal than the partition size (%d).\n", nOverSize, nPartSize );
482  printf( "Adjusting it to be equal to half of the partition size.\n" );
483  nOverSize = nPartSize/2;
484  }
485  assert( nOverSize < nPartSize );
486  vResult = Vec_PtrAlloc( 100 );
487  for ( Counter = 0; Counter < Aig_ManRegNum(pAig); Counter -= nOverSize )
488  {
489  vPart = Vec_IntAlloc( nPartSize );
490  for ( i = 0; i < nPartSize; i++, Counter++ )
491  if ( Counter < Aig_ManRegNum(pAig) )
492  Vec_IntPush( vPart, Counter );
493  if ( Vec_IntSize(vPart) <= nOverSize )
494  Vec_IntFree(vPart);
495  else
496  Vec_PtrPush( vResult, vPart );
497  }
498  return vResult;
499 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Counter
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Vec_Ptr_t* Aig_ManRegPartitionSmart ( Aig_Man_t pAig,
int  nPartSize 
)

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

Synopsis [Computes partitioning of registers.]

Description []

SideEffects []

SeeAlso []

Definition at line 413 of file aigPartReg.c.

414 {
415  extern void Ioa_WriteAiger( Aig_Man_t * pMan, char * pFileName, int fWriteSymbols, int fCompact );
416 
417  Aig_ManPre_t * p;
418  Vec_Ptr_t * vResult;
419  int iSeed, iNext, i, k;
420  // create the manager
421  p = Aig_ManRegManStart( pAig, nPartSize );
422  // add partitions as long as registers remain
423  for ( i = 0; (iSeed = Aig_ManRegFindSeed(p)) >= 0; i++ )
424  {
425 //printf( "Seed variable = %d.\n", iSeed );
426  // clean the current partition information
427  Vec_IntClear( p->vRegs );
428  Vec_IntClear( p->vUniques );
429  Vec_IntClear( p->vFreeVars );
430  Vec_FltClear( p->vPartCost );
431  memset( p->pfPartVars, 0, sizeof(char) * Aig_ManRegNum(p->pAig) );
432  // add the register and its partition support
433  Aig_ManRegPartitionAdd( p, iSeed );
434  // select the best var to add
435  for ( k = 0; Vec_IntSize(p->vRegs) < p->nRegsMax; k++ )
436  {
437  // get the next best variable
438  iNext = Aig_ManRegFindBestVar( p );
439  if ( iNext == -1 )
440  break;
441  // add the register to the support of the partition
442  Aig_ManRegPartitionAdd( p, iNext );
443  // report the result
444 //printf( "Part %3d Reg %3d : Free = %4d. Total = %4d. Ratio = %6.2f. Unique = %4d.\n", i, k,
445 // Vec_IntSize(p->vFreeVars), Vec_IntSize(p->vRegs),
446 // 1.0*Vec_IntSize(p->vFreeVars)/Vec_IntSize(p->vRegs), Vec_IntSize(p->vUniques) );
447  // quit if there are not free variables
448  if ( Vec_IntSize(p->vFreeVars) == 0 )
449  break;
450  }
451  // add this partition to the set
452  Vec_PtrPush( p->vParts, Vec_IntDup(p->vRegs) );
453 printf( "Part %3d SUMMARY: Free = %4d. Total = %4d. Ratio = %6.2f. Unique = %4d.\n", i,
454  Vec_IntSize(p->vFreeVars), Vec_IntSize(p->vRegs),
455  1.0*Vec_IntSize(p->vFreeVars)/Vec_IntSize(p->vRegs), Vec_IntSize(p->vUniques) );
456 //printf( "\n" );
457  }
458  vResult = p->vParts; p->vParts = NULL;
459  Aig_ManRegManStop( p );
460  return vResult;
461 }
char * memset()
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
Aig_ManPre_t * Aig_ManRegManStart(Aig_Man_t *pAig, int nPartSize)
FUNCTION DEFINITIONS ///.
Definition: aigPartReg.c:66
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
int Aig_ManRegFindBestVar(Aig_ManPre_t *p)
Definition: aigPartReg.c:156
static void Vec_FltClear(Vec_Flt_t *p)
Definition: vecFlt.h:512
void Aig_ManRegPartitionAdd(Aig_ManPre_t *p, int iReg)
Definition: aigPartReg.c:200
void Ioa_WriteAiger(Aig_Man_t *pMan, char *pFileName, int fWriteSymbols, int fCompact)
Definition: ioaWriteAig.c:446
void Aig_ManRegManStop(Aig_ManPre_t *p)
Definition: aigPartReg.c:96
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
typedefABC_NAMESPACE_IMPL_START struct Aig_ManPre_t_ Aig_ManPre_t
DECLARATIONS ///.
Definition: aigPartReg.c:31
int Aig_ManRegFindSeed(Aig_ManPre_t *p)
Definition: aigPartReg.c:122
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
Vec_Ptr_t* Aig_ManRegProjectOnehots ( Aig_Man_t pAig,
Aig_Man_t pPart,
Vec_Ptr_t vOnehots,
int  fVerbose 
)

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

Synopsis [Creates projection of 1-hot registers onto the given partition.]

Description [Assumes that the relevant register outputs are labeled with the current traversal ID.]

SideEffects []

SeeAlso []

Definition at line 248 of file aigPartReg.c.

249 {
250  Vec_Ptr_t * vOnehotsPart = NULL;
251  Vec_Int_t * vGroup, * vGroupNew;
252  Aig_Obj_t * pObj, * pObjNew;
253  int nOffset, iReg, i, k;
254  // set the PI numbers
255  Aig_ManForEachCi( pPart, pObj, i )
256  pObj->iData = i;
257  // go through each group and check if registers are involved in this one
258  nOffset = Aig_ManCiNum(pAig)-Aig_ManRegNum(pAig);
259  Vec_PtrForEachEntry( Vec_Int_t *, vOnehots, vGroup, i )
260  {
261  vGroupNew = NULL;
262  Vec_IntForEachEntry( vGroup, iReg, k )
263  {
264  pObj = Aig_ManCi( pAig, nOffset+iReg );
265  if ( !Aig_ObjIsTravIdCurrent(pAig, pObj) )
266  continue;
267  if ( vGroupNew == NULL )
268  vGroupNew = Vec_IntAlloc( Vec_IntSize(vGroup) );
269  pObjNew = (Aig_Obj_t *)pObj->pData;
270  Vec_IntPush( vGroupNew, pObjNew->iData );
271  }
272  if ( vGroupNew == NULL )
273  continue;
274  if ( Vec_IntSize(vGroupNew) > 1 )
275  {
276  if ( vOnehotsPart == NULL )
277  vOnehotsPart = Vec_PtrAlloc( 100 );
278  Vec_PtrPush( vOnehotsPart, vGroupNew );
279  }
280  else
281  Vec_IntFree( vGroupNew );
282  }
283  // clear the PI numbers
284  Aig_ManForEachCi( pPart, pObj, i )
285  pObj->iData = 0;
286  // print out
287  if ( vOnehotsPart && fVerbose )
288  {
289  printf( "Partition contains %d groups of 1-hot registers: { ", Vec_PtrSize(vOnehotsPart) );
290  Vec_PtrForEachEntry( Vec_Int_t *, vOnehotsPart, vGroup, k )
291  printf( "%d ", Vec_IntSize(vGroup) );
292  printf( "}\n" );
293  }
294  return vOnehotsPart;
295 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
void * pData
Definition: aig.h:87
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static Aig_Obj_t * Aig_ManCi(Aig_Man_t *p, int i)
Definition: aig.h:266
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
int iData
Definition: aig.h:88
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
Aig_Man_t* Aig_ManRehash ( Aig_Man_t p)

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

Synopsis [Iteratively rehashes the AIG.]

Description [The input AIG is assumed to have representatives assigned.]

SideEffects []

SeeAlso []

Definition at line 454 of file aigRepr.c.

455 {
456  Aig_Man_t * pTemp;
457  int i, nFanouts;
458  assert( p->pReprs != NULL );
459  for ( i = 0; (nFanouts = Aig_ManRemapRepr( p )); i++ )
460  {
461 // printf( "Iter = %3d. Fanouts = %6d. Nodes = %7d.\n", i+1, nFanouts, Aig_ManNodeNum(p) );
462  p = Aig_ManDupRepr( pTemp = p, 1 );
464  Aig_ManTransferRepr( p, pTemp );
465  Aig_ManStop( pTemp );
466  }
467  return p;
468 }
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
void Aig_ManTransferRepr(Aig_Man_t *pNew, Aig_Man_t *pOld)
Definition: aigRepr.c:211
Aig_Man_t * Aig_ManDupRepr(Aig_Man_t *p, int fOrdered)
Definition: aigRepr.c:267
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
int Aig_ManRemapRepr(Aig_Man_t *p)
Definition: aigRepr.c:351
#define assert(ex)
Definition: util_old.h:213
ABC_NAMESPACE_IMPL_START void Aig_ManReprStart(Aig_Man_t *p, int nIdMax)
DECLARATIONS ///.
Definition: aigRepr.c:45
void* Aig_ManReleaseData ( Aig_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 473 of file aigMan.c.

474 {
475  void * pD = p->pData;
476  p->pData = NULL;
477  return pD;
478 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Aig_Man_t* Aig_ManRemap ( Aig_Man_t p,
Vec_Ptr_t vMap 
)

DECLARATIONS ///.

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

FileName [aigScl.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [AIG package.]

Synopsis [Sequential cleanup.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Remaps the manager.]

Description [Map in the array specifies for each CI node the node that should be used after remapping.]

SideEffects []

SeeAlso []

Definition at line 46 of file aigScl.c.

47 {
48  Aig_Man_t * pNew;
49  Aig_Obj_t * pObj, * pObjMapped;
50  int i, nTruePis;
51  // create the new manager
52  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
53  pNew->pName = Abc_UtilStrsav( p->pName );
54  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
55  pNew->nAsserts = p->nAsserts;
56  pNew->nConstrs = p->nConstrs;
57  pNew->nBarBufs = p->nBarBufs;
58  assert( p->vFlopNums == NULL || Vec_IntSize(p->vFlopNums) == p->nRegs );
59  if ( p->vFlopNums )
60  pNew->vFlopNums = Vec_IntDup( p->vFlopNums );
61  if ( p->vFlopReprs )
62  pNew->vFlopReprs = Vec_IntDup( p->vFlopReprs );
63  // create the PIs
66  Aig_ManForEachCi( p, pObj, i )
67  pObj->pData = Aig_ObjCreateCi(pNew);
68  // implement the mapping
69  nTruePis = Aig_ManCiNum(p)-Aig_ManRegNum(p);
70  if ( p->vFlopReprs )
71  {
72  Aig_ManForEachLoSeq( p, pObj, i )
73  pObj->pNext = (Aig_Obj_t *)(long)Vec_IntEntry( p->vFlopNums, i-nTruePis );
74  }
75  Aig_ManForEachCi( p, pObj, i )
76  {
77  pObjMapped = (Aig_Obj_t *)Vec_PtrEntry( vMap, i );
78  pObj->pData = Aig_NotCond( (Aig_Obj_t *)Aig_Regular(pObjMapped)->pData, Aig_IsComplement(pObjMapped) );
79  if ( pNew->vFlopReprs && i >= nTruePis && pObj != pObjMapped )
80  {
81  Vec_IntPush( pNew->vFlopReprs, Aig_ObjCioId(pObj) );
82  if ( Aig_ObjIsConst1( Aig_Regular(pObjMapped) ) )
83  Vec_IntPush( pNew->vFlopReprs, -1 );
84  else
85  {
86  assert( !Aig_IsComplement(pObjMapped) );
87  assert( Aig_ObjIsCi(pObjMapped) );
88  assert( Aig_ObjCioId(pObj) != Aig_ObjCioId(pObjMapped) );
89  Vec_IntPush( pNew->vFlopReprs, Aig_ObjCioId(pObjMapped) );
90  }
91  }
92  }
93  if ( p->vFlopReprs )
94  {
95  Aig_ManForEachLoSeq( p, pObj, i )
96  pObj->pNext = NULL;
97  }
98  // duplicate internal nodes
99  Aig_ManForEachObj( p, pObj, i )
100  if ( Aig_ObjIsBuf(pObj) )
101  pObj->pData = Aig_ObjChild0Copy(pObj);
102  else if ( Aig_ObjIsNode(pObj) )
103  pObj->pData = Aig_And( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
104  // add the POs
105  Aig_ManForEachCo( p, pObj, i )
106  Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
107  assert( Aig_ManNodeNum(p) >= Aig_ManNodeNum(pNew) );
108  Aig_ManSetRegNum( pNew, Aig_ManRegNum(p) );
109  // check the resulting network
110  if ( !Aig_ManCheck(pNew) )
111  printf( "Aig_ManRemap(): The check has failed.\n" );
112  return pNew;
113 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void * pData
Definition: aig.h:87
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static void check(int expr)
Definition: satSolver.c:46
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Aig_ObjIsBuf(Aig_Obj_t *pObj)
Definition: aig.h:277
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
if(last==0)
Definition: sparse_int.h:34
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
else
Definition: sparse_int.h:55
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
Definition: aig.h:69
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
ABC_NAMESPACE_IMPL_START Aig_Man_t * Aig_ManRemap(Aig_Man_t *p, Vec_Ptr_t *vMap)
DECLARATIONS ///.
Definition: aigScl.c:46
#define Aig_ManForEachLoSeq(p, pObj, i)
Definition: aig.h:441
#define assert(ex)
Definition: util_old.h:213
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
static int Aig_ObjCioId(Aig_Obj_t *pObj)
Definition: aig.h:285
void Aig_ManReportImprovement ( Aig_Man_t p,
Aig_Man_t pNew 
)

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

Synopsis [Reports the reduction of the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 415 of file aigMan.c.

416 {
417  printf( "REG: Beg = %5d. End = %5d. (R =%5.1f %%) ",
418  Aig_ManRegNum(p), Aig_ManRegNum(pNew),
419  Aig_ManRegNum(p)? 100.0*(Aig_ManRegNum(p)-Aig_ManRegNum(pNew))/Aig_ManRegNum(p) : 0.0 );
420  printf( "AND: Beg = %6d. End = %6d. (R =%5.1f %%)",
422  Aig_ManNodeNum(p)? 100.0*(Aig_ManNodeNum(p)-Aig_ManNodeNum(pNew))/Aig_ManNodeNum(p) : 0.0 );
423  printf( "\n" );
424 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
void Aig_ManReprStart ( Aig_Man_t p,
int  nIdMax 
)

DECLARATIONS ///.

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

FileName [aigRepr.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [AIG package.]

Synopsis [Handing node representatives.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Starts the array of representatives.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file aigRepr.c.

46 {
47  assert( Aig_ManBufNum(p) == 0 );
48  assert( p->pReprs == NULL );
49  p->nReprsAlloc = nIdMax;
50  p->pReprs = ABC_ALLOC( Aig_Obj_t *, p->nReprsAlloc );
51  memset( p->pReprs, 0, sizeof(Aig_Obj_t *) * p->nReprsAlloc );
52 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static int Aig_ManBufNum(Aig_Man_t *p)
Definition: aig.h:253
Definition: aig.h:69
#define assert(ex)
Definition: util_old.h:213
void Aig_ManReprStop ( Aig_Man_t p)

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

Synopsis [Stop the array of representatives.]

Description []

SideEffects []

SeeAlso []

Definition at line 65 of file aigRepr.c.

66 {
67  assert( p->pReprs != NULL );
68  ABC_FREE( p->pReprs );
69  p->nReprsAlloc = 0;
70 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define assert(ex)
Definition: util_old.h:213
void Aig_ManResetRefs ( Aig_Man_t p)

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

Synopsis [Reset reference counters.]

Description []

SideEffects []

SeeAlso []

Definition at line 122 of file aigUtil.c.

123 {
124  Aig_Obj_t * pObj;
125  int i;
126  Aig_ManForEachObj( p, pObj, i )
127  pObj->nRefs = 0;
128  Aig_ManForEachObj( p, pObj, i )
129  {
130  if ( Aig_ObjFanin0(pObj) )
131  Aig_ObjFanin0(pObj)->nRefs++;
132  if ( Aig_ObjFanin1(pObj) )
133  Aig_ObjFanin1(pObj)->nRefs++;
134  }
135 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
Definition: aig.h:69
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
unsigned int nRefs
Definition: aig.h:81
Aig_Man_t* Aig_ManRetimeFrontier ( Aig_Man_t p,
int  nStepsMax 
)

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

Synopsis [Performs forward retiming.]

Description []

SideEffects []

SeeAlso []

Definition at line 125 of file aigRetF.c.

126 {
127  Aig_Obj_t * pObj, * pObjNew, * pObjLo, * pObjLo0, * pObjLo1, * pObjLi, * pObjLi0, * pObjLi1;//, * pObjLi0_, * pObjLi1_, * pObjLi0__, * pObjLi1__;
128  int i, Counter, fCompl, fChange;
129  assert( Aig_ManRegNum(p) > 0 );
130  // remove structural hashing table
131  Aig_TableClear( p );
132  // mark the retimable nodes
133  Aig_ManRetimeMark( p );
134  // mark the register outputs
135  Aig_ManForEachLiLoSeq( p, pObjLi, pObjLo, i )
136  {
137  pObjLo->fMarkA = 1;
138  pObjLo->pNext = pObjLi;
139  pObjLi->pNext = pObjLo;
140  }
141  // go through the nodes and find retimable ones
142  Counter = 0;
143  fChange = 1;
144  while ( fChange )
145  {
146  fChange = 0;
147  Aig_ManForEachNode( p, pObj, i )
148  {
149  if ( !pObj->fMarkB )
150  continue;
151  if ( Aig_ObjIsBuf(pObj) )
152  continue;
153  // get the real inputs of the node (skipping the buffers)
154  pObjLo0 = Aig_ObjReal_rec( Aig_ObjChild0(pObj) );
155  pObjLo1 = Aig_ObjReal_rec( Aig_ObjChild1(pObj) );
156  if ( !Aig_Regular(pObjLo0)->fMarkA || !Aig_Regular(pObjLo1)->fMarkA )
157  continue;
158  // remember complemented attribute
159  fCompl = Aig_IsComplement(pObjLo0) & Aig_IsComplement(pObjLo1);
160  // get the register inputs
161 // pObjLi0_ = Aig_Regular(pObjLo0)->pNext;
162 // pObjLi1_ = Aig_Regular(pObjLo1)->pNext;
163 // pObjLi0__ = Aig_ObjChild0(Aig_Regular(pObjLo0)->pNext);
164 // pObjLi1__ = Aig_ObjChild0(Aig_Regular(pObjLo1)->pNext);
165  pObjLi0 = Aig_NotCond( Aig_ObjChild0(Aig_Regular(pObjLo0)->pNext), Aig_IsComplement(pObjLo0) );
166  pObjLi1 = Aig_NotCond( Aig_ObjChild0(Aig_Regular(pObjLo1)->pNext), Aig_IsComplement(pObjLo1) );
167  // create new node
168  pObjNew = Aig_And( p, pObjLi0, pObjLi1 );
169  pObjNew->fMarkB = 1;
170  // create new register
171  pObjLo = Aig_ObjCreateCi(p);
172  pObjLo->fMarkA = 1;
173  pObjLi = Aig_ObjCreateCo( p, Aig_NotCond(pObjNew, fCompl) );
174  p->nRegs++;
175  pObjLo->pNext = pObjLi;
176  pObjLi->pNext = pObjLo;
177  // add the buffer
178  Aig_ObjDisconnect( p, pObj );
179  pObj->Type = AIG_OBJ_BUF;
180  p->nObjs[AIG_OBJ_AND]--;
181  p->nObjs[AIG_OBJ_BUF]++;
182  Aig_ObjConnect( p, pObj, Aig_NotCond(pObjLo, fCompl), NULL );
183  // create HAIG if defined
184  // mark the change
185  fChange = 1;
186  // check the limit
187  if ( ++Counter >= nStepsMax )
188  {
189  fChange = 0;
190  break;
191  }
192  }
193  }
194  // clean the markings
195  Aig_ManForEachLiLoSeq( p, pObjLi, pObjLo, i )
196  {
197  pObjLo->fMarkA = 0;
198  pObjLo->pNext = pObjLi->pNext = NULL;
199  }
200  Aig_ManForEachObj( p, pObj, i )
201  pObj->fMarkB = 0;
202  // remove useless registers
203  Aig_ManSeqCleanup( p );
204  // rehash the nodes
205  return Aig_ManDupOrdered( p );
206 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
static Aig_Obj_t * Aig_ObjChild0(Aig_Obj_t *pObj)
Definition: aig.h:310
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Aig_ManSeqCleanup(Aig_Man_t *p)
Definition: aigScl.c:158
Aig_Obj_t * Aig_ObjReal_rec(Aig_Obj_t *pObj)
Definition: aigUtil.c:476
unsigned int Type
Definition: aig.h:77
unsigned int fMarkB
Definition: aig.h:80
Aig_Man_t * Aig_ManDupOrdered(Aig_Man_t *p)
Definition: aigDup.c:277
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
unsigned int fMarkA
Definition: aig.h:79
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
void Aig_ObjConnect(Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pFan0, Aig_Obj_t *pFan1)
Definition: aigObj.c:126
static int Aig_ObjIsBuf(Aig_Obj_t *pObj)
Definition: aig.h:277
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
#define Aig_ManForEachLiLoSeq(p, pObjLi, pObjLo, k)
Definition: aig.h:450
static Aig_Obj_t * Aig_ObjChild1(Aig_Obj_t *pObj)
Definition: aig.h:311
Definition: aig.h:69
Aig_Obj_t * pNext
Definition: aig.h:72
static int Counter
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
#define assert(ex)
Definition: util_old.h:213
void Aig_ObjDisconnect(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigObj.c:171
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
void Aig_ManRetimeMark(Aig_Man_t *p)
Definition: aigRetF.c:73
void Aig_TableClear(Aig_Man_t *p)
Definition: aigTable.c:265
Aig_Man_t* Aig_ManScl ( Aig_Man_t pAig,
int  fLatchConst,
int  fLatchEqual,
int  fUseMvSweep,
int  nFramesSymb,
int  nFramesSatur,
int  fVerbose,
int  fVeryVerbose 
)

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

Synopsis [Gives the current ABC network to AIG manager for processing.]

Description []

SideEffects []

SeeAlso []

Definition at line 650 of file aigScl.c.

651 {
652  extern void Saig_ManReportUselessRegisters( Aig_Man_t * pAig );
653  extern int Saig_ManReportComplements( Aig_Man_t * p );
654 
655  Aig_Man_t * pAigInit, * pAigNew;
656  Aig_Obj_t * pFlop1, * pFlop2;
657  int i, Entry1, Entry2, nTruePis;//, nRegs;
658 
659  if ( pAig->vClockDoms && Vec_VecSize(pAig->vClockDoms) > 0 )
660  return Aig_ManSclPart( pAig, fLatchConst, fLatchEqual, fVerbose);
661 
662  // store the original AIG
663  assert( pAig->vFlopNums == NULL );
664  pAigInit = pAig;
665  pAig = Aig_ManDupSimple( pAig );
666  // create storage for latch numbers
667  pAig->vFlopNums = Vec_IntStartNatural( pAig->nRegs );
668  pAig->vFlopReprs = Vec_IntAlloc( 100 );
669  Aig_ManSeqCleanup( pAig );
670  if ( fLatchConst && pAig->nRegs )
671  pAig = Aig_ManConstReduce( pAig, fUseMvSweep, nFramesSymb, nFramesSatur, fVerbose, fVeryVerbose );
672  if ( fLatchEqual && pAig->nRegs )
673  pAig = Aig_ManReduceLaches( pAig, fVerbose );
674  // translate pairs into reprs
675  nTruePis = Aig_ManCiNum(pAigInit)-Aig_ManRegNum(pAigInit);
676  Aig_ManReprStart( pAigInit, Aig_ManObjNumMax(pAigInit) );
677  Vec_IntForEachEntry( pAig->vFlopReprs, Entry1, i )
678  {
679  Entry2 = Vec_IntEntry( pAig->vFlopReprs, ++i );
680  pFlop1 = Aig_ManCi( pAigInit, nTruePis + Entry1 );
681  pFlop2 = (Entry2 == -1)? Aig_ManConst1(pAigInit) : Aig_ManCi( pAigInit, nTruePis + Entry2 );
682  assert( pFlop1 != pFlop2 );
683  if ( pFlop1->Id > pFlop2->Id )
684  pAigInit->pReprs[pFlop1->Id] = pFlop2;
685  else
686  pAigInit->pReprs[pFlop2->Id] = pFlop1;
687  }
688  Aig_ManStop( pAig );
689 // Aig_ManSeqCleanup( pAigInit );
690  pAigNew = Aig_ManDupRepr( pAigInit, 0 );
691  Aig_ManSeqCleanup( pAigNew );
692 
693 // Saig_ManReportUselessRegisters( pAigNew );
694  if ( Aig_ManRegNum(pAigNew) == 0 )
695  return pAigNew;
696 // nRegs = Saig_ManReportComplements( pAigNew );
697 // if ( nRegs )
698 // printf( "The number of complemented registers = %d.\n", nRegs );
699  return pAigNew;
700 }
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
void Saig_ManReportUselessRegisters(Aig_Man_t *pAig)
DECLARATIONS ///.
Definition: saigScl.c:45
static Vec_Int_t * Vec_IntStartNatural(int nSize)
Definition: bblif.c:192
void Aig_ManReprStart(Aig_Man_t *p, int nIdMax)
DECLARATIONS ///.
Definition: aigRepr.c:45
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static Aig_Obj_t * Aig_ManCi(Aig_Man_t *p, int i)
Definition: aig.h:266
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Aig_Man_t * Aig_ManConstReduce(Aig_Man_t *p, int fUseMvSweep, int nFramesSymb, int nFramesSatur, int fVerbose, int fVeryVerbose)
Definition: aigTsim.c:498
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
int Saig_ManReportComplements(Aig_Man_t *p)
Definition: saigScl.c:85
Definition: aig.h:69
Aig_Man_t * Aig_ManDupRepr(Aig_Man_t *p, int fOrdered)
Definition: aigRepr.c:267
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
Aig_Man_t * Aig_ManSclPart(Aig_Man_t *pAig, int fLatchConst, int fLatchEqual, int fVerbose)
Definition: aigScl.c:598
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
int Aig_ManSeqCleanup(Aig_Man_t *p)
Definition: aigScl.c:158
static int Vec_VecSize(Vec_Vec_t *p)
Definition: vecVec.h:222
#define assert(ex)
Definition: util_old.h:213
Aig_Man_t * Aig_ManReduceLaches(Aig_Man_t *p, int fVerbose)
Definition: aigScl.c:455
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
int Id
Definition: aig.h:85
Aig_Man_t * Aig_ManDupSimple(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigDup.c:46
int Aig_ManSeqCleanup ( Aig_Man_t p)

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

Synopsis [Returns the number of dangling nodes removed.]

Description []

SideEffects []

SeeAlso []

Definition at line 158 of file aigScl.c.

159 {
160  Vec_Ptr_t * vNodes, * vCis, * vCos;
161  Aig_Obj_t * pObj, * pObjLi, * pObjLo;
162  int i, nTruePis, nTruePos;
163 // assert( Aig_ManBufNum(p) == 0 );
164 
165  // mark the PIs
168  Aig_ManForEachPiSeq( p, pObj, i )
169  Aig_ObjSetTravIdCurrent( p, pObj );
170 
171  // prepare to collect nodes reachable from POs
172  vNodes = Vec_PtrAlloc( 100 );
173  Aig_ManForEachPoSeq( p, pObj, i )
174  Vec_PtrPush( vNodes, pObj );
175 
176  // remember latch inputs in latch outputs
177  Aig_ManForEachLiLoSeq( p, pObjLi, pObjLo, i )
178  pObjLo->pNext = pObjLi;
179  // mark the nodes reachable from these nodes
180  Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
181  Aig_ManSeqCleanup_rec( p, pObj, vNodes );
182  assert( Vec_PtrSize(vNodes) <= Aig_ManCoNum(p) );
183  // clean latch output pointers
184  Aig_ManForEachLiLoSeq( p, pObjLi, pObjLo, i )
185  pObjLo->pNext = NULL;
186 
187  // if some latches are removed, update PIs/POs
188  if ( Vec_PtrSize(vNodes) < Aig_ManCoNum(p) )
189  {
190  if ( p->vFlopNums )
191  {
192  int nTruePos = Aig_ManCoNum(p)-Aig_ManRegNum(p);
193  int iNum, k = 0;
194  Aig_ManForEachCo( p, pObj, i )
195  if ( i >= nTruePos && Aig_ObjIsTravIdCurrent(p, pObj) )
196  {
197  iNum = Vec_IntEntry( p->vFlopNums, i - nTruePos );
198  Vec_IntWriteEntry( p->vFlopNums, k++, iNum );
199  }
200  assert( k == Vec_PtrSize(vNodes) - nTruePos );
201  Vec_IntShrink( p->vFlopNums, k );
202  }
203  // collect new CIs/COs
204  vCis = Vec_PtrAlloc( Aig_ManCiNum(p) );
205  Aig_ManForEachCi( p, pObj, i )
206  if ( Aig_ObjIsTravIdCurrent(p, pObj) )
207  Vec_PtrPush( vCis, pObj );
208  else
209  {
210  Vec_PtrWriteEntry( p->vObjs, pObj->Id, NULL );
211 // Aig_ManRecycleMemory( p, pObj );
212  }
213  vCos = Vec_PtrAlloc( Aig_ManCoNum(p) );
214  Aig_ManForEachCo( p, pObj, i )
215  if ( Aig_ObjIsTravIdCurrent(p, pObj) )
216  Vec_PtrPush( vCos, pObj );
217  else
218  {
219  Aig_ObjDisconnect( p, pObj );
220  Vec_PtrWriteEntry( p->vObjs, pObj->Id, NULL );
221 // Aig_ManRecycleMemory( p, pObj );
222  }
223  // remember the number of true PIs/POs
224  nTruePis = Aig_ManCiNum(p) - Aig_ManRegNum(p);
225  nTruePos = Aig_ManCoNum(p) - Aig_ManRegNum(p);
226  // set the new number of registers
227  p->nRegs -= Aig_ManCoNum(p) - Vec_PtrSize(vNodes);
228  // create new PIs/POs
229  assert( Vec_PtrSize(vCis) == nTruePis + p->nRegs );
230  assert( Vec_PtrSize(vCos) == nTruePos + p->nRegs );
231  Vec_PtrFree( p->vCis ); p->vCis = vCis;
232  Vec_PtrFree( p->vCos ); p->vCos = vCos;
233  p->nObjs[AIG_OBJ_CI] = Vec_PtrSize( p->vCis );
234  p->nObjs[AIG_OBJ_CO] = Vec_PtrSize( p->vCos );
235 
236  }
237  Vec_PtrFree( vNodes );
238  p->nTruePis = Aig_ManCiNum(p) - Aig_ManRegNum(p);
239  p->nTruePos = Aig_ManCoNum(p) - Aig_ManRegNum(p);
240  Aig_ManSetCioIds( p );
241  // remove dangling nodes
242  return Aig_ManCleanup( p );
243 }
void Aig_ManSeqCleanup_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vNodes)
Definition: aigScl.c:126
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Definition: aig.h:61
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
#define Aig_ManForEachLiLoSeq(p, pObjLi, pObjLo, k)
Definition: aig.h:450
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
Definition: aig.h:69
void Aig_ManSetCioIds(Aig_Man_t *p)
Definition: aigUtil.c:965
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static void Vec_IntShrink(Vec_Int_t *p, int nSizeNew)
Definition: bblif.c:435
Definition: aig.h:60
#define assert(ex)
Definition: util_old.h:213
void Aig_ObjDisconnect(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigObj.c:171
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
#define Aig_ManForEachPoSeq(p, pObj, i)
Definition: aig.h:444
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
#define Aig_ManForEachPiSeq(p, pObj, i)
SEQUENTIAL ITERATORS ///.
Definition: aig.h:438
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
int Aig_ManSeqCleanupBasic ( Aig_Man_t p)

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

Synopsis [Returns the number of dangling nodes removed.]

Description [This cleanup procedure is different in that it removes logic but does not remove the dangling latches.]

SideEffects []

SeeAlso []

Definition at line 257 of file aigScl.c.

258 {
259  Vec_Ptr_t * vNodes;
260  Aig_Obj_t * pObj, * pObjLi, * pObjLo;
261  int i;
262 // assert( Aig_ManBufNum(p) == 0 );
263 
264  // mark the PIs
267  Aig_ManForEachPiSeq( p, pObj, i )
268  Aig_ObjSetTravIdCurrent( p, pObj );
269 
270  // prepare to collect nodes reachable from POs
271  vNodes = Vec_PtrAlloc( 100 );
272  Aig_ManForEachPoSeq( p, pObj, i )
273  Vec_PtrPush( vNodes, pObj );
274 
275  // remember latch inputs in latch outputs
276  Aig_ManForEachLiLoSeq( p, pObjLi, pObjLo, i )
277  pObjLo->pNext = pObjLi;
278  // mark the nodes reachable from these nodes
279  Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
280  Aig_ManSeqCleanup_rec( p, pObj, vNodes );
281  assert( Vec_PtrSize(vNodes) <= Aig_ManCoNum(p) );
282  // clean latch output pointers
283  Aig_ManForEachLiLoSeq( p, pObjLi, pObjLo, i )
284  pObjLo->pNext = NULL;
285 
286  // if some latches are removed, update PIs/POs
287  if ( Vec_PtrSize(vNodes) < Aig_ManCoNum(p) )
288  {
289  // add constant drivers to the dangling latches
290  Aig_ManForEachCo( p, pObj, i )
291  if ( !Aig_ObjIsTravIdCurrent(p, pObj) )
292  Aig_ObjPatchFanin0( p, pObj, Aig_ManConst0(p) );
293  }
294  Vec_PtrFree( vNodes );
295  // remove dangling nodes
296  return Aig_ManCleanup( p );
297 }
void Aig_ManSeqCleanup_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vNodes)
Definition: aigScl.c:126
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static Aig_Obj_t * Aig_ManConst0(Aig_Man_t *p)
Definition: aig.h:263
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
void Aig_ObjPatchFanin0(Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pFaninNew)
Definition: aigObj.c:282
#define Aig_ManForEachLiLoSeq(p, pObjLi, pObjLo, k)
Definition: aig.h:450
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
#define Aig_ManForEachPoSeq(p, pObj, i)
Definition: aig.h:444
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
#define Aig_ManForEachPiSeq(p, pObj, i)
SEQUENTIAL ITERATORS ///.
Definition: aig.h:438
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Aig_ManSetCioIds ( Aig_Man_t p)

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

Synopsis [Sets the PI/PO numbers.]

Description []

SideEffects []

SeeAlso []

Definition at line 965 of file aigUtil.c.

966 {
967  Aig_Obj_t * pObj;
968  int i;
969  Aig_ManForEachCi( p, pObj, i )
970  pObj->CioId = i;
971  Aig_ManForEachCo( p, pObj, i )
972  pObj->CioId = i;
973 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
Definition: aig.h:69
void Aig_ManSetPhase ( Aig_Man_t pAig)

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

Synopsis [Handle the counter-example.]

Description []

SideEffects []

SeeAlso []

Definition at line 1431 of file aigUtil.c.

1432 {
1433  Aig_Obj_t * pObj;
1434  int i;
1435  // set the PI simulation information
1436  Aig_ManConst1( pAig )->fPhase = 1;
1437  Aig_ManForEachCi( pAig, pObj, i )
1438  pObj->fPhase = 0;
1439  // simulate internal nodes
1440  Aig_ManForEachNode( pAig, pObj, i )
1441  pObj->fPhase = ( Aig_ObjFanin0(pObj)->fPhase ^ Aig_ObjFaninC0(pObj) )
1442  & ( Aig_ObjFanin1(pObj)->fPhase ^ Aig_ObjFaninC1(pObj) );
1443  // simulate PO nodes
1444  Aig_ManForEachCo( pAig, pObj, i )
1445  pObj->fPhase = Aig_ObjFanin0(pObj)->fPhase ^ Aig_ObjFaninC0(pObj);
1446 }
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
Definition: aig.h:69
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
unsigned int fPhase
Definition: aig.h:78
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
void Aig_ManSetRegNum ( Aig_Man_t p,
int  nRegs 
)

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

Synopsis [Sets the number of registers in the AIG manager.]

Description [This procedure should be called after the manager is fully constructed.]

SideEffects []

SeeAlso []

Definition at line 438 of file aigMan.c.

439 {
440  p->nRegs = nRegs;
441  p->nTruePis = Aig_ManCiNum(p) - nRegs;
442  p->nTruePos = Aig_ManCoNum(p) - nRegs;
443  Aig_ManSetCioIds( p );
444 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
void Aig_ManSetCioIds(Aig_Man_t *p)
Definition: aigUtil.c:965
void Aig_ManShow ( Aig_Man_t pMan,
int  fHaig,
Vec_Ptr_t vBold 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 340 of file aigShow.c.

341 {
342  extern void Abc_ShowFile( char * FileNameDot );
343  static int Counter = 0;
344  char FileNameDot[200];
345  FILE * pFile;
346  // create the file name
347 // Aig_ShowGetFileName( pMan->pName, FileNameDot );
348  sprintf( FileNameDot, "temp%02d.dot", Counter++ );
349  // check that the file can be opened
350  if ( (pFile = fopen( FileNameDot, "w" )) == NULL )
351  {
352  fprintf( stdout, "Cannot open the intermediate file \"%s\".\n", FileNameDot );
353  return;
354  }
355  fclose( pFile );
356  // generate the file
357  Aig_WriteDotAig( pMan, FileNameDot, fHaig, vBold );
358  // visualize the file
359  Abc_ShowFile( FileNameDot );
360 }
ABC_NAMESPACE_IMPL_START void Aig_WriteDotAig(Aig_Man_t *pMan, char *pFileName, int fHaig, Vec_Ptr_t *vBold)
DECLARATIONS ///.
Definition: aigShow.c:46
ABC_NAMESPACE_IMPL_START void Abc_ShowFile(char *FileNameDot)
DECLARATIONS ///.
Definition: abcShow.c:245
char * sprintf()
static int Counter
Aig_Man_t* Aig_ManStart ( int  nNodesMax)

DECLARATIONS ///.

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

FileName [aigMan.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [AIG package.]

Synopsis [AIG manager.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Starts the AIG manager.]

Description [The argument of this procedure is a soft limit on the the number of nodes, or 0 if the limit is unknown.]

SideEffects []

SeeAlso []

Definition at line 47 of file aigMan.c.

48 {
49  Aig_Man_t * p;
50  if ( nNodesMax <= 0 )
51  nNodesMax = 10007;
52  // start the manager
53  p = ABC_ALLOC( Aig_Man_t, 1 );
54  memset( p, 0, sizeof(Aig_Man_t) );
55  // perform initializations
56  p->nTravIds = 1;
57  p->fCatchExor = 0;
58  // allocate arrays for nodes
59  p->vCis = Vec_PtrAlloc( 100 );
60  p->vCos = Vec_PtrAlloc( 100 );
61  p->vObjs = Vec_PtrAlloc( 1000 );
62  p->vBufs = Vec_PtrAlloc( 100 );
63  //--jlong -- begin
64  p->unfold2_type_I = Vec_PtrAlloc( 4);
65  p->unfold2_type_II = Vec_PtrAlloc( 4);
66  //--jlong -- end
67  // prepare the internal memory manager
68  p->pMemObjs = Aig_MmFixedStart( sizeof(Aig_Obj_t), nNodesMax );
69  // create the constant node
70  p->pConst1 = Aig_ManFetchMemory( p );
71  p->pConst1->Type = AIG_OBJ_CONST1;
72  p->pConst1->fPhase = 1;
73  p->nObjs[AIG_OBJ_CONST1]++;
74  // start the table
75  p->nTableSize = Abc_PrimeCudd( nNodesMax );
76  p->pTable = ABC_ALLOC( Aig_Obj_t *, p->nTableSize );
77  memset( p->pTable, 0, sizeof(Aig_Obj_t *) * p->nTableSize );
78  return p;
79 }
char * memset()
static int Abc_PrimeCudd(unsigned int p)
Definition: abc_global.h:383
static Aig_Obj_t * Aig_ManFetchMemory(Aig_Man_t *p)
Definition: aig.h:368
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
Aig_MmFixed_t * Aig_MmFixedStart(int nEntrySize, int nEntriesMax)
FUNCTION DEFINITIONS ///.
Definition: aigMem.c:96
Definition: aig.h:69
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
Aig_Man_t* Aig_ManStartFrom ( Aig_Man_t p)

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

Synopsis [Duplicates the AIG manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 92 of file aigMan.c.

93 {
94  Aig_Man_t * pNew;
95  Aig_Obj_t * pObj, * pObjNew;
96  int i;
97  // create the new manager
98  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
99  pNew->pName = Abc_UtilStrsav( p->pName );
100  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
101  // create the PIs
103  Aig_ManForEachCi( p, pObj, i )
104  {
105  pObjNew = Aig_ObjCreateCi( pNew );
106  pObjNew->Level = pObj->Level;
107  pObj->pData = pObjNew;
108  }
109  return pNew;
110 }
unsigned Level
Definition: aig.h:82
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void * pData
Definition: aig.h:87
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
Definition: aig.h:69
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
ABC_NAMESPACE_IMPL_START Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Aig_ManStartMemory ( Aig_Man_t p)
void Aig_ManStartReverseLevels ( Aig_Man_t p,
int  nMaxLevelIncrease 
)

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

Synopsis [Prepares for the computation of required levels.]

Description [This procedure should be called before the required times are used. It starts internal data structures, which records the level from the COs of the network nodes in reverse topologogical order.]

SideEffects []

SeeAlso []

Definition at line 142 of file aigTiming.c.

143 {
144  Vec_Ptr_t * vNodes;
145  Aig_Obj_t * pObj;
146  int i;
147  assert( p->pFanData != NULL );
148  assert( p->vLevelR == NULL );
149  // remember the maximum number of direct levels
150  p->nLevelMax = Aig_ManLevels(p) + nMaxLevelIncrease;
151  // start the reverse levels
152  p->vLevelR = Vec_IntAlloc( 0 );
153  Vec_IntFill( p->vLevelR, Aig_ManObjNumMax(p), 0 );
154  // compute levels in reverse topological order
155  vNodes = Aig_ManDfsReverse( p );
156  Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
157  {
158  assert( pObj->fMarkA == 0 );
160  }
161  Vec_PtrFree( vNodes );
162 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
unsigned int fMarkA
Definition: aig.h:79
int Aig_ObjReverseLevelNew(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigTiming.c:117
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
Definition: aig.h:69
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
Vec_Ptr_t * Aig_ManDfsReverse(Aig_Man_t *p)
Definition: aigDfs.c:458
static void Aig_ObjSetReverseLevel(Aig_Man_t *p, Aig_Obj_t *pObj, int LevelR)
Definition: aigTiming.c:65
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
int Aig_ManLevels(Aig_Man_t *p)
Definition: aigUtil.c:102
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Aig_ManStop ( Aig_Man_t p)

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

Synopsis [Stops the AIG manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 187 of file aigMan.c.

188 {
189  Aig_Obj_t * pObj;
190  int i;
191  if ( p->time1 ) { ABC_PRT( "time1", p->time1 ); }
192  if ( p->time2 ) { ABC_PRT( "time2", p->time2 ); }
193  // make sure the nodes have clean marks
194  Aig_ManForEachObj( p, pObj, i )
195  assert( !pObj->fMarkA && !pObj->fMarkB );
196  Tim_ManStopP( (Tim_Man_t **)&p->pManTime );
197  if ( p->pFanData )
198  Aig_ManFanoutStop( p );
199  if ( p->pManExdc )
200  Aig_ManStop( p->pManExdc );
201 // Aig_TableProfile( p );
202  Aig_MmFixedStop( p->pMemObjs, 0 );
203  Vec_PtrFreeP( &p->vCis );
204  Vec_PtrFreeP( &p->vCos );
205  Vec_PtrFreeP( &p->vObjs );
206  Vec_PtrFreeP( &p->vBufs );
207  //--jlong -- begin
208  Vec_PtrFreeP( &p->unfold2_type_I );
209  Vec_PtrFreeP( &p->unfold2_type_II );
210  //--jlong -- end
211  Vec_IntFreeP( &p->vLevelR );
212  Vec_VecFreeP( &p->vLevels );
213  Vec_IntFreeP( &p->vFlopNums );
214  Vec_IntFreeP( &p->vFlopReprs );
215  Vec_VecFreeP( (Vec_Vec_t **)&p->vOnehots );
216  Vec_VecFreeP( &p->vClockDoms );
217  Vec_IntFreeP( &p->vProbs );
218  Vec_IntFreeP( &p->vCiNumsOrig );
219  Vec_PtrFreeP( &p->vMapped );
220  if ( p->vSeqModelVec )
221  Vec_PtrFreeFree( p->vSeqModelVec );
222  ABC_FREE( p->pTerSimData );
223  ABC_FREE( p->pFastSim );
224  ABC_FREE( p->pData );
225  ABC_FREE( p->pSeqModel );
226  ABC_FREE( p->pName );
227  ABC_FREE( p->pSpec );
228  ABC_FREE( p->pObjCopies );
229  ABC_FREE( p->pReprs );
230  ABC_FREE( p->pEquivs );
231  ABC_FREE( p->pTable );
232  ABC_FREE( p );
233 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Aig_MmFixedStop(Aig_MmFixed_t *p, int fVerbose)
Definition: aigMem.c:132
static void Vec_PtrFreeFree(Vec_Ptr_t *p)
Definition: vecPtr.h:569
void Aig_ManFanoutStop(Aig_Man_t *p)
Definition: aigFanout.c:89
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
void Tim_ManStopP(Tim_Man_t **p)
Definition: timMan.c:384
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define ABC_PRT(a, t)
Definition: abc_global.h:220
static void Vec_PtrFreeP(Vec_Ptr_t **p)
Definition: vecPtr.h:240
static void Vec_VecFreeP(Vec_Vec_t **p)
Definition: vecVec.h:367
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
void Aig_ManStopMemory ( Aig_Man_t p)
void Aig_ManStopP ( Aig_Man_t **  p)

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

Synopsis [Stops the AIG manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 246 of file aigMan.c.

247 {
248  if ( *p == NULL )
249  return;
250  Aig_ManStop( *p );
251  *p = NULL;
252 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
void Aig_ManStopReverseLevels ( Aig_Man_t p)

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

Synopsis [Cleans the data structures used to compute required levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 175 of file aigTiming.c.

176 {
177  assert( p->vLevelR != NULL );
178  Vec_IntFree( p->vLevelR );
179  p->vLevelR = NULL;
180  p->nLevelMax = 0;
181 
182 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Vec_Ptr_t* Aig_ManSupports ( Aig_Man_t pMan)

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

Synopsis [Computes supports of the POs in the multi-output AIG.]

Description [Returns the array of integer arrays containing indices of the primary inputs for each primary output.]

SideEffects [Adds the integer PO number at end of each array.]

SeeAlso []

Definition at line 273 of file aigPart.c.

274 {
275  Vec_Ptr_t * vSupports;
276  Vec_Int_t * vSupp;
277  Part_Man_t * p;
278  Part_One_t * pPart0, * pPart1;
279  Aig_Obj_t * pObj;
280  int i, Counter = 0;
281  // set the number of PIs/POs
282  Aig_ManForEachCi( pMan, pObj, i )
283  pObj->pNext = (Aig_Obj_t *)(long)i;
284  Aig_ManForEachCo( pMan, pObj, i )
285  pObj->pNext = (Aig_Obj_t *)(long)i;
286  // start the support computation manager
287  p = Part_ManStart( 1 << 20, 1 << 6 );
288  // consider objects in the topological order
289  vSupports = Vec_PtrAlloc( Aig_ManCoNum(pMan) );
290  Aig_ManCleanData(pMan);
291  Aig_ManForEachObj( pMan, pObj, i )
292  {
293  if ( Aig_ObjIsNode(pObj) )
294  {
295  pPart0 = (Part_One_t *)Aig_ObjFanin0(pObj)->pData;
296  pPart1 = (Part_One_t *)Aig_ObjFanin1(pObj)->pData;
297  pObj->pData = Part_ManMergeEntry( p, pPart0, pPart1, pObj->nRefs );
298  assert( pPart0->nRefs > 0 );
299  if ( --pPart0->nRefs == 0 )
300  Part_ManRecycleEntry( p, pPart0 );
301  assert( pPart1->nRefs > 0 );
302  if ( --pPart1->nRefs == 0 )
303  Part_ManRecycleEntry( p, pPart1 );
304  if ( ((Part_One_t *)pObj->pData)->nOuts <= 16 )
305  Counter++;
306  continue;
307  }
308  if ( Aig_ObjIsCo(pObj) )
309  {
310  pPart0 = (Part_One_t *)Aig_ObjFanin0(pObj)->pData;
311  vSupp = Part_ManTransferEntry(pPart0);
312  Vec_IntPush( vSupp, (int)(long)pObj->pNext );
313  Vec_PtrPush( vSupports, vSupp );
314  assert( pPart0->nRefs > 0 );
315  if ( --pPart0->nRefs == 0 )
316  Part_ManRecycleEntry( p, pPart0 );
317  continue;
318  }
319  if ( Aig_ObjIsCi(pObj) )
320  {
321  if ( pObj->nRefs )
322  {
323  pPart0 = Part_ManFetchEntry( p, 1, pObj->nRefs );
324  pPart0->pOuts[ pPart0->nOuts++ ] = (int)(long)pObj->pNext;
325  pObj->pData = pPart0;
326  }
327  continue;
328  }
329  if ( Aig_ObjIsConst1(pObj) )
330  {
331  if ( pObj->nRefs )
332  pObj->pData = Part_ManFetchEntry( p, 0, pObj->nRefs );
333  continue;
334  }
335  assert( 0 );
336  }
337 //printf( "Memory usage = %d MB.\n", Vec_PtrSize(p->vMemory) * p->nChunkSize / (1<<20) );
338  Part_ManStop( p );
339  // sort supports by size
340  Vec_VecSort( (Vec_Vec_t *)vSupports, 1 );
341  // clear the number of PIs/POs
342  Aig_ManForEachCi( pMan, pObj, i )
343  pObj->pNext = NULL;
344  Aig_ManForEachCo( pMan, pObj, i )
345  pObj->pNext = NULL;
346 /*
347  Aig_ManForEachCo( pMan, pObj, i )
348  printf( "%d ", Vec_IntSize( Vec_VecEntryInt(vSupports, i) ) );
349  printf( "\n" );
350 */
351 // printf( "%d \n", Counter );
352  return vSupports;
353 }
void Part_ManStop(Part_Man_t *p)
Definition: aigPart.c:94
Part_Man_t * Part_ManStart(int nChunkSize, int nStepSize)
FUNCTION DEFINITIONS ///.
Definition: aigPart.c:71
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static void Vec_VecSort(Vec_Vec_t *p, int fReverse)
Definition: vecVec.h:546
int nRefs
Definition: aigPart.c:46
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
int pOuts[0]
Definition: aigPart.c:49
void * pData
Definition: aig.h:87
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
typedefABC_NAMESPACE_IMPL_START struct Part_Man_t_ Part_Man_t
DECLARATIONS ///.
Definition: aigPart.c:32
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
Part_One_t * Part_ManMergeEntry(Part_Man_t *pMan, Part_One_t *p1, Part_One_t *p2, int nRefs)
Definition: aigPart.c:212
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
static Part_One_t * Part_ManFetchEntry(Part_Man_t *p, int nWords, int nRefs)
Definition: aigPart.c:173
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
Definition: aig.h:69
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Counter
static void Part_ManRecycleEntry(Part_Man_t *p, Part_One_t *pEntry)
Definition: aigPart.c:194
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define assert(ex)
Definition: util_old.h:213
int nOuts
Definition: aigPart.c:47
Vec_Int_t * Part_ManTransferEntry(Part_One_t *p)
Definition: aigPart.c:251
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
Vec_Ptr_t* Aig_ManSupportsInverse ( Aig_Man_t p)

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

Synopsis [Computes the set of outputs for each input.]

Description [Returns the array of integer arrays containing indices of the primary outputsf for each primary input.]

SideEffects []

SeeAlso []

Definition at line 385 of file aigPart.c.

386 {
387  Vec_Ptr_t * vSupps, * vSuppsInv;
388  Vec_Int_t * vSupp;
389  int i, k, iIn, iOut;
390  // get structural supports for each output
391  vSupps = Aig_ManSupports( p );
392  // start the inverse supports
393  vSuppsInv = Vec_PtrAlloc( Aig_ManCiNum(p) );
394  for ( i = 0; i < Aig_ManCiNum(p); i++ )
395  Vec_PtrPush( vSuppsInv, Vec_IntAlloc(8) );
396  // transforms the supports into the inverse supports
397  Vec_PtrForEachEntry( Vec_Int_t *, vSupps, vSupp, i )
398  {
399  iOut = Vec_IntPop( vSupp );
400  Vec_IntForEachEntry( vSupp, iIn, k )
401  Vec_IntPush( (Vec_Int_t *)Vec_PtrEntry(vSuppsInv, iIn), iOut );
402  }
403  Vec_VecFree( (Vec_Vec_t *)vSupps );
404  return vSuppsInv;
405 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static void Vec_VecFree(Vec_Vec_t *p)
Definition: vecVec.h:347
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
static int Vec_IntPop(Vec_Int_t *p)
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
Vec_Ptr_t * Aig_ManSupports(Aig_Man_t *pMan)
Definition: aigPart.c:273
Vec_Ptr_t* Aig_ManSupportsRegisters ( Aig_Man_t p)

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

Synopsis [Returns the register dependency matrix.]

Description []

SideEffects []

SeeAlso []

Definition at line 418 of file aigPart.c.

419 {
420  Vec_Ptr_t * vSupports, * vMatrix;
421  Vec_Int_t * vSupp;
422  int iOut, iIn, k, m, i;
423  // get structural supports for each output
424  vSupports = Aig_ManSupports( p );
425  // transforms the supports into the latch dependency matrix
426  vMatrix = Vec_PtrStart( Aig_ManRegNum(p) );
427  Vec_PtrForEachEntry( Vec_Int_t *, vSupports, vSupp, i )
428  {
429  // skip true POs
430  iOut = Vec_IntPop( vSupp );
431  iOut -= Aig_ManCoNum(p) - Aig_ManRegNum(p);
432  if ( iOut < 0 )
433  {
434  Vec_IntFree( vSupp );
435  continue;
436  }
437  // remove PIs
438  m = 0;
439  Vec_IntForEachEntry( vSupp, iIn, k )
440  {
441  iIn -= Aig_ManCiNum(p) - Aig_ManRegNum(p);
442  if ( iIn < 0 )
443  continue;
444  assert( iIn < Aig_ManRegNum(p) );
445  Vec_IntWriteEntry( vSupp, m++, iIn );
446  }
447  Vec_IntShrink( vSupp, m );
448  // store support in the matrix
449  assert( iOut < Aig_ManRegNum(p) );
450  Vec_PtrWriteEntry( vMatrix, iOut, vSupp );
451  }
452  Vec_PtrFree( vSupports );
453  // check that all supports are used
454  Vec_PtrForEachEntry( Vec_Int_t *, vMatrix, vSupp, i )
455  assert( vSupp != NULL );
456  return vMatrix;
457 }
static Vec_Ptr_t * Vec_PtrStart(int nSize)
Definition: vecPtr.h:106
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
static int Vec_IntPop(Vec_Int_t *p)
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static void Vec_IntShrink(Vec_Int_t *p, int nSizeNew)
Definition: bblif.c:435
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
Vec_Ptr_t * Aig_ManSupports(Aig_Man_t *pMan)
Definition: aigPart.c:273
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Aig_ManTransferRepr ( Aig_Man_t pNew,
Aig_Man_t pOld 
)

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

Synopsis [Duplicates AIG while substituting representatives.]

Description []

SideEffects []

SeeAlso []

Definition at line 211 of file aigRepr.c.

212 {
213  Aig_Obj_t * pObj, * pRepr;
214  int k;
215  assert( pNew->pReprs != NULL );
216  // extend storage to fix pNew
217  if ( pNew->nReprsAlloc < Aig_ManObjNumMax(pNew) )
218  {
219  int nReprsAllocNew = 2 * Aig_ManObjNumMax(pNew);
220  pNew->pReprs = ABC_REALLOC( Aig_Obj_t *, pNew->pReprs, nReprsAllocNew );
221  memset( pNew->pReprs + pNew->nReprsAlloc, 0, sizeof(Aig_Obj_t *) * (nReprsAllocNew-pNew->nReprsAlloc) );
222  pNew->nReprsAlloc = nReprsAllocNew;
223  }
224  // go through the nodes which have representatives
225  Aig_ManForEachObj( pOld, pObj, k )
226  if ( (pRepr = Aig_ObjFindRepr(pOld, pObj)) )
227  Aig_ObjSetRepr_( pNew, Aig_Regular((Aig_Obj_t *)pRepr->pData), Aig_Regular((Aig_Obj_t *)pObj->pData) );
228 }
char * memset()
#define ABC_REALLOC(type, obj, num)
Definition: abc_global.h:233
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static Aig_Obj_t * Aig_ObjFindRepr(Aig_Man_t *p, Aig_Obj_t *pNode)
Definition: aigRepr.c:131
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
#define assert(ex)
Definition: util_old.h:213
static void Aig_ObjSetRepr_(Aig_Man_t *p, Aig_Obj_t *pNode1, Aig_Obj_t *pNode2)
Definition: aigRepr.c:105
void Aig_ManUpdateLevel ( Aig_Man_t p,
Aig_Obj_t pObjNew 
)

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

Synopsis [Incrementally updates level of the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 195 of file aigTiming.c.

196 {
197  Aig_Obj_t * pFanout, * pTemp;
198  int iFanout = -1, LevelOld, Lev, k, m;
199  assert( p->pFanData != NULL );
200  assert( Aig_ObjIsNode(pObjNew) );
201  // allocate level if needed
202  if ( p->vLevels == NULL )
203  p->vLevels = Vec_VecAlloc( Aig_ManLevels(p) + 8 );
204  // check if level has changed
205  LevelOld = Aig_ObjLevel(pObjNew);
206  if ( LevelOld == Aig_ObjLevelNew(pObjNew) )
207  return;
208  // start the data structure for level update
209  // we cannot fail to visit a node when using this structure because the
210  // nodes are stored by their _old_ levels, which are assumed to be correct
211  Vec_VecClear( p->vLevels );
212  Vec_VecPush( p->vLevels, LevelOld, pObjNew );
213  pObjNew->fMarkA = 1;
214  // recursively update level
215  Vec_VecForEachEntryStart( Aig_Obj_t *, p->vLevels, pTemp, Lev, k, LevelOld )
216  {
217  pTemp->fMarkA = 0;
218  assert( Aig_ObjLevel(pTemp) == Lev );
219  pTemp->Level = Aig_ObjLevelNew(pTemp);
220  // if the level did not change, no need to check the fanout levels
221  if ( Aig_ObjLevel(pTemp) == Lev )
222  continue;
223  // schedule fanout for level update
224  Aig_ObjForEachFanout( p, pTemp, pFanout, iFanout, m )
225  {
226  if ( Aig_ObjIsNode(pFanout) && !pFanout->fMarkA )
227  {
228  assert( Aig_ObjLevel(pFanout) >= Lev );
229  Vec_VecPush( p->vLevels, Aig_ObjLevel(pFanout), pFanout );
230  pFanout->fMarkA = 1;
231  }
232  }
233  }
234 }
#define Aig_ObjForEachFanout(p, pObj, pFanout, iFan, i)
Definition: aig.h:427
static int Aig_ObjLevelNew(Aig_Obj_t *pObj)
Definition: aig.h:324
unsigned Level
Definition: aig.h:82
static void Vec_VecPush(Vec_Vec_t *p, int Level, void *Entry)
Definition: vecVec.h:456
static Vec_Vec_t * Vec_VecAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecVec.h:145
static Llb_Mgr_t * p
Definition: llb3Image.c:950
unsigned int fMarkA
Definition: aig.h:79
static void Vec_VecClear(Vec_Vec_t *p)
Definition: vecVec.h:437
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
Definition: aig.h:69
#define Vec_VecForEachEntryStart(Type, vGlob, pEntry, i, k, LevelStart)
Definition: vecVec.h:92
static int Aig_ObjLevel(Aig_Obj_t *pObj)
Definition: aig.h:323
#define assert(ex)
Definition: util_old.h:213
int Aig_ManLevels(Aig_Man_t *p)
Definition: aigUtil.c:102
void Aig_ManUpdateReverseLevel ( Aig_Man_t p,
Aig_Obj_t pObjNew 
)

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

Synopsis [Incrementally updates level of the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 247 of file aigTiming.c.

248 {
249  Aig_Obj_t * pFanin, * pTemp;
250  int LevelOld, LevFanin, Lev, k;
251  assert( p->vLevelR != NULL );
252  assert( Aig_ObjIsNode(pObjNew) );
253  // allocate level if needed
254  if ( p->vLevels == NULL )
255  p->vLevels = Vec_VecAlloc( Aig_ManLevels(p) + 8 );
256  // check if level has changed
257  LevelOld = Aig_ObjReverseLevel(p, pObjNew);
258  if ( LevelOld == Aig_ObjReverseLevelNew(p, pObjNew) )
259  return;
260  // start the data structure for level update
261  // we cannot fail to visit a node when using this structure because the
262  // nodes are stored by their _old_ levels, which are assumed to be correct
263  Vec_VecClear( p->vLevels );
264  Vec_VecPush( p->vLevels, LevelOld, pObjNew );
265  pObjNew->fMarkA = 1;
266  // recursively update level
267  Vec_VecForEachEntryStart( Aig_Obj_t *, p->vLevels, pTemp, Lev, k, LevelOld )
268  {
269  pTemp->fMarkA = 0;
270  LevelOld = Aig_ObjReverseLevel(p, pTemp);
271  assert( LevelOld == Lev );
273  // if the level did not change, to need to check the fanout levels
274  if ( Aig_ObjReverseLevel(p, pTemp) == Lev )
275  continue;
276  // schedule fanins for level update
277  pFanin = Aig_ObjFanin0(pTemp);
278  if ( Aig_ObjIsNode(pFanin) && !pFanin->fMarkA )
279  {
280  LevFanin = Aig_ObjReverseLevel( p, pFanin );
281  assert( LevFanin >= Lev );
282  Vec_VecPush( p->vLevels, LevFanin, pFanin );
283  pFanin->fMarkA = 1;
284  }
285  pFanin = Aig_ObjFanin1(pTemp);
286  if ( Aig_ObjIsNode(pFanin) && !pFanin->fMarkA )
287  {
288  LevFanin = Aig_ObjReverseLevel( p, pFanin );
289  assert( LevFanin >= Lev );
290  Vec_VecPush( p->vLevels, LevFanin, pFanin );
291  pFanin->fMarkA = 1;
292  }
293  }
294 }
static void Vec_VecPush(Vec_Vec_t *p, int Level, void *Entry)
Definition: vecVec.h:456
static Vec_Vec_t * Vec_VecAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecVec.h:145
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
unsigned int fMarkA
Definition: aig.h:79
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static void Vec_VecClear(Vec_Vec_t *p)
Definition: vecVec.h:437
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
int Aig_ObjReverseLevelNew(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigTiming.c:117
static ABC_NAMESPACE_IMPL_START int Aig_ObjReverseLevel(Aig_Man_t *p, Aig_Obj_t *pObj)
DECLARATIONS ///.
Definition: aigTiming.c:46
Definition: aig.h:69
#define Vec_VecForEachEntryStart(Type, vGlob, pEntry, i, k, LevelStart)
Definition: vecVec.h:92
static void Aig_ObjSetReverseLevel(Aig_Man_t *p, Aig_Obj_t *pObj, int LevelR)
Definition: aigTiming.c:65
#define assert(ex)
Definition: util_old.h:213
int Aig_ManLevels(Aig_Man_t *p)
Definition: aigUtil.c:102
void Aig_ManVerifyLevel ( Aig_Man_t p)

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

Synopsis [Verifies direct level of the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 307 of file aigTiming.c.

308 {
309  Aig_Obj_t * pObj;
310  int i, Counter = 0;
311  assert( p->pFanData );
312  Aig_ManForEachNode( p, pObj, i )
313  if ( Aig_ObjLevel(pObj) != Aig_ObjLevelNew(pObj) )
314  {
315  printf( "Level of node %6d should be %4d instead of %4d.\n",
316  pObj->Id, Aig_ObjLevelNew(pObj), Aig_ObjLevel(pObj) );
317  Counter++;
318  }
319  if ( Counter )
320  printf( "Levels of %d nodes are incorrect.\n", Counter );
321 }
static int Aig_ObjLevelNew(Aig_Obj_t *pObj)
Definition: aig.h:324
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
static int Counter
static int Aig_ObjLevel(Aig_Obj_t *pObj)
Definition: aig.h:323
#define assert(ex)
Definition: util_old.h:213
void Aig_ManVerifyReverseLevel ( Aig_Man_t p)

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

Synopsis [Verifies reverse level of the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 334 of file aigTiming.c.

335 {
336  Aig_Obj_t * pObj;
337  int i, Counter = 0;
338  assert( p->vLevelR );
339  Aig_ManForEachNode( p, pObj, i )
340  if ( Aig_ObjLevel(pObj) != Aig_ObjLevelNew(pObj) )
341  {
342  printf( "Reverse level of node %6d should be %4d instead of %4d.\n",
343  pObj->Id, Aig_ObjReverseLevelNew(p, pObj), Aig_ObjReverseLevel(p, pObj) );
344  Counter++;
345  }
346  if ( Counter )
347  printf( "Reverse levels of %d nodes are incorrect.\n", Counter );
348 }
static int Aig_ObjLevelNew(Aig_Obj_t *pObj)
Definition: aig.h:324
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Aig_ObjReverseLevelNew(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigTiming.c:117
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
if(last==0)
Definition: sparse_int.h:34
static ABC_NAMESPACE_IMPL_START int Aig_ObjReverseLevel(Aig_Man_t *p, Aig_Obj_t *pObj)
DECLARATIONS ///.
Definition: aigTiming.c:46
Definition: aig.h:69
static int Counter
static int Aig_ObjLevel(Aig_Obj_t *pObj)
Definition: aig.h:323
#define assert(ex)
Definition: util_old.h:213
int Aig_ManVerifyTopoOrder ( Aig_Man_t p)

DECLARATIONS ///.

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

FileName [aigDfs.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [AIG package.]

Synopsis [DFS traversal procedures.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Verifies that the objects are in a topo order.]

Description []

SideEffects []

SeeAlso []

Definition at line 46 of file aigDfs.c.

47 {
48  Aig_Obj_t * pObj, * pNext;
49  int i, k, iBox, iTerm1, nTerms;
52  Aig_ManForEachObj( p, pObj, i )
53  {
54  if ( Aig_ObjIsNode(pObj) )
55  {
56  pNext = Aig_ObjFanin0(pObj);
57  if ( !Aig_ObjIsTravIdCurrent(p,pNext) )
58  {
59  printf( "Node %d has fanin %d that is not in a topological order.\n", pObj->Id, pNext->Id );
60  return 0;
61  }
62  pNext = Aig_ObjFanin1(pObj);
63  if ( !Aig_ObjIsTravIdCurrent(p,pNext) )
64  {
65  printf( "Node %d has fanin %d that is not in a topological order.\n", pObj->Id, pNext->Id );
66  return 0;
67  }
68  }
69  else if ( Aig_ObjIsCo(pObj) || Aig_ObjIsBuf(pObj) )
70  {
71  pNext = Aig_ObjFanin0(pObj);
72  if ( !Aig_ObjIsTravIdCurrent(p,pNext) )
73  {
74  printf( "Node %d has fanin %d that is not in a topological order.\n", pObj->Id, pNext->Id );
75  return 0;
76  }
77  }
78  else if ( Aig_ObjIsCi(pObj) )
79  {
80  if ( p->pManTime )
81  {
82  iBox = Tim_ManBoxForCi( (Tim_Man_t *)p->pManTime, Aig_ObjCioId(pObj) );
83  if ( iBox >= 0 ) // this is not a true PI
84  {
85  iTerm1 = Tim_ManBoxInputFirst( (Tim_Man_t *)p->pManTime, iBox );
86  nTerms = Tim_ManBoxInputNum( (Tim_Man_t *)p->pManTime, iBox );
87  for ( k = 0; k < nTerms; k++ )
88  {
89  pNext = Aig_ManCo( p, iTerm1 + k );
90  assert( Tim_ManBoxForCo( (Tim_Man_t *)p->pManTime, Aig_ObjCioId(pNext) ) == iBox );
91  if ( !Aig_ObjIsTravIdCurrent(p,pNext) )
92  {
93  printf( "Box %d has input %d that is not in a topological order.\n", iBox, pNext->Id );
94  return 0;
95  }
96  }
97  }
98  }
99  }
100  else if ( !Aig_ObjIsConst1(pObj) )
101  assert( 0 );
102  Aig_ObjSetTravIdCurrent( p, pObj );
103  }
105  return 1;
106 }
int Tim_ManBoxForCi(Tim_Man_t *p, int iCo)
Definition: timBox.c:86
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
int Tim_ManBoxForCo(Tim_Man_t *p, int iCi)
Definition: timBox.c:104
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Aig_ObjIsBuf(Aig_Obj_t *pObj)
Definition: aig.h:277
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
Definition: aig.h:69
void Aig_ManSetCioIds(Aig_Man_t *p)
Definition: aigUtil.c:965
int Tim_ManBoxInputNum(Tim_Man_t *p, int iBox)
Definition: timBox.c:186
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
Definition: aig.h:267
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
void Aig_ManCleanCioIds(Aig_Man_t *p)
Definition: aigUtil.c:986
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
int Tim_ManBoxInputFirst(Tim_Man_t *p, int iBox)
Definition: timBox.c:122
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
int Id
Definition: aig.h:85
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
static int Aig_ObjCioId(Aig_Obj_t *pObj)
Definition: aig.h:285
Aig_Obj_t* Aig_Miter ( Aig_Man_t p,
Vec_Ptr_t vPairs 
)

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

Synopsis [Implements the miter.]

Description []

SideEffects []

SeeAlso []

Definition at line 431 of file aigOper.c.

432 {
433  int i;
434  assert( vPairs->nSize > 0 );
435  assert( vPairs->nSize % 2 == 0 );
436  for ( i = 0; i < vPairs->nSize; i += 2 )
437  vPairs->pArray[i/2] = Aig_Not( Aig_Exor( p, (Aig_Obj_t *)vPairs->pArray[i], (Aig_Obj_t *)vPairs->pArray[i+1] ) );
438  vPairs->nSize = vPairs->nSize/2;
439  return Aig_Not( Aig_Multi_rec( p, (Aig_Obj_t **)vPairs->pArray, vPairs->nSize, AIG_OBJ_AND ) );
440 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Aig_Obj_t * Aig_Exor(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:220
static Aig_Obj_t * Aig_Not(Aig_Obj_t *p)
Definition: aig.h:247
Aig_Obj_t * Aig_Multi_rec(Aig_Man_t *p, Aig_Obj_t **ppObjs, int nObjs, Aig_Type_t Type)
Definition: aigOper.c:392
Definition: aig.h:69
#define assert(ex)
Definition: util_old.h:213
Aig_Obj_t* Aig_MiterTwo ( Aig_Man_t p,
Vec_Ptr_t vNodes1,
Vec_Ptr_t vNodes2 
)

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

Synopsis [Implements the miter.]

Description []

SideEffects []

SeeAlso []

Definition at line 453 of file aigOper.c.

454 {
455  int i;
456  assert( vNodes1->nSize > 0 && vNodes1->nSize > 0 );
457  assert( vNodes1->nSize == vNodes2->nSize );
458  for ( i = 0; i < vNodes1->nSize; i++ )
459  vNodes1->pArray[i] = Aig_Not( Aig_Exor( p, (Aig_Obj_t *)vNodes1->pArray[i], (Aig_Obj_t *)vNodes2->pArray[i] ) );
460  return Aig_Not( Aig_Multi_rec( p, (Aig_Obj_t **)vNodes1->pArray, vNodes1->nSize, AIG_OBJ_AND ) );
461 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Aig_Obj_t * Aig_Exor(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:220
static Aig_Obj_t * Aig_Not(Aig_Obj_t *p)
Definition: aig.h:247
Aig_Obj_t * Aig_Multi_rec(Aig_Man_t *p, Aig_Obj_t **ppObjs, int nObjs, Aig_Type_t Type)
Definition: aigOper.c:392
Definition: aig.h:69
#define assert(ex)
Definition: util_old.h:213
char* Aig_MmFixedEntryFetch ( Aig_MmFixed_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 161 of file aigMem.c.

162 {
163  char * pTemp;
164  int i;
165 
166  // check if there are still free entries
167  if ( p->nEntriesUsed == p->nEntriesAlloc )
168  { // need to allocate more entries
169  assert( p->pEntriesFree == NULL );
170  if ( p->nChunks == p->nChunksAlloc )
171  {
172  p->nChunksAlloc *= 2;
173  p->pChunks = ABC_REALLOC( char *, p->pChunks, p->nChunksAlloc );
174  }
175  p->pEntriesFree = ABC_ALLOC( char, p->nEntrySize * p->nChunkSize );
176  p->nMemoryAlloc += p->nEntrySize * p->nChunkSize;
177  // transform these entries into a linked list
178  pTemp = p->pEntriesFree;
179  for ( i = 1; i < p->nChunkSize; i++ )
180  {
181  *((char **)pTemp) = pTemp + p->nEntrySize;
182  pTemp += p->nEntrySize;
183  }
184  // set the last link
185  *((char **)pTemp) = NULL;
186  // add the chunk to the chunk storage
187  p->pChunks[ p->nChunks++ ] = p->pEntriesFree;
188  // add to the number of entries allocated
189  p->nEntriesAlloc += p->nChunkSize;
190  }
191  // incrememt the counter of used entries
192  p->nEntriesUsed++;
193  if ( p->nEntriesMax < p->nEntriesUsed )
194  p->nEntriesMax = p->nEntriesUsed;
195  // return the first entry in the free entry list
196  pTemp = p->pEntriesFree;
197  p->pEntriesFree = *((char **)pTemp);
198  return pTemp;
199 }
#define ABC_REALLOC(type, obj, num)
Definition: abc_global.h:233
int nChunks
Definition: aigMem.c:42
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
char ** pChunks
Definition: aigMem.c:43
char * pEntriesFree
Definition: aigMem.c:37
int nChunkSize
Definition: aigMem.c:40
int nEntrySize
Definition: aigMem.c:33
int nMemoryAlloc
Definition: aigMem.c:47
int nEntriesMax
Definition: aigMem.c:36
int nEntriesUsed
Definition: aigMem.c:35
#define assert(ex)
Definition: util_old.h:213
int nChunksAlloc
Definition: aigMem.c:41
int nEntriesAlloc
Definition: aigMem.c:34
void Aig_MmFixedEntryRecycle ( Aig_MmFixed_t p,
char *  pEntry 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 212 of file aigMem.c.

213 {
214  // decrement the counter of used entries
215  p->nEntriesUsed--;
216  // add the entry to the linked list of free entries
217  *((char **)pEntry) = p->pEntriesFree;
218  p->pEntriesFree = pEntry;
219 }
char * pEntriesFree
Definition: aigMem.c:37
int nEntriesUsed
Definition: aigMem.c:35
int Aig_MmFixedReadMaxEntriesUsed ( Aig_MmFixed_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 287 of file aigMem.c.

288 {
289  return p->nEntriesMax;
290 }
int nEntriesMax
Definition: aigMem.c:36
int Aig_MmFixedReadMemUsage ( Aig_MmFixed_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 271 of file aigMem.c.

272 {
273  return p->nMemoryAlloc;
274 }
int nMemoryAlloc
Definition: aigMem.c:47
void Aig_MmFixedRestart ( Aig_MmFixed_t p)

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

Synopsis []

Description [Relocates all the memory except the first chunk.]

SideEffects []

SeeAlso []

Definition at line 232 of file aigMem.c.

233 {
234  int i;
235  char * pTemp;
236  if ( p->nChunks == 0 )
237  return;
238  // deallocate all chunks except the first one
239  for ( i = 1; i < p->nChunks; i++ )
240  ABC_FREE( p->pChunks[i] );
241  p->nChunks = 1;
242  // transform these entries into a linked list
243  pTemp = p->pChunks[0];
244  for ( i = 1; i < p->nChunkSize; i++ )
245  {
246  *((char **)pTemp) = pTemp + p->nEntrySize;
247  pTemp += p->nEntrySize;
248  }
249  // set the last link
250  *((char **)pTemp) = NULL;
251  // set the free entry list
252  p->pEntriesFree = p->pChunks[0];
253  // set the correct statistics
254  p->nMemoryAlloc = p->nEntrySize * p->nChunkSize;
255  p->nMemoryUsed = 0;
256  p->nEntriesAlloc = p->nChunkSize;
257  p->nEntriesUsed = 0;
258 }
int nChunks
Definition: aigMem.c:42
char ** pChunks
Definition: aigMem.c:43
char * pEntriesFree
Definition: aigMem.c:37
int nChunkSize
Definition: aigMem.c:40
int nEntrySize
Definition: aigMem.c:33
int nMemoryAlloc
Definition: aigMem.c:47
int nEntriesUsed
Definition: aigMem.c:35
#define ABC_FREE(obj)
Definition: abc_global.h:232
int nMemoryUsed
Definition: aigMem.c:46
int nEntriesAlloc
Definition: aigMem.c:34
Aig_MmFixed_t* Aig_MmFixedStart ( int  nEntrySize,
int  nEntriesMax 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Allocates memory pieces of fixed size.]

Description [The size of the chunk is computed as the minimum of 1024 entries and 64K. Can only work with entry size at least 4 byte long.]

SideEffects []

SeeAlso []

Definition at line 96 of file aigMem.c.

97 {
98  Aig_MmFixed_t * p;
99 
100  p = ABC_ALLOC( Aig_MmFixed_t, 1 );
101  memset( p, 0, sizeof(Aig_MmFixed_t) );
102 
103  p->nEntrySize = nEntrySize;
104  p->nEntriesAlloc = 0;
105  p->nEntriesUsed = 0;
106  p->pEntriesFree = NULL;
107 
108  p->nChunkSize = nEntriesMax / 8;
109  if ( p->nChunkSize < 8 )
110  p->nChunkSize = 8;
111 
112  p->nChunksAlloc = 64;
113  p->nChunks = 0;
114  p->pChunks = ABC_ALLOC( char *, p->nChunksAlloc );
115 
116  p->nMemoryUsed = 0;
117  p->nMemoryAlloc = 0;
118  return p;
119 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nChunks
Definition: aigMem.c:42
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
char ** pChunks
Definition: aigMem.c:43
char * pEntriesFree
Definition: aigMem.c:37
DECLARATIONS ///.
Definition: aigMem.c:30
int nChunkSize
Definition: aigMem.c:40
int nEntrySize
Definition: aigMem.c:33
int nMemoryAlloc
Definition: aigMem.c:47
int nEntriesUsed
Definition: aigMem.c:35
int nChunksAlloc
Definition: aigMem.c:41
int nMemoryUsed
Definition: aigMem.c:46
int nEntriesAlloc
Definition: aigMem.c:34
void Aig_MmFixedStop ( Aig_MmFixed_t p,
int  fVerbose 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 132 of file aigMem.c.

133 {
134  int i;
135  if ( p == NULL )
136  return;
137  if ( fVerbose )
138  {
139  printf( "Fixed memory manager: Entry = %5d. Chunk = %5d. Chunks used = %5d.\n",
140  p->nEntrySize, p->nChunkSize, p->nChunks );
141  printf( " Entries used = %8d. Entries peak = %8d. Memory used = %8d. Memory alloc = %8d.\n",
143  }
144  for ( i = 0; i < p->nChunks; i++ )
145  ABC_FREE( p->pChunks[i] );
146  ABC_FREE( p->pChunks );
147  ABC_FREE( p );
148 }
int nChunks
Definition: aigMem.c:42
char ** pChunks
Definition: aigMem.c:43
int nChunkSize
Definition: aigMem.c:40
int nEntrySize
Definition: aigMem.c:33
int nMemoryAlloc
Definition: aigMem.c:47
int nEntriesMax
Definition: aigMem.c:36
int nEntriesUsed
Definition: aigMem.c:35
#define ABC_FREE(obj)
Definition: abc_global.h:232
char* Aig_MmFlexEntryFetch ( Aig_MmFlex_t p,
int  nBytes 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 366 of file aigMem.c.

367 {
368  char * pTemp;
369  // check if there are still free entries
370  if ( p->pCurrent == NULL || p->pCurrent + nBytes > p->pEnd )
371  { // need to allocate more entries
372  if ( p->nChunks == p->nChunksAlloc )
373  {
374  p->nChunksAlloc *= 2;
375  p->pChunks = ABC_REALLOC( char *, p->pChunks, p->nChunksAlloc );
376  }
377  if ( nBytes > p->nChunkSize )
378  {
379  // resize the chunk size if more memory is requested than it can give
380  // (ideally, this should never happen)
381  p->nChunkSize = 2 * nBytes;
382  }
383  p->pCurrent = ABC_ALLOC( char, p->nChunkSize );
384  p->pEnd = p->pCurrent + p->nChunkSize;
385  p->nMemoryAlloc += p->nChunkSize;
386  // add the chunk to the chunk storage
387  p->pChunks[ p->nChunks++ ] = p->pCurrent;
388  }
389  assert( p->pCurrent + nBytes <= p->pEnd );
390  // increment the counter of used entries
391  p->nEntriesUsed++;
392  // keep track of the memory used
393  p->nMemoryUsed += nBytes;
394  // return the next entry
395  pTemp = p->pCurrent;
396  p->pCurrent += nBytes;
397  return pTemp;
398 }
int nMemoryAlloc
Definition: aigMem.c:65
int nChunks
Definition: aigMem.c:60
#define ABC_REALLOC(type, obj, num)
Definition: abc_global.h:233
int nChunksAlloc
Definition: aigMem.c:59
int nEntriesUsed
Definition: aigMem.c:53
int nChunkSize
Definition: aigMem.c:58
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
int nMemoryUsed
Definition: aigMem.c:64
char * pEnd
Definition: aigMem.c:55
char ** pChunks
Definition: aigMem.c:61
char * pCurrent
Definition: aigMem.c:54
#define assert(ex)
Definition: util_old.h:213
int Aig_MmFlexReadMemUsage ( Aig_MmFlex_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 439 of file aigMem.c.

440 {
441  return p->nMemoryUsed;
442 }
int nMemoryUsed
Definition: aigMem.c:64
void Aig_MmFlexRestart ( Aig_MmFlex_t p)

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

Synopsis []

Description [Relocates all the memory except the first chunk.]

SideEffects []

SeeAlso []

Definition at line 411 of file aigMem.c.

412 {
413  int i;
414  if ( p->nChunks == 0 )
415  return;
416  // deallocate all chunks except the first one
417  for ( i = 1; i < p->nChunks; i++ )
418  ABC_FREE( p->pChunks[i] );
419  p->nChunks = 1;
420  p->nMemoryAlloc = p->nChunkSize;
421  // transform these entries into a linked list
422  p->pCurrent = p->pChunks[0];
423  p->pEnd = p->pCurrent + p->nChunkSize;
424  p->nEntriesUsed = 0;
425  p->nMemoryUsed = 0;
426 }
int nMemoryAlloc
Definition: aigMem.c:65
int nChunks
Definition: aigMem.c:60
int nEntriesUsed
Definition: aigMem.c:53
int nChunkSize
Definition: aigMem.c:58
int nMemoryUsed
Definition: aigMem.c:64
char * pEnd
Definition: aigMem.c:55
char ** pChunks
Definition: aigMem.c:61
#define ABC_FREE(obj)
Definition: abc_global.h:232
char * pCurrent
Definition: aigMem.c:54
Aig_MmFlex_t* Aig_MmFlexStart ( )

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

Synopsis [Allocates entries of flexible size.]

Description [Can only work with entry size at least 4 byte long.]

SideEffects []

SeeAlso []

Definition at line 305 of file aigMem.c.

306 {
307  Aig_MmFlex_t * p;
308 
309  p = ABC_ALLOC( Aig_MmFlex_t, 1 );
310  memset( p, 0, sizeof(Aig_MmFlex_t) );
311 
312  p->nEntriesUsed = 0;
313  p->pCurrent = NULL;
314  p->pEnd = NULL;
315 
316  p->nChunkSize = (1 << 18);
317  p->nChunksAlloc = 64;
318  p->nChunks = 0;
319  p->pChunks = ABC_ALLOC( char *, p->nChunksAlloc );
320 
321  p->nMemoryUsed = 0;
322  p->nMemoryAlloc = 0;
323  return p;
324 }
char * memset()
int nMemoryAlloc
Definition: aigMem.c:65
int nChunks
Definition: aigMem.c:60
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nChunksAlloc
Definition: aigMem.c:59
int nEntriesUsed
Definition: aigMem.c:53
int nChunkSize
Definition: aigMem.c:58
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
int nMemoryUsed
Definition: aigMem.c:64
char * pEnd
Definition: aigMem.c:55
char ** pChunks
Definition: aigMem.c:61
char * pCurrent
Definition: aigMem.c:54
void Aig_MmFlexStop ( Aig_MmFlex_t p,
int  fVerbose 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 337 of file aigMem.c.

338 {
339  int i;
340  if ( p == NULL )
341  return;
342  if ( fVerbose )
343  {
344  printf( "Flexible memory manager: Chunk size = %d. Chunks used = %d.\n",
345  p->nChunkSize, p->nChunks );
346  printf( " Entries used = %d. Memory used = %d. Memory alloc = %d.\n",
348  }
349  for ( i = 0; i < p->nChunks; i++ )
350  ABC_FREE( p->pChunks[i] );
351  ABC_FREE( p->pChunks );
352  ABC_FREE( p );
353 }
int nMemoryAlloc
Definition: aigMem.c:65
int nChunks
Definition: aigMem.c:60
int nEntriesUsed
Definition: aigMem.c:53
int nChunkSize
Definition: aigMem.c:58
int nMemoryUsed
Definition: aigMem.c:64
char ** pChunks
Definition: aigMem.c:61
#define ABC_FREE(obj)
Definition: abc_global.h:232
char* Aig_MmStepEntryFetch ( Aig_MmStep_t p,
int  nBytes 
)

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

Synopsis [Creates the entry.]

Description []

SideEffects []

SeeAlso []

Definition at line 534 of file aigMem.c.

535 {
536  if ( nBytes == 0 )
537  return NULL;
538  if ( nBytes > p->nMapSize )
539  {
540  if ( p->nChunks == p->nChunksAlloc )
541  {
542  p->nChunksAlloc *= 2;
543  p->pChunks = ABC_REALLOC( char *, p->pChunks, p->nChunksAlloc );
544  }
545  p->pChunks[ p->nChunks++ ] = ABC_ALLOC( char, nBytes );
546  return p->pChunks[p->nChunks-1];
547  }
548  return Aig_MmFixedEntryFetch( p->pMap[nBytes] );
549 }
#define ABC_REALLOC(type, obj, num)
Definition: abc_global.h:233
Aig_MmFixed_t ** pMap
Definition: aigMem.c:73
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
int nMapSize
Definition: aigMem.c:72
char * Aig_MmFixedEntryFetch(Aig_MmFixed_t *p)
Definition: aigMem.c:161
int nChunksAlloc
Definition: aigMem.c:75
int nChunks
Definition: aigMem.c:76
char ** pChunks
Definition: aigMem.c:77
void Aig_MmStepEntryRecycle ( Aig_MmStep_t p,
char *  pEntry,
int  nBytes 
)

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

Synopsis [Recycles the entry.]

Description []

SideEffects []

SeeAlso []

Definition at line 563 of file aigMem.c.

564 {
565  if ( nBytes == 0 )
566  return;
567  if ( nBytes > p->nMapSize )
568  {
569 // ABC_FREE( pEntry );
570  return;
571  }
572  Aig_MmFixedEntryRecycle( p->pMap[nBytes], pEntry );
573 }
Aig_MmFixed_t ** pMap
Definition: aigMem.c:73
int nMapSize
Definition: aigMem.c:72
void Aig_MmFixedEntryRecycle(Aig_MmFixed_t *p, char *pEntry)
Definition: aigMem.c:212
int Aig_MmStepReadMemUsage ( Aig_MmStep_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 586 of file aigMem.c.

587 {
588  int i, nMemTotal = 0;
589  for ( i = 0; i < p->nMems; i++ )
590  nMemTotal += p->pMems[i]->nMemoryAlloc;
591  return nMemTotal;
592 }
int nMems
Definition: aigMem.c:70
Aig_MmFixed_t ** pMems
Definition: aigMem.c:71
int nMemoryAlloc
Definition: aigMem.c:47
Aig_MmStep_t* Aig_MmStepStart ( int  nSteps)

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

Synopsis [Starts the hierarchical memory manager.]

Description [This manager can allocate entries of any size. Iternally they are mapped into the entries with the number of bytes equal to the power of 2. The smallest entry size is 8 bytes. The next one is 16 bytes etc. So, if the user requests 6 bytes, he gets 8 byte entry. If we asks for 25 bytes, he gets 32 byte entry etc. The input parameters "nSteps" says how many fixed memory managers are employed internally. Calling this procedure with nSteps equal to 10 results in 10 hierarchically arranged internal memory managers, which can allocate up to 4096 (1Kb) entries. Requests for larger entries are handed over to malloc() and then ABC_FREE()ed.]

SideEffects []

SeeAlso []

Definition at line 468 of file aigMem.c.

469 {
470  Aig_MmStep_t * p;
471  int i, k;
472  p = ABC_ALLOC( Aig_MmStep_t, 1 );
473  memset( p, 0, sizeof(Aig_MmStep_t) );
474  p->nMems = nSteps;
475  // start the fixed memory managers
476  p->pMems = ABC_ALLOC( Aig_MmFixed_t *, p->nMems );
477  for ( i = 0; i < p->nMems; i++ )
478  p->pMems[i] = Aig_MmFixedStart( (8<<i), (1<<13) );
479  // set up the mapping of the required memory size into the corresponding manager
480  p->nMapSize = (4<<p->nMems);
481  p->pMap = ABC_ALLOC( Aig_MmFixed_t *, p->nMapSize+1 );
482  p->pMap[0] = NULL;
483  for ( k = 1; k <= 4; k++ )
484  p->pMap[k] = p->pMems[0];
485  for ( i = 0; i < p->nMems; i++ )
486  for ( k = (4<<i)+1; k <= (8<<i); k++ )
487  p->pMap[k] = p->pMems[i];
488 //for ( i = 1; i < 100; i ++ )
489 //printf( "%10d: size = %10d\n", i, p->pMap[i]->nEntrySize );
490  p->nChunksAlloc = 64;
491  p->nChunks = 0;
492  p->pChunks = ABC_ALLOC( char *, p->nChunksAlloc );
493  return p;
494 }
char * memset()
int nMems
Definition: aigMem.c:70
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Aig_MmFixed_t ** pMap
Definition: aigMem.c:73
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
for(p=first;p->value< newval;p=p->next)
Aig_MmFixed_t * Aig_MmFixedStart(int nEntrySize, int nEntriesMax)
FUNCTION DEFINITIONS ///.
Definition: aigMem.c:96
DECLARATIONS ///.
Definition: aigMem.c:30
Aig_MmFixed_t ** pMems
Definition: aigMem.c:71
int nMapSize
Definition: aigMem.c:72
int nChunksAlloc
Definition: aigMem.c:75
int nChunks
Definition: aigMem.c:76
char ** pChunks
Definition: aigMem.c:77
void Aig_MmStepStop ( Aig_MmStep_t p,
int  fVerbose 
)

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

Synopsis [Stops the memory manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 507 of file aigMem.c.

508 {
509  int i;
510  for ( i = 0; i < p->nMems; i++ )
511  Aig_MmFixedStop( p->pMems[i], fVerbose );
512  if ( p->nChunksAlloc )
513  {
514  for ( i = 0; i < p->nChunks; i++ )
515  ABC_FREE( p->pChunks[i] );
516  ABC_FREE( p->pChunks );
517  }
518  ABC_FREE( p->pMems );
519  ABC_FREE( p->pMap );
520  ABC_FREE( p );
521 }
int nMems
Definition: aigMem.c:70
Aig_MmFixed_t ** pMap
Definition: aigMem.c:73
Aig_MmFixed_t ** pMems
Definition: aigMem.c:71
int nChunksAlloc
Definition: aigMem.c:75
#define ABC_FREE(obj)
Definition: abc_global.h:232
void Aig_MmFixedStop(Aig_MmFixed_t *p, int fVerbose)
Definition: aigMem.c:132
int nChunks
Definition: aigMem.c:76
char ** pChunks
Definition: aigMem.c:77
Aig_Obj_t* Aig_Multi ( Aig_Man_t p,
Aig_Obj_t **  pArgs,
int  nArgs,
Aig_Type_t  Type 
)

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

Synopsis [Old code.]

Description []

SideEffects []

SeeAlso []

Definition at line 413 of file aigOper.c.

414 {
415  assert( Type == AIG_OBJ_AND || Type == AIG_OBJ_EXOR );
416  assert( nArgs > 0 );
417  return Aig_Multi_rec( p, pArgs, nArgs, Type );
418 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Aig_Obj_t * Aig_Multi_rec(Aig_Man_t *p, Aig_Obj_t **ppObjs, int nObjs, Aig_Type_t Type)
Definition: aigOper.c:392
#define assert(ex)
Definition: util_old.h:213
Aig_Obj_t* Aig_Mux ( Aig_Man_t p,
Aig_Obj_t pC,
Aig_Obj_t p1,
Aig_Obj_t p0 
)

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

Synopsis [Implements ITE operation.]

Description []

SideEffects []

SeeAlso []

Definition at line 317 of file aigOper.c.

318 {
319  int fUseMuxCanon = 0;
320  Aig_Obj_t * pTempA1, * pTempA2, * pTempB1, * pTempB2, * pTemp;
321  int Count0, Count1;
322  if ( !fUseMuxCanon )
323  return Aig_Mux2( p, pC, p1, p0 );
324  if ( p0 == p1 )
325  return p0;
326  if ( p1 == Aig_Not(p0) )
327  return Aig_Exor( p, pC, p0 );
328  if ( pC == Aig_ManConst0(p) )
329  return p0;
330  if ( pC == Aig_ManConst1(p) )
331  return p1;
332  if ( p0 == Aig_ManConst0(p) )
333  return Aig_And( p, pC, p1 );
334  if ( p0 == Aig_ManConst1(p) )
335  return Aig_Or( p, Aig_Not(pC), p1 );
336  if ( p1 == Aig_ManConst0(p) )
337  return Aig_And( p, Aig_Not(pC), p0 );
338  if ( p1 == Aig_ManConst1(p) )
339  return Aig_Or( p, pC, p0 );
340  // implement the first MUX (F = C * x1 + C' * x0)
341  pTempA1 = Aig_TableLookupInt( p, pC, p1 );
342  pTempA2 = Aig_TableLookupInt( p, Aig_Not(pC), p0 );
343  if ( pTempA1 && pTempA2 )
344  {
345  pTemp = Aig_TableLookupInt( p, Aig_Not(pTempA1), Aig_Not(pTempA2) );
346  if ( pTemp ) return Aig_Not(pTemp);
347  }
348  Count0 = (pTempA1 != NULL) + (pTempA2 != NULL);
349  // implement the second MUX (F' = C * x1' + C' * x0')
350  pTempB1 = Aig_TableLookupInt( p, pC, Aig_Not(p1) );
351  pTempB2 = Aig_TableLookupInt( p, Aig_Not(pC), Aig_Not(p0) );
352  if ( pTempB1 && pTempB2 )
353  {
354  pTemp = Aig_TableLookupInt( p, Aig_Not(pTempB1), Aig_Not(pTempB2) );
355  if ( pTemp ) return pTemp;
356  }
357  Count1 = (pTempB1 != NULL) + (pTempB2 != NULL);
358  // compare and decide which one to implement
359  if ( Count0 >= Count1 )
360  return Aig_Or( p, Aig_And(p, pC, p1), Aig_And(p, Aig_Not(pC), p0) );
361  return Aig_Not( Aig_Or( p, Aig_And(p, pC, Aig_Not(p1)), Aig_And(p, Aig_Not(pC), Aig_Not(p0)) ) );
362 // return Aig_Or( p, Aig_And(p, pC, p1), Aig_And(p, Aig_Not(pC), p0) );
363 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Aig_Obj_t * Aig_Exor(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:220
static Aig_Obj_t * Aig_ManConst0(Aig_Man_t *p)
Definition: aig.h:263
static Aig_Obj_t * Aig_Not(Aig_Obj_t *p)
Definition: aig.h:247
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
Aig_Obj_t * Aig_Mux2(Aig_Man_t *p, Aig_Obj_t *pC, Aig_Obj_t *p1, Aig_Obj_t *p0)
Definition: aigOper.c:301
Aig_Obj_t * Aig_TableLookupInt(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:275
Definition: aig.h:69
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
Aig_Obj_t * Aig_Or(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:259
int Aig_NodeDeref_rec ( Aig_Obj_t pNode,
unsigned  LevelMin,
float *  pPower,
float *  pProbs 
)

DECLARATIONS ///.

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

FileName [aigMffc.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [AIG package.]

Synopsis [Computation of MFFCs.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Dereferences the node's MFFC.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file aigMffc.c.

46 {
47  float Power0 = 0.0, Power1 = 0.0;
48  Aig_Obj_t * pFanin;
49  int Counter = 0;
50  if ( pProbs )
51  *pPower = 0.0;
52  if ( Aig_ObjIsCi(pNode) )
53  return 0;
54  // consider the first fanin
55  pFanin = Aig_ObjFanin0(pNode);
56  assert( pFanin->nRefs > 0 );
57  if ( --pFanin->nRefs == 0 && (!LevelMin || pFanin->Level > LevelMin) )
58  Counter += Aig_NodeDeref_rec( pFanin, LevelMin, &Power0, pProbs );
59  if ( pProbs )
60  *pPower += Power0 + 2.0 * pProbs[pFanin->Id] * (1.0 - pProbs[pFanin->Id]);
61  // skip the buffer
62  if ( Aig_ObjIsBuf(pNode) )
63  return Counter;
64  assert( Aig_ObjIsNode(pNode) );
65  // consider the second fanin
66  pFanin = Aig_ObjFanin1(pNode);
67  assert( pFanin->nRefs > 0 );
68  if ( --pFanin->nRefs == 0 && (!LevelMin || pFanin->Level > LevelMin) )
69  Counter += Aig_NodeDeref_rec( pFanin, LevelMin, &Power1, pProbs );
70  if ( pProbs )
71  *pPower += Power1 + 2.0 * pProbs[pFanin->Id] * (1.0 - pProbs[pFanin->Id]);
72  return Counter + 1;
73 }
unsigned Level
Definition: aig.h:82
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Aig_ObjIsBuf(Aig_Obj_t *pObj)
Definition: aig.h:277
Definition: aig.h:69
static int Counter
#define assert(ex)
Definition: util_old.h:213
ABC_NAMESPACE_IMPL_START int Aig_NodeDeref_rec(Aig_Obj_t *pNode, unsigned LevelMin, float *pPower, float *pProbs)
DECLARATIONS ///.
Definition: aigMffc.c:45
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
int Id
Definition: aig.h:85
unsigned int nRefs
Definition: aig.h:81
void Aig_NodeIntersectLists ( Vec_Ptr_t vArr1,
Vec_Ptr_t vArr2,
Vec_Ptr_t vArr 
)

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

Synopsis [Returns the result of intersecting the two vectors.]

Description [Assumes that the vectors are sorted in the increasing order.]

SideEffects []

SeeAlso []

Definition at line 1259 of file aigUtil.c.

1260 {
1261  Aig_Obj_t ** pBeg = (Aig_Obj_t **)vArr->pArray;
1262  Aig_Obj_t ** pBeg1 = (Aig_Obj_t **)vArr1->pArray;
1263  Aig_Obj_t ** pBeg2 = (Aig_Obj_t **)vArr2->pArray;
1264  Aig_Obj_t ** pEnd1 = (Aig_Obj_t **)vArr1->pArray + vArr1->nSize;
1265  Aig_Obj_t ** pEnd2 = (Aig_Obj_t **)vArr2->pArray + vArr2->nSize;
1266  Vec_PtrGrow( vArr, Abc_MaxInt( Vec_PtrSize(vArr1), Vec_PtrSize(vArr2) ) );
1267  pBeg = (Aig_Obj_t **)vArr->pArray;
1268  while ( pBeg1 < pEnd1 && pBeg2 < pEnd2 )
1269  {
1270  if ( (*pBeg1)->Id == (*pBeg2)->Id )
1271  *pBeg++ = *pBeg1++, pBeg2++;
1272  else if ( (*pBeg1)->Id < (*pBeg2)->Id )
1273 // *pBeg++ = *pBeg1++;
1274  pBeg1++;
1275  else
1276 // *pBeg++ = *pBeg2++;
1277  pBeg2++;
1278  }
1279 // while ( pBeg1 < pEnd1 )
1280 // *pBeg++ = *pBeg1++;
1281 // while ( pBeg2 < pEnd2 )
1282 // *pBeg++ = *pBeg2++;
1283  vArr->nSize = pBeg - (Aig_Obj_t **)vArr->pArray;
1284  assert( vArr->nSize <= vArr->nCap );
1285  assert( vArr->nSize <= vArr1->nSize );
1286  assert( vArr->nSize <= vArr2->nSize );
1287 }
static void Vec_PtrGrow(Vec_Ptr_t *p, int nCapMin)
Definition: vecPtr.h:430
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Definition: aig.h:69
#define assert(ex)
Definition: util_old.h:213
int Aig_NodeMffcExtendCut ( Aig_Man_t p,
Aig_Obj_t pNode,
Vec_Ptr_t vLeaves,
Vec_Ptr_t vResult 
)

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

Synopsis [Expands the cut by adding the most closely related node.]

Description [Returns 1 if the cut exists.]

SideEffects []

SeeAlso []

Definition at line 265 of file aigMffc.c.

266 {
267  Aig_Obj_t * pObj, * pLeafBest;
268  int i, LevelMax, ConeSize1, ConeSize2, ConeCur1, ConeCur2, ConeBest;
269  // dereference the current cut
270  LevelMax = 0;
271  Vec_PtrForEachEntry( Aig_Obj_t *, vLeaves, pObj, i )
272  LevelMax = Abc_MaxInt( LevelMax, (int)pObj->Level );
273  if ( LevelMax == 0 )
274  return 0;
275  // dereference the cut
276  ConeSize1 = Aig_NodeDeref_rec( pNode, 0, NULL, NULL );
277  // try expanding each node in the boundary
278  ConeBest = ABC_INFINITY;
279  pLeafBest = NULL;
280  Vec_PtrForEachEntry( Aig_Obj_t *, vLeaves, pObj, i )
281  {
282  if ( (int)pObj->Level != LevelMax )
283  continue;
284  ConeCur1 = Aig_NodeDeref_rec( pObj, 0, NULL, NULL );
285  if ( ConeBest > ConeCur1 )
286  {
287  ConeBest = ConeCur1;
288  pLeafBest = pObj;
289  }
290  ConeCur2 = Aig_NodeRef_rec( pObj, 0 );
291  assert( ConeCur1 == ConeCur2 );
292  }
293  assert( pLeafBest != NULL );
294  assert( Aig_ObjIsNode(pLeafBest) );
295  // deref the best leaf
296  ConeCur1 = Aig_NodeDeref_rec( pLeafBest, 0, NULL, NULL );
297  // collect the cut nodes
298  Vec_PtrClear( vResult );
300  Aig_NodeMffcSupp_rec( p, pNode, 0, vResult, 1, pLeafBest );
301  // ref the nodes
302  ConeCur2 = Aig_NodeRef_rec( pLeafBest, 0 );
303  assert( ConeCur1 == ConeCur2 );
304  // ref the original node
305  ConeSize2 = Aig_NodeRef_rec( pNode, 0 );
306  assert( ConeSize1 == ConeSize2 );
307  return 1;
308 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
int Aig_NodeRef_rec(Aig_Obj_t *pNode, unsigned LevelMin)
Definition: aigMffc.c:86
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
void Aig_NodeMffcSupp_rec(Aig_Man_t *p, Aig_Obj_t *pNode, unsigned LevelMin, Vec_Ptr_t *vSupp, int fTopmost, Aig_Obj_t *pObjSkip)
Definition: aigMffc.c:150
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
ABC_NAMESPACE_IMPL_START int Aig_NodeDeref_rec(Aig_Obj_t *pNode, unsigned LevelMin, float *pPower, float *pProbs)
DECLARATIONS ///.
Definition: aigMffc.c:45
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
int Aig_NodeMffcLabel ( Aig_Man_t p,
Aig_Obj_t pNode,
float *  pPower 
)

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

Synopsis [Labels the nodes in the MFFC.]

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

SideEffects []

SeeAlso []

Definition at line 211 of file aigMffc.c.

212 {
213  int ConeSize1, ConeSize2;
214  assert( (pPower != NULL) == (p->vProbs != NULL) );
215  assert( !Aig_IsComplement(pNode) );
216  assert( Aig_ObjIsNode(pNode) );
218  ConeSize1 = Aig_NodeDeref_rec( pNode, 0, pPower, p->vProbs? (float *)p->vProbs->pArray : NULL );
219  ConeSize2 = Aig_NodeRefLabel_rec( p, pNode, 0 );
220  assert( ConeSize1 == ConeSize2 );
221  assert( ConeSize1 > 0 );
222  return ConeSize1;
223 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
int Aig_NodeRefLabel_rec(Aig_Man_t *p, Aig_Obj_t *pNode, unsigned LevelMin)
Definition: aigMffc.c:118
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
#define assert(ex)
Definition: util_old.h:213
ABC_NAMESPACE_IMPL_START int Aig_NodeDeref_rec(Aig_Obj_t *pNode, unsigned LevelMin, float *pPower, float *pProbs)
DECLARATIONS ///.
Definition: aigMffc.c:45
int Aig_NodeMffcLabelCut ( Aig_Man_t p,
Aig_Obj_t pNode,
Vec_Ptr_t vLeaves 
)

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

Synopsis [Labels the nodes in the MFFC.]

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

SideEffects []

SeeAlso []

Definition at line 236 of file aigMffc.c.

237 {
238  Aig_Obj_t * pObj;
239  int i, ConeSize1, ConeSize2;
240  assert( !Aig_IsComplement(pNode) );
241  assert( Aig_ObjIsNode(pNode) );
243  Vec_PtrForEachEntry( Aig_Obj_t *, vLeaves, pObj, i )
244  pObj->nRefs++;
245  ConeSize1 = Aig_NodeDeref_rec( pNode, 0, NULL, NULL );
246  ConeSize2 = Aig_NodeRefLabel_rec( p, pNode, 0 );
247  Vec_PtrForEachEntry( Aig_Obj_t *, vLeaves, pObj, i )
248  pObj->nRefs--;
249  assert( ConeSize1 == ConeSize2 );
250  assert( ConeSize1 > 0 );
251  return ConeSize1;
252 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
int Aig_NodeRefLabel_rec(Aig_Man_t *p, Aig_Obj_t *pNode, unsigned LevelMin)
Definition: aigMffc.c:118
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
Definition: aig.h:69
#define assert(ex)
Definition: util_old.h:213
ABC_NAMESPACE_IMPL_START int Aig_NodeDeref_rec(Aig_Obj_t *pNode, unsigned LevelMin, float *pPower, float *pProbs)
DECLARATIONS ///.
Definition: aigMffc.c:45
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
int Aig_NodeMffcSupp ( Aig_Man_t p,
Aig_Obj_t pNode,
int  LevelMin,
Vec_Ptr_t vSupp 
)

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

Synopsis [Collects the support of depth-limited MFFC.]

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

SideEffects []

SeeAlso []

Definition at line 179 of file aigMffc.c.

180 {
181  int ConeSize1, ConeSize2;
182  if ( vSupp ) Vec_PtrClear( vSupp );
183  if ( !Aig_ObjIsNode(pNode) )
184  {
185  if ( Aig_ObjIsCi(pNode) && vSupp )
186  Vec_PtrPush( vSupp, pNode );
187  return 0;
188  }
189  assert( !Aig_IsComplement(pNode) );
190  assert( Aig_ObjIsNode(pNode) );
192  ConeSize1 = Aig_NodeDeref_rec( pNode, LevelMin, NULL, NULL );
193  Aig_NodeMffcSupp_rec( p, pNode, LevelMin, vSupp, 1, NULL );
194  ConeSize2 = Aig_NodeRef_rec( pNode, LevelMin );
195  assert( ConeSize1 == ConeSize2 );
196  assert( ConeSize1 > 0 );
197  return ConeSize1;
198 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
int Aig_NodeRef_rec(Aig_Obj_t *pNode, unsigned LevelMin)
Definition: aigMffc.c:86
void Aig_NodeMffcSupp_rec(Aig_Man_t *p, Aig_Obj_t *pNode, unsigned LevelMin, Vec_Ptr_t *vSupp, int fTopmost, Aig_Obj_t *pObjSkip)
Definition: aigMffc.c:150
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
ABC_NAMESPACE_IMPL_START int Aig_NodeDeref_rec(Aig_Obj_t *pNode, unsigned LevelMin, float *pPower, float *pProbs)
DECLARATIONS ///.
Definition: aigMffc.c:45
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
int Aig_NodeRef_rec ( Aig_Obj_t pNode,
unsigned  LevelMin 
)

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

Synopsis [References the node's MFFC.]

Description []

SideEffects []

SeeAlso []

Definition at line 86 of file aigMffc.c.

87 {
88  Aig_Obj_t * pFanin;
89  int Counter = 0;
90  if ( Aig_ObjIsCi(pNode) )
91  return 0;
92  // consider the first fanin
93  pFanin = Aig_ObjFanin0(pNode);
94  if ( pFanin->nRefs++ == 0 && (!LevelMin || pFanin->Level > LevelMin) )
95  Counter += Aig_NodeRef_rec( pFanin, LevelMin );
96  // skip the buffer
97  if ( Aig_ObjIsBuf(pNode) )
98  return Counter;
99  assert( Aig_ObjIsNode(pNode) );
100  // consider the second fanin
101  pFanin = Aig_ObjFanin1(pNode);
102  if ( pFanin->nRefs++ == 0 && (!LevelMin || pFanin->Level > LevelMin) )
103  Counter += Aig_NodeRef_rec( pFanin, LevelMin );
104  return Counter + 1;
105 }
unsigned Level
Definition: aig.h:82
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Aig_ObjIsBuf(Aig_Obj_t *pObj)
Definition: aig.h:277
int Aig_NodeRef_rec(Aig_Obj_t *pNode, unsigned LevelMin)
Definition: aigMffc.c:86
Definition: aig.h:69
static int Counter
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
unsigned int nRefs
Definition: aig.h:81
void Aig_NodeUnionLists ( Vec_Ptr_t vArr1,
Vec_Ptr_t vArr2,
Vec_Ptr_t vArr 
)

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

Synopsis [Returns the result of merging the two vectors.]

Description [Assumes that the vectors are sorted in the increasing order.]

SideEffects []

SeeAlso []

Definition at line 1220 of file aigUtil.c.

1221 {
1222  Aig_Obj_t ** pBeg = (Aig_Obj_t **)vArr->pArray;
1223  Aig_Obj_t ** pBeg1 = (Aig_Obj_t **)vArr1->pArray;
1224  Aig_Obj_t ** pBeg2 = (Aig_Obj_t **)vArr2->pArray;
1225  Aig_Obj_t ** pEnd1 = (Aig_Obj_t **)vArr1->pArray + vArr1->nSize;
1226  Aig_Obj_t ** pEnd2 = (Aig_Obj_t **)vArr2->pArray + vArr2->nSize;
1227  Vec_PtrGrow( vArr, Vec_PtrSize(vArr1) + Vec_PtrSize(vArr2) );
1228  pBeg = (Aig_Obj_t **)vArr->pArray;
1229  while ( pBeg1 < pEnd1 && pBeg2 < pEnd2 )
1230  {
1231  if ( (*pBeg1)->Id == (*pBeg2)->Id )
1232  *pBeg++ = *pBeg1++, pBeg2++;
1233  else if ( (*pBeg1)->Id < (*pBeg2)->Id )
1234  *pBeg++ = *pBeg1++;
1235  else
1236  *pBeg++ = *pBeg2++;
1237  }
1238  while ( pBeg1 < pEnd1 )
1239  *pBeg++ = *pBeg1++;
1240  while ( pBeg2 < pEnd2 )
1241  *pBeg++ = *pBeg2++;
1242  vArr->nSize = pBeg - (Aig_Obj_t **)vArr->pArray;
1243  assert( vArr->nSize <= vArr->nCap );
1244  assert( vArr->nSize >= vArr1->nSize );
1245  assert( vArr->nSize >= vArr2->nSize );
1246 }
static void Vec_PtrGrow(Vec_Ptr_t *p, int nCapMin)
Definition: vecPtr.h:430
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Definition: aig.h:69
#define assert(ex)
Definition: util_old.h:213
static Aig_Obj_t* Aig_Not ( Aig_Obj_t p)
inlinestatic

Definition at line 247 of file aig.h.

247 { return (Aig_Obj_t *)((ABC_PTRUINT_T)(p) ^ 01); }
Definition: aig.h:69
static Aig_Obj_t* Aig_NotCond ( Aig_Obj_t p,
int  c 
)
inlinestatic

Definition at line 248 of file aig.h.

248 { return (Aig_Obj_t *)((ABC_PTRUINT_T)(p) ^ (c)); }
Definition: aig.h:69
void Aig_ObjAddFanout ( Aig_Man_t p,
Aig_Obj_t pObj,
Aig_Obj_t pFanout 
)

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

Synopsis [Adds fanout (pFanout) of node (pObj).]

Description []

SideEffects []

SeeAlso []

Definition at line 107 of file aigFanout.c.

108 {
109  int iFan, * pFirst, * pPrevC, * pNextC, * pPrev, * pNext;
110  assert( p->pFanData );
111  assert( !Aig_IsComplement(pObj) && !Aig_IsComplement(pFanout) );
112  assert( pFanout->Id > 0 );
113  if ( pObj->Id >= p->nFansAlloc || pFanout->Id >= p->nFansAlloc )
114  {
115  int nFansAlloc = 2 * Abc_MaxInt( pObj->Id, pFanout->Id );
116  p->pFanData = ABC_REALLOC( int, p->pFanData, 5 * nFansAlloc );
117  memset( p->pFanData + 5 * p->nFansAlloc, 0, sizeof(int) * 5 * (nFansAlloc - p->nFansAlloc) );
118  p->nFansAlloc = nFansAlloc;
119  }
120  assert( pObj->Id < p->nFansAlloc && pFanout->Id < p->nFansAlloc );
121  iFan = Aig_FanoutCreate( pFanout->Id, Aig_ObjWhatFanin(pFanout, pObj) );
122  pPrevC = Aig_FanoutPrev( p->pFanData, iFan );
123  pNextC = Aig_FanoutNext( p->pFanData, iFan );
124  pFirst = Aig_FanoutObj( p->pFanData, pObj->Id );
125  if ( *pFirst == 0 )
126  {
127  *pFirst = iFan;
128  *pPrevC = iFan;
129  *pNextC = iFan;
130  }
131  else
132  {
133  pPrev = Aig_FanoutPrev( p->pFanData, *pFirst );
134  pNext = Aig_FanoutNext( p->pFanData, *pPrev );
135  assert( *pNext == *pFirst );
136  *pPrevC = *pPrev;
137  *pNextC = *pFirst;
138  *pPrev = iFan;
139  *pNext = iFan;
140  }
141 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_REALLOC(type, obj, num)
Definition: abc_global.h:233
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static int Aig_ObjWhatFanin(Aig_Obj_t *pObj, Aig_Obj_t *pFanin)
Definition: aig.h:332
static int * Aig_FanoutObj(int *pData, int ObjId)
Definition: aigFanout.c:37
static int * Aig_FanoutPrev(int *pData, int iFan)
Definition: aigFanout.c:38
static int * Aig_FanoutNext(int *pData, int iFan)
Definition: aigFanout.c:39
static ABC_NAMESPACE_IMPL_START int Aig_FanoutCreate(int FanId, int Num)
DECLARATIONS ///.
Definition: aigFanout.c:36
#define assert(ex)
Definition: util_old.h:213
int Id
Definition: aig.h:85
int Aig_ObjCheckTfi ( Aig_Man_t p,
Aig_Obj_t pNew,
Aig_Obj_t pOld 
)

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

Synopsis [Returns 1 if pOld is in the TFI of pNew.]

Description []

SideEffects []

SeeAlso []

Definition at line 435 of file aigRepr.c.

436 {
437  assert( !Aig_IsComplement(pNew) );
438  assert( !Aig_IsComplement(pOld) );
440  return Aig_ObjCheckTfi_rec( p, pNew, pOld );
441 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
#define assert(ex)
Definition: util_old.h:213
int Aig_ObjCheckTfi_rec(Aig_Man_t *p, Aig_Obj_t *pNode, Aig_Obj_t *pOld)
Definition: aigRepr.c:400
static Aig_Obj_t* Aig_ObjChild0 ( Aig_Obj_t pObj)
inlinestatic

Definition at line 310 of file aig.h.

310 { return pObj->pFanin0; }
Aig_Obj_t * pFanin0
Definition: aig.h:75
static Aig_Obj_t* Aig_ObjChild0Copy ( Aig_Obj_t pObj)
inlinestatic

Definition at line 312 of file aig.h.

312 { assert( !Aig_IsComplement(pObj) ); return Aig_ObjFanin0(pObj)? Aig_NotCond((Aig_Obj_t *)Aig_ObjFanin0(pObj)->pData, Aig_ObjFaninC0(pObj)) : NULL; }
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
Definition: aig.h:69
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
#define assert(ex)
Definition: util_old.h:213
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
static void Aig_ObjChild0Flip ( Aig_Obj_t pObj)
inlinestatic

Definition at line 316 of file aig.h.

316 { assert( !Aig_IsComplement(pObj) ); pObj->pFanin0 = Aig_Not(pObj->pFanin0); }
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Not(Aig_Obj_t *p)
Definition: aig.h:247
#define assert(ex)
Definition: util_old.h:213
Aig_Obj_t * pFanin0
Definition: aig.h:75
static Aig_Obj_t* Aig_ObjChild0Next ( Aig_Obj_t pObj)
inlinestatic

Definition at line 314 of file aig.h.

314 { assert( !Aig_IsComplement(pObj) ); return Aig_ObjFanin0(pObj)? Aig_NotCond((Aig_Obj_t *)Aig_ObjFanin0(pObj)->pNext, Aig_ObjFaninC0(pObj)) : NULL; }
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
Definition: aig.h:69
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
#define assert(ex)
Definition: util_old.h:213
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
static Aig_Obj_t* Aig_ObjChild1 ( Aig_Obj_t pObj)
inlinestatic

Definition at line 311 of file aig.h.

311 { return pObj->pFanin1; }
Aig_Obj_t * pFanin1
Definition: aig.h:76
static Aig_Obj_t* Aig_ObjChild1Copy ( Aig_Obj_t pObj)
inlinestatic

Definition at line 313 of file aig.h.

313 { assert( !Aig_IsComplement(pObj) ); return Aig_ObjFanin1(pObj)? Aig_NotCond((Aig_Obj_t *)Aig_ObjFanin1(pObj)->pData, Aig_ObjFaninC1(pObj)) : NULL; }
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
Definition: aig.h:69
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
#define assert(ex)
Definition: util_old.h:213
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
static void Aig_ObjChild1Flip ( Aig_Obj_t pObj)
inlinestatic

Definition at line 317 of file aig.h.

317 { assert( !Aig_IsComplement(pObj) ); pObj->pFanin1 = Aig_Not(pObj->pFanin1); }
Aig_Obj_t * pFanin1
Definition: aig.h:76
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Not(Aig_Obj_t *p)
Definition: aig.h:247
#define assert(ex)
Definition: util_old.h:213
static Aig_Obj_t* Aig_ObjChild1Next ( Aig_Obj_t pObj)
inlinestatic

Definition at line 315 of file aig.h.

315 { assert( !Aig_IsComplement(pObj) ); return Aig_ObjFanin1(pObj)? Aig_NotCond((Aig_Obj_t *)Aig_ObjFanin1(pObj)->pNext, Aig_ObjFaninC1(pObj)) : NULL; }
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
Definition: aig.h:69
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
#define assert(ex)
Definition: util_old.h:213
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
static int Aig_ObjCioId ( Aig_Obj_t pObj)
inlinestatic

Definition at line 285 of file aig.h.

285 { assert( !Aig_ObjIsNode(pObj) ); return pObj->CioId; }
int CioId
Definition: aig.h:73
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
#define assert(ex)
Definition: util_old.h:213
static void Aig_ObjClean ( Aig_Obj_t pObj)
inlinestatic

Definition at line 326 of file aig.h.

326 { memset( pObj, 0, sizeof(Aig_Obj_t) ); }
char * memset()
Definition: aig.h:69
void Aig_ObjCleanData_rec ( Aig_Obj_t pObj)

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

Synopsis [Recursively cleans the data pointers in the cone of the node.]

Description [Applicable to small AIGs only because no caching is performed.]

SideEffects []

SeeAlso []

Definition at line 243 of file aigUtil.c.

244 {
245  assert( !Aig_IsComplement(pObj) );
246  assert( !Aig_ObjIsCo(pObj) );
247  if ( Aig_ObjIsAnd(pObj) )
248  {
251  }
252  pObj->pData = NULL;
253 }
void * pData
Definition: aig.h:87
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
void Aig_ObjCleanData_rec(Aig_Obj_t *pObj)
Definition: aigUtil.c:243
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
static int Aig_ObjIsAnd(Aig_Obj_t *pObj)
Definition: aig.h:278
static void Aig_ObjClearMarkA ( Aig_Obj_t pObj)
inlinestatic

Definition at line 290 of file aig.h.

290 { pObj->fMarkA = 0; }
unsigned int fMarkA
Definition: aig.h:79
static void Aig_ObjClearRef ( Aig_Obj_t pObj)
inlinestatic

Definition at line 303 of file aig.h.

303 { pObj->nRefs = 0; }
unsigned int nRefs
Definition: aig.h:81
void Aig_ObjClearReverseLevel ( Aig_Man_t p,
Aig_Obj_t pObj 
)

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

Synopsis [Resets reverse level of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 83 of file aigTiming.c.

84 {
85  Aig_ObjSetReverseLevel( p, pObj, 0 );
86 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Aig_ObjSetReverseLevel(Aig_Man_t *p, Aig_Obj_t *pObj, int LevelR)
Definition: aigTiming.c:65
void Aig_ObjCollectCut ( Aig_Obj_t pRoot,
Vec_Ptr_t vLeaves,
Vec_Ptr_t vNodes 
)

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

Synopsis [Computes the internal nodes of the cut.]

Description [Does not include the leaves of the cut.]

SideEffects []

SeeAlso []

Definition at line 1017 of file aigDfs.c.

1018 {
1019  Aig_Obj_t * pObj;
1020  int i;
1021  // collect and mark the leaves
1022  Vec_PtrClear( vNodes );
1023  Vec_PtrForEachEntry( Aig_Obj_t *, vLeaves, pObj, i )
1024  {
1025  assert( pObj->fMarkA == 0 );
1026  pObj->fMarkA = 1;
1027 // printf( "%d " , pObj->Id );
1028  }
1029 //printf( "\n" );
1030  // collect and mark the nodes
1031  Aig_ObjCollectCut_rec( pRoot, vNodes );
1032  // clean the nodes
1033  Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
1034  pObj->fMarkA = 0;
1035  Vec_PtrForEachEntry( Aig_Obj_t *, vLeaves, pObj, i )
1036  pObj->fMarkA = 0;
1037 }
unsigned int fMarkA
Definition: aig.h:79
Definition: aig.h:69
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
void Aig_ObjCollectCut_rec(Aig_Obj_t *pNode, Vec_Ptr_t *vNodes)
Definition: aigDfs.c:992
void Aig_ObjCollectMulti ( Aig_Obj_t pRoot,
Vec_Ptr_t vSuper 
)

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

Synopsis [Detects multi-input gate rooted at this node.]

Description []

SideEffects []

SeeAlso []

Definition at line 289 of file aigUtil.c.

290 {
291  assert( !Aig_IsComplement(pRoot) );
292  Vec_PtrClear( vSuper );
293  Aig_ObjCollectMulti_rec( pRoot, pRoot, vSuper );
294 }
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
void Aig_ObjCollectMulti_rec(Aig_Obj_t *pRoot, Aig_Obj_t *pObj, Vec_Ptr_t *vSuper)
Definition: aigUtil.c:267
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
int Aig_ObjCollectSuper ( Aig_Obj_t pObj,
Vec_Ptr_t vSuper 
)

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

Synopsis [Collects the nodes of the supergate.]

Description []

SideEffects []

SeeAlso []

Definition at line 1097 of file aigDfs.c.

1098 {
1099  int RetValue, i;
1100  assert( !Aig_IsComplement(pObj) );
1101  assert( Aig_ObjIsNode(pObj) );
1102  // collect the nodes in the implication supergate
1103  Vec_PtrClear( vSuper );
1104  RetValue = Aig_ObjCollectSuper_rec( pObj, pObj, vSuper );
1105  assert( Vec_PtrSize(vSuper) > 1 );
1106  // unmark the visited nodes
1107  Vec_PtrForEachEntry( Aig_Obj_t *, vSuper, pObj, i )
1108  Aig_Regular(pObj)->fMarkA = 0;
1109  // if we found the node and its complement in the same implication supergate,
1110  // return empty set of nodes (meaning that we should use constant-0 node)
1111  if ( RetValue == -1 )
1112  vSuper->nSize = 0;
1113  return RetValue;
1114 }
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
int Aig_ObjCollectSuper_rec(Aig_Obj_t *pRoot, Aig_Obj_t *pObj, Vec_Ptr_t *vSuper)
Definition: aigDfs.c:1051
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
int Aig_ObjCompareIdIncrease ( Aig_Obj_t **  pp1,
Aig_Obj_t **  pp2 
)

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

Synopsis [Procedure used for sorting the nodes in increasing order of IDs.]

Description []

SideEffects []

SeeAlso []

Definition at line 496 of file aigUtil.c.

497 {
498  int Diff = Aig_ObjId(*pp1) - Aig_ObjId(*pp2);
499  if ( Diff < 0 )
500  return -1;
501  if ( Diff > 0 )
502  return 1;
503  return 0;
504 }
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
void Aig_ObjConnect ( Aig_Man_t p,
Aig_Obj_t pObj,
Aig_Obj_t pFan0,
Aig_Obj_t pFan1 
)

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

Synopsis [Connect the object to the fanin.]

Description []

SideEffects []

SeeAlso []

Definition at line 126 of file aigObj.c.

127 {
128  assert( !Aig_IsComplement(pObj) );
129  assert( !Aig_ObjIsCi(pObj) );
130  // add the first fanin
131  pObj->pFanin0 = pFan0;
132  pObj->pFanin1 = pFan1;
133  // increment references of the fanins and add their fanouts
134  if ( pFan0 != NULL )
135  {
136  assert( Aig_ObjFanin0(pObj)->Type > 0 );
137  Aig_ObjRef( Aig_ObjFanin0(pObj) );
138  if ( p->pFanData )
139  Aig_ObjAddFanout( p, Aig_ObjFanin0(pObj), pObj );
140  }
141  if ( pFan1 != NULL )
142  {
143  assert( Aig_ObjFanin1(pObj)->Type > 0 );
144  Aig_ObjRef( Aig_ObjFanin1(pObj) );
145  if ( p->pFanData )
146  Aig_ObjAddFanout( p, Aig_ObjFanin1(pObj), pObj );
147  }
148  // set level and phase
149  pObj->Level = Aig_ObjLevelNew( pObj );
150  pObj->fPhase = Aig_ObjPhaseReal(pFan0) & Aig_ObjPhaseReal(pFan1);
151  // add the node to the structural hash table
152  if ( p->pTable && Aig_ObjIsHash(pObj) )
153  Aig_TableInsert( p, pObj );
154  // add the node to the dynamically updated topological order
155 // if ( p->pOrderData && Aig_ObjIsNode(pObj) )
156 // Aig_ObjOrderInsert( p, pObj->Id );
157  assert( !Aig_ObjIsNode(pObj) || pObj->Level > 0 );
158 }
static int Aig_ObjLevelNew(Aig_Obj_t *pObj)
Definition: aig.h:324
unsigned Level
Definition: aig.h:82
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Aig_Obj_t * pFanin1
Definition: aig.h:76
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static void Aig_ObjRef(Aig_Obj_t *pObj)
Definition: aig.h:301
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Aig_ObjPhaseReal(Aig_Obj_t *pObj)
Definition: aig.h:299
unsigned int fPhase
Definition: aig.h:78
void Aig_TableInsert(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigTable.c:173
#define assert(ex)
Definition: util_old.h:213
void Aig_ObjAddFanout(Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pFanout)
Definition: aigFanout.c:107
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
Aig_Obj_t * pFanin0
Definition: aig.h:75
static int Aig_ObjIsHash(Aig_Obj_t *pObj)
Definition: aig.h:282
static Aig_Obj_t* Aig_ObjCopy ( Aig_Obj_t pObj)
inlinestatic

Definition at line 318 of file aig.h.

318 { assert( !Aig_IsComplement(pObj) ); return (Aig_Obj_t *)pObj->pData; }
void * pData
Definition: aig.h:87
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
Definition: aig.h:69
#define assert(ex)
Definition: util_old.h:213
Aig_Obj_t* Aig_ObjCreate ( Aig_Man_t p,
Aig_Obj_t pGhost 
)

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 89 of file aigObj.c.

90 {
91  Aig_Obj_t * pObj;
92  assert( !Aig_IsComplement(pGhost) );
93  assert( Aig_ObjIsHash(pGhost) );
94 // assert( pGhost == &p->Ghost );
95  // get memory for the new object
96  pObj = Aig_ManFetchMemory( p );
97  pObj->Type = pGhost->Type;
98  // add connections
99  Aig_ObjConnect( p, pObj, pGhost->pFanin0, pGhost->pFanin1 );
100  // update node counters of the manager
101  p->nObjs[Aig_ObjType(pObj)]++;
102  assert( pObj->pData == NULL );
103  // create the power counter
104  if ( p->vProbs )
105  {
106  float Prob0 = Abc_Int2Float( Vec_IntEntry( p->vProbs, Aig_ObjFaninId0(pObj) ) );
107  float Prob1 = Abc_Int2Float( Vec_IntEntry( p->vProbs, Aig_ObjFaninId1(pObj) ) );
108  Prob0 = Aig_ObjFaninC0(pObj)? 1.0 - Prob0 : Prob0;
109  Prob1 = Aig_ObjFaninC1(pObj)? 1.0 - Prob1 : Prob1;
110  Vec_IntSetEntry( p->vProbs, pObj->Id, Abc_Float2Int(Prob0 * Prob1) );
111  }
112  return pObj;
113 }
static Aig_Type_t Aig_ObjType(Aig_Obj_t *pObj)
Definition: aig.h:272
static int Aig_ObjFaninId0(Aig_Obj_t *pObj)
Definition: aig.h:304
static Aig_Obj_t * Aig_ManFetchMemory(Aig_Man_t *p)
Definition: aig.h:368
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Aig_Obj_t * pFanin1
Definition: aig.h:76
unsigned int Type
Definition: aig.h:77
void * pData
Definition: aig.h:87
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static void Vec_IntSetEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:418
static int Aig_ObjFaninId1(Aig_Obj_t *pObj)
Definition: aig.h:305
static int Abc_Float2Int(float Val)
Definition: abc_global.h:249
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Definition: aig.h:69
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static float Abc_Int2Float(int Num)
Definition: abc_global.h:250
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
#define assert(ex)
Definition: util_old.h:213
void Aig_ObjConnect(Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pFan0, Aig_Obj_t *pFan1)
Definition: aigObj.c:126
Aig_Obj_t * pFanin0
Definition: aig.h:75
int Id
Definition: aig.h:85
static int Aig_ObjIsHash(Aig_Obj_t *pObj)
Definition: aig.h:282
Aig_Obj_t* Aig_ObjCreateCi ( Aig_Man_t p)

DECLARATIONS ///.

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

FileName [aigObj.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [AIG package.]

Synopsis [Adding/removing objects.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Creates primary input.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file aigObj.c.

46 {
47  Aig_Obj_t * pObj;
48  pObj = Aig_ManFetchMemory( p );
49  pObj->Type = AIG_OBJ_CI;
50  Vec_PtrPush( p->vCis, pObj );
51  p->nObjs[AIG_OBJ_CI]++;
52  return pObj;
53 }
static Aig_Obj_t * Aig_ManFetchMemory(Aig_Man_t *p)
Definition: aig.h:368
static Llb_Mgr_t * p
Definition: llb3Image.c:950
unsigned int Type
Definition: aig.h:77
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
Definition: aig.h:69
Definition: aig.h:60
Aig_Obj_t* Aig_ObjCreateCo ( Aig_Man_t p,
Aig_Obj_t pDriver 
)

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

Synopsis [Creates primary output with the given driver.]

Description []

SideEffects []

SeeAlso []

Definition at line 66 of file aigObj.c.

67 {
68  Aig_Obj_t * pObj;
69  pObj = Aig_ManFetchMemory( p );
70  pObj->Type = AIG_OBJ_CO;
71  Vec_PtrPush( p->vCos, pObj );
72  Aig_ObjConnect( p, pObj, pDriver, NULL );
73  p->nObjs[AIG_OBJ_CO]++;
74  return pObj;
75 }
static Aig_Obj_t * Aig_ManFetchMemory(Aig_Man_t *p)
Definition: aig.h:368
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Definition: aig.h:61
unsigned int Type
Definition: aig.h:77
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
Definition: aig.h:69
void Aig_ObjConnect(Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pFan0, Aig_Obj_t *pFan1)
Definition: aigObj.c:126
static Aig_Obj_t* Aig_ObjCreateGhost ( Aig_Man_t p,
Aig_Obj_t p0,
Aig_Obj_t p1,
Aig_Type_t  Type 
)
inlinestatic

Definition at line 346 of file aig.h.

347 {
348  Aig_Obj_t * pGhost;
349  assert( Type != AIG_OBJ_AND || !Aig_ObjIsConst1(Aig_Regular(p0)) );
350  assert( p1 == NULL || !Aig_ObjIsConst1(Aig_Regular(p1)) );
351  assert( Type == AIG_OBJ_CI || Aig_Regular(p0) != Aig_Regular(p1) );
352  pGhost = Aig_ManGhost(p);
353  pGhost->Type = Type;
354  if ( p1 == NULL || Aig_Regular(p0)->Id < Aig_Regular(p1)->Id )
355  {
356  pGhost->pFanin0 = p0;
357  pGhost->pFanin1 = p1;
358  }
359  else
360  {
361  pGhost->pFanin0 = p1;
362  pGhost->pFanin1 = p0;
363  }
364  return pGhost;
365 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Aig_Obj_t * pFanin1
Definition: aig.h:76
unsigned int Type
Definition: aig.h:77
static Aig_Obj_t * Aig_ManGhost(Aig_Man_t *p)
Definition: aig.h:265
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
Definition: aig.h:69
Definition: aig.h:60
#define assert(ex)
Definition: util_old.h:213
Aig_Obj_t * pFanin0
Definition: aig.h:75
void Aig_ObjCreateRepr ( Aig_Man_t p,
Aig_Obj_t pNode1,
Aig_Obj_t pNode2 
)

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

Synopsis [Set the representative.]

Description []

SideEffects []

SeeAlso []

Definition at line 83 of file aigRepr.c.

84 {
85  assert( p->pReprs != NULL );
86  assert( !Aig_IsComplement(pNode1) );
87  assert( !Aig_IsComplement(pNode2) );
88  assert( pNode1->Id < p->nReprsAlloc );
89  assert( pNode2->Id < p->nReprsAlloc );
90  assert( pNode1->Id < pNode2->Id );
91  p->pReprs[pNode2->Id] = pNode1;
92 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
#define assert(ex)
Definition: util_old.h:213
int Id
Definition: aig.h:85
static Aig_Cut_t* Aig_ObjCuts ( Aig_ManCut_t p,
Aig_Obj_t pObj 
)
inlinestatic

Definition at line 209 of file aig.h.

209 { return p->pCuts[pObj->Id]; }
Aig_Cut_t ** pCuts
Definition: aig.h:196
int Id
Definition: aig.h:85
static unsigned Aig_ObjCutSign ( unsigned  ObjId)
inlinestatic

MACRO DEFINITIONS ///.

Definition at line 228 of file aig.h.

228 { return (1 << (ObjId & 31)); }
void Aig_ObjDelete ( Aig_Man_t p,
Aig_Obj_t pObj 
)

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

Synopsis [Deletes the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 209 of file aigObj.c.

210 {
211  assert( !Aig_IsComplement(pObj) );
212  assert( !Aig_ObjIsTerm(pObj) );
213  assert( Aig_ObjRefs(pObj) == 0 );
214  if ( p->pFanData && Aig_ObjIsBuf(pObj) )
215  Vec_PtrRemove( p->vBufs, pObj );
216  p->nObjs[pObj->Type]--;
217  Vec_PtrWriteEntry( p->vObjs, pObj->Id, NULL );
218  Aig_ManRecycleMemory( p, pObj );
219 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
unsigned int Type
Definition: aig.h:77
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static void Vec_PtrRemove(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:714
static int Aig_ObjIsBuf(Aig_Obj_t *pObj)
Definition: aig.h:277
static int Aig_ObjIsTerm(Aig_Obj_t *pObj)
Definition: aig.h:281
static void Aig_ManRecycleMemory(Aig_Man_t *p, Aig_Obj_t *pEntry)
Definition: aig.h:378
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjRefs(Aig_Obj_t *pObj)
Definition: aig.h:300
int Id
Definition: aig.h:85
void Aig_ObjDelete_rec ( Aig_Man_t p,
Aig_Obj_t pObj,
int  fFreeTop 
)

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

Synopsis [Deletes the MFFC of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 232 of file aigObj.c.

233 {
234  Aig_Obj_t * pFanin0, * pFanin1;
235  assert( !Aig_IsComplement(pObj) );
236  if ( Aig_ObjIsConst1(pObj) || Aig_ObjIsCi(pObj) )
237  return;
238  assert( !Aig_ObjIsCo(pObj) );
239  pFanin0 = Aig_ObjFanin0(pObj);
240  pFanin1 = Aig_ObjFanin1(pObj);
241  Aig_ObjDisconnect( p, pObj );
242  if ( fFreeTop )
243  Aig_ObjDelete( p, pObj );
244  if ( pFanin0 && !Aig_ObjIsNone(pFanin0) && Aig_ObjRefs(pFanin0) == 0 )
245  Aig_ObjDelete_rec( p, pFanin0, 1 );
246  if ( pFanin1 && !Aig_ObjIsNone(pFanin1) && Aig_ObjRefs(pFanin1) == 0 )
247  Aig_ObjDelete_rec( p, pFanin1, 1 );
248 }
void Aig_ObjDelete_rec(Aig_Man_t *p, Aig_Obj_t *pObj, int fFreeTop)
Definition: aigObj.c:232
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static int Aig_ObjIsNone(Aig_Obj_t *pObj)
Definition: aig.h:273
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
Definition: aig.h:69
void Aig_ObjDelete(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigObj.c:209
void Aig_ObjDisconnect(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigObj.c:171
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjRefs(Aig_Obj_t *pObj)
Definition: aig.h:300
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
void Aig_ObjDeletePo ( Aig_Man_t p,
Aig_Obj_t pObj 
)

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

Synopsis [Deletes the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 261 of file aigObj.c.

262 {
263  assert( Aig_ObjIsCo(pObj) );
265  pObj->pFanin0 = NULL;
266  p->nObjs[pObj->Type]--;
267  Vec_PtrWriteEntry( p->vObjs, pObj->Id, NULL );
268  Aig_ManRecycleMemory( p, pObj );
269 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Aig_ObjDeref(Aig_Obj_t *pObj)
Definition: aig.h:302
unsigned int Type
Definition: aig.h:77
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static void Aig_ManRecycleMemory(Aig_Man_t *p, Aig_Obj_t *pEntry)
Definition: aig.h:378
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
#define assert(ex)
Definition: util_old.h:213
Aig_Obj_t * pFanin0
Definition: aig.h:75
int Id
Definition: aig.h:85
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
static void Aig_ObjDeref ( Aig_Obj_t pObj)
inlinestatic

Definition at line 302 of file aig.h.

302 { assert( pObj->nRefs > 0 ); pObj->nRefs--; }
#define assert(ex)
Definition: util_old.h:213
unsigned int nRefs
Definition: aig.h:81
void Aig_ObjDisconnect ( Aig_Man_t p,
Aig_Obj_t pObj 
)

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

Synopsis [Disconnects the object from the fanins.]

Description []

SideEffects []

SeeAlso []

Definition at line 171 of file aigObj.c.

172 {
173  assert( !Aig_IsComplement(pObj) );
174  // remove connections
175  if ( pObj->pFanin0 != NULL )
176  {
177  if ( p->pFanData )
178  Aig_ObjRemoveFanout( p, Aig_ObjFanin0(pObj), pObj );
180  }
181  if ( pObj->pFanin1 != NULL )
182  {
183  if ( p->pFanData )
184  Aig_ObjRemoveFanout( p, Aig_ObjFanin1(pObj), pObj );
186  }
187  // remove the node from the structural hash table
188  if ( p->pTable && Aig_ObjIsHash(pObj) )
189  Aig_TableDelete( p, pObj );
190  // add the first fanin
191  pObj->pFanin0 = NULL;
192  pObj->pFanin1 = NULL;
193  // remove the node from the dynamically updated topological order
194 // if ( p->pOrderData && Aig_ObjIsNode(pObj) )
195 // Aig_ObjOrderRemove( p, pObj->Id );
196 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Aig_ObjDeref(Aig_Obj_t *pObj)
Definition: aig.h:302
Aig_Obj_t * pFanin1
Definition: aig.h:76
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
void Aig_TableDelete(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigTable.c:196
void Aig_ObjRemoveFanout(Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pFanout)
Definition: aigFanout.c:154
#define assert(ex)
Definition: util_old.h:213
Aig_Obj_t * pFanin0
Definition: aig.h:75
static int Aig_ObjIsHash(Aig_Obj_t *pObj)
Definition: aig.h:282
static Aig_Obj_t* Aig_ObjEquiv ( Aig_Man_t p,
Aig_Obj_t pObj 
)
inlinestatic

Definition at line 328 of file aig.h.

328 { return p->pEquivs? p->pEquivs[pObj->Id] : NULL; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Id
Definition: aig.h:85
static Aig_Obj_t* Aig_ObjFanin0 ( Aig_Obj_t pObj)
inlinestatic

Definition at line 308 of file aig.h.

308 { return Aig_Regular(pObj->pFanin0); }
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
Aig_Obj_t * pFanin0
Definition: aig.h:75
static Aig_Obj_t* Aig_ObjFanin1 ( Aig_Obj_t pObj)
inlinestatic

Definition at line 309 of file aig.h.

309 { return Aig_Regular(pObj->pFanin1); }
Aig_Obj_t * pFanin1
Definition: aig.h:76
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static int Aig_ObjFaninC0 ( Aig_Obj_t pObj)
inlinestatic

Definition at line 306 of file aig.h.

306 { return Aig_IsComplement(pObj->pFanin0); }
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
Aig_Obj_t * pFanin0
Definition: aig.h:75
static int Aig_ObjFaninC1 ( Aig_Obj_t pObj)
inlinestatic

Definition at line 307 of file aig.h.

307 { return Aig_IsComplement(pObj->pFanin1); }
Aig_Obj_t * pFanin1
Definition: aig.h:76
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static int Aig_ObjFaninId0 ( Aig_Obj_t pObj)
inlinestatic

Definition at line 304 of file aig.h.

304 { return pObj->pFanin0? Aig_Regular(pObj->pFanin0)->Id : -1; }
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
Aig_Obj_t * pFanin0
Definition: aig.h:75
int Id
Definition: aig.h:85
static int Aig_ObjFaninId1 ( Aig_Obj_t pObj)
inlinestatic

Definition at line 305 of file aig.h.

305 { return pObj->pFanin1? Aig_Regular(pObj->pFanin1)->Id : -1; }
Aig_Obj_t * pFanin1
Definition: aig.h:76
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
int Id
Definition: aig.h:85
static Aig_Obj_t* Aig_ObjFanout0 ( Aig_Man_t p,
Aig_Obj_t pObj 
)
inlinestatic

Definition at line 327 of file aig.h.

327 { assert(p->pFanData && pObj->Id < p->nFansAlloc); return Aig_ManObj(p, p->pFanData[5*pObj->Id] >> 1); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_ManObj(Aig_Man_t *p, int i)
Definition: aig.h:270
#define assert(ex)
Definition: util_old.h:213
int Id
Definition: aig.h:85
static int Aig_ObjFanout0Int ( Aig_Man_t p,
int  ObjId 
)
inlinestatic

Definition at line 424 of file aig.h.

424 { assert(ObjId < p->nFansAlloc); return p->pFanData[5*ObjId]; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjFanoutC ( Aig_Obj_t pObj,
Aig_Obj_t pFanout 
)
inlinestatic

Definition at line 338 of file aig.h.

339 {
340  if ( Aig_ObjFanin0(pFanout) == pObj ) return Aig_ObjFaninC0(pObj);
341  if ( Aig_ObjFanin1(pFanout) == pObj ) return Aig_ObjFaninC1(pObj);
342  assert(0); return -1;
343 }
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjFanoutNext ( Aig_Man_t p,
int  iFan 
)
inlinestatic

Definition at line 425 of file aig.h.

425 { assert(iFan/2 < p->nFansAlloc); return p->pFanData[5*(iFan >> 1) + 3 + (iFan & 1)]; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
static Aig_Obj_t* Aig_ObjFromLit ( Aig_Man_t p,
int  iLit 
)
inlinestatic

Definition at line 322 of file aig.h.

322 { return Aig_NotCond( Aig_ManObj(p, Abc_Lit2Var(iLit)), Abc_LitIsCompl(iLit) ); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_ManObj(Aig_Man_t *p, int i)
Definition: aig.h:270
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
static int Aig_ObjId ( Aig_Obj_t pObj)
inlinestatic

Definition at line 286 of file aig.h.

286 { return pObj->Id; }
int Id
Definition: aig.h:85
static int Aig_ObjIsAnd ( Aig_Obj_t pObj)
inlinestatic

Definition at line 278 of file aig.h.

278 { return pObj->Type == AIG_OBJ_AND; }
unsigned int Type
Definition: aig.h:77
static int Aig_ObjIsBuf ( Aig_Obj_t pObj)
inlinestatic

Definition at line 277 of file aig.h.

277 { return pObj->Type == AIG_OBJ_BUF; }
unsigned int Type
Definition: aig.h:77
static int Aig_ObjIsCand ( Aig_Obj_t pObj)
inlinestatic

Definition at line 284 of file aig.h.

284 { return pObj->Type == AIG_OBJ_CI || pObj->Type == AIG_OBJ_AND || pObj->Type == AIG_OBJ_EXOR; }
unsigned int Type
Definition: aig.h:77
Definition: aig.h:60
static int Aig_ObjIsChoice ( Aig_Man_t p,
Aig_Obj_t pObj 
)
inlinestatic

Definition at line 283 of file aig.h.

283 { return p->pEquivs && p->pEquivs[pObj->Id] && pObj->nRefs > 0; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Id
Definition: aig.h:85
unsigned int nRefs
Definition: aig.h:81
static int Aig_ObjIsCi ( Aig_Obj_t pObj)
inlinestatic

Definition at line 275 of file aig.h.

275 { return pObj->Type == AIG_OBJ_CI; }
unsigned int Type
Definition: aig.h:77
Definition: aig.h:60
static int Aig_ObjIsCo ( Aig_Obj_t pObj)
inlinestatic

Definition at line 276 of file aig.h.

276 { return pObj->Type == AIG_OBJ_CO; }
Definition: aig.h:61
unsigned int Type
Definition: aig.h:77
static int Aig_ObjIsConst1 ( Aig_Obj_t pObj)
inlinestatic

Definition at line 274 of file aig.h.

274 { assert(!Aig_IsComplement(pObj)); return pObj->Type == AIG_OBJ_CONST1; }
unsigned int Type
Definition: aig.h:77
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjIsExor ( Aig_Obj_t pObj)
inlinestatic

Definition at line 279 of file aig.h.

279 { return pObj->Type == AIG_OBJ_EXOR; }
unsigned int Type
Definition: aig.h:77
static int Aig_ObjIsHash ( Aig_Obj_t pObj)
inlinestatic

Definition at line 282 of file aig.h.

282 { return pObj->Type == AIG_OBJ_AND || pObj->Type == AIG_OBJ_EXOR; }
unsigned int Type
Definition: aig.h:77
static int Aig_ObjIsMarkA ( Aig_Obj_t pObj)
inlinestatic

Definition at line 288 of file aig.h.

288 { return pObj->fMarkA; }
unsigned int fMarkA
Definition: aig.h:79
int Aig_ObjIsMuxType ( Aig_Obj_t pNode)

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 307 of file aigUtil.c.

308 {
309  Aig_Obj_t * pNode0, * pNode1;
310  // check that the node is regular
311  assert( !Aig_IsComplement(pNode) );
312  // if the node is not AND, this is not MUX
313  if ( !Aig_ObjIsAnd(pNode) )
314  return 0;
315  // if the children are not complemented, this is not MUX
316  if ( !Aig_ObjFaninC0(pNode) || !Aig_ObjFaninC1(pNode) )
317  return 0;
318  // get children
319  pNode0 = Aig_ObjFanin0(pNode);
320  pNode1 = Aig_ObjFanin1(pNode);
321  // if the children are not ANDs, this is not MUX
322  if ( !Aig_ObjIsAnd(pNode0) || !Aig_ObjIsAnd(pNode1) )
323  return 0;
324  // otherwise the node is MUX iff it has a pair of equal grandchildren
325  return (Aig_ObjFanin0(pNode0) == Aig_ObjFanin0(pNode1) && (Aig_ObjFaninC0(pNode0) ^ Aig_ObjFaninC0(pNode1))) ||
326  (Aig_ObjFanin0(pNode0) == Aig_ObjFanin1(pNode1) && (Aig_ObjFaninC0(pNode0) ^ Aig_ObjFaninC1(pNode1))) ||
327  (Aig_ObjFanin1(pNode0) == Aig_ObjFanin0(pNode1) && (Aig_ObjFaninC1(pNode0) ^ Aig_ObjFaninC0(pNode1))) ||
328  (Aig_ObjFanin1(pNode0) == Aig_ObjFanin1(pNode1) && (Aig_ObjFaninC1(pNode0) ^ Aig_ObjFaninC1(pNode1)));
329 }
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
Definition: aig.h:69
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjIsAnd(Aig_Obj_t *pObj)
Definition: aig.h:278
static int Aig_ObjIsNode ( Aig_Obj_t pObj)
inlinestatic

Definition at line 280 of file aig.h.

280 { return pObj->Type == AIG_OBJ_AND || pObj->Type == AIG_OBJ_EXOR; }
unsigned int Type
Definition: aig.h:77
static int Aig_ObjIsNone ( Aig_Obj_t pObj)
inlinestatic

Definition at line 273 of file aig.h.

273 { return pObj->Type == AIG_OBJ_NONE; }
unsigned int Type
Definition: aig.h:77
static int Aig_ObjIsTerm ( Aig_Obj_t pObj)
inlinestatic

Definition at line 281 of file aig.h.

281 { return pObj->Type == AIG_OBJ_CI || pObj->Type == AIG_OBJ_CO || pObj->Type == AIG_OBJ_CONST1; }
Definition: aig.h:61
unsigned int Type
Definition: aig.h:77
Definition: aig.h:60
static int Aig_ObjIsTravIdCurrent ( Aig_Man_t p,
Aig_Obj_t pObj 
)
inlinestatic

Definition at line 295 of file aig.h.

295 { return (int)(pObj->TravId == p->nTravIds); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int TravId
Definition: aig.h:84
static int Aig_ObjIsTravIdPrevious ( Aig_Man_t p,
Aig_Obj_t pObj 
)
inlinestatic

Definition at line 296 of file aig.h.

296 { return (int)(pObj->TravId == p->nTravIds - 1); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int TravId
Definition: aig.h:84
static int Aig_ObjLevel ( Aig_Obj_t pObj)
inlinestatic

Definition at line 323 of file aig.h.

323 { assert( !Aig_IsComplement(pObj) ); return pObj->Level; }
unsigned Level
Definition: aig.h:82
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjLevelNew ( Aig_Obj_t pObj)
inlinestatic

Definition at line 324 of file aig.h.

324 { assert( !Aig_IsComplement(pObj) ); return Aig_ObjFanin1(pObj)? 1 + Aig_ObjIsExor(pObj) + Abc_MaxInt(Aig_ObjFanin0(pObj)->Level, Aig_ObjFanin1(pObj)->Level) : Aig_ObjFanin0(pObj)->Level; }
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static int Aig_ObjIsExor(Aig_Obj_t *pObj)
Definition: aig.h:279
#define assert(ex)
Definition: util_old.h:213
void Aig_ObjOrderAdvance ( Aig_Man_t p)

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

Synopsis [Advances the order forward.]

Description []

SideEffects []

SeeAlso []

Definition at line 162 of file aigOrder.c.

163 {
164  assert( p->pOrderData );
165  assert( p->pOrderData[2*p->iPrev+1] == (unsigned)p->iNext );
166  p->iPrev = p->iNext;
167  p->nAndPrev++;
168 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
void Aig_ObjOrderInsert ( Aig_Man_t p,
int  ObjId 
)

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

Synopsis [Inserts an entry before iNext.]

Description []

SideEffects []

SeeAlso []

Definition at line 95 of file aigOrder.c.

96 {
97  int iPrev;
98  assert( ObjId != 0 );
99  assert( Aig_ObjIsNode( Aig_ManObj(p, ObjId) ) );
100  if ( ObjId >= p->nOrderAlloc )
101  {
102  int nOrderAlloc = 2 * ObjId;
103  p->pOrderData = ABC_REALLOC( unsigned, p->pOrderData, 2 * nOrderAlloc );
104  memset( p->pOrderData + 2 * p->nOrderAlloc, 0xFF, sizeof(unsigned) * 2 * (nOrderAlloc - p->nOrderAlloc) );
105  p->nOrderAlloc = nOrderAlloc;
106  }
107  assert( p->pOrderData[2*ObjId] == 0xFFFFFFFF ); // prev
108  assert( p->pOrderData[2*ObjId+1] == 0xFFFFFFFF ); // next
109  iPrev = p->pOrderData[2*p->iNext];
110  assert( p->pOrderData[2*iPrev+1] == (unsigned)p->iNext );
111  p->pOrderData[2*ObjId] = iPrev;
112  p->pOrderData[2*iPrev+1] = ObjId;
113  p->pOrderData[2*p->iNext] = ObjId;
114  p->pOrderData[2*ObjId+1] = p->iNext;
115  p->nAndTotal++;
116 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_REALLOC(type, obj, num)
Definition: abc_global.h:233
static Aig_Obj_t * Aig_ManObj(Aig_Man_t *p, int i)
Definition: aig.h:270
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
#define assert(ex)
Definition: util_old.h:213
void Aig_ObjOrderRemove ( Aig_Man_t p,
int  ObjId 
)

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

Synopsis [Removes the entry.]

Description [If iPrev is removed, it slides backward. If iNext is removed, it slides forward.]

SideEffects []

SeeAlso []

Definition at line 130 of file aigOrder.c.

131 {
132  int iPrev, iNext;
133  assert( ObjId != 0 );
134  assert( Aig_ObjIsNode( Aig_ManObj(p, ObjId) ) );
135  iPrev = p->pOrderData[2*ObjId];
136  iNext = p->pOrderData[2*ObjId+1];
137  p->pOrderData[2*ObjId] = 0xFFFFFFFF;
138  p->pOrderData[2*ObjId+1] = 0xFFFFFFFF;
139  p->pOrderData[2*iNext] = iPrev;
140  p->pOrderData[2*iPrev+1] = iNext;
141  if ( p->iPrev == ObjId )
142  {
143  p->nAndPrev--;
144  p->iPrev = iPrev;
145  }
146  if ( p->iNext == ObjId )
147  p->iNext = iNext;
148  p->nAndTotal--;
149 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_ManObj(Aig_Man_t *p, int i)
Definition: aig.h:270
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
#define assert(ex)
Definition: util_old.h:213
void Aig_ObjPatchFanin0 ( Aig_Man_t p,
Aig_Obj_t pObj,
Aig_Obj_t pFaninNew 
)

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 282 of file aigObj.c.

283 {
284  Aig_Obj_t * pFaninOld;
285  assert( !Aig_IsComplement(pObj) );
286  assert( Aig_ObjIsCo(pObj) );
287  pFaninOld = Aig_ObjFanin0(pObj);
288  // decrement ref and remove fanout
289  if ( p->pFanData )
290  Aig_ObjRemoveFanout( p, pFaninOld, pObj );
291  Aig_ObjDeref( pFaninOld );
292  // update the fanin
293  pObj->pFanin0 = pFaninNew;
294  pObj->Level = Aig_ObjLevelNew( pObj );
295  pObj->fPhase = Aig_ObjPhaseReal(pObj->pFanin0);
296  // increment ref and add fanout
297  if ( p->pFanData )
298  Aig_ObjAddFanout( p, Aig_ObjFanin0(pObj), pObj );
299  Aig_ObjRef( Aig_ObjFanin0(pObj) );
300  // get rid of old fanin
301  if ( !Aig_ObjIsCi(pFaninOld) && !Aig_ObjIsConst1(pFaninOld) && Aig_ObjRefs(pFaninOld) == 0 )
302  Aig_ObjDelete_rec( p, pFaninOld, 1 );
303 }
static int Aig_ObjLevelNew(Aig_Obj_t *pObj)
Definition: aig.h:324
void Aig_ObjDelete_rec(Aig_Man_t *p, Aig_Obj_t *pObj, int fFreeTop)
Definition: aigObj.c:232
unsigned Level
Definition: aig.h:82
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Aig_ObjDeref(Aig_Obj_t *pObj)
Definition: aig.h:302
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static void Aig_ObjRef(Aig_Obj_t *pObj)
Definition: aig.h:301
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
static int Aig_ObjPhaseReal(Aig_Obj_t *pObj)
Definition: aig.h:299
Definition: aig.h:69
void Aig_ObjRemoveFanout(Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pFanout)
Definition: aigFanout.c:154
unsigned int fPhase
Definition: aig.h:78
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjRefs(Aig_Obj_t *pObj)
Definition: aig.h:300
void Aig_ObjAddFanout(Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pFanout)
Definition: aigFanout.c:107
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
Aig_Obj_t * pFanin0
Definition: aig.h:75
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
static int Aig_ObjPhase ( Aig_Obj_t pObj)
inlinestatic

Definition at line 298 of file aig.h.

298 { return pObj->fPhase; }
unsigned int fPhase
Definition: aig.h:78
static int Aig_ObjPhaseReal ( Aig_Obj_t pObj)
inlinestatic

Definition at line 299 of file aig.h.

299 { return pObj? Aig_Regular(pObj)->fPhase ^ Aig_IsComplement(pObj) : 1; }
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
unsigned int fPhase
Definition: aig.h:78
void Aig_ObjPrint ( Aig_Man_t p,
Aig_Obj_t pObj 
)

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

Synopsis [Verbose printing of the AIG node.]

Description []

SideEffects []

SeeAlso []

Definition at line 316 of file aigObj.c.

317 {
318  int fShowFanouts = 0;
319  Aig_Obj_t * pTemp;
320  if ( pObj == NULL )
321  {
322  printf( "Object is NULL." );
323  return;
324  }
325  if ( Aig_IsComplement(pObj) )
326  {
327  printf( "Compl " );
328  pObj = Aig_Not(pObj);
329  }
330  assert( !Aig_IsComplement(pObj) );
331  printf( "Node %4d : ", Aig_ObjId(pObj) );
332  if ( Aig_ObjIsConst1(pObj) )
333  printf( "constant 1" );
334  else if ( Aig_ObjIsCi(pObj) )
335  printf( "PI" );
336  else if ( Aig_ObjIsCo(pObj) )
337  printf( "PO( %4d%s )", Aig_ObjFanin0(pObj)->Id, (Aig_ObjFaninC0(pObj)? "\'" : " ") );
338  else if ( Aig_ObjIsBuf(pObj) )
339  printf( "BUF( %d%s )", Aig_ObjFanin0(pObj)->Id, (Aig_ObjFaninC0(pObj)? "\'" : " ") );
340  else
341  printf( "AND( %4d%s, %4d%s )",
342  Aig_ObjFanin0(pObj)->Id, (Aig_ObjFaninC0(pObj)? "\'" : " "),
343  Aig_ObjFanin1(pObj)->Id, (Aig_ObjFaninC1(pObj)? "\'" : " ") );
344  printf( " (refs = %3d)", Aig_ObjRefs(pObj) );
345  if ( fShowFanouts && p->pFanData )
346  {
347  Aig_Obj_t * pFanout;
348  int i;
349  int iFan = -1; // Suppress "might be used uninitialized"
350  printf( "\nFanouts:\n" );
351  Aig_ObjForEachFanout( p, pObj, pFanout, iFan, i )
352  {
353  printf( " " );
354  printf( "Node %4d : ", Aig_ObjId(pFanout) );
355  if ( Aig_ObjIsCo(pFanout) )
356  printf( "PO( %4d%s )", Aig_ObjFanin0(pFanout)->Id, (Aig_ObjFaninC0(pFanout)? "\'" : " ") );
357  else if ( Aig_ObjIsBuf(pFanout) )
358  printf( "BUF( %d%s )", Aig_ObjFanin0(pFanout)->Id, (Aig_ObjFaninC0(pFanout)? "\'" : " ") );
359  else
360  printf( "AND( %4d%s, %4d%s )",
361  Aig_ObjFanin0(pFanout)->Id, (Aig_ObjFaninC0(pFanout)? "\'" : " "),
362  Aig_ObjFanin1(pFanout)->Id, (Aig_ObjFaninC1(pFanout)? "\'" : " ") );
363  printf( "\n" );
364  }
365  return;
366  }
367  // there are choices
368  if ( p->pEquivs && p->pEquivs[pObj->Id] )
369  {
370  // print equivalence class
371  printf( " { %4d ", pObj->Id );
372  for ( pTemp = p->pEquivs[pObj->Id]; pTemp; pTemp = p->pEquivs[pTemp->Id] )
373  printf( " %4d%s", pTemp->Id, (pTemp->fPhase != pObj->fPhase)? "\'" : " " );
374  printf( " }" );
375  return;
376  }
377  // this is a secondary node
378  if ( p->pReprs && p->pReprs[pObj->Id] )
379  printf( " class of %d", pObj->Id );
380 }
#define Aig_ObjForEachFanout(p, pObj, pFanout, iFan, i)
Definition: aig.h:427
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Not(Aig_Obj_t *p)
Definition: aig.h:247
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static int Aig_ObjIsBuf(Aig_Obj_t *pObj)
Definition: aig.h:277
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
Definition: aig.h:69
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
unsigned int fPhase
Definition: aig.h:78
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjRefs(Aig_Obj_t *pObj)
Definition: aig.h:300
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
int Id
Definition: aig.h:85
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
void Aig_ObjPrintEqn ( FILE *  pFile,
Aig_Obj_t pObj,
Vec_Vec_t vLevels,
int  Level 
)

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

Synopsis [Prints Eqn formula for the AIG rooted at this node.]

Description [The formula is in terms of PIs, which should have their names assigned in pObj->pData fields.]

SideEffects []

SeeAlso []

Definition at line 519 of file aigUtil.c.

520 {
521  Vec_Ptr_t * vSuper;
522  Aig_Obj_t * pFanin;
523  int fCompl, i;
524  // store the complemented attribute
525  fCompl = Aig_IsComplement(pObj);
526  pObj = Aig_Regular(pObj);
527  // constant case
528  if ( Aig_ObjIsConst1(pObj) )
529  {
530  fprintf( pFile, "%d", !fCompl );
531  return;
532  }
533  // PI case
534  if ( Aig_ObjIsCi(pObj) )
535  {
536  fprintf( pFile, "%s%s", fCompl? "!" : "", (char*)pObj->pData );
537  return;
538  }
539  // AND case
540  Vec_VecExpand( vLevels, Level );
541  vSuper = Vec_VecEntry(vLevels, Level);
542  Aig_ObjCollectMulti( pObj, vSuper );
543  fprintf( pFile, "%s", (Level==0? "" : "(") );
544  Vec_PtrForEachEntry( Aig_Obj_t *, vSuper, pFanin, i )
545  {
546  Aig_ObjPrintEqn( pFile, Aig_NotCond(pFanin, fCompl), vLevels, Level+1 );
547  if ( i < Vec_PtrSize(vSuper) - 1 )
548  fprintf( pFile, " %s ", fCompl? "+" : "*" );
549  }
550  fprintf( pFile, "%s", (Level==0? "" : ")") );
551  return;
552 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
void * pData
Definition: aig.h:87
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
Definition: aig.h:69
static void Vec_VecExpand(Vec_Vec_t *p, int Level)
Definition: vecVec.h:190
static Vec_Ptr_t * Vec_VecEntry(Vec_Vec_t *p, int i)
Definition: vecVec.h:271
void Aig_ObjCollectMulti(Aig_Obj_t *pRoot, Vec_Ptr_t *vSuper)
Definition: aigUtil.c:289
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
void Aig_ObjPrintEqn(FILE *pFile, Aig_Obj_t *pObj, Vec_Vec_t *vLevels, int Level)
Definition: aigUtil.c:519
void Aig_ObjPrintVerbose ( Aig_Obj_t pObj,
int  fHaig 
)

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

Synopsis [Prints node in HAIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 653 of file aigUtil.c.

654 {
655  assert( !Aig_IsComplement(pObj) );
656  printf( "Node %p : ", pObj );
657  if ( Aig_ObjIsConst1(pObj) )
658  printf( "constant 1" );
659  else if ( Aig_ObjIsCi(pObj) )
660  printf( "PI" );
661  else if ( Aig_ObjIsCo(pObj) )
662  {
663  printf( "PO" );
664  printf( "%p%s",
665  Aig_ObjFanin0(pObj), (Aig_ObjFaninC0(pObj)? "\'" : " ") );
666  }
667  else
668  printf( "AND( %p%s, %p%s )",
669  Aig_ObjFanin0(pObj), (Aig_ObjFaninC0(pObj)? "\'" : " "),
670  Aig_ObjFanin1(pObj), (Aig_ObjFaninC1(pObj)? "\'" : " ") );
671  printf( " (refs = %3d)", Aig_ObjRefs(pObj) );
672 }
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjRefs(Aig_Obj_t *pObj)
Definition: aig.h:300
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
void Aig_ObjPrintVerilog ( FILE *  pFile,
Aig_Obj_t pObj,
Vec_Vec_t vLevels,
int  Level 
)

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

Synopsis [Prints Verilog formula for the AIG rooted at this node.]

Description [The formula is in terms of PIs, which should have their names assigned in pObj->pData fields.]

SideEffects []

SeeAlso []

Definition at line 566 of file aigUtil.c.

567 {
568  Vec_Ptr_t * vSuper;
569  Aig_Obj_t * pFanin, * pFanin0, * pFanin1, * pFaninC;
570  int fCompl, i;
571  // store the complemented attribute
572  fCompl = Aig_IsComplement(pObj);
573  pObj = Aig_Regular(pObj);
574  // constant case
575  if ( Aig_ObjIsConst1(pObj) )
576  {
577  fprintf( pFile, "1\'b%d", !fCompl );
578  return;
579  }
580  // PI case
581  if ( Aig_ObjIsCi(pObj) )
582  {
583  fprintf( pFile, "%s%s", fCompl? "~" : "", (char*)pObj->pData );
584  return;
585  }
586  // EXOR case
587  if ( Aig_ObjIsExor(pObj) )
588  {
589  Vec_VecExpand( vLevels, Level );
590  vSuper = Vec_VecEntry( vLevels, Level );
591  Aig_ObjCollectMulti( pObj, vSuper );
592  fprintf( pFile, "%s", (Level==0? "" : "(") );
593  Vec_PtrForEachEntry( Aig_Obj_t *, vSuper, pFanin, i )
594  {
595  Aig_ObjPrintVerilog( pFile, Aig_NotCond(pFanin, (fCompl && i==0)), vLevels, Level+1 );
596  if ( i < Vec_PtrSize(vSuper) - 1 )
597  fprintf( pFile, " ^ " );
598  }
599  fprintf( pFile, "%s", (Level==0? "" : ")") );
600  return;
601  }
602  // MUX case
603  if ( Aig_ObjIsMuxType(pObj) )
604  {
605  if ( Aig_ObjRecognizeExor( pObj, &pFanin0, &pFanin1 ) )
606  {
607  fprintf( pFile, "%s", (Level==0? "" : "(") );
608  Aig_ObjPrintVerilog( pFile, Aig_NotCond(pFanin0, fCompl), vLevels, Level+1 );
609  fprintf( pFile, " ^ " );
610  Aig_ObjPrintVerilog( pFile, pFanin1, vLevels, Level+1 );
611  fprintf( pFile, "%s", (Level==0? "" : ")") );
612  }
613  else
614  {
615  pFaninC = Aig_ObjRecognizeMux( pObj, &pFanin1, &pFanin0 );
616  fprintf( pFile, "%s", (Level==0? "" : "(") );
617  Aig_ObjPrintVerilog( pFile, pFaninC, vLevels, Level+1 );
618  fprintf( pFile, " ? " );
619  Aig_ObjPrintVerilog( pFile, Aig_NotCond(pFanin1, fCompl), vLevels, Level+1 );
620  fprintf( pFile, " : " );
621  Aig_ObjPrintVerilog( pFile, Aig_NotCond(pFanin0, fCompl), vLevels, Level+1 );
622  fprintf( pFile, "%s", (Level==0? "" : ")") );
623  }
624  return;
625  }
626  // AND case
627  Vec_VecExpand( vLevels, Level );
628  vSuper = Vec_VecEntry(vLevels, Level);
629  Aig_ObjCollectMulti( pObj, vSuper );
630  fprintf( pFile, "%s", (Level==0? "" : "(") );
631  Vec_PtrForEachEntry( Aig_Obj_t *, vSuper, pFanin, i )
632  {
633  Aig_ObjPrintVerilog( pFile, Aig_NotCond(pFanin, fCompl), vLevels, Level+1 );
634  if ( i < Vec_PtrSize(vSuper) - 1 )
635  fprintf( pFile, " %s ", fCompl? "|" : "&" );
636  }
637  fprintf( pFile, "%s", (Level==0? "" : ")") );
638  return;
639 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
int Aig_ObjRecognizeExor(Aig_Obj_t *pObj, Aig_Obj_t **ppFan0, Aig_Obj_t **ppFan1)
Definition: aigUtil.c:343
void * pData
Definition: aig.h:87
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
Definition: aig.h:69
int Aig_ObjIsMuxType(Aig_Obj_t *pNode)
Definition: aigUtil.c:307
static int Aig_ObjIsExor(Aig_Obj_t *pObj)
Definition: aig.h:279
Aig_Obj_t * Aig_ObjRecognizeMux(Aig_Obj_t *pNode, Aig_Obj_t **ppNodeT, Aig_Obj_t **ppNodeE)
Definition: aigUtil.c:387
static void Vec_VecExpand(Vec_Vec_t *p, int Level)
Definition: vecVec.h:190
static Vec_Ptr_t * Vec_VecEntry(Vec_Vec_t *p, int i)
Definition: vecVec.h:271
void Aig_ObjCollectMulti(Aig_Obj_t *pRoot, Vec_Ptr_t *vSuper)
Definition: aigUtil.c:289
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
void Aig_ObjPrintVerilog(FILE *pFile, Aig_Obj_t *pObj, Vec_Vec_t *vLevels, int Level)
Definition: aigUtil.c:566
Aig_Obj_t* Aig_ObjReal_rec ( Aig_Obj_t pObj)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 476 of file aigUtil.c.

477 {
478  Aig_Obj_t * pObjNew, * pObjR = Aig_Regular(pObj);
479  if ( !Aig_ObjIsBuf(pObjR) )
480  return pObj;
481  pObjNew = Aig_ObjReal_rec( Aig_ObjChild0(pObjR) );
482  return Aig_NotCond( pObjNew, Aig_IsComplement(pObj) );
483 }
static Aig_Obj_t * Aig_ObjChild0(Aig_Obj_t *pObj)
Definition: aig.h:310
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static int Aig_ObjIsBuf(Aig_Obj_t *pObj)
Definition: aig.h:277
Aig_Obj_t * Aig_ObjReal_rec(Aig_Obj_t *pObj)
Definition: aigUtil.c:476
Definition: aig.h:69
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
static Aig_Obj_t* Aig_ObjRealCopy ( Aig_Obj_t pObj)
inlinestatic

Definition at line 320 of file aig.h.

320 { return Aig_NotCond((Aig_Obj_t *)Aig_Regular(pObj)->pData, Aig_IsComplement(pObj));}
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
Definition: aig.h:69
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
int Aig_ObjRecognizeExor ( Aig_Obj_t pObj,
Aig_Obj_t **  ppFan0,
Aig_Obj_t **  ppFan1 
)

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 343 of file aigUtil.c.

344 {
345  Aig_Obj_t * p0, * p1;
346  assert( !Aig_IsComplement(pObj) );
347  if ( !Aig_ObjIsNode(pObj) )
348  return 0;
349  if ( Aig_ObjIsExor(pObj) )
350  {
351  *ppFan0 = Aig_ObjChild0(pObj);
352  *ppFan1 = Aig_ObjChild1(pObj);
353  return 1;
354  }
355  assert( Aig_ObjIsAnd(pObj) );
356  p0 = Aig_ObjChild0(pObj);
357  p1 = Aig_ObjChild1(pObj);
358  if ( !Aig_IsComplement(p0) || !Aig_IsComplement(p1) )
359  return 0;
360  p0 = Aig_Regular(p0);
361  p1 = Aig_Regular(p1);
362  if ( !Aig_ObjIsAnd(p0) || !Aig_ObjIsAnd(p1) )
363  return 0;
364  if ( Aig_ObjFanin0(p0) != Aig_ObjFanin0(p1) || Aig_ObjFanin1(p0) != Aig_ObjFanin1(p1) )
365  return 0;
366  if ( Aig_ObjFaninC0(p0) == Aig_ObjFaninC0(p1) || Aig_ObjFaninC1(p0) == Aig_ObjFaninC1(p1) )
367  return 0;
368  *ppFan0 = Aig_ObjChild0(p0);
369  *ppFan1 = Aig_ObjChild1(p0);
370  return 1;
371 }
static Aig_Obj_t * Aig_ObjChild0(Aig_Obj_t *pObj)
Definition: aig.h:310
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static Aig_Obj_t * Aig_ObjChild1(Aig_Obj_t *pObj)
Definition: aig.h:311
Definition: aig.h:69
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static int Aig_ObjIsExor(Aig_Obj_t *pObj)
Definition: aig.h:279
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjIsAnd(Aig_Obj_t *pObj)
Definition: aig.h:278
Aig_Obj_t* Aig_ObjRecognizeMux ( Aig_Obj_t pNode,
Aig_Obj_t **  ppNodeT,
Aig_Obj_t **  ppNodeE 
)

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

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

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

SideEffects []

SeeAlso []

Definition at line 387 of file aigUtil.c.

388 {
389  Aig_Obj_t * pNode0, * pNode1;
390  assert( !Aig_IsComplement(pNode) );
391  assert( Aig_ObjIsMuxType(pNode) );
392  // get children
393  pNode0 = Aig_ObjFanin0(pNode);
394  pNode1 = Aig_ObjFanin1(pNode);
395 
396  // find the control variable
397  if ( Aig_ObjFanin1(pNode0) == Aig_ObjFanin1(pNode1) && (Aig_ObjFaninC1(pNode0) ^ Aig_ObjFaninC1(pNode1)) )
398  {
399 // if ( Fraig_IsComplement(pNode1->p2) )
400  if ( Aig_ObjFaninC1(pNode0) )
401  { // pNode2->p2 is positive phase of C
402  *ppNodeT = Aig_Not(Aig_ObjChild0(pNode1));//pNode2->p1);
403  *ppNodeE = Aig_Not(Aig_ObjChild0(pNode0));//pNode1->p1);
404  return Aig_ObjChild1(pNode1);//pNode2->p2;
405  }
406  else
407  { // pNode1->p2 is positive phase of C
408  *ppNodeT = Aig_Not(Aig_ObjChild0(pNode0));//pNode1->p1);
409  *ppNodeE = Aig_Not(Aig_ObjChild0(pNode1));//pNode2->p1);
410  return Aig_ObjChild1(pNode0);//pNode1->p2;
411  }
412  }
413  else if ( Aig_ObjFanin0(pNode0) == Aig_ObjFanin0(pNode1) && (Aig_ObjFaninC0(pNode0) ^ Aig_ObjFaninC0(pNode1)) )
414  {
415 // if ( Fraig_IsComplement(pNode1->p1) )
416  if ( Aig_ObjFaninC0(pNode0) )
417  { // pNode2->p1 is positive phase of C
418  *ppNodeT = Aig_Not(Aig_ObjChild1(pNode1));//pNode2->p2);
419  *ppNodeE = Aig_Not(Aig_ObjChild1(pNode0));//pNode1->p2);
420  return Aig_ObjChild0(pNode1);//pNode2->p1;
421  }
422  else
423  { // pNode1->p1 is positive phase of C
424  *ppNodeT = Aig_Not(Aig_ObjChild1(pNode0));//pNode1->p2);
425  *ppNodeE = Aig_Not(Aig_ObjChild1(pNode1));//pNode2->p2);
426  return Aig_ObjChild0(pNode0);//pNode1->p1;
427  }
428  }
429  else if ( Aig_ObjFanin0(pNode0) == Aig_ObjFanin1(pNode1) && (Aig_ObjFaninC0(pNode0) ^ Aig_ObjFaninC1(pNode1)) )
430  {
431 // if ( Fraig_IsComplement(pNode1->p1) )
432  if ( Aig_ObjFaninC0(pNode0) )
433  { // pNode2->p2 is positive phase of C
434  *ppNodeT = Aig_Not(Aig_ObjChild0(pNode1));//pNode2->p1);
435  *ppNodeE = Aig_Not(Aig_ObjChild1(pNode0));//pNode1->p2);
436  return Aig_ObjChild1(pNode1);//pNode2->p2;
437  }
438  else
439  { // pNode1->p1 is positive phase of C
440  *ppNodeT = Aig_Not(Aig_ObjChild1(pNode0));//pNode1->p2);
441  *ppNodeE = Aig_Not(Aig_ObjChild0(pNode1));//pNode2->p1);
442  return Aig_ObjChild0(pNode0);//pNode1->p1;
443  }
444  }
445  else if ( Aig_ObjFanin1(pNode0) == Aig_ObjFanin0(pNode1) && (Aig_ObjFaninC1(pNode0) ^ Aig_ObjFaninC0(pNode1)) )
446  {
447 // if ( Fraig_IsComplement(pNode1->p2) )
448  if ( Aig_ObjFaninC1(pNode0) )
449  { // pNode2->p1 is positive phase of C
450  *ppNodeT = Aig_Not(Aig_ObjChild1(pNode1));//pNode2->p2);
451  *ppNodeE = Aig_Not(Aig_ObjChild0(pNode0));//pNode1->p1);
452  return Aig_ObjChild0(pNode1);//pNode2->p1;
453  }
454  else
455  { // pNode1->p2 is positive phase of C
456  *ppNodeT = Aig_Not(Aig_ObjChild0(pNode0));//pNode1->p1);
457  *ppNodeE = Aig_Not(Aig_ObjChild1(pNode1));//pNode2->p2);
458  return Aig_ObjChild1(pNode0);//pNode1->p2;
459  }
460  }
461  assert( 0 ); // this is not MUX
462  return NULL;
463 }
static Aig_Obj_t * Aig_ObjChild0(Aig_Obj_t *pObj)
Definition: aig.h:310
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Not(Aig_Obj_t *p)
Definition: aig.h:247
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static Aig_Obj_t * Aig_ObjChild1(Aig_Obj_t *pObj)
Definition: aig.h:311
Definition: aig.h:69
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
int Aig_ObjIsMuxType(Aig_Obj_t *pNode)
Definition: aigUtil.c:307
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
#define assert(ex)
Definition: util_old.h:213
static void Aig_ObjRef ( Aig_Obj_t pObj)
inlinestatic

Definition at line 301 of file aig.h.

301 { pObj->nRefs++; }
unsigned int nRefs
Definition: aig.h:81
static int Aig_ObjRefs ( Aig_Obj_t pObj)
inlinestatic

Definition at line 300 of file aig.h.

300 { return pObj->nRefs; }
unsigned int nRefs
Definition: aig.h:81
void Aig_ObjRemoveFanout ( Aig_Man_t p,
Aig_Obj_t pObj,
Aig_Obj_t pFanout 
)

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

Synopsis [Removes fanout (pFanout) of node (pObj).]

Description []

SideEffects []

SeeAlso []

Definition at line 154 of file aigFanout.c.

155 {
156  int iFan, * pFirst, * pPrevC, * pNextC, * pPrev, * pNext;
157  assert( p->pFanData && pObj->Id < p->nFansAlloc && pFanout->Id < p->nFansAlloc );
158  assert( !Aig_IsComplement(pObj) && !Aig_IsComplement(pFanout) );
159  assert( pFanout->Id > 0 );
160  iFan = Aig_FanoutCreate( pFanout->Id, Aig_ObjWhatFanin(pFanout, pObj) );
161  pPrevC = Aig_FanoutPrev( p->pFanData, iFan );
162  pNextC = Aig_FanoutNext( p->pFanData, iFan );
163  pPrev = Aig_FanoutPrev( p->pFanData, *pNextC );
164  pNext = Aig_FanoutNext( p->pFanData, *pPrevC );
165  assert( *pPrev == iFan );
166  assert( *pNext == iFan );
167  pFirst = Aig_FanoutObj( p->pFanData, pObj->Id );
168  assert( *pFirst > 0 );
169  if ( *pFirst == iFan )
170  {
171  if ( *pNextC == iFan )
172  {
173  *pFirst = 0;
174  *pPrev = 0;
175  *pNext = 0;
176  *pPrevC = 0;
177  *pNextC = 0;
178  return;
179  }
180  *pFirst = *pNextC;
181  }
182  *pPrev = *pPrevC;
183  *pNext = *pNextC;
184  *pPrevC = 0;
185  *pNextC = 0;
186 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static int Aig_ObjWhatFanin(Aig_Obj_t *pObj, Aig_Obj_t *pFanin)
Definition: aig.h:332
static int * Aig_FanoutObj(int *pData, int ObjId)
Definition: aigFanout.c:37
static int * Aig_FanoutPrev(int *pData, int iFan)
Definition: aigFanout.c:38
static int * Aig_FanoutNext(int *pData, int iFan)
Definition: aigFanout.c:39
static ABC_NAMESPACE_IMPL_START int Aig_FanoutCreate(int FanId, int Num)
DECLARATIONS ///.
Definition: aigFanout.c:36
#define assert(ex)
Definition: util_old.h:213
int Id
Definition: aig.h:85
void Aig_ObjReplace ( Aig_Man_t p,
Aig_Obj_t pObjOld,
Aig_Obj_t pObjNew,
int  fUpdateLevel 
)

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

Synopsis [Replaces one object by another.]

Description [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 and the new object remains in the manager; otherwise, the new object is deleted.]

SideEffects []

SeeAlso []

Definition at line 467 of file aigObj.c.

468 {
469  Aig_Obj_t * pObjNewR = Aig_Regular(pObjNew);
470  // the object to be replaced cannot be complemented
471  assert( !Aig_IsComplement(pObjOld) );
472  // the object to be replaced cannot be a terminal
473  assert( !Aig_ObjIsCi(pObjOld) && !Aig_ObjIsCo(pObjOld) );
474  // the object to be used cannot be a buffer or a PO
475  assert( !Aig_ObjIsBuf(pObjNewR) && !Aig_ObjIsCo(pObjNewR) );
476  // the object cannot be the same
477  assert( pObjOld != pObjNewR );
478  // make sure object is not pointing to itself
479  assert( pObjOld != Aig_ObjFanin0(pObjNewR) );
480  assert( pObjOld != Aig_ObjFanin1(pObjNewR) );
481  if ( pObjOld == Aig_ObjFanin0(pObjNewR) || pObjOld == Aig_ObjFanin1(pObjNewR) )
482  {
483  printf( "Aig_ObjReplace(): Internal error!\n" );
484  exit(1);
485  }
486  // recursively delete the old node - but leave the object there
487  pObjNewR->nRefs++;
488  Aig_ObjDelete_rec( p, pObjOld, 0 );
489  pObjNewR->nRefs--;
490  // if the new object is complemented or already used, create a buffer
491  p->nObjs[pObjOld->Type]--;
492  if ( Aig_IsComplement(pObjNew) || Aig_ObjRefs(pObjNew) > 0 || !Aig_ObjIsNode(pObjNew) )
493  {
494  pObjOld->Type = AIG_OBJ_BUF;
495  Aig_ObjConnect( p, pObjOld, pObjNew, NULL );
496  p->nBufReplaces++;
497  }
498  else
499  {
500  Aig_Obj_t * pFanin0 = pObjNew->pFanin0;
501  Aig_Obj_t * pFanin1 = pObjNew->pFanin1;
502  int LevelOld = pObjOld->Level;
503  pObjOld->Type = pObjNew->Type;
504  Aig_ObjDisconnect( p, pObjNew );
505  Aig_ObjConnect( p, pObjOld, pFanin0, pFanin1 );
506  // delete the new object
507  Aig_ObjDelete( p, pObjNew );
508  // update levels
509  if ( p->pFanData )
510  {
511  pObjOld->Level = LevelOld;
512  Aig_ManUpdateLevel( p, pObjOld );
513  }
514  if ( fUpdateLevel )
515  {
516  Aig_ObjClearReverseLevel( p, pObjOld );
517  Aig_ManUpdateReverseLevel( p, pObjOld );
518  }
519  }
520  p->nObjs[pObjOld->Type]++;
521  // store buffers if fanout is allocated
522  if ( p->pFanData && Aig_ObjIsBuf(pObjOld) )
523  {
524  Vec_PtrPush( p->vBufs, pObjOld );
525  p->nBufMax = Abc_MaxInt( p->nBufMax, Vec_PtrSize(p->vBufs) );
526  Aig_ManPropagateBuffers( p, fUpdateLevel );
527  }
528 }
VOID_HACK exit()
void Aig_ObjDelete_rec(Aig_Man_t *p, Aig_Obj_t *pObj, int fFreeTop)
Definition: aigObj.c:232
unsigned Level
Definition: aig.h:82
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Aig_Obj_t * pFanin1
Definition: aig.h:76
unsigned int Type
Definition: aig.h:77
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
int Aig_ManPropagateBuffers(Aig_Man_t *p, int fUpdateLevel)
Definition: aigObj.c:432
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
void Aig_ManUpdateReverseLevel(Aig_Man_t *p, Aig_Obj_t *pObjNew)
Definition: aigTiming.c:247
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Aig_ObjIsBuf(Aig_Obj_t *pObj)
Definition: aig.h:277
void Aig_ObjClearReverseLevel(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigTiming.c:83
Definition: aig.h:69
void Aig_ObjDelete(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigObj.c:209
void Aig_ObjDisconnect(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigObj.c:171
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjRefs(Aig_Obj_t *pObj)
Definition: aig.h:300
void Aig_ObjConnect(Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pFan0, Aig_Obj_t *pFan1)
Definition: aigObj.c:126
void Aig_ManUpdateLevel(Aig_Man_t *p, Aig_Obj_t *pObjNew)
Definition: aigTiming.c:195
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
Aig_Obj_t * pFanin0
Definition: aig.h:75
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
unsigned int nRefs
Definition: aig.h:81
static Aig_Obj_t* Aig_ObjRepr ( Aig_Man_t p,
Aig_Obj_t pObj 
)
inlinestatic

Definition at line 330 of file aig.h.

330 { return p->pReprs? p->pReprs[pObj->Id] : NULL; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Id
Definition: aig.h:85
int Aig_ObjRequiredLevel ( Aig_Man_t p,
Aig_Obj_t pObj 
)

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

Synopsis [Returns required level of the node.]

Description [Converts the reverse levels of the node into its required level as follows: ReqLevel(Node) = MaxLevels(Ntk) + 1 - LevelR(Node).]

SideEffects []

SeeAlso []

Definition at line 100 of file aigTiming.c.

101 {
102  assert( p->vLevelR );
103  return p->nLevelMax + 1 - Aig_ObjReverseLevel(p, pObj);
104 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static ABC_NAMESPACE_IMPL_START int Aig_ObjReverseLevel(Aig_Man_t *p, Aig_Obj_t *pObj)
DECLARATIONS ///.
Definition: aigTiming.c:46
#define assert(ex)
Definition: util_old.h:213
static void Aig_ObjSetCopy ( Aig_Obj_t pObj,
Aig_Obj_t pCopy 
)
inlinestatic

Definition at line 319 of file aig.h.

319 { assert( !Aig_IsComplement(pObj) ); pObj->pData = pCopy; }
void * pData
Definition: aig.h:87
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
#define assert(ex)
Definition: util_old.h:213
static void Aig_ObjSetCuts ( Aig_ManCut_t p,
Aig_Obj_t pObj,
Aig_Cut_t pCuts 
)
inlinestatic

Definition at line 210 of file aig.h.

210 { p->pCuts[pObj->Id] = pCuts; }
Aig_Cut_t ** pCuts
Definition: aig.h:196
int Id
Definition: aig.h:85
static void Aig_ObjSetEquiv ( Aig_Man_t p,
Aig_Obj_t pObj,
Aig_Obj_t pEqu 
)
inlinestatic

Definition at line 329 of file aig.h.

329 { assert(p->pEquivs); p->pEquivs[pObj->Id] = pEqu; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
int Id
Definition: aig.h:85
static int Aig_ObjSetLevel ( Aig_Obj_t pObj,
int  i 
)
inlinestatic

Definition at line 325 of file aig.h.

325 { assert( !Aig_IsComplement(pObj) ); return pObj->Level = i; }
unsigned Level
Definition: aig.h:82
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
#define assert(ex)
Definition: util_old.h:213
static void Aig_ObjSetMarkA ( Aig_Obj_t pObj)
inlinestatic

Definition at line 289 of file aig.h.

289 { pObj->fMarkA = 1; }
unsigned int fMarkA
Definition: aig.h:79
static void Aig_ObjSetRepr ( Aig_Man_t p,
Aig_Obj_t pObj,
Aig_Obj_t pRepr 
)
inlinestatic

Definition at line 331 of file aig.h.

331 { assert(p->pReprs); p->pReprs[pObj->Id] = pRepr; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
int Id
Definition: aig.h:85
static void Aig_ObjSetTravId ( Aig_Obj_t pObj,
int  TravId 
)
inlinestatic

Definition at line 292 of file aig.h.

292 { pObj->TravId = TravId; }
int TravId
Definition: aig.h:84
static void Aig_ObjSetTravIdCurrent ( Aig_Man_t p,
Aig_Obj_t pObj 
)
inlinestatic

Definition at line 293 of file aig.h.

293 { pObj->TravId = p->nTravIds; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int TravId
Definition: aig.h:84
static void Aig_ObjSetTravIdPrevious ( Aig_Man_t p,
Aig_Obj_t pObj 
)
inlinestatic

Definition at line 294 of file aig.h.

294 { pObj->TravId = p->nTravIds - 1; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int TravId
Definition: aig.h:84
static int Aig_ObjToLit ( Aig_Obj_t pObj)
inlinestatic

Definition at line 321 of file aig.h.

321 { return Abc_Var2Lit( Aig_ObjId(Aig_Regular(pObj)), Aig_IsComplement(pObj) ); }
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
static Aig_Type_t Aig_ObjType ( Aig_Obj_t pObj)
inlinestatic

Definition at line 272 of file aig.h.

272 { return (Aig_Type_t)pObj->Type; }
Aig_Type_t
Definition: aig.h:57
unsigned int Type
Definition: aig.h:77
static int Aig_ObjWhatFanin ( Aig_Obj_t pObj,
Aig_Obj_t pFanin 
)
inlinestatic

Definition at line 332 of file aig.h.

333 {
334  if ( Aig_ObjFanin0(pObj) == pFanin ) return 0;
335  if ( Aig_ObjFanin1(pObj) == pFanin ) return 1;
336  assert(0); return -1;
337 }
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
#define assert(ex)
Definition: util_old.h:213
Aig_Obj_t* Aig_Oper ( Aig_Man_t p,
Aig_Obj_t p0,
Aig_Obj_t p1,
Aig_Type_t  Type 
)

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

Synopsis [Perform one operation.]

Description [The argument nodes can be complemented.]

SideEffects []

SeeAlso []

Definition at line 83 of file aigOper.c.

84 {
85  if ( Type == AIG_OBJ_AND )
86  return Aig_And( p, p0, p1 );
87  if ( Type == AIG_OBJ_EXOR )
88  return Aig_Exor( p, p0, p1 );
89  assert( 0 );
90  return NULL;
91 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Aig_Obj_t * Aig_Exor(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:220
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
#define assert(ex)
Definition: util_old.h:213
Aig_Obj_t* Aig_Or ( Aig_Man_t p,
Aig_Obj_t p0,
Aig_Obj_t p1 
)

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

Synopsis [Implements Boolean OR.]

Description []

SideEffects []

SeeAlso []

Definition at line 259 of file aigOper.c.

260 {
261  return Aig_Not( Aig_And( p, Aig_Not(p0), Aig_Not(p1) ) );
262 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_Not(Aig_Obj_t *p)
Definition: aig.h:247
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static Aig_Obj_t* Aig_Regular ( Aig_Obj_t p)
inlinestatic

Definition at line 246 of file aig.h.

246 { return (Aig_Obj_t *)((ABC_PTRUINT_T)(p) & ~01); }
Definition: aig.h:69
Vec_Ptr_t* Aig_Support ( Aig_Man_t p,
Aig_Obj_t pObj 
)

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

Synopsis [Counts the support size of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 832 of file aigDfs.c.

833 {
834  Vec_Ptr_t * vSupp;
835  assert( !Aig_IsComplement(pObj) );
836  assert( !Aig_ObjIsCo(pObj) );
838  vSupp = Vec_PtrAlloc( 100 );
839  Aig_Support_rec( p, pObj, vSupp );
840  return vSupp;
841 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
void Aig_Support_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vSupp)
Definition: aigDfs.c:803
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
void Aig_SupportNodes ( Aig_Man_t p,
Aig_Obj_t **  ppObjs,
int  nObjs,
Vec_Ptr_t vSupp 
)

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

Synopsis [Counts the support size of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 854 of file aigDfs.c.

855 {
856  int i;
857  Vec_PtrClear( vSupp );
860  for ( i = 0; i < nObjs; i++ )
861  {
862  assert( !Aig_IsComplement(ppObjs[i]) );
863  if ( Aig_ObjIsCo(ppObjs[i]) )
864  Aig_Support_rec( p, Aig_ObjFanin0(ppObjs[i]), vSupp );
865  else
866  Aig_Support_rec( p, ppObjs[i], vSupp );
867  }
868 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
void Aig_Support_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vSupp)
Definition: aigDfs.c:803
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
int Aig_SupportSize ( Aig_Man_t p,
Aig_Obj_t pObj 
)

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

Synopsis [Counts the support size of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 758 of file aigDfs.c.

759 {
760  int Counter = 0;
761  assert( !Aig_IsComplement(pObj) );
762  assert( !Aig_ObjIsCo(pObj) );
764  Aig_SupportSize_rec( p, pObj, &Counter );
765  return Counter;
766 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
static int Counter
void Aig_SupportSize_rec(Aig_Man_t *p, Aig_Obj_t *pObj, int *pCounter)
Definition: aigDfs.c:731
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
void Aig_TableClear ( Aig_Man_t p)

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

Synopsis [Profiles the hash table.]

Description []

SideEffects []

SeeAlso []

Definition at line 265 of file aigTable.c.

266 {
267  ABC_FREE( p->pTable );
268  p->nTableSize = 0;
269 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_FREE(obj)
Definition: abc_global.h:232
int Aig_TableCountEntries ( Aig_Man_t p)

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 218 of file aigTable.c.

219 {
220  Aig_Obj_t * pEntry;
221  int i, Counter = 0;
222  for ( i = 0; i < p->nTableSize; i++ )
223  for ( pEntry = p->pTable[i]; pEntry; pEntry = pEntry->pNext )
224  Counter++;
225  return Counter;
226 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Definition: aig.h:69
Aig_Obj_t * pNext
Definition: aig.h:72
static int Counter
void Aig_TableDelete ( Aig_Man_t p,
Aig_Obj_t pObj 
)

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

Synopsis [Deletes the node from the hash table.]

Description []

SideEffects []

SeeAlso []

Definition at line 196 of file aigTable.c.

197 {
198  Aig_Obj_t ** ppPlace;
199  assert( !Aig_IsComplement(pObj) );
200  ppPlace = Aig_TableFind( p, pObj );
201  assert( *ppPlace == pObj ); // node should be in the table
202  // remove the node
203  *ppPlace = pObj->pNext;
204  pObj->pNext = NULL;
205 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
Definition: aig.h:69
Aig_Obj_t * pNext
Definition: aig.h:72
#define assert(ex)
Definition: util_old.h:213
static Aig_Obj_t ** Aig_TableFind(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigTable.c:42
void Aig_TableInsert ( Aig_Man_t p,
Aig_Obj_t pObj 
)

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

Synopsis [Adds the new node to the hash table.]

Description []

SideEffects []

SeeAlso []

Definition at line 173 of file aigTable.c.

174 {
175  Aig_Obj_t ** ppPlace;
176  assert( !Aig_IsComplement(pObj) );
177  assert( Aig_TableLookup(p, pObj) == NULL );
178  if ( (pObj->Id & 0xFF) == 0 && 2 * p->nTableSize < Aig_ManNodeNum(p) )
179  Aig_TableResize( p );
180  ppPlace = Aig_TableFind( p, pObj );
181  assert( *ppPlace == NULL );
182  *ppPlace = pObj;
183 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Aig_TableResize(Aig_Man_t *p)
FUNCTION DEFINITIONS ///.
Definition: aigTable.c:69
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
Definition: aig.h:69
Aig_Obj_t * Aig_TableLookup(Aig_Man_t *p, Aig_Obj_t *pGhost)
Definition: aigTable.c:116
#define assert(ex)
Definition: util_old.h:213
int Id
Definition: aig.h:85
static Aig_Obj_t ** Aig_TableFind(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigTable.c:42
Aig_Obj_t* Aig_TableLookup ( Aig_Man_t p,
Aig_Obj_t pGhost 
)

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 116 of file aigTable.c.

117 {
118  Aig_Obj_t * pEntry;
119  assert( !Aig_IsComplement(pGhost) );
120  assert( Aig_ObjIsNode(pGhost) );
121  assert( Aig_ObjChild0(pGhost) && Aig_ObjChild1(pGhost) );
122  assert( Aig_ObjFanin0(pGhost)->Id < Aig_ObjFanin1(pGhost)->Id );
123  if ( p->pTable == NULL || !Aig_ObjRefs(Aig_ObjFanin0(pGhost)) || !Aig_ObjRefs(Aig_ObjFanin1(pGhost)) )
124  return NULL;
125  for ( pEntry = p->pTable[Aig_Hash(pGhost, p->nTableSize)]; pEntry; pEntry = pEntry->pNext )
126  {
127  if ( Aig_ObjChild0(pEntry) == Aig_ObjChild0(pGhost) &&
128  Aig_ObjChild1(pEntry) == Aig_ObjChild1(pGhost) &&
129  Aig_ObjType(pEntry) == Aig_ObjType(pGhost) )
130  return pEntry;
131  }
132  return NULL;
133 }
static Aig_Type_t Aig_ObjType(Aig_Obj_t *pObj)
Definition: aig.h:272
static Aig_Obj_t * Aig_ObjChild0(Aig_Obj_t *pObj)
Definition: aig.h:310
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static ABC_NAMESPACE_IMPL_START unsigned long Aig_Hash(Aig_Obj_t *pObj, int TableSize)
DECLARATIONS ///.
Definition: aigTable.c:31
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static Aig_Obj_t * Aig_ObjChild1(Aig_Obj_t *pObj)
Definition: aig.h:311
Definition: aig.h:69
Aig_Obj_t * pNext
Definition: aig.h:72
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjRefs(Aig_Obj_t *pObj)
Definition: aig.h:300
Aig_Obj_t* Aig_TableLookupTwo ( Aig_Man_t p,
Aig_Obj_t pFanin0,
Aig_Obj_t pFanin1 
)

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 146 of file aigTable.c.

147 {
148  Aig_Obj_t * pGhost;
149  // consider simple cases
150  if ( pFanin0 == pFanin1 )
151  return pFanin0;
152  if ( pFanin0 == Aig_Not(pFanin1) )
153  return Aig_ManConst0(p);
154  if ( Aig_Regular(pFanin0) == Aig_ManConst1(p) )
155  return pFanin0 == Aig_ManConst1(p) ? pFanin1 : Aig_ManConst0(p);
156  if ( Aig_Regular(pFanin1) == Aig_ManConst1(p) )
157  return pFanin1 == Aig_ManConst1(p) ? pFanin0 : Aig_ManConst0(p);
158  pGhost = Aig_ObjCreateGhost( p, pFanin0, pFanin1, AIG_OBJ_AND );
159  return Aig_TableLookup( p, pGhost );
160 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static Aig_Obj_t * Aig_ManConst0(Aig_Man_t *p)
Definition: aig.h:263
static Aig_Obj_t * Aig_Not(Aig_Obj_t *p)
Definition: aig.h:247
Definition: aig.h:69
static Aig_Obj_t * Aig_ObjCreateGhost(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1, Aig_Type_t Type)
Definition: aig.h:346
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
Aig_Obj_t * Aig_TableLookup(Aig_Man_t *p, Aig_Obj_t *pGhost)
Definition: aigTable.c:116
void Aig_TableProfile ( Aig_Man_t p)

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

Synopsis [Profiles the hash table.]

Description []

SideEffects []

SeeAlso []

Definition at line 239 of file aigTable.c.

240 {
241  Aig_Obj_t * pEntry;
242  int i, Counter;
243  printf( "Table size = %d. Entries = %d.\n", p->nTableSize, Aig_ManNodeNum(p) );
244  for ( i = 0; i < p->nTableSize; i++ )
245  {
246  Counter = 0;
247  for ( pEntry = p->pTable[i]; pEntry; pEntry = pEntry->pNext )
248  Counter++;
249  if ( Counter )
250  printf( "%d ", Counter );
251  }
252 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
Definition: aig.h:69
Aig_Obj_t * pNext
Definition: aig.h:72
static int Counter
char* Aig_TimeStamp ( )

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

Synopsis [Returns the time stamp.]

Description [The file should be closed.]

SideEffects []

SeeAlso []

Definition at line 62 of file aigUtil.c.

63 {
64  static char Buffer[100];
65  char * TimeStamp;
66  time_t ltime;
67  // get the current time
68  time( &ltime );
69  TimeStamp = asctime( localtime( &ltime ) );
70  TimeStamp[ strlen(TimeStamp) - 1 ] = 0;
71  strcpy( Buffer, TimeStamp );
72  return Buffer;
73 }
char * strcpy()
int strlen()
Aig_Obj_t* Aig_Transfer ( Aig_Man_t pSour,
Aig_Man_t pDest,
Aig_Obj_t pRoot,
int  nVars 
)

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

Synopsis [Transfers the AIG from one manager into another.]

Description []

SideEffects []

SeeAlso []

Definition at line 904 of file aigDfs.c.

905 {
906  Aig_Obj_t * pObj;
907  int i;
908  // solve simple cases
909  if ( pSour == pDest )
910  return pRoot;
911  if ( Aig_ObjIsConst1( Aig_Regular(pRoot) ) )
912  return Aig_NotCond( Aig_ManConst1(pDest), Aig_IsComplement(pRoot) );
913  // set the PI mapping
914  Aig_ManForEachCi( pSour, pObj, i )
915  {
916  if ( i == nVars )
917  break;
918  pObj->pData = Aig_IthVar(pDest, i);
919  }
920  // transfer and set markings
921  Aig_Transfer_rec( pDest, Aig_Regular(pRoot) );
922  // clear the markings
924  return Aig_NotCond( (Aig_Obj_t *)Aig_Regular(pRoot)->pData, Aig_IsComplement(pRoot) );
925 }
void * pData
Definition: aig.h:87
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
Aig_Obj_t * Aig_IthVar(Aig_Man_t *p, int i)
FUNCTION DEFINITIONS ///.
Definition: aigOper.c:63
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
Definition: aig.h:69
void Aig_ConeUnmark_rec(Aig_Obj_t *pObj)
Definition: aigDfs.c:690
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
void Aig_Transfer_rec(Aig_Man_t *pDest, Aig_Obj_t *pObj)
Definition: aigDfs.c:881
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
int Aig_TransferMappedClasses ( Aig_Man_t pAig,
Aig_Man_t pPart,
int *  pMapBack 
)

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

Synopsis [Transfers the classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 533 of file aigRepr.c.

534 {
535  Aig_Obj_t * pObj;
536  int nClasses, k;
537  nClasses = 0;
538  if ( pPart->pReprs ) {
539  Aig_ManForEachObj( pPart, pObj, k )
540  {
541  if ( pPart->pReprs[pObj->Id] == NULL )
542  continue;
543  nClasses++;
544  Aig_ObjSetRepr_( pAig,
545  Aig_ManObj(pAig, pMapBack[pObj->Id]),
546  Aig_ManObj(pAig, pMapBack[pPart->pReprs[pObj->Id]->Id]) );
547  }
548  }
549  return nClasses;
550 }
static Aig_Obj_t * Aig_ManObj(Aig_Man_t *p, int i)
Definition: aig.h:270
Definition: aig.h:69
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
static void Aig_ObjSetRepr_(Aig_Man_t *p, Aig_Obj_t *pNode1, Aig_Obj_t *pNode2)
Definition: aigRepr.c:105
int Id
Definition: aig.h:85
static int Aig_WordCountOnes ( unsigned  uWord)
inlinestatic

Definition at line 229 of file aig.h.

230 {
231  uWord = (uWord & 0x55555555) + ((uWord>>1) & 0x55555555);
232  uWord = (uWord & 0x33333333) + ((uWord>>2) & 0x33333333);
233  uWord = (uWord & 0x0F0F0F0F) + ((uWord>>4) & 0x0F0F0F0F);
234  uWord = (uWord & 0x00FF00FF) + ((uWord>>8) & 0x00FF00FF);
235  return (uWord & 0x0000FFFF) + (uWord>>16);
236 }
static int Aig_WordFindFirstBit ( unsigned  uWord)
inlinestatic

Definition at line 237 of file aig.h.

238 {
239  int i;
240  for ( i = 0; i < 32; i++ )
241  if ( uWord & (1 << i) )
242  return i;
243  return -1;
244 }
Aig_Man_t* Rtm_ManRetime ( Aig_Man_t p,
int  fForward,
int  nStepsMax,
int  fVerbose 
)

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

Synopsis [Performs forward retiming with the given limit on depth.]

Description []

SideEffects []

SeeAlso []

Definition at line 834 of file aigRet.c.

835 {
836  Vec_Ptr_t * vQueue;
837  Aig_Man_t * pNew;
838  Rtm_Man_t * pRtm;
839  Rtm_Obj_t * pObj, * pNext;
840  Aig_Obj_t * pObjAig;
841  int i, k, nAutos, Degree, DegreeMax = 0;
842  abctime clk;
843 
844  // create the retiming manager
845 clk = Abc_Clock();
846  pRtm = Rtm_ManFromAig( p );
847  // set registers
848  Aig_ManForEachLoSeq( p, pObjAig, i )
849  Rtm_ObjAddFirst( pRtm, Rtm_ObjEdge((Rtm_Obj_t *)pObjAig->pData, 0), fForward? RTM_VAL_ZERO : RTM_VAL_VOID );
850  // detect and mark the autonomous components
851  if ( fForward )
852  nAutos = Rtm_ManMarkAutoFwd( pRtm );
853  else
854  nAutos = Rtm_ManMarkAutoBwd( pRtm );
855  if ( fVerbose )
856  {
857  printf( "Detected %d autonomous objects. ", nAutos );
858  ABC_PRT( "Time", Abc_Clock() - clk );
859  }
860 
861  // set the current retiming number
862  Rtm_ManForEachObj( pRtm, pObj, i )
863  {
864  assert( pObj->nFanins == pObj->Num );
865  assert( pObj->nFanouts == pObj->Temp );
866  pObj->Num = 0;
867  }
868 
869 clk = Abc_Clock();
870  // put the LOs on the queue
871  vQueue = Vec_PtrAlloc( 1000 );
872  if ( fForward )
873  {
874  Aig_ManForEachLoSeq( p, pObjAig, i )
875  {
876  pObj = (Rtm_Obj_t *)pObjAig->pData;
877  if ( pObj->fAuto )
878  continue;
879  pObj->fMark = 1;
880  Vec_PtrPush( vQueue, pObj );
881  }
882  }
883  else
884  {
885  Aig_ManForEachLiSeq( p, pObjAig, i )
886  {
887  pObj = (Rtm_Obj_t *)pObjAig->pData;
888  if ( pObj->fAuto )
889  continue;
890  pObj->fMark = 1;
891  Vec_PtrPush( vQueue, pObj );
892  }
893  }
894  // perform retiming
895  DegreeMax = 0;
896  Vec_PtrForEachEntry( Rtm_Obj_t *, vQueue, pObj, i )
897  {
898  pObj->fMark = 0;
899  // retime the node
900  if ( fForward )
901  {
902  Rtm_ObjRetimeFwd( pRtm, pObj );
903  // check if its fanouts should be retimed
904  Rtm_ObjForEachFanout( pObj, pNext, k )
905  {
906  if ( pNext->fMark ) // skip aleady scheduled
907  continue;
908  if ( pNext->Type ) // skip POs
909  continue;
910  if ( !Rtm_ObjCheckRetimeFwd( pNext ) ) // skip non-retimable
911  continue;
912  Degree = Rtm_ObjGetDegreeFwd( pNext );
913  DegreeMax = Abc_MaxInt( DegreeMax, Degree );
914  if ( Degree > nStepsMax ) // skip nodes with high degree
915  continue;
916  pNext->fMark = 1;
917  pNext->Num = Degree;
918  Vec_PtrPush( vQueue, pNext );
919  }
920  }
921  else
922  {
923  Rtm_ObjRetimeBwd( pRtm, pObj );
924  // check if its fanouts should be retimed
925  Rtm_ObjForEachFanin( pObj, pNext, k )
926  {
927  if ( pNext->fMark ) // skip aleady scheduled
928  continue;
929  if ( pNext->nFanins == 0 ) // skip PIs
930  continue;
931  if ( !Rtm_ObjCheckRetimeBwd( pNext ) ) // skip non-retimable
932  continue;
933  Degree = Rtm_ObjGetDegreeBwd( pNext );
934  DegreeMax = Abc_MaxInt( DegreeMax, Degree );
935  if ( Degree > nStepsMax ) // skip nodes with high degree
936  continue;
937  pNext->fMark = 1;
938  pNext->Num = Degree;
939  Vec_PtrPush( vQueue, pNext );
940  }
941  }
942  }
943 
944  if ( fVerbose )
945  {
946  printf( "Performed %d %s latch moves of max depth %d and max latch count %d.\n",
947  Vec_PtrSize(vQueue), fForward? "fwd":"bwd", DegreeMax, Rtm_ManLatchMax(pRtm) );
948  printf( "Memory usage = %d. ", pRtm->nExtraCur );
949  ABC_PRT( "Time", Abc_Clock() - clk );
950  }
951  Vec_PtrFree( vQueue );
952 
953  // get the new manager
954  pNew = Rtm_ManToAig( pRtm );
955  pNew->pName = Abc_UtilStrsav( p->pName );
956  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
957  Rtm_ManFree( pRtm );
958  // group the registers
959 clk = Abc_Clock();
960  pNew = Aig_ManReduceLaches( pNew, fVerbose );
961  if ( fVerbose )
962  {
963  ABC_PRT( "Register sharing time", Abc_Clock() - clk );
964  }
965  return pNew;
966 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
int Temp
Definition: aigRet.c:72
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Aig_Man_t * Rtm_ManToAig(Rtm_Man_t *pRtm)
Definition: aigRet.c:765
unsigned long fAuto
Definition: aigRet.c:66
unsigned Num
Definition: aigRet.c:70
#define Rtm_ManForEachObj(p, pObj, i)
Definition: aigRet.c:127
void * pData
Definition: aig.h:87
unsigned long fMark
Definition: aigRet.c:65
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static void Rtm_ObjAddFirst(Rtm_Man_t *p, Rtm_Edg_t *pEdge, Rtm_Init_t Val)
Definition: aigRet.c:116
int nFanouts
Definition: aigRet.c:73
#define Rtm_ObjForEachFanin(pObj, pFanin, i)
Definition: aigRet.c:130
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
int Rtm_ObjGetDegreeFwd(Rtm_Obj_t *pObj)
Definition: aigRet.c:475
unsigned long Type
Definition: aigRet.c:64
#define Rtm_ObjForEachFanout(pObj, pFanout, i)
Definition: aigRet.c:133
unsigned long nFanins
Definition: aigRet.c:69
void Rtm_ManFree(Rtm_Man_t *p)
Definition: aigRet.c:327
void Rtm_ObjRetimeFwd(Rtm_Man_t *pRtm, Rtm_Obj_t *pObj)
Definition: aigRet.c:515
Aig_Man_t * Aig_ManReduceLaches(Aig_Man_t *p, int fVerbose)
Definition: aigScl.c:455
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
Definition: aig.h:69
int Rtm_ManLatchMax(Rtm_Man_t *p)
Definition: aigRet.c:348
static Rtm_Edg_t * Rtm_ObjEdge(Rtm_Obj_t *pObj, int i)
Definition: aigRet.c:79
int Rtm_ObjCheckRetimeFwd(Rtm_Obj_t *pObj)
Definition: aigRet.c:433
Rtm_Man_t * Rtm_ManFromAig(Aig_Man_t *p)
Definition: aigRet.c:675
int Rtm_ObjCheckRetimeBwd(Rtm_Obj_t *pObj)
Definition: aigRet.c:454
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
int Rtm_ManMarkAutoBwd(Rtm_Man_t *pRtm)
Definition: aigRet.c:643
#define ABC_PRT(a, t)
Definition: abc_global.h:220
#define Aig_ManForEachLoSeq(p, pObj, i)
Definition: aig.h:441
void Rtm_ObjRetimeBwd(Rtm_Man_t *pRtm, Rtm_Obj_t *pObj)
Definition: aigRet.c:545
int Rtm_ObjGetDegreeBwd(Rtm_Obj_t *pObj)
Definition: aigRet.c:495
#define assert(ex)
Definition: util_old.h:213
#define Aig_ManForEachLiSeq(p, pObj, i)
Definition: aig.h:447
int Rtm_ManMarkAutoFwd(Rtm_Man_t *pRtm)
Definition: aigRet.c:591
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
ABC_INT64_T abctime
Definition: abc_global.h:278
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223