abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
gia.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  Gia_Rpr_t_
 
struct  Gia_Plc_t_
 
struct  Gia_Obj_t_
 
struct  Gia_Man_t_
 
struct  Gps_Par_t_
 
struct  Emb_Par_t_
 
struct  Gia_ParFra_t_
 
struct  Gia_ParSim_t_
 
struct  Gia_ManSim_t_
 
struct  Jf_Par_t_
 

Macros

#define GIA_NONE   0x1FFFFFFF
 INCLUDES ///. More...
 
#define GIA_VOID   0x0FFFFFFF
 
#define GIA_ZER   1
 
#define GIA_ONE   2
 
#define GIA_UND   3
 
#define Gia_ManForEachConst(p, i)   for ( i = 1; i < Gia_ManObjNum(p); i++ ) if ( !Gia_ObjIsConst(p, i) ) {} else
 
#define Gia_ManForEachClass(p, i)   for ( i = 1; i < Gia_ManObjNum(p); i++ ) if ( !Gia_ObjIsHead(p, i) ) {} else
 
#define Gia_ManForEachClassReverse(p, i)   for ( i = Gia_ManObjNum(p) - 1; i > 0; i-- ) if ( !Gia_ObjIsHead(p, i) ) {} else
 
#define Gia_ClassForEachObj(p, i, iObj)   for ( assert(Gia_ObjIsHead(p, i)), iObj = i; iObj; iObj = Gia_ObjNext(p, iObj) )
 
#define Gia_ClassForEachObj1(p, i, iObj)   for ( assert(Gia_ObjIsHead(p, i)), iObj = Gia_ObjNext(p, i); iObj; iObj = Gia_ObjNext(p, iObj) )
 
#define Gia_ObjForEachFanoutStatic(p, pObj, pFanout, i)   for ( i = 0; (i < Gia_ObjFanoutNum(p, pObj)) && (((pFanout) = Gia_ObjFanout(p, pObj, i)), 1); i++ )
 
#define Gia_ObjForEachFanoutStaticId(p, Id, FanId, i)   for ( i = 0; (i < Gia_ObjFanoutNumId(p, Id)) && (((FanId) = Gia_ObjFanoutId(p, Id, i)), 1); i++ )
 
#define Gia_ManForEachLut(p, i)   for ( i = 1; i < Gia_ManObjNum(p); i++ ) if ( !Gia_ObjIsLut(p, i) ) {} else
 
#define Gia_LutForEachFanin(p, i, iFan, k)   for ( k = 0; k < Gia_ObjLutSize(p,i) && ((iFan = Gia_ObjLutFanins(p,i)[k]),1); k++ )
 
#define Gia_LutForEachFaninObj(p, i, pFanin, k)   for ( k = 0; k < Gia_ObjLutSize(p,i) && ((pFanin = Gia_ManObj(p, Gia_ObjLutFanins(p,i)[k])),1); k++ )
 
#define Gia_ManForEachCell(p, i)   for ( i = 2; i < 2*Gia_ManObjNum(p); i++ ) if ( !Gia_ObjIsCell(p, i) ) {} else
 
#define Gia_CellForEachFanin(p, i, iFanLit, k)   for ( k = 0; k < Gia_ObjCellSize(p,i) && ((iFanLit = Gia_ObjCellFanins(p,i)[k]),1); k++ )
 
#define Gia_ManForEachObj(p, pObj, i)   for ( i = 0; (i < p->nObjs) && ((pObj) = Gia_ManObj(p, i)); i++ )
 MACRO DEFINITIONS ///. More...
 
#define Gia_ManForEachObj1(p, pObj, i)   for ( i = 1; (i < p->nObjs) && ((pObj) = Gia_ManObj(p, i)); i++ )
 
#define Gia_ManForEachObjVec(vVec, p, pObj, i)   for ( i = 0; (i < Vec_IntSize(vVec)) && ((pObj) = Gia_ManObj(p, Vec_IntEntry(vVec,i))); i++ )
 
#define Gia_ManForEachObjVecReverse(vVec, p, pObj, i)   for ( i = Vec_IntSize(vVec) - 1; (i >= 0) && ((pObj) = Gia_ManObj(p, Vec_IntEntry(vVec,i))); i-- )
 
#define Gia_ManForEachObjVecLit(vVec, p, pObj, fCompl, i)   for ( i = 0; (i < Vec_IntSize(vVec)) && ((pObj) = Gia_ManObj(p, Abc_Lit2Var(Vec_IntEntry(vVec,i)))) && (((fCompl) = Abc_LitIsCompl(Vec_IntEntry(vVec,i))),1); i++ )
 
#define Gia_ManForEachObjReverse(p, pObj, i)   for ( i = p->nObjs - 1; (i >= 0) && ((pObj) = Gia_ManObj(p, i)); i-- )
 
#define Gia_ManForEachObjReverse1(p, pObj, i)   for ( i = p->nObjs - 1; (i > 0) && ((pObj) = Gia_ManObj(p, i)); i-- )
 
#define Gia_ManForEachBuf(p, pObj, i)   for ( i = Gia_ManBufNum(p) ? 0 : p->nObjs; (i < p->nObjs) && ((pObj) = Gia_ManObj(p, i)); i++ ) if ( !Gia_ObjIsBuf(pObj) ) {} else
 
#define Gia_ManForEachBufId(p, i)   for ( i = 0; (i < p->nObjs); i++ ) if ( !Gia_ObjIsBuf(Gia_ManObj(p, i)) ) {} else
 
#define Gia_ManForEachAnd(p, pObj, i)   for ( i = 0; (i < p->nObjs) && ((pObj) = Gia_ManObj(p, i)); i++ ) if ( !Gia_ObjIsAnd(pObj) ) {} else
 
#define Gia_ManForEachAndId(p, i)   for ( i = 0; (i < p->nObjs); i++ ) if ( !Gia_ObjIsAnd(Gia_ManObj(p, i)) ) {} else
 
#define Gia_ManForEachMuxId(p, i)   for ( i = 0; (i < p->nObjs); i++ ) if ( !Gia_ObjIsMuxId(p, i) ) {} else
 
#define Gia_ManForEachCand(p, pObj, i)   for ( i = 0; (i < p->nObjs) && ((pObj) = Gia_ManObj(p, i)); i++ ) if ( !Gia_ObjIsCand(pObj) ) {} else
 
#define Gia_ManForEachAndReverse(p, pObj, i)   for ( i = p->nObjs - 1; (i > 0) && ((pObj) = Gia_ManObj(p, i)); i-- ) if ( !Gia_ObjIsAnd(pObj) ) {} else
 
#define Gia_ManForEachAndReverseId(p, i)   for ( i = p->nObjs - 1; (i > 0); i-- ) if ( !Gia_ObjIsAnd(Gia_ManObj(p, i)) ) {} else
 
#define Gia_ManForEachMux(p, pObj, i)   for ( i = 0; (i < p->nObjs) && ((pObj) = Gia_ManObj(p, i)); i++ ) if ( !Gia_ObjIsMuxId(p, i) ) {} else
 
#define Gia_ManForEachCi(p, pObj, i)   for ( i = 0; (i < Vec_IntSize(p->vCis)) && ((pObj) = Gia_ManCi(p, i)); i++ )
 
#define Gia_ManForEachCiId(p, Id, i)   for ( i = 0; (i < Vec_IntSize(p->vCis)) && ((Id) = Gia_ObjId(p, Gia_ManCi(p, i))); i++ )
 
#define Gia_ManForEachCiReverse(p, pObj, i)   for ( i = Vec_IntSize(p->vCis) - 1; (i >= 0) && ((pObj) = Gia_ManCi(p, i)); i-- )
 
#define Gia_ManForEachCo(p, pObj, i)   for ( i = 0; (i < Vec_IntSize(p->vCos)) && ((pObj) = Gia_ManCo(p, i)); i++ )
 
#define Gia_ManForEachCoVec(vVec, p, pObj, i)   for ( i = 0; (i < Vec_IntSize(vVec)) && ((pObj) = Gia_ManCo(p, Vec_IntEntry(vVec,i))); i++ )
 
#define Gia_ManForEachCoId(p, Id, i)   for ( i = 0; (i < Vec_IntSize(p->vCos)) && ((Id) = Gia_ObjId(p, Gia_ManCo(p, i))); i++ )
 
#define Gia_ManForEachCoReverse(p, pObj, i)   for ( i = Vec_IntSize(p->vCos) - 1; (i >= 0) && ((pObj) = Gia_ManCo(p, i)); i-- )
 
#define Gia_ManForEachCoDriver(p, pObj, i)   for ( i = 0; (i < Vec_IntSize(p->vCos)) && ((pObj) = Gia_ObjFanin0(Gia_ManCo(p, i))); i++ )
 
#define Gia_ManForEachCoDriverId(p, DriverId, i)   for ( i = 0; (i < Vec_IntSize(p->vCos)) && (((DriverId) = Gia_ObjFaninId0p(p, Gia_ManCo(p, i))), 1); i++ )
 
#define Gia_ManForEachPi(p, pObj, i)   for ( i = 0; (i < Gia_ManPiNum(p)) && ((pObj) = Gia_ManCi(p, i)); i++ )
 
#define Gia_ManForEachPo(p, pObj, i)   for ( i = 0; (i < Gia_ManPoNum(p)) && ((pObj) = Gia_ManCo(p, i)); i++ )
 
#define Gia_ManForEachRo(p, pObj, i)   for ( i = 0; (i < Gia_ManRegNum(p)) && ((pObj) = Gia_ManCi(p, Gia_ManPiNum(p)+i)); i++ )
 
#define Gia_ManForEachRi(p, pObj, i)   for ( i = 0; (i < Gia_ManRegNum(p)) && ((pObj) = Gia_ManCo(p, Gia_ManPoNum(p)+i)); i++ )
 
#define Gia_ManForEachRiRo(p, pObjRi, pObjRo, i)   for ( i = 0; (i < Gia_ManRegNum(p)) && ((pObjRi) = Gia_ManCo(p, Gia_ManPoNum(p)+i)) && ((pObjRo) = Gia_ManCi(p, Gia_ManPiNum(p)+i)); i++ )
 

Typedefs

typedef struct Gia_MmFixed_t_ Gia_MmFixed_t
 BASIC TYPES ///. More...
 
typedef struct Gia_MmFlex_t_ Gia_MmFlex_t
 
typedef struct Gia_MmStep_t_ Gia_MmStep_t
 
typedef struct Gia_Rpr_t_ Gia_Rpr_t
 
typedef struct Gia_Plc_t_ Gia_Plc_t
 
typedef struct Gia_Obj_t_ Gia_Obj_t
 
typedef struct Gia_Man_t_ Gia_Man_t
 
typedef struct Gps_Par_t_ Gps_Par_t
 
typedef struct Emb_Par_t_ Emb_Par_t
 
typedef struct Gia_ParFra_t_ Gia_ParFra_t
 
typedef struct Gia_ParSim_t_ Gia_ParSim_t
 
typedef struct Gia_ManSim_t_ Gia_ManSim_t
 
typedef struct Jf_Par_t_ Jf_Par_t
 
typedef struct Tas_Man_t_ Tas_Man_t
 

Functions

static unsigned Gia_ObjCutSign (unsigned ObjId)
 
static int Gia_WordHasOneBit (unsigned uWord)
 
static int Gia_WordHasOnePair (unsigned uWord)
 
static int Gia_WordCountOnes (unsigned uWord)
 
static int Gia_WordFindFirstBit (unsigned uWord)
 
static int Gia_ManTruthIsConst0 (unsigned *pIn, int nVars)
 
static int Gia_ManTruthIsConst1 (unsigned *pIn, int nVars)
 
static void Gia_ManTruthCopy (unsigned *pOut, unsigned *pIn, int nVars)
 
static void Gia_ManTruthClear (unsigned *pOut, int nVars)
 
static void Gia_ManTruthFill (unsigned *pOut, int nVars)
 
static void Gia_ManTruthNot (unsigned *pOut, unsigned *pIn, int nVars)
 
static int Gia_ManConst0Lit ()
 
static int Gia_ManConst1Lit ()
 
static int Gia_ManIsConst0Lit (int iLit)
 
static int Gia_ManIsConst1Lit (int iLit)
 
static int Gia_ManIsConstLit (int iLit)
 
static Gia_Obj_tGia_Regular (Gia_Obj_t *p)
 
static Gia_Obj_tGia_Not (Gia_Obj_t *p)
 
static Gia_Obj_tGia_NotCond (Gia_Obj_t *p, int c)
 
static int Gia_IsComplement (Gia_Obj_t *p)
 
static char * Gia_ManName (Gia_Man_t *p)
 
static int Gia_ManCiNum (Gia_Man_t *p)
 
static int Gia_ManCoNum (Gia_Man_t *p)
 
static int Gia_ManPiNum (Gia_Man_t *p)
 
static int Gia_ManPoNum (Gia_Man_t *p)
 
static int Gia_ManRegNum (Gia_Man_t *p)
 
static int Gia_ManObjNum (Gia_Man_t *p)
 
static int Gia_ManAndNum (Gia_Man_t *p)
 
static int Gia_ManXorNum (Gia_Man_t *p)
 
static int Gia_ManMuxNum (Gia_Man_t *p)
 
static int Gia_ManBufNum (Gia_Man_t *p)
 
static int Gia_ManAndNotBufNum (Gia_Man_t *p)
 
static int Gia_ManCandNum (Gia_Man_t *p)
 
static int Gia_ManConstrNum (Gia_Man_t *p)
 
static void Gia_ManFlipVerbose (Gia_Man_t *p)
 
static int Gia_ManHasChoices (Gia_Man_t *p)
 
static int Gia_ManChoiceNum (Gia_Man_t *p)
 
static Gia_Obj_tGia_ManConst0 (Gia_Man_t *p)
 
static Gia_Obj_tGia_ManConst1 (Gia_Man_t *p)
 
static Gia_Obj_tGia_ManObj (Gia_Man_t *p, int v)
 
static Gia_Obj_tGia_ManCi (Gia_Man_t *p, int v)
 
static Gia_Obj_tGia_ManCo (Gia_Man_t *p, int v)
 
static Gia_Obj_tGia_ManPi (Gia_Man_t *p, int v)
 
static Gia_Obj_tGia_ManPo (Gia_Man_t *p, int v)
 
static Gia_Obj_tGia_ManRo (Gia_Man_t *p, int v)
 
static Gia_Obj_tGia_ManRi (Gia_Man_t *p, int v)
 
static int Gia_ObjId (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static int Gia_ObjCioId (Gia_Obj_t *pObj)
 
static void Gia_ObjSetCioId (Gia_Obj_t *pObj, int v)
 
static int Gia_ObjValue (Gia_Obj_t *pObj)
 
static void Gia_ObjSetValue (Gia_Obj_t *pObj, int i)
 
static int Gia_ObjPhase (Gia_Obj_t *pObj)
 
static int Gia_ObjPhaseReal (Gia_Obj_t *pObj)
 
static int Gia_ObjIsTerm (Gia_Obj_t *pObj)
 
static int Gia_ObjIsAndOrConst0 (Gia_Obj_t *pObj)
 
static int Gia_ObjIsCi (Gia_Obj_t *pObj)
 
static int Gia_ObjIsCo (Gia_Obj_t *pObj)
 
static int Gia_ObjIsAnd (Gia_Obj_t *pObj)
 
static int Gia_ObjIsXor (Gia_Obj_t *pObj)
 
static int Gia_ObjIsMuxId (Gia_Man_t *p, int iObj)
 
static int Gia_ObjIsMux (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static int Gia_ObjIsAndReal (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static int Gia_ObjIsBuf (Gia_Obj_t *pObj)
 
static int Gia_ObjIsAndNotBuf (Gia_Obj_t *pObj)
 
static int Gia_ObjIsCand (Gia_Obj_t *pObj)
 
static int Gia_ObjIsConst0 (Gia_Obj_t *pObj)
 
static int Gia_ManObjIsConst0 (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static int Gia_Obj2Lit (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static Gia_Obj_tGia_Lit2Obj (Gia_Man_t *p, int iLit)
 
static int Gia_ManCiLit (Gia_Man_t *p, int CiId)
 
static int Gia_ManIdToCioId (Gia_Man_t *p, int Id)
 
static int Gia_ManCiIdToId (Gia_Man_t *p, int CiId)
 
static int Gia_ManCoIdToId (Gia_Man_t *p, int CoId)
 
static int Gia_ObjIsPi (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static int Gia_ObjIsPo (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static int Gia_ObjIsRo (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static int Gia_ObjIsRi (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static Gia_Obj_tGia_ObjRoToRi (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static Gia_Obj_tGia_ObjRiToRo (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static int Gia_ObjDiff0 (Gia_Obj_t *pObj)
 
static int Gia_ObjDiff1 (Gia_Obj_t *pObj)
 
static int Gia_ObjFaninC0 (Gia_Obj_t *pObj)
 
static int Gia_ObjFaninC1 (Gia_Obj_t *pObj)
 
static int Gia_ObjFaninC2 (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static Gia_Obj_tGia_ObjFanin0 (Gia_Obj_t *pObj)
 
static Gia_Obj_tGia_ObjFanin1 (Gia_Obj_t *pObj)
 
static Gia_Obj_tGia_ObjFanin2 (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static Gia_Obj_tGia_ObjChild0 (Gia_Obj_t *pObj)
 
static Gia_Obj_tGia_ObjChild1 (Gia_Obj_t *pObj)
 
static Gia_Obj_tGia_ObjChild2 (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static int Gia_ObjFaninId0 (Gia_Obj_t *pObj, int ObjId)
 
static int Gia_ObjFaninId1 (Gia_Obj_t *pObj, int ObjId)
 
static int Gia_ObjFaninId2 (Gia_Man_t *p, int ObjId)
 
static int Gia_ObjFaninId0p (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static int Gia_ObjFaninId1p (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static int Gia_ObjFaninId2p (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static int Gia_ObjFaninLit0 (Gia_Obj_t *pObj, int ObjId)
 
static int Gia_ObjFaninLit1 (Gia_Obj_t *pObj, int ObjId)
 
static int Gia_ObjFaninLit2 (Gia_Man_t *p, int ObjId)
 
static int Gia_ObjFaninLit0p (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static int Gia_ObjFaninLit1p (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static int Gia_ObjFaninLit2p (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static void Gia_ObjFlipFaninC0 (Gia_Obj_t *pObj)
 
static int Gia_ObjWhatFanin (Gia_Obj_t *pObj, Gia_Obj_t *pFanin)
 
static int Gia_ManPoIsConst0 (Gia_Man_t *p, int iPoIndex)
 
static int Gia_ManPoIsConst1 (Gia_Man_t *p, int iPoIndex)
 
static Gia_Obj_tGia_ObjCopy (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static int Gia_ObjLitCopy (Gia_Man_t *p, int iLit)
 
static int Gia_ObjFanin0Copy (Gia_Obj_t *pObj)
 
static int Gia_ObjFanin1Copy (Gia_Obj_t *pObj)
 
static int Gia_ObjFanin2Copy (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static int Gia_ObjCopyF (Gia_Man_t *p, int f, Gia_Obj_t *pObj)
 
static void Gia_ObjSetCopyF (Gia_Man_t *p, int f, Gia_Obj_t *pObj, int iLit)
 
static int Gia_ObjCopyArray (Gia_Man_t *p, int iObj)
 
static void Gia_ObjSetCopyArray (Gia_Man_t *p, int iObj, int iLit)
 
static void Gia_ManCleanCopyArray (Gia_Man_t *p)
 
static int Gia_ObjFanin0CopyF (Gia_Man_t *p, int f, Gia_Obj_t *pObj)
 
static int Gia_ObjFanin1CopyF (Gia_Man_t *p, int f, Gia_Obj_t *pObj)
 
static int Gia_ObjFanin0CopyArray (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static int Gia_ObjFanin1CopyArray (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static Gia_Obj_tGia_ObjFromLit (Gia_Man_t *p, int iLit)
 
static int Gia_ObjToLit (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static int Gia_ObjPhaseRealLit (Gia_Man_t *p, int iLit)
 
static int Gia_ObjLevelId (Gia_Man_t *p, int Id)
 
static int Gia_ObjLevel (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static void Gia_ObjSetLevelId (Gia_Man_t *p, int Id, int l)
 
static void Gia_ObjSetLevel (Gia_Man_t *p, Gia_Obj_t *pObj, int l)
 
static void Gia_ObjSetCoLevel (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static void Gia_ObjSetBufLevel (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static void Gia_ObjSetAndLevel (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static void Gia_ObjSetXorLevel (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static void Gia_ObjSetMuxLevel (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static void Gia_ObjSetGateLevel (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static int Gia_ObjHasNumId (Gia_Man_t *p, int Id)
 
static int Gia_ObjNumId (Gia_Man_t *p, int Id)
 
static int Gia_ObjNum (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static void Gia_ObjSetNumId (Gia_Man_t *p, int Id, int n)
 
static void Gia_ObjSetNum (Gia_Man_t *p, Gia_Obj_t *pObj, int n)
 
static void Gia_ObjResetNumId (Gia_Man_t *p, int Id)
 
static int Gia_ObjRefNumId (Gia_Man_t *p, int Id)
 
static int Gia_ObjRefIncId (Gia_Man_t *p, int Id)
 
static int Gia_ObjRefDecId (Gia_Man_t *p, int Id)
 
static int Gia_ObjRefNum (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static int Gia_ObjRefInc (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static int Gia_ObjRefDec (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static void Gia_ObjRefFanin0Inc (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static void Gia_ObjRefFanin1Inc (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static void Gia_ObjRefFanin2Inc (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static void Gia_ObjRefFanin0Dec (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static void Gia_ObjRefFanin1Dec (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static void Gia_ObjRefFanin2Dec (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static void Gia_ObjSetTravIdCurrent (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static void Gia_ObjSetTravIdPrevious (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static int Gia_ObjIsTravIdCurrent (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static int Gia_ObjIsTravIdPrevious (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static void Gia_ObjSetTravIdCurrentId (Gia_Man_t *p, int Id)
 
static int Gia_ObjIsTravIdCurrentId (Gia_Man_t *p, int Id)
 
static void Gia_ManTimeClean (Gia_Man_t *p)
 
static void Gia_ManTimeStart (Gia_Man_t *p)
 
static void Gia_ManTimeStop (Gia_Man_t *p)
 
static float Gia_ObjTimeArrival (Gia_Man_t *p, int Id)
 
static float Gia_ObjTimeRequired (Gia_Man_t *p, int Id)
 
static float Gia_ObjTimeSlack (Gia_Man_t *p, int Id)
 
static float Gia_ObjTimeArrivalObj (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static float Gia_ObjTimeRequiredObj (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static float Gia_ObjTimeSlackObj (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static void Gia_ObjSetTimeArrival (Gia_Man_t *p, int Id, float t)
 
static void Gia_ObjSetTimeRequired (Gia_Man_t *p, int Id, float t)
 
static void Gia_ObjSetTimeSlack (Gia_Man_t *p, int Id, float t)
 
static void Gia_ObjSetTimeArrivalObj (Gia_Man_t *p, Gia_Obj_t *pObj, float t)
 
static void Gia_ObjSetTimeRequiredObj (Gia_Man_t *p, Gia_Obj_t *pObj, float t)
 
static void Gia_ObjSetTimeSlackObj (Gia_Man_t *p, Gia_Obj_t *pObj, float t)
 
static int Gia_ObjSimWords (Gia_Man_t *p)
 
static wordGia_ObjSimPi (Gia_Man_t *p, int PiId)
 
static wordGia_ObjSim (Gia_Man_t *p, int Id)
 
static wordGia_ObjSimObj (Gia_Man_t *p, Gia_Obj_t *pObj)
 
void Gia_ObjAddFanout (Gia_Man_t *p, Gia_Obj_t *pObj, Gia_Obj_t *pFanout)
 
static Gia_Obj_tGia_ManAppendObj (Gia_Man_t *p)
 
static int Gia_ManAppendCi (Gia_Man_t *p)
 
static int Gia_ManAppendAnd (Gia_Man_t *p, int iLit0, int iLit1)
 
static int Gia_ManAppendAnd2 (Gia_Man_t *p, int iLit0, int iLit1)
 
static int Gia_ManAppendXorReal (Gia_Man_t *p, int iLit0, int iLit1)
 
static int Gia_ManAppendMuxReal (Gia_Man_t *p, int iLitC, int iLit1, int iLit0)
 
static int Gia_ManAppendBuf (Gia_Man_t *p, int iLit)
 
static int Gia_ManAppendCo (Gia_Man_t *p, int iLit0)
 
static int Gia_ManAppendOr (Gia_Man_t *p, int iLit0, int iLit1)
 
static int Gia_ManAppendMux (Gia_Man_t *p, int iCtrl, int iData1, int iData0)
 
static int Gia_ManAppendMaj (Gia_Man_t *p, int iData0, int iData1, int iData2)
 
static int Gia_ManAppendXor (Gia_Man_t *p, int iLit0, int iLit1)
 
static void Gia_ManPatchCoDriver (Gia_Man_t *p, int iCoIndex, int iLit0)
 
static int Gia_XsimNotCond (int Value, int fCompl)
 
static int Gia_XsimAndCond (int Value0, int fCompl0, int Value1, int fCompl1)
 
static void Gia_ObjTerSimSetC (Gia_Obj_t *pObj)
 
static void Gia_ObjTerSimSet0 (Gia_Obj_t *pObj)
 
static void Gia_ObjTerSimSet1 (Gia_Obj_t *pObj)
 
static void Gia_ObjTerSimSetX (Gia_Obj_t *pObj)
 
static int Gia_ObjTerSimGetC (Gia_Obj_t *pObj)
 
static int Gia_ObjTerSimGet0 (Gia_Obj_t *pObj)
 
static int Gia_ObjTerSimGet1 (Gia_Obj_t *pObj)
 
static int Gia_ObjTerSimGetX (Gia_Obj_t *pObj)
 
static int Gia_ObjTerSimGet0Fanin0 (Gia_Obj_t *pObj)
 
static int Gia_ObjTerSimGet1Fanin0 (Gia_Obj_t *pObj)
 
static int Gia_ObjTerSimGet0Fanin1 (Gia_Obj_t *pObj)
 
static int Gia_ObjTerSimGet1Fanin1 (Gia_Obj_t *pObj)
 
static void Gia_ObjTerSimAnd (Gia_Obj_t *pObj)
 
static void Gia_ObjTerSimCo (Gia_Obj_t *pObj)
 
static void Gia_ObjTerSimRo (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static void Gia_ObjTerSimPrint (Gia_Obj_t *pObj)
 
static int Gia_AigerReadInt (unsigned char *pPos)
 
static void Gia_AigerWriteInt (unsigned char *pPos, int Value)
 
static unsigned Gia_AigerReadUnsigned (unsigned char **ppPos)
 
static void Gia_AigerWriteUnsigned (Vec_Str_t *vStr, unsigned x)
 
static void Gia_AigerWriteUnsignedFile (FILE *pFile, unsigned x)
 
static int Gia_AigerWriteUnsignedBuffer (unsigned char *pBuffer, int Pos, unsigned x)
 
static Gia_Obj_tGia_ObjReprObj (Gia_Man_t *p, int Id)
 
static int Gia_ObjRepr (Gia_Man_t *p, int Id)
 
static void Gia_ObjSetRepr (Gia_Man_t *p, int Id, int Num)
 
static void Gia_ObjSetReprRev (Gia_Man_t *p, int Id, int Num)
 
static void Gia_ObjUnsetRepr (Gia_Man_t *p, int Id)
 
static int Gia_ObjHasRepr (Gia_Man_t *p, int Id)
 
static int Gia_ObjReprSelf (Gia_Man_t *p, int Id)
 
static int Gia_ObjSibl (Gia_Man_t *p, int Id)
 
static Gia_Obj_tGia_ObjSiblObj (Gia_Man_t *p, int Id)
 
static int Gia_ObjProved (Gia_Man_t *p, int Id)
 
static void Gia_ObjSetProved (Gia_Man_t *p, int Id)
 
static void Gia_ObjUnsetProved (Gia_Man_t *p, int Id)
 
static int Gia_ObjFailed (Gia_Man_t *p, int Id)
 
static void Gia_ObjSetFailed (Gia_Man_t *p, int Id)
 
static int Gia_ObjColor (Gia_Man_t *p, int Id, int c)
 
static int Gia_ObjColors (Gia_Man_t *p, int Id)
 
static void Gia_ObjSetColor (Gia_Man_t *p, int Id, int c)
 
static void Gia_ObjSetColors (Gia_Man_t *p, int Id)
 
static int Gia_ObjVisitColor (Gia_Man_t *p, int Id, int c)
 
static int Gia_ObjDiffColors (Gia_Man_t *p, int i, int j)
 
static int Gia_ObjDiffColors2 (Gia_Man_t *p, int i, int j)
 
static Gia_Obj_tGia_ObjNextObj (Gia_Man_t *p, int Id)
 
static int Gia_ObjNext (Gia_Man_t *p, int Id)
 
static void Gia_ObjSetNext (Gia_Man_t *p, int Id, int Num)
 
static int Gia_ObjIsConst (Gia_Man_t *p, int Id)
 
static int Gia_ObjIsHead (Gia_Man_t *p, int Id)
 
static int Gia_ObjIsNone (Gia_Man_t *p, int Id)
 
static int Gia_ObjIsTail (Gia_Man_t *p, int Id)
 
static int Gia_ObjIsClass (Gia_Man_t *p, int Id)
 
static int Gia_ObjHasSameRepr (Gia_Man_t *p, int i, int k)
 
static int Gia_ObjIsFailedPair (Gia_Man_t *p, int i, int k)
 
static int Gia_ClassIsPair (Gia_Man_t *p, int i)
 
static void Gia_ClassUndoPair (Gia_Man_t *p, int i)
 
static int Gia_ObjFoffsetId (Gia_Man_t *p, int Id)
 
static int Gia_ObjFoffset (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static int Gia_ObjFanoutNumId (Gia_Man_t *p, int Id)
 
static int Gia_ObjFanoutNum (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static int Gia_ObjFanoutId (Gia_Man_t *p, int Id, int i)
 
static Gia_Obj_tGia_ObjFanout0 (Gia_Man_t *p, Gia_Obj_t *pObj)
 
static Gia_Obj_tGia_ObjFanout (Gia_Man_t *p, Gia_Obj_t *pObj, int i)
 
static void Gia_ObjSetFanout (Gia_Man_t *p, Gia_Obj_t *pObj, int i, Gia_Obj_t *pFan)
 
static int Gia_ManHasMapping (Gia_Man_t *p)
 
static int Gia_ObjIsLut (Gia_Man_t *p, int Id)
 
static int Gia_ObjLutSize (Gia_Man_t *p, int Id)
 
static int * Gia_ObjLutFanins (Gia_Man_t *p, int Id)
 
static int Gia_ObjLutFanin (Gia_Man_t *p, int Id, int i)
 
static int Gia_ObjLutMuxId (Gia_Man_t *p, int Id)
 
static int Gia_ObjLutIsMux (Gia_Man_t *p, int Id)
 
static int Gia_ManHasCellMapping (Gia_Man_t *p)
 
static int Gia_ObjIsCell (Gia_Man_t *p, int iLit)
 
static int Gia_ObjIsCellInv (Gia_Man_t *p, int iLit)
 
static int Gia_ObjIsCellBuf (Gia_Man_t *p, int iLit)
 
static int Gia_ObjCellSize (Gia_Man_t *p, int iLit)
 
static int * Gia_ObjCellFanins (Gia_Man_t *p, int iLit)
 
static int Gia_ObjCellFanin (Gia_Man_t *p, int iLit, int i)
 
static int Gia_ObjCellId (Gia_Man_t *p, int iLit)
 
int Gia_FileSize (char *pFileName)
 FUNCTION DECLARATIONS ///. More...
 
Gia_Man_tGia_AigerReadFromMemory (char *pContents, int nFileSize, int fSkipStrash, int fCheck)
 
Gia_Man_tGia_AigerRead (char *pFileName, int fSkipStrash, int fCheck)
 
void Gia_AigerWrite (Gia_Man_t *p, char *pFileName, int fWriteSymbols, int fCompact)
 
void Gia_DumpAiger (Gia_Man_t *p, char *pFilePrefix, int iFileNum, int nFileNumDigits)
 
Vec_Str_tGia_AigerWriteIntoMemoryStr (Gia_Man_t *p)
 
Vec_Str_tGia_AigerWriteIntoMemoryStrPart (Gia_Man_t *p, Vec_Int_t *vCis, Vec_Int_t *vAnds, Vec_Int_t *vCos, int nRegs)
 
void Gia_AigerWriteSimple (Gia_Man_t *pInit, char *pFileName)
 
Gia_Man_tGia_ManBalance (Gia_Man_t *p, int fSimpleAnd, int fVerbose)
 
Gia_Man_tGia_ManAreaBalance (Gia_Man_t *p, int fSimpleAnd, int nNewNodesMax, int fVerbose, int fVeryVerbose)
 
Gia_Man_tGia_ManAigSyn2 (Gia_Man_t *p, int fOldAlgo, int fCoarsen, int fCutMin, int nRelaxRatio, int fDelayMin, int fVerbose, int fVeryVerbose)
 
Gia_Man_tGia_ManAigSyn3 (Gia_Man_t *p, int fVerbose, int fVeryVerbose)
 
Gia_Man_tGia_ManAigSyn4 (Gia_Man_t *p, int fVerbose, int fVeryVerbose)
 
unsigned * Gia_ManConvertAigToTruth (Gia_Man_t *p, Gia_Obj_t *pRoot, Vec_Int_t *vLeaves, Vec_Int_t *vTruth, Vec_Int_t *vVisited)
 
Gia_Man_tGia_ManPerformBidec (Gia_Man_t *p, int fVerbose)
 
int Gia_ManVerifyCex (Gia_Man_t *pAig, Abc_Cex_t *p, int fDualOut)
 DECLARATIONS ///. More...
 
int Gia_ManFindFailedPoCex (Gia_Man_t *pAig, Abc_Cex_t *p, int nOutputs)
 
int Gia_ManSetFailedPoCex (Gia_Man_t *pAig, Abc_Cex_t *p)
 
void Gia_ManCounterExampleValueStart (Gia_Man_t *pGia, Abc_Cex_t *pCex)
 
void Gia_ManCounterExampleValueStop (Gia_Man_t *pGia)
 
int Gia_ManCounterExampleValueLookup (Gia_Man_t *pGia, int Id, int iFrame)
 
Abc_Cex_tGia_ManCexExtendToIncludeCurrentStates (Gia_Man_t *p, Abc_Cex_t *pCex)
 
Abc_Cex_tGia_ManCexExtendToIncludeAllObjects (Gia_Man_t *p, Abc_Cex_t *pCex)
 
Vec_Int_tCbs_ManSolveMiter (Gia_Man_t *pGia, int nConfs, Vec_Str_t **pvStatus, int fVerbose)
 
Vec_Int_tCbs_ManSolveMiterNc (Gia_Man_t *pGia, int nConfs, Vec_Str_t **pvStatus, int fVerbose)
 
Vec_Int_tTas_ManSolveMiterNc (Gia_Man_t *pGia, int nConfs, Vec_Str_t **pvStatus, int fVerbose)
 
void Gia_ManPrintFanio (Gia_Man_t *pGia, int nNodes)
 
Gia_Man_tGia_ManDupCof (Gia_Man_t *p, int iVar)
 
Gia_Man_tGia_ManDupCofAllInt (Gia_Man_t *p, Vec_Int_t *vSigs, int fVerbose)
 
Gia_Man_tGia_ManDupCofAll (Gia_Man_t *p, int nFanLim, int fVerbose)
 
void Gia_ManCollectCis (Gia_Man_t *p, int *pNodes, int nNodes, Vec_Int_t *vSupp)
 
void Gia_ManCollectAnds (Gia_Man_t *p, int *pNodes, int nNodes, Vec_Int_t *vNodes)
 
Vec_Int_tGia_ManCollectNodesCis (Gia_Man_t *p, int *pNodes, int nNodes)
 
int Gia_ManSuppSize (Gia_Man_t *p, int *pNodes, int nNodes)
 
int Gia_ManConeSize (Gia_Man_t *p, int *pNodes, int nNodes)
 
Vec_Vec_tGia_ManLevelize (Gia_Man_t *p)
 
Vec_Int_tGia_ManOrderReverse (Gia_Man_t *p)
 
void Gia_ManDupRemapEquiv (Gia_Man_t *pNew, Gia_Man_t *p)
 DECLARATIONS ///. More...
 
Gia_Man_tGia_ManDupOrderDfs (Gia_Man_t *p)
 
Gia_Man_tGia_ManDupOrderDfsChoices (Gia_Man_t *p)
 
Gia_Man_tGia_ManDupOrderDfsReverse (Gia_Man_t *p)
 
Gia_Man_tGia_ManDupOutputGroup (Gia_Man_t *p, int iOutStart, int iOutStop)
 
Gia_Man_tGia_ManDupOutputVec (Gia_Man_t *p, Vec_Int_t *vOutPres)
 
Gia_Man_tGia_ManDupSelectedOutputs (Gia_Man_t *p, Vec_Int_t *vOutsLeft)
 
Gia_Man_tGia_ManDupOrderAiger (Gia_Man_t *p)
 
Gia_Man_tGia_ManDupLastPis (Gia_Man_t *p, int nLastPis)
 
Gia_Man_tGia_ManDupFlip (Gia_Man_t *p, int *pInitState)
 
Gia_Man_tGia_ManDupCycled (Gia_Man_t *pAig, Abc_Cex_t *pCex, int nFrames)
 
Gia_Man_tGia_ManDup (Gia_Man_t *p)
 
Gia_Man_tGia_ManDupWithAttributes (Gia_Man_t *p)
 
Gia_Man_tGia_ManDupZero (Gia_Man_t *p)
 
Gia_Man_tGia_ManDupPerm (Gia_Man_t *p, Vec_Int_t *vPiPerm)
 
Gia_Man_tGia_ManDupPermFlop (Gia_Man_t *p, Vec_Int_t *vFfPerm)
 
Gia_Man_tGia_ManDupPermFlopGap (Gia_Man_t *p, Vec_Int_t *vFfPerm)
 
void Gia_ManDupAppend (Gia_Man_t *p, Gia_Man_t *pTwo)
 
void Gia_ManDupAppendShare (Gia_Man_t *p, Gia_Man_t *pTwo)
 
Gia_Man_tGia_ManDupAppendNew (Gia_Man_t *pOne, Gia_Man_t *pTwo)
 
Gia_Man_tGia_ManDupAppendCones (Gia_Man_t *p, Gia_Man_t **ppCones, int nCones, int fOnlyRegs)
 
Gia_Man_tGia_ManDupSelf (Gia_Man_t *p)
 
Gia_Man_tGia_ManDupFlopClass (Gia_Man_t *p, int iClass)
 
Gia_Man_tGia_ManDupMarked (Gia_Man_t *p)
 
Gia_Man_tGia_ManDupTimes (Gia_Man_t *p, int nTimes)
 
Gia_Man_tGia_ManDupDfs (Gia_Man_t *p)
 
Gia_Man_tGia_ManDupCofactorVar (Gia_Man_t *p, int iVar, int Value)
 
Gia_Man_tGia_ManDupCofactorObj (Gia_Man_t *p, int iObj, int Value)
 
Gia_Man_tGia_ManDupExist (Gia_Man_t *p, int iVar)
 
Gia_Man_tGia_ManDupDfsSkip (Gia_Man_t *p)
 
Gia_Man_tGia_ManDupDfsCone (Gia_Man_t *p, Gia_Obj_t *pObj)
 
Gia_Man_tGia_ManDupDfsNode (Gia_Man_t *p, Gia_Obj_t *pObj)
 
Gia_Man_tGia_ManDupDfsLitArray (Gia_Man_t *p, Vec_Int_t *vLits)
 
Gia_Man_tGia_ManDupTrimmed (Gia_Man_t *p, int fTrimCis, int fTrimCos, int fDualOut, int OutValue)
 
Gia_Man_tGia_ManDupOntop (Gia_Man_t *p, Gia_Man_t *p2)
 
Gia_Man_tGia_ManDupWithNewPo (Gia_Man_t *p1, Gia_Man_t *p2)
 
Gia_Man_tGia_ManDupDfsCiMap (Gia_Man_t *p, int *pCi2Lit, Vec_Int_t *vLits)
 
Gia_Man_tGia_ManDupDfsClasses (Gia_Man_t *p)
 
Gia_Man_tGia_ManDupTopAnd (Gia_Man_t *p, int fVerbose)
 
Gia_Man_tGia_ManMiter (Gia_Man_t *pAig0, Gia_Man_t *pAig1, int nInsDup, int fDualOut, int fSeq, int fImplic, int fVerbose)
 
Gia_Man_tGia_ManDupAndOr (Gia_Man_t *p, int nOuts, int fUseOr, int fCompl)
 
Gia_Man_tGia_ManDupZeroUndc (Gia_Man_t *p, char *pInit, int fVerbose)
 
Gia_Man_tGia_ManMiter2 (Gia_Man_t *p, char *pInit, int fVerbose)
 
Gia_Man_tGia_ManTransformMiter (Gia_Man_t *p)
 
Gia_Man_tGia_ManTransformToDual (Gia_Man_t *p)
 
Gia_Man_tGia_ManChoiceMiter (Vec_Ptr_t *vGias)
 
Gia_Man_tGia_ManDupWithConstraints (Gia_Man_t *p, Vec_Int_t *vPoTypes)
 
Gia_Man_tGia_ManDupCones (Gia_Man_t *p, int *pPos, int nPos, int fTrimPis)
 
Gia_Man_tGia_ManDupOneHot (Gia_Man_t *p)
 
Gia_Man_tGia_ManDupLevelized (Gia_Man_t *p)
 
Gia_Man_tGia_ManDupFromVecs (Gia_Man_t *p, Vec_Int_t *vCis, Vec_Int_t *vAnds, Vec_Int_t *vCos, int nRegs)
 
Gia_Man_tGia_ManDupSliced (Gia_Man_t *p, int nSuppMax)
 
void Gia_ManDetectSeqSignals (Gia_Man_t *p, int fSetReset, int fVerbose)
 
Gia_Man_tGia_ManUnrollAndCofactor (Gia_Man_t *p, int nFrames, int nFanMax, int fVerbose)
 
Gia_Man_tGia_ManRemoveEnables (Gia_Man_t *p)
 
void Gia_ManEquivFixOutputPairs (Gia_Man_t *p)
 
int Gia_ManCheckTopoOrder (Gia_Man_t *p)
 
int * Gia_ManDeriveNexts (Gia_Man_t *p)
 
void Gia_ManDeriveReprs (Gia_Man_t *p)
 
int Gia_ManEquivCountLits (Gia_Man_t *p)
 
int Gia_ManEquivCountLitsAll (Gia_Man_t *p)
 
int Gia_ManEquivCountClasses (Gia_Man_t *p)
 
void Gia_ManEquivPrintOne (Gia_Man_t *p, int i, int Counter)
 
void Gia_ManEquivPrintClasses (Gia_Man_t *p, int fVerbose, float Mem)
 
Gia_Man_tGia_ManEquivReduce (Gia_Man_t *p, int fUseAll, int fDualOut, int fSkipPhase, int fVerbose)
 
Gia_Man_tGia_ManEquivReduceAndRemap (Gia_Man_t *p, int fSeq, int fMiterPairs)
 
int Gia_ManEquivSetColors (Gia_Man_t *p, int fVerbose)
 
Gia_Man_tGia_ManSpecReduce (Gia_Man_t *p, int fDualOut, int fSynthesis, int fReduce, int fSkipSome, int fVerbose)
 
Gia_Man_tGia_ManSpecReduceInit (Gia_Man_t *p, Abc_Cex_t *pInit, int nFrames, int fDualOut)
 
Gia_Man_tGia_ManSpecReduceInitFrames (Gia_Man_t *p, Abc_Cex_t *pInit, int nFramesMax, int *pnFrames, int fDualOut, int nMinOutputs)
 
void Gia_ManEquivTransform (Gia_Man_t *p, int fVerbose)
 
void Gia_ManEquivImprove (Gia_Man_t *p)
 
Gia_Man_tGia_ManEquivToChoices (Gia_Man_t *p, int nSnapshots)
 
int Gia_ManCountChoiceNodes (Gia_Man_t *p)
 
int Gia_ManCountChoices (Gia_Man_t *p)
 
int Gia_ManFilterEquivsForSpeculation (Gia_Man_t *pGia, char *pName1, char *pName2, int fLatchA, int fLatchB)
 
int Gia_ManFilterEquivsUsingParts (Gia_Man_t *pGia, char *pName1, char *pName2)
 
void Gia_ManFilterEquivsUsingLatches (Gia_Man_t *pGia, int fFlopsOnly, int fFlopsWith, int fUseRiDrivers)
 
void Gia_ObjRemoveFanout (Gia_Man_t *p, Gia_Obj_t *pObj, Gia_Obj_t *pFanout)
 
void Gia_ManFanoutStart (Gia_Man_t *p)
 FUNCTION DEFINITIONS ///. More...
 
void Gia_ManFanoutStop (Gia_Man_t *p)
 
void Gia_ManStaticFanoutStart (Gia_Man_t *p)
 
void Gia_ManStaticFanoutStop (Gia_Man_t *p)
 
void For_ManExperiment (Gia_Man_t *pGia, int nIters, int fClustered, int fVerbose)
 
Gia_Man_tGia_ManUnrollDup (Gia_Man_t *p, Vec_Int_t *vLimit)
 
Vec_Ptr_tGia_ManUnrollAbs (Gia_Man_t *p, int nFrames)
 
void * Gia_ManUnrollStart (Gia_Man_t *pAig, Gia_ParFra_t *pPars)
 
void * Gia_ManUnrollAdd (void *pMan, int fMax)
 
void Gia_ManUnrollStop (void *pMan)
 
int Gia_ManUnrollLastLit (void *pMan)
 
void Gia_ManFraSetDefaultParams (Gia_ParFra_t *p)
 
Gia_Man_tGia_ManFrames (Gia_Man_t *pAig, Gia_ParFra_t *pPars)
 
Gia_Man_tGia_ManFramesInitSpecial (Gia_Man_t *pAig, int nFrames, int fVerbose)
 
Gia_Man_tGia_ManFront (Gia_Man_t *p)
 
void Gia_ManFrontTest (Gia_Man_t *p)
 
Gia_Man_tGia_ManPerformFx (Gia_Man_t *p, int nNewNodesMax, int LitCountMax, int fReverse, int fVerbose, int fVeryVerbose)
 
void Gia_ManHashAlloc (Gia_Man_t *p)
 
void Gia_ManHashStart (Gia_Man_t *p)
 
void Gia_ManHashStop (Gia_Man_t *p)
 
int Gia_ManHashXorReal (Gia_Man_t *p, int iLit0, int iLit1)
 
int Gia_ManHashMuxReal (Gia_Man_t *p, int iLitC, int iLit1, int iLit0)
 
int Gia_ManHashAnd (Gia_Man_t *p, int iLit0, int iLit1)
 
int Gia_ManHashOr (Gia_Man_t *p, int iLit0, int iLit1)
 
int Gia_ManHashXor (Gia_Man_t *p, int iLit0, int iLit1)
 
int Gia_ManHashMux (Gia_Man_t *p, int iCtrl, int iData1, int iData0)
 
int Gia_ManHashMaj (Gia_Man_t *p, int iData0, int iData1, int iData2)
 
int Gia_ManHashAndTry (Gia_Man_t *p, int iLit0, int iLit1)
 
Gia_Man_tGia_ManRehash (Gia_Man_t *p, int fAddStrash)
 
void Gia_ManHashProfile (Gia_Man_t *p)
 
int Gia_ManHashLookup (Gia_Man_t *p, Gia_Obj_t *p0, Gia_Obj_t *p1)
 
int Gia_ManHashAndMulti (Gia_Man_t *p, Vec_Int_t *vLits)
 
void Gia_ManPrintMappingStats (Gia_Man_t *p, char *pDumpFile)
 
void Gia_ManPrintPackingStats (Gia_Man_t *p)
 
void Gia_ManPrintLutStats (Gia_Man_t *p)
 
int Gia_ManLutFaninCount (Gia_Man_t *p)
 
int Gia_ManLutSizeMax (Gia_Man_t *p)
 
int Gia_ManLutNum (Gia_Man_t *p)
 
int Gia_ManLutLevel (Gia_Man_t *p)
 
void Gia_ManLutParams (Gia_Man_t *p, int *pnCurLuts, int *pnCurEdges, int *pnCurLevels)
 
void Gia_ManSetRefsMapped (Gia_Man_t *p)
 
void Gia_ManSetIfParsDefault (void *pIfPars)
 FUNCTION DEFINITIONS ///. More...
 
void Gia_ManMappingVerify (Gia_Man_t *p)
 
void Gia_ManTransferMapping (Gia_Man_t *p, Gia_Man_t *pGia)
 
void Gia_ManTransferPacking (Gia_Man_t *p, Gia_Man_t *pGia)
 
void Gia_ManTransferTiming (Gia_Man_t *p, Gia_Man_t *pGia)
 
Gia_Man_tGia_ManPerformMapping (Gia_Man_t *p, void *pIfPars)
 
Gia_Man_tGia_ManPerformSopBalance (Gia_Man_t *p, int nCutNum, int nRelaxRatio, int fVerbose)
 
Gia_Man_tGia_ManPerformDsdBalance (Gia_Man_t *p, int nLutSize, int nCutNum, int nRelaxRatio, int fVerbose)
 
void Jf_ManSetDefaultPars (Jf_Par_t *pPars)
 
Gia_Man_tJf_ManPerformMapping (Gia_Man_t *pGia, Jf_Par_t *pPars)
 
Gia_Man_tJf_ManDeriveCnf (Gia_Man_t *p, int fCnfObjIds)
 
Gia_Man_tGia_ManIsoCanonicize (Gia_Man_t *p, int fVerbose)
 
Gia_Man_tGia_ManIsoReduce (Gia_Man_t *p, Vec_Ptr_t **pvPosEquivs, Vec_Ptr_t **pvPiPerms, int fEstimate, int fDualOut, int fVerbose, int fVeryVerbose)
 
Gia_Man_tGia_ManIsoReduce2 (Gia_Man_t *p, Vec_Ptr_t **pvPosEquivs, Vec_Ptr_t **pvPiPerms, int fEstimate, int fBetterQual, int fDualOut, int fVerbose, int fVeryVerbose)
 
void Lf_ManSetDefaultPars (Jf_Par_t *pPars)
 
Gia_Man_tLf_ManPerformMapping (Gia_Man_t *pGia, Jf_Par_t *pPars)
 
Gia_Man_tGia_ManPerformLfMapping (Gia_Man_t *p, Jf_Par_t *pPars, int fNormalized)
 
void Gia_ManTestDistance (Gia_Man_t *p)
 
void Gia_ManSolveProblem (Gia_Man_t *pGia, Emb_Par_t *pPars)
 
Gia_Man_tGia_ManStart (int nObjsMax)
 DECLARATIONS ///. More...
 
void Gia_ManStop (Gia_Man_t *p)
 
void Gia_ManStopP (Gia_Man_t **p)
 
double Gia_ManMemory (Gia_Man_t *p)
 
void Gia_ManPrintStats (Gia_Man_t *p, Gps_Par_t *pPars)
 
void Gia_ManPrintStatsShort (Gia_Man_t *p)
 
void Gia_ManPrintMiterStatus (Gia_Man_t *p)
 
void Gia_ManPrintStatsMiter (Gia_Man_t *p, int fVerbose)
 
void Gia_ManSetRegNum (Gia_Man_t *p, int nRegs)
 
void Gia_ManReportImprovement (Gia_Man_t *p, Gia_Man_t *pNew)
 
void Gia_ManPrintNpnClasses (Gia_Man_t *p)
 
Gia_MmFixed_tGia_MmFixedStart (int nEntrySize, int nEntriesMax)
 FUNCTION DEFINITIONS ///. More...
 
void Gia_MmFixedStop (Gia_MmFixed_t *p, int fVerbose)
 
char * Gia_MmFixedEntryFetch (Gia_MmFixed_t *p)
 
void Gia_MmFixedEntryRecycle (Gia_MmFixed_t *p, char *pEntry)
 
void Gia_MmFixedRestart (Gia_MmFixed_t *p)
 
int Gia_MmFixedReadMemUsage (Gia_MmFixed_t *p)
 
int Gia_MmFixedReadMaxEntriesUsed (Gia_MmFixed_t *p)
 
Gia_MmFlex_tGia_MmFlexStart ()
 
void Gia_MmFlexStop (Gia_MmFlex_t *p, int fVerbose)
 
char * Gia_MmFlexEntryFetch (Gia_MmFlex_t *p, int nBytes)
 
void Gia_MmFlexRestart (Gia_MmFlex_t *p)
 
int Gia_MmFlexReadMemUsage (Gia_MmFlex_t *p)
 
Gia_MmStep_tGia_MmStepStart (int nSteps)
 
void Gia_MmStepStop (Gia_MmStep_t *p, int fVerbose)
 
char * Gia_MmStepEntryFetch (Gia_MmStep_t *p, int nBytes)
 
void Gia_MmStepEntryRecycle (Gia_MmStep_t *p, char *pEntry, int nBytes)
 
int Gia_MmStepReadMemUsage (Gia_MmStep_t *p)
 
void Mf_ManSetDefaultPars (Jf_Par_t *pPars)
 
Gia_Man_tMf_ManPerformMapping (Gia_Man_t *pGia, Jf_Par_t *pPars)
 
Gia_Man_tGia_ManReadMiniAig (char *pFileName)
 
void Gia_ManWriteMiniAig (Gia_Man_t *pGia, char *pFileName)
 
void Gia_ManCountMuxXor (Gia_Man_t *p, int *pnMuxes, int *pnXors)
 DECLARATIONS ///. More...
 
void Gia_ManPrintMuxStats (Gia_Man_t *p)
 
Gia_Man_tGia_ManDupMuxes (Gia_Man_t *p, int Limit)
 
Gia_Man_tGia_ManDupNoMuxes (Gia_Man_t *p)
 
void Gia_SatVerifyPattern (Gia_Man_t *p, Gia_Obj_t *pRoot, Vec_Int_t *vCex, Vec_Int_t *vVisit)
 
Gia_Man_tGia_ManRetimeForward (Gia_Man_t *p, int nMaxIters, int fVerbose)
 
int Sat_ManTest (Gia_Man_t *pGia, Gia_Obj_t *pObj, int nConfsMax)
 
int Gia_ManSeqMarkUsed (Gia_Man_t *p)
 
int Gia_ManCombMarkUsed (Gia_Man_t *p)
 
Gia_Man_tGia_ManCleanup (Gia_Man_t *p)
 
Gia_Man_tGia_ManCleanupOutputs (Gia_Man_t *p, int nOutputs)
 
Gia_Man_tGia_ManSeqCleanup (Gia_Man_t *p)
 
Gia_Man_tGia_ManSeqStructSweep (Gia_Man_t *p, int fConst, int fEquiv, int fVerbose)
 
Gia_Man_tGia_ManMapShrink4 (Gia_Man_t *p, int fKeepLevel, int fVerbose)
 FUNCTION DEFINITIONS ///. More...
 
Gia_Man_tGia_ManMapShrink6 (Gia_Man_t *p, int nFanoutMax, int fKeepLevel, int fVerbose)
 
Gia_Man_tGia_ManExtractWindow (Gia_Man_t *p, int LevelMax, int nTimeWindow, int fVerbose)
 
Gia_Man_tGia_ManPerformSopBalanceWin (Gia_Man_t *p, int LevelMax, int nTimeWindow, int nCutNum, int nRelaxRatio, int fVerbose)
 
Gia_Man_tGia_ManPerformDsdBalanceWin (Gia_Man_t *p, int LevelMax, int nTimeWindow, int nLutSize, int nCutNum, int nRelaxRatio, int fVerbose)
 
int * Gia_SortFloats (float *pArray, int *pPerm, int nSize)
 
void Gia_ManSimSetDefaultParams (Gia_ParSim_t *p)
 
int Gia_ManSimSimulate (Gia_Man_t *pAig, Gia_ParSim_t *pPars)
 
unsigned * Gia_SimDataExt (Gia_ManSim_t *p, int i)
 
unsigned * Gia_SimDataCiExt (Gia_ManSim_t *p, int i)
 
unsigned * Gia_SimDataCoExt (Gia_ManSim_t *p, int i)
 
void Gia_ManSimInfoInit (Gia_ManSim_t *p)
 
void Gia_ManSimInfoTransfer (Gia_ManSim_t *p)
 
void Gia_ManSimulateRound (Gia_ManSim_t *p)
 
float Gia_ManDelayTraceLut (Gia_Man_t *p)
 
float Gia_ManDelayTraceLutPrint (Gia_Man_t *p, int fVerbose)
 
Gia_Man_tGia_ManSpeedup (Gia_Man_t *p, int Percentage, int Degree, int fVerbose, int fVeryVerbose)
 
void Gia_ManStgPrint (FILE *pFile, Vec_Int_t *vLines, int nIns, int nOuts, int nStates)
 
Gia_Man_tGia_ManStgRead (char *pFileName, int kHot, int fVerbose)
 
Gia_Man_tGia_ManFraigSweepSimple (Gia_Man_t *p, void *pPars)
 
Gia_Man_tGia_ManSweepWithBoxes (Gia_Man_t *p, void *pParsC, void *pParsS, int fConst, int fEquiv, int fVerbose)
 
void Gia_ManCheckIntegrityWithBoxes (Gia_Man_t *p)
 
Gia_Man_tGia_SweeperStart (Gia_Man_t *p)
 
void Gia_SweeperStop (Gia_Man_t *p)
 
int Gia_SweeperIsRunning (Gia_Man_t *p)
 
void Gia_SweeperPrintStats (Gia_Man_t *p)
 
void Gia_SweeperSetConflictLimit (Gia_Man_t *p, int nConfMax)
 
void Gia_SweeperSetRuntimeLimit (Gia_Man_t *p, int nSeconds)
 
Vec_Int_tGia_SweeperGetCex (Gia_Man_t *p)
 
int Gia_SweeperProbeCreate (Gia_Man_t *p, int iLit)
 
int Gia_SweeperProbeDelete (Gia_Man_t *p, int ProbeId)
 
int Gia_SweeperProbeUpdate (Gia_Man_t *p, int ProbeId, int iLitNew)
 
int Gia_SweeperProbeLit (Gia_Man_t *p, int ProbeId)
 
Vec_Int_tGia_SweeperCollectValidProbeIds (Gia_Man_t *p)
 
int Gia_SweeperCondPop (Gia_Man_t *p)
 
void Gia_SweeperCondPush (Gia_Man_t *p, int ProbeId)
 
Vec_Int_tGia_SweeperCondVector (Gia_Man_t *p)
 
int Gia_SweeperCondCheckUnsat (Gia_Man_t *p)
 
int Gia_SweeperCheckEquiv (Gia_Man_t *p, int ProbeId1, int ProbeId2)
 
Gia_Man_tGia_SweeperExtractUserLogic (Gia_Man_t *p, Vec_Int_t *vProbeIds, Vec_Ptr_t *vInNames, Vec_Ptr_t *vOutNames)
 
void Gia_SweeperLogicDump (Gia_Man_t *p, Vec_Int_t *vProbeIds, int fDumpConds, char *pFileName)
 
Gia_Man_tGia_SweeperCleanup (Gia_Man_t *p, char *pCommLime)
 
Vec_Int_tGia_SweeperGraft (Gia_Man_t *pDst, Vec_Int_t *vProbes, Gia_Man_t *pSrc)
 
int Gia_SweeperFraig (Gia_Man_t *p, Vec_Int_t *vProbeIds, char *pCommLime, int nWords, int nConfs, int fVerify, int fVerbose)
 
int Gia_SweeperRun (Gia_Man_t *p, Vec_Int_t *vProbeIds, char *pCommLime, int fVerbose)
 
float Gia_ManEvaluateSwitching (Gia_Man_t *p)
 
float Gia_ManComputeSwitching (Gia_Man_t *p, int nFrames, int nPref, int fProbOne)
 
Vec_Int_tGia_ManComputeSwitchProbs (Gia_Man_t *pGia, int nFrames, int nPref, int fProbOne)
 
Vec_Flt_tGia_ManPrintOutputProb (Gia_Man_t *p)
 
int Gia_ManBoxNum (Gia_Man_t *p)
 DECLARATIONS ///. More...
 
int Gia_ManRegBoxNum (Gia_Man_t *p)
 
int Gia_ManNonRegBoxNum (Gia_Man_t *p)
 
int Gia_ManBoxCiNum (Gia_Man_t *p)
 
int Gia_ManBoxCoNum (Gia_Man_t *p)
 
int Gia_ManClockDomainNum (Gia_Man_t *p)
 
int Gia_ManIsSeqWithBoxes (Gia_Man_t *p)
 
int Gia_ManIsNormalized (Gia_Man_t *p)
 
Gia_Man_tGia_ManDupNormalize (Gia_Man_t *p)
 
Gia_Man_tGia_ManDupUnnormalize (Gia_Man_t *p)
 
Gia_Man_tGia_ManDupUnshuffleInputs (Gia_Man_t *p)
 
int Gia_ManLevelWithBoxes (Gia_Man_t *p)
 
int Gia_ManLutLevelWithBoxes (Gia_Man_t *p)
 
void * Gia_ManUpdateTimMan (Gia_Man_t *p, Vec_Int_t *vBoxPres)
 
void * Gia_ManUpdateTimMan2 (Gia_Man_t *p, Vec_Int_t *vBoxesLeft, int nTermsDiff)
 
Gia_Man_tGia_ManUpdateExtraAig (void *pTime, Gia_Man_t *pAig, Vec_Int_t *vBoxPres)
 
Gia_Man_tGia_ManUpdateExtraAig2 (void *pTime, Gia_Man_t *pAig, Vec_Int_t *vBoxesLeft)
 
Gia_Man_tGia_ManDupCollapse (Gia_Man_t *p, Gia_Man_t *pBoxes, Vec_Int_t *vBoxPres, int fSeq)
 
int Gia_ManVerifyWithBoxes (Gia_Man_t *pGia, int nBTLimit, int nTimeLim, int fSeq, int fVerbose, char *pFileSpec)
 
word Gia_ObjComputeTruthTable6Lut (Gia_Man_t *p, int iObj, Vec_Wrd_t *vTemp)
 
word Gia_ObjComputeTruthTable6 (Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vSupp, Vec_Wrd_t *vTruths)
 
void Gia_ObjCollectInternal (Gia_Man_t *p, Gia_Obj_t *pObj)
 
wordGia_ObjComputeTruthTable (Gia_Man_t *p, Gia_Obj_t *pObj)
 
void Gia_ObjComputeTruthTableStart (Gia_Man_t *p, int nVarsMax)
 
void Gia_ObjComputeTruthTableStop (Gia_Man_t *p)
 
wordGia_ObjComputeTruthTableCut (Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vLeaves)
 
Gia_Man_tGia_ManReduceConst (Gia_Man_t *pAig, int fVerbose)
 
unsigned Gia_ManRandom (int fReset)
 FUNCTION DEFINITIONS ///. More...
 
word Gia_ManRandomW (int fReset)
 
void Gia_ManRandomInfo (Vec_Ptr_t *vInfo, int iInputStart, int iWordStart, int iWordStop)
 
char * Gia_TimeStamp ()
 
char * Gia_FileNameGenericAppend (char *pBase, char *pSuffix)
 
void Gia_ManIncrementTravId (Gia_Man_t *p)
 
void Gia_ManCleanMark01 (Gia_Man_t *p)
 
void Gia_ManSetMark0 (Gia_Man_t *p)
 
void Gia_ManCleanMark0 (Gia_Man_t *p)
 
void Gia_ManCheckMark0 (Gia_Man_t *p)
 
void Gia_ManSetMark1 (Gia_Man_t *p)
 
void Gia_ManCleanMark1 (Gia_Man_t *p)
 
void Gia_ManCheckMark1 (Gia_Man_t *p)
 
void Gia_ManCleanValue (Gia_Man_t *p)
 
void Gia_ManCleanLevels (Gia_Man_t *p, int Size)
 
void Gia_ManCleanTruth (Gia_Man_t *p)
 
void Gia_ManFillValue (Gia_Man_t *p)
 
void Gia_ObjSetPhase (Gia_Man_t *p, Gia_Obj_t *pObj)
 
void Gia_ManSetPhase (Gia_Man_t *p)
 
void Gia_ManSetPhasePattern (Gia_Man_t *p, Vec_Int_t *vCiValues)
 
void Gia_ManSetPhase1 (Gia_Man_t *p)
 
void Gia_ManCleanPhase (Gia_Man_t *p)
 
int Gia_ManCheckCoPhase (Gia_Man_t *p)
 
int Gia_ManLevelNum (Gia_Man_t *p)
 
Vec_Int_tGia_ManGetCiLevels (Gia_Man_t *p)
 
int Gia_ManSetLevels (Gia_Man_t *p, Vec_Int_t *vCiLevels)
 
Vec_Int_tGia_ManReverseLevel (Gia_Man_t *p)
 
Vec_Int_tGia_ManRequiredLevel (Gia_Man_t *p)
 
void Gia_ManCreateValueRefs (Gia_Man_t *p)
 
void Gia_ManCreateRefs (Gia_Man_t *p)
 
int * Gia_ManCreateMuxRefs (Gia_Man_t *p)
 
int Gia_ManCrossCut (Gia_Man_t *p, int fReverse)
 
Vec_Int_tGia_ManCollectPoIds (Gia_Man_t *p)
 
int Gia_ObjIsMuxType (Gia_Obj_t *pNode)
 
int Gia_ObjRecognizeExor (Gia_Obj_t *pObj, Gia_Obj_t **ppFan0, Gia_Obj_t **ppFan1)
 
Gia_Obj_tGia_ObjRecognizeMux (Gia_Obj_t *pNode, Gia_Obj_t **ppNodeT, Gia_Obj_t **ppNodeE)
 
int Gia_ObjRecognizeMuxLits (Gia_Man_t *p, Gia_Obj_t *pNode, int *iLitT, int *iLitE)
 
int Gia_NodeMffcSize (Gia_Man_t *p, Gia_Obj_t *pNode)
 
int Gia_ManHasDangling (Gia_Man_t *p)
 
int Gia_ManMarkDangling (Gia_Man_t *p)
 
Vec_Int_tGia_ManGetDangling (Gia_Man_t *p)
 
void Gia_ObjPrint (Gia_Man_t *p, Gia_Obj_t *pObj)
 
void Gia_ManPrint (Gia_Man_t *p)
 
void Gia_ManPrintCo (Gia_Man_t *p, Gia_Obj_t *pObj)
 
void Gia_ManPrintCone (Gia_Man_t *p, Gia_Obj_t *pObj, int *pLeaves, int nLeaves, Vec_Int_t *vNodes)
 
void Gia_ManPrintCone2 (Gia_Man_t *p, Gia_Obj_t *pObj)
 
void Gia_ManInvertConstraints (Gia_Man_t *pAig)
 
void Gia_ManInvertPos (Gia_Man_t *pAig)
 
int Gia_ManCompare (Gia_Man_t *p1, Gia_Man_t *p2)
 
void Gia_ManMarkFanoutDrivers (Gia_Man_t *p)
 
void Gia_ManSwapPos (Gia_Man_t *p, int i)
 
Vec_Int_tGia_ManSaveValue (Gia_Man_t *p)
 
void Gia_ManLoadValue (Gia_Man_t *p, Vec_Int_t *vValues)
 
Vec_Int_tGia_ManFirstFanouts (Gia_Man_t *p)
 
Tas_Man_tTas_ManAlloc (Gia_Man_t *pAig, int nBTLimit)
 
void Tas_ManStop (Tas_Man_t *p)
 
Vec_Int_tTas_ReadModel (Tas_Man_t *p)
 
void Tas_ManSatPrintStats (Tas_Man_t *p)
 
int Tas_ManSolve (Tas_Man_t *p, Gia_Obj_t *pObj, Gia_Obj_t *pObj2)
 
int Tas_ManSolveArray (Tas_Man_t *p, Vec_Ptr_t *vObjs)
 

Macro Definition Documentation

#define Gia_CellForEachFanin (   p,
  i,
  iFanLit,
 
)    for ( k = 0; k < Gia_ObjCellSize(p,i) && ((iFanLit = Gia_ObjCellFanins(p,i)[k]),1); k++ )

Definition at line 977 of file gia.h.

#define Gia_ClassForEachObj (   p,
  i,
  iObj 
)    for ( assert(Gia_ObjIsHead(p, i)), iObj = i; iObj; iObj = Gia_ObjNext(p, iObj) )

Definition at line 931 of file gia.h.

#define Gia_ClassForEachObj1 (   p,
  i,
  iObj 
)    for ( assert(Gia_ObjIsHead(p, i)), iObj = Gia_ObjNext(p, i); iObj; iObj = Gia_ObjNext(p, iObj) )

Definition at line 933 of file gia.h.

#define Gia_LutForEachFanin (   p,
  i,
  iFan,
 
)    for ( k = 0; k < Gia_ObjLutSize(p,i) && ((iFan = Gia_ObjLutFanins(p,i)[k]),1); k++ )

Definition at line 970 of file gia.h.

#define Gia_LutForEachFaninObj (   p,
  i,
  pFanin,
 
)    for ( k = 0; k < Gia_ObjLutSize(p,i) && ((pFanin = Gia_ManObj(p, Gia_ObjLutFanins(p,i)[k])),1); k++ )

Definition at line 972 of file gia.h.

#define Gia_ManForEachAnd (   p,
  pObj,
 
)    for ( i = 0; (i < p->nObjs) && ((pObj) = Gia_ManObj(p, i)); i++ ) if ( !Gia_ObjIsAnd(pObj) ) {} else

Definition at line 1002 of file gia.h.

#define Gia_ManForEachAndId (   p,
 
)    for ( i = 0; (i < p->nObjs); i++ ) if ( !Gia_ObjIsAnd(Gia_ManObj(p, i)) ) {} else

Definition at line 1004 of file gia.h.

#define Gia_ManForEachAndReverse (   p,
  pObj,
 
)    for ( i = p->nObjs - 1; (i > 0) && ((pObj) = Gia_ManObj(p, i)); i-- ) if ( !Gia_ObjIsAnd(pObj) ) {} else

Definition at line 1010 of file gia.h.

#define Gia_ManForEachAndReverseId (   p,
 
)    for ( i = p->nObjs - 1; (i > 0); i-- ) if ( !Gia_ObjIsAnd(Gia_ManObj(p, i)) ) {} else

Definition at line 1012 of file gia.h.

#define Gia_ManForEachBuf (   p,
  pObj,
 
)    for ( i = Gia_ManBufNum(p) ? 0 : p->nObjs; (i < p->nObjs) && ((pObj) = Gia_ManObj(p, i)); i++ ) if ( !Gia_ObjIsBuf(pObj) ) {} else

Definition at line 998 of file gia.h.

#define Gia_ManForEachBufId (   p,
 
)    for ( i = 0; (i < p->nObjs); i++ ) if ( !Gia_ObjIsBuf(Gia_ManObj(p, i)) ) {} else

Definition at line 1000 of file gia.h.

#define Gia_ManForEachCand (   p,
  pObj,
 
)    for ( i = 0; (i < p->nObjs) && ((pObj) = Gia_ManObj(p, i)); i++ ) if ( !Gia_ObjIsCand(pObj) ) {} else

Definition at line 1008 of file gia.h.

#define Gia_ManForEachCell (   p,
 
)    for ( i = 2; i < 2*Gia_ManObjNum(p); i++ ) if ( !Gia_ObjIsCell(p, i) ) {} else

Definition at line 975 of file gia.h.

#define Gia_ManForEachCi (   p,
  pObj,
 
)    for ( i = 0; (i < Vec_IntSize(p->vCis)) && ((pObj) = Gia_ManCi(p, i)); i++ )

Definition at line 1016 of file gia.h.

#define Gia_ManForEachCiId (   p,
  Id,
 
)    for ( i = 0; (i < Vec_IntSize(p->vCis)) && ((Id) = Gia_ObjId(p, Gia_ManCi(p, i))); i++ )

Definition at line 1018 of file gia.h.

#define Gia_ManForEachCiReverse (   p,
  pObj,
 
)    for ( i = Vec_IntSize(p->vCis) - 1; (i >= 0) && ((pObj) = Gia_ManCi(p, i)); i-- )

Definition at line 1020 of file gia.h.

#define Gia_ManForEachClass (   p,
 
)    for ( i = 1; i < Gia_ManObjNum(p); i++ ) if ( !Gia_ObjIsHead(p, i) ) {} else

Definition at line 927 of file gia.h.

#define Gia_ManForEachClassReverse (   p,
 
)    for ( i = Gia_ManObjNum(p) - 1; i > 0; i-- ) if ( !Gia_ObjIsHead(p, i) ) {} else

Definition at line 929 of file gia.h.

#define Gia_ManForEachCo (   p,
  pObj,
 
)    for ( i = 0; (i < Vec_IntSize(p->vCos)) && ((pObj) = Gia_ManCo(p, i)); i++ )

Definition at line 1022 of file gia.h.

#define Gia_ManForEachCoDriver (   p,
  pObj,
 
)    for ( i = 0; (i < Vec_IntSize(p->vCos)) && ((pObj) = Gia_ObjFanin0(Gia_ManCo(p, i))); i++ )

Definition at line 1030 of file gia.h.

#define Gia_ManForEachCoDriverId (   p,
  DriverId,
 
)    for ( i = 0; (i < Vec_IntSize(p->vCos)) && (((DriverId) = Gia_ObjFaninId0p(p, Gia_ManCo(p, i))), 1); i++ )

Definition at line 1032 of file gia.h.

#define Gia_ManForEachCoId (   p,
  Id,
 
)    for ( i = 0; (i < Vec_IntSize(p->vCos)) && ((Id) = Gia_ObjId(p, Gia_ManCo(p, i))); i++ )

Definition at line 1026 of file gia.h.

#define Gia_ManForEachConst (   p,
 
)    for ( i = 1; i < Gia_ManObjNum(p); i++ ) if ( !Gia_ObjIsConst(p, i) ) {} else

Definition at line 925 of file gia.h.

#define Gia_ManForEachCoReverse (   p,
  pObj,
 
)    for ( i = Vec_IntSize(p->vCos) - 1; (i >= 0) && ((pObj) = Gia_ManCo(p, i)); i-- )

Definition at line 1028 of file gia.h.

#define Gia_ManForEachCoVec (   vVec,
  p,
  pObj,
 
)    for ( i = 0; (i < Vec_IntSize(vVec)) && ((pObj) = Gia_ManCo(p, Vec_IntEntry(vVec,i))); i++ )

Definition at line 1024 of file gia.h.

#define Gia_ManForEachLut (   p,
 
)    for ( i = 1; i < Gia_ManObjNum(p); i++ ) if ( !Gia_ObjIsLut(p, i) ) {} else

Definition at line 968 of file gia.h.

#define Gia_ManForEachMux (   p,
  pObj,
 
)    for ( i = 0; (i < p->nObjs) && ((pObj) = Gia_ManObj(p, i)); i++ ) if ( !Gia_ObjIsMuxId(p, i) ) {} else

Definition at line 1014 of file gia.h.

#define Gia_ManForEachMuxId (   p,
 
)    for ( i = 0; (i < p->nObjs); i++ ) if ( !Gia_ObjIsMuxId(p, i) ) {} else

Definition at line 1006 of file gia.h.

#define Gia_ManForEachObj (   p,
  pObj,
 
)    for ( i = 0; (i < p->nObjs) && ((pObj) = Gia_ManObj(p, i)); i++ )

MACRO DEFINITIONS ///.

Definition at line 984 of file gia.h.

#define Gia_ManForEachObj1 (   p,
  pObj,
 
)    for ( i = 1; (i < p->nObjs) && ((pObj) = Gia_ManObj(p, i)); i++ )

Definition at line 986 of file gia.h.

#define Gia_ManForEachObjReverse (   p,
  pObj,
 
)    for ( i = p->nObjs - 1; (i >= 0) && ((pObj) = Gia_ManObj(p, i)); i-- )

Definition at line 994 of file gia.h.

#define Gia_ManForEachObjReverse1 (   p,
  pObj,
 
)    for ( i = p->nObjs - 1; (i > 0) && ((pObj) = Gia_ManObj(p, i)); i-- )

Definition at line 996 of file gia.h.

#define Gia_ManForEachObjVec (   vVec,
  p,
  pObj,
 
)    for ( i = 0; (i < Vec_IntSize(vVec)) && ((pObj) = Gia_ManObj(p, Vec_IntEntry(vVec,i))); i++ )

Definition at line 988 of file gia.h.

#define Gia_ManForEachObjVecLit (   vVec,
  p,
  pObj,
  fCompl,
 
)    for ( i = 0; (i < Vec_IntSize(vVec)) && ((pObj) = Gia_ManObj(p, Abc_Lit2Var(Vec_IntEntry(vVec,i)))) && (((fCompl) = Abc_LitIsCompl(Vec_IntEntry(vVec,i))),1); i++ )

Definition at line 992 of file gia.h.

#define Gia_ManForEachObjVecReverse (   vVec,
  p,
  pObj,
 
)    for ( i = Vec_IntSize(vVec) - 1; (i >= 0) && ((pObj) = Gia_ManObj(p, Vec_IntEntry(vVec,i))); i-- )

Definition at line 990 of file gia.h.

#define Gia_ManForEachPi (   p,
  pObj,
 
)    for ( i = 0; (i < Gia_ManPiNum(p)) && ((pObj) = Gia_ManCi(p, i)); i++ )

Definition at line 1034 of file gia.h.

#define Gia_ManForEachPo (   p,
  pObj,
 
)    for ( i = 0; (i < Gia_ManPoNum(p)) && ((pObj) = Gia_ManCo(p, i)); i++ )

Definition at line 1036 of file gia.h.

#define Gia_ManForEachRi (   p,
  pObj,
 
)    for ( i = 0; (i < Gia_ManRegNum(p)) && ((pObj) = Gia_ManCo(p, Gia_ManPoNum(p)+i)); i++ )

Definition at line 1040 of file gia.h.

#define Gia_ManForEachRiRo (   p,
  pObjRi,
  pObjRo,
 
)    for ( i = 0; (i < Gia_ManRegNum(p)) && ((pObjRi) = Gia_ManCo(p, Gia_ManPoNum(p)+i)) && ((pObjRo) = Gia_ManCi(p, Gia_ManPiNum(p)+i)); i++ )

Definition at line 1042 of file gia.h.

#define Gia_ManForEachRo (   p,
  pObj,
 
)    for ( i = 0; (i < Gia_ManRegNum(p)) && ((pObj) = Gia_ManCi(p, Gia_ManPiNum(p)+i)); i++ )

Definition at line 1038 of file gia.h.

#define GIA_NONE   0x1FFFFFFF

INCLUDES ///.

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

FileName [gia.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Scalable AIG package.]

Synopsis [External declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

Id:
gia.h,v 1.00 2005/06/20 00:00:00 alanmi Exp

]PARAMETERS ///

Definition at line 44 of file gia.h.

#define Gia_ObjForEachFanoutStatic (   p,
  pObj,
  pFanout,
 
)    for ( i = 0; (i < Gia_ObjFanoutNum(p, pObj)) && (((pFanout) = Gia_ObjFanout(p, pObj, i)), 1); i++ )

Definition at line 946 of file gia.h.

#define Gia_ObjForEachFanoutStaticId (   p,
  Id,
  FanId,
 
)    for ( i = 0; (i < Gia_ObjFanoutNumId(p, Id)) && (((FanId) = Gia_ObjFanoutId(p, Id, i)), 1); i++ )

Definition at line 948 of file gia.h.

#define GIA_ONE   2

Definition at line 748 of file gia.h.

#define GIA_UND   3

Definition at line 749 of file gia.h.

#define GIA_VOID   0x0FFFFFFF

Definition at line 45 of file gia.h.

#define GIA_ZER   1

Definition at line 747 of file gia.h.

Typedef Documentation

typedef struct Emb_Par_t_ Emb_Par_t

Definition at line 208 of file gia.h.

typedef struct Gia_Man_t_ Gia_Man_t

Definition at line 94 of file gia.h.

typedef struct Gia_ManSim_t_ Gia_ManSim_t

Definition at line 250 of file gia.h.

typedef struct Gia_MmFixed_t_ Gia_MmFixed_t

BASIC TYPES ///.

Definition at line 51 of file gia.h.

typedef struct Gia_MmFlex_t_ Gia_MmFlex_t

Definition at line 52 of file gia.h.

typedef struct Gia_MmStep_t_ Gia_MmStep_t

Definition at line 53 of file gia.h.

typedef struct Gia_Obj_t_ Gia_Obj_t

Definition at line 74 of file gia.h.

typedef struct Gia_ParFra_t_ Gia_ParFra_t

Definition at line 224 of file gia.h.

typedef struct Gia_ParSim_t_ Gia_ParSim_t

Definition at line 237 of file gia.h.

typedef struct Gia_Plc_t_ Gia_Plc_t

Definition at line 65 of file gia.h.

typedef struct Gia_Rpr_t_ Gia_Rpr_t

Definition at line 55 of file gia.h.

typedef struct Gps_Par_t_ Gps_Par_t

Definition at line 194 of file gia.h.

typedef struct Jf_Par_t_ Jf_Par_t

Definition at line 264 of file gia.h.

typedef struct Tas_Man_t_ Tas_Man_t

Definition at line 1448 of file gia.h.

Function Documentation

Vec_Int_t* Cbs_ManSolveMiter ( Gia_Man_t pAig,
int  nConfs,
Vec_Str_t **  pvStatus,
int  fVerbose 
)

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

Synopsis [Procedure to test the new SAT solver.]

Description []

SideEffects []

SeeAlso []

Definition at line 708 of file giaCSatOld.c.

709 {
710  extern void Cec_ManSatAddToStore( Vec_Int_t * vCexStore, Vec_Int_t * vCex, int Out );
711  Cbs0_Man_t * p;
712  Vec_Int_t * vCex, * vVisit, * vCexStore;
713  Vec_Str_t * vStatus;
714  Gia_Obj_t * pRoot;
715  int i, status;
716  abctime clk, clkTotal = Abc_Clock();
717  assert( Gia_ManRegNum(pAig) == 0 );
718  // prepare AIG
719  Gia_ManCreateRefs( pAig );
720  Gia_ManCleanMark0( pAig );
721  Gia_ManCleanMark1( pAig );
722  // create logic network
723  p = Cbs0_ManAlloc();
724  p->Pars.nBTLimit = nConfs;
725  p->pAig = pAig;
726  // create resulting data-structures
727  vStatus = Vec_StrAlloc( Gia_ManPoNum(pAig) );
728  vCexStore = Vec_IntAlloc( 10000 );
729  vVisit = Vec_IntAlloc( 100 );
730  vCex = Cbs0_ReadModel( p );
731  // solve for each output
732  Gia_ManForEachCo( pAig, pRoot, i )
733  {
734  Vec_IntClear( vCex );
735  if ( Gia_ObjIsConst0(Gia_ObjFanin0(pRoot)) )
736  {
737  if ( Gia_ObjFaninC0(pRoot) )
738  {
739  printf( "Constant 1 output of SRM!!!\n" );
740  Cec_ManSatAddToStore( vCexStore, vCex, i ); // trivial counter-example
741  Vec_StrPush( vStatus, 0 );
742  }
743  else
744  {
745 // printf( "Constant 0 output of SRM!!!\n" );
746  Vec_StrPush( vStatus, 1 );
747  }
748  continue;
749  }
750  clk = Abc_Clock();
751  p->Pars.fUseHighest = 1;
752  p->Pars.fUseLowest = 0;
753  status = Cbs0_ManSolve( p, Gia_ObjChild0(pRoot) );
754 /*
755  if ( status == -1 )
756  {
757  p->Pars.fUseHighest = 0;
758  p->Pars.fUseLowest = 1;
759  status = Cbs0_ManSolve( p, Gia_ObjChild0(pRoot) );
760  }
761 */
762  Vec_StrPush( vStatus, (char)status );
763  if ( status == -1 )
764  {
765  p->nSatUndec++;
766  p->nConfUndec += p->Pars.nBTThis;
767  Cec_ManSatAddToStore( vCexStore, NULL, i ); // timeout
768  p->timeSatUndec += Abc_Clock() - clk;
769  continue;
770  }
771  if ( status == 1 )
772  {
773  p->nSatUnsat++;
774  p->nConfUnsat += p->Pars.nBTThis;
775  p->timeSatUnsat += Abc_Clock() - clk;
776  continue;
777  }
778  p->nSatSat++;
779  p->nConfSat += p->Pars.nBTThis;
780 // Gia_SatVerifyPattern( pAig, pRoot, vCex, vVisit );
781  Cec_ManSatAddToStore( vCexStore, vCex, i );
782  p->timeSatSat += Abc_Clock() - clk;
783  }
784  Vec_IntFree( vVisit );
785  p->nSatTotal = Gia_ManPoNum(pAig);
786  p->timeTotal = Abc_Clock() - clkTotal;
787  if ( fVerbose )
789  Cbs0_ManStop( p );
790  *pvStatus = vStatus;
791 // printf( "Total number of cex literals = %d. (Ave = %d)\n",
792 // Vec_IntSize(vCexStore)-2*p->nSatUndec-2*p->nSatSat,
793 // (Vec_IntSize(vCexStore)-2*p->nSatUndec-2*p->nSatSat)/p->nSatSat );
794  return vCexStore;
795 }
int nConfSat
Definition: giaCSatOld.c:73
void Gia_ManCreateRefs(Gia_Man_t *p)
Definition: giaUtil.c:715
static Gia_Obj_t * Gia_ObjChild0(Gia_Obj_t *pObj)
Definition: gia.h:457
int nSatUnsat
Definition: giaCSatOld.c:67
int nConfUnsat
Definition: giaCSatOld.c:72
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
abctime timeSatUndec
Definition: giaCSatOld.c:78
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
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
void Gia_ManCleanMark0(Gia_Man_t *p)
Definition: giaUtil.c:215
static int Gia_ObjIsConst0(Gia_Obj_t *pObj)
Definition: gia.h:430
void Cbs0_ManStop(Cbs0_Man_t *p)
Definition: giaCSatOld.c:154
abctime timeSatUnsat
Definition: giaCSatOld.c:76
static Vec_Str_t * Vec_StrAlloc(int nCap)
Definition: bblif.c:495
static abctime Abc_Clock()
Definition: abc_global.h:279
static void Vec_StrPush(Vec_Str_t *p, char Entry)
Definition: vecStr.h:535
Definition: gia.h:75
void Gia_ManCleanMark1(Gia_Man_t *p)
Definition: giaUtil.c:272
int nSatTotal
Definition: giaCSatOld.c:70
int Cbs0_ManSolve(Cbs0_Man_t *p, Gia_Obj_t *pObj)
Definition: giaCSatOld.c:646
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
int nSatUndec
Definition: giaCSatOld.c:69
int nConfUndec
Definition: giaCSatOld.c:74
void Cec_ManSatAddToStore(Vec_Int_t *vCexStore, Vec_Int_t *vCex, int Out)
Definition: cecSolve.c:952
Cbs0_Par_t Pars
Definition: giaCSatOld.c:61
Vec_Int_t * Cbs0_ReadModel(Cbs0_Man_t *p)
Definition: giaCSatOld.c:173
Cbs0_Man_t * Cbs0_ManAlloc()
Definition: giaCSatOld.c:131
abctime timeTotal
Definition: giaCSatOld.c:79
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Gia_Man_t * pAig
Definition: giaCSatOld.c:62
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
ABC_INT64_T abctime
Definition: abc_global.h:278
void Cbs0_ManSatPrintStats(Cbs0_Man_t *p)
Definition: giaCSatOld.c:678
abctime timeSatSat
Definition: giaCSatOld.c:77
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Vec_Int_t* Cbs_ManSolveMiterNc ( Gia_Man_t pAig,
int  nConfs,
Vec_Str_t **  pvStatus,
int  fVerbose 
)

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

Synopsis [Procedure to test the new SAT solver.]

Description []

SideEffects []

SeeAlso []

Definition at line 998 of file giaCSat.c.

999 {
1000  extern void Gia_ManCollectTest( Gia_Man_t * pAig );
1001  extern void Cec_ManSatAddToStore( Vec_Int_t * vCexStore, Vec_Int_t * vCex, int Out );
1002  Cbs_Man_t * p;
1003  Vec_Int_t * vCex, * vVisit, * vCexStore;
1004  Vec_Str_t * vStatus;
1005  Gia_Obj_t * pRoot;
1006  int i, status;
1007  abctime clk, clkTotal = Abc_Clock();
1008  assert( Gia_ManRegNum(pAig) == 0 );
1009 // Gia_ManCollectTest( pAig );
1010  // prepare AIG
1011  Gia_ManCreateRefs( pAig );
1012  Gia_ManCleanMark0( pAig );
1013  Gia_ManCleanMark1( pAig );
1014  Gia_ManFillValue( pAig ); // maps nodes into trail ids
1015  Gia_ManSetPhase( pAig ); // maps nodes into trail ids
1016  // create logic network
1017  p = Cbs_ManAlloc();
1018  p->Pars.nBTLimit = nConfs;
1019  p->pAig = pAig;
1020  // create resulting data-structures
1021  vStatus = Vec_StrAlloc( Gia_ManPoNum(pAig) );
1022  vCexStore = Vec_IntAlloc( 10000 );
1023  vVisit = Vec_IntAlloc( 100 );
1024  vCex = Cbs_ReadModel( p );
1025  // solve for each output
1026  Gia_ManForEachCo( pAig, pRoot, i )
1027  {
1028 // printf( "\n" );
1029 
1030  Vec_IntClear( vCex );
1031  if ( Gia_ObjIsConst0(Gia_ObjFanin0(pRoot)) )
1032  {
1033  if ( Gia_ObjFaninC0(pRoot) )
1034  {
1035 // printf( "Constant 1 output of SRM!!!\n" );
1036  Cec_ManSatAddToStore( vCexStore, vCex, i ); // trivial counter-example
1037  Vec_StrPush( vStatus, 0 );
1038  }
1039  else
1040  {
1041 // printf( "Constant 0 output of SRM!!!\n" );
1042  Vec_StrPush( vStatus, 1 );
1043  }
1044  continue;
1045  }
1046  clk = Abc_Clock();
1047  p->Pars.fUseHighest = 1;
1048  p->Pars.fUseLowest = 0;
1049  status = Cbs_ManSolve( p, Gia_ObjChild0(pRoot) );
1050 // printf( "\n" );
1051 /*
1052  if ( status == -1 )
1053  {
1054  p->Pars.fUseHighest = 0;
1055  p->Pars.fUseLowest = 1;
1056  status = Cbs_ManSolve( p, Gia_ObjChild0(pRoot) );
1057  }
1058 */
1059  Vec_StrPush( vStatus, (char)status );
1060  if ( status == -1 )
1061  {
1062  p->nSatUndec++;
1063  p->nConfUndec += p->Pars.nBTThis;
1064  Cec_ManSatAddToStore( vCexStore, NULL, i ); // timeout
1065  p->timeSatUndec += Abc_Clock() - clk;
1066  continue;
1067  }
1068  if ( status == 1 )
1069  {
1070  p->nSatUnsat++;
1071  p->nConfUnsat += p->Pars.nBTThis;
1072  p->timeSatUnsat += Abc_Clock() - clk;
1073  continue;
1074  }
1075  p->nSatSat++;
1076  p->nConfSat += p->Pars.nBTThis;
1077 // Gia_SatVerifyPattern( pAig, pRoot, vCex, vVisit );
1078  Cec_ManSatAddToStore( vCexStore, vCex, i );
1079  p->timeSatSat += Abc_Clock() - clk;
1080  }
1081  Vec_IntFree( vVisit );
1082  p->nSatTotal = Gia_ManPoNum(pAig);
1083  p->timeTotal = Abc_Clock() - clkTotal;
1084  if ( fVerbose )
1085  Cbs_ManSatPrintStats( p );
1086 // printf( "RecCalls = %8d. RecClause = %8d. RecNonChro = %8d.\n", p->nRecCall, p->nRecClause, p->nRecNonChro );
1087  Cbs_ManStop( p );
1088  *pvStatus = vStatus;
1089 
1090 // printf( "Total number of cex literals = %d. (Ave = %d)\n",
1091 // Vec_IntSize(vCexStore)-2*p->nSatUndec-2*p->nSatSat,
1092 // (Vec_IntSize(vCexStore)-2*p->nSatUndec-2*p->nSatSat)/p->nSatSat );
1093  return vCexStore;
1094 }
void Gia_ManCreateRefs(Gia_Man_t *p)
Definition: giaUtil.c:715
abctime timeTotal
Definition: giaCSat.c:87
static Gia_Obj_t * Gia_ObjChild0(Gia_Obj_t *pObj)
Definition: gia.h:457
int nConfSat
Definition: giaCSat.c:81
int nSatSat
Definition: giaCSat.c:76
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
int Cbs_ManSolve(Cbs_Man_t *p, Gia_Obj_t *pObj)
Definition: giaCSat.c:932
int nSatTotal
Definition: giaCSat.c:78
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Gia_Man_t * pAig
Definition: giaCSat.c:66
void Cbs_ManSatPrintStats(Cbs_Man_t *p)
Definition: giaCSat.c:968
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Cbs_Man_t * Cbs_ManAlloc()
Definition: giaCSat.c:149
Vec_Int_t * Cbs_ReadModel(Cbs_Man_t *p)
Definition: giaCSat.c:198
void Gia_ManCleanMark0(Gia_Man_t *p)
Definition: giaUtil.c:215
int nSatUndec
Definition: giaCSat.c:77
static int Gia_ObjIsConst0(Gia_Obj_t *pObj)
Definition: gia.h:430
void Cbs_ManStop(Cbs_Man_t *p)
Definition: giaCSat.c:176
static Vec_Str_t * Vec_StrAlloc(int nCap)
Definition: bblif.c:495
static abctime Abc_Clock()
Definition: abc_global.h:279
static void Vec_StrPush(Vec_Str_t *p, char Entry)
Definition: vecStr.h:535
int nConfUnsat
Definition: giaCSat.c:80
Definition: gia.h:75
void Gia_ManCleanMark1(Gia_Man_t *p)
Definition: giaUtil.c:272
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
int nConfUndec
Definition: giaCSat.c:82
abctime timeSatSat
Definition: giaCSat.c:85
abctime timeSatUndec
Definition: giaCSat.c:86
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
Cbs_Par_t Pars
Definition: giaCSat.c:65
void Cec_ManSatAddToStore(Vec_Int_t *vCexStore, Vec_Int_t *vCex, int Out)
Definition: cecSolve.c:952
Definition: gia.h:95
#define assert(ex)
Definition: util_old.h:213
void Gia_ManSetPhase(Gia_Man_t *p)
Definition: giaUtil.c:379
void Gia_ManCollectTest(Gia_Man_t *p)
Definition: giaDfs.c:208
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
ABC_INT64_T abctime
Definition: abc_global.h:278
int nSatUnsat
Definition: giaCSat.c:75
abctime timeSatUnsat
Definition: giaCSat.c:84
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
void For_ManExperiment ( Gia_Man_t pGia,
int  nIters,
int  fClustered,
int  fVerbose 
)

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

Synopsis [Experiment with the FORCE algorithm.]

Description []

SideEffects []

SeeAlso []

Definition at line 1039 of file giaForce.c.

1040 {
1041  Frc_Man_t * p;
1042  Gia_ManRandom( 1 );
1043  if ( fClustered )
1044  p = Frc_ManStart( pGia );
1045  else
1046  p = Frc_ManStartSimple( pGia );
1047 // Frc_DumpGraphIntoFile( p );
1048  if ( fVerbose )
1049  Frc_ManPrintStats( p );
1050 // Frc_ManCrossCutTest( p, NULL );
1051  Frc_ManPlacementRefine( p, nIters, fVerbose );
1052  Frc_ManStop( p );
1053 }
Frc_Man_t * Frc_ManStartSimple(Gia_Man_t *pGia)
Definition: giaForce.c:150
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Frc_Man_t * Frc_ManStart(Gia_Man_t *pGia)
Definition: giaForce.c:428
void Frc_ManPrintStats(Frc_Man_t *p)
Definition: giaForce.c:557
unsigned Gia_ManRandom(int fReset)
FUNCTION DEFINITIONS ///.
Definition: giaUtil.c:49
void Frc_ManPlacementRefine(Frc_Man_t *p, int nIters, int fVerbose)
Definition: giaForce.c:886
void Frc_ManStop(Frc_Man_t *p)
Definition: giaForce.c:584
Gia_Man_t* Gia_AigerRead ( char *  pFileName,
int  fSkipStrash,
int  fCheck 
)

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

Synopsis [Reads the AIG in the binary AIGER format.]

Description []

SideEffects []

SeeAlso []

Definition at line 821 of file giaAiger.c.

822 {
823  FILE * pFile;
824  Gia_Man_t * pNew;
825  char * pName, * pContents;
826  int nFileSize;
827  int RetValue;
828 
829  // read the file into the buffer
830  Gia_FileFixName( pFileName );
831  nFileSize = Gia_FileSize( pFileName );
832  pFile = fopen( pFileName, "rb" );
833  pContents = ABC_ALLOC( char, nFileSize );
834  RetValue = fread( pContents, nFileSize, 1, pFile );
835  fclose( pFile );
836 
837  pNew = Gia_AigerReadFromMemory( pContents, nFileSize, fSkipStrash, fCheck );
838  ABC_FREE( pContents );
839  if ( pNew )
840  {
841  ABC_FREE( pNew->pName );
842  pName = Gia_FileNameGeneric( pFileName );
843  pNew->pName = Abc_UtilStrsav( pName );
844  ABC_FREE( pName );
845 
846  assert( pNew->pSpec == NULL );
847  pNew->pSpec = Abc_UtilStrsav( pFileName );
848  }
849  return pNew;
850 }
void Gia_FileFixName(char *pFileName)
DECLARATIONS ///.
Definition: giaAiger.c:49
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
int Gia_FileSize(char *pFileName)
FUNCTION DECLARATIONS ///.
Definition: giaAiger.c:64
char * pName
Definition: gia.h:97
char * pSpec
Definition: gia.h:98
char * Gia_FileNameGeneric(char *FileName)
Definition: giaAiger.c:56
#define ABC_FREE(obj)
Definition: abc_global.h:232
Definition: gia.h:95
#define assert(ex)
Definition: util_old.h:213
Gia_Man_t * Gia_AigerReadFromMemory(char *pContents, int nFileSize, int fSkipStrash, int fCheck)
Definition: giaAiger.c:176
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
Gia_Man_t* Gia_AigerReadFromMemory ( char *  pContents,
int  nFileSize,
int  fSkipStrash,
int  fCheck 
)

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

Synopsis [Reads the AIG in the binary AIGER format.]

Description []

SideEffects []

SeeAlso []

Definition at line 176 of file giaAiger.c.

177 {
178  Gia_Man_t * pNew, * pTemp;
179  Vec_Int_t * vLits = NULL, * vPoTypes = NULL;
180  Vec_Int_t * vNodes, * vDrivers, * vInits = NULL;
181  int iObj, iNode0, iNode1, fHieOnly = 0;
182  int nTotal, nInputs, nOutputs, nLatches, nAnds, i;
183  int nBad = 0, nConstr = 0, nJust = 0, nFair = 0;
184  unsigned char * pDrivers, * pSymbols, * pCur;
185  unsigned uLit0, uLit1, uLit;
186 
187  // read the parameters (M I L O A + B C J F)
188  pCur = (unsigned char *)pContents; while ( *pCur != ' ' ) pCur++; pCur++;
189  // read the number of objects
190  nTotal = atoi( (const char *)pCur ); while ( *pCur != ' ' ) pCur++; pCur++;
191  // read the number of inputs
192  nInputs = atoi( (const char *)pCur ); while ( *pCur != ' ' ) pCur++; pCur++;
193  // read the number of latches
194  nLatches = atoi( (const char *)pCur ); while ( *pCur != ' ' ) pCur++; pCur++;
195  // read the number of outputs
196  nOutputs = atoi( (const char *)pCur ); while ( *pCur != ' ' ) pCur++; pCur++;
197  // read the number of nodes
198  nAnds = atoi( (const char *)pCur ); while ( *pCur != ' ' && *pCur != '\n' ) pCur++;
199  if ( *pCur == ' ' )
200  {
201 // assert( nOutputs == 0 );
202  // read the number of properties
203  pCur++;
204  nBad = atoi( (const char *)pCur ); while ( *pCur != ' ' && *pCur != '\n' ) pCur++;
205  nOutputs += nBad;
206  }
207  if ( *pCur == ' ' )
208  {
209  // read the number of properties
210  pCur++;
211  nConstr = atoi( (const char *)pCur ); while ( *pCur != ' ' && *pCur != '\n' ) pCur++;
212  nOutputs += nConstr;
213  }
214  if ( *pCur == ' ' )
215  {
216  // read the number of properties
217  pCur++;
218  nJust = atoi( (const char *)pCur ); while ( *pCur != ' ' && *pCur != '\n' ) pCur++;
219  nOutputs += nJust;
220  }
221  if ( *pCur == ' ' )
222  {
223  // read the number of properties
224  pCur++;
225  nFair = atoi( (const char *)pCur ); while ( *pCur != ' ' && *pCur != '\n' ) pCur++;
226  nOutputs += nFair;
227  }
228  if ( *pCur != '\n' )
229  {
230  fprintf( stdout, "The parameter line is in a wrong format.\n" );
231  return NULL;
232  }
233  pCur++;
234 
235  // check the parameters
236  if ( nTotal != nInputs + nLatches + nAnds )
237  {
238  fprintf( stdout, "The number of objects does not match.\n" );
239  return NULL;
240  }
241  if ( nJust || nFair )
242  {
243  fprintf( stdout, "Reading AIGER files with liveness properties is currently not supported.\n" );
244  return NULL;
245  }
246 
247  if ( nConstr )
248  {
249  if ( nConstr == 1 )
250  fprintf( stdout, "Warning: The last output is interpreted as a constraint.\n" );
251  else
252  fprintf( stdout, "Warning: The last %d outputs are interpreted as constraints.\n", nConstr );
253  }
254 
255  // allocate the empty AIG
256  pNew = Gia_ManStart( nTotal + nLatches + nOutputs + 1 );
257  pNew->nConstrs = nConstr;
258 
259  // prepare the array of nodes
260  vNodes = Vec_IntAlloc( 1 + nTotal );
261  Vec_IntPush( vNodes, 0 );
262 
263  // create the PIs
264  for ( i = 0; i < nInputs + nLatches; i++ )
265  {
266  iObj = Gia_ManAppendCi(pNew);
267  Vec_IntPush( vNodes, iObj );
268  }
269 
270  // remember the beginning of latch/PO literals
271  pDrivers = pCur;
272  if ( pContents[3] == ' ' ) // standard AIGER
273  {
274  // scroll to the beginning of the binary data
275  for ( i = 0; i < nLatches + nOutputs; )
276  if ( *pCur++ == '\n' )
277  i++;
278  }
279  else // modified AIGER
280  {
281  vLits = Gia_AigerReadLiterals( &pCur, nLatches + nOutputs );
282  }
283 
284  // create the AND gates
285  if ( !fSkipStrash )
286  Gia_ManHashAlloc( pNew );
287  for ( i = 0; i < nAnds; i++ )
288  {
289  uLit = ((i + 1 + nInputs + nLatches) << 1);
290  uLit1 = uLit - Gia_AigerReadUnsigned( &pCur );
291  uLit0 = uLit1 - Gia_AigerReadUnsigned( &pCur );
292 // assert( uLit1 > uLit0 );
293  iNode0 = Abc_LitNotCond( Vec_IntEntry(vNodes, uLit0 >> 1), uLit0 & 1 );
294  iNode1 = Abc_LitNotCond( Vec_IntEntry(vNodes, uLit1 >> 1), uLit1 & 1 );
295  assert( Vec_IntSize(vNodes) == i + 1 + nInputs + nLatches );
296  if ( fSkipStrash )
297  {
298  if ( iNode0 == iNode1 )
299  Vec_IntPush( vNodes, Gia_ManAppendBuf(pNew, iNode0) );
300  else
301  Vec_IntPush( vNodes, Gia_ManAppendAnd(pNew, iNode0, iNode1) );
302  }
303  else
304  Vec_IntPush( vNodes, Gia_ManHashAnd(pNew, iNode0, iNode1) );
305  }
306  if ( !fSkipStrash )
307  Gia_ManHashStop( pNew );
308 
309  // remember the place where symbols begin
310  pSymbols = pCur;
311 
312  // read the latch driver literals
313  vDrivers = Vec_IntAlloc( nLatches + nOutputs );
314  if ( pContents[3] == ' ' ) // standard AIGER
315  {
316  vInits = Vec_IntAlloc( nLatches );
317  pCur = pDrivers;
318  for ( i = 0; i < nLatches; i++ )
319  {
320  uLit0 = atoi( (char *)pCur );
321  while ( *pCur != ' ' && *pCur != '\n' )
322  pCur++;
323  if ( *pCur == ' ' )
324  {
325  pCur++;
326  Vec_IntPush( vInits, atoi( (char *)pCur ) );
327  while ( *pCur++ != '\n' );
328  }
329  else
330  {
331  pCur++;
332  Vec_IntPush( vInits, 0 );
333  }
334  iNode0 = Abc_LitNotCond( Vec_IntEntry(vNodes, uLit0 >> 1), (uLit0 & 1) );
335  Vec_IntPush( vDrivers, iNode0 );
336  }
337  // read the PO driver literals
338  for ( i = 0; i < nOutputs; i++ )
339  {
340  uLit0 = atoi( (char *)pCur ); while ( *pCur++ != '\n' );
341  iNode0 = Abc_LitNotCond( Vec_IntEntry(vNodes, uLit0 >> 1), (uLit0 & 1) );
342  Vec_IntPush( vDrivers, iNode0 );
343  }
344 
345  }
346  else
347  {
348  // read the latch driver literals
349  for ( i = 0; i < nLatches; i++ )
350  {
351  uLit0 = Vec_IntEntry( vLits, i );
352  iNode0 = Abc_LitNotCond( Vec_IntEntry(vNodes, uLit0 >> 1), (uLit0 & 1) );
353  Vec_IntPush( vDrivers, iNode0 );
354  }
355  // read the PO driver literals
356  for ( i = 0; i < nOutputs; i++ )
357  {
358  uLit0 = Vec_IntEntry( vLits, i+nLatches );
359  iNode0 = Abc_LitNotCond( Vec_IntEntry(vNodes, uLit0 >> 1), (uLit0 & 1) );
360  Vec_IntPush( vDrivers, iNode0 );
361  }
362  Vec_IntFree( vLits );
363  }
364 
365  // create the POs
366  for ( i = 0; i < nOutputs; i++ )
367  Gia_ManAppendCo( pNew, Vec_IntEntry(vDrivers, nLatches + i) );
368  for ( i = 0; i < nLatches; i++ )
369  Gia_ManAppendCo( pNew, Vec_IntEntry(vDrivers, i) );
370  Vec_IntFree( vDrivers );
371 
372  // create the latches
373  Gia_ManSetRegNum( pNew, nLatches );
374 
375  // read signal names if they are of the special type
376  pCur = pSymbols;
377  if ( pCur < (unsigned char *)pContents + nFileSize && *pCur != 'c' )
378  {
379  int fBreakUsed = 0;
380  unsigned char * pCurOld = pCur;
381  pNew->vUserPiIds = Vec_IntStartFull( nInputs );
382  pNew->vUserPoIds = Vec_IntStartFull( nOutputs );
383  pNew->vUserFfIds = Vec_IntStartFull( nLatches );
384  while ( pCur < (unsigned char *)pContents + nFileSize && *pCur != 'c' )
385  {
386  int iTerm;
387  char * pType = (char *)pCur;
388  // check terminal type
389  if ( *pCur != 'i' && *pCur != 'o' && *pCur != 'l' )
390  {
391 // fprintf( stdout, "Wrong terminal type.\n" );
392  fBreakUsed = 1;
393  break;
394  }
395  // get terminal number
396  iTerm = atoi( (char *)++pCur ); while ( *pCur++ != ' ' );
397  // skip spaces
398  while ( *pCur == ' ' )
399  pCur++;
400  // decode the user numbers:
401  // flops are named: @l<num>
402  // PIs are named: @i<num>
403  // POs are named: @o<num>
404  if ( *pCur++ != '@' )
405  {
406  fBreakUsed = 1;
407  break;
408  }
409  if ( *pCur == 'i' && *pType == 'i' )
410  Vec_IntWriteEntry( pNew->vUserPiIds, iTerm, atoi((char *)pCur+1) );
411  else if ( *pCur == 'o' && *pType == 'o' )
412  Vec_IntWriteEntry( pNew->vUserPoIds, iTerm, atoi((char *)pCur+1) );
413  else if ( *pCur == 'l' && *pType == 'l' )
414  Vec_IntWriteEntry( pNew->vUserFfIds, iTerm, atoi((char *)pCur+1) );
415  else
416  {
417  fprintf( stdout, "Wrong name format.\n" );
418  fBreakUsed = 1;
419  break;
420  }
421  // skip digits
422  while ( *pCur++ != '\n' );
423  }
424  // in case of abnormal termination, remove the arrays
425  if ( fBreakUsed )
426  {
427  unsigned char * pName;
428  int Entry, nInvars, nConstr, iTerm;
429 
430  Vec_Int_t * vPoNames = Vec_IntStartFull( nOutputs );
431 
432  Vec_IntFreeP( &pNew->vUserPiIds );
433  Vec_IntFreeP( &pNew->vUserPoIds );
434  Vec_IntFreeP( &pNew->vUserFfIds );
435 
436  // try to figure out signal names
437  fBreakUsed = 0;
438  pCur = (unsigned char *)pCurOld;
439  while ( pCur < (unsigned char *)pContents + nFileSize && *pCur != 'c' )
440  {
441  // get the terminal type
442  if ( *pCur == 'i' || *pCur == 'l' )
443  {
444  // skip till the end of the line
445  while ( *pCur++ != '\n' );
446  *(pCur-1) = 0;
447  continue;
448  }
449  if ( *pCur != 'o' )
450  {
451 // fprintf( stdout, "Wrong terminal type.\n" );
452  fBreakUsed = 1;
453  break;
454  }
455  // get the terminal number
456  iTerm = atoi( (char *)++pCur ); while ( *pCur++ != ' ' );
457  // get the node
458  if ( iTerm < 0 || iTerm >= nOutputs )
459  {
460  fprintf( stdout, "The output number (%d) is out of range.\n", iTerm );
461  fBreakUsed = 1;
462  break;
463  }
464  if ( Vec_IntEntry(vPoNames, iTerm) != ~0 )
465  {
466  fprintf( stdout, "The output number (%d) is listed twice.\n", iTerm );
467  fBreakUsed = 1;
468  break;
469  }
470 
471  // get the name
472  pName = pCur; while ( *pCur++ != '\n' );
473  *(pCur-1) = 0;
474  // assign the name
475  Vec_IntWriteEntry( vPoNames, iTerm, pName - (unsigned char *)pContents );
476  }
477 
478  // check that all names are assigned
479  if ( !fBreakUsed )
480  {
481  nInvars = nConstr = 0;
482  vPoTypes = Vec_IntStart( Gia_ManPoNum(pNew) );
483  Vec_IntForEachEntry( vPoNames, Entry, i )
484  {
485  if ( Entry == ~0 )
486  continue;
487  if ( strncmp( pContents+Entry, "constraint:", 11 ) == 0 )
488  {
489  Vec_IntWriteEntry( vPoTypes, i, 1 );
490  nConstr++;
491  }
492  if ( strncmp( pContents+Entry, "invariant:", 10 ) == 0 )
493  {
494  Vec_IntWriteEntry( vPoTypes, i, 2 );
495  nInvars++;
496  }
497  }
498  if ( nConstr )
499  fprintf( stdout, "Recognized and added %d constraints.\n", nConstr );
500  if ( nInvars )
501  fprintf( stdout, "Recognized and skipped %d invariants.\n", nInvars );
502  if ( nConstr == 0 && nInvars == 0 )
503  Vec_IntFreeP( &vPoTypes );
504  }
505  Vec_IntFree( vPoNames );
506  }
507  }
508 
509 
510  // check if there are other types of information to read
511  if ( pCur + 1 < (unsigned char *)pContents + nFileSize && *pCur == 'c' )
512  {
513  int fVerbose = XAIG_VERBOSE;
514  Vec_Str_t * vStr;
515  unsigned char * pCurTemp;
516  pCur++;
517  // skip new line if present
518 // if ( *pCur == '\n' )
519 // pCur++;
520  while ( pCur < (unsigned char *)pContents + nFileSize )
521  {
522  // read extra AIG
523  if ( *pCur == 'a' )
524  {
525  pCur++;
526  vStr = Vec_StrStart( Gia_AigerReadInt(pCur) ); pCur += 4;
527  memcpy( Vec_StrArray(vStr), pCur, Vec_StrSize(vStr) );
528  pCur += Vec_StrSize(vStr);
529  pNew->pAigExtra = Gia_AigerReadFromMemory( Vec_StrArray(vStr), Vec_StrSize(vStr), 0, 0 );
530  Vec_StrFree( vStr );
531  if ( fVerbose ) printf( "Finished reading extension \"a\".\n" );
532  }
533  // read number of constraints
534  else if ( *pCur == 'c' )
535  {
536  pCur++;
537  assert( Gia_AigerReadInt(pCur) == 4 ); pCur += 4;
538  pNew->nConstrs = Gia_AigerReadInt( pCur ); pCur += 4;
539  if ( fVerbose ) printf( "Finished reading extension \"c\".\n" );
540  }
541  // read delay information
542  else if ( *pCur == 'd' )
543  {
544  pCur++;
545  assert( Gia_AigerReadInt(pCur) == 4 ); pCur += 4;
546  pNew->nAnd2Delay = Gia_AigerReadInt(pCur); pCur += 4;
547  if ( fVerbose ) printf( "Finished reading extension \"d\".\n" );
548  }
549  else if ( *pCur == 'i' )
550  {
551  pCur++;
552  nInputs = Gia_AigerReadInt(pCur)/4; pCur += 4;
553  pNew->vInArrs = Vec_FltStart( nInputs );
554  memcpy( Vec_FltArray(pNew->vInArrs), pCur, 4*nInputs ); pCur += 4*nInputs;
555  if ( fVerbose ) printf( "Finished reading extension \"i\".\n" );
556  }
557  else if ( *pCur == 'o' )
558  {
559  pCur++;
560  nOutputs = Gia_AigerReadInt(pCur)/4; pCur += 4;
561  pNew->vOutReqs = Vec_FltStart( nOutputs );
562  memcpy( Vec_FltArray(pNew->vOutReqs), pCur, 4*nOutputs ); pCur += 4*nOutputs;
563  if ( fVerbose ) printf( "Finished reading extension \"o\".\n" );
564  }
565  // read equivalence classes
566  else if ( *pCur == 'e' )
567  {
568  extern Gia_Rpr_t * Gia_AigerReadEquivClasses( unsigned char ** ppPos, int nSize );
569  pCur++;
570  pCurTemp = pCur + Gia_AigerReadInt(pCur) + 4; pCur += 4;
571  pNew->pReprs = Gia_AigerReadEquivClasses( &pCur, Gia_ManObjNum(pNew) );
572  pNew->pNexts = Gia_ManDeriveNexts( pNew );
573  assert( pCur == pCurTemp );
574  if ( fVerbose ) printf( "Finished reading extension \"e\".\n" );
575  }
576  // read flop classes
577  else if ( *pCur == 'f' )
578  {
579  pCur++;
580  assert( Gia_AigerReadInt(pCur) == 4*Gia_ManRegNum(pNew) ); pCur += 4;
581  pNew->vFlopClasses = Vec_IntStart( Gia_ManRegNum(pNew) );
582  memcpy( Vec_IntArray(pNew->vFlopClasses), pCur, 4*Gia_ManRegNum(pNew) ); pCur += 4*Gia_ManRegNum(pNew);
583  if ( fVerbose ) printf( "Finished reading extension \"f\".\n" );
584  }
585  // read gate classes
586  else if ( *pCur == 'g' )
587  {
588  pCur++;
589  assert( Gia_AigerReadInt(pCur) == 4*Gia_ManObjNum(pNew) ); pCur += 4;
590  pNew->vGateClasses = Vec_IntStart( Gia_ManObjNum(pNew) );
591  memcpy( Vec_IntArray(pNew->vGateClasses), pCur, 4*Gia_ManObjNum(pNew) ); pCur += 4*Gia_ManObjNum(pNew);
592  if ( fVerbose ) printf( "Finished reading extension \"g\".\n" );
593  }
594  // read hierarchy information
595  else if ( *pCur == 'h' )
596  {
597  pCur++;
598  vStr = Vec_StrStart( Gia_AigerReadInt(pCur) ); pCur += 4;
599  memcpy( Vec_StrArray(vStr), pCur, Vec_StrSize(vStr) );
600  pCur += Vec_StrSize(vStr);
601  pNew->pManTime = Tim_ManLoad( vStr, 1 );
602  Vec_StrFree( vStr );
603  fHieOnly = 1;
604  if ( fVerbose ) printf( "Finished reading extension \"h\".\n" );
605  }
606  // read packing
607  else if ( *pCur == 'k' )
608  {
609  extern Vec_Int_t * Gia_AigerReadPacking( unsigned char ** ppPos, int nSize );
610  int nSize;
611  pCur++;
612  nSize = Gia_AigerReadInt(pCur);
613  pCurTemp = pCur + nSize + 4; pCur += 4;
614  pNew->vPacking = Gia_AigerReadPacking( &pCur, nSize );
615  assert( pCur == pCurTemp );
616  if ( fVerbose ) printf( "Finished reading extension \"k\".\n" );
617  }
618  // read mapping
619  else if ( *pCur == 'm' )
620  {
621  extern int * Gia_AigerReadMapping( unsigned char ** ppPos, int nSize );
622  extern int * Gia_AigerReadMappingSimple( unsigned char ** ppPos, int nSize );
623  extern Vec_Int_t * Gia_AigerReadMappingDoc( unsigned char ** ppPos, int nObjs );
624  int nSize;
625  pCur++;
626  nSize = Gia_AigerReadInt(pCur);
627  pCurTemp = pCur + nSize + 4; pCur += 4;
628  pNew->vMapping = Gia_AigerReadMappingDoc( &pCur, Gia_ManObjNum(pNew) );
629  assert( pCur == pCurTemp );
630  if ( fVerbose ) printf( "Finished reading extension \"m\".\n" );
631  }
632  // read model name
633  else if ( *pCur == 'n' )
634  {
635  pCur++;
636  if ( (*pCur >= 'a' && *pCur <= 'z') || (*pCur >= 'A' && *pCur <= 'Z') || (*pCur >= '0' && *pCur <= '9') )
637  {
638  pNew->pName = Abc_UtilStrsav( (char *)pCur ); pCur += strlen(pNew->pName) + 1;
639  }
640  else
641  {
642  pCurTemp = pCur + Gia_AigerReadInt(pCur) + 4; pCur += 4;
643  ABC_FREE( pNew->pName );
644  pNew->pName = Abc_UtilStrsav( (char *)pCur ); pCur += strlen(pNew->pName) + 1;
645  assert( pCur == pCurTemp );
646  }
647  }
648  // read placement
649  else if ( *pCur == 'p' )
650  {
651  Gia_Plc_t * pPlacement;
652  pCur++;
653  pCurTemp = pCur + Gia_AigerReadInt(pCur) + 4; pCur += 4;
654  pPlacement = ABC_ALLOC( Gia_Plc_t, Gia_ManObjNum(pNew) );
655  memcpy( pPlacement, pCur, 4*Gia_ManObjNum(pNew) ); pCur += 4*Gia_ManObjNum(pNew);
656  assert( pCur == pCurTemp );
657  pNew->pPlacement = pPlacement;
658  if ( fVerbose ) printf( "Finished reading extension \"p\".\n" );
659  }
660  // read register classes
661  else if ( *pCur == 'r' )
662  {
663  int i, nRegs;
664  pCur++;
665  nRegs = Gia_AigerReadInt(pCur)/4; pCur += 4;
666  pNew->vRegClasses = Vec_IntAlloc( nRegs );
667  for ( i = 0; i < nRegs; i++ )
668  Vec_IntPush( pNew->vRegClasses, Gia_AigerReadInt(pCur) ), pCur += 4;
669  if ( fVerbose ) printf( "Finished reading extension \"r\".\n" );
670  }
671  // read choices
672  else if ( *pCur == 'q' )
673  {
674  int i, nPairs, iRepr, iNode;
675  assert( !Gia_ManHasChoices(pNew) );
676  pNew->pSibls = ABC_CALLOC( int, Gia_ManObjNum(pNew) );
677  pCur++;
678  pCurTemp = pCur + Gia_AigerReadInt(pCur) + 4; pCur += 4;
679  nPairs = Gia_AigerReadInt(pCur); pCur += 4;
680  for ( i = 0; i < nPairs; i++ )
681  {
682  iRepr = Gia_AigerReadInt(pCur); pCur += 4;
683  iNode = Gia_AigerReadInt(pCur); pCur += 4;
684  pNew->pSibls[iRepr] = iNode;
685  assert( iRepr > iNode );
686  }
687  assert( pCur == pCurTemp );
688  if ( fVerbose ) printf( "Finished reading extension \"q\".\n" );
689  }
690  // read switching activity
691  else if ( *pCur == 'u' )
692  {
693  unsigned char * pSwitching;
694  pCur++;
695  pCurTemp = pCur + Gia_AigerReadInt(pCur) + 4; pCur += 4;
696  pSwitching = ABC_ALLOC( unsigned char, Gia_ManObjNum(pNew) );
697  memcpy( pSwitching, pCur, Gia_ManObjNum(pNew) ); pCur += Gia_ManObjNum(pNew);
698  assert( pCur == pCurTemp );
699  if ( fVerbose ) printf( "Finished reading extension \"s\".\n" );
700  }
701  // read timing manager
702  else if ( *pCur == 't' )
703  {
704  pCur++;
705  vStr = Vec_StrStart( Gia_AigerReadInt(pCur) ); pCur += 4;
706  memcpy( Vec_StrArray(vStr), pCur, Vec_StrSize(vStr) ); pCur += Vec_StrSize(vStr);
707  pNew->pManTime = Tim_ManLoad( vStr, 0 );
708  Vec_StrFree( vStr );
709  if ( fVerbose ) printf( "Finished reading extension \"t\".\n" );
710  }
711  // read object classes
712  else if ( *pCur == 'v' )
713  {
714  pCur++;
715  pNew->vObjClasses = Vec_IntStart( Gia_AigerReadInt(pCur)/4 ); pCur += 4;
716  memcpy( Vec_IntArray(pNew->vObjClasses), pCur, 4*Vec_IntSize(pNew->vObjClasses) );
717  pCur += 4*Vec_IntSize(pNew->vObjClasses);
718  if ( fVerbose ) printf( "Finished reading extension \"v\".\n" );
719  }
720  else break;
721  }
722  }
723 
724  // skipping the comments
725  Vec_IntFree( vNodes );
726 
727  // update polarity of the additional outputs
728  if ( nBad || nConstr || nJust || nFair )
729  Gia_ManInvertConstraints( pNew );
730 
731  // clean the PO drivers
732  if ( vPoTypes )
733  {
734  pNew = Gia_ManDupWithConstraints( pTemp = pNew, vPoTypes );
735  Gia_ManStop( pTemp );
736  Vec_IntFreeP( &vPoTypes );
737  }
738 
739  if ( !fSkipStrash && Gia_ManHasDangling(pNew) )
740  {
741  Tim_Man_t * pManTime;
742  Vec_Int_t * vFlopMap, * vGateMap, * vObjMap;
743  vFlopMap = pNew->vFlopClasses; pNew->vFlopClasses = NULL;
744  vGateMap = pNew->vGateClasses; pNew->vGateClasses = NULL;
745  vObjMap = pNew->vObjClasses; pNew->vObjClasses = NULL;
746  pManTime = (Tim_Man_t *)pNew->pManTime; pNew->pManTime = NULL;
747  pNew = Gia_ManCleanup( pTemp = pNew );
748  if ( (vGateMap || vObjMap) && (Gia_ManObjNum(pNew) < Gia_ManObjNum(pTemp)) )
749  printf( "Cleanup removed objects after reading. Old gate/object abstraction maps are invalid!\n" );
750  Gia_ManStop( pTemp );
751  pNew->vFlopClasses = vFlopMap;
752  pNew->vGateClasses = vGateMap;
753  pNew->vObjClasses = vObjMap;
754  pNew->pManTime = pManTime;
755  }
756 
757  if ( fHieOnly )
758  {
759 // Tim_ManPrint( (Tim_Man_t *)pNew->pManTime );
760  if ( Abc_FrameReadLibBox() == NULL )
761  printf( "Warning: Creating unit-delay box delay tables because box library is not available.\n" );
763  }
764  Vec_FltFreeP( &pNew->vInArrs );
765  Vec_FltFreeP( &pNew->vOutReqs );
766 /*
767  // check the result
768  if ( fCheck && !Gia_ManCheck( pNew ) )
769  {
770  printf( "Gia_AigerRead: The network check has failed.\n" );
771  Gia_ManStop( pNew );
772  return NULL;
773  }
774 */
775 
776  if ( vInits && Vec_IntSum(vInits) )
777  {
778  char * pInit = ABC_ALLOC( char, Vec_IntSize(vInits) + 1 );
779  Gia_Obj_t * pObj;
780  int i;
781  assert( Vec_IntSize(vInits) == Gia_ManRegNum(pNew) );
782  Gia_ManForEachRo( pNew, pObj, i )
783  {
784  if ( Vec_IntEntry(vInits, i) == 0 )
785  pInit[i] = '0';
786  else if ( Vec_IntEntry(vInits, i) == 1 )
787  pInit[i] = '1';
788  else
789  {
790  assert( Vec_IntEntry(vInits, i) == Abc_Var2Lit(Gia_ObjId(pNew, pObj), 0) );
791  // unitialized value of the latch is the latch literal according to http://fmv.jku.at/hwmcc11/beyond1.pdf
792  pInit[i] = 'X';
793  }
794  }
795  pInit[i] = 0;
796  pNew = Gia_ManDupZeroUndc( pTemp = pNew, pInit, 1 );
797  pNew->nConstrs = pTemp->nConstrs; pTemp->nConstrs = 0;
798  Gia_ManStop( pTemp );
799  ABC_FREE( pInit );
800  }
801  Vec_IntFreeP( &vInits );
802  if ( !fSkipStrash && pNew->vMapping )
803  {
804  Abc_Print( 0, "Structural hashing enabled while reading AIGER invalidated the mapping. Consider using \"&r -s\".\n" );
805  Vec_IntFreeP( &pNew->vMapping );
806  }
807  return pNew;
808 }
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
static int Gia_ManAppendAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: gia.h:592
Vec_Int_t * vUserFfIds
Definition: gia.h:159
void Gia_ManInvertConstraints(Gia_Man_t *pAig)
Definition: giaUtil.c:1415
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
Gia_Man_t * pAigExtra
Definition: gia.h:149
int * pNexts
Definition: gia.h:122
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Vec_Int_t * vRegClasses
Definition: gia.h:144
static char * Vec_StrArray(Vec_Str_t *p)
Definition: vecStr.h:272
Vec_Int_t * vObjClasses
Definition: gia.h:142
int * pSibls
Definition: gia.h:123
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
Vec_Int_t * vFlopClasses
Definition: gia.h:140
char * memcpy()
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
#define XAIG_VERBOSE
Definition: giaAiger.c:28
static float * Vec_FltArray(Vec_Flt_t *p)
Definition: vecFlt.h:274
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
ABC_NAMESPACE_IMPL_START Gia_Rpr_t * Gia_AigerReadEquivClasses(unsigned char **ppPos, int nSize)
DECLARATIONS ///.
Definition: giaAigerExt.c:45
Vec_Int_t * vPacking
Definition: gia.h:133
int * Gia_AigerReadMapping(unsigned char **ppPos, int nSize)
Definition: giaAigerExt.c:143
Vec_Int_t * Gia_AigerReadLiterals(unsigned char **ppPos, int nEntries)
Definition: giaAiger.c:109
static Vec_Int_t * Vec_IntStartFull(int nSize)
Definition: vecInt.h:119
static void Vec_FltFreeP(Vec_Flt_t **p)
Definition: vecFlt.h:235
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
Definition: gia.h:75
Gia_Man_t * Gia_ManDupZeroUndc(Gia_Man_t *p, char *pInit, int fVerbose)
Definition: giaDup.c:2390
int Gia_ManHasDangling(Gia_Man_t *p)
Definition: giaUtil.c:1155
static int Gia_ManHasChoices(Gia_Man_t *p)
Definition: gia.h:397
void Tim_ManCreate(Tim_Man_t *p, void *pLib, Vec_Flt_t *vInArrs, Vec_Flt_t *vOutReqs)
Definition: timMan.c:403
static Vec_Flt_t * Vec_FltStart(int nSize)
Definition: vecFlt.h:101
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
static int Gia_AigerReadInt(unsigned char *pPos)
Definition: gia.h:827
int nConstrs
Definition: gia.h:117
char * pName
Definition: gia.h:97
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Vec_StrFree(Vec_Str_t *p)
Definition: bblif.c:616
Vec_Int_t * vGateClasses
Definition: gia.h:141
static int Gia_ManAppendBuf(Gia_Man_t *p, int iLit)
Definition: gia.h:694
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
ABC_DLL void * Abc_FrameReadLibBox()
Definition: mainFrame.c:55
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
static Vec_Str_t * Vec_StrStart(int nSize)
Definition: vecStr.h:95
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
Vec_Flt_t * vOutReqs
Definition: gia.h:151
void * pManTime
Definition: gia.h:165
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
int * Gia_ManDeriveNexts(Gia_Man_t *p)
Definition: giaEquiv.c:97
Vec_Int_t * Gia_AigerReadMappingDoc(unsigned char **ppPos, int nObjs)
Definition: giaAigerExt.c:245
Vec_Int_t * vUserPiIds
Definition: gia.h:157
int nAnd2Delay
Definition: gia.h:173
static int Vec_StrSize(Vec_Str_t *p)
Definition: bblif.c:600
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Vec_IntSum(Vec_Int_t *p)
Definition: vecInt.h:1137
#define ABC_FREE(obj)
Definition: abc_global.h:232
Definition: gia.h:95
Gia_Plc_t * pPlacement
Definition: gia.h:148
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
int strncmp()
#define Gia_ManForEachRo(p, pObj, i)
Definition: gia.h:1038
int * Gia_AigerReadMappingSimple(unsigned char **ppPos, int nSize)
Definition: giaAigerExt.c:219
Gia_Rpr_t * pReprs
Definition: gia.h:121
#define assert(ex)
Definition: util_old.h:213
int strlen()
Definition: gia.h:66
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
static unsigned Gia_AigerReadUnsigned(unsigned char **ppPos)
Definition: gia.h:840
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
Vec_Int_t * vMapping
Definition: gia.h:131
Gia_Man_t * Gia_AigerReadFromMemory(char *pContents, int nFileSize, int fSkipStrash, int fCheck)
Definition: giaAiger.c:176
Definition: gia.h:56
Tim_Man_t * Tim_ManLoad(Vec_Str_t *p, int fHieOnly)
Definition: timDump.c:112
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
Vec_Int_t * vUserPoIds
Definition: gia.h:158
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
Gia_Man_t * Gia_ManDupWithConstraints(Gia_Man_t *p, Vec_Int_t *vPoTypes)
Definition: giaDup.c:2627
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
Vec_Int_t * Gia_AigerReadPacking(unsigned char **ppPos, int nSize)
Definition: giaAigerExt.c:302
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
int nTotal
DECLARATIONS ///.
Definition: cutTruth.c:37
Vec_Flt_t * vInArrs
Definition: gia.h:150
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
static int Gia_AigerReadInt ( unsigned char *  pPos)
inlinestatic

Definition at line 827 of file gia.h.

828 {
829  int i, Value = 0;
830  for ( i = 0; i < 4; i++ )
831  Value = (Value << 8) | *pPos++;
832  return Value;
833 }
static unsigned Gia_AigerReadUnsigned ( unsigned char **  ppPos)
inlinestatic

Definition at line 840 of file gia.h.

841 {
842  unsigned x = 0, i = 0;
843  unsigned char ch;
844  while ((ch = *(*ppPos)++) & 0x80)
845  x |= (ch & 0x7f) << (7 * i++);
846  return x | (ch << (7 * i));
847 }
void Gia_AigerWrite ( Gia_Man_t pInit,
char *  pFileName,
int  fWriteSymbols,
int  fCompact 
)

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

Synopsis [Writes the AIG in the binary AIGER format.]

Description []

SideEffects []

SeeAlso []

Definition at line 1024 of file giaAiger.c.

1025 {
1026  int fVerbose = XAIG_VERBOSE;
1027  FILE * pFile;
1028  Gia_Man_t * p;
1029  Gia_Obj_t * pObj;
1030  Vec_Str_t * vStrExt;
1031  int i, nBufferSize, Pos;
1032  unsigned char * pBuffer;
1033  unsigned uLit0, uLit1, uLit;
1034  assert( pInit->nXors == 0 && pInit->nMuxes == 0 );
1035 
1036  if ( Gia_ManCoNum(pInit) == 0 )
1037  {
1038  printf( "AIG cannot be written because it has no POs.\n" );
1039  return;
1040  }
1041 
1042  // start the output stream
1043  pFile = fopen( pFileName, "wb" );
1044  if ( pFile == NULL )
1045  {
1046  fprintf( stdout, "Gia_AigerWrite(): Cannot open the output file \"%s\".\n", pFileName );
1047  return;
1048  }
1049 
1050  // create normalized AIG
1051  if ( !Gia_ManIsNormalized(pInit) )
1052  {
1053 // printf( "Gia_AigerWrite(): Normalizing AIG for writing.\n" );
1054  p = Gia_ManDupNormalize( pInit );
1055  Gia_ManTransferMapping( p, pInit );
1056  Gia_ManTransferPacking( p, pInit );
1057  Gia_ManTransferTiming( p, pInit );
1058  p->vNamesIn = pInit->vNamesIn; pInit->vNamesIn = NULL;
1059  p->vNamesOut = pInit->vNamesOut; pInit->vNamesOut = NULL;
1060  p->nConstrs = pInit->nConstrs; pInit->nConstrs = 0;
1061  }
1062  else
1063  p = pInit;
1064 
1065  // write the header "M I L O A" where M = I + L + A
1066  fprintf( pFile, "aig%s %u %u %u %u %u",
1067  fCompact? "2" : "",
1068  Gia_ManCiNum(p) + Gia_ManAndNum(p),
1069  Gia_ManPiNum(p),
1070  Gia_ManRegNum(p),
1071  Gia_ManConstrNum(p) ? 0 : Gia_ManPoNum(p),
1072  Gia_ManAndNum(p) );
1073  // write the extended header "B C J F"
1074  if ( Gia_ManConstrNum(p) )
1075  fprintf( pFile, " %u %u", Gia_ManPoNum(p) - Gia_ManConstrNum(p), Gia_ManConstrNum(p) );
1076  fprintf( pFile, "\n" );
1077 
1079  if ( !fCompact )
1080  {
1081  // write latch drivers
1082  Gia_ManForEachRi( p, pObj, i )
1083  fprintf( pFile, "%u\n", Gia_ObjFaninLit0p(p, pObj) );
1084  // write PO drivers
1085  Gia_ManForEachPo( p, pObj, i )
1086  fprintf( pFile, "%u\n", Gia_ObjFaninLit0p(p, pObj) );
1087  }
1088  else
1089  {
1090  Vec_Int_t * vLits = Gia_AigerCollectLiterals( p );
1091  Vec_Str_t * vBinary = Gia_AigerWriteLiterals( vLits );
1092  fwrite( Vec_StrArray(vBinary), 1, Vec_StrSize(vBinary), pFile );
1093  Vec_StrFree( vBinary );
1094  Vec_IntFree( vLits );
1095  }
1097 
1098  // write the nodes into the buffer
1099  Pos = 0;
1100  nBufferSize = 8 * Gia_ManAndNum(p) + 100; // skeptically assuming 3 chars per one AIG edge
1101  pBuffer = ABC_ALLOC( unsigned char, nBufferSize );
1102  Gia_ManForEachAnd( p, pObj, i )
1103  {
1104  uLit = Abc_Var2Lit( i, 0 );
1105  uLit0 = Gia_ObjFaninLit0( pObj, i );
1106  uLit1 = Gia_ObjFaninLit1( pObj, i );
1107  assert( Gia_ManBufNum(p) || uLit0 < uLit1 );
1108  Pos = Gia_AigerWriteUnsignedBuffer( pBuffer, Pos, uLit - uLit1 );
1109  Pos = Gia_AigerWriteUnsignedBuffer( pBuffer, Pos, uLit1 - uLit0 );
1110  if ( Pos > nBufferSize - 10 )
1111  {
1112  printf( "Gia_AigerWrite(): AIGER generation has failed because the allocated buffer is too small.\n" );
1113  fclose( pFile );
1114  if ( p != pInit )
1115  Gia_ManStop( p );
1116  return;
1117  }
1118  }
1119  assert( Pos < nBufferSize );
1120 
1121  // write the buffer
1122  fwrite( pBuffer, 1, Pos, pFile );
1123  ABC_FREE( pBuffer );
1124 
1125  // write the symbol table
1126  if ( p->vNamesIn && p->vNamesOut )
1127  {
1128  assert( Vec_PtrSize(p->vNamesIn) == Gia_ManCiNum(p) );
1129  assert( Vec_PtrSize(p->vNamesOut) == Gia_ManCoNum(p) );
1130  // write PIs
1131  Gia_ManForEachPi( p, pObj, i )
1132  fprintf( pFile, "i%d %s\n", i, (char *)Vec_PtrEntry(p->vNamesIn, i) );
1133  // write latches
1134  Gia_ManForEachRo( p, pObj, i )
1135  fprintf( pFile, "l%d %s\n", i, (char *)Vec_PtrEntry(p->vNamesIn, Gia_ManPiNum(p) + i) );
1136  // write POs
1137  Gia_ManForEachPo( p, pObj, i )
1138  fprintf( pFile, "o%d %s\n", i, (char *)Vec_PtrEntry(p->vNamesOut, i) );
1139  }
1140 
1141  // write the comment
1142 // fprintf( pFile, "c\n" );
1143  fprintf( pFile, "c" );
1144 
1145  // write additional AIG
1146  if ( p->pAigExtra )
1147  {
1148  fprintf( pFile, "a" );
1149  vStrExt = Gia_AigerWriteIntoMemoryStr( p->pAigExtra );
1150  Gia_FileWriteBufferSize( pFile, Vec_StrSize(vStrExt) );
1151  fwrite( Vec_StrArray(vStrExt), 1, Vec_StrSize(vStrExt), pFile );
1152  Vec_StrFree( vStrExt );
1153  if ( fVerbose ) printf( "Finished writing extension \"a\".\n" );
1154  }
1155  // write constraints
1156  if ( p->nConstrs )
1157  {
1158  fprintf( pFile, "c" );
1159  Gia_FileWriteBufferSize( pFile, 4 );
1160  Gia_FileWriteBufferSize( pFile, p->nConstrs );
1161  }
1162  // write timing information
1163  if ( p->nAnd2Delay )
1164  {
1165  fprintf( pFile, "d" );
1166  Gia_FileWriteBufferSize( pFile, 4 );
1167  Gia_FileWriteBufferSize( pFile, p->nAnd2Delay );
1168  }
1169  if ( p->pManTime )
1170  {
1171  float * pTimes;
1172  pTimes = Tim_ManGetArrTimes( (Tim_Man_t *)p->pManTime );
1173  if ( pTimes )
1174  {
1175  fprintf( pFile, "i" );
1176  Gia_FileWriteBufferSize( pFile, 4*Tim_ManPiNum((Tim_Man_t *)p->pManTime) );
1177  fwrite( pTimes, 1, 4*Tim_ManPiNum((Tim_Man_t *)p->pManTime), pFile );
1178  ABC_FREE( pTimes );
1179  if ( fVerbose ) printf( "Finished writing extension \"i\".\n" );
1180  }
1181  pTimes = Tim_ManGetReqTimes( (Tim_Man_t *)p->pManTime );
1182  if ( pTimes )
1183  {
1184  fprintf( pFile, "o" );
1185  Gia_FileWriteBufferSize( pFile, 4*Tim_ManPoNum((Tim_Man_t *)p->pManTime) );
1186  fwrite( pTimes, 1, 4*Tim_ManPoNum((Tim_Man_t *)p->pManTime), pFile );
1187  ABC_FREE( pTimes );
1188  if ( fVerbose ) printf( "Finished writing extension \"o\".\n" );
1189  }
1190  }
1191  // write equivalences
1192  if ( p->pReprs && p->pNexts )
1193  {
1194  extern Vec_Str_t * Gia_WriteEquivClasses( Gia_Man_t * p );
1195  fprintf( pFile, "e" );
1196  vStrExt = Gia_WriteEquivClasses( p );
1197  Gia_FileWriteBufferSize( pFile, Vec_StrSize(vStrExt) );
1198  fwrite( Vec_StrArray(vStrExt), 1, Vec_StrSize(vStrExt), pFile );
1199  Vec_StrFree( vStrExt );
1200  }
1201  // write flop classes
1202  if ( p->vFlopClasses )
1203  {
1204  fprintf( pFile, "f" );
1205  Gia_FileWriteBufferSize( pFile, 4*Gia_ManRegNum(p) );
1206  assert( Vec_IntSize(p->vFlopClasses) == Gia_ManRegNum(p) );
1207  fwrite( Vec_IntArray(p->vFlopClasses), 1, 4*Gia_ManRegNum(p), pFile );
1208  }
1209  // write gate classes
1210  if ( p->vGateClasses )
1211  {
1212  fprintf( pFile, "g" );
1213  Gia_FileWriteBufferSize( pFile, 4*Gia_ManObjNum(p) );
1214  assert( Vec_IntSize(p->vGateClasses) == Gia_ManObjNum(p) );
1215  fwrite( Vec_IntArray(p->vGateClasses), 1, 4*Gia_ManObjNum(p), pFile );
1216  }
1217  // write hierarchy info
1218  if ( p->pManTime )
1219  {
1220  fprintf( pFile, "h" );
1221  vStrExt = Tim_ManSave( (Tim_Man_t *)p->pManTime, 1 );
1222  Gia_FileWriteBufferSize( pFile, Vec_StrSize(vStrExt) );
1223  fwrite( Vec_StrArray(vStrExt), 1, Vec_StrSize(vStrExt), pFile );
1224  Vec_StrFree( vStrExt );
1225  if ( fVerbose ) printf( "Finished writing extension \"h\".\n" );
1226  }
1227  // write packing
1228  if ( p->vPacking )
1229  {
1230  extern Vec_Str_t * Gia_WritePacking( Vec_Int_t * vPacking );
1231  fprintf( pFile, "k" );
1232  vStrExt = Gia_WritePacking( p->vPacking );
1233  Gia_FileWriteBufferSize( pFile, Vec_StrSize(vStrExt) );
1234  fwrite( Vec_StrArray(vStrExt), 1, Vec_StrSize(vStrExt), pFile );
1235  Vec_StrFree( vStrExt );
1236  if ( fVerbose ) printf( "Finished writing extension \"k\".\n" );
1237  }
1238  // write mapping
1239  if ( Gia_ManHasMapping(p) )
1240  {
1241  extern Vec_Str_t * Gia_AigerWriteMapping( Gia_Man_t * p );
1244  fprintf( pFile, "m" );
1245  vStrExt = Gia_AigerWriteMappingDoc( p );
1246  Gia_FileWriteBufferSize( pFile, Vec_StrSize(vStrExt) );
1247  fwrite( Vec_StrArray(vStrExt), 1, Vec_StrSize(vStrExt), pFile );
1248  Vec_StrFree( vStrExt );
1249  if ( fVerbose ) printf( "Finished writing extension \"m\".\n" );
1250  }
1251  // write placement
1252  if ( p->pPlacement )
1253  {
1254  fprintf( pFile, "p" );
1255  Gia_FileWriteBufferSize( pFile, 4*Gia_ManObjNum(p) );
1256  fwrite( p->pPlacement, 1, 4*Gia_ManObjNum(p), pFile );
1257  }
1258  // write register classes
1259  if ( p->vRegClasses )
1260  {
1261  int i;
1262  fprintf( pFile, "r" );
1263  Gia_FileWriteBufferSize( pFile, 4*Vec_IntSize(p->vRegClasses) );
1264  for ( i = 0; i < Vec_IntSize(p->vRegClasses); i++ )
1265  Gia_FileWriteBufferSize( pFile, Vec_IntEntry(p->vRegClasses, i) );
1266  }
1267  // write choices
1268  if ( Gia_ManHasChoices(p) )
1269  {
1270  int i, nPairs = 0;
1271  fprintf( pFile, "q" );
1272  for ( i = 0; i < Gia_ManObjNum(p); i++ )
1273  nPairs += (Gia_ObjSibl(p, i) > 0);
1274  Gia_FileWriteBufferSize( pFile, 4*(nPairs * 2 + 1) );
1275  Gia_FileWriteBufferSize( pFile, nPairs );
1276  for ( i = 0; i < Gia_ManObjNum(p); i++ )
1277  if ( Gia_ObjSibl(p, i) )
1278  {
1279  assert( i > Gia_ObjSibl(p, i) );
1280  Gia_FileWriteBufferSize( pFile, i );
1281  Gia_FileWriteBufferSize( pFile, Gia_ObjSibl(p, i) );
1282  }
1283  if ( fVerbose ) printf( "Finished writing extension \"q\".\n" );
1284  }
1285  // write switching activity
1286  if ( p->pSwitching )
1287  {
1288  fprintf( pFile, "u" );
1290  fwrite( p->pSwitching, 1, Gia_ManObjNum(p), pFile );
1291  }
1292 /*
1293  // write timing information
1294  if ( p->pManTime )
1295  {
1296  fprintf( pFile, "t" );
1297  vStrExt = Tim_ManSave( (Tim_Man_t *)p->pManTime, 0 );
1298  Gia_FileWriteBufferSize( pFile, Vec_StrSize(vStrExt) );
1299  fwrite( Vec_StrArray(vStrExt), 1, Vec_StrSize(vStrExt), pFile );
1300  Vec_StrFree( vStrExt );
1301  }
1302 */
1303  // write object classes
1304  if ( p->vObjClasses )
1305  {
1306  fprintf( pFile, "v" );
1307  Gia_FileWriteBufferSize( pFile, 4*Gia_ManObjNum(p) );
1308  assert( Vec_IntSize(p->vObjClasses) == Gia_ManObjNum(p) );
1309  fwrite( Vec_IntArray(p->vObjClasses), 1, 4*Gia_ManObjNum(p), pFile );
1310  }
1311  // write name
1312  if ( p->pName )
1313  {
1314  fprintf( pFile, "n" );
1315  Gia_FileWriteBufferSize( pFile, strlen(p->pName)+1 );
1316  fwrite( p->pName, 1, strlen(p->pName), pFile );
1317  fprintf( pFile, "%c", '\0' );
1318  }
1319  // write comments
1320  fprintf( pFile, "\nThis file was produced by the GIA package in ABC on %s\n", Gia_TimeStamp() );
1321  fprintf( pFile, "For information about AIGER format, refer to %s\n", "http://fmv.jku.at/aiger" );
1322  fclose( pFile );
1323  if ( p != pInit )
1324  {
1325  pInit->pManTime = p->pManTime; p->pManTime = NULL;
1326  pInit->vNamesIn = p->vNamesIn; p->vNamesIn = NULL;
1327  pInit->vNamesOut = p->vNamesOut; p->vNamesOut = NULL;
1328  Gia_ManStop( p );
1329  }
1330 }
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
static int Gia_ObjFaninLit0(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:466
void Gia_ManInvertConstraints(Gia_Man_t *pAig)
Definition: giaUtil.c:1415
Vec_Str_t * Tim_ManSave(Tim_Man_t *p, int fHieOnly)
FUNCTION DEFINITIONS ///.
Definition: timDump.c:46
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
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 char * Vec_StrArray(Vec_Str_t *p)
Definition: vecStr.h:272
static int Gia_ObjFaninLit0p(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:469
ush Pos
Definition: deflate.h:88
Vec_Str_t * Gia_AigerWriteMappingDoc(Gia_Man_t *p)
Definition: giaAigerExt.c:267
static int Gia_ManConstrNum(Gia_Man_t *p)
Definition: gia.h:395
char * Gia_TimeStamp()
Definition: giaUtil.c:101
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
#define XAIG_VERBOSE
Definition: giaAiger.c:28
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Definition: gia.h:75
static int Gia_ManHasChoices(Gia_Man_t *p)
Definition: gia.h:397
int nXors
Definition: gia.h:105
int Tim_ManPiNum(Tim_Man_t *p)
Definition: timMan.c:688
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
static int Gia_ObjSibl(Gia_Man_t *p, int Id)
Definition: gia.h:893
Vec_Str_t * Gia_AigerWriteMappingSimple(Gia_Man_t *p)
Definition: giaAigerExt.c:226
Vec_Int_t * Gia_AigerCollectLiterals(Gia_Man_t *p)
Definition: giaAiger.c:97
int nConstrs
Definition: gia.h:117
static int Gia_ObjFaninLit1(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:467
static void Vec_StrFree(Vec_Str_t *p)
Definition: bblif.c:616
Gia_Man_t * Gia_ManDupNormalize(Gia_Man_t *p)
Definition: giaTim.c:134
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Vec_Str_t * Gia_AigerWriteMapping(Gia_Man_t *p)
Definition: giaAigerExt.c:201
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
Vec_Str_t * Gia_WriteEquivClasses(Gia_Man_t *p)
Definition: giaAigerExt.c:118
void * pManTime
Definition: gia.h:165
void Gia_ManTransferTiming(Gia_Man_t *p, Gia_Man_t *pGia)
Definition: giaIf.c:1912
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
Vec_Ptr_t * vNamesOut
Definition: gia.h:156
float * Tim_ManGetReqTimes(Tim_Man_t *p)
Definition: timMan.c:494
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Vec_StrSize(Vec_Str_t *p)
Definition: bblif.c:600
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Gia_ManHasMapping(Gia_Man_t *p)
Definition: gia.h:951
void Gia_FileWriteBufferSize(FILE *pFile, int nSize)
Definition: giaAiger.c:79
#define ABC_FREE(obj)
Definition: abc_global.h:232
Definition: gia.h:95
int Gia_ManIsNormalized(Gia_Man_t *p)
Definition: giaTim.c:109
static int Gia_ManBufNum(Gia_Man_t *p)
Definition: gia.h:392
void Gia_ManTransferPacking(Gia_Man_t *p, Gia_Man_t *pGia)
Definition: giaIf.c:1878
#define Gia_ManForEachRo(p, pObj, i)
Definition: gia.h:1038
void Gia_ManTransferMapping(Gia_Man_t *p, Gia_Man_t *pGia)
Definition: giaIf.c:1855
#define assert(ex)
Definition: util_old.h:213
int strlen()
Vec_Str_t * Gia_AigerWriteIntoMemoryStr(Gia_Man_t *p)
Definition: giaAiger.c:866
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
#define Gia_ManForEachRi(p, pObj, i)
Definition: gia.h:1040
Vec_Ptr_t * vNamesIn
Definition: gia.h:155
static int Gia_AigerWriteUnsignedBuffer(unsigned char *pBuffer, int Pos, unsigned x)
Definition: gia.h:872
Vec_Str_t * Gia_WritePacking(Vec_Int_t *vPacking)
Definition: giaAigerExt.c:311
float * Tim_ManGetArrTimes(Tim_Man_t *p)
Definition: timMan.c:479
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
int nMuxes
Definition: gia.h:106
int Tim_ManPoNum(Tim_Man_t *p)
Definition: timMan.c:694
Vec_Str_t * Gia_AigerWriteLiterals(Vec_Int_t *vLits)
Definition: giaAiger.c:129
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
static void Gia_AigerWriteInt ( unsigned char *  pPos,
int  Value 
)
inlinestatic

Definition at line 834 of file gia.h.

835 {
836  int i;
837  for ( i = 3; i >= 0; i-- )
838  *pPos++ = (Value >> (8*i)) & 255;
839 }
Vec_Str_t* Gia_AigerWriteIntoMemoryStr ( Gia_Man_t p)

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

Synopsis [Writes the AIG in into the memory buffer.]

Description [The resulting buffer constains the AIG in AIGER format. The resulting buffer should be deallocated by the user.]

SideEffects []

SeeAlso []

Definition at line 866 of file giaAiger.c.

867 {
868  Vec_Str_t * vBuffer;
869  Gia_Obj_t * pObj;
870  int nNodes = 0, i, uLit, uLit0, uLit1;
871  // set the node numbers to be used in the output file
872  Gia_ManConst0(p)->Value = nNodes++;
873  Gia_ManForEachCi( p, pObj, i )
874  pObj->Value = nNodes++;
875  Gia_ManForEachAnd( p, pObj, i )
876  pObj->Value = nNodes++;
877 
878  // write the header "M I L O A" where M = I + L + A
879  vBuffer = Vec_StrAlloc( 3*Gia_ManObjNum(p) );
880  Vec_StrPrintStr( vBuffer, "aig " );
881  Vec_StrPrintNum( vBuffer, Gia_ManCandNum(p) );
882  Vec_StrPrintStr( vBuffer, " " );
883  Vec_StrPrintNum( vBuffer, Gia_ManPiNum(p) );
884  Vec_StrPrintStr( vBuffer, " " );
885  Vec_StrPrintNum( vBuffer, Gia_ManRegNum(p) );
886  Vec_StrPrintStr( vBuffer, " " );
887  Vec_StrPrintNum( vBuffer, Gia_ManPoNum(p) );
888  Vec_StrPrintStr( vBuffer, " " );
889  Vec_StrPrintNum( vBuffer, Gia_ManAndNum(p) );
890  Vec_StrPrintStr( vBuffer, "\n" );
891 
892  // write latch drivers
893  Gia_ManForEachRi( p, pObj, i )
894  {
895  uLit = Abc_Var2Lit( Gia_ObjValue(Gia_ObjFanin0(pObj)), Gia_ObjFaninC0(pObj) );
896  Vec_StrPrintNum( vBuffer, uLit );
897  Vec_StrPrintStr( vBuffer, "\n" );
898  }
899 
900  // write PO drivers
901  Gia_ManForEachPo( p, pObj, i )
902  {
903  uLit = Abc_Var2Lit( Gia_ObjValue(Gia_ObjFanin0(pObj)), Gia_ObjFaninC0(pObj) );
904  Vec_StrPrintNum( vBuffer, uLit );
905  Vec_StrPrintStr( vBuffer, "\n" );
906  }
907  // write the nodes into the buffer
908  Gia_ManForEachAnd( p, pObj, i )
909  {
910  uLit = Abc_Var2Lit( Gia_ObjValue(pObj), 0 );
911  uLit0 = Abc_Var2Lit( Gia_ObjValue(Gia_ObjFanin0(pObj)), Gia_ObjFaninC0(pObj) );
912  uLit1 = Abc_Var2Lit( Gia_ObjValue(Gia_ObjFanin1(pObj)), Gia_ObjFaninC1(pObj) );
913  assert( uLit0 != uLit1 );
914  if ( uLit0 > uLit1 )
915  {
916  int Temp = uLit0;
917  uLit0 = uLit1;
918  uLit1 = Temp;
919  }
920  Gia_AigerWriteUnsigned( vBuffer, uLit - uLit1 );
921  Gia_AigerWriteUnsigned( vBuffer, uLit1 - uLit0 );
922  }
923  Vec_StrPrintStr( vBuffer, "c" );
924  return vBuffer;
925 }
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static void Vec_StrPrintNum(Vec_Str_t *p, int Num)
Definition: vecStr.h:575
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
static int Gia_ObjValue(Gia_Obj_t *pObj)
Definition: gia.h:413
static Vec_Str_t * Vec_StrAlloc(int nCap)
Definition: bblif.c:495
static void Gia_AigerWriteUnsigned(Vec_Str_t *vStr, unsigned x)
Definition: gia.h:848
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
static int Gia_ManCandNum(Gia_Man_t *p)
Definition: gia.h:394
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
static void Vec_StrPrintStr(Vec_Str_t *p, const char *pStr)
Definition: vecStr.h:627
#define Gia_ManForEachRi(p, pObj, i)
Definition: gia.h:1040
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Vec_Str_t* Gia_AigerWriteIntoMemoryStrPart ( Gia_Man_t p,
Vec_Int_t vCis,
Vec_Int_t vAnds,
Vec_Int_t vCos,
int  nRegs 
)

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

Synopsis [Writes the AIG in into the memory buffer.]

Description [The resulting buffer constains the AIG in AIGER format. The CI/CO/AND nodes are assumed to be ordered according to some rule. The resulting buffer should be deallocated by the user.]

SideEffects [Note that in vCos, PIs are order first, followed by latches!]

SeeAlso []

Definition at line 940 of file giaAiger.c.

941 {
942  Vec_Str_t * vBuffer;
943  Gia_Obj_t * pObj;
944  int nNodes = 0, i, uLit, uLit0, uLit1;
945  // set the node numbers to be used in the output file
946  Gia_ManConst0(p)->Value = nNodes++;
947  Gia_ManForEachObjVec( vCis, p, pObj, i )
948  {
949  assert( Gia_ObjIsCi(pObj) );
950  pObj->Value = nNodes++;
951  }
952  Gia_ManForEachObjVec( vAnds, p, pObj, i )
953  {
954  assert( Gia_ObjIsAnd(pObj) );
955  pObj->Value = nNodes++;
956  }
957 
958  // write the header "M I L O A" where M = I + L + A
959  vBuffer = Vec_StrAlloc( 3*Gia_ManObjNum(p) );
960  Vec_StrPrintStr( vBuffer, "aig " );
961  Vec_StrPrintNum( vBuffer, Vec_IntSize(vCis) + Vec_IntSize(vAnds) );
962  Vec_StrPrintStr( vBuffer, " " );
963  Vec_StrPrintNum( vBuffer, Vec_IntSize(vCis) - nRegs );
964  Vec_StrPrintStr( vBuffer, " " );
965  Vec_StrPrintNum( vBuffer, nRegs );
966  Vec_StrPrintStr( vBuffer, " " );
967  Vec_StrPrintNum( vBuffer, Vec_IntSize(vCos) - nRegs );
968  Vec_StrPrintStr( vBuffer, " " );
969  Vec_StrPrintNum( vBuffer, Vec_IntSize(vAnds) );
970  Vec_StrPrintStr( vBuffer, "\n" );
971 
972  // write latch drivers
973  Gia_ManForEachObjVec( vCos, p, pObj, i )
974  {
975  assert( Gia_ObjIsCo(pObj) );
976  if ( i < Vec_IntSize(vCos) - nRegs )
977  continue;
978  uLit = Abc_Var2Lit( Gia_ObjValue(Gia_ObjFanin0(pObj)), Gia_ObjFaninC0(pObj) );
979  Vec_StrPrintNum( vBuffer, uLit );
980  Vec_StrPrintStr( vBuffer, "\n" );
981  }
982  // write output drivers
983  Gia_ManForEachObjVec( vCos, p, pObj, i )
984  {
985  assert( Gia_ObjIsCo(pObj) );
986  if ( i >= Vec_IntSize(vCos) - nRegs )
987  continue;
988  uLit = Abc_Var2Lit( Gia_ObjValue(Gia_ObjFanin0(pObj)), Gia_ObjFaninC0(pObj) );
989  Vec_StrPrintNum( vBuffer, uLit );
990  Vec_StrPrintStr( vBuffer, "\n" );
991  }
992 
993  // write the nodes into the buffer
994  Gia_ManForEachObjVec( vAnds, p, pObj, i )
995  {
996  uLit = Abc_Var2Lit( Gia_ObjValue(pObj), 0 );
997  uLit0 = Abc_Var2Lit( Gia_ObjValue(Gia_ObjFanin0(pObj)), Gia_ObjFaninC0(pObj) );
998  uLit1 = Abc_Var2Lit( Gia_ObjValue(Gia_ObjFanin1(pObj)), Gia_ObjFaninC1(pObj) );
999  assert( uLit0 != uLit1 );
1000  if ( uLit0 > uLit1 )
1001  {
1002  int Temp = uLit0;
1003  uLit0 = uLit1;
1004  uLit1 = Temp;
1005  }
1006  Gia_AigerWriteUnsigned( vBuffer, uLit - uLit1 );
1007  Gia_AigerWriteUnsigned( vBuffer, uLit1 - uLit0 );
1008  }
1009  Vec_StrPrintStr( vBuffer, "c" );
1010  return vBuffer;
1011 }
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static void Vec_StrPrintNum(Vec_Str_t *p, int Num)
Definition: vecStr.h:575
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
static int Gia_ObjValue(Gia_Obj_t *pObj)
Definition: gia.h:413
static Vec_Str_t * Vec_StrAlloc(int nCap)
Definition: bblif.c:495
static void Gia_AigerWriteUnsigned(Vec_Str_t *vStr, unsigned x)
Definition: gia.h:848
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition: gia.h:988
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
static void Vec_StrPrintStr(Vec_Str_t *p, const char *pStr)
Definition: vecStr.h:627
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_AigerWriteSimple ( Gia_Man_t pInit,
char *  pFileName 
)

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

Synopsis [Writes the AIG in the binary AIGER format.]

Description []

SideEffects []

SeeAlso []

Definition at line 1361 of file giaAiger.c.

1362 {
1363  FILE * pFile;
1364  Vec_Str_t * vStr;
1365  if ( Gia_ManPoNum(pInit) == 0 )
1366  {
1367  printf( "Gia_AigerWriteSimple(): AIG cannot be written because it has no POs.\n" );
1368  return;
1369  }
1370  // start the output stream
1371  pFile = fopen( pFileName, "wb" );
1372  if ( pFile == NULL )
1373  {
1374  fprintf( stdout, "Gia_AigerWriteSimple(): Cannot open the output file \"%s\".\n", pFileName );
1375  return;
1376  }
1377  // write the buffer
1378  vStr = Gia_AigerWriteIntoMemoryStr( pInit );
1379  fwrite( Vec_StrArray(vStr), 1, Vec_StrSize(vStr), pFile );
1380  Vec_StrFree( vStr );
1381  fclose( pFile );
1382 }
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static char * Vec_StrArray(Vec_Str_t *p)
Definition: vecStr.h:272
static void Vec_StrFree(Vec_Str_t *p)
Definition: bblif.c:616
static int Vec_StrSize(Vec_Str_t *p)
Definition: bblif.c:600
Vec_Str_t * Gia_AigerWriteIntoMemoryStr(Gia_Man_t *p)
Definition: giaAiger.c:866
static void Gia_AigerWriteUnsigned ( Vec_Str_t vStr,
unsigned  x 
)
inlinestatic

Definition at line 848 of file gia.h.

849 {
850  unsigned char ch;
851  while (x & ~0x7f)
852  {
853  ch = (x & 0x7f) | 0x80;
854  Vec_StrPush( vStr, ch );
855  x >>= 7;
856  }
857  ch = x;
858  Vec_StrPush( vStr, ch );
859 }
static void Vec_StrPush(Vec_Str_t *p, char Entry)
Definition: vecStr.h:535
static int Gia_AigerWriteUnsignedBuffer ( unsigned char *  pBuffer,
int  Pos,
unsigned  x 
)
inlinestatic

Definition at line 872 of file gia.h.

873 {
874  unsigned char ch;
875  while (x & ~0x7f)
876  {
877  ch = (x & 0x7f) | 0x80;
878  pBuffer[Pos++] = ch;
879  x >>= 7;
880  }
881  ch = x;
882  pBuffer[Pos++] = ch;
883  return Pos;
884 }
ush Pos
Definition: deflate.h:88
static void Gia_AigerWriteUnsignedFile ( FILE *  pFile,
unsigned  x 
)
inlinestatic

Definition at line 860 of file gia.h.

861 {
862  unsigned char ch;
863  while (x & ~0x7f)
864  {
865  ch = (x & 0x7f) | 0x80;
866  fputc( ch, pFile );
867  x >>= 7;
868  }
869  ch = x;
870  fputc( ch, pFile );
871 }
static int Gia_ClassIsPair ( Gia_Man_t p,
int  i 
)
inlinestatic

Definition at line 922 of file gia.h.

922 { assert( Gia_ObjIsHead(p, i) ); assert( Gia_ObjNext(p, i) ); return Gia_ObjNext(p, Gia_ObjNext(p, i)) == 0; }
static int Gia_ObjIsHead(Gia_Man_t *p, int Id)
Definition: gia.h:916
static int Gia_ObjNext(Gia_Man_t *p, int Id)
Definition: gia.h:912
#define assert(ex)
Definition: util_old.h:213
static void Gia_ClassUndoPair ( Gia_Man_t p,
int  i 
)
inlinestatic

Definition at line 923 of file gia.h.

923 { assert( Gia_ClassIsPair(p,i) ); Gia_ObjSetRepr(p, Gia_ObjNext(p, i), GIA_VOID); Gia_ObjSetNext(p, i, 0); }
static void Gia_ObjSetRepr(Gia_Man_t *p, int Id, int Num)
Definition: gia.h:888
static int Gia_ObjNext(Gia_Man_t *p, int Id)
Definition: gia.h:912
static void Gia_ObjSetNext(Gia_Man_t *p, int Id, int Num)
Definition: gia.h:913
#define GIA_VOID
Definition: gia.h:45
#define assert(ex)
Definition: util_old.h:213
static int Gia_ClassIsPair(Gia_Man_t *p, int i)
Definition: gia.h:922
void Gia_DumpAiger ( Gia_Man_t p,
char *  pFilePrefix,
int  iFileNum,
int  nFileNumDigits 
)

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

Synopsis [Writes the AIG in the binary AIGER format.]

Description []

SideEffects []

SeeAlso []

Definition at line 1343 of file giaAiger.c.

1344 {
1345  char Buffer[100];
1346  sprintf( Buffer, "%s%0*d.aig", pFilePrefix, nFileNumDigits, iFileNum );
1347  Gia_AigerWrite( p, Buffer, 0, 0 );
1348 }
char * sprintf()
void Gia_AigerWrite(Gia_Man_t *pInit, char *pFileName, int fWriteSymbols, int fCompact)
Definition: giaAiger.c:1024
char* Gia_FileNameGenericAppend ( char *  pBase,
char *  pSuffix 
)

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

Synopsis [Returns the composite name of the file.]

Description []

SideEffects []

SeeAlso []

Definition at line 125 of file giaUtil.c.

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

FUNCTION DECLARATIONS ///.

Definition at line 64 of file giaAiger.c.

65 {
66  FILE * pFile;
67  int nFileSize;
68  pFile = fopen( pFileName, "r" );
69  if ( pFile == NULL )
70  {
71  printf( "Gia_FileSize(): The file is unavailable (absent or open).\n" );
72  return 0;
73  }
74  fseek( pFile, 0, SEEK_END );
75  nFileSize = ftell( pFile );
76  fclose( pFile );
77  return nFileSize;
78 }
#define SEEK_END
Definition: zconf.h:392
static int Gia_IsComplement ( Gia_Obj_t p)
inlinestatic

Definition at line 380 of file gia.h.

380 { return (int)((ABC_PTRUINT_T)(p) & 01); }
static Gia_Obj_t* Gia_Lit2Obj ( Gia_Man_t p,
int  iLit 
)
inlinestatic

Definition at line 434 of file gia.h.

434 { return Gia_NotCond(Gia_ManObj(p, Abc_Lit2Var(iLit)), Abc_LitIsCompl(iLit)); }
static Gia_Obj_t * Gia_NotCond(Gia_Obj_t *p, int c)
Definition: gia.h:379
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
Gia_Man_t* Gia_ManAigSyn2 ( Gia_Man_t pInit,
int  fOldAlgo,
int  fCoarsen,
int  fCutMin,
int  nRelaxRatio,
int  fDelayMin,
int  fVerbose,
int  fVeryVerbose 
)

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

Synopsis [Synthesis script.]

Description []

SideEffects []

SeeAlso []

Definition at line 69 of file giaScript.c.

70 {
71  Gia_Man_t * p, * pNew, * pTemp;
72  Jf_Par_t Pars, * pPars = &Pars;
73  if ( fOldAlgo )
74  {
75  Jf_ManSetDefaultPars( pPars );
76  pPars->fCutMin = fCutMin;
77  }
78  else
79  {
80  Lf_ManSetDefaultPars( pPars );
81  pPars->fCutMin = fCutMin;
82  pPars->fCoarsen = fCoarsen;
83  pPars->nRelaxRatio = nRelaxRatio;
84  pPars->nAreaTuner = 1;
85  pPars->nCutNum = 4;
86  }
87  if ( fVerbose ) Gia_ManPrintStats( pInit, NULL );
88  p = Gia_ManDup( pInit );
89  Gia_ManTransferTiming( p, pInit );
90  if ( Gia_ManAndNum(p) == 0 )
91  return p;
92  // delay optimization
93  if ( fDelayMin && p->pManTime == NULL )
94  {
95  int Area0, Area1, Delay0, Delay1;
96  int fCutMin = pPars->fCutMin;
97  int fCoarsen = pPars->fCoarsen;
98  int nRelaxRatio = pPars->nRelaxRatio;
99  pPars->fCutMin = 0;
100  pPars->fCoarsen = 0;
101  pPars->nRelaxRatio = 0;
102  // perform mapping
103  if ( fOldAlgo )
104  Jf_ManPerformMapping( p, pPars );
105  else
106  Lf_ManPerformMapping( p, pPars );
107  Area0 = (int)pPars->Area;
108  Delay0 = (int)pPars->Delay;
109  // perform balancing
110  pNew = Gia_ManPerformDsdBalance( p, 6, 4, 0, 0 );
111  // perform mapping again
112  if ( fOldAlgo )
113  Jf_ManPerformMapping( pNew, pPars );
114  else
115  Lf_ManPerformMapping( pNew, pPars );
116  Area1 = (int)pPars->Area;
117  Delay1 = (int)pPars->Delay;
118  // choose the best result
119  if ( Delay1 < Delay0 - 1 || (Delay1 == Delay0 + 1 && 100.0 * (Area1 - Area0) / Area1 < 3.0) )
120  {
121  Gia_ManStop( p );
122  p = pNew;
123  }
124  else
125  {
126  Gia_ManStop( pNew );
127  Vec_IntFreeP( &p->vMapping );
128  }
129  // reset params
130  pPars->fCutMin = fCutMin;
131  pPars->fCoarsen = fCoarsen;
132  pPars->nRelaxRatio = nRelaxRatio;
133  }
134  // perform balancing
135  pNew = Gia_ManAreaBalance( p, 0, ABC_INFINITY, fVeryVerbose, 0 );
136  if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
137  Gia_ManStop( p );
138  // perform mapping
139  if ( fOldAlgo )
140  pNew = Jf_ManPerformMapping( pTemp = pNew, pPars );
141  else
142  pNew = Lf_ManPerformMapping( pTemp = pNew, pPars );
143  if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
144  if ( pTemp != pNew )
145  Gia_ManStop( pTemp );
146  // perform balancing
147  pNew = Gia_ManAreaBalance( pTemp = pNew, 0, ABC_INFINITY, fVeryVerbose, 0 );
148  if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
149  Gia_ManStop( pTemp );
150  return pNew;
151 }
Gia_Man_t * Jf_ManPerformMapping(Gia_Man_t *pGia, Jf_Par_t *pPars)
Definition: giaJf.c:1712
void Lf_ManSetDefaultPars(Jf_Par_t *pPars)
Definition: giaLf.c:1981
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition: giaDup.c:552
int nCutNum
Definition: gia.h:268
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
void Gia_ManPrintStats(Gia_Man_t *p, Gps_Par_t *pPars)
Definition: giaMan.c:389
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Gia_Man_t * Lf_ManPerformMapping(Gia_Man_t *pGia, Jf_Par_t *pPars)
Definition: giaLf.c:2193
int nAreaTuner
Definition: gia.h:274
Gia_Man_t * Gia_ManPerformDsdBalance(Gia_Man_t *p, int nLutSize, int nCutNum, int nRelaxRatio, int fVerbose)
Definition: giaIf.c:2058
int nRelaxRatio
Definition: gia.h:272
word Delay
Definition: gia.h:297
word Area
Definition: gia.h:298
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
Definition: gia.h:265
void Jf_ManSetDefaultPars(Jf_Par_t *pPars)
Definition: giaJf.c:1679
void * pManTime
Definition: gia.h:165
void Gia_ManTransferTiming(Gia_Man_t *p, Gia_Man_t *pGia)
Definition: giaIf.c:1912
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
Definition: gia.h:95
int fCutMin
Definition: gia.h:282
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
Gia_Man_t * Gia_ManAreaBalance(Gia_Man_t *p, int fSimpleAnd, int nNewNodesMax, int fVerbose, int fVeryVerbose)
Definition: giaBalAig.c:968
Vec_Int_t * vMapping
Definition: gia.h:131
int fCoarsen
Definition: gia.h:281
Gia_Man_t* Gia_ManAigSyn3 ( Gia_Man_t p,
int  fVerbose,
int  fVeryVerbose 
)

Definition at line 152 of file giaScript.c.

153 {
154  Gia_Man_t * pNew, * pTemp;
155  Jf_Par_t Pars, * pPars = &Pars;
156  Jf_ManSetDefaultPars( pPars );
157  pPars->nRelaxRatio = 40;
158  if ( fVerbose ) Gia_ManPrintStats( p, NULL );
159  if ( Gia_ManAndNum(p) == 0 )
160  return Gia_ManDup(p);
161  // perform balancing
162  pNew = Gia_ManAreaBalance( p, 0, ABC_INFINITY, fVeryVerbose, 0 );
163  if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
164  // perform mapping
165  pPars->nLutSize = 6;
166  pNew = Jf_ManPerformMapping( pTemp = pNew, pPars );
167  if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
168 // Gia_ManStop( pTemp );
169  // perform balancing
170  pNew = Gia_ManAreaBalance( pTemp = pNew, 0, ABC_INFINITY, fVeryVerbose, 0 );
171  if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
172  Gia_ManStop( pTemp );
173  // perform mapping
174  pPars->nLutSize = 4;
175  pNew = Jf_ManPerformMapping( pTemp = pNew, pPars );
176  if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
177 // Gia_ManStop( pTemp );
178  // perform balancing
179  pNew = Gia_ManAreaBalance( pTemp = pNew, 0, ABC_INFINITY, fVeryVerbose, 0 );
180  if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
181  Gia_ManStop( pTemp );
182  return pNew;
183 }
Gia_Man_t * Jf_ManPerformMapping(Gia_Man_t *pGia, Jf_Par_t *pPars)
Definition: giaJf.c:1712
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition: giaDup.c:552
int nLutSize
Definition: gia.h:267
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
void Gia_ManPrintStats(Gia_Man_t *p, Gps_Par_t *pPars)
Definition: giaMan.c:389
int nRelaxRatio
Definition: gia.h:272
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
Definition: gia.h:265
void Jf_ManSetDefaultPars(Jf_Par_t *pPars)
Definition: giaJf.c:1679
Definition: gia.h:95
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
Gia_Man_t * Gia_ManAreaBalance(Gia_Man_t *p, int fSimpleAnd, int nNewNodesMax, int fVerbose, int fVeryVerbose)
Definition: giaBalAig.c:968
Gia_Man_t* Gia_ManAigSyn4 ( Gia_Man_t p,
int  fVerbose,
int  fVeryVerbose 
)

Definition at line 184 of file giaScript.c.

185 {
186  Gia_Man_t * pNew, * pTemp;
187  Jf_Par_t Pars, * pPars = &Pars;
188  Jf_ManSetDefaultPars( pPars );
189  pPars->nRelaxRatio = 40;
190  if ( fVerbose ) Gia_ManPrintStats( p, NULL );
191  if ( Gia_ManAndNum(p) == 0 )
192  return Gia_ManDup(p);
193 //Gia_ManAigPrintPiLevels( p );
194  // perform balancing
195  pNew = Gia_ManAreaBalance( p, 0, ABC_INFINITY, fVeryVerbose, 0 );
196  if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
197  // perform mapping
198  pPars->nLutSize = 7;
199  pNew = Jf_ManPerformMapping( pTemp = pNew, pPars );
200  if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
201 // Gia_ManStop( pTemp );
202  // perform extraction
203  pNew = Gia_ManPerformFx( pTemp = pNew, ABC_INFINITY, 0, 0, fVeryVerbose, 0 );
204  if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
205  Gia_ManStop( pTemp );
206  // perform balancing
207  pNew = Gia_ManAreaBalance( pTemp = pNew, 0, ABC_INFINITY, fVeryVerbose, 0 );
208  if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
209  Gia_ManStop( pTemp );
210  // perform mapping
211  pPars->nLutSize = 5;
212  pNew = Jf_ManPerformMapping( pTemp = pNew, pPars );
213  if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
214 // Gia_ManStop( pTemp );
215  // perform extraction
216  pNew = Gia_ManPerformFx( pTemp = pNew, ABC_INFINITY, 0, 0, fVeryVerbose, 0 );
217  if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
218  Gia_ManStop( pTemp );
219  // perform balancing
220  pNew = Gia_ManAreaBalance( pTemp = pNew, 0, ABC_INFINITY, fVeryVerbose, 0 );
221  if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
222  Gia_ManStop( pTemp );
223 //Gia_ManAigPrintPiLevels( pNew );
224  return pNew;
225 }
Gia_Man_t * Jf_ManPerformMapping(Gia_Man_t *pGia, Jf_Par_t *pPars)
Definition: giaJf.c:1712
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition: giaDup.c:552
int nLutSize
Definition: gia.h:267
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
void Gia_ManPrintStats(Gia_Man_t *p, Gps_Par_t *pPars)
Definition: giaMan.c:389
Gia_Man_t * Gia_ManPerformFx(Gia_Man_t *p, int nNewNodesMax, int LitCountMax, int fReverse, int fVerbose, int fVeryVerbose)
Definition: giaFx.c:451
int nRelaxRatio
Definition: gia.h:272
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
Definition: gia.h:265
void Jf_ManSetDefaultPars(Jf_Par_t *pPars)
Definition: giaJf.c:1679
Definition: gia.h:95
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
Gia_Man_t * Gia_ManAreaBalance(Gia_Man_t *p, int fSimpleAnd, int nNewNodesMax, int fVerbose, int fVeryVerbose)
Definition: giaBalAig.c:968
static int Gia_ManAndNotBufNum ( Gia_Man_t p)
inlinestatic

Definition at line 393 of file gia.h.

393 { return Gia_ManAndNum(p) - Gia_ManBufNum(p); }
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
static int Gia_ManBufNum(Gia_Man_t *p)
Definition: gia.h:392
static int Gia_ManAndNum ( Gia_Man_t p)
inlinestatic

Definition at line 389 of file gia.h.

389 { return p->nObjs - Vec_IntSize(p->vCis) - Vec_IntSize(p->vCos) - 1; }
Vec_Int_t * vCos
Definition: gia.h:109
int nObjs
Definition: gia.h:101
Vec_Int_t * vCis
Definition: gia.h:108
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Gia_ManAppendAnd ( Gia_Man_t p,
int  iLit0,
int  iLit1 
)
inlinestatic

Definition at line 592 of file gia.h.

593 {
594  Gia_Obj_t * pObj = Gia_ManAppendObj( p );
595  assert( iLit0 >= 0 && Abc_Lit2Var(iLit0) < Gia_ManObjNum(p) );
596  assert( iLit1 >= 0 && Abc_Lit2Var(iLit1) < Gia_ManObjNum(p) );
597  assert( Abc_Lit2Var(iLit0) != Abc_Lit2Var(iLit1) );
598  if ( iLit0 < iLit1 )
599  {
600  pObj->iDiff0 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit0);
601  pObj->fCompl0 = Abc_LitIsCompl(iLit0);
602  pObj->iDiff1 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit1);
603  pObj->fCompl1 = Abc_LitIsCompl(iLit1);
604  }
605  else
606  {
607  pObj->iDiff1 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit0);
608  pObj->fCompl1 = Abc_LitIsCompl(iLit0);
609  pObj->iDiff0 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit1);
610  pObj->fCompl0 = Abc_LitIsCompl(iLit1);
611  }
612  if ( p->pFanData )
613  {
614  Gia_ObjAddFanout( p, Gia_ObjFanin0(pObj), pObj );
615  Gia_ObjAddFanout( p, Gia_ObjFanin1(pObj), pObj );
616  }
617  if ( p->fSweeper )
618  {
619  Gia_Obj_t * pFan0 = Gia_ObjFanin0(pObj);
620  Gia_Obj_t * pFan1 = Gia_ObjFanin1(pObj);
621  if ( pFan0->fMark0 ) pFan0->fMark1 = 1; else pFan0->fMark0 = 1;
622  if ( pFan1->fMark0 ) pFan1->fMark1 = 1; else pFan1->fMark0 = 1;
623  pObj->fPhase = (Gia_ObjPhase(pFan0) ^ Gia_ObjFaninC0(pObj)) & (Gia_ObjPhase(pFan1) ^ Gia_ObjFaninC1(pObj));
624  }
625  return Gia_ObjId( p, pObj ) << 1;
626 }
unsigned iDiff0
Definition: gia.h:77
static int Gia_ObjPhase(Gia_Obj_t *pObj)
Definition: gia.h:415
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
unsigned fMark1
Definition: gia.h:84
void Gia_ObjAddFanout(Gia_Man_t *p, Gia_Obj_t *pObj, Gia_Obj_t *pFanout)
Definition: giaFanout.c:116
Definition: gia.h:75
int fSweeper
Definition: gia.h:113
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
unsigned fCompl1
Definition: gia.h:83
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
int * pFanData
Definition: gia.h:127
static Gia_Obj_t * Gia_ManAppendObj(Gia_Man_t *p)
Definition: gia.h:561
unsigned fPhase
Definition: gia.h:85
unsigned fMark0
Definition: gia.h:79
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
unsigned fCompl0
Definition: gia.h:78
unsigned iDiff1
Definition: gia.h:82
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ManAppendAnd2 ( Gia_Man_t p,
int  iLit0,
int  iLit1 
)
inlinestatic

Definition at line 627 of file gia.h.

628 {
629  if ( iLit0 < 2 )
630  return iLit0 ? iLit1 : 0;
631  if ( iLit1 < 2 )
632  return iLit1 ? iLit0 : 0;
633  if ( iLit0 == iLit1 )
634  return iLit1;
635  if ( iLit0 == Abc_LitNot(iLit1) )
636  return 0;
637  return Gia_ManAppendAnd( p, iLit0, iLit1 );
638 }
static int Gia_ManAppendAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: gia.h:592
static int Abc_LitNot(int Lit)
Definition: abc_global.h:266
static int Gia_ManAppendBuf ( Gia_Man_t p,
int  iLit 
)
inlinestatic

Definition at line 694 of file gia.h.

695 {
696  Gia_Obj_t * pObj = Gia_ManAppendObj( p );
697  assert( iLit >= 0 && Abc_Lit2Var(iLit) < Gia_ManObjNum(p) );
698  pObj->iDiff0 = pObj->iDiff1 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit);
699  pObj->fCompl0 = pObj->fCompl1 = Abc_LitIsCompl(iLit);
700  p->nBufs++;
701  return Gia_ObjId( p, pObj ) << 1;
702 }
unsigned iDiff0
Definition: gia.h:77
int nBufs
Definition: gia.h:107
Definition: gia.h:75
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
unsigned fCompl1
Definition: gia.h:83
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static Gia_Obj_t * Gia_ManAppendObj(Gia_Man_t *p)
Definition: gia.h:561
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
#define assert(ex)
Definition: util_old.h:213
unsigned fCompl0
Definition: gia.h:78
unsigned iDiff1
Definition: gia.h:82
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ManAppendCi ( Gia_Man_t p)
inlinestatic

Definition at line 583 of file gia.h.

584 {
585  Gia_Obj_t * pObj = Gia_ManAppendObj( p );
586  pObj->fTerm = 1;
587  pObj->iDiff0 = GIA_NONE;
588  pObj->iDiff1 = Vec_IntSize( p->vCis );
589  Vec_IntPush( p->vCis, Gia_ObjId(p, pObj) );
590  return Gia_ObjId( p, pObj ) << 1;
591 }
unsigned iDiff0
Definition: gia.h:77
Definition: gia.h:75
unsigned fTerm
Definition: gia.h:80
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
Vec_Int_t * vCis
Definition: gia.h:108
static Gia_Obj_t * Gia_ManAppendObj(Gia_Man_t *p)
Definition: gia.h:561
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define GIA_NONE
INCLUDES ///.
Definition: gia.h:44
unsigned iDiff1
Definition: gia.h:82
static int Gia_ManAppendCo ( Gia_Man_t p,
int  iLit0 
)
inlinestatic

Definition at line 703 of file gia.h.

704 {
705  Gia_Obj_t * pObj;
706  assert( iLit0 >= 0 && Abc_Lit2Var(iLit0) < Gia_ManObjNum(p) );
707  assert( !Gia_ObjIsCo(Gia_ManObj(p, Abc_Lit2Var(iLit0))) );
708  pObj = Gia_ManAppendObj( p );
709  pObj->fTerm = 1;
710  pObj->iDiff0 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit0);
711  pObj->fCompl0 = Abc_LitIsCompl(iLit0);
712  pObj->iDiff1 = Vec_IntSize( p->vCos );
713  Vec_IntPush( p->vCos, Gia_ObjId(p, pObj) );
714  if ( p->pFanData )
715  Gia_ObjAddFanout( p, Gia_ObjFanin0(pObj), pObj );
716  return Gia_ObjId( p, pObj ) << 1;
717 }
unsigned iDiff0
Definition: gia.h:77
Vec_Int_t * vCos
Definition: gia.h:109
void Gia_ObjAddFanout(Gia_Man_t *p, Gia_Obj_t *pObj, Gia_Obj_t *pFanout)
Definition: giaFanout.c:116
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
unsigned fTerm
Definition: gia.h:80
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
int * pFanData
Definition: gia.h:127
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static Gia_Obj_t * Gia_ManAppendObj(Gia_Man_t *p)
Definition: gia.h:561
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
#define assert(ex)
Definition: util_old.h:213
unsigned fCompl0
Definition: gia.h:78
unsigned iDiff1
Definition: gia.h:82
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ManAppendMaj ( Gia_Man_t p,
int  iData0,
int  iData1,
int  iData2 
)
inlinestatic

Definition at line 728 of file gia.h.

729 {
730  int iTemp0 = Gia_ManAppendOr( p, iData1, iData2 );
731  int iTemp1 = Gia_ManAppendAnd( p, iData0, iTemp0 );
732  int iTemp2 = Gia_ManAppendAnd( p, iData1, iData2 );
733  return Gia_ManAppendOr( p, iTemp1, iTemp2 );
734 }
static int Gia_ManAppendAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: gia.h:592
static int Gia_ManAppendOr(Gia_Man_t *p, int iLit0, int iLit1)
Definition: gia.h:718
static int Gia_ManAppendMux ( Gia_Man_t p,
int  iCtrl,
int  iData1,
int  iData0 
)
inlinestatic

Definition at line 722 of file gia.h.

723 {
724  int iTemp0 = Gia_ManAppendAnd( p, Abc_LitNot(iCtrl), iData0 );
725  int iTemp1 = Gia_ManAppendAnd( p, iCtrl, iData1 );
726  return Abc_LitNotCond( Gia_ManAppendAnd( p, Abc_LitNot(iTemp0), Abc_LitNot(iTemp1) ), 1 );
727 }
static int Gia_ManAppendAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: gia.h:592
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
static int Abc_LitNot(int Lit)
Definition: abc_global.h:266
static int Gia_ManAppendMuxReal ( Gia_Man_t p,
int  iLitC,
int  iLit1,
int  iLit0 
)
inlinestatic

Definition at line 664 of file gia.h.

665 {
666  Gia_Obj_t * pObj = Gia_ManAppendObj( p );
667  assert( p->pMuxes != NULL );
668  assert( iLit0 >= 0 && Abc_Lit2Var(iLit0) < Gia_ManObjNum(p) );
669  assert( iLit1 >= 0 && Abc_Lit2Var(iLit1) < Gia_ManObjNum(p) );
670  assert( iLitC >= 0 && Abc_Lit2Var(iLitC) < Gia_ManObjNum(p) );
671  assert( Abc_Lit2Var(iLit0) != Abc_Lit2Var(iLit1) );
672  assert( Abc_Lit2Var(iLitC) != Abc_Lit2Var(iLit0) );
673  assert( Abc_Lit2Var(iLitC) != Abc_Lit2Var(iLit1) );
674  assert( !p->pHTable || !Abc_LitIsCompl(iLit1) );
675  if ( Abc_Lit2Var(iLit0) < Abc_Lit2Var(iLit1) )
676  {
677  pObj->iDiff0 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit0);
678  pObj->fCompl0 = Abc_LitIsCompl(iLit0);
679  pObj->iDiff1 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit1);
680  pObj->fCompl1 = Abc_LitIsCompl(iLit1);
681  p->pMuxes[Gia_ObjId(p, pObj)] = iLitC;
682  }
683  else
684  {
685  pObj->iDiff1 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit0);
686  pObj->fCompl1 = Abc_LitIsCompl(iLit0);
687  pObj->iDiff0 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit1);
688  pObj->fCompl0 = Abc_LitIsCompl(iLit1);
689  p->pMuxes[Gia_ObjId(p, pObj)] = Abc_LitNot(iLitC);
690  }
691  p->nMuxes++;
692  return Gia_ObjId( p, pObj ) << 1;
693 }
unsigned iDiff0
Definition: gia.h:77
int * pHTable
Definition: gia.h:110
unsigned * pMuxes
Definition: gia.h:104
Definition: gia.h:75
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
unsigned fCompl1
Definition: gia.h:83
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static Gia_Obj_t * Gia_ManAppendObj(Gia_Man_t *p)
Definition: gia.h:561
static int Abc_LitNot(int Lit)
Definition: abc_global.h:266
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
#define assert(ex)
Definition: util_old.h:213
unsigned fCompl0
Definition: gia.h:78
unsigned iDiff1
Definition: gia.h:82
int nMuxes
Definition: gia.h:106
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static Gia_Obj_t* Gia_ManAppendObj ( Gia_Man_t p)
inlinestatic

Definition at line 561 of file gia.h.

562 {
563  if ( p->nObjs == p->nObjsAlloc )
564  {
565  int nObjNew = Abc_MinInt( 2 * p->nObjsAlloc, (1 << 29) );
566  if ( p->nObjs == (1 << 29) )
567  printf( "Hard limit on the number of nodes (2^29) is reached. Quitting...\n" ), exit(1);
568  assert( p->nObjs < nObjNew );
569  if ( p->fVerbose )
570  printf("Extending GIA object storage: %d -> %d.\n", p->nObjsAlloc, nObjNew );
571  assert( p->nObjsAlloc > 0 );
572  p->pObjs = ABC_REALLOC( Gia_Obj_t, p->pObjs, nObjNew );
573  memset( p->pObjs + p->nObjsAlloc, 0, sizeof(Gia_Obj_t) * (nObjNew - p->nObjsAlloc) );
574  if ( p->pMuxes )
575  {
576  p->pMuxes = ABC_REALLOC( unsigned, p->pMuxes, nObjNew );
577  memset( p->pMuxes + p->nObjsAlloc, 0, sizeof(unsigned) * (nObjNew - p->nObjsAlloc) );
578  }
579  p->nObjsAlloc = nObjNew;
580  }
581  return Gia_ManObj( p, p->nObjs++ );
582 }
int nObjsAlloc
Definition: gia.h:102
char * memset()
VOID_HACK exit()
#define ABC_REALLOC(type, obj, num)
Definition: abc_global.h:233
Gia_Obj_t * pObjs
Definition: gia.h:103
unsigned * pMuxes
Definition: gia.h:104
int nObjs
Definition: gia.h:101
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
static int Abc_MinInt(int a, int b)
Definition: abc_global.h:239
int fVerbose
Definition: gia.h:174
#define assert(ex)
Definition: util_old.h:213
static int Gia_ManAppendOr ( Gia_Man_t p,
int  iLit0,
int  iLit1 
)
inlinestatic

Definition at line 718 of file gia.h.

719 {
720  return Abc_LitNot(Gia_ManAppendAnd( p, Abc_LitNot(iLit0), Abc_LitNot(iLit1) ));
721 }
static int Gia_ManAppendAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: gia.h:592
static int Abc_LitNot(int Lit)
Definition: abc_global.h:266
static int Gia_ManAppendXor ( Gia_Man_t p,
int  iLit0,
int  iLit1 
)
inlinestatic

Definition at line 735 of file gia.h.

736 {
737  return Gia_ManAppendMux( p, iLit0, Abc_LitNot(iLit1), iLit1 );
738 }
static int Gia_ManAppendMux(Gia_Man_t *p, int iCtrl, int iData1, int iData0)
Definition: gia.h:722
static int Abc_LitNot(int Lit)
Definition: abc_global.h:266
static int Gia_ManAppendXorReal ( Gia_Man_t p,
int  iLit0,
int  iLit1 
)
inlinestatic

Definition at line 639 of file gia.h.

640 {
641  Gia_Obj_t * pObj = Gia_ManAppendObj( p );
642  assert( iLit0 >= 0 && Abc_Lit2Var(iLit0) < Gia_ManObjNum(p) );
643  assert( iLit1 >= 0 && Abc_Lit2Var(iLit1) < Gia_ManObjNum(p) );
644  assert( Abc_Lit2Var(iLit0) != Abc_Lit2Var(iLit1) );
645  assert( !Abc_LitIsCompl(iLit0) );
646  assert( !Abc_LitIsCompl(iLit1) );
647  if ( Abc_Lit2Var(iLit0) > Abc_Lit2Var(iLit1) )
648  {
649  pObj->iDiff0 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit0);
650  pObj->fCompl0 = Abc_LitIsCompl(iLit0);
651  pObj->iDiff1 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit1);
652  pObj->fCompl1 = Abc_LitIsCompl(iLit1);
653  }
654  else
655  {
656  pObj->iDiff1 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit0);
657  pObj->fCompl1 = Abc_LitIsCompl(iLit0);
658  pObj->iDiff0 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit1);
659  pObj->fCompl0 = Abc_LitIsCompl(iLit1);
660  }
661  p->nXors++;
662  return Gia_ObjId( p, pObj ) << 1;
663 }
unsigned iDiff0
Definition: gia.h:77
Definition: gia.h:75
int nXors
Definition: gia.h:105
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
unsigned fCompl1
Definition: gia.h:83
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static Gia_Obj_t * Gia_ManAppendObj(Gia_Man_t *p)
Definition: gia.h:561
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
#define assert(ex)
Definition: util_old.h:213
unsigned fCompl0
Definition: gia.h:78
unsigned iDiff1
Definition: gia.h:82
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
Gia_Man_t* Gia_ManAreaBalance ( Gia_Man_t p,
int  fSimpleAnd,
int  nNewNodesMax,
int  fVerbose,
int  fVeryVerbose 
)

Definition at line 968 of file giaBalAig.c.

969 {
970  Gia_Man_t * pNew0, * pNew, * pNew1, * pNew2;
971  Vec_Int_t * vCiLevels;
972  // determine CI levels
973  if ( p->pManTime && p->vLevels == NULL )
975  vCiLevels = Gia_ManGetCiLevels( p );
976  // get the starting manager
977  pNew0 = Gia_ManHasMapping(p) ? (Gia_Man_t *)Dsm_ManDeriveGia(p, 0) : p;
978  if ( fVerbose ) Gia_ManPrintStats( pNew0, NULL );
979  // derive internal manager
980  pNew = fSimpleAnd ? Gia_ManDup( pNew0 ) : Gia_ManDupMuxes( pNew0, 2 );
981  if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
982  if ( pNew0 != p ) Gia_ManStop( pNew0 );
983  // perform the operation
984  pNew1 = Dam_ManAreaBalanceInt( pNew, vCiLevels, nNewNodesMax, fVerbose, fVeryVerbose );
985  if ( fVerbose ) Gia_ManPrintStats( pNew1, NULL );
986  Gia_ManStop( pNew );
987  Vec_IntFreeP( &vCiLevels );
988  // derive the final result
989  pNew2 = Gia_ManDupNoMuxes( pNew1 );
990  if ( fVerbose ) Gia_ManPrintStats( pNew2, NULL );
991  Gia_ManStop( pNew1 );
992  // normalize if needed
993  if ( !Gia_ManIsNormalized(pNew2) )
994  {
995  pNew2 = Gia_ManDupNormalize( pNew1 = pNew2 );
996  Gia_ManStop( pNew1 );
997  }
998  Gia_ManTransferTiming( pNew2, p );
999  return pNew2;
1000 }
Vec_Int_t * Gia_ManGetCiLevels(Gia_Man_t *p)
Definition: giaUtil.c:546
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition: giaDup.c:552
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
void Gia_ManPrintStats(Gia_Man_t *p, Gps_Par_t *pPars)
Definition: giaMan.c:389
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 Gia_ManLevelWithBoxes(Gia_Man_t *p)
Definition: giaTim.c:469
Gia_Man_t * Dam_ManAreaBalanceInt(Gia_Man_t *pGia, Vec_Int_t *vCiLevels, int nNewNodesMax, int fVerbose, int fVeryVerbose)
Definition: giaBalAig.c:934
Gia_Man_t * Gia_ManDupNoMuxes(Gia_Man_t *p)
Definition: giaMuxes.c:159
Gia_Man_t * Gia_ManDupNormalize(Gia_Man_t *p)
Definition: giaTim.c:134
Gia_Man_t * Gia_ManDupMuxes(Gia_Man_t *p, int Limit)
Definition: giaMuxes.c:96
void * pManTime
Definition: gia.h:165
void Gia_ManTransferTiming(Gia_Man_t *p, Gia_Man_t *pGia)
Definition: giaIf.c:1912
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
static int Gia_ManHasMapping(Gia_Man_t *p)
Definition: gia.h:951
void * Dsm_ManDeriveGia(void *p, int fUseMuxes)
Definition: dauGia.c:471
Definition: gia.h:95
int Gia_ManIsNormalized(Gia_Man_t *p)
Definition: giaTim.c:109
Vec_Int_t * vLevels
Definition: gia.h:115
Gia_Man_t* Gia_ManBalance ( Gia_Man_t p,
int  fSimpleAnd,
int  fVerbose 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 365 of file giaBalAig.c.

366 {
367  Gia_Man_t * pNew, * pNew1, * pNew2;
368  if ( fVerbose ) Gia_ManPrintStats( p, NULL );
369  pNew = fSimpleAnd ? Gia_ManDup( p ) : Gia_ManDupMuxes( p, 2 );
370  if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
371  pNew1 = Gia_ManBalanceInt( pNew );
372  if ( fVerbose ) Gia_ManPrintStats( pNew1, NULL );
373  Gia_ManStop( pNew );
374  pNew2 = Gia_ManDupNoMuxes( pNew1 );
375  if ( fVerbose ) Gia_ManPrintStats( pNew2, NULL );
376  Gia_ManStop( pNew1 );
377  return pNew2;
378 }
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition: giaDup.c:552
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
void Gia_ManPrintStats(Gia_Man_t *p, Gps_Par_t *pPars)
Definition: giaMan.c:389
Gia_Man_t * Gia_ManDupNoMuxes(Gia_Man_t *p)
Definition: giaMuxes.c:159
Gia_Man_t * Gia_ManBalanceInt(Gia_Man_t *p)
Definition: giaBalAig.c:315
Gia_Man_t * Gia_ManDupMuxes(Gia_Man_t *p, int Limit)
Definition: giaMuxes.c:96
Definition: gia.h:95
int Gia_ManBoxCiNum ( Gia_Man_t p)

Definition at line 61 of file giaTim.c.

62 {
63  return p->pManTime ? Gia_ManCiNum(p) - Tim_ManPiNum((Tim_Man_t *)p->pManTime) : 0;
64 }
int Tim_ManPiNum(Tim_Man_t *p)
Definition: timMan.c:688
void * pManTime
Definition: gia.h:165
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
int Gia_ManBoxCoNum ( Gia_Man_t p)

Definition at line 65 of file giaTim.c.

66 {
67  return p->pManTime ? Gia_ManCoNum(p) - Tim_ManPoNum((Tim_Man_t *)p->pManTime) : 0;
68 }
void * pManTime
Definition: gia.h:165
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
int Tim_ManPoNum(Tim_Man_t *p)
Definition: timMan.c:694
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
int Gia_ManBoxNum ( Gia_Man_t p)

DECLARATIONS ///.

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

FileName [giaTim.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Scalable AIG package.]

Synopsis [Procedures with hierarchy/timing manager.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Returns the number of boxes in the AIG with boxes.]

Description []

SideEffects []

SeeAlso []

Definition at line 49 of file giaTim.c.

50 {
51  return p->pManTime ? Tim_ManBoxNum((Tim_Man_t *)p->pManTime) : 0;
52 }
void * pManTime
Definition: gia.h:165
int Tim_ManBoxNum(Tim_Man_t *p)
Definition: timMan.c:702
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
static int Gia_ManBufNum ( Gia_Man_t p)
inlinestatic

Definition at line 392 of file gia.h.

392 { return p->nBufs; }
int nBufs
Definition: gia.h:107
static int Gia_ManCandNum ( Gia_Man_t p)
inlinestatic

Definition at line 394 of file gia.h.

394 { return Gia_ManCiNum(p) + Gia_ManAndNum(p); }
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
Abc_Cex_t* Gia_ManCexExtendToIncludeAllObjects ( Gia_Man_t p,
Abc_Cex_t pCex 
)

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

Synopsis [Returns CEX containing all object valuess for each timeframe.]

Description []

SideEffects []

SeeAlso []

Definition at line 349 of file giaCex.c.

350 {
351  Abc_Cex_t * pNew;
352  Gia_Obj_t * pObj, * pObjRo, * pObjRi;
353  int i, k, iBit = 0;
354  assert( pCex->nRegs > 0 );
355  // start the counter-example
356  pNew = Abc_CexAlloc( 0, Gia_ManObjNum(p), pCex->iFrame + 1 );
357  pNew->iFrame = pCex->iFrame;
358  pNew->iPo = pCex->iPo;
359  // set const0
360  Gia_ManConst0(p)->fMark0 = 0;
361  // set init state
362  Gia_ManForEachRi( p, pObjRi, k )
363  pObjRi->fMark0 = Abc_InfoHasBit(pCex->pData, iBit++);
364  assert( iBit == pCex->nRegs );
365  for ( i = 0; i <= pCex->iFrame; i++ )
366  {
367  Gia_ManForEachPi( p, pObj, k )
368  pObj->fMark0 = Abc_InfoHasBit(pCex->pData, iBit++);
369  Gia_ManForEachRiRo( p, pObjRi, pObjRo, k )
370  pObjRo->fMark0 = pObjRi->fMark0;
371  Gia_ManForEachObj( p, pObj, k )
372  if ( pObj->fMark0 )
373  Abc_InfoSetBit( pNew->pData, pNew->nPis * i + k );
374  Gia_ManForEachAnd( p, pObj, k )
375  pObj->fMark0 = (Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj)) & (Gia_ObjFanin1(pObj)->fMark0 ^ Gia_ObjFaninC1(pObj));
376  Gia_ManForEachCo( p, pObj, k )
377  pObj->fMark0 = Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj);
378  }
379  assert( iBit == pCex->nBits );
380  assert( Gia_ManPo(p, pCex->iPo)->fMark0 == 1 );
382  return pNew;
383 }
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
ABC_NAMESPACE_IMPL_START Abc_Cex_t * Abc_CexAlloc(int nRegs, int nRealPis, int nFrames)
DECLARATIONS ///.
Definition: utilCex.c:51
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
void Gia_ManCleanMark0(Gia_Man_t *p)
Definition: giaUtil.c:215
for(p=first;p->value< newval;p=p->next)
Definition: gia.h:75
#define Gia_ManForEachRiRo(p, pObjRi, pObjRo, i)
Definition: gia.h:1042
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
if(last==0)
Definition: sparse_int.h:34
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
static void Abc_InfoSetBit(unsigned *p, int i)
Definition: abc_global.h:259
unsigned fMark0
Definition: gia.h:79
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
Definition: utilCex.h:39
#define Gia_ManForEachRi(p, pObj, i)
Definition: gia.h:1040
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
Abc_Cex_t* Gia_ManCexExtendToIncludeCurrentStates ( Gia_Man_t p,
Abc_Cex_t pCex 
)

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

Synopsis [Returns CEX containing PI+CS values for each timeframe.]

Description []

SideEffects []

SeeAlso []

Definition at line 302 of file giaCex.c.

303 {
304  Abc_Cex_t * pNew;
305  Gia_Obj_t * pObj, * pObjRo, * pObjRi;
306  int i, k, iBit = 0;
307  assert( pCex->nRegs > 0 );
308  // start the counter-example
309  pNew = Abc_CexAlloc( 0, Gia_ManCiNum(p), pCex->iFrame + 1 );
310  pNew->iFrame = pCex->iFrame;
311  pNew->iPo = pCex->iPo;
312  // set const0
313  Gia_ManConst0(p)->fMark0 = 0;
314  // set init state
315  Gia_ManForEachRi( p, pObjRi, k )
316  pObjRi->fMark0 = Abc_InfoHasBit(pCex->pData, iBit++);
317  assert( iBit == pCex->nRegs );
318  for ( i = 0; i <= pCex->iFrame; i++ )
319  {
320  Gia_ManForEachPi( p, pObj, k )
321  pObj->fMark0 = Abc_InfoHasBit(pCex->pData, iBit++);
322  Gia_ManForEachRiRo( p, pObjRi, pObjRo, k )
323  pObjRo->fMark0 = pObjRi->fMark0;
324  Gia_ManForEachCi( p, pObj, k )
325  if ( pObj->fMark0 )
326  Abc_InfoSetBit( pNew->pData, pNew->nPis * i + k );
327  Gia_ManForEachAnd( p, pObj, k )
328  pObj->fMark0 = (Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj)) & (Gia_ObjFanin1(pObj)->fMark0 ^ Gia_ObjFaninC1(pObj));
329  Gia_ManForEachCo( p, pObj, k )
330  pObj->fMark0 = Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj);
331  }
332  assert( iBit == pCex->nBits );
333  assert( Gia_ManPo(p, pCex->iPo)->fMark0 == 1 );
335  return pNew;
336 }
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
ABC_NAMESPACE_IMPL_START Abc_Cex_t * Abc_CexAlloc(int nRegs, int nRealPis, int nFrames)
DECLARATIONS ///.
Definition: utilCex.c:51
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
void Gia_ManCleanMark0(Gia_Man_t *p)
Definition: giaUtil.c:215
for(p=first;p->value< newval;p=p->next)
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
#define Gia_ManForEachRiRo(p, pObjRi, pObjRo, i)
Definition: gia.h:1042
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
if(last==0)
Definition: sparse_int.h:34
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
static void Abc_InfoSetBit(unsigned *p, int i)
Definition: abc_global.h:259
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
unsigned fMark0
Definition: gia.h:79
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
Definition: utilCex.h:39
#define Gia_ManForEachRi(p, pObj, i)
Definition: gia.h:1040
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
int Gia_ManCheckCoPhase ( Gia_Man_t p)

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 450 of file giaUtil.c.

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

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

Synopsis [Checks integriting of complex flops and carry-chains.]

Description []

SideEffects []

SeeAlso []

Definition at line 406 of file giaSweep.c.

407 {
408  Gia_Obj_t * pObj;
409  Vec_Int_t * vCarryOuts;
410  int i, nCountReg = 0, nCountCarry = 0;
411  if ( p->pManTime == NULL )
412  return;
413  Gia_ManCreateRefs( p );
414  for ( i = Gia_ManPoNum(p) - Gia_ManRegBoxNum(p); i < Gia_ManPoNum(p); i++ )
415  {
416  pObj = Gia_ObjFanin0( Gia_ManPo(p, i) );
417  assert( Gia_ObjIsCi(pObj) );
418  if ( Gia_ObjRefNum(p, pObj) > 1 )
419  nCountReg++;
420  }
421  vCarryOuts = Gia_ManComputeCarryOuts( p );
422  Gia_ManForEachObjVec( vCarryOuts, p, pObj, i )
423  if ( Gia_ObjRefNum(p, pObj) > 1 )
424  nCountCarry++;
425  Vec_IntFree( vCarryOuts );
426  if ( nCountReg || nCountCarry )
427  printf( "Warning: AIG with boxes has internal fanout in %d complex flops and %d carries.\n", nCountReg, nCountCarry );
428  ABC_FREE( p->pRefs );
429 }
void Gia_ManCreateRefs(Gia_Man_t *p)
Definition: giaUtil.c:715
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
int Gia_ManRegBoxNum(Gia_Man_t *p)
Definition: giaTim.c:53
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
static int Gia_ObjRefNum(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:521
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
if(last==0)
Definition: sparse_int.h:34
Vec_Int_t * Gia_ManComputeCarryOuts(Gia_Man_t *p)
Definition: giaSweep.c:373
void * pManTime
Definition: gia.h:165
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition: gia.h:988
#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
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
void Gia_ManCheckMark0 ( Gia_Man_t p)

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

Synopsis [Sets phases of the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 234 of file giaUtil.c.

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

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

Synopsis [Sets phases of the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 291 of file giaUtil.c.

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

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

Synopsis [Returns 0 if AIG is not in the required topo order.]

Description [AIG should be in such an order that the representative is always traversed before the node.]

SideEffects []

SeeAlso []

Definition at line 73 of file giaEquiv.c.

74 {
75  Gia_Obj_t * pObj;
76  int i, RetValue = 1;
77  Gia_ManFillValue( p );
78  Gia_ManConst0(p)->Value = 0;
79  Gia_ManForEachCi( p, pObj, i )
80  pObj->Value = 0;
81  Gia_ManForEachCo( p, pObj, i )
82  RetValue &= Gia_ManCheckTopoOrder_rec( p, Gia_ObjFanin0(pObj) );
83  return RetValue;
84 }
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
ABC_NAMESPACE_IMPL_START int Gia_ManCheckTopoOrder_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
DECLARATIONS ///.
Definition: giaEquiv.c:46
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
unsigned Value
Definition: gia.h:87
Gia_Man_t* Gia_ManChoiceMiter ( Vec_Ptr_t vGias)

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

Synopsis [Derives the miter of several AIGs for choice computation.]

Description []

SideEffects []

SeeAlso []

Definition at line 2574 of file giaDup.c.

2575 {
2576  Gia_Man_t * pNew, * pGia, * pGia0;
2577  int i, k, iNode, nNodes;
2578  // make sure they have equal parameters
2579  assert( Vec_PtrSize(vGias) > 0 );
2580  pGia0 = (Gia_Man_t *)Vec_PtrEntry( vGias, 0 );
2581  Vec_PtrForEachEntry( Gia_Man_t *, vGias, pGia, i )
2582  {
2583  assert( Gia_ManCiNum(pGia) == Gia_ManCiNum(pGia0) );
2584  assert( Gia_ManCoNum(pGia) == Gia_ManCoNum(pGia0) );
2585  assert( Gia_ManRegNum(pGia) == Gia_ManRegNum(pGia0) );
2586  Gia_ManFillValue( pGia );
2587  Gia_ManConst0(pGia)->Value = 0;
2588  }
2589  // start the new manager
2590  pNew = Gia_ManStart( Vec_PtrSize(vGias) * Gia_ManObjNum(pGia0) );
2591  pNew->pName = Abc_UtilStrsav( pGia0->pName );
2592  pNew->pSpec = Abc_UtilStrsav( pGia0->pSpec );
2593  // create new CIs and assign them to the old manager CIs
2594  for ( k = 0; k < Gia_ManCiNum(pGia0); k++ )
2595  {
2596  iNode = Gia_ManAppendCi(pNew);
2597  Vec_PtrForEachEntry( Gia_Man_t *, vGias, pGia, i )
2598  Gia_ManCi( pGia, k )->Value = iNode;
2599  }
2600  // create internal nodes
2601  Gia_ManHashAlloc( pNew );
2602  for ( k = 0; k < Gia_ManCoNum(pGia0); k++ )
2603  {
2604  Vec_PtrForEachEntry( Gia_Man_t *, vGias, pGia, i )
2605  Gia_ManChoiceMiter_rec( pNew, pGia, Gia_ManCo( pGia, k ) );
2606  }
2607  Gia_ManHashStop( pNew );
2608  // check the presence of dangling nodes
2609  nNodes = Gia_ManHasDangling( pNew );
2610  assert( nNodes == 0 );
2611  // finalize
2612  Gia_ManSetRegNum( pNew, Gia_ManRegNum(pGia0) );
2613  return pNew;
2614 }
static Gia_Obj_t * Gia_ManCi(Gia_Man_t *p, int v)
Definition: gia.h:403
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
for(p=first;p->value< newval;p=p->next)
int Gia_ManHasDangling(Gia_Man_t *p)
Definition: giaUtil.c:1155
char * pName
Definition: gia.h:97
int Gia_ManChoiceMiter_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaDup.c:2552
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
static Gia_Obj_t * Gia_ManCo(Gia_Man_t *p, int v)
Definition: gia.h:404
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
static int Gia_ManChoiceNum ( Gia_Man_t p)
inlinestatic

Definition at line 398 of file gia.h.

398 { int c = 0; if (p->pSibls) { int i; for (i = 0; i < p->nObjs; i++) c += (int)(p->pSibls[i] > 0); } return c; }
int * pSibls
Definition: gia.h:123
int nObjs
Definition: gia.h:101
static Gia_Obj_t* Gia_ManCi ( Gia_Man_t p,
int  v 
)
inlinestatic

Definition at line 403 of file gia.h.

403 { return Gia_ManObj( p, Vec_IntEntry(p->vCis,v) ); }
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Vec_Int_t * vCis
Definition: gia.h:108
static int Gia_ManCiIdToId ( Gia_Man_t p,
int  CiId 
)
inlinestatic

Definition at line 438 of file gia.h.

438 { return Gia_ObjId( p, Gia_ManCi(p, CiId) ); }
static Gia_Obj_t * Gia_ManCi(Gia_Man_t *p, int v)
Definition: gia.h:403
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Gia_ManCiLit ( Gia_Man_t p,
int  CiId 
)
inlinestatic

Definition at line 435 of file gia.h.

435 { return Gia_Obj2Lit( p, Gia_ManCi(p, CiId) ); }
static Gia_Obj_t * Gia_ManCi(Gia_Man_t *p, int v)
Definition: gia.h:403
static int Gia_Obj2Lit(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:433
static int Gia_ManCiNum ( Gia_Man_t p)
inlinestatic

Definition at line 383 of file gia.h.

383 { return Vec_IntSize(p->vCis); }
Vec_Int_t * vCis
Definition: gia.h:108
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static void Gia_ManCleanCopyArray ( Gia_Man_t p)
inlinestatic

Definition at line 489 of file gia.h.

489 { Vec_IntFill( &p->vCopies, Gia_ManObjNum(p), -1 ); }
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
Vec_Int_t vCopies
Definition: gia.h:138
void Gia_ManCleanLevels ( Gia_Man_t p,
int  Size 
)

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

Synopsis [Prepares copies for the model.]

Description []

SideEffects []

SeeAlso []

Definition at line 470 of file giaUtil.c.

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

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

Synopsis [Sets phases of the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 215 of file giaUtil.c.

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

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

Synopsis [Sets phases of the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 177 of file giaUtil.c.

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

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

Synopsis [Sets phases of the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 272 of file giaUtil.c.

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

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

Synopsis [Sets phases of the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 431 of file giaUtil.c.

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

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

Synopsis [Prepares copies for the model.]

Description []

SideEffects []

SeeAlso []

Definition at line 487 of file giaUtil.c.

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

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

Synopsis [Performs combinational cleanup.]

Description []

SideEffects []

SeeAlso []

Definition at line 84 of file giaScl.c.

85 {
87  return Gia_ManDupMarked( p );
88 }
Gia_Man_t * Gia_ManDupMarked(Gia_Man_t *p)
Definition: giaDup.c:975
int Gia_ManCombMarkUsed(Gia_Man_t *p)
Definition: giaScl.c:60
Gia_Man_t* Gia_ManCleanupOutputs ( Gia_Man_t p,
int  nOutputs 
)

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

Synopsis [Skip the first outputs during cleanup.]

Description []

SideEffects []

SeeAlso []

Definition at line 101 of file giaScl.c.

102 {
103  Gia_Obj_t * pObj;
104  int i;
105  assert( Gia_ManRegNum(p) == 0 );
106  assert( nOutputs < Gia_ManCoNum(p) );
107  Gia_ManCombMarkUsed( p );
108  Gia_ManForEachCo( p, pObj, i )
109  if ( i < nOutputs )
110  pObj->fMark0 = 1;
111  else
112  break;
113  return Gia_ManDupMarked( p );
114 }
Gia_Man_t * Gia_ManDupMarked(Gia_Man_t *p)
Definition: giaDup.c:975
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
Definition: gia.h:75
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
#define assert(ex)
Definition: util_old.h:213
int Gia_ManCombMarkUsed(Gia_Man_t *p)
Definition: giaScl.c:60
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
void Gia_ManCleanValue ( Gia_Man_t p)

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

Synopsis [Cleans the value.]

Description []

SideEffects []

SeeAlso []

Definition at line 310 of file giaUtil.c.

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

Definition at line 69 of file giaTim.c.

70 {
71  int i, nDoms, Count = 0;
72  if ( p->vRegClasses == NULL )
73  return 0;
74  nDoms = Vec_IntFindMax(p->vRegClasses);
75  assert( Vec_IntCountEntry(p->vRegClasses, 0) == 0 );
76  for ( i = 1; i <= nDoms; i++ )
77  if ( Vec_IntCountEntry(p->vRegClasses, i) > 0 )
78  Count++;
79  return Count;
80 }
static int Vec_IntCountEntry(Vec_Int_t *p, int Entry)
Definition: vecInt.h:1156
Vec_Int_t * vRegClasses
Definition: gia.h:144
static int Vec_IntFindMax(Vec_Int_t *p)
Definition: vecInt.h:996
#define assert(ex)
Definition: util_old.h:213
static Gia_Obj_t* Gia_ManCo ( Gia_Man_t p,
int  v 
)
inlinestatic

Definition at line 404 of file gia.h.

404 { return Gia_ManObj( p, Vec_IntEntry(p->vCos,v) ); }
Vec_Int_t * vCos
Definition: gia.h:109
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Gia_ManCoIdToId ( Gia_Man_t p,
int  CoId 
)
inlinestatic

Definition at line 439 of file gia.h.

439 { return Gia_ObjId( p, Gia_ManCo(p, CoId) ); }
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static Gia_Obj_t * Gia_ManCo(Gia_Man_t *p, int v)
Definition: gia.h:404
void Gia_ManCollectAnds ( Gia_Man_t p,
int *  pNodes,
int  nNodes,
Vec_Int_t vNodes 
)

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

Synopsis [Collects support nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 123 of file giaDfs.c.

124 {
125  Gia_Obj_t * pObj;
126  int i;
127  Vec_IntClear( vNodes );
128 // Gia_ManIncrementTravId( p );
130  for ( i = 0; i < nNodes; i++ )
131  {
132  pObj = Gia_ManObj( p, pNodes[i] );
133  if ( Gia_ObjIsCo(pObj) )
134  Gia_ManCollectAnds_rec( p, Gia_ObjFanin0(pObj), vNodes );
135  else
136  Gia_ManCollectAnds_rec( p, pObj, vNodes );
137  }
138 }
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
void Gia_ManCollectAnds_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vNodes)
Definition: giaDfs.c:99
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
void Gia_ManCollectCis ( Gia_Man_t p,
int *  pNodes,
int  nNodes,
Vec_Int_t vSupp 
)

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

Synopsis [Collects support nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 71 of file giaDfs.c.

72 {
73  Gia_Obj_t * pObj;
74  int i;
75  Vec_IntClear( vSupp );
78  for ( i = 0; i < nNodes; i++ )
79  {
80  pObj = Gia_ManObj( p, pNodes[i] );
81  if ( Gia_ObjIsCo(pObj) )
82  Gia_ManCollectCis_rec( p, Gia_ObjFanin0(pObj), vSupp );
83  else
84  Gia_ManCollectCis_rec( p, pObj, vSupp );
85  }
86 }
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
ABC_NAMESPACE_IMPL_START void Gia_ManCollectCis_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vSupp)
DECLARATIONS ///.
Definition: giaDfs.c:45
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
Vec_Int_t* Gia_ManCollectNodesCis ( Gia_Man_t p,
int *  pNodes,
int  nNodes 
)

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

Synopsis [Collects support nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 178 of file giaDfs.c.

179 {
180  Vec_Int_t * vNodes;
181  Gia_Obj_t * pObj;
182  int i;
183  vNodes = Vec_IntAlloc( 10000 );
186  for ( i = 0; i < nNodes; i++ )
187  {
188  pObj = Gia_ManObj( p, pNodes[i] );
189  if ( Gia_ObjIsCo(pObj) )
190  Gia_ManCollectNodesCis_rec( p, Gia_ObjFanin0(pObj), vNodes );
191  else
192  Gia_ManCollectNodesCis_rec( p, pObj, vNodes );
193  }
194  return vNodes;
195 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
void Gia_ManCollectNodesCis_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vNodes)
Definition: giaDfs.c:151
Vec_Int_t* Gia_ManCollectPoIds ( Gia_Man_t p)

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

Synopsis [Collects PO Ids into one array.]

Description []

SideEffects []

SeeAlso []

Definition at line 863 of file giaUtil.c.

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

Definition at line 60 of file giaScl.c.

61 {
62  Gia_Obj_t * pObj;
63  int i, nNodes = 0;
64  Gia_ManForEachObj( p, pObj, i )
65  pObj->fMark0 = Gia_ObjIsAnd(pObj) && !Gia_ObjIsBuf(pObj);
66  Gia_ManForEachBuf( p, pObj, i )
67  nNodes += Gia_ManCombMarkUsed_rec( p, Gia_ObjFanin0(pObj) );
68  Gia_ManForEachCo( p, pObj, i )
69  nNodes += Gia_ManCombMarkUsed_rec( p, Gia_ObjFanin0(pObj) );
70  return nNodes;
71 }
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ObjIsBuf(Gia_Obj_t *pObj)
Definition: gia.h:427
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
ABC_NAMESPACE_IMPL_START int Gia_ManCombMarkUsed_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
DECLARATIONS ///.
Definition: giaScl.c:45
#define Gia_ManForEachBuf(p, pObj, i)
Definition: gia.h:998
int Gia_ManCompare ( Gia_Man_t p1,
Gia_Man_t p2 
)

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 1511 of file giaUtil.c.

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

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

Synopsis [Computes probability of switching (or of being 1).]

Description []

SideEffects []

SeeAlso []

Definition at line 781 of file giaSwitch.c.

782 {
783  Vec_Int_t * vSwitching = Gia_ManComputeSwitchProbs( p, nFrames, nPref, fProbOne );
784  float * pSwi = (float *)Vec_IntArray(vSwitching), SwiTotal = 0;
785  Gia_Obj_t * pObj;
786  int i, k, iFan;
787  if ( Gia_ManHasMapping(p) )
788  {
789  Gia_ManForEachLut( p, i )
790  Gia_LutForEachFanin( p, i, iFan, k )
791  SwiTotal += pSwi[iFan];
792  }
793  else
794  {
795  Gia_ManForEachAnd( p, pObj, i )
796  SwiTotal += pSwi[Gia_ObjFaninId0(pObj, i)] + pSwi[Gia_ObjFaninId1(pObj, i)];
797  }
798  Vec_IntFree( vSwitching );
799  return SwiTotal;
800 }
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Definition: gia.h:75
#define Gia_ManForEachLut(p, i)
Definition: gia.h:968
Vec_Int_t * Gia_ManComputeSwitchProbs(Gia_Man_t *pGia, int nFrames, int nPref, int fProbOne)
Definition: giaSwitch.c:658
else
Definition: sparse_int.h:55
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
static int Gia_ManHasMapping(Gia_Man_t *p)
Definition: gia.h:951
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static int Gia_ObjFaninId1(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:461
#define Gia_LutForEachFanin(p, i, iFan, k)
Definition: gia.h:970
static int Gia_ObjFaninId0(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:460
Vec_Int_t* Gia_ManComputeSwitchProbs ( Gia_Man_t pGia,
int  nFrames,
int  nPref,
int  fProbOne 
)

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

Synopsis [Computes probability of switching (or of being 1).]

Description []

SideEffects []

SeeAlso []

Definition at line 658 of file giaSwitch.c.

659 {
660  Gia_ParSwi_t Pars, * pPars = &Pars;
661  // set the default parameters
662  Gia_ManSetDefaultParamsSwi( pPars );
663  // override some of the defaults
664  pPars->nIters = nFrames; // set number of total timeframes
665  if ( Abc_FrameReadFlag("seqsimframes") )
666  pPars->nIters = atoi( Abc_FrameReadFlag("seqsimframes") );
667  pPars->nPref = nPref; // set number of first timeframes to skip
668  // decide what should be computed
669  if ( fProbOne )
670  {
671  // if the user asked to compute propability of 1, we do not need transition information
672  pPars->fProbOne = 1; // enable computing probabiblity of being one
673  pPars->fProbTrans = 0; // disable computing transition probability
674  }
675  else
676  {
677  // if the user asked for transition propabability, we do not need to compute probability of 1
678  pPars->fProbOne = 0; // disable computing probabiblity of being one
679  pPars->fProbTrans = 1; // enable computing transition probability
680  }
681  // perform the computation of switching activity
682  return Gia_ManSwiSimulate( pGia, pPars );
683 }
Vec_Int_t * Gia_ManSwiSimulate(Gia_Man_t *pAig, Gia_ParSwi_t *pPars)
Definition: giaSwitch.c:556
typedefABC_NAMESPACE_IMPL_START struct Gia_ParSwi_t_ Gia_ParSwi_t
DECLARATIONS ///.
Definition: giaSwitch.c:32
void Gia_ManSetDefaultParamsSwi(Gia_ParSwi_t *p)
FUNCTION DEFINITIONS ///.
Definition: giaSwitch.c:77
ABC_DLL char * Abc_FrameReadFlag(char *pFlag)
Definition: mainFrame.c:64
int Gia_ManConeSize ( Gia_Man_t p,
int *  pNodes,
int  nNodes 
)

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

Synopsis [Collects support nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 351 of file giaDfs.c.

352 {
353  Gia_Obj_t * pObj;
354  int i, Counter = 0;
357  for ( i = 0; i < nNodes; i++ )
358  {
359  pObj = Gia_ManObj( p, pNodes[i] );
360  if ( Gia_ObjIsCo(pObj) )
361  Counter += Gia_ManConeSize_rec( p, Gia_ObjFanin0(pObj) );
362  else
363  Counter += Gia_ManConeSize_rec( p, pObj );
364  }
365  return Counter;
366 }
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
static int Counter
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
int Gia_ManConeSize_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaDfs.c:328
static Gia_Obj_t* Gia_ManConst0 ( Gia_Man_t p)
inlinestatic

Definition at line 400 of file gia.h.

400 { return p->pObjs; }
Gia_Obj_t * pObjs
Definition: gia.h:103
static int Gia_ManConst0Lit ( )
inlinestatic

Definition at line 371 of file gia.h.

371 { return 0; }
static Gia_Obj_t* Gia_ManConst1 ( Gia_Man_t p)
inlinestatic

Definition at line 401 of file gia.h.

401 { return Gia_Not(Gia_ManConst0(p)); }
static Gia_Obj_t * Gia_Not(Gia_Obj_t *p)
Definition: gia.h:378
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
static int Gia_ManConst1Lit ( )
inlinestatic

Definition at line 372 of file gia.h.

372 { return 1; }
static int Gia_ManConstrNum ( Gia_Man_t p)
inlinestatic

Definition at line 395 of file gia.h.

395 { return p->nConstrs; }
int nConstrs
Definition: gia.h:117
static int Gia_ManCoNum ( Gia_Man_t p)
inlinestatic

Definition at line 384 of file gia.h.

384 { return Vec_IntSize(p->vCos); }
Vec_Int_t * vCos
Definition: gia.h:109
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
unsigned* Gia_ManConvertAigToTruth ( Gia_Man_t p,
Gia_Obj_t pRoot,
Vec_Int_t vLeaves,
Vec_Int_t vTruth,
Vec_Int_t vVisited 
)

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

Synopsis [Computes truth table of the node.]

Description [Assumes that the structural support is no more than 8 inputs. Uses array vTruth to store temporary truth tables. The returned pointer should be used immediately.]

SideEffects []

SeeAlso []

Definition at line 90 of file giaBidec.c.

91 {
92  static unsigned uTruths[8][8] = { // elementary truth tables
93  { 0xAAAAAAAA,0xAAAAAAAA,0xAAAAAAAA,0xAAAAAAAA,0xAAAAAAAA,0xAAAAAAAA,0xAAAAAAAA,0xAAAAAAAA },
94  { 0xCCCCCCCC,0xCCCCCCCC,0xCCCCCCCC,0xCCCCCCCC,0xCCCCCCCC,0xCCCCCCCC,0xCCCCCCCC,0xCCCCCCCC },
95  { 0xF0F0F0F0,0xF0F0F0F0,0xF0F0F0F0,0xF0F0F0F0,0xF0F0F0F0,0xF0F0F0F0,0xF0F0F0F0,0xF0F0F0F0 },
96  { 0xFF00FF00,0xFF00FF00,0xFF00FF00,0xFF00FF00,0xFF00FF00,0xFF00FF00,0xFF00FF00,0xFF00FF00 },
97  { 0xFFFF0000,0xFFFF0000,0xFFFF0000,0xFFFF0000,0xFFFF0000,0xFFFF0000,0xFFFF0000,0xFFFF0000 },
98  { 0x00000000,0xFFFFFFFF,0x00000000,0xFFFFFFFF,0x00000000,0xFFFFFFFF,0x00000000,0xFFFFFFFF },
99  { 0x00000000,0x00000000,0xFFFFFFFF,0xFFFFFFFF,0x00000000,0x00000000,0xFFFFFFFF,0xFFFFFFFF },
100  { 0x00000000,0x00000000,0x00000000,0x00000000,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF }
101  };
102  Gia_Obj_t * pObj;
103  Vec_Ptr_t * vTtElems = NULL;
104  unsigned * pTruth;//, * pTruth2;
105  int i, nWords, nVars;
106  // get the number of variables and words
107  nVars = Vec_IntSize( vLeaves );
108  nWords = Abc_TruthWordNum( nVars );
109  // check the case of a constant
110  if ( Gia_ObjIsConst0( Gia_Regular(pRoot) ) )
111  {
112  Vec_IntClear( vTruth );
113  // get room for the truth table
114  pTruth = Vec_IntFetch( vTruth, nWords );
115  if ( !Gia_IsComplement(pRoot) )
116  Gia_ManTruthClear( pTruth, nVars );
117  else
118  Gia_ManTruthFill( pTruth, nVars );
119  return pTruth;
120  }
121  // if the number of variables is more than 8, allocate truth tables
122  if ( nVars > 8 )
123  vTtElems = Vec_PtrAllocTruthTables( nVars );
124  // assign elementary truth tables
125  Vec_IntClear( vTruth );
126  Vec_IntClear( vVisited );
127  Gia_ManForEachObjVec( vLeaves, p, pObj, i )
128  {
129  // get room for the truth table
130  pTruth = Vec_IntFetch( vTruth, nWords );
131  // assign elementary variable
132  if ( vTtElems )
133  Gia_ManTruthCopy( pTruth, (unsigned *)Vec_PtrEntry(vTtElems, i), nVars );
134  else
135  Gia_ManTruthCopy( pTruth, uTruths[i], nVars );
136  // save the visited node
137  Vec_IntSetEntry( p->vTruths, Gia_ObjId(p, pObj), Vec_IntSize(vVisited) );
138  Vec_IntPush( vVisited, Gia_ObjId(p, pObj) );
139  }
140  if ( vTtElems )
141  Vec_PtrFree( vTtElems );
142  // clear the marks and compute the truth table
143 // pTruth2 = Gia_ManConvertAigToTruth_rec( p, Gia_Regular(pRoot), vTruth, nWords, vVisited );
144  pTruth = Gia_ManConvertAigToTruth_rec( p, Gia_Regular(pRoot), vTruth, nWords, vVisited );
145  // copy the result
146 // Gia_ManTruthCopy( pTruth, pTruth2, nVars );
147  if ( Gia_IsComplement(pRoot) )
148  Gia_ManTruthNot( pTruth, pTruth, nVars );
149  // clean truth tables
150  Gia_ManForEachObjVec( vVisited, p, pObj, i )
151  Vec_IntSetEntry( p->vTruths, Gia_ObjId(p, pObj), -1 );
152  return pTruth;
153 }
static void Gia_ManTruthCopy(unsigned *pOut, unsigned *pIn, int nVars)
Definition: gia.h:346
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Gia_Obj_t * Gia_Regular(Gia_Obj_t *p)
Definition: gia.h:377
static int Gia_ObjIsConst0(Gia_Obj_t *pObj)
Definition: gia.h:430
static void Vec_IntSetEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:418
static int Abc_TruthWordNum(int nVars)
Definition: abc_global.h:256
static unsigned * Vec_IntFetch(Vec_Int_t *p, int nWords)
Definition: vecInt.h:853
int nWords
Definition: abcNpn.c:127
Definition: gia.h:75
static Vec_Ptr_t * Vec_PtrAllocTruthTables(int nVars)
Definition: vecPtr.h:1065
ABC_NAMESPACE_IMPL_START unsigned * Gia_ManConvertAigToTruth_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vTruth, int nWords, Vec_Int_t *vVisited)
DECLARATIONS ///.
Definition: giaBidec.c:46
Vec_Int_t * vTruths
Definition: gia.h:139
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static void Gia_ManTruthFill(unsigned *pOut, int nVars)
Definition: gia.h:358
static void Gia_ManTruthNot(unsigned *pOut, unsigned *pIn, int nVars)
Definition: gia.h:364
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition: gia.h:988
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Gia_IsComplement(Gia_Obj_t *p)
Definition: gia.h:380
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
static void Gia_ManTruthClear(unsigned *pOut, int nVars)
Definition: gia.h:352
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
int Gia_ManCountChoiceNodes ( Gia_Man_t p)

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

Synopsis [Counts the number of choice nodes]

Description []

SideEffects []

SeeAlso []

Definition at line 1686 of file giaEquiv.c.

1687 {
1688  Gia_Obj_t * pObj;
1689  int i, Counter = 0;
1690  if ( p->pReprs == NULL || p->pNexts == NULL )
1691  return 0;
1692  Gia_ManForEachObj( p, pObj, i )
1693  Counter += Gia_ObjIsHead( p, i );
1694  return Counter;
1695 }
int * pNexts
Definition: gia.h:122
static int Gia_ObjIsHead(Gia_Man_t *p, int Id)
Definition: gia.h:916
Definition: gia.h:75
static int Counter
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
Gia_Rpr_t * pReprs
Definition: gia.h:121
int Gia_ManCountChoices ( Gia_Man_t p)

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

Synopsis [Counts the number of choices]

Description []

SideEffects []

SeeAlso []

Definition at line 1708 of file giaEquiv.c.

1709 {
1710  Gia_Obj_t * pObj;
1711  int i, Counter = 0;
1712  if ( p->pReprs == NULL || p->pNexts == NULL )
1713  return 0;
1714  Gia_ManForEachObj( p, pObj, i )
1715  Counter += (int)(Gia_ObjNext( p, i ) > 0);
1716  return Counter;
1717 }
int * pNexts
Definition: gia.h:122
Definition: gia.h:75
static int Counter
static int Gia_ObjNext(Gia_Man_t *p, int Id)
Definition: gia.h:912
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
Gia_Rpr_t * pReprs
Definition: gia.h:121
int Gia_ManCounterExampleValueLookup ( Gia_Man_t pGia,
int  Id,
int  iFrame 
)

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

Synopsis [Returns the value of the given object in the given timeframe.]

Description [Should be called to probe the value of an object with the given ID (iFrame is a 0-based number of a time frame - should not exceed the number of timeframes in the original counter-example).]

SideEffects []

SeeAlso []

Definition at line 262 of file giaCex.c.

263 {
264  assert( Id >= 0 && Id < Gia_ManObjNum(pGia) );
265  return Abc_InfoHasBit( (unsigned *)pGia->pData2, Gia_ManObjNum(pGia) * iFrame + Id );
266 }
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
unsigned * pData2
Definition: gia.h:170
#define assert(ex)
Definition: util_old.h:213
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManCounterExampleValueStart ( Gia_Man_t pGia,
Abc_Cex_t pCex 
)

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

Synopsis [Starts the process of returning values for internal nodes.]

Description [Should be called when pCex is available, before probing any object for its value using Gia_ManCounterExampleValueLookup().]

SideEffects []

SeeAlso []

Definition at line 184 of file giaCex.c.

185 {
186  Gia_Obj_t * pObj, * pObjRi, * pObjRo;
187  int Val0, Val1, nObjs, i, k, iBit = 0;
188  assert( Gia_ManRegNum(pGia) > 0 ); // makes sense only for sequential AIGs
189  assert( pGia->pData2 == NULL ); // if this fail, there may be a memory leak
190  // allocate memory to store simulation bits for internal nodes
191  pGia->pData2 = ABC_CALLOC( unsigned, Abc_BitWordNum( (pCex->iFrame + 1) * Gia_ManObjNum(pGia) ) );
192  // the register values in the counter-example should be zero
193  Gia_ManForEachRo( pGia, pObj, k )
194  assert( Abc_InfoHasBit(pCex->pData, iBit++) == 0 );
195  // iterate through the timeframes
196  nObjs = Gia_ManObjNum(pGia);
197  for ( i = 0; i <= pCex->iFrame; i++ )
198  {
199  // no need to set constant-0 node
200  // set primary inputs according to the counter-example
201  Gia_ManForEachPi( pGia, pObj, k )
202  if ( Abc_InfoHasBit(pCex->pData, iBit++) )
203  Abc_InfoSetBit( (unsigned *)pGia->pData2, nObjs * i + Gia_ObjId(pGia, pObj) );
204  // compute values for each node
205  Gia_ManForEachAnd( pGia, pObj, k )
206  {
207  Val0 = Abc_InfoHasBit( (unsigned *)pGia->pData2, nObjs * i + Gia_ObjFaninId0p(pGia, pObj) );
208  Val1 = Abc_InfoHasBit( (unsigned *)pGia->pData2, nObjs * i + Gia_ObjFaninId1p(pGia, pObj) );
209  if ( (Val0 ^ Gia_ObjFaninC0(pObj)) & (Val1 ^ Gia_ObjFaninC1(pObj)) )
210  Abc_InfoSetBit( (unsigned *)pGia->pData2, nObjs * i + Gia_ObjId(pGia, pObj) );
211  }
212  // derive values for combinational outputs
213  Gia_ManForEachCo( pGia, pObj, k )
214  {
215  Val0 = Abc_InfoHasBit( (unsigned *)pGia->pData2, nObjs * i + Gia_ObjFaninId0p(pGia, pObj) );
216  if ( Val0 ^ Gia_ObjFaninC0(pObj) )
217  Abc_InfoSetBit( (unsigned *)pGia->pData2, nObjs * i + Gia_ObjId(pGia, pObj) );
218  }
219  if ( i == pCex->iFrame )
220  continue;
221  // transfer values to the register output of the next frame
222  Gia_ManForEachRiRo( pGia, pObjRi, pObjRo, k )
223  if ( Abc_InfoHasBit( (unsigned *)pGia->pData2, nObjs * i + Gia_ObjId(pGia, pObjRi) ) )
224  Abc_InfoSetBit( (unsigned *)pGia->pData2, nObjs * (i+1) + Gia_ObjId(pGia, pObjRo) );
225  }
226  assert( iBit == pCex->nBits );
227  // check that the counter-example is correct, that is, the corresponding output is asserted
228  assert( Abc_InfoHasBit( (unsigned *)pGia->pData2, nObjs * pCex->iFrame + Gia_ObjId(pGia, Gia_ManCo(pGia, pCex->iPo)) ) );
229 }
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
static int Gia_ObjFaninId1p(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:464
unsigned * pData2
Definition: gia.h:170
for(p=first;p->value< newval;p=p->next)
Definition: gia.h:75
#define Gia_ManForEachRiRo(p, pObjRi, pObjRo, i)
Definition: gia.h:1042
if(last==0)
Definition: sparse_int.h:34
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
static void Abc_InfoSetBit(unsigned *p, int i)
Definition: abc_global.h:259
static Gia_Obj_t * Gia_ManCo(Gia_Man_t *p, int v)
Definition: gia.h:404
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
static int Gia_ObjFaninId0p(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:463
#define Gia_ManForEachRo(p, pObj, i)
Definition: gia.h:1038
static int Abc_BitWordNum(int nBits)
Definition: abc_global.h:255
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
void Gia_ManCounterExampleValueStop ( Gia_Man_t pGia)

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

Synopsis [Stops the process of returning values for internal nodes.]

Description [Should be called when probing is no longer needed]

SideEffects []

SeeAlso []

Definition at line 242 of file giaCex.c.

243 {
244  assert( pGia->pData2 != NULL ); // if this fail, we try to call this procedure more than once
245  ABC_FREE( pGia->pData2 );
246  pGia->pData2 = NULL;
247 }
unsigned * pData2
Definition: gia.h:170
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define assert(ex)
Definition: util_old.h:213
void Gia_ManCountMuxXor ( Gia_Man_t p,
int *  pnMuxes,
int *  pnXors 
)

DECLARATIONS ///.

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

FileName [giaMuxes.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Scalable AIG package.]

Synopsis [Multiplexer profiling algorithm.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Counts XORs and MUXes.]

Description []

SideEffects []

SeeAlso []

Definition at line 47 of file giaMuxes.c.

48 {
49  Gia_Obj_t * pObj, * pFan0, * pFan1; int i;
50  *pnMuxes = *pnXors = 0;
51  Gia_ManForEachAnd( p, pObj, i )
52  {
53  if ( !Gia_ObjIsMuxType(pObj) )
54  continue;
55  if ( Gia_ObjRecognizeExor(pObj, &pFan0, &pFan1) )
56  (*pnXors)++;
57  else
58  (*pnMuxes)++;
59  }
60 }
int Gia_ObjRecognizeExor(Gia_Obj_t *pObj, Gia_Obj_t **ppFan0, Gia_Obj_t **ppFan1)
Definition: giaUtil.c:921
Definition: gia.h:75
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
int Gia_ObjIsMuxType(Gia_Obj_t *pNode)
Definition: giaUtil.c:885
int* Gia_ManCreateMuxRefs ( Gia_Man_t p)

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

Synopsis [Assigns references.]

Description []

SideEffects []

SeeAlso []

Definition at line 746 of file giaUtil.c.

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

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

Synopsis [Assigns references.]

Description []

SideEffects []

SeeAlso []

Definition at line 715 of file giaUtil.c.

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

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

Synopsis [Assigns levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 687 of file giaUtil.c.

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

Definition at line 820 of file giaUtil.c.

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

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

Synopsis [Computes the delay trace of the given network.]

Description []

SideEffects []

SeeAlso []

Definition at line 230 of file giaSpeedup.c.

231 {
232  int fUseSorting = 1;
233  If_LibLut_t * pLutLib = (If_LibLut_t *)p->pLutLib;
234  Vec_Int_t * vObjs;
235  Gia_Obj_t * pObj;
236  float tArrival, tArrivalCur, tRequired, tSlack;
237  int i, iObj;
238 
239  // get the library
240  if ( pLutLib && pLutLib->LutMax < Gia_ManLutSizeMax(p) )
241  {
242  printf( "The max LUT size (%d) is less than the max fanin count (%d).\n",
243  pLutLib->LutMax, Gia_ManLutSizeMax(p) );
244  return -TIM_ETERNITY;
245  }
246 
247  // initialize the arrival times
248  Gia_ManTimeStart( p );
249 
250  // propagate arrival times
251  if ( p->pManTime )
253  Gia_ManForEachObj( p, pObj, i )
254  {
255  if ( !Gia_ObjIsCi(pObj) && !Gia_ObjIsCo(pObj) && !Gia_ObjIsLut(p, i) )
256  continue;
257  tArrival = Gia_ObjComputeArrival( p, i, fUseSorting );
258  if ( Gia_ObjIsCi(pObj) && p->pManTime )
259  {
260  tArrival = Tim_ManGetCiArrival( (Tim_Man_t *)p->pManTime, Gia_ObjCioId(pObj) );
261 //printf( "%.3f ", tArrival );
262  }
263  if ( Gia_ObjIsCo(pObj) && p->pManTime )
264  Tim_ManSetCoArrival( (Tim_Man_t *)p->pManTime, Gia_ObjCioId(pObj), tArrival );
265  Gia_ObjSetTimeArrival( p, i, tArrival );
266  }
267 
268  // get the latest arrival times
269  tArrival = -TIM_ETERNITY;
270  Gia_ManForEachCo( p, pObj, i )
271  {
272  tArrivalCur = Gia_ObjTimeArrivalObj( p, Gia_ObjFanin0(pObj) );
273  Gia_ObjSetTimeArrival( p, Gia_ObjId(p,pObj), tArrivalCur );
274  if ( tArrival < tArrivalCur )
275  tArrival = tArrivalCur;
276  }
277 
278  // initialize the required times
279  if ( p->pManTime )
280  {
282  Tim_ManInitPoRequiredAll( (Tim_Man_t *)p->pManTime, tArrival );
283  }
284  else
285  {
286  Gia_ManForEachCo( p, pObj, i )
287  Gia_ObjSetTimeRequiredObj( p, pObj, tArrival );
288  }
289 
290  // propagate the required times
291  vObjs = Gia_ManOrderReverse( p );
292  Vec_IntForEachEntry( vObjs, iObj, i )
293  {
294  pObj = Gia_ManObj(p, iObj);
295  if ( Gia_ObjIsLut(p, iObj) )
296  {
297  Gia_ObjPropagateRequired( p, iObj, fUseSorting );
298  }
299  else if ( Gia_ObjIsCi(pObj) )
300  {
301  if ( p->pManTime )
302  Tim_ManSetCiRequired( (Tim_Man_t *)p->pManTime, Gia_ObjCioId(pObj), Gia_ObjTimeRequired(p, iObj) );
303  }
304  else if ( Gia_ObjIsCo(pObj) )
305  {
306  if ( p->pManTime )
307  {
308  tRequired = Tim_ManGetCoRequired( (Tim_Man_t *)p->pManTime, Gia_ObjCioId(pObj) );
309  Gia_ObjSetTimeRequired( p, iObj, tRequired );
310  }
311  if ( Gia_ObjTimeRequired(p, Gia_ObjFaninId0p(p, pObj)) > Gia_ObjTimeRequired(p, iObj) )
313  }
314 
315  // set slack for this object
316  tSlack = Gia_ObjTimeRequired(p, iObj) - Gia_ObjTimeArrival(p, iObj);
317  assert( tSlack + 0.01 > 0.0 );
318  Gia_ObjSetTimeSlack( p, iObj, tSlack < 0.0 ? 0.0 : tSlack );
319  }
320  Vec_IntFree( vObjs );
321  return tArrival;
322 }
void * pLutLib
Definition: gia.h:166
void Tim_ManIncrementTravId(Tim_Man_t *p)
DECLARATIONS ///.
Definition: timTrav.c:44
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
float Gia_ObjPropagateRequired(Gia_Man_t *p, int iObj, int fUseSorting)
Definition: giaSpeedup.c:170
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
void Tim_ManSetCoArrival(Tim_Man_t *p, int iCo, float Delay)
Definition: timTime.c:116
int LutMax
Definition: if.h:173
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
void Tim_ManSetCiRequired(Tim_Man_t *p, int iCi, float Delay)
Definition: timTime.c:135
static void Gia_ObjSetTimeSlack(Gia_Man_t *p, int Id, float t)
Definition: gia.h:549
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
if(last==0)
Definition: sparse_int.h:34
static float Gia_ObjTimeRequired(Gia_Man_t *p, int Id)
Definition: gia.h:542
void * pManTime
Definition: gia.h:165
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
int Gia_ManLutSizeMax(Gia_Man_t *p)
Definition: giaIf.c:125
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static void Gia_ObjSetTimeArrival(Gia_Man_t *p, int Id, float t)
Definition: gia.h:547
static void Gia_ObjSetTimeRequiredObj(Gia_Man_t *p, Gia_Obj_t *pObj, float t)
Definition: gia.h:551
#define TIM_ETERNITY
MACRO DEFINITIONS ///.
Definition: tim.h:98
static void Gia_ManTimeStart(Gia_Man_t *p)
Definition: gia.h:539
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
static int Gia_ObjFaninId0p(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:463
static float Gia_ObjTimeArrival(Gia_Man_t *p, int Id)
Definition: gia.h:541
float Tim_ManGetCoRequired(Tim_Man_t *p, int iCo)
Definition: timTime.c:222
#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 Gia_ObjIsLut(Gia_Man_t *p, int Id)
Definition: gia.h:952
float Gia_ObjComputeArrival(Gia_Man_t *p, int iObj, int fUseSorting)
Definition: giaSpeedup.c:110
Vec_Int_t * Gia_ManOrderReverse(Gia_Man_t *p)
Definition: giaDfs.c:407
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
static void Gia_ObjSetTimeRequired(Gia_Man_t *p, int Id, float t)
Definition: gia.h:548
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
float Tim_ManGetCiArrival(Tim_Man_t *p, int iCi)
Definition: timTime.c:174
static int Gia_ObjCioId(Gia_Obj_t *pObj)
Definition: gia.h:411
void Tim_ManInitPoRequiredAll(Tim_Man_t *p, float Delay)
Definition: timTime.c:97
static float Gia_ObjTimeArrivalObj(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:544
float Gia_ManDelayTraceLutPrint ( Gia_Man_t p,
int  fVerbose 
)

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

Synopsis [Prints the delay trace for the given network.]

Description []

SideEffects []

SeeAlso []

Definition at line 443 of file giaSpeedup.c.

444 {
445  If_LibLut_t * pLutLib = (If_LibLut_t *)p->pLutLib;
446  int i, Nodes, * pCounters;
447  float tArrival, tDelta, nSteps, Num;
448  // get the library
449  if ( pLutLib && pLutLib->LutMax < Gia_ManLutSizeMax(p) )
450  {
451  printf( "The max LUT size (%d) is less than the max fanin count (%d).\n",
452  pLutLib->LutMax, Gia_ManLutSizeMax(p) );
453  return -ABC_INFINITY;
454  }
455  // decide how many steps
456  nSteps = pLutLib ? 20 : Gia_ManLutLevel(p);
457  pCounters = ABC_ALLOC( int, nSteps + 1 );
458  memset( pCounters, 0, sizeof(int)*(nSteps + 1) );
459  // perform delay trace
460  tArrival = Gia_ManDelayTraceLut( p );
461  tDelta = tArrival / nSteps;
462  // count how many nodes have slack in the corresponding intervals
463  Gia_ManForEachLut( p, i )
464  {
465  if ( Gia_ObjLutSize(p, i) == 0 )
466  continue;
467  Num = Gia_ObjTimeSlack(p, i) / tDelta;
468  if ( Num > nSteps )
469  continue;
470  assert( Num >=0 && Num <= nSteps );
471  pCounters[(int)Num]++;
472  }
473  // print the results
474  if ( fVerbose )
475  {
476  printf( "Max delay = %6.2f. Delay trace using %s model:\n", tArrival, pLutLib? "LUT library" : "unit-delay" );
477  Nodes = 0;
478  for ( i = 0; i < nSteps; i++ )
479  {
480  Nodes += pCounters[i];
481  printf( "%3d %s : %5d (%6.2f %%)\n", pLutLib? 5*(i+1) : i+1,
482  pLutLib? "%":"lev", Nodes, 100.0*Nodes/Gia_ManLutNum(p) );
483  }
484  }
485  ABC_FREE( pCounters );
486  Gia_ManTimeStop( p );
487  return tArrival;
488 }
char * memset()
void * pLutLib
Definition: gia.h:166
int Gia_ManLutLevel(Gia_Man_t *p)
Definition: giaIf.c:163
int LutMax
Definition: if.h:173
float Gia_ManDelayTraceLut(Gia_Man_t *p)
Definition: giaSpeedup.c:230
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
int Gia_ManLutNum(Gia_Man_t *p)
Definition: giaIf.c:144
#define Gia_ManForEachLut(p, i)
Definition: gia.h:968
static int Gia_ObjLutSize(Gia_Man_t *p, int Id)
Definition: gia.h:953
static float Gia_ObjTimeSlack(Gia_Man_t *p, int Id)
Definition: gia.h:543
if(last==0)
Definition: sparse_int.h:34
static void Gia_ManTimeStop(Gia_Man_t *p)
Definition: gia.h:540
int Gia_ManLutSizeMax(Gia_Man_t *p)
Definition: giaIf.c:125
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
#define assert(ex)
Definition: util_old.h:213
int* Gia_ManDeriveNexts ( Gia_Man_t p)

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

Synopsis [Given representatives, derives pointers to the next objects.]

Description []

SideEffects []

SeeAlso []

Definition at line 97 of file giaEquiv.c.

98 {
99  unsigned * pNexts, * pTails;
100  int i;
101  assert( p->pReprs != NULL );
102  assert( p->pNexts == NULL );
103  pNexts = ABC_CALLOC( unsigned, Gia_ManObjNum(p) );
104  pTails = ABC_ALLOC( unsigned, Gia_ManObjNum(p) );
105  for ( i = 0; i < Gia_ManObjNum(p); i++ )
106  pTails[i] = i;
107  for ( i = 0; i < Gia_ManObjNum(p); i++ )
108  {
109  if ( !p->pReprs[i].iRepr || p->pReprs[i].iRepr == GIA_VOID )
110  continue;
111  pNexts[ pTails[p->pReprs[i].iRepr] ] = i;
112  pTails[p->pReprs[i].iRepr] = i;
113  }
114  ABC_FREE( pTails );
115  return (int *)pNexts;
116 }
int * pNexts
Definition: gia.h:122
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
unsigned iRepr
Definition: gia.h:58
#define GIA_VOID
Definition: gia.h:45
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
Gia_Rpr_t * pReprs
Definition: gia.h:121
#define assert(ex)
Definition: util_old.h:213
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManDeriveReprs ( Gia_Man_t p)

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

Synopsis [Given points to the next objects, derives representatives.]

Description []

SideEffects []

SeeAlso []

Definition at line 129 of file giaEquiv.c.

130 {
131  int i, iObj;
132  assert( p->pReprs == NULL );
133  assert( p->pNexts != NULL );
135  for ( i = 0; i < Gia_ManObjNum(p); i++ )
136  Gia_ObjSetRepr( p, i, GIA_VOID );
137  for ( i = 0; i < Gia_ManObjNum(p); i++ )
138  {
139  if ( p->pNexts[i] == 0 )
140  continue;
141  if ( p->pReprs[i].iRepr != GIA_VOID )
142  continue;
143  // next is set, repr is not set
144  for ( iObj = p->pNexts[i]; iObj; iObj = p->pNexts[iObj] )
145  p->pReprs[iObj].iRepr = i;
146  }
147 }
int * pNexts
Definition: gia.h:122
unsigned iRepr
Definition: gia.h:58
static void Gia_ObjSetRepr(Gia_Man_t *p, int Id, int Num)
Definition: gia.h:888
#define GIA_VOID
Definition: gia.h:45
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
Gia_Rpr_t * pReprs
Definition: gia.h:121
#define assert(ex)
Definition: util_old.h:213
Definition: gia.h:56
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManDetectSeqSignals ( Gia_Man_t p,
int  fSetReset,
int  fVerbose 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 130 of file giaEnable.c.

131 {
132  Vec_Int_t * vSuper;
133  Gia_Obj_t * pFlop, * pObjC, * pObj0, * pObj1, * pNode, * pTemp;
134  int i, k, Ent, * pSets, * pResets, * pEnables;
135  int nHaveSetReset = 0, nHaveEnable = 0;
136  assert( Gia_ManRegNum(p) > 0 );
137  pSets = ABC_CALLOC( int, Gia_ManObjNum(p) );
138  pResets = ABC_CALLOC( int, Gia_ManObjNum(p) );
139  pEnables = ABC_CALLOC( int, Gia_ManObjNum(p) );
140  vSuper = Vec_IntAlloc( 100 );
141  Gia_ManForEachRi( p, pFlop, i )
142  {
143  pNode = Gia_ObjFanin0(pFlop);
144  if ( !Gia_ObjIsAnd(pNode) )
145  continue;
146  // detect sets/resets
147  Gia_CollectSuper( p, pNode, vSuper );
148  if ( Gia_ObjFaninC0(pFlop) )
149  Vec_IntForEachEntry( vSuper, Ent, k )
150  pSets[Ent]++;
151  else
152  Vec_IntForEachEntry( vSuper, Ent, k )
153  pResets[Ent]++;
154  // detect enables
155  if ( !Gia_ObjIsMuxType(pNode) )
156  continue;
157  pObjC = Gia_ObjRecognizeMux( pNode, &pObj0, &pObj1 );
158  pTemp = Gia_ObjRiToRo( p, pFlop );
159  if ( Gia_Regular(pObj0) != pTemp && Gia_Regular(pObj1) != pTemp )
160  continue;
161  if ( !Gia_ObjFaninC0(pFlop) )
162  {
163  pObj0 = Gia_Not(pObj0);
164  pObj1 = Gia_Not(pObj1);
165  }
166  if ( Gia_IsComplement(pObjC) )
167  {
168  pObjC = Gia_Not(pObjC);
169  pTemp = pObj0;
170  pObj0 = pObj1;
171  pObj1 = pTemp;
172  }
173  // detect controls
174 // Gia_CollectSuper( p, pObjC, vSuper );
175 // Vec_IntForEachEntry( vSuper, Ent, k )
176 // pEnables[Ent]++;
177  pEnables[Gia_ObjId(p, pObjC)]++;
178  nHaveEnable++;
179  }
180  Gia_ManForEachRi( p, pFlop, i )
181  {
182  pNode = Gia_ObjFanin0(pFlop);
183  if ( !Gia_ObjIsAnd(pNode) )
184  continue;
185  // detect sets/resets
186  Gia_CollectSuper( p, pNode, vSuper );
187  Vec_IntForEachEntry( vSuper, Ent, k )
188  if ( pSets[Ent] > 1 || pResets[Ent] > 1 )
189  {
190  nHaveSetReset++;
191  break;
192  }
193  }
194  Vec_IntFree( vSuper );
195  ABC_FREE( p->pRefs );
196  Gia_ManCreateRefs( p );
197  if ( fVerbose )
198  {
199  printf( "Flops with set/reset = %6d. Flops with enable = %6d.\n", nHaveSetReset, nHaveEnable );
200  if ( fSetReset )
201  {
202  Gia_ManPrintSignals( p, pSets, "Set signals" );
203  Gia_ManPrintSignals( p, pResets, "Reset signals" );
204  }
205  Gia_ManPrintSignals( p, pEnables, "Enable signals" );
206  }
207  ABC_FREE( p->pRefs );
208  ABC_FREE( pSets );
209  ABC_FREE( pResets );
210  ABC_FREE( pEnables );
211 }
void Gia_ManCreateRefs(Gia_Man_t *p)
Definition: giaUtil.c:715
void Gia_CollectSuper(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vSuper)
Definition: giaEnable.c:70
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Gia_Obj_t * Gia_Regular(Gia_Obj_t *p)
Definition: gia.h:377
int * pRefs
Definition: gia.h:114
Definition: gia.h:75
void Gia_ManPrintSignals(Gia_Man_t *p, int *pFreq, char *pStr)
Definition: giaEnable.c:96
static Gia_Obj_t * Gia_Not(Gia_Obj_t *p)
Definition: gia.h:378
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
int Gia_ObjIsMuxType(Gia_Obj_t *pNode)
Definition: giaUtil.c:885
static int Gia_IsComplement(Gia_Obj_t *p)
Definition: gia.h:380
#define ABC_FREE(obj)
Definition: abc_global.h:232
static Gia_Obj_t * Gia_ObjRiToRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:447
Gia_Obj_t * Gia_ObjRecognizeMux(Gia_Obj_t *pNode, Gia_Obj_t **ppNodeT, Gia_Obj_t **ppNodeE)
Definition: giaUtil.c:959
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define assert(ex)
Definition: util_old.h:213
#define Gia_ManForEachRi(p, pObj, i)
Definition: gia.h:1040
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManDup ( Gia_Man_t p)

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

Synopsis [Duplicates AIG without any changes.]

Description []

SideEffects []

SeeAlso []

Definition at line 552 of file giaDup.c.

553 {
554  Gia_Man_t * pNew;
555  Gia_Obj_t * pObj;
556  int i;
557  pNew = Gia_ManStart( Gia_ManObjNum(p) );
558  pNew->pName = Abc_UtilStrsav( p->pName );
559  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
560  if ( Gia_ManHasChoices(p) )
561  pNew->pSibls = ABC_CALLOC( int, Gia_ManObjNum(p) );
562  Gia_ManConst0(p)->Value = 0;
563  Gia_ManForEachObj1( p, pObj, i )
564  {
565  if ( Gia_ObjIsBuf(pObj) )
566  pObj->Value = Gia_ManAppendBuf( pNew, Gia_ObjFanin0Copy(pObj) );
567  else if ( Gia_ObjIsAnd(pObj) )
568  {
569  pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
570  if ( Gia_ObjSibl(p, Gia_ObjId(p, pObj)) )
571  pNew->pSibls[Abc_Lit2Var(pObj->Value)] = Abc_Lit2Var(Gia_ObjSiblObj(p, Gia_ObjId(p, pObj))->Value);
572  }
573  else if ( Gia_ObjIsCi(pObj) )
574  pObj->Value = Gia_ManAppendCi( pNew );
575  else if ( Gia_ObjIsCo(pObj) )
576  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
577  }
578  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
579  if ( p->pCexSeq )
580  pNew->pCexSeq = Abc_CexDup( p->pCexSeq, Gia_ManRegNum(p) );
581  return pNew;
582 }
static int Gia_ManAppendAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: gia.h:592
static Gia_Obj_t * Gia_ObjSiblObj(Gia_Man_t *p, int Id)
Definition: gia.h:894
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
int * pSibls
Definition: gia.h:123
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
static int Gia_ObjIsBuf(Gia_Obj_t *pObj)
Definition: gia.h:427
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
Definition: gia.h:75
static int Gia_ManHasChoices(Gia_Man_t *p)
Definition: gia.h:397
static int Gia_ObjSibl(Gia_Man_t *p, int Id)
Definition: gia.h:893
char * pName
Definition: gia.h:97
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
static int Gia_ManAppendBuf(Gia_Man_t *p, int iLit)
Definition: gia.h:694
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
Abc_Cex_t * Abc_CexDup(Abc_Cex_t *p, int nRegsNew)
Definition: utilCex.c:145
Definition: gia.h:95
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
unsigned Value
Definition: gia.h:87
#define Gia_ManForEachObj1(p, pObj, i)
Definition: gia.h:986
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
Abc_Cex_t * pCexSeq
Definition: gia.h:136
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManDupAndOr ( Gia_Man_t p,
int  nOuts,
int  fUseOr,
int  fCompl 
)

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

Synopsis [Computes the AND of all POs.]

Description []

SideEffects []

SeeAlso []

Definition at line 2275 of file giaDup.c.

2276 {
2277  Gia_Man_t * pNew, * pTemp;
2278  Gia_Obj_t * pObj;
2279  int i, iResult;
2280  assert( Gia_ManRegNum(p) == 0 );
2281  pNew = Gia_ManStart( Gia_ManObjNum(p) );
2282  pNew->pName = Abc_UtilStrsav( p->pName );
2283  Gia_ManConst0(p)->Value = 0;
2284  Gia_ManHashAlloc( pNew );
2285  Gia_ManForEachPi( p, pObj, i )
2286  pObj->Value = Gia_ManAppendCi( pNew );
2287  Gia_ManForEachAnd( p, pObj, i )
2288  pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
2289  if ( fUseOr ) // construct OR of all POs
2290  {
2291  iResult = 0;
2292  Gia_ManForEachPo( p, pObj, i )
2293  iResult = Gia_ManHashOr( pNew, iResult, Gia_ObjFanin0Copy(pObj) );
2294  }
2295  else // construct AND of all POs
2296  {
2297  iResult = 1;
2298  Gia_ManForEachPo( p, pObj, i )
2299  iResult = Gia_ManHashAnd( pNew, iResult, Gia_ObjFanin0Copy(pObj) );
2300  }
2301  iResult = Abc_LitNotCond( iResult, (int)(fCompl > 0) );
2302 // Gia_ManForEachPo( p, pObj, i )
2303 // pObj->Value = Gia_ManAppendCo( pNew, iResult );
2304  for ( i = 0; i < nOuts; i++ )
2305  Gia_ManAppendCo( pNew, iResult );
2306  Gia_ManHashStop( pNew );
2307  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
2308  pNew = Gia_ManCleanup( pTemp = pNew );
2309  Gia_ManStop( pTemp );
2310  return pNew;
2311 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
for(p=first;p->value< newval;p=p->next)
Definition: gia.h:75
char * pName
Definition: gia.h:97
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
int Gia_ManHashOr(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:611
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
void Gia_ManDupAppend ( Gia_Man_t pNew,
Gia_Man_t pTwo 
)

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

Synopsis [Appends second AIG without any changes.]

Description []

SideEffects []

SeeAlso []

Definition at line 746 of file giaDup.c.

747 {
748  Gia_Obj_t * pObj;
749  int i;
750  if ( pNew->nRegs > 0 )
751  pNew->nRegs = 0;
752  if ( pNew->pHTable == NULL )
753  Gia_ManHashStart( pNew );
754  Gia_ManConst0(pTwo)->Value = 0;
755  Gia_ManForEachObj1( pTwo, pObj, i )
756  {
757  if ( Gia_ObjIsAnd(pObj) )
758  pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
759  else if ( Gia_ObjIsCi(pObj) )
760  pObj->Value = Gia_ManAppendCi( pNew );
761  else if ( Gia_ObjIsCo(pObj) )
762  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
763  }
764 }
static int Gia_ManAppendAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: gia.h:592
int * pHTable
Definition: gia.h:110
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
Definition: gia.h:75
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
void Gia_ManHashStart(Gia_Man_t *p)
Definition: giaHash.c:117
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
int nRegs
Definition: gia.h:99
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
unsigned Value
Definition: gia.h:87
#define Gia_ManForEachObj1(p, pObj, i)
Definition: gia.h:986
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
Gia_Man_t* Gia_ManDupAppendCones ( Gia_Man_t p,
Gia_Man_t **  ppCones,
int  nCones,
int  fOnlyRegs 
)

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

Synopsis [Appends logic cones as additional property outputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 836 of file giaDup.c.

837 {
838  Gia_Man_t * pNew, * pOne;
839  Gia_Obj_t * pObj;
840  int i, k;
841  pNew = Gia_ManStart( Gia_ManObjNum(p) );
842  pNew->pName = Abc_UtilStrsav( p->pName );
843  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
844  Gia_ManHashAlloc( pNew );
845  Gia_ManConst0(p)->Value = 0;
846  Gia_ManForEachCi( p, pObj, i )
847  pObj->Value = Gia_ManAppendCi( pNew );
848  Gia_ManForEachAnd( p, pObj, i )
849  pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
850  Gia_ManForEachPo( p, pObj, i )
851  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
852  for ( k = 0; k < nCones; k++ )
853  {
854  pOne = ppCones[k];
855  assert( Gia_ManPoNum(pOne) == 1 );
856  assert( Gia_ManRegNum(pOne) == 0 );
857  if ( fOnlyRegs )
858  assert( Gia_ManPiNum(pOne) == Gia_ManRegNum(p) );
859  else
860  assert( Gia_ManPiNum(pOne) == Gia_ManCiNum(p) );
861  Gia_ManConst0(pOne)->Value = 0;
862  Gia_ManForEachPi( pOne, pObj, i )
863  pObj->Value = Gia_ManCiLit( pNew, fOnlyRegs ? Gia_ManPiNum(p) + i : i );
864  Gia_ManForEachAnd( pOne, pObj, i )
865  pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
866  Gia_ManForEachPo( pOne, pObj, i )
867  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
868  }
869  Gia_ManForEachRi( p, pObj, i )
870  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
871  Gia_ManHashStop( pNew );
872  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
873  pNew = Gia_ManCleanup( pOne = pNew );
874  Gia_ManStop( pOne );
875  return pNew;
876 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static int Gia_ManCiLit(Gia_Man_t *p, int CiId)
Definition: gia.h:435
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
for(p=first;p->value< newval;p=p->next)
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
char * pName
Definition: gia.h:97
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
#define Gia_ManForEachRi(p, pObj, i)
Definition: gia.h:1040
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManDupAppendNew ( Gia_Man_t pOne,
Gia_Man_t pTwo 
)

Definition at line 783 of file giaDup.c.

784 {
785  Gia_Man_t * pNew;
786  Gia_Obj_t * pObj;
787  int i;
788  pNew = Gia_ManStart( Gia_ManObjNum(pOne) + Gia_ManObjNum(pTwo) );
789  pNew->pName = Abc_UtilStrsav( pOne->pName );
790  pNew->pSpec = Abc_UtilStrsav( pOne->pSpec );
791  Gia_ManHashAlloc( pNew );
792  Gia_ManConst0(pOne)->Value = 0;
793  Gia_ManForEachObj1( pOne, pObj, i )
794  {
795  if ( Gia_ObjIsAnd(pObj) )
796  pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
797  else if ( Gia_ObjIsCi(pObj) )
798  pObj->Value = Gia_ManAppendCi( pNew );
799  }
800  Gia_ManConst0(pTwo)->Value = 0;
801  Gia_ManForEachObj1( pTwo, pObj, i )
802  {
803  if ( Gia_ObjIsAnd(pObj) )
804  pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
805  else if ( Gia_ObjIsPi(pTwo, pObj) )
806  pObj->Value = Gia_ManPi(pOne, Gia_ObjCioId(pObj))->Value;
807  else if ( Gia_ObjIsCi(pObj) )
808  pObj->Value = Gia_ManAppendCi( pNew );
809  }
810  Gia_ManHashStop( pNew );
811  // primary outputs
812  Gia_ManForEachPo( pOne, pObj, i )
813  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
814  Gia_ManForEachPo( pTwo, pObj, i )
815  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
816  // flop inputs
817  Gia_ManForEachRi( pOne, pObj, i )
818  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
819  Gia_ManForEachRi( pTwo, pObj, i )
820  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
821  Gia_ManSetRegNum( pNew, Gia_ManRegNum(pOne) + Gia_ManRegNum(pTwo) );
822  return pNew;
823 }
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
Definition: gia.h:75
static Gia_Obj_t * Gia_ManPi(Gia_Man_t *p, int v)
Definition: gia.h:405
char * pName
Definition: gia.h:97
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
Definition: gia.h:95
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
unsigned Value
Definition: gia.h:87
#define Gia_ManForEachRi(p, pObj, i)
Definition: gia.h:1040
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
#define Gia_ManForEachObj1(p, pObj, i)
Definition: gia.h:986
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
static int Gia_ObjCioId(Gia_Obj_t *pObj)
Definition: gia.h:411
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
static int Gia_ObjIsPi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:441
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
void Gia_ManDupAppendShare ( Gia_Man_t p,
Gia_Man_t pTwo 
)

Definition at line 765 of file giaDup.c.

766 {
767  Gia_Obj_t * pObj;
768  int i;
769  assert( Gia_ManCiNum(pNew) == Gia_ManCiNum(pTwo) );
770  if ( pNew->pHTable == NULL )
771  Gia_ManHashStart( pNew );
772  Gia_ManConst0(pTwo)->Value = 0;
773  Gia_ManForEachObj1( pTwo, pObj, i )
774  {
775  if ( Gia_ObjIsAnd(pObj) )
776  pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
777  else if ( Gia_ObjIsCi(pObj) )
778  pObj->Value = Gia_Obj2Lit( pNew, Gia_ManCi( pNew, Gia_ObjCioId(pObj) ) );
779  else if ( Gia_ObjIsCo(pObj) )
780  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
781  }
782 }
static Gia_Obj_t * Gia_ManCi(Gia_Man_t *p, int v)
Definition: gia.h:403
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
Definition: gia.h:75
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
void Gia_ManHashStart(Gia_Man_t *p)
Definition: giaHash.c:117
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
#define Gia_ManForEachObj1(p, pObj, i)
Definition: gia.h:986
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
static int Gia_ObjCioId(Gia_Obj_t *pObj)
Definition: gia.h:411
static int Gia_Obj2Lit(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:433
Gia_Man_t* Gia_ManDupCof ( Gia_Man_t p,
int  iVar 
)

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

Synopsis [Duplicates AIG in the DFS order while putting CIs first.]

Description []

SideEffects []

SeeAlso []

Definition at line 862 of file giaCof.c.

863 {
864  Gia_Man_t * pNew, * pTemp;
865  pNew = Gia_ManDupCofInt( p, iVar );
866  pNew = Gia_ManCleanup( pTemp = pNew );
867  Gia_ManStop( pTemp );
868  return pNew;
869 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
Definition: gia.h:95
Gia_Man_t * Gia_ManDupCofInt(Gia_Man_t *p, int iVar)
Definition: giaCof.c:780
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
Gia_Man_t* Gia_ManDupCofactorObj ( Gia_Man_t p,
int  iObj,
int  Value 
)

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

Synopsis [Cofactors w.r.t. an internal node.]

Description []

SideEffects []

SeeAlso []

Definition at line 1319 of file giaDup.c.

1320 {
1321  Gia_Man_t * pNew, * pTemp;
1322  Gia_Obj_t * pObj;
1323  int i, iObjValue = -1;
1324  assert( Gia_ManRegNum(p) == 0 );
1325  assert( iObj > 0 && iObj < Gia_ManObjNum(p) );
1326  assert( Gia_ObjIsCand(Gia_ManObj(p, iObj)) );
1327  assert( Value == 0 || Value == 1 );
1328  pNew = Gia_ManStart( Gia_ManObjNum(p) );
1329  pNew->pName = Abc_UtilStrsav( p->pName );
1330  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1331  Gia_ManConst0(p)->Value = 0;
1332  Gia_ManHashAlloc( pNew );
1333  Gia_ManForEachObj1( p, pObj, i )
1334  {
1335  if ( Gia_ObjIsCi(pObj) )
1336  pObj->Value = Gia_ManAppendCi( pNew );
1337  else if ( Gia_ObjIsAnd(pObj) )
1338  pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1339  else if ( Gia_ObjIsCo(pObj) )
1340  pObj->Value = Gia_ManAppendCo( pNew, Gia_ManHashAnd(pNew, Gia_ObjFanin0Copy(pObj), iObjValue) );
1341  if ( i == iObj )
1342  iObjValue = Abc_LitNotCond(pObj->Value, !Value), pObj->Value = Value;
1343  }
1344  pNew = Gia_ManCleanup( pTemp = pNew );
1345  Gia_ManStop( pTemp );
1346  return pNew;
1347 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static int Gia_ObjIsCand(Gia_Obj_t *pObj)
Definition: gia.h:429
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
Definition: gia.h:75
char * pName
Definition: gia.h:97
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
Definition: gia.h:95
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
#define Gia_ManForEachObj1(p, pObj, i)
Definition: gia.h:986
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManDupCofactorVar ( Gia_Man_t p,
int  iVar,
int  Value 
)

Definition at line 1281 of file giaDup.c.

1282 {
1283  Gia_Man_t * pNew, * pTemp;
1284  Gia_Obj_t * pObj;
1285  int i;
1286  assert( iVar >= 0 && iVar < Gia_ManPiNum(p) );
1287  assert( Value == 0 || Value == 1 );
1288  pNew = Gia_ManStart( Gia_ManObjNum(p) );
1289  pNew->pName = Abc_UtilStrsav( p->pName );
1290  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1291  Gia_ManFillValue( p );
1292  Gia_ManConst0(p)->Value = 0;
1293  Gia_ManForEachCi( p, pObj, i )
1294  pObj->Value = Gia_ManAppendCi(pNew);
1295  Gia_ManPi( p, iVar )->Value = Value; // modification!
1296  Gia_ManHashAlloc( pNew );
1297  Gia_ManForEachCo( p, pObj, i )
1298  Gia_ManDupCofactorVar_rec( pNew, p, Gia_ObjFanin0(pObj) );
1299  Gia_ManForEachCo( p, pObj, i )
1300  Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1301  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
1302  pNew->nConstrs = p->nConstrs;
1303  pNew = Gia_ManCleanup( pTemp = pNew );
1304  Gia_ManStop( pTemp );
1305  return pNew;
1306 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
void Gia_ManDupCofactorVar_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaDup.c:1272
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
static Gia_Obj_t * Gia_ManPi(Gia_Man_t *p, int v)
Definition: gia.h:405
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
char * pName
Definition: gia.h:97
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManDupCofAll ( Gia_Man_t p,
int  nFanLim,
int  fVerbose 
)

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

Synopsis [Cofactors all variables whose fanout is higher than this.]

Description []

SideEffects []

SeeAlso []

Definition at line 987 of file giaCof.c.

988 {
989  Gia_Man_t * pNew;
990  Vec_Int_t * vSigs = Gia_ManCofVars( p, nFanLim );
991  pNew = Gia_ManDupCofAllInt( p, vSigs, fVerbose );
992  Vec_IntFree( vSigs );
993  return pNew;
994 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Gia_Man_t * Gia_ManDupCofAllInt(Gia_Man_t *p, Vec_Int_t *vSigs, int fVerbose)
Definition: giaCof.c:936
Vec_Int_t * Gia_ManCofVars(Gia_Man_t *p, int nFanLim)
Definition: giaCof.c:883
Definition: gia.h:95
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Gia_Man_t* Gia_ManDupCofAllInt ( Gia_Man_t p,
Vec_Int_t vSigs,
int  fVerbose 
)

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

Synopsis [Cofactors selected variables (should be in reverse topo order).]

Description []

SideEffects []

SeeAlso []

Definition at line 936 of file giaCof.c.

937 {
938  Vec_Int_t * vSigsNew, * vTemp;
939  Gia_Man_t * pAig, * pCof, * pNew;
940  int iVar;
941  if ( fVerbose )
942  {
943  printf( "Cofactoring %d signals.\n", Vec_IntSize(vSigs) );
944  Gia_ManPrintStats( p, NULL );
945  }
946  if ( Vec_IntSize( vSigs ) > 200 )
947  {
948  printf( "Too many signals to cofactor.\n" );
949  return NULL;
950  }
951  pAig = Gia_ManDup( p );
952  vSigsNew = Vec_IntDup( vSigs );
953  while ( Vec_IntSize(vSigsNew) > 0 )
954  {
955  Vec_IntSort( vSigsNew, 0 );
956  iVar = Vec_IntPop( vSigsNew );
957 // Gia_ManCreateRefs( pAig );
958 // printf( "ref count = %d\n", Gia_ObjRefNum( pAig, Gia_ManObj(pAig, iVar) ) );
959 // ABC_FREE( pAig->pRefs );
960  pCof = Gia_ManDupCofInt( pAig, iVar );
961  pNew = Gia_ManCleanup( pCof );
962  vSigsNew = Gia_ManTransfer( pAig, pCof, pNew, vTemp = vSigsNew );
963  Vec_IntFree( vTemp );
964  Gia_ManStop( pAig );
965  Gia_ManStop( pCof );
966  pAig = pNew;
967  if ( fVerbose )
968  printf( "Cofactored variable %d.\n", iVar );
969  if ( fVerbose )
970  Gia_ManPrintStats( pAig, NULL );
971  }
972  Vec_IntFree( vSigsNew );
973  return pAig;
974 }
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition: giaDup.c:552
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
void Gia_ManPrintStats(Gia_Man_t *p, Gps_Par_t *pPars)
Definition: giaMan.c:389
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static void Vec_IntSort(Vec_Int_t *p, int fReverse)
Definition: vecInt.h:1293
static int Vec_IntPop(Vec_Int_t *p)
Vec_Int_t * Gia_ManTransfer(Gia_Man_t *pAig, Gia_Man_t *pCof, Gia_Man_t *pNew, Vec_Int_t *vSigs)
Definition: giaCof.c:909
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Definition: gia.h:95
Gia_Man_t * Gia_ManDupCofInt(Gia_Man_t *p, int iVar)
Definition: giaCof.c:780
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
Gia_Man_t* Gia_ManDupCollapse ( Gia_Man_t p,
Gia_Man_t pBoxes,
Vec_Int_t vBoxPres,
int  fSeq 
)

Definition at line 748 of file giaTim.c.

749 {
750  // this procedure assumes that sequential AIG with boxes is unshuffled to have valid boxes
751  Tim_Man_t * pManTime = (Tim_Man_t *)p->pManTime;
752  Gia_Man_t * pNew, * pTemp;
753  Gia_Obj_t * pObj, * pObjBox;
754  int i, k, curCi, curCo;
755  assert( !fSeq || p->vRegClasses );
756  //assert( Gia_ManRegNum(p) == 0 );
757  assert( Gia_ManCiNum(p) == Tim_ManPiNum(pManTime) + Gia_ManCoNum(pBoxes) );
758  pNew = Gia_ManStart( Gia_ManObjNum(p) );
759  pNew->pName = Abc_UtilStrsav( p->pName );
760  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
761  if ( Gia_ManHasChoices(p) )
762  pNew->pSibls = ABC_CALLOC( int, Gia_ManObjNum(p) );
763  Gia_ManHashAlloc( pNew );
764  // copy const and real PIs
765  Gia_ManFillValue( p );
766  Gia_ManConst0(p)->Value = 0;
769  for ( i = 0; i < Tim_ManPiNum(pManTime); i++ )
770  {
771  pObj = Gia_ManCi( p, i );
772  pObj->Value = Gia_ManAppendCi(pNew);
773  Gia_ObjSetTravIdCurrent( p, pObj );
774  }
775  // create logic for each box
776  curCi = Tim_ManPiNum(pManTime);
777  curCo = 0;
778  for ( i = 0; i < Tim_ManBoxNum(pManTime); i++ )
779  {
780  // clean boxes
781  Gia_ManIncrementTravId( pBoxes );
782  Gia_ObjSetTravIdCurrent( pBoxes, Gia_ManConst0(pBoxes) );
783  Gia_ManConst0(pBoxes)->Value = 0;
784  // add internal nodes
785  if ( Tim_ManBoxIsBlack(pManTime, i) )
786  {
787  int fSkip = (vBoxPres != NULL && !Vec_IntEntry(vBoxPres, i));
788  for ( k = 0; k < Tim_ManBoxInputNum(pManTime, i); k++ )
789  {
790  pObj = Gia_ManCo( p, curCo + k );
791  Gia_ManDupCollapse_rec( p, Gia_ObjFanin0(pObj), pNew );
792  pObj->Value = fSkip ? -1 : Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
793  }
794  for ( k = 0; k < Tim_ManBoxOutputNum(pManTime, i); k++ )
795  {
796  pObj = Gia_ManCi( p, curCi + k );
797  pObj->Value = fSkip ? 0 : Gia_ManAppendCi(pNew);
798  Gia_ObjSetTravIdCurrent( p, pObj );
799  }
800  }
801  else
802  {
803  for ( k = 0; k < Tim_ManBoxInputNum(pManTime, i); k++ )
804  {
805  // build logic
806  pObj = Gia_ManCo( p, curCo + k );
807  Gia_ManDupCollapse_rec( p, Gia_ObjFanin0(pObj), pNew );
808  // transfer to the PI
809  pObjBox = Gia_ManCi( pBoxes, k );
810  pObjBox->Value = Gia_ObjFanin0Copy(pObj);
811  Gia_ObjSetTravIdCurrent( pBoxes, pObjBox );
812  }
813  for ( k = 0; k < Tim_ManBoxOutputNum(pManTime, i); k++ )
814  {
815  // build logic
816  pObjBox = Gia_ManCo( pBoxes, curCi - Tim_ManPiNum(pManTime) + k );
817  Gia_ManDupCollapse_rec( pBoxes, Gia_ObjFanin0(pObjBox), pNew );
818  // transfer to the PI
819  pObj = Gia_ManCi( p, curCi + k );
820  pObj->Value = Gia_ObjFanin0Copy(pObjBox);
821  Gia_ObjSetTravIdCurrent( p, pObj );
822  }
823  }
824  curCo += Tim_ManBoxInputNum(pManTime, i);
825  curCi += Tim_ManBoxOutputNum(pManTime, i);
826  }
827  // add remaining nodes
828  for ( i = Tim_ManCoNum(pManTime) - Tim_ManPoNum(pManTime); i < Tim_ManCoNum(pManTime); i++ )
829  {
830  pObj = Gia_ManCo( p, i );
831  Gia_ManDupCollapse_rec( p, Gia_ObjFanin0(pObj), pNew );
832  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
833  }
834  curCo += Tim_ManPoNum(pManTime);
835  // verify counts
836  assert( curCi == Gia_ManCiNum(p) );
837  assert( curCo == Gia_ManCoNum(p) );
838  Gia_ManSetRegNum( pNew, (fSeq && p->vRegClasses) ? Vec_IntSize(p->vRegClasses) : Gia_ManRegNum(p) );
839  Gia_ManHashStop( pNew );
840  pNew = Gia_ManCleanup( pTemp = pNew );
841  Gia_ManCleanupRemap( p, pTemp );
842  Gia_ManStop( pTemp );
843  assert( Tim_ManPoNum(pManTime) == Gia_ManCoNum(pNew) );
844  assert( Tim_ManPiNum(pManTime) == Gia_ManCiNum(pNew) );
845  return pNew;
846 }
int Tim_ManCoNum(Tim_Man_t *p)
Definition: timMan.c:684
void Gia_ManDupCollapse_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Gia_Man_t *pNew)
Definition: giaTim.c:733
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static Gia_Obj_t * Gia_ManCi(Gia_Man_t *p, int v)
Definition: gia.h:403
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
Vec_Int_t * vRegClasses
Definition: gia.h:144
int * pSibls
Definition: gia.h:123
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
int Tim_ManBoxOutputNum(Tim_Man_t *p, int iBox)
Definition: timBox.c:202
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
void Gia_ManCleanupRemap(Gia_Man_t *p, Gia_Man_t *pGia)
Definition: giaTim.c:424
Definition: gia.h:75
static int Gia_ManHasChoices(Gia_Man_t *p)
Definition: gia.h:397
int Tim_ManPiNum(Tim_Man_t *p)
Definition: timMan.c:688
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
char * pName
Definition: gia.h:97
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
void * pManTime
Definition: gia.h:165
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
int Tim_ManBoxNum(Tim_Man_t *p)
Definition: timMan.c:702
int Tim_ManBoxInputNum(Tim_Man_t *p, int iBox)
Definition: timBox.c:186
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
int Tim_ManBoxIsBlack(Tim_Man_t *p, int iBox)
Definition: timBox.c:257
static Gia_Obj_t * Gia_ManCo(Gia_Man_t *p, int v)
Definition: gia.h:404
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
int Tim_ManPoNum(Tim_Man_t *p)
Definition: timMan.c:694
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManDupCones ( Gia_Man_t p,
int *  pPos,
int  nPos,
int  fTrimPis 
)

Definition at line 2691 of file giaDup.c.

2692 {
2693  Gia_Man_t * pNew;
2694  Vec_Ptr_t * vLeaves, * vNodes, * vRoots;
2695  Gia_Obj_t * pObj;
2696  int i;
2697 
2698  // collect initial POs
2699  vLeaves = Vec_PtrAlloc( 100 );
2700  vNodes = Vec_PtrAlloc( 100 );
2701  vRoots = Vec_PtrAlloc( 100 );
2702  for ( i = 0; i < nPos; i++ )
2703  Vec_PtrPush( vRoots, Gia_ManPo(p, pPos[i]) );
2704 
2705  // mark internal nodes
2708  Vec_PtrForEachEntry( Gia_Obj_t *, vRoots, pObj, i )
2709  Gia_ManDupCones_rec( p, pObj, vLeaves, vNodes, vRoots );
2710  Vec_PtrSort( vLeaves, (int (*)(void))Gia_ObjCompareByCioId );
2711 
2712  // start the new manager
2713 // Gia_ManFillValue( p );
2714  pNew = Gia_ManStart( Vec_PtrSize(vLeaves) + Vec_PtrSize(vNodes) + Vec_PtrSize(vRoots) + 1);
2715  pNew->pName = Abc_UtilStrsav( p->pName );
2716  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
2717  // map the constant node
2718  Gia_ManConst0(p)->Value = 0;
2719  // create PIs
2720  if ( fTrimPis )
2721  {
2722  Vec_PtrForEachEntry( Gia_Obj_t *, vLeaves, pObj, i )
2723  pObj->Value = Gia_ManAppendCi( pNew );
2724  }
2725  else
2726  {
2727  Gia_ManForEachPi( p, pObj, i )
2728  pObj->Value = Gia_ManAppendCi( pNew );
2729  }
2730  // create LOs
2731  Vec_PtrForEachEntryStart( Gia_Obj_t *, vRoots, pObj, i, nPos )
2732  Gia_ObjRiToRo(p, pObj)->Value = Gia_ManAppendCi( pNew );
2733  // create internal nodes
2734  Vec_PtrForEachEntry( Gia_Obj_t *, vNodes, pObj, i )
2735  pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
2736  // create COs
2737  Vec_PtrForEachEntry( Gia_Obj_t *, vRoots, pObj, i )
2738  Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
2739  // finalize
2740  Gia_ManSetRegNum( pNew, Vec_PtrSize(vRoots)-nPos );
2741  Vec_PtrFree( vLeaves );
2742  Vec_PtrFree( vNodes );
2743  Vec_PtrFree( vRoots );
2744  return pNew;
2745 
2746 }
static int Gia_ManAppendAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: gia.h:592
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
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
int Gia_ObjCompareByCioId(Gia_Obj_t **pp1, Gia_Obj_t **pp2)
Definition: giaDup.c:2666
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
static void Vec_PtrSort(Vec_Ptr_t *p, int(*Vec_PtrSortCompare)()) ___unused
Definition: vecPtr.h:851
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Definition: gia.h:75
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
void Gia_ManDupCones_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Ptr_t *vLeaves, Vec_Ptr_t *vNodes, Vec_Ptr_t *vRoots)
Definition: giaDup.c:2672
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static Gia_Obj_t * Gia_ObjRiToRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:447
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Gia_Man_t* Gia_ManDupCycled ( Gia_Man_t pAig,
Abc_Cex_t pCex,
int  nFrames 
)

Definition at line 523 of file giaDup.c.

524 {
525  Gia_Man_t * pNew;
526  Vec_Bit_t * vInits;
527  Gia_Obj_t * pObj;
528  int i;
530  Gia_ManCycle( p, pCex, nFrames );
531  vInits = Vec_BitAlloc( Gia_ManRegNum(p) );
532  Gia_ManForEachRo( p, pObj, i )
533  Vec_BitPush( vInits, pObj->fMark0 );
534  pNew = Gia_ManDupFlip( p, Vec_BitArray(vInits) );
535  Vec_BitFree( vInits );
537  return pNew;
538 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Gia_ManCleanMark0(Gia_Man_t *p)
Definition: giaUtil.c:215
Definition: gia.h:75
typedefABC_NAMESPACE_HEADER_START struct Vec_Bit_t_ Vec_Bit_t
INCLUDES ///.
Definition: vecBit.h:42
static int * Vec_BitArray(Vec_Bit_t *p)
Definition: vecBit.h:223
static Vec_Bit_t * Vec_BitAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecBit.h:80
Definition: gia.h:95
static void Vec_BitFree(Vec_Bit_t *p)
Definition: vecBit.h:167
#define Gia_ManForEachRo(p, pObj, i)
Definition: gia.h:1038
void Gia_ManCycle(Gia_Man_t *p, Abc_Cex_t *pCex, int nFrames)
Definition: giaDup.c:503
Gia_Man_t * Gia_ManDupFlip(Gia_Man_t *p, int *pInitState)
Definition: giaDup.c:460
static void Vec_BitPush(Vec_Bit_t *p, int Entry)
Definition: vecBit.h:516
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManDupDfs ( Gia_Man_t p)

Definition at line 1238 of file giaDup.c.

1239 {
1240  Gia_Man_t * pNew;
1241  Gia_Obj_t * pObj;
1242  int i;
1243  pNew = Gia_ManStart( Gia_ManObjNum(p) );
1244  pNew->pName = Abc_UtilStrsav( p->pName );
1245  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1246  Gia_ManFillValue( p );
1247  Gia_ManConst0(p)->Value = 0;
1248  Gia_ManForEachCi( p, pObj, i )
1249  pObj->Value = Gia_ManAppendCi(pNew);
1250  Gia_ManForEachCo( p, pObj, i )
1251  Gia_ManDupDfs_rec( pNew, p, Gia_ObjFanin0(pObj) );
1252  Gia_ManForEachCo( p, pObj, i )
1253  Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1254  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
1255  pNew->nConstrs = p->nConstrs;
1256  if ( p->pCexSeq )
1257  pNew->pCexSeq = Abc_CexDup( p->pCexSeq, Gia_ManRegNum(p) );
1258  return pNew;
1259 }
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
char * pName
Definition: gia.h:97
if(last==0)
Definition: sparse_int.h:34
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
Abc_Cex_t * Abc_CexDup(Abc_Cex_t *p, int nRegsNew)
Definition: utilCex.c:145
void Gia_ManDupDfs_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaDup.c:1229
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
unsigned Value
Definition: gia.h:87
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManDupDfsCiMap ( Gia_Man_t p,
int *  pCi2Lit,
Vec_Int_t vLits 
)

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

Synopsis [Duplicates AIG in the DFS order.]

Description []

SideEffects []

SeeAlso []

Definition at line 1890 of file giaDup.c.

1891 {
1892  Gia_Man_t * pNew;
1893  Gia_Obj_t * pObj;
1894  int i;
1895  Gia_ManFillValue( p );
1896  pNew = Gia_ManStart( Gia_ManObjNum(p) );
1897  pNew->pName = Abc_UtilStrsav( p->pName );
1898  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1899  Gia_ManConst0(p)->Value = 0;
1900  Gia_ManForEachCi( p, pObj, i )
1901  {
1902  pObj->Value = Gia_ManAppendCi(pNew);
1903  if ( ~pCi2Lit[i] )
1904  pObj->Value = Abc_LitNotCond( Gia_ManObj(p, Abc_Lit2Var(pCi2Lit[i]))->Value, Abc_LitIsCompl(pCi2Lit[i]) );
1905  }
1906  Gia_ManHashAlloc( pNew );
1907  if ( vLits )
1908  {
1909  int iLit, iLitRes;
1910  Vec_IntForEachEntry( vLits, iLit, i )
1911  {
1912  iLitRes = Gia_ManDupDfs2_rec( pNew, p, Gia_ManObj(p, Abc_Lit2Var(iLit)) );
1913  Gia_ManAppendCo( pNew, Abc_LitNotCond( iLitRes, Abc_LitIsCompl(iLit)) );
1914  }
1915  }
1916  else
1917  {
1918  Gia_ManForEachCo( p, pObj, i )
1919  {
1920  Gia_ManDupDfs2_rec( pNew, p, Gia_ObjFanin0(pObj) );
1921  Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1922  }
1923  }
1924  Gia_ManHashStop( pNew );
1925  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
1926  return pNew;
1927 }
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
char * pName
Definition: gia.h:97
int Gia_ManDupDfs2_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaDup.c:1158
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
unsigned Value
Definition: gia.h:87
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManDupDfsClasses ( Gia_Man_t p)

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

Synopsis [Duplicates AIG in the DFS order.]

Description []

SideEffects []

SeeAlso []

Definition at line 1940 of file giaDup.c.

1941 {
1942  Gia_Man_t * pNew, * pTemp;
1943  Gia_Obj_t * pObj;
1944  int i;
1945  assert( p->pReprsOld != NULL );
1946  Gia_ManFillValue( p );
1947  pNew = Gia_ManStart( Gia_ManObjNum(p) );
1948  pNew->pName = Abc_UtilStrsav( p->pName );
1949  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1950  Gia_ManConst0(p)->Value = 0;
1951  Gia_ManForEachCi( p, pObj, i )
1952  pObj->Value = Gia_ManAppendCi(pNew);
1953  Gia_ManHashAlloc( pNew );
1954  Gia_ManForEachCo( p, pObj, i )
1955  Gia_ManDupDfs_rec( pNew, p, pObj );
1956  Gia_ManHashStop( pNew );
1957  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
1958  pNew = Gia_ManCleanup( pTemp = pNew );
1959  Gia_ManStop( pTemp );
1960  return pNew;
1961 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
char * pName
Definition: gia.h:97
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
void Gia_ManDupDfs_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaDup.c:1229
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
int * pReprsOld
Definition: gia.h:120
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManDupDfsCone ( Gia_Man_t p,
Gia_Obj_t pRoot 
)

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

Synopsis [Duplicates AIG in the DFS order while putting CIs first.]

Description []

SideEffects []

SeeAlso []

Definition at line 1484 of file giaDup.c.

1485 {
1486  Gia_Man_t * pNew;
1487  Gia_Obj_t * pObj;
1488  int i;
1489  assert( Gia_ObjIsCo(pRoot) );
1490  Gia_ManFillValue( p );
1491  pNew = Gia_ManStart( Gia_ManObjNum(p) );
1492  pNew->pName = Abc_UtilStrsav( p->pName );
1493  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1494  Gia_ManConst0(p)->Value = 0;
1495  Gia_ManForEachCi( p, pObj, i )
1496  pObj->Value = Gia_ManAppendCi(pNew);
1497  Gia_ManDupDfs_rec( pNew, p, Gia_ObjFanin0(pRoot) );
1498  Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pRoot) );
1499  Gia_ManSetRegNum( pNew, 0 );
1500  return pNew;
1501 }
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
char * pName
Definition: gia.h:97
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
void Gia_ManDupDfs_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaDup.c:1229
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
Gia_Man_t* Gia_ManDupDfsLitArray ( Gia_Man_t p,
Vec_Int_t vLits 
)

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

Synopsis [Duplicates AIG in the DFS order while putting CIs first.]

Description []

SideEffects []

SeeAlso []

Definition at line 1553 of file giaDup.c.

1554 {
1555  Gia_Man_t * pNew;
1556  Gia_Obj_t * pObj;
1557  int i, iLit, iLitRes;
1558  Gia_ManFillValue( p );
1559  pNew = Gia_ManStart( Gia_ManObjNum(p) );
1560  pNew->pName = Abc_UtilStrsav( p->pName );
1561  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1562  Gia_ManConst0(p)->Value = 0;
1563  Gia_ManForEachCi( p, pObj, i )
1564  pObj->Value = Gia_ManAppendCi(pNew);
1565  Vec_IntForEachEntry( vLits, iLit, i )
1566  {
1567  iLitRes = Gia_ManDupDfs2_rec( pNew, p, Gia_ManObj(p, Abc_Lit2Var(iLit)) );
1568  Gia_ManAppendCo( pNew, Abc_LitNotCond( iLitRes, Abc_LitIsCompl(iLit)) );
1569  }
1570  Gia_ManSetRegNum( pNew, 0 );
1571  return pNew;
1572 }
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
char * pName
Definition: gia.h:97
int Gia_ManDupDfs2_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaDup.c:1158
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
unsigned Value
Definition: gia.h:87
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
Gia_Man_t* Gia_ManDupDfsNode ( Gia_Man_t p,
Gia_Obj_t pObj 
)

Definition at line 1528 of file giaDup.c.

1529 {
1530  Gia_Man_t * pNew;
1531  assert( Gia_ObjIsAnd(pRoot) );
1532  Gia_ManFillValue( p );
1533  pNew = Gia_ManStart( Gia_ManObjNum(p) );
1534  pNew->pName = Abc_UtilStrsav( p->pName );
1535  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1536  Gia_ManConst0(p)->Value = 0;
1537  Gia_ManDupDfs3_rec( pNew, p, pRoot );
1538  Gia_ManAppendCo( pNew, pRoot->Value );
1539  return pNew;
1540 }
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
void Gia_ManDupDfs3_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaDup.c:1514
char * pName
Definition: gia.h:97
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
Definition: gia.h:95
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
Gia_Man_t* Gia_ManDupDfsSkip ( Gia_Man_t p)

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

Synopsis [Duplicates AIG in the DFS order while putting CIs first.]

Description []

SideEffects []

SeeAlso []

Definition at line 1454 of file giaDup.c.

1455 {
1456  Gia_Man_t * pNew;
1457  Gia_Obj_t * pObj;
1458  int i;
1459  Gia_ManFillValue( p );
1460  pNew = Gia_ManStart( Gia_ManObjNum(p) );
1461  pNew->pName = Abc_UtilStrsav( p->pName );
1462  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1463  Gia_ManConst0(p)->Value = 0;
1464  Gia_ManForEachCi( p, pObj, i )
1465  pObj->Value = Gia_ManAppendCi(pNew);
1466  Gia_ManForEachCo( p, pObj, i )
1467  if ( pObj->fMark1 == 0 )
1468  Gia_ManDupDfs_rec( pNew, p, pObj );
1469  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
1470  return pNew;
1471 }
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
char * pName
Definition: gia.h:97
if(last==0)
Definition: sparse_int.h:34
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
void Gia_ManDupDfs_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaDup.c:1229
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
unsigned Value
Definition: gia.h:87
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManDupExist ( Gia_Man_t p,
int  iVar 
)

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

Synopsis [Existentially quantified given variable.]

Description []

SideEffects []

SeeAlso []

Definition at line 1360 of file giaDup.c.

1361 {
1362  Gia_Man_t * pNew, * pTemp;
1363  Gia_Obj_t * pObj;
1364  int i;
1365  assert( iVar >= 0 && iVar < Gia_ManPiNum(p) );
1366  assert( Gia_ManPoNum(p) == 1 );
1367  assert( Gia_ManRegNum(p) == 0 );
1368  Gia_ManFillValue( p );
1369  // find the cofactoring variable
1370  pNew = Gia_ManStart( Gia_ManObjNum(p) );
1371  pNew->pName = Abc_UtilStrsav( p->pName );
1372  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1373  Gia_ManHashAlloc( pNew );
1374  // compute negative cofactor
1375  Gia_ManConst0(p)->Value = 0;
1376  Gia_ManForEachCi( p, pObj, i )
1377  pObj->Value = Gia_ManAppendCi(pNew);
1378  Gia_ManPi( p, iVar )->Value = Abc_Var2Lit( 0, 0 );
1379  Gia_ManForEachAnd( p, pObj, i )
1380  pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1381  Gia_ManForEachPo( p, pObj, i )
1382  pObj->Value = Gia_ObjFanin0Copy(pObj);
1383  // compute the positive cofactor
1384  Gia_ManPi( p, iVar )->Value = Abc_Var2Lit( 0, 1 );
1385  Gia_ManForEachAnd( p, pObj, i )
1386  pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1387  // create OR gate
1388  Gia_ManForEachPo( p, pObj, i )
1389  pObj->Value = Gia_ManAppendCo( pNew, Gia_ManHashOr(pNew, Gia_ObjFanin0Copy(pObj), pObj->Value) );
1390  Gia_ManHashStop( pNew );
1391  pNew = Gia_ManCleanup( pTemp = pNew );
1392  Gia_ManStop( pTemp );
1393  return pNew;
1394 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
static Gia_Obj_t * Gia_ManPi(Gia_Man_t *p, int v)
Definition: gia.h:405
char * pName
Definition: gia.h:97
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
int Gia_ManHashOr(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:611
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManDupFlip ( Gia_Man_t p,
int *  pInitState 
)

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

Synopsis [Duplicates AIG while complementing the flops.]

Description [The array of initial state contains the init state for each state bit of the flops in the design.]

SideEffects []

SeeAlso []

Definition at line 460 of file giaDup.c.

461 {
462  Gia_Man_t * pNew;
463  Gia_Obj_t * pObj;
464  int i;
465  pNew = Gia_ManStart( Gia_ManObjNum(p) );
466  pNew->pName = Abc_UtilStrsav( p->pName );
467  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
468  Gia_ManConst0(p)->Value = 0;
469  Gia_ManForEachObj1( p, pObj, i )
470  {
471  if ( Gia_ObjIsAnd(pObj) )
472  pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
473  else if ( Gia_ObjIsCi(pObj) )
474  {
475  pObj->Value = Gia_ManAppendCi( pNew );
476  if ( Gia_ObjCioId(pObj) >= Gia_ManPiNum(p) )
477  pObj->Value = Abc_LitNotCond( pObj->Value, Abc_InfoHasBit((unsigned *)pInitState, Gia_ObjCioId(pObj) - Gia_ManPiNum(p)) );
478  }
479  else if ( Gia_ObjIsCo(pObj) )
480  {
481  pObj->Value = Gia_ObjFanin0Copy(pObj);
482  if ( Gia_ObjCioId(pObj) >= Gia_ManPoNum(p) )
483  pObj->Value = Abc_LitNotCond( pObj->Value, Abc_InfoHasBit((unsigned *)pInitState, Gia_ObjCioId(pObj) - Gia_ManPoNum(p)) );
484  pObj->Value = Gia_ManAppendCo( pNew, pObj->Value );
485  }
486  }
487  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
488  return pNew;
489 }
static int Gia_ManAppendAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: gia.h:592
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
Definition: gia.h:75
char * pName
Definition: gia.h:97
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
Definition: gia.h:95
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
unsigned Value
Definition: gia.h:87
#define Gia_ManForEachObj1(p, pObj, i)
Definition: gia.h:986
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static int Gia_ObjCioId(Gia_Obj_t *pObj)
Definition: gia.h:411
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManDupFlopClass ( Gia_Man_t p,
int  iClass 
)

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

Synopsis [Duplicates while adding self-loops to the registers.]

Description []

SideEffects []

SeeAlso []

Definition at line 930 of file giaDup.c.

931 {
932  Gia_Man_t * pNew;
933  Gia_Obj_t * pObj;
934  int i, Counter1 = 0, Counter2 = 0;
935  assert( p->vFlopClasses != NULL );
936  pNew = Gia_ManStart( Gia_ManObjNum(p) );
937  pNew->pName = Abc_UtilStrsav( p->pName );
938  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
939  Gia_ManFillValue( p );
940  Gia_ManConst0(p)->Value = 0;
941  Gia_ManForEachPi( p, pObj, i )
942  pObj->Value = Gia_ManAppendCi( pNew );
943  Gia_ManForEachRo( p, pObj, i )
944  if ( Vec_IntEntry(p->vFlopClasses, i) != iClass )
945  pObj->Value = Gia_ManAppendCi( pNew );
946  Gia_ManForEachRo( p, pObj, i )
947  if ( Vec_IntEntry(p->vFlopClasses, i) == iClass )
948  pObj->Value = Gia_ManAppendCi( pNew ), Counter1++;
949  Gia_ManForEachAnd( p, pObj, i )
950  pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
951  Gia_ManForEachPo( p, pObj, i )
952  Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
953  Gia_ManForEachRi( p, pObj, i )
954  if ( Vec_IntEntry(p->vFlopClasses, i) != iClass )
955  Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
956  Gia_ManForEachRi( p, pObj, i )
957  if ( Vec_IntEntry(p->vFlopClasses, i) == iClass )
958  Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) ), Counter2++;
959  assert( Counter1 == Counter2 );
960  Gia_ManSetRegNum( pNew, Counter1 );
961  return pNew;
962 }
static int Gia_ManAppendAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: gia.h:592
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
Vec_Int_t * vFlopClasses
Definition: gia.h:140
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
Definition: gia.h:75
char * pName
Definition: gia.h:97
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
if(last==0)
Definition: sparse_int.h:34
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define Gia_ManForEachRo(p, pObj, i)
Definition: gia.h:1038
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
#define Gia_ManForEachRi(p, pObj, i)
Definition: gia.h:1040
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
Gia_Man_t* Gia_ManDupFromVecs ( Gia_Man_t p,
Vec_Int_t vCis,
Vec_Int_t vAnds,
Vec_Int_t vCos,
int  nRegs 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 2853 of file giaDup.c.

2854 {
2855  Gia_Man_t * pNew;
2856  Gia_Obj_t * pObj;
2857  int i;
2858  // start the new manager
2859  pNew = Gia_ManStart( 5000 );
2860  pNew->pName = Abc_UtilStrsav( p->pName );
2861  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
2862  // create constant
2863  Gia_ManConst0(p)->Value = 0;
2864  // create PIs
2865  Gia_ManForEachObjVec( vCis, p, pObj, i )
2866  pObj->Value = Gia_ManAppendCi( pNew );
2867  // create internal nodes
2868  Gia_ManForEachObjVec( vAnds, p, pObj, i )
2869  pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
2870  // create ROs
2871  Gia_ManForEachObjVec( vCos, p, pObj, i )
2872  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
2873  Gia_ManSetRegNum( pNew, nRegs );
2874  return pNew;
2875 }
static int Gia_ManAppendAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: gia.h:592
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
Definition: gia.h:75
char * pName
Definition: gia.h:97
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition: gia.h:988
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
unsigned Value
Definition: gia.h:87
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
Gia_Man_t* Gia_ManDupLastPis ( Gia_Man_t p,
int  nLastPis 
)

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

Synopsis [Duplicates AIG while putting first PIs, then nodes, then POs.]

Description []

SideEffects []

SeeAlso []

Definition at line 429 of file giaDup.c.

430 {
431  Gia_Man_t * pNew;
432  Gia_Obj_t * pObj;
433  int i;
434  assert( Gia_ManRegNum(p) == 0 );
435  pNew = Gia_ManStart( Gia_ManObjNum(p) );
436  pNew->pName = Abc_UtilStrsav( p->pName );
437  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
438  Gia_ManConst0(p)->Value = 0;
439  Gia_ManForEachCi( p, pObj, i )
440  pObj->Value = (i < Gia_ManCiNum(p) - nLastPis) ? ~0 : Gia_ManAppendCi(pNew);
441  Gia_ManForEachAnd( p, pObj, i )
442  pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
443  Gia_ManForEachCo( p, pObj, i )
444  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
445  return pNew;
446 }
static int Gia_ManAppendAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: gia.h:592
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
char * pName
Definition: gia.h:97
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManDupLevelized ( Gia_Man_t p)

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

Synopsis [Duplicates the AIG with nodes ordered by level.]

Description []

SideEffects []

SeeAlso []

Definition at line 2812 of file giaDup.c.

2813 {
2814  Gia_Man_t * pNew;
2815  Gia_Obj_t * pObj;
2816  int i, nLevels = Gia_ManLevelNum( p );
2817  int * pCounts = ABC_CALLOC( int, nLevels + 1 );
2818  int * pNodes = ABC_ALLOC( int, Gia_ManAndNum(p) );
2819  Gia_ManForEachAnd( p, pObj, i )
2820  pCounts[Gia_ObjLevel(p, pObj)]++;
2821  for ( i = 1; i <= nLevels; i++ )
2822  pCounts[i] += pCounts[i-1];
2823  Gia_ManForEachAnd( p, pObj, i )
2824  pNodes[pCounts[Gia_ObjLevel(p, pObj)-1]++] = i;
2825  // duplicate
2826  pNew = Gia_ManStart( Gia_ManObjNum(p) );
2827  pNew->pName = Abc_UtilStrsav( p->pName );
2828  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
2829  Gia_ManConst0(p)->Value = 0;
2830  Gia_ManForEachCi( p, pObj, i )
2831  pObj->Value = Gia_ManAppendCi( pNew );
2832  for ( i = 0; i < Gia_ManAndNum(p) && (pObj = Gia_ManObj(p, pNodes[i])); i++ )
2833  pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
2834  Gia_ManForEachCo( p, pObj, i )
2835  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
2836  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
2837  ABC_FREE( pCounts );
2838  ABC_FREE( pNodes );
2839  return pNew;
2840 }
static int Gia_ManAppendAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: gia.h:592
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
for(p=first;p->value< newval;p=p->next)
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
static int Gia_ObjLevel(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:501
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
#define ABC_FREE(obj)
Definition: abc_global.h:232
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
int Gia_ManLevelNum(Gia_Man_t *p)
Definition: giaUtil.c:505
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManDupMarked ( Gia_Man_t p)

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

Synopsis [Duplicates AIG without any changes.]

Description []

SideEffects []

SeeAlso []

Definition at line 975 of file giaDup.c.

976 {
977  Gia_Man_t * pNew;
978  Gia_Obj_t * pObj;
979  int i, nRos = 0, nRis = 0;
980  int CountMarked = 0;
981  Gia_ManForEachObj( p, pObj, i )
982  CountMarked += pObj->fMark0;
983  Gia_ManFillValue( p );
984  pNew = Gia_ManStart( Gia_ManObjNum(p) - CountMarked );
985  if ( p->pMuxes )
986  pNew->pMuxes = ABC_CALLOC( unsigned, pNew->nObjsAlloc );
987  pNew->nConstrs = p->nConstrs;
988  pNew->pName = Abc_UtilStrsav( p->pName );
989  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
990  Gia_ManConst0(p)->Value = 0;
991  Gia_ManForEachObj1( p, pObj, i )
992  {
993  if ( pObj->fMark0 )
994  {
995  assert( Gia_ObjIsAnd(pObj) && !Gia_ObjIsBuf(pObj) );
996  pObj->fMark0 = 0;
997  continue;
998  }
999  if ( Gia_ObjIsBuf(pObj) )
1000  pObj->Value = Gia_ManAppendBuf( pNew, Gia_ObjFanin0Copy(pObj) );
1001  else if ( Gia_ObjIsAnd(pObj) )
1002  {
1003  if ( Gia_ObjIsXor(pObj) )
1004  pObj->Value = Gia_ManAppendXorReal( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1005  else if ( Gia_ObjIsMux(p, pObj) )
1006  pObj->Value = Gia_ManAppendMuxReal( pNew, Gia_ObjFanin2Copy(p, pObj), Gia_ObjFanin1Copy(pObj), Gia_ObjFanin0Copy(pObj) );
1007  else
1008  pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1009  }
1010  else if ( Gia_ObjIsCi(pObj) )
1011  {
1012  pObj->Value = Gia_ManAppendCi( pNew );
1013  nRos += Gia_ObjIsRo(p, pObj);
1014  }
1015  else if ( Gia_ObjIsCo(pObj) )
1016  {
1017 // Gia_Obj_t * pFanin = Gia_ObjFanin0(pObj);
1018  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1019  nRis += Gia_ObjIsRi(p, pObj);
1020  }
1021  }
1022  assert( pNew->nObjsAlloc == pNew->nObjs );
1023  assert( nRos == nRis );
1024  Gia_ManSetRegNum( pNew, nRos );
1025  if ( p->pReprs && p->pNexts )
1026  {
1027  Gia_Obj_t * pRepr;
1028  pNew->pReprs = ABC_CALLOC( Gia_Rpr_t, Gia_ManObjNum(pNew) );
1029  for ( i = 0; i < Gia_ManObjNum(p); i++ )
1030  Gia_ObjSetRepr( pNew, i, GIA_VOID );
1031  Gia_ManForEachObj1( p, pObj, i )
1032  {
1033  if ( !~pObj->Value )
1034  continue;
1035  pRepr = Gia_ObjReprObj( p, i );
1036  if ( pRepr == NULL )
1037  continue;
1038  if ( !~pRepr->Value )
1039  continue;
1040  assert( !Gia_ObjIsBuf(pObj) );
1041  if ( Abc_Lit2Var(pObj->Value) != Abc_Lit2Var(pRepr->Value) )
1042  Gia_ObjSetRepr( pNew, Abc_Lit2Var(pObj->Value), Abc_Lit2Var(pRepr->Value) );
1043  }
1044  pNew->pNexts = Gia_ManDeriveNexts( pNew );
1045  }
1046  if ( Gia_ManHasChoices(p) )
1047  {
1048  Gia_Obj_t * pSibl;
1049  pNew->pSibls = ABC_CALLOC( int, Gia_ManObjNum(pNew) );
1050  Gia_ManForEachObj1( p, pObj, i )
1051  {
1052  if ( !~pObj->Value )
1053  continue;
1054  pSibl = Gia_ObjSiblObj( p, i );
1055  if ( pSibl == NULL )
1056  continue;
1057  if ( !~pSibl->Value )
1058  continue;
1059  assert( !Gia_ObjIsBuf(pObj) );
1060  assert( Abc_Lit2Var(pObj->Value) > Abc_Lit2Var(pSibl->Value) );
1061  pNew->pSibls[Abc_Lit2Var(pObj->Value)] = Abc_Lit2Var(pSibl->Value);
1062  }
1063  }
1064  return pNew;
1065 }
int nObjsAlloc
Definition: gia.h:102
static int Gia_ObjFanin2Copy(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:483
static int Gia_ManAppendAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: gia.h:592
static int Gia_ManAppendMuxReal(Gia_Man_t *p, int iLitC, int iLit1, int iLit0)
Definition: gia.h:664
static Gia_Obj_t * Gia_ObjSiblObj(Gia_Man_t *p, int Id)
Definition: gia.h:894
int * pNexts
Definition: gia.h:122
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
int * pSibls
Definition: gia.h:123
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
static int Gia_ObjIsBuf(Gia_Obj_t *pObj)
Definition: gia.h:427
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
int nObjs
Definition: gia.h:101
Definition: gia.h:75
static int Gia_ManHasChoices(Gia_Man_t *p)
Definition: gia.h:397
static void Gia_ObjSetRepr(Gia_Man_t *p, int Id, int Num)
Definition: gia.h:888
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
static int Gia_ObjIsRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:443
static int Gia_ManAppendBuf(Gia_Man_t *p, int iLit)
Definition: gia.h:694
static int Gia_ObjIsRi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:444
if(last==0)
Definition: sparse_int.h:34
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
static int Gia_ObjIsXor(Gia_Obj_t *pObj)
Definition: gia.h:423
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
int * Gia_ManDeriveNexts(Gia_Man_t *p)
Definition: giaEquiv.c:97
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static Gia_Obj_t * Gia_ObjReprObj(Gia_Man_t *p, int Id)
Definition: gia.h:886
#define GIA_VOID
Definition: gia.h:45
Definition: gia.h:95
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
Gia_Rpr_t * pReprs
Definition: gia.h:121
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
#define Gia_ManForEachObj1(p, pObj, i)
Definition: gia.h:986
Definition: gia.h:56
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static int Gia_ObjIsMux(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:425
static int Gia_ManAppendXorReal(Gia_Man_t *p, int iLit0, int iLit1)
Definition: gia.h:639
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
Gia_Man_t* Gia_ManDupMuxes ( Gia_Man_t p,
int  Limit 
)

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

Synopsis [Derives GIA with MUXes.]

Description [Create MUX if the sum of fanin references does not exceed limit.]

SideEffects []

SeeAlso []

Definition at line 96 of file giaMuxes.c.

97 {
98  Gia_Man_t * pNew, * pTemp;
99  Gia_Obj_t * pObj, * pFan0, * pFan1, * pFanC, * pSiblNew, * pObjNew;
100  int i;
101  assert( p->pMuxes == NULL );
102  assert( Limit >= 2 );
103  ABC_FREE( p->pRefs );
104  Gia_ManCreateRefs( p );
105  // start the new manager
106  pNew = Gia_ManStart( Gia_ManObjNum(p) );
107  pNew->pName = Abc_UtilStrsav( p->pName );
108  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
109  pNew->pMuxes = ABC_CALLOC( unsigned, pNew->nObjsAlloc );
110  if ( Gia_ManHasChoices(p) )
111  pNew->pSibls = ABC_CALLOC( int, pNew->nObjsAlloc );
112  Gia_ManConst0(p)->Value = 0;
113  Gia_ManHashStart( pNew );
114  Gia_ManForEachObj1( p, pObj, i )
115  {
116  if ( Gia_ObjIsCi(pObj) )
117  pObj->Value = Gia_ManAppendCi( pNew );
118  else if ( Gia_ObjIsCo(pObj) )
119  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
120  else if ( Gia_ObjIsBuf(pObj) )
121  pObj->Value = Gia_ManAppendBuf( pNew, Gia_ObjFanin0Copy(pObj) );
122  else if ( !Gia_ObjIsMuxType(pObj) || Gia_ObjSibl(p, Gia_ObjFaninId0(pObj, i)) || Gia_ObjSibl(p, Gia_ObjFaninId1(pObj, i)) )
123  pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
124  else if ( Gia_ObjRecognizeExor(pObj, &pFan0, &pFan1) )
125  pObj->Value = Gia_ManHashXorReal( pNew, Gia_ObjLitCopy(p, Gia_ObjToLit(p, pFan0)), Gia_ObjLitCopy(p, Gia_ObjToLit(p, pFan1)) );
126  else if ( Gia_ObjRefNum(p, Gia_ObjFanin0(pObj)) + Gia_ObjRefNum(p, Gia_ObjFanin1(pObj)) > Limit )
127  pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
128  else
129  {
130  pFanC = Gia_ObjRecognizeMux( pObj, &pFan1, &pFan0 );
131  pObj->Value = Gia_ManHashMuxReal( pNew, Gia_ObjLitCopy(p, Gia_ObjToLit(p, pFanC)), Gia_ObjLitCopy(p, Gia_ObjToLit(p, pFan1)), Gia_ObjLitCopy(p, Gia_ObjToLit(p, pFan0)) );
132  }
133  if ( !Gia_ObjSibl(p, i) )
134  continue;
135  pObjNew = Gia_ManObj( pNew, Abc_Lit2Var(pObj->Value) );
136  pSiblNew = Gia_ManObj( pNew, Abc_Lit2Var(Gia_ObjSiblObj(p, i)->Value) );
137  if ( Gia_ObjIsAnd(pObjNew) && Gia_ObjIsAnd(pSiblNew) && Gia_ObjId(pNew, pObjNew) > Gia_ObjId(pNew, pSiblNew) )
138  pNew->pSibls[Gia_ObjId(pNew, pObjNew)] = Gia_ObjId(pNew, pSiblNew);
139  }
140  Gia_ManHashStop( pNew );
141  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
142  // perform cleanup
143  pNew = Gia_ManCleanup( pTemp = pNew );
144  Gia_ManStop( pTemp );
145  return pNew;
146 }
int nObjsAlloc
Definition: gia.h:102
static int Gia_ObjToLit(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:497
void Gia_ManCreateRefs(Gia_Man_t *p)
Definition: giaUtil.c:715
int Gia_ObjRecognizeExor(Gia_Obj_t *pObj, Gia_Obj_t **ppFan0, Gia_Obj_t **ppFan1)
Definition: giaUtil.c:921
static Gia_Obj_t * Gia_ObjSiblObj(Gia_Man_t *p, int Id)
Definition: gia.h:894
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
int * pSibls
Definition: gia.h:123
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
unsigned * pMuxes
Definition: gia.h:104
static int Gia_ObjRefNum(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:521
static int Gia_ObjIsBuf(Gia_Obj_t *pObj)
Definition: gia.h:427
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
int * pRefs
Definition: gia.h:114
Definition: gia.h:75
static int Gia_ManHasChoices(Gia_Man_t *p)
Definition: gia.h:397
static int Gia_ObjSibl(Gia_Man_t *p, int Id)
Definition: gia.h:893
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
char * pName
Definition: gia.h:97
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
static int Gia_ManAppendBuf(Gia_Man_t *p, int iLit)
Definition: gia.h:694
void Gia_ManHashStart(Gia_Man_t *p)
Definition: giaHash.c:117
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
int Gia_ManHashXorReal(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:465
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Gia_ObjLitCopy(Gia_Man_t *p, int iLit)
Definition: gia.h:479
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
int Gia_ObjIsMuxType(Gia_Obj_t *pNode)
Definition: giaUtil.c:885
#define ABC_FREE(obj)
Definition: abc_global.h:232
Gia_Obj_t * Gia_ObjRecognizeMux(Gia_Obj_t *pNode, Gia_Obj_t **ppNodeT, Gia_Obj_t **ppNodeE)
Definition: giaUtil.c:959
Definition: gia.h:95
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
int Gia_ManHashMuxReal(Gia_Man_t *p, int iLitC, int iLit1, int iLit0)
Definition: giaHash.c:517
#define Gia_ManForEachObj1(p, pObj, i)
Definition: gia.h:986
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static int Gia_ObjFaninId1(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:461
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
static int Gia_ObjFaninId0(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:460
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManDupNoMuxes ( Gia_Man_t p)

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

Synopsis [Derives GIA without MUXes.]

Description []

SideEffects []

SeeAlso []

Definition at line 159 of file giaMuxes.c.

160 {
161  Gia_Man_t * pNew, * pTemp;
162  Gia_Obj_t * pObj;
163  int i;
164  assert( p->pMuxes != NULL );
165  // start the new manager
166  pNew = Gia_ManStart( 5000 );
167  pNew->pName = Abc_UtilStrsav( p->pName );
168  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
169  Gia_ManConst0(p)->Value = 0;
170  Gia_ManHashStart( pNew );
171  Gia_ManForEachObj1( p, pObj, i )
172  {
173  if ( Gia_ObjIsCi(pObj) )
174  pObj->Value = Gia_ManAppendCi( pNew );
175  else if ( Gia_ObjIsCo(pObj) )
176  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
177  else if ( Gia_ObjIsBuf(pObj) )
178  pObj->Value = Gia_ManAppendBuf( pNew, Gia_ObjFanin0Copy(pObj) );
179  else if ( Gia_ObjIsMuxId(p, i) )
180  pObj->Value = Gia_ManHashMux( pNew, Gia_ObjFanin2Copy(p, pObj), Gia_ObjFanin1Copy(pObj), Gia_ObjFanin0Copy(pObj) );
181  else if ( Gia_ObjIsXor(pObj) )
182  pObj->Value = Gia_ManHashXor( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
183  else
184  pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
185  }
186  Gia_ManHashStop( pNew );
187  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
188  // perform cleanup
189  pNew = Gia_ManCleanup( pTemp = pNew );
190  Gia_ManStop( pTemp );
191  return pNew;
192 }
static int Gia_ObjFanin2Copy(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:483
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
int Gia_ManHashXor(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:658
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
unsigned * pMuxes
Definition: gia.h:104
static int Gia_ObjIsBuf(Gia_Obj_t *pObj)
Definition: gia.h:427
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
Definition: gia.h:75
static int Gia_ObjIsMuxId(Gia_Man_t *p, int iObj)
Definition: gia.h:424
char * pName
Definition: gia.h:97
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
static int Gia_ManAppendBuf(Gia_Man_t *p, int iLit)
Definition: gia.h:694
int Gia_ManHashMux(Gia_Man_t *p, int iCtrl, int iData1, int iData0)
Definition: giaHash.c:677
void Gia_ManHashStart(Gia_Man_t *p)
Definition: giaHash.c:117
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
static int Gia_ObjIsXor(Gia_Obj_t *pObj)
Definition: gia.h:423
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
#define Gia_ManForEachObj1(p, pObj, i)
Definition: gia.h:986
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManDupNormalize ( Gia_Man_t p)

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

Synopsis [Duplicates AIG in the DFS order while putting CIs first.]

Description []

SideEffects []

SeeAlso []

Definition at line 134 of file giaTim.c.

135 {
136  Gia_Man_t * pNew;
137  Gia_Obj_t * pObj;
138  int i;
139  Gia_ManFillValue( p );
140  pNew = Gia_ManStart( Gia_ManObjNum(p) );
141  pNew->pName = Abc_UtilStrsav( p->pName );
142  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
143  Gia_ManConst0(p)->Value = 0;
144  if ( !Gia_ManIsSeqWithBoxes(p) )
145  {
146  Gia_ManForEachCi( p, pObj, i )
147  pObj->Value = Gia_ManAppendCi(pNew);
148  }
149  else
150  {
151  // current CI order: PIs + FOs + NewCIs
152  // desired reorder: PIs + NewCIs + FOs
153  int nCIs = Tim_ManPiNum( (Tim_Man_t *)p->pManTime );
154  int nAll = Tim_ManCiNum( (Tim_Man_t *)p->pManTime );
155  int nPis = nCIs - Gia_ManRegNum(p);
156  assert( nAll == Gia_ManCiNum(p) );
157  assert( nPis > 0 );
158  // copy PIs first
159  for ( i = 0; i < nPis; i++ )
160  Gia_ManCi(p, i)->Value = Gia_ManAppendCi(pNew);
161  // copy new CIs second
162  for ( i = nCIs; i < nAll; i++ )
163  Gia_ManCi(p, i)->Value = Gia_ManAppendCi(pNew);
164  // copy flops last
165  for ( i = nCIs - Gia_ManRegNum(p); i < nCIs; i++ )
166  Gia_ManCi(p, i)->Value = Gia_ManAppendCi(pNew);
167  printf( "Warning: Shuffled CI order to be correct sequential AIG.\n" );
168  }
169  Gia_ManForEachAnd( p, pObj, i )
170  if ( Gia_ObjIsBuf(pObj) )
171  pObj->Value = Gia_ManAppendBuf( pNew, Gia_ObjFanin0Copy(pObj) );
172  else
173  pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
174  Gia_ManForEachCo( p, pObj, i )
175  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
176  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
177  pNew->nConstrs = p->nConstrs;
178  assert( Gia_ManIsNormalized(pNew) );
179  Gia_ManDupRemapEquiv( pNew, p );
180  return pNew;
181 }
static int Gia_ManAppendAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: gia.h:592
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static Gia_Obj_t * Gia_ManCi(Gia_Man_t *p, int v)
Definition: gia.h:403
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
static int Gia_ObjIsBuf(Gia_Obj_t *pObj)
Definition: gia.h:427
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
int Gia_ManIsNormalized(Gia_Man_t *p)
Definition: giaTim.c:109
Definition: gia.h:75
int Tim_ManPiNum(Tim_Man_t *p)
Definition: timMan.c:688
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
int Gia_ManIsSeqWithBoxes(Gia_Man_t *p)
Definition: giaTim.c:93
char * pName
Definition: gia.h:97
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
static int Gia_ManAppendBuf(Gia_Man_t *p, int iLit)
Definition: gia.h:694
int Tim_ManCiNum(Tim_Man_t *p)
Definition: timMan.c:680
if(last==0)
Definition: sparse_int.h:34
char * pSpec
Definition: gia.h:98
else
Definition: sparse_int.h:55
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
void * pManTime
Definition: gia.h:165
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
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
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManDupRemapEquiv(Gia_Man_t *pNew, Gia_Man_t *p)
DECLARATIONS ///.
Definition: giaDup.c:46
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManDupOneHot ( Gia_Man_t p)

Definition at line 2785 of file giaDup.c.

2786 {
2787  Gia_Man_t * pOneHot, * pNew = Gia_ManDup( p );
2788  if ( Gia_ManRegNum(pNew) == 0 )
2789  {
2790  Abc_Print( 0, "Appending 1-hotness constraints to the PIs.\n" );
2791  pOneHot = Gia_ManOneHot( 0, Gia_ManCiNum(pNew) );
2792  }
2793  else
2794  pOneHot = Gia_ManOneHot( Gia_ManPiNum(pNew), Gia_ManRegNum(pNew) );
2795  Gia_ManDupAppendShare( pNew, pOneHot );
2796  pNew->nConstrs += Gia_ManPoNum(pOneHot);
2797  Gia_ManStop( pOneHot );
2798  return pNew;
2799 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition: giaDup.c:552
int nConstrs
Definition: gia.h:117
void Gia_ManDupAppendShare(Gia_Man_t *pNew, Gia_Man_t *pTwo)
Definition: giaDup.c:765
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
Gia_Man_t * Gia_ManOneHot(int nSkips, int nVars)
Definition: giaDup.c:2759
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
Definition: gia.h:95
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManDupOntop ( Gia_Man_t p,
Gia_Man_t p2 
)

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

Synopsis [Duplicates AIG in the DFS order while putting CIs first.]

Description []

SideEffects []

SeeAlso []

Definition at line 1772 of file giaDup.c.

1773 {
1774  Gia_Man_t * pTemp, * pNew;
1775  Gia_Obj_t * pObj;
1776  int i;
1777  assert( Gia_ManPoNum(p) == Gia_ManPiNum(p2) );
1778  assert( Gia_ManRegNum(p) == 0 );
1779  assert( Gia_ManRegNum(p2) == 0 );
1780  pNew = Gia_ManStart( Gia_ManObjNum(p)+Gia_ManObjNum(p2) );
1781  pNew->pName = Abc_UtilStrsav( p->pName );
1782  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1783  Gia_ManHashAlloc( pNew );
1784  // dup first AIG
1785  Gia_ManConst0(p)->Value = 0;
1786  Gia_ManForEachCi( p, pObj, i )
1787  pObj->Value = Gia_ManAppendCi(pNew);
1788  Gia_ManForEachAnd( p, pObj, i )
1789  pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1790  // dup second AIG
1791  Gia_ManConst0(p2)->Value = 0;
1792  Gia_ManForEachCo( p, pObj, i )
1793  Gia_ManPi(p2, i)->Value = Gia_ObjFanin0Copy(pObj);
1794  Gia_ManForEachAnd( p2, pObj, i )
1795  pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1796  Gia_ManForEachCo( p2, pObj, i )
1797  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1798  Gia_ManHashStop( pNew );
1799 // Gia_ManPrintStats( pGiaNew, 0 );
1800  pNew = Gia_ManCleanup( pTemp = pNew );
1801  Gia_ManStop( pTemp );
1802  return pNew;
1803 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
static Gia_Obj_t * Gia_ManPi(Gia_Man_t *p, int v)
Definition: gia.h:405
char * pName
Definition: gia.h:97
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManDupOrderAiger ( Gia_Man_t p)

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

Synopsis [Duplicates AIG while putting first PIs, then nodes, then POs.]

Description []

SideEffects []

SeeAlso []

Definition at line 397 of file giaDup.c.

398 {
399  Gia_Man_t * pNew;
400  Gia_Obj_t * pObj;
401  int i;
402  pNew = Gia_ManStart( Gia_ManObjNum(p) );
403  pNew->pName = Abc_UtilStrsav( p->pName );
404  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
405  Gia_ManConst0(p)->Value = 0;
406  Gia_ManForEachCi( p, pObj, i )
407  pObj->Value = Gia_ManAppendCi(pNew);
408  Gia_ManForEachAnd( p, pObj, i )
409  pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
410  Gia_ManForEachCo( p, pObj, i )
411  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
412  Gia_ManDupRemapEquiv( pNew, p );
413  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
414  assert( Gia_ManIsNormalized(pNew) );
415  return pNew;
416 }
static int Gia_ManAppendAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: gia.h:592
ABC_NAMESPACE_IMPL_START void Gia_ManDupRemapEquiv(Gia_Man_t *pNew, Gia_Man_t *p)
DECLARATIONS ///.
Definition: giaDup.c:46
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
char * pName
Definition: gia.h:97
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
Definition: gia.h:95
int Gia_ManIsNormalized(Gia_Man_t *p)
Definition: giaTim.c:109
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManDupOrderDfs ( Gia_Man_t p)

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

Synopsis [Duplicates AIG while putting objects in the DFS order.]

Description []

SideEffects []

SeeAlso []

Definition at line 170 of file giaDup.c.

171 {
172  Gia_Man_t * pNew;
173  Gia_Obj_t * pObj;
174  int i;
175  Gia_ManFillValue( p );
176  pNew = Gia_ManStart( Gia_ManObjNum(p) );
177  pNew->pName = Abc_UtilStrsav( p->pName );
178  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
179  Gia_ManConst0(p)->Value = 0;
180  Gia_ManForEachCo( p, pObj, i )
181  Gia_ManDupOrderDfs_rec( pNew, p, pObj );
182  Gia_ManForEachCi( p, pObj, i )
183  if ( !~pObj->Value )
184  pObj->Value = Gia_ManAppendCi(pNew);
185  assert( Gia_ManCiNum(pNew) == Gia_ManCiNum(p) );
186  Gia_ManDupRemapCis( pNew, p );
187  Gia_ManDupRemapEquiv( pNew, p );
188  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
189  return pNew;
190 }
ABC_NAMESPACE_IMPL_START void Gia_ManDupRemapEquiv(Gia_Man_t *pNew, Gia_Man_t *p)
DECLARATIONS ///.
Definition: giaDup.c:46
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
void Gia_ManDupRemapCis(Gia_Man_t *pNew, Gia_Man_t *p)
Definition: giaDup.c:92
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
int Gia_ManDupOrderDfs_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaDup.c:144
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
char * pName
Definition: gia.h:97
if(last==0)
Definition: sparse_int.h:34
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManDupOrderDfsChoices ( Gia_Man_t p)

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

Synopsis [Duplicates AIG while putting objects in the DFS order.]

Description []

SideEffects []

SeeAlso []

Definition at line 328 of file giaDup.c.

329 {
330  Gia_Man_t * pNew;
331  Gia_Obj_t * pObj;
332  int i;
333  assert( p->pReprs && p->pNexts );
334  Gia_ManFillValue( p );
335  pNew = Gia_ManStart( Gia_ManObjNum(p) );
336  pNew->pName = Abc_UtilStrsav( p->pName );
337  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
338  pNew->pNexts = ABC_CALLOC( int, Gia_ManObjNum(p) );
339  Gia_ManConst0(p)->Value = 0;
340  Gia_ManForEachCi( p, pObj, i )
341  pObj->Value = Gia_ManAppendCi(pNew);
342  Gia_ManForEachCo( p, pObj, i )
343  {
345  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
346  }
347  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
348 // Gia_ManDeriveReprs( pNew );
349  return pNew;
350 }
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
int * pNexts
Definition: gia.h:122
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
void Gia_ManDupOrderDfsChoices_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaDup.c:298
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
char * pName
Definition: gia.h:97
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
Gia_Rpr_t * pReprs
Definition: gia.h:121
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManDupOrderDfsReverse ( Gia_Man_t p)

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

Synopsis [Duplicates AIG while putting objects in the DFS order.]

Description []

SideEffects []

SeeAlso []

Definition at line 363 of file giaDup.c.

364 {
365  Gia_Man_t * pNew;
366  Gia_Obj_t * pObj;
367  int i;
368  Gia_ManFillValue( p );
369  pNew = Gia_ManStart( Gia_ManObjNum(p) );
370  pNew->pName = Abc_UtilStrsav( p->pName );
371  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
372  Gia_ManConst0(p)->Value = 0;
373  Gia_ManForEachCoReverse( p, pObj, i )
374  Gia_ManDupOrderDfs_rec( pNew, p, pObj );
375  Gia_ManForEachCi( p, pObj, i )
376  if ( !~pObj->Value )
377  pObj->Value = Gia_ManAppendCi(pNew);
378  assert( Gia_ManCiNum(pNew) == Gia_ManCiNum(p) );
379  Gia_ManDupRemapCis( pNew, p );
380  Gia_ManDupRemapCos( pNew, p );
381  Gia_ManDupRemapEquiv( pNew, p );
382  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
383  return pNew;
384 }
ABC_NAMESPACE_IMPL_START void Gia_ManDupRemapEquiv(Gia_Man_t *pNew, Gia_Man_t *p)
DECLARATIONS ///.
Definition: giaDup.c:46
void Gia_ManDupRemapCis(Gia_Man_t *pNew, Gia_Man_t *p)
Definition: giaDup.c:92
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
int Gia_ManDupOrderDfs_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaDup.c:144
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
char * pName
Definition: gia.h:97
if(last==0)
Definition: sparse_int.h:34
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
void Gia_ManDupRemapCos(Gia_Man_t *pNew, Gia_Man_t *p)
Definition: giaDup.c:118
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Gia_ManForEachCoReverse(p, pObj, i)
Definition: gia.h:1028
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManDupOutputGroup ( Gia_Man_t p,
int  iOutStart,
int  iOutStop 
)

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

Synopsis [Duplicates AIG while putting objects in the DFS order.]

Description []

SideEffects []

SeeAlso []

Definition at line 203 of file giaDup.c.

204 {
205  Gia_Man_t * pNew;
206  Gia_Obj_t * pObj;
207  int i;
208  Gia_ManFillValue( p );
209  pNew = Gia_ManStart( Gia_ManObjNum(p) );
210  pNew->pName = Abc_UtilStrsav( p->pName );
211  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
212  Gia_ManConst0(p)->Value = 0;
213  for ( i = iOutStart; i < iOutStop; i++ )
214  {
215  pObj = Gia_ManCo( p, i );
216  Gia_ManDupOrderDfs_rec( pNew, p, pObj );
217  }
218  return pNew;
219 }
int Gia_ManDupOrderDfs_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaDup.c:144
Definition: gia.h:75
char * pName
Definition: gia.h:97
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
static Gia_Obj_t * Gia_ManCo(Gia_Man_t *p, int v)
Definition: gia.h:404
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
unsigned Value
Definition: gia.h:87
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
Gia_Man_t* Gia_ManDupOutputVec ( Gia_Man_t p,
Vec_Int_t vOutPres 
)

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

Synopsis [Duplicates AIG while putting objects in the DFS order.]

Description []

SideEffects []

SeeAlso []

Definition at line 232 of file giaDup.c.

233 {
234  Gia_Man_t * pNew;
235  Gia_Obj_t * pObj;
236  int i;
237  assert( Gia_ManRegNum(p) == 0 );
238  assert( Gia_ManPoNum(p) == Vec_IntSize(vOutPres) );
239  Gia_ManFillValue( p );
240  pNew = Gia_ManStart( Gia_ManObjNum(p) );
241  pNew->pName = Abc_UtilStrsav( p->pName );
242  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
243  Gia_ManConst0(p)->Value = 0;
244  Gia_ManForEachPi( p, pObj, i )
245  pObj->Value = Gia_ManAppendCi(pNew);
246  Gia_ManForEachPo( p, pObj, i )
247  if ( Vec_IntEntry(vOutPres, i) )
248  Gia_ManDupOrderDfs_rec( pNew, p, Gia_ObjFanin0(pObj) );
249  Gia_ManForEachPo( p, pObj, i )
250  if ( Vec_IntEntry(vOutPres, i) )
251  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
252  return pNew;
253 }
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
int Gia_ManDupOrderDfs_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaDup.c:144
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
char * pName
Definition: gia.h:97
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
if(last==0)
Definition: sparse_int.h:34
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManDupPerm ( Gia_Man_t p,
Vec_Int_t vPiPerm 
)

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

Synopsis [Duplicates AIG without any changes.]

Description []

SideEffects []

SeeAlso []

Definition at line 632 of file giaDup.c.

633 {
634 // Vec_Int_t * vPiPermInv;
635  Gia_Man_t * pNew;
636  Gia_Obj_t * pObj;
637  int i;
638  assert( Vec_IntSize(vPiPerm) == Gia_ManPiNum(p) );
639  pNew = Gia_ManStart( Gia_ManObjNum(p) );
640  pNew->pName = Abc_UtilStrsav( p->pName );
641  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
642  Gia_ManConst0(p)->Value = 0;
643 // vPiPermInv = Vec_IntInvert( vPiPerm, -1 );
644  Gia_ManForEachPi( p, pObj, i )
645 // Gia_ManPi(p, Vec_IntEntry(vPiPermInv,i))->Value = Gia_ManAppendCi( pNew );
646  Gia_ManPi(p, Vec_IntEntry(vPiPerm,i))->Value = Gia_ManAppendCi( pNew );
647 // Vec_IntFree( vPiPermInv );
648  Gia_ManForEachObj1( p, pObj, i )
649  {
650  if ( Gia_ObjIsAnd(pObj) )
651  pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
652  else if ( Gia_ObjIsCi(pObj) )
653  {
654  if ( Gia_ObjIsRo(p, pObj) )
655  pObj->Value = Gia_ManAppendCi( pNew );
656  }
657  else if ( Gia_ObjIsCo(pObj) )
658  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
659  }
660  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
661  return pNew;
662 }
static int Gia_ManAppendAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: gia.h:592
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
Definition: gia.h:75
static Gia_Obj_t * Gia_ManPi(Gia_Man_t *p, int v)
Definition: gia.h:405
char * pName
Definition: gia.h:97
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
static int Gia_ObjIsRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:443
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Definition: gia.h:95
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
#define Gia_ManForEachObj1(p, pObj, i)
Definition: gia.h:986
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManDupPermFlop ( Gia_Man_t p,
Vec_Int_t vFfPerm 
)

Definition at line 663 of file giaDup.c.

664 {
665  Vec_Int_t * vPermInv;
666  Gia_Man_t * pNew;
667  Gia_Obj_t * pObj;
668  int i;
669  assert( Vec_IntSize(vFfPerm) == Gia_ManRegNum(p) );
670  vPermInv = Vec_IntInvert( vFfPerm, -1 );
671  pNew = Gia_ManStart( Gia_ManObjNum(p) );
672  pNew->pName = Abc_UtilStrsav( p->pName );
673  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
674  Gia_ManConst0(p)->Value = 0;
675  Gia_ManForEachPi( p, pObj, i )
676  pObj->Value = Gia_ManAppendCi(pNew);
677  Gia_ManForEachRo( p, pObj, i )
678  Gia_ManRo(p, Vec_IntEntry(vPermInv, i))->Value = Gia_ManAppendCi(pNew);
679  Gia_ManForEachAnd( p, pObj, i )
680  pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
681  Gia_ManForEachPo( p, pObj, i )
682  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
683  Gia_ManForEachRi( p, pObj, i )
684  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy( Gia_ManRi(p, Vec_IntEntry(vPermInv, i)) ) );
685  Vec_IntFree( vPermInv );
686  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
687  return pNew;
688 }
static int Gia_ManAppendAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: gia.h:592
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
static Vec_Int_t * Vec_IntInvert(Vec_Int_t *p, int Fill)
Definition: vecInt.h:1092
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
Definition: gia.h:75
char * pName
Definition: gia.h:97
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define Gia_ManForEachRo(p, pObj, i)
Definition: gia.h:1038
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
#define Gia_ManForEachRi(p, pObj, i)
Definition: gia.h:1040
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static Gia_Obj_t * Gia_ManRo(Gia_Man_t *p, int v)
Definition: gia.h:407
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static Gia_Obj_t * Gia_ManRi(Gia_Man_t *p, int v)
Definition: gia.h:408
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManDupPermFlopGap ( Gia_Man_t p,
Vec_Int_t vFfPerm 
)

Definition at line 725 of file giaDup.c.

726 {
727  Vec_Int_t * vPerm = Vec_IntCondense( vFfMask, -1 );
728  Gia_Man_t * pPerm = Gia_ManDupPermFlop( p, vPerm );
729  Gia_Man_t * pSpread = Gia_ManDupSpreadFlop( pPerm, vFfMask );
730  Vec_IntFree( vPerm );
731  Gia_ManStop( pPerm );
732  return pSpread;
733 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Gia_Man_t * Gia_ManDupSpreadFlop(Gia_Man_t *p, Vec_Int_t *vFfMask)
Definition: giaDup.c:689
Gia_Man_t * Gia_ManDupPermFlop(Gia_Man_t *p, Vec_Int_t *vFfPerm)
Definition: giaDup.c:663
static int pPerm[13719]
Definition: rwrTemp.c:32
Definition: gia.h:95
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static Vec_Int_t * Vec_IntCondense(Vec_Int_t *p, int Fill)
Definition: vecInt.h:1116
void Gia_ManDupRemapEquiv ( Gia_Man_t pNew,
Gia_Man_t p 
)

DECLARATIONS ///.

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

FileName [giaDup.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Scalable AIG package.]

Synopsis [Duplication procedures.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Removes pointers to the unmarked nodes..]

Description []

SideEffects []

SeeAlso []

Definition at line 46 of file giaDup.c.

47 {
48  Vec_Int_t * vClass;
49  int i, k, iNode, iRepr, iPrev;
50  if ( p->pReprs == NULL )
51  return;
52  assert( pNew->pReprs == NULL && pNew->pNexts == NULL );
53  // start representatives
54  pNew->pReprs = ABC_CALLOC( Gia_Rpr_t, Gia_ManObjNum(pNew) );
55  for ( i = 0; i < Gia_ManObjNum(pNew); i++ )
56  Gia_ObjSetRepr( pNew, i, GIA_VOID );
57  // iterate over constant candidates
58  Gia_ManForEachConst( p, i )
59  Gia_ObjSetRepr( pNew, Abc_Lit2Var(Gia_ManObj(p, i)->Value), 0 );
60  // iterate over class candidates
61  vClass = Vec_IntAlloc( 100 );
62  Gia_ManForEachClass( p, i )
63  {
64  Vec_IntClear( vClass );
65  Gia_ClassForEachObj( p, i, k )
66  Vec_IntPushUnique( vClass, Abc_Lit2Var(Gia_ManObj(p, k)->Value) );
67  assert( Vec_IntSize( vClass ) > 1 );
68  Vec_IntSort( vClass, 0 );
69  iRepr = iPrev = Vec_IntEntry( vClass, 0 );
70  Vec_IntForEachEntryStart( vClass, iNode, k, 1 )
71  {
72  Gia_ObjSetRepr( pNew, iNode, iRepr );
73  assert( iPrev < iNode );
74  iPrev = iNode;
75  }
76  }
77  Vec_IntFree( vClass );
78  pNew->pNexts = Gia_ManDeriveNexts( pNew );
79 }
int * pNexts
Definition: gia.h:122
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static void Vec_IntSort(Vec_Int_t *p, int fReverse)
Definition: vecInt.h:1293
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
static void Gia_ObjSetRepr(Gia_Man_t *p, int Id, int Num)
Definition: gia.h:888
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
#define Gia_ManForEachConst(p, i)
Definition: gia.h:925
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
Definition: vecInt.h:56
int * Gia_ManDeriveNexts(Gia_Man_t *p)
Definition: giaEquiv.c:97
#define Gia_ClassForEachObj(p, i, iObj)
Definition: gia.h:931
#define GIA_VOID
Definition: gia.h:45
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define Gia_ManForEachClass(p, i)
Definition: gia.h:927
Gia_Rpr_t * pReprs
Definition: gia.h:121
#define assert(ex)
Definition: util_old.h:213
Definition: gia.h:56
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static int Vec_IntPushUnique(Vec_Int_t *p, int Entry)
Definition: vecInt.h:832
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
Gia_Man_t* Gia_ManDupSelectedOutputs ( Gia_Man_t p,
Vec_Int_t vOutsLeft 
)

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

Synopsis [Duplicates AIG while putting objects in the DFS order.]

Description []

SideEffects []

SeeAlso []

Definition at line 266 of file giaDup.c.

267 {
268  Gia_Man_t * pNew;
269  Gia_Obj_t * pObj;
270  int i, iOut;
271  assert( Gia_ManRegNum(p) == 0 );
272  assert( Gia_ManPoNum(p) >= Vec_IntSize(vOutsLeft) );
273  Gia_ManFillValue( p );
274  pNew = Gia_ManStart( Gia_ManObjNum(p) );
275  pNew->pName = Abc_UtilStrsav( p->pName );
276  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
277  Gia_ManConst0(p)->Value = 0;
278  Gia_ManForEachPi( p, pObj, i )
279  pObj->Value = Gia_ManAppendCi(pNew);
280  Vec_IntForEachEntry( vOutsLeft, iOut, i )
281  Gia_ManDupOrderDfs_rec( pNew, p, Gia_ObjFanin0(Gia_ManPo(p, iOut)) );
282  Vec_IntForEachEntry( vOutsLeft, iOut, i )
283  Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(Gia_ManPo(p, iOut)) );
284  return pNew;
285 }
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
int Gia_ManDupOrderDfs_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaDup.c:144
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
char * pName
Definition: gia.h:97
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManDupSelf ( Gia_Man_t p)

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

Synopsis [Duplicates while adding self-loops to the registers.]

Description []

SideEffects []

SeeAlso []

Definition at line 890 of file giaDup.c.

891 {
892  Gia_Man_t * pNew, * pTemp;
893  Gia_Obj_t * pObj;
894  int i, iCtrl;
895  pNew = Gia_ManStart( Gia_ManObjNum(p) );
896  pNew->pName = Abc_UtilStrsav( p->pName );
897  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
898  Gia_ManHashAlloc( pNew );
899  Gia_ManFillValue( p );
900  Gia_ManConst0(p)->Value = 0;
901  iCtrl = Gia_ManAppendCi( pNew );
902  Gia_ManForEachCi( p, pObj, i )
903  pObj->Value = Gia_ManAppendCi( pNew );
904  Gia_ManForEachAnd( p, pObj, i )
905  pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
906  Gia_ManForEachPo( p, pObj, i )
907  pObj->Value = Gia_ObjFanin0Copy(pObj);
908  Gia_ManForEachRi( p, pObj, i )
909  pObj->Value = Gia_ManHashMux( pNew, iCtrl, Gia_ObjFanin0Copy(pObj), Gia_ObjRiToRo(p, pObj)->Value );
910  Gia_ManForEachCo( p, pObj, i )
911  Gia_ManAppendCo( pNew, pObj->Value );
912  Gia_ManHashStop( pNew );
913  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
914  pNew = Gia_ManCleanup( pTemp = pNew );
915  Gia_ManStop( pTemp );
916  return pNew;
917 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
char * pName
Definition: gia.h:97
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
int Gia_ManHashMux(Gia_Man_t *p, int iCtrl, int iData1, int iData0)
Definition: giaHash.c:677
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static Gia_Obj_t * Gia_ObjRiToRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:447
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
unsigned Value
Definition: gia.h:87
#define Gia_ManForEachRi(p, pObj, i)
Definition: gia.h:1040
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManDupSliced ( Gia_Man_t p,
int  nSuppMax 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 2888 of file giaDup.c.

2889 {
2890  Gia_Man_t * pNew;
2891  Gia_Obj_t * pObj;
2892  int i;
2893  // start the new manager
2894  pNew = Gia_ManStart( 5000 );
2895  pNew->pName = Abc_UtilStrsav( p->pName );
2896  // create constant and PIs
2897  Gia_ManConst0(p)->Value = 0;
2898  Gia_ManForEachCi( p, pObj, i )
2899  pObj->Value = Gia_ManAppendCi( pNew );
2900  // create internal nodes
2901  Gia_ManCleanMark01(p);
2902  Gia_ManForEachAnd( p, pObj, i )
2903  if ( Gia_ManSuppSize(p, &i, 1) <= nSuppMax )
2904  {
2905  pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
2906  pObj->fMark0 = 1;
2907  }
2908  else
2909  {
2910  Gia_ObjFanin0(pObj)->fMark1 = 1;
2911  Gia_ObjFanin1(pObj)->fMark1 = 1;
2912  }
2913  Gia_ManForEachCo( p, pObj, i )
2914  Gia_ObjFanin0(pObj)->fMark1 = 1;
2915  // add POs for the nodes pointed to
2916  Gia_ManForEachAnd( p, pObj, i )
2917  if ( pObj->fMark0 && pObj->fMark1 )
2918  Gia_ManAppendCo( pNew, pObj->Value );
2919  // cleanup and leave
2920  Gia_ManCleanMark01(p);
2921  return pNew;
2922 }
static int Gia_ManAppendAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: gia.h:592
int Gia_ManSuppSize(Gia_Man_t *p, int *pNodes, int nNodes)
Definition: giaDfs.c:300
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
unsigned fMark1
Definition: gia.h:84
int nSuppMax
Definition: llb3Image.c:83
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
char * pName
Definition: gia.h:97
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
if(last==0)
Definition: sparse_int.h:34
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
unsigned Value
Definition: gia.h:87
void Gia_ManCleanMark01(Gia_Man_t *p)
Definition: giaUtil.c:177
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
Gia_Man_t* Gia_ManDupTimes ( Gia_Man_t p,
int  nTimes 
)

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

Synopsis [Duplicates AIG while creating "parallel" copies.]

Description []

SideEffects []

SeeAlso []

Definition at line 1078 of file giaDup.c.

1079 {
1080  Gia_Man_t * pNew;
1081  Gia_Obj_t * pObj;
1082  Vec_Int_t * vPis, * vPos, * vRis, * vRos;
1083  int i, t, Entry;
1084  assert( nTimes > 0 );
1085  pNew = Gia_ManStart( Gia_ManObjNum(p) );
1086  pNew->pName = Abc_UtilStrsav( p->pName );
1087  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1088  Gia_ManConst0(p)->Value = 0;
1089  vPis = Vec_IntAlloc( Gia_ManPiNum(p) * nTimes );
1090  vPos = Vec_IntAlloc( Gia_ManPoNum(p) * nTimes );
1091  vRis = Vec_IntAlloc( Gia_ManRegNum(p) * nTimes );
1092  vRos = Vec_IntAlloc( Gia_ManRegNum(p) * nTimes );
1093  for ( t = 0; t < nTimes; t++ )
1094  {
1095  Gia_ManForEachObj1( p, pObj, i )
1096  {
1097  if ( Gia_ObjIsAnd(pObj) )
1098  pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1099  else if ( Gia_ObjIsCi(pObj) )
1100  {
1101  pObj->Value = Gia_ManAppendCi( pNew );
1102  if ( Gia_ObjIsPi(p, pObj) )
1103  Vec_IntPush( vPis, Abc_Lit2Var(pObj->Value) );
1104  else
1105  Vec_IntPush( vRos, Abc_Lit2Var(pObj->Value) );
1106  }
1107  else if ( Gia_ObjIsCo(pObj) )
1108  {
1109  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1110  if ( Gia_ObjIsPo(p, pObj) )
1111  Vec_IntPush( vPos, Abc_Lit2Var(pObj->Value) );
1112  else
1113  Vec_IntPush( vRis, Abc_Lit2Var(pObj->Value) );
1114  }
1115  }
1116  }
1117  Vec_IntClear( pNew->vCis );
1118  Vec_IntForEachEntry( vPis, Entry, i )
1119  {
1120  Gia_ObjSetCioId( Gia_ManObj(pNew, Entry), Vec_IntSize(pNew->vCis) );
1121  Vec_IntPush( pNew->vCis, Entry );
1122  }
1123  Vec_IntForEachEntry( vRos, Entry, i )
1124  {
1125  Gia_ObjSetCioId( Gia_ManObj(pNew, Entry), Vec_IntSize(pNew->vCis) );
1126  Vec_IntPush( pNew->vCis, Entry );
1127  }
1128  Vec_IntClear( pNew->vCos );
1129  Vec_IntForEachEntry( vPos, Entry, i )
1130  {
1131  Gia_ObjSetCioId( Gia_ManObj(pNew, Entry), Vec_IntSize(pNew->vCos) );
1132  Vec_IntPush( pNew->vCos, Entry );
1133  }
1134  Vec_IntForEachEntry( vRis, Entry, i )
1135  {
1136  Gia_ObjSetCioId( Gia_ManObj(pNew, Entry), Vec_IntSize(pNew->vCos) );
1137  Vec_IntPush( pNew->vCos, Entry );
1138  }
1139  Vec_IntFree( vPis );
1140  Vec_IntFree( vPos );
1141  Vec_IntFree( vRis );
1142  Vec_IntFree( vRos );
1143  Gia_ManSetRegNum( pNew, nTimes * Gia_ManRegNum(p) );
1144  return pNew;
1145 }
static int Gia_ManAppendAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: gia.h:592
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
Vec_Int_t * vCos
Definition: gia.h:109
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
char * pName
Definition: gia.h:97
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
static void Gia_ObjSetCioId(Gia_Obj_t *pObj, int v)
Definition: gia.h:412
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
Vec_Int_t * vCis
Definition: gia.h:108
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Definition: gia.h:95
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
static int Gia_ObjIsPo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:442
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
#define Gia_ManForEachObj1(p, pObj, i)
Definition: gia.h:986
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ObjIsPi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:441
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManDupTopAnd ( Gia_Man_t p,
int  fVerbose 
)

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

Synopsis [Detect topmost gate.]

Description []

SideEffects []

SeeAlso []

Definition at line 2075 of file giaDup.c.

2076 {
2077  Gia_Man_t * pNew, * pTemp;
2078  int fContinue, iIter = 0;
2079  pNew = Gia_ManDupNormalize( p );
2080  for ( fContinue = 1; fContinue; )
2081  {
2082  pNew = Gia_ManDupTopAnd_iter( pTemp = pNew, fVerbose );
2083  if ( Gia_ManCoNum(pNew) == Gia_ManCoNum(pTemp) && Gia_ManAndNum(pNew) == Gia_ManAndNum(pTemp) )
2084  fContinue = 0;
2085  Gia_ManStop( pTemp );
2086  if ( fVerbose )
2087  {
2088  printf( "Iter %2d : ", ++iIter );
2089  Gia_ManPrintStatsShort( pNew );
2090  }
2091  }
2092  return pNew;
2093 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
Gia_Man_t * Gia_ManDupTopAnd_iter(Gia_Man_t *p, int fVerbose)
Definition: giaDup.c:1974
void Gia_ManPrintStatsShort(Gia_Man_t *p)
Definition: giaMan.c:522
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
Gia_Man_t * Gia_ManDupNormalize(Gia_Man_t *p)
Definition: giaTim.c:134
Definition: gia.h:95
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
Gia_Man_t* Gia_ManDupTrimmed ( Gia_Man_t p,
int  fTrimCis,
int  fTrimCos,
int  fDualOut,
int  OutValue 
)

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

Synopsis [Duplicates AIG in the DFS order while putting CIs first.]

Description []

SideEffects []

SeeAlso []

Definition at line 1638 of file giaDup.c.

1639 {
1640  Vec_Int_t * vNonZero = NULL;
1641  Gia_Man_t * pNew, * pTemp;
1642  Gia_Obj_t * pObj;
1643  int i, Entry;
1644  // collect non-zero
1645  if ( fDualOut && fTrimCos )
1646  vNonZero = Gia_ManDupTrimmedNonZero( p );
1647  // start new manager
1648  pNew = Gia_ManStart( Gia_ManObjNum(p) );
1649  pNew->pName = Abc_UtilStrsav( p->pName );
1650  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1651  // check if there are PIs to be added
1652  Gia_ManCreateRefs( p );
1653  Gia_ManForEachPi( p, pObj, i )
1654  if ( !fTrimCis || Gia_ObjRefNum(p, pObj) )
1655  break;
1656  if ( i == Gia_ManPiNum(p) ) // there is no PIs - add dummy PI
1657  Gia_ManAppendCi(pNew);
1658  // add the ROs
1659  Gia_ManFillValue( p );
1660  Gia_ManConst0(p)->Value = 0;
1661  Gia_ManForEachCi( p, pObj, i )
1662  if ( !fTrimCis || Gia_ObjRefNum(p, pObj) || Gia_ObjIsRo(p, pObj) )
1663  pObj->Value = Gia_ManAppendCi(pNew);
1664  Gia_ManForEachAnd( p, pObj, i )
1665  pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1666  if ( fDualOut && fTrimCos )
1667  {
1668  Vec_IntForEachEntry( vNonZero, Entry, i )
1669  {
1670  Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(Gia_ManPo(p, 2*Entry+0)) );
1671  Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(Gia_ManPo(p, 2*Entry+1)) );
1672  }
1673  if ( Gia_ManPoNum(pNew) == 0 ) // nothing - add dummy PO
1674  {
1675 // Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(Gia_ManPo(p, 0)) );
1676 // Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(Gia_ManPo(p, 1)) );
1677  Gia_ManAppendCo( pNew, 0 );
1678  Gia_ManAppendCo( pNew, 0 );
1679  }
1680  Gia_ManForEachRi( p, pObj, i )
1681  Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1682  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
1683  // cleanup
1684  pNew = Gia_ManSeqStructSweep( pTemp = pNew, 1, 1, 0 );
1685  Gia_ManStop( pTemp );
1686  // trim the PIs
1687 // pNew = Gia_ManDupTrimmed( pTemp = pNew, 1, 0, 0 );
1688 // Gia_ManStop( pTemp );
1689  }
1690  else
1691  {
1692  // check if there are POs to be added
1693  Gia_ManForEachPo( p, pObj, i )
1694  if ( !fTrimCos || !Gia_ManPoIsToRemove(p, pObj, OutValue) )
1695  break;
1696  if ( i == Gia_ManPoNum(p) ) // there is no POs - add dummy PO
1697  Gia_ManAppendCo( pNew, 0 );
1698  Gia_ManForEachCo( p, pObj, i )
1699  if ( !fTrimCos || !Gia_ManPoIsToRemove(p, pObj, OutValue) || Gia_ObjIsRi(p, pObj) )
1700  Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1701  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
1702  }
1703  Vec_IntFreeP( &vNonZero );
1704  assert( !Gia_ManHasDangling( pNew ) );
1705  return pNew;
1706 }
static int Gia_ManAppendAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: gia.h:592
void Gia_ManCreateRefs(Gia_Man_t *p)
Definition: giaUtil.c:715
int Gia_ManPoIsToRemove(Gia_Man_t *p, Gia_Obj_t *pObj, int Value)
Definition: giaDup.c:1618
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
static int Gia_ObjRefNum(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:521
Vec_Int_t * Gia_ManDupTrimmedNonZero(Gia_Man_t *p)
Definition: giaDup.c:1585
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
Definition: gia.h:75
int Gia_ManHasDangling(Gia_Man_t *p)
Definition: giaUtil.c:1155
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
char * pName
Definition: gia.h:97
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
static int Gia_ObjIsRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:443
static int Gia_ObjIsRi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:444
if(last==0)
Definition: sparse_int.h:34
char * pSpec
Definition: gia.h:98
else
Definition: sparse_int.h:55
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
Gia_Man_t * Gia_ManSeqStructSweep(Gia_Man_t *p, int fConst, int fEquiv, int fVerbose)
Definition: giaScl.c:258
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define assert(ex)
Definition: util_old.h:213
#define Gia_ManForEachRi(p, pObj, i)
Definition: gia.h:1040
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManDupUnnormalize ( Gia_Man_t p)

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

Synopsis [Duplicates AIG according to the timing manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 373 of file giaTim.c.

374 {
375  Vec_Int_t * vNodes;
376  Gia_Man_t * pNew;
377  Gia_Obj_t * pObj;
378  int i;
379  assert( !Gia_ManBufNum(p) );
380  vNodes = Gia_ManOrderWithBoxes( p );
381  if ( vNodes == NULL )
382  return NULL;
383  Gia_ManFillValue( p );
384  pNew = Gia_ManStart( Gia_ManObjNum(p) );
385  pNew->pName = Abc_UtilStrsav( p->pName );
386  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
387  if ( Gia_ManHasChoices(p) )
388  pNew->pSibls = ABC_CALLOC( int, Gia_ManObjNum(p) );
389  Gia_ManForEachObjVec( vNodes, p, pObj, i )
390  {
391  if ( Gia_ObjIsBuf(pObj) )
392  pObj->Value = Gia_ManAppendBuf( pNew, Gia_ObjFanin0Copy(pObj) );
393  else if ( Gia_ObjIsAnd(pObj) )
394  {
395  pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
396  if ( Gia_ObjSibl(p, Gia_ObjId(p, pObj)) )
397  pNew->pSibls[Abc_Lit2Var(pObj->Value)] = Abc_Lit2Var(Gia_ObjSiblObj(p, Gia_ObjId(p, pObj))->Value);
398  }
399  else if ( Gia_ObjIsCi(pObj) )
400  pObj->Value = Gia_ManAppendCi( pNew );
401  else if ( Gia_ObjIsCo(pObj) )
402  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
403  else if ( Gia_ObjIsConst0(pObj) )
404  pObj->Value = 0;
405  else assert( 0 );
406  }
407  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
408  Vec_IntFree( vNodes );
409  return pNew;
410 }
static int Gia_ManAppendAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: gia.h:592
Vec_Int_t * Gia_ManOrderWithBoxes(Gia_Man_t *p)
Definition: giaTim.c:277
static Gia_Obj_t * Gia_ObjSiblObj(Gia_Man_t *p, int Id)
Definition: gia.h:894
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
int * pSibls
Definition: gia.h:123
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
static int Gia_ObjIsConst0(Gia_Obj_t *pObj)
Definition: gia.h:430
static int Gia_ObjIsBuf(Gia_Obj_t *pObj)
Definition: gia.h:427
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
Definition: gia.h:75
static int Gia_ManHasChoices(Gia_Man_t *p)
Definition: gia.h:397
static int Gia_ObjSibl(Gia_Man_t *p, int Id)
Definition: gia.h:893
char * pName
Definition: gia.h:97
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
static int Gia_ManAppendBuf(Gia_Man_t *p, int iLit)
Definition: gia.h:694
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition: gia.h:988
Definition: gia.h:95
static int Gia_ManBufNum(Gia_Man_t *p)
Definition: gia.h:392
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManDupUnshuffleInputs ( Gia_Man_t p)

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

Synopsis [Reorders flops for sequential AIGs with boxes.]

Description []

SideEffects []

SeeAlso []

Definition at line 194 of file giaTim.c.

195 {
196  Gia_Man_t * pNew;
197  Gia_Obj_t * pObj;
198  int i, nCIs, nAll, nPis;
199  // sanity checks
202  Gia_ManFillValue( p );
203  pNew = Gia_ManStart( Gia_ManObjNum(p) );
204  pNew->pName = Abc_UtilStrsav( p->pName );
205  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
206  Gia_ManConst0(p)->Value = 0;
207  // change input order
208  // desired reorder: PIs + NewCIs + FOs
209  // current CI order: PIs + FOs + NewCIs
210  nCIs = Tim_ManPiNum( (Tim_Man_t *)p->pManTime );
211  nAll = Tim_ManCiNum( (Tim_Man_t *)p->pManTime );
212  nPis = nCIs - Gia_ManRegNum(p);
213  assert( nAll == Gia_ManCiNum(p) );
214  assert( nPis > 0 );
215  // copy PIs first
216  for ( i = 0; i < nPis; i++ )
217  Gia_ManCi(p, i)->Value = Gia_ManAppendCi(pNew);
218  // copy flops second
219  for ( i = nAll - Gia_ManRegNum(p); i < nAll; i++ )
220  Gia_ManCi(p, i)->Value = Gia_ManAppendCi(pNew);
221  // copy new CIs last
222  for ( i = nPis; i < nAll - Gia_ManRegNum(p); i++ )
223  Gia_ManCi(p, i)->Value = Gia_ManAppendCi(pNew);
224  printf( "Warning: Unshuffled CI order to be correct AIG with boxes.\n" );
225  // other things
226  Gia_ManForEachAnd( p, pObj, i )
227  pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
228  Gia_ManForEachCo( p, pObj, i )
229  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
230  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
231  pNew->nConstrs = p->nConstrs;
232  assert( Gia_ManIsNormalized(pNew) );
233  Gia_ManDupRemapEquiv( pNew, p );
234  return pNew;
235 }
static int Gia_ManAppendAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: gia.h:592
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static Gia_Obj_t * Gia_ManCi(Gia_Man_t *p, int v)
Definition: gia.h:403
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
int Gia_ManIsNormalized(Gia_Man_t *p)
Definition: giaTim.c:109
Definition: gia.h:75
int Tim_ManPiNum(Tim_Man_t *p)
Definition: timMan.c:688
int Gia_ManIsSeqWithBoxes(Gia_Man_t *p)
Definition: giaTim.c:93
char * pName
Definition: gia.h:97
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
int Tim_ManCiNum(Tim_Man_t *p)
Definition: timMan.c:680
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
void * pManTime
Definition: gia.h:165
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
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
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManDupRemapEquiv(Gia_Man_t *pNew, Gia_Man_t *p)
DECLARATIONS ///.
Definition: giaDup.c:46
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManDupWithAttributes ( Gia_Man_t p)

Definition at line 583 of file giaDup.c.

584 {
585  Gia_Man_t * pNew = Gia_ManDup(p);
586  Gia_ManTransferMapping( pNew, p );
587  Gia_ManTransferPacking( pNew, p );
588  if ( p->pManTime )
589  pNew->pManTime = Tim_ManDup( (Tim_Man_t *)p->pManTime, 0 );
590  if ( p->pAigExtra )
591  pNew->pAigExtra = Gia_ManDup( p->pAigExtra );
592  if ( p->nAnd2Delay )
593  pNew->nAnd2Delay = p->nAnd2Delay;
594  return pNew;
595 }
Gia_Man_t * pAigExtra
Definition: gia.h:149
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition: giaDup.c:552
Tim_Man_t * Tim_ManDup(Tim_Man_t *p, int fUnitDelay)
Definition: timMan.c:86
void * pManTime
Definition: gia.h:165
int nAnd2Delay
Definition: gia.h:173
Definition: gia.h:95
void Gia_ManTransferPacking(Gia_Man_t *p, Gia_Man_t *pGia)
Definition: giaIf.c:1878
void Gia_ManTransferMapping(Gia_Man_t *p, Gia_Man_t *pGia)
Definition: giaIf.c:1855
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
Gia_Man_t* Gia_ManDupWithConstraints ( Gia_Man_t p,
Vec_Int_t vPoTypes 
)

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

Synopsis [Duplicates AIG while putting first PIs, then nodes, then POs.]

Description []

SideEffects []

SeeAlso []

Definition at line 2627 of file giaDup.c.

2628 {
2629  Gia_Man_t * pNew;
2630  Gia_Obj_t * pObj;
2631  int i, nConstr = 0;
2632  pNew = Gia_ManStart( Gia_ManObjNum(p) );
2633  pNew->pName = Abc_UtilStrsav( p->pName );
2634  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
2635  Gia_ManConst0(p)->Value = 0;
2636  Gia_ManForEachCi( p, pObj, i )
2637  pObj->Value = Gia_ManAppendCi(pNew);
2638  Gia_ManForEachAnd( p, pObj, i )
2639  pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
2640  Gia_ManForEachPo( p, pObj, i )
2641  if ( Vec_IntEntry(vPoTypes, i) == 0 ) // regular PO
2642  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
2643  Gia_ManForEachPo( p, pObj, i )
2644  if ( Vec_IntEntry(vPoTypes, i) == 1 ) // constraint (should be complemented!)
2645  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) ^ 1 ), nConstr++;
2646  Gia_ManForEachRi( p, pObj, i )
2647  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
2648 // Gia_ManDupRemapEquiv( pNew, p );
2649  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
2650  pNew->nConstrs = nConstr;
2651  assert( Gia_ManIsNormalized(pNew) );
2652  return pNew;
2653 }
static int Gia_ManAppendAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: gia.h:592
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
char * pName
Definition: gia.h:97
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
if(last==0)
Definition: sparse_int.h:34
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
Definition: gia.h:95
int Gia_ManIsNormalized(Gia_Man_t *p)
Definition: giaTim.c:109
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
#define Gia_ManForEachRi(p, pObj, i)
Definition: gia.h:1040
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManDupWithNewPo ( Gia_Man_t p1,
Gia_Man_t p2 
)

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

Synopsis [Duplicates transition relation from p1 and property from p2.]

Description []

SideEffects []

SeeAlso []

Definition at line 1816 of file giaDup.c.

1817 {
1818  Gia_Man_t * pTemp, * pNew;
1819  Gia_Obj_t * pObj;
1820  int i;
1821  // there is no flops in p2
1822  assert( Gia_ManRegNum(p2) == 0 );
1823  // there is only one PO in p2
1824 // assert( Gia_ManPoNum(p2) == 1 );
1825  // input count of p2 is equal to flop count of p1
1826  assert( Gia_ManPiNum(p2) == Gia_ManRegNum(p1) );
1827 
1828  // start new AIG
1829  pNew = Gia_ManStart( Gia_ManObjNum(p1)+Gia_ManObjNum(p2) );
1830  pNew->pName = Abc_UtilStrsav( p1->pName );
1831  pNew->pSpec = Abc_UtilStrsav( p1->pSpec );
1832  Gia_ManHashAlloc( pNew );
1833  // dup first AIG
1834  Gia_ManConst0(p1)->Value = 0;
1835  Gia_ManForEachCi( p1, pObj, i )
1836  pObj->Value = Gia_ManAppendCi(pNew);
1837  Gia_ManForEachAnd( p1, pObj, i )
1838  pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1839  // dup second AIG
1840  Gia_ManConst0(p2)->Value = 0;
1841  Gia_ManForEachPi( p2, pObj, i )
1842  pObj->Value = Gia_ManRo(p1, i)->Value;
1843  Gia_ManForEachAnd( p2, pObj, i )
1844  pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1845  // add property output
1846  Gia_ManForEachPo( p2, pObj, i )
1847  Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1848  // add flop inputs
1849  Gia_ManForEachRi( p1, pObj, i )
1850  Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1851  Gia_ManHashStop( pNew );
1852  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p1) );
1853  pNew = Gia_ManCleanup( pTemp = pNew );
1854  Gia_ManStop( pTemp );
1855  return pNew;
1856 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
char * pName
Definition: gia.h:97
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
#define Gia_ManForEachRi(p, pObj, i)
Definition: gia.h:1040
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
static Gia_Obj_t * Gia_ManRo(Gia_Man_t *p, int v)
Definition: gia.h:407
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManDupZero ( Gia_Man_t p)

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

Synopsis [Duplicates AIG without any changes.]

Description []

SideEffects []

SeeAlso []

Definition at line 608 of file giaDup.c.

609 {
610  Gia_Man_t * pNew; int i;
611  pNew = Gia_ManStart( 1 + Gia_ManCiNum(p) + Gia_ManCoNum(p) );
612  pNew->pName = Abc_UtilStrsav( p->pName );
613  for ( i = 0; i < Gia_ManCiNum(p); i++ )
614  Gia_ManAppendCi( pNew );
615  for ( i = 0; i < Gia_ManCoNum(p); i++ )
616  Gia_ManAppendCo( pNew, 0 );
617  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
618  return pNew;
619 }
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
char * pName
Definition: gia.h:97
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
Definition: gia.h:95
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManDupZeroUndc ( Gia_Man_t p,
char *  pInit,
int  fVerbose 
)

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

Synopsis [Performs 'zero' and 'undc' operation.]

Description [The init string specifies 0/1/X for each flop.]

SideEffects []

SeeAlso []

Definition at line 2390 of file giaDup.c.

2391 {
2392  Gia_Man_t * pNew;
2393  Gia_Obj_t * pObj;
2394  int CountPis = Gia_ManPiNum(p), * pPiLits;
2395  int i, iResetFlop = -1, Count1 = 0;
2396  // map X-valued flops into new PIs
2397  assert( (int)strlen(pInit) == Gia_ManRegNum(p) );
2398  pPiLits = ABC_FALLOC( int, Gia_ManRegNum(p) );
2399  for ( i = 0; i < Gia_ManRegNum(p); i++ )
2400  if ( pInit[i] == 'x' || pInit[i] == 'X' )
2401  pPiLits[i] = CountPis++;
2402  // create new manager
2403  pNew = Gia_ManStart( Gia_ManObjNum(p) );
2404  pNew->pName = Abc_UtilStrsav( p->pName );
2405  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
2406  Gia_ManConst0(p)->Value = 0;
2407  // create primary inputs
2408  Gia_ManForEachPi( p, pObj, i )
2409  pObj->Value = Gia_ManAppendCi( pNew );
2410  // create additional primary inputs
2411  for ( i = Gia_ManPiNum(p); i < CountPis; i++ )
2412  Gia_ManAppendCi( pNew );
2413  // create flop outputs
2414  Gia_ManForEachRo( p, pObj, i )
2415  pObj->Value = Gia_ManAppendCi( pNew );
2416  // create reset flop output
2417  if ( CountPis > Gia_ManPiNum(p) )
2418  iResetFlop = Gia_ManAppendCi( pNew );
2419  // update flop outputs
2420  Gia_ManForEachRo( p, pObj, i )
2421  {
2422  if ( pInit[i] == '1' )
2423  pObj->Value = Abc_LitNot(pObj->Value), Count1++;
2424  else if ( pInit[i] == 'x' || pInit[i] == 'X' )
2425  pObj->Value = Gia_ManAppendMux( pNew, iResetFlop, pObj->Value, Gia_Obj2Lit(pNew, Gia_ManPi(pNew, pPiLits[i])) );
2426  else if ( pInit[i] != '0' )
2427  assert( 0 );
2428  }
2429  ABC_FREE( pPiLits );
2430  // build internal nodes
2431  Gia_ManForEachAnd( p, pObj, i )
2432  pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
2433  // create POs
2434  Gia_ManForEachPo( p, pObj, i )
2435  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
2436  // create flop inputs
2437  Gia_ManForEachRi( p, pObj, i )
2438  if ( pInit[i] == '1' )
2439  pObj->Value = Gia_ManAppendCo( pNew, Abc_LitNot(Gia_ObjFanin0Copy(pObj)) );
2440  else
2441  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
2442  // create reset flop input
2443  if ( CountPis > Gia_ManPiNum(p) )
2444  Gia_ManAppendCo( pNew, 1 );
2445  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) + (int)(CountPis > Gia_ManPiNum(p)) );
2446  if ( fVerbose )
2447  printf( "Converted %d 1-valued FFs and %d DC-valued FFs.\n", Count1, CountPis-Gia_ManPiNum(p) );
2448  return pNew;
2449 }
static int Gia_ManAppendAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: gia.h:592
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
for(p=first;p->value< newval;p=p->next)
Definition: gia.h:75
static int Gia_ManAppendMux(Gia_Man_t *p, int iCtrl, int iData1, int iData0)
Definition: gia.h:722
static Gia_Obj_t * Gia_ManPi(Gia_Man_t *p, int v)
Definition: gia.h:405
char * pName
Definition: gia.h:97
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
if(last==0)
Definition: sparse_int.h:34
char * pSpec
Definition: gia.h:98
else
Definition: sparse_int.h:55
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static int Abc_LitNot(int Lit)
Definition: abc_global.h:266
#define ABC_FREE(obj)
Definition: abc_global.h:232
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define Gia_ManForEachRo(p, pObj, i)
Definition: gia.h:1038
#define assert(ex)
Definition: util_old.h:213
int strlen()
unsigned Value
Definition: gia.h:87
#define Gia_ManForEachRi(p, pObj, i)
Definition: gia.h:1040
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
static int Gia_Obj2Lit(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:433
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
#define ABC_FALLOC(type, num)
Definition: abc_global.h:231
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
int Gia_ManEquivCountClasses ( Gia_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 179 of file giaEquiv.c.

180 {
181  int i, Counter = 0;
182  if ( p->pReprs == NULL )
183  return 0;
184  for ( i = 1; i < Gia_ManObjNum(p); i++ )
185  Counter += Gia_ObjIsHead(p, i);
186  return Counter;
187 }
static int Gia_ObjIsHead(Gia_Man_t *p, int Id)
Definition: gia.h:916
static int Counter
Gia_Rpr_t * pReprs
Definition: gia.h:121
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
int Gia_ManEquivCountLits ( Gia_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 253 of file giaEquiv.c.

254 {
255  int i, Counter = 0, Counter0 = 0, CounterX = 0;
256  if ( p->pReprs == NULL || p->pNexts == NULL )
257  return 0;
258  for ( i = 1; i < Gia_ManObjNum(p); i++ )
259  {
260  if ( Gia_ObjIsHead(p, i) )
261  Counter++;
262  else if ( Gia_ObjIsConst(p, i) )
263  Counter0++;
264  else if ( Gia_ObjIsNone(p, i) )
265  CounterX++;
266  }
267  CounterX -= Gia_ManCoNum(p);
268  return Gia_ManCiNum(p) + Gia_ManAndNum(p) - Counter - CounterX;
269 }
int * pNexts
Definition: gia.h:122
static int Gia_ObjIsHead(Gia_Man_t *p, int Id)
Definition: gia.h:916
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
static int Gia_ObjIsConst(Gia_Man_t *p, int Id)
Definition: gia.h:915
static int Counter
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
static int Gia_ObjIsNone(Gia_Man_t *p, int Id)
Definition: gia.h:917
Gia_Rpr_t * pReprs
Definition: gia.h:121
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
int Gia_ManEquivCountLitsAll ( Gia_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 160 of file giaEquiv.c.

161 {
162  int i, nLits = 0;
163  for ( i = 0; i < Gia_ManObjNum(p); i++ )
164  nLits += (Gia_ObjRepr(p, i) != GIA_VOID);
165  return nLits;
166 }
#define GIA_VOID
Definition: gia.h:45
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ObjRepr(Gia_Man_t *p, int Id)
Definition: gia.h:887
void Gia_ManEquivFixOutputPairs ( Gia_Man_t p)

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

Synopsis [Reduces AIG using equivalence classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 480 of file giaEquiv.c.

481 {
482  Gia_Obj_t * pObj0, * pObj1;
483  int i;
484  assert( (Gia_ManPoNum(p) & 1) == 0 );
485  Gia_ManForEachPo( p, pObj0, i )
486  {
487  pObj1 = Gia_ManPo( p, ++i );
488  if ( Gia_ObjChild0(pObj0) != Gia_ObjChild0(pObj1) )
489  continue;
490  pObj0->iDiff0 = Gia_ObjId(p, pObj0);
491  pObj0->fCompl0 = 0;
492  pObj1->iDiff0 = Gia_ObjId(p, pObj1);
493  pObj1->fCompl0 = 0;
494  }
495 }
unsigned iDiff0
Definition: gia.h:77
static Gia_Obj_t * Gia_ObjChild0(Gia_Obj_t *pObj)
Definition: gia.h:457
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
Definition: gia.h:75
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
#define assert(ex)
Definition: util_old.h:213
unsigned fCompl0
Definition: gia.h:78
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
void Gia_ManEquivImprove ( Gia_Man_t p)

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

Synopsis [Transforms equiv classes by setting a good representative.]

Description []

SideEffects []

SeeAlso []

Definition at line 1375 of file giaEquiv.c.

1376 {
1377  Vec_Int_t * vClass;
1378  int i, k, iNode, iRepr;
1379  int iReprBest, iLevelBest, iLevelCur, iMffcBest, iMffcCur;
1380  assert( p->pReprs != NULL && p->pNexts != NULL );
1381  Gia_ManLevelNum( p );
1382  Gia_ManCreateRefs( p );
1383  // iterate over class candidates
1384  vClass = Vec_IntAlloc( 100 );
1385  Gia_ManForEachClass( p, i )
1386  {
1387  Vec_IntClear( vClass );
1388  iReprBest = -1;
1389  iLevelBest = iMffcBest = ABC_INFINITY;
1390  Gia_ClassForEachObj( p, i, k )
1391  {
1392  iLevelCur = Gia_ObjLevel( p,Gia_ManObj(p, k) );
1393  iMffcCur = Gia_NodeMffcSize( p, Gia_ManObj(p, k) );
1394  if ( iLevelBest > iLevelCur || (iLevelBest == iLevelCur && iMffcBest > iMffcCur) )
1395  {
1396  iReprBest = k;
1397  iLevelBest = iLevelCur;
1398  iMffcBest = iMffcCur;
1399  }
1400  Vec_IntPush( vClass, k );
1401  }
1402  assert( Vec_IntSize( vClass ) > 1 );
1403  assert( iReprBest > 0 );
1404  if ( i == iReprBest )
1405  continue;
1406 /*
1407  Abc_Print( 1, "Repr/Best = %6d/%6d. Lev = %3d/%3d. Mffc = %3d/%3d.\n",
1408  i, iReprBest, Gia_ObjLevel( p,Gia_ManObj(p, i) ), Gia_ObjLevel( p,Gia_ManObj(p, iReprBest) ),
1409  Gia_NodeMffcSize( p, Gia_ManObj(p, i) ), Gia_NodeMffcSize( p, Gia_ManObj(p, iReprBest) ) );
1410 */
1411  iRepr = iReprBest;
1412  Gia_ObjSetRepr( p, iRepr, GIA_VOID );
1413  Gia_ObjSetProved( p, i );
1414  Gia_ObjUnsetProved( p, iRepr );
1415  Vec_IntForEachEntry( vClass, iNode, k )
1416  if ( iNode != iRepr )
1417  Gia_ObjSetRepr( p, iNode, iRepr );
1418  }
1419  Vec_IntFree( vClass );
1420  ABC_FREE( p->pNexts );
1421 // p->pNexts = Gia_ManDeriveNexts( p );
1422 }
void Gia_ManCreateRefs(Gia_Man_t *p)
Definition: giaUtil.c:715
int * pNexts
Definition: gia.h:122
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
static void Gia_ObjSetRepr(Gia_Man_t *p, int Id, int Num)
Definition: gia.h:888
static int Gia_ObjLevel(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:501
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Gia_ObjSetProved(Gia_Man_t *p, int Id)
Definition: gia.h:897
if(last==0)
Definition: sparse_int.h:34
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
#define Gia_ClassForEachObj(p, i, iObj)
Definition: gia.h:931
#define GIA_VOID
Definition: gia.h:45
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define Gia_ManForEachClass(p, i)
Definition: gia.h:927
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
int Gia_NodeMffcSize(Gia_Man_t *p, Gia_Obj_t *pNode)
Definition: giaUtil.c:1132
Gia_Rpr_t * pReprs
Definition: gia.h:121
#define assert(ex)
Definition: util_old.h:213
int Gia_ManLevelNum(Gia_Man_t *p)
Definition: giaUtil.c:505
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static void Gia_ObjUnsetProved(Gia_Man_t *p, int Id)
Definition: gia.h:898
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
void Gia_ManEquivPrintClasses ( Gia_Man_t p,
int  fVerbose,
float  Mem 
)

Definition at line 304 of file giaEquiv.c.

305 {
306  int i, Counter = 0, Counter0 = 0, CounterX = 0, Proved = 0, nLits;
307  for ( i = 1; i < Gia_ManObjNum(p); i++ )
308  {
309  if ( Gia_ObjIsHead(p, i) )
310  Counter++;
311  else if ( Gia_ObjIsConst(p, i) )
312  Counter0++;
313  else if ( Gia_ObjIsNone(p, i) )
314  CounterX++;
315  if ( Gia_ObjProved(p, i) )
316  Proved++;
317  }
318  CounterX -= Gia_ManCoNum(p);
319  nLits = Gia_ManCiNum(p) + Gia_ManAndNum(p) - Counter - CounterX;
320  Abc_Print( 1, "cst =%8d cls =%7d lit =%8d unused =%8d proof =%6d mem =%5.2f MB\n",
321  Counter0, Counter, nLits, CounterX, Proved, (Mem == 0.0) ? 8.0*Gia_ManObjNum(p)/(1<<20) : Mem );
322  assert( Gia_ManEquivCheckLits( p, nLits ) );
323  if ( fVerbose )
324  {
325 // int Ent;
326  Abc_Print( 1, "Const0 = " );
327  Gia_ManForEachConst( p, i )
328  Abc_Print( 1, "%d ", i );
329  Abc_Print( 1, "\n" );
330  Counter = 0;
331  Gia_ManForEachClass( p, i )
332  Gia_ManEquivPrintOne( p, i, ++Counter );
333 /*
334  Gia_ManLevelNum( p );
335  Gia_ManForEachClass( p, i )
336  if ( i % 100 == 0 )
337  {
338 // Abc_Print( 1, "%d ", Gia_ManEquivCountOne(p, i) );
339  Gia_ClassForEachObj( p, i, Ent )
340  {
341  Abc_Print( 1, "%d ", Gia_ObjLevel( p, Gia_ManObj(p, Ent) ) );
342  }
343  Abc_Print( 1, "\n" );
344  }
345 */
346  }
347 }
void Gia_ManEquivPrintOne(Gia_Man_t *p, int i, int Counter)
Definition: giaEquiv.c:292
static int Gia_ObjIsHead(Gia_Man_t *p, int Id)
Definition: gia.h:916
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
#define Gia_ManForEachConst(p, i)
Definition: gia.h:925
static int Gia_ObjIsConst(Gia_Man_t *p, int Id)
Definition: gia.h:915
static int Counter
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
int Gia_ManEquivCheckLits(Gia_Man_t *p, int nLits)
Definition: giaEquiv.c:200
static int Gia_ObjIsNone(Gia_Man_t *p, int Id)
Definition: gia.h:917
#define Gia_ManForEachClass(p, i)
Definition: gia.h:927
static int Gia_ObjProved(Gia_Man_t *p, int Id)
Definition: gia.h:896
#define assert(ex)
Definition: util_old.h:213
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
void Gia_ManEquivPrintOne ( Gia_Man_t p,
int  i,
int  Counter 
)

Definition at line 292 of file giaEquiv.c.

293 {
294  int Ent;
295  Abc_Print( 1, "Class %4d : Num = %2d {", Counter, Gia_ManEquivCountOne(p, i) );
296  Gia_ClassForEachObj( p, i, Ent )
297  {
298  Abc_Print( 1," %d", Ent );
299  if ( p->pReprs[Ent].fColorA || p->pReprs[Ent].fColorB )
300  Abc_Print( 1," <%d%d>", p->pReprs[Ent].fColorA, p->pReprs[Ent].fColorB );
301  }
302  Abc_Print( 1, " }\n" );
303 }
unsigned fColorA
Definition: gia.h:61
unsigned fColorB
Definition: gia.h:62
static int Counter
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
int Gia_ManEquivCountOne(Gia_Man_t *p, int i)
Definition: giaEquiv.c:282
#define Gia_ClassForEachObj(p, i, iObj)
Definition: gia.h:931
Gia_Rpr_t * pReprs
Definition: gia.h:121
Gia_Man_t* Gia_ManEquivReduce ( Gia_Man_t p,
int  fUseAll,
int  fDualOut,
int  fSkipPhase,
int  fVerbose 
)

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

Synopsis [Reduces AIG using equivalence classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 417 of file giaEquiv.c.

418 {
419  Gia_Man_t * pNew;
420  Gia_Obj_t * pObj;
421  int i;
422  if ( !p->pReprs )
423  {
424  Abc_Print( 1, "Gia_ManEquivReduce(): Equivalence classes are not available.\n" );
425  return NULL;
426  }
427  if ( fDualOut && (Gia_ManPoNum(p) & 1) )
428  {
429  Abc_Print( 1, "Gia_ManEquivReduce(): Dual-output miter should have even number of POs.\n" );
430  return NULL;
431  }
432  // check if there are any equivalences defined
433  Gia_ManForEachObj( p, pObj, i )
434  if ( Gia_ObjReprObj(p, i) != NULL )
435  break;
436  if ( i == Gia_ManObjNum(p) )
437  {
438 // Abc_Print( 1, "Gia_ManEquivReduce(): There are no equivalences to reduce.\n" );
439  return NULL;
440  }
441 /*
442  if ( !Gia_ManCheckTopoOrder( p ) )
443  {
444  Abc_Print( 1, "Gia_ManEquivReduce(): AIG is not in a correct topological order.\n" );
445  return NULL;
446  }
447 */
448  if ( !fSkipPhase )
449  Gia_ManSetPhase( p );
450  if ( fDualOut )
451  Gia_ManEquivSetColors( p, fVerbose );
452  pNew = Gia_ManStart( Gia_ManObjNum(p) );
453  pNew->pName = Abc_UtilStrsav( p->pName );
454  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
455  Gia_ManFillValue( p );
456  Gia_ManConst0(p)->Value = 0;
457  Gia_ManForEachCi( p, pObj, i )
458  pObj->Value = Gia_ManAppendCi(pNew);
459  Gia_ManHashAlloc( pNew );
460  Gia_ManForEachCo( p, pObj, i )
461  Gia_ManEquivReduce_rec( pNew, p, Gia_ObjFanin0(pObj), fUseAll, fDualOut );
462  Gia_ManForEachCo( p, pObj, i )
463  Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
464  Gia_ManHashStop( pNew );
465  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
466  return pNew;
467 }
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
void Gia_ManEquivReduce_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj, int fUseAll, int fDualOut)
Definition: giaEquiv.c:389
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
char * pName
Definition: gia.h:97
if(last==0)
Definition: sparse_int.h:34
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static Gia_Obj_t * Gia_ObjReprObj(Gia_Man_t *p, int Id)
Definition: gia.h:886
Definition: gia.h:95
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
Gia_Rpr_t * pReprs
Definition: gia.h:121
void Gia_ManSetPhase(Gia_Man_t *p)
Definition: giaUtil.c:379
unsigned Value
Definition: gia.h:87
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
int Gia_ManEquivSetColors(Gia_Man_t *p, int fVerbose)
Definition: giaEquiv.c:692
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManEquivReduceAndRemap ( Gia_Man_t p,
int  fSeq,
int  fMiterPairs 
)

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

Synopsis [Reduces AIG while remapping equivalence classes.]

Description [Drops the pairs of outputs if they are proved equivalent.]

SideEffects []

SeeAlso []

Definition at line 638 of file giaEquiv.c.

639 {
640  Gia_Man_t * pNew, * pFinal;
641  pNew = Gia_ManEquivReduce( p, 0, 0, 0, 0 );
642  if ( pNew == NULL )
643  return NULL;
644  if ( fMiterPairs )
646  if ( fSeq )
647  Gia_ManSeqMarkUsed( pNew );
648  else
649  Gia_ManCombMarkUsed( pNew );
650  Gia_ManEquivUpdatePointers( p, pNew );
651  pFinal = Gia_ManDupMarked( pNew );
652  Gia_ManEquivDeriveReprs( p, pNew, pFinal );
653  Gia_ManStop( pNew );
654  pFinal = Gia_ManEquivRemapDfs( pNew = pFinal );
655  Gia_ManStop( pNew );
656  return pFinal;
657 }
Gia_Man_t * Gia_ManDupMarked(Gia_Man_t *p)
Definition: giaDup.c:975
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
int Gia_ManSeqMarkUsed(Gia_Man_t *p)
Definition: giaScl.c:156
void Gia_ManEquivDeriveReprs(Gia_Man_t *p, Gia_Man_t *pNew, Gia_Man_t *pFinal)
Definition: giaEquiv.c:533
Gia_Man_t * Gia_ManEquivRemapDfs(Gia_Man_t *p)
Definition: giaEquiv.c:592
int Gia_ManCombMarkUsed(Gia_Man_t *p)
Definition: giaScl.c:60
void Gia_ManEquivFixOutputPairs(Gia_Man_t *p)
Definition: giaEquiv.c:480
Definition: gia.h:95
void Gia_ManEquivUpdatePointers(Gia_Man_t *p, Gia_Man_t *pNew)
Definition: giaEquiv.c:508
Gia_Man_t * Gia_ManEquivReduce(Gia_Man_t *p, int fUseAll, int fDualOut, int fSkipPhase, int fVerbose)
Definition: giaEquiv.c:417
int Gia_ManEquivSetColors ( Gia_Man_t p,
int  fVerbose 
)

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

Synopsis [Marks CIs/COs/ANDs unreachable from POs.]

Description []

SideEffects []

SeeAlso []

Definition at line 692 of file giaEquiv.c.

693 {
694  Gia_Obj_t * pObj;
695  int i, nNodes[2], nDiffs[2];
696  assert( (Gia_ManPoNum(p) & 1) == 0 );
697  Gia_ObjSetColors( p, 0 );
698  Gia_ManForEachPi( p, pObj, i )
699  Gia_ObjSetColors( p, Gia_ObjId(p,pObj) );
700  nNodes[0] = nNodes[1] = Gia_ManPiNum(p);
701  Gia_ManForEachPo( p, pObj, i )
702  nNodes[i&1] += Gia_ManEquivSetColor_rec( p, Gia_ObjFanin0(pObj), i&1 );
703 // Gia_ManForEachObj( p, pObj, i )
704 // if ( Gia_ObjIsCi(pObj) || Gia_ObjIsAnd(pObj) )
705 // assert( Gia_ObjColors(p, i) );
706  nDiffs[0] = Gia_ManCandNum(p) - nNodes[0];
707  nDiffs[1] = Gia_ManCandNum(p) - nNodes[1];
708  if ( fVerbose )
709  {
710  Abc_Print( 1, "CI+AND = %7d A = %7d B = %7d Ad = %7d Bd = %7d AB = %7d.\n",
711  Gia_ManCandNum(p), nNodes[0], nNodes[1], nDiffs[0], nDiffs[1],
712  Gia_ManCandNum(p) - nDiffs[0] - nDiffs[1] );
713  }
714  return (nDiffs[0] + nDiffs[1]) / 2;
715 }
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
int Gia_ManEquivSetColor_rec(Gia_Man_t *p, Gia_Obj_t *pObj, int fOdds)
Definition: giaEquiv.c:670
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
if(last==0)
Definition: sparse_int.h:34
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Gia_ManCandNum(Gia_Man_t *p)
Definition: gia.h:394
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static void Gia_ObjSetColors(Gia_Man_t *p, int Id)
Definition: gia.h:906
#define assert(ex)
Definition: util_old.h:213
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
Gia_Man_t* Gia_ManEquivToChoices ( Gia_Man_t p,
int  nSnapshots 
)

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

Synopsis [Reduces AIG using equivalence classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1629 of file giaEquiv.c.

1630 {
1631  Vec_Int_t * vNodes;
1632  Gia_Man_t * pNew, * pTemp;
1633  Gia_Obj_t * pObj, * pRepr;
1634  int i;
1635 //Gia_ManEquivPrintClasses( p, 0, 0 );
1636  assert( (Gia_ManCoNum(p) % nSnapshots) == 0 );
1637  Gia_ManSetPhase( p );
1638  pNew = Gia_ManStart( Gia_ManObjNum(p) );
1639  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1640  pNew->pName = Abc_UtilStrsav( p->pName );
1641  pNew->pReprs = ABC_CALLOC( Gia_Rpr_t, Gia_ManObjNum(p) );
1642  pNew->pNexts = ABC_CALLOC( int, Gia_ManObjNum(p) );
1643  for ( i = 0; i < Gia_ManObjNum(p); i++ )
1644  Gia_ObjSetRepr( pNew, i, GIA_VOID );
1645  Gia_ManFillValue( p );
1646  Gia_ManConst0(p)->Value = 0;
1647  Gia_ManForEachCi( p, pObj, i )
1648  pObj->Value = Gia_ManAppendCi(pNew);
1649  Gia_ManForEachRo( p, pObj, i )
1650  if ( (pRepr = Gia_ObjReprObj(p, Gia_ObjId(p, pObj))) )
1651  {
1652  assert( Gia_ObjIsConst0(pRepr) || Gia_ObjIsRo(p, pRepr) );
1653  pObj->Value = pRepr->Value;
1654  }
1655  Gia_ManHashAlloc( pNew );
1656  Gia_ManForEachCo( p, pObj, i )
1657  Gia_ManEquivToChoices_rec( pNew, p, Gia_ObjFanin0(pObj) );
1658  vNodes = Gia_ManGetDangling( p );
1659  Gia_ManForEachObjVec( vNodes, p, pObj, i )
1660  Gia_ManEquivToChoices_rec( pNew, p, pObj );
1661  Vec_IntFree( vNodes );
1662  Gia_ManForEachCo( p, pObj, i )
1663  if ( i % nSnapshots == 0 )
1664  Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1665  Gia_ManHashStop( pNew );
1666  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
1667  Gia_ManRemoveBadChoices( pNew );
1668 //Gia_ManEquivPrintClasses( pNew, 0, 0 );
1669  pNew = Gia_ManCleanup( pTemp = pNew );
1670  Gia_ManStop( pTemp );
1671 //Gia_ManEquivPrintClasses( pNew, 0, 0 );
1672  return pNew;
1673 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
int * pNexts
Definition: gia.h:122
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Vec_Int_t * Gia_ManGetDangling(Gia_Man_t *p)
Definition: giaUtil.c:1224
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
static int Gia_ObjIsConst0(Gia_Obj_t *pObj)
Definition: gia.h:430
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
static void Gia_ObjSetRepr(Gia_Man_t *p, int Id, int Num)
Definition: gia.h:888
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
char * pName
Definition: gia.h:97
static int Gia_ObjIsRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:443
if(last==0)
Definition: sparse_int.h:34
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
void Gia_ManRemoveBadChoices(Gia_Man_t *p)
Definition: giaEquiv.c:1581
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition: gia.h:988
static Gia_Obj_t * Gia_ObjReprObj(Gia_Man_t *p, int Id)
Definition: gia.h:886
void Gia_ManEquivToChoices_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaEquiv.c:1520
#define GIA_VOID
Definition: gia.h:45
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define Gia_ManForEachRo(p, pObj, i)
Definition: gia.h:1038
Gia_Rpr_t * pReprs
Definition: gia.h:121
#define assert(ex)
Definition: util_old.h:213
void Gia_ManSetPhase(Gia_Man_t *p)
Definition: giaUtil.c:379
unsigned Value
Definition: gia.h:87
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
Definition: gia.h:56
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
void Gia_ManEquivTransform ( Gia_Man_t p,
int  fVerbose 
)

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

Synopsis [Transforms equiv classes by removing the AB nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1114 of file giaEquiv.c.

1115 {
1116  extern void Cec_ManSimClassCreate( Gia_Man_t * p, Vec_Int_t * vClass );
1117  Vec_Int_t * vClass, * vClassNew;
1118  int iRepr, iNode, Ent, k;
1119  int nRemovedLits = 0, nRemovedClas = 0;
1120  int nTotalLits = 0, nTotalClas = 0;
1121  Gia_Obj_t * pObj;
1122  int i;
1123  assert( p->pReprs && p->pNexts );
1124  vClass = Vec_IntAlloc( 100 );
1125  vClassNew = Vec_IntAlloc( 100 );
1126  Gia_ManForEachObj( p, pObj, i )
1127  if ( Gia_ObjIsCi(pObj) || Gia_ObjIsAnd(pObj) )
1128  assert( Gia_ObjColors(p, i) );
1129  Gia_ManForEachClassReverse( p, iRepr )
1130  {
1131  nTotalClas++;
1132  Vec_IntClear( vClass );
1133  Vec_IntClear( vClassNew );
1134  Gia_ClassForEachObj( p, iRepr, iNode )
1135  {
1136  nTotalLits++;
1137  Vec_IntPush( vClass, iNode );
1138  assert( Gia_ObjColors(p, iNode) );
1139  if ( Gia_ObjColors(p, iNode) != 3 )
1140  Vec_IntPush( vClassNew, iNode );
1141  else
1142  nRemovedLits++;
1143  }
1144  Vec_IntForEachEntry( vClass, Ent, k )
1145  {
1146  p->pReprs[Ent].fFailed = p->pReprs[Ent].fProved = 0;
1147  p->pReprs[Ent].iRepr = GIA_VOID;
1148  p->pNexts[Ent] = 0;
1149  }
1150  if ( Vec_IntSize(vClassNew) < 2 )
1151  {
1152  nRemovedClas++;
1153  continue;
1154  }
1155  Cec_ManSimClassCreate( p, vClassNew );
1156  }
1157  Vec_IntFree( vClass );
1158  Vec_IntFree( vClassNew );
1159  if ( fVerbose )
1160  Abc_Print( 1, "Removed classes = %6d (out of %6d). Removed literals = %6d (out of %6d).\n",
1161  nRemovedClas, nTotalClas, nRemovedLits, nTotalLits );
1162 }
#define Gia_ManForEachClassReverse(p, i)
Definition: gia.h:929
int * pNexts
Definition: gia.h:122
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Definition: gia.h:75
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
if(last==0)
Definition: sparse_int.h:34
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
void Cec_ManSimClassCreate(Gia_Man_t *p, Vec_Int_t *vClass)
Definition: cecClass.c:234
#define Gia_ClassForEachObj(p, i, iObj)
Definition: gia.h:931
static int Gia_ObjColors(Gia_Man_t *p, int Id)
Definition: gia.h:904
#define GIA_VOID
Definition: gia.h:45
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Definition: gia.h:95
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
Gia_Rpr_t * pReprs
Definition: gia.h:121
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
float Gia_ManEvaluateSwitching ( Gia_Man_t p)

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

Synopsis [Computes probability of switching (or of being 1).]

Description []

SideEffects []

SeeAlso []

Definition at line 719 of file giaSwitch.c.

720 {
721  Gia_Obj_t * pObj;
722  float SwitchTotal = 0.0;
723  int i;
724  assert( p->pSwitching );
725  ABC_FREE( p->pRefs );
726  Gia_ManCreateRefs( p );
727  Gia_ManForEachObj( p, pObj, i )
728  SwitchTotal += (float)Gia_ObjRefNum(p, pObj) * p->pSwitching[i] / 255;
729  return SwitchTotal;
730 }
void Gia_ManCreateRefs(Gia_Man_t *p)
Definition: giaUtil.c:715
static int Gia_ObjRefNum(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:521
int * pRefs
Definition: gia.h:114
Definition: gia.h:75
unsigned char * pSwitching
Definition: gia.h:147
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
#define assert(ex)
Definition: util_old.h:213
Gia_Man_t* Gia_ManExtractWindow ( Gia_Man_t p,
int  LevelMax,
int  nTimeWindow,
int  fVerbose 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 236 of file giaBalMap.c.

237 {
238  Vec_Int_t * vOuts;
239  Gia_Man_t * pWin;
240  assert( !LevelMax != !nTimeWindow );
241  vOuts = Gia_ManFindLatest( p, LevelMax, nTimeWindow );
242  if ( fVerbose )
243  printf( "Collected %d outputs to extract.\n", Vec_IntSize(vOuts) );
244  if ( Vec_IntSize(vOuts) == 0 )
245  {
246  Vec_IntFree( vOuts );
247  return Gia_ManDup( p );
248  }
249  pWin = Gia_ManExtractWin( p, vOuts, 1 );
250  Vec_IntFree( vOuts );
251  return pWin;
252 }
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition: giaDup.c:552
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Gia_Man_t * Gia_ManExtractWin(Gia_Man_t *p, Vec_Int_t *vOuts, int fPoOnly)
Definition: giaBalMap.c:114
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Vec_Int_t * Gia_ManFindLatest(Gia_Man_t *p, int LevelMax, int nTimeWindow)
Definition: giaBalMap.c:186
Definition: gia.h:95
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
void Gia_ManFanoutStart ( Gia_Man_t p)

FUNCTION DEFINITIONS ///.

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 66 of file giaFanout.c.

67 {
68  Gia_Obj_t * pObj;
69  int i;
70  // allocate fanout datastructure
71  assert( p->pFanData == NULL );
72  p->nFansAlloc = 2 * Gia_ManObjNum(p);
73  if ( p->nFansAlloc < (1<<12) )
74  p->nFansAlloc = (1<<12);
75  p->pFanData = ABC_ALLOC( int, 5 * p->nFansAlloc );
76  memset( p->pFanData, 0, sizeof(int) * 5 * p->nFansAlloc );
77  // add fanouts for all objects
78  Gia_ManForEachObj( p, pObj, i )
79  {
80  if ( Gia_ObjChild0(pObj) )
81  Gia_ObjAddFanout( p, Gia_ObjFanin0(pObj), pObj );
82  if ( Gia_ObjChild1(pObj) )
83  Gia_ObjAddFanout( p, Gia_ObjFanin1(pObj), pObj );
84  }
85 }
char * memset()
static Gia_Obj_t * Gia_ObjChild0(Gia_Obj_t *pObj)
Definition: gia.h:457
int nFansAlloc
Definition: gia.h:128
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjChild1(Gia_Obj_t *pObj)
Definition: gia.h:458
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
int * pFanData
Definition: gia.h:127
void Gia_ObjAddFanout(Gia_Man_t *p, Gia_Obj_t *pObj, Gia_Obj_t *pFanout)
Definition: giaFanout.c:116
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManFanoutStop ( Gia_Man_t p)

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 98 of file giaFanout.c.

99 {
100  assert( p->pFanData != NULL );
101  ABC_FREE( p->pFanData );
102  p->nFansAlloc = 0;
103 }
int nFansAlloc
Definition: gia.h:128
int * pFanData
Definition: gia.h:127
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define assert(ex)
Definition: util_old.h:213
void Gia_ManFillValue ( Gia_Man_t p)

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

Synopsis [Cleans the value.]

Description []

SideEffects []

SeeAlso []

Definition at line 328 of file giaUtil.c.

329 {
330  int i;
331  for ( i = 0; i < p->nObjs; i++ )
332  p->pObjs[i].Value = ~0;
333 }
Gia_Obj_t * pObjs
Definition: gia.h:103
int nObjs
Definition: gia.h:101
unsigned Value
Definition: gia.h:87
int Gia_ManFilterEquivsForSpeculation ( Gia_Man_t pGia,
char *  pName1,
char *  pName2,
int  fLatchA,
int  fLatchB 
)

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

Synopsis [Reduces AIG using equivalence classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1862 of file giaEquiv.c.

1863 {
1864  Gia_Man_t * pGia1, * pGia2, * pMiter;
1865  Gia_Obj_t * pObj1, * pObj2, * pObjM, * pObj;
1866  int i, iObj, iNext, Counter = 0;
1867  if ( pGia->pReprs == NULL || pGia->pNexts == NULL )
1868  {
1869  Abc_Print( 1, "Equivalences are not defined.\n" );
1870  return 0;
1871  }
1872  pGia1 = Gia_AigerRead( pName1, 0, 0 );
1873  if ( pGia1 == NULL )
1874  {
1875  Abc_Print( 1, "Cannot read first file %s.\n", pName1 );
1876  return 0;
1877  }
1878  pGia2 = Gia_AigerRead( pName2, 0, 0 );
1879  if ( pGia2 == NULL )
1880  {
1881  Gia_ManStop( pGia2 );
1882  Abc_Print( 1, "Cannot read second file %s.\n", pName2 );
1883  return 0;
1884  }
1885  pMiter = Gia_ManMiter( pGia1, pGia2, 0, 0, 1, 0, 0 );
1886  if ( pMiter == NULL )
1887  {
1888  Gia_ManStop( pGia1 );
1889  Gia_ManStop( pGia2 );
1890  Abc_Print( 1, "Cannot create sequential miter.\n" );
1891  return 0;
1892  }
1893  // make sure the miter is isomorphic
1894  if ( Gia_ManObjNum(pGia) != Gia_ManObjNum(pMiter) )
1895  {
1896  Gia_ManStop( pGia1 );
1897  Gia_ManStop( pGia2 );
1898  Gia_ManStop( pMiter );
1899  Abc_Print( 1, "The number of objects in different.\n" );
1900  return 0;
1901  }
1902  if ( memcmp( pGia->pObjs, pMiter->pObjs, sizeof(Gia_Obj_t) * Gia_ManObjNum(pGia) ) )
1903  {
1904  Gia_ManStop( pGia1 );
1905  Gia_ManStop( pGia2 );
1906  Gia_ManStop( pMiter );
1907  Abc_Print( 1, "The AIG structure of the miter does not match.\n" );
1908  return 0;
1909  }
1910  // transfer copies
1911  Gia_ManCleanMark0( pGia );
1912  Gia_ManForEachObj( pGia1, pObj1, i )
1913  {
1914  if ( pObj1->Value == ~0 )
1915  continue;
1916  pObjM = Gia_ManObj( pMiter, Abc_Lit2Var(pObj1->Value) );
1917  pObj = Gia_ManObj( pGia, Gia_ObjId(pMiter, pObjM) );
1918  pObj->fMark0 = 1;
1919  }
1920  Gia_ManCleanMark1( pGia );
1921  Gia_ManForEachObj( pGia2, pObj2, i )
1922  {
1923  if ( pObj2->Value == ~0 )
1924  continue;
1925  pObjM = Gia_ManObj( pMiter, Abc_Lit2Var(pObj2->Value) );
1926  pObj = Gia_ManObj( pGia, Gia_ObjId(pMiter, pObjM) );
1927  pObj->fMark1 = 1;
1928  }
1929 
1930  // filter equivalences
1931  Gia_ManForEachConst( pGia, i )
1932  {
1933  Gia_ObjUnsetRepr( pGia, i );
1934  assert( pGia->pNexts[i] == 0 );
1935  }
1936  Gia_ManForEachClass( pGia, i )
1937  {
1938  // find the first colorA and colorB
1939  int ClassA = -1, ClassB = -1;
1940  Gia_ClassForEachObj( pGia, i, iObj )
1941  {
1942  pObj = Gia_ManObj( pGia, iObj );
1943  if ( ClassA == -1 && pObj->fMark0 && !pObj->fMark1 )
1944  {
1945  if ( fLatchA && !Gia_ObjIsRo(pGia, pObj) )
1946  continue;
1947  ClassA = iObj;
1948  }
1949  if ( ClassB == -1 && pObj->fMark1 && !pObj->fMark0 )
1950  {
1951  if ( fLatchB && !Gia_ObjIsRo(pGia, pObj) )
1952  continue;
1953  ClassB = iObj;
1954  }
1955  }
1956  // undo equivalence classes
1957  for ( iObj = i, iNext = Gia_ObjNext(pGia, iObj); iObj;
1958  iObj = iNext, iNext = Gia_ObjNext(pGia, iObj) )
1959  {
1960  Gia_ObjUnsetRepr( pGia, iObj );
1961  Gia_ObjSetNext( pGia, iObj, 0 );
1962  }
1963  assert( !Gia_ObjIsHead(pGia, i) );
1964  if ( ClassA > 0 && ClassB > 0 )
1965  {
1966  if ( ClassA > ClassB )
1967  {
1968  ClassA ^= ClassB;
1969  ClassB ^= ClassA;
1970  ClassA ^= ClassB;
1971  }
1972  assert( ClassA < ClassB );
1973  Gia_ObjSetNext( pGia, ClassA, ClassB );
1974  Gia_ObjSetRepr( pGia, ClassB, ClassA );
1975  Counter++;
1976  assert( Gia_ObjIsHead(pGia, ClassA) );
1977  }
1978  }
1979  Abc_Print( 1, "The number of two-node classes after filtering = %d.\n", Counter );
1980 //Gia_ManEquivPrintClasses( pGia, 1, 0 );
1981 
1982  Gia_ManCleanMark0( pGia );
1983  Gia_ManCleanMark1( pGia );
1984  return 1;
1985 }
static void Gia_ObjUnsetRepr(Gia_Man_t *p, int Id)
Definition: gia.h:890
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
int * pNexts
Definition: gia.h:122
Gia_Man_t * Gia_AigerRead(char *pFileName, int fSkipStrash, int fCheck)
Definition: giaAiger.c:821
void Gia_ManCleanMark0(Gia_Man_t *p)
Definition: giaUtil.c:215
Gia_Obj_t * pObjs
Definition: gia.h:103
static int Gia_ObjIsHead(Gia_Man_t *p, int Id)
Definition: gia.h:916
unsigned fMark1
Definition: gia.h:84
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
void Gia_ManCleanMark1(Gia_Man_t *p)
Definition: giaUtil.c:272
static void Gia_ObjSetRepr(Gia_Man_t *p, int Id, int Num)
Definition: gia.h:888
static int Gia_ObjIsRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:443
#define Gia_ManForEachConst(p, i)
Definition: gia.h:925
int memcmp()
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Counter
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
#define Gia_ClassForEachObj(p, i, iObj)
Definition: gia.h:931
static int Gia_ObjNext(Gia_Man_t *p, int Id)
Definition: gia.h:912
static void Gia_ObjSetNext(Gia_Man_t *p, int Id, int Num)
Definition: gia.h:913
unsigned fMark0
Definition: gia.h:79
Definition: gia.h:95
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
#define Gia_ManForEachClass(p, i)
Definition: gia.h:927
Gia_Rpr_t * pReprs
Definition: gia.h:121
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
Gia_Man_t * Gia_ManMiter(Gia_Man_t *pAig0, Gia_Man_t *pAig1, int nInsDup, int fDualOut, int fSeq, int fImplic, int fVerbose)
Definition: giaDup.c:2128
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManFilterEquivsUsingLatches ( Gia_Man_t pGia,
int  fFlopsOnly,
int  fFlopsWith,
int  fUseRiDrivers 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 2147 of file giaEquiv.c.

2148 {
2149  Gia_Obj_t * pObjR;
2150  Vec_Int_t * vNodes, * vFfIds;
2151  int i, k, iObj, iNext, iPrev, iRepr;
2152  int iLitsOld = 0, iLitsNew = 0;
2153  assert( fFlopsOnly ^ fFlopsWith );
2154  vNodes = Vec_IntAlloc( 100 );
2155  // select nodes "flop" node IDs
2156  vFfIds = Vec_IntStart( Gia_ManObjNum(pGia) );
2157  if ( fUseRiDrivers )
2158  {
2159  Gia_ManForEachRi( pGia, pObjR, i )
2160  Vec_IntWriteEntry( vFfIds, Gia_ObjFaninId0p(pGia, pObjR), 1 );
2161  }
2162  else
2163  {
2164  Gia_ManForEachRo( pGia, pObjR, i )
2165  Vec_IntWriteEntry( vFfIds, Gia_ObjId(pGia, pObjR), 1 );
2166  }
2167  // remove all non-flop constants
2168  Gia_ManForEachConst( pGia, i )
2169  {
2170  iLitsOld++;
2171  assert( pGia->pNexts[i] == 0 );
2172  if ( !Vec_IntEntry(vFfIds, i) )
2173  Gia_ObjUnsetRepr( pGia, i );
2174  else
2175  iLitsNew++;
2176  }
2177  // clear the classes
2178  if ( fFlopsOnly )
2179  {
2180  Gia_ManForEachClass( pGia, i )
2181  {
2182  Vec_IntClear( vNodes );
2183  Gia_ClassForEachObj( pGia, i, iObj )
2184  {
2185  if ( Vec_IntEntry(vFfIds, iObj) )
2186  Vec_IntPush( vNodes, iObj );
2187  iLitsOld++;
2188  }
2189  iLitsOld--;
2190  // undo equivalence classes
2191  for ( iObj = i, iNext = Gia_ObjNext(pGia, iObj); iObj;
2192  iObj = iNext, iNext = Gia_ObjNext(pGia, iObj) )
2193  {
2194  Gia_ObjUnsetRepr( pGia, iObj );
2195  Gia_ObjSetNext( pGia, iObj, 0 );
2196  }
2197  assert( !Gia_ObjIsHead(pGia, i) );
2198  if ( Vec_IntSize(vNodes) > 1 )
2199  {
2200  // create new class
2201  iPrev = iRepr = Vec_IntEntry( vNodes, 0 );
2202  Vec_IntForEachEntryStart( vNodes, iObj, k, 1 )
2203  {
2204  Gia_ObjSetRepr( pGia, iObj, iRepr );
2205  Gia_ObjSetNext( pGia, iPrev, iObj );
2206  iPrev = iObj;
2207  iLitsNew++;
2208  }
2209  assert( Gia_ObjNext(pGia, iPrev) == 0 );
2210  }
2211  }
2212  }
2213  else
2214  {
2215  Gia_ManForEachClass( pGia, i )
2216  {
2217  int fSeenFlop = 0;
2218  Gia_ClassForEachObj( pGia, i, iObj )
2219  {
2220  if ( Vec_IntEntry(vFfIds, iObj) )
2221  fSeenFlop = 1;
2222  iLitsOld++;
2223  iLitsNew++;
2224  }
2225  iLitsOld--;
2226  iLitsNew--;
2227  if ( fSeenFlop )
2228  continue;
2229  // undo equivalence classes
2230  for ( iObj = i, iNext = Gia_ObjNext(pGia, iObj); iObj;
2231  iObj = iNext, iNext = Gia_ObjNext(pGia, iObj) )
2232  {
2233  Gia_ObjUnsetRepr( pGia, iObj );
2234  Gia_ObjSetNext( pGia, iObj, 0 );
2235  iLitsNew--;
2236  }
2237  iLitsNew++;
2238  assert( !Gia_ObjIsHead(pGia, i) );
2239  }
2240  }
2241  Vec_IntFree( vNodes );
2242  Vec_IntFree( vFfIds );
2243  Abc_Print( 1, "The number of literals: Before = %d. After = %d.\n", iLitsOld, iLitsNew );
2244 }
static void Gia_ObjUnsetRepr(Gia_Man_t *p, int Id)
Definition: gia.h:890
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Gia_ObjIsHead(Gia_Man_t *p, int Id)
Definition: gia.h:916
Definition: gia.h:75
static void Gia_ObjSetRepr(Gia_Man_t *p, int Id, int Num)
Definition: gia.h:888
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
#define Gia_ManForEachConst(p, i)
Definition: gia.h:925
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
else
Definition: sparse_int.h:55
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
Definition: vecInt.h:56
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
#define Gia_ClassForEachObj(p, i, iObj)
Definition: gia.h:931
static int Gia_ObjNext(Gia_Man_t *p, int Id)
Definition: gia.h:912
static void Gia_ObjSetNext(Gia_Man_t *p, int Id, int Num)
Definition: gia.h:913
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Gia_ObjFaninId0p(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:463
#define Gia_ManForEachClass(p, i)
Definition: gia.h:927
#define Gia_ManForEachRo(p, pObj, i)
Definition: gia.h:1038
#define assert(ex)
Definition: util_old.h:213
#define Gia_ManForEachRi(p, pObj, i)
Definition: gia.h:1040
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
int Gia_ManFilterEquivsUsingParts ( Gia_Man_t pGia,
char *  pName1,
char *  pName2 
)

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

Synopsis [Reduces AIG using equivalence classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1999 of file giaEquiv.c.

2000 {
2001  Vec_Int_t * vNodes;
2002  Gia_Man_t * pGia1, * pGia2, * pMiter;
2003  Gia_Obj_t * pObj1, * pObj2, * pObjM, * pObj = NULL;
2004  int i, k, iObj, iNext, iPrev, iRepr;
2005  int iLitsOld, iLitsNew;
2006  if ( pGia->pReprs == NULL || pGia->pNexts == NULL )
2007  {
2008  Abc_Print( 1, "Equivalences are not defined.\n" );
2009  return 0;
2010  }
2011  pGia1 = Gia_AigerRead( pName1, 0, 0 );
2012  if ( pGia1 == NULL )
2013  {
2014  Abc_Print( 1, "Cannot read first file %s.\n", pName1 );
2015  return 0;
2016  }
2017  pGia2 = Gia_AigerRead( pName2, 0, 0 );
2018  if ( pGia2 == NULL )
2019  {
2020  Gia_ManStop( pGia2 );
2021  Abc_Print( 1, "Cannot read second file %s.\n", pName2 );
2022  return 0;
2023  }
2024  pMiter = Gia_ManMiter( pGia1, pGia2, 0, 0, 1, 0, 0 );
2025  if ( pMiter == NULL )
2026  {
2027  Gia_ManStop( pGia1 );
2028  Gia_ManStop( pGia2 );
2029  Abc_Print( 1, "Cannot create sequential miter.\n" );
2030  return 0;
2031  }
2032  // make sure the miter is isomorphic
2033  if ( Gia_ManObjNum(pGia) != Gia_ManObjNum(pMiter) )
2034  {
2035  Gia_ManStop( pGia1 );
2036  Gia_ManStop( pGia2 );
2037  Gia_ManStop( pMiter );
2038  Abc_Print( 1, "The number of objects in different.\n" );
2039  return 0;
2040  }
2041  if ( memcmp( pGia->pObjs, pMiter->pObjs, sizeof(Gia_Obj_t) * Gia_ManObjNum(pGia) ) )
2042  {
2043  Gia_ManStop( pGia1 );
2044  Gia_ManStop( pGia2 );
2045  Gia_ManStop( pMiter );
2046  Abc_Print( 1, "The AIG structure of the miter does not match.\n" );
2047  return 0;
2048  }
2049  // transfer copies
2050  Gia_ManCleanMark0( pGia );
2051  Gia_ManForEachObj( pGia1, pObj1, i )
2052  {
2053  if ( pObj1->Value == ~0 )
2054  continue;
2055  pObjM = Gia_ManObj( pMiter, Abc_Lit2Var(pObj1->Value) );
2056  pObj = Gia_ManObj( pGia, Gia_ObjId(pMiter, pObjM) );
2057  pObj->fMark0 = 1;
2058  }
2059  Gia_ManCleanMark1( pGia );
2060  Gia_ManForEachObj( pGia2, pObj2, i )
2061  {
2062  if ( pObj2->Value == ~0 )
2063  continue;
2064  pObjM = Gia_ManObj( pMiter, Abc_Lit2Var(pObj2->Value) );
2065  pObj = Gia_ManObj( pGia, Gia_ObjId(pMiter, pObjM) );
2066  pObj->fMark1 = 1;
2067  }
2068 
2069  // filter equivalences
2070  iLitsOld = iLitsNew = 0;
2071  Gia_ManForEachConst( pGia, i )
2072  {
2073  iLitsOld++;
2074  pObj = Gia_ManObj( pGia, i );
2075  assert( pGia->pNexts[i] == 0 );
2076  assert( pObj->fMark0 || pObj->fMark1 );
2077  if ( pObj->fMark0 && pObj->fMark1 ) // belongs to both A and B
2078  Gia_ObjUnsetRepr( pGia, i );
2079  else
2080  iLitsNew++;
2081  }
2082  // filter equivalences
2083  vNodes = Vec_IntAlloc( 100 );
2084  Gia_ManForEachClass( pGia, i )
2085  {
2086  int fSeenA = 0, fSeenB = 0;
2087  assert( pObj->fMark0 || pObj->fMark1 );
2088  Vec_IntClear( vNodes );
2089  Gia_ClassForEachObj( pGia, i, iObj )
2090  {
2091  pObj = Gia_ManObj( pGia, iObj );
2092  if ( pObj->fMark0 && !pObj->fMark1 )
2093  {
2094  fSeenA = 1;
2095  Vec_IntPush( vNodes, iObj );
2096  }
2097  if ( !pObj->fMark0 && pObj->fMark1 )
2098  {
2099  fSeenB = 1;
2100  Vec_IntPush( vNodes, iObj );
2101  }
2102  iLitsOld++;
2103  }
2104  iLitsOld--;
2105  // undo equivalence classes
2106  for ( iObj = i, iNext = Gia_ObjNext(pGia, iObj); iObj;
2107  iObj = iNext, iNext = Gia_ObjNext(pGia, iObj) )
2108  {
2109  Gia_ObjUnsetRepr( pGia, iObj );
2110  Gia_ObjSetNext( pGia, iObj, 0 );
2111  }
2112  assert( !Gia_ObjIsHead(pGia, i) );
2113  if ( fSeenA && fSeenB && Vec_IntSize(vNodes) > 1 )
2114  {
2115  // create new class
2116  iPrev = iRepr = Vec_IntEntry( vNodes, 0 );
2117  Vec_IntForEachEntryStart( vNodes, iObj, k, 1 )
2118  {
2119  Gia_ObjSetRepr( pGia, iObj, iRepr );
2120  Gia_ObjSetNext( pGia, iPrev, iObj );
2121  iPrev = iObj;
2122  iLitsNew++;
2123  }
2124  assert( Gia_ObjNext(pGia, iPrev) == 0 );
2125  }
2126  }
2127  Vec_IntFree( vNodes );
2128  Abc_Print( 1, "The number of literals: Before = %d. After = %d.\n", iLitsOld, iLitsNew );
2129 //Gia_ManEquivPrintClasses( pGia, 1, 0 );
2130 
2131  Gia_ManCleanMark0( pGia );
2132  Gia_ManCleanMark1( pGia );
2133  return 1;
2134 }
static void Gia_ObjUnsetRepr(Gia_Man_t *p, int Id)
Definition: gia.h:890
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
int * pNexts
Definition: gia.h:122
Gia_Man_t * Gia_AigerRead(char *pFileName, int fSkipStrash, int fCheck)
Definition: giaAiger.c:821
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
void Gia_ManCleanMark0(Gia_Man_t *p)
Definition: giaUtil.c:215
Gia_Obj_t * pObjs
Definition: gia.h:103
static int Gia_ObjIsHead(Gia_Man_t *p, int Id)
Definition: gia.h:916
unsigned fMark1
Definition: gia.h:84
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
void Gia_ManCleanMark1(Gia_Man_t *p)
Definition: giaUtil.c:272
static void Gia_ObjSetRepr(Gia_Man_t *p, int Id, int Num)
Definition: gia.h:888
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
#define Gia_ManForEachConst(p, i)
Definition: gia.h:925
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
int memcmp()
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
Definition: vecInt.h:56
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
#define Gia_ClassForEachObj(p, i, iObj)
Definition: gia.h:931
static int Gia_ObjNext(Gia_Man_t *p, int Id)
Definition: gia.h:912
static void Gia_ObjSetNext(Gia_Man_t *p, int Id, int Num)
Definition: gia.h:913
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
unsigned fMark0
Definition: gia.h:79
Definition: gia.h:95
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
#define Gia_ManForEachClass(p, i)
Definition: gia.h:927
Gia_Rpr_t * pReprs
Definition: gia.h:121
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
Gia_Man_t * Gia_ManMiter(Gia_Man_t *pAig0, Gia_Man_t *pAig1, int nInsDup, int fDualOut, int fSeq, int fImplic, int fVerbose)
Definition: giaDup.c:2128
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
int Gia_ManFindFailedPoCex ( Gia_Man_t pAig,
Abc_Cex_t p,
int  nOutputs 
)

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

Synopsis [Resimulates the counter-example.]

Description []

SideEffects []

SeeAlso []

Definition at line 87 of file giaCex.c.

88 {
89  Gia_Obj_t * pObj, * pObjRi, * pObjRo;
90  int RetValue, i, k, iBit = 0;
91  assert( Gia_ManPiNum(pAig) == p->nPis );
92  Gia_ManCleanMark0(pAig);
93 // Gia_ManForEachRo( pAig, pObj, i )
94 // pObj->fMark0 = Abc_InfoHasBit(p->pData, iBit++);
95  iBit = p->nRegs;
96  for ( i = 0; i <= p->iFrame; i++ )
97  {
98  Gia_ManForEachPi( pAig, pObj, k )
99  pObj->fMark0 = Abc_InfoHasBit(p->pData, iBit++);
100  Gia_ManForEachAnd( pAig, pObj, k )
101  pObj->fMark0 = (Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj)) &
102  (Gia_ObjFanin1(pObj)->fMark0 ^ Gia_ObjFaninC1(pObj));
103  Gia_ManForEachCo( pAig, pObj, k )
104  pObj->fMark0 = Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj);
105  Gia_ManForEachRiRo( pAig, pObjRi, pObjRo, k )
106  pObjRo->fMark0 = pObjRi->fMark0;
107  }
108  assert( iBit == p->nBits );
109  // figure out the number of failed output
110  RetValue = -1;
111 // for ( i = Gia_ManPoNum(pAig) - 1; i >= nOutputs; i-- )
112  for ( i = nOutputs; i < Gia_ManPoNum(pAig); i++ )
113  {
114  if ( Gia_ManPo(pAig, i)->fMark0 )
115  {
116  RetValue = i;
117  break;
118  }
119  }
120  Gia_ManCleanMark0(pAig);
121  return RetValue;
122 }
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
void Gia_ManCleanMark0(Gia_Man_t *p)
Definition: giaUtil.c:215
for(p=first;p->value< newval;p=p->next)
Definition: gia.h:75
#define Gia_ManForEachRiRo(p, pObjRi, pObjRo, i)
Definition: gia.h:1042
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
Vec_Int_t* Gia_ManFirstFanouts ( Gia_Man_t p)

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 1635 of file giaUtil.c.

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

Definition at line 396 of file gia.h.

396 { p->fVerbose ^= 1; }
int fVerbose
Definition: gia.h:174
Gia_Man_t* Gia_ManFraigSweepSimple ( Gia_Man_t p,
void *  pPars 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 556 of file giaSweep.c.

557 {
558  Gia_Man_t * pNew;
559  assert( p->pManTime == NULL || Gia_ManBoxNum(p) == 0 );
560  Gia_ManFraigSweepPerform( p, pPars );
561  pNew = Gia_ManEquivReduce( p, 1, 0, 0, 0 );
562  if ( pNew == NULL )
563  pNew = Gia_ManDup(p);
564  Gia_ManTransferTiming( pNew, p );
565  return pNew;
566 }
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition: giaDup.c:552
Gia_Man_t * Gia_ManEquivReduce(Gia_Man_t *p, int fUseAll, int fDualOut, int fSkipPhase, int fVerbose)
Definition: giaEquiv.c:417
int Gia_ManBoxNum(Gia_Man_t *p)
DECLARATIONS ///.
Definition: giaTim.c:49
void * pManTime
Definition: gia.h:165
void Gia_ManFraigSweepPerform(Gia_Man_t *p, void *pPars)
Definition: giaSweep.c:535
void Gia_ManTransferTiming(Gia_Man_t *p, Gia_Man_t *pGia)
Definition: giaIf.c:1912
Definition: gia.h:95
#define assert(ex)
Definition: util_old.h:213
Gia_Man_t* Gia_ManFrames ( Gia_Man_t pAig,
Gia_ParFra_t pPars 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 840 of file giaFrames.c.

841 {
842  Gia_Man_t * pFrames, * pTemp;
843  Gia_Obj_t * pObj;
844  Vec_Int_t * vPoLits = NULL;
845  int i, f;
846  assert( Gia_ManRegNum(pAig) > 0 );
847  assert( pPars->nFrames > 0 );
848  if ( pPars->fInit )
849  return Gia_ManFramesInit( pAig, pPars );
850  if ( pPars->fOrPos )
851  vPoLits = Vec_IntStart( Gia_ManPoNum(pAig) );
852  pFrames = Gia_ManStart( pPars->nFrames * Gia_ManObjNum(pAig) );
853  pFrames->pName = Abc_UtilStrsav( pAig->pName );
854  pFrames->pSpec = Abc_UtilStrsav( pAig->pSpec );
855  if ( !pPars->fDisableSt )
856  Gia_ManHashAlloc( pFrames );
857  Gia_ManConst0(pAig)->Value = 0;
858  // create primary inputs
859  for ( f = 0; f < pPars->nFrames; f++ )
860  Gia_ManForEachPi( pAig, pObj, i )
861  pObj->Value = Gia_ManAppendCi( pFrames );
862  // add internal nodes for each timeframe
863  for ( f = 0; f < pPars->nFrames; f++ )
864  {
865  if ( f == 0 )
866  {
867  Gia_ManForEachRo( pAig, pObj, i )
868  pObj->Value = Gia_ManAppendCi( pFrames );
869  }
870  else
871  {
872  Gia_ManForEachRo( pAig, pObj, i )
873  pObj->Value = Gia_ObjRoToRi( pAig, pObj )->Value;
874  }
875  Gia_ManForEachPi( pAig, pObj, i )
876  pObj->Value = Gia_Obj2Lit( pFrames, Gia_ManPi(pFrames, f * Gia_ManPiNum(pAig) + i) );
877  if ( !pPars->fDisableSt )
878  Gia_ManForEachAnd( pAig, pObj, i )
879  pObj->Value = Gia_ManHashAnd( pFrames, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
880  else
881  Gia_ManForEachAnd( pAig, pObj, i )
882  pObj->Value = Gia_ManAppendAnd2( pFrames, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
883  if ( vPoLits )
884  {
885  if ( !pPars->fDisableSt )
886  Gia_ManForEachPo( pAig, pObj, i )
887  Vec_IntWriteEntry( vPoLits, i, Gia_ManHashOr(pFrames, Vec_IntEntry(vPoLits, i), Gia_ObjFanin0Copy(pObj)) );
888  else
889  Gia_ManForEachPo( pAig, pObj, i )
891  }
892  else
893  {
894  Gia_ManForEachPo( pAig, pObj, i )
895  pObj->Value = Gia_ManAppendCo( pFrames, Gia_ObjFanin0Copy(pObj) );
896  }
897  if ( f == pPars->nFrames - 1 )
898  {
899  if ( vPoLits )
900  Gia_ManForEachPo( pAig, pObj, i )
901  pObj->Value = Gia_ManAppendCo( pFrames, Vec_IntEntry(vPoLits, i) );
902  Gia_ManForEachRi( pAig, pObj, i )
903  pObj->Value = Gia_ManAppendCo( pFrames, Gia_ObjFanin0Copy(pObj) );
904  }
905  else
906  {
907  Gia_ManForEachRi( pAig, pObj, i )
908  pObj->Value = Gia_ObjFanin0Copy(pObj);
909  }
910  }
911  Vec_IntFreeP( &vPoLits );
912  if ( !pPars->fDisableSt )
913  Gia_ManHashStop( pFrames );
914  Gia_ManSetRegNum( pFrames, Gia_ManRegNum(pAig) );
915  if ( Gia_ManCombMarkUsed(pFrames) < Gia_ManAndNum(pFrames) )
916  {
917  pFrames = Gia_ManDupMarked( pTemp = pFrames );
918  if ( pPars->fVerbose )
919  printf( "Before cleanup = %d nodes. After cleanup = %d nodes.\n",
920  Gia_ManAndNum(pTemp), Gia_ManAndNum(pFrames) );
921  Gia_ManStop( pTemp );
922  }
923  else if ( pPars->fVerbose )
924  printf( "Before cleanup = %d nodes. After cleanup = %d nodes.\n",
925  Gia_ManAndNum(pFrames), Gia_ManAndNum(pFrames) );
926  return pFrames;
927 }
Gia_Man_t * Gia_ManDupMarked(Gia_Man_t *p)
Definition: giaDup.c:975
int nFrames
Definition: gia.h:227
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
int fOrPos
Definition: gia.h:231
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
Definition: gia.h:75
Gia_Man_t * Gia_ManFramesInit(Gia_Man_t *pAig, Gia_ParFra_t *pPars)
Definition: giaFrames.c:727
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
int Gia_ManCombMarkUsed(Gia_Man_t *p)
Definition: giaScl.c:60
static Gia_Obj_t * Gia_ManPi(Gia_Man_t *p, int v)
Definition: gia.h:405
char * pName
Definition: gia.h:97
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
int fVerbose
Definition: gia.h:232
static Gia_Obj_t * Gia_ObjRoToRi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:446
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
if(last==0)
Definition: sparse_int.h:34
char * pSpec
Definition: gia.h:98
else
Definition: sparse_int.h:55
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static int Gia_ManAppendAnd2(Gia_Man_t *p, int iLit0, int iLit1)
Definition: gia.h:627
static int Abc_LitNot(int Lit)
Definition: abc_global.h:266
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
int fInit
Definition: gia.h:228
#define Gia_ManForEachRo(p, pObj, i)
Definition: gia.h:1038
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
#define Gia_ManForEachRi(p, pObj, i)
Definition: gia.h:1040
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
int Gia_ManHashOr(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:611
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
static int Gia_Obj2Lit(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:433
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
int fDisableSt
Definition: gia.h:230
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManFramesInitSpecial ( Gia_Man_t pAig,
int  nFrames,
int  fVerbose 
)

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

Synopsis [Perform init unrolling as long as PO(s) are constant 0.]

Description []

SideEffects []

SeeAlso []

Definition at line 941 of file giaFrames.c.

942 {
943  Gia_Man_t * pFrames, * pTemp;
944  Gia_Obj_t * pObj;
945  int i, f;
946  assert( Gia_ManRegNum(pAig) > 0 );
947  if ( nFrames > 0 )
948  printf( "Computing specialized unrolling with %d frames...\n", nFrames );
949  pFrames = Gia_ManStart( Gia_ManObjNum(pAig) );
950  pFrames->pName = Abc_UtilStrsav( pAig->pName );
951  pFrames->pSpec = Abc_UtilStrsav( pAig->pSpec );
952  Gia_ManHashAlloc( pFrames );
953  Gia_ManConst0(pAig)->Value = 0;
954  for ( f = 0; nFrames == 0 || f < nFrames; f++ )
955  {
956  if ( fVerbose && (f % 100 == 0) )
957  {
958  printf( "%6d : ", f );
959  Gia_ManPrintStats( pFrames, NULL );
960  }
961  Gia_ManForEachRo( pAig, pObj, i )
962  pObj->Value = f ? Gia_ObjRoToRi( pAig, pObj )->Value : 0;
963  Gia_ManForEachPi( pAig, pObj, i )
964  pObj->Value = Gia_ManAppendCi( pFrames );
965  Gia_ManForEachAnd( pAig, pObj, i )
966  pObj->Value = Gia_ManHashAnd( pFrames, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
967  Gia_ManForEachPo( pAig, pObj, i )
968  if ( Gia_ObjFanin0Copy(pObj) != 0 )
969  break;
970  if ( i < Gia_ManPoNum(pAig) )
971  break;
972  Gia_ManForEachRi( pAig, pObj, i )
973  pObj->Value = Gia_ObjFanin0Copy(pObj);
974  }
975  if ( fVerbose )
976  printf( "Computed prefix of %d frames.\n", f );
977  Gia_ManForEachRi( pAig, pObj, i )
978  Gia_ManAppendCo( pFrames, pObj->Value );
979  Gia_ManHashStop( pFrames );
980  pFrames = Gia_ManCleanup( pTemp = pFrames );
981  if ( fVerbose )
982  printf( "Before cleanup = %d nodes. After cleanup = %d nodes.\n",
983  Gia_ManAndNum(pTemp), Gia_ManAndNum(pFrames) );
984  Gia_ManStop( pTemp );
985  return pFrames;
986 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
void Gia_ManPrintStats(Gia_Man_t *p, Gps_Par_t *pPars)
Definition: giaMan.c:389
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
Definition: gia.h:75
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
char * pName
Definition: gia.h:97
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
static Gia_Obj_t * Gia_ObjRoToRi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:446
if(last==0)
Definition: sparse_int.h:34
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define Gia_ManForEachRo(p, pObj, i)
Definition: gia.h:1038
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
#define Gia_ManForEachRi(p, pObj, i)
Definition: gia.h:1040
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
void Gia_ManFraSetDefaultParams ( Gia_ParFra_t p)

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

Synopsis [This procedure sets default parameters.]

Description []

SideEffects []

SeeAlso []

Definition at line 631 of file giaFrames.c.

632 {
633  memset( p, 0, sizeof(Gia_ParFra_t) );
634  p->nFrames = 32; // the number of frames to unroll
635  p->fInit = 0; // initialize the timeframes
636  p->fVerbose = 0; // enables verbose output
637 }
char * memset()
int nFrames
Definition: gia.h:227
int fVerbose
Definition: gia.h:232
int fInit
Definition: gia.h:228
Gia_Man_t* Gia_ManFront ( Gia_Man_t p)

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

Synopsis [Determine the frontier.]

Description []

SideEffects []

SeeAlso []

Definition at line 147 of file giaFront.c.

148 {
149  Gia_Man_t * pNew;
150  Gia_Obj_t * pObj, * pFanin0New, * pFanin1New, * pObjNew;
151  char * pFront; // places used for the frontier
152  int i, iLit, nCrossCut = 0, nCrossCutMax = 0;
153  int nCrossCutMaxInit = Gia_ManCrossCutSimple( p );
154  int iFront = 0;//, clk = Abc_Clock();
155  // set references for all objects
157  // start the new manager
158  pNew = Gia_ManStart( Gia_ManObjNum(p) );
159  pNew->pName = Abc_UtilStrsav( p->pName );
160  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
161  pNew->nFront = 1 + (int)((float)1.1 * nCrossCutMaxInit);
162  // start the frontier
163  pFront = ABC_CALLOC( char, pNew->nFront );
164  // add constant node
165  Gia_ManConst0(pNew)->Value = iFront = Gia_ManFrontFindNext( pFront, pNew->nFront, iFront );
166  if ( Gia_ObjValue(Gia_ManConst0(p)) == 0 )
167  pFront[iFront] = 0;
168  else
169  nCrossCut = 1;
170  // iterate through the objects
171  Gia_ManForEachObj1( p, pObj, i )
172  {
173  if ( Gia_ObjIsCi(pObj) )
174  {
175  if ( Gia_ObjValue(pObj) && nCrossCutMax < ++nCrossCut )
176  nCrossCutMax = nCrossCut;
177  // create new node
178  iLit = Gia_ManAppendCi( pNew );
179  pObjNew = Gia_ManObj( pNew, Abc_Lit2Var(iLit) );
180  assert( Gia_ObjId(pNew, pObjNew) == Gia_ObjId(p, pObj) );
181  pObjNew->Value = iFront = Gia_ManFrontFindNext( pFront, pNew->nFront, iFront );
182  // handle CIs without fanout
183  if ( Gia_ObjValue(pObj) == 0 )
184  pFront[iFront] = 0;
185  continue;
186  }
187  if ( Gia_ObjIsCo(pObj) )
188  {
189  assert( Gia_ObjValue(pObj) == 0 );
190  // create new node
191  iLit = Gia_ManAppendCo( pNew, 0 );
192  pObjNew = Gia_ManObj( pNew, Abc_Lit2Var(iLit) );
193  assert( Gia_ObjId(pNew, pObjNew) == Gia_ObjId(p, pObj) );
194  // get the fanin
195  pFanin0New = Gia_ManObj( pNew, Gia_ObjFaninId0(pObj, i) );
196  assert( pFanin0New->Value != GIA_NONE );
197  pObjNew->Value = GIA_NONE;
198  pObjNew->iDiff0 = pFanin0New->Value;
199  pObjNew->fCompl0 = Gia_ObjFaninC0(pObj);
200  // deref the fanin
201  if ( --Gia_ObjFanin0(pObj)->Value == 0 )
202  {
203  pFront[pFanin0New->Value] = 0;
204  nCrossCut--;
205  }
206  continue;
207  }
208  if ( Gia_ObjValue(pObj) && nCrossCutMax < ++nCrossCut )
209  nCrossCutMax = nCrossCut;
210  // create new node
211  pObjNew = Gia_ManAppendObj( pNew );
212  assert( Gia_ObjId(pNew, pObjNew) == Gia_ObjId(p, pObj) );
213  // assign the first fanin
214  pFanin0New = Gia_ManObj( pNew, Gia_ObjFaninId0(pObj, i) );
215  assert( pFanin0New->Value != GIA_NONE );
216  pObjNew->iDiff0 = pFanin0New->Value;
217  pObjNew->fCompl0 = Gia_ObjFaninC0(pObj);
218  // assign the second fanin
219  pFanin1New = Gia_ManObj( pNew, Gia_ObjFaninId1(pObj, i) );
220  assert( pFanin1New->Value != GIA_NONE );
221  pObjNew->iDiff1 = pFanin1New->Value;
222  pObjNew->fCompl1 = Gia_ObjFaninC1(pObj);
223  // assign the frontier number
224  pObjNew->Value = iFront = Gia_ManFrontFindNext( pFront, pNew->nFront, iFront );
225  // deref the fanins
226  if ( --Gia_ObjFanin0(pObj)->Value == 0 )
227  {
228  pFront[pFanin0New->Value] = 0;
229  nCrossCut--;
230  }
231  if ( --Gia_ObjFanin1(pObj)->Value == 0 )
232  {
233  pFront[pFanin1New->Value] = 0;
234  nCrossCut--;
235  }
236  // handle nodes without fanout (choice nodes)
237  if ( Gia_ObjValue(pObj) == 0 )
238  pFront[iFront] = 0;
239  }
240  assert( pNew->nObjs == p->nObjs );
241  assert( nCrossCut == 0 || nCrossCutMax == nCrossCutMaxInit );
242  for ( i = 0; i < pNew->nFront; i++ )
243  assert( pFront[i] == 0 );
244  ABC_FREE( pFront );
245 //printf( "Crosscut = %6d. Frontier = %6d. ", nCrossCutMaxInit, pNew->nFront );
246 //ABC_PRT( "Time", Abc_Clock() - clk );
247  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
248  return pNew;
249 }
unsigned iDiff0
Definition: gia.h:77
int Gia_ManCrossCutSimple(Gia_Man_t *p)
Definition: giaFront.c:106
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
int nFront
Definition: gia.h:119
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
static int Gia_ObjValue(Gia_Obj_t *pObj)
Definition: gia.h:413
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
int nObjs
Definition: gia.h:101
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
void Gia_ManCreateValueRefs(Gia_Man_t *p)
Definition: giaUtil.c:687
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
char * pName
Definition: gia.h:97
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
unsigned fCompl1
Definition: gia.h:83
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static ABC_NAMESPACE_IMPL_START int Gia_ManFrontFindNext(char *pFront, int nFront, int iFront)
DECLARATIONS ///.
Definition: giaFront.c:45
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static Gia_Obj_t * Gia_ManAppendObj(Gia_Man_t *p)
Definition: gia.h:561
#define ABC_FREE(obj)
Definition: abc_global.h:232
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define GIA_NONE
INCLUDES ///.
Definition: gia.h:44
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
unsigned fCompl0
Definition: gia.h:78
#define Gia_ManForEachObj1(p, pObj, i)
Definition: gia.h:986
unsigned iDiff1
Definition: gia.h:82
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static int Gia_ObjFaninId1(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:461
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ObjFaninId0(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:460
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
void Gia_ManFrontTest ( Gia_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 262 of file giaFront.c.

263 {
264  Gia_Man_t * pNew;
265  pNew = Gia_ManFront( p );
266  Gia_ManFrontTransform( pNew );
267 // Gia_ManCleanValue( p );
268 // Gia_ManCleanValue( pNew );
269  if ( memcmp( pNew->pObjs, p->pObjs, sizeof(Gia_Obj_t) * p->nObjs ) )
270  {
271 /*
272  Gia_Obj_t * pObj, * pObjNew;
273  int i;
274  Gia_ManForEachObj( p, pObj, i )
275  {
276  pObjNew = Gia_ManObj( pNew, i );
277  printf( "%5d %5d %5d %5d\n",
278  pObj->iDiff0, pObjNew->iDiff0,
279  pObj->iDiff1, pObjNew->iDiff1 );
280  }
281 */
282  printf( "Verification failed.\n" );
283  }
284  else
285  printf( "Verification successful.\n" );
286  Gia_ManStop( pNew );
287 }
Gia_Man_t * Gia_ManFront(Gia_Man_t *p)
Definition: giaFront.c:147
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
Gia_Obj_t * pObjs
Definition: gia.h:103
int nObjs
Definition: gia.h:101
void Gia_ManFrontTransform(Gia_Man_t *p)
Definition: giaFront.c:65
Definition: gia.h:75
int memcmp()
Definition: gia.h:95
Vec_Int_t* Gia_ManGetCiLevels ( Gia_Man_t p)

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

Synopsis [Assigns levels using CI level information.]

Description []

SideEffects []

SeeAlso []

Definition at line 546 of file giaUtil.c.

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

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

Synopsis [Returns 1 if AIG has dangling nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1224 of file giaUtil.c.

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

Definition at line 959 of file gia.h.

959 { return p->vCellMapping != NULL; }
Vec_Int_t * vCellMapping
Definition: gia.h:132
static int Gia_ManHasChoices ( Gia_Man_t p)
inlinestatic

Definition at line 397 of file gia.h.

397 { return p->pSibls != NULL; }
int * pSibls
Definition: gia.h:123
int Gia_ManHasDangling ( Gia_Man_t p)

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

Synopsis [Returns 1 if AIG has dangling nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1155 of file giaUtil.c.

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

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

Synopsis [Starts the hash table.]

Description []

SideEffects []

SeeAlso []

Definition at line 99 of file giaHash.c.

100 {
101  assert( p->pHTable == NULL );
102  p->nHTable = Abc_PrimeCudd( Gia_ManAndNum(p) ? Gia_ManAndNum(p) + 1000 : p->nObjsAlloc );
103  p->pHTable = ABC_CALLOC( int, p->nHTable );
104 }
int nObjsAlloc
Definition: gia.h:102
static int Abc_PrimeCudd(unsigned int p)
Definition: abc_global.h:383
int * pHTable
Definition: gia.h:110
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
int nHTable
Definition: gia.h:111
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define assert(ex)
Definition: util_old.h:213
int Gia_ManHashAnd ( Gia_Man_t p,
int  iLit0,
int  iLit1 
)

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

Synopsis [Hashes AND gate.]

Description []

SideEffects []

SeeAlso []

Definition at line 572 of file giaHash.c.

573 {
574  if ( iLit0 < 2 )
575  return iLit0 ? iLit1 : 0;
576  if ( iLit1 < 2 )
577  return iLit1 ? iLit0 : 0;
578  if ( iLit0 == iLit1 )
579  return iLit1;
580  if ( iLit0 == Abc_LitNot(iLit1) )
581  return 0;
582  if ( (p->nObjs & 0xFF) == 0 && 2 * p->nHTable < Gia_ManAndNum(p) )
583  Gia_ManHashResize( p );
584  if ( p->fAddStrash )
585  {
586  Gia_Obj_t * pObj = Gia_ManAddStrash( p, Gia_ObjFromLit(p, iLit0), Gia_ObjFromLit(p, iLit1) );
587  if ( pObj != NULL )
588  return Gia_ObjToLit( p, pObj );
589  }
590  if ( iLit0 > iLit1 )
591  iLit0 ^= iLit1, iLit1 ^= iLit0, iLit0 ^= iLit1;
592  {
593  int * pPlace = Gia_ManHashFind( p, iLit0, iLit1, -1 );
594  if ( *pPlace )
595  {
596  p->nHashHit++;
597  return *pPlace;
598  }
599  p->nHashMiss++;
600  if ( p->nObjs < p->nObjsAlloc )
601  return *pPlace = Gia_ManAppendAnd( p, iLit0, iLit1 );
602  else
603  {
604  int iNode = Gia_ManAppendAnd( p, iLit0, iLit1 );
605  pPlace = Gia_ManHashFind( p, iLit0, iLit1, -1 );
606  assert( *pPlace == 0 );
607  return *pPlace = iNode;
608  }
609  }
610 }
int nObjsAlloc
Definition: gia.h:102
static int Gia_ObjToLit(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:497
static int Gia_ManAppendAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: gia.h:592
word nHashMiss
Definition: gia.h:168
static Gia_Obj_t * Gia_ManAddStrash(Gia_Man_t *p, Gia_Obj_t *p0, Gia_Obj_t *p1)
Definition: giaHash.c:338
static Gia_Obj_t * Gia_ObjFromLit(Gia_Man_t *p, int iLit)
Definition: gia.h:496
int nObjs
Definition: gia.h:101
Definition: gia.h:75
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
static int * Gia_ManHashFind(Gia_Man_t *p, int iLit0, int iLit1, int iLitC)
Definition: giaHash.c:54
word nHashHit
Definition: gia.h:167
int nHTable
Definition: gia.h:111
static int Abc_LitNot(int Lit)
Definition: abc_global.h:266
void Gia_ManHashResize(Gia_Man_t *p)
Definition: giaHash.c:159
#define assert(ex)
Definition: util_old.h:213
int fAddStrash
Definition: gia.h:112
int Gia_ManHashAndMulti ( Gia_Man_t p,
Vec_Int_t vLits 
)

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

Synopsis [Creates well-balanced AND gate.]

Description []

SideEffects []

SeeAlso []

Definition at line 763 of file giaHash.c.

764 {
765  if ( Vec_IntSize(vLits) == 0 )
766  return 0;
767  while ( Vec_IntSize(vLits) > 1 )
768  {
769  int i, k = 0, Lit1, Lit2, LitRes;
770  Vec_IntForEachEntryDouble( vLits, Lit1, Lit2, i )
771  {
772  LitRes = Gia_ManHashAnd( p, Lit1, Lit2 );
773  Vec_IntWriteEntry( vLits, k++, LitRes );
774  }
775  if ( Vec_IntSize(vLits) & 1 )
776  Vec_IntWriteEntry( vLits, k++, Vec_IntEntryLast(vLits) );
777  Vec_IntShrink( vLits, k );
778  }
779  assert( Vec_IntSize(vLits) == 1 );
780  return Vec_IntEntry(vLits, 0);
781 }
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
#define Vec_IntForEachEntryDouble(vVec, Entry1, Entry2, i)
Definition: vecInt.h:66
static int Vec_IntEntryLast(Vec_Int_t *p)
Definition: bblif.c:319
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static void Vec_IntShrink(Vec_Int_t *p, int nSizeNew)
Definition: bblif.c:435
#define assert(ex)
Definition: util_old.h:213
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
int Gia_ManHashAndTry ( Gia_Man_t p,
int  iLit0,
int  iLit1 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 627 of file giaHash.c.

628 {
629  if ( iLit0 < 2 )
630  return iLit0 ? iLit1 : 0;
631  if ( iLit1 < 2 )
632  return iLit1 ? iLit0 : 0;
633  if ( iLit0 == iLit1 )
634  return iLit1;
635  if ( iLit0 == Abc_LitNot(iLit1) )
636  return 0;
637  if ( iLit0 > iLit1 )
638  iLit0 ^= iLit1, iLit1 ^= iLit0, iLit0 ^= iLit1;
639  {
640  int * pPlace = Gia_ManHashFind( p, iLit0, iLit1, -1 );
641  if ( *pPlace )
642  return *pPlace;
643  return -1;
644  }
645 }
static int * Gia_ManHashFind(Gia_Man_t *p, int iLit0, int iLit1, int iLitC)
Definition: giaHash.c:54
static int Abc_LitNot(int Lit)
Definition: abc_global.h:266
int Gia_ManHashLookup ( Gia_Man_t p,
Gia_Obj_t p0,
Gia_Obj_t p1 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 79 of file giaHash.c.

80 {
81  int iLit0 = Gia_ObjToLit( p, p0 );
82  int iLit1 = Gia_ObjToLit( p, p1 );
83  if ( iLit0 > iLit1 )
84  iLit0 ^= iLit1, iLit1 ^= iLit0, iLit0 ^= iLit1;
85  return *Gia_ManHashFind( p, iLit0, iLit1, -1 );
86 }
static int Gia_ObjToLit(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:497
static int * Gia_ManHashFind(Gia_Man_t *p, int iLit0, int iLit1, int iLitC)
Definition: giaHash.c:54
int Gia_ManHashMaj ( Gia_Man_t p,
int  iData0,
int  iData1,
int  iData2 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 700 of file giaHash.c.

701 {
702  int iTemp0 = Gia_ManHashOr( p, iData1, iData2 );
703  int iTemp1 = Gia_ManHashAnd( p, iData0, iTemp0 );
704  int iTemp2 = Gia_ManHashAnd( p, iData1, iData2 );
705  return Gia_ManHashOr( p, iTemp1, iTemp2 );
706 }
int Gia_ManHashOr(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:611
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
int Gia_ManHashMux ( Gia_Man_t p,
int  iCtrl,
int  iData1,
int  iData0 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 677 of file giaHash.c.

678 {
679  int iTemp0, iTemp1, fCompl = 0;
680  if ( iData0 > iData1 )
681  iData0 ^= iData1, iData1 ^= iData0, iData0 ^= iData1, iCtrl = Abc_LitNot(iCtrl);
682  if ( Abc_LitIsCompl(iData1) )
683  iData0 = Abc_LitNot(iData0), iData1 = Abc_LitNot(iData1), fCompl = 1;
684  iTemp0 = Gia_ManHashAnd( p, Abc_LitNot(iCtrl), iData0 );
685  iTemp1 = Gia_ManHashAnd( p, iCtrl, iData1 );
686  return Abc_LitNotCond( Gia_ManHashAnd( p, Abc_LitNot(iTemp0), Abc_LitNot(iTemp1) ), !fCompl );
687 }
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
static int Abc_LitNot(int Lit)
Definition: abc_global.h:266
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
int Gia_ManHashMuxReal ( Gia_Man_t p,
int  iLitC,
int  iLit1,
int  iLit0 
)

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

Synopsis [Hashes MUX gate.]

Description []

SideEffects []

SeeAlso []

Definition at line 517 of file giaHash.c.

518 {
519  int fCompl = 0;
520  assert( p->fAddStrash == 0 );
521  if ( iLitC < 2 )
522  return iLitC ? iLit1 : iLit0;
523  if ( iLit0 < 2 )
524  return iLit0 ? Gia_ManHashOr(p, Abc_LitNot(iLitC), iLit1) : Gia_ManHashAnd(p, iLitC, iLit1);
525  if ( iLit1 < 2 )
526  return iLit1 ? Gia_ManHashOr(p, iLitC, iLit0) : Gia_ManHashAnd(p, Abc_LitNot(iLitC), iLit0);
527  assert( iLit0 > 1 && iLit1 > 1 && iLitC > 1 );
528  if ( iLit0 == iLit1 )
529  return iLit0;
530  if ( iLitC == iLit0 || iLitC == Abc_LitNot(iLit1) )
531  return Gia_ManHashAnd(p, iLit0, iLit1);
532  if ( iLitC == iLit1 || iLitC == Abc_LitNot(iLit0) )
533  return Gia_ManHashOr(p, iLit0, iLit1);
534  if ( Abc_Lit2Var(iLit0) == Abc_Lit2Var(iLit1) )
535  return Gia_ManHashXorReal( p, iLitC, iLit0 );
536  if ( iLit0 > iLit1 )
537  iLit0 ^= iLit1, iLit1 ^= iLit0, iLit0 ^= iLit1, iLitC = Abc_LitNot(iLitC);
538  if ( Abc_LitIsCompl(iLit1) )
539  iLit0 = Abc_LitNot(iLit0), iLit1 = Abc_LitNot(iLit1), fCompl = 1;
540  {
541  int *pPlace = Gia_ManHashFind( p, iLit0, iLit1, iLitC );
542  if ( *pPlace )
543  {
544  p->nHashHit++;
545  return Abc_LitNotCond( *pPlace, fCompl );
546  }
547  p->nHashMiss++;
548  if ( p->nObjs < p->nObjsAlloc )
549  *pPlace = Gia_ManAppendMuxReal( p, iLitC, iLit1, iLit0 );
550  else
551  {
552  int iNode = Gia_ManAppendMuxReal( p, iLitC, iLit1, iLit0 );
553  pPlace = Gia_ManHashFind( p, iLit0, iLit1, iLitC );
554  assert( *pPlace == 0 );
555  *pPlace = iNode;
556  }
557  return Abc_LitNotCond( *pPlace, fCompl );
558  }
559 }
int nObjsAlloc
Definition: gia.h:102
word nHashMiss
Definition: gia.h:168
static int Gia_ManAppendMuxReal(Gia_Man_t *p, int iLitC, int iLit1, int iLit0)
Definition: gia.h:664
int nObjs
Definition: gia.h:101
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
static int * Gia_ManHashFind(Gia_Man_t *p, int iLit0, int iLit1, int iLitC)
Definition: giaHash.c:54
int Gia_ManHashXorReal(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:465
word nHashHit
Definition: gia.h:167
static int Abc_LitNot(int Lit)
Definition: abc_global.h:266
int Gia_ManHashOr(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:611
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
#define assert(ex)
Definition: util_old.h:213
int fAddStrash
Definition: gia.h:112
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
int Gia_ManHashOr ( Gia_Man_t p,
int  iLit0,
int  iLit1 
)

Definition at line 611 of file giaHash.c.

612 {
613  return Abc_LitNot(Gia_ManHashAnd( p, Abc_LitNot(iLit0), Abc_LitNot(iLit1) ));
614 }
static int Abc_LitNot(int Lit)
Definition: abc_global.h:266
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
void Gia_ManHashProfile ( Gia_Man_t p)

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

Synopsis [Profiles the hash table.]

Description []

SideEffects []

SeeAlso []

Definition at line 203 of file giaHash.c.

204 {
205  Gia_Obj_t * pEntry;
206  int i, Counter, Limit;
207  printf( "Table size = %d. Entries = %d. ", p->nHTable, Gia_ManAndNum(p) );
208  printf( "Hits = %d. Misses = %d.\n", (int)p->nHashHit, (int)p->nHashMiss );
209  Limit = Abc_MinInt( 1000, p->nHTable );
210  for ( i = 0; i < Limit; i++ )
211  {
212  Counter = 0;
213  for ( pEntry = (p->pHTable[i]? Gia_ManObj(p, Abc_Lit2Var(p->pHTable[i])) : NULL);
214  pEntry;
215  pEntry = (pEntry->Value? Gia_ManObj(p, Abc_Lit2Var(pEntry->Value)) : NULL) )
216  Counter++;
217  if ( Counter )
218  printf( "%d ", Counter );
219  }
220  printf( "\n" );
221 }
word nHashMiss
Definition: gia.h:168
int * pHTable
Definition: gia.h:110
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
static int Abc_MinInt(int a, int b)
Definition: abc_global.h:239
word nHashHit
Definition: gia.h:167
static int Counter
int nHTable
Definition: gia.h:111
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
unsigned Value
Definition: gia.h:87
void Gia_ManHashStart ( Gia_Man_t p)

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

Synopsis [Starts the hash table.]

Description []

SideEffects []

SeeAlso []

Definition at line 117 of file giaHash.c.

118 {
119  Gia_Obj_t * pObj;
120  int * pPlace, i;
121  Gia_ManHashAlloc( p );
122  Gia_ManCleanValue( p );
123  Gia_ManForEachAnd( p, pObj, i )
124  {
125  pPlace = Gia_ManHashFind( p, Gia_ObjFaninLit0(pObj, i), Gia_ObjFaninLit1(pObj, i), Gia_ObjFaninLit2(p, i) );
126  assert( *pPlace == 0 );
127  *pPlace = Abc_Var2Lit( i, 0 );
128  }
129 }
static int Gia_ObjFaninLit0(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:466
static int Gia_ObjFaninLit2(Gia_Man_t *p, int ObjId)
Definition: gia.h:468
void Gia_ManCleanValue(Gia_Man_t *p)
Definition: giaUtil.c:310
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
Definition: gia.h:75
static int * Gia_ManHashFind(Gia_Man_t *p, int iLit0, int iLit1, int iLitC)
Definition: giaHash.c:54
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
static int Gia_ObjFaninLit1(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:467
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
#define assert(ex)
Definition: util_old.h:213
void Gia_ManHashStop ( Gia_Man_t p)

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

Synopsis [Stops the hash table.]

Description []

SideEffects []

SeeAlso []

Definition at line 142 of file giaHash.c.

143 {
144  ABC_FREE( p->pHTable );
145  p->nHTable = 0;
146 }
int * pHTable
Definition: gia.h:110
int nHTable
Definition: gia.h:111
#define ABC_FREE(obj)
Definition: abc_global.h:232
int Gia_ManHashXor ( Gia_Man_t p,
int  iLit0,
int  iLit1 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 658 of file giaHash.c.

659 {
660  int fCompl = Abc_LitIsCompl(iLit0) ^ Abc_LitIsCompl(iLit1);
661  int iTemp0 = Gia_ManHashAnd( p, Abc_LitRegular(iLit0), Abc_LitNot(Abc_LitRegular(iLit1)) );
662  int iTemp1 = Gia_ManHashAnd( p, Abc_LitRegular(iLit1), Abc_LitNot(Abc_LitRegular(iLit0)) );
663  return Abc_LitNotCond( Gia_ManHashAnd( p, Abc_LitNot(iTemp0), Abc_LitNot(iTemp1) ), !fCompl );
664 }
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
static int Abc_LitNot(int Lit)
Definition: abc_global.h:266
static int Abc_LitRegular(int Lit)
Definition: abc_global.h:268
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
int Gia_ManHashXorReal ( Gia_Man_t p,
int  iLit0,
int  iLit1 
)

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

Synopsis [Hashes XOR gate.]

Description []

SideEffects []

SeeAlso []

Definition at line 465 of file giaHash.c.

466 {
467  int fCompl = 0;
468  assert( p->fAddStrash == 0 );
469  if ( iLit0 < 2 )
470  return iLit0 ? Abc_LitNot(iLit1) : iLit1;
471  if ( iLit1 < 2 )
472  return iLit1 ? Abc_LitNot(iLit0) : iLit0;
473  if ( iLit0 == iLit1 )
474  return 0;
475  if ( iLit0 == Abc_LitNot(iLit1) )
476  return 1;
477  if ( (p->nObjs & 0xFF) == 0 && 2 * p->nHTable < Gia_ManAndNum(p) )
478  Gia_ManHashResize( p );
479  if ( iLit0 < iLit1 )
480  iLit0 ^= iLit1, iLit1 ^= iLit0, iLit0 ^= iLit1;
481  if ( Abc_LitIsCompl(iLit0) )
482  iLit0 = Abc_LitNot(iLit0), fCompl ^= 1;
483  if ( Abc_LitIsCompl(iLit1) )
484  iLit1 = Abc_LitNot(iLit1), fCompl ^= 1;
485  {
486  int *pPlace = Gia_ManHashFind( p, iLit0, iLit1, -1 );
487  if ( *pPlace )
488  {
489  p->nHashHit++;
490  return Abc_LitNotCond( *pPlace, fCompl );
491  }
492  p->nHashMiss++;
493  if ( p->nObjs < p->nObjsAlloc )
494  *pPlace = Gia_ManAppendXorReal( p, iLit0, iLit1 );
495  else
496  {
497  int iNode = Gia_ManAppendXorReal( p, iLit0, iLit1 );
498  pPlace = Gia_ManHashFind( p, iLit0, iLit1, -1 );
499  assert( *pPlace == 0 );
500  *pPlace = iNode;
501  }
502  return Abc_LitNotCond( *pPlace, fCompl );
503  }
504 }
int nObjsAlloc
Definition: gia.h:102
word nHashMiss
Definition: gia.h:168
int nObjs
Definition: gia.h:101
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
static int * Gia_ManHashFind(Gia_Man_t *p, int iLit0, int iLit1, int iLitC)
Definition: giaHash.c:54
word nHashHit
Definition: gia.h:167
int nHTable
Definition: gia.h:111
static int Abc_LitNot(int Lit)
Definition: abc_global.h:266
void Gia_ManHashResize(Gia_Man_t *p)
Definition: giaHash.c:159
#define assert(ex)
Definition: util_old.h:213
int fAddStrash
Definition: gia.h:112
static int Gia_ManAppendXorReal(Gia_Man_t *p, int iLit0, int iLit1)
Definition: gia.h:639
static int Gia_ManHasMapping ( Gia_Man_t p)
inlinestatic

Definition at line 951 of file gia.h.

951 { return p->vMapping != NULL; }
Vec_Int_t * vMapping
Definition: gia.h:131
static int Gia_ManIdToCioId ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 437 of file gia.h.

437 { return Gia_ObjCioId( Gia_ManObj(p, Id) ); }
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
static int Gia_ObjCioId(Gia_Obj_t *pObj)
Definition: gia.h:411
void Gia_ManIncrementTravId ( Gia_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 149 of file giaUtil.c.

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

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

Synopsis [Complements the constraint outputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 1415 of file giaUtil.c.

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

Definition at line 1425 of file giaUtil.c.

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

Definition at line 373 of file gia.h.

373 { return (iLit == 0); }
static int Gia_ManIsConst1Lit ( int  iLit)
inlinestatic

Definition at line 374 of file gia.h.

374 { return (iLit == 1); }
static int Gia_ManIsConstLit ( int  iLit)
inlinestatic

Definition at line 375 of file gia.h.

375 { return (iLit <= 1); }
int Gia_ManIsNormalized ( Gia_Man_t p)

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

Synopsis [Makes sure the manager is normalized.]

Description []

SideEffects []

SeeAlso []

Definition at line 109 of file giaTim.c.

110 {
111  int i, nOffset;
112  nOffset = 1;
113  for ( i = 0; i < Gia_ManCiNum(p); i++ )
114  if ( !Gia_ObjIsCi( Gia_ManObj(p, nOffset+i) ) )
115  return 0;
116  nOffset = 1 + Gia_ManCiNum(p) + Gia_ManAndNum(p);
117  for ( i = 0; i < Gia_ManCoNum(p); i++ )
118  if ( !Gia_ObjIsCo( Gia_ManObj(p, nOffset+i) ) )
119  return 0;
120  return 1;
121 }
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
Gia_Man_t* Gia_ManIsoCanonicize ( Gia_Man_t p,
int  fVerbose 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 958 of file giaIso.c.

959 {
960  Gia_Man_t * pRes = NULL;
961  Vec_Int_t * vCis, * vAnds, * vCos;
962  Vec_Ptr_t * vEquiv;
963  if ( Gia_ManCiNum(p) == 0 ) // const AIG
964  {
965  assert( Gia_ManPoNum(p) == 1 );
966  assert( Gia_ManObjNum(p) == 2 );
967  return Gia_ManDup(p);
968  }
969  // derive canonical values
970  vEquiv = Gia_IsoDeriveEquivPos( p, 0, fVerbose );
971  Vec_VecFreeP( (Vec_Vec_t **)&vEquiv );
972  // find canonical order of CIs/COs/nodes
973  // find canonical order
974  vCis = Vec_IntAlloc( Gia_ManCiNum(p) );
975  vAnds = Vec_IntAlloc( Gia_ManAndNum(p) );
976  vCos = Vec_IntAlloc( Gia_ManCoNum(p) );
977  Gia_ManFindCaninicalOrder( p, vCis, vAnds, vCos, NULL );
978  // derive the new AIG
979  pRes = Gia_ManDupFromVecs( p, vCis, vAnds, vCos, Gia_ManRegNum(p) );
980  // cleanup
981  Vec_IntFree( vCis );
982  Vec_IntFree( vAnds );
983  Vec_IntFree( vCos );
984  return pRes;
985 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition: giaDup.c:552
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Gia_Man_t * Gia_ManDupFromVecs(Gia_Man_t *p, Vec_Int_t *vCis, Vec_Int_t *vAnds, Vec_Int_t *vCos, int nRegs)
Definition: giaDup.c:2853
void Gia_ManFindCaninicalOrder(Gia_Man_t *p, Vec_Int_t *vCis, Vec_Int_t *vAnds, Vec_Int_t *vCos, Vec_Int_t **pvPiPerm)
Definition: giaIso.c:882
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
Definition: gia.h:95
static void Vec_VecFreeP(Vec_Vec_t **p)
Definition: vecVec.h:367
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
Vec_Ptr_t * Gia_IsoDeriveEquivPos(Gia_Man_t *pGia, int fForward, int fVerbose)
Definition: giaIso.c:720
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManIsoReduce ( Gia_Man_t pInit,
Vec_Ptr_t **  pvPosEquivs,
Vec_Ptr_t **  pvPiPerms,
int  fEstimate,
int  fDualOut,
int  fVerbose,
int  fVeryVerbose 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1075 of file giaIso.c.

1076 {
1077  Gia_Man_t * p, * pPart;
1078  Vec_Ptr_t * vEquivs, * vEquivs2, * vStrings;
1079  Vec_Int_t * vRemain, * vLevel, * vLevel2;
1080  Vec_Str_t * vStr, * vStr2;
1081  int i, k, s, sStart, iPo, Counter;
1082  int nClasses, nUsedPos;
1083  abctime clk = Abc_Clock();
1084  if ( pvPosEquivs )
1085  *pvPosEquivs = NULL;
1086  if ( pvPiPerms )
1087  *pvPiPerms = Vec_PtrStart( Gia_ManPoNum(pInit) );
1088 
1089  if ( fDualOut )
1090  {
1091  assert( (Gia_ManPoNum(pInit) & 1) == 0 );
1092  if ( Gia_ManPoNum(pInit) == 2 )
1093  return Gia_ManDup(pInit);
1094  p = Gia_ManTransformMiter( pInit );
1095  p = Gia_ManSeqStructSweep( pPart = p, 1, 1, 0 );
1096  Gia_ManStop( pPart );
1097  }
1098  else
1099  {
1100  if ( Gia_ManPoNum(pInit) == 1 )
1101  return Gia_ManDup(pInit);
1102  p = pInit;
1103  }
1104 
1105  // create preliminary equivalences
1106  vEquivs = Gia_IsoDeriveEquivPos( p, 1, fVeryVerbose );
1107  if ( vEquivs == NULL )
1108  {
1109  if ( fDualOut )
1110  Gia_ManStop( p );
1111  return NULL;
1112  }
1113  nClasses = Vec_IntCountNonTrivial( vEquivs, &nUsedPos );
1114  printf( "Reduced %d outputs to %d candidate classes (%d outputs are in %d non-trivial classes). ",
1115  Gia_ManPoNum(p), Vec_PtrSize(vEquivs), nUsedPos, nClasses );
1116  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
1117  if ( fEstimate )
1118  {
1119  Vec_VecFree( (Vec_Vec_t *)vEquivs );
1120  return Gia_ManDup(pInit);
1121  }
1122 
1123  // perform refinement of equivalence classes
1124  Counter = 0;
1125  vEquivs2 = Vec_PtrAlloc( 100 );
1126  Vec_PtrForEachEntry( Vec_Int_t *, vEquivs, vLevel, i )
1127  {
1128  if ( Vec_IntSize(vLevel) < 2 )
1129  {
1130  Vec_PtrPush( vEquivs2, Vec_IntDup(vLevel) );
1131  for ( k = 0; k < Vec_IntSize(vLevel); k++ )
1132  if ( ++Counter % 100 == 0 )
1133  printf( "%6d finished...\r", Counter );
1134  continue;
1135  }
1136 
1137  if ( fVerbose )
1138  {
1139  iPo = Vec_IntEntry(vLevel, 0);
1140  printf( "%6d %6d %6d : ", i, Vec_IntSize(vLevel), iPo );
1141  pPart = Gia_ManDupCones( p, &iPo, 1, 1 );
1142  Gia_ManPrintStats(pPart, NULL);
1143  Gia_ManStop( pPart );
1144  }
1145 
1146  sStart = Vec_PtrSize( vEquivs2 );
1147  vStrings = Vec_PtrAlloc( 100 );
1148  Vec_IntForEachEntry( vLevel, iPo, k )
1149  {
1150  if ( ++Counter % 100 == 0 )
1151  printf( "%6d finished...\r", Counter );
1152  assert( pvPiPerms == NULL || Vec_PtrArray(*pvPiPerms)[iPo] == NULL );
1153  vStr = Gia_ManIsoFindString( p, iPo, 0, pvPiPerms ? (Vec_Int_t **)Vec_PtrArray(*pvPiPerms) + iPo : NULL );
1154 
1155 // printf( "Output %2d : ", iPo );
1156 // Vec_IntPrint( Vec_PtrArray(*pvPiPerms)[iPo] );
1157 
1158  // check if this string already exists
1159  Vec_PtrForEachEntry( Vec_Str_t *, vStrings, vStr2, s )
1160  if ( Vec_StrCompareVec(vStr, vStr2) == 0 )
1161  break;
1162  if ( s == Vec_PtrSize(vStrings) )
1163  {
1164  Vec_PtrPush( vStrings, vStr );
1165  Vec_PtrPush( vEquivs2, Vec_IntAlloc(8) );
1166  }
1167  else
1168  Vec_StrFree( vStr );
1169  // add this entry to the corresponding level
1170  vLevel2 = (Vec_Int_t *)Vec_PtrEntry( vEquivs2, sStart + s );
1171  Vec_IntPush( vLevel2, iPo );
1172  }
1173 // if ( Vec_PtrSize(vEquivs2) - sStart > 1 )
1174 // printf( "Refined class %d into %d classes.\n", i, Vec_PtrSize(vEquivs2) - sStart );
1175  Vec_VecFree( (Vec_Vec_t *)vStrings );
1176  }
1177  assert( Counter == Gia_ManPoNum(p) );
1178  Vec_VecSortByFirstInt( (Vec_Vec_t *)vEquivs2, 0 );
1179  Vec_VecFree( (Vec_Vec_t *)vEquivs );
1180  vEquivs = vEquivs2;
1181 
1182  // collect the first ones
1183  vRemain = Vec_IntAlloc( 100 );
1184  Vec_PtrForEachEntry( Vec_Int_t *, vEquivs, vLevel, i )
1185  Vec_IntPush( vRemain, Vec_IntEntry(vLevel, 0) );
1186 
1187  if ( fDualOut )
1188  {
1189  Vec_Int_t * vTemp = Vec_IntAlloc( Vec_IntSize(vRemain) );
1190  int i, Entry;
1191  Vec_IntForEachEntry( vRemain, Entry, i )
1192  {
1193 // printf( "%d ", Entry );
1194  Vec_IntPush( vTemp, 2*Entry );
1195  Vec_IntPush( vTemp, 2*Entry+1 );
1196  }
1197 // printf( "\n" );
1198  Vec_IntFree( vRemain );
1199  vRemain = vTemp;
1200  Gia_ManStop( p );
1201  p = pInit;
1202  }
1203 
1204 
1205  // derive the resulting AIG
1206  pPart = Gia_ManDupCones( p, Vec_IntArray(vRemain), Vec_IntSize(vRemain), 0 );
1207  Vec_IntFree( vRemain );
1208  // report the results
1209  nClasses = Vec_IntCountNonTrivial( vEquivs, &nUsedPos );
1210  if ( !fDualOut )
1211  printf( "Reduced %d outputs to %d equivalence classes (%d outputs are in %d non-trivial classes). ",
1212  Gia_ManPoNum(p), Vec_PtrSize(vEquivs), nUsedPos, nClasses );
1213  else
1214  printf( "Reduced %d dual outputs to %d dual outputs. ", Gia_ManPoNum(p)/2, Gia_ManPoNum(pPart)/2 );
1215  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
1216  if ( fVerbose )
1217  {
1218  printf( "Nontrivial classes:\n" );
1219  Vec_VecPrintInt( (Vec_Vec_t *)vEquivs, 1 );
1220  }
1221  if ( pvPosEquivs )
1222  *pvPosEquivs = vEquivs;
1223  else
1224  Vec_VecFree( (Vec_Vec_t *)vEquivs );
1225 // Gia_ManStopP( &pPart );
1226  return pPart;
1227 }
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
static Vec_Ptr_t * Vec_PtrStart(int nSize)
Definition: vecPtr.h:106
Gia_Man_t * Gia_ManDupCones(Gia_Man_t *p, int *pPos, int nPos, int fTrimPis)
Definition: giaDup.c:2691
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition: giaDup.c:552
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
Gia_Man_t * Gia_ManTransformMiter(Gia_Man_t *p)
Definition: giaDup.c:2324
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
void Gia_ManPrintStats(Gia_Man_t *p, Gps_Par_t *pPars)
Definition: giaMan.c:389
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
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 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 void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
int Vec_IntCountNonTrivial(Vec_Ptr_t *vEquivs, int *pnUsed)
Definition: giaIso.c:1049
static void Vec_StrFree(Vec_Str_t *p)
Definition: bblif.c:616
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static void Vec_VecPrintInt(Vec_Vec_t *p, int fSkipSingles)
Definition: vecVec.h:616
if(last==0)
Definition: sparse_int.h:34
static void Vec_VecSortByFirstInt(Vec_Vec_t *p, int fReverse)
Definition: vecVec.h:595
Vec_Str_t * Gia_ManIsoFindString(Gia_Man_t *p, int iPo, int fVerbose, Vec_Int_t **pvPiPerm)
Definition: giaIso.c:998
Gia_Man_t * Gia_ManSeqStructSweep(Gia_Man_t *p, int fConst, int fEquiv, int fVerbose)
Definition: giaScl.c:258
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Counter
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Vec_StrCompareVec(Vec_Str_t *p1, Vec_Str_t *p2)
Definition: vecStr.h:793
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
Definition: gia.h:95
#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
ABC_INT64_T abctime
Definition: abc_global.h:278
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static void ** Vec_PtrArray(Vec_Ptr_t *p)
Definition: vecPtr.h:279
Vec_Ptr_t * Gia_IsoDeriveEquivPos(Gia_Man_t *pGia, int fForward, int fVerbose)
Definition: giaIso.c:720
Gia_Man_t* Gia_ManIsoReduce2 ( Gia_Man_t pGia,
Vec_Ptr_t **  pvPosEquivs,
Vec_Ptr_t **  pvPiPerms,
int  fEstimate,
int  fBetterQual,
int  fDualOut,
int  fVerbose,
int  fVeryVerbose 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 718 of file giaIso2.c.

719 {
720  Gia_Man_t * pPart;
721  Vec_Wec_t * vEquivs, * vEquivs2;
722  Vec_Int_t * vRemains;
723  int nClasses, nUsedPos;
724  abctime clk = Abc_Clock();
725  vEquivs = Gia_Iso2ManPerform( pGia, fVeryVerbose );
726  // report class stats
727  nClasses = Vec_WecCountNonTrivial( vEquivs, &nUsedPos );
728  printf( "Reduced %d outputs to %d candidate classes (%d outputs are in %d non-trivial classes). ",
729  Gia_ManPoNum(pGia), Vec_WecSize(vEquivs), nUsedPos, nClasses );
730  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
731  if ( fEstimate )
732  {
733  Vec_WecFree( vEquivs );
734  return Gia_ManDup(pGia);
735  }
736  // verify classes
737  if ( fBetterQual )
738  vEquivs2 = Gia_Iso2ManCheckIsoClasses( pGia, vEquivs );
739  else
740  vEquivs2 = Gia_Iso2ManCheckIsoClassesSkip( pGia, vEquivs );
741  Vec_WecFree( vEquivs );
742  vEquivs = vEquivs2;
743  // sort equiv classes by the first integer
744  Vec_WecSortByFirstInt( vEquivs, 0 );
745  // find the first outputs
746  vRemains = Vec_WecCollectFirsts( vEquivs );
747  // derive the final GIA
748  pPart = Gia_ManDupCones( pGia, Vec_IntArray(vRemains), Vec_IntSize(vRemains), 0 );
749  Vec_IntFree( vRemains );
750  // report class stats
751  nClasses = Vec_WecCountNonTrivial( vEquivs, &nUsedPos );
752  printf( "Reduced %d outputs to %d equivalence classes (%d outputs are in %d non-trivial classes). ",
753  Gia_ManPoNum(pGia), Vec_WecSize(vEquivs), nUsedPos, nClasses );
754  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
755  if ( fVerbose )
756  {
757  printf( "Nontrivial classes:\n" );
758  Vec_WecPrint( vEquivs, 1 );
759  }
760  if ( pvPiPerms )
761  *pvPiPerms = NULL;
762  if ( pvPosEquivs )
763  *pvPosEquivs = Vec_WecConvertToVecPtr( vEquivs );
764  Vec_WecFree( vEquivs );
765 // Gia_ManStopP( &pPart );
766  return pPart;
767 }
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
Gia_Man_t * Gia_ManDupCones(Gia_Man_t *p, int *pPos, int nPos, int fTrimPis)
Definition: giaDup.c:2691
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.
Definition: vecWec.h:42
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition: giaDup.c:552
static Vec_Int_t * Vec_WecCollectFirsts(Vec_Wec_t *p)
Definition: vecWec.h:596
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Vec_Ptr_t * Vec_WecConvertToVecPtr(Vec_Wec_t *p)
Definition: vecWec.h:618
static void Vec_WecFree(Vec_Wec_t *p)
Definition: vecWec.h:345
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Vec_WecSize(Vec_Wec_t *p)
Definition: vecWec.h:193
Vec_Wec_t * Gia_Iso2ManCheckIsoClassesSkip(Gia_Man_t *p, Vec_Wec_t *vEquivs)
Definition: giaIso2.c:569
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
Vec_Wec_t * Gia_Iso2ManPerform(Gia_Man_t *pGia, int fVerbose)
Definition: giaIso2.c:680
static void Vec_WecPrint(Vec_Wec_t *p, int fSkipSingles)
Definition: vecWec.h:523
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Vec_Wec_t * Gia_Iso2ManCheckIsoClasses(Gia_Man_t *p, Vec_Wec_t *vEquivs)
Definition: giaIso2.c:628
Definition: gia.h:95
static int Vec_WecCountNonTrivial(Vec_Wec_t *p, int *pnUsed)
Definition: vecWec.h:570
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
ABC_INT64_T abctime
Definition: abc_global.h:278
static void Vec_WecSortByFirstInt(Vec_Wec_t *p, int fReverse)
Definition: vecWec.h:465
int Gia_ManIsSeqWithBoxes ( Gia_Man_t p)

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

Synopsis [Returns one if this is a seq AIG with non-trivial boxes.]

Description []

SideEffects []

SeeAlso []

Definition at line 93 of file giaTim.c.

94 {
95  return (Gia_ManRegNum(p) > 0 && Gia_ManBoxNum(p) > 0);
96 }
ABC_NAMESPACE_IMPL_START int Gia_ManBoxNum(Gia_Man_t *p)
DECLARATIONS ///.
Definition: giaTim.c:49
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Vec_Vec_t* Gia_ManLevelize ( Gia_Man_t p)

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

Synopsis [Levelizes the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 379 of file giaDfs.c.

380 {
381  Gia_Obj_t * pObj;
382  Vec_Vec_t * vLevels;
383  int nLevels, Level, i;
384  nLevels = Gia_ManLevelNum( p );
385  vLevels = Vec_VecStart( nLevels + 1 );
386  Gia_ManForEachAnd( p, pObj, i )
387  {
388  Level = Gia_ObjLevel( p, pObj );
389  assert( Level <= nLevels );
390  Vec_VecPush( vLevels, Level, pObj );
391  }
392  return vLevels;
393 }
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
Definition: gia.h:75
static int Gia_ObjLevel(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:501
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
static Vec_Vec_t * Vec_VecStart(int nSize)
Definition: vecVec.h:168
#define assert(ex)
Definition: util_old.h:213
int Gia_ManLevelNum(Gia_Man_t *p)
Definition: giaUtil.c:505
int Gia_ManLevelNum ( Gia_Man_t p)

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

Synopsis [Assigns levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 505 of file giaUtil.c.

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

Definition at line 469 of file giaTim.c.

470 {
471  int nAnd2Delay = p->nAnd2Delay ? p->nAnd2Delay : 1;
472  Tim_Man_t * pManTime = (Tim_Man_t *)p->pManTime;
473  Gia_Obj_t * pObj, * pObjIn;
474  int i, k, j, curCi, curCo, LevelMax;
475  assert( Gia_ManRegNum(p) == 0 );
476  assert( Gia_ManBufNum(p) == 0 );
477  // copy const and real PIs
479  Gia_ObjSetLevel( p, Gia_ManConst0(p), 0 );
482  for ( i = 0; i < Tim_ManPiNum(pManTime); i++ )
483  {
484  pObj = Gia_ManCi( p, i );
485  Gia_ObjSetLevel( p, pObj, Tim_ManGetCiArrival(pManTime, i) / nAnd2Delay );
486  Gia_ObjSetTravIdCurrent( p, pObj );
487  }
488  // create logic for each box
489  curCi = Tim_ManPiNum(pManTime);
490  curCo = 0;
491  for ( i = 0; i < Tim_ManBoxNum(pManTime); i++ )
492  {
493  int nBoxInputs = Tim_ManBoxInputNum( pManTime, i );
494  int nBoxOutputs = Tim_ManBoxOutputNum( pManTime, i );
495  float * pDelayTable = Tim_ManBoxDelayTable( pManTime, i );
496  // compute level for TFI of box inputs
497  for ( k = 0; k < nBoxInputs; k++ )
498  {
499  pObj = Gia_ManCo( p, curCo + k );
500  if ( Gia_ManLevelWithBoxes_rec( p, Gia_ObjFanin0(pObj) ) )
501  {
502  printf( "Boxes are not in a topological order. Switching to level computation without boxes.\n" );
503  return Gia_ManLevelNum( p );
504  }
505  // set box input level
506  Gia_ObjSetCoLevel( p, pObj );
507  }
508  // compute level for box outputs
509  for ( k = 0; k < nBoxOutputs; k++ )
510  {
511  pObj = Gia_ManCi( p, curCi + k );
512  Gia_ObjSetTravIdCurrent( p, pObj );
513  // evaluate delay of this output
514  LevelMax = 0;
515  assert( nBoxInputs == (int)pDelayTable[1] );
516  for ( j = 0; j < nBoxInputs && (pObjIn = Gia_ManCo(p, curCo + j)); j++ )
517  if ( (int)pDelayTable[3+k*nBoxInputs+j] != -ABC_INFINITY )
518  LevelMax = Abc_MaxInt( LevelMax, Gia_ObjLevel(p, pObjIn) + ((int)pDelayTable[3+k*nBoxInputs+j] / nAnd2Delay) );
519  // set box output level
520  Gia_ObjSetLevel( p, pObj, LevelMax );
521  }
522  curCo += nBoxInputs;
523  curCi += nBoxOutputs;
524  }
525  // add remaining nodes
526  p->nLevels = 0;
527  for ( i = Tim_ManCoNum(pManTime) - Tim_ManPoNum(pManTime); i < Tim_ManCoNum(pManTime); i++ )
528  {
529  pObj = Gia_ManCo( p, i );
531  Gia_ObjSetCoLevel( p, pObj );
532  p->nLevels = Abc_MaxInt( p->nLevels, Gia_ObjLevel(p, pObj) );
533  }
534  curCo += Tim_ManPoNum(pManTime);
535  // verify counts
536  assert( curCi == Gia_ManCiNum(p) );
537  assert( curCo == Gia_ManCoNum(p) );
538 // printf( "Max level is %d.\n", p->nLevels );
539  return p->nLevels;
540 }
int Tim_ManCoNum(Tim_Man_t *p)
Definition: timMan.c:684
static Gia_Obj_t * Gia_ManCi(Gia_Man_t *p, int v)
Definition: gia.h:403
int Tim_ManBoxOutputNum(Tim_Man_t *p, int iBox)
Definition: timBox.c:202
int nLevels
Definition: gia.h:116
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
Definition: gia.h:75
int Tim_ManPiNum(Tim_Man_t *p)
Definition: timMan.c:688
static int Gia_ObjLevel(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:501
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
void * pManTime
Definition: gia.h:165
void Gia_ManCleanLevels(Gia_Man_t *p, int Size)
Definition: giaUtil.c:470
int Tim_ManBoxNum(Tim_Man_t *p)
Definition: timMan.c:702
int Tim_ManBoxInputNum(Tim_Man_t *p, int iBox)
Definition: timBox.c:186
int nAnd2Delay
Definition: gia.h:173
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
static Gia_Obj_t * Gia_ManCo(Gia_Man_t *p, int v)
Definition: gia.h:404
static void Gia_ObjSetCoLevel(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:504
static int Gia_ManBufNum(Gia_Man_t *p)
Definition: gia.h:392
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
#define assert(ex)
Definition: util_old.h:213
int Gia_ManLevelNum(Gia_Man_t *p)
Definition: giaUtil.c:505
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
float Tim_ManGetCiArrival(Tim_Man_t *p, int iCi)
Definition: timTime.c:174
int Gia_ManLevelWithBoxes_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaTim.c:452
int Tim_ManPoNum(Tim_Man_t *p)
Definition: timMan.c:694
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
static void Gia_ObjSetLevel(Gia_Man_t *p, Gia_Obj_t *pObj, int l)
Definition: gia.h:503
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
float * Tim_ManBoxDelayTable(Tim_Man_t *p, int iBox)
Definition: timBox.c:234
void Gia_ManLoadValue ( Gia_Man_t p,
Vec_Int_t vValues 
)

Definition at line 1615 of file giaUtil.c.

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

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

Synopsis [Prints mapping statistics.]

Description []

SideEffects []

SeeAlso []

Definition at line 106 of file giaIf.c.

107 {
108  int i, Counter = 0;
109  Gia_ManForEachLut( p, i )
110  Counter += Gia_ObjLutSize(p, i);
111  return Counter;
112 }
#define Gia_ManForEachLut(p, i)
Definition: gia.h:968
static int Gia_ObjLutSize(Gia_Man_t *p, int Id)
Definition: gia.h:953
static int Counter
int Gia_ManLutLevel ( Gia_Man_t p)

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

Synopsis [Prints mapping statistics.]

Description []

SideEffects []

SeeAlso []

Definition at line 163 of file giaIf.c.

164 {
165  Gia_Obj_t * pObj;
166  int i, k, iFan, Level;
167  int * pLevels = ABC_CALLOC( int, Gia_ManObjNum(p) );
168  Gia_ManForEachLut( p, i )
169  {
170  Level = 0;
171  Gia_LutForEachFanin( p, i, iFan, k )
172  if ( Level < pLevels[iFan] )
173  Level = pLevels[iFan];
174  pLevels[i] = Level + 1;
175  }
176  Level = 0;
177  Gia_ManForEachCo( p, pObj, k )
178  if ( Level < pLevels[Gia_ObjFaninId0p(p, pObj)] )
179  Level = pLevels[Gia_ObjFaninId0p(p, pObj)];
180  ABC_FREE( pLevels );
181  return Level;
182 }
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
Definition: gia.h:75
#define Gia_ManForEachLut(p, i)
Definition: gia.h:968
if(last==0)
Definition: sparse_int.h:34
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
static int Gia_ObjFaninId0p(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:463
#define Gia_LutForEachFanin(p, i, iFan, k)
Definition: gia.h:970
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
int Gia_ManLutLevelWithBoxes ( Gia_Man_t p)

Definition at line 572 of file giaTim.c.

573 {
574 // int nAnd2Delay = p->nAnd2Delay ? p->nAnd2Delay : 1;
575  Tim_Man_t * pManTime = (Tim_Man_t *)p->pManTime;
576  Gia_Obj_t * pObj, * pObjIn;
577  int i, k, j, curCi, curCo, LevelMax;
578  assert( Gia_ManRegNum(p) == 0 );
579  // copy const and real PIs
581  Gia_ObjSetLevel( p, Gia_ManConst0(p), 0 );
584  for ( i = 0; i < Tim_ManPiNum(pManTime); i++ )
585  {
586  pObj = Gia_ManCi( p, i );
587 // Gia_ObjSetLevel( p, pObj, Tim_ManGetCiArrival(pManTime, i) / nAnd2Delay );
588  Gia_ObjSetLevel( p, pObj, 0 );
589  Gia_ObjSetTravIdCurrent( p, pObj );
590  }
591  // create logic for each box
592  curCi = Tim_ManPiNum(pManTime);
593  curCo = 0;
594  for ( i = 0; i < Tim_ManBoxNum(pManTime); i++ )
595  {
596  int nBoxInputs = Tim_ManBoxInputNum( pManTime, i );
597  int nBoxOutputs = Tim_ManBoxOutputNum( pManTime, i );
598  float * pDelayTable = Tim_ManBoxDelayTable( pManTime, i );
599  // compute level for TFI of box inputs
600  for ( k = 0; k < nBoxInputs; k++ )
601  {
602  pObj = Gia_ManCo( p, curCo + k );
604  {
605  printf( "Boxes are not in a topological order. Switching to level computation without boxes.\n" );
606  return Gia_ManLevelNum( p );
607  }
608  // set box input level
609  Gia_ObjSetCoLevel( p, pObj );
610  }
611  // compute level for box outputs
612  for ( k = 0; k < nBoxOutputs; k++ )
613  {
614  pObj = Gia_ManCi( p, curCi + k );
615  Gia_ObjSetTravIdCurrent( p, pObj );
616  // evaluate delay of this output
617  LevelMax = 0;
618  assert( nBoxInputs == (int)pDelayTable[1] );
619  for ( j = 0; j < nBoxInputs && (pObjIn = Gia_ManCo(p, curCo + j)); j++ )
620  if ( (int)pDelayTable[3+k*nBoxInputs+j] != -ABC_INFINITY )
621 // LevelMax = Abc_MaxInt( LevelMax, Gia_ObjLevel(p, pObjIn) + ((int)pDelayTable[3+k*nBoxInputs+j] / nAnd2Delay) );
622  LevelMax = Abc_MaxInt( LevelMax, Gia_ObjLevel(p, pObjIn) + 1 );
623  // set box output level
624  Gia_ObjSetLevel( p, pObj, LevelMax );
625  }
626  curCo += nBoxInputs;
627  curCi += nBoxOutputs;
628  }
629  // add remaining nodes
630  p->nLevels = 0;
631  for ( i = Tim_ManCoNum(pManTime) - Tim_ManPoNum(pManTime); i < Tim_ManCoNum(pManTime); i++ )
632  {
633  pObj = Gia_ManCo( p, i );
635  Gia_ObjSetCoLevel( p, pObj );
636  p->nLevels = Abc_MaxInt( p->nLevels, Gia_ObjLevel(p, pObj) );
637  }
638  curCo += Tim_ManPoNum(pManTime);
639  // verify counts
640  assert( curCi == Gia_ManCiNum(p) );
641  assert( curCo == Gia_ManCoNum(p) );
642 // printf( "Max level is %d.\n", p->nLevels );
643  return p->nLevels;
644 }
int Tim_ManCoNum(Tim_Man_t *p)
Definition: timMan.c:684
int Gia_ManLutLevelWithBoxes_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaTim.c:553
static Gia_Obj_t * Gia_ManCi(Gia_Man_t *p, int v)
Definition: gia.h:403
int Tim_ManBoxOutputNum(Tim_Man_t *p, int iBox)
Definition: timBox.c:202
int nLevels
Definition: gia.h:116
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
Definition: gia.h:75
int Tim_ManPiNum(Tim_Man_t *p)
Definition: timMan.c:688
static int Gia_ObjLevel(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:501
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
void * pManTime
Definition: gia.h:165
void Gia_ManCleanLevels(Gia_Man_t *p, int Size)
Definition: giaUtil.c:470
int Tim_ManBoxNum(Tim_Man_t *p)
Definition: timMan.c:702
int Tim_ManBoxInputNum(Tim_Man_t *p, int iBox)
Definition: timBox.c:186
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
static Gia_Obj_t * Gia_ManCo(Gia_Man_t *p, int v)
Definition: gia.h:404
static void Gia_ObjSetCoLevel(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:504
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
#define assert(ex)
Definition: util_old.h:213
int Gia_ManLevelNum(Gia_Man_t *p)
Definition: giaUtil.c:505
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
int Tim_ManPoNum(Tim_Man_t *p)
Definition: timMan.c:694
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
static void Gia_ObjSetLevel(Gia_Man_t *p, Gia_Obj_t *pObj, int l)
Definition: gia.h:503
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
float * Tim_ManBoxDelayTable(Tim_Man_t *p, int iBox)
Definition: timBox.c:234
int Gia_ManLutNum ( Gia_Man_t p)

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

Synopsis [Prints mapping statistics.]

Description []

SideEffects []

SeeAlso []

Definition at line 144 of file giaIf.c.

145 {
146  int i, Counter = 0;
147  Gia_ManForEachLut( p, i )
148  Counter ++;
149  return Counter;
150 }
#define Gia_ManForEachLut(p, i)
Definition: gia.h:968
static int Counter
void Gia_ManLutParams ( Gia_Man_t p,
int *  pnCurLuts,
int *  pnCurEdges,
int *  pnCurLevels 
)

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

Synopsis [Prints mapping statistics.]

Description []

SideEffects []

SeeAlso []

Definition at line 195 of file giaIf.c.

196 {
197  if ( p->pManTime && Tim_ManBoxNum((Tim_Man_t *)p->pManTime) )
198  {
199  int i;
200  *pnCurLuts = 0;
201  *pnCurEdges = 0;
202  Gia_ManForEachLut( p, i )
203  {
204  (*pnCurLuts)++;
205  (*pnCurEdges) += Gia_ObjLutSize(p, i);
206  }
207  *pnCurLevels = Gia_ManLutLevelWithBoxes( p );
208  }
209  else
210  {
211  Gia_Obj_t * pObj;
212  int i, k, iFan;
213  int * pLevels = ABC_CALLOC( int, Gia_ManObjNum(p) );
214  *pnCurLuts = 0;
215  *pnCurEdges = 0;
216  Gia_ManForEachLut( p, i )
217  {
218  int Level = 0;
219  (*pnCurLuts)++;
220  (*pnCurEdges) += Gia_ObjLutSize(p, i);
221  Gia_LutForEachFanin( p, i, iFan, k )
222  if ( Level < pLevels[iFan] )
223  Level = pLevels[iFan];
224  pLevels[i] = Level + 1;
225  }
226  *pnCurLevels = 0;
227  Gia_ManForEachCo( p, pObj, k )
228  if ( *pnCurLevels < pLevels[Gia_ObjFaninId0p(p, pObj)] )
229  *pnCurLevels = pLevels[Gia_ObjFaninId0p(p, pObj)];
230  ABC_FREE( pLevels );
231  }
232 }
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
Definition: gia.h:75
#define Gia_ManForEachLut(p, i)
Definition: gia.h:968
static int Gia_ObjLutSize(Gia_Man_t *p, int Id)
Definition: gia.h:953
if(last==0)
Definition: sparse_int.h:34
void * pManTime
Definition: gia.h:165
int Tim_ManBoxNum(Tim_Man_t *p)
Definition: timMan.c:702
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
static int Gia_ObjFaninId0p(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:463
int Gia_ManLutLevelWithBoxes(Gia_Man_t *p)
Definition: giaTim.c:572
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
#define Gia_LutForEachFanin(p, i, iFan, k)
Definition: gia.h:970
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
int Gia_ManLutSizeMax ( Gia_Man_t p)

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

Synopsis [Prints mapping statistics.]

Description []

SideEffects []

SeeAlso []

Definition at line 125 of file giaIf.c.

126 {
127  int i, nSizeMax = -1;
128  Gia_ManForEachLut( p, i )
129  nSizeMax = Abc_MaxInt( nSizeMax, Gia_ObjLutSize(p, i) );
130  return nSizeMax;
131 }
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
#define Gia_ManForEachLut(p, i)
Definition: gia.h:968
static int Gia_ObjLutSize(Gia_Man_t *p, int Id)
Definition: gia.h:953
void Gia_ManMappingVerify ( Gia_Man_t p)

Definition at line 1807 of file giaIf.c.

1808 {
1809  Gia_Obj_t * pObj, * pFanin;
1810  int i, Result = 1;
1811  assert( Gia_ManHasMapping(p) );
1813  Gia_ManForEachBuf( p, pObj, i )
1814  {
1815  pFanin = Gia_ObjFanin0(pObj);
1816  if ( !Gia_ObjIsAndNotBuf(pFanin) )
1817  continue;
1818  if ( !Gia_ObjIsLut(p, Gia_ObjId(p, pFanin)) )
1819  {
1820  Abc_Print( -1, "Gia_ManMappingVerify: CO driver %d does not have mapping.\n", Gia_ObjId(p, pFanin) );
1821  Result = 0;
1822  continue;
1823  }
1824  Result &= Gia_ManMappingVerify_rec( p, pFanin );
1825  }
1826  Gia_ManForEachCo( p, pObj, i )
1827  {
1828  pFanin = Gia_ObjFanin0(pObj);
1829  if ( !Gia_ObjIsAndNotBuf(pFanin) )
1830  continue;
1831  if ( !Gia_ObjIsLut(p, Gia_ObjId(p, pFanin)) )
1832  {
1833  Abc_Print( -1, "Gia_ManMappingVerify: CO driver %d does not have mapping.\n", Gia_ObjId(p, pFanin) );
1834  Result = 0;
1835  continue;
1836  }
1837  Result &= Gia_ManMappingVerify_rec( p, pFanin );
1838  }
1839 // if ( Result && Gia_NtkIsRoot(p) )
1840 // Abc_Print( 1, "Mapping verified correctly.\n" );
1841 }
static int Gia_ObjIsAndNotBuf(Gia_Obj_t *pObj)
Definition: gia.h:428
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
int Gia_ManMappingVerify_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaIf.c:1788
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static int Gia_ManHasMapping(Gia_Man_t *p)
Definition: gia.h:951
#define Gia_ManForEachBuf(p, pObj, i)
Definition: gia.h:998
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjIsLut(Gia_Man_t *p, int Id)
Definition: gia.h:952
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
Gia_Man_t* Gia_ManMapShrink4 ( Gia_Man_t p,
int  fKeepLevel,
int  fVerbose 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Performs AIG shrinking using the current mapping.]

Description []

SideEffects []

SeeAlso []

Definition at line 49 of file giaShrink.c.

50 {
51  Vec_Int_t * vLeaves, * vTruth, * vVisited, * vLeavesBest;
52  Gia_Man_t * pNew, * pTemp;
53  Gia_Obj_t * pObj, * pFanin;
54  unsigned * pTruth;
55  int i, k, iFan;
56  abctime clk = Abc_Clock();
57 // int ClassCounts[222] = {0};
58  int * pLutClass, Counter = 0;
60  if ( Gia_ManLutSizeMax( p ) > 4 )
61  {
62  printf( "Resynthesis is not performed when nodes have more than 4 inputs.\n" );
63  return NULL;
64  }
65  pLutClass = ABC_CALLOC( int, Gia_ManObjNum(p) );
66  vLeaves = Vec_IntAlloc( 0 );
67  vTruth = Vec_IntAlloc( (1<<16) );
68  vVisited = Vec_IntAlloc( 0 );
69  vLeavesBest = Vec_IntAlloc( 4 );
70  // prepare the library
71  Dar_LibPrepare( 5 );
72  // clean the old manager
73  Gia_ManCleanTruth( p );
74  Gia_ManSetPhase( p );
75  Gia_ManFillValue( p );
76  Gia_ManConst0(p)->Value = 0;
77  // start the new manager
78  pNew = Gia_ManStart( Gia_ManObjNum(p) );
79  pNew->pName = Abc_UtilStrsav( p->pName );
80  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
81  Gia_ManHashAlloc( pNew );
83  Gia_ManForEachObj1( p, pObj, i )
84  {
85  if ( Gia_ObjIsCi(pObj) )
86  {
87  pObj->Value = Gia_ManAppendCi( pNew );
88  if ( p->vLevels )
89  Gia_ObjSetLevel( pNew, Gia_ObjFromLit(pNew, Gia_ObjValue(pObj)), Gia_ObjLevel(p, pObj) );
90  }
91  else if ( Gia_ObjIsCo(pObj) )
92  {
93  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
94  }
95  else if ( Gia_ObjIsLut(p, i) )
96  {
97  Counter++;
98  // collect leaves of this gate
99  Vec_IntClear( vLeaves );
100  Gia_LutForEachFanin( p, i, iFan, k )
101  Vec_IntPush( vLeaves, iFan );
102  for ( ; k < 4; k++ )
103  Vec_IntPush( vLeaves, 0 );
104  //.compute the truth table
105  pTruth = Gia_ManConvertAigToTruth( p, pObj, vLeaves, vTruth, vVisited );
106  // change from node IDs to their literals
107  Gia_ManForEachObjVec( vLeaves, p, pFanin, k )
108  {
109 // assert( Gia_ObjValue(pFanin) != ~0 );
110  Vec_IntWriteEntry( vLeaves, k, Gia_ObjValue(pFanin) != ~0 ? Gia_ObjValue(pFanin) : 0 );
111  }
112  // derive new structre
113  if ( Gia_ManTruthIsConst0(pTruth, Vec_IntSize(vLeaves)) )
114  pObj->Value = 0;
115  else if ( Gia_ManTruthIsConst1(pTruth, Vec_IntSize(vLeaves)) )
116  pObj->Value = 1;
117  else
118  {
119  pObj->Value = Dar_LibEvalBuild( pNew, vLeaves, 0xffff & *pTruth, fKeepLevel, vLeavesBest );
120  pObj->Value = Abc_LitNotCond( pObj->Value, Gia_ObjPhaseRealLit(pNew, pObj->Value) ^ pObj->fPhase );
121  }
122  }
123  }
124  // cleanup the AIG
125  Gia_ManHashStop( pNew );
126  // check the presence of dangling nodes
127  if ( Gia_ManHasDangling(pNew) )
128  {
129  pNew = Gia_ManCleanup( pTemp = pNew );
130  if ( fVerbose && Gia_ManAndNum(pNew) != Gia_ManAndNum(pTemp) )
131  printf( "Gia_ManMapShrink4() node reduction after sweep %6d -> %6d.\n", Gia_ManAndNum(pTemp), Gia_ManAndNum(pNew) );
132  Gia_ManStop( pTemp );
133  }
134  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
135  Vec_IntFree( vLeaves );
136  Vec_IntFree( vTruth );
137  Vec_IntFree( vVisited );
138  Vec_IntFree( vLeavesBest );
139  if ( fVerbose )
140  {
141  printf( "Total gain in AIG nodes = %d. ", Gia_ManObjNum(p)-Gia_ManObjNum(pNew) );
142  ABC_PRT( "Total runtime", Abc_Clock() - clk );
143  }
144  ABC_FREE( pLutClass );
145  return pNew;
146 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Gia_Obj_t * Gia_ObjFromLit(Gia_Man_t *p, int iLit)
Definition: gia.h:496
static int Gia_ObjPhaseRealLit(Gia_Man_t *p, int iLit)
Definition: gia.h:498
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
static int Gia_ObjValue(Gia_Obj_t *pObj)
Definition: gia.h:413
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
static abctime Abc_Clock()
Definition: abc_global.h:279
void Gia_ManCleanTruth(Gia_Man_t *p)
Definition: giaUtil.c:487
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
for(p=first;p->value< newval;p=p->next)
Definition: gia.h:75
ABC_NAMESPACE_IMPL_START int Dar_LibEvalBuild(Gia_Man_t *p, Vec_Int_t *vCut, unsigned uTruth, int fKeepLevel, Vec_Int_t *vLeavesBest)
DECLARATIONS ///.
Definition: darLib.c:1329
int Gia_ManHasDangling(Gia_Man_t *p)
Definition: giaUtil.c:1155
static int Gia_ManTruthIsConst0(unsigned *pIn, int nVars)
Definition: gia.h:330
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
static int Gia_ObjLevel(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:501
char * pName
Definition: gia.h:97
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
unsigned * Gia_ManConvertAigToTruth(Gia_Man_t *p, Gia_Obj_t *pRoot, Vec_Int_t *vLeaves, Vec_Int_t *vTruth, Vec_Int_t *vVisited)
Definition: giaBidec.c:90
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
void Gia_ManCleanLevels(Gia_Man_t *p, int Size)
Definition: giaUtil.c:470
static int Counter
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
int Gia_ManLutSizeMax(Gia_Man_t *p)
Definition: giaIf.c:125
void Dar_LibPrepare(int nSubgraphs)
Definition: darLib.c:478
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition: gia.h:988
static int Gia_ManTruthIsConst1(unsigned *pIn, int nVars)
Definition: gia.h:338
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Gia_ManHasMapping(Gia_Man_t *p)
Definition: gia.h:951
#define ABC_FREE(obj)
Definition: abc_global.h:232
Definition: gia.h:95
#define ABC_PRT(a, t)
Definition: abc_global.h:220
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define assert(ex)
Definition: util_old.h:213
void Gia_ManSetPhase(Gia_Man_t *p)
Definition: giaUtil.c:379
unsigned Value
Definition: gia.h:87
Vec_Int_t * vLevels
Definition: gia.h:115
static int Gia_ObjIsLut(Gia_Man_t *p, int Id)
Definition: gia.h:952
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
#define Gia_ManForEachObj1(p, pObj, i)
Definition: gia.h:986
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
ABC_INT64_T abctime
Definition: abc_global.h:278
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Gia_LutForEachFanin(p, i, iFan, k)
Definition: gia.h:970
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
static void Gia_ObjSetLevel(Gia_Man_t *p, Gia_Obj_t *pObj, int l)
Definition: gia.h:503
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManMapShrink6 ( Gia_Man_t p,
int  nFanoutMax,
int  fKeepLevel,
int  fVerbose 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 401 of file giaShrink6.c.

402 {
403  Shr_Man_t * pMan;
404  Gia_Obj_t * pObj, * pFanin;
405  word uTruth, uTruth0, uTruth1;
406  int i, k, nDivs, iNode;
407  int RetValue, Counter1 = 0, Counter2 = 0;
408  abctime clk2, clk = Abc_Clock();
409  abctime timeFanout = 0;
411  pMan = Shr_ManAlloc( p );
412  Gia_ManFillValue( p );
413  Gia_ManConst0(p)->Value = 0;
414  Gia_ManForEachObj1( p, pObj, i )
415  {
416  if ( Gia_ObjIsCi(pObj) )
417  {
418  pObj->Value = Gia_ManAppendCi( pMan->pNew );
419  if ( p->vLevels )
420  Gia_ObjSetLevel( pMan->pNew, Gia_ObjFromLit(pMan->pNew, Gia_ObjValue(pObj)), Gia_ObjLevel(p, pObj) );
421  }
422  else if ( Gia_ObjIsCo(pObj) )
423  {
424  pObj->Value = Gia_ManAppendCo( pMan->pNew, Gia_ObjFanin0Copy(pObj) );
425  }
426  else if ( Gia_ObjIsLut(p, i) )
427  {
428  // collect leaves of this gate
429  Vec_IntClear( pMan->vLeaves );
430  Gia_LutForEachFanin( p, i, iNode, k )
431  Vec_IntPush( pMan->vLeaves, iNode );
432  assert( Vec_IntSize(pMan->vLeaves) <= 6 );
433  // compute truth table
434  uTruth = Shr_ManComputeTruth6( pMan->pGia, pObj, pMan->vLeaves, pMan->vTruths );
435  assert( pObj->Value == ~0 );
436  if ( uTruth == 0 || ~uTruth == 0 )
437  pObj->Value = Abc_LitNotCond( 0, ~uTruth == 0 );
438  else
439  Gia_ManForEachObjVec( pMan->vLeaves, p, pFanin, k )
440  if ( uTruth == Truth[k] || ~uTruth == Truth[k] )
441  pObj->Value = Abc_LitNotCond( pFanin->Value, ~uTruth == Truth[k] );
442  if ( pObj->Value != ~0 )
443  continue;
444  // translate into new nodes
445  Gia_ManForEachObjVec( pMan->vLeaves, p, pFanin, k )
446  {
447  if ( Abc_LitIsCompl(pFanin->Value) )
448  uTruth = ((uTruth & Truth[k]) >> (1 << k)) | ((uTruth & ~Truth[k]) << (1 << k));
449  Vec_IntWriteEntry( pMan->vLeaves, k, Abc_Lit2Var(pFanin->Value) );
450  }
451  // compute divisors
452  clk2 = Abc_Clock();
453  nDivs = Shr_ManCollectDivisors( pMan, pMan->vLeaves, pMan->nDivMax, nFanoutMax );
454  assert( nDivs <= pMan->nDivMax );
455  timeFanout += Abc_Clock() - clk2;
456  // compute truth tables
457  Shr_ManComputeTruths( pMan->pNew, Vec_IntSize(pMan->vLeaves), pMan->vDivs, pMan->vDivTruths, pMan->vTruths );
458  // perform resubstitution
459  RetValue = Rsb_ManPerformResub6( pMan->pManRsb, Vec_IntSize(pMan->vLeaves), uTruth, pMan->vDivTruths, &uTruth0, &uTruth1, 0 );
460  if ( RetValue ) // resub exists
461  {
462  Vec_Int_t * vResult = Rsb_ManGetFanins(pMan->pManRsb);
463  Vec_IntClear( pMan->vDivResub );
464  Vec_IntForEachEntry( vResult, iNode, k )
465  Vec_IntPush( pMan->vDivResub, Vec_IntEntry(pMan->vDivs, iNode) );
466  pObj->Value = Shr_ObjPerformBidec( pMan, pMan->pManDec, pMan->pNew, pMan->vDivResub, uTruth1, uTruth0 | uTruth1 );
467  Counter1++;
468  }
469  else
470  {
471  pObj->Value = Shr_ObjPerformBidec( pMan, pMan->pManDec, pMan->pNew, pMan->vLeaves, uTruth, ~(word)0 );
472  Counter2++;
473  }
474  }
475  }
476  if ( fVerbose )
477  {
478  printf( "Performed %d resubs and %d decomps. ", Counter1, Counter2 );
479  printf( "Gain in AIG nodes = %d. ", Gia_ManObjNum(p)-Gia_ManObjNum(pMan->pNew) );
480  ABC_PRT( "Runtime", Abc_Clock() - clk );
481 // ABC_PRT( "Divisors", timeFanout );
482  }
483  return Shr_ManFree( pMan );
484 }
Gia_Man_t * Shr_ManFree(Shr_Man_t *p)
Definition: giaShrink6.c:128
Vec_Wrd_t * vTruths
Definition: giaShrink6.c:69
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Gia_Obj_t * Gia_ObjFromLit(Gia_Man_t *p, int iLit)
Definition: gia.h:496
Vec_Int_t * vLeaves
Definition: giaShrink6.c:67
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
static int Gia_ObjValue(Gia_Obj_t *pObj)
Definition: gia.h:413
int Shr_ObjPerformBidec(Shr_Man_t *p, Bdc_Man_t *pManDec, Gia_Man_t *pNew, Vec_Int_t *vLeafLits, word uTruth1, word uTruthC)
Definition: giaShrink6.c:275
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
Definition: gia.h:75
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Gia_ObjLevel(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:501
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
Vec_Int_t * vDivs
Definition: giaShrink6.c:64
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
Rsb_Man_t * pManRsb
Definition: giaShrink6.c:72
if(last==0)
Definition: sparse_int.h:34
Vec_Wrd_t * vDivTruths
Definition: giaShrink6.c:70
else
Definition: sparse_int.h:55
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
word Shr_ManComputeTruth6(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vLeaves, Vec_Wrd_t *vTruths)
Definition: giaShrink6.c:335
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
int nDivMax
Definition: giaShrink6.c:57
static int Shr_ManCollectDivisors(Shr_Man_t *p, Vec_Int_t *vLeaves, int Limit, int nFanoutMax)
Definition: giaShrink6.c:223
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition: gia.h:988
Shr_Man_t * Shr_ManAlloc(Gia_Man_t *pGia)
FUNCTION DEFINITIONS ///.
Definition: giaShrink6.c:96
static ABC_NAMESPACE_IMPL_START word Truth[8]
DECLARATIONS ///.
Definition: giaShrink6.c:32
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Gia_ManHasMapping(Gia_Man_t *p)
Definition: gia.h:951
#define ABC_PRT(a, t)
Definition: abc_global.h:220
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
Vec_Int_t * vDivResub
Definition: giaShrink6.c:66
Vec_Int_t * Rsb_ManGetFanins(Rsb_Man_t *p)
Definition: rsbMan.c:84
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
Vec_Int_t * vLevels
Definition: gia.h:115
static int Gia_ObjIsLut(Gia_Man_t *p, int Id)
Definition: gia.h:952
#define Gia_ManForEachObj1(p, pObj, i)
Definition: gia.h:986
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
ABC_INT64_T abctime
Definition: abc_global.h:278
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
int Rsb_ManPerformResub6(Rsb_Man_t *p, int nVars, word uTruth, Vec_Wrd_t *vDivTruths, word *puTruth0, word *puTruth1, int fVerbose)
Definition: rsbDec6.c:694
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
void Shr_ManComputeTruths(Gia_Man_t *p, int nVars, Vec_Int_t *vDivs, Vec_Wrd_t *vDivTruths, Vec_Wrd_t *vTruths)
Definition: giaShrink6.c:359
#define Gia_LutForEachFanin(p, i, iFan, k)
Definition: gia.h:970
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
Gia_Man_t * pNew
Definition: giaShrink6.c:56
static void Gia_ObjSetLevel(Gia_Man_t *p, Gia_Obj_t *pObj, int l)
Definition: gia.h:503
int Gia_ManMarkDangling ( Gia_Man_t p)

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

Synopsis [Returns 1 if AIG has dangling nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1193 of file giaUtil.c.

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

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 1553 of file giaUtil.c.

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

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

Synopsis [Returns memory used in megabytes.]

Description []

SideEffects []

SeeAlso []

Definition at line 156 of file giaMan.c.

157 {
158  double Memory = sizeof(Gia_Man_t);
159  Memory += sizeof(Gia_Obj_t) * Gia_ManObjNum(p);
160  Memory += sizeof(int) * Gia_ManCiNum(p);
161  Memory += sizeof(int) * Gia_ManCoNum(p);
162  Memory += sizeof(int) * p->nHTable * (p->pHTable != NULL);
163  return Memory;
164 }
int * pHTable
Definition: gia.h:110
struct Gia_Obj_t_ Gia_Obj_t
Definition: gia.h:74
int nHTable
Definition: gia.h:111
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
struct Gia_Man_t_ Gia_Man_t
Definition: gia.h:94
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
Gia_Man_t* Gia_ManMiter ( Gia_Man_t p0,
Gia_Man_t p1,
int  nInsDup,
int  fDualOut,
int  fSeq,
int  fImplic,
int  fVerbose 
)

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

Synopsis [Creates miter of two designs.]

Description []

SideEffects []

SeeAlso []

Definition at line 2128 of file giaDup.c.

2129 {
2130  Gia_Man_t * pNew, * pTemp;
2131  Gia_Obj_t * pObj;
2132  int i, iLit;
2133  if ( fSeq )
2134  {
2135  if ( Gia_ManPiNum(p0) != Gia_ManPiNum(p1) )
2136  {
2137  printf( "Gia_ManMiter(): Designs have different number of PIs.\n" );
2138  return NULL;
2139  }
2140  if ( Gia_ManPoNum(p0) != Gia_ManPoNum(p1) )
2141  {
2142  printf( "Gia_ManMiter(): Designs have different number of POs.\n" );
2143  return NULL;
2144  }
2145  if ( Gia_ManRegNum(p0) == 0 || Gia_ManRegNum(p1) == 0 )
2146  {
2147  printf( "Gia_ManMiter(): At least one of the designs has no registers.\n" );
2148  return NULL;
2149  }
2150  }
2151  else
2152  {
2153  if ( Gia_ManCiNum(p0) != Gia_ManCiNum(p1) )
2154  {
2155  printf( "Gia_ManMiter(): Designs have different number of CIs.\n" );
2156  return NULL;
2157  }
2158  if ( Gia_ManCoNum(p0) != Gia_ManCoNum(p1) )
2159  {
2160  printf( "Gia_ManMiter(): Designs have different number of COs.\n" );
2161  return NULL;
2162  }
2163  }
2164  // start the manager
2165  pNew = Gia_ManStart( Gia_ManObjNum(p0) + Gia_ManObjNum(p1) );
2166  pNew->pName = Abc_UtilStrsav( "miter" );
2167  // map combinational inputs
2168  Gia_ManFillValue( p0 );
2169  Gia_ManFillValue( p1 );
2170  Gia_ManConst0(p0)->Value = 0;
2171  Gia_ManConst0(p1)->Value = 0;
2172  // map internal nodes and outputs
2173  Gia_ManHashAlloc( pNew );
2174  if ( fSeq )
2175  {
2176  // create primary inputs
2177  Gia_ManForEachPi( p0, pObj, i )
2178  pObj->Value = Gia_ManAppendCi( pNew );
2179  Gia_ManForEachPi( p1, pObj, i )
2180  if ( i < Gia_ManPiNum(p1) - nInsDup )
2181  pObj->Value = Gia_ObjToLit( pNew, Gia_ManPi(pNew, i) );
2182  else
2183  pObj->Value = Gia_ManAppendCi( pNew );
2184  // create latch outputs
2185  Gia_ManForEachRo( p0, pObj, i )
2186  pObj->Value = Gia_ManAppendCi( pNew );
2187  Gia_ManForEachRo( p1, pObj, i )
2188  pObj->Value = Gia_ManAppendCi( pNew );
2189  // create primary outputs
2190  Gia_ManForEachPo( p0, pObj, i )
2191  {
2192  Gia_ManMiter_rec( pNew, p0, Gia_ObjFanin0(pObj) );
2193  Gia_ManMiter_rec( pNew, p1, Gia_ObjFanin0(Gia_ManPo(p1,i)) );
2194  if ( fDualOut )
2195  {
2196  Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
2198  }
2199  else if ( fImplic )
2200  {
2202  Gia_ManAppendCo( pNew, iLit );
2203  }
2204  else
2205  {
2206  iLit = Gia_ManHashXor( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin0Copy(Gia_ManPo(p1,i)) );
2207  Gia_ManAppendCo( pNew, iLit );
2208  }
2209  }
2210  // create register inputs
2211  Gia_ManForEachRi( p0, pObj, i )
2212  {
2213  Gia_ManMiter_rec( pNew, p0, Gia_ObjFanin0(pObj) );
2214  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
2215  }
2216  Gia_ManForEachRi( p1, pObj, i )
2217  {
2218  Gia_ManMiter_rec( pNew, p1, Gia_ObjFanin0(pObj) );
2219  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
2220  }
2221  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p0) + Gia_ManRegNum(p1) );
2222  }
2223  else
2224  {
2225  // create combinational inputs
2226  Gia_ManForEachCi( p0, pObj, i )
2227  pObj->Value = Gia_ManAppendCi( pNew );
2228  Gia_ManForEachCi( p1, pObj, i )
2229  if ( i < Gia_ManCiNum(p1) - nInsDup )
2230  pObj->Value = Gia_ObjToLit( pNew, Gia_ManCi(pNew, i) );
2231  else
2232  pObj->Value = Gia_ManAppendCi( pNew );
2233  // create combinational outputs
2234  Gia_ManForEachCo( p0, pObj, i )
2235  {
2236  Gia_ManMiter_rec( pNew, p0, Gia_ObjFanin0(pObj) );
2237  Gia_ManMiter_rec( pNew, p1, Gia_ObjFanin0(Gia_ManCo(p1,i)) );
2238  if ( fDualOut )
2239  {
2240  Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
2242  }
2243  else if ( fImplic )
2244  {
2246  Gia_ManAppendCo( pNew, iLit );
2247  }
2248  else
2249  {
2250  iLit = Gia_ManHashXor( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin0Copy(Gia_ManCo(p1,i)) );
2251  Gia_ManAppendCo( pNew, iLit );
2252  }
2253  }
2254  }
2255  Gia_ManHashStop( pNew );
2256  pNew = Gia_ManCleanup( pTemp = pNew );
2257  Gia_ManStop( pTemp );
2258 
2259  pNew = Gia_ManDupNormalize( pTemp = pNew );
2260  Gia_ManStop( pTemp );
2261  return pNew;
2262 }
static int Gia_ObjToLit(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:497
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static Gia_Obj_t * Gia_ManCi(Gia_Man_t *p, int v)
Definition: gia.h:403
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
int Gia_ManHashXor(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:658
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
Definition: gia.h:75
int Gia_ManMiter_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaDup.c:2107
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
static Gia_Obj_t * Gia_ManPi(Gia_Man_t *p, int v)
Definition: gia.h:405
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
char * pName
Definition: gia.h:97
Gia_Man_t * Gia_ManDupNormalize(Gia_Man_t *p)
Definition: giaTim.c:134
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
static int Abc_LitNot(int Lit)
Definition: abc_global.h:266
static Gia_Obj_t * Gia_ManCo(Gia_Man_t *p, int v)
Definition: gia.h:404
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define Gia_ManForEachRo(p, pObj, i)
Definition: gia.h:1038
unsigned Value
Definition: gia.h:87
#define Gia_ManForEachRi(p, pObj, i)
Definition: gia.h:1040
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManMiter2 ( Gia_Man_t pStart,
char *  pInit,
int  fVerbose 
)

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

Synopsis [Creates miter of two designs.]

Description []

SideEffects []

SeeAlso []

Definition at line 2462 of file giaDup.c.

2463 {
2464  Vec_Int_t * vCiValues, * vCoValues0, * vCoValues1;
2465  Gia_Man_t * pNew, * pUndc, * pTemp;
2466  Gia_Obj_t * pObj;
2467  char * pInitNew;
2468  int i, k;
2469  // check PI values
2470  for ( i = 0; i < Gia_ManPiNum(pStart); i++ )
2471  assert( pInit[i] == 'x' || pInit[i] == 'X' );
2472  // normalize the manager
2473  pUndc = Gia_ManDupZeroUndc( pStart, pInit + Gia_ManPiNum(pStart), fVerbose );
2474  // create new init string
2475  pInitNew = ABC_ALLOC( char, Gia_ManPiNum(pUndc)+1 );
2476  for ( i = 0; i < Gia_ManPiNum(pStart); i++ )
2477  pInitNew[i] = pInit[i];
2478  for ( i = k = Gia_ManPiNum(pStart); i < Gia_ManCiNum(pStart); i++ )
2479  if ( pInit[i] == 'x' || pInit[i] == 'X' )
2480  pInitNew[k++] = pInit[i];
2481  pInitNew[k] = 0;
2482  assert( k == Gia_ManPiNum(pUndc) );
2483  // derive miter
2484  pNew = Gia_ManStart( Gia_ManObjNum(pUndc) );
2485  pNew->pName = Abc_UtilStrsav( pUndc->pName );
2486  pNew->pSpec = Abc_UtilStrsav( pUndc->pSpec );
2487  Gia_ManConst0(pUndc)->Value = 0;
2488  Gia_ManHashAlloc( pNew );
2489  // add PIs of the first side
2490  Gia_ManForEachPi( pUndc, pObj, i )
2491  pObj->Value = Gia_ManAppendCi( pNew );
2492  // add PIs of the second side
2493  vCiValues = Vec_IntAlloc( Gia_ManPiNum(pUndc) );
2494  Gia_ManForEachPi( pUndc, pObj, i )
2495  if ( pInitNew[i] == 'x' )
2496  Vec_IntPush( vCiValues, Gia_Obj2Lit( pNew, Gia_ManPi(pNew, i) ) );
2497  else if ( pInitNew[i] == 'X' )
2498  Vec_IntPush( vCiValues, Gia_ManAppendCi( pNew ) );
2499  else assert( 0 );
2500  // build flops and internal nodes
2501  Gia_ManForEachRo( pUndc, pObj, i )
2502  pObj->Value = Gia_ManAppendCi( pNew );
2503  Gia_ManForEachAnd( pUndc, pObj, i )
2504  pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
2505  // collect CO values
2506  vCoValues0 = Vec_IntAlloc( Gia_ManPoNum(pUndc) );
2507  Gia_ManForEachCo( pUndc, pObj, i )
2508  Vec_IntPush( vCoValues0, Gia_ObjFanin0Copy(pObj) );
2509  // build the other side
2510  Gia_ManForEachPi( pUndc, pObj, i )
2511  pObj->Value = Vec_IntEntry( vCiValues, i );
2512  Gia_ManForEachRo( pUndc, pObj, i )
2513  pObj->Value = Gia_ManAppendCi( pNew );
2514  Gia_ManForEachAnd( pUndc, pObj, i )
2515  pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
2516  // collect CO values
2517  vCoValues1 = Vec_IntAlloc( Gia_ManPoNum(pUndc) );
2518  Gia_ManForEachCo( pUndc, pObj, i )
2519  Vec_IntPush( vCoValues1, Gia_ObjFanin0Copy(pObj) );
2520  // create POs
2521  Gia_ManForEachPo( pUndc, pObj, i )
2522  pObj->Value = Gia_ManAppendCo( pNew, Gia_ManHashXor( pNew, Vec_IntEntry(vCoValues0, i), Vec_IntEntry(vCoValues1, i) ) );
2523  // create flop inputs
2524  Gia_ManForEachRi( pUndc, pObj, i )
2525  pObj->Value = Gia_ManAppendCo( pNew, Vec_IntEntry(vCoValues0, Gia_ManPoNum(pUndc)+i) );
2526  Gia_ManForEachRi( pUndc, pObj, i )
2527  pObj->Value = Gia_ManAppendCo( pNew, Vec_IntEntry(vCoValues1, Gia_ManPoNum(pUndc)+i) );
2528  Vec_IntFree( vCoValues0 );
2529  Vec_IntFree( vCoValues1 );
2530  Vec_IntFree( vCiValues );
2531  ABC_FREE( pInitNew );
2532  // cleanup
2533  Gia_ManHashStop( pNew );
2534  Gia_ManSetRegNum( pNew, 2*Gia_ManRegNum(pUndc) );
2535  Gia_ManStop( pUndc );
2536  pNew = Gia_ManCleanup( pTemp = pNew );
2537  Gia_ManStop( pTemp );
2538  return pNew;
2539 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
int Gia_ManHashXor(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:658
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
Definition: gia.h:75
static Gia_Obj_t * Gia_ManPi(Gia_Man_t *p, int v)
Definition: gia.h:405
char * pName
Definition: gia.h:97
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
if(last==0)
Definition: sparse_int.h:34
char * pSpec
Definition: gia.h:98
else
Definition: sparse_int.h:55
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
Gia_Man_t * Gia_ManDupZeroUndc(Gia_Man_t *p, char *pInit, int fVerbose)
Definition: giaDup.c:2390
#define ABC_FREE(obj)
Definition: abc_global.h:232
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define Gia_ManForEachRo(p, pObj, i)
Definition: gia.h:1038
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
#define Gia_ManForEachRi(p, pObj, i)
Definition: gia.h:1040
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
static int Gia_Obj2Lit(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:433
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
static int Gia_ManMuxNum ( Gia_Man_t p)
inlinestatic

Definition at line 391 of file gia.h.

391 { return p->nMuxes; }
int nMuxes
Definition: gia.h:106
static char* Gia_ManName ( Gia_Man_t p)
inlinestatic

Definition at line 382 of file gia.h.

382 { return p->pName; }
char * pName
Definition: gia.h:97
int Gia_ManNonRegBoxNum ( Gia_Man_t p)

Definition at line 57 of file giaTim.c.

58 {
59  return Gia_ManBoxNum(p) - Gia_ManRegBoxNum(p);
60 }
ABC_NAMESPACE_IMPL_START int Gia_ManBoxNum(Gia_Man_t *p)
DECLARATIONS ///.
Definition: giaTim.c:49
int Gia_ManRegBoxNum(Gia_Man_t *p)
Definition: giaTim.c:53
static Gia_Obj_t* Gia_ManObj ( Gia_Man_t p,
int  v 
)
inlinestatic

Definition at line 402 of file gia.h.

402 { assert( v >= 0 && v < p->nObjs ); return p->pObjs + v; }
Gia_Obj_t * pObjs
Definition: gia.h:103
#define assert(ex)
Definition: util_old.h:213
static int Gia_ManObjIsConst0 ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 431 of file gia.h.

431 { return pObj == p->pObjs; }
Gia_Obj_t * pObjs
Definition: gia.h:103
static int Gia_ManObjNum ( Gia_Man_t p)
inlinestatic

Definition at line 388 of file gia.h.

388 { return p->nObjs; }
int nObjs
Definition: gia.h:101
Vec_Int_t* Gia_ManOrderReverse ( Gia_Man_t p)

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

Synopsis [Computes reverse topological order.]

Description [Assumes that levels are already assigned. The levels of CO nodes may not be assigned.]

SideEffects []

SeeAlso []

Definition at line 407 of file giaDfs.c.

408 {
409  Gia_Obj_t * pObj;
410  Vec_Vec_t * vLevels;
411  Vec_Ptr_t * vLevel;
412  Vec_Int_t * vResult;
413  int i, k;
414  vLevels = Vec_VecStart( 100 );
415  // make sure levels are assigned
416  Gia_ManForEachAnd( p, pObj, i )
417  assert( Gia_ObjLevel(p, pObj) > 0 );
418  // add CO nodes based on the level of their fanin
419  Gia_ManForEachCo( p, pObj, i )
420  Vec_VecPush( vLevels, Gia_ObjLevel(p, Gia_ObjFanin0(pObj)), pObj );
421  // add other nodes based on their level
422  Gia_ManForEachObj( p, pObj, i )
423  if ( !Gia_ObjIsCo(pObj) )
424  Vec_VecPush( vLevels, Gia_ObjLevel(p, pObj), pObj );
425  // put the nodes in the reverse topological order
426  vResult = Vec_IntAlloc( Gia_ManObjNum(p) );
427  Vec_VecForEachLevelReverse( vLevels, vLevel, i )
428  Vec_PtrForEachEntry( Gia_Obj_t *, vLevel, pObj, k )
429  Vec_IntPush( vResult, Gia_ObjId(p, pObj) );
430  Vec_VecFree( vLevels );
431  return vResult;
432 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static void Vec_VecPush(Vec_Vec_t *p, int Level, void *Entry)
Definition: vecVec.h:456
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
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
static void Vec_VecFree(Vec_Vec_t *p)
Definition: vecVec.h:347
Definition: gia.h:75
static int Gia_ObjLevel(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:501
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
if(last==0)
Definition: sparse_int.h:34
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static Vec_Vec_t * Vec_VecStart(int nSize)
Definition: vecVec.h:168
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
#define Vec_VecForEachLevelReverse(vGlob, vVec, i)
Definition: vecVec.h:63
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static void Gia_ManPatchCoDriver ( Gia_Man_t p,
int  iCoIndex,
int  iLit0 
)
inlinestatic

Definition at line 739 of file gia.h.

740 {
741  Gia_Obj_t * pObjCo = Gia_ManCo( p, iCoIndex );
742  assert( Gia_ObjId(p, pObjCo) > Abc_Lit2Var(iLit0) );
743  pObjCo->iDiff0 = Gia_ObjId(p, pObjCo) - Abc_Lit2Var(iLit0);
744  pObjCo->fCompl0 = Abc_LitIsCompl(iLit0);
745 }
unsigned iDiff0
Definition: gia.h:77
Definition: gia.h:75
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static Gia_Obj_t * Gia_ManCo(Gia_Man_t *p, int v)
Definition: gia.h:404
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
#define assert(ex)
Definition: util_old.h:213
unsigned fCompl0
Definition: gia.h:78
Gia_Man_t* Gia_ManPerformBidec ( Gia_Man_t p,
int  fVerbose 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 233 of file giaBidec.c.

234 {
235  Bdc_Man_t * pManDec;
236  Bdc_Par_t Pars = {0}, * pPars = &Pars;
237  Vec_Int_t * vLeaves, * vTruth, * vVisited;
238  Gia_Man_t * pNew, * pTemp;
239  Gia_Obj_t * pObj;
240  int i;//, clk = Abc_Clock();
241  pPars->nVarsMax = Gia_ManLutSizeMax( p );
242  pPars->fVerbose = fVerbose;
243  if ( pPars->nVarsMax < 2 )
244  {
245  printf( "Resynthesis is not performed when nodes have less than 2 inputs.\n" );
246  return NULL;
247  }
248  if ( pPars->nVarsMax > 15 )
249  {
250  printf( "Resynthesis is not performed when nodes have more than 15 inputs.\n" );
251  return NULL;
252  }
253  vLeaves = Vec_IntAlloc( 0 );
254  vTruth = Vec_IntAlloc( (1<<16) );
255  vVisited = Vec_IntAlloc( 0 );
256  // clean the old manager
257  Gia_ManCleanTruth( p );
258  Gia_ManFillValue( p );
259  Gia_ManConst0(p)->Value = 0;
260  // start the new manager
261  pNew = Gia_ManStart( Gia_ManObjNum(p) );
262  pNew->pName = Abc_UtilStrsav( p->pName );
263  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
264  Gia_ManHashAlloc( pNew );
265 // Gia_ManCleanLevels( pNew, Gia_ManObjNum(p) );
266  pManDec = Bdc_ManAlloc( pPars );
267  Gia_ManForEachObj1( p, pObj, i )
268  {
269  if ( Gia_ObjIsCi(pObj) ) // transfer the CI level (is it needed?)
270  pObj->Value = Gia_ManAppendCi( pNew );
271  else if ( Gia_ObjIsCo(pObj) )
272  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
273  else if ( Gia_ObjIsLut(p, i) )
274  pObj->Value = Gia_ObjPerformBidec( pManDec, pNew, p, pObj, vLeaves, vTruth, vVisited );
275  }
276  Bdc_ManFree( pManDec );
277  // cleanup the AIG
278  Gia_ManHashStop( pNew );
279  // check the presence of dangling nodes
280  if ( Gia_ManHasDangling(pNew) )
281  {
282  pNew = Gia_ManCleanup( pTemp = pNew );
283  if ( Gia_ManAndNum(pNew) != Gia_ManAndNum(pTemp) )
284  printf( "Gia_ManPerformBidec() node count before and after: %6d and %6d.\n", Gia_ManAndNum(pNew), Gia_ManAndNum(pTemp) );
285  Gia_ManStop( pTemp );
286  }
287  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
288  Vec_IntFree( vLeaves );
289  Vec_IntFree( vTruth );
290  Vec_IntFree( vVisited );
291  if ( fVerbose )
292  {
293 // printf( "Total gain in AIG nodes = %d. ", Gia_ManObjNum(p)-Gia_ManObjNum(pNew) );
294 // ABC_PRT( "Total runtime", Abc_Clock() - clk );
295  }
296  return pNew;
297 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
Bdc_Man_t * Bdc_ManAlloc(Bdc_Par_t *pPars)
MACRO DEFINITIONS ///.
Definition: bdcCore.c:68
int Gia_ObjPerformBidec(Bdc_Man_t *pManDec, Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pRoot, Vec_Int_t *vLeaves, Vec_Int_t *vTruth, Vec_Int_t *vVisited)
Definition: giaBidec.c:166
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
void Gia_ManCleanTruth(Gia_Man_t *p)
Definition: giaUtil.c:487
Definition: gia.h:75
int Gia_ManHasDangling(Gia_Man_t *p)
Definition: giaUtil.c:1155
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
char * pName
Definition: gia.h:97
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
int Gia_ManLutSizeMax(Gia_Man_t *p)
Definition: giaIf.c:125
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
Definition: bdc.h:45
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
unsigned Value
Definition: gia.h:87
void Bdc_ManFree(Bdc_Man_t *p)
Definition: bdcCore.c:113
static int Gia_ObjIsLut(Gia_Man_t *p, int Id)
Definition: gia.h:952
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
#define Gia_ManForEachObj1(p, pObj, i)
Definition: gia.h:986
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManPerformDsdBalance ( Gia_Man_t p,
int  nLutSize,
int  nCutNum,
int  nRelaxRatio,
int  fVerbose 
)

Definition at line 2058 of file giaIf.c.

2059 {
2060  Gia_Man_t * pNew;
2061  If_Man_t * pIfMan;
2062  If_Par_t Pars, * pPars = &Pars;
2063  If_ManSetDefaultPars( pPars );
2064  pPars->nCutsMax = nCutNum;
2065  pPars->nRelaxRatio = nRelaxRatio;
2066  pPars->fVerbose = fVerbose;
2067  pPars->nLutSize = nLutSize;
2068  pPars->fDsdBalance = 1;
2069  pPars->fUseDsd = 1;
2070  pPars->fCutMin = 1;
2071  pPars->fTruth = 1;
2072  pPars->fExpRed = 0;
2073  if ( Abc_FrameReadManDsd2() == NULL )
2075  // perform mapping
2076  pIfMan = Gia_ManToIf( p, pPars );
2078  if ( pPars->fDsdBalance )
2079  If_DsdManAllocIsops( pIfMan->pIfDsdMan, pPars->nLutSize );
2080  If_ManPerformMapping( pIfMan );
2081  pNew = Gia_ManFromIfAig( pIfMan );
2082  If_ManStop( pIfMan );
2083  Gia_ManTransferTiming( pNew, p );
2084  // transfer name
2085  assert( pNew->pName == NULL );
2086  pNew->pName = Abc_UtilStrsav( p->pName );
2087  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
2088  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
2089  return pNew;
2090 }
If_DsdMan_t * pIfDsdMan
Definition: if.h:243
int nLutSize
Definition: if.h:103
Definition: if.h:100
void If_ManSetDefaultPars(If_Par_t *pPars)
FUNCTION DECLARATIONS ///.
Definition: ifCore.c:47
Gia_Man_t * Gia_ManFromIfAig(If_Man_t *pIfMan)
Definition: giaIf.c:880
int fVerbose
Definition: if.h:140
void Gia_ManTransferTiming(Gia_Man_t *p, Gia_Man_t *pGia)
Definition: giaIf.c:1912
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
int fExpRed
Definition: if.h:116
void If_DsdManAllocIsops(If_DsdMan_t *p, int nLutSize)
Definition: ifDsd.c:289
int fDsdBalance
Definition: if.h:123
char * pName
Definition: gia.h:97
int fTruth
Definition: if.h:146
Definition: if.h:180
char * pSpec
Definition: gia.h:98
If_Man_t * Gia_ManToIf(Gia_Man_t *p, If_Par_t *pPars)
Definition: giaIf.c:742
ABC_DLL void Abc_FrameSetManDsd2(void *pMan)
Definition: mainFrame.c:90
ABC_DLL void * Abc_FrameReadManDsd2()
Definition: mainFrame.c:63
int fUseDsd
Definition: if.h:133
int nRelaxRatio
Definition: if.h:111
If_DsdMan_t * If_DsdManAlloc(int nVars, int nLutSize)
Definition: ifDsd.c:248
int If_ManPerformMapping(If_Man_t *p)
Definition: ifCore.c:80
Definition: gia.h:95
int fCutMin
Definition: if.h:120
#define assert(ex)
Definition: util_old.h:213
int nCutsMax
Definition: if.h:104
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void If_ManStop(If_Man_t *p)
Definition: ifMan.c:205
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManPerformDsdBalanceWin ( Gia_Man_t p,
int  LevelMax,
int  nTimeWindow,
int  nLutSize,
int  nCutNum,
int  nRelaxRatio,
int  fVerbose 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 298 of file giaBalMap.c.

299 {
300  Vec_Int_t * vOuts;
301  Gia_Man_t * pNew, * pWin, * pWinNew;
302  assert( !LevelMax != !nTimeWindow );
303  vOuts = Gia_ManFindLatest( p, LevelMax, nTimeWindow );
304  if ( fVerbose )
305  printf( "Collected %d outputs to extract.\n", Vec_IntSize(vOuts) );
306  if ( Vec_IntSize(vOuts) == 0 )
307  {
308  Vec_IntFree( vOuts );
309  return Gia_ManDup( p );
310  }
311  pWin = Gia_ManExtractWin( p, vOuts, 0 );
312  pWinNew = Gia_ManPerformDsdBalance( pWin, nLutSize, nCutNum, nRelaxRatio, fVerbose );
313  Gia_ManStop( pWin );
314  pNew = Gia_ManInsertWin( p, vOuts, pWinNew );
315  Gia_ManStop( pWinNew );
316  Vec_IntFree( vOuts );
317  return pNew;
318 }
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition: giaDup.c:552
Gia_Man_t * Gia_ManInsertWin(Gia_Man_t *p, Vec_Int_t *vOuts, Gia_Man_t *pWin)
Definition: giaBalMap.c:136
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Gia_Man_t * Gia_ManPerformDsdBalance(Gia_Man_t *p, int nLutSize, int nCutNum, int nRelaxRatio, int fVerbose)
Definition: giaIf.c:2058
Gia_Man_t * Gia_ManExtractWin(Gia_Man_t *p, Vec_Int_t *vOuts, int fPoOnly)
Definition: giaBalMap.c:114
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Vec_Int_t * Gia_ManFindLatest(Gia_Man_t *p, int LevelMax, int nTimeWindow)
Definition: giaBalMap.c:186
Definition: gia.h:95
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Gia_Man_t* Gia_ManPerformFx ( Gia_Man_t p,
int  nNewNodesMax,
int  LitCountMax,
int  fReverse,
int  fVerbose,
int  fVeryVerbose 
)

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

Synopsis [Performs classical fast_extract on logic functions.]

Description []

SideEffects [Sorts the fanins of each cut in the increasing order.]

SeeAlso []

Definition at line 451 of file giaFx.c.

452 {
453  extern int Fx_FastExtract( Vec_Wec_t * vCubes, int ObjIdMax, int nNewNodesMax, int LitCountMax, int fVerbose, int fVeryVerbose );
454  Gia_Man_t * pNew = NULL;
455  Vec_Wec_t * vCubes;
456  Vec_Str_t * vCompl;
457 // abctime clk;
458  assert( Gia_ManHasMapping(p) );
459  // collect information
460  vCubes = Gia_ManFxRetrieve( p, &vCompl, fReverse );
461  // call the fast extract procedure
462 // clk = Abc_Clock();
463  Fx_FastExtract( vCubes, Vec_StrSize(vCompl), nNewNodesMax, LitCountMax, fVerbose, fVeryVerbose );
464 // Abc_PrintTime( 1, "Fx runtime", Abc_Clock() - clk );
465  // insert information
466  pNew = Gia_ManFxInsert( p, vCubes, vCompl );
467  Gia_ManTransferTiming( pNew, p );
468  // cleanup
469  Vec_WecFree( vCubes );
470  Vec_StrFree( vCompl );
471  return pNew;
472 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.
Definition: vecWec.h:42
static void Vec_WecFree(Vec_Wec_t *p)
Definition: vecWec.h:345
static void Vec_StrFree(Vec_Str_t *p)
Definition: bblif.c:616
void Gia_ManTransferTiming(Gia_Man_t *p, Gia_Man_t *pGia)
Definition: giaIf.c:1912
Gia_Man_t * Gia_ManFxInsert(Gia_Man_t *p, Vec_Wec_t *vCubes, Vec_Str_t *vCompls)
Definition: giaFx.c:310
static int Vec_StrSize(Vec_Str_t *p)
Definition: bblif.c:600
static int Gia_ManHasMapping(Gia_Man_t *p)
Definition: gia.h:951
int Fx_FastExtract(Vec_Wec_t *vCubes, int ObjIdMax, int nNewNodesMax, int LitCountMax, int fVerbose, int fVeryVerbose)
Definition: abcFx.c:1168
Definition: gia.h:95
Vec_Wec_t * Gia_ManFxRetrieve(Gia_Man_t *p, Vec_Str_t **pvCompl, int fReverse)
Definition: giaFx.c:186
#define assert(ex)
Definition: util_old.h:213
Gia_Man_t* Gia_ManPerformLfMapping ( Gia_Man_t p,
Jf_Par_t pPars,
int  fNormalized 
)

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

Synopsis [Interface of LUT mapping package.]

Description []

SideEffects []

SeeAlso []

Definition at line 2243 of file giaLf.c.

2244 {
2245  Gia_Man_t * pNew;
2246  // reconstruct GIA according to the hierarchy manager
2247  assert( pPars->pTimesArr == NULL );
2248  assert( pPars->pTimesReq == NULL );
2249  if ( p->pManTime )
2250  {
2251  if ( fNormalized )
2252  {
2253  pNew = Gia_ManDupUnnormalize( p );
2254  if ( pNew == NULL )
2255  return NULL;
2256  Gia_ManTransferTiming( pNew, p );
2257  p = pNew;
2258  // set arrival and required times
2259  pPars->pTimesArr = Tim_ManGetArrTimes( (Tim_Man_t *)p->pManTime );
2260  pPars->pTimesReq = Tim_ManGetReqTimes( (Tim_Man_t *)p->pManTime );
2261  }
2262  else
2263  p = Gia_ManDup( p );
2264  }
2265  else
2266  p = Gia_ManDup( p );
2267  // perform mapping
2268  pNew = Lf_ManPerformMappingInt( p, pPars );
2269  if ( pNew != p )
2270  {
2271  // transfer name
2272  ABC_FREE( pNew->pName );
2273  ABC_FREE( pNew->pSpec );
2274  pNew->pName = Abc_UtilStrsav( p->pName );
2275  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
2276  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
2277  // return the original (unmodified by the mapper) timing manager
2278  Gia_ManTransferTiming( pNew, p );
2279  Gia_ManStop( p );
2280  }
2281  // normalize and transfer mapping
2282  pNew = Gia_ManDupNormalize( p = pNew );
2283  Gia_ManTransferMapping( pNew, p );
2284 // Gia_ManTransferPacking( pNew, p );
2285  Gia_ManTransferTiming( pNew, p );
2286  Gia_ManStop( p );
2287  return pNew;
2288 }
float * pTimesArr
Definition: gia.h:306
Gia_Man_t * Gia_ManDupUnnormalize(Gia_Man_t *p)
Definition: giaTim.c:373
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition: giaDup.c:552
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
float * pTimesReq
Definition: gia.h:307
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
char * pName
Definition: gia.h:97
Gia_Man_t * Gia_ManDupNormalize(Gia_Man_t *p)
Definition: giaTim.c:134
char * pSpec
Definition: gia.h:98
void * pManTime
Definition: gia.h:165
void Gia_ManTransferTiming(Gia_Man_t *p, Gia_Man_t *pGia)
Definition: giaIf.c:1912
float * Tim_ManGetReqTimes(Tim_Man_t *p)
Definition: timMan.c:494
Gia_Man_t * Lf_ManPerformMappingInt(Gia_Man_t *pGia, Jf_Par_t *pPars)
Definition: giaLf.c:2133
#define ABC_FREE(obj)
Definition: abc_global.h:232
Definition: gia.h:95
void Gia_ManTransferMapping(Gia_Man_t *p, Gia_Man_t *pGia)
Definition: giaIf.c:1855
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
float * Tim_ManGetArrTimes(Tim_Man_t *p)
Definition: timMan.c:479
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManPerformMapping ( Gia_Man_t p,
void *  pIfPars 
)

Definition at line 1986 of file giaIf.c.

1987 {
1988  Gia_Man_t * pNew;
1989  if ( p->pManTime && Tim_ManBoxNum(p->pManTime) && Gia_ManIsNormalized(p) )
1990  {
1991  pNew = Gia_ManDupUnnormalize( p );
1992  if ( pNew == NULL )
1993  return NULL;
1994  Gia_ManTransferTiming( pNew, p );
1995  p = pNew;
1996  // mapping
1997  pNew = Gia_ManPerformMappingInt( p, (If_Par_t *)pp );
1998  if ( pNew != p )
1999  {
2000  Gia_ManTransferTiming( pNew, p );
2001  Gia_ManStop( p );
2002  }
2003  // normalize
2004  pNew = Gia_ManDupNormalize( p = pNew );
2005  Gia_ManTransferMapping( pNew, p );
2006  Gia_ManTransferPacking( pNew, p );
2007  Gia_ManTransferTiming( pNew, p );
2008  Gia_ManStop( p );
2009  assert( Gia_ManIsNormalized(pNew) );
2010  }
2011  else
2012  {
2013  // mapping
2014  pNew = Gia_ManPerformMappingInt( p, (If_Par_t *)pp );
2015  Gia_ManTransferTiming( pNew, p );
2016  }
2017  return pNew;
2018 }
void Gia_ManTransferPacking(Gia_Man_t *p, Gia_Man_t *pGia)
Definition: giaIf.c:1878
Gia_Man_t * Gia_ManDupUnnormalize(Gia_Man_t *p)
Definition: giaTim.c:373
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
Definition: if.h:100
void Gia_ManTransferTiming(Gia_Man_t *p, Gia_Man_t *pGia)
Definition: giaIf.c:1912
void Gia_ManTransferMapping(Gia_Man_t *p, Gia_Man_t *pGia)
Definition: giaIf.c:1855
Gia_Man_t * Gia_ManDupNormalize(Gia_Man_t *p)
Definition: giaTim.c:134
void * pManTime
Definition: gia.h:165
int Tim_ManBoxNum(Tim_Man_t *p)
Definition: timMan.c:702
Definition: gia.h:95
int Gia_ManIsNormalized(Gia_Man_t *p)
Definition: giaTim.c:109
#define assert(ex)
Definition: util_old.h:213
Gia_Man_t * Gia_ManPerformMappingInt(Gia_Man_t *p, If_Par_t *pPars)
Definition: giaIf.c:1933
Gia_Man_t* Gia_ManPerformSopBalance ( Gia_Man_t p,
int  nCutNum,
int  nRelaxRatio,
int  fVerbose 
)

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

Synopsis [Interface of other mapping-based procedures.]

Description []

SideEffects []

SeeAlso []

Definition at line 2031 of file giaIf.c.

2032 {
2033  Gia_Man_t * pNew;
2034  If_Man_t * pIfMan;
2035  If_Par_t Pars, * pPars = &Pars;
2036  If_ManSetDefaultPars( pPars );
2037  pPars->nCutsMax = nCutNum;
2038  pPars->nRelaxRatio = nRelaxRatio;
2039  pPars->fVerbose = fVerbose;
2040  pPars->nLutSize = 6;
2041  pPars->fDelayOpt = 1;
2042  pPars->fCutMin = 1;
2043  pPars->fTruth = 1;
2044  pPars->fExpRed = 0;
2045  // perform mapping
2046  pIfMan = Gia_ManToIf( p, pPars );
2047  If_ManPerformMapping( pIfMan );
2048  pNew = Gia_ManFromIfAig( pIfMan );
2049  If_ManStop( pIfMan );
2050  Gia_ManTransferTiming( pNew, p );
2051  // transfer name
2052  assert( pNew->pName == NULL );
2053  pNew->pName = Abc_UtilStrsav( p->pName );
2054  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
2055  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
2056  return pNew;
2057 }
int nLutSize
Definition: if.h:103
Definition: if.h:100
void If_ManSetDefaultPars(If_Par_t *pPars)
FUNCTION DECLARATIONS ///.
Definition: ifCore.c:47
Gia_Man_t * Gia_ManFromIfAig(If_Man_t *pIfMan)
Definition: giaIf.c:880
int fVerbose
Definition: if.h:140
void Gia_ManTransferTiming(Gia_Man_t *p, Gia_Man_t *pGia)
Definition: giaIf.c:1912
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
int fExpRed
Definition: if.h:116
char * pName
Definition: gia.h:97
int fTruth
Definition: if.h:146
Definition: if.h:180
char * pSpec
Definition: gia.h:98
If_Man_t * Gia_ManToIf(Gia_Man_t *p, If_Par_t *pPars)
Definition: giaIf.c:742
int nRelaxRatio
Definition: if.h:111
int If_ManPerformMapping(If_Man_t *p)
Definition: ifCore.c:80
Definition: gia.h:95
int fDelayOpt
Definition: if.h:121
int fCutMin
Definition: if.h:120
#define assert(ex)
Definition: util_old.h:213
int nCutsMax
Definition: if.h:104
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void If_ManStop(If_Man_t *p)
Definition: ifMan.c:205
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManPerformSopBalanceWin ( Gia_Man_t p,
int  LevelMax,
int  nTimeWindow,
int  nCutNum,
int  nRelaxRatio,
int  fVerbose 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 265 of file giaBalMap.c.

266 {
267  Vec_Int_t * vOuts;
268  Gia_Man_t * pNew, * pWin, * pWinNew;
269  assert( !LevelMax != !nTimeWindow );
270  vOuts = Gia_ManFindLatest( p, LevelMax, nTimeWindow );
271  if ( fVerbose )
272  printf( "Collected %d outputs to extract.\n", Vec_IntSize(vOuts) );
273  if ( Vec_IntSize(vOuts) == 0 )
274  {
275  Vec_IntFree( vOuts );
276  return Gia_ManDup( p );
277  }
278  pWin = Gia_ManExtractWin( p, vOuts, 0 );
279  pWinNew = Gia_ManPerformSopBalance( pWin, nCutNum, nRelaxRatio, fVerbose );
280  Gia_ManStop( pWin );
281  pNew = Gia_ManInsertWin( p, vOuts, pWinNew );
282  Gia_ManStop( pWinNew );
283  Vec_IntFree( vOuts );
284  return pNew;
285 }
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition: giaDup.c:552
Gia_Man_t * Gia_ManInsertWin(Gia_Man_t *p, Vec_Int_t *vOuts, Gia_Man_t *pWin)
Definition: giaBalMap.c:136
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Gia_Man_t * Gia_ManExtractWin(Gia_Man_t *p, Vec_Int_t *vOuts, int fPoOnly)
Definition: giaBalMap.c:114
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Vec_Int_t * Gia_ManFindLatest(Gia_Man_t *p, int LevelMax, int nTimeWindow)
Definition: giaBalMap.c:186
Gia_Man_t * Gia_ManPerformSopBalance(Gia_Man_t *p, int nCutNum, int nRelaxRatio, int fVerbose)
Definition: giaIf.c:2031
Definition: gia.h:95
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static Gia_Obj_t* Gia_ManPi ( Gia_Man_t p,
int  v 
)
inlinestatic

Definition at line 405 of file gia.h.

405 { assert( v < Gia_ManPiNum(p) ); return Gia_ManCi( p, v ); }
static Gia_Obj_t * Gia_ManCi(Gia_Man_t *p, int v)
Definition: gia.h:403
#define assert(ex)
Definition: util_old.h:213
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
static int Gia_ManPiNum ( Gia_Man_t p)
inlinestatic

Definition at line 385 of file gia.h.

385 { return Vec_IntSize(p->vCis) - p->nRegs; }
Vec_Int_t * vCis
Definition: gia.h:108
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
int nRegs
Definition: gia.h:99
static Gia_Obj_t* Gia_ManPo ( Gia_Man_t p,
int  v 
)
inlinestatic

Definition at line 406 of file gia.h.

406 { assert( v < Gia_ManPoNum(p) ); return Gia_ManCo( p, v ); }
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static Gia_Obj_t * Gia_ManCo(Gia_Man_t *p, int v)
Definition: gia.h:404
#define assert(ex)
Definition: util_old.h:213
static int Gia_ManPoIsConst0 ( Gia_Man_t p,
int  iPoIndex 
)
inlinestatic

Definition at line 475 of file gia.h.

475 { return Gia_ManIsConst0Lit( Gia_ObjFaninLit0p(p, Gia_ManPo(p, iPoIndex)) ); }
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
static int Gia_ObjFaninLit0p(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:469
static int Gia_ManIsConst0Lit(int iLit)
Definition: gia.h:373
static int Gia_ManPoIsConst1 ( Gia_Man_t p,
int  iPoIndex 
)
inlinestatic

Definition at line 476 of file gia.h.

476 { return Gia_ManIsConst1Lit( Gia_ObjFaninLit0p(p, Gia_ManPo(p, iPoIndex)) ); }
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
static int Gia_ObjFaninLit0p(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:469
static int Gia_ManIsConst1Lit(int iLit)
Definition: gia.h:374
static int Gia_ManPoNum ( Gia_Man_t p)
inlinestatic

Definition at line 386 of file gia.h.

386 { return Vec_IntSize(p->vCos) - p->nRegs; }
Vec_Int_t * vCos
Definition: gia.h:109
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
int nRegs
Definition: gia.h:99
void Gia_ManPrint ( Gia_Man_t p)

Definition at line 1329 of file giaUtil.c.

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

Definition at line 1349 of file giaUtil.c.

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

Definition at line 1368 of file giaUtil.c.

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

Definition at line 1392 of file giaUtil.c.

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

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

Synopsis [Returns sorted array of node handles with largest fanout.]

Description []

SideEffects []

SeeAlso []

Definition at line 746 of file giaCof.c.

747 {
748  Cof_Man_t * p;
749  abctime clk = Abc_Clock();
750  p = Cof_ManCreateLogicSimple( pGia );
751  p->nLevels = 1 + Gia_ManLevelNum( pGia );
752  p->pLevels = ABC_CALLOC( int, p->nLevels );
753  Cof_ManPrintFanio( p );
754 
755  if ( nNodes > 0 )
756  {
757  Cof_ManResetTravId( p );
758  Gia_ManHashStart( pGia );
759  Cof_ManPrintHighFanout( p, nNodes );
760  Gia_ManHashStop( pGia );
761 ABC_PRMn( "Memory for logic network", 4*p->nObjData );
762 ABC_PRT( "Time", Abc_Clock() - clk );
763  }
764 
765  Cof_ManStop( p );
766 }
#define ABC_PRMn(a, f)
Definition: abc_global.h:226
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nLevels
Definition: giaCof.c:67
void Cof_ManStop(Cof_Man_t *p)
Definition: giaCof.c:203
void Cof_ManPrintFanio(Cof_Man_t *p)
Definition: giaCof.c:605
void Cof_ManPrintHighFanout(Cof_Man_t *p, int nNodes)
Definition: giaCof.c:541
static abctime Abc_Clock()
Definition: abc_global.h:279
int nObjData
Definition: giaCof.c:65
static void Cof_ManResetTravId(Cof_Man_t *p)
Definition: giaCof.c:94
void Gia_ManHashStart(Gia_Man_t *p)
Definition: giaHash.c:117
Cof_Man_t * Cof_ManCreateLogicSimple(Gia_Man_t *pGia)
FUNCTION DEFINITIONS ///.
Definition: giaCof.c:126
#define ABC_PRT(a, t)
Definition: abc_global.h:220
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
int Gia_ManLevelNum(Gia_Man_t *p)
Definition: giaUtil.c:505
int * pLevels
Definition: giaCof.c:66
ABC_INT64_T abctime
Definition: abc_global.h:278
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
void Gia_ManPrintLutStats ( Gia_Man_t p)

Definition at line 613 of file giaIf.c.

614 {
615  int i, nSizeMax, pCounts[33] = {0};
616  nSizeMax = Gia_ManLutSizeMax( p );
617  if ( nSizeMax > 32 )
618  {
619  Abc_Print( 1, "The max LUT size (%d) is too large.\n", nSizeMax );
620  return;
621  }
622  Gia_ManForEachLut( p, i )
623  pCounts[ Gia_ObjLutSize(p, i) ]++;
624  Gia_ManPrintNodeProfile( pCounts, nSizeMax );
625 }
#define Gia_ManForEachLut(p, i)
Definition: gia.h:968
int Gia_ManLutSizeMax(Gia_Man_t *p)
Definition: giaIf.c:125
static int Gia_ObjLutSize(Gia_Man_t *p, int Id)
Definition: gia.h:953
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
void Gia_ManPrintNodeProfile(int *pCounts, int nSizeMax)
Definition: giaIf.c:600
void Gia_ManPrintMappingStats ( Gia_Man_t p,
char *  pDumpFile 
)

Definition at line 423 of file giaIf.c.

424 {
425  Gia_Obj_t * pObj;
426  int * pLevels;
427  int i, k, iFan, nLutSize = 0, nLuts = 0, nFanins = 0, LevelMax = 0, Ave = 0, nMuxF = 0;
428  if ( !Gia_ManHasMapping(p) )
429  return;
430  pLevels = ABC_CALLOC( int, Gia_ManObjNum(p) );
431  Gia_ManForEachLut( p, i )
432  {
433  if ( Gia_ObjLutIsMux(p, i) )
434  {
435  int pFanins[3];
436  if ( Gia_ObjLutSize(p, i) == 3 )
437  {
438  Gia_ManPrintGetMuxFanins( p, Gia_ManObj(p, i), pFanins );
439  pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[pFanins[0]]+1 );
440  pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[pFanins[1]] );
441  pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[pFanins[2]] );
442  }
443  else if ( Gia_ObjLutSize(p, i) == 2 )
444  {
445  pObj = Gia_ManObj( p, i );
446  pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[Gia_ObjFaninId0(pObj, i)] );
447  pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[Gia_ObjFaninId1(pObj, i)] );
448  }
449  LevelMax = Abc_MaxInt( LevelMax, pLevels[i] );
450  nFanins++;
451  nMuxF++;
452  continue;
453  }
454  nLuts++;
455  nFanins += Gia_ObjLutSize(p, i);
456  nLutSize = Abc_MaxInt( nLutSize, Gia_ObjLutSize(p, i) );
457  Gia_LutForEachFanin( p, i, iFan, k )
458  pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[iFan] );
459  pLevels[i]++;
460  LevelMax = Abc_MaxInt( LevelMax, pLevels[i] );
461  }
462  Gia_ManForEachCo( p, pObj, i )
463  Ave += pLevels[Gia_ObjFaninId0p(p, pObj)];
464  ABC_FREE( pLevels );
465 
466 #ifdef WIN32
467  {
468  HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
469  Abc_Print( 1, "Mapping (K=%d) : ", nLutSize );
470  SetConsoleTextAttribute( hConsole, 14 ); // yellow
471  Abc_Print( 1, "lut =%7d ", nLuts );
472  if ( nMuxF )
473  Abc_Print( 1, "muxF =%7d ", nMuxF );
474  SetConsoleTextAttribute( hConsole, 10 ); // green
475  Abc_Print( 1, "edge =%8d ", nFanins );
476  SetConsoleTextAttribute( hConsole, 12 ); // red
477  Abc_Print( 1, "lev =%5d ", LevelMax );
478  Abc_Print( 1, "(%.2f) ", (float)Ave / Gia_ManCoNum(p) );
479 // Abc_Print( 1, "over =%5.1f %% ", 100.0 * Gia_ManComputeOverlap(p) / Gia_ManAndNum(p) );
480  if ( p->pManTime && Tim_ManBoxNum((Tim_Man_t *)p->pManTime) )
481  Abc_Print( 1, "levB =%5d ", Gia_ManLutLevelWithBoxes(p) );
482  SetConsoleTextAttribute( hConsole, 7 ); // normal
483  Abc_Print( 1, "mem =%5.2f MB", 4.0*(Gia_ManObjNum(p) + 2*nLuts + nFanins)/(1<<20) );
484  Abc_Print( 1, "\n" );
485  }
486 #else
487  Abc_Print( 1, "Mapping (K=%d) : ", nLutSize );
488  Abc_Print( 1, "%slut =%7d%s ", "\033[1;33m", nLuts, "\033[0m" ); // yellow
489  Abc_Print( 1, "%sedge =%8d%s ", "\033[1;32m", nFanins, "\033[0m" ); // green
490  Abc_Print( 1, "%slev =%5d%s ", "\033[1;31m", LevelMax, "\033[0m" ); // red
491  Abc_Print( 1, "%s(%.2f)%s ", "\033[1;31m", (float)Ave / Gia_ManCoNum(p), "\033[0m" );
492 // Abc_Print( 1, "over =%5.1f %% ", 100.0 * Gia_ManComputeOverlap(p) / Gia_ManAndNum(p) );
493  if ( p->pManTime && Tim_ManBoxNum((Tim_Man_t *)p->pManTime) )
494  Abc_Print( 1, "%slevB =%5d%s ", "\033[1;31m", Gia_ManLutLevelWithBoxes(p), "\033[0m" );
495  Abc_Print( 1, "mem =%5.2f MB", 4.0*(Gia_ManObjNum(p) + 2*nLuts + nFanins)/(1<<20) );
496  Abc_Print( 1, "\n" );
497 #endif
498 
499  if ( nMuxF )
500  Gia_ManCountDupLut( p );
501 
502  return;
503  if ( pDumpFile )
504  {
505  static char FileNameOld[1000] = {0};
506  static abctime clk = 0;
507  FILE * pTable = fopen( pDumpFile, "a+" );
508  if ( strcmp( FileNameOld, p->pName ) )
509  {
510  sprintf( FileNameOld, "%s", p->pName );
511  fprintf( pTable, "\n" );
512  fprintf( pTable, "%s ", p->pName );
513 // fprintf( pTable, "%d ", Gia_ManCiNum(p) );
514 // fprintf( pTable, "%d ", Gia_ManCoNum(p) );
515 // fprintf( pTable, "%d ", Gia_ManAndNum(p) );
516  fprintf( pTable, "%d ", Gia_ManPiNum(p) - Gia_ManBoxCiNum(p) - Gia_ManRegBoxNum(p) );
517  fprintf( pTable, "%d ", Gia_ManPoNum(p) - Gia_ManBoxCoNum(p) - Gia_ManRegBoxNum(p) );
518  fprintf( pTable, "%d ", Gia_ManClockDomainNum(p) );
519 
520  fprintf( pTable, " " );
521  fprintf( pTable, "%d ", nLuts );
522  fprintf( pTable, "%d ", LevelMax );
523  fprintf( pTable, "%d ", Gia_ManRegBoxNum(p) );
524  fprintf( pTable, "%d ", Gia_ManNonRegBoxNum(p) );
525  clk = Abc_Clock();
526  }
527  else
528  {
529  fprintf( pTable, " " );
530  fprintf( pTable, "%d ", nLuts );
531  fprintf( pTable, "%d ", LevelMax );
532  fprintf( pTable, "%d ", Gia_ManRegBoxNum(p) );
533  fprintf( pTable, "%d ", Gia_ManNonRegBoxNum(p) );
534  fprintf( pTable, "%.2f", 1.0*(Abc_Clock() - clk)/CLOCKS_PER_SEC );
535  clk = Abc_Clock();
536  }
537  fclose( pTable );
538  }
539 
540 }
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
int Gia_ManRegBoxNum(Gia_Man_t *p)
Definition: giaTim.c:53
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
#define Gia_ManForEachLut(p, i)
Definition: gia.h:968
int strcmp()
static int Gia_ObjLutSize(Gia_Man_t *p, int Id)
Definition: gia.h:953
void Gia_ManPrintGetMuxFanins(Gia_Man_t *p, Gia_Obj_t *pObj, int *pFanins)
Definition: giaIf.c:361
static int Gia_ObjLutIsMux(Gia_Man_t *p, int Id)
Definition: gia.h:957
int Gia_ManBoxCiNum(Gia_Man_t *p)
Definition: giaTim.c:61
char * sprintf()
int Tim_ManBoxNum(Tim_Man_t *p)
Definition: timMan.c:702
int Gia_ManBoxCoNum(Gia_Man_t *p)
Definition: giaTim.c:65
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
int Gia_ManNonRegBoxNum(Gia_Man_t *p)
Definition: giaTim.c:57
static int Gia_ManHasMapping(Gia_Man_t *p)
Definition: gia.h:951
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
static int Gia_ObjFaninId0p(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:463
int Gia_ManLutLevelWithBoxes(Gia_Man_t *p)
Definition: giaTim.c:572
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
int Gia_ManCountDupLut(Gia_Man_t *p)
Definition: giaIf.c:369
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
ABC_INT64_T abctime
Definition: abc_global.h:278
static int Gia_ObjFaninId1(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:461
#define Gia_LutForEachFanin(p, i, iFan, k)
Definition: gia.h:970
int Gia_ManClockDomainNum(Gia_Man_t *p)
Definition: giaTim.c:69
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ObjFaninId0(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:460
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
void Gia_ManPrintMiterStatus ( Gia_Man_t p)

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

Synopsis [Prints stats for the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 543 of file giaMan.c.

544 {
545  Gia_Obj_t * pObj, * pChild;
546  int i, nSat = 0, nUnsat = 0, nUndec = 0, iOut = -1;
547  Gia_ManForEachPo( p, pObj, i )
548  {
549  pChild = Gia_ObjChild0(pObj);
550  // check if the output is constant 0
551  if ( pChild == Gia_ManConst0(p) )
552  nUnsat++;
553  // check if the output is constant 1
554  else if ( pChild == Gia_ManConst1(p) )
555  {
556  nSat++;
557  if ( iOut == -1 )
558  iOut = i;
559  }
560  // check if the output is a primary input
561  else if ( Gia_ObjIsPi(p, Gia_Regular(pChild)) )
562  {
563  nSat++;
564  if ( iOut == -1 )
565  iOut = i;
566  }
567 /*
568  // check if the output is 1 for the 0000 pattern
569  else if ( Gia_Regular(pChild)->fPhase != (unsigned)Gia_IsComplement(pChild) )
570  {
571  nSat++;
572  if ( iOut == -1 )
573  iOut = i;
574  }
575 */
576  else
577  nUndec++;
578  }
579  Abc_Print( 1, "Outputs = %7d. Unsat = %7d. Sat = %7d. Undec = %7d.\n",
580  Gia_ManPoNum(p), nUnsat, nSat, nUndec );
581 }
static Gia_Obj_t * Gia_ObjChild0(Gia_Obj_t *pObj)
Definition: gia.h:457
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static Gia_Obj_t * Gia_Regular(Gia_Obj_t *p)
Definition: gia.h:377
Definition: gia.h:75
static Gia_Obj_t * Gia_ManConst1(Gia_Man_t *p)
Definition: gia.h:401
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
static int Gia_ObjIsPi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:441
void Gia_ManPrintMuxStats ( Gia_Man_t p)

Definition at line 61 of file giaMuxes.c.

62 {
63  int nAnds, nMuxes, nXors, nTotal;
64  if ( p->pMuxes )
65  {
67  nXors = Gia_ManXorNum(p);
68  nMuxes = Gia_ManMuxNum(p);
69  nTotal = nAnds + 3*nXors + 3*nMuxes;
70  }
71  else
72  {
73  Gia_ManCountMuxXor( p, &nMuxes, &nXors );
74  nAnds = Gia_ManAndNotBufNum(p) - 3*nMuxes - 3*nXors;
75  nTotal = Gia_ManAndNotBufNum(p);
76  }
77  Abc_Print( 1, "stats: " );
78  Abc_Print( 1, "xor =%8d %6.2f %% ", nXors, 300.0*nXors/nTotal );
79  Abc_Print( 1, "mux =%8d %6.2f %% ", nMuxes, 300.0*nMuxes/nTotal );
80  Abc_Print( 1, "and =%8d %6.2f %% ", nAnds, 100.0*nAnds/nTotal );
81  Abc_Print( 1, "obj =%8d ", Gia_ManAndNotBufNum(p) );
82  fflush( stdout );
83 }
static int Gia_ManMuxNum(Gia_Man_t *p)
Definition: gia.h:391
unsigned * pMuxes
Definition: gia.h:104
static int Gia_ManAndNotBufNum(Gia_Man_t *p)
Definition: gia.h:393
ABC_NAMESPACE_IMPL_START void Gia_ManCountMuxXor(Gia_Man_t *p, int *pnMuxes, int *pnXors)
DECLARATIONS ///.
Definition: giaMuxes.c:47
static int nMuxes
Definition: abcSat.c:36
static int Gia_ManXorNum(Gia_Man_t *p)
Definition: gia.h:390
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
int nTotal
DECLARATIONS ///.
Definition: cutTruth.c:37
void Gia_ManPrintNpnClasses ( Gia_Man_t p)

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

Synopsis [Prints NPN class statistics.]

Description []

SideEffects []

SeeAlso []

Definition at line 668 of file giaMan.c.

669 {
670  extern char ** Kit_DsdNpn4ClassNames();
671  char ** pNames = Kit_DsdNpn4ClassNames();
672  Vec_Int_t * vLeaves, * vTruth, * vVisited;
673  int * pLutClass, ClassCounts[222] = {0};
674  int i, k, iFan, Class, OtherClasses, OtherClasses2, nTotal, Counter, Counter2;
675  unsigned * pTruth;
677  assert( Gia_ManLutSizeMax( p ) <= 4 );
678  vLeaves = Vec_IntAlloc( 100 );
679  vVisited = Vec_IntAlloc( 100 );
680  vTruth = Vec_IntAlloc( (1<<16) );
681  pLutClass = ABC_CALLOC( int, Gia_ManObjNum(p) );
682  Gia_ManCleanTruth( p );
683  Gia_ManForEachLut( p, i )
684  {
685  if ( Gia_ObjLutSize(p,i) > 4 )
686  continue;
687  Vec_IntClear( vLeaves );
688  Gia_LutForEachFanin( p, i, iFan, k )
689  Vec_IntPush( vLeaves, iFan );
690  for ( ; k < 4; k++ )
691  Vec_IntPush( vLeaves, 0 );
692  pTruth = Gia_ManConvertAigToTruth( p, Gia_ManObj(p, i), vLeaves, vTruth, vVisited );
693  Class = Dar_LibReturnClass( *pTruth );
694  ClassCounts[ Class ]++;
695  pLutClass[i] = Class;
696  }
697  Vec_IntFree( vLeaves );
698  Vec_IntFree( vTruth );
699  Vec_IntFree( vVisited );
700  Vec_IntFreeP( &p->vTruths );
701  nTotal = 0;
702  for ( i = 0; i < 222; i++ )
703  nTotal += ClassCounts[i];
704  Abc_Print( 1, "NPN CLASS STATISTICS (for %d LUT4 present in the current mapping):\n", nTotal );
705  OtherClasses = 0;
706  for ( i = 0; i < 222; i++ )
707  {
708  if ( ClassCounts[i] == 0 )
709  continue;
710 // if ( 100.0 * ClassCounts[i] / (nTotal+1) < 0.1 ) // do not show anything below 0.1 percent
711 // continue;
712  OtherClasses += ClassCounts[i];
713  Abc_Print( 1, "Class %3d : Count = %6d (%7.2f %%) %s\n",
714  i, ClassCounts[i], 100.0 * ClassCounts[i] / (nTotal+1), pNames[i] );
715  }
716  OtherClasses = nTotal - OtherClasses;
717  Abc_Print( 1, "Other : Count = %6d (%7.2f %%)\n",
718  OtherClasses, 100.0 * OtherClasses / (nTotal+1) );
719  // count the number of LUTs that have MUX function and two fanins with MUX functions
720  OtherClasses = OtherClasses2 = 0;
721  ABC_FREE( p->pRefs );
723  Gia_ManForEachLut( p, i )
724  {
725  if ( pLutClass[i] != 109 )
726  continue;
727  Counter = Counter2 = 0;
728  Gia_LutForEachFanin( p, i, iFan, k )
729  {
730  Counter += (pLutClass[iFan] == 109);
731  Counter2 += (pLutClass[iFan] == 109) && (Gia_ObjRefNumId(p, iFan) == 1);
732  }
733  OtherClasses += (Counter > 1);
734  OtherClasses2 += (Counter2 > 1);
735 // Abc_Print( 1, "%d -- ", pLutClass[i] );
736 // Gia_LutForEachFanin( p, i, iFan, k )
737 // Abc_Print( 1, "%d ", pLutClass[iFan] );
738 // Abc_Print( 1, "\n" );
739  }
740  ABC_FREE( p->pRefs );
741  Abc_Print( 1, "Approximate number of 4:1 MUX structures: All = %6d (%7.2f %%) MFFC = %6d (%7.2f %%)\n",
742  OtherClasses, 100.0 * OtherClasses / (nTotal+1),
743  OtherClasses2, 100.0 * OtherClasses2 / (nTotal+1) );
744  ABC_FREE( pLutClass );
745 }
char ** Kit_DsdNpn4ClassNames()
Definition: kitDsd.c:3048
void Gia_ManSetRefsMapped(Gia_Man_t *p)
Definition: giaIf.c:245
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Gia_ObjRefNumId(Gia_Man_t *p, int Id)
Definition: gia.h:518
int Dar_LibReturnClass(unsigned uTruth)
Definition: darLib.c:194
void Gia_ManCleanTruth(Gia_Man_t *p)
Definition: giaUtil.c:487
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
for(p=first;p->value< newval;p=p->next)
#define Gia_ManForEachLut(p, i)
Definition: gia.h:968
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Gia_ObjLutSize(Gia_Man_t *p, int Id)
Definition: gia.h:953
unsigned * Gia_ManConvertAigToTruth(Gia_Man_t *p, Gia_Obj_t *pRoot, Vec_Int_t *vLeaves, Vec_Int_t *vTruth, Vec_Int_t *vVisited)
Definition: giaBidec.c:90
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Counter
int Gia_ManLutSizeMax(Gia_Man_t *p)
Definition: giaIf.c:125
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static int Gia_ManHasMapping(Gia_Man_t *p)
Definition: gia.h:951
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
#define Gia_LutForEachFanin(p, i, iFan, k)
Definition: gia.h:970
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
int nTotal
DECLARATIONS ///.
Definition: cutTruth.c:37
Vec_Flt_t* Gia_ManPrintOutputProb ( Gia_Man_t p)

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

Synopsis [Determine probability of being 1 at the outputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 813 of file giaSwitch.c.

814 {
815  Vec_Flt_t * vSimData;
816  Gia_Man_t * pDfs = Gia_ManDup( p );
817  assert( Gia_ManObjNum(pDfs) == Gia_ManObjNum(p) );
818  vSimData = (Vec_Flt_t *)Gia_ManComputeSwitchProbs( pDfs, (Gia_ManRegNum(p) ? 16 : 1), 0, 1 );
819  Gia_ManStop( pDfs );
820  return vSimData;
821 }
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition: giaDup.c:552
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
Vec_Int_t * Gia_ManComputeSwitchProbs(Gia_Man_t *pGia, int nFrames, int nPref, int fProbOne)
Definition: giaSwitch.c:658
Definition: gia.h:95
typedefABC_NAMESPACE_HEADER_START struct Vec_Flt_t_ Vec_Flt_t
INCLUDES ///.
Definition: vecFlt.h:42
#define assert(ex)
Definition: util_old.h:213
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
void Gia_ManPrintPackingStats ( Gia_Man_t p)

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

Synopsis [Prints mapping statistics.]

Description []

SideEffects []

SeeAlso []

Definition at line 553 of file giaIf.c.

554 {
555  int fVerbose = 0;
556  int nObjToShow = 200;
557  int nNumStr[5] = {0};
558  int i, k, Entry, nEntries, nEntries2, MaxSize = -1;
559  if ( p->vPacking == NULL )
560  return;
561  nEntries = Vec_IntEntry( p->vPacking, 0 );
562  nEntries2 = 0;
563  Vec_IntForEachEntryStart( p->vPacking, Entry, i, 1 )
564  {
565  assert( Entry > 0 && Entry < 4 );
566  nNumStr[Entry]++;
567  i++;
568  if ( fVerbose && nEntries2 < nObjToShow ) Abc_Print( 1, "{ " );
569  for ( k = 0; k < Entry; k++, i++ )
570  if ( fVerbose && nEntries2 < nObjToShow ) Abc_Print( 1, "%d ", Vec_IntEntry(p->vPacking, i) );
571  if ( fVerbose && nEntries2 < nObjToShow ) Abc_Print( 1, "}\n" );
572  i--;
573  nEntries2++;
574  }
575  assert( nEntries == nEntries2 );
576  if ( nNumStr[3] > 0 )
577  MaxSize = 3;
578  else if ( nNumStr[2] > 0 )
579  MaxSize = 2;
580  else if ( nNumStr[1] > 0 )
581  MaxSize = 1;
582  Abc_Print( 1, "Packing (N=%d) : ", MaxSize );
583  for ( i = 1; i <= MaxSize; i++ )
584  Abc_Print( 1, "%d x LUT = %d ", i, nNumStr[i] );
585  Abc_Print( 1, "Total = %d", nEntries2 );
586  Abc_Print( 1, "\n" );
587 }
Vec_Int_t * vPacking
Definition: gia.h:133
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
Definition: vecInt.h:56
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
#define assert(ex)
Definition: util_old.h:213
void Gia_ManPrintStats ( Gia_Man_t p,
Gps_Par_t pPars 
)

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

Synopsis [Prints stats for the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 389 of file giaMan.c.

390 {
391  extern float Gia_ManLevelAve( Gia_Man_t * p );
392  if ( pPars && pPars->fMiter )
393  {
394  Gia_ManPrintStatsMiter( p, 0 );
395  return;
396  }
397 #ifdef WIN32
398  SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), 15 ); // bright
399  if ( p->pName )
400  Abc_Print( 1, "%-8s : ", p->pName );
401  SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), 7 ); // normal
402 #else
403  if ( p->pName )
404  Abc_Print( 1, "%s%-8s%s : ", "\033[1;37m", p->pName, "\033[0m" ); // bright
405 #endif
406  Abc_Print( 1, "i/o =%7d/%7d",
409  if ( Gia_ManConstrNum(p) )
410  Abc_Print( 1, "(c=%d)", Gia_ManConstrNum(p) );
411  if ( Gia_ManRegNum(p) )
412  Abc_Print( 1, " ff =%7d", Gia_ManRegNum(p) );
413  if ( Gia_ManRegBoxNum(p) )
414  Abc_Print( 1, " boxff =%d(%d)", Gia_ManRegBoxNum(p), Gia_ManClockDomainNum(p) );
415 
416 #ifdef WIN32
417  {
418  HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
419  SetConsoleTextAttribute( hConsole, 11 ); // blue
420  Abc_Print( 1, " %s =%8d", p->pMuxes? "nod" : "and", Gia_ManAndNum(p) );
421  SetConsoleTextAttribute( hConsole, 13 ); // magenta
422  Abc_Print( 1, " lev =%5d", Gia_ManLevelNum(p) );
423  Abc_Print( 1, " (%.2f)", Gia_ManLevelAve(p) );
424  SetConsoleTextAttribute( hConsole, 7 ); // normal
425  }
426 #else
427  Abc_Print( 1, " %s%s =%8d%s", "\033[1;36m", p->pMuxes? "nod" : "and", Gia_ManAndNum(p), "\033[0m" ); // blue
428  Abc_Print( 1, " %slev =%5d%s", "\033[1;35m", Gia_ManLevelNum(p), "\033[0m" ); // magenta
429  Abc_Print( 1, " %s(%.2f)%s", "\033[1;35m", Gia_ManLevelAve(p), "\033[0m" );
430 #endif
431  Vec_IntFreeP( &p->vLevels );
432  if ( pPars && pPars->fCut )
433  Abc_Print( 1, " cut = %d(%d)", Gia_ManCrossCut(p, 0), Gia_ManCrossCut(p, 1) );
434  Abc_Print( 1, " mem =%5.2f MB", Gia_ManMemory(p)/(1<<20) );
435  if ( Gia_ManHasChoices(p) )
436  Abc_Print( 1, " ch =%5d", Gia_ManChoiceNum(p) );
437  if ( p->pManTime )
438  Abc_Print( 1, " box = %d", Gia_ManNonRegBoxNum(p) );
439  if ( Gia_ManBufNum(p) )
440  Abc_Print( 1, " buf = %d", Gia_ManBufNum(p) );
441  if ( pPars && pPars->fMuxXor )
442  printf( "\nXOR/MUX " ), Gia_ManPrintMuxStats( p );
443  if ( pPars && pPars->fSwitch )
444  {
445  static int nPiPo = 0;
446  static float PrevSwiTotal = 0;
447  float SwiTotal = Gia_ManComputeSwitching( p, 48, 16, 0 );
448  Abc_Print( 1, " power =%8.1f", SwiTotal );
449  if ( PrevSwiTotal > 0 && nPiPo == Gia_ManCiNum(p) + Gia_ManCoNum(p) )
450  Abc_Print( 1, " %6.2f %%", 100.0*(PrevSwiTotal-SwiTotal)/PrevSwiTotal );
451  else if ( PrevSwiTotal == 0 || nPiPo != Gia_ManCiNum(p) + Gia_ManCoNum(p) )
452  PrevSwiTotal = SwiTotal, nPiPo = Gia_ManCiNum(p) + Gia_ManCoNum(p);
453  }
454 // Abc_Print( 1, "obj =%5d ", Gia_ManObjNum(p) );
455  Abc_Print( 1, "\n" );
456 
457 // Gia_ManSatExperiment( p );
458  if ( p->pReprs && p->pNexts )
459  Gia_ManEquivPrintClasses( p, 0, 0.0 );
460  if ( Gia_ManHasMapping(p) && (pPars == NULL || !pPars->fSkipMap) )
461  Gia_ManPrintMappingStats( p, pPars ? pPars->pDumpFile : NULL );
462  if ( pPars && pPars->fNpn && Gia_ManHasMapping(p) && Gia_ManLutSizeMax(p) <= 4 )
464  if ( p->vPacking )
466  if ( pPars && pPars->fLutProf && Gia_ManHasMapping(p) )
468  if ( p->pPlacement )
470 // if ( p->pManTime )
471 // Tim_ManPrintStats( (Tim_Man_t *)p->pManTime, p->nAnd2Delay );
475 // if ( p->vRegClasses )
476 // {
477 // printf( "The design has %d flops with the following class info: ", Vec_IntSize(p->vRegClasses) );
478 // Vec_IntPrint( p->vRegClasses );
479 // }
480  if ( p->vInitClasses )
482  // check integrity of boxes
484 /*
485  if ( Gia_ManRegBoxNum(p) )
486  {
487  int i, Limit = Vec_IntFindMax(p->vRegClasses);
488  for ( i = 1; i <= Limit; i++ )
489  printf( "%d ", Vec_IntCountEntry(p->vRegClasses, i) );
490  printf( "\n" );
491  }
492 */
493  if ( pPars && pPars->fTents )
494  {
495 /*
496  int k, Entry, Prev = 1;
497  Vec_Int_t * vLimit = Vec_IntAlloc( 1000 );
498  Gia_Man_t * pNew = Gia_ManUnrollDup( p, vLimit );
499  Abc_Print( 1, "Tents: " );
500  Vec_IntForEachEntryStart( vLimit, Entry, k, 1 )
501  Abc_Print( 1, "%d=%d ", k, Entry-Prev ), Prev = Entry;
502  Abc_Print( 1, " Unused=%d.", Gia_ManObjNum(p) - Gia_ManObjNum(pNew) );
503  Abc_Print( 1, "\n" );
504  Vec_IntFree( vLimit );
505  Gia_ManStop( pNew );
506 */
507  Gia_ManPrintTents( p );
508  }
509 }
int fCut
Definition: gia.h:199
float Gia_ManComputeSwitching(Gia_Man_t *p, int nFrames, int nPref, int fProbOne)
Definition: giaSwitch.c:781
double Gia_ManMemory(Gia_Man_t *p)
Definition: giaMan.c:156
int Gia_ManCrossCut(Gia_Man_t *p, int fReverse)
Definition: giaUtil.c:820
void Gia_ManPrintFlopClasses(Gia_Man_t *p)
Definition: absDup.c:301
int * pNexts
Definition: gia.h:122
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static int Gia_ManChoiceNum(Gia_Man_t *p)
Definition: gia.h:398
int Gia_ManRegBoxNum(Gia_Man_t *p)
Definition: giaTim.c:53
int fLutProf
Definition: gia.h:201
static int Gia_ManConstrNum(Gia_Man_t *p)
Definition: gia.h:395
void Gia_ManCheckIntegrityWithBoxes(Gia_Man_t *p)
Definition: giaSweep.c:406
unsigned * pMuxes
Definition: gia.h:104
Vec_Int_t * vPacking
Definition: gia.h:133
void Gia_ManPrintMappingStats(Gia_Man_t *p, char *pDumpFile)
Definition: giaIf.c:423
char * pDumpFile
Definition: gia.h:205
Vec_Int_t * vInitClasses
Definition: gia.h:143
void Gia_ManEquivPrintClasses(Gia_Man_t *p, int fVerbose, float Mem)
Definition: giaEquiv.c:304
static int Gia_ManHasChoices(Gia_Man_t *p)
Definition: gia.h:397
void Gia_ManPrintStatsMiter(Gia_Man_t *p, int fVerbose)
Definition: giaMan.c:594
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
float Gia_ManLevelAve(Gia_Man_t *p)
Definition: giaUtil.c:525
char * pName
Definition: gia.h:97
void Gia_ManPrintNpnClasses(Gia_Man_t *p)
Definition: giaMan.c:668
void Gia_ManPrintGateClasses(Gia_Man_t *p)
Definition: absDup.c:331
void Gia_ManPrintPackingStats(Gia_Man_t *p)
Definition: giaIf.c:553
int fTents
Definition: gia.h:197
int Gia_ManBoxCiNum(Gia_Man_t *p)
Definition: giaTim.c:61
void * pManTime
Definition: gia.h:165
int Gia_ManBoxCoNum(Gia_Man_t *p)
Definition: giaTim.c:65
void Gia_ManPrintObjClasses(Gia_Man_t *p)
Definition: absDup.c:367
int Gia_ManLutSizeMax(Gia_Man_t *p)
Definition: giaIf.c:125
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
int fNpn
Definition: gia.h:200
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
void Gia_ManPrintTents(Gia_Man_t *p)
Definition: giaMan.c:265
void Gia_ManPrintMuxStats(Gia_Man_t *p)
Definition: giaMuxes.c:61
void Gia_ManPrintInitClasses(Vec_Int_t *vInits)
Definition: giaMan.c:314
int Gia_ManNonRegBoxNum(Gia_Man_t *p)
Definition: giaTim.c:57
int fMuxXor
Definition: gia.h:202
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
static int Gia_ManHasMapping(Gia_Man_t *p)
Definition: gia.h:951
Definition: gia.h:95
static int Gia_ManBufNum(Gia_Man_t *p)
Definition: gia.h:392
int fSwitch
Definition: gia.h:198
int fSkipMap
Definition: gia.h:204
Gia_Plc_t * pPlacement
Definition: gia.h:148
int fMiter
Definition: gia.h:203
void Gia_ManPrintPlacement(Gia_Man_t *p)
Definition: giaMan.c:228
Gia_Rpr_t * pReprs
Definition: gia.h:121
int Gia_ManLevelNum(Gia_Man_t *p)
Definition: giaUtil.c:505
Vec_Int_t * vLevels
Definition: gia.h:115
void Gia_ManPrintLutStats(Gia_Man_t *p)
Definition: giaIf.c:613
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
int Gia_ManClockDomainNum(Gia_Man_t *p)
Definition: giaTim.c:69
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
void Gia_ManPrintStatsMiter ( Gia_Man_t p,
int  fVerbose 
)

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

Synopsis [Statistics of the miter.]

Description []

SideEffects []

SeeAlso []

Definition at line 594 of file giaMan.c.

595 {
596  Gia_Obj_t * pObj;
597  Vec_Flt_t * vProb;
598  int i, iObjId;
599  Gia_ManLevelNum( p );
600  Gia_ManCreateRefs( p );
601  vProb = Gia_ManPrintOutputProb( p );
602  printf( "Statistics for each outputs of the miter:\n" );
603  Gia_ManForEachPo( p, pObj, i )
604  {
605  iObjId = Gia_ObjId(p, pObj);
606  printf( "%4d : ", i );
607  printf( "Level = %5d ", Gia_ObjLevelId(p, iObjId) );
608  printf( "Supp = %5d ", Gia_ManSuppSize(p, &iObjId, 1) );
609  printf( "Cone = %5d ", Gia_ManConeSize(p, &iObjId, 1) );
610  printf( "Mffc = %5d ", Gia_NodeMffcSize(p, Gia_ObjFanin0(pObj)) );
611  printf( "Prob = %8.4f ", Vec_FltEntry(vProb, iObjId) );
612  printf( "\n" );
613  }
614  Vec_FltFree( vProb );
615 }
static int Gia_ObjLevelId(Gia_Man_t *p, int Id)
Definition: gia.h:500
void Gia_ManCreateRefs(Gia_Man_t *p)
Definition: giaUtil.c:715
int Gia_ManSuppSize(Gia_Man_t *p, int *pNodes, int nNodes)
Definition: giaDfs.c:300
static void Vec_FltFree(Vec_Flt_t *p)
Definition: vecFlt.h:218
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
int Gia_ManConeSize(Gia_Man_t *p, int *pNodes, int nNodes)
Definition: giaDfs.c:351
Vec_Flt_t * Gia_ManPrintOutputProb(Gia_Man_t *p)
Definition: giaSwitch.c:813
typedefABC_NAMESPACE_HEADER_START struct Vec_Flt_t_ Vec_Flt_t
INCLUDES ///.
Definition: vecFlt.h:42
int Gia_NodeMffcSize(Gia_Man_t *p, Gia_Obj_t *pNode)
Definition: giaUtil.c:1132
int Gia_ManLevelNum(Gia_Man_t *p)
Definition: giaUtil.c:505
static float Vec_FltEntry(Vec_Flt_t *p, int i)
Definition: vecFlt.h:342
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
void Gia_ManPrintStatsShort ( Gia_Man_t p)

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

Synopsis [Prints stats for the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 522 of file giaMan.c.

523 {
524  Abc_Print( 1, "i/o =%7d/%7d ", Gia_ManPiNum(p), Gia_ManPoNum(p) );
525  Abc_Print( 1, "ff =%7d ", Gia_ManRegNum(p) );
526  Abc_Print( 1, "and =%8d ", Gia_ManAndNum(p) );
527  Abc_Print( 1, "lev =%5d ", Gia_ManLevelNum(p) );
528 // Abc_Print( 1, "mem =%5.2f MB", 12.0*Gia_ManObjNum(p)/(1<<20) );
529  Abc_Print( 1, "\n" );
530 }
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
int Gia_ManLevelNum(Gia_Man_t *p)
Definition: giaUtil.c:505
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
unsigned Gia_ManRandom ( int  fReset)

FUNCTION DEFINITIONS ///.

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

Synopsis [Creates a sequence or random numbers.]

Description []

SideEffects []

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

Definition at line 49 of file giaUtil.c.

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

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

Synopsis [Creates random info for the primary inputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 80 of file giaUtil.c.

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

Definition at line 62 of file giaUtil.c.

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

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

Synopsis [Procedures to read/write GIA to/from MiniAIG file.]

Description []

SideEffects []

SeeAlso []

Definition at line 167 of file giaMini.c.

168 {
169  Mini_Aig_t * p = Mini_AigLoad( pFileName );
170  Gia_Man_t * pGia = Gia_ManFromMiniAig( p );
171  ABC_FREE( pGia->pName );
172  pGia->pName = Extra_FileNameGeneric( pFileName );
173  Mini_AigStop( p );
174  return pGia;
175 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Gia_Man_t * Gia_ManFromMiniAig(Mini_Aig_t *p)
Definition: giaMini.c:57
static Mini_Aig_t * Mini_AigLoad(char *pFileName)
Definition: miniaig.h:176
static void Mini_AigStop(Mini_Aig_t *p)
Definition: miniaig.h:140
char * pName
Definition: gia.h:97
char * Extra_FileNameGeneric(char *FileName)
#define ABC_FREE(obj)
Definition: abc_global.h:232
Definition: gia.h:95
Gia_Man_t* Gia_ManReduceConst ( Gia_Man_t pAig,
int  fVerbose 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 737 of file giaTsim.c.

738 {
739  Gia_ManTer_t * p;
740  Gia_Man_t * pNew = NULL;
741  int * pCi2Lit;
742  p = Gia_ManTerSimulate( pAig, fVerbose );
743  Gia_ManTerAnalyze( p );
744  pCi2Lit = Gia_ManTerCreateMap( p, fVerbose );
745  Gia_ManTerDelete( p );
746  pNew = Gia_ManDupDfsCiMap( pAig, pCi2Lit, NULL );
747  ABC_FREE( pCi2Lit );
748  return pNew;
749 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Gia_ManTerDelete(Gia_ManTer_t *p)
Definition: giaTsim.c:133
Gia_Man_t * Gia_ManDupDfsCiMap(Gia_Man_t *p, int *pCi2Lit, Vec_Int_t *vLits)
Definition: giaDup.c:1890
void Gia_ManTerAnalyze(Gia_ManTer_t *p)
Definition: giaTsim.c:547
#define ABC_FREE(obj)
Definition: abc_global.h:232
Definition: gia.h:95
int * Gia_ManTerCreateMap(Gia_ManTer_t *p, int fVerbose)
Definition: giaTsim.c:627
Gia_ManTer_t * Gia_ManTerSimulate(Gia_Man_t *pAig, int fVerbose)
Definition: giaTsim.c:668
int Gia_ManRegBoxNum ( Gia_Man_t p)

Definition at line 53 of file giaTim.c.

54 {
55  return p->vRegClasses ? Vec_IntSize(p->vRegClasses) : 0;
56 }
Vec_Int_t * vRegClasses
Definition: gia.h:144
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Gia_ManRegNum ( Gia_Man_t p)
inlinestatic

Definition at line 387 of file gia.h.

387 { return p->nRegs; }
int nRegs
Definition: gia.h:99
Gia_Man_t* Gia_ManRehash ( Gia_Man_t p,
int  fAddStrash 
)

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

Synopsis [Rehashes AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 719 of file giaHash.c.

720 {
721  Gia_Man_t * pNew, * pTemp;
722  Gia_Obj_t * pObj;
723  int i;
724  pNew = Gia_ManStart( Gia_ManObjNum(p) );
725  pNew->pName = Abc_UtilStrsav( p->pName );
726  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
727  pNew->fAddStrash = fAddStrash;
728  Gia_ManHashAlloc( pNew );
729  Gia_ManConst0(p)->Value = 0;
730  Gia_ManForEachObj( p, pObj, i )
731  {
732  //if ( Gia_ObjIsBuf(pObj) )
733  // pObj->Value = Gia_ManAppendBuf( pNew, Gia_ObjFanin0Copy(pObj) );
734  //else
735  if ( Gia_ObjIsAnd(pObj) )
736  pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
737  else if ( Gia_ObjIsCi(pObj) )
738  pObj->Value = Gia_ManAppendCi( pNew );
739  else if ( Gia_ObjIsCo(pObj) )
740  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
741  }
742  Gia_ManHashStop( pNew );
743  pNew->fAddStrash = 0;
744  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
745 // printf( "Top gate is %s\n", Gia_ObjFaninC0(Gia_ManCo(pNew, 0))? "OR" : "AND" );
746  pNew = Gia_ManCleanup( pTemp = pNew );
747  Gia_ManStop( pTemp );
748  return pNew;
749 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
Definition: gia.h:75
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
char * pName
Definition: gia.h:97
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
Definition: gia.h:95
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
unsigned Value
Definition: gia.h:87
int fAddStrash
Definition: gia.h:112
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManRemoveEnables ( Gia_Man_t p)

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

Synopsis [Transform seq circuits with enables by removing enables.]

Description []

SideEffects []

SeeAlso []

Definition at line 514 of file giaEnable.c.

515 {
516  Vec_Ptr_t * vCtrls, * vDatas;
517  Vec_Int_t * vFlopClasses;
518  Gia_Man_t * pNew, * pAux;
519  Gia_Obj_t * pFlopIn, * pFlopOut, * pDriver, * pFan0, * pFan1, * pCtrl, * pData, * pObj;
520  int i, iClass, fCompl, Counter = 0;
521  vCtrls = Vec_PtrAlloc( 100 );
522  Vec_PtrPush( vCtrls, NULL );
523  vDatas = Vec_PtrAlloc( Gia_ManRegNum(p) );
524  vFlopClasses = Vec_IntAlloc( Gia_ManRegNum(p) );
525  Gia_ManForEachRi( p, pFlopIn, i )
526  {
527  fCompl = Gia_ObjFaninC0(pFlopIn);
528  pDriver = Gia_ObjFanin0(pFlopIn);
529  if ( !Gia_ObjIsAnd(pDriver) )
530  {
531  printf( "The flop driver %d is not a node.\n", i );
532  Vec_PtrPush( vDatas, NULL );
533  Vec_IntPush( vFlopClasses, 0 );
534  Counter++;
535  continue;
536  }
537  if ( !Gia_ObjFaninC0(pDriver) || !Gia_ObjFaninC1(pDriver) )
538  {
539  printf( "The flop driver %d is not an OR gate.\n", i );
540  Vec_PtrPush( vDatas, NULL );
541  Vec_IntPush( vFlopClasses, 0 );
542  Counter++;
543  continue;
544  }
545  pFan0 = Gia_ObjFanin0(pDriver);
546  pFan1 = Gia_ObjFanin1(pDriver);
547  if ( !Gia_ObjIsAnd(pFan0) || !Gia_ObjIsAnd(pFan1) )
548  {
549  printf( "The flop driver fanin %d is not a node.\n", i );
550  Vec_PtrPush( vDatas, NULL );
551  Vec_IntPush( vFlopClasses, 0 );
552  Counter++;
553  continue;
554  }
555  pFlopOut = Gia_ObjRiToRo( p, pFlopIn );
556  pFlopOut = Gia_NotCond( pFlopOut, !fCompl );
557  if ( Gia_ObjChild0(pFan0) != pFlopOut && Gia_ObjChild1(pFan0) != pFlopOut &&
558  Gia_ObjChild0(pFan1) != pFlopOut && Gia_ObjChild1(pFan1) != pFlopOut )
559  {
560  printf( "The flop %d does not have a self-loop.\n", i );
561  Vec_PtrPush( vDatas, NULL );
562  Vec_IntPush( vFlopClasses, 0 );
563  Counter++;
564  continue;
565  }
566  pData = NULL;
567  if ( Gia_ObjChild0(pFan0) == pFlopOut )
568  {
569  pCtrl = Gia_Not( Gia_ObjChild1(pFan0) );
570  if ( Gia_ObjFanin0(pFan1) == Gia_Regular(pCtrl) )
571  pData = Gia_ObjChild1(pFan1);
572  else
573  pData = Gia_ObjChild0(pFan1);
574  }
575  else if ( Gia_ObjChild1(pFan0) == pFlopOut )
576  {
577  pCtrl = Gia_Not( Gia_ObjChild0(pFan0) );
578  if ( Gia_ObjFanin0(pFan1) == Gia_Regular(pCtrl) )
579  pData = Gia_ObjChild1(pFan1);
580  else
581  pData = Gia_ObjChild0(pFan1);
582  }
583  else if ( Gia_ObjChild0(pFan1) == pFlopOut )
584  {
585  pCtrl = Gia_Not( Gia_ObjChild1(pFan1) );
586  if ( Gia_ObjFanin0(pFan0) == Gia_Regular(pCtrl) )
587  pData = Gia_ObjChild1(pFan0);
588  else
589  pData = Gia_ObjChild0(pFan0);
590  }
591  else if ( Gia_ObjChild1(pFan1) == pFlopOut )
592  {
593  pCtrl = Gia_Not( Gia_ObjChild0(pFan1) );
594  if ( Gia_ObjFanin0(pFan0) == Gia_Regular(pCtrl) )
595  pData = Gia_ObjChild1(pFan0);
596  else
597  pData = Gia_ObjChild0(pFan0);
598  }
599  else assert( 0 );
600  if ( Vec_PtrFind( vCtrls, pCtrl ) == -1 )
601  Vec_PtrPush( vCtrls, pCtrl );
602  iClass = Vec_PtrFind( vCtrls, pCtrl );
603  pData = Gia_NotCond( pData, !fCompl );
604  Vec_PtrPush( vDatas, pData );
605  Vec_IntPush( vFlopClasses, iClass );
606  }
607  assert( Vec_PtrSize( vDatas ) == Gia_ManRegNum(p) );
608  assert( Vec_IntSize( vFlopClasses ) == Gia_ManRegNum(p) );
609  printf( "Detected %d classes.\n", Vec_PtrSize(vCtrls) - (Counter == 0) );
610  Vec_PtrFree( vCtrls );
611 
612 
613  pNew = Gia_ManStart( Gia_ManObjNum(p) );
614  pNew->pName = Abc_UtilStrsav( p->pName );
615  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
616  Gia_ManConst0(p)->Value = 0;
617  Gia_ManForEachObj1( p, pObj, i )
618  {
619  if ( Gia_ObjIsAnd(pObj) )
620  pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
621  else if ( Gia_ObjIsCi(pObj) )
622  pObj->Value = Gia_ManAppendCi( pNew );
623  else if ( Gia_ObjIsPo(p, pObj) )
624  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
625  }
626  Gia_ManForEachRi( p, pObj, i )
627  {
628  pData = (Gia_Obj_t *)Vec_PtrEntry(vDatas, i);
629  if ( pData == NULL )
630  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
631  else
632  pObj->Value = Gia_ManAppendCo( pNew, Abc_LitNotCond(Gia_Regular(pData)->Value, Gia_IsComplement(pData)) );
633  }
634  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
635  Vec_PtrFree( vDatas );
636 
637 
638  pNew = Gia_ManCleanup( pAux = pNew );
639  Gia_ManStop( pAux );
640  pNew->vFlopClasses = vFlopClasses;
641  return pNew;
642 }
static int Gia_ManAppendAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: gia.h:592
static Gia_Obj_t * Gia_ObjChild0(Gia_Obj_t *pObj)
Definition: gia.h:457
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static Gia_Obj_t * Gia_NotCond(Gia_Obj_t *p, int c)
Definition: gia.h:379
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Gia_Obj_t * Gia_Regular(Gia_Obj_t *p)
Definition: gia.h:377
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
Vec_Int_t * vFlopClasses
Definition: gia.h:140
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
Definition: gia.h:75
static int Vec_PtrFind(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:694
static Gia_Obj_t * Gia_ObjChild1(Gia_Obj_t *pObj)
Definition: gia.h:458
static Gia_Obj_t * Gia_Not(Gia_Obj_t *p)
Definition: gia.h:378
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
char * pName
Definition: gia.h:97
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Counter
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Gia_IsComplement(Gia_Obj_t *p)
Definition: gia.h:380
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static Gia_Obj_t * Gia_ObjRiToRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:447
Definition: gia.h:95
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
static int Gia_ObjIsPo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:442
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
#define Gia_ManForEachRi(p, pObj, i)
Definition: gia.h:1040
#define Gia_ManForEachObj1(p, pObj, i)
Definition: gia.h:986
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
void Gia_ManReportImprovement ( Gia_Man_t p,
Gia_Man_t pNew 
)

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

Synopsis [Reports the reduction of the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 646 of file giaMan.c.

647 {
648  Abc_Print( 1, "REG: Beg = %5d. End = %5d. (R =%5.1f %%) ",
649  Gia_ManRegNum(p), Gia_ManRegNum(pNew),
650  Gia_ManRegNum(p)? 100.0*(Gia_ManRegNum(p)-Gia_ManRegNum(pNew))/Gia_ManRegNum(p) : 0.0 );
651  Abc_Print( 1, "AND: Beg = %6d. End = %6d. (R =%5.1f %%)",
652  Gia_ManAndNum(p), Gia_ManAndNum(pNew),
653  Gia_ManAndNum(p)? 100.0*(Gia_ManAndNum(p)-Gia_ManAndNum(pNew))/Gia_ManAndNum(p) : 0.0 );
654  Abc_Print( 1, "\n" );
655 }
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Vec_Int_t* Gia_ManRequiredLevel ( Gia_Man_t p)

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

Synopsis [Compute required levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 639 of file giaUtil.c.

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

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

Synopsis [Derives the cut for forward retiming.]

Description [Assumes topological ordering of the nodes.]

SideEffects []

SeeAlso []

Definition at line 267 of file giaRetime.c.

268 {
269  Gia_Man_t * pNew, * pTemp;
270  int i, nRegFixed, nRegMoves = 1;
271  abctime clk;
272  pNew = p;
273  for ( i = 0; i < nMaxIters && nRegMoves > 0; i++ )
274  {
275  clk = Abc_Clock();
276  pNew = Gia_ManRetimeForwardOne( pTemp = pNew, &nRegFixed, &nRegMoves );
277  if ( fVerbose )
278  {
279  printf( "%2d : And = %6d. Reg = %5d. Unret = %5d. Move = %6d. ",
280  i + 1, Gia_ManAndNum(pTemp), Gia_ManRegNum(pTemp), nRegFixed, nRegMoves );
281  ABC_PRT( "Time", Abc_Clock() - clk );
282  }
283  if ( pTemp != p )
284  Gia_ManStop( pTemp );
285  }
286 /*
287  clk = Abc_Clock();
288  pNew = Gia_ManReduceLaches( pNew, fVerbose );
289  if ( fVerbose )
290  {
291  ABC_PRT( "Register sharing time", Abc_Clock() - clk );
292  }
293 */
294  return pNew;
295 }
Gia_Man_t * Gia_ManRetimeForwardOne(Gia_Man_t *p, int *pnRegFixed, int *pnRegMoves)
Definition: giaRetime.c:180
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
Definition: gia.h:95
#define ABC_PRT(a, t)
Definition: abc_global.h:220
ABC_INT64_T abctime
Definition: abc_global.h:278
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Vec_Int_t* Gia_ManReverseLevel ( Gia_Man_t p)

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

Synopsis [Compute reverse levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 595 of file giaUtil.c.

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

Definition at line 408 of file gia.h.

408 { assert( v < Gia_ManRegNum(p) ); return Gia_ManCo( p, Gia_ManPoNum(p)+v ); }
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static Gia_Obj_t * Gia_ManCo(Gia_Man_t *p, int v)
Definition: gia.h:404
#define assert(ex)
Definition: util_old.h:213
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
static Gia_Obj_t* Gia_ManRo ( Gia_Man_t p,
int  v 
)
inlinestatic

Definition at line 407 of file gia.h.

407 { assert( v < Gia_ManRegNum(p) ); return Gia_ManCi( p, Gia_ManPiNum(p)+v ); }
static Gia_Obj_t * Gia_ManCi(Gia_Man_t *p, int v)
Definition: gia.h:403
#define assert(ex)
Definition: util_old.h:213
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Vec_Int_t* Gia_ManSaveValue ( Gia_Man_t p)

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

Synopsis [Save/load value from file.]

Description []

SideEffects []

SeeAlso []

Definition at line 1605 of file giaUtil.c.

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

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

Synopsis [Performs sequential cleanup.]

Description []

SideEffects []

SeeAlso []

Definition at line 183 of file giaScl.c.

184 {
185  Gia_ManSeqMarkUsed( p );
186  return Gia_ManDupMarked( p );
187 }
Gia_Man_t * Gia_ManDupMarked(Gia_Man_t *p)
Definition: giaDup.c:975
int Gia_ManSeqMarkUsed(Gia_Man_t *p)
Definition: giaScl.c:156
int Gia_ManSeqMarkUsed ( Gia_Man_t p)

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

Synopsis [Marks CIs/COs/ANDs unreachable from POs.]

Description []

SideEffects []

SeeAlso []

Definition at line 156 of file giaScl.c.

157 {
158  Vec_Int_t * vRoots;
159  Gia_Obj_t * pObj;
160  int i, nNodes = 0;
161  Gia_ManSetMark0( p );
162  Gia_ManConst0(p)->fMark0 = 0;
163  Gia_ManForEachPi( p, pObj, i )
164  pObj->fMark0 = 0;
165  vRoots = Gia_ManCollectPoIds( p );
166  Gia_ManForEachObjVec( vRoots, p, pObj, i )
167  nNodes += Gia_ManSeqMarkUsed_rec( p, pObj, vRoots );
168  Vec_IntFree( vRoots );
169  return nNodes;
170 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Definition: gia.h:75
int Gia_ManSeqMarkUsed_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vRoots)
Definition: giaScl.c:128
void Gia_ManSetMark0(Gia_Man_t *p)
Definition: giaUtil.c:196
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition: gia.h:988
unsigned fMark0
Definition: gia.h:79
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
Vec_Int_t * Gia_ManCollectPoIds(Gia_Man_t *p)
Definition: giaUtil.c:863
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Gia_Man_t* Gia_ManSeqStructSweep ( Gia_Man_t p,
int  fConst,
int  fEquiv,
int  fVerbose 
)

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

Synopsis [Performs sequential cleanup.]

Description []

SideEffects []

SeeAlso []

Definition at line 258 of file giaScl.c.

259 {
260  Gia_Man_t * pTemp;
261  if ( Gia_ManRegNum(p) == 0 )
262  return Gia_ManCleanup( p );
263  if ( fVerbose )
264  printf( "Performing sequential cleanup.\n" );
265  p = Gia_ManSeqCleanup( pTemp = p );
266  if ( fVerbose )
267  Gia_ManReportImprovement( pTemp, p );
268  if ( fConst && Gia_ManRegNum(p) )
269  {
270  p = Gia_ManReduceConst( pTemp = p, fVerbose );
271  if ( fVerbose )
272  Gia_ManReportImprovement( pTemp, p );
273  Gia_ManStop( pTemp );
274  }
275  if ( fVerbose && fEquiv )
276  printf( "Merging combinationally equivalent flops.\n" );
277  if ( fEquiv )
278  while ( 1 )
279  {
280  p = Gia_ManSeqCleanup( pTemp = p );
281  if ( fVerbose )
282  Gia_ManReportImprovement( pTemp, p );
283  Gia_ManStop( pTemp );
284  if ( Gia_ManRegNum(p) == 0 )
285  break;
286  p = Gia_ManReduceEquiv( pTemp = p, fVerbose );
287  if ( p == pTemp )
288  break;
289  Gia_ManStop( pTemp );
290  }
291  return p;
292 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
Gia_Man_t * Gia_ManReduceConst(Gia_Man_t *pAig, int fVerbose)
Definition: giaTsim.c:737
Gia_Man_t * Gia_ManSeqCleanup(Gia_Man_t *p)
Definition: giaScl.c:183
void Gia_ManReportImprovement(Gia_Man_t *p, Gia_Man_t *pNew)
Definition: giaMan.c:646
Definition: gia.h:95
Gia_Man_t * Gia_ManReduceEquiv(Gia_Man_t *p, int fVerbose)
Definition: giaScl.c:200
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
int Gia_ManSetFailedPoCex ( Gia_Man_t pAig,
Abc_Cex_t p 
)

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

Synopsis [Determines the failed PO when its exact frame is not known.]

Description []

SideEffects []

SeeAlso []

Definition at line 135 of file giaCex.c.

136 {
137  Gia_Obj_t * pObj, * pObjRi, * pObjRo;
138  int i, k, iBit = 0;
139  assert( Gia_ManPiNum(pAig) == p->nPis );
140  Gia_ManCleanMark0(pAig);
141  p->iPo = -1;
142 // Gia_ManForEachRo( pAig, pObj, i )
143 // pObj->fMark0 = Abc_InfoHasBit(p->pData, iBit++);
144  iBit = p->nRegs;
145  for ( i = 0; i <= p->iFrame; i++ )
146  {
147  Gia_ManForEachPi( pAig, pObj, k )
148  pObj->fMark0 = Abc_InfoHasBit(p->pData, iBit++);
149  Gia_ManForEachAnd( pAig, pObj, k )
150  pObj->fMark0 = (Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj)) &
151  (Gia_ObjFanin1(pObj)->fMark0 ^ Gia_ObjFaninC1(pObj));
152  Gia_ManForEachCo( pAig, pObj, k )
153  pObj->fMark0 = Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj);
154  Gia_ManForEachRiRo( pAig, pObjRi, pObjRo, k )
155  pObjRo->fMark0 = pObjRi->fMark0;
156  // check the POs
157  Gia_ManForEachPo( pAig, pObj, k )
158  {
159  if ( !pObj->fMark0 )
160  continue;
161  p->iPo = k;
162  p->iFrame = i;
163  p->nBits = iBit;
164  break;
165  }
166  }
167  Gia_ManCleanMark0(pAig);
168  return p->iPo;
169 }
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
void Gia_ManCleanMark0(Gia_Man_t *p)
Definition: giaUtil.c:215
Definition: gia.h:75
#define Gia_ManForEachRiRo(p, pObjRi, pObjRo, i)
Definition: gia.h:1042
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
void Gia_ManSetIfParsDefault ( void *  pp)

FUNCTION DEFINITIONS ///.

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

Synopsis [Load the network into FPGA manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 57 of file giaIf.c.

58 {
59  If_Par_t * pPars = (If_Par_t *)pp;
60 // extern void * Abc_FrameReadLibLut();
61  If_Par_t * p = (If_Par_t *)pPars;
62  // set defaults
63  memset( p, 0, sizeof(If_Par_t) );
64  // user-controlable paramters
65  p->nLutSize = -1;
66 // p->nLutSize = 6;
67  p->nCutsMax = 8;
68  p->nFlowIters = 1;
69  p->nAreaIters = 2;
70  p->DelayTarget = -1;
71  p->Epsilon = (float)0.005;
72  p->fPreprocess = 1;
73  p->fArea = 0;
74  p->fFancy = 0;
75  p->fExpRed = 1; ////
76  p->fLatchPaths = 0;
77  p->fEdge = 1;
78  p->fPower = 0;
79  p->fCutMin = 0;
80  p->fVerbose = 0;
81  p->pLutStruct = NULL;
82  // internal parameters
83  p->fTruth = 0;
84  p->nLatchesCi = 0;
85  p->nLatchesCo = 0;
86  p->fLiftLeaves = 0;
87  p->fUseCoAttrs = 1; // use CO attributes
88  p->pLutLib = NULL;
89  p->pTimesArr = NULL;
90  p->pTimesReq = NULL;
91  p->pFuncCost = NULL;
92 }
char * memset()
int nLutSize
Definition: if.h:103
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Definition: if.h:100
int fVerbose
Definition: if.h:140
char * pLutStruct
Definition: if.h:141
int(* pFuncCost)(If_Man_t *, If_Cut_t *)
Definition: if.h:163
int fUseCoAttrs
Definition: if.h:157
int nLatchesCi
Definition: if.h:152
int fExpRed
Definition: if.h:116
int nFlowIters
Definition: if.h:105
int fEdge
Definition: if.h:118
int fPreprocess
Definition: if.h:113
int fTruth
Definition: if.h:146
int fLatchPaths
Definition: if.h:117
float * pTimesArr
Definition: if.h:161
float Epsilon
Definition: if.h:110
float * pTimesReq
Definition: if.h:162
int fFancy
Definition: if.h:115
float DelayTarget
Definition: if.h:109
int nLatchesCo
Definition: if.h:153
int nAreaIters
Definition: if.h:106
int fPower
Definition: if.h:119
int fCutMin
Definition: if.h:120
int nCutsMax
Definition: if.h:104
int fArea
Definition: if.h:114
int fLiftLeaves
Definition: if.h:156
If_LibLut_t * pLutLib
Definition: if.h:160
int Gia_ManSetLevels ( Gia_Man_t p,
Vec_Int_t vCiLevels 
)

Definition at line 558 of file giaUtil.c.

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

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

Synopsis [Sets phases of the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 196 of file giaUtil.c.

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

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

Synopsis [Sets phases of the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 253 of file giaUtil.c.

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

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

Synopsis [Sets phases of the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 379 of file giaUtil.c.

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

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

Synopsis [Sets phases of the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 409 of file giaUtil.c.

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

Definition at line 386 of file giaUtil.c.

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

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

Synopsis [Assigns levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 245 of file giaIf.c.

246 {
247  Gia_Obj_t * pObj;
248  int i, k, iFan;
249  ABC_FREE( p->pRefs );
250  p->pRefs = ABC_CALLOC( int, Gia_ManObjNum(p) );
251  Gia_ManForEachCo( p, pObj, i )
252  Gia_ObjRefInc( p, Gia_ObjFanin0(pObj) );
253  Gia_ManForEachLut( p, i )
254  Gia_LutForEachFanin( p, i, iFan, k )
255  Gia_ObjRefInc( p, Gia_ManObj(p, iFan) );
256 }
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
int * pRefs
Definition: gia.h:114
Definition: gia.h:75
#define Gia_ManForEachLut(p, i)
Definition: gia.h:968
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjRefInc(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:522
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define Gia_LutForEachFanin(p, i, iFan, k)
Definition: gia.h:970
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManSetRegNum ( Gia_Man_t p,
int  nRegs 
)

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

Synopsis [Prints stats for the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 628 of file giaMan.c.

629 {
630  assert( p->nRegs == 0 );
631  p->nRegs = nRegs;
632 }
int nRegs
Definition: gia.h:99
#define assert(ex)
Definition: util_old.h:213
void Gia_ManSimInfoInit ( Gia_ManSim_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 429 of file giaSim.c.

430 {
431  int iPioNum, i;
432  Vec_IntForEachEntry( p->vCis2Ids, iPioNum, i )
433  {
434  if ( iPioNum < Gia_ManPiNum(p->pAig) )
436  else
437  Gia_ManSimInfoZero( p, Gia_SimDataCi(p, i) );
438  }
439 }
Vec_Int_t * vCis2Ids
Definition: gia.h:256
Gia_Man_t * pAig
Definition: gia.h:253
static void Gia_ManSimInfoRandom(Gia_ManSim_t *p, unsigned *pInfo)
Definition: giaSim.c:256
static void Gia_ManSimInfoZero(Gia_ManSim_t *p, unsigned *pInfo)
Definition: giaSim.c:274
static unsigned * Gia_SimDataCi(Gia_ManSim_t *p, int i)
Definition: giaSim.c:31
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
void Gia_ManSimInfoTransfer ( Gia_ManSim_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 452 of file giaSim.c.

453 {
454  int iPioNum, i;
455  Vec_IntForEachEntry( p->vCis2Ids, iPioNum, i )
456  {
457  if ( iPioNum < Gia_ManPiNum(p->pAig) )
459  else
461  }
462 }
Vec_Int_t * vCis2Ids
Definition: gia.h:256
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static unsigned * Gia_SimDataCo(Gia_ManSim_t *p, int i)
Definition: giaSim.c:32
Gia_Man_t * pAig
Definition: gia.h:253
static void Gia_ManSimInfoRandom(Gia_ManSim_t *p, unsigned *pInfo)
Definition: giaSim.c:256
static void Gia_ManSimInfoCopy(Gia_ManSim_t *p, unsigned *pInfo, unsigned *pInfo0)
Definition: giaSim.c:330
static unsigned * Gia_SimDataCi(Gia_ManSim_t *p, int i)
Definition: giaSim.c:31
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
void Gia_ManSimSetDefaultParams ( Gia_ParSim_t p)

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

Synopsis [This procedure sets default parameters.]

Description []

SideEffects []

SeeAlso []

Definition at line 164 of file giaSim.c.

165 {
166  memset( p, 0, sizeof(Gia_ParSim_t) );
167  // user-controlled parameters
168  p->nWords = 8; // the number of machine words
169  p->nIters = 32; // the number of timeframes
170  p->RandSeed = 0; // the seed to generate random numbers
171  p->TimeLimit = 60; // time limit in seconds
172  p->fCheckMiter = 0; // check if miter outputs are non-zero
173  p->fVerbose = 0; // enables verbose output
174  p->iOutFail = -1; // index of the failed output
175 }
char * memset()
int nWords
Definition: gia.h:241
int RandSeed
Definition: gia.h:243
int fVerbose
Definition: gia.h:246
int fCheckMiter
Definition: gia.h:245
int nIters
Definition: gia.h:242
int iOutFail
Definition: gia.h:247
int TimeLimit
Definition: gia.h:244
int Gia_ManSimSimulate ( Gia_Man_t pAig,
Gia_ParSim_t pPars 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 598 of file giaSim.c.

599 {
600  extern int Gia_ManSimSimulateEquiv( Gia_Man_t * pAig, Gia_ParSim_t * pPars );
601  Gia_ManSim_t * p;
602  abctime clkTotal = Abc_Clock();
603  int i, iOut, iPat, RetValue = 0;
604  abctime nTimeToStop = pPars->TimeLimit ? pPars->TimeLimit * CLOCKS_PER_SEC + Abc_Clock(): 0;
605  if ( pAig->pReprs && pAig->pNexts )
606  return Gia_ManSimSimulateEquiv( pAig, pPars );
607  ABC_FREE( pAig->pCexSeq );
608  p = Gia_ManSimCreate( pAig, pPars );
609  Gia_ManResetRandom( pPars );
610  Gia_ManSimInfoInit( p );
611  for ( i = 0; i < pPars->nIters; i++ )
612  {
614  if ( pPars->fVerbose )
615  {
616  Abc_Print( 1, "Frame %4d out of %4d and timeout %3d sec. ", i+1, pPars->nIters, pPars->TimeLimit );
617  Abc_Print( 1, "Time = %7.2f sec\r", (1.0*Abc_Clock()-clkTotal)/CLOCKS_PER_SEC );
618  }
619  if ( pPars->fCheckMiter && Gia_ManCheckPos( p, &iOut, &iPat ) )
620  {
621  Gia_ManResetRandom( pPars );
622  pPars->iOutFail = iOut;
623  pAig->pCexSeq = Gia_ManGenerateCounter( pAig, i, iOut, p->nWords, iPat, p->vCis2Ids );
624  Abc_Print( 1, "Output %d of miter \"%s\" was asserted in frame %d. ", iOut, pAig->pName, i );
625  if ( !Gia_ManVerifyCex( pAig, pAig->pCexSeq, 0 ) )
626  {
627 // Abc_Print( 1, "\n" );
628  Abc_Print( 1, "\nGenerated counter-example is INVALID. " );
629 // Abc_Print( 1, "\n" );
630  }
631  else
632  {
633 // Abc_Print( 1, "\n" );
634 // if ( pPars->fVerbose )
635 // Abc_Print( 1, "\nGenerated counter-example is verified correctly. " );
636 // Abc_Print( 1, "\n" );
637  }
638  RetValue = 1;
639  break;
640  }
641  if ( Abc_Clock() > nTimeToStop )
642  {
643  i++;
644  break;
645  }
646  if ( i < pPars->nIters - 1 )
648  }
649  Gia_ManSimDelete( p );
650  if ( pAig->pCexSeq == NULL )
651  Abc_Print( 1, "No bug detected after simulating %d frames with %d words. ", i, pPars->nWords );
652  Abc_PrintTime( 1, "Time", Abc_Clock() - clkTotal );
653  return RetValue;
654 }
Vec_Int_t * vCis2Ids
Definition: gia.h:256
int nWords
Definition: gia.h:241
int Gia_ManVerifyCex(Gia_Man_t *pAig, Abc_Cex_t *p, int fDualOut)
DECLARATIONS ///.
Definition: giaCex.c:44
int * pNexts
Definition: gia.h:122
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nWords
Definition: gia.h:255
static abctime Abc_Clock()
Definition: abc_global.h:279
void Gia_ManSimInfoInit(Gia_ManSim_t *p)
Definition: giaSim.c:429
int fVerbose
Definition: gia.h:246
static int Gia_ManCheckPos(Gia_ManSim_t *p, int *piPo, int *piPat)
Definition: giaSim.c:515
void Gia_ManSimDelete(Gia_ManSim_t *p)
Definition: giaSim.c:188
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
void Gia_ManSimInfoTransfer(Gia_ManSim_t *p)
Definition: giaSim.c:452
Abc_Cex_t * Gia_ManGenerateCounter(Gia_Man_t *pAig, int iFrame, int iOut, int nWords, int iPat, Vec_Int_t *vCis2Ids)
Definition: giaSim.c:542
char * pName
Definition: gia.h:97
int fCheckMiter
Definition: gia.h:245
Gia_ManSim_t * Gia_ManSimCreate(Gia_Man_t *pAig, Gia_ParSim_t *pPars)
Definition: giaSim.c:210
int nIters
Definition: gia.h:242
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
#define ABC_FREE(obj)
Definition: abc_global.h:232
Definition: gia.h:95
void Gia_ManResetRandom(Gia_ParSim_t *pPars)
Definition: giaSim.c:579
void Gia_ManSimulateRound(Gia_ManSim_t *p)
Definition: giaSim.c:475
Gia_Rpr_t * pReprs
Definition: gia.h:121
int iOutFail
Definition: gia.h:247
int Gia_ManSimSimulateEquiv(Gia_Man_t *pAig, Gia_ParSim_t *pPars)
Definition: giaSim2.c:638
ABC_INT64_T abctime
Definition: abc_global.h:278
Abc_Cex_t * pCexSeq
Definition: gia.h:136
int TimeLimit
Definition: gia.h:244
void Gia_ManSimulateRound ( Gia_ManSim_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 475 of file giaSim.c.

476 {
477  Gia_Obj_t * pObj;
478  int i, iCis = 0, iCos = 0;
479  assert( p->pAig->nFront > 0 );
480  assert( Gia_ManConst0(p->pAig)->Value == 0 );
481  Gia_ManSimInfoZero( p, Gia_SimData(p, 0) );
482  Gia_ManForEachObj1( p->pAig, pObj, i )
483  {
484  if ( Gia_ObjIsAndOrConst0(pObj) )
485  {
486  assert( Gia_ObjValue(pObj) < p->pAig->nFront );
487  Gia_ManSimulateNode( p, pObj );
488  }
489  else if ( Gia_ObjIsCo(pObj) )
490  {
491  assert( Gia_ObjValue(pObj) == GIA_NONE );
492  Gia_ManSimulateCo( p, iCos++, pObj );
493  }
494  else // if ( Gia_ObjIsCi(pObj) )
495  {
496  assert( Gia_ObjValue(pObj) < p->pAig->nFront );
497  Gia_ManSimulateCi( p, pObj, iCis++ );
498  }
499  }
500  assert( Gia_ManCiNum(p->pAig) == iCis );
501  assert( Gia_ManCoNum(p->pAig) == iCos );
502 }
static void Gia_ManSimulateNode(Gia_ManSim_t *p, Gia_Obj_t *pObj)
Definition: giaSim.c:392
int nFront
Definition: gia.h:119
static int Gia_ObjValue(Gia_Obj_t *pObj)
Definition: gia.h:413
static void Gia_ManSimulateCi(Gia_ManSim_t *p, Gia_Obj_t *pObj, int iCi)
Definition: giaSim.c:348
Definition: gia.h:75
static void Gia_ManSimulateCo(Gia_ManSim_t *p, int iCo, Gia_Obj_t *pObj)
Definition: giaSim.c:368
Gia_Man_t * pAig
Definition: gia.h:253
static void Gia_ManSimInfoZero(Gia_ManSim_t *p, unsigned *pInfo)
Definition: giaSim.c:274
static int Gia_ObjIsAndOrConst0(Gia_Obj_t *pObj)
Definition: gia.h:419
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define GIA_NONE
INCLUDES ///.
Definition: gia.h:44
static ABC_NAMESPACE_IMPL_START unsigned * Gia_SimData(Gia_ManSim_t *p, int i)
DECLARATIONS ///.
Definition: giaSim.c:30
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
#define Gia_ManForEachObj1(p, pObj, i)
Definition: gia.h:986
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
void Gia_ManSolveProblem ( Gia_Man_t pGia,
Emb_Par_t pPars 
)

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

Synopsis [Computes dimentions of the graph.]

Description []

SideEffects []

SeeAlso []

Definition at line 1791 of file giaEmbed.c.

1792 {
1793  Emb_Man_t * p;
1794  int i;
1795  abctime clkSetup;
1796  abctime clk;
1797 // Gia_ManTestDistance( pGia );
1798 
1799  // transform AIG into internal data-structure
1800 clk = Abc_Clock();
1801  if ( pPars->fCluster )
1802  {
1803  p = Emb_ManStart( pGia );
1804  if ( pPars->fVerbose )
1805  {
1806  printf( "Clustered: " );
1807  Emb_ManPrintStats( p );
1808  }
1809  }
1810  else
1811  p = Emb_ManStartSimple( pGia );
1812  p->fVerbose = pPars->fVerbose;
1813 // Emb_ManPrintFanio( p );
1814 
1815  // prepare data-structure
1816  Gia_ManRandom( 1 ); // reset random numbers for deterministic behavior
1817  Emb_ManResetTravId( p );
1818  Emb_ManSetValue( p );
1819 clkSetup = Abc_Clock() - clk;
1820 
1821 clk = Abc_Clock();
1822  Emb_ManComputeDimensions( p, pPars->nDims );
1823 if ( pPars->fVerbose )
1824 ABC_PRT( "Setup ", clkSetup );
1825 if ( pPars->fVerbose )
1826 ABC_PRT( "Dimensions", Abc_Clock() - clk );
1827 
1828 clk = Abc_Clock();
1829  Emb_ManComputeCovariance( p, pPars->nDims );
1830 if ( pPars->fVerbose )
1831 ABC_PRT( "Matrix ", Abc_Clock() - clk );
1832 
1833 clk = Abc_Clock();
1834  Emb_ManComputeEigenvectors( p, pPars->nDims, pPars->nSols );
1835  Emb_ManComputeSolutions( p, pPars->nDims, pPars->nSols );
1836  Emb_ManDerivePlacement( p, pPars->nSols );
1837 if ( pPars->fVerbose )
1838 ABC_PRT( "Eigenvecs ", Abc_Clock() - clk );
1839 
1840  if ( pPars->fRefine )
1841  {
1842 clk = Abc_Clock();
1843  Emb_ManPlacementRefine( p, pPars->nIters, pPars->fVerbose );
1844 if ( pPars->fVerbose )
1845 ABC_PRT( "Refinement", Abc_Clock() - clk );
1846  }
1847 
1848  if ( (pPars->fDump || pPars->fDumpLarge) && pPars->nSols == 2 )
1849  {
1850 clk = Abc_Clock();
1851  Emb_ManDumpGnuplot( p, pGia->pName, pPars->fDumpLarge, pPars->fShowImage );
1852 if ( pPars->fVerbose )
1853 ABC_PRT( "Image dump", Abc_Clock() - clk );
1854  }
1855 
1856  // transfer placement
1857  if ( Gia_ManObjNum(pGia) == p->nObjs )
1858  {
1859  // assuming normalized ordering of the AIG
1860  pGia->pPlacement = ABC_CALLOC( Gia_Plc_t, p->nObjs );
1861  for ( i = 0; i < p->nObjs; i++ )
1862  {
1863  pGia->pPlacement[i].xCoord = p->pPlacement[2*i+0];
1864  pGia->pPlacement[i].yCoord = p->pPlacement[2*i+1];
1865  }
1866  }
1867  Emb_ManStop( p );
1868 }
int nDims
Definition: gia.h:211
void Emb_ManDerivePlacement(Emb_Man_t *p, int nSols)
Definition: giaEmbed.c:1427
void Emb_ManPlacementRefine(Emb_Man_t *p, int nIters, int fVerbose)
Definition: giaEmbed.c:1524
int nIters
Definition: gia.h:213
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Emb_ManStop(Emb_Man_t *p)
Definition: giaEmbed.c:651
int fVerbose
Definition: gia.h:219
int fDumpLarge
Definition: gia.h:217
int nSols
Definition: gia.h:212
static abctime Abc_Clock()
Definition: abc_global.h:279
Emb_Man_t * Emb_ManStartSimple(Gia_Man_t *pGia)
Definition: giaEmbed.c:172
void Emb_ManPrintStats(Emb_Man_t *p)
Definition: giaEmbed.c:622
unsigned Gia_ManRandom(int fReset)
FUNCTION DEFINITIONS ///.
Definition: giaUtil.c:49
unsigned yCoord
Definition: gia.h:71
unsigned short * pPlacement
Definition: giaEmbed.c:87
char * pName
Definition: gia.h:97
int fShowImage
Definition: gia.h:218
void Emb_ManDumpGnuplot(Emb_Man_t *p, char *pName, int fDumpLarge, int fShowImage)
Definition: giaEmbed.c:1695
void Emb_ManComputeCovariance(Emb_Man_t *p, int nDims)
Definition: giaEmbed.c:1191
int fRefine
Definition: gia.h:214
void Emb_ManComputeDimensions(Emb_Man_t *p, int nDims)
Definition: giaEmbed.c:1102
static void Emb_ManResetTravId(Emb_Man_t *p)
Definition: giaEmbed.c:116
unsigned xCoord
Definition: gia.h:69
#define ABC_PRT(a, t)
Definition: abc_global.h:220
void Emb_ManSetValue(Emb_Man_t *p)
Definition: giaEmbed.c:470
Gia_Plc_t * pPlacement
Definition: gia.h:148
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
Emb_Man_t * Emb_ManStart(Gia_Man_t *pGia)
Definition: giaEmbed.c:493
int fCluster
Definition: gia.h:215
Definition: gia.h:66
void Emb_ManComputeSolutions(Emb_Man_t *p, int nDims, int nSols)
Definition: giaEmbed.c:1397
ABC_INT64_T abctime
Definition: abc_global.h:278
int nObjs
Definition: giaEmbed.c:75
int fDump
Definition: gia.h:216
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
int fVerbose
Definition: giaEmbed.c:80
void Emb_ManComputeEigenvectors(Emb_Man_t *p, int nDims, int nSols)
Definition: giaEmbed.c:1358
Gia_Man_t* Gia_ManSpecReduce ( Gia_Man_t p,
int  fDualOut,
int  fSynthesis,
int  fSpeculate,
int  fSkipSome,
int  fVerbose 
)

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

Synopsis [Reduces AIG using equivalence classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 848 of file giaEquiv.c.

849 {
850  Gia_Man_t * pNew, * pTemp;
851  Gia_Obj_t * pObj;
852  Vec_Int_t * vXorLits;
853  int i, iLitNew;
854  Vec_Int_t * vTrace = NULL, * vGuide = NULL;
855  if ( !p->pReprs )
856  {
857  Abc_Print( 1, "Gia_ManSpecReduce(): Equivalence classes are not available.\n" );
858  return NULL;
859  }
860  if ( fDualOut && (Gia_ManPoNum(p) & 1) )
861  {
862  Abc_Print( 1, "Gia_ManSpecReduce(): Dual-output miter should have even number of POs.\n" );
863  return NULL;
864  }
865  if ( fSkipSome )
866  {
867  vGuide = Vec_IntAlloc( 100 );
868  pTemp = Gia_ManSpecReduceTrace( p, vGuide, NULL );
869  Gia_ManStop( pTemp );
871  vTrace = Vec_IntAlloc( 100 );
872  }
873  vXorLits = Vec_IntAlloc( 1000 );
874  Gia_ManSetPhase( p );
875  Gia_ManFillValue( p );
876  if ( fDualOut )
877  Gia_ManEquivSetColors( p, fVerbose );
878  pNew = Gia_ManStart( Gia_ManObjNum(p) );
879  pNew->pName = Abc_UtilStrsav( p->pName );
880  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
881  Gia_ManHashAlloc( pNew );
882  Gia_ManConst0(p)->Value = 0;
883  Gia_ManForEachCi( p, pObj, i )
884  pObj->Value = Gia_ManAppendCi(pNew);
885  Gia_ManForEachRo( p, pObj, i )
886  Gia_ManSpecBuild( pNew, p, pObj, vXorLits, fDualOut, fSpeculate, vTrace, vGuide, NULL );
887  Gia_ManForEachCo( p, pObj, i )
888  Gia_ManSpecReduce_rec( pNew, p, Gia_ObjFanin0(pObj), vXorLits, fDualOut, fSpeculate, vTrace, vGuide, NULL );
889  if ( !fSynthesis )
890  {
891  Gia_ManForEachPo( p, pObj, i )
892  Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
893  }
894  Vec_IntForEachEntry( vXorLits, iLitNew, i )
895  Gia_ManAppendCo( pNew, iLitNew );
896  if ( Vec_IntSize(vXorLits) == 0 )
897  {
898  Abc_Print( 1, "Speculatively reduced model has no primary outputs.\n" );
899  Gia_ManAppendCo( pNew, 0 );
900  }
901  Gia_ManForEachRi( p, pObj, i )
902  Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
903  Gia_ManHashStop( pNew );
904  Vec_IntFree( vXorLits );
905  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
906  pNew = Gia_ManCleanup( pTemp = pNew );
907  Gia_ManStop( pTemp );
908 
909  // update using trace
910  if ( fSkipSome )
911  {
912  // count the number of non-zero entries
913  int iLit, nAddPos = 0;
914  Vec_IntForEachEntry( vGuide, iLit, i )
915  if ( iLit )
916  nAddPos++;
917  if ( nAddPos )
918  assert( Gia_ManPoNum(pNew) == Gia_ManPoNum(p) + nAddPos );
919  }
920  Vec_IntFreeP( &vTrace );
921  Vec_IntFreeP( &vGuide );
922  return pNew;
923 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
char * pName
Definition: gia.h:97
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
if(last==0)
Definition: sparse_int.h:34
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Gia_Man_t * Gia_ManSpecReduceTrace(Gia_Man_t *p, Vec_Int_t *vTrace, Vec_Int_t *vMap)
Definition: giaEquiv.c:792
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define Gia_ManForEachRo(p, pObj, i)
Definition: gia.h:1038
Gia_Rpr_t * pReprs
Definition: gia.h:121
static void Gia_ManSpecBuild(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vXorLits, int fDualOut, int fSpeculate, Vec_Int_t *vTrace, Vec_Int_t *vGuide, Vec_Int_t *vMap)
Definition: giaEquiv.c:728
#define assert(ex)
Definition: util_old.h:213
void Gia_ManSetPhase(Gia_Man_t *p)
Definition: giaUtil.c:379
unsigned Value
Definition: gia.h:87
#define Gia_ManForEachRi(p, pObj, i)
Definition: gia.h:1040
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
int Gia_ManEquivCountLitsAll(Gia_Man_t *p)
Definition: giaEquiv.c:160
void Gia_ManSpecReduce_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vXorLits, int fDualOut, int fSpeculate, Vec_Int_t *vTrace, Vec_Int_t *vGuide, Vec_Int_t *vMap)
Definition: giaEquiv.c:770
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
int Gia_ManEquivSetColors(Gia_Man_t *p, int fVerbose)
Definition: giaEquiv.c:692
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManSpecReduceInit ( Gia_Man_t p,
Abc_Cex_t pInit,
int  nFrames,
int  fDualOut 
)

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

Synopsis [Creates initialized SRM with the given number of frames.]

Description []

SideEffects []

SeeAlso []

Definition at line 985 of file giaEquiv.c.

986 {
987  Gia_Man_t * pNew, * pTemp;
988  Gia_Obj_t * pObj, * pObjRi, * pObjRo;
989  Vec_Int_t * vXorLits;
990  int f, i, iLitNew;
991  if ( !p->pReprs )
992  {
993  Abc_Print( 1, "Gia_ManSpecReduceInit(): Equivalence classes are not available.\n" );
994  return NULL;
995  }
996  if ( Gia_ManRegNum(p) == 0 )
997  {
998  Abc_Print( 1, "Gia_ManSpecReduceInit(): Circuit is not sequential.\n" );
999  return NULL;
1000  }
1001  if ( Gia_ManRegNum(p) != pInit->nRegs )
1002  {
1003  Abc_Print( 1, "Gia_ManSpecReduceInit(): Mismatch in the number of registers.\n" );
1004  return NULL;
1005  }
1006  if ( fDualOut && (Gia_ManPoNum(p) & 1) )
1007  {
1008  Abc_Print( 1, "Gia_ManSpecReduceInit(): Dual-output miter should have even number of POs.\n" );
1009  return NULL;
1010  }
1011 
1012 /*
1013  if ( !Gia_ManCheckTopoOrder( p ) )
1014  {
1015  Abc_Print( 1, "Gia_ManSpecReduceInit(): AIG is not in a correct topological order.\n" );
1016  return NULL;
1017  }
1018 */
1019  assert( pInit->nRegs == Gia_ManRegNum(p) && pInit->nPis == 0 );
1020  Vec_IntFill( &p->vCopies, nFrames * Gia_ManObjNum(p), -1 );
1021  vXorLits = Vec_IntAlloc( 1000 );
1022  Gia_ManSetPhase( p );
1023  if ( fDualOut )
1024  Gia_ManEquivSetColors( p, 0 );
1025  pNew = Gia_ManStart( nFrames * Gia_ManObjNum(p) );
1026  pNew->pName = Abc_UtilStrsav( p->pName );
1027  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1028  Gia_ManHashAlloc( pNew );
1029  Gia_ManForEachRo( p, pObj, i )
1030  Gia_ObjSetCopyF( p, 0, pObj, Abc_InfoHasBit(pInit->pData, i) );
1031  for ( f = 0; f < nFrames; f++ )
1032  {
1033  Gia_ObjSetCopyF( p, f, Gia_ManConst0(p), 0 );
1034  Gia_ManForEachPi( p, pObj, i )
1035  Gia_ObjSetCopyF( p, f, pObj, Gia_ManAppendCi(pNew) );
1036  Gia_ManForEachRo( p, pObj, i )
1037  Gia_ManSpecBuildInit( pNew, p, pObj, vXorLits, f, fDualOut );
1038  Gia_ManForEachCo( p, pObj, i )
1039  {
1040  Gia_ManSpecReduceInit_rec( pNew, p, Gia_ObjFanin0(pObj), vXorLits, f, fDualOut );
1041  Gia_ObjSetCopyF( p, f, pObj, Gia_ObjFanin0CopyF(p, f, pObj) );
1042  }
1043  if ( f == nFrames - 1 )
1044  break;
1045  Gia_ManForEachRiRo( p, pObjRi, pObjRo, i )
1046  Gia_ObjSetCopyF( p, f+1, pObjRo, Gia_ObjCopyF(p, f, pObjRi) );
1047  }
1048  Vec_IntForEachEntry( vXorLits, iLitNew, i )
1049  Gia_ManAppendCo( pNew, iLitNew );
1050  if ( Vec_IntSize(vXorLits) == 0 )
1051  {
1052 // Abc_Print( 1, "Speculatively reduced model has no primary outputs.\n" );
1053  Gia_ManAppendCo( pNew, 0 );
1054  }
1055  Vec_IntErase( &p->vCopies );
1056  Vec_IntFree( vXorLits );
1057  Gia_ManHashStop( pNew );
1058  pNew = Gia_ManCleanup( pTemp = pNew );
1059  Gia_ManStop( pTemp );
1060  return pNew;
1061 }
static void Gia_ObjSetCopyF(Gia_Man_t *p, int f, Gia_Obj_t *pObj, int iLit)
Definition: gia.h:486
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
static void Vec_IntErase(Vec_Int_t *p)
Definition: vecInt.h:266
for(p=first;p->value< newval;p=p->next)
Definition: gia.h:75
#define Gia_ManForEachRiRo(p, pObjRi, pObjRo, i)
Definition: gia.h:1042
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
char * pName
Definition: gia.h:97
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
if(last==0)
Definition: sparse_int.h:34
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
void Gia_ManSpecReduceInit_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vXorLits, int f, int fDualOut)
Definition: giaEquiv.c:963
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
void Gia_ManSpecBuildInit(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vXorLits, int f, int fDualOut)
Definition: giaEquiv.c:936
#define Gia_ManForEachRo(p, pObj, i)
Definition: gia.h:1038
Gia_Rpr_t * pReprs
Definition: gia.h:121
#define assert(ex)
Definition: util_old.h:213
void Gia_ManSetPhase(Gia_Man_t *p)
Definition: giaUtil.c:379
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static int Gia_ObjFanin0CopyF(Gia_Man_t *p, int f, Gia_Obj_t *pObj)
Definition: gia.h:491
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
int Gia_ManEquivSetColors(Gia_Man_t *p, int fVerbose)
Definition: giaEquiv.c:692
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
Vec_Int_t vCopies
Definition: gia.h:138
static int Gia_ObjCopyF(Gia_Man_t *p, int f, Gia_Obj_t *pObj)
Definition: gia.h:485
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManSpecReduceInitFrames ( Gia_Man_t p,
Abc_Cex_t pInit,
int  nFramesMax,
int *  pnFrames,
int  fDualOut,
int  nMinOutputs 
)

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

Synopsis [Creates initialized SRM with the given number of frames.]

Description [Uses as many frames as needed to create the number of output not less than the number of equivalence literals.]

SideEffects []

SeeAlso []

Definition at line 1075 of file giaEquiv.c.

1076 {
1077  Gia_Man_t * pFrames;
1078  int f, nLits;
1079  nLits = Gia_ManEquivCountLits( p );
1080  for ( f = 1; ; f++ )
1081  {
1082  pFrames = Gia_ManSpecReduceInit( p, pInit, f, fDualOut );
1083  if ( (nMinOutputs == 0 && Gia_ManPoNum(pFrames) >= nLits/2+1) ||
1084  (nMinOutputs != 0 && Gia_ManPoNum(pFrames) >= nMinOutputs) )
1085  break;
1086  if ( f == nFramesMax )
1087  break;
1088  if ( Gia_ManAndNum(pFrames) > 500000 )
1089  {
1090  Gia_ManStop( pFrames );
1091  return NULL;
1092  }
1093  Gia_ManStop( pFrames );
1094  pFrames = NULL;
1095  }
1096  if ( f == nFramesMax )
1097  Abc_Print( 1, "Stopped unrolling after %d frames.\n", nFramesMax );
1098  if ( pnFrames )
1099  *pnFrames = f;
1100  return pFrames;
1101 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
Gia_Man_t * Gia_ManSpecReduceInit(Gia_Man_t *p, Abc_Cex_t *pInit, int nFrames, int fDualOut)
Definition: giaEquiv.c:985
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
Definition: gia.h:95
int Gia_ManEquivCountLits(Gia_Man_t *p)
Definition: giaEquiv.c:253
Gia_Man_t* Gia_ManSpeedup ( Gia_Man_t p,
int  Percentage,
int  Degree,
int  fVerbose,
int  fVeryVerbose 
)

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

Synopsis [Adds choices to speed up the network by the given percentage.]

Description []

SideEffects []

SeeAlso []

Definition at line 628 of file giaSpeedup.c.

629 {
630  Gia_Man_t * pNew, * pTemp;
631  Vec_Int_t * vTimeCries, * vTimeFanins;
632  int iObj, iFanin, iFanin2, nNodesNew;
633  float tDelta, tArrival;
634  int i, k, k2, Counter, CounterRes, nTimeCris;
635  int fUseLutLib = (p->pLutLib != NULL);
636  void * pTempTim = NULL;
637  unsigned * puTCEdges;
639  if ( !fUseLutLib && p->pManTime )
640  {
641  pTempTim = p->pManTime;
642  p->pManTime = Tim_ManDup( (Tim_Man_t *)pTempTim, 1 );
643  }
644  // perform delay trace
645  tArrival = Gia_ManDelayTraceLut( p );
646  tDelta = fUseLutLib ? tArrival*Percentage/100.0 : 1.0;
647  if ( fVerbose )
648  {
649  printf( "Max delay = %.2f. Delta = %.2f. ", tArrival, tDelta );
650  printf( "Using %s model. ", fUseLutLib ? "LUT library" : "unit-delay" );
651  if ( fUseLutLib )
652  printf( "Percentage = %d. ", Percentage );
653  printf( "\n" );
654  }
655  // mark the timing critical nodes and edges
656  puTCEdges = ABC_CALLOC( unsigned, Gia_ManObjNum(p) );
657  Gia_ManForEachLut( p, iObj )
658  {
659  if ( Gia_ObjTimeSlack(p, iObj) >= tDelta )
660  continue;
661  puTCEdges[iObj] = Gia_LutDelayTraceTCEdges( p, iObj, tDelta );
662  }
663  if ( fVerbose )
664  {
665  Counter = CounterRes = 0;
666  Gia_ManForEachLut( p, iObj )
667  {
668  Gia_LutForEachFanin( p, iObj, iFanin, k )
669  if ( !Gia_ObjIsCi(Gia_ManObj(p, iFanin)) && Gia_ObjTimeSlack(p, iFanin) < tDelta )
670  Counter++;
671  CounterRes += Gia_WordCountOnes( puTCEdges[iObj] );
672  }
673  printf( "Edges: Total = %7d. 0-slack = %7d. Critical = %7d. Ratio = %4.2f\n",
674  Gia_ManLutFaninCount(p), Counter, CounterRes, Counter? 1.0*CounterRes/Counter : 0.0 );
675  }
676 
677  // start the resulting network
678  pNew = Gia_ManDup( p );
679  Gia_ManHashStart( pNew );
680  nNodesNew = 1000 + 3 * Gia_ManObjNum(pNew);
681  pNew->pNexts = ABC_CALLOC( int, nNodesNew );
682  pNew->pReprs = ABC_CALLOC( Gia_Rpr_t, nNodesNew );
683  for ( i = 0; i < nNodesNew; i++ )
684  Gia_ObjSetRepr( pNew, i, GIA_VOID );
685 
686  // collect nodes to be used for resynthesis
687  Counter = CounterRes = 0;
688  vTimeCries = Vec_IntAlloc( 16 );
689  vTimeFanins = Vec_IntAlloc( 16 );
690  Gia_ManForEachLut( p, iObj )
691  {
692  if ( Gia_ObjTimeSlack(p, iObj) >= tDelta )
693  continue;
694  // count the number of non-PI timing-critical nodes
695  nTimeCris = 0;
696  Gia_LutForEachFanin( p, iObj, iFanin, k )
697  if ( !Gia_ObjIsCi(Gia_ManObj(p, iFanin)) && (puTCEdges[iObj] & (1<<k)) )
698  nTimeCris++;
699  if ( !fVeryVerbose && nTimeCris == 0 )
700  continue;
701  Counter++;
702  // count the total number of timing critical second-generation nodes
703  Vec_IntClear( vTimeCries );
704  if ( nTimeCris )
705  {
706  Gia_LutForEachFanin( p, iObj, iFanin, k )
707  if ( !Gia_ObjIsCi(Gia_ManObj(p, iFanin)) && (puTCEdges[iObj] & (1<<k)) )
708  Gia_LutForEachFanin( p, iFanin, iFanin2, k2 )
709  if ( puTCEdges[iFanin] & (1<<k2) )
710  Vec_IntPushUnique( vTimeCries, iFanin2 );
711  }
712 // if ( !fVeryVerbose && (Vec_IntSize(vTimeCries) == 0 || Vec_IntSize(vTimeCries) > Degree) )
713  if ( (Vec_IntSize(vTimeCries) == 0 || Vec_IntSize(vTimeCries) > Degree) )
714  continue;
715  CounterRes++;
716  // collect second generation nodes
717  Vec_IntClear( vTimeFanins );
718  Gia_LutForEachFanin( p, iObj, iFanin, k )
719  {
720  if ( Gia_ObjIsCi(Gia_ManObj(p, iFanin)) )
721  Vec_IntPushUnique( vTimeFanins, iFanin );
722  else
723  Gia_LutForEachFanin( p, iFanin, iFanin2, k2 )
724  Vec_IntPushUnique( vTimeFanins, iFanin2 );
725  }
726  // print the results
727  if ( fVeryVerbose )
728  {
729  printf( "%5d Node %5d : %d %2d %2d ", Counter, iObj,
730  nTimeCris, Vec_IntSize(vTimeCries), Vec_IntSize(vTimeFanins) );
731  Gia_LutForEachFanin( p, iObj, iFanin, k )
732  printf( "%d(%.2f)%s ", iFanin, Gia_ObjTimeSlack(p, iFanin), (puTCEdges[iObj] & (1<<k))? "*":"" );
733  printf( "\n" );
734  }
735  // add the node to choices
736  if ( Vec_IntSize(vTimeCries) == 0 || Vec_IntSize(vTimeCries) > Degree )
737  continue;
738  // order the fanins in the increasing order of criticalily
739  if ( Vec_IntSize(vTimeCries) > 1 )
740  {
741  iFanin = Vec_IntEntry( vTimeCries, 0 );
742  iFanin2 = Vec_IntEntry( vTimeCries, 1 );
743  if ( Gia_ObjTimeSlack(p, iFanin) < Gia_ObjTimeSlack(p, iFanin2) )
744  {
745  Vec_IntWriteEntry( vTimeCries, 0, iFanin2 );
746  Vec_IntWriteEntry( vTimeCries, 1, iFanin );
747  }
748  }
749  if ( Vec_IntSize(vTimeCries) > 2 )
750  {
751  iFanin = Vec_IntEntry( vTimeCries, 1 );
752  iFanin2 = Vec_IntEntry( vTimeCries, 2 );
753  if ( Gia_ObjTimeSlack(p, iFanin) < Gia_ObjTimeSlack(p, iFanin2) )
754  {
755  Vec_IntWriteEntry( vTimeCries, 1, iFanin2 );
756  Vec_IntWriteEntry( vTimeCries, 2, iFanin );
757  }
758  iFanin = Vec_IntEntry( vTimeCries, 0 );
759  iFanin2 = Vec_IntEntry( vTimeCries, 1 );
760  if ( Gia_ObjTimeSlack(p, iFanin) < Gia_ObjTimeSlack(p, iFanin2) )
761  {
762  Vec_IntWriteEntry( vTimeCries, 0, iFanin2 );
763  Vec_IntWriteEntry( vTimeCries, 1, iFanin );
764  }
765  }
766  // add choice
767  Gia_ManSpeedupObj( pNew, p, Gia_ManObj(p,iObj), vTimeFanins, vTimeCries );
768  // quit if the number of nodes is large
769  if ( Gia_ManObjNum(pNew) > nNodesNew - 100 )
770  {
771  printf( "Speedup stopped adding choices because there was too many to add.\n" );
772  break;
773  }
774  }
775  Gia_ManTimeStop( p );
776  Vec_IntFree( vTimeCries );
777  Vec_IntFree( vTimeFanins );
778  ABC_FREE( puTCEdges );
779  if ( fVerbose )
780  printf( "Nodes: Total = %7d. 0-slack = %7d. Workable = %7d. Ratio = %4.2f\n",
781  Gia_ManLutNum(p), Counter, CounterRes, Counter? 1.0*CounterRes/Counter : 0.0 );
782  if ( pTempTim )
783  {
784  Tim_ManStop( (Tim_Man_t *)p->pManTime );
785  p->pManTime = pTempTim;
786  }
787  // derive AIG with choices
788 //Gia_ManPrintStats( pNew, 0 );
789  pTemp = Gia_ManEquivToChoices( pNew, 1 );
790  Gia_ManStop( pNew );
791 //Gia_ManPrintStats( pTemp, 0 );
792 // pNew = Gia_ManDupOrderDfsChoices( pTemp );
793 // Gia_ManStop( pTemp );
794 //Gia_ManPrintStats( pNew, 0 );
795 // return pNew;
796  return pTemp;
797 }
void * pLutLib
Definition: gia.h:166
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition: giaDup.c:552
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
unsigned Gia_LutDelayTraceTCEdges(Gia_Man_t *p, int iObj, float tDelta)
Definition: giaSpeedup.c:501
float Gia_ManDelayTraceLut(Gia_Man_t *p)
Definition: giaSpeedup.c:230
static int Gia_WordCountOnes(unsigned uWord)
Definition: gia.h:313
int Gia_ManLutNum(Gia_Man_t *p)
Definition: giaIf.c:144
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
for(p=first;p->value< newval;p=p->next)
#define Gia_ManForEachLut(p, i)
Definition: gia.h:968
Gia_Man_t * Gia_ManEquivToChoices(Gia_Man_t *p, int nSnapshots)
Definition: giaEquiv.c:1629
static void Gia_ObjSetRepr(Gia_Man_t *p, int Id, int Num)
Definition: gia.h:888
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static float Gia_ObjTimeSlack(Gia_Man_t *p, int Id)
Definition: gia.h:543
int Gia_ManLutFaninCount(Gia_Man_t *p)
Definition: giaIf.c:106
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
if(last==0)
Definition: sparse_int.h:34
void Gia_ManHashStart(Gia_Man_t *p)
Definition: giaHash.c:117
Tim_Man_t * Tim_ManDup(Tim_Man_t *p, int fUnitDelay)
Definition: timMan.c:86
void * pManTime
Definition: gia.h:165
static int Counter
static void Gia_ManTimeStop(Gia_Man_t *p)
Definition: gia.h:540
void Tim_ManStop(Tim_Man_t *p)
Definition: timMan.c:375
#define GIA_VOID
Definition: gia.h:45
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Gia_ManHasMapping(Gia_Man_t *p)
Definition: gia.h:951
#define ABC_FREE(obj)
Definition: abc_global.h:232
Definition: gia.h:95
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
Definition: gia.h:56
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static int Vec_IntPushUnique(Vec_Int_t *p, int Entry)
Definition: vecInt.h:832
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
void Gia_ManSpeedupObj(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vLeaves, Vec_Int_t *vTimes)
Definition: giaSpeedup.c:572
#define Gia_LutForEachFanin(p, i, iFan, k)
Definition: gia.h:970
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
Gia_Man_t* Gia_ManStart ( int  nObjsMax)

DECLARATIONS ///.

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

FileName [giaMan.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Scalable AIG package.]

Synopsis [Package manager.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Creates AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 52 of file giaMan.c.

53 {
54  Gia_Man_t * p;
55  assert( nObjsMax > 0 );
56  p = ABC_CALLOC( Gia_Man_t, 1 );
57  p->nObjsAlloc = nObjsMax;
58  p->pObjs = ABC_CALLOC( Gia_Obj_t, nObjsMax );
59  p->pObjs->iDiff0 = p->pObjs->iDiff1 = GIA_NONE;
60  p->nObjs = 1;
61  p->vCis = Vec_IntAlloc( nObjsMax / 20 );
62  p->vCos = Vec_IntAlloc( nObjsMax / 20 );
63  return p;
64 }
int nObjsAlloc
Definition: gia.h:102
unsigned iDiff0
Definition: gia.h:77
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Gia_Obj_t * pObjs
Definition: gia.h:103
Vec_Int_t * vCos
Definition: gia.h:109
int nObjs
Definition: gia.h:101
Definition: gia.h:75
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
Vec_Int_t * vCis
Definition: gia.h:108
Definition: gia.h:95
#define GIA_NONE
INCLUDES ///.
Definition: gia.h:44
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define assert(ex)
Definition: util_old.h:213
unsigned iDiff1
Definition: gia.h:82
void Gia_ManStaticFanoutStart ( Gia_Man_t p)

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

Synopsis [Allocates static fanout.]

Description []

SideEffects []

SeeAlso []

Definition at line 238 of file giaFanout.c.

239 {
240  Vec_Int_t * vCounts;
241  int * pRefsOld;
242  Gia_Obj_t * pObj, * pFanin;
243  int i, iFanout;
244  assert( p->vFanoutNums == NULL );
245  assert( p->vFanout == NULL );
246  // recompute reference counters
247  pRefsOld = p->pRefs; p->pRefs = NULL;
250  p->pRefs = pRefsOld;
251  // start the fanout maps
253  // incrementally add fanouts
254  vCounts = Vec_IntStart( Gia_ManObjNum(p) );
255  Gia_ManForEachObj( p, pObj, i )
256  {
257  if ( Gia_ObjIsAnd(pObj) || Gia_ObjIsCo(pObj) )
258  {
259  pFanin = Gia_ObjFanin0(pObj);
260  iFanout = Vec_IntEntry( vCounts, Gia_ObjId(p, pFanin) );
261  Gia_ObjSetFanout( p, pFanin, iFanout, pObj );
262  Vec_IntAddToEntry( vCounts, Gia_ObjId(p, pFanin), 1 );
263  }
264  if ( Gia_ObjIsAnd(pObj) )
265  {
266 
267  pFanin = Gia_ObjFanin1(pObj);
268  iFanout = Vec_IntEntry( vCounts, Gia_ObjId(p, pFanin) );
269  Gia_ObjSetFanout( p, pFanin, iFanout, pObj );
270  Vec_IntAddToEntry( vCounts, Gia_ObjId(p, pFanin), 1 );
271  }
272  }
273  // double-check the current number of fanouts added
274  Gia_ManForEachObj( p, pObj, i )
275  assert( Vec_IntEntry(vCounts, i) == Gia_ObjFanoutNum(p, pObj) );
276  Vec_IntFree( vCounts );
277 }
void Gia_ManCreateRefs(Gia_Man_t *p)
Definition: giaUtil.c:715
Vec_Int_t * vFanoutNums
Definition: gia.h:129
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Vec_Int_t * Vec_IntAllocArray(int *pArray, int nSize)
Definition: bblif.c:214
int * pRefs
Definition: gia.h:114
Definition: gia.h:75
Vec_Int_t * Gia_ManStartFanoutMap(Gia_Man_t *p, Vec_Int_t *vFanoutNums)
Definition: giaFanout.c:211
Vec_Int_t * vFanout
Definition: gia.h:130
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static void Vec_IntAddToEntry(Vec_Int_t *p, int i, int Addition)
Definition: bblif.c:302
static void Gia_ObjSetFanout(Gia_Man_t *p, Gia_Obj_t *pObj, int i, Gia_Obj_t *pFan)
Definition: gia.h:944
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Gia_ObjFanoutNum(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:940
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManStaticFanoutStop ( Gia_Man_t p)

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

Synopsis [Deallocates static fanout.]

Description []

SideEffects []

SeeAlso []

Definition at line 290 of file giaFanout.c.

291 {
292  Vec_IntFreeP( &p->vFanoutNums );
293  Vec_IntFreeP( &p->vFanout );
294 }
Vec_Int_t * vFanoutNums
Definition: gia.h:129
Vec_Int_t * vFanout
Definition: gia.h:130
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
void Gia_ManStgPrint ( FILE *  pFile,
Vec_Int_t vLines,
int  nIns,
int  nOuts,
int  nStates 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 407 of file giaStg.c.

408 {
409  int i, nDigits = Abc_Base10Log( nStates );
410  assert( Vec_IntSize(vLines) % 4 == 0 );
411  for ( i = 0; i < Vec_IntSize(vLines); i += 4 )
412  {
413  int iMint = Vec_IntEntry(vLines, i );
414  int iCur = Vec_IntEntry(vLines, i+1) - 1;
415  int iNext = Vec_IntEntry(vLines, i+2) - 1;
416  int iOut = Vec_IntEntry(vLines, i+3);
417  assert( iMint >= 0 && iMint < (1<<nIns) );
418  assert( iCur >= 0 && iCur < nStates );
419  assert( iNext >= 0 && iNext < nStates );
420  assert( iOut >= 0 && iOut < (1<<nOuts) );
421  Extra_PrintBinary( pFile, (unsigned *)Vec_IntEntryP(vLines, i), nIns );
422  fprintf( pFile, " %*d", nDigits, Vec_IntEntry(vLines, i+1) );
423  fprintf( pFile, " %*d ", nDigits, Vec_IntEntry(vLines, i+2) );
424  Extra_PrintBinary( pFile, (unsigned *)Vec_IntEntryP(vLines, i+3), nOuts );
425  fprintf( pFile, "\n" );
426  }
427 }
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Abc_Base10Log(unsigned n)
Definition: abc_global.h:252
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
void Extra_PrintBinary(FILE *pFile, unsigned Sign[], int nBits)
#define assert(ex)
Definition: util_old.h:213
static int * Vec_IntEntryP(Vec_Int_t *p, int i)
Definition: vecInt.h:417
Gia_Man_t* Gia_ManStgRead ( char *  pFileName,
int  kHot,
int  fVerbose 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 508 of file giaStg.c.

509 {
510  Gia_Man_t * p;
511  Vec_Int_t * vLines;
512  int nIns, nOuts, nStates;
513  vLines = Gia_ManStgReadLines( pFileName, &nIns, &nOuts, &nStates );
514  if ( vLines == NULL )
515  return NULL;
516 // p = Gia_ManStgOneHot( vLines, nIns, nOuts, nStates );
517  p = Gia_ManStgKHot( vLines, nIns, nOuts, nStates, kHot, fVerbose );
518  Vec_IntFree( vLines );
519  return p;
520 }
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
Gia_Man_t * Gia_ManStgKHot(Vec_Int_t *vLines, int nIns, int nOuts, int nStates, int kHot, int fVerbose)
Definition: giaStg.c:215
Definition: gia.h:95
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Vec_Int_t * Gia_ManStgReadLines(char *pFileName, int *pnIns, int *pnOuts, int *pnStates)
Definition: giaStg.c:440
void Gia_ManStop ( Gia_Man_t p)

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

Synopsis [Deletes AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 77 of file giaMan.c.

78 {
79  if ( p->vSeqModelVec )
82  Tim_ManStopP( (Tim_Man_t **)&p->pManTime );
83  assert( p->pManTime == NULL );
86  Vec_IntFreeP( &p->vSwitching );
87  Vec_IntFreeP( &p->vSuper );
88  Vec_IntFreeP( &p->vStore );
89  Vec_IntFreeP( &p->vClassNew );
90  Vec_IntFreeP( &p->vClassOld );
91  Vec_WrdFreeP( &p->vSims );
92  Vec_WrdFreeP( &p->vSimsPi );
93  Vec_FltFreeP( &p->vTiming );
94  Vec_VecFreeP( &p->vClockDoms );
95  Vec_IntFreeP( &p->vCofVars );
97  Vec_IntFreeP( &p->vUserPiIds );
98  Vec_IntFreeP( &p->vUserPoIds );
99  Vec_IntFreeP( &p->vUserFfIds );
100  Vec_IntFreeP( &p->vFlopClasses );
101  Vec_IntFreeP( &p->vGateClasses );
102  Vec_IntFreeP( &p->vObjClasses );
103  Vec_IntFreeP( &p->vInitClasses );
104  Vec_IntFreeP( &p->vRegClasses );
105  Vec_IntFreeP( &p->vDoms );
106  Vec_IntFreeP( &p->vBarBufs );
107  Vec_IntFreeP( &p->vLevels );
108  Vec_IntFreeP( &p->vTruths );
109  Vec_IntErase( &p->vCopies );
110  Vec_IntFreeP( &p->vTtNums );
111  Vec_IntFreeP( &p->vTtNodes );
112  Vec_WrdFreeP( &p->vTtMemory );
113  Vec_PtrFreeP( &p->vTtInputs );
114  Vec_IntFreeP( &p->vMapping );
115  Vec_IntFreeP( &p->vCellMapping );
116  Vec_IntFreeP( &p->vPacking );
117  Vec_FltFreeP( &p->vInArrs );
118  Vec_FltFreeP( &p->vOutReqs );
119  Gia_ManStopP( &p->pAigExtra );
120  Vec_IntFree( p->vCis );
121  Vec_IntFree( p->vCos );
122  ABC_FREE( p->pData2 );
123  ABC_FREE( p->pTravIds );
124  ABC_FREE( p->pPlacement );
125  ABC_FREE( p->pSwitching );
126  ABC_FREE( p->pCexSeq );
127  ABC_FREE( p->pCexComb );
128  ABC_FREE( p->pIso );
129 // ABC_FREE( p->pMapping );
130  ABC_FREE( p->pFanData );
131  ABC_FREE( p->pReprsOld );
132  ABC_FREE( p->pReprs );
133  ABC_FREE( p->pNexts );
134  ABC_FREE( p->pSibls );
135  ABC_FREE( p->pRefs );
136 // ABC_FREE( p->pNodeRefs );
137  ABC_FREE( p->pHTable );
138  ABC_FREE( p->pMuxes );
139  ABC_FREE( p->pObjs );
140  ABC_FREE( p->pSpec );
141  ABC_FREE( p->pName );
142  ABC_FREE( p );
143 }
Vec_Int_t * vUserFfIds
Definition: gia.h:159
Vec_Wrd_t * vSims
Definition: gia.h:177
int * pHTable
Definition: gia.h:110
int * pTravIds
Definition: gia.h:153
Gia_Man_t * pAigExtra
Definition: gia.h:149
int * pNexts
Definition: gia.h:122
Vec_Int_t * vRegClasses
Definition: gia.h:144
Vec_Int_t * vObjClasses
Definition: gia.h:142
int * pSibls
Definition: gia.h:123
Vec_Int_t * vSwitching
Definition: gia.h:152
static void Vec_PtrFreeFree(Vec_Ptr_t *p)
Definition: vecPtr.h:569
Vec_Int_t * vClassOld
Definition: gia.h:179
Gia_Obj_t * pObjs
Definition: gia.h:103
Vec_Int_t * vCos
Definition: gia.h:109
unsigned * pMuxes
Definition: gia.h:104
Vec_Int_t * vBarBufs
Definition: gia.h:146
Vec_Int_t * vFlopClasses
Definition: gia.h:140
unsigned * pData2
Definition: gia.h:170
Abc_Cex_t * pCexComb
Definition: gia.h:135
int * pIso
Definition: gia.h:124
static void Vec_IntErase(Vec_Int_t *p)
Definition: vecInt.h:266
Vec_Int_t * vPacking
Definition: gia.h:133
Vec_Wrd_t * vSimsPi
Definition: gia.h:178
static void Vec_WrdFreeP(Vec_Wrd_t **p)
Definition: vecWrd.h:277
static void Vec_FltFreeP(Vec_Flt_t **p)
Definition: vecFlt.h:235
Vec_Int_t * vStore
Definition: gia.h:190
int * pRefs
Definition: gia.h:114
Vec_Int_t * vInitClasses
Definition: gia.h:143
Vec_Flt_t * vTiming
Definition: gia.h:164
Vec_Int_t * vClassNew
Definition: gia.h:180
char * pName
Definition: gia.h:97
Vec_Int_t * vTruths
Definition: gia.h:139
Vec_Int_t * vGateClasses
Definition: gia.h:141
void Gia_ManStaticFanoutStop(Gia_Man_t *p)
Definition: giaFanout.c:290
Vec_Ptr_t * vTtInputs
Definition: gia.h:186
Vec_Int_t * vDoms
Definition: gia.h:145
unsigned char * pSwitching
Definition: gia.h:147
char * pSpec
Definition: gia.h:98
Vec_Flt_t * vOutReqs
Definition: gia.h:151
void * pManTime
Definition: gia.h:165
int * pFanData
Definition: gia.h:127
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
Vec_Int_t * vCellMapping
Definition: gia.h:132
void Tim_ManStopP(Tim_Man_t **p)
Definition: timMan.c:384
Vec_Ptr_t * vSeqModelVec
Definition: gia.h:137
Vec_Ptr_t * vNamesOut
Definition: gia.h:156
Vec_Int_t * vUserPiIds
Definition: gia.h:157
Vec_Int_t * vCis
Definition: gia.h:108
Vec_Vec_t * vClockDoms
Definition: gia.h:163
Vec_Int_t * vCofVars
Definition: gia.h:162
#define ABC_FREE(obj)
Definition: abc_global.h:232
Vec_Int_t * vTtNodes
Definition: gia.h:185
void Gia_ManStopP(Gia_Man_t **p)
Definition: giaMan.c:177
Gia_Plc_t * pPlacement
Definition: gia.h:148
static void Vec_PtrFreeP(Vec_Ptr_t **p)
Definition: vecPtr.h:240
Vec_Wrd_t * vTtMemory
Definition: gia.h:187
static void Vec_VecFreeP(Vec_Vec_t **p)
Definition: vecVec.h:367
Gia_Rpr_t * pReprs
Definition: gia.h:121
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
Vec_Int_t * vLevels
Definition: gia.h:115
Vec_Ptr_t * vNamesIn
Definition: gia.h:155
Vec_Int_t * vMapping
Definition: gia.h:131
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Vec_Int_t * vSuper
Definition: gia.h:189
Vec_Int_t * vUserPoIds
Definition: gia.h:158
int * pReprsOld
Definition: gia.h:120
Vec_Int_t * vLutConfigs
Definition: gia.h:134
Vec_Flt_t * vInArrs
Definition: gia.h:150
Vec_Int_t vCopies
Definition: gia.h:138
Vec_Int_t * vTtNums
Definition: gia.h:184
Abc_Cex_t * pCexSeq
Definition: gia.h:136
void Gia_ManStopP ( Gia_Man_t **  p)

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

Synopsis [Stops the AIG manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 177 of file giaMan.c.

178 {
179  if ( *p == NULL )
180  return;
181  Gia_ManStop( *p );
182  *p = NULL;
183 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
int Gia_ManSuppSize ( Gia_Man_t p,
int *  pNodes,
int  nNodes 
)

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

Synopsis [Collects support nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 300 of file giaDfs.c.

301 {
302  Gia_Obj_t * pObj;
303  int i, Counter = 0;
306  for ( i = 0; i < nNodes; i++ )
307  {
308  pObj = Gia_ManObj( p, pNodes[i] );
309  if ( Gia_ObjIsCo(pObj) )
310  Counter += Gia_ManSuppSize_rec( p, Gia_ObjFanin0(pObj) );
311  else
312  Counter += Gia_ManSuppSize_rec( p, pObj );
313  }
314  return Counter;
315 }
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
static int Counter
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
int Gia_ManSuppSize_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaDfs.c:236
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
void Gia_ManSwapPos ( Gia_Man_t p,
int  i 
)

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 1582 of file giaUtil.c.

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

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

Synopsis [Reduces root model with scorr.]

Description []

SideEffects []

SeeAlso []

Definition at line 683 of file giaSweep.c.

684 {
685  Gia_Man_t * pClp, * pNew, * pTemp;
686  int * pReprs;
687  assert( Gia_ManRegNum(p) == 0 );
688  assert( p->pAigExtra != NULL );
689  // consider seq synthesis with multiple clock domains
690  if ( pParsC == NULL && Gia_ManClockDomainNum(p) > 1 )
691  return Gia_ManSweepWithBoxesAndDomains( p, pParsS, fConst, fEquiv, fVerbose );
692  // order AIG objects
693  pNew = Gia_ManDupUnnormalize( p );
694  if ( pNew == NULL )
695  return NULL;
696  Gia_ManTransferTiming( pNew, p );
697  // find global equivalences
698  pClp = Gia_ManDupCollapse( pNew, pNew->pAigExtra, NULL, pParsC ? 0 : 1 );
699  // compute equivalences
700  if ( pParsC )
701  Gia_ManFraigSweepPerform( pClp, pParsC );
702  else if ( pParsS )
703  Cec_ManLSCorrespondenceClasses( pClp, (Cec_ParCor_t *)pParsS );
704  else
705  Gia_ManSeqCleanupClasses( pClp, fConst, fEquiv, fVerbose );
706  // transfer equivalences
707  pReprs = Gia_ManFraigSelectReprs( pNew, pClp, fVerbose );
708  Gia_ManStop( pClp );
709  // reduce AIG
710  Gia_ManTransferTiming( p, pNew );
711  pNew = Gia_ManFraigReduceGia( pTemp = pNew, pReprs );
712  Gia_ManTransferTiming( pNew, p );
713  Gia_ManStop( pTemp );
714  ABC_FREE( pReprs );
715  // derive new AIG
716  pNew = Gia_ManDupWithBoxes( pTemp = pNew, pParsC ? 0 : 1 );
717  Gia_ManStop( pTemp );
718  // normalize the result
719  pNew = Gia_ManDupNormalize( pTemp = pNew );
720  Gia_ManTransferTiming( pNew, pTemp );
721  Gia_ManStop( pTemp );
722  // check integrity
723  //Gia_ManCheckIntegrityWithBoxes( pNew );
724  return pNew;
725 }
Gia_Man_t * Gia_ManDupUnnormalize(Gia_Man_t *p)
Definition: giaTim.c:373
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
Gia_Man_t * pAigExtra
Definition: gia.h:149
int * Gia_ManFraigSelectReprs(Gia_Man_t *p, Gia_Man_t *pClp, int fVerbose)
Definition: giaSweep.c:442
Gia_Man_t * Gia_ManDupNormalize(Gia_Man_t *p)
Definition: giaTim.c:134
Gia_Man_t * Gia_ManFraigReduceGia(Gia_Man_t *p, int *pReprs)
Definition: giaSweep.c:334
void Gia_ManSeqCleanupClasses(Gia_Man_t *p, int fConst, int fEquiv, int fVerbose)
Definition: giaAig.c:603
void Gia_ManFraigSweepPerform(Gia_Man_t *p, void *pPars)
Definition: giaSweep.c:535
void Gia_ManTransferTiming(Gia_Man_t *p, Gia_Man_t *pGia)
Definition: giaIf.c:1912
int Cec_ManLSCorrespondenceClasses(Gia_Man_t *pAig, Cec_ParCor_t *pPars)
Definition: cecCorr.c:909
Gia_Man_t * Gia_ManDupCollapse(Gia_Man_t *p, Gia_Man_t *pBoxes, Vec_Int_t *vBoxPres, int fSeq)
Definition: giaTim.c:748
#define ABC_FREE(obj)
Definition: abc_global.h:232
Definition: gia.h:95
#define assert(ex)
Definition: util_old.h:213
Gia_Man_t * Gia_ManSweepWithBoxesAndDomains(Gia_Man_t *p, void *pParsS, int fConst, int fEquiv, int fVerbose)
Definition: giaSweep.c:621
Gia_Man_t * Gia_ManDupWithBoxes(Gia_Man_t *p, int fSeq)
Definition: giaSweep.c:124
int Gia_ManClockDomainNum(Gia_Man_t *p)
Definition: giaTim.c:69
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
void Gia_ManTestDistance ( Gia_Man_t pGia)

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

Synopsis [Returns sorted array of node handles with largest fanout.]

Description []

SideEffects []

SeeAlso []

Definition at line 904 of file giaEmbed.c.

905 {
906  Emb_Man_t * p;
907  abctime clk = Abc_Clock();
908  p = Emb_ManStart( pGia );
909 // Emb_ManPrintFanio( p );
910  Emb_ManPrintStats( p );
911 ABC_PRT( "Time", Abc_Clock() - clk );
913  Emb_ManStop( p );
914 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Emb_ManStop(Emb_Man_t *p)
Definition: giaEmbed.c:651
void Gia_ManTestDistanceInternal(Emb_Man_t *p)
Definition: giaEmbed.c:838
static abctime Abc_Clock()
Definition: abc_global.h:279
void Emb_ManPrintStats(Emb_Man_t *p)
Definition: giaEmbed.c:622
#define ABC_PRT(a, t)
Definition: abc_global.h:220
Emb_Man_t * Emb_ManStart(Gia_Man_t *pGia)
Definition: giaEmbed.c:493
ABC_INT64_T abctime
Definition: abc_global.h:278
static void Gia_ManTimeClean ( Gia_Man_t p)
inlinestatic

Definition at line 538 of file gia.h.

538 { int i; assert( p->vTiming != NULL ); Vec_FltFill(p->vTiming, 3*Gia_ManObjNum(p), 0); for ( i = 0; i < Gia_ManObjNum(p); i++ ) Vec_FltWriteEntry( p->vTiming, 3*i+1, (float)(ABC_INFINITY) ); }
static void Vec_FltWriteEntry(Vec_Flt_t *p, int i, float Entry)
Definition: vecFlt.h:364
static void Vec_FltFill(Vec_Flt_t *p, int nSize, float Entry)
Definition: vecFlt.h:450
Vec_Flt_t * vTiming
Definition: gia.h:164
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
#define assert(ex)
Definition: util_old.h:213
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static void Gia_ManTimeStart ( Gia_Man_t p)
inlinestatic

Definition at line 539 of file gia.h.

539 { assert( p->vTiming == NULL ); p->vTiming = Vec_FltAlloc(0); Gia_ManTimeClean( p ); }
static Vec_Flt_t * Vec_FltAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecFlt.h:78
Vec_Flt_t * vTiming
Definition: gia.h:164
#define assert(ex)
Definition: util_old.h:213
static void Gia_ManTimeClean(Gia_Man_t *p)
Definition: gia.h:538
static void Gia_ManTimeStop ( Gia_Man_t p)
inlinestatic

Definition at line 540 of file gia.h.

540 { assert( p->vTiming != NULL ); Vec_FltFreeP(&p->vTiming); }
static void Vec_FltFreeP(Vec_Flt_t **p)
Definition: vecFlt.h:235
Vec_Flt_t * vTiming
Definition: gia.h:164
#define assert(ex)
Definition: util_old.h:213
void Gia_ManTransferMapping ( Gia_Man_t p,
Gia_Man_t pGia 
)

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

Synopsis [Transfers mapping from hie GIA to normalized GIA.]

Description [Hie GIA (pGia) points to normalized GIA (p).]

SideEffects []

SeeAlso []

Definition at line 1855 of file giaIf.c.

1856 {
1857  Gia_Obj_t * pObj;
1858  int i, k, iFan;
1859  if ( !Gia_ManHasMapping(pGia) )
1860  return;
1861  Gia_ManMappingVerify( pGia );
1862  Vec_IntFreeP( &p->vMapping );
1863  p->vMapping = Vec_IntAlloc( 2 * Gia_ManObjNum(p) );
1864  Vec_IntFill( p->vMapping, Gia_ManObjNum(p), 0 );
1865  Gia_ManForEachLut( pGia, i )
1866  {
1868  pObj = Gia_ManObj( p, Abc_Lit2Var(Gia_ObjValue(Gia_ManObj(pGia, i))) );
1870  Vec_IntPush( p->vMapping, Gia_ObjLutSize(pGia, i) );
1871  Gia_LutForEachFanin( pGia, i, iFan, k )
1872  Vec_IntPush( p->vMapping, Abc_Lit2Var(Gia_ObjValue(Gia_ManObj(pGia, iFan))) );
1873  iFan = Abc_Lit2Var( Gia_ObjValue(Gia_ManObj(pGia, Abc_AbsInt(Gia_ObjLutMuxId(pGia, i)))) );
1874  Vec_IntPush( p->vMapping, Gia_ObjLutIsMux(pGia, i) ? -iFan : iFan );
1875  }
1876  Gia_ManMappingVerify( p );
1877 }
static int Abc_AbsInt(int a)
Definition: abc_global.h:237
static int Gia_ObjLutMuxId(Gia_Man_t *p, int Id)
Definition: gia.h:956
static int Gia_ObjValue(Gia_Obj_t *pObj)
Definition: gia.h:413
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
#define Gia_ManForEachLut(p, i)
Definition: gia.h:968
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Gia_ObjLutSize(Gia_Man_t *p, int Id)
Definition: gia.h:953
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
static int Gia_ObjLutIsMux(Gia_Man_t *p, int Id)
Definition: gia.h:957
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Gia_ManHasMapping(Gia_Man_t *p)
Definition: gia.h:951
void Gia_ManMappingVerify(Gia_Man_t *p)
Definition: giaIf.c:1807
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
#define assert(ex)
Definition: util_old.h:213
Vec_Int_t * vMapping
Definition: gia.h:131
#define Gia_LutForEachFanin(p, i, iFan, k)
Definition: gia.h:970
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManTransferPacking ( Gia_Man_t p,
Gia_Man_t pGia 
)

Definition at line 1878 of file giaIf.c.

1879 {
1880  Vec_Int_t * vPackingNew;
1881  Gia_Obj_t * pObj, * pObjNew;
1882  int i, k, Entry, nEntries, nEntries2;
1883  if ( pGia->vPacking == NULL )
1884  return;
1885  nEntries = Vec_IntEntry( pGia->vPacking, 0 );
1886  nEntries2 = 0;
1887  // create new packing info
1888  vPackingNew = Vec_IntAlloc( Vec_IntSize(pGia->vPacking) );
1889  Vec_IntPush( vPackingNew, nEntries );
1890  Vec_IntForEachEntryStart( pGia->vPacking, Entry, i, 1 )
1891  {
1892  assert( Entry > 0 && Entry < 4 );
1893  Vec_IntPush( vPackingNew, Entry );
1894  i++;
1895  for ( k = 0; k < Entry; k++, i++ )
1896  {
1897  pObj = Gia_ManObj(pGia, Vec_IntEntry(pGia->vPacking, i));
1898  pObjNew = Gia_ManObj(p, Abc_Lit2Var(Gia_ObjValue(pObj)));
1899  assert( Gia_ObjIsLut(pGia, Gia_ObjId(pGia, pObj)) );
1900  assert( Gia_ObjIsLut(p, Gia_ObjId(p, pObjNew)) );
1901  Vec_IntPush( vPackingNew, Gia_ObjId(p, pObjNew) );
1902 // printf( "%d -> %d ", Vec_IntEntry(pGia->vPacking, i), Gia_ObjId(p, pObjNew) );
1903  }
1904  i--;
1905  nEntries2++;
1906  }
1907  assert( nEntries == nEntries2 );
1908  // attach packing info
1909  assert( p->vPacking == NULL );
1910  p->vPacking = vPackingNew;
1911 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Gia_ObjValue(Gia_Obj_t *pObj)
Definition: gia.h:413
Vec_Int_t * vPacking
Definition: gia.h:133
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
Definition: vecInt.h:56
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjIsLut(Gia_Man_t *p, int Id)
Definition: gia.h:952
void Gia_ManTransferTiming ( Gia_Man_t p,
Gia_Man_t pGia 
)

Definition at line 1912 of file giaIf.c.

1913 {
1914  if ( pGia->pManTime == NULL || p == pGia )
1915  return;
1916  p->pManTime = pGia->pManTime; pGia->pManTime = NULL;
1917  p->pAigExtra = pGia->pAigExtra; pGia->pAigExtra = NULL;
1918  p->vRegClasses = pGia->vRegClasses; pGia->vRegClasses = NULL;
1919  p->nAnd2Delay = pGia->nAnd2Delay; pGia->nAnd2Delay = 0;
1920 }
Gia_Man_t * pAigExtra
Definition: gia.h:149
Vec_Int_t * vRegClasses
Definition: gia.h:144
void * pManTime
Definition: gia.h:165
int nAnd2Delay
Definition: gia.h:173
Gia_Man_t* Gia_ManTransformMiter ( Gia_Man_t p)

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

Synopsis [Transforms the circuit into a regular miter.]

Description []

SideEffects []

SeeAlso []

Definition at line 2324 of file giaDup.c.

2325 {
2326  Gia_Man_t * pNew, * pTemp;
2327  Gia_Obj_t * pObj, * pObj2;
2328  int i, iLit;
2329  assert( (Gia_ManPoNum(p) & 1) == 0 );
2330  pNew = Gia_ManStart( Gia_ManObjNum(p) );
2331  pNew->pName = Abc_UtilStrsav( p->pName );
2332  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
2333  Gia_ManConst0(p)->Value = 0;
2334  Gia_ManHashAlloc( pNew );
2335  Gia_ManForEachCi( p, pObj, i )
2336  pObj->Value = Gia_ManAppendCi( pNew );
2337  Gia_ManForEachAnd( p, pObj, i )
2338  pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
2339  Gia_ManForEachPo( p, pObj, i )
2340  {
2341  pObj2 = Gia_ManPo( p, ++i );
2342  iLit = Gia_ManHashXor( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin0Copy(pObj2) );
2343  Gia_ManAppendCo( pNew, iLit );
2344  }
2345  Gia_ManForEachRi( p, pObj, i )
2346  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
2347  Gia_ManHashStop( pNew );
2348  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
2349  pNew = Gia_ManCleanup( pTemp = pNew );
2350  Gia_ManStop( pTemp );
2351  return pNew;
2352 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
int Gia_ManHashXor(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:658
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
char * pName
Definition: gia.h:97
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
#define Gia_ManForEachRi(p, pObj, i)
Definition: gia.h:1040
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
Gia_Man_t* Gia_ManTransformToDual ( Gia_Man_t p)

Definition at line 2353 of file giaDup.c.

2354 {
2355  Gia_Man_t * pNew;
2356  Gia_Obj_t * pObj;
2357  int i;
2358  pNew = Gia_ManStart( Gia_ManObjNum(p) );
2359  pNew->pName = Abc_UtilStrsav( p->pName );
2360  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
2361  Gia_ManConst0(p)->Value = 0;
2362  Gia_ManHashAlloc( pNew );
2363  Gia_ManForEachCi( p, pObj, i )
2364  pObj->Value = Gia_ManAppendCi( pNew );
2365  Gia_ManForEachAnd( p, pObj, i )
2366  pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
2367  Gia_ManForEachPo( p, pObj, i )
2368  {
2369  Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
2370  Gia_ManAppendCo( pNew, 0 );
2371  }
2372  Gia_ManForEachRi( p, pObj, i )
2373  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
2374  Gia_ManHashStop( pNew );
2375  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
2376  return pNew;
2377 }
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
char * pName
Definition: gia.h:97
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
unsigned Value
Definition: gia.h:87
#define Gia_ManForEachRi(p, pObj, i)
Definition: gia.h:1040
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
static void Gia_ManTruthClear ( unsigned *  pOut,
int  nVars 
)
inlinestatic

Definition at line 352 of file gia.h.

353 {
354  int w;
355  for ( w = Abc_TruthWordNum(nVars)-1; w >= 0; w-- )
356  pOut[w] = 0;
357 }
static int Abc_TruthWordNum(int nVars)
Definition: abc_global.h:256
static void Gia_ManTruthCopy ( unsigned *  pOut,
unsigned *  pIn,
int  nVars 
)
inlinestatic

Definition at line 346 of file gia.h.

347 {
348  int w;
349  for ( w = Abc_TruthWordNum(nVars)-1; w >= 0; w-- )
350  pOut[w] = pIn[w];
351 }
static int Abc_TruthWordNum(int nVars)
Definition: abc_global.h:256
static void Gia_ManTruthFill ( unsigned *  pOut,
int  nVars 
)
inlinestatic

Definition at line 358 of file gia.h.

359 {
360  int w;
361  for ( w = Abc_TruthWordNum(nVars)-1; w >= 0; w-- )
362  pOut[w] = ~(unsigned)0;
363 }
static int Abc_TruthWordNum(int nVars)
Definition: abc_global.h:256
static int Gia_ManTruthIsConst0 ( unsigned *  pIn,
int  nVars 
)
inlinestatic

Definition at line 330 of file gia.h.

331 {
332  int w;
333  for ( w = Abc_TruthWordNum(nVars)-1; w >= 0; w-- )
334  if ( pIn[w] )
335  return 0;
336  return 1;
337 }
static int Abc_TruthWordNum(int nVars)
Definition: abc_global.h:256
static int Gia_ManTruthIsConst1 ( unsigned *  pIn,
int  nVars 
)
inlinestatic

Definition at line 338 of file gia.h.

339 {
340  int w;
341  for ( w = Abc_TruthWordNum(nVars)-1; w >= 0; w-- )
342  if ( pIn[w] != ~(unsigned)0 )
343  return 0;
344  return 1;
345 }
static int Abc_TruthWordNum(int nVars)
Definition: abc_global.h:256
static void Gia_ManTruthNot ( unsigned *  pOut,
unsigned *  pIn,
int  nVars 
)
inlinestatic

Definition at line 364 of file gia.h.

365 {
366  int w;
367  for ( w = Abc_TruthWordNum(nVars)-1; w >= 0; w-- )
368  pOut[w] = ~pIn[w];
369 }
static int Abc_TruthWordNum(int nVars)
Definition: abc_global.h:256
Vec_Ptr_t* Gia_ManUnrollAbs ( Gia_Man_t p,
int  nFrames 
)

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

Synopsis [Duplicates AIG for unrolling.]

Description []

SideEffects []

SeeAlso []

Definition at line 155 of file giaFrames.c.

156 {
157  int fVerbose = 0;
158  Vec_Ptr_t * vFrames;
159  Vec_Int_t * vLimit, * vOne;
160  Gia_Man_t * pNew;
161  Gia_Obj_t * pObj;
162  int nObjBits, nObjMask;
163  int f, fMax, k, Entry, Prev, iStart, iStop, Size;
164  // get the bitmasks
165  nObjBits = Abc_Base2Log( Gia_ManObjNum(p) );
166  nObjMask = (1 << nObjBits) - 1;
167  assert( Gia_ManObjNum(p) <= nObjMask );
168  // derive the tents
169  vLimit = Vec_IntAlloc( 1000 );
170  pNew = Gia_ManUnrollDup( p, vLimit );
171  // debug printout
172  if ( fVerbose )
173  {
174  Prev = 1;
175  printf( "Tents: " );
176  Vec_IntForEachEntryStart( vLimit, Entry, k, 1 )
177  printf( "%d=%d ", k, Entry-Prev ), Prev = Entry;
178  printf( " Unused=%d", Gia_ManObjNum(p) - Gia_ManObjNum(pNew) );
179  printf( "\n" );
180  }
181  // create abstraction
182  vFrames = Vec_PtrAlloc( Vec_IntSize(vLimit) );
183  for ( fMax = 0; fMax < nFrames; fMax++ )
184  {
185  Size = (fMax+1 < Vec_IntSize(vLimit)) ? Vec_IntEntry(vLimit, fMax+1) : Gia_ManObjNum(pNew);
186  vOne = Vec_IntAlloc( Size );
187  for ( f = 0; f <= fMax; f++ )
188  {
189  iStart = (f < Vec_IntSize(vLimit)) ? Vec_IntEntry(vLimit, f ) : 0;
190  iStop = (f+1 < Vec_IntSize(vLimit)) ? Vec_IntEntry(vLimit, f+1) : 0;
191  for ( k = iStop - 1; k >= iStart; k-- )
192  {
193  assert( Gia_ManObj(pNew, k)->Value > 0 );
194  pObj = Gia_ManObj(p, Gia_ManObj(pNew, k)->Value);
195  if ( Gia_ObjIsCo(pObj) || Gia_ObjIsPi(p, pObj) )
196  continue;
197  assert( Gia_ObjIsRo(p, pObj) || Gia_ObjIsAnd(pObj) );
198  Entry = ((fMax-f) << nObjBits) | Gia_ObjId(p, pObj);
199  Vec_IntPush( vOne, Entry );
200 // printf( "%d ", Gia_ManObj(pNew, k)->Value );
201  }
202 // printf( "\n" );
203  }
204  // add in reverse topological order
205  Vec_IntSort( vOne, 1 );
206  Vec_PtrPush( vFrames, vOne );
207  assert( Vec_IntSize(vOne) <= Size - 1 );
208  }
209  Vec_IntFree( vLimit );
210  Gia_ManStop( pNew );
211  return vFrames;
212 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
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_IntSort(Vec_Int_t *p, int fReverse)
Definition: vecInt.h:1293
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
for(p=first;p->value< newval;p=p->next)
Definition: gia.h:75
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Gia_ObjIsRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:443
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 Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
Definition: vecInt.h:56
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
Definition: gia.h:95
static int Abc_Base2Log(unsigned n)
Definition: abc_global.h:251
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
Gia_Man_t * Gia_ManUnrollDup(Gia_Man_t *p, Vec_Int_t *vLimit)
Definition: giaFrames.c:107
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ObjIsPi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:441
void* Gia_ManUnrollAdd ( void *  pMan,
int  fMax 
)

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

Synopsis [Computes init/non-init unrolling without flops.]

Description []

SideEffects []

SeeAlso []

Definition at line 437 of file giaFrames.c.

438 {
439  Gia_ManUnr_t * p = (Gia_ManUnr_t *)pMan;
440  Gia_Obj_t * pObj;
441  int f, i, Lit, Beg, End;
442  // create PIs on demand
443  if ( p->pPars->fSaveLastLit )
444  for ( i = 0; i < Gia_ManPiNum(p->pAig); i++ )
445  Gia_ManAppendCi(p->pNew);
446  // unroll another timeframe
447  for ( f = 0; f < fMax; f++ )
448  {
449  if ( Vec_IntSize(p->vLimit) <= fMax-f )
450  continue;
451  Beg = Vec_IntEntry( p->vLimit, fMax-f-1 );
452  End = Vec_IntEntry( p->vLimit, fMax-f );
453  for ( i = Beg; i < End; i++ )
454  {
455  pObj = Gia_ManObj( p->pOrder, i );
456  if ( Gia_ObjIsAnd(pObj) )
457  Lit = Gia_ManHashAnd( p->pNew, Gia_ObjUnrReadCopy0(p, pObj, i), Gia_ObjUnrReadCopy1(p, pObj, i) );
458  else if ( Gia_ObjIsCo(pObj) )
459  {
460  Lit = Gia_ObjUnrReadCopy0(p, pObj, i);
461  if ( f == fMax-1 )
462  {
463  if ( p->pPars->fSaveLastLit )
464  p->LastLit = Lit;
465  else
466  Gia_ManAppendCo( p->pNew, Lit );
467  }
468  }
469  else if ( Gia_ObjIsCi(pObj) )
470  Lit = Gia_ObjUnrReadCi( p, i, f, p->pNew );
471  else assert( 0 );
472  assert( Lit >= 0 );
473  Gia_ObjUnrWrite( p, i, Lit ); // should be exactly one call for each obj!
474  }
475  }
476  return p->pNew;
477 }
static int Gia_ObjUnrReadCopy0(Gia_ManUnr_t *p, Gia_Obj_t *pObj, int Id)
Definition: giaFrames.c:352
static int Gia_ObjUnrReadCi(Gia_ManUnr_t *p, int Id, int f, Gia_Man_t *pNew)
Definition: giaFrames.c:362
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int fSaveLastLit
Definition: gia.h:229
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
Gia_Man_t * pOrder
Definition: giaFrames.c:47
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
Gia_Man_t * pAig
Definition: giaFrames.c:45
static int Gia_ObjUnrReadCopy1(Gia_ManUnr_t *p, Gia_Obj_t *pObj, int Id)
Definition: giaFrames.c:357
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static void Gia_ObjUnrWrite(Gia_ManUnr_t *p, int Id, int Entry)
Definition: giaFrames.c:335
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
Vec_Int_t * vLimit
Definition: giaFrames.c:48
Gia_ParFra_t * pPars
Definition: giaFrames.c:44
Gia_Man_t * pNew
Definition: giaFrames.c:56
#define assert(ex)
Definition: util_old.h:213
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
Gia_Man_t* Gia_ManUnrollAndCofactor ( Gia_Man_t p,
int  nFrames,
int  nFanMax,
int  fVerbose 
)

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

Synopsis [Unrolls initialized timeframes while cofactoring some vars.]

Description []

SideEffects []

SeeAlso []

Definition at line 403 of file giaEnable.c.

404 {
405  Vec_Int_t * vCofSigs, * vTemp;
406  Gia_Man_t * pAig, * pFrames, * pNew;
407  // compute initialized timeframes
408  pFrames = Gia_ManUnrollInit( p, nFrames );
409  pAig = Gia_ManCleanup( pFrames );
410  // compute and remap set/reset/enable signals
411  vCofSigs = Gia_ManDetectSeqSignalsWithFanout( p, nFanMax, fVerbose );
412  vCofSigs = Gia_ManTransferFrames( p, pFrames, nFrames, pAig, vTemp = vCofSigs );
413  Vec_IntFree( vTemp );
414  Gia_ManStop( pFrames );
415  Vec_IntErase( &p->vCopies );
416  // cofactor all these variables
417  pNew = Gia_ManDupCofAllInt( pAig, vCofSigs, fVerbose );
418  Vec_IntFree( vCofSigs );
419  Gia_ManStop( pAig );
420  return pNew;
421 }
Vec_Int_t * Gia_ManDetectSeqSignalsWithFanout(Gia_Man_t *p, int nFanMax, int fVerbose)
Definition: giaEnable.c:224
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
Gia_Man_t * Gia_ManDupCofAllInt(Gia_Man_t *p, Vec_Int_t *vSigs, int fVerbose)
Definition: giaCof.c:936
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static void Vec_IntErase(Vec_Int_t *p)
Definition: vecInt.h:266
Vec_Int_t * Gia_ManTransferFrames(Gia_Man_t *pAig, Gia_Man_t *pFrames, int nFrames, Gia_Man_t *pNew, Vec_Int_t *vSigs)
Definition: giaEnable.c:330
Definition: gia.h:95
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
Gia_Man_t * Gia_ManUnrollInit(Gia_Man_t *p, int nFrames)
Definition: giaEnable.c:360
Vec_Int_t vCopies
Definition: gia.h:138
Gia_Man_t* Gia_ManUnrollDup ( Gia_Man_t p,
Vec_Int_t vLimit 
)

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

Synopsis [Duplicates AIG for unrolling.]

Description []

SideEffects []

SeeAlso []

Definition at line 107 of file giaFrames.c.

108 {
109  Gia_Man_t * pNew;
110  Gia_Obj_t * pObj;
111  int i;
112  assert( Vec_IntSize(vLimit) == 0 );
113  pNew = Gia_ManStart( Gia_ManObjNum(p) );
114  pNew->pName = Abc_UtilStrsav( p->pName );
115  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
116 
117  // save constant class
118  Gia_ManFillValue( p );
119  Gia_ManConst0(p)->Value = 0;
120  Vec_IntPush( vLimit, Gia_ManObjNum(pNew) );
121 
122  // create first class
123  Gia_ManForEachPo( p, pObj, i )
124  Gia_ManUnrollDup_rec( pNew, pObj, Gia_ObjId(p, pObj) );
125  Vec_IntPush( vLimit, Gia_ManObjNum(pNew) );
126 
127  // create next classes
128  for ( i = 1; i < Gia_ManObjNum(pNew); i++ )
129  {
130  if ( i == Vec_IntEntryLast(vLimit) )
131  Vec_IntPush( vLimit, Gia_ManObjNum(pNew) );
132  pObj = Gia_ManObj( p, Gia_ManObj(pNew, i)->Value );
133  if ( Gia_ObjIsRo(p, pObj) )
134  {
135  pObj = Gia_ObjRoToRi(p, pObj);
136  assert( !~pObj->Value );
137  Gia_ManUnrollDup_rec( pNew, pObj, Gia_ObjId(p, pObj) );
138  }
139  }
140  Gia_ManSetRegNum( pNew, 0 );
141  return pNew;
142 }
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
for(p=first;p->value< newval;p=p->next)
Definition: gia.h:75
char * pName
Definition: gia.h:97
static int Gia_ObjIsRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:443
static Gia_Obj_t * Gia_ObjRoToRi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:446
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
void Gia_ManUnrollDup_rec(Gia_Man_t *pNew, Gia_Obj_t *pObj, int Id)
FUNCTION DEFINITIONS ///.
Definition: giaFrames.c:75
static int Vec_IntEntryLast(Vec_Int_t *p)
Definition: bblif.c:319
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
int Gia_ManUnrollLastLit ( void *  pMan)

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

Synopsis [Read the last literal.]

Description []

SideEffects []

SeeAlso []

Definition at line 490 of file giaFrames.c.

491 {
492  Gia_ManUnr_t * p = (Gia_ManUnr_t *)pMan;
493  return p->LastLit;
494 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void* Gia_ManUnrollStart ( Gia_Man_t pAig,
Gia_ParFra_t pPars 
)

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

Synopsis [Computes init/non-init unrolling without flops.]

Description []

SideEffects []

SeeAlso []

Definition at line 402 of file giaFrames.c.

403 {
404  Gia_ManUnr_t * p;
405  int f, i;
406  // start
407  p = Gia_ManUnrStart( pAig, pPars );
408  // start timeframes
409  assert( p->pNew == NULL );
410  p->pNew = Gia_ManStart( 10000 );
411  p->pNew->pName = Abc_UtilStrsav( p->pAig->pName );
412  p->pNew->pSpec = Abc_UtilStrsav( p->pAig->pSpec );
413  Gia_ManHashAlloc( p->pNew );
414  // create combinational inputs
415  if ( !p->pPars->fSaveLastLit ) // only in the case when unrolling depth is known
416  for ( f = 0; f < p->pPars->nFrames; f++ )
417  for ( i = 0; i < Gia_ManPiNum(p->pAig); i++ )
418  Gia_ManAppendCi(p->pNew);
419  // create flop outputs
420  if ( !p->pPars->fInit ) // only in the case when initialization is not performed
421  for ( i = 0; i < Gia_ManRegNum(p->pAig); i++ )
422  Gia_ManAppendCi(p->pNew);
423  return p;
424 }
int nFrames
Definition: gia.h:227
Gia_ManUnr_t * Gia_ManUnrStart(Gia_Man_t *pAig, Gia_ParFra_t *pPars)
Definition: giaFrames.c:225
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int fSaveLastLit
Definition: gia.h:229
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
Gia_Man_t * pAig
Definition: giaFrames.c:45
char * pName
Definition: gia.h:97
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
int fInit
Definition: gia.h:228
Gia_ParFra_t * pPars
Definition: giaFrames.c:44
Gia_Man_t * pNew
Definition: giaFrames.c:56
#define assert(ex)
Definition: util_old.h:213
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
void Gia_ManUnrollStop ( void *  pMan)

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

Synopsis [Deletes manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 310 of file giaFrames.c.

311 {
312  Gia_ManUnr_t * p = (Gia_ManUnr_t *)pMan;
313  Gia_ManStopP( &p->pOrder );
314  Vec_IntFreeP( &p->vLimit );
315  Vec_IntFreeP( &p->vRank );
316  Vec_IntFreeP( &p->vDegree );
317  Vec_IntFreeP( &p->vDegDiff );
318  Vec_IntFreeP( &p->vFirst );
319  Vec_IntFreeP( &p->vStore );
320  ABC_FREE( p );
321 }
Vec_Int_t * vDegree
Definition: giaFrames.c:51
Vec_Int_t * vFirst
Definition: giaFrames.c:53
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Gia_Man_t * pOrder
Definition: giaFrames.c:47
void Gia_ManStopP(Gia_Man_t **p)
Definition: giaMan.c:177
Vec_Int_t * vRank
Definition: giaFrames.c:50
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
Vec_Int_t * vStore
Definition: giaFrames.c:54
#define ABC_FREE(obj)
Definition: abc_global.h:232
Vec_Int_t * vLimit
Definition: giaFrames.c:48
Vec_Int_t * vDegDiff
Definition: giaFrames.c:52
Gia_Man_t* Gia_ManUpdateExtraAig ( void *  pTime,
Gia_Man_t p,
Vec_Int_t vBoxPres 
)

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

Synopsis [Update AIG of the holes.]

Description []

SideEffects []

SeeAlso []

Definition at line 683 of file giaTim.c.

684 {
685  Gia_Man_t * pNew;
686  Tim_Man_t * pManTime = (Tim_Man_t *)pTime;
687  Vec_Int_t * vOutPres = Vec_IntAlloc( 100 );
688  int i, k, curPo = 0;
689  assert( Vec_IntSize(vBoxPres) == Tim_ManBoxNum(pManTime) );
690  assert( Gia_ManCoNum(p) == Tim_ManCiNum(pManTime) - Tim_ManPiNum(pManTime) );
691  for ( i = 0; i < Tim_ManBoxNum(pManTime); i++ )
692  {
693  for ( k = 0; k < Tim_ManBoxOutputNum(pManTime, i); k++ )
694  Vec_IntPush( vOutPres, Vec_IntEntry(vBoxPres, i) );
695  curPo += Tim_ManBoxOutputNum(pManTime, i);
696  }
697  assert( curPo == Gia_ManCoNum(p) );
698  pNew = Gia_ManDupOutputVec( p, vOutPres );
699  Vec_IntFree( vOutPres );
700  return pNew;
701 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
int Tim_ManBoxOutputNum(Tim_Man_t *p, int iBox)
Definition: timBox.c:202
Gia_Man_t * Gia_ManDupOutputVec(Gia_Man_t *p, Vec_Int_t *vOutPres)
Definition: giaDup.c:232
int Tim_ManPiNum(Tim_Man_t *p)
Definition: timMan.c:688
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
int Tim_ManCiNum(Tim_Man_t *p)
Definition: timMan.c:680
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
int Tim_ManBoxNum(Tim_Man_t *p)
Definition: timMan.c:702
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Definition: gia.h:95
#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
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
Gia_Man_t* Gia_ManUpdateExtraAig2 ( void *  pTime,
Gia_Man_t pAig,
Vec_Int_t vBoxesLeft 
)

Definition at line 702 of file giaTim.c.

703 {
704  Gia_Man_t * pNew;
705  Tim_Man_t * pManTime = (Tim_Man_t *)pTime;
706  int nRealPis = Tim_ManPiNum(pManTime);
707  Vec_Int_t * vOutsLeft = Vec_IntAlloc( 100 );
708  int i, k, iBox, iOutFirst;
709  assert( Vec_IntSize(vBoxesLeft) <= Tim_ManBoxNum(pManTime) );
710  assert( Gia_ManCoNum(p) == Tim_ManCiNum(pManTime) - nRealPis );
711  Vec_IntForEachEntry( vBoxesLeft, iBox, i )
712  {
713  iOutFirst = Tim_ManBoxOutputFirst(pManTime, iBox) - nRealPis;
714  for ( k = 0; k < Tim_ManBoxOutputNum(pManTime, iBox); k++ )
715  Vec_IntPush( vOutsLeft, iOutFirst + k );
716  }
717  pNew = Gia_ManDupSelectedOutputs( p, vOutsLeft );
718  Vec_IntFree( vOutsLeft );
719  return pNew;
720 }
int Tim_ManBoxOutputFirst(Tim_Man_t *p, int iBox)
Definition: timBox.c:154
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 Tim_ManBoxOutputNum(Tim_Man_t *p, int iBox)
Definition: timBox.c:202
int Tim_ManPiNum(Tim_Man_t *p)
Definition: timMan.c:688
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
int Tim_ManCiNum(Tim_Man_t *p)
Definition: timMan.c:680
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
int Tim_ManBoxNum(Tim_Man_t *p)
Definition: timMan.c:702
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Definition: gia.h:95
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
Gia_Man_t * Gia_ManDupSelectedOutputs(Gia_Man_t *p, Vec_Int_t *vOutsLeft)
Definition: giaDup.c:266
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
void* Gia_ManUpdateTimMan ( Gia_Man_t p,
Vec_Int_t vBoxPres 
)

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

Synopsis [Update hierarchy/timing manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 657 of file giaTim.c.

658 {
659  Tim_Man_t * pManTime = (Tim_Man_t *)p->pManTime;
660  assert( pManTime != NULL );
661  assert( Vec_IntSize(vBoxPres) == Tim_ManBoxNum(pManTime) );
662  return Tim_ManTrim( pManTime, vBoxPres );
663 }
void * pManTime
Definition: gia.h:165
Tim_Man_t * Tim_ManTrim(Tim_Man_t *p, Vec_Int_t *vBoxPres)
Definition: timMan.c:163
int Tim_ManBoxNum(Tim_Man_t *p)
Definition: timMan.c:702
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#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* Gia_ManUpdateTimMan2 ( Gia_Man_t p,
Vec_Int_t vBoxesLeft,
int  nTermsDiff 
)

Definition at line 664 of file giaTim.c.

665 {
666  Tim_Man_t * pManTime = (Tim_Man_t *)p->pManTime;
667  assert( pManTime != NULL );
668  assert( Vec_IntSize(vBoxesLeft) <= Tim_ManBoxNum(pManTime) );
669  return Tim_ManReduce( pManTime, vBoxesLeft, nTermsDiff );
670 }
Tim_Man_t * Tim_ManReduce(Tim_Man_t *p, Vec_Int_t *vBoxesLeft, int nTermsDiff)
Definition: timMan.c:251
void * pManTime
Definition: gia.h:165
int Tim_ManBoxNum(Tim_Man_t *p)
Definition: timMan.c:702
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#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 Gia_ManVerifyCex ( Gia_Man_t pAig,
Abc_Cex_t p,
int  fDualOut 
)

DECLARATIONS ///.

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

FileName [giaAbs.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Scalable AIG package.]

Synopsis [Counter-example-guided abstraction refinement.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Resimulates the counter-example.]

Description []

SideEffects []

SeeAlso []

Definition at line 44 of file giaCex.c.

45 {
46  Gia_Obj_t * pObj, * pObjRi, * pObjRo;
47  int RetValue, i, k, iBit = 0;
48  Gia_ManCleanMark0(pAig);
49  Gia_ManForEachRo( pAig, pObj, i )
50  pObj->fMark0 = Abc_InfoHasBit(p->pData, iBit++);
51  for ( i = 0; i <= p->iFrame; i++ )
52  {
53  Gia_ManForEachPi( pAig, pObj, k )
54  pObj->fMark0 = Abc_InfoHasBit(p->pData, iBit++);
55  Gia_ManForEachAnd( pAig, pObj, k )
56  pObj->fMark0 = (Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj)) &
57  (Gia_ObjFanin1(pObj)->fMark0 ^ Gia_ObjFaninC1(pObj));
58  Gia_ManForEachCo( pAig, pObj, k )
59  pObj->fMark0 = Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj);
60  if ( i == p->iFrame )
61  break;
62  Gia_ManForEachRiRo( pAig, pObjRi, pObjRo, k )
63  {
64  pObjRo->fMark0 = pObjRi->fMark0;
65  }
66  }
67  assert( iBit == p->nBits );
68  if ( fDualOut )
69  RetValue = Gia_ManPo(pAig, 2*p->iPo)->fMark0 ^ Gia_ManPo(pAig, 2*p->iPo+1)->fMark0;
70  else
71  RetValue = Gia_ManPo(pAig, p->iPo)->fMark0;
72  Gia_ManCleanMark0(pAig);
73  return RetValue;
74 }
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
void Gia_ManCleanMark0(Gia_Man_t *p)
Definition: giaUtil.c:215
for(p=first;p->value< newval;p=p->next)
Definition: gia.h:75
#define Gia_ManForEachRiRo(p, pObjRi, pObjRo, i)
Definition: gia.h:1042
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
if(last==0)
Definition: sparse_int.h:34
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
unsigned fMark0
Definition: gia.h:79
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define Gia_ManForEachRo(p, pObj, i)
Definition: gia.h:1038
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
int Gia_ManVerifyWithBoxes ( Gia_Man_t pGia,
int  nBTLimit,
int  nTimeLim,
int  fSeq,
int  fVerbose,
char *  pFileSpec 
)

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

Synopsis [Verify XAIG against its spec.]

Description []

SideEffects []

SeeAlso []

Definition at line 859 of file giaTim.c.

860 {
861  int Status = -1;
862  Gia_Man_t * pSpec, * pGia0, * pGia1, * pMiter;
863  Vec_Int_t * vBoxPres = NULL;
864  if ( pFileSpec == NULL && pGia->pSpec == NULL )
865  {
866  printf( "Spec file is not given. Use standard flow.\n" );
867  return Status;
868  }
869  if ( Gia_ManBoxNum(pGia) && pGia->pAigExtra == NULL )
870  {
871  printf( "Design has no box logic. Use standard flow.\n" );
872  return Status;
873  }
874  // read original AIG
875  pSpec = Gia_AigerRead( pFileSpec ? pFileSpec : pGia->pSpec, 0, 0 );
876  if ( Gia_ManBoxNum(pSpec) && pSpec->pAigExtra == NULL )
877  {
878  Gia_ManStop( pSpec );
879  printf( "Spec has no box logic. Use standard flow.\n" );
880  return Status;
881  }
882  // prepare miter
883  if ( pGia->pManTime == NULL && pSpec->pManTime == NULL )
884  {
885  pGia0 = Gia_ManDup( pSpec );
886  pGia1 = Gia_ManDup( pGia );
887  }
888  else
889  {
890  // if timing managers have different number of black boxes,
891  // it is possible that some of the boxes are swept away
892  if ( pSpec->pManTime && Tim_ManBlackBoxNum((Tim_Man_t *)pSpec->pManTime) > 0 && Gia_ManBoxNum(pGia) > 0 )
893  {
894  // specification cannot have fewer boxes than implementation
895  if ( Gia_ManBoxNum(pSpec) < Gia_ManBoxNum(pGia) )
896  {
897  printf( "Spec has less boxes than the design. Cannot proceed.\n" );
898  return Status;
899  }
900  // to align the boxes, find what boxes of pSpec are dropped in pGia
901  if ( Gia_ManBoxNum(pSpec) > Gia_ManBoxNum(pGia) )
902  {
903  vBoxPres = Tim_ManAlignTwo( (Tim_Man_t *)pSpec->pManTime, (Tim_Man_t *)pGia->pManTime );
904  if ( vBoxPres == NULL )
905  {
906  printf( "Boxes of spec and design cannot be aligned. Cannot proceed.\n" );
907  return Status;
908  }
909  }
910  }
911  // collapse two designs
912  if ( Gia_ManBoxNum(pSpec) > 0 )
913  pGia0 = Gia_ManDupCollapse( pSpec, pSpec->pAigExtra, vBoxPres, fSeq );
914  else
915  pGia0 = Gia_ManDup( pSpec );
916  if ( Gia_ManBoxNum(pGia) > 0 )
917  pGia1 = Gia_ManDupCollapse( pGia, pGia->pAigExtra, NULL, fSeq );
918  else
919  pGia1 = Gia_ManDup( pGia );
920  Vec_IntFreeP( &vBoxPres );
921  }
922  // compute the miter
923  if ( fSeq )
924  {
925  pMiter = Gia_ManMiter( pGia0, pGia1, 0, 0, 1, 0, fVerbose );
926  if ( pMiter )
927  {
928  Aig_Man_t * pMan;
929  Fra_Sec_t SecPar, * pSecPar = &SecPar;
930  Fra_SecSetDefaultParams( pSecPar );
931  pSecPar->fRetimeFirst = 0;
932  pSecPar->nBTLimit = nBTLimit;
933  pSecPar->TimeLimit = nTimeLim;
934  pSecPar->fVerbose = fVerbose;
935  pMan = Gia_ManToAig( pMiter, 0 );
936  Gia_ManStop( pMiter );
937  Status = Fra_FraigSec( pMan, pSecPar, NULL );
938  Aig_ManStop( pMan );
939  }
940  }
941  else
942  {
943  pMiter = Gia_ManMiter( pGia0, pGia1, 0, 1, 0, 0, fVerbose );
944  if ( pMiter )
945  {
946  Cec_ParCec_t ParsCec, * pPars = &ParsCec;
948  pPars->nBTLimit = nBTLimit;
949  pPars->TimeLimit = nTimeLim;
950  pPars->fVerbose = fVerbose;
951  Status = Cec_ManVerify( pMiter, pPars );
952  if ( pPars->iOutFail >= 0 )
953  Abc_Print( 1, "Verification failed for at least one output (%d).\n", pPars->iOutFail );
954  Gia_ManStop( pMiter );
955  }
956  }
957  Gia_ManStop( pGia0 );
958  Gia_ManStop( pGia1 );
959  Gia_ManStop( pSpec );
960  return Status;
961 }
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition: giaDup.c:552
int TimeLimit
Definition: fra.h:141
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
ABC_NAMESPACE_IMPL_START int Gia_ManBoxNum(Gia_Man_t *p)
DECLARATIONS ///.
Definition: giaTim.c:49
Gia_Man_t * pAigExtra
Definition: gia.h:149
Gia_Man_t * Gia_AigerRead(char *pFileName, int fSkipStrash, int fCheck)
Definition: giaAiger.c:821
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
int nBTLimit
Definition: cec.h:120
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
void Fra_SecSetDefaultParams(Fra_Sec_t *p)
DECLARATIONS ///.
Definition: fraSec.c:51
int fVerbose
Definition: fra.h:139
void Cec_ManCecSetDefaultParams(Cec_ParCec_t *p)
Definition: cecCore.c:157
char * pSpec
Definition: gia.h:98
Aig_Man_t * Gia_ManToAig(Gia_Man_t *p, int fChoices)
Definition: giaAig.c:277
void * pManTime
Definition: gia.h:165
int TimeLimit
Definition: cec.h:121
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
int Fra_FraigSec(Aig_Man_t *p, Fra_Sec_t *pParSec, Aig_Man_t **ppResult)
Definition: fraSec.c:95
int nBTLimit
Definition: fra.h:119
int iOutFail
Definition: cec.h:128
int Tim_ManBlackBoxNum(Tim_Man_t *p)
Definition: timMan.c:706
Definition: gia.h:95
int Cec_ManVerify(Gia_Man_t *p, Cec_ParCec_t *pPars)
MACRO DEFINITIONS ///.
Definition: cecCec.c:308
int fVerbose
Definition: cec.h:127
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
Gia_Man_t * Gia_ManDupCollapse(Gia_Man_t *p, Gia_Man_t *pBoxes, Vec_Int_t *vBoxPres, int fSeq)
Definition: giaTim.c:748
int fRetimeFirst
Definition: fra.h:127
Vec_Int_t * Tim_ManAlignTwo(Tim_Man_t *pSpec, Tim_Man_t *pImpl)
Definition: timMan.c:344
Gia_Man_t * Gia_ManMiter(Gia_Man_t *pAig0, Gia_Man_t *pAig1, int nInsDup, int fDualOut, int fSeq, int fImplic, int fVerbose)
Definition: giaDup.c:2128
void Gia_ManWriteMiniAig ( Gia_Man_t pGia,
char *  pFileName 
)

Definition at line 176 of file giaMini.c.

177 {
178  Mini_Aig_t * p = Gia_ManToMiniAig( pGia );
179  Mini_AigDump( p, pFileName );
180  Mini_AigStop( p );
181 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Mini_Aig_t * Gia_ManToMiniAig(Gia_Man_t *pGia)
Definition: giaMini.c:103
static void Mini_AigStop(Mini_Aig_t *p)
Definition: miniaig.h:140
static void Mini_AigDump(Mini_Aig_t *p, char *pFileName)
Definition: miniaig.h:161
static int Gia_ManXorNum ( Gia_Man_t p)
inlinestatic

Definition at line 390 of file gia.h.

390 { return p->nXors; }
int nXors
Definition: gia.h:105
char* Gia_MmFixedEntryFetch ( Gia_MmFixed_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 161 of file giaMem.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 }
int nEntriesAlloc
Definition: giaMem.c:34
int nEntriesUsed
Definition: giaMem.c:35
#define ABC_REALLOC(type, obj, num)
Definition: abc_global.h:233
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
int nChunksAlloc
Definition: giaMem.c:41
int nEntriesMax
Definition: giaMem.c:36
int nEntrySize
Definition: giaMem.c:33
int nChunks
Definition: giaMem.c:42
char ** pChunks
Definition: giaMem.c:43
char * pEntriesFree
Definition: giaMem.c:37
int nChunkSize
Definition: giaMem.c:40
#define assert(ex)
Definition: util_old.h:213
int nMemoryAlloc
Definition: giaMem.c:47
void Gia_MmFixedEntryRecycle ( Gia_MmFixed_t p,
char *  pEntry 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 212 of file giaMem.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 }
int nEntriesUsed
Definition: giaMem.c:35
char * pEntriesFree
Definition: giaMem.c:37
int Gia_MmFixedReadMaxEntriesUsed ( Gia_MmFixed_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 287 of file giaMem.c.

288 {
289  return p->nEntriesMax;
290 }
int nEntriesMax
Definition: giaMem.c:36
int Gia_MmFixedReadMemUsage ( Gia_MmFixed_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 271 of file giaMem.c.

272 {
273  return p->nMemoryAlloc;
274 }
int nMemoryAlloc
Definition: giaMem.c:47
void Gia_MmFixedRestart ( Gia_MmFixed_t p)

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

Synopsis []

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

SideEffects []

SeeAlso []

Definition at line 232 of file giaMem.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 nEntriesAlloc
Definition: giaMem.c:34
int nEntriesUsed
Definition: giaMem.c:35
int nMemoryUsed
Definition: giaMem.c:46
int nEntrySize
Definition: giaMem.c:33
int nChunks
Definition: giaMem.c:42
char ** pChunks
Definition: giaMem.c:43
char * pEntriesFree
Definition: giaMem.c:37
#define ABC_FREE(obj)
Definition: abc_global.h:232
int nChunkSize
Definition: giaMem.c:40
int nMemoryAlloc
Definition: giaMem.c:47
Gia_MmFixed_t* Gia_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 giaMem.c.

97 {
98  Gia_MmFixed_t * p;
99 
100  p = ABC_ALLOC( Gia_MmFixed_t, 1 );
101  memset( p, 0, sizeof(Gia_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()
int nEntriesAlloc
Definition: giaMem.c:34
int nEntriesUsed
Definition: giaMem.c:35
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
int nChunksAlloc
Definition: giaMem.c:41
int nMemoryUsed
Definition: giaMem.c:46
int nEntrySize
Definition: giaMem.c:33
int nChunks
Definition: giaMem.c:42
char ** pChunks
Definition: giaMem.c:43
char * pEntriesFree
Definition: giaMem.c:37
int nChunkSize
Definition: giaMem.c:40
DECLARATIONS ///.
Definition: giaMem.c:30
int nMemoryAlloc
Definition: giaMem.c:47
void Gia_MmFixedStop ( Gia_MmFixed_t p,
int  fVerbose 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 132 of file giaMem.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 nEntriesUsed
Definition: giaMem.c:35
int nEntriesMax
Definition: giaMem.c:36
int nEntrySize
Definition: giaMem.c:33
int nChunks
Definition: giaMem.c:42
char ** pChunks
Definition: giaMem.c:43
#define ABC_FREE(obj)
Definition: abc_global.h:232
int nChunkSize
Definition: giaMem.c:40
int nMemoryAlloc
Definition: giaMem.c:47
char* Gia_MmFlexEntryFetch ( Gia_MmFlex_t p,
int  nBytes 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 366 of file giaMem.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 }
char ** pChunks
Definition: giaMem.c:61
int nChunks
Definition: giaMem.c:60
#define ABC_REALLOC(type, obj, num)
Definition: abc_global.h:233
char * pCurrent
Definition: giaMem.c:54
int nMemoryUsed
Definition: giaMem.c:64
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
int nChunkSize
Definition: giaMem.c:58
int nMemoryAlloc
Definition: giaMem.c:65
char * pEnd
Definition: giaMem.c:55
int nChunksAlloc
Definition: giaMem.c:59
int nEntriesUsed
Definition: giaMem.c:53
#define assert(ex)
Definition: util_old.h:213
int Gia_MmFlexReadMemUsage ( Gia_MmFlex_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 439 of file giaMem.c.

440 {
441  return p->nMemoryUsed;
442 }
int nMemoryUsed
Definition: giaMem.c:64
void Gia_MmFlexRestart ( Gia_MmFlex_t p)

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

Synopsis []

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

SideEffects []

SeeAlso []

Definition at line 411 of file giaMem.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 }
char ** pChunks
Definition: giaMem.c:61
int nChunks
Definition: giaMem.c:60
char * pCurrent
Definition: giaMem.c:54
int nMemoryUsed
Definition: giaMem.c:64
int nChunkSize
Definition: giaMem.c:58
int nMemoryAlloc
Definition: giaMem.c:65
char * pEnd
Definition: giaMem.c:55
#define ABC_FREE(obj)
Definition: abc_global.h:232
int nEntriesUsed
Definition: giaMem.c:53
Gia_MmFlex_t* Gia_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 giaMem.c.

306 {
307  Gia_MmFlex_t * p;
308 
309  p = ABC_ALLOC( Gia_MmFlex_t, 1 );
310  memset( p, 0, sizeof(Gia_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()
char ** pChunks
Definition: giaMem.c:61
int nChunks
Definition: giaMem.c:60
static Llb_Mgr_t * p
Definition: llb3Image.c:950
char * pCurrent
Definition: giaMem.c:54
int nMemoryUsed
Definition: giaMem.c:64
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
int nChunkSize
Definition: giaMem.c:58
int nMemoryAlloc
Definition: giaMem.c:65
char * pEnd
Definition: giaMem.c:55
int nChunksAlloc
Definition: giaMem.c:59
int nEntriesUsed
Definition: giaMem.c:53
void Gia_MmFlexStop ( Gia_MmFlex_t p,
int  fVerbose 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 337 of file giaMem.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 }
char ** pChunks
Definition: giaMem.c:61
int nChunks
Definition: giaMem.c:60
int nMemoryUsed
Definition: giaMem.c:64
int nChunkSize
Definition: giaMem.c:58
int nMemoryAlloc
Definition: giaMem.c:65
#define ABC_FREE(obj)
Definition: abc_global.h:232
int nEntriesUsed
Definition: giaMem.c:53
char* Gia_MmStepEntryFetch ( Gia_MmStep_t p,
int  nBytes 
)

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

Synopsis [Creates the entry.]

Description []

SideEffects []

SeeAlso []

Definition at line 534 of file giaMem.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 Gia_MmFixedEntryFetch( p->pMap[nBytes] );
549 }
Gia_MmFixed_t ** pMap
Definition: giaMem.c:73
#define ABC_REALLOC(type, obj, num)
Definition: abc_global.h:233
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
char * Gia_MmFixedEntryFetch(Gia_MmFixed_t *p)
Definition: giaMem.c:161
int nMapSize
Definition: giaMem.c:72
int nChunks
Definition: giaMem.c:76
char ** pChunks
Definition: giaMem.c:77
int nChunksAlloc
Definition: giaMem.c:75
void Gia_MmStepEntryRecycle ( Gia_MmStep_t p,
char *  pEntry,
int  nBytes 
)

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

Synopsis [Recycles the entry.]

Description []

SideEffects []

SeeAlso []

Definition at line 563 of file giaMem.c.

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

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 586 of file giaMem.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 }
Gia_MmFixed_t ** pMems
Definition: giaMem.c:71
int nMems
Definition: giaMem.c:70
int nMemoryAlloc
Definition: giaMem.c:47
Gia_MmStep_t* Gia_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 giaMem.c.

469 {
470  Gia_MmStep_t * p;
471  int i, k;
472  p = ABC_ALLOC( Gia_MmStep_t, 1 );
473  memset( p, 0, sizeof(Gia_MmStep_t) );
474  p->nMems = nSteps;
475  // start the fixed memory managers
476  p->pMems = ABC_ALLOC( Gia_MmFixed_t *, p->nMems );
477  for ( i = 0; i < p->nMems; i++ )
478  p->pMems[i] = Gia_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( Gia_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()
Gia_MmFixed_t ** pMap
Definition: giaMem.c:73
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
Gia_MmFixed_t ** pMems
Definition: giaMem.c:71
for(p=first;p->value< newval;p=p->next)
int nMems
Definition: giaMem.c:70
int nMapSize
Definition: giaMem.c:72
Gia_MmFixed_t * Gia_MmFixedStart(int nEntrySize, int nEntriesMax)
FUNCTION DEFINITIONS ///.
Definition: giaMem.c:96
int nChunks
Definition: giaMem.c:76
char ** pChunks
Definition: giaMem.c:77
int nChunksAlloc
Definition: giaMem.c:75
DECLARATIONS ///.
Definition: giaMem.c:30
void Gia_MmStepStop ( Gia_MmStep_t p,
int  fVerbose 
)

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

Synopsis [Stops the memory manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 507 of file giaMem.c.

508 {
509  int i;
510  for ( i = 0; i < p->nMems; i++ )
511  Gia_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 }
Gia_MmFixed_t ** pMap
Definition: giaMem.c:73
Gia_MmFixed_t ** pMems
Definition: giaMem.c:71
int nMems
Definition: giaMem.c:70
int nChunks
Definition: giaMem.c:76
#define ABC_FREE(obj)
Definition: abc_global.h:232
char ** pChunks
Definition: giaMem.c:77
int nChunksAlloc
Definition: giaMem.c:75
void Gia_MmFixedStop(Gia_MmFixed_t *p, int fVerbose)
Definition: giaMem.c:132
int Gia_NodeMffcSize ( Gia_Man_t p,
Gia_Obj_t pNode 
)

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 1132 of file giaUtil.c.

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

Definition at line 378 of file gia.h.

378 { return (Gia_Obj_t *)((ABC_PTRUINT_T)(p) ^ 01); }
Definition: gia.h:75
static Gia_Obj_t* Gia_NotCond ( Gia_Obj_t p,
int  c 
)
inlinestatic

Definition at line 379 of file gia.h.

379 { return (Gia_Obj_t *)((ABC_PTRUINT_T)(p) ^ (c)); }
Definition: gia.h:75
static int Gia_Obj2Lit ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 433 of file gia.h.

433 { return Abc_Var2Lit(Gia_ObjId(p, Gia_Regular(pObj)), Gia_IsComplement(pObj)); }
static Gia_Obj_t * Gia_Regular(Gia_Obj_t *p)
Definition: gia.h:377
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Gia_IsComplement(Gia_Obj_t *p)
Definition: gia.h:380
void Gia_ObjAddFanout ( Gia_Man_t p,
Gia_Obj_t pObj,
Gia_Obj_t pFanout 
)

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 116 of file giaFanout.c.

117 {
118  int iFan, * pFirst, * pPrevC, * pNextC, * pPrev, * pNext;
119  assert( p->pFanData );
120  assert( !Gia_IsComplement(pObj) && !Gia_IsComplement(pFanout) );
121  assert( Gia_ObjId(p, pFanout) > 0 );
122  if ( Gia_ObjId(p, pObj) >= p->nFansAlloc || Gia_ObjId(p, pFanout) >= p->nFansAlloc )
123  {
124  int nFansAlloc = 2 * Abc_MaxInt( Gia_ObjId(p, pObj), Gia_ObjId(p, pFanout) );
125  p->pFanData = ABC_REALLOC( int, p->pFanData, 5 * nFansAlloc );
126  memset( p->pFanData + 5 * p->nFansAlloc, 0, sizeof(int) * 5 * (nFansAlloc - p->nFansAlloc) );
127  p->nFansAlloc = nFansAlloc;
128  }
129  assert( Gia_ObjId(p, pObj) < p->nFansAlloc && Gia_ObjId(p, pFanout) < p->nFansAlloc );
130  iFan = Gia_FanoutCreate( Gia_ObjId(p, pFanout), Gia_ObjWhatFanin(pFanout, pObj) );
131  pPrevC = Gia_FanoutPrev( p->pFanData, iFan );
132  pNextC = Gia_FanoutNext( p->pFanData, iFan );
133  pFirst = Gia_FanoutObj( p->pFanData, Gia_ObjId(p, pObj) );
134  if ( *pFirst == 0 )
135  {
136  *pFirst = iFan;
137  *pPrevC = iFan;
138  *pNextC = iFan;
139  }
140  else
141  {
142  pPrev = Gia_FanoutPrev( p->pFanData, *pFirst );
143  pNext = Gia_FanoutNext( p->pFanData, *pPrev );
144  assert( *pNext == *pFirst );
145  *pPrevC = *pPrev;
146  *pNextC = *pFirst;
147  *pPrev = iFan;
148  *pNext = iFan;
149  }
150 }
char * memset()
static int * Gia_FanoutNext(int *pData, int iFan)
Definition: giaFanout.c:39
#define ABC_REALLOC(type, obj, num)
Definition: abc_global.h:233
static int * Gia_FanoutPrev(int *pData, int iFan)
Definition: giaFanout.c:38
int nFansAlloc
Definition: gia.h:128
static int * Gia_FanoutObj(int *pData, int ObjId)
Definition: giaFanout.c:37
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static int Gia_ObjWhatFanin(Gia_Obj_t *pObj, Gia_Obj_t *pFanin)
Definition: gia.h:473
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
int * pFanData
Definition: gia.h:127
static int Gia_IsComplement(Gia_Obj_t *p)
Definition: gia.h:380
#define assert(ex)
Definition: util_old.h:213
static ABC_NAMESPACE_IMPL_START int Gia_FanoutCreate(int FanId, int Num)
DECLARATIONS ///.
Definition: giaFanout.c:36
static int Gia_ObjCellFanin ( Gia_Man_t p,
int  iLit,
int  i 
)
inlinestatic

Definition at line 965 of file gia.h.

965 { return Gia_ObjCellFanins(p, iLit)[i]; }
static int * Gia_ObjCellFanins(Gia_Man_t *p, int iLit)
Definition: gia.h:964
static int* Gia_ObjCellFanins ( Gia_Man_t p,
int  iLit 
)
inlinestatic

Definition at line 964 of file gia.h.

964 { return Vec_IntEntryP(p->vCellMapping, Vec_IntEntry(p->vCellMapping, iLit))+1; }
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Vec_Int_t * vCellMapping
Definition: gia.h:132
static int * Vec_IntEntryP(Vec_Int_t *p, int i)
Definition: vecInt.h:417
static int Gia_ObjCellId ( Gia_Man_t p,
int  iLit 
)
inlinestatic

Definition at line 966 of file gia.h.

966 { return Gia_ObjCellFanins(p, iLit)[Gia_ObjCellSize(p, iLit)]; }
static int Gia_ObjCellSize(Gia_Man_t *p, int iLit)
Definition: gia.h:963
static int * Gia_ObjCellFanins(Gia_Man_t *p, int iLit)
Definition: gia.h:964
static int Gia_ObjCellSize ( Gia_Man_t p,
int  iLit 
)
inlinestatic

Definition at line 963 of file gia.h.

963 { return Vec_IntEntry(p->vCellMapping, Vec_IntEntry(p->vCellMapping, iLit)); }
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Vec_Int_t * vCellMapping
Definition: gia.h:132
static Gia_Obj_t* Gia_ObjChild0 ( Gia_Obj_t pObj)
inlinestatic

Definition at line 457 of file gia.h.

457 { return Gia_NotCond( Gia_ObjFanin0(pObj), Gia_ObjFaninC0(pObj) ); }
static Gia_Obj_t * Gia_NotCond(Gia_Obj_t *p, int c)
Definition: gia.h:379
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static Gia_Obj_t* Gia_ObjChild1 ( Gia_Obj_t pObj)
inlinestatic

Definition at line 458 of file gia.h.

458 { return Gia_NotCond( Gia_ObjFanin1(pObj), Gia_ObjFaninC1(pObj) ); }
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static Gia_Obj_t * Gia_NotCond(Gia_Obj_t *p, int c)
Definition: gia.h:379
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
static Gia_Obj_t* Gia_ObjChild2 ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 459 of file gia.h.

459 { return Gia_NotCond( Gia_ObjFanin2(p, pObj), Gia_ObjFaninC2(p, pObj) ); }
static int Gia_ObjFaninC2(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:453
static Gia_Obj_t * Gia_NotCond(Gia_Obj_t *p, int c)
Definition: gia.h:379
static Gia_Obj_t * Gia_ObjFanin2(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:456
static int Gia_ObjCioId ( Gia_Obj_t pObj)
inlinestatic

Definition at line 411 of file gia.h.

411 { assert( pObj->fTerm ); return pObj->iDiff1; }
unsigned fTerm
Definition: gia.h:80
#define assert(ex)
Definition: util_old.h:213
unsigned iDiff1
Definition: gia.h:82
void Gia_ObjCollectInternal ( Gia_Man_t p,
Gia_Obj_t pObj 
)

Definition at line 159 of file giaTruth.c.

160 {
161  Vec_IntClear( p->vTtNodes );
162  Gia_ObjCollectInternal_rec( p, pObj );
163 }
void Gia_ObjCollectInternal_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaTruth.c:147
Vec_Int_t * vTtNodes
Definition: gia.h:185
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
static int Gia_ObjColor ( Gia_Man_t p,
int  Id,
int  c 
)
inlinestatic

Definition at line 903 of file gia.h.

903 { return c? p->pReprs[Id].fColorB : p->pReprs[Id].fColorA; }
unsigned fColorA
Definition: gia.h:61
unsigned fColorB
Definition: gia.h:62
Gia_Rpr_t * pReprs
Definition: gia.h:121
static int Gia_ObjColors ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 904 of file gia.h.

904 { return p->pReprs[Id].fColorB * 2 + p->pReprs[Id].fColorA; }
unsigned fColorA
Definition: gia.h:61
unsigned fColorB
Definition: gia.h:62
Gia_Rpr_t * pReprs
Definition: gia.h:121
word* Gia_ObjComputeTruthTable ( Gia_Man_t p,
Gia_Obj_t pObj 
)

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

Synopsis [Computing the truth table for GIA object.]

Description [The truth table should be used by the calling application (or saved into the user's storage) before this procedure is called again.]

SideEffects []

SeeAlso []

Definition at line 177 of file giaTruth.c.

178 {
179  Gia_Obj_t * pTemp, * pRoot;
180  word * pTruth, * pTruthL, * pTruth0, * pTruth1;
181  int i;
182  if ( p->vTtMemory == NULL )
183  {
184  p->nTtVars = Gia_ManPiNum( p );
186  p->vTtNums = Vec_IntStart( Gia_ManObjNum(p) + 1000 );
187  p->vTtNodes = Vec_IntAlloc( 256 );
189  p->vTtMemory = Vec_WrdStart( p->nTtWords * 256 );
190  }
191  else
192  {
193  // make sure the number of primary inputs did not change
194  // since the truth table computation storage was prepared
195  assert( p->nTtVars == Gia_ManPiNum(p) );
196  }
197  // extend ID numbers
198  if ( Vec_IntSize(p->vTtNums) < Gia_ManObjNum(p) )
200  // collect internal nodes
201  pRoot = Gia_ObjIsCo(pObj) ? Gia_ObjFanin0(pObj) : pObj;
202  Gia_ObjCollectInternal( p, pRoot );
203  // extend TT storage
204  if ( Vec_WrdSize(p->vTtMemory) < p->nTtWords * (Vec_IntSize(p->vTtNodes) + 2) )
205  Vec_WrdFillExtra( p->vTtMemory, p->nTtWords * (Vec_IntSize(p->vTtNodes) + 2), 0 );
206  // compute the truth table for internal nodes
207  Gia_ManForEachObjVec( p->vTtNodes, p, pTemp, i )
208  {
209  pTemp->fMark0 = 0; // unmark nodes marked by Gia_ObjCollectInternal()
210  pTruth = Gla_ObjTruthNode(p, pTemp);
211  pTruthL = pTruth + p->nTtWords;
214  if ( Gia_ObjFaninC0(pTemp) )
215  {
216  if ( Gia_ObjFaninC1(pTemp) )
217  while ( pTruth < pTruthL )
218  *pTruth++ = ~*pTruth0++ & ~*pTruth1++;
219  else
220  while ( pTruth < pTruthL )
221  *pTruth++ = ~*pTruth0++ & *pTruth1++;
222  }
223  else
224  {
225  if ( Gia_ObjFaninC1(pTemp) )
226  while ( pTruth < pTruthL )
227  *pTruth++ = *pTruth0++ & ~*pTruth1++;
228  else
229  while ( pTruth < pTruthL )
230  *pTruth++ = *pTruth0++ & *pTruth1++;
231  }
232  }
233  // compute the final table
234  if ( Gia_ObjIsConst0(pRoot) )
235  pTruth = Gla_ObjTruthConst0( p, Gla_ObjTruthFree1(p) );
236  else if ( Gia_ObjIsPi(p, pRoot) )
237  pTruth = Gla_ObjTruthElem( p, Gia_ObjCioId(pRoot) );
238  else if ( Gia_ObjIsAnd(pRoot) )
239  pTruth = Gla_ObjTruthNode( p, pRoot );
240  else
241  pTruth = NULL;
242  return Gla_ObjTruthDup( p, Gla_ObjTruthFree2(p), pTruth, Gia_ObjIsCo(pObj) && Gia_ObjFaninC0(pObj) );
243 }
void Gia_ObjCollectInternal(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaTruth.c:159
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static void Vec_IntFillExtra(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:376
static word * Gla_ObjTruthFree1(Gia_Man_t *p)
Definition: giaTruth.c:42
static int Abc_Truth6WordNum(int nVars)
Definition: abc_global.h:257
static int Gia_ObjIsConst0(Gia_Obj_t *pObj)
Definition: gia.h:430
static word * Gla_ObjTruthFree2(Gia_Man_t *p)
Definition: giaTruth.c:43
int nTtWords
Definition: gia.h:183
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static int Vec_WrdSize(Vec_Wrd_t *p)
Definition: vecWrd.h:336
Definition: gia.h:75
static word * Gla_ObjTruthDup(Gia_Man_t *p, word *pDst, word *pSrc, int c)
Definition: giaTruth.c:45
static Vec_Ptr_t * Vec_PtrAllocTruthTables(int nVars)
Definition: vecPtr.h:1065
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static word * Gla_ObjTruthConst0(Gia_Man_t *p, word *pDst)
Definition: giaTruth.c:44
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
Vec_Ptr_t * vTtInputs
Definition: gia.h:186
static word * Gla_ObjTruthElem(Gia_Man_t *p, int i)
Definition: giaTruth.c:39
int nTtVars
Definition: gia.h:182
static word * Gla_ObjTruthNode(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaTruth.c:41
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition: gia.h:988
static Vec_Wrd_t * Vec_WrdStart(int nSize)
Definition: vecWrd.h:103
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
unsigned fMark0
Definition: gia.h:79
Vec_Int_t * vTtNodes
Definition: gia.h:185
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
Vec_Wrd_t * vTtMemory
Definition: gia.h:187
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
static void Vec_WrdFillExtra(Vec_Wrd_t *p, int nSize, word Fill)
Definition: vecWrd.h:509
static int Gia_ObjCioId(Gia_Obj_t *pObj)
Definition: gia.h:411
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ObjIsPi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:441
Vec_Int_t * vTtNums
Definition: gia.h:184
word Gia_ObjComputeTruthTable6 ( Gia_Man_t p,
Gia_Obj_t pObj,
Vec_Int_t vSupp,
Vec_Wrd_t vTruths 
)

Definition at line 116 of file giaTruth.c.

117 {
118  Gia_Obj_t * pLeaf;
119  int i;
120  assert( Vec_IntSize(vSupp) <= 6 );
121  assert( Gia_ObjIsAnd(pObj) );
122  assert( !pObj->fMark0 );
123  Vec_WrdClear( vTruths );
125  Gia_ManForEachObjVec( vSupp, p, pLeaf, i )
126  {
127  assert( pLeaf->fMark0 || Gia_ObjIsRo(p, pLeaf) );
128  pLeaf->Value = Vec_WrdSize(vTruths);
129  Vec_WrdPush( vTruths, s_Truth6[i] );
130  Gia_ObjSetTravIdCurrent(p, pLeaf);
131  }
132  Gia_ObjComputeTruthTable6_rec( p, pObj, vTruths );
133  return Vec_WrdEntryLast( vTruths );
134 }
void Gia_ObjComputeTruthTable6_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Wrd_t *vTruths)
Definition: giaTruth.c:99
static void Vec_WrdPush(Vec_Wrd_t *p, word Entry)
Definition: vecWrd.h:618
static word Vec_WrdEntryLast(Vec_Wrd_t *p)
Definition: vecWrd.h:452
static int Vec_WrdSize(Vec_Wrd_t *p)
Definition: vecWrd.h:336
Definition: gia.h:75
static ABC_NAMESPACE_IMPL_START word s_Truth6[6]
DECLARATIONS ///.
Definition: giaTruth.c:30
static void Vec_WrdClear(Vec_Wrd_t *p)
Definition: vecWrd.h:602
static int Gia_ObjIsRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:443
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition: gia.h:988
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
unsigned fMark0
Definition: gia.h:79
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
word Gia_ObjComputeTruthTable6Lut ( Gia_Man_t p,
int  iObj,
Vec_Wrd_t vTemp 
)

Definition at line 76 of file giaTruth.c.

77 {
78  int i, Fanin;
79  assert( Vec_WrdSize(vTemp) == Gia_ManObjNum(p) );
80  assert( Gia_ObjIsLut(p, iObj) );
81  Gia_LutForEachFanin( p, iObj, Fanin, i )
82  Vec_WrdWriteEntry( vTemp, Fanin, s_Truth6[i] );
83  assert( i <= 6 );
84  Gia_ObjComputeTruthTable6Lut_rec( p, iObj, vTemp );
85  return Vec_WrdEntry( vTemp, iObj );
86 }
static int Vec_WrdSize(Vec_Wrd_t *p)
Definition: vecWrd.h:336
static ABC_NAMESPACE_IMPL_START word s_Truth6[6]
DECLARATIONS ///.
Definition: giaTruth.c:30
static void Vec_WrdWriteEntry(Vec_Wrd_t *p, int i, word Entry)
Definition: vecWrd.h:418
static word Vec_WrdEntry(Vec_Wrd_t *p, int i)
Definition: vecWrd.h:384
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjIsLut(Gia_Man_t *p, int Id)
Definition: gia.h:952
#define Gia_LutForEachFanin(p, i, iFan, k)
Definition: gia.h:970
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ObjComputeTruthTable6Lut_rec(Gia_Man_t *p, int iObj, Vec_Wrd_t *vTemp)
FUNCTION DEFINITIONS ///.
Definition: giaTruth.c:62
word* Gia_ObjComputeTruthTableCut ( Gia_Man_t p,
Gia_Obj_t pRoot,
Vec_Int_t vLeaves 
)

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

Synopsis [Computes the truth table of pRoot in terms of leaves.]

Description [The root cannot be one of the leaves.]

SideEffects []

SeeAlso []

Definition at line 351 of file giaTruth.c.

352 {
353  Gia_Obj_t * pTemp;
354  word * pTruth, * pTruthL, * pTruth0, * pTruth1;
355  int i, iObj, Id0, Id1;
356  assert( p->vTtMemory != NULL );
357  assert( Vec_IntSize(vLeaves) <= p->nTtVars );
358  // extend ID numbers
359  if ( Vec_IntSize(p->vTtNums) < Gia_ManObjNum(p) )
361  // collect internal nodes
362  Gia_ObjCollectInternalCut( p, Gia_ObjId(p, pRoot), vLeaves );
363  // extend TT storage
364  if ( Vec_WrdSize(p->vTtMemory) < p->nTtWords * (Vec_IntSize(p->vTtNodes) + 2) )
365  Vec_WrdFillExtra( p->vTtMemory, p->nTtWords * (Vec_IntSize(p->vTtNodes) + 2), 0 );
366  // compute the truth table for internal nodes
367  Vec_IntForEachEntryStart( p->vTtNodes, iObj, i, 1 )
368  {
369  assert( i == Gia_ObjNumId(p, iObj) );
370  pTemp = Gia_ManObj( p, iObj );
371  pTruth = Gla_ObjTruthNodeId( p, i );
372  pTruthL = pTruth + p->nTtWords;
373  Id0 = Gia_ObjNumId( p, Gia_ObjFaninId0(pTemp, iObj) );
374  Id1 = Gia_ObjNumId( p, Gia_ObjFaninId1(pTemp, iObj) );
375  pTruth0 = (Id0 > 0) ? Gla_ObjTruthNodeId(p, Id0) : Gla_ObjTruthElem(p, -Id0);
376  pTruth1 = (Id1 > 0) ? Gla_ObjTruthNodeId(p, Id1) : Gla_ObjTruthElem(p, -Id1);
377  if ( Gia_ObjFaninC0(pTemp) )
378  {
379  if ( Gia_ObjFaninC1(pTemp) )
380  while ( pTruth < pTruthL )
381  *pTruth++ = ~*pTruth0++ & ~*pTruth1++;
382  else
383  while ( pTruth < pTruthL )
384  *pTruth++ = ~*pTruth0++ & *pTruth1++;
385  }
386  else
387  {
388  if ( Gia_ObjFaninC1(pTemp) )
389  while ( pTruth < pTruthL )
390  *pTruth++ = *pTruth0++ & ~*pTruth1++;
391  else
392  while ( pTruth < pTruthL )
393  *pTruth++ = *pTruth0++ & *pTruth1++;
394  }
395  }
396  pTruth = Gla_ObjTruthNode( p, pRoot );
397  // unmark leaves marked by Gia_ObjCollectInternal()
398  Vec_IntForEachEntry( vLeaves, iObj, i )
399  Gia_ObjResetNumId( p, iObj );
400  Vec_IntForEachEntryStart( p->vTtNodes, iObj, i, 1 )
401  Gia_ObjResetNumId( p, iObj );
402  return pTruth;
403 }
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static void Vec_IntFillExtra(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:376
int nTtWords
Definition: gia.h:183
static int Vec_WrdSize(Vec_Wrd_t *p)
Definition: vecWrd.h:336
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static word * Gla_ObjTruthElem(Gia_Man_t *p, int i)
Definition: giaTruth.c:39
static word * Gla_ObjTruthNodeId(Gia_Man_t *p, int Id)
Definition: giaTruth.c:40
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
Definition: vecInt.h:56
int nTtVars
Definition: gia.h:182
static word * Gla_ObjTruthNode(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaTruth.c:41
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Vec_Int_t * vTtNodes
Definition: gia.h:185
static int Gia_ObjNumId(Gia_Man_t *p, int Id)
Definition: gia.h:512
Vec_Wrd_t * vTtMemory
Definition: gia.h:187
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
void Gia_ObjCollectInternalCut(Gia_Man_t *p, int iRoot, Vec_Int_t *vLeaves)
Definition: giaTruth.c:324
#define assert(ex)
Definition: util_old.h:213
static void Gia_ObjResetNumId(Gia_Man_t *p, int Id)
Definition: gia.h:516
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static void Vec_WrdFillExtra(Vec_Wrd_t *p, int nSize, word Fill)
Definition: vecWrd.h:509
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static int Gia_ObjFaninId1(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:461
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ObjFaninId0(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:460
Vec_Int_t * vTtNums
Definition: gia.h:184
void Gia_ObjComputeTruthTableStart ( Gia_Man_t p,
int  nVarsMax 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 282 of file giaTruth.c.

283 {
284  assert( p->vTtMemory == NULL );
285  p->nTtVars = nVarsMax;
287  p->vTtNodes = Vec_IntAlloc( 256 );
289  p->vTtMemory = Vec_WrdStart( p->nTtWords * 64 );
290  p->vTtNums = Vec_IntAlloc( Gia_ManObjNum(p) + 1000 );
292 }
static int Abc_Truth6WordNum(int nVars)
Definition: abc_global.h:257
int nTtWords
Definition: gia.h:183
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static Vec_Ptr_t * Vec_PtrAllocTruthTables(int nVars)
Definition: vecPtr.h:1065
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
Vec_Ptr_t * vTtInputs
Definition: gia.h:186
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
static int Vec_IntCap(Vec_Int_t *p)
Definition: vecInt.h:368
int nTtVars
Definition: gia.h:182
static Vec_Wrd_t * Vec_WrdStart(int nSize)
Definition: vecWrd.h:103
Vec_Int_t * vTtNodes
Definition: gia.h:185
Vec_Wrd_t * vTtMemory
Definition: gia.h:187
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
#define assert(ex)
Definition: util_old.h:213
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
Vec_Int_t * vTtNums
Definition: gia.h:184
void Gia_ObjComputeTruthTableStop ( Gia_Man_t p)

Definition at line 293 of file giaTruth.c.

294 {
295  p->nTtVars = 0;
296  p->nTtWords = 0;
297  Vec_IntFreeP( &p->vTtNums );
298  Vec_IntFreeP( &p->vTtNodes );
299  Vec_PtrFreeP( &p->vTtInputs );
300  Vec_WrdFreeP( &p->vTtMemory );
301 }
int nTtWords
Definition: gia.h:183
static void Vec_WrdFreeP(Vec_Wrd_t **p)
Definition: vecWrd.h:277
Vec_Ptr_t * vTtInputs
Definition: gia.h:186
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
int nTtVars
Definition: gia.h:182
Vec_Int_t * vTtNodes
Definition: gia.h:185
static void Vec_PtrFreeP(Vec_Ptr_t **p)
Definition: vecPtr.h:240
Vec_Wrd_t * vTtMemory
Definition: gia.h:187
Vec_Int_t * vTtNums
Definition: gia.h:184
static Gia_Obj_t* Gia_ObjCopy ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 478 of file gia.h.

478 { return Gia_ManObj( p, Abc_Lit2Var(pObj->Value) ); }
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
unsigned Value
Definition: gia.h:87
static int Gia_ObjCopyArray ( Gia_Man_t p,
int  iObj 
)
inlinestatic

Definition at line 487 of file gia.h.

487 { return Vec_IntEntry(&p->vCopies, iObj); }
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Vec_Int_t vCopies
Definition: gia.h:138
static int Gia_ObjCopyF ( Gia_Man_t p,
int  f,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 485 of file gia.h.

485 { return Vec_IntEntry(&p->vCopies, Gia_ManObjNum(p) * f + Gia_ObjId(p,pObj)); }
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
Vec_Int_t vCopies
Definition: gia.h:138
static unsigned Gia_ObjCutSign ( unsigned  ObjId)
inlinestatic

Definition at line 310 of file gia.h.

310 { return (1 << (ObjId & 31)); }
static int Gia_ObjDiff0 ( Gia_Obj_t pObj)
inlinestatic

Definition at line 449 of file gia.h.

449 { return pObj->iDiff0; }
unsigned iDiff0
Definition: gia.h:77
static int Gia_ObjDiff1 ( Gia_Obj_t pObj)
inlinestatic

Definition at line 450 of file gia.h.

450 { return pObj->iDiff1; }
unsigned iDiff1
Definition: gia.h:82
static int Gia_ObjDiffColors ( Gia_Man_t p,
int  i,
int  j 
)
inlinestatic

Definition at line 908 of file gia.h.

908 { return (p->pReprs[i].fColorA ^ p->pReprs[j].fColorA) && (p->pReprs[i].fColorB ^ p->pReprs[j].fColorB); }
unsigned fColorA
Definition: gia.h:61
unsigned fColorB
Definition: gia.h:62
Gia_Rpr_t * pReprs
Definition: gia.h:121
static int Gia_ObjDiffColors2 ( Gia_Man_t p,
int  i,
int  j 
)
inlinestatic

Definition at line 909 of file gia.h.

909 { return (p->pReprs[i].fColorA ^ p->pReprs[j].fColorA) || (p->pReprs[i].fColorB ^ p->pReprs[j].fColorB); }
unsigned fColorA
Definition: gia.h:61
unsigned fColorB
Definition: gia.h:62
Gia_Rpr_t * pReprs
Definition: gia.h:121
static int Gia_ObjFailed ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 900 of file gia.h.

900 { return p->pReprs[Id].fFailed; }
unsigned fFailed
Definition: gia.h:60
Gia_Rpr_t * pReprs
Definition: gia.h:121
static Gia_Obj_t* Gia_ObjFanin0 ( Gia_Obj_t pObj)
inlinestatic

Definition at line 454 of file gia.h.

454 { return pObj - pObj->iDiff0; }
unsigned iDiff0
Definition: gia.h:77
static int Gia_ObjFanin0Copy ( Gia_Obj_t pObj)
inlinestatic

Definition at line 481 of file gia.h.

481 { return Abc_LitNotCond( Gia_ObjFanin0(pObj)->Value, Gia_ObjFaninC0(pObj) ); }
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static int Gia_ObjFanin0CopyArray ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 493 of file gia.h.

493 { return Abc_LitNotCond(Gia_ObjCopyArray(p, Gia_ObjFaninId0p(p,pObj)), Gia_ObjFaninC0(pObj)); }
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
static int Gia_ObjCopyArray(Gia_Man_t *p, int iObj)
Definition: gia.h:487
static int Gia_ObjFaninId0p(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:463
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static int Gia_ObjFanin0CopyF ( Gia_Man_t p,
int  f,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 491 of file gia.h.

491 { return Abc_LitNotCond(Gia_ObjCopyF(p, f, Gia_ObjFanin0(pObj)), Gia_ObjFaninC0(pObj)); }
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static int Gia_ObjCopyF(Gia_Man_t *p, int f, Gia_Obj_t *pObj)
Definition: gia.h:485
static Gia_Obj_t* Gia_ObjFanin1 ( Gia_Obj_t pObj)
inlinestatic

Definition at line 455 of file gia.h.

455 { return pObj - pObj->iDiff1; }
unsigned iDiff1
Definition: gia.h:82
static int Gia_ObjFanin1Copy ( Gia_Obj_t pObj)
inlinestatic

Definition at line 482 of file gia.h.

482 { return Abc_LitNotCond( Gia_ObjFanin1(pObj)->Value, Gia_ObjFaninC1(pObj) ); }
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
static int Gia_ObjFanin1CopyArray ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 494 of file gia.h.

494 { return Abc_LitNotCond(Gia_ObjCopyArray(p, Gia_ObjFaninId1p(p,pObj)), Gia_ObjFaninC1(pObj)); }
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static int Gia_ObjFaninId1p(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:464
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
static int Gia_ObjCopyArray(Gia_Man_t *p, int iObj)
Definition: gia.h:487
static int Gia_ObjFanin1CopyF ( Gia_Man_t p,
int  f,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 492 of file gia.h.

492 { return Abc_LitNotCond(Gia_ObjCopyF(p, f, Gia_ObjFanin1(pObj)), Gia_ObjFaninC1(pObj)); }
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
static int Gia_ObjCopyF(Gia_Man_t *p, int f, Gia_Obj_t *pObj)
Definition: gia.h:485
static Gia_Obj_t* Gia_ObjFanin2 ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 456 of file gia.h.

456 { return p->pMuxes ? Gia_ManObj(p, Abc_Lit2Var(p->pMuxes[Gia_ObjId(p, pObj)])) : NULL; }
unsigned * pMuxes
Definition: gia.h:104
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
static int Gia_ObjFanin2Copy ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 483 of file gia.h.

483 { return Abc_LitNotCond(Gia_ObjFanin2(p, pObj)->Value, Gia_ObjFaninC2(p, pObj)); }
static int Gia_ObjFaninC2(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:453
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
static Gia_Obj_t * Gia_ObjFanin2(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:456
static int Gia_ObjFaninC0 ( Gia_Obj_t pObj)
inlinestatic

Definition at line 451 of file gia.h.

451 { return pObj->fCompl0; }
unsigned fCompl0
Definition: gia.h:78
static int Gia_ObjFaninC1 ( Gia_Obj_t pObj)
inlinestatic

Definition at line 452 of file gia.h.

452 { return pObj->fCompl1; }
unsigned fCompl1
Definition: gia.h:83
static int Gia_ObjFaninC2 ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 453 of file gia.h.

453 { return p->pMuxes && Abc_LitIsCompl(p->pMuxes[Gia_ObjId(p, pObj)]); }
unsigned * pMuxes
Definition: gia.h:104
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Gia_ObjFaninId0 ( Gia_Obj_t pObj,
int  ObjId 
)
inlinestatic

Definition at line 460 of file gia.h.

460 { return ObjId - pObj->iDiff0; }
unsigned iDiff0
Definition: gia.h:77
static int Gia_ObjFaninId0p ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 463 of file gia.h.

463 { return Gia_ObjFaninId0( pObj, Gia_ObjId(p, pObj) ); }
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Gia_ObjFaninId0(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:460
static int Gia_ObjFaninId1 ( Gia_Obj_t pObj,
int  ObjId 
)
inlinestatic

Definition at line 461 of file gia.h.

461 { return ObjId - pObj->iDiff1; }
unsigned iDiff1
Definition: gia.h:82
static int Gia_ObjFaninId1p ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 464 of file gia.h.

464 { return Gia_ObjFaninId1( pObj, Gia_ObjId(p, pObj) ); }
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Gia_ObjFaninId1(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:461
static int Gia_ObjFaninId2 ( Gia_Man_t p,
int  ObjId 
)
inlinestatic

Definition at line 462 of file gia.h.

462 { return (p->pMuxes && p->pMuxes[ObjId]) ? Abc_Lit2Var(p->pMuxes[ObjId]) : -1; }
unsigned * pMuxes
Definition: gia.h:104
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
static int Gia_ObjFaninId2p ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 465 of file gia.h.

465 { return (p->pMuxes && p->pMuxes[Gia_ObjId(p, pObj)]) ? Abc_Lit2Var(p->pMuxes[Gia_ObjId(p, pObj)]) : -1; }
unsigned * pMuxes
Definition: gia.h:104
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
static int Gia_ObjFaninLit0 ( Gia_Obj_t pObj,
int  ObjId 
)
inlinestatic

Definition at line 466 of file gia.h.

466 { return Abc_Var2Lit( Gia_ObjFaninId0(pObj, ObjId), Gia_ObjFaninC0(pObj) ); }
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static int Gia_ObjFaninId0(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:460
static int Gia_ObjFaninLit0p ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 469 of file gia.h.

469 { return Abc_Var2Lit( Gia_ObjFaninId0p(p, pObj), Gia_ObjFaninC0(pObj) ); }
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
static int Gia_ObjFaninId0p(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:463
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static int Gia_ObjFaninLit1 ( Gia_Obj_t pObj,
int  ObjId 
)
inlinestatic

Definition at line 467 of file gia.h.

467 { return Abc_Var2Lit( Gia_ObjFaninId1(pObj, ObjId), Gia_ObjFaninC1(pObj) ); }
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
static int Gia_ObjFaninId1(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:461
static int Gia_ObjFaninLit1p ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 470 of file gia.h.

470 { return Abc_Var2Lit( Gia_ObjFaninId1p(p, pObj), Gia_ObjFaninC1(pObj) ); }
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
static int Gia_ObjFaninId1p(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:464
static int Gia_ObjFaninLit2 ( Gia_Man_t p,
int  ObjId 
)
inlinestatic

Definition at line 468 of file gia.h.

468 { return (p->pMuxes && p->pMuxes[ObjId]) ? p->pMuxes[ObjId] : -1; }
unsigned * pMuxes
Definition: gia.h:104
static int Gia_ObjFaninLit2p ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 471 of file gia.h.

471 { return (p->pMuxes && p->pMuxes[Gia_ObjId(p, pObj)]) ? p->pMuxes[Gia_ObjId(p, pObj)] : -1; }
unsigned * pMuxes
Definition: gia.h:104
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static Gia_Obj_t* Gia_ObjFanout ( Gia_Man_t p,
Gia_Obj_t pObj,
int  i 
)
inlinestatic

Definition at line 943 of file gia.h.

943 { return Gia_ManObj( p, Gia_ObjFanoutId(p, Gia_ObjId(p, pObj), i) ); }
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Gia_ObjFanoutId(Gia_Man_t *p, int Id, int i)
Definition: gia.h:941
static Gia_Obj_t* Gia_ObjFanout0 ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 942 of file gia.h.

942 { return Gia_ManObj( p, Gia_ObjFanoutId(p, Gia_ObjId(p, pObj), 0) ); }
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Gia_ObjFanoutId(Gia_Man_t *p, int Id, int i)
Definition: gia.h:941
static int Gia_ObjFanoutId ( Gia_Man_t p,
int  Id,
int  i 
)
inlinestatic

Definition at line 941 of file gia.h.

941 { return Vec_IntEntry( p->vFanout, Gia_ObjFoffsetId(p, Id) + i ); }
static int Gia_ObjFoffsetId(Gia_Man_t *p, int Id)
Definition: gia.h:937
Vec_Int_t * vFanout
Definition: gia.h:130
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Gia_ObjFanoutNum ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 940 of file gia.h.

940 { return Gia_ObjFanoutNumId( p, Gia_ObjId(p, pObj) ); }
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Gia_ObjFanoutNumId(Gia_Man_t *p, int Id)
Definition: gia.h:939
static int Gia_ObjFanoutNumId ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 939 of file gia.h.

939 { return Vec_IntEntry( p->vFanoutNums, Id ); }
Vec_Int_t * vFanoutNums
Definition: gia.h:129
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static void Gia_ObjFlipFaninC0 ( Gia_Obj_t pObj)
inlinestatic

Definition at line 472 of file gia.h.

472 { assert( Gia_ObjIsCo(pObj) ); pObj->fCompl0 ^= 1; }
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
#define assert(ex)
Definition: util_old.h:213
unsigned fCompl0
Definition: gia.h:78
static int Gia_ObjFoffset ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 938 of file gia.h.

938 { return Gia_ObjFoffsetId( p, Gia_ObjId(p, pObj) ); }
static int Gia_ObjFoffsetId(Gia_Man_t *p, int Id)
Definition: gia.h:937
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Gia_ObjFoffsetId ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 937 of file gia.h.

937 { return Vec_IntEntry( p->vFanout, Id ); }
Vec_Int_t * vFanout
Definition: gia.h:130
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static Gia_Obj_t* Gia_ObjFromLit ( Gia_Man_t p,
int  iLit 
)
inlinestatic

Definition at line 496 of file gia.h.

496 { return Gia_NotCond( Gia_ManObj(p, Abc_Lit2Var(iLit)), Abc_LitIsCompl(iLit) ); }
static Gia_Obj_t * Gia_NotCond(Gia_Obj_t *p, int c)
Definition: gia.h:379
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
static int Gia_ObjHasNumId ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 511 of file gia.h.

511 { return Vec_IntEntry(p->vTtNums, Id) > -ABC_INFINITY; }
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
Vec_Int_t * vTtNums
Definition: gia.h:184
static int Gia_ObjHasRepr ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 891 of file gia.h.

891 { return p->pReprs[Id].iRepr != GIA_VOID; }
unsigned iRepr
Definition: gia.h:58
#define GIA_VOID
Definition: gia.h:45
Gia_Rpr_t * pReprs
Definition: gia.h:121
static int Gia_ObjHasSameRepr ( Gia_Man_t p,
int  i,
int  k 
)
inlinestatic

Definition at line 920 of file gia.h.

920 { assert( k ); return i? (Gia_ObjRepr(p, i) == Gia_ObjRepr(p, k) && Gia_ObjRepr(p, i) != GIA_VOID) : Gia_ObjRepr(p, k) == 0; }
#define GIA_VOID
Definition: gia.h:45
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjRepr(Gia_Man_t *p, int Id)
Definition: gia.h:887
static int Gia_ObjId ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 410 of file gia.h.

410 { assert( p->pObjs <= pObj && pObj < p->pObjs + p->nObjs ); return pObj - p->pObjs; }
Gia_Obj_t * pObjs
Definition: gia.h:103
int nObjs
Definition: gia.h:101
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjIsAnd ( Gia_Obj_t pObj)
inlinestatic

Definition at line 422 of file gia.h.

422 { return!pObj->fTerm && pObj->iDiff0 != GIA_NONE; }
unsigned iDiff0
Definition: gia.h:77
unsigned fTerm
Definition: gia.h:80
#define GIA_NONE
INCLUDES ///.
Definition: gia.h:44
static int Gia_ObjIsAndNotBuf ( Gia_Obj_t pObj)
inlinestatic

Definition at line 428 of file gia.h.

428 { return Gia_ObjIsAnd(pObj) && pObj->iDiff0 != pObj->iDiff1; }
unsigned iDiff0
Definition: gia.h:77
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
unsigned iDiff1
Definition: gia.h:82
static int Gia_ObjIsAndOrConst0 ( Gia_Obj_t pObj)
inlinestatic

Definition at line 419 of file gia.h.

419 { return!pObj->fTerm; }
unsigned fTerm
Definition: gia.h:80
static int Gia_ObjIsAndReal ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 426 of file gia.h.

426 { return Gia_ObjIsAnd(pObj) && pObj->iDiff0 > pObj->iDiff1 && !Gia_ObjIsMux(p, pObj); }
unsigned iDiff0
Definition: gia.h:77
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
unsigned iDiff1
Definition: gia.h:82
static int Gia_ObjIsMux(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:425
static int Gia_ObjIsBuf ( Gia_Obj_t pObj)
inlinestatic

Definition at line 427 of file gia.h.

427 { return pObj->iDiff0 == pObj->iDiff1 && pObj->iDiff0 != GIA_NONE && !pObj->fTerm; }
unsigned iDiff0
Definition: gia.h:77
unsigned fTerm
Definition: gia.h:80
#define GIA_NONE
INCLUDES ///.
Definition: gia.h:44
unsigned iDiff1
Definition: gia.h:82
static int Gia_ObjIsCand ( Gia_Obj_t pObj)
inlinestatic

Definition at line 429 of file gia.h.

429 { return Gia_ObjIsAnd(pObj) || Gia_ObjIsCi(pObj); }
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
static int Gia_ObjIsCell ( Gia_Man_t p,
int  iLit 
)
inlinestatic

Definition at line 960 of file gia.h.

960 { return Vec_IntEntry(p->vCellMapping, iLit) != 0; }
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Vec_Int_t * vCellMapping
Definition: gia.h:132
static int Gia_ObjIsCellBuf ( Gia_Man_t p,
int  iLit 
)
inlinestatic

Definition at line 962 of file gia.h.

962 { return Vec_IntEntry(p->vCellMapping, iLit) == -2; }
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Vec_Int_t * vCellMapping
Definition: gia.h:132
static int Gia_ObjIsCellInv ( Gia_Man_t p,
int  iLit 
)
inlinestatic

Definition at line 961 of file gia.h.

961 { return Vec_IntEntry(p->vCellMapping, iLit) == -1; }
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Vec_Int_t * vCellMapping
Definition: gia.h:132
static int Gia_ObjIsCi ( Gia_Obj_t pObj)
inlinestatic

Definition at line 420 of file gia.h.

420 { return pObj->fTerm && pObj->iDiff0 == GIA_NONE; }
unsigned iDiff0
Definition: gia.h:77
unsigned fTerm
Definition: gia.h:80
#define GIA_NONE
INCLUDES ///.
Definition: gia.h:44
static int Gia_ObjIsClass ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 919 of file gia.h.

919 { return (Gia_ObjRepr(p, Id) > 0 && Gia_ObjRepr(p, Id) != GIA_VOID) || Gia_ObjNext(p, Id) > 0; }
static int Gia_ObjNext(Gia_Man_t *p, int Id)
Definition: gia.h:912
#define GIA_VOID
Definition: gia.h:45
static int Gia_ObjRepr(Gia_Man_t *p, int Id)
Definition: gia.h:887
static int Gia_ObjIsCo ( Gia_Obj_t pObj)
inlinestatic

Definition at line 421 of file gia.h.

421 { return pObj->fTerm && pObj->iDiff0 != GIA_NONE; }
unsigned iDiff0
Definition: gia.h:77
unsigned fTerm
Definition: gia.h:80
#define GIA_NONE
INCLUDES ///.
Definition: gia.h:44
static int Gia_ObjIsConst ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 915 of file gia.h.

915 { return Gia_ObjRepr(p, Id) == 0; }
static int Gia_ObjRepr(Gia_Man_t *p, int Id)
Definition: gia.h:887
static int Gia_ObjIsConst0 ( Gia_Obj_t pObj)
inlinestatic

Definition at line 430 of file gia.h.

430 { return pObj->iDiff0 == GIA_NONE && pObj->iDiff1 == GIA_NONE; }
unsigned iDiff0
Definition: gia.h:77
#define GIA_NONE
INCLUDES ///.
Definition: gia.h:44
unsigned iDiff1
Definition: gia.h:82
static int Gia_ObjIsFailedPair ( Gia_Man_t p,
int  i,
int  k 
)
inlinestatic

Definition at line 921 of file gia.h.

921 { assert( k ); return i? (Gia_ObjFailed(p, i) || Gia_ObjFailed(p, k)) : Gia_ObjFailed(p, k); }
static int Gia_ObjFailed(Gia_Man_t *p, int Id)
Definition: gia.h:900
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjIsHead ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 916 of file gia.h.

916 { return Gia_ObjRepr(p, Id) == GIA_VOID && Gia_ObjNext(p, Id) > 0; }
static int Gia_ObjNext(Gia_Man_t *p, int Id)
Definition: gia.h:912
#define GIA_VOID
Definition: gia.h:45
static int Gia_ObjRepr(Gia_Man_t *p, int Id)
Definition: gia.h:887
static int Gia_ObjIsLut ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 952 of file gia.h.

952 { return Vec_IntEntry(p->vMapping, Id) != 0; }
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Vec_Int_t * vMapping
Definition: gia.h:131
static int Gia_ObjIsMux ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 425 of file gia.h.

425 { return Gia_ObjIsMuxId( p, Gia_ObjId(p, pObj) ); }
static int Gia_ObjIsMuxId(Gia_Man_t *p, int iObj)
Definition: gia.h:424
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Gia_ObjIsMuxId ( Gia_Man_t p,
int  iObj 
)
inlinestatic

Definition at line 424 of file gia.h.

424 { return p->pMuxes && p->pMuxes[iObj] > 0; }
unsigned * pMuxes
Definition: gia.h:104
int Gia_ObjIsMuxType ( Gia_Obj_t pNode)

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 885 of file giaUtil.c.

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

Definition at line 917 of file gia.h.

917 { return Gia_ObjRepr(p, Id) == GIA_VOID && Gia_ObjNext(p, Id) == 0; }
static int Gia_ObjNext(Gia_Man_t *p, int Id)
Definition: gia.h:912
#define GIA_VOID
Definition: gia.h:45
static int Gia_ObjRepr(Gia_Man_t *p, int Id)
Definition: gia.h:887
static int Gia_ObjIsPi ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 441 of file gia.h.

441 { return Gia_ObjIsCi(pObj) && Gia_ObjCioId(pObj) < Gia_ManPiNum(p); }
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
static int Gia_ObjCioId(Gia_Obj_t *pObj)
Definition: gia.h:411
static int Gia_ObjIsPo ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 442 of file gia.h.

442 { return Gia_ObjIsCo(pObj) && Gia_ObjCioId(pObj) < Gia_ManPoNum(p); }
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static int Gia_ObjCioId(Gia_Obj_t *pObj)
Definition: gia.h:411
static int Gia_ObjIsRi ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 444 of file gia.h.

444 { return Gia_ObjIsCo(pObj) && Gia_ObjCioId(pObj) >= Gia_ManPoNum(p); }
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static int Gia_ObjCioId(Gia_Obj_t *pObj)
Definition: gia.h:411
static int Gia_ObjIsRo ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 443 of file gia.h.

443 { return Gia_ObjIsCi(pObj) && Gia_ObjCioId(pObj) >= Gia_ManPiNum(p); }
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
static int Gia_ObjCioId(Gia_Obj_t *pObj)
Definition: gia.h:411
static int Gia_ObjIsTail ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 918 of file gia.h.

918 { return (Gia_ObjRepr(p, Id) > 0 && Gia_ObjRepr(p, Id) != GIA_VOID) && Gia_ObjNext(p, Id) == 0; }
static int Gia_ObjNext(Gia_Man_t *p, int Id)
Definition: gia.h:912
#define GIA_VOID
Definition: gia.h:45
static int Gia_ObjRepr(Gia_Man_t *p, int Id)
Definition: gia.h:887
static int Gia_ObjIsTerm ( Gia_Obj_t pObj)
inlinestatic

Definition at line 418 of file gia.h.

418 { return pObj->fTerm; }
unsigned fTerm
Definition: gia.h:80
static int Gia_ObjIsTravIdCurrent ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 533 of file gia.h.

533 { assert( Gia_ObjId(p, pObj) < p->nTravIdsAlloc ); return (p->pTravIds[Gia_ObjId(p, pObj)] == p->nTravIds); }
int * pTravIds
Definition: gia.h:153
int nTravIds
Definition: gia.h:118
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
int nTravIdsAlloc
Definition: gia.h:154
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjIsTravIdCurrentId ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 536 of file gia.h.

536 { assert( Id < p->nTravIdsAlloc ); return (p->pTravIds[Id] == p->nTravIds); }
int * pTravIds
Definition: gia.h:153
int nTravIds
Definition: gia.h:118
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjIsTravIdPrevious ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 534 of file gia.h.

534 { assert( Gia_ObjId(p, pObj) < p->nTravIdsAlloc ); return (p->pTravIds[Gia_ObjId(p, pObj)] == p->nTravIds - 1); }
int * pTravIds
Definition: gia.h:153
int nTravIds
Definition: gia.h:118
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
int nTravIdsAlloc
Definition: gia.h:154
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjIsXor ( Gia_Obj_t pObj)
inlinestatic

Definition at line 423 of file gia.h.

423 { return Gia_ObjIsAnd(pObj) && pObj->iDiff0 < pObj->iDiff1; }
unsigned iDiff0
Definition: gia.h:77
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
unsigned iDiff1
Definition: gia.h:82
static int Gia_ObjLevel ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 501 of file gia.h.

501 { return Gia_ObjLevelId( p, Gia_ObjId(p,pObj) ); }
static int Gia_ObjLevelId(Gia_Man_t *p, int Id)
Definition: gia.h:500
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Gia_ObjLevelId ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 500 of file gia.h.

500 { return Vec_IntGetEntry(p->vLevels, Id); }
static int Vec_IntGetEntry(Vec_Int_t *p, int i)
Definition: bblif.c:401
Vec_Int_t * vLevels
Definition: gia.h:115
static int Gia_ObjLitCopy ( Gia_Man_t p,
int  iLit 
)
inlinestatic

Definition at line 479 of file gia.h.

479 { return Abc_LitNotCond( Gia_ManObj(p, Abc_Lit2Var(iLit))->Value, Abc_LitIsCompl(iLit)); }
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
static int Gia_ObjLutFanin ( Gia_Man_t p,
int  Id,
int  i 
)
inlinestatic

Definition at line 955 of file gia.h.

955 { return Gia_ObjLutFanins(p, Id)[i]; }
static int * Gia_ObjLutFanins(Gia_Man_t *p, int Id)
Definition: gia.h:954
static int* Gia_ObjLutFanins ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 954 of file gia.h.

954 { return Vec_IntEntryP(p->vMapping, Vec_IntEntry(p->vMapping, Id)) + 1; }
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int * Vec_IntEntryP(Vec_Int_t *p, int i)
Definition: vecInt.h:417
Vec_Int_t * vMapping
Definition: gia.h:131
static int Gia_ObjLutIsMux ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 957 of file gia.h.

957 { return (int)(Gia_ObjLutMuxId(p, Id) < 0); }
static int Gia_ObjLutMuxId(Gia_Man_t *p, int Id)
Definition: gia.h:956
static int Gia_ObjLutMuxId ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 956 of file gia.h.

956 { return Gia_ObjLutFanins(p, Id)[Gia_ObjLutSize(p, Id)]; }
static int Gia_ObjLutSize(Gia_Man_t *p, int Id)
Definition: gia.h:953
static int * Gia_ObjLutFanins(Gia_Man_t *p, int Id)
Definition: gia.h:954
static int Gia_ObjLutSize ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 953 of file gia.h.

953 { return Vec_IntEntry(p->vMapping, Vec_IntEntry(p->vMapping, Id)); }
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Vec_Int_t * vMapping
Definition: gia.h:131
static int Gia_ObjNext ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 912 of file gia.h.

912 { return p->pNexts[Id]; }
int * pNexts
Definition: gia.h:122
static Gia_Obj_t* Gia_ObjNextObj ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 911 of file gia.h.

911 { return p->pNexts[Id] == 0 ? NULL : Gia_ManObj( p, p->pNexts[Id] );}
int * pNexts
Definition: gia.h:122
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
static int Gia_ObjNum ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 513 of file gia.h.

513 { return Vec_IntEntry(p->vTtNums, Gia_ObjId(p,pObj)); }
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
Vec_Int_t * vTtNums
Definition: gia.h:184
static int Gia_ObjNumId ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 512 of file gia.h.

512 { return Vec_IntEntry(p->vTtNums, Id); }
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Vec_Int_t * vTtNums
Definition: gia.h:184
static int Gia_ObjPhase ( Gia_Obj_t pObj)
inlinestatic

Definition at line 415 of file gia.h.

415 { return pObj->fPhase; }
unsigned fPhase
Definition: gia.h:85
static int Gia_ObjPhaseReal ( Gia_Obj_t pObj)
inlinestatic

Definition at line 416 of file gia.h.

416 { return Gia_Regular(pObj)->fPhase ^ Gia_IsComplement(pObj); }
static Gia_Obj_t * Gia_Regular(Gia_Obj_t *p)
Definition: gia.h:377
unsigned fPhase
Definition: gia.h:85
static int Gia_IsComplement(Gia_Obj_t *p)
Definition: gia.h:380
static int Gia_ObjPhaseRealLit ( Gia_Man_t p,
int  iLit 
)
inlinestatic

Definition at line 498 of file gia.h.

498 { return Gia_ObjPhaseReal( Gia_ObjFromLit(p, iLit) ); }
static int Gia_ObjPhaseReal(Gia_Obj_t *pObj)
Definition: gia.h:416
static Gia_Obj_t * Gia_ObjFromLit(Gia_Man_t *p, int iLit)
Definition: gia.h:496
void Gia_ObjPrint ( Gia_Man_t p,
Gia_Obj_t pObj 
)

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

Synopsis [Verbose printing of the AIG node.]

Description []

SideEffects []

SeeAlso []

Definition at line 1258 of file giaUtil.c.

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

Definition at line 896 of file gia.h.

896 { return p->pReprs[Id].fProved; }
Gia_Rpr_t * pReprs
Definition: gia.h:121
unsigned fProved
Definition: gia.h:59
int Gia_ObjRecognizeExor ( Gia_Obj_t pObj,
Gia_Obj_t **  ppFan0,
Gia_Obj_t **  ppFan1 
)

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 921 of file giaUtil.c.

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

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

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

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

SideEffects []

SeeAlso []

Definition at line 959 of file giaUtil.c.

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

Definition at line 1036 of file giaUtil.c.

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

Definition at line 523 of file gia.h.

523 { return Gia_ObjRefDecId( p, Gia_ObjId(p, pObj) ); }
static int Gia_ObjRefDecId(Gia_Man_t *p, int Id)
Definition: gia.h:520
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Gia_ObjRefDecId ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 520 of file gia.h.

520 { return --p->pRefs[Id]; }
int * pRefs
Definition: gia.h:114
static void Gia_ObjRefFanin0Dec ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 527 of file gia.h.

527 { Gia_ObjRefDec(p, Gia_ObjFanin0(pObj)); }
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjRefDec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:523
static void Gia_ObjRefFanin0Inc ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 524 of file gia.h.

524 { Gia_ObjRefInc(p, Gia_ObjFanin0(pObj)); }
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjRefInc(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:522
static void Gia_ObjRefFanin1Dec ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 528 of file gia.h.

528 { Gia_ObjRefDec(p, Gia_ObjFanin1(pObj)); }
static int Gia_ObjRefDec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:523
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
static void Gia_ObjRefFanin1Inc ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 525 of file gia.h.

525 { Gia_ObjRefInc(p, Gia_ObjFanin1(pObj)); }
static int Gia_ObjRefInc(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:522
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
static void Gia_ObjRefFanin2Dec ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 529 of file gia.h.

529 { Gia_ObjRefDec(p, Gia_ObjFanin2(p, pObj)); }
static Gia_Obj_t * Gia_ObjFanin2(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:456
static int Gia_ObjRefDec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:523
static void Gia_ObjRefFanin2Inc ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 526 of file gia.h.

526 { Gia_ObjRefInc(p, Gia_ObjFanin2(p, pObj)); }
static int Gia_ObjRefInc(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:522
static Gia_Obj_t * Gia_ObjFanin2(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:456
static int Gia_ObjRefInc ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 522 of file gia.h.

522 { return Gia_ObjRefIncId( p, Gia_ObjId(p, pObj) ); }
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Gia_ObjRefIncId(Gia_Man_t *p, int Id)
Definition: gia.h:519
static int Gia_ObjRefIncId ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 519 of file gia.h.

519 { return p->pRefs[Id]++; }
int * pRefs
Definition: gia.h:114
static int Gia_ObjRefNum ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 521 of file gia.h.

521 { return Gia_ObjRefNumId( p, Gia_ObjId(p, pObj) ); }
static int Gia_ObjRefNumId(Gia_Man_t *p, int Id)
Definition: gia.h:518
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Gia_ObjRefNumId ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 518 of file gia.h.

518 { return p->pRefs[Id]; }
int * pRefs
Definition: gia.h:114
void Gia_ObjRemoveFanout ( Gia_Man_t p,
Gia_Obj_t pObj,
Gia_Obj_t pFanout 
)

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 163 of file giaFanout.c.

164 {
165  int iFan, * pFirst, * pPrevC, * pNextC, * pPrev, * pNext;
166  assert( p->pFanData && Gia_ObjId(p, pObj) < p->nFansAlloc && Gia_ObjId(p, pFanout) < p->nFansAlloc );
167  assert( !Gia_IsComplement(pObj) && !Gia_IsComplement(pFanout) );
168  assert( Gia_ObjId(p, pFanout) > 0 );
169  iFan = Gia_FanoutCreate( Gia_ObjId(p, pFanout), Gia_ObjWhatFanin(pFanout, pObj) );
170  pPrevC = Gia_FanoutPrev( p->pFanData, iFan );
171  pNextC = Gia_FanoutNext( p->pFanData, iFan );
172  pPrev = Gia_FanoutPrev( p->pFanData, *pNextC );
173  pNext = Gia_FanoutNext( p->pFanData, *pPrevC );
174  assert( *pPrev == iFan );
175  assert( *pNext == iFan );
176  pFirst = Gia_FanoutObj( p->pFanData, Gia_ObjId(p, pObj) );
177  assert( *pFirst > 0 );
178  if ( *pFirst == iFan )
179  {
180  if ( *pNextC == iFan )
181  {
182  *pFirst = 0;
183  *pPrev = 0;
184  *pNext = 0;
185  *pPrevC = 0;
186  *pNextC = 0;
187  return;
188  }
189  *pFirst = *pNextC;
190  }
191  *pPrev = *pPrevC;
192  *pNext = *pNextC;
193  *pPrevC = 0;
194  *pNextC = 0;
195 }
static int * Gia_FanoutNext(int *pData, int iFan)
Definition: giaFanout.c:39
static int * Gia_FanoutPrev(int *pData, int iFan)
Definition: giaFanout.c:38
int nFansAlloc
Definition: gia.h:128
static int * Gia_FanoutObj(int *pData, int ObjId)
Definition: giaFanout.c:37
static int Gia_ObjWhatFanin(Gia_Obj_t *pObj, Gia_Obj_t *pFanin)
Definition: gia.h:473
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
int * pFanData
Definition: gia.h:127
static int Gia_IsComplement(Gia_Obj_t *p)
Definition: gia.h:380
#define assert(ex)
Definition: util_old.h:213
static ABC_NAMESPACE_IMPL_START int Gia_FanoutCreate(int FanId, int Num)
DECLARATIONS ///.
Definition: giaFanout.c:36
static int Gia_ObjRepr ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 887 of file gia.h.

887 { return p->pReprs[Id].iRepr; }
unsigned iRepr
Definition: gia.h:58
Gia_Rpr_t * pReprs
Definition: gia.h:121
static Gia_Obj_t* Gia_ObjReprObj ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 886 of file gia.h.

886 { return p->pReprs[Id].iRepr == GIA_VOID ? NULL : Gia_ManObj( p, p->pReprs[Id].iRepr ); }
unsigned iRepr
Definition: gia.h:58
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
#define GIA_VOID
Definition: gia.h:45
Gia_Rpr_t * pReprs
Definition: gia.h:121
static int Gia_ObjReprSelf ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 892 of file gia.h.

892 { return Gia_ObjHasRepr(p, Id) ? Gia_ObjRepr(p, Id) : Id; }
static int Gia_ObjRepr(Gia_Man_t *p, int Id)
Definition: gia.h:887
static int Gia_ObjHasRepr(Gia_Man_t *p, int Id)
Definition: gia.h:891
static void Gia_ObjResetNumId ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 516 of file gia.h.

static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
Vec_Int_t * vTtNums
Definition: gia.h:184
static Gia_Obj_t* Gia_ObjRiToRo ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 447 of file gia.h.

447 { assert( Gia_ObjIsRi(p, pObj) ); return Gia_ManCi(p, Gia_ManCiNum(p) - Gia_ManCoNum(p) + Gia_ObjCioId(pObj)); }
static Gia_Obj_t * Gia_ManCi(Gia_Man_t *p, int v)
Definition: gia.h:403
static int Gia_ObjIsRi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:444
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjCioId(Gia_Obj_t *pObj)
Definition: gia.h:411
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
static Gia_Obj_t* Gia_ObjRoToRi ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 446 of file gia.h.

446 { assert( Gia_ObjIsRo(p, pObj) ); return Gia_ManCo(p, Gia_ManCoNum(p) - Gia_ManCiNum(p) + Gia_ObjCioId(pObj)); }
static int Gia_ObjIsRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:443
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
static Gia_Obj_t * Gia_ManCo(Gia_Man_t *p, int v)
Definition: gia.h:404
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjCioId(Gia_Obj_t *pObj)
Definition: gia.h:411
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
static void Gia_ObjSetAndLevel ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 506 of file gia.h.

static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static int Gia_ObjLevel(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:501
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
static void Gia_ObjSetLevel(Gia_Man_t *p, Gia_Obj_t *pObj, int l)
Definition: gia.h:503
static void Gia_ObjSetBufLevel ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 505 of file gia.h.

505 { assert( Gia_ObjIsAnd(pObj) ); Gia_ObjSetLevel( p, pObj, Gia_ObjLevel(p,Gia_ObjFanin0(pObj)) ); }
static int Gia_ObjLevel(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:501
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
#define assert(ex)
Definition: util_old.h:213
static void Gia_ObjSetLevel(Gia_Man_t *p, Gia_Obj_t *pObj, int l)
Definition: gia.h:503
static void Gia_ObjSetCioId ( Gia_Obj_t pObj,
int  v 
)
inlinestatic

Definition at line 412 of file gia.h.

412 { assert( pObj->fTerm ); pObj->iDiff1 = v; }
unsigned fTerm
Definition: gia.h:80
#define assert(ex)
Definition: util_old.h:213
unsigned iDiff1
Definition: gia.h:82
static void Gia_ObjSetCoLevel ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 504 of file gia.h.

504 { assert( Gia_ObjIsCo(pObj) ); Gia_ObjSetLevel( p, pObj, Gia_ObjLevel(p,Gia_ObjFanin0(pObj)) ); }
static int Gia_ObjLevel(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:501
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
#define assert(ex)
Definition: util_old.h:213
static void Gia_ObjSetLevel(Gia_Man_t *p, Gia_Obj_t *pObj, int l)
Definition: gia.h:503
static void Gia_ObjSetColor ( Gia_Man_t p,
int  Id,
int  c 
)
inlinestatic

Definition at line 905 of file gia.h.

905 { if (c) p->pReprs[Id].fColorB = 1; else p->pReprs[Id].fColorA = 1; }
unsigned fColorA
Definition: gia.h:61
unsigned fColorB
Definition: gia.h:62
Gia_Rpr_t * pReprs
Definition: gia.h:121
static void Gia_ObjSetColors ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 906 of file gia.h.

906 { p->pReprs[Id].fColorB = p->pReprs[Id].fColorA = 1; }
unsigned fColorA
Definition: gia.h:61
unsigned fColorB
Definition: gia.h:62
Gia_Rpr_t * pReprs
Definition: gia.h:121
static void Gia_ObjSetCopyArray ( Gia_Man_t p,
int  iObj,
int  iLit 
)
inlinestatic

Definition at line 488 of file gia.h.

488 { Vec_IntWriteEntry(&p->vCopies, iObj, iLit); }
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
Vec_Int_t vCopies
Definition: gia.h:138
static void Gia_ObjSetCopyF ( Gia_Man_t p,
int  f,
Gia_Obj_t pObj,
int  iLit 
)
inlinestatic

Definition at line 486 of file gia.h.

486 { Vec_IntWriteEntry(&p->vCopies, Gia_ManObjNum(p) * f + Gia_ObjId(p,pObj), iLit); }
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
Vec_Int_t vCopies
Definition: gia.h:138
static void Gia_ObjSetFailed ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 901 of file gia.h.

901 { p->pReprs[Id].fFailed = 1; }
unsigned fFailed
Definition: gia.h:60
Gia_Rpr_t * pReprs
Definition: gia.h:121
static void Gia_ObjSetFanout ( Gia_Man_t p,
Gia_Obj_t pObj,
int  i,
Gia_Obj_t pFan 
)
inlinestatic

Definition at line 944 of file gia.h.

944 { Vec_IntWriteEntry( p->vFanout, Gia_ObjFoffset(p, pObj) + i, Gia_ObjId(p, pFan) ); }
static int Gia_ObjFoffset(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:938
Vec_Int_t * vFanout
Definition: gia.h:130
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static void Gia_ObjSetGateLevel ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 509 of file gia.h.

509 { if ( Gia_ObjIsBuf(pObj) ) Gia_ObjSetBufLevel(p, pObj); else if ( Gia_ObjIsMux(p,pObj) ) Gia_ObjSetMuxLevel(p, pObj); else if ( Gia_ObjIsXor(pObj) ) Gia_ObjSetXorLevel(p, pObj); else if ( Gia_ObjIsAnd(pObj) ) Gia_ObjSetAndLevel(p, pObj); }
static int Gia_ObjIsBuf(Gia_Obj_t *pObj)
Definition: gia.h:427
static void Gia_ObjSetBufLevel(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:505
static void Gia_ObjSetAndLevel(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:506
static int Gia_ObjIsXor(Gia_Obj_t *pObj)
Definition: gia.h:423
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static void Gia_ObjSetMuxLevel(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:508
static void Gia_ObjSetXorLevel(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:507
static int Gia_ObjIsMux(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:425
static void Gia_ObjSetLevel ( Gia_Man_t p,
Gia_Obj_t pObj,
int  l 
)
inlinestatic

Definition at line 503 of file gia.h.

503 { Gia_ObjSetLevelId( p, Gia_ObjId(p,pObj), l ); }
static void Gia_ObjSetLevelId(Gia_Man_t *p, int Id, int l)
Definition: gia.h:502
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static void Gia_ObjSetLevelId ( Gia_Man_t p,
int  Id,
int  l 
)
inlinestatic

Definition at line 502 of file gia.h.

502 { Vec_IntSetEntry(p->vLevels, Id, l); }
static void Vec_IntSetEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:418
Vec_Int_t * vLevels
Definition: gia.h:115
static void Gia_ObjSetMuxLevel ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 508 of file gia.h.

static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static int Gia_ObjLevel(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:501
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static Gia_Obj_t * Gia_ObjFanin2(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:456
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjIsMux(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:425
static void Gia_ObjSetLevel(Gia_Man_t *p, Gia_Obj_t *pObj, int l)
Definition: gia.h:503
static void Gia_ObjSetNext ( Gia_Man_t p,
int  Id,
int  Num 
)
inlinestatic

Definition at line 913 of file gia.h.

913 { p->pNexts[Id] = Num; }
int * pNexts
Definition: gia.h:122
static void Gia_ObjSetNum ( Gia_Man_t p,
Gia_Obj_t pObj,
int  n 
)
inlinestatic

Definition at line 515 of file gia.h.

515 { Vec_IntWriteEntry(p->vTtNums, Gia_ObjId(p,pObj), n); }
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
Vec_Int_t * vTtNums
Definition: gia.h:184
static void Gia_ObjSetNumId ( Gia_Man_t p,
int  Id,
int  n 
)
inlinestatic

Definition at line 514 of file gia.h.

514 { Vec_IntWriteEntry(p->vTtNums, Id, n); }
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
Vec_Int_t * vTtNums
Definition: gia.h:184
void Gia_ObjSetPhase ( Gia_Man_t p,
Gia_Obj_t pObj 
)

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

Synopsis [Sets the phase of one object.]

Description []

SideEffects []

SeeAlso []

Definition at line 346 of file giaUtil.c.

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

Definition at line 897 of file gia.h.

897 { p->pReprs[Id].fProved = 1; }
Gia_Rpr_t * pReprs
Definition: gia.h:121
unsigned fProved
Definition: gia.h:59
static void Gia_ObjSetRepr ( Gia_Man_t p,
int  Id,
int  Num 
)
inlinestatic

Definition at line 888 of file gia.h.

888 { assert( Num == GIA_VOID || Num < Id ); p->pReprs[Id].iRepr = Num; }
unsigned iRepr
Definition: gia.h:58
#define GIA_VOID
Definition: gia.h:45
Gia_Rpr_t * pReprs
Definition: gia.h:121
#define assert(ex)
Definition: util_old.h:213
static void Gia_ObjSetReprRev ( Gia_Man_t p,
int  Id,
int  Num 
)
inlinestatic

Definition at line 889 of file gia.h.

889 { assert( Num == GIA_VOID || Num > Id ); p->pReprs[Id].iRepr = Num; }
unsigned iRepr
Definition: gia.h:58
#define GIA_VOID
Definition: gia.h:45
Gia_Rpr_t * pReprs
Definition: gia.h:121
#define assert(ex)
Definition: util_old.h:213
static void Gia_ObjSetTimeArrival ( Gia_Man_t p,
int  Id,
float  t 
)
inlinestatic

Definition at line 547 of file gia.h.

547 { Vec_FltWriteEntry( p->vTiming, 3*Id+0, t ); }
static void Vec_FltWriteEntry(Vec_Flt_t *p, int i, float Entry)
Definition: vecFlt.h:364
Vec_Flt_t * vTiming
Definition: gia.h:164
static void Gia_ObjSetTimeArrivalObj ( Gia_Man_t p,
Gia_Obj_t pObj,
float  t 
)
inlinestatic

Definition at line 550 of file gia.h.

550 { Gia_ObjSetTimeArrival( p, Gia_ObjId(p, pObj), t ); }
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static void Gia_ObjSetTimeArrival(Gia_Man_t *p, int Id, float t)
Definition: gia.h:547
static void Gia_ObjSetTimeRequired ( Gia_Man_t p,
int  Id,
float  t 
)
inlinestatic

Definition at line 548 of file gia.h.

548 { Vec_FltWriteEntry( p->vTiming, 3*Id+1, t ); }
static void Vec_FltWriteEntry(Vec_Flt_t *p, int i, float Entry)
Definition: vecFlt.h:364
Vec_Flt_t * vTiming
Definition: gia.h:164
static void Gia_ObjSetTimeRequiredObj ( Gia_Man_t p,
Gia_Obj_t pObj,
float  t 
)
inlinestatic

Definition at line 551 of file gia.h.

551 { Gia_ObjSetTimeRequired( p, Gia_ObjId(p, pObj), t ); }
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static void Gia_ObjSetTimeRequired(Gia_Man_t *p, int Id, float t)
Definition: gia.h:548
static void Gia_ObjSetTimeSlack ( Gia_Man_t p,
int  Id,
float  t 
)
inlinestatic

Definition at line 549 of file gia.h.

549 { Vec_FltWriteEntry( p->vTiming, 3*Id+2, t ); }
static void Vec_FltWriteEntry(Vec_Flt_t *p, int i, float Entry)
Definition: vecFlt.h:364
Vec_Flt_t * vTiming
Definition: gia.h:164
static void Gia_ObjSetTimeSlackObj ( Gia_Man_t p,
Gia_Obj_t pObj,
float  t 
)
inlinestatic

Definition at line 552 of file gia.h.

552 { Gia_ObjSetTimeSlack( p, Gia_ObjId(p, pObj), t ); }
static void Gia_ObjSetTimeSlack(Gia_Man_t *p, int Id, float t)
Definition: gia.h:549
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static void Gia_ObjSetTravIdCurrent ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 531 of file gia.h.

531 { assert( Gia_ObjId(p, pObj) < p->nTravIdsAlloc ); p->pTravIds[Gia_ObjId(p, pObj)] = p->nTravIds; }
int * pTravIds
Definition: gia.h:153
int nTravIds
Definition: gia.h:118
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
int nTravIdsAlloc
Definition: gia.h:154
#define assert(ex)
Definition: util_old.h:213
static void Gia_ObjSetTravIdCurrentId ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 535 of file gia.h.

535 { assert( Id < p->nTravIdsAlloc ); p->pTravIds[Id] = p->nTravIds; }
int * pTravIds
Definition: gia.h:153
int nTravIds
Definition: gia.h:118
#define assert(ex)
Definition: util_old.h:213
static void Gia_ObjSetTravIdPrevious ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 532 of file gia.h.

532 { assert( Gia_ObjId(p, pObj) < p->nTravIdsAlloc ); p->pTravIds[Gia_ObjId(p, pObj)] = p->nTravIds - 1; }
int * pTravIds
Definition: gia.h:153
int nTravIds
Definition: gia.h:118
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
int nTravIdsAlloc
Definition: gia.h:154
#define assert(ex)
Definition: util_old.h:213
static void Gia_ObjSetValue ( Gia_Obj_t pObj,
int  i 
)
inlinestatic

Definition at line 414 of file gia.h.

414 { pObj->Value = i; }
unsigned Value
Definition: gia.h:87
static void Gia_ObjSetXorLevel ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 507 of file gia.h.

static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static int Gia_ObjLevel(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:501
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjIsXor(Gia_Obj_t *pObj)
Definition: gia.h:423
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
static void Gia_ObjSetLevel(Gia_Man_t *p, Gia_Obj_t *pObj, int l)
Definition: gia.h:503
static int Gia_ObjSibl ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 893 of file gia.h.

893 { return p->pSibls ? p->pSibls[Id] : 0; }
int * pSibls
Definition: gia.h:123
static Gia_Obj_t* Gia_ObjSiblObj ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 894 of file gia.h.

894 { return (p->pSibls && p->pSibls[Id]) ? Gia_ManObj(p, p->pSibls[Id]) : NULL; }
int * pSibls
Definition: gia.h:123
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
static word* Gia_ObjSim ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 556 of file gia.h.

556 { return Vec_WrdEntryP( p->vSims, Id * Gia_ObjSimWords(p) ); }
Vec_Wrd_t * vSims
Definition: gia.h:177
static int Gia_ObjSimWords(Gia_Man_t *p)
Definition: gia.h:554
static word * Vec_WrdEntryP(Vec_Wrd_t *p, int i)
Definition: vecWrd.h:401
static word* Gia_ObjSimObj ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 557 of file gia.h.

557 { return Gia_ObjSim( p, Gia_ObjId(p, pObj) ); }
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static word * Gia_ObjSim(Gia_Man_t *p, int Id)
Definition: gia.h:556
static word* Gia_ObjSimPi ( Gia_Man_t p,
int  PiId 
)
inlinestatic

Definition at line 555 of file gia.h.

555 { return Vec_WrdEntryP( p->vSimsPi, PiId * Gia_ObjSimWords(p) ); }
Vec_Wrd_t * vSimsPi
Definition: gia.h:178
static int Gia_ObjSimWords(Gia_Man_t *p)
Definition: gia.h:554
static word * Vec_WrdEntryP(Vec_Wrd_t *p, int i)
Definition: vecWrd.h:401
static int Gia_ObjSimWords ( Gia_Man_t p)
inlinestatic

Definition at line 554 of file gia.h.

554 { return Vec_WrdSize( p->vSimsPi ) / Gia_ManPiNum( p ); }
Vec_Wrd_t * vSimsPi
Definition: gia.h:178
static int Vec_WrdSize(Vec_Wrd_t *p)
Definition: vecWrd.h:336
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
static void Gia_ObjTerSimAnd ( Gia_Obj_t pObj)
inlinestatic

Definition at line 785 of file gia.h.

786 {
787  assert( Gia_ObjIsAnd(pObj) );
791  Gia_ObjTerSimSet0( pObj );
792  else if ( Gia_ObjTerSimGet1Fanin0(pObj) && Gia_ObjTerSimGet1Fanin1(pObj) )
793  Gia_ObjTerSimSet1( pObj );
794  else
795  Gia_ObjTerSimSetX( pObj );
796 }
static void Gia_ObjTerSimSet0(Gia_Obj_t *pObj)
Definition: gia.h:770
static int Gia_ObjTerSimGet0Fanin1(Gia_Obj_t *pObj)
Definition: gia.h:782
static int Gia_ObjTerSimGet0Fanin0(Gia_Obj_t *pObj)
Definition: gia.h:779
static int Gia_ObjTerSimGet1Fanin0(Gia_Obj_t *pObj)
Definition: gia.h:780
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjTerSimGet1Fanin1(Gia_Obj_t *pObj)
Definition: gia.h:783
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static void Gia_ObjTerSimSet1(Gia_Obj_t *pObj)
Definition: gia.h:771
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjTerSimGetC(Gia_Obj_t *pObj)
Definition: gia.h:774
static void Gia_ObjTerSimSetX(Gia_Obj_t *pObj)
Definition: gia.h:772
static void Gia_ObjTerSimCo ( Gia_Obj_t pObj)
inlinestatic

Definition at line 797 of file gia.h.

798 {
799  assert( Gia_ObjIsCo(pObj) );
801  if ( Gia_ObjTerSimGet0Fanin0(pObj) )
802  Gia_ObjTerSimSet0( pObj );
803  else if ( Gia_ObjTerSimGet1Fanin0(pObj) )
804  Gia_ObjTerSimSet1( pObj );
805  else
806  Gia_ObjTerSimSetX( pObj );
807 }
static void Gia_ObjTerSimSet0(Gia_Obj_t *pObj)
Definition: gia.h:770
static int Gia_ObjTerSimGet0Fanin0(Gia_Obj_t *pObj)
Definition: gia.h:779
static int Gia_ObjTerSimGet1Fanin0(Gia_Obj_t *pObj)
Definition: gia.h:780
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static void Gia_ObjTerSimSet1(Gia_Obj_t *pObj)
Definition: gia.h:771
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjTerSimGetC(Gia_Obj_t *pObj)
Definition: gia.h:774
static void Gia_ObjTerSimSetX(Gia_Obj_t *pObj)
Definition: gia.h:772
static int Gia_ObjTerSimGet0 ( Gia_Obj_t pObj)
inlinestatic

Definition at line 775 of file gia.h.

775 { return pObj->fMark0 && !pObj->fMark1; }
unsigned fMark1
Definition: gia.h:84
unsigned fMark0
Definition: gia.h:79
static int Gia_ObjTerSimGet0Fanin0 ( Gia_Obj_t pObj)
inlinestatic

Definition at line 779 of file gia.h.

779 { return (Gia_ObjTerSimGet1(Gia_ObjFanin0(pObj)) && Gia_ObjFaninC0(pObj)) || (Gia_ObjTerSimGet0(Gia_ObjFanin0(pObj)) && !Gia_ObjFaninC0(pObj)); }
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjTerSimGet0(Gia_Obj_t *pObj)
Definition: gia.h:775
static int Gia_ObjTerSimGet1(Gia_Obj_t *pObj)
Definition: gia.h:776
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static int Gia_ObjTerSimGet0Fanin1 ( Gia_Obj_t pObj)
inlinestatic

Definition at line 782 of file gia.h.

782 { return (Gia_ObjTerSimGet1(Gia_ObjFanin1(pObj)) && Gia_ObjFaninC1(pObj)) || (Gia_ObjTerSimGet0(Gia_ObjFanin1(pObj)) && !Gia_ObjFaninC1(pObj)); }
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static int Gia_ObjTerSimGet0(Gia_Obj_t *pObj)
Definition: gia.h:775
static int Gia_ObjTerSimGet1(Gia_Obj_t *pObj)
Definition: gia.h:776
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
static int Gia_ObjTerSimGet1 ( Gia_Obj_t pObj)
inlinestatic

Definition at line 776 of file gia.h.

776 { return !pObj->fMark0 && pObj->fMark1; }
unsigned fMark1
Definition: gia.h:84
unsigned fMark0
Definition: gia.h:79
static int Gia_ObjTerSimGet1Fanin0 ( Gia_Obj_t pObj)
inlinestatic

Definition at line 780 of file gia.h.

780 { return (Gia_ObjTerSimGet0(Gia_ObjFanin0(pObj)) && Gia_ObjFaninC0(pObj)) || (Gia_ObjTerSimGet1(Gia_ObjFanin0(pObj)) && !Gia_ObjFaninC0(pObj)); }
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjTerSimGet0(Gia_Obj_t *pObj)
Definition: gia.h:775
static int Gia_ObjTerSimGet1(Gia_Obj_t *pObj)
Definition: gia.h:776
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static int Gia_ObjTerSimGet1Fanin1 ( Gia_Obj_t pObj)
inlinestatic

Definition at line 783 of file gia.h.

783 { return (Gia_ObjTerSimGet0(Gia_ObjFanin1(pObj)) && Gia_ObjFaninC1(pObj)) || (Gia_ObjTerSimGet1(Gia_ObjFanin1(pObj)) && !Gia_ObjFaninC1(pObj)); }
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static int Gia_ObjTerSimGet0(Gia_Obj_t *pObj)
Definition: gia.h:775
static int Gia_ObjTerSimGet1(Gia_Obj_t *pObj)
Definition: gia.h:776
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
static int Gia_ObjTerSimGetC ( Gia_Obj_t pObj)
inlinestatic

Definition at line 774 of file gia.h.

774 { return !pObj->fMark0 && !pObj->fMark1; }
unsigned fMark1
Definition: gia.h:84
unsigned fMark0
Definition: gia.h:79
static int Gia_ObjTerSimGetX ( Gia_Obj_t pObj)
inlinestatic

Definition at line 777 of file gia.h.

777 { return pObj->fMark0 && pObj->fMark1; }
unsigned fMark1
Definition: gia.h:84
unsigned fMark0
Definition: gia.h:79
static void Gia_ObjTerSimPrint ( Gia_Obj_t pObj)
inlinestatic

Definition at line 817 of file gia.h.

818 {
819  if ( Gia_ObjTerSimGet0(pObj) )
820  printf( "0" );
821  else if ( Gia_ObjTerSimGet1(pObj) )
822  printf( "1" );
823  else if ( Gia_ObjTerSimGetX(pObj) )
824  printf( "X" );
825 }
static int Gia_ObjTerSimGetX(Gia_Obj_t *pObj)
Definition: gia.h:777
static int Gia_ObjTerSimGet0(Gia_Obj_t *pObj)
Definition: gia.h:775
static int Gia_ObjTerSimGet1(Gia_Obj_t *pObj)
Definition: gia.h:776
static void Gia_ObjTerSimRo ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 808 of file gia.h.

809 {
810  Gia_Obj_t * pTemp = Gia_ObjRoToRi(p, pObj);
811  assert( Gia_ObjIsRo(p, pObj) );
812  assert( !Gia_ObjTerSimGetC( pTemp ) );
813  pObj->fMark0 = pTemp->fMark0;
814  pObj->fMark1 = pTemp->fMark1;
815 }
unsigned fMark1
Definition: gia.h:84
Definition: gia.h:75
static int Gia_ObjIsRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:443
static Gia_Obj_t * Gia_ObjRoToRi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:446
unsigned fMark0
Definition: gia.h:79
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjTerSimGetC(Gia_Obj_t *pObj)
Definition: gia.h:774
static void Gia_ObjTerSimSet0 ( Gia_Obj_t pObj)
inlinestatic

Definition at line 770 of file gia.h.

770 { pObj->fMark0 = 1; pObj->fMark1 = 0; }
unsigned fMark1
Definition: gia.h:84
unsigned fMark0
Definition: gia.h:79
static void Gia_ObjTerSimSet1 ( Gia_Obj_t pObj)
inlinestatic

Definition at line 771 of file gia.h.

771 { pObj->fMark0 = 0; pObj->fMark1 = 1; }
unsigned fMark1
Definition: gia.h:84
unsigned fMark0
Definition: gia.h:79
static void Gia_ObjTerSimSetC ( Gia_Obj_t pObj)
inlinestatic

Definition at line 769 of file gia.h.

769 { pObj->fMark0 = 0; pObj->fMark1 = 0; }
unsigned fMark1
Definition: gia.h:84
unsigned fMark0
Definition: gia.h:79
static void Gia_ObjTerSimSetX ( Gia_Obj_t pObj)
inlinestatic

Definition at line 772 of file gia.h.

772 { pObj->fMark0 = 1; pObj->fMark1 = 1; }
unsigned fMark1
Definition: gia.h:84
unsigned fMark0
Definition: gia.h:79
static float Gia_ObjTimeArrival ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 541 of file gia.h.

541 { return Vec_FltEntry(p->vTiming, 3*Id+0); }
Vec_Flt_t * vTiming
Definition: gia.h:164
static float Vec_FltEntry(Vec_Flt_t *p, int i)
Definition: vecFlt.h:342
static float Gia_ObjTimeArrivalObj ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 544 of file gia.h.

544 { return Gia_ObjTimeArrival( p, Gia_ObjId(p, pObj) ); }
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static float Gia_ObjTimeArrival(Gia_Man_t *p, int Id)
Definition: gia.h:541
static float Gia_ObjTimeRequired ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 542 of file gia.h.

542 { return Vec_FltEntry(p->vTiming, 3*Id+1); }
Vec_Flt_t * vTiming
Definition: gia.h:164
static float Vec_FltEntry(Vec_Flt_t *p, int i)
Definition: vecFlt.h:342
static float Gia_ObjTimeRequiredObj ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 545 of file gia.h.

545 { return Gia_ObjTimeRequired( p, Gia_ObjId(p, pObj) ); }
static float Gia_ObjTimeRequired(Gia_Man_t *p, int Id)
Definition: gia.h:542
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static float Gia_ObjTimeSlack ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 543 of file gia.h.

543 { return Vec_FltEntry(p->vTiming, 3*Id+2); }
Vec_Flt_t * vTiming
Definition: gia.h:164
static float Vec_FltEntry(Vec_Flt_t *p, int i)
Definition: vecFlt.h:342
static float Gia_ObjTimeSlackObj ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 546 of file gia.h.

546 { return Gia_ObjTimeSlack( p, Gia_ObjId(p, pObj) ); }
static float Gia_ObjTimeSlack(Gia_Man_t *p, int Id)
Definition: gia.h:543
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Gia_ObjToLit ( Gia_Man_t p,
Gia_Obj_t pObj 
)
inlinestatic

Definition at line 497 of file gia.h.

497 { return Abc_Var2Lit( Gia_ObjId(p, Gia_Regular(pObj)), Gia_IsComplement(pObj) ); }
static Gia_Obj_t * Gia_Regular(Gia_Obj_t *p)
Definition: gia.h:377
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Gia_IsComplement(Gia_Obj_t *p)
Definition: gia.h:380
static void Gia_ObjUnsetProved ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 898 of file gia.h.

898 { p->pReprs[Id].fProved = 0; }
Gia_Rpr_t * pReprs
Definition: gia.h:121
unsigned fProved
Definition: gia.h:59
static void Gia_ObjUnsetRepr ( Gia_Man_t p,
int  Id 
)
inlinestatic

Definition at line 890 of file gia.h.

890 { p->pReprs[Id].iRepr = GIA_VOID; }
unsigned iRepr
Definition: gia.h:58
#define GIA_VOID
Definition: gia.h:45
Gia_Rpr_t * pReprs
Definition: gia.h:121
static int Gia_ObjValue ( Gia_Obj_t pObj)
inlinestatic

Definition at line 413 of file gia.h.

413 { return pObj->Value; }
unsigned Value
Definition: gia.h:87
static int Gia_ObjVisitColor ( Gia_Man_t p,
int  Id,
int  c 
)
inlinestatic

Definition at line 907 of file gia.h.

907 { int x; if (c) { x = p->pReprs[Id].fColorB; p->pReprs[Id].fColorB = 1; } else { x = p->pReprs[Id].fColorA; p->pReprs[Id].fColorA = 1; } return x; }
unsigned fColorA
Definition: gia.h:61
unsigned fColorB
Definition: gia.h:62
Gia_Rpr_t * pReprs
Definition: gia.h:121
static int Gia_ObjWhatFanin ( Gia_Obj_t pObj,
Gia_Obj_t pFanin 
)
inlinestatic

Definition at line 473 of file gia.h.

473 { return Gia_ObjFanin0(pObj) == pFanin ? 0 : (Gia_ObjFanin1(pObj) == pFanin ? 1 : -1); }
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
static Gia_Obj_t* Gia_Regular ( Gia_Obj_t p)
inlinestatic

Definition at line 377 of file gia.h.

377 { return (Gia_Obj_t *)((ABC_PTRUINT_T)(p) & ~01); }
Definition: gia.h:75
void Gia_SatVerifyPattern ( Gia_Man_t p,
Gia_Obj_t pRoot,
Vec_Int_t vCex,
Vec_Int_t vVisit 
)

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

Synopsis [Checks if the counter-examples asserts the output.]

Description [Assumes that fMark0 and fMark1 are clean. Leaves them clean.]

SideEffects []

SeeAlso []

Definition at line 93 of file giaPat.c.

94 {
95  Gia_Obj_t * pObj;
96  int i, Entry, Value, Value0, Value1;
97  assert( Gia_ObjIsCo(pRoot) );
99  // collect nodes and initialized them to x
100  Gia_SatCollectCone( p, Gia_ObjFanin0(pRoot), vVisit );
101  // set binary values to nodes in the counter-example
102  Vec_IntForEachEntry( vCex, Entry, i )
103 // Sat_ObjSetXValue( Gia_ManObj(p, Abc_Lit2Var(Entry)), Abc_LitIsCompl(Entry)? GIA_ZER : GIA_ONE );
105  // simulate
106  Gia_ManForEachObjVec( vVisit, p, pObj, i )
107  {
108  if ( Gia_ObjIsCi(pObj) )
109  continue;
110  assert( Gia_ObjIsAnd(pObj) );
111  Value0 = Sat_ObjXValue( Gia_ObjFanin0(pObj) );
112  Value1 = Sat_ObjXValue( Gia_ObjFanin1(pObj) );
113  Value = Gia_XsimAndCond( Value0, Gia_ObjFaninC0(pObj), Value1, Gia_ObjFaninC1(pObj) );
114  Sat_ObjSetXValue( pObj, Value );
115  }
116  Value = Sat_ObjXValue( Gia_ObjFanin0(pRoot) );
117  Value = Gia_XsimNotCond( Value, Gia_ObjFaninC0(pRoot) );
118  if ( Value != GIA_ONE )
119  printf( "Gia_SatVerifyPattern(): Verification FAILED.\n" );
120 // else
121 // printf( "Gia_SatVerifyPattern(): Verification succeeded.\n" );
122 // assert( Value == GIA_ONE );
123  // clean the nodes
124  Gia_ManForEachObjVec( vVisit, p, pObj, i )
125  Sat_ObjSetXValue( pObj, 0 );
126 }
static void Sat_ObjSetXValue(Gia_Obj_t *pObj, int v)
Definition: giaPat.c:31
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static Gia_Obj_t * Gia_ManCi(Gia_Man_t *p, int v)
Definition: gia.h:403
#define GIA_ZER
Definition: gia.h:747
static int Gia_ObjIsConst0(Gia_Obj_t *pObj)
Definition: gia.h:430
static int Gia_XsimNotCond(int Value, int fCompl)
Definition: gia.h:751
static int Gia_XsimAndCond(int Value0, int fCompl0, int Value1, int fCompl1)
Definition: gia.h:759
Definition: gia.h:75
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
void Gia_SatCollectCone(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vVisit)
Definition: giaPat.c:73
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition: gia.h:988
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static ABC_NAMESPACE_IMPL_START int Sat_ObjXValue(Gia_Obj_t *pObj)
DECLARATIONS ///.
Definition: giaPat.c:30
#define GIA_ONE
Definition: gia.h:748
unsigned* Gia_SimDataCiExt ( Gia_ManSim_t p,
int  i 
)

Definition at line 35 of file giaSim.c.

35 { return Gia_SimDataCi(p, i); }
static unsigned * Gia_SimDataCi(Gia_ManSim_t *p, int i)
Definition: giaSim.c:31
unsigned* Gia_SimDataCoExt ( Gia_ManSim_t p,
int  i 
)

Definition at line 36 of file giaSim.c.

36 { return Gia_SimDataCo(p, i); }
static unsigned * Gia_SimDataCo(Gia_ManSim_t *p, int i)
Definition: giaSim.c:32
unsigned* Gia_SimDataExt ( Gia_ManSim_t p,
int  i 
)

Definition at line 34 of file giaSim.c.

34 { return Gia_SimData(p, i); }
static ABC_NAMESPACE_IMPL_START unsigned * Gia_SimData(Gia_ManSim_t *p, int i)
DECLARATIONS ///.
Definition: giaSim.c:30
int* Gia_SortFloats ( float *  pArray,
int *  pPerm,
int  nSize 
)

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

Synopsis [Sorts the array of floating point numbers.]

Description []

SideEffects []

SeeAlso []

Definition at line 251 of file giaSort.c.

252 {
253  int i;
254  if ( pPerm == NULL )
255  {
256  pPerm = ABC_ALLOC( int, nSize );
257  for ( i = 0; i < nSize; i++ )
258  pPerm[i] = i;
259  }
260  minisat_sort3( pArray, pPerm, nSize );
261 // for ( i = 1; i < nSize; i++ )
262 // assert( pArray[i-1] <= pArray[i] );
263  return pPerm;
264 }
void minisat_sort3(float *array, int *perm, int size)
Definition: giaSort.c:235
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static int pPerm[13719]
Definition: rwrTemp.c:32
int Gia_SweeperCheckEquiv ( Gia_Man_t pGia,
int  Probe1,
int  Probe2 
)

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

Synopsis [Runs equivalence test for probes.]

Description []

SideEffects []

SeeAlso []

Definition at line 789 of file giaSweeper.c.

790 {
791  Swp_Man_t * p = (Swp_Man_t *)pGia->pData;
792  int iLitOld, iLitNew, iLitAig, pLitsSat[2], RetValue, RetValue1, ProbeId, i;
793  abctime clk;
794  p->nSatCalls++;
795  assert( p->pSat != NULL );
796  p->vCexUser = NULL;
797 
798  // get the literals
799  iLitOld = Gia_SweeperProbeLit( pGia, Probe1 );
800  iLitNew = Gia_SweeperProbeLit( pGia, Probe2 );
801  // if the literals are identical, the probes are equivalent
802  if ( iLitOld == iLitNew )
803  return 1;
804  // if the literals are opposites, the probes are not equivalent
805  if ( Abc_LitRegular(iLitOld) == Abc_LitRegular(iLitNew) )
806  {
807  Vec_IntFill( p->vCexSwp, Gia_ManPiNum(pGia), 2 );
808  p->vCexUser = p->vCexSwp;
809  return 0;
810  }
811  // order the literals
812  if ( iLitOld < iLitNew )
813  ABC_SWAP( int, iLitOld, iLitNew );
814  assert( iLitOld > iLitNew );
815 
816  // create logic cones and the array of assumptions
817  Vec_IntClear( p->vCondAssump );
818  Vec_IntForEachEntry( p->vCondProbes, ProbeId, i )
819  {
820  iLitAig = Gia_SweeperProbeLit( pGia, ProbeId );
821  Gia_ManCnfNodeAddToSolver( p, Abc_Lit2Var(iLitAig) );
822  Vec_IntPush( p->vCondAssump, Abc_LitNot(Swp_ManLit2Lit(p, iLitAig)) );
823  }
824  Gia_ManCnfNodeAddToSolver( p, Abc_Lit2Var(iLitOld) );
825  Gia_ManCnfNodeAddToSolver( p, Abc_Lit2Var(iLitNew) );
826  sat_solver_compress( p->pSat );
827 
828  // set the SAT literals
829  pLitsSat[0] = Swp_ManLit2Lit( p, iLitOld );
830  pLitsSat[1] = Swp_ManLit2Lit( p, iLitNew );
831 
832  // solve under assumptions
833  // A = 1; B = 0 OR A = 1; B = 1
834  Vec_IntPush( p->vCondAssump, pLitsSat[0] );
835  Vec_IntPush( p->vCondAssump, Abc_LitNot(pLitsSat[1]) );
836 
837  // set runtime limit for this call
838  if ( p->nTimeOut )
839  sat_solver_set_runtime_limit( p->pSat, p->nTimeOut * CLOCKS_PER_SEC + Abc_Clock() );
840 
841 clk = Abc_Clock();
842  RetValue1 = sat_solver_solve( p->pSat, Vec_IntArray(p->vCondAssump), Vec_IntArray(p->vCondAssump) + Vec_IntSize(p->vCondAssump),
843  (ABC_INT64_T)p->nConfMax, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
844  Vec_IntShrink( p->vCondAssump, Vec_IntSize(p->vCondAssump) - 2 );
845 p->timeSat += Abc_Clock() - clk;
846  if ( RetValue1 == l_False )
847  {
848  pLitsSat[0] = Abc_LitNot( pLitsSat[0] );
849  RetValue = sat_solver_addclause( p->pSat, pLitsSat, pLitsSat + 2 );
850  assert( RetValue );
851  pLitsSat[0] = Abc_LitNot( pLitsSat[0] );
852 p->timeSatUnsat += Abc_Clock() - clk;
853  p->nSatCallsUnsat++;
854  }
855  else if ( RetValue1 == l_True )
856  {
857  p->vCexUser = Gia_ManGetCex( p->pGia, p->vId2Lit, p->pSat, p->vCexSwp );
858 p->timeSatSat += Abc_Clock() - clk;
859  p->nSatCallsSat++;
860  return 0;
861  }
862  else // if ( RetValue1 == l_Undef )
863  {
864 p->timeSatUndec += Abc_Clock() - clk;
865  p->nSatCallsUndec++;
866  return -1;
867  }
868 
869  // if the old node was constant 0, we already know the answer
870  if ( Gia_ManIsConstLit(iLitNew) )
871  {
872  p->nSatProofs++;
873  return 1;
874  }
875 
876  // solve under assumptions
877  // A = 0; B = 1 OR A = 0; B = 0
878  Vec_IntPush( p->vCondAssump, Abc_LitNot(pLitsSat[0]) );
879  Vec_IntPush( p->vCondAssump, pLitsSat[1] );
880 
881 clk = Abc_Clock();
882  RetValue1 = sat_solver_solve( p->pSat, Vec_IntArray(p->vCondAssump), Vec_IntArray(p->vCondAssump) + Vec_IntSize(p->vCondAssump),
883  (ABC_INT64_T)p->nConfMax, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
884  Vec_IntShrink( p->vCondAssump, Vec_IntSize(p->vCondAssump) - 2 );
885 p->timeSat += Abc_Clock() - clk;
886  if ( RetValue1 == l_False )
887  {
888  pLitsSat[1] = Abc_LitNot( pLitsSat[1] );
889  RetValue = sat_solver_addclause( p->pSat, pLitsSat, pLitsSat + 2 );
890  assert( RetValue );
891  pLitsSat[1] = Abc_LitNot( pLitsSat[1] );
892 p->timeSatUnsat += Abc_Clock() - clk;
893  p->nSatCallsUnsat++;
894  }
895  else if ( RetValue1 == l_True )
896  {
897  p->vCexUser = Gia_ManGetCex( p->pGia, p->vId2Lit, p->pSat, p->vCexSwp );
898 p->timeSatSat += Abc_Clock() - clk;
899  p->nSatCallsSat++;
900  return 0;
901  }
902  else // if ( RetValue1 == l_Undef )
903  {
904 p->timeSatUndec += Abc_Clock() - clk;
905  p->nSatCallsUndec++;
906  return -1;
907  }
908  // return SAT proof
909  p->nSatProofs++;
910  return 1;
911 }
static abctime sat_solver_set_runtime_limit(sat_solver *s, abctime Limit)
Definition: satSolver.h:233
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int sat_solver_addclause(sat_solver *s, lit *begin, lit *end)
Definition: satSolver.c:1492
static int Gia_ManIsConstLit(int iLit)
Definition: gia.h:375
int sat_solver_solve(sat_solver *s, lit *begin, lit *end, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, ABC_INT64_T nConfLimitGlobal, ABC_INT64_T nInsLimitGlobal)
Definition: satSolver.c:1700
static void sat_solver_compress(sat_solver *s)
Definition: satSolver.h:217
#define l_True
Definition: SolverTypes.h:84
static abctime Abc_Clock()
Definition: abc_global.h:279
#define ABC_SWAP(Type, a, b)
Definition: abc_global.h:218
static int Swp_ManLit2Lit(Swp_Man_t *p, int Lit)
Definition: giaSweeper.c:89
void * pData
Definition: gia.h:169
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Abc_LitNot(int Lit)
Definition: abc_global.h:266
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static void Vec_IntShrink(Vec_Int_t *p, int nSizeNew)
Definition: bblif.c:435
typedefABC_NAMESPACE_IMPL_START struct Swp_Man_t_ Swp_Man_t
DECLARATIONS ///.
Definition: giaSweeper.c:56
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
#define l_False
Definition: SolverTypes.h:85
static void Gia_ManCnfNodeAddToSolver(Swp_Man_t *p, int NodeId)
Definition: giaSweeper.c:701
static int Abc_LitRegular(int Lit)
Definition: abc_global.h:268
#define assert(ex)
Definition: util_old.h:213
int Gia_SweeperProbeLit(Gia_Man_t *p, int ProbeId)
Definition: giaSweeper.c:276
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
ABC_INT64_T abctime
Definition: abc_global.h:278
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static Vec_Int_t * Gia_ManGetCex(Gia_Man_t *pGia, Vec_Int_t *vId2Lit, sat_solver *pSat, Vec_Int_t *vCex)
Definition: giaSweeper.c:753
Gia_Man_t* Gia_SweeperCleanup ( Gia_Man_t p,
char *  pCommLime 
)

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

Synopsis [Sweeper cleanup.]

Description [Returns new GIA with sweeper defined, which is the same as the original sweeper, with all the dangling logic removed and SAT solver restarted. The probe IDs are guaranteed to have the same logic functions as in the original manager.]

SideEffects [The input manager is deleted inside this procedure.]

SeeAlso []

Definition at line 461 of file giaSweeper.c.

462 {
463  Swp_Man_t * pSwp = (Swp_Man_t *)p->pData;
464  Vec_Int_t * vObjIds;
465  Gia_Man_t * pNew, * pTemp;
466  Gia_Obj_t * pObj;
467  int i, iLit, ProbeId;
468 
469  // collect all internal nodes pointed to by currently-used probes
471  vObjIds = Vec_IntAlloc( 1000 );
472  Vec_IntForEachEntry( pSwp->vProbes, iLit, ProbeId )
473  {
474  if ( iLit < 0 ) continue;
475  pObj = Gia_Lit2Obj( p, iLit );
476  Gia_ManExtract_rec( p, Gia_Regular(pObj), vObjIds );
477  }
478  // create new manager
479  pNew = Gia_ManStart( 1 + Gia_ManPiNum(p) + Vec_IntSize(vObjIds) + 100 );
480  pNew->pName = Abc_UtilStrsav( p->pName );
481  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
482  Gia_ManConst0(p)->Value = 0;
483  Gia_ManForEachPi( p, pObj, i )
484  pObj->Value = Gia_ManAppendCi(pNew);
485  // create internal nodes
486  Gia_ManHashStart( pNew );
487  Gia_ManForEachObjVec( vObjIds, p, pObj, i )
488  pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
489  Gia_ManHashStop( pNew );
490  // create outputs
491  Vec_IntForEachEntry( pSwp->vProbes, iLit, ProbeId )
492  {
493  if ( iLit < 0 ) continue;
494  pObj = Gia_Lit2Obj( p, iLit );
495  iLit = Gia_Regular(pObj)->Value ^ Gia_IsComplement(pObj);
496  Vec_IntWriteEntry( pSwp->vProbes, ProbeId, iLit );
497  }
498  Vec_IntFree( vObjIds );
499  // duplicate if needed
500  if ( Gia_ManHasDangling(pNew) )
501  {
502  pNew = Gia_ManCleanup( pTemp = pNew );
503  Gia_ManStop( pTemp );
504  }
505  // execute command line
506  if ( pCommLime )
507  {
508  // set pNew to be current GIA in ABC
510  // execute command line pCommLine using Abc_CmdCommandExecute()
512  // get pNew to be current GIA in ABC
514  }
515  // restart the SAT solver
516  Vec_IntClear( pSwp->vId2Lit );
517  sat_solver_delete( pSwp->pSat );
518  pSwp->pSat = sat_solver_new();
519  pSwp->nSatVars = 1;
520  sat_solver_setnvars( pSwp->pSat, 1000 );
521  Swp_ManSetObj2Lit( pSwp, 0, (iLit = Abc_Var2Lit(pSwp->nSatVars++, 0)) );
522  iLit = Abc_LitNot(iLit);
523  sat_solver_addclause( pSwp->pSat, &iLit, &iLit + 1 );
524  pSwp->timeStart = Abc_Clock();
525  // return the result
526  pNew->pData = p->pData; p->pData = NULL;
527  Gia_ManStop( p );
528  return pNew;
529 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
int sat_solver_addclause(sat_solver *s, lit *begin, lit *end)
Definition: satSolver.c:1492
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
int Cmd_CommandExecute(void *pAbc, char *pCommandLine)
static Gia_Obj_t * Gia_Regular(Gia_Obj_t *p)
Definition: gia.h:377
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
void sat_solver_delete(sat_solver *s)
Definition: satSolver.c:1141
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
static abctime Abc_Clock()
Definition: abc_global.h:279
Definition: gia.h:75
int Gia_ManHasDangling(Gia_Man_t *p)
Definition: giaUtil.c:1155
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
char * pName
Definition: gia.h:97
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
void sat_solver_setnvars(sat_solver *s, int n)
Definition: satSolver.c:1072
void * pData
Definition: gia.h:169
void * Abc_FrameGetGlobalFrame()
Definition: mainFrame.c:593
void Gia_ManHashStart(Gia_Man_t *p)
Definition: giaHash.c:117
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
static void Gia_ManExtract_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vObjIds)
Definition: giaSweeper.c:347
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition: gia.h:988
static int Abc_LitNot(int Lit)
Definition: abc_global.h:266
sat_solver * sat_solver_new(void)
Definition: satSolver.c:1001
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Gia_IsComplement(Gia_Obj_t *p)
Definition: gia.h:380
Definition: gia.h:95
typedefABC_NAMESPACE_IMPL_START struct Swp_Man_t_ Swp_Man_t
DECLARATIONS ///.
Definition: giaSweeper.c:56
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
void Abc_FrameUpdateGia(Abc_Frame_t *pAbc, Gia_Man_t *pNew)
Definition: abc.c:616
static void Swp_ManSetObj2Lit(Swp_Man_t *p, int Id, int Lit)
Definition: giaSweeper.c:90
unsigned Value
Definition: gia.h:87
static Gia_Obj_t * Gia_Lit2Obj(Gia_Man_t *p, int iLit)
Definition: gia.h:434
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
Gia_Man_t * Abc_FrameGetGia(Abc_Frame_t *pAbc)
Definition: abc.c:656
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
Vec_Int_t* Gia_SweeperCollectValidProbeIds ( Gia_Man_t p)

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

Synopsis [This procedure returns indexes of all currently defined valid probes.]

Description []

SideEffects []

SeeAlso []

Definition at line 295 of file giaSweeper.c.

296 {
297  Swp_Man_t * pSwp = (Swp_Man_t *)p->pData;
298  Vec_Int_t * vProbeIds = Vec_IntAlloc( 1000 );
299  int iLit, ProbeId;
300  Vec_IntForEachEntry( pSwp->vProbes, iLit, ProbeId )
301  {
302  if ( iLit < 0 ) continue;
303  Vec_IntPush( vProbeIds, ProbeId );
304  }
305  return vProbeIds;
306 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
void * pData
Definition: gia.h:169
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
typedefABC_NAMESPACE_IMPL_START struct Swp_Man_t_ Swp_Man_t
DECLARATIONS ///.
Definition: giaSweeper.c:56
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
int Gia_SweeperCondCheckUnsat ( Gia_Man_t pGia)

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

Synopsis [Returns 1 if the set of conditions is UNSAT (0 if SAT; -1 if undecided).]

Description []

SideEffects []

SeeAlso []

Definition at line 924 of file giaSweeper.c.

925 {
926  Swp_Man_t * p = (Swp_Man_t *)pGia->pData;
927  int RetValue, ProbeId, iLitAig, i;
928  abctime clk;
929  assert( p->pSat != NULL );
930  p->nSatCalls++;
931  p->vCexUser = NULL;
932 
933  // create logic cones and the array of assumptions
934  Vec_IntClear( p->vCondAssump );
935  Vec_IntForEachEntry( p->vCondProbes, ProbeId, i )
936  {
937  iLitAig = Gia_SweeperProbeLit( pGia, ProbeId );
938  Gia_ManCnfNodeAddToSolver( p, Abc_Lit2Var(iLitAig) );
939  Vec_IntPush( p->vCondAssump, Abc_LitNot(Swp_ManLit2Lit(p, iLitAig)) );
940  }
941  sat_solver_compress( p->pSat );
942 
943  // set runtime limit for this call
944  if ( p->nTimeOut )
945  sat_solver_set_runtime_limit( p->pSat, p->nTimeOut * CLOCKS_PER_SEC + Abc_Clock() );
946 
947 clk = Abc_Clock();
948  RetValue = sat_solver_solve( p->pSat, Vec_IntArray(p->vCondAssump), Vec_IntArray(p->vCondAssump) + Vec_IntSize(p->vCondAssump),
949  (ABC_INT64_T)p->nConfMax, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
950 p->timeSat += Abc_Clock() - clk;
951  if ( RetValue == l_False )
952  {
953  assert( Vec_IntSize(p->vCondProbes) > 0 );
954 p->timeSatUnsat += Abc_Clock() - clk;
955  p->nSatCallsUnsat++;
956  p->nSatProofs++;
957  return 1;
958  }
959  else if ( RetValue == l_True )
960  {
961  p->vCexUser = Gia_ManGetCex( p->pGia, p->vId2Lit, p->pSat, p->vCexSwp );
962 p->timeSatSat += Abc_Clock() - clk;
963  p->nSatCallsSat++;
964  return 0;
965  }
966  else // if ( RetValue1 == l_Undef )
967  {
968 p->timeSatUndec += Abc_Clock() - clk;
969  p->nSatCallsUndec++;
970  return -1;
971  }
972 }
static abctime sat_solver_set_runtime_limit(sat_solver *s, abctime Limit)
Definition: satSolver.h:233
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int sat_solver_solve(sat_solver *s, lit *begin, lit *end, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, ABC_INT64_T nConfLimitGlobal, ABC_INT64_T nInsLimitGlobal)
Definition: satSolver.c:1700
static void sat_solver_compress(sat_solver *s)
Definition: satSolver.h:217
#define l_True
Definition: SolverTypes.h:84
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Swp_ManLit2Lit(Swp_Man_t *p, int Lit)
Definition: giaSweeper.c:89
void * pData
Definition: gia.h:169
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Abc_LitNot(int Lit)
Definition: abc_global.h:266
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
typedefABC_NAMESPACE_IMPL_START struct Swp_Man_t_ Swp_Man_t
DECLARATIONS ///.
Definition: giaSweeper.c:56
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
#define l_False
Definition: SolverTypes.h:85
static void Gia_ManCnfNodeAddToSolver(Swp_Man_t *p, int NodeId)
Definition: giaSweeper.c:701
#define assert(ex)
Definition: util_old.h:213
int Gia_SweeperProbeLit(Gia_Man_t *p, int ProbeId)
Definition: giaSweeper.c:276
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
ABC_INT64_T abctime
Definition: abc_global.h:278
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static Vec_Int_t * Gia_ManGetCex(Gia_Man_t *pGia, Vec_Int_t *vId2Lit, sat_solver *pSat, Vec_Int_t *vCex)
Definition: giaSweeper.c:753
int Gia_SweeperCondPop ( Gia_Man_t p)

Definition at line 324 of file giaSweeper.c.

325 {
326  Swp_Man_t * pSwp = (Swp_Man_t *)p->pData;
327  return Vec_IntPop( pSwp->vCondProbes );
328 }
void * pData
Definition: gia.h:169
static int Vec_IntPop(Vec_Int_t *p)
typedefABC_NAMESPACE_IMPL_START struct Swp_Man_t_ Swp_Man_t
DECLARATIONS ///.
Definition: giaSweeper.c:56
void Gia_SweeperCondPush ( Gia_Man_t p,
int  ProbeId 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 319 of file giaSweeper.c.

320 {
321  Swp_Man_t * pSwp = (Swp_Man_t *)p->pData;
322  Vec_IntPush( pSwp->vCondProbes, ProbeId );
323 }
void * pData
Definition: gia.h:169
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
typedefABC_NAMESPACE_IMPL_START struct Swp_Man_t_ Swp_Man_t
DECLARATIONS ///.
Definition: giaSweeper.c:56
Vec_Int_t* Gia_SweeperCondVector ( Gia_Man_t p)

Definition at line 329 of file giaSweeper.c.

330 {
331  Swp_Man_t * pSwp = (Swp_Man_t *)p->pData;
332  return pSwp->vCondProbes;
333 }
void * pData
Definition: gia.h:169
typedefABC_NAMESPACE_IMPL_START struct Swp_Man_t_ Swp_Man_t
DECLARATIONS ///.
Definition: giaSweeper.c:56
Gia_Man_t* Gia_SweeperExtractUserLogic ( Gia_Man_t p,
Vec_Int_t vProbeIds,
Vec_Ptr_t vInNames,
Vec_Ptr_t vOutNames 
)

Definition at line 358 of file giaSweeper.c.

359 {
360  Vec_Int_t * vObjIds, * vValues;
361  Gia_Man_t * pNew, * pTemp;
362  Gia_Obj_t * pObj;
363  int i, ProbeId;
364  assert( vInNames == NULL || Gia_ManPiNum(p) == Vec_PtrSize(vInNames) );
365  assert( vOutNames == NULL || Vec_IntSize(vProbeIds) == Vec_PtrSize(vOutNames) );
366  // create new
368  vObjIds = Vec_IntAlloc( 1000 );
369  Vec_IntForEachEntry( vProbeIds, ProbeId, i )
370  {
371  pObj = Gia_Lit2Obj( p, Gia_SweeperProbeLit(p, ProbeId) );
372  Gia_ManExtract_rec( p, Gia_Regular(pObj), vObjIds );
373  }
374  // create new manager
375  pNew = Gia_ManStart( 1 + Gia_ManPiNum(p) + Vec_IntSize(vObjIds) + Vec_IntSize(vProbeIds) + 100 );
376  pNew->pName = Abc_UtilStrsav( p->pName );
377  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
378  Gia_ManConst0(p)->Value = 0;
379  Gia_ManForEachPi( p, pObj, i )
380  pObj->Value = Gia_ManAppendCi(pNew);
381  // create internal nodes
382  Gia_ManHashStart( pNew );
383  vValues = Vec_IntAlloc( Vec_IntSize(vObjIds) );
384  Gia_ManForEachObjVec( vObjIds, p, pObj, i )
385  {
386  Vec_IntPush( vValues, pObj->Value );
387  pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
388  }
389  Gia_ManHashStop( pNew );
390  // create outputs
391  Vec_IntForEachEntry( vProbeIds, ProbeId, i )
392  {
393  pObj = Gia_Lit2Obj( p, Gia_SweeperProbeLit(p, ProbeId) );
394  Gia_ManAppendCo( pNew, Gia_Regular(pObj)->Value ^ Gia_IsComplement(pObj) );
395  }
396  // return the values back
397  Gia_ManForEachPi( p, pObj, i )
398  pObj->Value = 0;
399  Gia_ManForEachObjVec( vObjIds, p, pObj, i )
400  pObj->Value = Vec_IntEntry( vValues, i );
401  Vec_IntFree( vObjIds );
402  Vec_IntFree( vValues );
403  // duplicate if needed
404  if ( Gia_ManHasDangling(pNew) )
405  {
406  pNew = Gia_ManCleanup( pTemp = pNew );
407  Gia_ManStop( pTemp );
408  }
409  // copy names if present
410  if ( vInNames )
411  pNew->vNamesIn = Vec_PtrDupStr( vInNames );
412  if ( vOutNames )
413  pNew->vNamesOut = Vec_PtrDupStr( vOutNames );
414  return pNew;
415 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Gia_Obj_t * Gia_Regular(Gia_Obj_t *p)
Definition: gia.h:377
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Definition: gia.h:75
int Gia_ManHasDangling(Gia_Man_t *p)
Definition: giaUtil.c:1155
char * pName
Definition: gia.h:97
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
if(last==0)
Definition: sparse_int.h:34
void Gia_ManHashStart(Gia_Man_t *p)
Definition: giaHash.c:117
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static void Gia_ManExtract_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vObjIds)
Definition: giaSweeper.c:347
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition: gia.h:988
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Gia_IsComplement(Gia_Obj_t *p)
Definition: gia.h:380
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
static Gia_Obj_t * Gia_Lit2Obj(Gia_Man_t *p, int iLit)
Definition: gia.h:434
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
int Gia_SweeperProbeLit(Gia_Man_t *p, int ProbeId)
Definition: giaSweeper.c:276
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static Vec_Ptr_t * Vec_PtrDupStr(Vec_Ptr_t *pVec)
Definition: vecPtr.h:179
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
int Gia_SweeperFraig ( Gia_Man_t p,
Vec_Int_t vProbeIds,
char *  pCommLime,
int  nWords,
int  nConfs,
int  fVerify,
int  fVerbose 
)

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

Synopsis [Procedure to perform conditional fraig sweeping on separate logic cones.]

Description [The procedure takes GIA with the sweeper defined. The sweeper is assumed to have some conditions currently pushed, which will be used as constraints for fraig sweeping. The second argument (vProbes) contains the array of probe IDs pointing to the user's logic cones to be SAT swept. Finally, the optional command line (pCommLine) is an ABC command line to be applied to the resulting GIA after SAT sweeping before it is grafted back into the original GIA manager. The return value is the status (success/failure) and the array of original probes possibly pointing to the new literals in the original GIA manager, corresponding to the user's logic cones after sweeping, synthesis and grafting.]

SideEffects []

SeeAlso []

Definition at line 1064 of file giaSweeper.c.

1065 {
1066  Gia_Man_t * pNew;
1067  Vec_Int_t * vLits;
1068  int ProbeId, i;
1069  // sweeper is running
1071  // sweep the logic
1072  pNew = Gia_SweeperSweep( p, vProbeIds, nWords, nConfs, fVerify, fVerbose );
1073  if ( pNew == NULL )
1074  return 0;
1075  // execute command line
1076  if ( pCommLime )
1077  {
1078  // set pNew to be current GIA in ABC
1080  // execute command line pCommLine using Abc_CmdCommandExecute()
1082  // get pNew to be current GIA in ABC
1084  }
1085  // return logic back into the main manager
1086  vLits = Gia_SweeperGraft( p, NULL, pNew );
1087  Gia_ManStop( pNew );
1088  // update the array of probes
1089  Vec_IntForEachEntry( vProbeIds, ProbeId, i )
1090  Gia_SweeperProbeUpdate( p, ProbeId, Vec_IntEntry(vLits, i) );
1091  Vec_IntFree( vLits );
1092  return 1;
1093 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
int Cmd_CommandExecute(void *pAbc, char *pCommandLine)
int Gia_SweeperProbeUpdate(Gia_Man_t *p, int ProbeId, int iLitNew)
Definition: giaSweeper.c:267
int nWords
Definition: abcNpn.c:127
Vec_Int_t * Gia_SweeperGraft(Gia_Man_t *pDst, Vec_Int_t *vProbes, Gia_Man_t *pSrc)
Definition: giaSweeper.c:985
Gia_Man_t * Gia_SweeperSweep(Gia_Man_t *p, Vec_Int_t *vProbeOuts, int nWords, int nConfs, int fVerify, int fVerbose)
Definition: giaSweeper.c:1017
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
void * Abc_FrameGetGlobalFrame()
Definition: mainFrame.c:593
int Gia_SweeperIsRunning(Gia_Man_t *pGia)
Definition: giaSweeper.c:164
Definition: gia.h:95
void Abc_FrameUpdateGia(Abc_Frame_t *pAbc, Gia_Man_t *pNew)
Definition: abc.c:616
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Gia_Man_t * Abc_FrameGetGia(Abc_Frame_t *pAbc)
Definition: abc.c:656
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
Vec_Int_t* Gia_SweeperGetCex ( Gia_Man_t p)

Definition at line 230 of file giaSweeper.c.

231 {
232  Swp_Man_t * pSwp = (Swp_Man_t *)p->pData;
233  assert( pSwp->vCexUser == NULL || Vec_IntSize(pSwp->vCexUser) == Gia_ManPiNum(p) );
234  return pSwp->vCexUser;
235 }
void * pData
Definition: gia.h:169
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
typedefABC_NAMESPACE_IMPL_START struct Swp_Man_t_ Swp_Man_t
DECLARATIONS ///.
Definition: giaSweeper.c:56
#define assert(ex)
Definition: util_old.h:213
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
Vec_Int_t* Gia_SweeperGraft ( Gia_Man_t pDst,
Vec_Int_t vProbes,
Gia_Man_t pSrc 
)

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

Synopsis [Performs grafting from another manager.]

Description [Returns the array of resulting literals in the destination manager.]

SideEffects []

SeeAlso []

Definition at line 985 of file giaSweeper.c.

986 {
987  Vec_Int_t * vOutLits;
988  Gia_Obj_t * pObj;
989  int i;
990  assert( Gia_SweeperIsRunning(pDst) );
991  if ( vProbes )
992  assert( Vec_IntSize(vProbes) == Gia_ManPiNum(pSrc) );
993  else
994  assert( Gia_ManPiNum(pDst) == Gia_ManPiNum(pSrc) );
995  Gia_ManForEachPi( pSrc, pObj, i )
996  pObj->Value = vProbes ? Gia_SweeperProbeLit(pDst, Vec_IntEntry(vProbes, i)) : Gia_Obj2Lit(pDst,Gia_ManPi(pDst, i));
997  Gia_ManForEachAnd( pSrc, pObj, i )
998  pObj->Value = Gia_ManHashAnd( pDst, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
999  vOutLits = Vec_IntAlloc( Gia_ManPoNum(pSrc) );
1000  Gia_ManForEachPo( pSrc, pObj, i )
1001  Vec_IntPush( vOutLits, Gia_ObjFanin0Copy(pObj) );
1002  return vOutLits;
1003 }
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Definition: gia.h:75
static Gia_Obj_t * Gia_ManPi(Gia_Man_t *p, int v)
Definition: gia.h:405
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
#define Gia_ManForEachPi(p, pObj, i)
Definition: gia.h:1034
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
int Gia_SweeperIsRunning(Gia_Man_t *pGia)
Definition: giaSweeper.c:164
#define assert(ex)
Definition: util_old.h:213
int Gia_SweeperProbeLit(Gia_Man_t *p, int ProbeId)
Definition: giaSweeper.c:276
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
static int Gia_Obj2Lit(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:433
int Gia_SweeperIsRunning ( Gia_Man_t p)

Definition at line 164 of file giaSweeper.c.

165 {
166  return (pGia->pData != NULL);
167 }
void Gia_SweeperLogicDump ( Gia_Man_t p,
Vec_Int_t vProbeIds,
int  fDumpConds,
char *  pFileName 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 428 of file giaSweeper.c.

429 {
430  Gia_Man_t * pGiaOuts = Gia_SweeperExtractUserLogic( p, vProbeIds, NULL, NULL );
431  Vec_Int_t * vProbeConds = Gia_SweeperCondVector( p );
432  printf( "Dumping logic cones" );
433  if ( fDumpConds && Vec_IntSize(vProbeConds) > 0 )
434  {
435  Gia_Man_t * pGiaCond = Gia_SweeperExtractUserLogic( p, vProbeConds, NULL, NULL );
436  Gia_ManDupAppendShare( pGiaOuts, pGiaCond );
437  pGiaOuts->nConstrs = Gia_ManPoNum(pGiaCond);
438  Gia_ManHashStop( pGiaOuts );
439  Gia_ManStop( pGiaCond );
440  printf( " and conditions" );
441  }
442  Gia_AigerWrite( pGiaOuts, pFileName, 0, 0 );
443  Gia_ManStop( pGiaOuts );
444  printf( " into file \"%s\".\n", pFileName );
445 }
Vec_Int_t * Gia_SweeperCondVector(Gia_Man_t *p)
Definition: giaSweeper.c:329
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Gia_Man_t * Gia_SweeperExtractUserLogic(Gia_Man_t *p, Vec_Int_t *vProbeIds, Vec_Ptr_t *vInNames, Vec_Ptr_t *vOutNames)
Definition: giaSweeper.c:358
int nConstrs
Definition: gia.h:117
void Gia_AigerWrite(Gia_Man_t *p, char *pFileName, int fWriteSymbols, int fCompact)
Definition: giaAiger.c:1024
void Gia_ManDupAppendShare(Gia_Man_t *p, Gia_Man_t *pTwo)
Definition: giaDup.c:765
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Definition: gia.h:95
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
void Gia_SweeperPrintStats ( Gia_Man_t p)

Definition at line 181 of file giaSweeper.c.

182 {
183  Swp_Man_t * p = (Swp_Man_t *)pGia->pData;
184  double nMemSwp = Gia_SweeperMemUsage(pGia);
185  double nMemGia = (double)Gia_ManObjNum(pGia)*(sizeof(Gia_Obj_t) + sizeof(int));
186  double nMemSat = sat_solver_memory(p->pSat);
187  double nMemTot = nMemSwp + nMemGia + nMemSat;
188  printf( "SAT sweeper statistics:\n" );
189  printf( "Memory usage:\n" );
190  ABC_PRMP( "Sweeper ", nMemSwp, nMemTot );
191  ABC_PRMP( "AIG manager ", nMemGia, nMemTot );
192  ABC_PRMP( "SAT solver ", nMemSat, nMemTot );
193  ABC_PRMP( "TOTAL ", nMemTot, nMemTot );
194  printf( "Runtime usage:\n" );
195  p->timeTotal = Abc_Clock() - p->timeStart;
196  ABC_PRTP( "CNF construction", p->timeCnf, p->timeTotal );
197  ABC_PRTP( "SAT solving ", p->timeSat, p->timeTotal );
198  ABC_PRTP( " Sat ", p->timeSatSat, p->timeTotal );
199  ABC_PRTP( " Unsat ", p->timeSatUnsat, p->timeTotal );
200  ABC_PRTP( " Undecided ", p->timeSatUndec, p->timeTotal );
201  ABC_PRTP( "TOTAL RUNTIME ", p->timeTotal, p->timeTotal );
202  printf( "GIA: " );
203  Gia_ManPrintStats( pGia, NULL );
204  printf( "SAT calls = %d. Sat = %d. Unsat = %d. Undecided = %d. Proofs = %d.\n",
205  p->nSatCalls, p->nSatCallsSat, p->nSatCallsUnsat, p->nSatCallsUndec, p->nSatProofs );
206  Sat_SolverPrintStats( stdout, p->pSat );
207 }
double Gia_SweeperMemUsage(Gia_Man_t *pGia)
Definition: giaSweeper.c:168
void Gia_ManPrintStats(Gia_Man_t *p, Gps_Par_t *pPars)
Definition: giaMan.c:389
static abctime Abc_Clock()
Definition: abc_global.h:279
double sat_solver_memory(sat_solver *s)
Definition: satSolver.c:1236
#define ABC_PRTP(a, t, T)
Definition: abc_global.h:223
struct Gia_Obj_t_ Gia_Obj_t
Definition: gia.h:74
void * pData
Definition: gia.h:169
#define ABC_PRMP(a, f, F)
Definition: abc_global.h:227
typedefABC_NAMESPACE_IMPL_START struct Swp_Man_t_ Swp_Man_t
DECLARATIONS ///.
Definition: giaSweeper.c:56
void Sat_SolverPrintStats(FILE *pFile, sat_solver *p)
Definition: satUtil.c:188
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
int Gia_SweeperProbeCreate ( Gia_Man_t p,
int  iLit 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 249 of file giaSweeper.c.

250 {
251  Swp_Man_t * pSwp = (Swp_Man_t *)p->pData;
252  int ProbeId = Vec_IntSize(pSwp->vProbes);
253  assert( iLit >= 0 );
254  Vec_IntPush( pSwp->vProbes, iLit );
255  return ProbeId;
256 }
void * pData
Definition: gia.h:169
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
typedefABC_NAMESPACE_IMPL_START struct Swp_Man_t_ Swp_Man_t
DECLARATIONS ///.
Definition: giaSweeper.c:56
#define assert(ex)
Definition: util_old.h:213
int Gia_SweeperProbeDelete ( Gia_Man_t p,
int  ProbeId 
)

Definition at line 258 of file giaSweeper.c.

259 {
260  Swp_Man_t * pSwp = (Swp_Man_t *)p->pData;
261  int iLit = Vec_IntEntry(pSwp->vProbes, ProbeId);
262  assert( iLit >= 0 );
263  Vec_IntWriteEntry(pSwp->vProbes, ProbeId, -1);
264  return iLit;
265 }
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
void * pData
Definition: gia.h:169
typedefABC_NAMESPACE_IMPL_START struct Swp_Man_t_ Swp_Man_t
DECLARATIONS ///.
Definition: giaSweeper.c:56
#define assert(ex)
Definition: util_old.h:213
int Gia_SweeperProbeLit ( Gia_Man_t p,
int  ProbeId 
)

Definition at line 276 of file giaSweeper.c.

277 {
278  Swp_Man_t * pSwp = (Swp_Man_t *)p->pData;
279  int iLit = Vec_IntEntry(pSwp->vProbes, ProbeId);
280  assert( iLit >= 0 );
281  return iLit;
282 }
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
void * pData
Definition: gia.h:169
typedefABC_NAMESPACE_IMPL_START struct Swp_Man_t_ Swp_Man_t
DECLARATIONS ///.
Definition: giaSweeper.c:56
#define assert(ex)
Definition: util_old.h:213
int Gia_SweeperProbeUpdate ( Gia_Man_t p,
int  ProbeId,
int  iLitNew 
)

Definition at line 267 of file giaSweeper.c.

268 {
269  Swp_Man_t * pSwp = (Swp_Man_t *)p->pData;
270  int iLit = Vec_IntEntry(pSwp->vProbes, ProbeId);
271  assert( iLit >= 0 );
272  Vec_IntWriteEntry(pSwp->vProbes, ProbeId, iLitNew);
273  return iLit;
274 }
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
void * pData
Definition: gia.h:169
typedefABC_NAMESPACE_IMPL_START struct Swp_Man_t_ Swp_Man_t
DECLARATIONS ///.
Definition: giaSweeper.c:56
#define assert(ex)
Definition: util_old.h:213
int Gia_SweeperRun ( Gia_Man_t p,
Vec_Int_t vProbeIds,
char *  pCommLime,
int  fVerbose 
)

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

Synopsis [Executes given command line for the logic defined by the probes.]

Description [ ]

SideEffects []

SeeAlso []

Definition at line 1106 of file giaSweeper.c.

1107 {
1108  Gia_Man_t * pNew;
1109  Vec_Int_t * vLits;
1110  int ProbeId, i;
1111  // sweeper is running
1113  // sweep the logic
1114  pNew = Gia_SweeperExtractUserLogic( p, vProbeIds, NULL, NULL );
1115  // execute command line
1116  if ( pCommLime )
1117  {
1118  if ( fVerbose )
1119  printf( "GIA manager statistics before and after applying \"%s\":\n", pCommLime );
1120  if ( fVerbose )
1121  Gia_ManPrintStats( pNew, NULL );
1122  // set pNew to be current GIA in ABC
1124  // execute command line pCommLine using Abc_CmdCommandExecute()
1126  // get pNew to be current GIA in ABC
1128  if ( fVerbose )
1129  Gia_ManPrintStats( pNew, NULL );
1130  }
1131  // return logic back into the main manager
1132  vLits = Gia_SweeperGraft( p, NULL, pNew );
1133  Gia_ManStop( pNew );
1134  // update the array of probes
1135  Vec_IntForEachEntry( vProbeIds, ProbeId, i )
1136  Gia_SweeperProbeUpdate( p, ProbeId, Vec_IntEntry(vLits, i) );
1137  Vec_IntFree( vLits );
1138  return 1;
1139 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
void Gia_ManPrintStats(Gia_Man_t *p, Gps_Par_t *pPars)
Definition: giaMan.c:389
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
int Cmd_CommandExecute(void *pAbc, char *pCommandLine)
Gia_Man_t * Gia_SweeperExtractUserLogic(Gia_Man_t *p, Vec_Int_t *vProbeIds, Vec_Ptr_t *vInNames, Vec_Ptr_t *vOutNames)
Definition: giaSweeper.c:358
int Gia_SweeperProbeUpdate(Gia_Man_t *p, int ProbeId, int iLitNew)
Definition: giaSweeper.c:267
Vec_Int_t * Gia_SweeperGraft(Gia_Man_t *pDst, Vec_Int_t *vProbes, Gia_Man_t *pSrc)
Definition: giaSweeper.c:985
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
void * Abc_FrameGetGlobalFrame()
Definition: mainFrame.c:593
int Gia_SweeperIsRunning(Gia_Man_t *pGia)
Definition: giaSweeper.c:164
Definition: gia.h:95
void Abc_FrameUpdateGia(Abc_Frame_t *pAbc, Gia_Man_t *pNew)
Definition: abc.c:616
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Gia_Man_t * Abc_FrameGetGia(Abc_Frame_t *pAbc)
Definition: abc.c:656
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
void Gia_SweeperSetConflictLimit ( Gia_Man_t p,
int  nConfMax 
)

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

Synopsis [Setting resource limits.]

Description []

SideEffects []

SeeAlso []

Definition at line 220 of file giaSweeper.c.

221 {
222  Swp_Man_t * pSwp = (Swp_Man_t *)p->pData;
223  pSwp->nConfMax = nConfMax;
224 }
void * pData
Definition: gia.h:169
typedefABC_NAMESPACE_IMPL_START struct Swp_Man_t_ Swp_Man_t
DECLARATIONS ///.
Definition: giaSweeper.c:56
void Gia_SweeperSetRuntimeLimit ( Gia_Man_t p,
int  nSeconds 
)

Definition at line 225 of file giaSweeper.c.

226 {
227  Swp_Man_t * pSwp = (Swp_Man_t *)p->pData;
228  pSwp->nTimeOut = nSeconds;
229 }
void * pData
Definition: gia.h:169
typedefABC_NAMESPACE_IMPL_START struct Swp_Man_t_ Swp_Man_t
DECLARATIONS ///.
Definition: giaSweeper.c:56
Gia_Man_t* Gia_SweeperStart ( Gia_Man_t p)

Definition at line 145 of file giaSweeper.c.

146 {
147  if ( pGia == NULL )
148  pGia = Gia_ManStart( 10000 );
149  if ( pGia->pHTable == NULL )
150  Gia_ManHashStart( pGia );
151  // recompute fPhase and fMark1 to mark multiple fanout nodes if AIG is already defined!!!
152 
153  Swp_ManStart( pGia );
154  pGia->fSweeper = 1;
155  return pGia;
156 }
static Swp_Man_t * Swp_ManStart(Gia_Man_t *pGia)
FUNCTION DEFINITIONS ///.
Definition: giaSweeper.c:107
void Gia_ManHashStart(Gia_Man_t *p)
Definition: giaHash.c:117
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
void Gia_SweeperStop ( Gia_Man_t p)

Definition at line 157 of file giaSweeper.c.

158 {
159  pGia->fSweeper = 0;
160  Swp_ManStop( pGia );
161  Gia_ManHashStop( pGia );
162 // Gia_ManStop( pGia );
163 }
static void Swp_ManStop(Gia_Man_t *pGia)
Definition: giaSweeper.c:131
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
char* Gia_TimeStamp ( )

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

Synopsis [Returns the time stamp.]

Description [The file should be closed.]

SideEffects []

SeeAlso []

Definition at line 101 of file giaUtil.c.

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

Definition at line 313 of file gia.h.

314 {
315  uWord = (uWord & 0x55555555) + ((uWord>>1) & 0x55555555);
316  uWord = (uWord & 0x33333333) + ((uWord>>2) & 0x33333333);
317  uWord = (uWord & 0x0F0F0F0F) + ((uWord>>4) & 0x0F0F0F0F);
318  uWord = (uWord & 0x00FF00FF) + ((uWord>>8) & 0x00FF00FF);
319  return (uWord & 0x0000FFFF) + (uWord>>16);
320 }
static int Gia_WordFindFirstBit ( unsigned  uWord)
inlinestatic

Definition at line 321 of file gia.h.

322 {
323  int i;
324  for ( i = 0; i < 32; i++ )
325  if ( uWord & (1 << i) )
326  return i;
327  return -1;
328 }
static int Gia_WordHasOneBit ( unsigned  uWord)
inlinestatic

Definition at line 311 of file gia.h.

311 { return (uWord & (uWord-1)) == 0; }
static int Gia_WordHasOnePair ( unsigned  uWord)
inlinestatic

Definition at line 312 of file gia.h.

312 { return Gia_WordHasOneBit(uWord & (uWord>>1) & 0x55555555); }
static int Gia_WordHasOneBit(unsigned uWord)
Definition: gia.h:311
static int Gia_XsimAndCond ( int  Value0,
int  fCompl0,
int  Value1,
int  fCompl1 
)
inlinestatic

Definition at line 759 of file gia.h.

760 {
761  if ( Value0 == GIA_ZER + fCompl0 || Value1 == GIA_ZER + fCompl1 )
762  return GIA_ZER;
763  if ( Value0 == GIA_UND || Value1 == GIA_UND )
764  return GIA_UND;
765  return GIA_ONE;
766 }
#define GIA_UND
Definition: gia.h:749
#define GIA_ZER
Definition: gia.h:747
#define GIA_ONE
Definition: gia.h:748
static int Gia_XsimNotCond ( int  Value,
int  fCompl 
)
inlinestatic

Definition at line 751 of file gia.h.

752 {
753  if ( Value == GIA_UND )
754  return GIA_UND;
755  if ( Value == GIA_ZER + fCompl )
756  return GIA_ZER;
757  return GIA_ONE;
758 }
#define GIA_UND
Definition: gia.h:749
#define GIA_ZER
Definition: gia.h:747
#define GIA_ONE
Definition: gia.h:748
Gia_Man_t* Jf_ManDeriveCnf ( Gia_Man_t p,
int  fCnfObjIds 
)

Definition at line 1746 of file giaJf.c.

1747 {
1748  Jf_Par_t Pars, * pPars = &Pars;
1749  Jf_ManSetDefaultPars( pPars );
1750  pPars->fGenCnf = 1;
1751  pPars->fCnfObjIds = fCnfObjIds;
1752  return Jf_ManPerformMapping( p, pPars );
1753 }
int fCnfObjIds
Definition: gia.h:285
void Jf_ManSetDefaultPars(Jf_Par_t *pPars)
Definition: giaJf.c:1679
Definition: gia.h:265
Gia_Man_t * Jf_ManPerformMapping(Gia_Man_t *pGia, Jf_Par_t *pPars)
Definition: giaJf.c:1712
int fGenCnf
Definition: gia.h:284
Gia_Man_t* Jf_ManPerformMapping ( Gia_Man_t pGia,
Jf_Par_t pPars 
)

Definition at line 1712 of file giaJf.c.

1713 {
1714  Gia_Man_t * pNew = pGia;
1715  Jf_Man_t * p; int i;
1716  assert( !Gia_ManBufNum(pGia) );
1717  assert( !pPars->fCutMin || !pPars->fFuncDsd || pPars->nLutSize <= 6 );
1718  if ( pPars->fGenCnf )
1719  pPars->fCutMin = 1, pPars->fFuncDsd = 1, pPars->fOptEdge = 0;
1720  if ( pPars->fCutMin && !pPars->fFuncDsd )
1721  pPars->fCoarsen = 0;
1722  p = Jf_ManAlloc( pGia, pPars );
1724  Jf_ManComputeCuts( p, 0 );
1725  Jf_ManComputeRefs( p ); Jf_ManPrintStats( p, "Start" );
1726  for ( i = 0; i < pPars->nRounds; i++ )
1727  {
1728  if ( !p->pPars->fGenCnf )
1729  {
1730  Jf_ManPropagateFlow( p, pPars->fOptEdge ); Jf_ManPrintStats( p, "Flow " );
1731  }
1732  Jf_ManPropagateEla( p, 0 ); Jf_ManPrintStats( p, "Area " );
1733  Jf_ManPropagateEla( p, 1 ); Jf_ManPrintStats( p, "Edge " );
1734  }
1735  if ( p->pPars->fVeryVerbose && p->pPars->fCutMin && !p->pPars->fFuncDsd )
1737  if ( p->pPars->fPureAig )
1738  pNew = Jf_ManDeriveGia(p);
1739  else if ( p->pPars->fCutMin )
1740  pNew = Jf_ManDeriveMappingGia(p);
1741  else
1743  Jf_ManFree( p );
1744  return pNew;
1745 }
int nLutSize
Definition: gia.h:267
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Gia_Man_t * Jf_ManDeriveMappingGia(Jf_Man_t *p)
Definition: giaJf.c:1429
Jf_Par_t * pPars
Definition: giaJf.c:55
static char * Gia_ManName(Gia_Man_t *p)
Definition: gia.h:382
int Jf_ManComputeRefs(Jf_Man_t *p)
Definition: giaJf.c:1306
void Jf_ManPrintStats(Jf_Man_t *p, char *pTitle)
Definition: giaJf.c:1699
void Jf_ManComputeCuts(Jf_Man_t *p, int fEdge)
Definition: giaJf.c:1238
int fAreaOnly
Definition: gia.h:277
int fVeryVerbose
Definition: gia.h:292
Jf_Man_t * Jf_ManAlloc(Gia_Man_t *pGia, Jf_Par_t *pPars)
Definition: giaJf.c:364
int fOptEdge
Definition: gia.h:278
Gia_Man_t * pGia
Definition: giaJf.c:54
float Jf_CutCompareArea(Jf_Cut_t *pOld, Jf_Cut_t *pNew)
Definition: giaJf.c:946
void Jf_ManPropagateFlow(Jf_Man_t *p, int fEdge)
Definition: giaJf.c:1379
void Jf_ManPropagateEla(Jf_Man_t *p, int fEdge)
Definition: giaJf.c:1390
void Jf_ManDeriveMapping(Jf_Man_t *p)
Definition: giaJf.c:1542
static void Vec_MemDumpTruthTables(Vec_Mem_t *p, char *pName, int nLutSize)
Definition: vecMem.h:402
void Jf_ManFree(Jf_Man_t *p)
Definition: giaJf.c:395
int nRounds
Definition: gia.h:270
float(* pCutCmp)(Jf_Cut_t *, Jf_Cut_t *)
Definition: giaJf.c:66
Definition: gia.h:95
static int Gia_ManBufNum(Gia_Man_t *p)
Definition: gia.h:392
int fPureAig
Definition: gia.h:287
int fCutMin
Definition: gia.h:282
Gia_Man_t * Jf_ManDeriveGia(Jf_Man_t *p)
Definition: giaJf.c:1578
int fFuncDsd
Definition: gia.h:283
int fGenCnf
Definition: gia.h:284
#define assert(ex)
Definition: util_old.h:213
float Jf_CutCompareDelay(Jf_Cut_t *pOld, Jf_Cut_t *pNew)
Definition: giaJf.c:939
Vec_Mem_t * vTtMem
Definition: giaJf.c:58
int fCoarsen
Definition: gia.h:281
void Jf_ManSetDefaultPars ( Jf_Par_t pPars)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1679 of file giaJf.c.

1680 {
1681  memset( pPars, 0, sizeof(Jf_Par_t) );
1682  pPars->nLutSize = 6;
1683  pPars->nCutNum = 8;
1684  pPars->nRounds = 1;
1685  pPars->nVerbLimit = 5;
1686  pPars->DelayTarget = -1;
1687  pPars->fAreaOnly = 1;
1688  pPars->fOptEdge = 1;
1689  pPars->fCoarsen = 0;
1690  pPars->fCutMin = 0;
1691  pPars->fFuncDsd = 0;
1692  pPars->fGenCnf = 0;
1693  pPars->fPureAig = 0;
1694  pPars->fVerbose = 0;
1695  pPars->fVeryVerbose = 0;
1696  pPars->nLutSizeMax = JF_LEAF_MAX;
1697  pPars->nCutNumMax = JF_CUT_MAX;
1698 }
char * memset()
int nCutNum
Definition: gia.h:268
int nLutSize
Definition: gia.h:267
#define JF_CUT_MAX
Definition: giaJf.c:38
int nCutNumMax
Definition: gia.h:294
int fAreaOnly
Definition: gia.h:277
int nVerbLimit
Definition: gia.h:275
int fVeryVerbose
Definition: gia.h:292
int fOptEdge
Definition: gia.h:278
Definition: gia.h:265
int nRounds
Definition: gia.h:270
#define JF_LEAF_MAX
DECLARATIONS ///.
Definition: giaJf.c:36
int fPureAig
Definition: gia.h:287
int fCutMin
Definition: gia.h:282
int fFuncDsd
Definition: gia.h:283
int fGenCnf
Definition: gia.h:284
int nLutSizeMax
Definition: gia.h:293
int DelayTarget
Definition: gia.h:276
int fVerbose
Definition: gia.h:291
int fCoarsen
Definition: gia.h:281
Gia_Man_t* Lf_ManPerformMapping ( Gia_Man_t pGia,
Jf_Par_t pPars 
)

Definition at line 2193 of file giaLf.c.

2194 {
2195  Gia_Man_t * pNew;
2196  if ( p->pManTime && Tim_ManBoxNum(p->pManTime) && Gia_ManIsNormalized(p) )
2197  {
2198  Tim_Man_t * pTimOld = (Tim_Man_t *)p->pManTime;
2199  p->pManTime = Tim_ManDup( pTimOld, 1 );
2200  pNew = Gia_ManDupUnnormalize( p );
2201  if ( pNew == NULL )
2202  return NULL;
2203  Gia_ManTransferTiming( pNew, p );
2204  p = pNew;
2205  // mapping
2206  pNew = Lf_ManPerformMappingInt( p, pPars );
2207  if ( pNew != p )
2208  {
2209  Gia_ManTransferTiming( pNew, p );
2210  Gia_ManStop( p );
2211  }
2212  // normalize
2213  pNew = Gia_ManDupNormalize( p = pNew );
2214  Gia_ManTransferMapping( pNew, p );
2215 // Gia_ManTransferPacking( pNew, p );
2216  Gia_ManTransferTiming( pNew, p );
2217  Gia_ManStop( p ); // do not delete if the original one!
2218  // cleanup
2219  Tim_ManStop( (Tim_Man_t *)pNew->pManTime );
2220  pNew->pManTime = pTimOld;
2221  assert( Gia_ManIsNormalized(pNew) );
2222  }
2223  else
2224  {
2225  // mapping
2226  pNew = Lf_ManPerformMappingInt( p, pPars );
2227  Gia_ManTransferTiming( pNew, p );
2228  }
2229  return pNew;
2230 }
Gia_Man_t * Gia_ManDupUnnormalize(Gia_Man_t *p)
Definition: giaTim.c:373
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Gia_Man_t * Gia_ManDupNormalize(Gia_Man_t *p)
Definition: giaTim.c:134
Tim_Man_t * Tim_ManDup(Tim_Man_t *p, int fUnitDelay)
Definition: timMan.c:86
void * pManTime
Definition: gia.h:165
void Tim_ManStop(Tim_Man_t *p)
Definition: timMan.c:375
int Tim_ManBoxNum(Tim_Man_t *p)
Definition: timMan.c:702
void Gia_ManTransferTiming(Gia_Man_t *p, Gia_Man_t *pGia)
Definition: giaIf.c:1912
Gia_Man_t * Lf_ManPerformMappingInt(Gia_Man_t *pGia, Jf_Par_t *pPars)
Definition: giaLf.c:2133
Definition: gia.h:95
int Gia_ManIsNormalized(Gia_Man_t *p)
Definition: giaTim.c:109
void Gia_ManTransferMapping(Gia_Man_t *p, Gia_Man_t *pGia)
Definition: giaIf.c:1855
#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 Lf_ManSetDefaultPars ( Jf_Par_t pPars)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1981 of file giaLf.c.

1982 {
1983  memset( pPars, 0, sizeof(Jf_Par_t) );
1984  pPars->nLutSize = 6;
1985  pPars->nCutNum = 8;
1986  pPars->nProcNum = 0;
1987  pPars->nRounds = 4;
1988  pPars->nRoundsEla = 1;
1989  pPars->nRelaxRatio = 0;
1990  pPars->nCoarseLimit = 3;
1991  pPars->nAreaTuner = 1;
1992  pPars->nVerbLimit = 5;
1993  pPars->DelayTarget = -1;
1994  pPars->fAreaOnly = 0;
1995  pPars->fOptEdge = 1;
1996  pPars->fUseMux7 = 0;
1997  pPars->fPower = 0;
1998  pPars->fCoarsen = 1;
1999  pPars->fCutMin = 0;
2000  pPars->fFuncDsd = 0;
2001  pPars->fGenCnf = 0;
2002  pPars->fPureAig = 0;
2003  pPars->fCutHashing = 0;
2004  pPars->fCutSimple = 0;
2005  pPars->fVerbose = 0;
2006  pPars->fVeryVerbose = 0;
2007  pPars->nLutSizeMax = LF_LEAF_MAX;
2008  pPars->nCutNumMax = LF_CUT_MAX;
2009 }
char * memset()
int nCutNum
Definition: gia.h:268
int nLutSize
Definition: gia.h:267
#define LF_LEAF_MAX
DECLARATIONS ///.
Definition: giaLf.c:33
int nProcNum
Definition: gia.h:269
int nAreaTuner
Definition: gia.h:274
int nCutNumMax
Definition: gia.h:294
int fCutSimple
Definition: gia.h:290
int fAreaOnly
Definition: gia.h:277
int nVerbLimit
Definition: gia.h:275
int fCutHashing
Definition: gia.h:289
int fPower
Definition: gia.h:280
int fVeryVerbose
Definition: gia.h:292
int nRelaxRatio
Definition: gia.h:272
int fOptEdge
Definition: gia.h:278
Definition: gia.h:265
#define LF_CUT_MAX
Definition: giaLf.c:34
int nRounds
Definition: gia.h:270
int fPureAig
Definition: gia.h:287
int fCutMin
Definition: gia.h:282
int fFuncDsd
Definition: gia.h:283
int fGenCnf
Definition: gia.h:284
int nLutSizeMax
Definition: gia.h:293
int nRoundsEla
Definition: gia.h:271
int fUseMux7
Definition: gia.h:279
int DelayTarget
Definition: gia.h:276
int nCoarseLimit
Definition: gia.h:273
int fVerbose
Definition: gia.h:291
int fCoarsen
Definition: gia.h:281
Gia_Man_t* Mf_ManPerformMapping ( Gia_Man_t pGia,
Jf_Par_t pPars 
)

Definition at line 1575 of file giaMf.c.

1576 {
1577  Mf_Man_t * p;
1578  Gia_Man_t * pNew, * pCls;
1579  if ( pPars->fGenCnf )
1580  pPars->fCutMin = 1;
1581  if ( Gia_ManHasChoices(pGia) )
1582  pPars->fCutMin = 1, pPars->fCoarsen = 0;
1583  pCls = pPars->fCoarsen ? Gia_ManDupMuxes(pGia, pPars->nCoarseLimit) : pGia;
1584  p = Mf_ManAlloc( pCls, pPars );
1585  p->pGia0 = pGia;
1586  if ( pPars->fVerbose && pPars->fCoarsen )
1587  {
1588  printf( "Initial " ); Gia_ManPrintMuxStats( pGia ); printf( "\n" );
1589  printf( "Derived " ); Gia_ManPrintMuxStats( pCls ); printf( "\n" );
1590  }
1591  Mf_ManPrintInit( p );
1592  Mf_ManComputeCuts( p );
1593  for ( p->Iter = 1; p->Iter < p->pPars->nRounds; p->Iter++ )
1594  Mf_ManComputeMapping( p );
1595  p->fUseEla = 1;
1596  for ( ; p->Iter < p->pPars->nRounds + pPars->nRoundsEla; p->Iter++ )
1597  Mf_ManComputeMapping( p );
1598  if ( pPars->fVeryVerbose && pPars->fCutMin )
1600  if ( pPars->fCutMin )
1601  pNew = Mf_ManDeriveMappingGia( p );
1602  else if ( pPars->fCoarsen )
1603  pNew = Mf_ManDeriveMappingCoarse( p );
1604  else
1605  pNew = Mf_ManDeriveMapping( p );
1606  if ( p->pPars->fGenCnf )
1607  pGia->pData = Mf_ManDeriveCnf( p, p->pPars->fCnfObjIds, p->pPars->fAddOrCla );
1608 // if ( p->pPars->fGenCnf )
1609 // Mf_ManProfileTruths( p );
1610  Gia_ManMappingVerify( pNew );
1611  Mf_ManPrintQuit( p, pNew );
1612  Mf_ManFree( p );
1613  if ( pCls != pGia )
1614  Gia_ManStop( pCls );
1615  return pNew;
1616 }
void Mf_ManComputeCuts(Mf_Man_t *p)
Definition: giaMf.c:1466
int nLutSize
Definition: gia.h:267
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
Cnf_Dat_t * Mf_ManDeriveCnf(Mf_Man_t *p, int fCnfObjIds, int fAddOrCla)
Definition: giaMf.c:325
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Jf_Par_t * pPars
Definition: giaMf.c:66
Gia_Man_t * pGia
Definition: giaMf.c:65
static char * Gia_ManName(Gia_Man_t *p)
Definition: gia.h:382
Gia_Man_t * Mf_ManDeriveMappingCoarse(Mf_Man_t *p)
Definition: giaMf.c:1191
void Mf_ManFree(Mf_Man_t *p)
Definition: giaMf.c:1354
int fCnfObjIds
Definition: gia.h:285
Gia_Man_t * pGia0
Definition: giaMf.c:64
int fVeryVerbose
Definition: gia.h:292
static int Gia_ManHasChoices(Gia_Man_t *p)
Definition: gia.h:397
void Mf_ManComputeMapping(Mf_Man_t *p)
Definition: giaMf.c:1567
Gia_Man_t * Mf_ManDeriveMappingGia(Mf_Man_t *p)
Definition: giaMf.c:1232
void * pData
Definition: gia.h:169
Gia_Man_t * Gia_ManDupMuxes(Gia_Man_t *p, int Limit)
Definition: giaMuxes.c:96
void Gia_ManMappingVerify(Gia_Man_t *p)
Definition: giaIf.c:1807
static void Vec_MemDumpTruthTables(Vec_Mem_t *p, char *pName, int nLutSize)
Definition: vecMem.h:402
void Mf_ManPrintQuit(Mf_Man_t *p, Gia_Man_t *pNew)
Definition: giaMf.c:1432
void Gia_ManPrintMuxStats(Gia_Man_t *p)
Definition: giaMuxes.c:61
int fUseEla
Definition: giaMf.c:75
int nRounds
Definition: gia.h:270
Mf_Man_t * Mf_ManAlloc(Gia_Man_t *pGia, Jf_Par_t *pPars)
Definition: giaMf.c:1321
Gia_Man_t * Mf_ManDeriveMapping(Mf_Man_t *p)
Definition: giaMf.c:1169
Definition: gia.h:95
int fCutMin
Definition: gia.h:282
int fGenCnf
Definition: gia.h:284
int nRoundsEla
Definition: gia.h:271
void Mf_ManPrintInit(Mf_Man_t *p)
Definition: giaMf.c:1417
int nCoarseLimit
Definition: gia.h:273
int fAddOrCla
Definition: gia.h:286
int fVerbose
Definition: gia.h:291
int fCoarsen
Definition: gia.h:281
Vec_Mem_t * vTtMem
Definition: giaMf.c:70
int Iter
Definition: giaMf.c:74
void Mf_ManSetDefaultPars ( Jf_Par_t pPars)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1380 of file giaMf.c.

1381 {
1382  memset( pPars, 0, sizeof(Jf_Par_t) );
1383  pPars->nLutSize = 6;
1384  pPars->nCutNum = 8;
1385  pPars->nProcNum = 0;
1386  pPars->nRounds = 2;
1387  pPars->nRoundsEla = 1;
1388  pPars->nRelaxRatio = 0;
1389  pPars->nCoarseLimit = 3;
1390  pPars->nAreaTuner = 1;
1391  pPars->nVerbLimit = 5;
1392  pPars->DelayTarget = -1;
1393  pPars->fAreaOnly = 0;
1394  pPars->fOptEdge = 1;
1395  pPars->fCoarsen = 1;
1396  pPars->fCutMin = 0;
1397  pPars->fGenCnf = 0;
1398  pPars->fPureAig = 0;
1399  pPars->fVerbose = 0;
1400  pPars->fVeryVerbose = 0;
1401  pPars->nLutSizeMax = MF_LEAF_MAX;
1402  pPars->nCutNumMax = MF_CUT_MAX;
1403 }
char * memset()
int nCutNum
Definition: gia.h:268
int nLutSize
Definition: gia.h:267
int nProcNum
Definition: gia.h:269
int nAreaTuner
Definition: gia.h:274
int nCutNumMax
Definition: gia.h:294
int fAreaOnly
Definition: gia.h:277
int nVerbLimit
Definition: gia.h:275
int fVeryVerbose
Definition: gia.h:292
int nRelaxRatio
Definition: gia.h:272
int fOptEdge
Definition: gia.h:278
Definition: gia.h:265
#define MF_CUT_MAX
Definition: giaMf.c:35
#define MF_LEAF_MAX
DECLARATIONS ///.
Definition: giaMf.c:34
int nRounds
Definition: gia.h:270
int fPureAig
Definition: gia.h:287
int fCutMin
Definition: gia.h:282
int fGenCnf
Definition: gia.h:284
int nLutSizeMax
Definition: gia.h:293
int nRoundsEla
Definition: gia.h:271
int DelayTarget
Definition: gia.h:276
int nCoarseLimit
Definition: gia.h:273
int fVerbose
Definition: gia.h:291
int fCoarsen
Definition: gia.h:281
int Sat_ManTest ( Gia_Man_t pGia,
Gia_Obj_t pObj,
int  nConfsMax 
)
Tas_Man_t* Tas_ManAlloc ( Gia_Man_t pAig,
int  nBTLimit 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 187 of file giaCTas.c.

188 {
189  Tas_Man_t * p;
190  p = ABC_CALLOC( Tas_Man_t, 1 );
191  Tas_SetDefaultParams( &p->Pars );
192  p->pAig = pAig;
193  p->Pars.nBTLimit = nBTLimit;
194  p->pProp.nSize = p->pJust.nSize = p->pClauses.nSize = 10000;
195  p->pProp.pData = ABC_ALLOC( Gia_Obj_t *, p->pProp.nSize );
196  p->pJust.pData = ABC_ALLOC( Gia_Obj_t *, p->pJust.nSize );
198  p->pClauses.iHead = p->pClauses.iTail = 1;
199  p->vModel = Vec_IntAlloc( 1000 );
200  p->vLevReas = Vec_IntAlloc( 1000 );
201  p->vTemp = Vec_PtrAlloc( 1000 );
202  p->pStore.iCur = 16;
203  p->pStore.nSize = 10000;
204  p->pStore.pData = ABC_ALLOC( int, p->pStore.nSize );
205  p->pWatches = ABC_CALLOC( int, 2 * Gia_ManObjNum(pAig) );
206  p->vWatchLits = Vec_IntAlloc( 100 );
207  p->pActivity = ABC_CALLOC( float, Gia_ManObjNum(pAig) );
208  p->vActiveVars = Vec_IntAlloc( 100 );
209  return p;
210 }
int nSize
Definition: giaCTas.c:69
int * pWatches
Definition: giaCTas.c:95
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Vec_Int_t * vActiveVars
Definition: giaCTas.c:100
Gia_Man_t * pAig
Definition: giaCTas.c:85
Tas_Que_t pProp
Definition: giaCTas.c:86
int iHead
Definition: giaCTas.c:76
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
float * pActivity
Definition: giaCTas.c:99
Definition: gia.h:75
Gia_Obj_t ** pData
Definition: giaCTas.c:79
int iCur
Definition: giaCTas.c:68
Tas_Sto_t pStore
Definition: giaCTas.c:94
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
int * pData
Definition: giaCTas.c:70
int nSize
Definition: giaCTas.c:78
Vec_Int_t * vLevReas
Definition: giaCTas.c:90
void Tas_SetDefaultParams(Tas_Par_t *pPars)
FUNCTION DEFINITIONS ///.
Definition: giaCTas.c:162
Vec_Int_t * vWatchLits
Definition: giaCTas.c:96
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
Tas_Que_t pClauses
Definition: giaCTas.c:88
Tas_Que_t pJust
Definition: giaCTas.c:87
int iTail
Definition: giaCTas.c:77
Vec_Ptr_t * vTemp
Definition: giaCTas.c:92
Vec_Int_t * vModel
Definition: giaCTas.c:91
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
Tas_Par_t Pars
Definition: giaCTas.c:84
void Tas_ManSatPrintStats ( Tas_Man_t p)

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

Synopsis [Prints statistics of the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 1487 of file giaCTas.c.

1488 {
1489  printf( "CO = %8d ", Gia_ManCoNum(p->pAig) );
1490  printf( "AND = %8d ", Gia_ManAndNum(p->pAig) );
1491  printf( "Conf = %6d ", p->Pars.nBTLimit );
1492  printf( "JustMax = %5d ", p->Pars.nJustLimit );
1493  printf( "\n" );
1494  printf( "Unsat calls %6d (%6.2f %%) Ave conf = %8.1f ",
1495  p->nSatUnsat, p->nSatTotal? 100.0*p->nSatUnsat/p->nSatTotal :0.0, p->nSatUnsat? 1.0*p->nConfUnsat/p->nSatUnsat :0.0 );
1496  ABC_PRTP( "Time", p->timeSatUnsat, p->timeTotal );
1497  printf( "Sat calls %6d (%6.2f %%) Ave conf = %8.1f ",
1498  p->nSatSat, p->nSatTotal? 100.0*p->nSatSat/p->nSatTotal :0.0, p->nSatSat? 1.0*p->nConfSat/p->nSatSat : 0.0 );
1499  ABC_PRTP( "Time", p->timeSatSat, p->timeTotal );
1500  printf( "Undef calls %6d (%6.2f %%) Ave conf = %8.1f ",
1501  p->nSatUndec, p->nSatTotal? 100.0*p->nSatUndec/p->nSatTotal :0.0, p->nSatUndec? 1.0*p->nConfUndec/p->nSatUndec : 0.0 );
1502  ABC_PRTP( "Time", p->timeSatUndec, p->timeTotal );
1503  ABC_PRT( "Total time", p->timeTotal );
1504 }
abctime timeSatUndec
Definition: giaCTas.c:113
abctime timeTotal
Definition: giaCTas.c:114
Gia_Man_t * pAig
Definition: giaCTas.c:85
int nSatTotal
Definition: giaCTas.c:105
#define ABC_PRTP(a, t, T)
Definition: abc_global.h:223
int nConfUnsat
Definition: giaCTas.c:107
int nConfSat
Definition: giaCTas.c:108
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
int nSatUnsat
Definition: giaCTas.c:102
int nSatSat
Definition: giaCTas.c:103
abctime timeSatSat
Definition: giaCTas.c:112
abctime timeSatUnsat
Definition: giaCTas.c:111
#define ABC_PRT(a, t)
Definition: abc_global.h:220
int nConfUndec
Definition: giaCTas.c:109
int nSatUndec
Definition: giaCTas.c:104
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
Tas_Par_t Pars
Definition: giaCTas.c:84
int Tas_ManSolve ( Tas_Man_t p,
Gia_Obj_t pObj,
Gia_Obj_t pObj2 
)

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

Synopsis [Looking for a satisfying assignment of the node.]

Description [Assumes that each node has flag pObj->fMark0 set to 0. Returns 1 if unsatisfiable, 0 if satisfiable, and -1 if undecided. The node may be complemented. ]

SideEffects []

SeeAlso []

Definition at line 1366 of file giaCTas.c.

1367 {
1368  int i, Entry, RetValue = 0;
1369  s_Counter2 = 0;
1370  Vec_IntClear( p->vModel );
1371  if ( pObj == Gia_ManConst0(p->pAig) || pObj2 == Gia_ManConst0(p->pAig) || pObj == Gia_Not(pObj2) )
1372  return 1;
1373  if ( pObj == Gia_ManConst1(p->pAig) && (pObj2 == NULL || pObj2 == Gia_ManConst1(p->pAig)) )
1374  return 0;
1375  assert( !p->pProp.iHead && !p->pProp.iTail );
1376  assert( !p->pJust.iHead && !p->pJust.iTail );
1377  assert( p->pClauses.iHead == 1 && p->pClauses.iTail == 1 );
1378  p->Pars.nBTThis = p->Pars.nJustThis = p->Pars.nBTThisNc = 0;
1379  Tas_ManAssign( p, pObj, 0, NULL, NULL );
1380  if ( pObj2 && !Tas_VarIsAssigned(Gia_Regular(pObj2)) )
1381  Tas_ManAssign( p, pObj2, 0, NULL, NULL );
1382  if ( !Tas_ManSolve_rec(p, 0) && !Tas_ManCheckLimits(p) )
1383  Tas_ManSaveModel( p, p->vModel );
1384  else
1385  RetValue = 1;
1386  Tas_ManCancelUntil( p, 0 );
1387  p->pJust.iHead = p->pJust.iTail = 0;
1388  p->pClauses.iHead = p->pClauses.iTail = 1;
1389  // clauses
1390  if ( p->nClauses > 0 )
1391  {
1392  p->pStore.iCur = 16;
1393  Vec_IntForEachEntry( p->vWatchLits, Entry, i )
1394  p->pWatches[Entry] = 0;
1395  Vec_IntClear( p->vWatchLits );
1396  p->nClauses = 0;
1397  }
1398  // activity
1399  Vec_IntForEachEntry( p->vActiveVars, Entry, i )
1400  p->pActivity[Entry] = 0.0;
1401  Vec_IntClear( p->vActiveVars );
1402  // statistics
1403  p->Pars.nBTTotal += p->Pars.nBTThis;
1404  p->Pars.nJustTotal = Abc_MaxInt( p->Pars.nJustTotal, p->Pars.nJustThis );
1405  if ( Tas_ManCheckLimits( p ) )
1406  RetValue = -1;
1407  return RetValue;
1408 }
static Gia_Obj_t * Gia_Regular(Gia_Obj_t *p)
Definition: gia.h:377
static void Tas_ManSaveModel(Tas_Man_t *p, Vec_Int_t *vCex)
Definition: giaCTas.c:285
Gia_Man_t * pAig
Definition: giaCTas.c:85
Tas_Que_t pProp
Definition: giaCTas.c:86
int iHead
Definition: giaCTas.c:76
static void Tas_ManAssign(Tas_Man_t *p, Gia_Obj_t *pObj, int Level, Gia_Obj_t *pRes0, Gia_Obj_t *pRes1)
Definition: giaCTas.c:654
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static Gia_Obj_t * Gia_ManConst1(Gia_Man_t *p)
Definition: gia.h:401
static Gia_Obj_t * Gia_Not(Gia_Obj_t *p)
Definition: gia.h:378
static int Tas_VarIsAssigned(Gia_Obj_t *pVar)
Definition: giaCTas.c:117
int iCur
Definition: giaCTas.c:68
int nClauses
Definition: giaCTas.c:97
Tas_Sto_t pStore
Definition: giaCTas.c:94
if(last==0)
Definition: sparse_int.h:34
int Tas_ManSolve_rec(Tas_Man_t *p, int Level)
Definition: giaCTas.c:1285
Vec_Int_t * vWatchLits
Definition: giaCTas.c:96
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
Tas_Que_t pClauses
Definition: giaCTas.c:88
Tas_Que_t pJust
Definition: giaCTas.c:87
int s_Counter2
Definition: giaCTas.c:639
int iTail
Definition: giaCTas.c:77
#define assert(ex)
Definition: util_old.h:213
static void Tas_ManCancelUntil(Tas_Man_t *p, int iBound)
Definition: giaCTas.c:627
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
static int Tas_ManCheckLimits(Tas_Man_t *p)
Definition: giaCTas.c:269
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
Vec_Int_t * vModel
Definition: giaCTas.c:91
Tas_Par_t Pars
Definition: giaCTas.c:84
int Tas_ManSolveArray ( Tas_Man_t p,
Vec_Ptr_t vObjs 
)

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

Synopsis [Looking for a satisfying assignment of the node.]

Description [Assumes that each node has flag pObj->fMark0 set to 0. Returns 1 if unsatisfiable, 0 if satisfiable, and -1 if undecided. The node may be complemented. ]

SideEffects []

SeeAlso []

Definition at line 1423 of file giaCTas.c.

1424 {
1425  Gia_Obj_t * pObj;
1426  int i, Entry, RetValue = 0;
1427  s_Counter2 = 0;
1428  s_Counter3 = 0;
1429  s_Counter4 = 0;
1430  Vec_IntClear( p->vModel );
1431  Vec_PtrForEachEntry( Gia_Obj_t *, vObjs, pObj, i )
1432  if ( pObj == Gia_ManConst0(p->pAig) )
1433  return 1;
1434  assert( !p->pProp.iHead && !p->pProp.iTail );
1435  assert( !p->pJust.iHead && !p->pJust.iTail );
1436  assert( p->pClauses.iHead == 1 && p->pClauses.iTail == 1 );
1437  p->Pars.nBTThis = p->Pars.nJustThis = p->Pars.nBTThisNc = 0;
1438  Vec_PtrForEachEntry( Gia_Obj_t *, vObjs, pObj, i )
1439  if ( pObj != Gia_ManConst1(p->pAig) && !Tas_VarIsAssigned(Gia_Regular(pObj)) )
1440  Tas_ManAssign( p, pObj, 0, NULL, NULL );
1441  if ( !Tas_ManSolve_rec(p, 0) && !Tas_ManCheckLimits(p) )
1442  Tas_ManSaveModel( p, p->vModel );
1443  else
1444  RetValue = 1;
1445  Tas_ManCancelUntil( p, 0 );
1446  p->pJust.iHead = p->pJust.iTail = 0;
1447  p->pClauses.iHead = p->pClauses.iTail = 1;
1448  // clauses
1449  if ( p->nClauses > 0 )
1450  {
1451  p->pStore.iCur = 16;
1452  Vec_IntForEachEntry( p->vWatchLits, Entry, i )
1453  p->pWatches[Entry] = 0;
1454  Vec_IntClear( p->vWatchLits );
1455  p->nClauses = 0;
1456  }
1457  // activity
1458  Vec_IntForEachEntry( p->vActiveVars, Entry, i )
1459  p->pActivity[Entry] = 0.0;
1460  Vec_IntClear( p->vActiveVars );
1461  // statistics
1462  p->Pars.nBTTotal += p->Pars.nBTThis;
1463  p->Pars.nJustTotal = Abc_MaxInt( p->Pars.nJustTotal, p->Pars.nJustThis );
1464  if ( Tas_ManCheckLimits( p ) )
1465  RetValue = -1;
1466 
1467 // printf( "%d ", Gia_ManObjNum(p->pAig) );
1468 // printf( "%d ", p->Pars.nBTThis );
1469 // printf( "%d ", p->Pars.nJustThis );
1470 // printf( "%d ", s_Counter2 );
1471 // printf( "%d ", s_Counter3 );
1472 // printf( "%d ", s_Counter4 );
1473  return RetValue;
1474 }
static Gia_Obj_t * Gia_Regular(Gia_Obj_t *p)
Definition: gia.h:377
static void Tas_ManSaveModel(Tas_Man_t *p, Vec_Int_t *vCex)
Definition: giaCTas.c:285
static void Tas_ManAssign(Tas_Man_t *p, Gia_Obj_t *pObj, int Level, Gia_Obj_t *pRes0, Gia_Obj_t *pRes1)
Definition: giaCTas.c:654
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
Definition: gia.h:75
static Gia_Obj_t * Gia_ManConst1(Gia_Man_t *p)
Definition: gia.h:401
static int Tas_VarIsAssigned(Gia_Obj_t *pVar)
Definition: giaCTas.c:117
int s_Counter3
Definition: giaCTas.c:640
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
int Tas_ManSolve_rec(Tas_Man_t *p, int Level)
Definition: giaCTas.c:1285
int s_Counter4
Definition: giaCTas.c:641
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
int s_Counter2
Definition: giaCTas.c:639
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void Tas_ManCancelUntil(Tas_Man_t *p, int iBound)
Definition: giaCTas.c:627
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
static int Tas_ManCheckLimits(Tas_Man_t *p)
Definition: giaCTas.c:269
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
Vec_Int_t * vModel
Definition: giaCTas.c:91
Vec_Int_t* Tas_ManSolveMiterNc ( Gia_Man_t pAig,
int  nConfs,
Vec_Str_t **  pvStatus,
int  fVerbose 
)

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

Synopsis [Procedure to test the new SAT solver.]

Description []

SideEffects []

SeeAlso []

Definition at line 1517 of file giaCTas.c.

1518 {
1519  extern void Gia_ManCollectTest( Gia_Man_t * pAig );
1520  extern void Cec_ManSatAddToStore( Vec_Int_t * vCexStore, Vec_Int_t * vCex, int Out );
1521  Tas_Man_t * p;
1522  Vec_Int_t * vCex, * vVisit, * vCexStore;
1523  Vec_Str_t * vStatus;
1524  Gia_Obj_t * pRoot;//, * pRootCopy;
1525 // Gia_Man_t * pAigCopy = Gia_ManDup( pAig ), * pAigTemp;
1526 
1527  int i, status;
1528  abctime clk, clkTotal = Abc_Clock();
1529  assert( Gia_ManRegNum(pAig) == 0 );
1530 // Gia_ManCollectTest( pAig );
1531  // prepare AIG
1532  Gia_ManCreateRefs( pAig );
1533  Gia_ManCleanMark0( pAig );
1534  Gia_ManCleanMark1( pAig );
1535  Gia_ManFillValue( pAig ); // maps nodes into trail ids
1536  Gia_ManCleanPhase( pAig ); // maps nodes into trail ids
1537  // create logic network
1538  p = Tas_ManAlloc( pAig, nConfs );
1539  p->pAig = pAig;
1540  // create resulting data-structures
1541  vStatus = Vec_StrAlloc( Gia_ManPoNum(pAig) );
1542  vCexStore = Vec_IntAlloc( 10000 );
1543  vVisit = Vec_IntAlloc( 100 );
1544  vCex = Tas_ReadModel( p );
1545  // solve for each output
1546  Gia_ManForEachCo( pAig, pRoot, i )
1547  {
1548 // printf( "%d=", i );
1549 
1550  Vec_IntClear( vCex );
1551  if ( Gia_ObjIsConst0(Gia_ObjFanin0(pRoot)) )
1552  {
1553  if ( Gia_ObjFaninC0(pRoot) )
1554  {
1555 // printf( "Constant 1 output of SRM!!!\n" );
1556  Cec_ManSatAddToStore( vCexStore, vCex, i ); // trivial counter-example
1557  Vec_StrPush( vStatus, 0 );
1558  }
1559  else
1560  {
1561 // printf( "Constant 0 output of SRM!!!\n" );
1562  Vec_StrPush( vStatus, 1 );
1563  }
1564  continue;
1565  }
1566  clk = Abc_Clock();
1567 // p->Pars.fUseActive = 1;
1568  p->Pars.fUseHighest = 1;
1569  p->Pars.fUseLowest = 0;
1570  status = Tas_ManSolve( p, Gia_ObjChild0(pRoot), NULL );
1571 // printf( "\n" );
1572 /*
1573  if ( status == -1 )
1574  {
1575  p->Pars.fUseHighest = 0;
1576  p->Pars.fUseLowest = 1;
1577  status = Tas_ManSolve( p, Gia_ObjChild0(pRoot) );
1578  }
1579 */
1580  Vec_StrPush( vStatus, (char)status );
1581  if ( status == -1 )
1582  {
1583 // printf( "Unsolved %d.\n", i );
1584 
1585  p->nSatUndec++;
1586  p->nConfUndec += p->Pars.nBTThis;
1587  Cec_ManSatAddToStore( vCexStore, NULL, i ); // timeout
1588  p->timeSatUndec += Abc_Clock() - clk;
1589  continue;
1590  }
1591 
1592 // pRootCopy = Gia_ManCo( pAigCopy, i );
1593 // pRootCopy->iDiff0 = Gia_ObjId( pAigCopy, pRootCopy );
1594 // pRootCopy->fCompl0 = 0;
1595 
1596  if ( status == 1 )
1597  {
1598  p->nSatUnsat++;
1599  p->nConfUnsat += p->Pars.nBTThis;
1600  p->timeSatUnsat += Abc_Clock() - clk;
1601  continue;
1602  }
1603  p->nSatSat++;
1604  p->nConfSat += p->Pars.nBTThis;
1605 // Gia_SatVerifyPattern( pAig, pRoot, vCex, vVisit );
1606  Cec_ManSatAddToStore( vCexStore, vCex, i );
1607  p->timeSatSat += Abc_Clock() - clk;
1608 
1609 // printf( "%d ", Vec_IntSize(vCex) );
1610  }
1611 // pAigCopy = Gia_ManCleanup( pAigTemp = pAigCopy );
1612 // Gia_ManStop( pAigTemp );
1613 // Gia_DumpAiger( pAigCopy, "test", 0, 2 );
1614 // Gia_ManStop( pAigCopy );
1615 
1616  Vec_IntFree( vVisit );
1617  p->nSatTotal = Gia_ManPoNum(pAig);
1618  p->timeTotal = Abc_Clock() - clkTotal;
1619  if ( fVerbose )
1620  Tas_ManSatPrintStats( p );
1621 // printf( "RecCalls = %8d. RecClause = %8d. RecNonChro = %8d.\n", p->nRecCall, p->nRecClause, p->nRecNonChro );
1622  Tas_ManStop( p );
1623  *pvStatus = vStatus;
1624 
1625 // printf( "Total number of cex literals = %d. (Ave = %d)\n",
1626 // Vec_IntSize(vCexStore)-2*p->nSatUndec-2*p->nSatSat,
1627 // (Vec_IntSize(vCexStore)-2*p->nSatUndec-2*p->nSatSat)/p->nSatSat );
1628  return vCexStore;
1629 }
void Gia_ManCreateRefs(Gia_Man_t *p)
Definition: giaUtil.c:715
void Gia_ManCleanPhase(Gia_Man_t *p)
Definition: giaUtil.c:431
static Gia_Obj_t * Gia_ObjChild0(Gia_Obj_t *pObj)
Definition: gia.h:457
abctime timeSatUndec
Definition: giaCTas.c:113
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
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
abctime timeTotal
Definition: giaCTas.c:114
Gia_Man_t * pAig
Definition: giaCTas.c:85
void Gia_ManCleanMark0(Gia_Man_t *p)
Definition: giaUtil.c:215
static int Gia_ObjIsConst0(Gia_Obj_t *pObj)
Definition: gia.h:430
static Vec_Str_t * Vec_StrAlloc(int nCap)
Definition: bblif.c:495
static abctime Abc_Clock()
Definition: abc_global.h:279
int nSatTotal
Definition: giaCTas.c:105
static void Vec_StrPush(Vec_Str_t *p, char Entry)
Definition: vecStr.h:535
Definition: gia.h:75
void Gia_ManCleanMark1(Gia_Man_t *p)
Definition: giaUtil.c:272
int nConfUnsat
Definition: giaCTas.c:107
int nConfSat
Definition: giaCTas.c:108
void Tas_ManStop(Tas_Man_t *p)
Definition: giaCTas.c:223
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
int nSatUnsat
Definition: giaCTas.c:102
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
int Tas_ManSolve(Tas_Man_t *p, Gia_Obj_t *pObj, Gia_Obj_t *pObj2)
Definition: giaCTas.c:1366
int nSatSat
Definition: giaCTas.c:103
abctime timeSatSat
Definition: giaCTas.c:112
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
abctime timeSatUnsat
Definition: giaCTas.c:111
void Cec_ManSatAddToStore(Vec_Int_t *vCexStore, Vec_Int_t *vCex, int Out)
Definition: cecSolve.c:952
Definition: gia.h:95
int nConfUndec
Definition: giaCTas.c:109
#define assert(ex)
Definition: util_old.h:213
void Gia_ManCollectTest(Gia_Man_t *p)
Definition: giaDfs.c:208
void Tas_ManSatPrintStats(Tas_Man_t *p)
Definition: giaCTas.c:1487
Vec_Int_t * Tas_ReadModel(Tas_Man_t *p)
Definition: giaCTas.c:250
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Tas_Man_t * Tas_ManAlloc(Gia_Man_t *pAig, int nBTLimit)
Definition: giaCTas.c:187
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
ABC_INT64_T abctime
Definition: abc_global.h:278
int nSatUndec
Definition: giaCTas.c:104
Tas_Par_t Pars
Definition: giaCTas.c:84
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
void Tas_ManStop ( Tas_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 223 of file giaCTas.c.

224 {
225  Vec_IntFree( p->vActiveVars );
226  Vec_IntFree( p->vWatchLits );
227  Vec_IntFree( p->vLevReas );
228  Vec_IntFree( p->vModel );
229  Vec_PtrFree( p->vTemp );
230  ABC_FREE( p->pActivity );
231  ABC_FREE( p->pWatches );
232  ABC_FREE( p->pStore.pData );
233  ABC_FREE( p->pClauses.pData );
234  ABC_FREE( p->pProp.pData );
235  ABC_FREE( p->pJust.pData );
236  ABC_FREE( p );
237 }
int * pWatches
Definition: giaCTas.c:95
Vec_Int_t * vActiveVars
Definition: giaCTas.c:100
Tas_Que_t pProp
Definition: giaCTas.c:86
float * pActivity
Definition: giaCTas.c:99
Gia_Obj_t ** pData
Definition: giaCTas.c:79
Tas_Sto_t pStore
Definition: giaCTas.c:94
int * pData
Definition: giaCTas.c:70
Vec_Int_t * vLevReas
Definition: giaCTas.c:90
Vec_Int_t * vWatchLits
Definition: giaCTas.c:96
#define ABC_FREE(obj)
Definition: abc_global.h:232
Tas_Que_t pClauses
Definition: giaCTas.c:88
Tas_Que_t pJust
Definition: giaCTas.c:87
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Vec_Ptr_t * vTemp
Definition: giaCTas.c:92
Vec_Int_t * vModel
Definition: giaCTas.c:91
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Vec_Int_t* Tas_ReadModel ( Tas_Man_t p)

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

Synopsis [Returns satisfying assignment.]

Description []

SideEffects []

SeeAlso []

Definition at line 250 of file giaCTas.c.

251 {
252  return p->vModel;
253 }
Vec_Int_t * vModel
Definition: giaCTas.c:91