ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
gia.h File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "misc/vec/vec.h"
#include "misc/vec/vecWec.h"
#include "misc/util/utilCex.h"
Include dependency graph for gia.h:

Go to the source code of this file.

Classes

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 ///.
 
#define GIA_VOID   0x0FFFFFFF
 
#define GIA_ZER   1
 
#define GIA_ONE   2
 
#define GIA_UND   3
 
#define Gia_ManForEachConst(p, i)
 
#define Gia_ManForEachClass(p, i)
 
#define Gia_ManForEachClass0(p, i)
 
#define Gia_ManForEachClassReverse(p, i)
 
#define Gia_ClassForEachObj(p, i, iObj)
 
#define Gia_ClassForEachObj1(p, i, iObj)
 
#define Gia_ClassForEachObjStart(p, i, iObj, Start)
 
#define Gia_ObjForEachFanoutStatic(p, pObj, pFanout, i)
 
#define Gia_ObjForEachFanoutStaticId(p, Id, FanId, i)
 
#define Gia_ObjForEachFanoutStaticIndex(p, Id, FanId, i, Index)
 
#define Gia_ManForEachLut(p, i)
 
#define Gia_ManForEachLutReverse(p, i)
 
#define Gia_LutForEachFanin(p, i, iFan, k)
 
#define Gia_LutForEachFaninIndex(p, i, iFan, k, Index)
 
#define Gia_LutForEachFaninObj(p, i, pFanin, k)
 
#define Gia_ManForEachLut2(p, i)
 
#define Gia_ManForEachLut2Reverse(p, i)
 
#define Gia_ManForEachLut2Vec(vIds, p, vVec, iObj, i)
 
#define Gia_ManForEachLut2VecReverse(vIds, p, vVec, iObj, i)
 
#define Gia_LutForEachFanin2(p, i, iFan, k)
 
#define Gia_LutForEachFanout2(p, i, iFan, k)
 
#define Gia_ManForEachCell(p, i)
 
#define Gia_CellForEachFanin(p, i, iFanLit, k)
 
#define Gia_ManForEachObj(p, pObj, i)
 MACRO DEFINITIONS ///.
 
#define Gia_ManForEachObj1(p, pObj, i)
 
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
 
#define Gia_ManForEachObjVecStart(vVec, p, pObj, i, Start)
 
#define Gia_ManForEachObjVecStop(vVec, p, pObj, i, Stop)
 
#define Gia_ManForEachObjVecStartStop(vVec, p, pObj, i, Start, Stop)
 
#define Gia_ManForEachObjVecReverse(vVec, p, pObj, i)
 
#define Gia_ManForEachObjVecLit(vVec, p, pObj, fCompl, i)
 
#define Gia_ManForEachObjReverse(p, pObj, i)
 
#define Gia_ManForEachObjReverse1(p, pObj, i)
 
#define Gia_ManForEachBuf(p, pObj, i)
 
#define Gia_ManForEachBufId(p, i)
 
#define Gia_ManForEachAnd(p, pObj, i)
 
#define Gia_ManForEachAndId(p, i)
 
#define Gia_ManForEachMuxId(p, i)
 
#define Gia_ManForEachCand(p, pObj, i)
 
#define Gia_ManForEachAndReverse(p, pObj, i)
 
#define Gia_ManForEachAndReverseId(p, i)
 
#define Gia_ManForEachMux(p, pObj, i)
 
#define Gia_ManForEachCi(p, pObj, i)
 
#define Gia_ManForEachCiId(p, Id, i)
 
#define Gia_ManForEachCiVec(vVec, p, pObj, i)
 
#define Gia_ManForEachCiReverse(p, pObj, i)
 
#define Gia_ManForEachCo(p, pObj, i)
 
#define Gia_ManForEachCoVec(vVec, p, pObj, i)
 
#define Gia_ManForEachCoId(p, Id, i)
 
#define Gia_ManForEachCoReverse(p, pObj, i)
 
#define Gia_ManForEachCoDriver(p, pObj, i)
 
#define Gia_ManForEachCoDriverId(p, DriverId, i)
 
#define Gia_ManForEachPi(p, pObj, i)
 
#define Gia_ManForEachPo(p, pObj, i)
 
#define Gia_ManForEachRo(p, pObj, i)
 
#define Gia_ManForEachRi(p, pObj, i)
 
#define Gia_ManForEachRiRo(p, pObjRi, pObjRo, i)
 
#define Gia_ManForEachRoToRiVec(vRoIds, p, pObj, i)
 
#define Gia_ManForEachObjWithBoxes(p, pObj, i)
 
#define Gia_ManForEachObjReverseWithBoxes(p, pObj, i)
 
#define Gia_ManForEachCiIdWithBoxes(p, Id, i)
 
#define Gia_ManForEachCoWithBoxes(p, pObj, i)
 

Typedefs

typedef struct Gia_MmFixed_t_ Gia_MmFixed_t
 BASIC TYPES ///.
 
typedef struct Gia_MmFlex_t_ Gia_MmFlex_t
 
typedef struct Gia_MmStep_t_ Gia_MmStep_t
 
typedef struct Gia_Dat_t_ Gia_Dat_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 Cbs_Man_t_ Cbs_Man_t
 
typedef struct Gia_ChMan_t_ Gia_ChMan_t
 
typedef struct Gia_ManMin_t_ Gia_ManMin_t
 
typedef struct Gia_Man2Min_t_ Gia_Man2Min_t
 
typedef struct Tas_Man_t_ Tas_Man_t
 
typedef struct Bnd_Man_t_ Bnd_Man_t
 

Functions

void Gia_ObjAddFanout (Gia_Man_t *p, Gia_Obj_t *pObj, Gia_Obj_t *pFanout)
 
void Gia_ManQuantSetSuppAnd (Gia_Man_t *p, Gia_Obj_t *pObj)
 
void Gia_ManBuiltInSimPerform (Gia_Man_t *p, int iObj)
 
int Gia_FileSize (char *pFileName)
 FUNCTION DECLARATIONS ///.
 
Gia_Man_tGia_AigerReadFromMemory (char *pContents, int nFileSize, int fGiaSimple, int fSkipStrash, int fCheck)
 
Gia_Man_tGia_AigerRead (char *pFileName, int fGiaSimple, int fSkipStrash, int fCheck)
 
void Gia_AigerWrite (Gia_Man_t *p, char *pFileName, int fWriteSymbols, int fCompact, int fWriteNewLine)
 
void Gia_AigerWriteS (Gia_Man_t *p, char *pFileName, int fWriteSymbols, int fCompact, int fWriteNewLine, int fSkipComment)
 
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 fStrict, 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 ///.
 
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)
 
Cbs_Man_tCbs_ManAlloc (Gia_Man_t *pGia)
 
void Cbs_ManStop (Cbs_Man_t *p)
 
int Cbs_ManSolve (Cbs_Man_t *p, Gia_Obj_t *pObj)
 
int Cbs_ManSolve2 (Cbs_Man_t *p, Gia_Obj_t *pObj, Gia_Obj_t *pObj2)
 
Vec_Int_tCbs_ManSolveMiterNc (Gia_Man_t *pGia, int nConfs, Vec_Str_t **pvStatus, int f0Proved, int fVerbose)
 
void Cbs_ManSetConflictNum (Cbs_Man_t *p, int Num)
 
Vec_Int_tCbs_ReadModel (Cbs_Man_t *p)
 
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)
 
int Gia_ResubVarNum (Vec_Int_t *vResub)
 FUNCTION DEFINITIONS ///.
 
word Gia_ResubToTruth6 (Vec_Int_t *vResub)
 
int Gia_ManEvalSolutionOne (Gia_Man_t *p, Vec_Wrd_t *vSims, Vec_Wrd_t *vIsfs, Vec_Int_t *vCands, Vec_Int_t *vSet, int nWords, int fVerbose)
 
Vec_Int_tGia_ManDeriveSolutionOne (Gia_Man_t *p, Vec_Wrd_t *vSims, Vec_Wrd_t *vIsfs, Vec_Int_t *vCands, Vec_Int_t *vSet, int nWords, int Type)
 
void Gia_ManCollectCis (Gia_Man_t *p, int *pNodes, int nNodes, Vec_Int_t *vSupp)
 
void Gia_ManCollectAnds_rec (Gia_Man_t *p, int iObj, Vec_Int_t *vNodes)
 
void Gia_ManCollectAnds (Gia_Man_t *p, int *pNodes, int nNodes, Vec_Int_t *vNodes, Vec_Int_t *vLeaves)
 
Vec_Int_tGia_ManCollectAndsAll (Gia_Man_t *p)
 
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_Wec_tGia_ManLevelizeR (Gia_Man_t *p)
 
Vec_Int_tGia_ManOrderReverse (Gia_Man_t *p)
 
void Gia_ManCollectTfi (Gia_Man_t *p, Vec_Int_t *vRoots, Vec_Int_t *vNodes)
 
void Gia_ManCollectTfo (Gia_Man_t *p, Vec_Int_t *vRoots, Vec_Int_t *vNodes)
 
void Gia_ManDupRemapLiterals (Vec_Int_t *vLits, Gia_Man_t *p)
 FUNCTION DEFINITIONS ///.
 
void Gia_ManDupRemapEquiv (Gia_Man_t *pNew, Gia_Man_t *p)
 
Gia_Man_tGia_ManDupOrderDfs (Gia_Man_t *p)
 
Gia_Man_tGia_ManDupOrderDfsChoices (Gia_Man_t *p)
 
Gia_Man_tGia_ManDupOrderDfsReverse (Gia_Man_t *p, int fRevFans, int fRevOuts)
 
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_ManDupNoBuf (Gia_Man_t *p)
 
Gia_Man_tGia_ManDupMap (Gia_Man_t *p, Vec_Int_t *vMap)
 
Gia_Man_tGia_ManDup2 (Gia_Man_t *p1, Gia_Man_t *p2)
 
Gia_Man_tGia_ManDupWithAttributes (Gia_Man_t *p)
 
Gia_Man_tGia_ManDupRemovePis (Gia_Man_t *p, int nRemPis)
 
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_ManDupDfsOnePo (Gia_Man_t *p, int iPo)
 
Gia_Man_tGia_ManDupDfsRehash (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_ManDupMux (int iVar, Gia_Man_t *pCof1, Gia_Man_t *pCof0)
 
Gia_Man_tGia_ManDupBlock (Gia_Man_t *p, int nBlock)
 
Gia_Man_tGia_ManDupExist (Gia_Man_t *p, int iVar)
 
Gia_Man_tGia_ManDupUniv (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_ManDupConeSupp (Gia_Man_t *p, int iLit, Vec_Int_t *vCiIds)
 
int Gia_ManDupConeBack (Gia_Man_t *p, Gia_Man_t *pNew, Vec_Int_t *vCiIds)
 
int Gia_ManDupConeBackObjs (Gia_Man_t *p, Gia_Man_t *pNew, Vec_Int_t *vObjs)
 
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_ManPermuteInputs (Gia_Man_t *p, int nPpis, int nExtra)
 
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_ManMiterInverse (Gia_Man_t *pBot, Gia_Man_t *pTop, int fDualOut, 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 nNewPis, int fGiaSimple, 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_ManTransformMiter2 (Gia_Man_t *p)
 
Gia_Man_tGia_ManTransformToDual (Gia_Man_t *p)
 
Gia_Man_tGia_ManTransformTwoWord2DualOutput (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_ManDupAndCones (Gia_Man_t *p, int *pAnds, int nAnds, int fTrimPis)
 
Gia_Man_tGia_ManDupAndConesLimit (Gia_Man_t *p, int *pAnds, int nAnds, int Level)
 
Gia_Man_tGia_ManDupAndConesLimit2 (Gia_Man_t *p, int *pAnds, int nAnds, int Level)
 
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)
 
Gia_Man_tGia_ManDupDemiter (Gia_Man_t *p, int fVerbose)
 
Gia_Man_tGia_ManDemiterToDual (Gia_Man_t *p)
 
int Gia_ManDemiterDual (Gia_Man_t *p, Gia_Man_t **pp0, Gia_Man_t **pp1)
 
int Gia_ManDemiterTwoWords (Gia_Man_t *p, Gia_Man_t **pp0, Gia_Man_t **pp1)
 
void Gia_ManProdAdderGen (int nArgA, int nArgB, int Seed, int fSigned, int fCla)
 
Gia_ChMan_tGia_ManDupChoicesStart (Gia_Man_t *pGia)
 
void Gia_ManDupChoicesAdd (Gia_ChMan_t *pMan, Gia_Man_t *pGia)
 
Gia_Man_tGia_ManDupChoicesFinish (Gia_ChMan_t *pMan)
 
void Gia_ManEdgeFromArray (Gia_Man_t *p, Vec_Int_t *vArray)
 FUNCTION DEFINITIONS ///.
 
Vec_Int_tGia_ManEdgeToArray (Gia_Man_t *p)
 
void Gia_ManConvertPackingToEdges (Gia_Man_t *p)
 
int Gia_ObjCheckEdge (Gia_Man_t *p, int iObj, int iNext)
 
int Gia_ManEvalEdgeDelay (Gia_Man_t *p)
 
int Gia_ManEvalEdgeCount (Gia_Man_t *p)
 
int Gia_ManComputeEdgeDelay (Gia_Man_t *p, int fUseTwo)
 
int Gia_ManComputeEdgeDelay2 (Gia_Man_t *p)
 
void Gia_ManUpdateMapping (Gia_Man_t *p, Vec_Int_t *vNodes, Vec_Wec_t *vWin)
 
int Gia_ManEvalWindow (Gia_Man_t *p, Vec_Int_t *vLeaves, Vec_Int_t *vNodes, Vec_Wec_t *vWin, Vec_Int_t *vTemp, int fUseTwo)
 
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_ManOrigIdsInit (Gia_Man_t *p)
 DECLARATIONS ///.
 
void Gia_ManOrigIdsStart (Gia_Man_t *p)
 
void Gia_ManOrigIdsRemap (Gia_Man_t *p, Gia_Man_t *pNew)
 
Gia_Man_tGia_ManOrigIdsReduce (Gia_Man_t *p, Vec_Int_t *vPairs)
 
Gia_Man_tGia_ManComputeGiaEquivs (Gia_Man_t *pGia, int nConfs, int fVerbose)
 
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)
 
void Gia_ManDeriveReprsFromSibls (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_ManQuantSetSuppStart (Gia_Man_t *p)
 
void Gia_ManQuantSetSuppZero (Gia_Man_t *p)
 
void Gia_ManQuantSetSuppCi (Gia_Man_t *p, Gia_Obj_t *pObj)
 
void Gia_ManQuantUpdateCiSupp (Gia_Man_t *p, int iObj)
 
int Gia_ManQuantExist (Gia_Man_t *p, int iLit, int(*pFuncCiToKeep)(void *, int), void *pData)
 
void Gia_ObjRemoveFanout (Gia_Man_t *p, Gia_Obj_t *pObj, Gia_Obj_t *pFanout)
 
void Gia_ManFanoutStart (Gia_Man_t *p)
 FUNCTION DEFINITIONS ///.
 
void Gia_ManFanoutStop (Gia_Man_t *p)
 
void Gia_ManStaticFanoutStart (Gia_Man_t *p)
 
void Gia_ManStaticFanoutStop (Gia_Man_t *p)
 
void Gia_ManStaticMappingFanoutStart (Gia_Man_t *p, Vec_Int_t **pvIndex)
 
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_ManHashLookupInt (Gia_Man_t *p, int iLit0, int iLit1)
 
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)
 
int Gia_ManHashAndMulti2 (Gia_Man_t *p, Vec_Int_t *vLits)
 
int Gia_ManHashDualMiter (Gia_Man_t *p, Vec_Int_t *vOuts)
 
void Gia_ManPrintOutputLutStats (Gia_Man_t *p)
 
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, int **ppLevels)
 
void Gia_ManLutParams (Gia_Man_t *p, int *pnCurLuts, int *pnCurEdges, int *pnCurLevels)
 
void Gia_ManSetRefsMapped (Gia_Man_t *p)
 
void Gia_ManSetLutRefs (Gia_Man_t *p)
 
void Gia_ManSetIfParsDefault (void *pIfPars)
 FUNCTION DEFINITIONS ///.
 
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)
 
Gia_Man_tGia_ManDupHashMapping (Gia_Man_t *p)
 
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)
 FUNCTION DEFINITIONS ///.
 
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)
 
void Gia_ManDumpVerilog (Gia_Man_t *p, char *pFileName, Vec_Int_t *vObjs, int fVerBufs, int fInter, int fInterComb, int fAssign, int fReverse)
 
void Gia_ManDumpVerilogNand (Gia_Man_t *p, char *pFileName)
 
Gia_MmFixed_tGia_MmFixedStart (int nEntrySize, int nEntriesMax)
 FUNCTION DEFINITIONS ///.
 
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)
 
void * Mf_ManGenerateCnf (Gia_Man_t *pGia, int nLutSize, int fCnfObjIds, int fAddOrCla, int fMapping, int fVerbose)
 
Gia_Man_tGia_ManReadMiniAig (char *pFileName, int fGiaSimple)
 
void Gia_ManWriteMiniAig (Gia_Man_t *pGia, char *pFileName)
 
Gia_Man_tGia_ManReadMiniLut (char *pFileName)
 
void Gia_ManWriteMiniLut (Gia_Man_t *pGia, char *pFileName)
 
wordGia_ManCountFraction (Gia_Man_t *p, Vec_Wrd_t *vSimI, Vec_Int_t *vSupp, int Thresh, int fVerbose, int *pCare)
 
Vec_Int_tGia_ManCollectSuppNew (Gia_Man_t *p, int iOut, int nOuts)
 
void Gia_ManCountMuxXor (Gia_Man_t *p, int *pnMuxes, int *pnXors)
 DECLARATIONS ///.
 
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, int fSkipBufs)
 
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)
 
void Gia_ManShow (Gia_Man_t *pMan, Vec_Int_t *vBold, int fAdders, int fFadds, int fPath)
 
Gia_Man_tGia_ManMapShrink4 (Gia_Man_t *p, int fKeepLevel, int fVerbose)
 FUNCTION DEFINITIONS ///.
 
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)
 
void Gia_ManBuiltInSimStart (Gia_Man_t *p, int nWords, int nObjs)
 
int Gia_ManBuiltInSimCheckOver (Gia_Man_t *p, int iLit0, int iLit1)
 
int Gia_ManBuiltInSimCheckEqual (Gia_Man_t *p, int iLit0, int iLit1)
 
void Gia_ManBuiltInSimResimulateCone (Gia_Man_t *p, int iLit0, int iLit1)
 
void Gia_ManBuiltInSimResimulate (Gia_Man_t *p)
 
int Gia_ManBuiltInSimAddPat (Gia_Man_t *p, Vec_Int_t *vPat)
 
void Gia_ManIncrSimStart (Gia_Man_t *p, int nWords, int nObjs)
 
void Gia_ManIncrSimSet (Gia_Man_t *p, Vec_Int_t *vObjLits)
 
int Gia_ManIncrSimCheckOver (Gia_Man_t *p, int iLit0, int iLit1)
 
int Gia_ManIncrSimCheckEqual (Gia_Man_t *p, int iLit0, int iLit1)
 
Vec_Wrd_tGia_ManSimPatSim (Gia_Man_t *p)
 
Vec_Wrd_tGia_ManSimPatSimOut (Gia_Man_t *pGia, Vec_Wrd_t *vSimsPi, int fOuts)
 
void Gia_ManSim2ArrayOne (Vec_Wrd_t *vSimsPi, Vec_Int_t *vRes)
 
Vec_Wec_tGia_ManSim2Array (Vec_Ptr_t *vSims)
 
Vec_Wrd_tGia_ManArray2SimOne (Vec_Int_t *vRes)
 
Vec_Ptr_tGia_ManArray2Sim (Vec_Wec_t *vRes)
 
void Gia_ManPtrWrdDumpBin (char *pFileName, Vec_Ptr_t *p, int fVerbose)
 
Vec_Ptr_tGia_ManPtrWrdReadBin (char *pFileName, int fVerbose)
 
Vec_Str_tGia_ManComputeRange (Gia_Man_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_ManComputeOneWinStart (Gia_Man_t *p, int nAnds, int fReverse)
 
int Gia_ManComputeOneWin (Gia_Man_t *p, int iPivot, Vec_Int_t **pvRoots, Vec_Int_t **pvNodes, Vec_Int_t **pvLeaves, Vec_Int_t **pvAnds)
 
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_ManMin_tGia_ManSuppStart (Gia_Man_t *pGia)
 DECLARATIONS ///.
 
void Gia_ManSuppStop (Gia_ManMin_t *p)
 
int Gia_ManSupportAnd (Gia_ManMin_t *p, int iLit0, int iLit1)
 
Gia_Man2Min_tGia_Man2SuppStart (Gia_Man_t *pGia)
 
void Gia_Man2SuppStop (Gia_Man2Min_t *p)
 
int Gia_Man2SupportAnd (Gia_Man2Min_t *p, int iLit0, int iLit1)
 
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, int fVerbEquivs)
 
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_Int_tGia_ManComputeSwitchProbs2 (Gia_Man_t *pGia, int nFrames, int nPref, int fProbOne, int nRandPiFactor)
 
Vec_Flt_tGia_ManPrintOutputProb (Gia_Man_t *p)
 
int Gia_ManBoxNum (Gia_Man_t *p)
 DECLARATIONS ///.
 
int Gia_ManRegBoxNum (Gia_Man_t *p)
 
int Gia_ManNonRegBoxNum (Gia_Man_t *p)
 
int Gia_ManBlackBoxNum (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)
 
Vec_Int_tGia_ManOrderWithBoxes (Gia_Man_t *p)
 
Gia_Man_tGia_ManDupNormalize (Gia_Man_t *p, int fHashMapping)
 
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 fDumpFiles, int fVerbose, char *pFileSpec)
 
word Gia_LutComputeTruth6 (Gia_Man_t *p, int iObj, Vec_Wrd_t *vTruths)
 
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)
 
word Gia_ObjComputeTruth6Cis (Gia_Man_t *p, int iLit, Vec_Int_t *vSupp, Vec_Wrd_t *vTemp)
 
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 ///.
 
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)
 
Vec_Ptr_tGia_GetFakeNames (int nNames, int fCaps)
 
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)
 
int Gia_ManLevelRNum (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)
 
void Gia_ManCreateLitRefs (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_NodeMffcSizeMark (Gia_Man_t *p, Gia_Obj_t *pNode)
 
int Gia_NodeMffcSizeSupp (Gia_Man_t *p, Gia_Obj_t *pNode, Vec_Int_t *vSupp)
 
int Gia_NodeMffcMapping (Gia_Man_t *p)
 
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_ManPrintConeMulti (Gia_Man_t *p, Vec_Int_t *vObjs, Vec_Int_t *vLeaves, 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)
 
int Gia_ManCheckSuppOverlap (Gia_Man_t *p, int iNode1, int iNode2)
 
int Gia_ManCountPisWithFanout (Gia_Man_t *p)
 
int Gia_ManCountPosWithNonZeroDrivers (Gia_Man_t *p)
 
void Gia_ManUpdateCopy (Vec_Int_t *vCopy, Gia_Man_t *p)
 
Vec_Int_tGia_ManComputeDistance (Gia_Man_t *p, int iObj, Vec_Int_t *vObjs, int fVerbose)
 
Gia_Man_tGia_ManTtopt (Gia_Man_t *p, int nIns, int nOuts, int nRounds)
 
Gia_Man_tGia_ManTtoptCare (Gia_Man_t *p, int nIns, int nOuts, int nRounds, char *pFileName, int nRarity)
 
Gia_Man_tGia_ManTransductionBdd (Gia_Man_t *pGia, int nType, int fMspf, int nRandom, int nSortType, int nPiShuffle, int nParameter, int fLevel, Gia_Man_t *pExdc, int fNewLine, int nVerbose)
 
Gia_Man_tGia_ManTransductionTt (Gia_Man_t *pGia, int nType, int fMspf, int nRandom, int nSortType, int nPiShuffle, int nParameter, int fLevel, Gia_Man_t *pExdc, int fNewLine, int nVerbose)
 
Gia_Man_tGia_ManRrr (Gia_Man_t *pGia, int iSeed, int nWords, int nTimeout, int nSchedulerVerbose, int nPartitionerVerbose, int nOptimizerVerbose, int nAnalyzerVerbose, int nSimulatorVerbose, int nSatSolverVerbose, int fUseBddCspf, int fUseBddMspf, int nConflictLimit, int nSortType, int nOptimizerFlow, int nSchedulerFlow, int nPartitionType, int nDistance, int nJobs, int nThreads, int nPartitionSize, int nPartitionSizeMin, int fDeterministic, int nParallelPartitions, int fOptOnInsert, int fGreedy)
 
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)
 
Bnd_Man_tBnd_ManStart (Gia_Man_t *pSpec, Gia_Man_t *pImpl, int fVerbose)
 
void Bnd_ManStop ()
 
int Bnd_ManGetNInternal ()
 
int Bnd_ManGetNExtra ()
 
void Bnd_ManMap (int iLit, int id, int spec)
 
void Bnd_ManMerge (int id1, int id2, int phaseDiff)
 
void Bnd_ManFinalizeMappings ()
 
void Bnd_ManPrintMappings ()
 
Gia_Man_tBnd_ManStackGias (Gia_Man_t *pSpec, Gia_Man_t *pImpl)
 
int Bnd_ManCheckCoMerged (Gia_Man_t *p)
 
int Bnd_ManCheckBound (Gia_Man_t *p, int fVerbose)
 
void Bnd_ManFindBound (Gia_Man_t *p, Gia_Man_t *pImpl)
 
Gia_Man_tBnd_ManGenSpecOut (Gia_Man_t *p)
 
Gia_Man_tBnd_ManGenImplOut (Gia_Man_t *p)
 
Gia_Man_tBnd_ManGenPatched (Gia_Man_t *pOut, Gia_Man_t *pSpec, Gia_Man_t *pPatch)
 
Gia_Man_tBnd_ManGenPatched1 (Gia_Man_t *pOut, Gia_Man_t *pSpec)
 
Gia_Man_tBnd_ManGenPatched2 (Gia_Man_t *pImpl, Gia_Man_t *pPatch, int fSkiptStrash, int fVerbose)
 
void Bnd_ManSetEqOut (int eq)
 FUNCTION DEFINITIONS ///.
 
void Bnd_ManSetEqRes (int eq)
 
void Bnd_ManPrintStats ()
 
Gia_Man_tBnd_ManCutBoundary (Gia_Man_t *p, Vec_Int_t *vEI, Vec_Int_t *vEO, Vec_Bit_t *vEI_phase, Vec_Bit_t *vEO_phase)
 
int Gia_ObjCheckMffc (Gia_Man_t *p, Gia_Obj_t *pRoot, int Limit, Vec_Int_t *vNodes, Vec_Int_t *vLeaves, Vec_Int_t *vInners)
 

Macro Definition Documentation

◆ Gia_CellForEachFanin

#define Gia_CellForEachFanin ( p,
i,
iFanLit,
k )
Value:
for ( k = 0; k < Gia_ObjCellSize(p,i) && ((iFanLit = Gia_ObjCellFanins(p,i)[k]),1); k++ )
Cube * p
Definition exorList.c:222

Definition at line 1183 of file gia.h.

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

◆ Gia_ClassForEachObj

#define Gia_ClassForEachObj ( p,
i,
iObj )
Value:
for ( assert(Gia_ObjIsHead(p, i) && i), iObj = i; iObj > 0; iObj = Gia_ObjNext(p, iObj) )
#define assert(ex)
Definition util_old.h:213

Definition at line 1107 of file gia.h.

1107#define Gia_ClassForEachObj( p, i, iObj ) \
1108 for ( assert(Gia_ObjIsHead(p, i) && i), iObj = i; iObj > 0; iObj = Gia_ObjNext(p, iObj) )

◆ Gia_ClassForEachObj1

#define Gia_ClassForEachObj1 ( p,
i,
iObj )
Value:
for ( assert(Gia_ObjIsHead(p, i)), iObj = Gia_ObjNext(p, i); iObj > 0; iObj = Gia_ObjNext(p, iObj) )

Definition at line 1109 of file gia.h.

1109#define Gia_ClassForEachObj1( p, i, iObj ) \
1110 for ( assert(Gia_ObjIsHead(p, i)), iObj = Gia_ObjNext(p, i); iObj > 0; iObj = Gia_ObjNext(p, iObj) )

◆ Gia_ClassForEachObjStart

#define Gia_ClassForEachObjStart ( p,
i,
iObj,
Start )
Value:
for ( assert(Gia_ObjIsHead(p, i)), iObj = Gia_ObjNext(p, Start); iObj > 0; iObj = Gia_ObjNext(p, iObj) )

Definition at line 1111 of file gia.h.

1111#define Gia_ClassForEachObjStart( p, i, iObj, Start ) \
1112 for ( assert(Gia_ObjIsHead(p, i)), iObj = Gia_ObjNext(p, Start); iObj > 0; iObj = Gia_ObjNext(p, iObj) )

◆ Gia_LutForEachFanin

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

Definition at line 1161 of file gia.h.

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

◆ Gia_LutForEachFanin2

#define Gia_LutForEachFanin2 ( p,
i,
iFan,
k )
Value:
for ( k = 0; k < Gia_ObjLutSize2(p,i) && ((iFan = Gia_ObjLutFanin2(p,i,k)),1); k++ )

Definition at line 1176 of file gia.h.

1176#define Gia_LutForEachFanin2( p, i, iFan, k ) \
1177 for ( k = 0; k < Gia_ObjLutSize2(p,i) && ((iFan = Gia_ObjLutFanin2(p,i,k)),1); k++ )

◆ Gia_LutForEachFaninIndex

#define Gia_LutForEachFaninIndex ( p,
i,
iFan,
k,
Index )
Value:
for ( k = 0; k < Gia_ObjLutSize(p,i) && (Index = Vec_IntEntry(p->vMapping, i)+1+k) && ((iFan = Vec_IntEntry(p->vMapping, Index)),1); k++ )

Definition at line 1163 of file gia.h.

1163#define Gia_LutForEachFaninIndex( p, i, iFan, k, Index ) \
1164 for ( k = 0; k < Gia_ObjLutSize(p,i) && (Index = Vec_IntEntry(p->vMapping, i)+1+k) && ((iFan = Vec_IntEntry(p->vMapping, Index)),1); k++ )

◆ Gia_LutForEachFaninObj

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

Definition at line 1165 of file gia.h.

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

◆ Gia_LutForEachFanout2

#define Gia_LutForEachFanout2 ( p,
i,
iFan,
k )
Value:
for ( k = 0; k < Gia_ObjLutFanoutNum2(p,i) && ((iFan = Gia_ObjLutFanout2(p,i,k)),1); k++ )

Definition at line 1178 of file gia.h.

1178#define Gia_LutForEachFanout2( p, i, iFan, k ) \
1179 for ( k = 0; k < Gia_ObjLutFanoutNum2(p,i) && ((iFan = Gia_ObjLutFanout2(p,i,k)),1); k++ )

◆ Gia_ManForEachAnd

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

Definition at line 1214 of file gia.h.

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

◆ Gia_ManForEachAndId

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

Definition at line 1216 of file gia.h.

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

◆ Gia_ManForEachAndReverse

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

Definition at line 1222 of file gia.h.

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

◆ Gia_ManForEachAndReverseId

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

Definition at line 1224 of file gia.h.

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

◆ Gia_ManForEachBuf

#define Gia_ManForEachBuf ( p,
pObj,
i )
Value:
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 1210 of file gia.h.

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

◆ Gia_ManForEachBufId

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

Definition at line 1212 of file gia.h.

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

◆ Gia_ManForEachCand

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

Definition at line 1220 of file gia.h.

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

◆ Gia_ManForEachCell

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

Definition at line 1181 of file gia.h.

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

◆ Gia_ManForEachCi

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

Definition at line 1228 of file gia.h.

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

◆ Gia_ManForEachCiId

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

Definition at line 1230 of file gia.h.

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

◆ Gia_ManForEachCiIdWithBoxes

#define Gia_ManForEachCiIdWithBoxes ( p,
Id,
i )
Value:
for ( i = 0; (i < p->iFirstNonPiId) && ((Id) = Gia_ObjId(p, Gia_ManCi(p, i))); i++ )

Definition at line 1265 of file gia.h.

1265#define Gia_ManForEachCiIdWithBoxes( p, Id, i ) \
1266 for ( i = 0; (i < p->iFirstNonPiId) && ((Id) = Gia_ObjId(p, Gia_ManCi(p, i))); i++ )

◆ Gia_ManForEachCiReverse

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

Definition at line 1234 of file gia.h.

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

◆ Gia_ManForEachCiVec

#define Gia_ManForEachCiVec ( vVec,
p,
pObj,
i )
Value:
for ( i = 0; (i < Vec_IntSize(vVec)) && ((pObj) = Gia_ManCi(p, Vec_IntEntry(vVec,i))); i++ )

Definition at line 1232 of file gia.h.

1232#define Gia_ManForEachCiVec( vVec, p, pObj, i ) \
1233 for ( i = 0; (i < Vec_IntSize(vVec)) && ((pObj) = Gia_ManCi(p, Vec_IntEntry(vVec,i))); i++ )

◆ Gia_ManForEachClass

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

Definition at line 1101 of file gia.h.

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

◆ Gia_ManForEachClass0

#define Gia_ManForEachClass0 ( p,
i )
Value:
for ( i = 0; i < Gia_ManObjNum(p); i++ ) if ( !Gia_ObjIsHead(p, i) ) {} else

Definition at line 1103 of file gia.h.

1103#define Gia_ManForEachClass0( p, i ) \
1104 for ( i = 0; i < Gia_ManObjNum(p); i++ ) if ( !Gia_ObjIsHead(p, i) ) {} else

◆ Gia_ManForEachClassReverse

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

Definition at line 1105 of file gia.h.

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

◆ Gia_ManForEachCo

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

Definition at line 1236 of file gia.h.

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

◆ Gia_ManForEachCoDriver

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

Definition at line 1244 of file gia.h.

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

◆ Gia_ManForEachCoDriverId

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

Definition at line 1246 of file gia.h.

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

◆ Gia_ManForEachCoId

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

Definition at line 1240 of file gia.h.

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

◆ Gia_ManForEachConst

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

Definition at line 1099 of file gia.h.

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

◆ Gia_ManForEachCoReverse

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

Definition at line 1242 of file gia.h.

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

◆ Gia_ManForEachCoVec

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

Definition at line 1238 of file gia.h.

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

◆ Gia_ManForEachCoWithBoxes

#define Gia_ManForEachCoWithBoxes ( p,
pObj,
i )
Value:
for ( i = p->iFirstPoId; (i < Vec_IntSize(p->vCos)) && ((pObj) = Gia_ManCo(p, i)); i++ )

Definition at line 1267 of file gia.h.

1267#define Gia_ManForEachCoWithBoxes( p, pObj, i ) \
1268 for ( i = p->iFirstPoId; (i < Vec_IntSize(p->vCos)) && ((pObj) = Gia_ManCo(p, i)); i++ )

◆ Gia_ManForEachLut

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

Definition at line 1157 of file gia.h.

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

◆ Gia_ManForEachLut2

#define Gia_ManForEachLut2 ( p,
i )
Value:
for ( i = 1; i < Gia_ManObjNum(p); i++ ) if ( !Gia_ObjIsLut2(p, i) ) {} else

Definition at line 1168 of file gia.h.

1168#define Gia_ManForEachLut2( p, i ) \
1169 for ( i = 1; i < Gia_ManObjNum(p); i++ ) if ( !Gia_ObjIsLut2(p, i) ) {} else

◆ Gia_ManForEachLut2Reverse

#define Gia_ManForEachLut2Reverse ( p,
i )
Value:
for ( i = Gia_ManObjNum(p) - 1; i > 0; i-- ) if ( !Gia_ObjIsLut2(p, i) ) {} else

Definition at line 1170 of file gia.h.

1170#define Gia_ManForEachLut2Reverse( p, i ) \
1171 for ( i = Gia_ManObjNum(p) - 1; i > 0; i-- ) if ( !Gia_ObjIsLut2(p, i) ) {} else

◆ Gia_ManForEachLut2Vec

#define Gia_ManForEachLut2Vec ( vIds,
p,
vVec,
iObj,
i )
Value:
for ( i = 0; i < Vec_IntSize(vIds) && (vVec = Vec_WecEntry(p->vMapping2, (iObj = Vec_IntEntry(vIds, i)))); i++ )

Definition at line 1172 of file gia.h.

1172#define Gia_ManForEachLut2Vec( vIds, p, vVec, iObj, i ) \
1173 for ( i = 0; i < Vec_IntSize(vIds) && (vVec = Vec_WecEntry(p->vMapping2, (iObj = Vec_IntEntry(vIds, i)))); i++ )

◆ Gia_ManForEachLut2VecReverse

#define Gia_ManForEachLut2VecReverse ( vIds,
p,
vVec,
iObj,
i )
Value:
for ( i = Vec_IntSize(vIds)-1; i >= 0 && (vVec = Vec_WecEntry(p->vMapping2, (iObj = Vec_IntEntry(vIds, i)))); i-- )

Definition at line 1174 of file gia.h.

1174#define Gia_ManForEachLut2VecReverse( vIds, p, vVec, iObj, i ) \
1175 for ( i = Vec_IntSize(vIds)-1; i >= 0 && (vVec = Vec_WecEntry(p->vMapping2, (iObj = Vec_IntEntry(vIds, i)))); i-- )

◆ Gia_ManForEachLutReverse

#define Gia_ManForEachLutReverse ( p,
i )
Value:
for ( i = Gia_ManObjNum(p) - 1; i > 0; i-- ) if ( !Gia_ObjIsLut(p, i) ) {} else

Definition at line 1159 of file gia.h.

1159#define Gia_ManForEachLutReverse( p, i ) \
1160 for ( i = Gia_ManObjNum(p) - 1; i > 0; i-- ) if ( !Gia_ObjIsLut(p, i) ) {} else

◆ Gia_ManForEachMux

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

Definition at line 1226 of file gia.h.

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

◆ Gia_ManForEachMuxId

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

Definition at line 1218 of file gia.h.

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

◆ Gia_ManForEachObj

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

MACRO DEFINITIONS ///.

Definition at line 1190 of file gia.h.

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

◆ Gia_ManForEachObj1

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

Definition at line 1192 of file gia.h.

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

◆ Gia_ManForEachObjReverse

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

Definition at line 1206 of file gia.h.

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

◆ Gia_ManForEachObjReverse1

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

Definition at line 1208 of file gia.h.

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

◆ Gia_ManForEachObjReverseWithBoxes

#define Gia_ManForEachObjReverseWithBoxes ( p,
pObj,
i )
Value:
for ( i = p->iFirstPoObj - 1; (i >= p->iFirstAndObj) && ((pObj) = Gia_ManObj(p, i)); i-- )

Definition at line 1263 of file gia.h.

1263#define Gia_ManForEachObjReverseWithBoxes( p, pObj, i ) \
1264 for ( i = p->iFirstPoObj - 1; (i >= p->iFirstAndObj) && ((pObj) = Gia_ManObj(p, i)); i-- )

◆ Gia_ManForEachObjVec

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

Definition at line 1194 of file gia.h.

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

◆ Gia_ManForEachObjVecLit

#define Gia_ManForEachObjVecLit ( vVec,
p,
pObj,
fCompl,
i )
Value:
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 1204 of file gia.h.

1204#define Gia_ManForEachObjVecLit( vVec, p, pObj, fCompl, i ) \
1205 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++ )

◆ Gia_ManForEachObjVecReverse

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

Definition at line 1202 of file gia.h.

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

◆ Gia_ManForEachObjVecStart

#define Gia_ManForEachObjVecStart ( vVec,
p,
pObj,
i,
Start )
Value:
for ( i = Start; (i < Vec_IntSize(vVec)) && ((pObj) = Gia_ManObj(p, Vec_IntEntry(vVec,i))); i++ )

Definition at line 1196 of file gia.h.

1196#define Gia_ManForEachObjVecStart( vVec, p, pObj, i, Start ) \
1197 for ( i = Start; (i < Vec_IntSize(vVec)) && ((pObj) = Gia_ManObj(p, Vec_IntEntry(vVec,i))); i++ )

◆ Gia_ManForEachObjVecStartStop

#define Gia_ManForEachObjVecStartStop ( vVec,
p,
pObj,
i,
Start,
Stop )
Value:
for ( i = Start; (i < Stop) && ((pObj) = Gia_ManObj(p, Vec_IntEntry(vVec,i))); i++ )

Definition at line 1200 of file gia.h.

1200#define Gia_ManForEachObjVecStartStop( vVec, p, pObj, i, Start, Stop ) \
1201 for ( i = Start; (i < Stop) && ((pObj) = Gia_ManObj(p, Vec_IntEntry(vVec,i))); i++ )

◆ Gia_ManForEachObjVecStop

#define Gia_ManForEachObjVecStop ( vVec,
p,
pObj,
i,
Stop )
Value:
for ( i = 0; (i < Stop) && ((pObj) = Gia_ManObj(p, Vec_IntEntry(vVec,i))); i++ )

Definition at line 1198 of file gia.h.

1198#define Gia_ManForEachObjVecStop( vVec, p, pObj, i, Stop ) \
1199 for ( i = 0; (i < Stop) && ((pObj) = Gia_ManObj(p, Vec_IntEntry(vVec,i))); i++ )

◆ Gia_ManForEachObjWithBoxes

#define Gia_ManForEachObjWithBoxes ( p,
pObj,
i )
Value:
for ( i = p->iFirstAndObj; (i < p->iFirstPoObj) && ((pObj) = Gia_ManObj(p, i)); i++ )

Definition at line 1261 of file gia.h.

1261#define Gia_ManForEachObjWithBoxes( p, pObj, i ) \
1262 for ( i = p->iFirstAndObj; (i < p->iFirstPoObj) && ((pObj) = Gia_ManObj(p, i)); i++ )

◆ Gia_ManForEachPi

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

Definition at line 1248 of file gia.h.

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

◆ Gia_ManForEachPo

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

Definition at line 1250 of file gia.h.

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

◆ Gia_ManForEachRi

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

Definition at line 1254 of file gia.h.

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

◆ Gia_ManForEachRiRo

#define Gia_ManForEachRiRo ( p,
pObjRi,
pObjRo,
i )
Value:
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 1256 of file gia.h.

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

◆ Gia_ManForEachRo

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

Definition at line 1252 of file gia.h.

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

◆ Gia_ManForEachRoToRiVec

#define Gia_ManForEachRoToRiVec ( vRoIds,
p,
pObj,
i )
Value:
for ( i = 0; (i < Vec_IntSize(vRoIds)) && ((pObj) = Gia_ObjRoToRi(p, Gia_ManObj(p, Vec_IntEntry(vRoIds, i)))); i++ )

Definition at line 1258 of file gia.h.

1258#define Gia_ManForEachRoToRiVec( vRoIds, p, pObj, i ) \
1259 for ( i = 0; (i < Vec_IntSize(vRoIds)) && ((pObj) = Gia_ObjRoToRi(p, Gia_ManObj(p, Vec_IntEntry(vRoIds, i)))); i++ )

◆ GIA_NONE

#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 45 of file gia.h.

◆ Gia_ObjForEachFanoutStatic

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

Definition at line 1125 of file gia.h.

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

◆ Gia_ObjForEachFanoutStaticId

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

Definition at line 1127 of file gia.h.

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

◆ Gia_ObjForEachFanoutStaticIndex

#define Gia_ObjForEachFanoutStaticIndex ( p,
Id,
FanId,
i,
Index )
Value:
for ( i = 0; (i < Gia_ObjFanoutNumId(p, Id)) && (Index = Vec_IntEntry(p->vFanout, Id)+i) && ((FanId = Vec_IntEntry(p->vFanout, Index)), 1); i++ )

Definition at line 1129 of file gia.h.

1129#define Gia_ObjForEachFanoutStaticIndex( p, Id, FanId, i, Index ) \
1130 for ( i = 0; (i < Gia_ObjFanoutNumId(p, Id)) && (Index = Vec_IntEntry(p->vFanout, Id)+i) && ((FanId = Vec_IntEntry(p->vFanout, Index)), 1); i++ )

◆ GIA_ONE

#define GIA_ONE   2

Definition at line 922 of file gia.h.

◆ GIA_UND

#define GIA_UND   3

Definition at line 923 of file gia.h.

◆ GIA_VOID

#define GIA_VOID   0x0FFFFFFF

Definition at line 46 of file gia.h.

◆ GIA_ZER

#define GIA_ZER   1

Definition at line 921 of file gia.h.

Typedef Documentation

◆ Bnd_Man_t

typedef struct Bnd_Man_t_ Bnd_Man_t

Definition at line 1830 of file gia.h.

◆ Cbs_Man_t

typedef struct Cbs_Man_t_ Cbs_Man_t

Definition at line 1305 of file gia.h.

◆ Emb_Par_t

typedef struct Emb_Par_t_ Emb_Par_t

Definition at line 277 of file gia.h.

◆ Gia_ChMan_t

typedef struct Gia_ChMan_t_ Gia_ChMan_t

Definition at line 1416 of file gia.h.

◆ Gia_Dat_t

typedef struct Gia_Dat_t_ Gia_Dat_t

Definition at line 55 of file gia.h.

◆ Gia_Man2Min_t

typedef struct Gia_Man2Min_t_ Gia_Man2Min_t

Definition at line 1669 of file gia.h.

◆ Gia_Man_t

typedef struct Gia_Man_t_ Gia_Man_t

Definition at line 96 of file gia.h.

◆ Gia_ManMin_t

typedef struct Gia_ManMin_t_ Gia_ManMin_t

Definition at line 1665 of file gia.h.

◆ Gia_ManSim_t

typedef struct Gia_ManSim_t_ Gia_ManSim_t

Definition at line 319 of file gia.h.

◆ Gia_MmFixed_t

typedef struct Gia_MmFixed_t_ Gia_MmFixed_t

BASIC TYPES ///.

Definition at line 52 of file gia.h.

◆ Gia_MmFlex_t

typedef struct Gia_MmFlex_t_ Gia_MmFlex_t

Definition at line 53 of file gia.h.

◆ Gia_MmStep_t

typedef struct Gia_MmStep_t_ Gia_MmStep_t

Definition at line 54 of file gia.h.

◆ Gia_Obj_t

typedef struct Gia_Obj_t_ Gia_Obj_t

Definition at line 76 of file gia.h.

◆ Gia_ParFra_t

typedef struct Gia_ParFra_t_ Gia_ParFra_t

Definition at line 293 of file gia.h.

◆ Gia_ParSim_t

typedef struct Gia_ParSim_t_ Gia_ParSim_t

Definition at line 306 of file gia.h.

◆ Gia_Plc_t

typedef struct Gia_Plc_t_ Gia_Plc_t

Definition at line 67 of file gia.h.

◆ Gia_Rpr_t

typedef struct Gia_Rpr_t_ Gia_Rpr_t

Definition at line 57 of file gia.h.

◆ Gps_Par_t

typedef struct Gps_Par_t_ Gps_Par_t

Definition at line 260 of file gia.h.

◆ Jf_Par_t

typedef struct Jf_Par_t_ Jf_Par_t

Definition at line 333 of file gia.h.

◆ Tas_Man_t

typedef struct Tas_Man_t_ Tas_Man_t

Definition at line 1821 of file gia.h.

Function Documentation

◆ Bnd_ManCheckBound()

int Bnd_ManCheckBound ( Gia_Man_t * p,
int fVerbose )
extern

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

Synopsis []

Description [check if the given boundary is valid. Return 0 if the boundary is invalid. Return k if the boundary is valid and there're k boundary inputs. Can be called even if Bnd_Man_t is not created]

SideEffects []

SeeAlso []

Definition at line 379 of file giaBound.c.

380{
381 int i;
382 Gia_Obj_t *pObj;
383 int valid = 1;
384 int nBI = 0, nBO = 0, nInternal = 0;
385
386 if ( fVerbose ) printf( "Checking boundary... \n");
387
388 Vec_Int_t *vPath;
389 vPath = Vec_IntAlloc( Gia_ManObjNum(p) );
390 Vec_IntFill( vPath, Gia_ManObjNum(p), 0 );
391 int path;
392
393 Gia_ManForEachObjReverse1( p , pObj, i )
394 {
395 if ( Gia_ObjIsCo( pObj ) )
396 {
397 Vec_IntSetEntry( vPath, Gia_ObjId( p, pObj ), 1 );
398 }
399
400 path = Vec_IntEntry( vPath, Gia_ObjId(p, pObj) );
401 // printf("path = %d\n", path);
402
403 if ( path >= 8 )
404 {
405 valid = 0;
406 printf("there're more than 2 bufs in a path\n");
407 break;
408 }
409
410
411 if( Gia_ObjIsBuf( pObj ) )
412 {
413 Vec_IntSetEntry( vPath, Gia_ObjId( p, Gia_ObjFanin0( pObj ) ), Vec_IntEntry( vPath, Gia_ObjId(p, Gia_ObjFanin0( pObj ) ) ) | path << 1 );
414 if ( path == 1 ) // boundary input
415 {
416 // TODO: record BIs here since they may not be in the first n buffers
417 nBO ++;
418 }
419 }
420 else if ( Gia_ObjFaninNum( p, pObj ) >= 1 )
421 {
422 Vec_IntSetEntry( vPath, Gia_ObjId( p, Gia_ObjFanin0( pObj ) ), Vec_IntEntry( vPath, Gia_ObjId(p, Gia_ObjFanin0( pObj ) ) ) | path );
423 if ( Gia_ObjFaninNum( p, pObj ) >= 2 )
424 {
425 assert( Gia_ObjFaninNum( p, pObj ) <= 2 );
426 Vec_IntSetEntry( vPath, Gia_ObjId( p, Gia_ObjFanin1( pObj ) ), Vec_IntEntry( vPath, Gia_ObjId(p, Gia_ObjFanin1( pObj ) ) ) | path );
427 }
428 if ( path == 2 ) // inside boundary
429 {
430 // TODO: record BIs here since they may not be in the first n buffers
431 nInternal ++;
432 }
433 }
434 else // PI or const, check validity
435 {
436 if ( (Vec_IntEntry( vPath, Gia_ObjId(p, pObj) ) | 5) != 5 )
437 {
438 valid = 0;
439 printf("incorrect buf number at pi %d\n", Vec_IntEntry(vPath, Gia_ObjId(p, pObj)) );
440 break;
441 }
442 }
443 }
444
445 nBI = Gia_ManBufNum(p) - nBO;
446
447 if ( !valid )
448 {
449 printf("invalid boundary\n");
450 return 0;
451 }
452 else if ( nBI == 0 )
453 {
454 printf("no boundary\n");
455 return 0;
456 }
457 else
458 {
459 if ( fVerbose )
460 {
461 printf("valid boundary (");
462 printf("#BI = %d\t#BO = %d\t", nBI, Gia_ManBufNum(p)- nBI);
463 printf("#Internal = %d)\n", nInternal );
464 }
465 if ( pBnd )
466 {
467 pBnd -> nBI = nBI;
468 pBnd -> nBO = nBO;
469 pBnd -> nInternal = nInternal;
470 }
471 return nBI;
472 }
473}
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
Bnd_Man_t * pBnd
DECLARATIONS ///.
Definition giaBound.c:61
#define Gia_ManForEachObjReverse1(p, pObj, i)
Definition gia.h:1208
struct Gia_Obj_t_ Gia_Obj_t
Definition gia.h:76
Here is the caller graph for this function:

◆ Bnd_ManCheckCoMerged()

int Bnd_ManCheckCoMerged ( Gia_Man_t * p)
extern

Definition at line 1352 of file giaBound.c.

1353{
1354 int nCO = Gia_ManCoNum(p)/2;
1355
1356 Gia_Obj_t* pObj1;
1357 Gia_Obj_t* pObj2;
1358
1359 for ( int i = 0; i < nCO; i++ )
1360 {
1361 pObj1 = Gia_ManCo(p, i);
1362 pObj2 = Gia_ManCo(p, i + nCO);
1363 if ( Gia_ObjFaninLit0p(p, pObj1) != Gia_ObjFaninLit0p(p, pObj2) ) return 0;
1364 }
1365 return 1;
1366}

◆ Bnd_ManCutBoundary()

Gia_Man_t * Bnd_ManCutBoundary ( Gia_Man_t * p,
Vec_Int_t * vEI,
Vec_Int_t * vEO,
Vec_Bit_t * vEI_phase,
Vec_Bit_t * vEO_phase )
extern

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

Synopsis []

Description [create circuit with the boundary changed to CI/CO]

SideEffects []

SeeAlso []

Definition at line 780 of file giaBound.c.

781{
782 Gia_Man_t * pNew, * pTemp;
783 Gia_Obj_t * pObj;
784 Vec_Int_t * vValue;
785 int i, id, lit;
786
787 // check if the boundary has loop (EO cannot be in the TFC of EI )
788 if ( !Bnd_ManCheckExtBound( p, vEI, vEO ) )
789 {
790 printf("Combinational loop exist\n");
791 pBnd -> combLoop_impl = 1;
792 return 0;
793 }
794
795 // initialize
796 pNew = Gia_ManStart( Gia_ManObjNum(p) );
797 pNew -> pName = ABC_ALLOC( char, strlen(p->pName)+10);
798 sprintf( pNew -> pName, "%s_out", p -> pName );
799 Gia_ManHashStart( pNew );
801 Gia_ManConst0(p) -> Value = 0;
802
803
804 // record the original value for eo
805 vValue = Vec_IntAlloc( Gia_ManObjNum(p) );
806 Vec_IntFill( vValue, Gia_ManObjNum(p), -1 );
807
808 // create ci for ci and eo
809 Gia_ManForEachCi( p, pObj, i )
810 {
811 pObj -> Value = Gia_ManAppendCi( pNew );
812 }
813 Vec_IntForEachEntry( vEO, id, i )
814 {
815 if( Gia_ManObj(p, id) -> Value != ~0 )
816 {
817 Vec_IntSetEntry( vValue, id, Gia_ManObj(p, id) -> Value );
818 }
819 Gia_ManObj( p, id ) -> Value = Gia_ManAppendCi(pNew);
820 if ( vEO_phase && Vec_BitEntry( vEO_phase, i ) )
821 {
822 Gia_ManObj( p, id ) -> Value ^= 1;
823 }
824 }
825
826 // add aig nodes
827 Gia_ManForEachAnd(p, pObj, i)
828 {
829 if ( pObj -> Value != ~0 ) continue;
830 pObj -> Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
831 }
832
833 // create co for co and ei
834 Gia_ManForEachCo(p, pObj, i)
835 {
836 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
837 }
838 Vec_IntForEachEntry( vEI, id, i )
839 {
840 pObj = Gia_ManObj(p, id);
841 // lit = Gia_ManObj(p, id)->Value;
842 if ( Gia_ObjIsAnd(pObj) ) lit = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
843 else
844 {
845 assert(Gia_ObjIsCi(pObj) || Gia_ObjIsConst0(pObj));
846 if ( Vec_IntEntry(vValue, id) != -1 )
847 {
848 lit = Vec_IntEntry( vValue, id ); // EI at PI and EI merged with EO
849 }
850 else {
851 lit = pObj -> Value; // EI at PI
852 }
853 }
854 if ( vEI_phase && Vec_BitEntry( vEI_phase, i ) ) lit ^= 1;
855 Gia_ManAppendCo( pNew, lit );
856 }
857
858 // clean up
859 Vec_IntFree( vValue );
860 Gia_ManHashStop( pNew );
861 pNew = Gia_ManCleanup( pTemp = pNew );
862 Gia_ManStop( pTemp );
863 return pNew;
864
865}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
int Bnd_ManCheckExtBound(Gia_Man_t *p, Vec_Int_t *vEI, Vec_Int_t *vEO)
Definition giaBound.c:508
void Gia_ManStop(Gia_Man_t *p)
Definition giaMan.c:82
void Gia_ManHashStart(Gia_Man_t *p)
Definition giaHash.c:125
#define Gia_ManForEachAnd(p, pObj, i)
Definition gia.h:1214
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
Definition giaMan.c:57
void Gia_ManFillValue(Gia_Man_t *p)
Definition giaUtil.c:369
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition giaScl.c:84
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:576
#define Gia_ManForEachCo(p, pObj, i)
Definition gia.h:1236
#define Gia_ManForEachCi(p, pObj, i)
Definition gia.h:1228
void Gia_ManHashStop(Gia_Man_t *p)
Definition giaHash.c:149
int lit
Definition satVec.h:130
int strlen()
char * sprintf()
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bnd_ManFinalizeMappings()

void Bnd_ManFinalizeMappings ( )
extern

Definition at line 232 of file giaBound.c.

233{
234
235 Vec_Ptr_t* vBmiter2Spec = pBnd -> vBmiter2Spec;
236 Vec_Ptr_t* vBmiter2Impl = pBnd -> vBmiter2Impl;
237
238 Vec_Int_t *vSpec, *vImpl;
239 int i, j, id;
240
241 pBnd -> nMerged_impl = 0;
242 pBnd -> nMerged_spec = 0;
243
244
245 for( i = 0; i < Vec_PtrSize(vBmiter2Spec); i++ )
246 {
247 vSpec = (Vec_Int_t *)Vec_PtrEntry( vBmiter2Spec, i );
248 vImpl = (Vec_Int_t *)Vec_PtrEntry( vBmiter2Impl, i );
249
250 Vec_IntForEachEntry( vSpec, id, j )
251 {
252 // vSpec2Bmiter
253 Vec_IntSetEntry( pBnd->vSpec2Bmiter, id, i );
254 }
255
256 Vec_IntForEachEntry( vImpl, id, j )
257 {
258 // vImpl2Bmiter
259 Vec_IntSetEntry( pBnd->vImpl2Bmiter, id, i );
260 }
261
262 // count number of nodes merged into the same circuit
263 if ( Vec_IntSize(vSpec) != 0 )
264 {
265 pBnd->nMerged_spec += Vec_IntSize(vSpec) - 1;
266 }
267 if ( Vec_IntSize(vImpl) != 0 )
268 {
269 pBnd->nMerged_impl += Vec_IntSize(vImpl) - 1;
270 }
271 }
272
273}
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
Here is the caller graph for this function:

◆ Bnd_ManFindBound()

void Bnd_ManFindBound ( Gia_Man_t * p,
Gia_Man_t * pImpl )
extern

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

Synopsis []

Description [find the extended boundary in spec and compute the corresponding boundary in impl]

SideEffects []

SeeAlso []

Definition at line 549 of file giaBound.c.

550{
551 Vec_Int_t *vFlag;
552 Vec_Ptr_t *vQ;
553 Gia_Obj_t *pObj;
554 int i, j, id, cnt;
555
556 Vec_Int_t *vAI = Vec_IntAlloc(16);
557 Vec_Int_t *vAO = Vec_IntAlloc(16);
558
559 Vec_Bit_t *vSpec2Impl_phase = pBnd -> vSpec2Impl_phase;
560 Vec_Int_t *vBI = pBnd -> vBI;
561 Vec_Int_t *vBO = pBnd -> vBO;
562 Vec_Int_t *vEI_spec = pBnd -> vEI_spec;
563 Vec_Int_t *vEO_spec = pBnd -> vEO_spec;
564 Vec_Int_t *vEI_impl = pBnd -> vEI_impl;
565 Vec_Int_t *vEO_impl = pBnd -> vEO_impl;
566 Vec_Bit_t *vEI_phase = pBnd -> vEI_phase;
567 Vec_Bit_t *vEO_phase = pBnd -> vEO_phase;
568
569
570 // prepare to compute extended boundary
571 vQ = Vec_PtrAlloc(16);
572 vFlag = Vec_IntAlloc( Gia_ManObjNum(p) );
573 Vec_IntFill( vFlag, Gia_ManObjNum(p), 0 );
574
576
577 // save bo, bi
578 cnt = 0;
579 Gia_ManForEachBuf(p, pObj, i)
580 {
581 if ( cnt < pBnd -> nBI )
582 {
583 Vec_IntPush( vBI, Gia_ObjId(p, Gia_ObjFanin0(pObj) ) );
584 }
585 else
586 {
587 Vec_IntPush( vBO, Gia_ObjId(p, pObj) );
588 }
589 cnt++;
590 }
591
592 // compute EO, travse with flag 1
593 Vec_IntForEachEntry( vBO, id, i )
594 {
595 if ( Bnd_ManSpec2ImplNum(id) == 0 ) // BO not matched
596 {
597 Vec_PtrPush( vQ, Gia_ManObj(p, id) );
598 }
599 else
600 {
601 Vec_IntPush(vEO_spec, id);
602 }
603 }
604 if ( pBnd -> fVerbose ) printf("%d BO doesn't match. ", Vec_PtrSize(vQ) );
605 pBnd -> nBO_miss = Vec_PtrSize(vQ);
606
607 int cnt_extra = - Vec_PtrSize(vQ);
608 while( Vec_PtrSize(vQ) > 0 )
609 {
610 pObj = (Gia_Obj_t *)Vec_PtrPop(vQ);
611 id = Gia_ObjId( p, pObj );
612
613 if ( Vec_IntEntry( vFlag, id ) == 1 ) continue;
614 Vec_IntSetEntry( vFlag, id, 1 );
615
616 // printf("%d\n", id);
617
618 if ( Bnd_ManSpec2ImplNum(id) != 0 ) // matched
619 {
620 Vec_IntPush( vEO_spec, id );
621 Vec_IntPush( vAO, id );
622 }
623 else
624 {
625 for( j = 0; j < Gia_ObjFanoutNum(p, pObj); j++ )
626 {
627 Vec_PtrPush( vQ, Gia_ObjFanout(p, pObj, j) );
628 // printf("\t%d\n", Gia_ObjId( p1, Gia_ObjFanout(p1, pObj, j) ) );
629 }
630 }
631 }
632 // printf("%d AO found with %d extra nodes\n", Vec_IntSize(vAO) , cnt_extra );
633 if ( pBnd -> fVerbose ) printf("%d AO found\n", Vec_IntSize(vAO) );
634
635
636 // mark TFOC of BO with flag 1 to prevent them from being selected into EI
637 // stop at CO
638 Vec_IntForEachEntry( pBnd -> vBO, id, i )
639 {
640 Vec_PtrPush( vQ, Gia_ManObj(p, id) );
641 }
642 Vec_IntForEachEntry( vFlag, id, i )
643 {
644 Vec_IntSetEntry( vFlag, id, 0 );
645 }
646 while( Vec_PtrSize(vQ) > 0 )
647 {
648 pObj = (Gia_Obj_t *)Vec_PtrPop(vQ);
649 id = Gia_ObjId( p, pObj );
650
651 if ( Vec_IntEntry( vFlag, id ) == 1 ) continue;
652 Vec_IntSetEntry( vFlag, id, 1 );
653
654 for( j = 0; j < Gia_ObjFanoutNum(p, pObj); j++ )
655 {
656 Vec_PtrPush( vQ, Gia_ObjFanout(p, pObj, j) );
657 }
658 }
659
660
661
662 // compute EI, traverse with flag 2
663
664 // add unmatched BI to queue
665 Vec_IntForEachEntry( vBI, id, i )
666 {
667 if ( Bnd_ManSpec2ImplNum(id) == 0 ) // BO not matched
668 {
669 Vec_PtrPush( vQ, Gia_ManObj(p, id) );
670 }
671 else
672 {
673 Vec_IntPush(vEI_spec, id);
674 }
675 }
676 if ( pBnd -> fVerbose ) printf("%d BI doesn't match. ", Vec_PtrSize(vQ) );
677 pBnd -> nBI_miss = Vec_PtrSize(vQ);
678 cnt_extra -= Vec_PtrSize(vQ);
679
680 // add AO to queue
681 Vec_IntForEachEntry( vAO, id, i )
682 {
683 Vec_PtrPush( vQ, Gia_ManObj(p, id) );
684 }
685
686 // set flag 2 for BO
687 Vec_IntForEachEntry( vBO, id, i )
688 {
689 Vec_IntSetEntry( vFlag, id, 2 );
690 }
691
692 // traverse down from AI and unmatched BI
693 while( Vec_PtrSize(vQ) > 0 )
694 {
695 pObj = (Gia_Obj_t *)Vec_PtrPop(vQ);
696 id = Gia_ObjId( p, pObj );
697
698 if ( Vec_IntEntry( vFlag, id ) == 2 ) continue;
699 cnt_extra ++;
700
701 // printf("%d\n", id);
702
703 if ( Vec_IntEntry(vFlag, id) != 1 && Bnd_ManSpec2ImplNum(id) != 0 ) // matched
704 {
705 Vec_IntPush( vEI_spec, id );
706 Vec_IntPush( vAI, id );
707 }
708 else
709 {
710 for( j = 0; j < Gia_ObjFaninNum(p, pObj); j++ )
711 {
712 Vec_PtrPush( vQ, Gia_ObjFanin(pObj, j) );
713 // printf("\t%d\n", Gia_ObjId( p1, Gia_ObjFanout(p1, pObj, j) ) );
714 }
715 }
716
717 Vec_IntSetEntry( vFlag, id, 2 );
718 }
719 if ( pBnd -> fVerbose ) printf("%d AI found with %d extra nodes in total\n", Vec_IntSize(vAI) , cnt_extra );
720 pBnd -> nExtra = cnt_extra;
721
722
723 // gen vEI_impl, vEO_impl, vEI_phase, vEO_phase
724 Vec_IntForEachEntry( vEI_spec, id, i )
725 {
726 Vec_IntPush( vEI_impl, Vec_IntEntry( Bnd_ManSpec2Impl(id) , 0 ) );
727 Vec_BitPush( vEI_phase, Vec_BitEntry( vSpec2Impl_phase, id ) );
728 }
729 Vec_IntForEachEntry( vEO_spec, id, i )
730 {
731 Vec_IntPush( vEO_impl, Vec_IntEntry( Bnd_ManSpec2Impl(id), 0 ) );
732 Vec_BitPush( vEO_phase, Vec_BitEntry( vSpec2Impl_phase, id ) );
733 }
734
735
736 // count number of choice of boundary
737 Vec_IntForEachEntry( vEO_spec, id, i )
738 {
739 pBnd -> nChoice_impl += Bnd_ManSpec2ImplNum( id ) - 1;
740 }
741 Vec_IntForEachEntry( vEO_impl, id, i )
742 {
743 pBnd -> nChoice_spec += Bnd_ManImpl2SpecNum( id ) - 1;
744 }
745
746 // print
747 if ( pBnd -> fVerbose )
748 {
749 printf("#EI = %d\t#EO = %d\t#Extra Node = %d\n", Vec_IntSize(vEI_spec) , Vec_IntSize(vEO_spec), cnt_extra );
751 }
752
753 // check boundary has comb loop
754 if ( !Bnd_ManCheckExtBound( p, vEI_spec, vEO_spec ) )
755 {
756
757 printf("Combinational loop exist\n");
758 pBnd -> combLoop_spec = 1;
759
760 }
761
762
763 // clean up
764 Vec_IntFree(vAI);
765 Vec_IntFree(vAO);
766}
void Bnd_ManPrintBound()
Definition giaBound.c:295
Vec_Int_t * Bnd_ManSpec2Impl(int id)
Definition giaBound.c:70
int Bnd_ManImpl2SpecNum(int id)
Definition giaBound.c:74
int Bnd_ManSpec2ImplNum(int id)
Definition giaBound.c:71
void Gia_ManStaticFanoutStart(Gia_Man_t *p)
Definition giaFanout.c:238
#define Gia_ManForEachBuf(p, pObj, i)
Definition gia.h:1210
typedefABC_NAMESPACE_HEADER_START struct Vec_Bit_t_ Vec_Bit_t
INCLUDES ///.
Definition vecBit.h:42
Here is the call graph for this function:

◆ Bnd_ManGenImplOut()

Gia_Man_t * Bnd_ManGenImplOut ( Gia_Man_t * p)
extern

Definition at line 873 of file giaBound.c.

874{
875 if ( pBnd -> fVerbose ) printf("Generating impl_out with given boundary.\n");
876 Gia_Man_t *pNew = Bnd_ManCutBoundary( p, pBnd->vEI_impl, pBnd->vEO_impl, pBnd->vEI_phase, pBnd->vEO_phase );
877 if (!pNew) pBnd -> combLoop_impl = 1;
878 return pNew;
879}
Gia_Man_t * Bnd_ManCutBoundary(Gia_Man_t *p, Vec_Int_t *vEI, Vec_Int_t *vEO, Vec_Bit_t *vEI_phase, Vec_Bit_t *vEO_phase)
Definition giaBound.c:780
Here is the call graph for this function:

◆ Bnd_ManGenPatched()

Gia_Man_t * Bnd_ManGenPatched ( Gia_Man_t * pOut,
Gia_Man_t * pSpec,
Gia_Man_t * pPatch )
extern

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

Synopsis []

Description [perform ECO directly (not used)]

SideEffects []

SeeAlso []

Definition at line 922 of file giaBound.c.

923{
924
925 Gia_Man_t * pNew, * pTemp;
926 Gia_Obj_t * pObj;
927 int i, id, cnt;
928 Vec_Int_t *vBI_patch, *vBO_patch;
929
930 pBnd -> nNode_patch = Gia_ManAndNotBufNum( pPatch );
931
932 pNew = Gia_ManStart( Gia_ManObjNum(pOut) + Gia_ManObjNum( pSpec ) + Gia_ManObjNum(pPatch) );
933 pNew -> pName = ABC_ALLOC( char, strlen(pOut->pName)+3);
934 sprintf( pNew -> pName, "%s_p", pOut -> pName );
935 Gia_ManHashStart( pNew );
936 Gia_ManFillValue(pOut);
937 Gia_ManFillValue(pSpec);
938 Gia_ManFillValue(pPatch);
939 Gia_ManConst0(pOut)->Value = 0;
940 Gia_ManConst0(pSpec)->Value = 0;
941 Gia_ManConst0(pPatch)->Value = 0;
942
943 // get bi and bo in patch
944 cnt = 0;
945 vBI_patch = Vec_IntAlloc(16);
946 vBO_patch = Vec_IntAlloc(16);
947 Gia_ManForEachBuf( pPatch, pObj, i )
948 {
949 if ( cnt < pBnd -> nBI )
950 {
951 Vec_IntPush( vBI_patch, Gia_ObjId( pPatch, pObj ) );
952 }
953 else
954 {
955
956 Vec_IntPush( vBO_patch, Gia_ObjId( pPatch, pObj ) );
957 }
958 cnt ++;
959 }
960 assert( Vec_IntSize( vBI_patch ) == Vec_IntSize(pBnd->vBI) );
961 assert( Vec_IntSize( vBO_patch ) == Vec_IntSize(pBnd->vBO) );
962
963
964 // add Impl (real) PI
965 for ( i = 0; i < Gia_ManCiNum(pSpec); i++ )
966 {
967 pObj = Gia_ManCi(pOut, i);
968 pObj -> Value = Gia_ManAppendCi( pNew );
969 }
970
971 // add Impl EI to CI
972 // printf("adding EI to CI in Impl\n");
973 for ( i = 0; i < Vec_IntSize( pBnd -> vEI_spec ); i++ )
974 {
975 pObj = Gia_ManCo(pOut, i + Gia_ManCoNum(pSpec) );
976 Bnd_AddNodeRec( pOut, pNew, pObj, 0 );
977
978 // set Spec EI
979 Gia_ManObj( pSpec, Vec_IntEntry(pBnd -> vEI_spec, i) ) -> Value = pObj -> Value;
980 // printf(" %d",pObj -> Value);
981 }
982 // printf("\n");
983
984 // add Spec BI to EI
985 // printf("adding BI to EI in Spec\n");
986 Vec_IntForEachEntry( pBnd -> vBI, id, i )
987 {
988 pObj = Gia_ManObj( pSpec, id );
989 Bnd_AddNodeRec( pSpec, pNew, pObj, 0 );
990
991 // set patch bi
992 Gia_ManObj( pPatch, Vec_IntEntry( vBI_patch, i) ) -> Value = pObj -> Value;
993 // printf(" %d",pObj -> Value);
994 }
995 // printf("\n");
996
997 // add Patch BO to BI
998 // printf("adding BO to BI in Patch\n");
999 Vec_IntForEachEntry( vBO_patch, id, i )
1000 {
1001 pObj = Gia_ManObj( pPatch, id );
1002 Bnd_AddNodeRec( pPatch, pNew, pObj, 0 );
1003
1004 // set spec bo
1005 Gia_ManObj( pSpec, Vec_IntEntry( pBnd -> vBO, i) ) -> Value = pObj -> Value;
1006 // printf(" %d",pObj -> Value);
1007 }
1008 // printf("\n");
1009
1010 // add Spec EO to BO
1011 // printf("adding EO to BO in Spec\n");
1012 Vec_IntForEachEntry( pBnd -> vEO_spec, id, i )
1013 {
1014 pObj = Gia_ManObj( pSpec, id );
1015 Bnd_AddNodeRec( pSpec, pNew, pObj, 0 );
1016
1017 // set impl EO (PI)
1018 Gia_ManCi( pOut, i + Gia_ManCiNum(pSpec) ) -> Value = pObj -> Value;
1019 // printf(" %d",pObj -> Value);
1020 }
1021 // printf("\n");
1022
1023 // add Impl (real) PO to EO
1024 // printf("adding CO to EO in Impl\n");
1025 for ( i = 0; i < Gia_ManCoNum(pSpec); i++ )
1026 {
1027 pObj = Gia_ManCo( pOut, i );
1028 Bnd_AddNodeRec( pOut, pNew, pObj, 0 );
1029 Gia_ManAppendCo( pNew, pObj->Value );
1030 // printf(" %d",pObj -> Value);
1031 }
1032 // printf("\n");
1033
1034
1035 // clean up
1036 Vec_IntFree( vBI_patch );
1037 Vec_IntFree( vBO_patch );
1038 Gia_ManHashStop( pNew );
1039
1040 pNew = Gia_ManCleanup( pTemp = pNew );
1041 Gia_ManStop( pTemp );
1042
1043 pBnd -> nNode_patched = Gia_ManAndNum( pNew );
1044
1045 return pNew;
1046}
void Bnd_AddNodeRec(Gia_Man_t *p, Gia_Man_t *pNew, Gia_Obj_t *pObj, int fSkipStrash)
Definition giaBound.c:881
char * pName
Definition gia.h:99
unsigned Value
Definition gia.h:89
Here is the call graph for this function:

◆ Bnd_ManGenPatched1()

Gia_Man_t * Bnd_ManGenPatched1 ( Gia_Man_t * pOut,
Gia_Man_t * pSpec )
extern

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

Synopsis []

Description [recover bounadry]

SideEffects []

SeeAlso []

Definition at line 1059 of file giaBound.c.

1060{
1061
1062 Gia_Man_t * pNew, * pTemp;
1063 Gia_Obj_t * pObj;
1064 int i, id;
1065
1066 pNew = Gia_ManStart( Gia_ManObjNum(pOut) + Gia_ManObjNum( pSpec ) );
1067 pNew -> pName = ABC_ALLOC( char, strlen(pOut->pName)+3);
1068 sprintf( pNew -> pName, "%s_p", pOut -> pName );
1069
1070 Gia_ManFillValue(pOut);
1071 Gia_ManFillValue(pSpec);
1072 Gia_ManConst0(pOut)->Value = 0;
1073 Gia_ManConst0(pSpec)->Value = 0;
1074
1075
1076 // add Impl (real) PI
1077 for ( i = 0; i < Gia_ManCiNum(pSpec); i++ )
1078 {
1079 pObj = Gia_ManCi(pOut, i);
1080 pObj -> Value = Gia_ManAppendCi( pNew );
1081 }
1082
1083 // add Impl EI to CI
1084 // printf("adding EI to CI in Impl\n");
1085 for ( i = 0; i < Vec_IntSize( pBnd -> vEI_spec ); i++ )
1086 {
1087 pObj = Gia_ManCo(pOut, i + Gia_ManCoNum(pSpec) );
1088 Bnd_AddNodeRec( pOut, pNew, pObj, 1 );
1089
1090 // set Spec EI
1091 Gia_ManObj( pSpec, Vec_IntEntry(pBnd -> vEI_spec, i) ) -> Value = pObj -> Value;
1092 // printf(" %d",pObj -> Value);
1093 }
1094 // printf("\n");
1095
1096 // add Spec EO to EI
1097 // add BI -> BO -> EO to maintain the order of bufs
1098 // Vec_IntForEachEntry( pBnd -> vBI, id, i )
1099 // {
1100 // pObj = Gia_ManObj( pSpec, id );
1101 // Bnd_AddNodeRec( pSpec, pNew, pObj, 1 );
1102 // }
1103 // Vec_IntForEachEntry( pBnd -> vBO, id, i )
1104 // {
1105 // pObj = Gia_ManObj( pSpec, id );
1106 // Bnd_AddNodeRec( pSpec, pNew, pObj, 1 );
1107 // }
1108 Gia_ManForEachBuf( pSpec, pObj, i )
1109 {
1110 Bnd_AddNodeRec( pSpec, pNew, pObj, 1 );
1111 }
1112 Vec_IntForEachEntry( pBnd -> vEO_spec, id, i )
1113 {
1114 pObj = Gia_ManObj( pSpec, id );
1115 Bnd_AddNodeRec( pSpec, pNew, pObj, 1 );
1116
1117 // set impl EO (PI)
1118 Gia_ManCi( pOut, i + Gia_ManCiNum(pSpec) ) -> Value = pObj -> Value;
1119 // printf(" %d",pObj -> Value);
1120 }
1121 // printf("\n");
1122
1123 // add Impl (real) PO to EO
1124 // printf("adding CO to EO in Impl\n");
1125 for ( i = 0; i < Gia_ManCoNum(pSpec); i++ )
1126 {
1127 pObj = Gia_ManCo( pOut, i );
1128 Bnd_AddNodeRec( pOut, pNew, pObj, 1 );
1129 Gia_ManAppendCo( pNew, pObj->Value );
1130 // printf(" %d",pObj -> Value);
1131 }
1132 // printf("\n");
1133
1134
1135 // clean up
1136 pNew = Gia_ManCleanup( pTemp = pNew );
1137 Gia_ManStop( pTemp );
1138
1139 pBnd -> nNode_patched = Gia_ManAndNum( pNew );
1140
1141 return pNew;
1142}
Here is the call graph for this function:

◆ Bnd_ManGenPatched2()

Gia_Man_t * Bnd_ManGenPatched2 ( Gia_Man_t * pImpl,
Gia_Man_t * pPatch,
int fSkipStrash,
int fVerbose )
extern

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

Synopsis []

Description [perform eco with recovered boundary. bnd_man is not used]

SideEffects []

SeeAlso []

Definition at line 1156 of file giaBound.c.

1157{
1158
1159 Gia_Man_t * pNew, * pTemp;
1160 Gia_Obj_t * pObj;
1161 int i, nBI, nBI_patch, cnt;
1162 Vec_Int_t* vLit;
1163
1164
1165 // check boundary first
1166 nBI = Bnd_ManCheckBound( pImpl, fVerbose );
1167 nBI_patch = Bnd_ManCheckBound( pPatch, fVerbose );
1168 if ( 0 == nBI_patch || Gia_ManBufNum(pImpl) != Gia_ManBufNum(pPatch) || nBI != nBI_patch )
1169 {
1170 Abc_Print( -1, "Abc_CommandAbc9StrEco(): The given boundary is invalid.\n" );
1171 return 0;
1172 }
1173
1174 // prepare new network
1175 pNew = Gia_ManStart( Gia_ManObjNum(pImpl) + Gia_ManObjNum( pPatch ) );
1176 pNew -> pName = ABC_ALLOC( char, strlen(pImpl->pName)+3);
1177 sprintf( pNew -> pName, "%s_p", pImpl -> pName );
1178 if ( !fSkipStrash )
1179 {
1180 Gia_ManHashAlloc( pNew );
1181 }
1182 Gia_ManFillValue(pImpl);
1183 Gia_ManFillValue(pPatch);
1184 Gia_ManConst0(pImpl)->Value = 0;
1185 Gia_ManConst0(pPatch)->Value = 0;
1186
1187 vLit = Vec_IntAlloc( Gia_ManBufNum(pImpl) );
1188
1189 // add Impl (real) CI
1190 Gia_ManForEachCi( pImpl, pObj, i )
1191 {
1192 pObj -> Value = Gia_ManAppendCi( pNew );
1193 }
1194
1195 // add Impl BI to CI
1196 cnt = 0;
1197 Gia_ManForEachBuf( pImpl, pObj, i )
1198 {
1199 Bnd_AddNodeRec( pImpl, pNew, pObj, fSkipStrash );
1200 Vec_IntPush( vLit, pObj -> Value );
1201 cnt ++;
1202 if ( cnt >= nBI ) break;
1203 }
1204
1205 // set BI in patch
1206 // add patch BO to BI
1207 cnt = 0;
1208 Gia_ManForEachBuf( pPatch, pObj, i )
1209 {
1210 if ( cnt < nBI )
1211 {
1212 pObj -> Value = Vec_IntEntry( vLit, cnt );
1213 }
1214 else
1215 {
1216 Bnd_AddNodeRec( pPatch, pNew, pObj, fSkipStrash );
1217 Vec_IntPush( vLit, pObj -> Value );
1218 }
1219 cnt ++;
1220 if ( cnt == nBI ) Vec_IntClear( vLit );
1221 }
1222
1223 // set BO in impl
1224 cnt = 0;
1225 Gia_ManForEachBuf( pImpl, pObj, i )
1226 {
1227 cnt ++;
1228 if ( cnt <= nBI) continue;
1229 pObj -> Value = Vec_IntEntry( vLit, cnt-nBI-1 );
1230 }
1231
1232 // add impl CO to BO
1233 Gia_ManForEachCo( pImpl, pObj, i )
1234 {
1235 Bnd_AddNodeRec( pImpl, pNew, pObj, fSkipStrash );
1236 Gia_ManAppendCo( pNew, pObj -> Value );
1237 }
1238
1239 // clean up
1240 if ( !fSkipStrash )
1241 {
1242 Gia_ManHashStop( pNew );
1243 }
1244 Vec_IntFree( vLit );
1245 pNew = Gia_ManCleanup( pTemp = pNew );
1246 Gia_ManStop( pTemp );
1247
1248 return pNew;
1249}
int Bnd_ManCheckBound(Gia_Man_t *p, int fVerbose)
Definition giaBound.c:379
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition giaHash.c:105
Here is the call graph for this function:

◆ Bnd_ManGenSpecOut()

Gia_Man_t * Bnd_ManGenSpecOut ( Gia_Man_t * p)
extern

Definition at line 867 of file giaBound.c.

868{
869 if ( pBnd -> fVerbose ) printf("Generating spec_out with given boundary.\n");
870 Gia_Man_t *pNew = Bnd_ManCutBoundary( p, pBnd->vEI_spec, pBnd->vEO_spec, 0, 0 );
871 return pNew;
872}
Here is the call graph for this function:

◆ Bnd_ManGetNExtra()

int Bnd_ManGetNExtra ( )
extern

Definition at line 176 of file giaBound.c.

176{ assert(pBnd); return pBnd -> nExtra; }

◆ Bnd_ManGetNInternal()

int Bnd_ManGetNInternal ( )
extern

Definition at line 175 of file giaBound.c.

175{ assert(pBnd); return pBnd -> nInternal; }

◆ Bnd_ManMap()

void Bnd_ManMap ( int iLit,
int id,
int spec )
extern

Definition at line 178 of file giaBound.c.

179{
180
181 if ( spec )
182 {
183 Vec_IntPush( (Vec_Int_t *)Vec_PtrEntry( pBnd -> vBmiter2Spec, iLit >> 1), id );
184 Vec_BitSetEntry( pBnd -> vSpec2Impl_phase, id, iLit & 1 );
185 }
186 else
187 {
188 assert( (iLit & 1) == 0 );
189 Vec_IntPush( (Vec_Int_t *)Vec_PtrEntry( pBnd -> vBmiter2Impl, iLit >> 1), id );
190 }
191}
Here is the caller graph for this function:

◆ Bnd_ManMerge()

void Bnd_ManMerge ( int id1,
int id2,
int phaseDiff )
extern

Definition at line 193 of file giaBound.c.

194{
195
196
197 Vec_Ptr_t* vBmiter2Spec = pBnd -> vBmiter2Spec;
198 Vec_Ptr_t* vBmiter2Impl = pBnd -> vBmiter2Impl;
199 Vec_Bit_t* vSpec2Impl_phase = pBnd -> vSpec2Impl_phase;
200 int id, i;
201
202 Vec_Int_t *vIds_spec_repr, *vIds_impl_repr, *vIds_spec_obj, *vIds_impl_obj;
203
204 vIds_spec_repr = (Vec_Int_t *)Vec_PtrEntry( vBmiter2Spec, id_repr );
205 vIds_impl_repr = (Vec_Int_t *)Vec_PtrEntry( vBmiter2Impl, id_repr );
206 vIds_spec_obj = (Vec_Int_t *)Vec_PtrEntry( vBmiter2Spec, id_obj );
207 vIds_impl_obj = (Vec_Int_t *)Vec_PtrEntry( vBmiter2Impl, id_obj );
208
209 Vec_IntForEachEntry( vIds_spec_obj, id, i )
210 {
211 Vec_IntPush(vIds_spec_repr, id);
212 }
213 Vec_IntForEachEntry( vIds_impl_obj, id, i )
214 {
215 Vec_IntPush(vIds_impl_repr, id);
216 }
217
218 // handle spec2impl phase
219 if ( phaseDiff )
220 {
221 Vec_IntForEachEntry( vIds_spec_obj, id, i )
222 {
223 Vec_BitSetEntry( vSpec2Impl_phase, id, !Vec_BitEntry(vSpec2Impl_phase, id) );
224 // printf( "spec id %d's phase set to %d\n", id, Vec_BitEntry(vSpec2Impl_phase, id) );
225 }
226 }
227
228 Vec_IntClear(vIds_spec_obj);
229 Vec_IntClear(vIds_impl_obj);
230
231}
Here is the caller graph for this function:

◆ Bnd_ManPrintMappings()

void Bnd_ManPrintMappings ( )
extern

Definition at line 274 of file giaBound.c.

275{
276 Vec_Ptr_t* vBmiter2Spec = pBnd -> vBmiter2Spec;
277 Vec_Ptr_t* vBmiter2Impl = pBnd -> vBmiter2Impl;
278 Vec_Int_t* vIds_spec, *vIds_impl;
279 int k, id;
280 for( int j=0; j < Vec_PtrSize(vBmiter2Spec); j++ )
281 {
282 printf("node %d: ", j);
283 vIds_spec = (Vec_Int_t *)Vec_PtrEntry( vBmiter2Spec, j);
284 vIds_impl = (Vec_Int_t *)Vec_PtrEntry( vBmiter2Impl, j);
285 Vec_IntForEachEntry(vIds_spec, id, k)
286 printf("%d ", id);
287 printf("| ");
288 Vec_IntForEachEntry(vIds_impl, id, k)
289 printf("%d ", id);
290 printf("\n");
291 }
292
293}

◆ Bnd_ManPrintStats()

void Bnd_ManPrintStats ( )
extern

Definition at line 310 of file giaBound.c.

311{
312 Bnd_Man_t* p = pBnd;
313
314
315 printf("\nSTATS\n");
316
317 int warning = 0;
318 if ( p->nChoice_spec > 0 )
319 {
320 warning = 1;
321 printf("WARNING: multiple equiv nodes on the boundary of spec\n");
322 }
323 if ( p->nChoice_impl > 0 )
324 {
325 warning = 1;
326 printf("WARNING: multiple equiv nodes on the boundary of impl\n");
327 }
328
329 printf("The outsides of spec and impl are %sEQ.\n", p->eq_out ? "" : "NOT " );
330 printf("The patched impl is %sEQ. to spec (and impl)\n", p->eq_res ? "" : "NOT " );
331
332 // #internal
333 // nBI, nBO
334 // nBI_miss, nBO_miss
335 // nEI, nEO, nExtra
336 // #spec, #impl, #patched
337 // combLoop_spec, combLoop_impl
338 // #choice_impl
339 // #choice_spec
340 // #feedthrough
341 // warning (may be neq)
342 // eq_out, eq_res
343
344 printf("\nRESULT\n");
345 printf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
346 p->nInternal,
347 p->nBI, p->nBO,
348 p->nBI_miss, p->nBO_miss,
349 Vec_IntSize(p->vEI_spec), Vec_IntSize(p->vEO_spec), p->nExtra,
350 p->nNode_spec, p->nNode_impl, p->nNode_patched,
351 p->combLoop_spec, p->combLoop_impl,
352 p->nChoice_impl,
353 p->nChoice_spec,
354 warning,
355 p->eq_out, p->eq_res
356 );
357
358 printf("#Choice Spec\t%d\n", p->nChoice_spec);
359 printf("#Choice Impl\t%d\n", p->nChoice_impl);
360
361
362
363}
struct Bnd_Man_t_ Bnd_Man_t
Definition gia.h:1830

◆ Bnd_ManSetEqOut()

void Bnd_ManSetEqOut ( int eq)
extern

FUNCTION DEFINITIONS ///.

Definition at line 67 of file giaBound.c.

67{ pBnd -> eq_out = eq;}

◆ Bnd_ManSetEqRes()

void Bnd_ManSetEqRes ( int eq)
extern

Definition at line 68 of file giaBound.c.

68{ pBnd -> eq_res = eq;}

◆ Bnd_ManStackGias()

Gia_Man_t * Bnd_ManStackGias ( Gia_Man_t * pSpec,
Gia_Man_t * pImpl )
extern

Definition at line 1252 of file giaBound.c.

1253{
1254 Gia_Man_t * pNew, * pTemp;
1255 Gia_Obj_t * pObj;
1256
1257 int i, iLit;
1258 if ( Gia_ManBufNum(pSpec) == 0 ) {
1259 printf( "The spec AIG should have a boundary.\n" );
1260 return NULL;
1261 }
1262 if ( Gia_ManBufNum(pImpl) != 0 ) {
1263 printf( "The impl AIG should have no boundary.\n" );
1264 return NULL;
1265 }
1266
1267 assert( Gia_ManBufNum(pSpec) > 0 );
1268 assert( Gia_ManBufNum(pImpl) == 0 );
1269 assert( Gia_ManRegNum(pSpec) == 0 );
1270 assert( Gia_ManRegNum(pImpl) == 0 );
1271 assert( Gia_ManCiNum(pSpec) == Gia_ManCiNum(pImpl) );
1272 assert( Gia_ManCoNum(pSpec) == Gia_ManCoNum(pImpl) );
1273
1274 pNew = Gia_ManStart( Gia_ManObjNum(pSpec) + Gia_ManObjNum(pImpl) );
1275 pNew->pName = ABC_ALLOC( char, strlen(pSpec->pName) + 10 );
1276 sprintf( pNew->pName, "%s_stack", pSpec->pName );
1277
1278 Gia_ManHashStart( pNew );
1279 Gia_ManConst0(pSpec)->Value = 0;
1280 Gia_ManConst0(pImpl)->Value = 0;
1281
1282 for( int i = 0; i < Gia_ManCiNum(pSpec); i++ )
1283 {
1284 int iLit = Gia_ManCi(pSpec, i)->Value = Gia_ManCi(pImpl, i) -> Value = Gia_ManAppendCi(pNew);
1285
1286 pObj = Gia_ManCi(pSpec, i);
1287 Bnd_ManMap( iLit, Gia_ObjId( pSpec, pObj ), 1 );
1288
1289 pObj = Gia_ManCi(pImpl, i);
1290 Bnd_ManMap( iLit, Gia_ObjId( pImpl, pObj) , 0 );
1291 }
1292
1293 // record the corresponding impl node of each lit
1294 Gia_ManForEachAnd( pImpl, pObj, i )
1295 {
1296 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1297 if ( pBnd ) Bnd_ManMap( pObj -> Value, Gia_ObjId(pImpl, pObj), 0 );
1298 }
1299
1300 Vec_Int_t* vFlag = Vec_IntAlloc( Gia_ManObjNum( pSpec ) );
1301 Vec_IntFill( vFlag, Gia_ManObjNum(pSpec), 0 );
1302 int count = 0;
1303 Gia_ManForEachBuf( pSpec, pObj, i )
1304 {
1305 if ( count < pBnd -> nBI )
1306 {
1307 // it's BI, don't record buf
1308 Vec_IntSetEntry( vFlag, Gia_ObjId( pSpec, pObj ), 1 );
1309 }
1310 else
1311 {
1312 // it's BO, don't record buf's fanin
1313 Vec_IntSetEntry( vFlag, Gia_ObjId( pSpec, Gia_ObjFanin0( pObj ) ), 1 );
1314 }
1315 count++;
1316 }
1317
1318 // record hashed equivalent nodes
1319 Gia_ManForEachAnd( pSpec, pObj, i )
1320 {
1321 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1322 if ( Vec_IntEntry( vFlag, Gia_ObjId( pSpec, pObj ) ) == 0 )
1323 {
1324 Bnd_ManMap( pObj -> Value, Gia_ObjId(pSpec, pObj), 1 );
1325 }
1326 }
1327 Vec_IntFree( vFlag );
1328
1329 Gia_ManForEachCo( pImpl, pObj, i )
1330 {
1331 iLit = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1332 }
1333 Gia_ManForEachCo( pSpec, pObj, i )
1334 {
1335 iLit = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1336 }
1337
1338 // miter
1339 // Gia_ManForEachCo( pImpl, pObj, i )
1340 // {
1341 // iLit = Gia_ManHashXor( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin0Copy(Gia_ManCo(pSpec,i)) );
1342 // Gia_ManAppendCo( pNew, iLit );
1343 // }
1344
1345
1346 Gia_ManHashStop( pNew );
1347 pNew = Gia_ManCleanup( pTemp = pNew );
1348 Gia_ManStop( pTemp );
1349 return pNew;
1350}
void Bnd_ManMap(int iLit, int id, int spec)
Definition giaBound.c:178
Here is the call graph for this function:

◆ Bnd_ManStart()

Bnd_Man_t * Bnd_ManStart ( Gia_Man_t * pSpec,
Gia_Man_t * pImpl,
int fVerbose )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 88 of file giaBound.c.

89{
90 int i;
92
93 p -> maxNumClass = Gia_ManCiNum( pSpec ) + Gia_ManAndNotBufNum(pSpec) + Gia_ManAndNum(pImpl) + 2 + Gia_ManCoNum(pSpec) * 2;
94 // one for constant node and one for dummy
95
96 p -> vBmiter2Spec = Vec_PtrAlloc( p -> maxNumClass );
97 p -> vBmiter2Impl = Vec_PtrAlloc( p -> maxNumClass );
98 Vec_PtrFill( p -> vBmiter2Spec, p -> maxNumClass, 0 );
99 Vec_PtrFill( p -> vBmiter2Impl, p -> maxNumClass, 0 );
100 for( i = 0; i < Vec_PtrSize( p -> vBmiter2Impl ); i ++ )
101 {
102 Vec_PtrSetEntry( p -> vBmiter2Spec, i, Vec_IntAlloc(1) );
103 Vec_PtrSetEntry( p -> vBmiter2Impl, i, Vec_IntAlloc(1) );
104 }
105
106 p -> vSpec2Impl_phase = Vec_BitAlloc( Gia_ManObjNum(pSpec) );
107 Vec_BitFill( p -> vSpec2Impl_phase, Gia_ManObjNum(pSpec), 0 );
108
109 p -> vImpl2Bmiter = Vec_IntAlloc( Gia_ManObjNum(pImpl) );
110 Vec_IntFill( p -> vImpl2Bmiter, Gia_ManObjNum(pImpl), p -> maxNumClass - 1 );
111 p -> vSpec2Bmiter = Vec_IntAlloc( Gia_ManObjNum(pSpec) );
112 Vec_IntFill( p -> vSpec2Bmiter, Gia_ManObjNum(pSpec), p -> maxNumClass - 1);
113
114 p -> vBI = Vec_IntAlloc(16);
115 p -> vBO = Vec_IntAlloc(16);
116 p -> vEI_spec = Vec_IntAlloc(16);
117 p -> vEO_spec = Vec_IntAlloc(16);
118 p -> vEI_impl = Vec_IntAlloc(16);
119 p -> vEO_impl = Vec_IntAlloc(16);
120 p -> vEI_phase = Vec_BitAlloc(16);
121 p -> vEO_phase = Vec_BitAlloc(16);
122
123 p -> nNode_spec = Gia_ManAndNum(pSpec) - Gia_ManBufNum(pSpec);
124 p -> nNode_impl = Gia_ManAndNum(pImpl);
125 p -> nNode_patch = 0;
126 p -> nNode_patched = 0;
127
128 p -> fVerbose = fVerbose;
129
130 p -> combLoop_spec = 0;
131 p -> combLoop_impl = 0;
132 p -> eq_out = 0;
133 p -> eq_res = 0;
134
135 p -> nChoice_spec = 0;
136 p -> nChoice_impl = 0;
137 p -> feedthrough = 0;
138
139 return p;
140}
#define ABC_CALLOC(type, num)
Definition abc_global.h:265

◆ Bnd_ManStop()

void Bnd_ManStop ( )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 153 of file giaBound.c.

154{
155 assert(pBnd);
156
157 Vec_PtrFree( pBnd-> vBmiter2Spec );
158 Vec_PtrFree( pBnd-> vBmiter2Impl );
159 Vec_BitFree( pBnd-> vSpec2Impl_phase );
160 Vec_IntFree( pBnd-> vImpl2Bmiter );
161 Vec_IntFree( pBnd-> vSpec2Bmiter );
162
163 Vec_IntFree( pBnd->vBI );
164 Vec_IntFree( pBnd->vBO );
165 Vec_IntFree( pBnd->vEI_spec );
166 Vec_IntFree( pBnd->vEO_spec );
167 Vec_IntFree( pBnd->vEI_impl );
168 Vec_IntFree( pBnd->vEO_impl );
169 Vec_BitFree( pBnd->vEI_phase );
170 Vec_BitFree( pBnd->vEO_phase );
171
172 ABC_FREE( pBnd );
173}
#define ABC_FREE(obj)
Definition abc_global.h:267

◆ Cbs_ManAlloc()

Cbs_Man_t * Cbs_ManAlloc ( Gia_Man_t * pGia)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 153 of file giaCSat.c.

154{
155 Cbs_Man_t * p;
156 p = ABC_CALLOC( Cbs_Man_t, 1 );
157 p->pProp.nSize = p->pJust.nSize = p->pClauses.nSize = 10000;
158 p->pProp.pData = ABC_ALLOC( Gia_Obj_t *, p->pProp.nSize );
159 p->pJust.pData = ABC_ALLOC( Gia_Obj_t *, p->pJust.nSize );
160 p->pClauses.pData = ABC_ALLOC( Gia_Obj_t *, p->pClauses.nSize );
161 p->pClauses.iHead = p->pClauses.iTail = 1;
162 p->vModel = Vec_IntAlloc( 1000 );
163 p->vLevReas = Vec_IntAlloc( 1000 );
164 p->vTemp = Vec_PtrAlloc( 1000 );
165 p->pAig = pGia;
166 Cbs_SetDefaultParams( &p->Pars );
167 return p;
168}
void Cbs_SetDefaultParams(Cbs_Par_t *pPars)
FUNCTION DEFINITIONS ///.
Definition giaCSat.c:127
struct Cbs_Man_t_ Cbs_Man_t
Definition gia.h:1305
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Cbs_ManSetConflictNum()

void Cbs_ManSetConflictNum ( Cbs_Man_t * p,
int Num )
extern

Definition at line 137 of file giaCSat.c.

138{
139 p->Pars.nBTLimit = Num;
140}

◆ Cbs_ManSolve()

int Cbs_ManSolve ( Cbs_Man_t * p,
Gia_Obj_t * pObj )
extern

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 [The two procedures differ in the CEX format.]

SeeAlso []

Definition at line 947 of file giaCSat.c.

948{
949 int RetValue = 0;
950 s_Counter = 0;
951 assert( !p->pProp.iHead && !p->pProp.iTail );
952 assert( !p->pJust.iHead && !p->pJust.iTail );
953 assert( p->pClauses.iHead == 1 && p->pClauses.iTail == 1 );
954 p->Pars.nBTThis = p->Pars.nJustThis = p->Pars.nBTThisNc = 0;
955 Cbs_ManAssign( p, pObj, 0, NULL, NULL );
956 if ( !Cbs_ManSolve_rec(p, 0) && !Cbs_ManCheckLimits(p) )
957 Cbs_ManSaveModel( p, p->vModel );
958 else
959 RetValue = 1;
960 Cbs_ManCancelUntil( p, 0 );
961 p->pJust.iHead = p->pJust.iTail = 0;
962 p->pClauses.iHead = p->pClauses.iTail = 1;
963 p->Pars.nBTTotal += p->Pars.nBTThis;
964 p->Pars.nJustTotal = Abc_MaxInt( p->Pars.nJustTotal, p->Pars.nJustThis );
965 if ( Cbs_ManCheckLimits( p ) )
966 RetValue = -1;
967// printf( "%d ", s_Counter );
968 return RetValue;
969}
int Cbs_ManSolve_rec(Cbs_Man_t *p, int Level)
Definition giaCSat.c:875
int s_Counter
Definition giaCSat.c:494
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Cbs_ManSolve2()

int Cbs_ManSolve2 ( Cbs_Man_t * p,
Gia_Obj_t * pObj,
Gia_Obj_t * pObj2 )
extern

Definition at line 970 of file giaCSat.c.

971{
972 int RetValue = 0;
973 s_Counter = 0;
974 assert( !p->pProp.iHead && !p->pProp.iTail );
975 assert( !p->pJust.iHead && !p->pJust.iTail );
976 assert( p->pClauses.iHead == 1 && p->pClauses.iTail == 1 );
977 p->Pars.nBTThis = p->Pars.nJustThis = p->Pars.nBTThisNc = 0;
978 Cbs_ManAssign( p, pObj, 0, NULL, NULL );
979 if ( pObj2 )
980 Cbs_ManAssign( p, pObj2, 0, NULL, NULL );
981 if ( !Cbs_ManSolve_rec(p, 0) && !Cbs_ManCheckLimits(p) )
982 Cbs_ManSaveModelAll( p, p->vModel );
983 else
984 RetValue = 1;
985 Cbs_ManCancelUntil( p, 0 );
986 p->pJust.iHead = p->pJust.iTail = 0;
987 p->pClauses.iHead = p->pClauses.iTail = 1;
988 p->Pars.nBTTotal += p->Pars.nBTThis;
989 p->Pars.nJustTotal = Abc_MaxInt( p->Pars.nJustTotal, p->Pars.nJustThis );
990 if ( Cbs_ManCheckLimits( p ) )
991 RetValue = -1;
992// printf( "%d ", s_Counter );
993 return RetValue;
994}
Here is the call graph for this function:

◆ Cbs_ManSolveMiter()

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

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}
ABC_INT64_T abctime
Definition abc_global.h:332
struct Vec_Str_t_ Vec_Str_t
Definition bblif.c:46
void Cec_ManSatAddToStore(Vec_Int_t *vCexStore, Vec_Int_t *vCex, int Out)
Definition cecSolve.c:996
int Cbs0_ManSolve(Cbs0_Man_t *p, Gia_Obj_t *pObj)
Definition giaCSatOld.c:646
void Cbs0_ManStop(Cbs0_Man_t *p)
Definition giaCSatOld.c:154
struct Cbs0_Man_t_ Cbs0_Man_t
Definition giaCSatOld.c:58
Vec_Int_t * Cbs0_ReadModel(Cbs0_Man_t *p)
Definition giaCSatOld.c:173
void Cbs0_ManSatPrintStats(Cbs0_Man_t *p)
Definition giaCSatOld.c:678
Cbs0_Man_t * Cbs0_ManAlloc()
Definition giaCSatOld.c:131
void Gia_ManCleanMark0(Gia_Man_t *p)
Definition giaUtil.c:256
void Gia_ManCreateRefs(Gia_Man_t *p)
Definition giaUtil.c:779
void Gia_ManCleanMark1(Gia_Man_t *p)
Definition giaUtil.c:313
Here is the call graph for this function:

◆ Cbs_ManSolveMiterNc()

Vec_Int_t * Cbs_ManSolveMiterNc ( Gia_Man_t * pAig,
int nConfs,
Vec_Str_t ** pvStatus,
int f0Proved,
int fVerbose )
extern

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

Synopsis [Procedure to test the new SAT solver.]

Description []

SideEffects []

SeeAlso []

Definition at line 1037 of file giaCSat.c.

1038{
1039 extern void Gia_ManCollectTest( Gia_Man_t * pAig );
1040 extern void Cec_ManSatAddToStore( Vec_Int_t * vCexStore, Vec_Int_t * vCex, int Out );
1041 Cbs_Man_t * p;
1042 Vec_Int_t * vCex, * vVisit, * vCexStore;
1043 Vec_Str_t * vStatus;
1044 Gia_Obj_t * pRoot;
1045 int i, status;
1046 abctime clk, clkTotal = Abc_Clock();
1047 assert( Gia_ManRegNum(pAig) == 0 );
1048// Gia_ManCollectTest( pAig );
1049 // prepare AIG
1050 Gia_ManCreateRefs( pAig );
1051 Gia_ManCleanMark0( pAig );
1052 Gia_ManCleanMark1( pAig );
1053 Gia_ManFillValue( pAig ); // maps nodes into trail ids
1054 Gia_ManSetPhase( pAig ); // maps nodes into trail ids
1055 // create logic network
1056 p = Cbs_ManAlloc( pAig );
1057 p->Pars.nBTLimit = nConfs;
1058 // create resulting data-structures
1059 vStatus = Vec_StrAlloc( Gia_ManPoNum(pAig) );
1060 vCexStore = Vec_IntAlloc( 10000 );
1061 vVisit = Vec_IntAlloc( 100 );
1062 vCex = Cbs_ReadModel( p );
1063 // solve for each output
1064 Gia_ManForEachCo( pAig, pRoot, i )
1065 {
1066// printf( "\n" );
1067
1068 Vec_IntClear( vCex );
1069 if ( Gia_ObjIsConst0(Gia_ObjFanin0(pRoot)) )
1070 {
1071 if ( Gia_ObjFaninC0(pRoot) )
1072 {
1073// printf( "Constant 1 output of SRM!!!\n" );
1074 Cec_ManSatAddToStore( vCexStore, vCex, i ); // trivial counter-example
1075 Vec_StrPush( vStatus, 0 );
1076 }
1077 else
1078 {
1079// printf( "Constant 0 output of SRM!!!\n" );
1080 Vec_StrPush( vStatus, 1 );
1081 }
1082 continue;
1083 }
1084 clk = Abc_Clock();
1085 p->Pars.fUseHighest = 1;
1086 p->Pars.fUseLowest = 0;
1087 status = Cbs_ManSolve( p, Gia_ObjChild0(pRoot) );
1088// printf( "\n" );
1089/*
1090 if ( status == -1 )
1091 {
1092 p->Pars.fUseHighest = 0;
1093 p->Pars.fUseLowest = 1;
1094 status = Cbs_ManSolve( p, Gia_ObjChild0(pRoot) );
1095 }
1096*/
1097 Vec_StrPush( vStatus, (char)status );
1098 if ( status == -1 )
1099 {
1100 p->nSatUndec++;
1101 p->nConfUndec += p->Pars.nBTThis;
1102 Cec_ManSatAddToStore( vCexStore, NULL, i ); // timeout
1103 p->timeSatUndec += Abc_Clock() - clk;
1104 continue;
1105 }
1106 if ( status == 1 )
1107 {
1108 if ( f0Proved )
1109 Gia_ManPatchCoDriver( pAig, i, 0 );
1110 p->nSatUnsat++;
1111 p->nConfUnsat += p->Pars.nBTThis;
1112 p->timeSatUnsat += Abc_Clock() - clk;
1113 continue;
1114 }
1115 p->nSatSat++;
1116 p->nConfSat += p->Pars.nBTThis;
1117// Gia_SatVerifyPattern( pAig, pRoot, vCex, vVisit );
1118 Cec_ManSatAddToStore( vCexStore, vCex, i );
1119 p->timeSatSat += Abc_Clock() - clk;
1120 }
1121 Vec_IntFree( vVisit );
1122 p->nSatTotal = Gia_ManPoNum(pAig);
1123 p->timeTotal = Abc_Clock() - clkTotal;
1124 if ( fVerbose )
1126// printf( "RecCalls = %8d. RecClause = %8d. RecNonChro = %8d.\n", p->nRecCall, p->nRecClause, p->nRecNonChro );
1127 Cbs_ManStop( p );
1128 *pvStatus = vStatus;
1129
1130// printf( "Total number of cex literals = %d. (Ave = %d)\n",
1131// Vec_IntSize(vCexStore)-2*p->nSatUndec-2*p->nSatSat,
1132// (Vec_IntSize(vCexStore)-2*p->nSatUndec-2*p->nSatSat)/p->nSatSat );
1133 return vCexStore;
1134}
void Cbs_ManSatPrintStats(Cbs_Man_t *p)
Definition giaCSat.c:1007
Cbs_Man_t * Cbs_ManAlloc(Gia_Man_t *pGia)
Definition giaCSat.c:153
Vec_Int_t * Cbs_ReadModel(Cbs_Man_t *p)
Definition giaCSat.c:203
int Cbs_ManSolve(Cbs_Man_t *p, Gia_Obj_t *pObj)
Definition giaCSat.c:947
void Cbs_ManStop(Cbs_Man_t *p)
Definition giaCSat.c:181
void Gia_ManCollectTest(Gia_Man_t *p)
Definition giaDfs.c:232
void Gia_ManSetPhase(Gia_Man_t *p)
Definition giaUtil.c:420
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Cbs_ManStop()

void Cbs_ManStop ( Cbs_Man_t * p)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 181 of file giaCSat.c.

182{
183 Vec_IntFree( p->vLevReas );
184 Vec_IntFree( p->vModel );
185 Vec_PtrFree( p->vTemp );
186 ABC_FREE( p->pClauses.pData );
187 ABC_FREE( p->pProp.pData );
188 ABC_FREE( p->pJust.pData );
189 ABC_FREE( p );
190}
Here is the caller graph for this function:

◆ Cbs_ReadModel()

Vec_Int_t * Cbs_ReadModel ( Cbs_Man_t * p)
extern

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

Synopsis [Returns satisfying assignment.]

Description []

SideEffects []

SeeAlso []

Definition at line 203 of file giaCSat.c.

204{
205 return p->vModel;
206}
Here is the caller graph for this function:

◆ For_ManExperiment()

void For_ManExperiment ( Gia_Man_t * pGia,
int nIters,
int fClustered,
int fVerbose )
extern

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 )
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
void Frc_ManStop(Frc_Man_t *p)
Definition giaForce.c:584
Frc_Man_t * Frc_ManStart(Gia_Man_t *pGia)
Definition giaForce.c:428
struct Frc_Man_t_ Frc_Man_t
Definition giaForce.c:55
void Frc_ManPrintStats(Frc_Man_t *p)
Definition giaForce.c:557
void Frc_ManPlacementRefine(Frc_Man_t *p, int nIters, int fVerbose)
Definition giaForce.c:886
unsigned Gia_ManRandom(int fReset)
FUNCTION DEFINITIONS ///.
Definition giaUtil.c:49
Here is the call graph for this function:

◆ Gia_AigerRead()

Gia_Man_t * Gia_AigerRead ( char * pFileName,
int fGiaSimple,
int fSkipStrash,
int fCheck )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 1017 of file giaAiger.c.

1018{
1019 FILE * pFile;
1020 Gia_Man_t * pNew;
1021 char * pName, * pContents;
1022 int nFileSize;
1023 int RetValue;
1024
1025 // read the file into the buffer
1026 Gia_FileFixName( pFileName );
1027 nFileSize = Gia_FileSize( pFileName );
1028 pFile = fopen( pFileName, "rb" );
1029 pContents = ABC_ALLOC( char, nFileSize );
1030 RetValue = fread( pContents, nFileSize, 1, pFile );
1031 fclose( pFile );
1032
1033 pNew = Gia_AigerReadFromMemory( pContents, nFileSize, fGiaSimple, fSkipStrash, fCheck );
1034 ABC_FREE( pContents );
1035 if ( pNew )
1036 {
1037 ABC_FREE( pNew->pName );
1038 pName = Gia_FileNameGeneric( pFileName );
1039 pNew->pName = Abc_UtilStrsav( pName );
1040 ABC_FREE( pName );
1041
1042 assert( pNew->pSpec == NULL );
1043 pNew->pSpec = Abc_UtilStrsav( pFileName );
1044 }
1045 return pNew;
1046}
int Gia_FileSize(char *pFileName)
FUNCTION DECLARATIONS ///.
Definition giaAiger.c:64
void Gia_FileFixName(char *pFileName)
DECLARATIONS ///.
Definition giaAiger.c:49
char * Gia_FileNameGeneric(char *FileName)
Definition giaAiger.c:56
Gia_Man_t * Gia_AigerReadFromMemory(char *pContents, int nFileSize, int fGiaSimple, int fSkipStrash, int fCheck)
Definition giaAiger.c:176
char * pSpec
Definition gia.h:100
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_AigerReadFromMemory()

Gia_Man_t * Gia_AigerReadFromMemory ( char * pContents,
int nFileSize,
int fGiaSimple,
int fSkipStrash,
int fCheck )
extern

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_Ptr_t * vNamesIn = NULL, * vNamesOut = NULL, * vNamesRegIn = NULL, * vNamesRegOut = NULL, * vNamesNode = NULL;
180 Vec_Int_t * vLits = NULL, * vPoTypes = NULL;
181 Vec_Int_t * vNodes, * vDrivers, * vInits = NULL;
182 int iObj, iNode0, iNode1, fHieOnly = 0;
183 int nTotal, nInputs, nOutputs, nLatches, nAnds, i;
184 int nBad = 0, nConstr = 0, nJust = 0, nFair = 0;
185 unsigned char * pDrivers, * pSymbols, * pCur;
186 unsigned uLit0, uLit1, uLit;
187
188 // read the parameters (M I L O A + B C J F)
189 pCur = (unsigned char *)pContents; while ( *pCur != ' ' ) pCur++; pCur++;
190 // read the number of objects
191 nTotal = atoi( (const char *)pCur ); while ( *pCur != ' ' ) pCur++; pCur++;
192 // read the number of inputs
193 nInputs = atoi( (const char *)pCur ); while ( *pCur != ' ' ) pCur++; pCur++;
194 // read the number of latches
195 nLatches = atoi( (const char *)pCur ); while ( *pCur != ' ' ) pCur++; pCur++;
196 // read the number of outputs
197 nOutputs = atoi( (const char *)pCur ); while ( *pCur != ' ' ) pCur++; pCur++;
198 // read the number of nodes
199 nAnds = atoi( (const char *)pCur ); while ( *pCur != ' ' && *pCur != '\n' ) pCur++;
200 if ( *pCur == ' ' )
201 {
202// assert( nOutputs == 0 );
203 // read the number of properties
204 pCur++;
205 nBad = atoi( (const char *)pCur ); while ( *pCur != ' ' && *pCur != '\n' ) pCur++;
206 nOutputs += nBad;
207 }
208 if ( *pCur == ' ' )
209 {
210 // read the number of properties
211 pCur++;
212 nConstr = atoi( (const char *)pCur ); while ( *pCur != ' ' && *pCur != '\n' ) pCur++;
213 nOutputs += nConstr;
214 }
215 if ( *pCur == ' ' )
216 {
217 // read the number of properties
218 pCur++;
219 nJust = atoi( (const char *)pCur ); while ( *pCur != ' ' && *pCur != '\n' ) pCur++;
220 nOutputs += nJust;
221 }
222 if ( *pCur == ' ' )
223 {
224 // read the number of properties
225 pCur++;
226 nFair = atoi( (const char *)pCur ); while ( *pCur != ' ' && *pCur != '\n' ) pCur++;
227 nOutputs += nFair;
228 }
229 if ( *pCur != '\n' )
230 {
231 fprintf( stdout, "The parameter line is in a wrong format.\n" );
232 return NULL;
233 }
234 pCur++;
235
236 // check the parameters
237 if ( nTotal != nInputs + nLatches + nAnds )
238 {
239 fprintf( stdout, "The number of objects does not match.\n" );
240 return NULL;
241 }
242 if ( nJust || nFair )
243 {
244 fprintf( stdout, "Reading AIGER files with liveness properties is currently not supported.\n" );
245 return NULL;
246 }
247
248 if ( nConstr )
249 {
250 if ( nConstr == 1 )
251 fprintf( stdout, "Warning: The last output is interpreted as a constraint.\n" );
252 else
253 fprintf( stdout, "Warning: The last %d outputs are interpreted as constraints.\n", nConstr );
254 }
255
256 // allocate the empty AIG
257 pNew = Gia_ManStart( nTotal + nLatches + nOutputs + 1 );
258 pNew->nConstrs = nConstr;
259 pNew->fGiaSimple = fGiaSimple;
260
261 // prepare the array of nodes
262 vNodes = Vec_IntAlloc( 1 + nTotal );
263 Vec_IntPush( vNodes, 0 );
264
265 // create the PIs
266 for ( i = 0; i < nInputs + nLatches; i++ )
267 {
268 iObj = Gia_ManAppendCi(pNew);
269 Vec_IntPush( vNodes, iObj );
270 }
271
272 // remember the beginning of latch/PO literals
273 pDrivers = pCur;
274 if ( pContents[3] == ' ' ) // standard AIGER
275 {
276 // scroll to the beginning of the binary data
277 for ( i = 0; i < nLatches + nOutputs; )
278 if ( *pCur++ == '\n' )
279 i++;
280 }
281 else // modified AIGER
282 {
283 vLits = Gia_AigerReadLiterals( &pCur, nLatches + nOutputs );
284 }
285
286 // create the AND gates
287 if ( !fGiaSimple && !fSkipStrash )
288 Gia_ManHashAlloc( pNew );
289 for ( i = 0; i < nAnds; i++ )
290 {
291 uLit = ((i + 1 + nInputs + nLatches) << 1);
292 uLit1 = uLit - Gia_AigerReadUnsigned( &pCur );
293 uLit0 = uLit1 - Gia_AigerReadUnsigned( &pCur );
294// assert( uLit1 > uLit0 );
295 iNode0 = Abc_LitNotCond( Vec_IntEntry(vNodes, uLit0 >> 1), uLit0 & 1 );
296 iNode1 = Abc_LitNotCond( Vec_IntEntry(vNodes, uLit1 >> 1), uLit1 & 1 );
297 assert( Vec_IntSize(vNodes) == i + 1 + nInputs + nLatches );
298 if ( !fGiaSimple && fSkipStrash )
299 {
300 if ( iNode0 == iNode1 )
301 Vec_IntPush( vNodes, Gia_ManAppendBuf(pNew, iNode0) );
302 else
303 Vec_IntPush( vNodes, Gia_ManAppendAnd(pNew, iNode0, iNode1) );
304 }
305 else
306 Vec_IntPush( vNodes, Gia_ManHashAnd(pNew, iNode0, iNode1) );
307 }
308 if ( !fGiaSimple && !fSkipStrash )
309 Gia_ManHashStop( pNew );
310
311 // remember the place where symbols begin
312 pSymbols = pCur;
313
314 // read the latch driver literals
315 vDrivers = Vec_IntAlloc( nLatches + nOutputs );
316 if ( pContents[3] == ' ' ) // standard AIGER
317 {
318 vInits = Vec_IntAlloc( nLatches );
319 pCur = pDrivers;
320 for ( i = 0; i < nLatches; i++ )
321 {
322 uLit0 = atoi( (char *)pCur );
323 while ( *pCur != ' ' && *pCur != '\n' )
324 pCur++;
325 if ( *pCur == ' ' )
326 {
327 pCur++;
328 Vec_IntPush( vInits, atoi( (char *)pCur ) );
329 while ( *pCur++ != '\n' );
330 }
331 else
332 {
333 pCur++;
334 Vec_IntPush( vInits, 0 );
335 }
336 iNode0 = Abc_LitNotCond( Vec_IntEntry(vNodes, uLit0 >> 1), (uLit0 & 1) );
337 Vec_IntPush( vDrivers, iNode0 );
338 }
339 // read the PO driver literals
340 for ( i = 0; i < nOutputs; i++ )
341 {
342 uLit0 = atoi( (char *)pCur ); while ( *pCur++ != '\n' );
343 iNode0 = Abc_LitNotCond( Vec_IntEntry(vNodes, uLit0 >> 1), (uLit0 & 1) );
344 Vec_IntPush( vDrivers, iNode0 );
345 }
346
347 }
348 else
349 {
350 // read the latch driver literals
351 for ( i = 0; i < nLatches; i++ )
352 {
353 uLit0 = Vec_IntEntry( vLits, i );
354 iNode0 = Abc_LitNotCond( Vec_IntEntry(vNodes, uLit0 >> 1), (uLit0 & 1) );
355 Vec_IntPush( vDrivers, iNode0 );
356 }
357 // read the PO driver literals
358 for ( i = 0; i < nOutputs; i++ )
359 {
360 uLit0 = Vec_IntEntry( vLits, i+nLatches );
361 iNode0 = Abc_LitNotCond( Vec_IntEntry(vNodes, uLit0 >> 1), (uLit0 & 1) );
362 Vec_IntPush( vDrivers, iNode0 );
363 }
364 Vec_IntFree( vLits );
365 }
366
367 // create the POs
368 for ( i = 0; i < nOutputs; i++ )
369 Gia_ManAppendCo( pNew, Vec_IntEntry(vDrivers, nLatches + i) );
370 for ( i = 0; i < nLatches; i++ )
371 Gia_ManAppendCo( pNew, Vec_IntEntry(vDrivers, i) );
372 Vec_IntFree( vDrivers );
373
374 // create the latches
375 Gia_ManSetRegNum( pNew, nLatches );
376
377 // read signal names if they are of the special type
378 pCur = pSymbols;
379 if ( pCur < (unsigned char *)pContents + nFileSize && *pCur != 'c' )
380 {
381 int fReadNames = 1;
382 if ( fReadNames )
383 {
384 int fError = 0;
385 while ( !fError && pCur < (unsigned char *)pContents + nFileSize && *pCur != 'c' )
386 {
387 int iTerm;
388 char * pType = (char *)pCur;
389 char * pName = NULL;
390 // check terminal type
391 if ( *pCur != 'i' && *pCur != 'o' && *pCur != 'l' && *pCur != 'n' )
392 {
393 fError = 1;
394 break;
395 }
396 // get terminal number
397 iTerm = atoi( (char *)++pCur ); while ( *pCur++ != ' ' );
398 // skip spaces
399 while ( *pCur == ' ' )
400 pCur++;
401 // skip till the end of line
402 for ( pName = (char *)pCur; *pCur && *pCur != '\n'; pCur++ );
403 if ( *pCur == '\n' )
404 *pCur = 0;
405 // save the name
406 if ( *pType == 'i' )
407 {
408 if ( vNamesIn == NULL )
409 vNamesIn = Vec_PtrStart( nInputs );
410 if ( Vec_PtrSize(vNamesIn) <= iTerm )
411 {
412 fError = 1;
413 break;
414 }
415 Vec_PtrWriteEntry( vNamesIn, iTerm, Abc_UtilStrsav(pName) );
416 }
417 else if ( *pType == 'o' )
418 {
419 if ( vNamesOut == NULL )
420 vNamesOut = Vec_PtrStart( nOutputs );
421 if ( Vec_PtrSize(vNamesOut) <= iTerm )
422 {
423 fError = 1;
424 break;
425 }
426 Vec_PtrWriteEntry( vNamesOut, iTerm, Abc_UtilStrsav(pName) );
427 }
428 else if ( *pType == 'l' )
429 {
430 char Buffer[1000];
431 assert( strlen(pName) < 995 );
432 sprintf( Buffer, "%s_in", pName );
433 if ( vNamesRegIn == NULL )
434 vNamesRegIn = Vec_PtrStart( nLatches );
435 if ( vNamesRegOut == NULL )
436 vNamesRegOut = Vec_PtrStart( nLatches );
437 if ( Vec_PtrSize(vNamesRegIn) <= iTerm )
438 {
439 fError = 1;
440 break;
441 }
442 Vec_PtrWriteEntry( vNamesRegIn, iTerm, Abc_UtilStrsav(Buffer) );
443 Vec_PtrWriteEntry( vNamesRegOut, iTerm, Abc_UtilStrsav(pName) );
444 }
445 else if ( *pType == 'n' )
446 {
447 if ( Vec_IntSize(&pNew->vHTable) != 0 )
448 {
449 printf( "Structural hashing should be disabled to read internal nodes names.\n" );
450 fError = 1;
451 break;
452 }
453 if ( vNamesNode == NULL )
454 vNamesNode = Vec_PtrStart( Gia_ManObjNum(pNew) );
455 Vec_PtrWriteEntry( vNamesNode, iTerm, Abc_UtilStrsav(pName) );
456 }
457 else
458 {
459 fError = 1;
460 break;
461 }
462 pCur++;
463 }
464 if ( fError )
465 {
466 printf( "Error occurred when reading signal names. Signal names ignored.\n" );
467 if ( vNamesIn ) Vec_PtrFreeFree( vNamesIn ), vNamesIn = NULL;
468 if ( vNamesOut ) Vec_PtrFreeFree( vNamesOut ), vNamesOut = NULL;
469 if ( vNamesRegIn ) Vec_PtrFreeFree( vNamesRegIn ), vNamesRegIn = NULL;
470 if ( vNamesRegOut ) Vec_PtrFreeFree( vNamesRegOut ), vNamesRegOut = NULL;
471 if ( vNamesNode ) Vec_PtrFreeFree( vNamesNode ), vNamesNode = NULL;
472 }
473 }
474 else
475 {
476 int fBreakUsed = 0;
477 unsigned char * pCurOld = pCur;
478 pNew->vUserPiIds = Vec_IntStartFull( nInputs );
479 pNew->vUserPoIds = Vec_IntStartFull( nOutputs );
480 pNew->vUserFfIds = Vec_IntStartFull( nLatches );
481 while ( pCur < (unsigned char *)pContents + nFileSize && *pCur != 'c' )
482 {
483 int iTerm;
484 char * pType = (char *)pCur;
485 // check terminal type
486 if ( *pCur != 'i' && *pCur != 'o' && *pCur != 'l' )
487 {
488// fprintf( stdout, "Wrong terminal type.\n" );
489 fBreakUsed = 1;
490 break;
491 }
492 // get terminal number
493 iTerm = atoi( (char *)++pCur ); while ( *pCur++ != ' ' );
494 // skip spaces
495 while ( *pCur == ' ' )
496 pCur++;
497 // decode the user numbers:
498 // flops are named: @l<num>
499 // PIs are named: @i<num>
500 // POs are named: @o<num>
501 if ( *pCur++ != '@' )
502 {
503 fBreakUsed = 1;
504 break;
505 }
506 if ( *pCur == 'i' && *pType == 'i' )
507 Vec_IntWriteEntry( pNew->vUserPiIds, iTerm, atoi((char *)pCur+1) );
508 else if ( *pCur == 'o' && *pType == 'o' )
509 Vec_IntWriteEntry( pNew->vUserPoIds, iTerm, atoi((char *)pCur+1) );
510 else if ( *pCur == 'l' && *pType == 'l' )
511 Vec_IntWriteEntry( pNew->vUserFfIds, iTerm, atoi((char *)pCur+1) );
512 else
513 {
514 fprintf( stdout, "Wrong name format.\n" );
515 fBreakUsed = 1;
516 break;
517 }
518 // skip digits
519 while ( *pCur++ != '\n' );
520 }
521 // in case of abnormal termination, remove the arrays
522 if ( fBreakUsed )
523 {
524 unsigned char * pName;
525 int Entry, nInvars, nConstr, iTerm;
526
527 Vec_Int_t * vPoNames = Vec_IntStartFull( nOutputs );
528
529 Vec_IntFreeP( &pNew->vUserPiIds );
530 Vec_IntFreeP( &pNew->vUserPoIds );
531 Vec_IntFreeP( &pNew->vUserFfIds );
532
533 // try to figure out signal names
534 fBreakUsed = 0;
535 pCur = (unsigned char *)pCurOld;
536 while ( pCur < (unsigned char *)pContents + nFileSize && *pCur != 'c' )
537 {
538 // get the terminal type
539 if ( *pCur == 'i' || *pCur == 'l' )
540 {
541 // skip till the end of the line
542 while ( *pCur++ != '\n' );
543 *(pCur-1) = 0;
544 continue;
545 }
546 if ( *pCur != 'o' )
547 {
548// fprintf( stdout, "Wrong terminal type.\n" );
549 fBreakUsed = 1;
550 break;
551 }
552 // get the terminal number
553 iTerm = atoi( (char *)++pCur ); while ( *pCur++ != ' ' );
554 // get the node
555 if ( iTerm < 0 || iTerm >= nOutputs )
556 {
557 fprintf( stdout, "The output number (%d) is out of range.\n", iTerm );
558 fBreakUsed = 1;
559 break;
560 }
561 if ( Vec_IntEntry(vPoNames, iTerm) != ~0 )
562 {
563 fprintf( stdout, "The output number (%d) is listed twice.\n", iTerm );
564 fBreakUsed = 1;
565 break;
566 }
567
568 // get the name
569 pName = pCur; while ( *pCur++ != '\n' );
570 *(pCur-1) = 0;
571 // assign the name
572 Vec_IntWriteEntry( vPoNames, iTerm, pName - (unsigned char *)pContents );
573 }
574
575 // check that all names are assigned
576 if ( !fBreakUsed )
577 {
578 nInvars = nConstr = 0;
579 vPoTypes = Vec_IntStart( Gia_ManPoNum(pNew) );
580 Vec_IntForEachEntry( vPoNames, Entry, i )
581 {
582 if ( Entry == ~0 )
583 continue;
584 if ( strncmp( pContents+Entry, "constraint:", 11 ) == 0 )
585 {
586 Vec_IntWriteEntry( vPoTypes, i, 1 );
587 nConstr++;
588 }
589 if ( strncmp( pContents+Entry, "invariant:", 10 ) == 0 )
590 {
591 Vec_IntWriteEntry( vPoTypes, i, 2 );
592 nInvars++;
593 }
594 }
595 if ( nConstr )
596 fprintf( stdout, "Recognized and added %d constraints.\n", nConstr );
597 if ( nInvars )
598 fprintf( stdout, "Recognized and skipped %d invariants.\n", nInvars );
599 if ( nConstr == 0 && nInvars == 0 )
600 Vec_IntFreeP( &vPoTypes );
601 }
602 Vec_IntFree( vPoNames );
603 }
604 }
605 }
606
607
608 // check if there are other types of information to read
609 if ( pCur + 1 < (unsigned char *)pContents + nFileSize && *pCur == 'c' )
610 {
611 int fVerbose = XAIG_VERBOSE;
612 Vec_Str_t * vStr;
613 unsigned char * pCurTemp;
614 pCur++;
615 // skip new line if present
616// if ( *pCur == '\n' )
617// pCur++;
618 while ( pCur < (unsigned char *)pContents + nFileSize )
619 {
620 // read extra AIG
621 if ( *pCur == 'a' )
622 {
623 pCur++;
624 vStr = Vec_StrStart( Gia_AigerReadInt(pCur) ); pCur += 4;
625 memcpy( Vec_StrArray(vStr), pCur, (size_t)Vec_StrSize(vStr) );
626 pCur += Vec_StrSize(vStr);
627 pNew->pAigExtra = Gia_AigerReadFromMemory( Vec_StrArray(vStr), Vec_StrSize(vStr), 0, 0, 0 );
628 Vec_StrFree( vStr );
629 if ( fVerbose ) printf( "Finished reading extension \"a\".\n" );
630 }
631 // read number of constraints
632 else if ( *pCur == 'c' )
633 {
634 pCur++;
635 assert( Gia_AigerReadInt(pCur) == 4 ); pCur += 4;
636 pNew->nConstrs = Gia_AigerReadInt( pCur ); pCur += 4;
637 if ( fVerbose ) printf( "Finished reading extension \"c\".\n" );
638 }
639 // read delay information
640 else if ( *pCur == 'd' )
641 {
642 pCur++;
643 assert( Gia_AigerReadInt(pCur) == 4 ); pCur += 4;
644 pNew->nAnd2Delay = Gia_AigerReadInt(pCur); pCur += 4;
645 if ( fVerbose ) printf( "Finished reading extension \"d\".\n" );
646 }
647 else if ( *pCur == 'i' )
648 {
649 pCur++;
650 nInputs = Gia_AigerReadInt(pCur)/4; pCur += 4;
651 pNew->vInArrs = Vec_FltStart( nInputs );
652 memcpy( Vec_FltArray(pNew->vInArrs), pCur, (size_t)4*nInputs ); pCur += 4*nInputs;
653 if ( fVerbose ) printf( "Finished reading extension \"i\".\n" );
654 }
655 else if ( *pCur == 'o' )
656 {
657 pCur++;
658 nOutputs = Gia_AigerReadInt(pCur)/4; pCur += 4;
659 pNew->vOutReqs = Vec_FltStart( nOutputs );
660 memcpy( Vec_FltArray(pNew->vOutReqs), pCur, (size_t)4*nOutputs ); pCur += 4*nOutputs;
661 if ( fVerbose ) printf( "Finished reading extension \"o\".\n" );
662 }
663 // read equivalence classes
664 else if ( *pCur == 'e' )
665 {
666 extern Gia_Rpr_t * Gia_AigerReadEquivClasses( unsigned char ** ppPos, int nSize );
667 pCur++;
668 pCurTemp = pCur + Gia_AigerReadInt(pCur) + 4; pCur += 4;
669 pNew->pReprs = Gia_AigerReadEquivClasses( &pCur, Gia_ManObjNum(pNew) );
670 pNew->pNexts = Gia_ManDeriveNexts( pNew );
671 assert( pCur == pCurTemp );
672 if ( fVerbose ) printf( "Finished reading extension \"e\".\n" );
673 }
674 // read flop classes
675 else if ( *pCur == 'f' )
676 {
677 pCur++;
678 assert( Gia_AigerReadInt(pCur) == 4*Gia_ManRegNum(pNew) ); pCur += 4;
679 pNew->vFlopClasses = Vec_IntStart( Gia_ManRegNum(pNew) );
680 memcpy( Vec_IntArray(pNew->vFlopClasses), pCur, (size_t)4*Gia_ManRegNum(pNew) ); pCur += 4*Gia_ManRegNum(pNew);
681 if ( fVerbose ) printf( "Finished reading extension \"f\".\n" );
682 }
683 // read gate classes
684 else if ( *pCur == 'g' )
685 {
686 pCur++;
687 assert( Gia_AigerReadInt(pCur) == 4*Gia_ManObjNum(pNew) ); pCur += 4;
688 pNew->vGateClasses = Vec_IntStart( Gia_ManObjNum(pNew) );
689 memcpy( Vec_IntArray(pNew->vGateClasses), pCur, (size_t)4*Gia_ManObjNum(pNew) ); pCur += 4*Gia_ManObjNum(pNew);
690 if ( fVerbose ) printf( "Finished reading extension \"g\".\n" );
691 }
692 // read hierarchy information
693 else if ( *pCur == 'h' )
694 {
695 pCur++;
696 vStr = Vec_StrStart( Gia_AigerReadInt(pCur) ); pCur += 4;
697 memcpy( Vec_StrArray(vStr), pCur, (size_t)Vec_StrSize(vStr) );
698 pCur += Vec_StrSize(vStr);
699 pNew->pManTime = Tim_ManLoad( vStr, 1 );
700 Vec_StrFree( vStr );
701 fHieOnly = 1;
702 if ( fVerbose ) printf( "Finished reading extension \"h\".\n" );
703 }
704 // read packing
705 else if ( *pCur == 'k' )
706 {
707 extern Vec_Int_t * Gia_AigerReadPacking( unsigned char ** ppPos, int nSize );
708 int nSize;
709 pCur++;
710 nSize = Gia_AigerReadInt(pCur);
711 pCurTemp = pCur + nSize + 4; pCur += 4;
712 pNew->vPacking = Gia_AigerReadPacking( &pCur, nSize );
713 assert( pCur == pCurTemp );
714 if ( fVerbose ) printf( "Finished reading extension \"k\".\n" );
715 }
716 // read mapping
717 else if ( *pCur == 'm' )
718 {
719 extern int * Gia_AigerReadMapping( unsigned char ** ppPos, int nSize );
720 extern int * Gia_AigerReadMappingSimple( unsigned char ** ppPos, int nSize );
721 extern Vec_Int_t * Gia_AigerReadMappingDoc( unsigned char ** ppPos, int nObjs );
722 int nSize;
723 pCur++;
724 nSize = Gia_AigerReadInt(pCur);
725 pCurTemp = pCur + nSize + 4; pCur += 4;
726 pNew->vMapping = Gia_AigerReadMappingDoc( &pCur, Gia_ManObjNum(pNew) );
727 assert( pCur == pCurTemp );
728 if ( fVerbose ) printf( "Finished reading extension \"m\".\n" );
729 }
730 // read model name
731 else if ( *pCur == 'n' )
732 {
733 pCur++;
734 if ( (*pCur >= 'a' && *pCur <= 'z') || (*pCur >= 'A' && *pCur <= 'Z') || (*pCur >= '0' && *pCur <= '9') )
735 {
736 ABC_FREE( pNew->pName );
737 pNew->pName = Abc_UtilStrsav( (char *)pCur ); pCur += strlen(pNew->pName) + 1;
738 }
739 else
740 {
741 pCurTemp = pCur + Gia_AigerReadInt(pCur) + 4; pCur += 4;
742 ABC_FREE( pNew->pName );
743 pNew->pName = Abc_UtilStrsav( (char *)pCur ); pCur += strlen(pNew->pName) + 1;
744 assert( pCur == pCurTemp );
745 }
746 }
747 // read placement
748 else if ( *pCur == 'p' )
749 {
750 Gia_Plc_t * pPlacement;
751 pCur++;
752 pCurTemp = pCur + Gia_AigerReadInt(pCur) + 4; pCur += 4;
753 pPlacement = ABC_ALLOC( Gia_Plc_t, Gia_ManObjNum(pNew) );
754 memcpy( pPlacement, pCur, (size_t)4*Gia_ManObjNum(pNew) ); pCur += 4*Gia_ManObjNum(pNew);
755 assert( pCur == pCurTemp );
756 pNew->pPlacement = pPlacement;
757 if ( fVerbose ) printf( "Finished reading extension \"p\".\n" );
758 }
759 // read register classes
760 else if ( *pCur == 'r' )
761 {
762 int i, nRegs;
763 pCur++;
764 pCurTemp = pCur + Gia_AigerReadInt(pCur) + 4; pCur += 4;
765 nRegs = Gia_AigerReadInt(pCur); pCur += 4;
766 //nRegs = (pCurTemp - pCur)/4;
767 pNew->vRegClasses = Vec_IntAlloc( nRegs );
768 for ( i = 0; i < nRegs; i++ )
769 Vec_IntPush( pNew->vRegClasses, Gia_AigerReadInt(pCur) ), pCur += 4;
770 assert( pCur == pCurTemp );
771 if ( fVerbose ) printf( "Finished reading extension \"r\".\n" );
772 }
773 // read register inits
774 else if ( *pCur == 's' )
775 {
776 int i, nRegs;
777 pCur++;
778 pCurTemp = pCur + Gia_AigerReadInt(pCur) + 4; pCur += 4;
779 nRegs = Gia_AigerReadInt(pCur); pCur += 4;
780 pNew->vRegInits = Vec_IntAlloc( nRegs );
781 for ( i = 0; i < nRegs; i++ )
782 Vec_IntPush( pNew->vRegInits, Gia_AigerReadInt(pCur) ), pCur += 4;
783 assert( pCur == pCurTemp );
784 if ( fVerbose ) printf( "Finished reading extension \"s\".\n" );
785 }
786 // read configuration data
787 else if ( *pCur == 'b' )
788 {
789 int nSize;
790 pCur++;
791 nSize = Gia_AigerReadInt(pCur);
792 pCurTemp = pCur + nSize + 4; pCur += 4;
793 pNew->pCellStr = Abc_UtilStrsav( (char*)pCur ); pCur += strlen((char*)pCur) + 1;
794 nSize = nSize - strlen(pNew->pCellStr) - 1;
795 assert( nSize % 4 == 0 );
796 pNew->vConfigs = Vec_IntAlloc(nSize / 4);
797// memcpy(Vec_IntArray(pNew->vConfigs), pCur, (size_t)nSize); pCur += nSize;
798 for ( i = 0; i < nSize / 4; i++ )
799 Vec_IntPush( pNew->vConfigs, Gia_AigerReadInt(pCur) ), pCur += 4;
800 assert( pCur == pCurTemp );
801 if ( fVerbose ) printf( "Finished reading extension \"b\".\n" );
802 }
803 // read choices
804 else if ( *pCur == 'q' )
805 {
806 int i, nPairs, iRepr, iNode;
807 assert( !Gia_ManHasChoices(pNew) );
808 pNew->pSibls = ABC_CALLOC( int, Gia_ManObjNum(pNew) );
809 pCur++;
810 pCurTemp = pCur + Gia_AigerReadInt(pCur) + 4; pCur += 4;
811 nPairs = Gia_AigerReadInt(pCur); pCur += 4;
812 for ( i = 0; i < nPairs; i++ )
813 {
814 iRepr = Gia_AigerReadInt(pCur); pCur += 4;
815 iNode = Gia_AigerReadInt(pCur); pCur += 4;
816 pNew->pSibls[iRepr] = iNode;
817 assert( iRepr > iNode );
818 }
819 assert( pCur == pCurTemp );
820 if ( fVerbose ) printf( "Finished reading extension \"q\".\n" );
821 }
822 // read switching activity
823 else if ( *pCur == 'u' )
824 {
825 unsigned char * pSwitching;
826 pCur++;
827 pCurTemp = pCur + Gia_AigerReadInt(pCur) + 4; pCur += 4;
828 pSwitching = ABC_ALLOC( unsigned char, Gia_ManObjNum(pNew) );
829 memcpy( pSwitching, pCur, (size_t)Gia_ManObjNum(pNew) ); pCur += Gia_ManObjNum(pNew);
830 assert( pCur == pCurTemp );
831 if ( fVerbose ) printf( "Finished reading extension \"s\".\n" );
832 }
833 // read timing manager
834 else if ( *pCur == 't' )
835 {
836 pCur++;
837 vStr = Vec_StrStart( Gia_AigerReadInt(pCur) ); pCur += 4;
838 memcpy( Vec_StrArray(vStr), pCur, (size_t)Vec_StrSize(vStr) ); pCur += Vec_StrSize(vStr);
839 pNew->pManTime = Tim_ManLoad( vStr, 0 );
840 Vec_StrFree( vStr );
841 if ( fVerbose ) printf( "Finished reading extension \"t\".\n" );
842 }
843 // read object classes
844 else if ( *pCur == 'v' )
845 {
846 pCur++;
847 pNew->vObjClasses = Vec_IntStart( Gia_AigerReadInt(pCur)/4 ); pCur += 4;
848 memcpy( Vec_IntArray(pNew->vObjClasses), pCur, (size_t)4*Vec_IntSize(pNew->vObjClasses) );
849 pCur += 4*Vec_IntSize(pNew->vObjClasses);
850 if ( fVerbose ) printf( "Finished reading extension \"v\".\n" );
851 }
852 // read edge information
853 else if ( *pCur == 'w' )
854 {
855 Vec_Int_t * vPairs;
856 int i, nPairs;
857 pCur++;
858 pCurTemp = pCur + Gia_AigerReadInt(pCur) + 4; pCur += 4;
859 nPairs = Gia_AigerReadInt(pCur); pCur += 4;
860 vPairs = Vec_IntAlloc( 2*nPairs );
861 for ( i = 0; i < 2*nPairs; i++ )
862 Vec_IntPush( vPairs, Gia_AigerReadInt(pCur) ), pCur += 4;
863 assert( pCur == pCurTemp );
864 if ( fSkipStrash )
865 {
866 Gia_ManEdgeFromArray( pNew, vPairs );
867 if ( fVerbose ) printf( "Finished reading extension \"w\".\n" );
868 }
869 else
870 printf( "Cannot read extension \"w\" because AIG is rehashed. Use \"&r -s <file.aig>\".\n" );
871 Vec_IntFree( vPairs );
872 }
873 else break;
874 }
875 }
876
877 // skipping the comments
878 Vec_IntFree( vNodes );
879
880 // update polarity of the additional outputs
881 if ( nBad || nConstr || nJust || nFair )
883
884 // clean the PO drivers
885 if ( vPoTypes )
886 {
887 pNew = Gia_ManDupWithConstraints( pTemp = pNew, vPoTypes );
888 Gia_ManStop( pTemp );
889 Vec_IntFreeP( &vPoTypes );
890 }
891
892 if ( !fGiaSimple && !fSkipStrash && Gia_ManHasDangling(pNew) )
893 {
894 Tim_Man_t * pManTime;
895 Gia_Man_t * pAigExtra;
896 Vec_Int_t * vFlopMap, * vGateMap, * vObjMap, * vRegClasses, * vRegInits;
897 vRegClasses = pNew->vRegClasses; pNew->vRegClasses = NULL;
898 vRegInits = pNew->vRegInits; pNew->vRegInits = NULL;
899 vFlopMap = pNew->vFlopClasses; pNew->vFlopClasses = NULL;
900 vGateMap = pNew->vGateClasses; pNew->vGateClasses = NULL;
901 vObjMap = pNew->vObjClasses; pNew->vObjClasses = NULL;
902 pManTime = (Tim_Man_t *)pNew->pManTime; pNew->pManTime = NULL;
903 pAigExtra = pNew->pAigExtra; pNew->pAigExtra = NULL;
904 pNew = Gia_ManCleanup( pTemp = pNew );
905 if ( (vGateMap || vObjMap) && (Gia_ManObjNum(pNew) < Gia_ManObjNum(pTemp)) )
906 printf( "Cleanup removed objects after reading. Old gate/object abstraction maps are invalid!\n" );
907 Gia_ManStop( pTemp );
908 pNew->vRegClasses = vRegClasses;
909 pNew->vRegInits = vRegInits;
910 pNew->vFlopClasses = vFlopMap;
911 pNew->vGateClasses = vGateMap;
912 pNew->vObjClasses = vObjMap;
913 pNew->pManTime = pManTime;
914 pNew->pAigExtra = pAigExtra;
915 }
916
917 if ( fHieOnly )
918 {
919// Tim_ManPrint( (Tim_Man_t *)pNew->pManTime );
920 if ( Abc_FrameReadLibBox() == NULL )
921 printf( "Warning: Creating unit-delay box delay tables because box library is not available.\n" );
923 }
924 Vec_FltFreeP( &pNew->vInArrs );
925 Vec_FltFreeP( &pNew->vOutReqs );
926/*
927 // check the result
928 if ( fCheck && !Gia_ManCheck( pNew ) )
929 {
930 printf( "Gia_AigerRead: The network check has failed.\n" );
931 Gia_ManStop( pNew );
932 return NULL;
933 }
934*/
935
936 if ( vInits && Vec_IntSum(vInits) )
937 {
938 char * pInit = ABC_ALLOC( char, Vec_IntSize(vInits) + 1 );
939 Gia_Obj_t * pObj;
940 int i;
941 assert( Vec_IntSize(vInits) == Gia_ManRegNum(pNew) );
942 Gia_ManForEachRo( pNew, pObj, i )
943 {
944 if ( Vec_IntEntry(vInits, i) == 0 )
945 pInit[i] = '0';
946 else if ( Vec_IntEntry(vInits, i) == 1 )
947 pInit[i] = '1';
948 else
949 {
950 assert( Vec_IntEntry(vInits, i) == Abc_Var2Lit(Gia_ObjId(pNew, pObj), 0) );
951 // unitialized value of the latch is the latch literal according to http://fmv.jku.at/hwmcc11/beyond1.pdf
952 pInit[i] = 'X';
953 }
954 }
955 pInit[i] = 0;
956 if ( !fSkipStrash )
957 {
958 pNew = Gia_ManDupZeroUndc( pTemp = pNew, pInit, 0, fGiaSimple, 1 );
959 pNew->nConstrs = pTemp->nConstrs; pTemp->nConstrs = 0;
960 Gia_ManStop( pTemp );
961 }
962 ABC_FREE( pInit );
963 }
964 Vec_IntFreeP( &vInits );
965 if ( !fGiaSimple && !fSkipStrash && pNew->vMapping )
966 {
967 Abc_Print( 0, "Structural hashing enabled while reading AIGER invalidated the mapping. Consider using \"&r -s\".\n" );
968 Vec_IntFreeP( &pNew->vMapping );
969 }
970 if ( vNamesIn && Gia_ManPiNum(pNew) != Vec_PtrSize(vNamesIn) )
971 Abc_Print( 0, "The number of inputs does not match the number of input names.\n" );
972 else if ( vNamesOut && Gia_ManPoNum(pNew) != Vec_PtrSize(vNamesOut) )
973 Abc_Print( 0, "The number of output does not match the number of output names.\n" );
974 else if ( vNamesRegOut && Gia_ManRegNum(pNew) != Vec_PtrSize(vNamesRegOut) )
975 Abc_Print( 0, "The number of inputs does not match the number of flop names.\n" );
976 else if ( vNamesIn && vNamesOut )
977 {
978 pNew->vNamesIn = vNamesIn; vNamesIn = NULL;
979 pNew->vNamesOut = vNamesOut; vNamesOut = NULL;
980 if ( vNamesRegOut )
981 {
982 Vec_PtrAppend( pNew->vNamesIn, vNamesRegOut );
983 Vec_PtrClear( vNamesRegOut );
984 Vec_PtrFree( vNamesRegOut );
985 vNamesRegOut = NULL;
986 }
987 if ( vNamesRegIn )
988 {
989 Vec_PtrAppend( pNew->vNamesOut, vNamesRegIn );
990 Vec_PtrClear( vNamesRegIn );
991 Vec_PtrFree( vNamesRegIn );
992 vNamesRegIn = NULL;
993 }
994 }
995 if ( vNamesNode && Gia_ManObjNum(pNew) != Vec_PtrSize(vNamesNode) )
996 Abc_Print( 0, "The size of the node name array does not match the number of objects. Names are not entered.\n" );
997 else if ( vNamesNode )
998 pNew->vNamesNode = vNamesNode, vNamesNode = NULL;
999 if ( vNamesIn ) Vec_PtrFreeFree( vNamesIn );
1000 if ( vNamesOut ) Vec_PtrFreeFree( vNamesOut );
1001 if ( vNamesRegIn ) Vec_PtrFreeFree( vNamesRegIn );
1002 if ( vNamesRegOut ) Vec_PtrFreeFree( vNamesRegOut );
1003 return pNew;
1004}
int nTotal
DECLARATIONS ///.
Definition cutTruth.c:37
ABC_DLL void * Abc_FrameReadLibBox()
Definition mainFrame.c:58
ABC_NAMESPACE_IMPL_START Gia_Rpr_t * Gia_AigerReadEquivClasses(unsigned char **ppPos, int nSize)
DECLARATIONS ///.
Definition giaAigerExt.c:48
int * Gia_AigerReadMappingSimple(unsigned char **ppPos, int nSize)
Vec_Int_t * Gia_AigerReadMappingDoc(unsigned char **ppPos, int nObjs)
int * Gia_AigerReadMapping(unsigned char **ppPos, int nSize)
Vec_Int_t * Gia_AigerReadPacking(unsigned char **ppPos, int nSize)
#define XAIG_VERBOSE
Definition giaAiger.c:28
Vec_Int_t * Gia_AigerReadLiterals(unsigned char **ppPos, int nEntries)
Definition giaAiger.c:109
struct Gia_Rpr_t_ Gia_Rpr_t
Definition gia.h:57
#define Gia_ManForEachRo(p, pObj, i)
Definition gia.h:1252
int Gia_ManHasDangling(Gia_Man_t *p)
Definition giaUtil.c:1353
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition giaMan.c:764
int * Gia_ManDeriveNexts(Gia_Man_t *p)
Definition giaEquiv.c:260
struct Gia_Plc_t_ Gia_Plc_t
Definition gia.h:67
Gia_Man_t * Gia_ManDupWithConstraints(Gia_Man_t *p, Vec_Int_t *vPoTypes)
Definition giaDup.c:3816
void Gia_ManEdgeFromArray(Gia_Man_t *p, Vec_Int_t *vArray)
FUNCTION DEFINITIONS ///.
Definition giaEdge.c:72
void Gia_ManInvertConstraints(Gia_Man_t *pAig)
Definition giaUtil.c:1641
Gia_Man_t * Gia_ManDupZeroUndc(Gia_Man_t *p, char *pInit, int nNewPis, int fGiaSimple, int fVerbose)
Definition giaDup.c:3569
Gia_Man_t * pAigExtra
Definition gia.h:167
Vec_Ptr_t * vNamesIn
Definition gia.h:181
int * pSibls
Definition gia.h:128
int nAnd2Delay
Definition gia.h:202
Gia_Plc_t * pPlacement
Definition gia.h:166
Vec_Flt_t * vOutReqs
Definition gia.h:169
Vec_Flt_t * vInArrs
Definition gia.h:168
Gia_Rpr_t * pReprs
Definition gia.h:126
Vec_Int_t * vRegInits
Definition gia.h:161
Vec_Int_t * vUserPoIds
Definition gia.h:185
Vec_Int_t * vPacking
Definition gia.h:141
int * pNexts
Definition gia.h:127
Vec_Int_t vHTable
Definition gia.h:113
Vec_Ptr_t * vNamesOut
Definition gia.h:182
int fGiaSimple
Definition gia.h:116
Vec_Int_t * vMapping
Definition gia.h:136
Vec_Int_t * vRegClasses
Definition gia.h:160
void * pManTime
Definition gia.h:194
Vec_Int_t * vObjClasses
Definition gia.h:158
Vec_Int_t * vGateClasses
Definition gia.h:157
Vec_Int_t * vFlopClasses
Definition gia.h:156
Vec_Ptr_t * vNamesNode
Definition gia.h:183
Vec_Int_t * vUserPiIds
Definition gia.h:184
char * pCellStr
Definition gia.h:143
Vec_Int_t * vUserFfIds
Definition gia.h:186
int nConstrs
Definition gia.h:122
Vec_Int_t * vConfigs
Definition gia.h:142
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition tim.h:92
Tim_Man_t * Tim_ManLoad(Vec_Str_t *p, int fHieOnly)
Definition timDump.c:113
void Tim_ManCreate(Tim_Man_t *p, void *pLib, Vec_Flt_t *vInArrs, Vec_Flt_t *vOutReqs)
Definition timMan.c:406
int strncmp()
char * memcpy()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_AigerWrite()

void Gia_AigerWrite ( Gia_Man_t * pInit,
char * pFileName,
int fWriteSymbols,
int fCompact,
int fWriteNewLine )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 1595 of file giaAiger.c.

1596{
1597 Gia_AigerWriteS( pInit, pFileName, fWriteSymbols, fCompact, fWriteNewLine, 0 );
1598}
void Gia_AigerWriteS(Gia_Man_t *pInit, char *pFileName, int fWriteSymbols, int fCompact, int fWriteNewLine, int fSkipComment)
Definition giaAiger.c:1220
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_AigerWriteIntoMemoryStr()

Vec_Str_t * Gia_AigerWriteIntoMemoryStr ( Gia_Man_t * p)
extern

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 1062 of file giaAiger.c.

1063{
1064 Vec_Str_t * vBuffer;
1065 Gia_Obj_t * pObj;
1066 int nNodes = 0, i, uLit, uLit0, uLit1;
1067 // set the node numbers to be used in the output file
1068 Gia_ManConst0(p)->Value = nNodes++;
1069 Gia_ManForEachCi( p, pObj, i )
1070 pObj->Value = nNodes++;
1071 Gia_ManForEachAnd( p, pObj, i )
1072 pObj->Value = nNodes++;
1073
1074 // write the header "M I L O A" where M = I + L + A
1075 vBuffer = Vec_StrAlloc( 3*Gia_ManObjNum(p) );
1076 Vec_StrPrintStr( vBuffer, "aig " );
1077 Vec_StrPrintNum( vBuffer, Gia_ManCandNum(p) );
1078 Vec_StrPrintStr( vBuffer, " " );
1079 Vec_StrPrintNum( vBuffer, Gia_ManPiNum(p) );
1080 Vec_StrPrintStr( vBuffer, " " );
1081 Vec_StrPrintNum( vBuffer, Gia_ManRegNum(p) );
1082 Vec_StrPrintStr( vBuffer, " " );
1083 Vec_StrPrintNum( vBuffer, Gia_ManPoNum(p) );
1084 Vec_StrPrintStr( vBuffer, " " );
1085 Vec_StrPrintNum( vBuffer, Gia_ManAndNum(p) );
1086 Vec_StrPrintStr( vBuffer, "\n" );
1087
1088 // write latch drivers
1089 Gia_ManForEachRi( p, pObj, i )
1090 {
1091 uLit = Abc_Var2Lit( Gia_ObjValue(Gia_ObjFanin0(pObj)), Gia_ObjFaninC0(pObj) );
1092 Vec_StrPrintNum( vBuffer, uLit );
1093 Vec_StrPrintStr( vBuffer, "\n" );
1094 }
1095
1096 // write PO drivers
1097 Gia_ManForEachPo( p, pObj, i )
1098 {
1099 uLit = Abc_Var2Lit( Gia_ObjValue(Gia_ObjFanin0(pObj)), Gia_ObjFaninC0(pObj) );
1100 Vec_StrPrintNum( vBuffer, uLit );
1101 Vec_StrPrintStr( vBuffer, "\n" );
1102 }
1103 // write the nodes into the buffer
1104 Gia_ManForEachAnd( p, pObj, i )
1105 {
1106 uLit = Abc_Var2Lit( Gia_ObjValue(pObj), 0 );
1107 uLit0 = Abc_Var2Lit( Gia_ObjValue(Gia_ObjFanin0(pObj)), Gia_ObjFaninC0(pObj) );
1108 uLit1 = Abc_Var2Lit( Gia_ObjValue(Gia_ObjFanin1(pObj)), Gia_ObjFaninC1(pObj) );
1109 assert( uLit0 != uLit1 );
1110 if ( uLit0 > uLit1 )
1111 {
1112 int Temp = uLit0;
1113 uLit0 = uLit1;
1114 uLit1 = Temp;
1115 }
1116 Gia_AigerWriteUnsigned( vBuffer, uLit - uLit1 );
1117 Gia_AigerWriteUnsigned( vBuffer, uLit1 - uLit0 );
1118 }
1119 Vec_StrPrintStr( vBuffer, "c" );
1120 return vBuffer;
1121}
#define Gia_ManForEachPo(p, pObj, i)
Definition gia.h:1250
#define Gia_ManForEachRi(p, pObj, i)
Definition gia.h:1254
Here is the caller graph for this function:

◆ Gia_AigerWriteIntoMemoryStrPart()

Vec_Str_t * Gia_AigerWriteIntoMemoryStrPart ( Gia_Man_t * p,
Vec_Int_t * vCis,
Vec_Int_t * vAnds,
Vec_Int_t * vCos,
int nRegs )
extern

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 1136 of file giaAiger.c.

1137{
1138 Vec_Str_t * vBuffer;
1139 Gia_Obj_t * pObj;
1140 int nNodes = 0, i, uLit, uLit0, uLit1;
1141 // set the node numbers to be used in the output file
1142 Gia_ManConst0(p)->Value = nNodes++;
1143 Gia_ManForEachObjVec( vCis, p, pObj, i )
1144 {
1145 assert( Gia_ObjIsCi(pObj) );
1146 pObj->Value = nNodes++;
1147 }
1148 Gia_ManForEachObjVec( vAnds, p, pObj, i )
1149 {
1150 assert( Gia_ObjIsAnd(pObj) );
1151 pObj->Value = nNodes++;
1152 }
1153
1154 // write the header "M I L O A" where M = I + L + A
1155 vBuffer = Vec_StrAlloc( 3*Gia_ManObjNum(p) );
1156 Vec_StrPrintStr( vBuffer, "aig " );
1157 Vec_StrPrintNum( vBuffer, Vec_IntSize(vCis) + Vec_IntSize(vAnds) );
1158 Vec_StrPrintStr( vBuffer, " " );
1159 Vec_StrPrintNum( vBuffer, Vec_IntSize(vCis) - nRegs );
1160 Vec_StrPrintStr( vBuffer, " " );
1161 Vec_StrPrintNum( vBuffer, nRegs );
1162 Vec_StrPrintStr( vBuffer, " " );
1163 Vec_StrPrintNum( vBuffer, Vec_IntSize(vCos) - nRegs );
1164 Vec_StrPrintStr( vBuffer, " " );
1165 Vec_StrPrintNum( vBuffer, Vec_IntSize(vAnds) );
1166 Vec_StrPrintStr( vBuffer, "\n" );
1167
1168 // write latch drivers
1169 Gia_ManForEachObjVec( vCos, p, pObj, i )
1170 {
1171 assert( Gia_ObjIsCo(pObj) );
1172 if ( i < Vec_IntSize(vCos) - nRegs )
1173 continue;
1174 uLit = Abc_Var2Lit( Gia_ObjValue(Gia_ObjFanin0(pObj)), Gia_ObjFaninC0(pObj) );
1175 Vec_StrPrintNum( vBuffer, uLit );
1176 Vec_StrPrintStr( vBuffer, "\n" );
1177 }
1178 // write output drivers
1179 Gia_ManForEachObjVec( vCos, p, pObj, i )
1180 {
1181 assert( Gia_ObjIsCo(pObj) );
1182 if ( i >= Vec_IntSize(vCos) - nRegs )
1183 continue;
1184 uLit = Abc_Var2Lit( Gia_ObjValue(Gia_ObjFanin0(pObj)), Gia_ObjFaninC0(pObj) );
1185 Vec_StrPrintNum( vBuffer, uLit );
1186 Vec_StrPrintStr( vBuffer, "\n" );
1187 }
1188
1189 // write the nodes into the buffer
1190 Gia_ManForEachObjVec( vAnds, p, pObj, i )
1191 {
1192 uLit = Abc_Var2Lit( Gia_ObjValue(pObj), 0 );
1193 uLit0 = Abc_Var2Lit( Gia_ObjValue(Gia_ObjFanin0(pObj)), Gia_ObjFaninC0(pObj) );
1194 uLit1 = Abc_Var2Lit( Gia_ObjValue(Gia_ObjFanin1(pObj)), Gia_ObjFaninC1(pObj) );
1195 assert( uLit0 != uLit1 );
1196 if ( uLit0 > uLit1 )
1197 {
1198 int Temp = uLit0;
1199 uLit0 = uLit1;
1200 uLit1 = Temp;
1201 }
1202 Gia_AigerWriteUnsigned( vBuffer, uLit - uLit1 );
1203 Gia_AigerWriteUnsigned( vBuffer, uLit1 - uLit0 );
1204 }
1205 Vec_StrPrintStr( vBuffer, "c" );
1206 return vBuffer;
1207}
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition gia.h:1194
Here is the caller graph for this function:

◆ Gia_AigerWriteS()

void Gia_AigerWriteS ( Gia_Man_t * pInit,
char * pFileName,
int fWriteSymbols,
int fCompact,
int fWriteNewLine,
int fSkipComment )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 1220 of file giaAiger.c.

1221{
1222 int fVerbose = XAIG_VERBOSE;
1223 FILE * pFile;
1224 Gia_Man_t * p;
1225 Gia_Obj_t * pObj;
1226 Vec_Str_t * vStrExt;
1227 int i, nBufferSize, Pos;
1228 unsigned char * pBuffer;
1229 unsigned uLit0, uLit1, uLit;
1230 assert( pInit->nXors == 0 && pInit->nMuxes == 0 );
1231
1232 if ( Gia_ManCoNum(pInit) == 0 )
1233 {
1234 printf( "AIG cannot be written because it has no POs.\n" );
1235 return;
1236 }
1237
1238 // start the output stream
1239 pFile = fopen( pFileName, "wb" );
1240 if ( pFile == NULL )
1241 {
1242 fprintf( stdout, "Gia_AigerWrite(): Cannot open the output file \"%s\".\n", pFileName );
1243 return;
1244 }
1245
1246 // create normalized AIG
1247 if ( !Gia_ManIsNormalized(pInit) )
1248 {
1249// printf( "Gia_AigerWrite(): Normalizing AIG for writing.\n" );
1250 p = Gia_ManDupNormalize( pInit, 0 );
1251 Gia_ManTransferMapping( p, pInit );
1252 Gia_ManTransferPacking( p, pInit );
1253 Gia_ManTransferTiming( p, pInit );
1254 p->nConstrs = pInit->nConstrs;
1255 }
1256 else
1257 p = pInit;
1258
1259 // write the header "M I L O A" where M = I + L + A
1260 fprintf( pFile, "aig%s %u %u %u %u %u",
1261 fCompact? "2" : "",
1262 Gia_ManCiNum(p) + Gia_ManAndNum(p),
1263 Gia_ManPiNum(p),
1264 Gia_ManRegNum(p),
1265 Gia_ManConstrNum(p) ? 0 : Gia_ManPoNum(p),
1266 Gia_ManAndNum(p) );
1267 // write the extended header "B C J F"
1268 if ( Gia_ManConstrNum(p) )
1269 fprintf( pFile, " %u %u", Gia_ManPoNum(p) - Gia_ManConstrNum(p), Gia_ManConstrNum(p) );
1270 fprintf( pFile, "\n" );
1271
1273 if ( !fCompact )
1274 {
1275 // write latch drivers
1276 Gia_ManForEachRi( p, pObj, i )
1277 fprintf( pFile, "%u\n", Gia_ObjFaninLit0p(p, pObj) );
1278 // write PO drivers
1279 Gia_ManForEachPo( p, pObj, i )
1280 fprintf( pFile, "%u\n", Gia_ObjFaninLit0p(p, pObj) );
1281 }
1282 else
1283 {
1285 Vec_Str_t * vBinary = Gia_AigerWriteLiterals( vLits );
1286 fwrite( Vec_StrArray(vBinary), 1, Vec_StrSize(vBinary), pFile );
1287 Vec_StrFree( vBinary );
1288 Vec_IntFree( vLits );
1289 }
1291
1292 // write the nodes into the buffer
1293 Pos = 0;
1294 nBufferSize = 8 * Gia_ManAndNum(p) + 100; // skeptically assuming 3 chars per one AIG edge
1295 pBuffer = ABC_ALLOC( unsigned char, nBufferSize );
1296 Gia_ManForEachAnd( p, pObj, i )
1297 {
1298 uLit = Abc_Var2Lit( i, 0 );
1299 uLit0 = Gia_ObjFaninLit0( pObj, i );
1300 uLit1 = Gia_ObjFaninLit1( pObj, i );
1301 assert( p->fGiaSimple || Gia_ManBufNum(p) || uLit0 < uLit1 );
1302 Pos = Gia_AigerWriteUnsignedBuffer( pBuffer, Pos, uLit - uLit1 );
1303 Pos = Gia_AigerWriteUnsignedBuffer( pBuffer, Pos, uLit1 - uLit0 );
1304 if ( Pos > nBufferSize - 10 )
1305 {
1306 printf( "Gia_AigerWrite(): AIGER generation has failed because the allocated buffer is too small.\n" );
1307 fclose( pFile );
1308 if ( p != pInit )
1309 Gia_ManStop( p );
1310 return;
1311 }
1312 }
1313 assert( Pos < nBufferSize );
1314
1315 // write the buffer
1316 fwrite( pBuffer, 1, Pos, pFile );
1317 ABC_FREE( pBuffer );
1318
1319 // write the symbol table
1320 if ( p->vNamesIn && p->vNamesOut )
1321 {
1322 assert( Vec_PtrSize(p->vNamesIn) == Gia_ManCiNum(p) );
1323 assert( Vec_PtrSize(p->vNamesOut) == Gia_ManCoNum(p) );
1324 // write PIs
1325 Gia_ManForEachPi( p, pObj, i )
1326 fprintf( pFile, "i%d %s\n", i, (char *)Vec_PtrEntry(p->vNamesIn, i) );
1327 // write latches
1328 Gia_ManForEachRo( p, pObj, i )
1329 fprintf( pFile, "l%d %s\n", i, (char *)Vec_PtrEntry(p->vNamesIn, Gia_ManPiNum(p) + i) );
1330 // write POs
1331 Gia_ManForEachPo( p, pObj, i )
1332 fprintf( pFile, "o%d %s\n", i, (char *)Vec_PtrEntry(p->vNamesOut, i) );
1333 }
1334 if ( p->vNamesNode && Vec_PtrSize(p->vNamesNode) != Gia_ManObjNum(p) )
1335 Abc_Print( 0, "The size of the node name array does not match the number of objects. Names are not written.\n" );
1336 else if ( p->vNamesNode )
1337 {
1338 Gia_ManForEachAnd( p, pObj, i )
1339 if ( Vec_PtrEntry(p->vNamesNode, i) )
1340 fprintf( pFile, "n%d %s\n", i, (char *)Vec_PtrEntry(p->vNamesNode, i) );
1341 }
1342
1343 // write the comment
1344 if ( fWriteNewLine )
1345 fprintf( pFile, "c\n" );
1346 else
1347 fprintf( pFile, "c" );
1348
1349 // write additional AIG
1350 if ( p->pAigExtra )
1351 {
1352 fprintf( pFile, "a" );
1353 vStrExt = Gia_AigerWriteIntoMemoryStr( p->pAigExtra );
1354 Gia_FileWriteBufferSize( pFile, Vec_StrSize(vStrExt) );
1355 fwrite( Vec_StrArray(vStrExt), 1, Vec_StrSize(vStrExt), pFile );
1356 Vec_StrFree( vStrExt );
1357 if ( fVerbose ) printf( "Finished writing extension \"a\".\n" );
1358 }
1359 // write constraints
1360 if ( p->nConstrs )
1361 {
1362 fprintf( pFile, "c" );
1363 Gia_FileWriteBufferSize( pFile, 4 );
1364 Gia_FileWriteBufferSize( pFile, p->nConstrs );
1365 }
1366 // write timing information
1367 if ( p->nAnd2Delay )
1368 {
1369 fprintf( pFile, "d" );
1370 Gia_FileWriteBufferSize( pFile, 4 );
1371 Gia_FileWriteBufferSize( pFile, p->nAnd2Delay );
1372 }
1373 if ( p->pManTime )
1374 {
1375 float * pTimes;
1376 pTimes = Tim_ManGetArrTimes( (Tim_Man_t *)p->pManTime );
1377 if ( pTimes )
1378 {
1379 fprintf( pFile, "i" );
1380 Gia_FileWriteBufferSize( pFile, 4*Tim_ManPiNum((Tim_Man_t *)p->pManTime) );
1381 fwrite( pTimes, 1, 4*Tim_ManPiNum((Tim_Man_t *)p->pManTime), pFile );
1382 ABC_FREE( pTimes );
1383 if ( fVerbose ) printf( "Finished writing extension \"i\".\n" );
1384 }
1385 pTimes = Tim_ManGetReqTimes( (Tim_Man_t *)p->pManTime );
1386 if ( pTimes )
1387 {
1388 fprintf( pFile, "o" );
1389 Gia_FileWriteBufferSize( pFile, 4*Tim_ManPoNum((Tim_Man_t *)p->pManTime) );
1390 fwrite( pTimes, 1, 4*Tim_ManPoNum((Tim_Man_t *)p->pManTime), pFile );
1391 ABC_FREE( pTimes );
1392 if ( fVerbose ) printf( "Finished writing extension \"o\".\n" );
1393 }
1394 }
1395 // write equivalences
1396 if ( p->pReprs && p->pNexts )
1397 {
1399 fprintf( pFile, "e" );
1400 vStrExt = Gia_WriteEquivClasses( p );
1401 Gia_FileWriteBufferSize( pFile, Vec_StrSize(vStrExt) );
1402 fwrite( Vec_StrArray(vStrExt), 1, Vec_StrSize(vStrExt), pFile );
1403 Vec_StrFree( vStrExt );
1404 }
1405 // write flop classes
1406 if ( p->vFlopClasses )
1407 {
1408 fprintf( pFile, "f" );
1409 Gia_FileWriteBufferSize( pFile, 4*Gia_ManRegNum(p) );
1410 assert( Vec_IntSize(p->vFlopClasses) == Gia_ManRegNum(p) );
1411 fwrite( Vec_IntArray(p->vFlopClasses), 1, 4*Gia_ManRegNum(p), pFile );
1412 }
1413 // write gate classes
1414 if ( p->vGateClasses )
1415 {
1416 fprintf( pFile, "g" );
1417 Gia_FileWriteBufferSize( pFile, 4*Gia_ManObjNum(p) );
1418 assert( Vec_IntSize(p->vGateClasses) == Gia_ManObjNum(p) );
1419 fwrite( Vec_IntArray(p->vGateClasses), 1, 4*Gia_ManObjNum(p), pFile );
1420 }
1421 // write hierarchy info
1422 if ( p->pManTime )
1423 {
1424 fprintf( pFile, "h" );
1425 vStrExt = Tim_ManSave( (Tim_Man_t *)p->pManTime, 1 );
1426 Gia_FileWriteBufferSize( pFile, Vec_StrSize(vStrExt) );
1427 fwrite( Vec_StrArray(vStrExt), 1, Vec_StrSize(vStrExt), pFile );
1428 Vec_StrFree( vStrExt );
1429 if ( fVerbose ) printf( "Finished writing extension \"h\".\n" );
1430 }
1431 // write packing
1432 if ( p->vPacking )
1433 {
1434 extern Vec_Str_t * Gia_WritePacking( Vec_Int_t * vPacking );
1435 fprintf( pFile, "k" );
1436 vStrExt = Gia_WritePacking( p->vPacking );
1437 Gia_FileWriteBufferSize( pFile, Vec_StrSize(vStrExt) );
1438 fwrite( Vec_StrArray(vStrExt), 1, Vec_StrSize(vStrExt), pFile );
1439 Vec_StrFree( vStrExt );
1440 if ( fVerbose ) printf( "Finished writing extension \"k\".\n" );
1441 }
1442 // write edges
1443 if ( p->vEdge1 )
1444 {
1445 Vec_Int_t * vPairs = Gia_ManEdgeToArray( p );
1446 int i;
1447 fprintf( pFile, "w" );
1448 Gia_FileWriteBufferSize( pFile, 4*(Vec_IntSize(vPairs)+1) );
1449 Gia_FileWriteBufferSize( pFile, Vec_IntSize(vPairs)/2 );
1450 for ( i = 0; i < Vec_IntSize(vPairs); i++ )
1451 Gia_FileWriteBufferSize( pFile, Vec_IntEntry(vPairs, i) );
1452 Vec_IntFree( vPairs );
1453 }
1454 // write mapping
1455 if ( Gia_ManHasMapping(p) )
1456 {
1460 fprintf( pFile, "m" );
1461 vStrExt = Gia_AigerWriteMappingDoc( p );
1462 Gia_FileWriteBufferSize( pFile, Vec_StrSize(vStrExt) );
1463 fwrite( Vec_StrArray(vStrExt), 1, Vec_StrSize(vStrExt), pFile );
1464 Vec_StrFree( vStrExt );
1465 if ( fVerbose ) printf( "Finished writing extension \"m\".\n" );
1466 }
1467 // write cell mapping
1468 if ( Gia_ManHasCellMapping(p) )
1469 {
1471 fprintf( pFile, "M" );
1472 vStrExt = Gia_AigerWriteCellMappingDoc( p );
1473 Gia_FileWriteBufferSize( pFile, Vec_StrSize(vStrExt) );
1474 fwrite( Vec_StrArray(vStrExt), 1, Vec_StrSize(vStrExt), pFile );
1475 Vec_StrFree( vStrExt );
1476 if ( fVerbose ) printf( "Finished writing extension \"M\".\n" );
1477
1478 }
1479 // write placement
1480 if ( p->pPlacement )
1481 {
1482 fprintf( pFile, "p" );
1483 Gia_FileWriteBufferSize( pFile, 4*Gia_ManObjNum(p) );
1484 fwrite( p->pPlacement, 1, 4*Gia_ManObjNum(p), pFile );
1485 }
1486 // write register classes
1487 if ( p->vRegClasses )
1488 {
1489 int i;
1490 fprintf( pFile, "r" );
1491 Gia_FileWriteBufferSize( pFile, 4*(Vec_IntSize(p->vRegClasses)+1) );
1492 Gia_FileWriteBufferSize( pFile, Vec_IntSize(p->vRegClasses) );
1493 for ( i = 0; i < Vec_IntSize(p->vRegClasses); i++ )
1494 Gia_FileWriteBufferSize( pFile, Vec_IntEntry(p->vRegClasses, i) );
1495 }
1496 // write register inits
1497 if ( p->vRegInits )
1498 {
1499 int i;
1500 fprintf( pFile, "s" );
1501 Gia_FileWriteBufferSize( pFile, 4*(Vec_IntSize(p->vRegInits)+1) );
1502 Gia_FileWriteBufferSize( pFile, Vec_IntSize(p->vRegInits) );
1503 for ( i = 0; i < Vec_IntSize(p->vRegInits); i++ )
1504 Gia_FileWriteBufferSize( pFile, Vec_IntEntry(p->vRegInits, i) );
1505 }
1506 // write configuration data
1507 if ( p->vConfigs )
1508 {
1509 fprintf( pFile, "b" );
1510 assert( p->pCellStr != NULL );
1511 Gia_FileWriteBufferSize( pFile, 4*Vec_IntSize(p->vConfigs) + strlen(p->pCellStr) + 1 );
1512 fwrite( p->pCellStr, 1, strlen(p->pCellStr) + 1, pFile );
1513// fwrite( Vec_IntArray(p->vConfigs), 1, 4*Vec_IntSize(p->vConfigs), pFile );
1514 for ( i = 0; i < Vec_IntSize(p->vConfigs); i++ )
1515 Gia_FileWriteBufferSize( pFile, Vec_IntEntry(p->vConfigs, i) );
1516 }
1517 // write choices
1518 if ( Gia_ManHasChoices(p) )
1519 {
1520 int i, nPairs = 0;
1521 fprintf( pFile, "q" );
1522 for ( i = 0; i < Gia_ManObjNum(p); i++ )
1523 nPairs += (Gia_ObjSibl(p, i) > 0);
1524 Gia_FileWriteBufferSize( pFile, 4*(nPairs * 2 + 1) );
1525 Gia_FileWriteBufferSize( pFile, nPairs );
1526 for ( i = 0; i < Gia_ManObjNum(p); i++ )
1527 if ( Gia_ObjSibl(p, i) )
1528 {
1529 assert( i > Gia_ObjSibl(p, i) );
1530 Gia_FileWriteBufferSize( pFile, i );
1531 Gia_FileWriteBufferSize( pFile, Gia_ObjSibl(p, i) );
1532 }
1533 if ( fVerbose ) printf( "Finished writing extension \"q\".\n" );
1534 }
1535 // write switching activity
1536 if ( p->pSwitching )
1537 {
1538 fprintf( pFile, "u" );
1539 Gia_FileWriteBufferSize( pFile, Gia_ManObjNum(p) );
1540 fwrite( p->pSwitching, 1, Gia_ManObjNum(p), pFile );
1541 }
1542/*
1543 // write timing information
1544 if ( p->pManTime )
1545 {
1546 fprintf( pFile, "t" );
1547 vStrExt = Tim_ManSave( (Tim_Man_t *)p->pManTime, 0 );
1548 Gia_FileWriteBufferSize( pFile, Vec_StrSize(vStrExt) );
1549 fwrite( Vec_StrArray(vStrExt), 1, Vec_StrSize(vStrExt), pFile );
1550 Vec_StrFree( vStrExt );
1551 }
1552*/
1553 // write object classes
1554 if ( p->vObjClasses )
1555 {
1556 fprintf( pFile, "v" );
1557 Gia_FileWriteBufferSize( pFile, 4*Gia_ManObjNum(p) );
1558 assert( Vec_IntSize(p->vObjClasses) == Gia_ManObjNum(p) );
1559 fwrite( Vec_IntArray(p->vObjClasses), 1, 4*Gia_ManObjNum(p), pFile );
1560 }
1561 // write name
1562 if ( p->pName )
1563 {
1564 fprintf( pFile, "n" );
1565 Gia_FileWriteBufferSize( pFile, strlen(p->pName)+1 );
1566 fwrite( p->pName, 1, strlen(p->pName), pFile );
1567 fprintf( pFile, "%c", '\0' );
1568 }
1569 // write comments
1570 if ( fWriteNewLine )
1571 fprintf( pFile, "c\n" );
1572 if ( !fSkipComment ) {
1573 fprintf( pFile, "\nThis file was produced by the GIA package in ABC on %s\n", Gia_TimeStamp() );
1574 fprintf( pFile, "For information about AIGER format, refer to %s\n", "http://fmv.jku.at/aiger" );
1575 }
1576 fclose( pFile );
1577 if ( p != pInit )
1578 {
1579 Gia_ManTransferTiming( pInit, p );
1580 Gia_ManStop( p );
1581 }
1582}
ush Pos
Definition deflate.h:88
Vec_Str_t * Gia_AigerWriteMappingSimple(Gia_Man_t *p)
Vec_Str_t * Gia_AigerWriteMapping(Gia_Man_t *p)
Vec_Str_t * Gia_WritePacking(Vec_Int_t *vPacking)
Vec_Str_t * Gia_AigerWriteCellMappingDoc(Gia_Man_t *p)
Vec_Str_t * Gia_AigerWriteMappingDoc(Gia_Man_t *p)
Vec_Str_t * Gia_WriteEquivClasses(Gia_Man_t *p)
Vec_Str_t * Gia_AigerWriteIntoMemoryStr(Gia_Man_t *p)
Definition giaAiger.c:1062
Vec_Int_t * Gia_AigerCollectLiterals(Gia_Man_t *p)
Definition giaAiger.c:97
void Gia_FileWriteBufferSize(FILE *pFile, int nSize)
Definition giaAiger.c:79
Vec_Str_t * Gia_AigerWriteLiterals(Vec_Int_t *vLits)
Definition giaAiger.c:129
int Gia_ManIsNormalized(Gia_Man_t *p)
Definition giaTim.c:114
Vec_Int_t * Gia_ManEdgeToArray(Gia_Man_t *p)
Definition giaEdge.c:88
#define Gia_ManForEachPi(p, pObj, i)
Definition gia.h:1248
char * Gia_TimeStamp()
Definition giaUtil.c:106
void Gia_ManTransferTiming(Gia_Man_t *p, Gia_Man_t *pGia)
Definition giaIf.c:2370
Gia_Man_t * Gia_ManDupNormalize(Gia_Man_t *p, int fHashMapping)
Definition giaTim.c:139
void Gia_ManTransferMapping(Gia_Man_t *p, Gia_Man_t *pGia)
Definition giaIf.c:2305
void Gia_ManTransferPacking(Gia_Man_t *p, Gia_Man_t *pGia)
Definition giaIf.c:2336
int nMuxes
Definition gia.h:108
int nXors
Definition gia.h:107
Vec_Str_t * Tim_ManSave(Tim_Man_t *p, int fHieOnly)
FUNCTION DEFINITIONS ///.
Definition timDump.c:46
float * Tim_ManGetArrTimes(Tim_Man_t *p)
Definition timMan.c:482
int Tim_ManPoNum(Tim_Man_t *p)
Definition timMan.c:714
float * Tim_ManGetReqTimes(Tim_Man_t *p)
Definition timMan.c:497
int Tim_ManPiNum(Tim_Man_t *p)
Definition timMan.c:708
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_AigerWriteSimple()

void Gia_AigerWriteSimple ( Gia_Man_t * pInit,
char * pFileName )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 1629 of file giaAiger.c.

1630{
1631 FILE * pFile;
1632 Vec_Str_t * vStr;
1633 if ( Gia_ManPoNum(pInit) == 0 )
1634 {
1635 printf( "Gia_AigerWriteSimple(): AIG cannot be written because it has no POs.\n" );
1636 return;
1637 }
1638 // start the output stream
1639 pFile = fopen( pFileName, "wb" );
1640 if ( pFile == NULL )
1641 {
1642 fprintf( stdout, "Gia_AigerWriteSimple(): Cannot open the output file \"%s\".\n", pFileName );
1643 return;
1644 }
1645 // write the buffer
1646 vStr = Gia_AigerWriteIntoMemoryStr( pInit );
1647 fwrite( Vec_StrArray(vStr), 1, Vec_StrSize(vStr), pFile );
1648 Vec_StrFree( vStr );
1649 fclose( pFile );
1650}
Here is the call graph for this function:

◆ Gia_DumpAiger()

void Gia_DumpAiger ( Gia_Man_t * p,
char * pFilePrefix,
int iFileNum,
int nFileNumDigits )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 1611 of file giaAiger.c.

1612{
1613 char Buffer[100];
1614 sprintf( Buffer, "%s%0*d.aig", pFilePrefix, nFileNumDigits, iFileNum );
1615 Gia_AigerWrite( p, Buffer, 0, 0, 0 );
1616}
void Gia_AigerWrite(Gia_Man_t *pInit, char *pFileName, int fWriteSymbols, int fCompact, int fWriteNewLine)
Definition giaAiger.c:1595
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_FileNameGenericAppend()

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

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

Synopsis [Returns the composite name of the file.]

Description []

SideEffects []

SeeAlso []

Definition at line 130 of file giaUtil.c.

131{
132 static char Buffer[1000];
133 char * pDot;
134 strcpy( Buffer, pBase );
135 if ( (pDot = strrchr( Buffer, '.' )) )
136 *pDot = 0;
137 strcat( Buffer, pSuffix );
138 if ( (pDot = strrchr( Buffer, '\\' )) || (pDot = strrchr( Buffer, '/' )) )
139 return pDot+1;
140 return Buffer;
141}
char * strrchr()
char * strcpy()
char * strcat()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_FileSize()

int Gia_FileSize ( char * pFileName)
extern

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
Here is the caller graph for this function:

◆ Gia_GetFakeNames()

Vec_Ptr_t * Gia_GetFakeNames ( int nNames,
int fCaps )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 154 of file giaUtil.c.

155{
156 Vec_Ptr_t * vNames;
157 char Buffer[5];
158 int i;
159
160 vNames = Vec_PtrAlloc( nNames );
161 for ( i = 0; i < nNames; i++ )
162 {
163 if ( nNames < 26 )
164 {
165 Buffer[0] = (fCaps ? 'A' : 'a') + i;
166 Buffer[1] = 0;
167 }
168 else
169 {
170 Buffer[0] = (fCaps ? 'A' : 'a') + i%26;
171 Buffer[1] = '0' + i/26;
172 Buffer[2] = 0;
173 }
174 Vec_PtrPush( vNames, Extra_UtilStrsav(Buffer) );
175 }
176 return vNames;
177}
char * Extra_UtilStrsav(const char *s)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_LutComputeTruth6()

word Gia_LutComputeTruth6 ( Gia_Man_t * p,
int iObj,
Vec_Wrd_t * vTruths )
extern

Definition at line 249 of file giaTruth.c.

250{
251 int k, iFan;
252 assert( Gia_ObjIsLut(p, iObj) );
254 Gia_LutForEachFanin( p, iObj, iFan, k )
255 {
256 Vec_WrdWriteEntry( vTruths, iFan, s_Truths6[k] );
257 Gia_ObjSetTravIdCurrentId( p, iFan );
258 }
259 return Gia_LutComputeTruth6_rec( p, iObj, vTruths );
260}
word Gia_LutComputeTruth6_rec(Gia_Man_t *p, int iNode, Vec_Wrd_t *vTruths)
Definition giaTruth.c:231
#define Gia_LutForEachFanin(p, i, iFan, k)
Definition gia.h:1161
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition giaUtil.c:190
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_Man2SupportAnd()

int Gia_Man2SupportAnd ( Gia_Man2Min_t * p,
int iLit0,
int iLit1 )
extern

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

Synopsis [Takes a literal and returns a support-minized literal.]

Description []

SideEffects []

SeeAlso []

Definition at line 815 of file giaSupp.c.

816{
817 p->nCalls++;
818 //return Gia_ManHashAnd( p->pGia, iLit0, iLit1 );
819 p->iLits[0] = iLit0;
820 p->iLits[1] = iLit1;
821 if ( iLit0 < 2 || iLit1 < 2 || Abc_Lit2Var(iLit0) == Abc_Lit2Var(iLit1) || Gia_ManHashLookupInt(p->pGia, iLit0, iLit1) ||
823 return Gia_ManHashAnd( p->pGia, iLit0, iLit1 );
824 //printf( "%d %d\n", iLit0, iLit1 );
825 p->nSatUnsat++;
826 return 0;
827}
int Gia_Min2ManSimulate(Gia_Man2Min_t *p)
Definition giaSupp.c:671
int Gia_Min2ManGatherSupp(Gia_Man2Min_t *p)
Definition giaSupp.c:788
int Gia_Min2ManSolve(Gia_Man2Min_t *p)
Definition giaSupp.c:717
int Gia_ManHashLookupInt(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:81
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_Man2SuppStart()

Gia_Man2Min_t * Gia_Man2SuppStart ( Gia_Man_t * pGia)
extern

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

Synopsis [Create/delete the data representation manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 375 of file giaSupp.c.

376{
378 p = ABC_CALLOC( Gia_Man2Min_t, 1 );
379 p->pGia = pGia;
380 p->vCis[0] = Vec_IntAlloc( 512 );
381 p->vCis[1] = Vec_IntAlloc( 512 );
382 p->vObjs[0] = Vec_IntAlloc( 512 );
383 p->vObjs[1] = Vec_IntAlloc( 512 );
384 // SAT solving
385 p->pSat = satoko_create();
386 p->vSims = Vec_WrdAlloc( 1000 );
387 p->vFrontier = Vec_PtrAlloc( 1000 );
388 p->vFanins = Vec_PtrAlloc( 100 );
389 p->vSatVars = Vec_IntAlloc( 100 );
390 p->iPattern = 1;
391 satoko_options(p->pSat)->learnt_ratio = 0; // prevent garbage collection
392 return p;
393}
struct Gia_Man2Min_t_ Gia_Man2Min_t
Definition gia.h:1669
satoko_t * satoko_create(void)
Definition solver_api.c:88
satoko_opts_t * satoko_options(satoko_t *)
Definition solver_api.c:438
float learnt_ratio
Definition satoko.h:55
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_Man2SuppStop()

void Gia_Man2SuppStop ( Gia_Man2Min_t * p)
extern

Definition at line 394 of file giaSupp.c.

395{
396// printf( "Total calls = %8d. Supps = %6d. Sims = %6d. SAT = %6d. UNSAT = %6d.\n",
397// p->nCalls, p->nSupps, p->nSims, p->nSatSat, p->nSatUnsat );
398 Vec_IntFreeP( &p->vCis[0] );
399 Vec_IntFreeP( &p->vCis[1] );
400 Vec_IntFreeP( &p->vObjs[0] );
401 Vec_IntFreeP( &p->vObjs[1] );
402 Gia_ManCleanMark01( p->pGia );
403 satoko_destroy( p->pSat );
404 Vec_WrdFreeP( &p->vSims );
405 Vec_PtrFreeP( &p->vFrontier );
406 Vec_PtrFreeP( &p->vFanins );
407 Vec_IntFreeP( &p->vSatVars );
408 ABC_FREE( p );
409}
void Gia_ManCleanMark01(Gia_Man_t *p)
Definition giaUtil.c:218
void satoko_destroy(satoko_t *)
Definition solver_api.c:132
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManAigSyn2()

Gia_Man_t * Gia_ManAigSyn2 ( Gia_Man_t * pInit,
int fOldAlgo,
int fCoarsen,
int fCutMin,
int nRelaxRatio,
int fDelayMin,
int fVerbose,
int fVeryVerbose )
extern

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 {
92 pNew = Gia_ManDup(p);
93 Gia_ManTransferTiming( pNew, p );
94 Gia_ManStop( p );
95 return pNew;
96 }
97 // delay optimization
98 if ( fDelayMin && p->pManTime == NULL )
99 {
100 int Area0, Area1, Delay0, Delay1;
101 int fCutMin = pPars->fCutMin;
102 int fCoarsen = pPars->fCoarsen;
103 int nRelaxRatio = pPars->nRelaxRatio;
104 pPars->fCutMin = 0;
105 pPars->fCoarsen = 0;
106 pPars->nRelaxRatio = 0;
107 // perform mapping
108 if ( fOldAlgo )
109 Jf_ManPerformMapping( p, pPars );
110 else
111 Lf_ManPerformMapping( p, pPars );
112 Area0 = (int)pPars->Area;
113 Delay0 = (int)pPars->Delay;
114 // perform balancing
115 pNew = Gia_ManPerformDsdBalance( p, 6, 4, 0, 0 );
116 // perform mapping again
117 if ( fOldAlgo )
118 Jf_ManPerformMapping( pNew, pPars );
119 else
120 Lf_ManPerformMapping( pNew, pPars );
121 Area1 = (int)pPars->Area;
122 Delay1 = (int)pPars->Delay;
123 // choose the best result
124 if ( Delay1 < Delay0 - 1 || (Delay1 == Delay0 + 1 && 100.0 * (Area1 - Area0) / Area1 < 3.0) )
125 {
126 Gia_ManStop( p );
127 p = pNew;
128 }
129 else
130 {
131 Gia_ManStop( pNew );
132 Vec_IntFreeP( &p->vMapping );
133 }
134 // reset params
135 pPars->fCutMin = fCutMin;
136 pPars->fCoarsen = fCoarsen;
137 pPars->nRelaxRatio = nRelaxRatio;
138 }
139 // perform balancing
140 pNew = Gia_ManAreaBalance( p, 0, ABC_INFINITY, fVeryVerbose, 0 );
141 if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
142 Gia_ManStop( p );
143 // perform mapping
144 if ( fOldAlgo )
145 pNew = Jf_ManPerformMapping( pTemp = pNew, pPars );
146 else
147 pNew = Lf_ManPerformMapping( pTemp = pNew, pPars );
148 if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
149 if ( pTemp != pNew )
150 Gia_ManStop( pTemp );
151 // perform balancing
152 pNew = Gia_ManAreaBalance( pTemp = pNew, 0, ABC_INFINITY, fVeryVerbose, 0 );
153 if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
154 Gia_ManStop( pTemp );
155 return pNew;
156}
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition abc_global.h:250
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition giaDup.c:720
void Jf_ManSetDefaultPars(Jf_Par_t *pPars)
Definition giaJf.c:1682
Gia_Man_t * Gia_ManAreaBalance(Gia_Man_t *p, int fSimpleAnd, int nNewNodesMax, int fVerbose, int fVeryVerbose)
Definition giaBalAig.c:1047
Gia_Man_t * Lf_ManPerformMapping(Gia_Man_t *pGia, Jf_Par_t *pPars)
Definition giaLf.c:2242
Gia_Man_t * Jf_ManPerformMapping(Gia_Man_t *pGia, Jf_Par_t *pPars)
Definition giaJf.c:1715
Gia_Man_t * Gia_ManPerformDsdBalance(Gia_Man_t *p, int nLutSize, int nCutNum, int nRelaxRatio, int fVerbose)
Definition giaIf.c:2678
void Lf_ManSetDefaultPars(Jf_Par_t *pPars)
Definition giaLf.c:2021
struct Jf_Par_t_ Jf_Par_t
Definition gia.h:333
void Gia_ManPrintStats(Gia_Man_t *p, Gps_Par_t *pPars)
Definition giaMan.c:495
int nRelaxRatio
Definition gia.h:341
int nCutNum
Definition gia.h:337
int fCoarsen
Definition gia.h:357
word Delay
Definition gia.h:376
int nAreaTuner
Definition gia.h:343
int fCutMin
Definition gia.h:358
word Area
Definition gia.h:377
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManAigSyn3()

Gia_Man_t * Gia_ManAigSyn3 ( Gia_Man_t * p,
int fVerbose,
int fVeryVerbose )
extern

Definition at line 157 of file giaScript.c.

158{
159 Gia_Man_t * pNew, * pTemp;
160 Jf_Par_t Pars, * pPars = &Pars;
161 Jf_ManSetDefaultPars( pPars );
162 pPars->nRelaxRatio = 40;
163 if ( fVerbose ) Gia_ManPrintStats( p, NULL );
164 if ( Gia_ManAndNum(p) == 0 )
165 {
166 pNew = Gia_ManDup(p);
167 Gia_ManTransferTiming( pNew, p );
168 //Gia_ManStop( p );
169 return pNew;
170 }
171 // perform balancing
172 pNew = Gia_ManAreaBalance( p, 0, ABC_INFINITY, fVeryVerbose, 0 );
173 if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
174 // perform mapping
175 pPars->nLutSize = 6;
176 pNew = Jf_ManPerformMapping( pTemp = pNew, pPars );
177 if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
178// Gia_ManStop( pTemp );
179 // perform balancing
180 pNew = Gia_ManAreaBalance( pTemp = pNew, 0, ABC_INFINITY, fVeryVerbose, 0 );
181 if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
182 Gia_ManStop( pTemp );
183 // perform mapping
184 pPars->nLutSize = 4;
185 pNew = Jf_ManPerformMapping( pTemp = pNew, pPars );
186 if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
187// Gia_ManStop( pTemp );
188 // perform balancing
189 pNew = Gia_ManAreaBalance( pTemp = pNew, 0, ABC_INFINITY, fVeryVerbose, 0 );
190 if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
191 Gia_ManStop( pTemp );
192 return pNew;
193}
int nLutSize
Definition gia.h:336
Here is the call graph for this function:

◆ Gia_ManAigSyn4()

Gia_Man_t * Gia_ManAigSyn4 ( Gia_Man_t * p,
int fVerbose,
int fVeryVerbose )
extern

Definition at line 194 of file giaScript.c.

195{
196 Gia_Man_t * pNew, * pTemp;
197 Jf_Par_t Pars, * pPars = &Pars;
198 Jf_ManSetDefaultPars( pPars );
199 pPars->nRelaxRatio = 40;
200 if ( fVerbose ) Gia_ManPrintStats( p, NULL );
201 if ( Gia_ManAndNum(p) == 0 )
202 {
203 pNew = Gia_ManDup(p);
204 Gia_ManTransferTiming( pNew, p );
205 //Gia_ManStop( p );
206 return pNew;
207 }
208//Gia_ManAigPrintPiLevels( p );
209 // perform balancing
210 pNew = Gia_ManAreaBalance( p, 0, ABC_INFINITY, fVeryVerbose, 0 );
211 if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
212 // perform mapping
213 pPars->nLutSize = 7;
214 pNew = Jf_ManPerformMapping( pTemp = pNew, pPars );
215 if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
216// Gia_ManStop( pTemp );
217 // perform extraction
218 pNew = Gia_ManPerformFx( pTemp = pNew, ABC_INFINITY, 0, 0, fVeryVerbose, 0 );
219 if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
220 Gia_ManStop( pTemp );
221 // perform balancing
222 pNew = Gia_ManAreaBalance( pTemp = pNew, 0, ABC_INFINITY, fVeryVerbose, 0 );
223 if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
224 Gia_ManStop( pTemp );
225 // perform mapping
226 pPars->nLutSize = 5;
227 pNew = Jf_ManPerformMapping( pTemp = pNew, pPars );
228 if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
229// Gia_ManStop( pTemp );
230 // perform extraction
231 pNew = Gia_ManPerformFx( pTemp = pNew, ABC_INFINITY, 0, 0, fVeryVerbose, 0 );
232 if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
233 Gia_ManStop( pTemp );
234 // perform balancing
235 pNew = Gia_ManAreaBalance( pTemp = pNew, 0, ABC_INFINITY, fVeryVerbose, 0 );
236 if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
237 Gia_ManStop( pTemp );
238//Gia_ManAigPrintPiLevels( pNew );
239 return pNew;
240}
Gia_Man_t * Gia_ManPerformFx(Gia_Man_t *p, int nNewNodesMax, int LitCountMax, int fReverse, int fVerbose, int fVeryVerbose)
Definition giaFx.c:465
Here is the call graph for this function:

◆ Gia_ManAreaBalance()

Gia_Man_t * Gia_ManAreaBalance ( Gia_Man_t * p,
int fSimpleAnd,
int nNewNodesMax,
int fVerbose,
int fVeryVerbose )
extern

Definition at line 1047 of file giaBalAig.c.

1048{
1049 Gia_Man_t * pNew0, * pNew, * pNew1, * pNew2;
1050 Vec_Int_t * vCiLevels;
1051 // set arrival times for the input of the new AIG
1052 if ( p->vCiArrs )
1053 {
1054 int i, Id, And2Delay = p->And2Delay ? p->And2Delay : 1;
1055 Vec_IntFreeP( &p->vLevels );
1056 p->vLevels = Vec_IntStart( Gia_ManObjNum(p) );
1057 Gia_ManForEachCiId( p, Id, i )
1058 Vec_IntWriteEntry( p->vLevels, Id, Vec_IntEntry(p->vCiArrs, i)/And2Delay );
1059 }
1060 else if ( p->vInArrs )
1061 {
1062 int i, Id, And2Delay = p->And2Delay ? p->And2Delay : 1;
1063 Gia_ManForEachCiId( p, Id, i )
1064 Vec_IntWriteEntry( p->vLevels, Id, (int)(Vec_FltEntry(p->vInArrs, i)/And2Delay) );
1065 }
1066 // determine CI levels
1067 if ( p->pManTime && p->vLevels == NULL )
1069 vCiLevels = Gia_ManGetCiLevels( p );
1070 // get the starting manager
1071 pNew0 = Gia_ManHasMapping(p) ? (Gia_Man_t *)Dsm_ManDeriveGia(p, 0) : Gia_ManDup(p);
1072 Gia_ManTransferTiming( pNew0, p );
1073 if ( fVerbose ) Gia_ManPrintStats( pNew0, NULL );
1074 // derive internal manager
1075 pNew = fSimpleAnd ? Gia_ManDup( pNew0 ) : Gia_ManDupMuxes( pNew0, 2 );
1076 Gia_ManTransferTiming( pNew, pNew0 );
1077 if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
1078 if ( pNew0 != p ) Gia_ManStop( pNew0 );
1079 // perform the operation
1080 pNew1 = Dam_ManAreaBalanceInt( pNew, vCiLevels, nNewNodesMax, fVerbose, fVeryVerbose );
1081 Gia_ManTransferTiming( pNew1, pNew );
1082 if ( fVerbose ) Gia_ManPrintStats( pNew1, NULL );
1083 Gia_ManStop( pNew );
1084 Vec_IntFreeP( &vCiLevels );
1085 // derive the final result
1086 pNew2 = Gia_ManDupNoMuxes( pNew1, 0 );
1087 Gia_ManTransferTiming( pNew2, pNew1 );
1088 if ( fVerbose ) Gia_ManPrintStats( pNew2, NULL );
1089 Gia_ManStop( pNew1 );
1090 // normalize if needed
1091 if ( !Gia_ManIsNormalized(pNew2) )
1092 {
1093 pNew2 = Gia_ManDupNormalize( pNew1 = pNew2, 0 );
1094 Gia_ManTransferTiming( pNew2, pNew1 );
1095 Gia_ManStop( pNew1 );
1096 }
1097 //Gia_ManTransferTiming( pNew2, p );
1098 return pNew2;
1099}
void * Dsm_ManDeriveGia(void *p, int fUseMuxes)
Definition dauGia.c:503
Gia_Man_t * Dam_ManAreaBalanceInt(Gia_Man_t *pGia, Vec_Int_t *vCiLevels, int nNewNodesMax, int fVerbose, int fVeryVerbose)
Definition giaBalAig.c:1013
Gia_Man_t * Gia_ManDupMuxes(Gia_Man_t *p, int Limit)
Definition giaMuxes.c:98
Vec_Int_t * Gia_ManGetCiLevels(Gia_Man_t *p)
Definition giaUtil.c:609
int Gia_ManLevelWithBoxes(Gia_Man_t *p)
Definition giaTim.c:478
Gia_Man_t * Gia_ManDupNoMuxes(Gia_Man_t *p, int fSkipBufs)
Definition giaMuxes.c:228
#define Gia_ManForEachCiId(p, Id, i)
Definition gia.h:1230
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManArray2Sim()

Vec_Ptr_t * Gia_ManArray2Sim ( Vec_Wec_t * vRes)
extern

Definition at line 2596 of file giaSimBase.c.

2597{
2598 Vec_Ptr_t * vSims = Vec_PtrAlloc( Vec_WecSize(vRes) );
2599 Vec_Int_t * vLevel; int i;
2600 Vec_WecForEachLevel( vRes, vLevel, i )
2601 Vec_PtrPush( vSims, Gia_ManArray2SimOne(vLevel) );
2602 return vSims;
2603}
Vec_Wrd_t * Gia_ManArray2SimOne(Vec_Int_t *vRes)
#define Vec_WecForEachLevel(vGlob, vVec, i)
MACRO DEFINITIONS ///.
Definition vecWec.h:55
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManArray2SimOne()

Vec_Wrd_t * Gia_ManArray2SimOne ( Vec_Int_t * vRes)
extern

Definition at line 2579 of file giaSimBase.c.

2580{
2581 int i, iLit, nWords = Vec_IntEntryLast(vRes);
2582 Vec_Wrd_t * vSimsPi = Vec_WrdStart( 2*nWords );
2583 word * pInfo = Vec_WrdArray(vSimsPi);
2584 word * pCare = pInfo + nWords;
2585 Vec_IntPop( vRes );
2586 Vec_IntForEachEntry( vRes, iLit, i )
2587 {
2588 Abc_TtXorBit( pCare, Abc_Lit2Var(iLit) );
2589 if ( Abc_LitIsCompl(iLit) )
2590 Abc_TtXorBit( pInfo, Abc_Lit2Var(iLit) );
2591 }
2592 Vec_IntPush( vRes, nWords );
2593 Vec_WrdShrink( vSimsPi, Vec_WrdSize(vSimsPi)/2 );
2594 return vSimsPi;
2595}
int nWords
Definition abcNpn.c:127
unsigned __int64 word
DECLARATIONS ///.
Definition kitPerm.c:36
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.
Definition vecWrd.h:42
Here is the caller graph for this function:

◆ Gia_ManBalance()

Gia_Man_t * Gia_ManBalance ( Gia_Man_t * p,
int fSimpleAnd,
int fStrict,
int fVerbose )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 441 of file giaBalAig.c.

442{
443 Gia_Man_t * pNew, * pNew1, * pNew2;
444 if ( fVerbose ) Gia_ManPrintStats( p, NULL );
445 pNew = fSimpleAnd ? Gia_ManDup( p ) : Gia_ManDupMuxes( p, 2 );
446 Gia_ManTransferTiming( pNew, p );
447 if ( fVerbose ) Gia_ManPrintStats( pNew, NULL );
448 pNew1 = Gia_ManBalanceInt( pNew, fStrict );
449 Gia_ManTransferTiming( pNew1, pNew );
450 if ( fVerbose ) Gia_ManPrintStats( pNew1, NULL );
451 Gia_ManStop( pNew );
452 pNew2 = Gia_ManDupNoMuxes( pNew1, 0 );
453 Gia_ManTransferTiming( pNew2, pNew1 );
454 if ( fVerbose ) Gia_ManPrintStats( pNew2, NULL );
455 Gia_ManStop( pNew1 );
456 return pNew2;
457}
Gia_Man_t * Gia_ManBalanceInt(Gia_Man_t *p, int fStrict)
Definition giaBalAig.c:378
Here is the call graph for this function:

◆ Gia_ManBlackBoxNum()

int Gia_ManBlackBoxNum ( Gia_Man_t * p)
extern

Definition at line 62 of file giaTim.c.

63{
64 return Tim_ManBlackBoxNum((Tim_Man_t *)p->pManTime);
65}
int Tim_ManBlackBoxNum(Tim_Man_t *p)
Definition timMan.c:726
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManBoxCiNum()

int Gia_ManBoxCiNum ( Gia_Man_t * p)
extern

Definition at line 66 of file giaTim.c.

67{
68 return p->pManTime ? Gia_ManCiNum(p) - Tim_ManPiNum((Tim_Man_t *)p->pManTime) : 0;
69}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManBoxCoNum()

int Gia_ManBoxCoNum ( Gia_Man_t * p)
extern

Definition at line 70 of file giaTim.c.

71{
72 return p->pManTime ? Gia_ManCoNum(p) - Tim_ManPoNum((Tim_Man_t *)p->pManTime) : 0;
73}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManBoxNum()

int Gia_ManBoxNum ( Gia_Man_t * p)
extern

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 50 of file giaTim.c.

51{
52 return p->pManTime ? Tim_ManBoxNum((Tim_Man_t *)p->pManTime) : 0;
53}
int Tim_ManBoxNum(Tim_Man_t *p)
Definition timMan.c:722
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManBuiltInSimAddPat()

int Gia_ManBuiltInSimAddPat ( Gia_Man_t * p,
Vec_Int_t * vPat )
extern

Definition at line 963 of file giaSim.c.

964{
965 int Period = 0xF;
966 int fOverflow = p->iPatsPi == 64 * p->nSimWords && p->nSimWords == p->nSimWordsMax;
967 int k, iLit, iPat = Gia_ManBuiltInSimPack( p, vPat );
968 if ( iPat == -1 )
969 {
970 if ( fOverflow )
971 {
972 if ( (p->iPastPiMax & Period) == 0 )
974 iPat = p->iPastPiMax;
975 //if ( p->iPastPiMax == 64 * p->nSimWordsMax - 1 )
976 // printf( "Completed the cycle.\n" );
977 p->iPastPiMax = p->iPastPiMax == 64 * p->nSimWordsMax - 1 ? 0 : p->iPastPiMax + 1;
978 }
979 else
980 {
981 if ( p->iPatsPi && (p->iPatsPi & Period) == 0 )
983 if ( p->iPatsPi == 64 * p->nSimWords )
984 {
985 Vec_Wrd_t * vTemp = Vec_WrdAlloc( 2 * Vec_WrdSize(p->vSims) );
986 word Data; int w, Count = 0, iObj = 0;
987 Vec_WrdForEachEntry( p->vSims, Data, w )
988 {
989 Vec_WrdPush( vTemp, Data );
990 if ( ++Count == p->nSimWords )
991 {
992 Gia_Obj_t * pObj = Gia_ManObj(p, iObj++);
993 if ( Gia_ObjIsCi(pObj) )
994 Vec_WrdPush( vTemp, Gia_ManRandomW(0) ); // Vec_WrdPush( vTemp, 0 );
995 else if ( Gia_ObjIsAnd(pObj) )
996 Vec_WrdPush( vTemp, pObj->fPhase ? ~(word)0 : 0 );
997 else
998 Vec_WrdPush( vTemp, 0 );
999 Count = 0;
1000 }
1001 }
1002 assert( iObj == Gia_ManObjNum(p) );
1003 Vec_WrdFree( p->vSims );
1004 p->vSims = vTemp;
1005
1006 vTemp = Vec_WrdAlloc( 2 * Vec_WrdSize(p->vSimsPi) );
1007 Count = 0;
1008 Vec_WrdForEachEntry( p->vSimsPi, Data, w )
1009 {
1010 Vec_WrdPush( vTemp, Data );
1011 if ( ++Count == p->nSimWords )
1012 {
1013 Vec_WrdPush( vTemp, 0 );
1014 Count = 0;
1015 }
1016 }
1017 Vec_WrdFree( p->vSimsPi );
1018 p->vSimsPi = vTemp;
1019
1020 // update the word count
1021 p->nSimWords++;
1022 assert( Vec_WrdSize(p->vSims) == p->nSimWords * Gia_ManObjNum(p) );
1023 assert( Vec_WrdSize(p->vSimsPi) == p->nSimWords * Gia_ManCiNum(p) );
1024 //printf( "Resizing to %d words.\n", p->nSimWords );
1025 }
1026 iPat = p->iPatsPi++;
1027 }
1028 }
1029 assert( iPat >= 0 && iPat < p->iPatsPi );
1030 // add literals
1031 if ( fOverflow )
1032 {
1033 int iVar;
1034 Vec_IntForEachEntry( &p->vSuppVars, iVar, k )
1035 if ( Abc_TtGetBit(Gia_ManBuiltInDataPi(p, iVar), iPat) )
1036 Abc_TtXorBit(Gia_ManBuiltInDataPi(p, iVar), iPat);
1037 Vec_IntForEachEntry( vPat, iLit, k )
1038 {
1039 if ( Abc_TtGetBit(Gia_ManBuiltInData(p, 1+Abc_Lit2Var(iLit)), iPat) == Abc_LitIsCompl(iLit) )
1040 Abc_TtXorBit(Gia_ManBuiltInData(p, 1+Abc_Lit2Var(iLit)), iPat);
1041 Abc_TtXorBit(Gia_ManBuiltInDataPi(p, Abc_Lit2Var(iLit)), iPat);
1042 }
1043 }
1044 else
1045 {
1046 Vec_IntForEachEntry( vPat, iLit, k )
1047 {
1048 if ( Abc_TtGetBit(Gia_ManBuiltInDataPi(p, Abc_Lit2Var(iLit)), iPat) )
1049 assert( Abc_TtGetBit(Gia_ManBuiltInData(p, 1+Abc_Lit2Var(iLit)), iPat) != Abc_LitIsCompl(iLit) );
1050 else
1051 {
1052 if ( Abc_TtGetBit(Gia_ManBuiltInData(p, 1+Abc_Lit2Var(iLit)), iPat) == Abc_LitIsCompl(iLit) )
1053 Abc_TtXorBit(Gia_ManBuiltInData(p, 1+Abc_Lit2Var(iLit)), iPat);
1054 Abc_TtXorBit(Gia_ManBuiltInDataPi(p, Abc_Lit2Var(iLit)), iPat);
1055 }
1056 }
1057 }
1058 return 1;
1059}
int Gia_ManBuiltInSimPack(Gia_Man_t *p, Vec_Int_t *vPat)
Definition giaSim.c:946
void Gia_ManBuiltInSimResimulate(Gia_Man_t *p)
Definition giaSim.c:852
word Gia_ManRandomW(int fReset)
Definition giaUtil.c:67
unsigned fPhase
Definition gia.h:87
#define Vec_WrdForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecWrd.h:54
Here is the call graph for this function:

◆ Gia_ManBuiltInSimCheckEqual()

int Gia_ManBuiltInSimCheckEqual ( Gia_Man_t * p,
int iLit0,
int iLit1 )
extern

Definition at line 902 of file giaSim.c.

903{
904 word * pInfo0 = Gia_ManBuiltInData( p, Abc_Lit2Var(iLit0) );
905 word * pInfo1 = Gia_ManBuiltInData( p, Abc_Lit2Var(iLit1) ); int w;
906 assert( p->fBuiltInSim || p->fIncrSim );
907
908// printf( "%d %d\n", Abc_LitIsCompl(iLit0), Abc_LitIsCompl(iLit1) );
909// Extra_PrintBinary( stdout, pInfo0, 64*p->nSimWords ); printf( "\n" );
910// Extra_PrintBinary( stdout, pInfo1, 64*p->nSimWords ); printf( "\n" );
911// printf( "\n" );
912
913 if ( Abc_LitIsCompl(iLit0) )
914 {
915 if ( Abc_LitIsCompl(iLit1) )
916 {
917 for ( w = 0; w < p->nSimWords; w++ )
918 if ( ~pInfo0[w] != ~pInfo1[w] )
919 return 0;
920 }
921 else
922 {
923 for ( w = 0; w < p->nSimWords; w++ )
924 if ( ~pInfo0[w] != pInfo1[w] )
925 return 0;
926 }
927 }
928 else
929 {
930 if ( Abc_LitIsCompl(iLit1) )
931 {
932 for ( w = 0; w < p->nSimWords; w++ )
933 if ( pInfo0[w] != ~pInfo1[w] )
934 return 0;
935 }
936 else
937 {
938 for ( w = 0; w < p->nSimWords; w++ )
939 if ( pInfo0[w] != pInfo1[w] )
940 return 0;
941 }
942 }
943 return 1;
944}
Here is the caller graph for this function:

◆ Gia_ManBuiltInSimCheckOver()

int Gia_ManBuiltInSimCheckOver ( Gia_Man_t * p,
int iLit0,
int iLit1 )
extern

Definition at line 859 of file giaSim.c.

860{
861 word * pInfo0 = Gia_ManBuiltInData( p, Abc_Lit2Var(iLit0) );
862 word * pInfo1 = Gia_ManBuiltInData( p, Abc_Lit2Var(iLit1) ); int w;
863 assert( p->fBuiltInSim || p->fIncrSim );
864
865// printf( "%d %d\n", Abc_LitIsCompl(iLit0), Abc_LitIsCompl(iLit1) );
866// Extra_PrintBinary( stdout, pInfo0, 64*p->nSimWords ); printf( "\n" );
867// Extra_PrintBinary( stdout, pInfo1, 64*p->nSimWords ); printf( "\n" );
868// printf( "\n" );
869
870 if ( Abc_LitIsCompl(iLit0) )
871 {
872 if ( Abc_LitIsCompl(iLit1) )
873 {
874 for ( w = 0; w < p->nSimWords; w++ )
875 if ( ~pInfo0[w] & ~pInfo1[w] )
876 return 1;
877 }
878 else
879 {
880 for ( w = 0; w < p->nSimWords; w++ )
881 if ( ~pInfo0[w] & pInfo1[w] )
882 return 1;
883 }
884 }
885 else
886 {
887 if ( Abc_LitIsCompl(iLit1) )
888 {
889 for ( w = 0; w < p->nSimWords; w++ )
890 if ( pInfo0[w] & ~pInfo1[w] )
891 return 1;
892 }
893 else
894 {
895 for ( w = 0; w < p->nSimWords; w++ )
896 if ( pInfo0[w] & pInfo1[w] )
897 return 1;
898 }
899 }
900 return 0;
901}
Here is the caller graph for this function:

◆ Gia_ManBuiltInSimPerform()

void Gia_ManBuiltInSimPerform ( Gia_Man_t * p,
int iObj )
extern

Definition at line 824 of file giaSim.c.

825{
826 int w;
827 for ( w = 0; w < p->nSimWords; w++ )
828 Vec_WrdPush( p->vSims, 0 );
830}
void Gia_ManBuiltInSimPerformInt(Gia_Man_t *p, int iObj)
Definition giaSim.c:797
Here is the call graph for this function:

◆ Gia_ManBuiltInSimResimulate()

void Gia_ManBuiltInSimResimulate ( Gia_Man_t * p)
extern

Definition at line 852 of file giaSim.c.

853{
854 Gia_Obj_t * pObj; int iObj;
855 Gia_ManForEachAnd( p, pObj, iObj )
857}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManBuiltInSimResimulateCone()

void Gia_ManBuiltInSimResimulateCone ( Gia_Man_t * p,
int iLit0,
int iLit1 )
extern

Definition at line 846 of file giaSim.c.

847{
849 Gia_ManBuiltInSimResimulateCone_rec( p, Abc_Lit2Var(iLit0) );
850 Gia_ManBuiltInSimResimulateCone_rec( p, Abc_Lit2Var(iLit1) );
851}
void Gia_ManBuiltInSimResimulateCone_rec(Gia_Man_t *p, int iObj)
Definition giaSim.c:832
Here is the call graph for this function:

◆ Gia_ManBuiltInSimStart()

void Gia_ManBuiltInSimStart ( Gia_Man_t * p,
int nWords,
int nObjs )
extern

Definition at line 776 of file giaSim.c.

777{
778 int i, k;
779 assert( !p->fBuiltInSim );
780 assert( Gia_ManAndNum(p) == 0 );
781 p->fBuiltInSim = 1;
782 p->iPatsPi = 0;
783 p->iPastPiMax = 0;
784 p->nSimWords = nWords;
785 p->nSimWordsMax = 8;
786 Gia_ManRandomW( 1 );
787 // init PI care info
788 p->vSimsPi = Vec_WrdAlloc( p->nSimWords * Gia_ManCiNum(p) );
789 Vec_WrdFill( p->vSimsPi, p->nSimWords * Gia_ManCiNum(p), 0 );
790 // init object sim info
791 p->vSims = Vec_WrdAlloc( p->nSimWords * nObjs );
792 Vec_WrdFill( p->vSims, p->nSimWords, 0 );
793 for ( i = 0; i < Gia_ManCiNum(p); i++ )
794 for ( k = 0; k < p->nSimWords; k++ )
795 Vec_WrdPush( p->vSims, Gia_ManRandomW(0) );
796}
Here is the call graph for this function:

◆ Gia_ManCexExtendToIncludeAllObjects()

Abc_Cex_t * Gia_ManCexExtendToIncludeAllObjects ( Gia_Man_t * p,
Abc_Cex_t * pCex )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 353 of file giaCex.c.

354{
355 Abc_Cex_t * pNew;
356 Gia_Obj_t * pObj, * pObjRo, * pObjRi;
357 int i, k, iBit = 0;
358 assert( pCex->nRegs > 0 );
359 // start the counter-example
360 pNew = Abc_CexAlloc( 0, Gia_ManObjNum(p), pCex->iFrame + 1 );
361 pNew->iFrame = pCex->iFrame;
362 pNew->iPo = pCex->iPo;
363 // set const0
364 Gia_ManConst0(p)->fMark0 = 0;
365 // set init state
366 Gia_ManForEachRi( p, pObjRi, k )
367 pObjRi->fMark0 = Abc_InfoHasBit(pCex->pData, iBit++);
368 assert( iBit == pCex->nRegs );
369 for ( i = 0; i <= pCex->iFrame; i++ )
370 {
371 Gia_ManForEachPi( p, pObj, k )
372 pObj->fMark0 = Abc_InfoHasBit(pCex->pData, iBit++);
373 Gia_ManForEachRiRo( p, pObjRi, pObjRo, k )
374 pObjRo->fMark0 = pObjRi->fMark0;
375 Gia_ManForEachObj( p, pObj, k )
376 if ( pObj->fMark0 )
377 Abc_InfoSetBit( pNew->pData, pNew->nPis * i + k );
378 Gia_ManForEachAnd( p, pObj, k )
379 pObj->fMark0 = (Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj)) & (Gia_ObjFanin1(pObj)->fMark0 ^ Gia_ObjFaninC1(pObj));
380 Gia_ManForEachCo( p, pObj, k )
381 pObj->fMark0 = Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj);
382 }
383 assert( iBit == pCex->nBits );
384 assert( Gia_ManPo(p, pCex->iPo)->fMark0 == 1 );
386 return pNew;
387}
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition gia.h:1190
#define Gia_ManForEachRiRo(p, pObjRi, pObjRo, i)
Definition gia.h:1256
unsigned fMark0
Definition gia.h:81
ABC_NAMESPACE_IMPL_START Abc_Cex_t * Abc_CexAlloc(int nRegs, int nRealPis, int nFrames)
DECLARATIONS ///.
Definition utilCex.c:51
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
Definition utilCex.h:39
Here is the call graph for this function:

◆ Gia_ManCexExtendToIncludeCurrentStates()

Abc_Cex_t * Gia_ManCexExtendToIncludeCurrentStates ( Gia_Man_t * p,
Abc_Cex_t * pCex )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 306 of file giaCex.c.

307{
308 Abc_Cex_t * pNew;
309 Gia_Obj_t * pObj, * pObjRo, * pObjRi;
310 int i, k, iBit = 0;
311 assert( pCex->nRegs > 0 );
312 // start the counter-example
313 pNew = Abc_CexAlloc( 0, Gia_ManCiNum(p), pCex->iFrame + 1 );
314 pNew->iFrame = pCex->iFrame;
315 pNew->iPo = pCex->iPo;
316 // set const0
317 Gia_ManConst0(p)->fMark0 = 0;
318 // set init state
319 Gia_ManForEachRi( p, pObjRi, k )
320 pObjRi->fMark0 = Abc_InfoHasBit(pCex->pData, iBit++);
321 assert( iBit == pCex->nRegs );
322 for ( i = 0; i <= pCex->iFrame; i++ )
323 {
324 Gia_ManForEachPi( p, pObj, k )
325 pObj->fMark0 = Abc_InfoHasBit(pCex->pData, iBit++);
326 Gia_ManForEachRiRo( p, pObjRi, pObjRo, k )
327 pObjRo->fMark0 = pObjRi->fMark0;
328 Gia_ManForEachCi( p, pObj, k )
329 if ( pObj->fMark0 )
330 Abc_InfoSetBit( pNew->pData, pNew->nPis * i + k );
331 Gia_ManForEachAnd( p, pObj, k )
332 pObj->fMark0 = (Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj)) & (Gia_ObjFanin1(pObj)->fMark0 ^ Gia_ObjFaninC1(pObj));
333 Gia_ManForEachCo( p, pObj, k )
334 pObj->fMark0 = Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj);
335 }
336 assert( iBit == pCex->nBits );
337 assert( Gia_ManPo(p, pCex->iPo)->fMark0 == 1 );
339 return pNew;
340}
Here is the call graph for this function:

◆ Gia_ManCheckCoPhase()

int Gia_ManCheckCoPhase ( Gia_Man_t * p)
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 491 of file giaUtil.c.

492{
493 Gia_Obj_t * pObj;
494 int i, Counter = 0;
495 Gia_ManForEachCo( p, pObj, i )
496 Counter += pObj->fPhase;
497 return Counter;
498}
Here is the caller graph for this function:

◆ Gia_ManCheckIntegrityWithBoxes()

void Gia_ManCheckIntegrityWithBoxes ( Gia_Man_t * p)
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 441 of file giaSweep.c.

442{
443 Gia_Obj_t * pObj;
444 Vec_Int_t * vCarryOuts;
445 int i, nCountReg = 0, nCountCarry = 0;
446 if ( p->pManTime == NULL )
447 return;
448 ABC_FREE( p->pRefs );
450 for ( i = Gia_ManPoNum(p) - Gia_ManRegBoxNum(p); i < Gia_ManPoNum(p); i++ )
451 {
452 pObj = Gia_ObjFanin0( Gia_ManPo(p, i) );
453 assert( Gia_ObjIsCi(pObj) );
454 if ( Gia_ObjRefNum(p, pObj) > 1 )
455 nCountReg++;
456 }
457 vCarryOuts = Gia_ManComputeCarryOuts( p );
458 Gia_ManForEachObjVec( vCarryOuts, p, pObj, i )
459 if ( Gia_ObjRefNum(p, pObj) > 1 )
460 nCountCarry++;
461 Vec_IntFree( vCarryOuts );
462 if ( nCountReg || nCountCarry )
463 printf( "Warning: AIG with boxes has internal fanout in %d complex flops and %d carries.\n", nCountReg, nCountCarry );
464 ABC_FREE( p->pRefs );
465}
Vec_Int_t * Gia_ManComputeCarryOuts(Gia_Man_t *p)
Definition giaSweep.c:385
int Gia_ManRegBoxNum(Gia_Man_t *p)
Definition giaTim.c:54
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManCheckMark0()

void Gia_ManCheckMark0 ( Gia_Man_t * p)
extern

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

Synopsis [Sets phases of the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 275 of file giaUtil.c.

276{
277 Gia_Obj_t * pObj;
278 int i;
279 Gia_ManForEachObj( p, pObj, i )
280 assert( pObj->fMark0 == 0 );
281}

◆ Gia_ManCheckMark1()

void Gia_ManCheckMark1 ( Gia_Man_t * p)
extern

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

Synopsis [Sets phases of the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 332 of file giaUtil.c.

333{
334 Gia_Obj_t * pObj;
335 int i;
336 Gia_ManForEachObj( p, pObj, i )
337 assert( pObj->fMark1 == 0 );
338}
unsigned fMark1
Definition gia.h:86
Here is the caller graph for this function:

◆ Gia_ManCheckSuppOverlap()

int Gia_ManCheckSuppOverlap ( Gia_Man_t * p,
int iNode1,
int iNode2 )
extern

Definition at line 2278 of file giaUtil.c.

2279{
2280 int Result;
2281 if ( iNode1 == 0 || iNode2 == 0 )
2282 return 0;
2283 Gia_ManCheckSuppMark_rec( p, Gia_ManObj(p, iNode1) );
2284 Result = Gia_ManCheckSupp_rec( p, Gia_ManObj(p, iNode2) );
2285 Gia_ManCheckSuppUnmark_rec( p, Gia_ManObj(p, iNode1) );
2286 return Result;
2287}
void Gia_ManCheckSuppMark_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaUtil.c:2248
int Gia_ManCheckSupp_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaUtil.c:2268
void Gia_ManCheckSuppUnmark_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaUtil.c:2258
Here is the call graph for this function:

◆ Gia_ManCheckTopoOrder()

int Gia_ManCheckTopoOrder ( Gia_Man_t * p)
extern

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 236 of file giaEquiv.c.

237{
238 Gia_Obj_t * pObj;
239 int i, RetValue = 1;
241 Gia_ManConst0(p)->Value = 0;
242 Gia_ManForEachCi( p, pObj, i )
243 pObj->Value = 0;
244 Gia_ManForEachCo( p, pObj, i )
245 RetValue &= Gia_ManCheckTopoOrder_rec( p, Gia_ObjFanin0(pObj) );
246 return RetValue;
247}
int Gia_ManCheckTopoOrder_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaEquiv.c:209
Here is the call graph for this function:

◆ Gia_ManChoiceMiter()

Gia_Man_t * Gia_ManChoiceMiter ( Vec_Ptr_t * vGias)
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 3763 of file giaDup.c.

3764{
3765 Gia_Man_t * pNew, * pGia, * pGia0;
3766 int i, k, iNode, nNodes;
3767 // make sure they have equal parameters
3768 assert( Vec_PtrSize(vGias) > 0 );
3769 pGia0 = (Gia_Man_t *)Vec_PtrEntry( vGias, 0 );
3770 Vec_PtrForEachEntry( Gia_Man_t *, vGias, pGia, i )
3771 {
3772 assert( Gia_ManCiNum(pGia) == Gia_ManCiNum(pGia0) );
3773 assert( Gia_ManCoNum(pGia) == Gia_ManCoNum(pGia0) );
3774 assert( Gia_ManRegNum(pGia) == Gia_ManRegNum(pGia0) );
3775 Gia_ManFillValue( pGia );
3776 Gia_ManConst0(pGia)->Value = 0;
3777 }
3778 // start the new manager
3779 pNew = Gia_ManStart( Vec_PtrSize(vGias) * Gia_ManObjNum(pGia0) );
3780 pNew->pName = Abc_UtilStrsav( pGia0->pName );
3781 pNew->pSpec = Abc_UtilStrsav( pGia0->pSpec );
3782 // create new CIs and assign them to the old manager CIs
3783 for ( k = 0; k < Gia_ManCiNum(pGia0); k++ )
3784 {
3785 iNode = Gia_ManAppendCi(pNew);
3786 Vec_PtrForEachEntry( Gia_Man_t *, vGias, pGia, i )
3787 Gia_ManCi( pGia, k )->Value = iNode;
3788 }
3789 // create internal nodes
3790 Gia_ManHashAlloc( pNew );
3791 for ( k = 0; k < Gia_ManCoNum(pGia0); k++ )
3792 {
3793 Vec_PtrForEachEntry( Gia_Man_t *, vGias, pGia, i )
3794 Gia_ManChoiceMiter_rec( pNew, pGia, Gia_ManCo( pGia, k ) );
3795 }
3796 Gia_ManHashStop( pNew );
3797 // check the presence of dangling nodes
3798 nNodes = Gia_ManHasDangling( pNew );
3799 //assert( nNodes == 0 );
3800 // finalize
3801 Gia_ManSetRegNum( pNew, Gia_ManRegNum(pGia0) );
3802 return pNew;
3803}
int Gia_ManChoiceMiter_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaDup.c:3741
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManCleanLevels()

void Gia_ManCleanLevels ( Gia_Man_t * p,
int Size )
extern

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

Synopsis [Prepares copies for the model.]

Description []

SideEffects []

SeeAlso []

Definition at line 511 of file giaUtil.c.

512{
513 if ( p->vLevels == NULL )
514 p->vLevels = Vec_IntAlloc( Size );
515 Vec_IntFill( p->vLevels, Size, 0 );
516}
Here is the caller graph for this function:

◆ Gia_ManCleanMark0()

void Gia_ManCleanMark0 ( Gia_Man_t * p)
extern

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

Synopsis [Sets phases of the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 256 of file giaUtil.c.

257{
258 Gia_Obj_t * pObj;
259 int i;
260 Gia_ManForEachObj( p, pObj, i )
261 pObj->fMark0 = 0;
262}

◆ Gia_ManCleanMark01()

void Gia_ManCleanMark01 ( Gia_Man_t * p)
extern

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

Synopsis [Sets phases of the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 218 of file giaUtil.c.

219{
220 Gia_Obj_t * pObj;
221 int i;
222 Gia_ManForEachObj( p, pObj, i )
223 pObj->fMark0 = pObj->fMark1 = 0;
224}
Here is the caller graph for this function:

◆ Gia_ManCleanMark1()

void Gia_ManCleanMark1 ( Gia_Man_t * p)
extern

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

Synopsis [Sets phases of the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 313 of file giaUtil.c.

314{
315 Gia_Obj_t * pObj;
316 int i;
317 Gia_ManForEachObj( p, pObj, i )
318 pObj->fMark1 = 0;
319}
Here is the caller graph for this function:

◆ Gia_ManCleanPhase()

void Gia_ManCleanPhase ( Gia_Man_t * p)
extern

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

Synopsis [Sets phases of the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 472 of file giaUtil.c.

473{
474 Gia_Obj_t * pObj;
475 int i;
476 Gia_ManForEachObj( p, pObj, i )
477 pObj->fPhase = 0;
478}
Here is the caller graph for this function:

◆ Gia_ManCleanTruth()

void Gia_ManCleanTruth ( Gia_Man_t * p)
extern

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

Synopsis [Prepares copies for the model.]

Description []

SideEffects []

SeeAlso []

Definition at line 528 of file giaUtil.c.

529{
530 if ( p->vTruths == NULL )
531 p->vTruths = Vec_IntAlloc( Gia_ManObjNum(p) );
532 Vec_IntFill( p->vTruths, Gia_ManObjNum(p), -1 );
533}
Here is the caller graph for this function:

◆ Gia_ManCleanup()

Gia_Man_t * Gia_ManCleanup ( Gia_Man_t * p)
extern

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

Synopsis [Performs combinational cleanup.]

Description []

SideEffects []

SeeAlso []

Definition at line 84 of file giaScl.c.

85{
87 return Gia_ManDupMarked( p );
88}
int Gia_ManCombMarkUsed(Gia_Man_t *p)
Definition giaScl.c:60
Gia_Man_t * Gia_ManDupMarked(Gia_Man_t *p)
Definition giaDup.c:1444
Here is the call graph for this function:

◆ Gia_ManCleanupOutputs()

Gia_Man_t * Gia_ManCleanupOutputs ( Gia_Man_t * p,
int nOutputs )
extern

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) );
108 Gia_ManForEachCo( p, pObj, i )
109 if ( i < nOutputs )
110 pObj->fMark0 = 1;
111 else
112 break;
113 return Gia_ManDupMarked( p );
114}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManCleanValue()

void Gia_ManCleanValue ( Gia_Man_t * p)
extern

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

Synopsis [Cleans the value.]

Description []

SideEffects []

SeeAlso []

Definition at line 351 of file giaUtil.c.

352{
353 int i;
354 for ( i = 0; i < p->nObjs; i++ )
355 p->pObjs[i].Value = 0;
356}
Here is the caller graph for this function:

◆ Gia_ManClockDomainNum()

int Gia_ManClockDomainNum ( Gia_Man_t * p)
extern

Definition at line 74 of file giaTim.c.

75{
76 int i, nDoms, Count = 0;
77 if ( p->vRegClasses == NULL )
78 return 0;
79 nDoms = Vec_IntFindMax(p->vRegClasses);
80 assert( Vec_IntCountEntry(p->vRegClasses, 0) == 0 );
81 for ( i = 1; i <= nDoms; i++ )
82 if ( Vec_IntCountEntry(p->vRegClasses, i) > 0 )
83 Count++;
84 return Count;
85}
Here is the caller graph for this function:

◆ Gia_ManCollectAnds()

void Gia_ManCollectAnds ( Gia_Man_t * p,
int * pNodes,
int nNodes,
Vec_Int_t * vNodes,
Vec_Int_t * vLeaves )
extern

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

Synopsis [Collects support nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 125 of file giaDfs.c.

126{
127 int i, iLeaf;
128// Gia_ManIncrementTravId( p );
129 Gia_ObjSetTravIdCurrentId( p, 0 );
130 if ( vLeaves )
131 Vec_IntForEachEntry( vLeaves, iLeaf, i )
132 Gia_ObjSetTravIdCurrentId( p, iLeaf );
133 Vec_IntClear( vNodes );
134 for ( i = 0; i < nNodes; i++ )
135 {
136 Gia_Obj_t * pObj = Gia_ManObj( p, pNodes[i] );
137 if ( Gia_ObjIsCo(pObj) )
138 Gia_ManCollectAnds_rec( p, Gia_ObjFaninId0(pObj, pNodes[i]), vNodes );
139 else if ( Gia_ObjIsAnd(pObj) )
140 Gia_ManCollectAnds_rec( p, pNodes[i], vNodes );
141 }
142}
void Gia_ManCollectAnds_rec(Gia_Man_t *p, int iObj, Vec_Int_t *vNodes)
Definition giaDfs.c:99
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManCollectAnds_rec()

void Gia_ManCollectAnds_rec ( Gia_Man_t * p,
int iObj,
Vec_Int_t * vNodes )
extern

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

Synopsis [Counts the support size of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 99 of file giaDfs.c.

100{
101 Gia_Obj_t * pObj;
102 if ( Gia_ObjIsTravIdCurrentId(p, iObj) )
103 return;
104 Gia_ObjSetTravIdCurrentId(p, iObj);
105 pObj = Gia_ManObj( p, iObj );
106 if ( Gia_ObjIsCi(pObj) )
107 return;
108 assert( Gia_ObjIsAnd(pObj) );
109 Gia_ManCollectAnds_rec( p, Gia_ObjFaninId0(pObj, iObj), vNodes );
110 Gia_ManCollectAnds_rec( p, Gia_ObjFaninId1(pObj, iObj), vNodes );
111 Vec_IntPush( vNodes, iObj );
112}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManCollectAndsAll()

Vec_Int_t * Gia_ManCollectAndsAll ( Gia_Man_t * p)
extern

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

Synopsis [Collects support nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 155 of file giaDfs.c.

156{
157 Gia_Obj_t * pObj; int i;
158 Vec_Int_t * vNodes = Vec_IntAlloc( Gia_ManAndNum(p) );
159 Gia_ManForEachAnd( p, pObj, i )
160 Vec_IntPush( vNodes, i );
161 return vNodes;
162}

◆ Gia_ManCollectCis()

void Gia_ManCollectCis ( Gia_Man_t * p,
int * pNodes,
int nNodes,
Vec_Int_t * vSupp )
extern

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 );
77 Gia_ObjSetTravIdCurrent( p, Gia_ManConst0(p) );
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}
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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManCollectNodesCis()

Vec_Int_t * Gia_ManCollectNodesCis ( Gia_Man_t * p,
int * pNodes,
int nNodes )
extern

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

Synopsis [Collects support nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 202 of file giaDfs.c.

203{
204 Vec_Int_t * vNodes;
205 Gia_Obj_t * pObj;
206 int i;
207 vNodes = Vec_IntAlloc( 10000 );
209 Gia_ObjSetTravIdCurrent( p, Gia_ManConst0(p) );
210 for ( i = 0; i < nNodes; i++ )
211 {
212 pObj = Gia_ManObj( p, pNodes[i] );
213 if ( Gia_ObjIsCo(pObj) )
214 Gia_ManCollectNodesCis_rec( p, Gia_ObjFanin0(pObj), vNodes );
215 else
216 Gia_ManCollectNodesCis_rec( p, pObj, vNodes );
217 }
218 return vNodes;
219}
void Gia_ManCollectNodesCis_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vNodes)
Definition giaDfs.c:175
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManCollectPoIds()

Vec_Int_t * Gia_ManCollectPoIds ( Gia_Man_t * p)
extern

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

Synopsis [Collects PO Ids into one array.]

Description []

SideEffects []

SeeAlso []

Definition at line 960 of file giaUtil.c.

961{
962 Vec_Int_t * vStart;
963 int Entry, i;
964 vStart = Vec_IntAlloc( Gia_ManPoNum(p) );
965 Vec_IntForEachEntryStop( p->vCos, Entry, i, Gia_ManPoNum(p) )
966 Vec_IntPush( vStart, Entry );
967 return vStart;
968}
#define Vec_IntForEachEntryStop(vVec, Entry, i, Stop)
Definition vecInt.h:58
Here is the caller graph for this function:

◆ Gia_ManCollectSuppNew()

Vec_Int_t * Gia_ManCollectSuppNew ( Gia_Man_t * p,
int iOut,
int nOuts )
extern

Definition at line 632 of file giaMinLut.c.

633{
634 Vec_Int_t * vRes = Gia_ManCollectSupp( p, iOut, nOuts );
635 Gia_ManPermuteSupp( p, iOut, nOuts, vRes );
636 return vRes;
637}
Vec_Int_t * Gia_ManCollectSupp(Gia_Man_t *p, int iOut, int nOuts)
Definition giaMinLut.c:624
void Gia_ManPermuteSupp(Gia_Man_t *p, int iOut, int nOuts, Vec_Int_t *vSupp)
Definition giaMinLut.c:590
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManCollectTfi()

void Gia_ManCollectTfi ( Gia_Man_t * p,
Vec_Int_t * vRoots,
Vec_Int_t * vNodes )
extern

Definition at line 581 of file giaDfs.c.

582{
583 int i, iRoot;
584 Vec_IntClear( vNodes );
586 Vec_IntForEachEntry( vRoots, iRoot, i )
587 Gia_ManCollectTfi_rec( p, iRoot, vNodes );
588}
void Gia_ManCollectTfi_rec(Gia_Man_t *p, int iObj, Vec_Int_t *vNodes)
Definition giaDfs.c:567
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManCollectTfo()

void Gia_ManCollectTfo ( Gia_Man_t * p,
Vec_Int_t * vRoots,
Vec_Int_t * vNodes )
extern

Definition at line 615 of file giaDfs.c.

616{
617 int i, iRoot;
618 Vec_IntClear( vNodes );
620 Vec_IntForEachEntry( vRoots, iRoot, i )
621 Gia_ManCollectTfo_rec( p, iRoot, vNodes );
622}
void Gia_ManCollectTfo_rec(Gia_Man_t *p, int iObj, Vec_Int_t *vNodes)
Definition giaDfs.c:601
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManCombMarkUsed()

int Gia_ManCombMarkUsed ( Gia_Man_t * p)
extern

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}
ABC_NAMESPACE_IMPL_START int Gia_ManCombMarkUsed_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
DECLARATIONS ///.
Definition giaScl.c:45
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManCompare()

int Gia_ManCompare ( Gia_Man_t * p1,
Gia_Man_t * p2 )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 1737 of file giaUtil.c.

1738{
1739 Gia_Obj_t * pObj1, * pObj2;
1740 int i;
1741 if ( Gia_ManObjNum(p1) != Gia_ManObjNum(p2) )
1742 {
1743 printf( "AIGs have different number of objects.\n" );
1744 return 0;
1745 }
1746 Gia_ManCleanValue( p1 );
1747 Gia_ManCleanValue( p2 );
1748 Gia_ManForEachObj( p1, pObj1, i )
1749 {
1750 pObj2 = Gia_ManObj( p2, i );
1751 if ( memcmp( pObj1, pObj2, sizeof(Gia_Obj_t) ) )
1752 {
1753 printf( "Objects %d are different.\n", i );
1754 return 0;
1755 }
1756 if ( p1->pReprs && p2->pReprs )
1757 {
1758 if ( memcmp( &p1->pReprs[i], &p2->pReprs[i], sizeof(Gia_Rpr_t) ) )
1759 {
1760 printf( "Representatives of objects %d are different.\n", i );
1761 return 0;
1762 }
1763 }
1764 }
1765 return 1;
1766}
void Gia_ManCleanValue(Gia_Man_t *p)
Definition giaUtil.c:351
int memcmp()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManComputeDistance()

Vec_Int_t * Gia_ManComputeDistance ( Gia_Man_t * p,
int iObj,
Vec_Int_t * vObjs,
int fVerbose )
extern

Definition at line 2508 of file giaUtil.c.

2509{
2510 Vec_Int_t * vDists;
2511 if ( p->vFanoutNums )
2512 vDists = Gia_ManComputeDistanceInt( p, iObj, vObjs, fVerbose );
2513 else
2514 {
2516 vDists = Gia_ManComputeDistanceInt( p, iObj, vObjs, fVerbose );
2518 }
2519 return vDists;
2520}
Vec_Int_t * Gia_ManComputeDistanceInt(Gia_Man_t *p, int iTarg, Vec_Int_t *vObjs, int fVerbose)
Definition giaUtil.c:2471
void Gia_ManStaticFanoutStop(Gia_Man_t *p)
Definition giaFanout.c:393
Here is the call graph for this function:

◆ Gia_ManComputeEdgeDelay()

int Gia_ManComputeEdgeDelay ( Gia_Man_t * p,
int fUseTwo )
extern

Definition at line 390 of file giaEdge.c.

391{
392 int k, iLut, DelayMax = 0;
393 Vec_IntFreeP( &p->vEdgeDelay );
394 Vec_IntFreeP( &p->vEdge1 );
395 Vec_IntFreeP( &p->vEdge2 );
396 p->vEdge1 = Vec_IntStart( Gia_ManObjNum(p) );
397 p->vEdge2 = Vec_IntStart( Gia_ManObjNum(p) );
398 p->vEdgeDelay = Vec_IntStart( Gia_ManObjNum(p) );
399 if ( Gia_ManHasMapping(p) )
400 {
401 if ( p->pManTime != NULL && Tim_ManBoxNum((Tim_Man_t*)p->pManTime) )
402 {
403 Gia_Obj_t * pObj;
404 Vec_Int_t * vNodes = Gia_ManOrderWithBoxes( p );
405 Tim_ManIncrementTravId( (Tim_Man_t*)p->pManTime );
406 Gia_ManForEachObjVec( vNodes, p, pObj, k )
407 {
408 iLut = Gia_ObjId( p, pObj );
409 if ( Gia_ObjIsAnd(pObj) )
410 {
411 if ( Gia_ObjIsLut(p, iLut) )
412 Gia_ObjComputeEdgeDelay( p, iLut, p->vEdgeDelay, p->vEdge1, p->vEdge2, fUseTwo );
413 }
414 else if ( Gia_ObjIsCi(pObj) )
415 {
416 int arrTime = Tim_ManGetCiArrival( (Tim_Man_t*)p->pManTime, Gia_ObjCioId(pObj) );
417 Vec_IntWriteEntry( p->vEdgeDelay, iLut, arrTime );
418 }
419 else if ( Gia_ObjIsCo(pObj) )
420 {
421 int arrTime = Vec_IntEntry( p->vEdgeDelay, Gia_ObjFaninId0(pObj, iLut) );
422 Tim_ManSetCoArrival( (Tim_Man_t*)p->pManTime, Gia_ObjCioId(pObj), arrTime );
423 }
424 else if ( !Gia_ObjIsConst0(pObj) )
425 assert( 0 );
426 }
427 Vec_IntFree( vNodes );
428 }
429 else
430 {
431 Gia_ManForEachLut( p, iLut )
432 Gia_ObjComputeEdgeDelay( p, iLut, p->vEdgeDelay, p->vEdge1, p->vEdge2, fUseTwo );
433 }
434 }
435 else if ( Gia_ManHasMapping2(p) )
436 {
437 if ( p->pManTime != NULL && Tim_ManBoxNum((Tim_Man_t*)p->pManTime) )
438 {
439 Gia_Obj_t * pObj;
440 Vec_Int_t * vNodes = Gia_ManOrderWithBoxes( p );
441 Tim_ManIncrementTravId( (Tim_Man_t*)p->pManTime );
442 Gia_ManForEachObjVec( vNodes, p, pObj, k )
443 {
444 iLut = Gia_ObjId( p, pObj );
445 if ( Gia_ObjIsAnd(pObj) )
446 {
447 if ( Gia_ObjIsLut2(p, iLut) )
448 Gia_ObjComputeEdgeDelay( p, iLut, p->vEdgeDelay, p->vEdge1, p->vEdge2, fUseTwo );
449 }
450 else if ( Gia_ObjIsCi(pObj) )
451 {
452 int arrTime = Tim_ManGetCiArrival( (Tim_Man_t*)p->pManTime, Gia_ObjCioId(pObj) );
453 Vec_IntWriteEntry( p->vEdgeDelay, iLut, arrTime );
454 }
455 else if ( Gia_ObjIsCo(pObj) )
456 {
457 int arrTime = Vec_IntEntry( p->vEdgeDelay, Gia_ObjFaninId0(pObj, iLut) );
458 Tim_ManSetCoArrival( (Tim_Man_t*)p->pManTime, Gia_ObjCioId(pObj), arrTime );
459 }
460 else if ( !Gia_ObjIsConst0(pObj) )
461 assert( 0 );
462 }
463 Vec_IntFree( vNodes );
464 }
465 else
466 {
467 Gia_ManForEachLut2( p, iLut )
468 Gia_ObjComputeEdgeDelay( p, iLut, p->vEdgeDelay, p->vEdge1, p->vEdge2, fUseTwo );
469 }
470 }
471 else assert( 0 );
472 Gia_ManForEachCoDriverId( p, iLut, k )
473 DelayMax = Abc_MaxInt( DelayMax, Vec_IntEntry(p->vEdgeDelay, iLut) );
474 //printf( "The number of edges = %d. Delay = %d.\n", Gia_ManEvalEdgeCount(p), DelayMax );
475 return DelayMax;
476}
int Gia_ObjComputeEdgeDelay(Gia_Man_t *p, int iObj, Vec_Int_t *vDelay, Vec_Int_t *vEdge1, Vec_Int_t *vEdge2, int fUseTwo)
Definition giaEdge.c:301
#define Gia_ManForEachLut2(p, i)
Definition gia.h:1168
#define Gia_ManForEachCoDriverId(p, DriverId, i)
Definition gia.h:1246
#define Gia_ManForEachLut(p, i)
Definition gia.h:1157
Vec_Int_t * Gia_ManOrderWithBoxes(Gia_Man_t *p)
Definition giaTim.c:286
void Tim_ManSetCoArrival(Tim_Man_t *p, int iCo, float Delay)
Definition timTime.c:116
void Tim_ManIncrementTravId(Tim_Man_t *p)
DECLARATIONS ///.
Definition timTrav.c:44
float Tim_ManGetCiArrival(Tim_Man_t *p, int iCi)
Definition timTime.c:174
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManComputeEdgeDelay2()

int Gia_ManComputeEdgeDelay2 ( Gia_Man_t * p)
extern

Definition at line 568 of file giaEdge.c.

569{
570 int k, iLut, DelayMax = 0;
571 Vec_Int_t * vFanMax1 = Vec_IntStart( Gia_ManObjNum(p) );
572 Vec_Int_t * vFanMax2 = Vec_IntStart( Gia_ManObjNum(p) );
573 Vec_Int_t * vCountMax = Vec_IntStart( Gia_ManObjNum(p) );
574 assert( p->pManTime == NULL );
575 Vec_IntFreeP( &p->vEdgeDelay );
576 Vec_IntFreeP( &p->vEdge1 );
577 Vec_IntFreeP( &p->vEdge2 );
578 p->vEdgeDelay = Vec_IntStart( Gia_ManObjNum(p) );
579 p->vEdge1 = Vec_IntStart( Gia_ManObjNum(p) );
580 p->vEdge2 = Vec_IntStart( Gia_ManObjNum(p) );
581// Gia_ManForEachCoDriverId( p, iLut, k )
582// Vec_IntWriteEntry( p->vEdgeDelay, iLut, 1 );
583 if ( Gia_ManHasMapping(p) )
585 Gia_ObjComputeEdgeDelay2( p, iLut, p->vEdgeDelay, p->vEdge1, p->vEdge2, vFanMax1, vFanMax2, vCountMax );
586 else if ( Gia_ManHasMapping2(p) )
588 Gia_ObjComputeEdgeDelay2( p, iLut, p->vEdgeDelay, p->vEdge1, p->vEdge2, vFanMax1, vFanMax2, vCountMax );
589 else assert( 0 );
590 Gia_ManForEachCiId( p, iLut, k )
591 DelayMax = Abc_MaxInt( DelayMax, Vec_IntEntry(p->vEdgeDelay, iLut) );
592 Vec_IntFree( vFanMax1 );
593 Vec_IntFree( vFanMax2 );
594 Vec_IntFree( vCountMax );
595 //printf( "The number of edges = %d. Delay = %d.\n", Gia_ManEvalEdgeCount(p), DelayMax );
596 return DelayMax;
597}
int Gia_ObjComputeEdgeDelay2(Gia_Man_t *p, int iObj, Vec_Int_t *vDelay, Vec_Int_t *vEdge1, Vec_Int_t *vEdge2, Vec_Int_t *vFanMax1, Vec_Int_t *vFanMax2, Vec_Int_t *vCountMax)
Definition giaEdge.c:489
#define Gia_ManForEachLut2Reverse(p, i)
Definition gia.h:1170
#define Gia_ManForEachLutReverse(p, i)
Definition gia.h:1159
Here is the call graph for this function:

◆ Gia_ManComputeGiaEquivs()

Gia_Man_t * Gia_ManComputeGiaEquivs ( Gia_Man_t * pGia,
int nConfs,
int fVerbose )
extern

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

Synopsis [Compute equivalence classes of nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 183 of file giaEquiv.c.

184{
185 Gia_Man_t * pTemp;
186 Cec_ParFra_t ParsFra, * pPars = &ParsFra;
188 pPars->nItersMax = 100;
189 pPars->fUseOrigIds = 1;
190 pPars->fSatSweeping = 1;
191 pPars->nBTLimit = nConfs;
192 pPars->fVerbose = fVerbose;
193 pTemp = Cec_ManSatSweeping( pGia, pPars, 0 );
194 Gia_ManStop( pTemp );
195 return Gia_ManOrigIdsReduce( pGia, pGia->vIdsEquiv );
196}
struct Cec_ParFra_t_ Cec_ParFra_t
Definition cec.h:96
void Cec_ManFraSetDefaultParams(Cec_ParFra_t *p)
Definition cecCore.c:126
Gia_Man_t * Cec_ManSatSweeping(Gia_Man_t *pAig, Cec_ParFra_t *pPars, int fSilent)
Definition cecCore.c:344
Gia_Man_t * Gia_ManOrigIdsReduce(Gia_Man_t *p, Vec_Int_t *vPairs)
Definition giaEquiv.c:106
int nBTLimit
Definition cec.h:103
int nItersMax
Definition cec.h:102
int fVerbose
Definition cec.h:121
int fSatSweeping
Definition cec.h:116
int fUseOrigIds
Definition cec.h:119
Vec_Int_t * vIdsEquiv
Definition gia.h:190
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManComputeOneWin()

int Gia_ManComputeOneWin ( Gia_Man_t * pGia,
int iPivot,
Vec_Int_t ** pvRoots,
Vec_Int_t ** pvNodes,
Vec_Int_t ** pvLeaves,
Vec_Int_t ** pvAnds )
extern

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

Synopsis [External procedures.]

Description []

SideEffects []

SeeAlso []

Definition at line 516 of file giaSplit.c.

517{
518 Spl_Man_t * p = (Spl_Man_t *)pGia->pSatlutWinman;
519 assert( p != NULL );
520 if ( iPivot == -1 )
521 {
522 Spl_ManStop( p );
523 pGia->pSatlutWinman = NULL;
524 return 0;
525 }
526 if ( !Spl_ManComputeOne( p, iPivot ) )
527 {
528 *pvRoots = NULL;
529 *pvNodes = NULL;
530 *pvLeaves = NULL;
531 *pvAnds = NULL;
532 return 0;
533 }
534 *pvRoots = p->vRoots;
535 *pvNodes = p->vNodes;
536 *pvLeaves = p->vLeaves;
537 *pvAnds = p->vAnds;
538 // Vec_IntPrint( p->vNodes );
539 return Vec_IntSize(p->vAnds);
540}
typedefABC_NAMESPACE_IMPL_START struct Spl_Man_t_ Spl_Man_t
DECLARATIONS ///.
Definition giaSplit.c:31
int Spl_ManComputeOne(Spl_Man_t *p, int iPivot)
Definition giaSplit.c:461
void Spl_ManStop(Spl_Man_t *p)
Definition giaSplit.c:148
void * pSatlutWinman
Definition gia.h:140
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManComputeOneWinStart()

void Gia_ManComputeOneWinStart ( Gia_Man_t * p,
int nAnds,
int fReverse )
extern

Definition at line 541 of file giaSplit.c.

542{
543 assert( pGia->pSatlutWinman == NULL );
544 pGia->pSatlutWinman = Spl_ManAlloc( pGia, nAnds, fReverse );
545}
Spl_Man_t * Spl_ManAlloc(Gia_Man_t *pGia, int Limit, int fReverse)
Definition giaSplit.c:110
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManComputeRange()

Vec_Str_t * Gia_ManComputeRange ( Gia_Man_t * p)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 3685 of file giaSimBase.c.

3686{
3687 Vec_Wrd_t * vSimsPi = Vec_WrdStartTruthTables( Gia_ManCiNum(p) );
3688 Vec_Wrd_t * vSims = Gia_ManSimPatSimOut( p, vSimsPi, 1 );
3689 int n, nWords = Vec_WrdSize(vSimsPi) / Gia_ManCiNum(p);
3690 int i, nLimit = Gia_ManCiNum(p) < 6 ? 1 << Gia_ManCiNum(p) : 64*nWords;
3691 Vec_Str_t * vOut = Vec_StrAlloc( nLimit*(Gia_ManCoNum(p) + 3)+1 );
3692 assert( Vec_WrdSize(vSims) == nWords * Gia_ManCoNum(p) );
3693 for ( n = 0; n < nLimit; n++ )
3694 {
3695 for ( i = 0; i < Gia_ManCoNum(p); i++ )
3696 Vec_StrPush( vOut, (char)('0' + Abc_TtGetBit(Vec_WrdEntryP(vSims, i*nWords), n)) );
3697 Vec_StrPush( vOut, ' ' );
3698 Vec_StrPush( vOut, '1' );
3699 Vec_StrPush( vOut, '\n' );
3700 }
3701 Vec_StrPush( vOut, '\0' );
3702 Vec_WrdFree( vSims );
3703 Vec_WrdFree( vSimsPi );
3704 return vOut;
3705}
Vec_Wrd_t * Gia_ManSimPatSimOut(Gia_Man_t *pGia, Vec_Wrd_t *vSimsPi, int fOuts)
Definition giaSimBase.c:138
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManComputeSwitching()

float Gia_ManComputeSwitching ( Gia_Man_t * p,
int nFrames,
int nPref,
int fProbOne )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 808 of file giaSwitch.c.

809{
810 Vec_Int_t * vSwitching = Gia_ManComputeSwitchProbs( p, nFrames, nPref, fProbOne );
811 float * pSwi = (float *)Vec_IntArray(vSwitching), SwiTotal = 0;
812 Gia_Obj_t * pObj;
813 int i, k, iFan;
814 if ( Gia_ManHasMapping(p) )
815 {
816 Gia_ManForEachLut( p, i )
817 Gia_LutForEachFanin( p, i, iFan, k )
818 SwiTotal += pSwi[iFan];
819 }
820 else
821 {
822 Gia_ManForEachAnd( p, pObj, i )
823 SwiTotal += pSwi[Gia_ObjFaninId0(pObj, i)] + pSwi[Gia_ObjFaninId1(pObj, i)];
824 }
825 if ( 0 )
826 {
827 Gia_ManForEachObj( p, pObj, i )
828 {
829 printf( "Switch %6.2f ", pSwi[i] );
830 Gia_ObjPrint( p, pObj );
831 }
832 }
833 Vec_IntFree( vSwitching );
834 return SwiTotal;
835}
Vec_Int_t * Gia_ManComputeSwitchProbs(Gia_Man_t *pGia, int nFrames, int nPref, int fProbOne)
Definition giaSwitch.c:658
void Gia_ObjPrint(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaUtil.c:1456
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManComputeSwitchProbs()

Vec_Int_t * Gia_ManComputeSwitchProbs ( Gia_Man_t * pGia,
int nFrames,
int nPref,
int fProbOne )
extern

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
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}
ABC_DLL char * Abc_FrameReadFlag(char *pFlag)
Definition mainFrame.c:69
void Gia_ManSetDefaultParamsSwi(Gia_ParSwi_t *p)
FUNCTION DEFINITIONS ///.
Definition giaSwitch.c:77
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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManComputeSwitchProbs2()

Vec_Int_t * Gia_ManComputeSwitchProbs2 ( Gia_Man_t * pGia,
int nFrames,
int nPref,
int fProbOne,
int nRandPiFactor )
extern

Definition at line 684 of file giaSwitch.c.

685{
686 Gia_ParSwi_t Pars, * pPars = &Pars;
687 // set the default parameters
689 pPars->nRandPiFactor = nRandPiFactor;
690 // override some of the defaults
691 pPars->nIters = nFrames; // set number of total timeframes
692 if ( Abc_FrameReadFlag("seqsimframes") )
693 pPars->nIters = atoi( Abc_FrameReadFlag("seqsimframes") );
694 pPars->nPref = nPref; // set number of first timeframes to skip
695 // decide what should be computed
696 if ( fProbOne )
697 {
698 // if the user asked to compute propability of 1, we do not need transition information
699 pPars->fProbOne = 1; // enable computing probabiblity of being one
700 pPars->fProbTrans = 0; // disable computing transition probability
701 }
702 else
703 {
704 // if the user asked for transition propabability, we do not need to compute probability of 1
705 pPars->fProbOne = 0; // disable computing probabiblity of being one
706 pPars->fProbTrans = 1; // enable computing transition probability
707 }
708 // perform the computation of switching activity
709 return Gia_ManSwiSimulate( pGia, pPars );
710}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManConeSize()

int Gia_ManConeSize ( Gia_Man_t * p,
int * pNodes,
int nNodes )
extern

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

Synopsis [Collects support nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 375 of file giaDfs.c.

376{
377 Gia_Obj_t * pObj;
378 int i, Counter = 0;
380 Gia_ObjSetTravIdCurrent( p, Gia_ManConst0(p) );
381 for ( i = 0; i < nNodes; i++ )
382 {
383 pObj = Gia_ManObj( p, pNodes[i] );
384 if ( Gia_ObjIsCo(pObj) )
385 Counter += Gia_ManConeSize_rec( p, Gia_ObjFanin0(pObj) );
386 else
387 Counter += Gia_ManConeSize_rec( p, pObj );
388 }
389 return Counter;
390}
int Gia_ManConeSize_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaDfs.c:352
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManConvertAigToTruth()

unsigned * Gia_ManConvertAigToTruth ( Gia_Man_t * p,
Gia_Obj_t * pRoot,
Vec_Int_t * vLeaves,
Vec_Int_t * vTruth,
Vec_Int_t * vVisited )
extern

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}
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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManConvertPackingToEdges()

void Gia_ManConvertPackingToEdges ( Gia_Man_t * p)
extern

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

Synopsis [Prints mapping statistics.]

Description []

SideEffects []

SeeAlso []

Definition at line 118 of file giaEdge.c.

119{
120 int i, k, Entry, nEntries, nEntries2, nNodes[4], Count = 0;
121 if ( p->vPacking == NULL )
122 return;
123 Vec_IntFreeP( &p->vEdge1 );
124 Vec_IntFreeP( &p->vEdge2 );
125 p->vEdge1 = Vec_IntStart( Gia_ManObjNum(p) );
126 p->vEdge2 = Vec_IntStart( Gia_ManObjNum(p) );
127 // iterate through structures
128 nEntries = Vec_IntEntry( p->vPacking, 0 );
129 nEntries2 = 0;
130 Vec_IntForEachEntryStart( p->vPacking, Entry, i, 1 )
131 {
132 assert( Entry > 0 && Entry < 4 );
133 i++;
134 for ( k = 0; k < Entry; k++, i++ )
135 nNodes[k] = Vec_IntEntry(p->vPacking, i);
136 i--;
137 nEntries2++;
138 // create edges
139 if ( Entry == 2 )
140 {
141 Count += Gia_ObjEdgeAdd( nNodes[0], nNodes[1], p->vEdge1, p->vEdge2 );
142 Count += Gia_ObjEdgeAdd( nNodes[1], nNodes[0], p->vEdge1, p->vEdge2 );
143 }
144 else if ( Entry == 3 )
145 {
146 Count += Gia_ObjEdgeAdd( nNodes[0], nNodes[2], p->vEdge1, p->vEdge2 );
147 Count += Gia_ObjEdgeAdd( nNodes[2], nNodes[0], p->vEdge1, p->vEdge2 );
148 Count += Gia_ObjEdgeAdd( nNodes[1], nNodes[2], p->vEdge1, p->vEdge2 );
149 Count += Gia_ObjEdgeAdd( nNodes[2], nNodes[1], p->vEdge1, p->vEdge2 );
150 }
151 }
152 assert( nEntries == nEntries2 );
153 if ( Count )
154 printf( "Skipped %d illegal edges.\n", Count );
155}
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
Definition vecInt.h:56
Here is the caller graph for this function:

◆ Gia_ManCountChoiceNodes()

int Gia_ManCountChoiceNodes ( Gia_Man_t * p)
extern

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

Synopsis [Counts the number of choice nodes]

Description []

SideEffects []

SeeAlso []

Definition at line 2091 of file giaEquiv.c.

2092{
2093 Gia_Obj_t * pObj;
2094 int i, Counter = 0;
2095 if ( p->pReprs == NULL || p->pNexts == NULL )
2096 return 0;
2097 Gia_ManForEachObj( p, pObj, i )
2098 Counter += Gia_ObjIsHead( p, i );
2099 return Counter;
2100}

◆ Gia_ManCountChoices()

int Gia_ManCountChoices ( Gia_Man_t * p)
extern

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

Synopsis [Counts the number of choices]

Description []

SideEffects []

SeeAlso []

Definition at line 2113 of file giaEquiv.c.

2114{
2115 Gia_Obj_t * pObj;
2116 int i, Counter = 0;
2117 if ( p->pReprs == NULL || p->pNexts == NULL )
2118 return 0;
2119 Gia_ManForEachObj( p, pObj, i )
2120 Counter += (int)(Gia_ObjNext( p, i ) > 0);
2121 return Counter;
2122}

◆ Gia_ManCounterExampleValueLookup()

int Gia_ManCounterExampleValueLookup ( Gia_Man_t * pGia,
int Id,
int iFrame )
extern

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 266 of file giaCex.c.

267{
268 assert( Id >= 0 && Id < Gia_ManObjNum(pGia) );
269 return Abc_InfoHasBit( (unsigned *)pGia->pData2, Gia_ManObjNum(pGia) * iFrame + Id );
270}
unsigned * pData2
Definition gia.h:199
Here is the caller graph for this function:

◆ Gia_ManCounterExampleValueStart()

void Gia_ManCounterExampleValueStart ( Gia_Man_t * pGia,
Abc_Cex_t * pCex )
extern

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 188 of file giaCex.c.

189{
190 Gia_Obj_t * pObj, * pObjRi, * pObjRo;
191 int Val0, Val1, nObjs, i, k, iBit = 0;
192 assert( Gia_ManRegNum(pGia) > 0 ); // makes sense only for sequential AIGs
193 assert( pGia->pData2 == NULL ); // if this fail, there may be a memory leak
194 // allocate memory to store simulation bits for internal nodes
195 pGia->pData2 = ABC_CALLOC( unsigned, Abc_BitWordNum( (pCex->iFrame + 1) * Gia_ManObjNum(pGia) ) );
196 // the register values in the counter-example should be zero
197 Gia_ManForEachRo( pGia, pObj, k )
198 assert( Abc_InfoHasBit(pCex->pData, iBit) == 0 ), iBit++;
199 // iterate through the timeframes
200 nObjs = Gia_ManObjNum(pGia);
201 for ( i = 0; i <= pCex->iFrame; i++ )
202 {
203 // no need to set constant-0 node
204 // set primary inputs according to the counter-example
205 Gia_ManForEachPi( pGia, pObj, k )
206 if ( Abc_InfoHasBit(pCex->pData, iBit++) )
207 Abc_InfoSetBit( (unsigned *)pGia->pData2, nObjs * i + Gia_ObjId(pGia, pObj) );
208 // compute values for each node
209 Gia_ManForEachAnd( pGia, pObj, k )
210 {
211 Val0 = Abc_InfoHasBit( (unsigned *)pGia->pData2, nObjs * i + Gia_ObjFaninId0p(pGia, pObj) );
212 Val1 = Abc_InfoHasBit( (unsigned *)pGia->pData2, nObjs * i + Gia_ObjFaninId1p(pGia, pObj) );
213 if ( (Val0 ^ Gia_ObjFaninC0(pObj)) & (Val1 ^ Gia_ObjFaninC1(pObj)) )
214 Abc_InfoSetBit( (unsigned *)pGia->pData2, nObjs * i + Gia_ObjId(pGia, pObj) );
215 }
216 // derive values for combinational outputs
217 Gia_ManForEachCo( pGia, pObj, k )
218 {
219 Val0 = Abc_InfoHasBit( (unsigned *)pGia->pData2, nObjs * i + Gia_ObjFaninId0p(pGia, pObj) );
220 if ( Val0 ^ Gia_ObjFaninC0(pObj) )
221 Abc_InfoSetBit( (unsigned *)pGia->pData2, nObjs * i + Gia_ObjId(pGia, pObj) );
222 }
223 if ( i == pCex->iFrame )
224 continue;
225 // transfer values to the register output of the next frame
226 Gia_ManForEachRiRo( pGia, pObjRi, pObjRo, k )
227 if ( Abc_InfoHasBit( (unsigned *)pGia->pData2, nObjs * i + Gia_ObjId(pGia, pObjRi) ) )
228 Abc_InfoSetBit( (unsigned *)pGia->pData2, nObjs * (i+1) + Gia_ObjId(pGia, pObjRo) );
229 }
230 assert( iBit == pCex->nBits );
231 // check that the counter-example is correct, that is, the corresponding output is asserted
232 assert( Abc_InfoHasBit( (unsigned *)pGia->pData2, nObjs * pCex->iFrame + Gia_ObjId(pGia, Gia_ManCo(pGia, pCex->iPo)) ) );
233}
Here is the caller graph for this function:

◆ Gia_ManCounterExampleValueStop()

void Gia_ManCounterExampleValueStop ( Gia_Man_t * pGia)
extern

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 246 of file giaCex.c.

247{
248 assert( pGia->pData2 != NULL ); // if this fail, we try to call this procedure more than once
249 ABC_FREE( pGia->pData2 );
250 pGia->pData2 = NULL;
251}
Here is the caller graph for this function:

◆ Gia_ManCountFraction()

word * Gia_ManCountFraction ( Gia_Man_t * p,
Vec_Wrd_t * vSimI,
Vec_Int_t * vSupp,
int Thresh,
int fVerbose,
int * pCare )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 531 of file giaMinLut.c.

532{
533 Gia_Obj_t * pObj;
534 int i, k, nUsed = 0, nGood = 0;
535 int nWords = Vec_WrdSize(vSimI) / Gia_ManCiNum(p);
536 int nMints = 1 << Vec_IntSize(vSupp);
537 word ** pSims = ABC_ALLOC( word *, Vec_IntSize(vSupp) );
538 word * pRes = ABC_CALLOC( word, Abc_Truth6WordNum(Vec_IntSize(vSupp)) );
539 int * pCounts = ABC_CALLOC( int, nMints );
540 Gia_ManForEachObjVec( vSupp, p, pObj, i )
541 pSims[i] = Vec_WrdEntryP( vSimI, Gia_ObjCioId(pObj) * nWords );
542 for ( k = 0; k < 64*nWords; k++ )
543 {
544 int iMint = 0;
545 for ( i = 0; i < Vec_IntSize(vSupp); i++ )
546 if ( Abc_TtGetBit(pSims[i], k) )
547 iMint |= 1 << i;
548 assert( iMint < nMints );
549 pCounts[iMint]++;
550 }
551 for ( k = 0; k < nMints; k++ )
552 {
553 nUsed += (pCounts[k] > 0);
554 nGood += (pCounts[k] >= Thresh);
555 if ( pCounts[k] >= Thresh )
556 Abc_TtXorBit( pRes, k );
557 //printf( "%d ", pCounts[k] );
558 }
559 if ( Vec_IntSize(vSupp) < 6 )
560 pRes[0] = Abc_Tt6Stretch( pRes[0], Vec_IntSize(vSupp) );
561 //printf( "\n" );
562 if ( fVerbose )
563 printf( "Used %4d and good %4d (out of %4d).\n", nUsed, nGood, nMints );
564 ABC_FREE( pSims );
565 ABC_FREE( pCounts );
566 *pCare = nGood;
567 return pRes;
568}
int nGood
Definition abcCut.c:34
Here is the caller graph for this function:

◆ Gia_ManCountMuxXor()

void Gia_ManCountMuxXor ( Gia_Man_t * p,
int * pnMuxes,
int * pnXors )
extern

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 49 of file giaMuxes.c.

50{
51 Gia_Obj_t * pObj, * pFan0, * pFan1; int i;
52 *pnMuxes = *pnXors = 0;
53 Gia_ManForEachAnd( p, pObj, i )
54 {
55 if ( !Gia_ObjIsMuxType(pObj) )
56 continue;
57 if ( Gia_ObjRecognizeExor(pObj, &pFan0, &pFan1) )
58 (*pnXors)++;
59 else
60 (*pnMuxes)++;
61 }
62}
int Gia_ObjIsMuxType(Gia_Obj_t *pNode)
Definition giaUtil.c:982
int Gia_ObjRecognizeExor(Gia_Obj_t *pObj, Gia_Obj_t **ppFan0, Gia_Obj_t **ppFan1)
Definition giaUtil.c:1018
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManCountPisWithFanout()

int Gia_ManCountPisWithFanout ( Gia_Man_t * p)
extern

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

Synopsis [Count PIs with fanout.]

Description []

SideEffects []

SeeAlso []

Definition at line 2301 of file giaUtil.c.

2302{
2303 Gia_Obj_t * pObj;
2304 int i, Count = 0;
2305 Gia_ManForEachCi( p, pObj, i )
2306 pObj->fMark0 = 0;
2307 Gia_ManForEachAnd( p, pObj, i )
2308 {
2309 Gia_ObjFanin0(pObj)->fMark0 = 1;
2310 Gia_ObjFanin1(pObj)->fMark0 = 1;
2311 }
2312 Gia_ManForEachCo( p, pObj, i )
2313 Gia_ObjFanin0(pObj)->fMark0 = 1;
2314 Gia_ManForEachCi( p, pObj, i )
2315 Count += pObj->fMark0;
2316 Gia_ManForEachObj( p, pObj, i )
2317 pObj->fMark0 = 0;
2318 return Count;
2319}

◆ Gia_ManCountPosWithNonZeroDrivers()

int Gia_ManCountPosWithNonZeroDrivers ( Gia_Man_t * p)
extern

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

Synopsis [Count POs driven by non-zero driver.]

Description []

SideEffects []

SeeAlso []

Definition at line 2332 of file giaUtil.c.

2333{
2334 Gia_Obj_t * pObj;
2335 int i, Count = 0;
2336 Gia_ManForEachCo( p, pObj, i )
2337 Count += Gia_ObjFaninLit0(pObj, Gia_ObjId(p, pObj)) != 0;
2338 return Count;
2339}

◆ Gia_ManCreateLitRefs()

void Gia_ManCreateLitRefs ( Gia_Man_t * p)
extern

Definition at line 799 of file giaUtil.c.

800{
801 Gia_Obj_t * pObj;
802 int i;
803 assert( p->pRefs == NULL );
804 p->pRefs = ABC_CALLOC( int, 2*Gia_ManObjNum(p) );
805 Gia_ManForEachObj( p, pObj, i )
806 {
807 if ( Gia_ObjIsAnd(pObj) )
808 {
809 p->pRefs[Gia_ObjFaninLit0(pObj, i)]++;
810 p->pRefs[Gia_ObjFaninLit1(pObj, i)]++;
811 }
812 else if ( Gia_ObjIsCo(pObj) )
813 p->pRefs[Gia_ObjFaninLit0(pObj, i)]++;
814 }
815}

◆ Gia_ManCreateMuxRefs()

int * Gia_ManCreateMuxRefs ( Gia_Man_t * p)
extern

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

Synopsis [Assigns references.]

Description []

SideEffects []

SeeAlso []

Definition at line 828 of file giaUtil.c.

829{
830 Gia_Obj_t * pObj, * pCtrl, * pFan0, * pFan1;
831 int i, * pMuxRefs;
832 pMuxRefs = ABC_CALLOC( int, Gia_ManObjNum(p) );
833 Gia_ManForEachObj( p, pObj, i )
834 {
835 if ( Gia_ObjRecognizeExor( pObj, &pFan0, &pFan1 ) )
836 continue;
837 if ( !Gia_ObjIsMuxType(pObj) )
838 continue;
839 pCtrl = Gia_ObjRecognizeMux( pObj, &pFan0, &pFan1 );
840 pMuxRefs[ Gia_ObjId(p, Gia_Regular(pCtrl)) ]++;
841 }
842 return pMuxRefs;
843}
Gia_Obj_t * Gia_ObjRecognizeMux(Gia_Obj_t *pNode, Gia_Obj_t **ppNodeT, Gia_Obj_t **ppNodeE)
Definition giaUtil.c:1056
int Gia_ObjIsMuxType(Gia_Obj_t *pNode)
Definition giaUtil.c:982
int Gia_ObjRecognizeExor(Gia_Obj_t *pObj, Gia_Obj_t **ppFan0, Gia_Obj_t **ppFan1)
Definition giaUtil.c:1018
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManCreateRefs()

void Gia_ManCreateRefs ( Gia_Man_t * p)
extern

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

Synopsis [Assigns references.]

Description []

SideEffects []

SeeAlso []

Definition at line 779 of file giaUtil.c.

780{
781 Gia_Obj_t * pObj;
782 int i;
783 assert( p->pRefs == NULL );
784 p->pRefs = ABC_CALLOC( int, Gia_ManObjNum(p) );
785 Gia_ManForEachObj( p, pObj, i )
786 {
787 if ( Gia_ObjIsAnd(pObj) )
788 {
789 Gia_ObjRefFanin0Inc( p, pObj );
790 if ( !Gia_ObjIsBuf(pObj) )
791 Gia_ObjRefFanin1Inc( p, pObj );
792 if ( Gia_ObjIsMuxId(p, i) )
793 Gia_ObjRefFanin2Inc( p, pObj );
794 }
795 else if ( Gia_ObjIsCo(pObj) )
796 Gia_ObjRefFanin0Inc( p, pObj );
797 }
798}

◆ Gia_ManCreateValueRefs()

void Gia_ManCreateValueRefs ( Gia_Man_t * p)
extern

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

Synopsis [Assigns levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 750 of file giaUtil.c.

751{
752 Gia_Obj_t * pObj;
753 int i;
754 Gia_ManForEachObj( p, pObj, i )
755 {
756 pObj->Value = 0;
757 if ( Gia_ObjIsAnd(pObj) )
758 {
759 Gia_ObjFanin0(pObj)->Value++;
760 if ( !Gia_ObjIsBuf(pObj) )
761 Gia_ObjFanin1(pObj)->Value++;
762 }
763 else if ( Gia_ObjIsCo(pObj) )
764 Gia_ObjFanin0(pObj)->Value++;
765 }
766}
Here is the caller graph for this function:

◆ Gia_ManCrossCut()

int Gia_ManCrossCut ( Gia_Man_t * p,
int fReverse )
extern

Definition at line 916 of file giaUtil.c.

917{
918 Vec_Int_t * vNodes;
919 Gia_Obj_t * pObj;
920 int i, nCutCur = 0, nCutMax = 0;
921 vNodes = Gia_ManDfsForCrossCut( p, fReverse );
922 //vNodes = Gia_ManBfsForCrossCut( p );
923 Gia_ManForEachObjVec( vNodes, p, pObj, i )
924 {
925 if ( pObj->Value )
926 nCutCur++;
927 if ( nCutMax < nCutCur )
928 nCutMax = nCutCur;
929 if ( Gia_ObjIsAnd(pObj) )
930 {
931 if ( --Gia_ObjFanin0(pObj)->Value == 0 )
932 nCutCur--;
933 if ( --Gia_ObjFanin1(pObj)->Value == 0 )
934 nCutCur--;
935 }
936 else if ( Gia_ObjIsCo(pObj) )
937 {
938 if ( --Gia_ObjFanin0(pObj)->Value == 0 )
939 nCutCur--;
940 }
941 }
942 Vec_IntFree( vNodes );
943 Gia_ManForEachObj( p, pObj, i )
944 assert( pObj->Value == 0 );
945 return nCutMax;
946}
Vec_Int_t * Gia_ManDfsForCrossCut(Gia_Man_t *p, int fReverse)
Definition giaUtil.c:894
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDelayTraceLut()

float Gia_ManDelayTraceLut ( Gia_Man_t * p)
extern

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 );
250
251 // propagate arrival times
252 if ( p->pManTime )
253 Tim_ManIncrementTravId( (Tim_Man_t *)p->pManTime );
254 Gia_ManForEachObj( p, pObj, i )
255 {
256 if ( !Gia_ObjIsCi(pObj) && !Gia_ObjIsCo(pObj) && !Gia_ObjIsLut(p, i) )
257 continue;
258 tArrival = Gia_ObjComputeArrival( p, i, fUseSorting );
259 if ( Gia_ObjIsCi(pObj) && p->pManTime )
260 {
261 tArrival = Tim_ManGetCiArrival( (Tim_Man_t *)p->pManTime, Gia_ObjCioId(pObj) );
262//printf( "%.3f ", tArrival );
263 }
264 if ( Gia_ObjIsCo(pObj) && p->pManTime )
265 Tim_ManSetCoArrival( (Tim_Man_t *)p->pManTime, Gia_ObjCioId(pObj), tArrival );
266 Gia_ObjSetTimeArrival( p, i, tArrival );
267 }
268
269 // get the latest arrival times
270 tArrival = -TIM_ETERNITY;
271 Gia_ManForEachCo( p, pObj, i )
272 {
273 tArrivalCur = Gia_ObjTimeArrivalObj( p, Gia_ObjFanin0(pObj) );
274 Gia_ObjSetTimeArrival( p, Gia_ObjId(p,pObj), tArrivalCur );
275 if ( tArrival < tArrivalCur )
276 tArrival = tArrivalCur;
277 }
278
279 // initialize the required times
280 if ( p->pManTime )
281 {
282 Tim_ManIncrementTravId( (Tim_Man_t *)p->pManTime );
283 Tim_ManInitPoRequiredAll( (Tim_Man_t *)p->pManTime, tArrival );
284 }
285 else
286 {
287 Gia_ManForEachCo( p, pObj, i )
288 Gia_ObjSetTimeRequiredObj( p, pObj, tArrival );
289 }
290
291 // propagate the required times
292 vObjs = Gia_ManOrderReverse( p );
293 Vec_IntForEachEntry( vObjs, iObj, i )
294 {
295 pObj = Gia_ManObj(p, iObj);
296 if ( Gia_ObjIsLut(p, iObj) )
297 {
298 Gia_ObjPropagateRequired( p, iObj, fUseSorting );
299 }
300 else if ( Gia_ObjIsCi(pObj) )
301 {
302 if ( p->pManTime )
303 Tim_ManSetCiRequired( (Tim_Man_t *)p->pManTime, Gia_ObjCioId(pObj), Gia_ObjTimeRequired(p, iObj) );
304 }
305 else if ( Gia_ObjIsCo(pObj) )
306 {
307 if ( p->pManTime )
308 {
309 tRequired = Tim_ManGetCoRequired( (Tim_Man_t *)p->pManTime, Gia_ObjCioId(pObj) );
310 Gia_ObjSetTimeRequired( p, iObj, tRequired );
311 }
312 if ( Gia_ObjTimeRequired(p, Gia_ObjFaninId0p(p, pObj)) > Gia_ObjTimeRequired(p, iObj) )
313 Gia_ObjSetTimeRequired(p, Gia_ObjFaninId0p(p, pObj), Gia_ObjTimeRequired(p, iObj) );
314 }
315
316 // set slack for this object
317 tSlack = Gia_ObjTimeRequired(p, iObj) - Gia_ObjTimeArrival(p, iObj);
318 assert( tSlack + 0.01 > 0.0 );
319 Gia_ObjSetTimeSlack( p, iObj, tSlack < 0.0 ? 0.0 : tSlack );
320 }
321 Vec_IntFree( vObjs );
322 return tArrival;
323}
float Gia_ObjComputeArrival(Gia_Man_t *p, int iObj, int fUseSorting)
Definition giaSpeedup.c:110
float Gia_ObjPropagateRequired(Gia_Man_t *p, int iObj, int fUseSorting)
Definition giaSpeedup.c:170
Vec_Int_t * Gia_ManOrderReverse(Gia_Man_t *p)
Definition giaDfs.c:459
int Gia_ManLutSizeMax(Gia_Man_t *p)
Definition giaIf.c:127
int Gia_ManLevelNum(Gia_Man_t *p)
Definition giaUtil.c:546
struct If_LibLut_t_ If_LibLut_t
Definition if.h:82
void Tim_ManSetCiRequired(Tim_Man_t *p, int iCi, float Delay)
Definition timTime.c:135
void Tim_ManInitPoRequiredAll(Tim_Man_t *p, float Delay)
Definition timTime.c:97
#define TIM_ETERNITY
MACRO DEFINITIONS ///.
Definition tim.h:98
float Tim_ManGetCoRequired(Tim_Man_t *p, int iCo)
Definition timTime.c:222
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDelayTraceLutPrint()

float Gia_ManDelayTraceLutPrint ( Gia_Man_t * p,
int fVerbose )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 444 of file giaSpeedup.c.

445{
446 If_LibLut_t * pLutLib = (If_LibLut_t *)p->pLutLib;
447 int i, Nodes, * pCounters;
448 float tArrival, tDelta, nSteps, Num;
449 // get the library
450 if ( pLutLib && pLutLib->LutMax < Gia_ManLutSizeMax(p) )
451 {
452 printf( "The max LUT size (%d) is less than the max fanin count (%d).\n",
453 pLutLib->LutMax, Gia_ManLutSizeMax(p) );
454 return -ABC_INFINITY;
455 }
456 // decide how many steps
457 nSteps = pLutLib ? 20 : Gia_ManLutLevel(p, NULL);
458 pCounters = ABC_ALLOC( int, nSteps + 1 );
459 memset( pCounters, 0, sizeof(int)*(nSteps + 1) );
460 // perform delay trace
461 tArrival = Gia_ManDelayTraceLut( p );
462 tDelta = tArrival / nSteps;
463 // count how many nodes have slack in the corresponding intervals
464 Gia_ManForEachLut( p, i )
465 {
466 if ( Gia_ObjLutSize(p, i) == 0 )
467 continue;
468 Num = Gia_ObjTimeSlack(p, i) / tDelta;
469 if ( Num > nSteps )
470 continue;
471 assert( Num >=0 && Num <= nSteps );
472 pCounters[(int)Num]++;
473 }
474 // print the results
475 if ( fVerbose )
476 {
477 printf( "Max delay = %6.2f. Delay trace using %s model:\n", tArrival, pLutLib? "LUT library" : "unit-delay" );
478 Nodes = 0;
479 for ( i = 0; i < nSteps; i++ )
480 {
481 Nodes += pCounters[i];
482 printf( "%3d %s : %5d (%6.2f %%)\n", pLutLib? 5*(i+1) : i+1,
483 pLutLib? "%":"lev", Nodes, 100.0*Nodes/Gia_ManLutNum(p) );
484 }
485 }
486 ABC_FREE( pCounters );
487 Gia_ManTimeStop( p );
488 return tArrival;
489}
float Gia_ManDelayTraceLut(Gia_Man_t *p)
Definition giaSpeedup.c:230
int Gia_ManLutLevel(Gia_Man_t *p, int **ppLevels)
Definition giaIf.c:165
int Gia_ManLutNum(Gia_Man_t *p)
Definition giaIf.c:146
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDemiterDual()

int Gia_ManDemiterDual ( Gia_Man_t * p,
Gia_Man_t ** pp0,
Gia_Man_t ** pp1 )
extern

Definition at line 5030 of file giaDup.c.

5031{
5032 Gia_Obj_t * pObj;
5033 int i, fOdd;
5034 assert( Gia_ManRegNum(p) == 0 );
5035 assert( Gia_ManCoNum(p) % 2 == 0 );
5036 *pp0 = *pp1 = NULL;
5037 for ( fOdd = 0; fOdd < 2; fOdd++ )
5038 {
5039 Vec_Int_t * vNodes = Gia_ManCollectReach( p, fOdd );
5040 Gia_Man_t * pNew = Gia_ManStart( 1 + Gia_ManCiNum(p) + Vec_IntSize(vNodes) + Gia_ManCoNum(p)/2 );
5041 pNew->pName = Abc_UtilStrsav( p->pName );
5042 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
5043 Gia_ManConst0(p)->Value = 0;
5044 Gia_ManForEachPi( p, pObj, i )
5045 pObj->Value = Gia_ManAppendCi( pNew );
5046 Gia_ManForEachObjVec( vNodes, p, pObj, i )
5047 pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
5048 Gia_ManForEachCo( p, pObj, i )
5049 if ( (i & 1) == fOdd )
5050 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
5051 Vec_IntFree( vNodes );
5052 if ( fOdd )
5053 *pp1 = pNew;
5054 else
5055 *pp0 = pNew;
5056 }
5057 return 1;
5058}
Vec_Int_t * Gia_ManCollectReach(Gia_Man_t *p, int fOdd)
Definition giaDup.c:5019
Here is the call graph for this function:

◆ Gia_ManDemiterToDual()

Gia_Man_t * Gia_ManDemiterToDual ( Gia_Man_t * p)
extern

Definition at line 4956 of file giaDup.c.

4957{
4958 Gia_Man_t * pNew; Gia_Obj_t * pObj; int i;
4959 Vec_Int_t * vNodes;
4960 Vec_Int_t * vOrder = Gia_ManCollectTopXors( p );
4961 if ( vOrder == NULL )
4962 {
4963 printf( "Cannot demiter because the top-most gate is an AND-gate.\n" );
4964 return NULL;
4965 }
4966 assert( Vec_IntSize(vOrder) % 2 == 0 );
4967 vNodes = Vec_IntAlloc( Gia_ManObjNum(p) );
4969 Gia_ManCollectAnds( p, Vec_IntArray(vOrder), Vec_IntSize(vOrder), vNodes, NULL );
4970 pNew = Gia_ManStart( 1 + Gia_ManCiNum(p) + Vec_IntSize(vNodes) + Vec_IntSize(vOrder) );
4971 pNew->pName = Abc_UtilStrsav( p->pName );
4972 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
4973 Gia_ManConst0(p)->Value = 0;
4974 Gia_ManForEachCi( p, pObj, i )
4975 pObj->Value = Gia_ManAppendCi( pNew );
4976 Gia_ManForEachObjVec( vNodes, p, pObj, i )
4977 pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
4978 pObj = Gia_ManCo(p, 0);
4979 if ( Gia_ObjFanin0(pObj) == Gia_ManConst0(p) )
4980 {
4981 Gia_ManAppendCo( pNew, 0 );
4982 Gia_ManAppendCo( pNew, Gia_ObjFaninC0(pObj) );
4983 }
4984 else
4985 {
4986 Gia_ManSetPhase( p );
4987 Gia_ManForEachObjVec( vOrder, p, pObj, i )
4988 Gia_ManAppendCo( pNew, Abc_LitNotCond(pObj->Value, pObj->fPhase) );
4989 }
4990 Vec_IntFree( vNodes );
4991 Vec_IntFree( vOrder );
4992 return pNew;
4993}
Vec_Int_t * Gia_ManCollectTopXors(Gia_Man_t *p)
Definition giaDup.c:4898
void Gia_ManCollectAnds(Gia_Man_t *p, int *pNodes, int nNodes, Vec_Int_t *vNodes, Vec_Int_t *vLeaves)
Definition giaDfs.c:125
Here is the call graph for this function:

◆ Gia_ManDemiterTwoWords()

int Gia_ManDemiterTwoWords ( Gia_Man_t * p,
Gia_Man_t ** pp0,
Gia_Man_t ** pp1 )
extern

Definition at line 5082 of file giaDup.c.

5083{
5084 Gia_Obj_t * pObj;
5085 int i, fSecond;
5086 assert( Gia_ManRegNum(p) == 0 );
5087 assert( Gia_ManCoNum(p) % 2 == 0 );
5088 *pp0 = *pp1 = NULL;
5089 for ( fSecond = 0; fSecond < 2; fSecond++ )
5090 {
5091 Vec_Int_t * vNodes = Gia_ManCollectReach2( p, fSecond );
5092 Gia_Man_t * pNew = Gia_ManStart( 1 + Gia_ManCiNum(p) + Vec_IntSize(vNodes) + Gia_ManCoNum(p)/2 );
5093 pNew->pName = Abc_UtilStrsav( p->pName );
5094 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
5095 Gia_ManConst0(p)->Value = 0;
5096 Gia_ManForEachPi( p, pObj, i )
5097 pObj->Value = Gia_ManAppendCi( pNew );
5098 Gia_ManForEachObjVec( vNodes, p, pObj, i )
5099 pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
5100 Gia_ManForEachCo( p, pObj, i )
5101 if ( (i < Gia_ManCoNum(p)/2) ^ fSecond )
5102 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
5103 Vec_IntFree( vNodes );
5104 if ( fSecond )
5105 *pp1 = pNew;
5106 else
5107 *pp0 = pNew;
5108 }
5109 return 1;
5110}
Vec_Int_t * Gia_ManCollectReach2(Gia_Man_t *p, int fSecond)
Definition giaDup.c:5071
Here is the call graph for this function:

◆ Gia_ManDeriveNexts()

int * Gia_ManDeriveNexts ( Gia_Man_t * p)
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 260 of file giaEquiv.c.

261{
262 unsigned * pNexts, * pTails;
263 int i;
264 assert( p->pReprs != NULL );
265 assert( p->pNexts == NULL );
266 pNexts = ABC_CALLOC( unsigned, Gia_ManObjNum(p) );
267 pTails = ABC_ALLOC( unsigned, Gia_ManObjNum(p) );
268 for ( i = 0; i < Gia_ManObjNum(p); i++ )
269 pTails[i] = i;
270 for ( i = 0; i < Gia_ManObjNum(p); i++ )
271 {
272 //if ( p->pReprs[i].iRepr == GIA_VOID )
273 if ( !p->pReprs[i].iRepr || p->pReprs[i].iRepr == GIA_VOID )
274 continue;
275 pNexts[ pTails[p->pReprs[i].iRepr] ] = i;
276 pTails[p->pReprs[i].iRepr] = i;
277 }
278 ABC_FREE( pTails );
279 return (int *)pNexts;
280}
#define GIA_VOID
Definition gia.h:46
Here is the caller graph for this function:

◆ Gia_ManDeriveReprs()

void Gia_ManDeriveReprs ( Gia_Man_t * p)
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 293 of file giaEquiv.c.

294{
295 int i, iObj;
296 assert( p->pReprs == NULL );
297 assert( p->pNexts != NULL );
298 p->pReprs = ABC_CALLOC( Gia_Rpr_t, Gia_ManObjNum(p) );
299 for ( i = 0; i < Gia_ManObjNum(p); i++ )
300 Gia_ObjSetRepr( p, i, GIA_VOID );
301 for ( i = 0; i < Gia_ManObjNum(p); i++ )
302 {
303 if ( p->pNexts[i] == 0 )
304 continue;
305 if ( p->pReprs[i].iRepr != GIA_VOID )
306 continue;
307 // next is set, repr is not set
308 for ( iObj = p->pNexts[i]; iObj; iObj = p->pNexts[iObj] )
309 p->pReprs[iObj].iRepr = i;
310 }
311}
Here is the caller graph for this function:

◆ Gia_ManDeriveReprsFromSibls()

void Gia_ManDeriveReprsFromSibls ( Gia_Man_t * p)
extern

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

Synopsis [Given pSibls, derives original representitives and nexts.]

Description []

SideEffects []

SeeAlso []

Definition at line 325 of file giaEquiv.c.

326{
327
328 int i, iObj;
329 assert( !p->pReprs && p->pSibls );
330 p->pReprs = ABC_CALLOC( Gia_Rpr_t, Gia_ManObjNum(p) );
331 for ( i = 0; i < Gia_ManObjNum(p); i++ )
332 Gia_ObjSetRepr( p, i, GIA_VOID );
333 for ( i = 0; i < Gia_ManObjNum(p); i++ )
334 {
335 if ( p->pSibls[i] == 0 )
336 continue;
337 if ( p->pReprs[i].iRepr != GIA_VOID )
338 continue;
339 for ( iObj = p->pSibls[i]; iObj; iObj = p->pSibls[iObj] )
340 p->pReprs[iObj].iRepr = i;
341 }
342 ABC_FREE( p->pNexts );
343 p->pNexts = Gia_ManDeriveNexts( p );
344}
int * Gia_ManDeriveNexts(Gia_Man_t *p)
Definition giaEquiv.c:260
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDeriveSolutionOne()

Vec_Int_t * Gia_ManDeriveSolutionOne ( Gia_Man_t * p,
Vec_Wrd_t * vSims,
Vec_Wrd_t * vIsfs,
Vec_Int_t * vCands,
Vec_Int_t * vSet,
int nWords,
int Type )
extern

Definition at line 318 of file giaDecs.c.

319{
320 Vec_Int_t * vRes = NULL;
321 Vec_Wrd_t * vTruths = Gia_ManDeriveTruths( p, vSims, vIsfs, vCands, vSet, nWords );
322 int nTtWords = Vec_WrdSize(vTruths)/2, nVars = Vec_IntSize(vSet);
323 word * pTruth[2] = { Vec_WrdEntryP(vTruths, 0*nTtWords),
324 Vec_WrdEntryP(vTruths, 1*nTtWords) };
325 if ( Type == 0 )
326 vRes = Gia_ManDeriveResub( vTruths, nVars );
327 else if ( Type == 1 )
328 vRes = Gia_ManDeriveBidec( vTruths, nVars );
329 else if ( Type == 2 )
330 vRes = Gia_ManDeriveIsop( vTruths, nVars );
331 else if ( Type == 3 )
332 vRes = Gia_ManDeriveBdd( vTruths, nVars );
333 if ( vRes && Gia_ResubVarNum(vRes) <= 6 )
334 {
335 word Func = Gia_ResubToTruth6( vRes );
336 assert( !(Func & pTruth[0][0]) );
337 assert( !(pTruth[1][0] & ~Func) );
338 }
339 Vec_WrdFree( vTruths );
340 return vRes;
341}
Vec_Int_t * Gia_ManDeriveBidec(Vec_Wrd_t *vTruths, int nVars)
Definition giaDecs.c:197
word Gia_ResubToTruth6(Vec_Int_t *vResub)
Definition giaDecs.c:73
int Gia_ResubVarNum(Vec_Int_t *vResub)
FUNCTION DEFINITIONS ///.
Definition giaDecs.c:51
Vec_Wrd_t * Gia_ManDeriveTruths(Gia_Man_t *p, Vec_Wrd_t *vSims, Vec_Wrd_t *vIsfs, Vec_Int_t *vCands, Vec_Int_t *vSet, int nWords)
Definition giaDecs.c:95
Vec_Int_t * Gia_ManDeriveBdd(Vec_Wrd_t *vTruths, int nVars)
Definition giaDecs.c:245
Vec_Int_t * Gia_ManDeriveResub(Vec_Wrd_t *vTruths, int nVars)
Definition giaDecs.c:168
Vec_Int_t * Gia_ManDeriveIsop(Vec_Wrd_t *vTruths, int nVars)
Definition giaDecs.c:217
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDetectSeqSignals()

void Gia_ManDetectSeqSignals ( Gia_Man_t * p,
int fSetReset,
int fVerbose )
extern

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 );
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_ManPrintSignals(Gia_Man_t *p, int *pFreq, char *pStr)
Definition giaEnable.c:96
void Gia_CollectSuper(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vSuper)
Definition giaEnable.c:70
Gia_Obj_t * Gia_ObjRecognizeMux(Gia_Obj_t *pNode, Gia_Obj_t **ppNodeT, Gia_Obj_t **ppNodeE)
Definition giaUtil.c:1056
Here is the call graph for this function:

◆ Gia_ManDumpVerilog()

void Gia_ManDumpVerilog ( Gia_Man_t * p,
char * pFileName,
Vec_Int_t * vObjs,
int fVerBufs,
int fInter,
int fInterComb,
int fAssign,
int fReverse )
extern

Definition at line 1415 of file giaMan.c.

1416{
1417 if ( fInterComb )
1418 {
1419 if ( fAssign ) {
1420 extern void Gia_ManDumpInterfaceAssign( Gia_Man_t * p, char * pFileName );
1421 Gia_ManDumpInterfaceAssign( p, pFileName );
1422 }
1423 else {
1424 extern void Gia_ManDumpInterface( Gia_Man_t * p, char * pFileName );
1425 Gia_ManDumpInterface( p, pFileName );
1426 }
1427 }
1428 else
1429 {
1430 if ( fAssign ) {
1431 extern void Gia_ManDumpVerilogNoInterAssign( Gia_Man_t * p, char * pFileName, Vec_Int_t * vObjs, int fVerBufs, int fInter );
1432 Gia_ManDumpVerilogNoInterAssign( p, pFileName, vObjs, fVerBufs, fInter );
1433 }
1434 else {
1435 extern void Gia_ManDumpVerilogNoInter( Gia_Man_t * p, char * pFileName, Vec_Int_t * vObjs, int fVerBufs, int fInter );
1436 Gia_ManDumpVerilogNoInter( p, pFileName, vObjs, fVerBufs, fInter );
1437 }
1438 }
1439}
void Gia_ManDumpVerilogNoInter(Gia_Man_t *p, char *pFileName, Vec_Int_t *vObjs, int fVerBufs, int fInter)
Definition giaMan.c:1440
void Gia_ManDumpVerilogNoInterAssign(Gia_Man_t *p, char *pFileName, Vec_Int_t *vObjs, int fVerBufs, int fInter)
Definition giaMan.c:1620
void Gia_ManDumpInterfaceAssign(Gia_Man_t *p, char *pFileName)
Definition giaMan.c:2016
void Gia_ManDumpInterface(Gia_Man_t *p, char *pFileName)
Definition giaMan.c:1905
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDumpVerilogNand()

void Gia_ManDumpVerilogNand ( Gia_Man_t * p,
char * pFileName )
extern

Definition at line 2151 of file giaMan.c.

2152{
2153 Gia_Obj_t * pObj; int i, nPis = Gia_ManPiNum(p);
2154 int nDigits = Abc_Base10Log( Gia_ManObjNum(p) );
2155 int nDigitsI = Abc_Base10Log( Gia_ManPiNum(p) );
2156 int nDigitsO = Abc_Base10Log( Gia_ManPoNum(p) );
2157 FILE * pFile = fopen( pFileName, "wb" );
2158 if ( pFile == NULL )
2159 {
2160 printf( "Cannot open output file \"%s\".\n", pFileName );
2161 return;
2162 }
2163 assert( Gia_ManRegNum(p) == 0 );
2164 fprintf( pFile, "module " );
2165 Gia_ManDumpModuleName( pFile, p->pName );
2166 fprintf( pFile, "_wrapper" );
2167 fprintf( pFile, " ( " );
2168 if ( p->vNamesIn ) {
2169 Gia_ManDumpIoList( p, pFile, 0, 0 );
2170 fprintf( pFile, ", " );
2171 Gia_ManDumpIoList( p, pFile, 1, 0 );
2172 fprintf( pFile, " );\n\n" );
2173 Gia_ManDumpIoRanges( p, pFile, 0 );
2174 Gia_ManDumpIoRanges( p, pFile, 1 );
2175 }
2176 else {
2177 fprintf( pFile, "\n " );
2178 Gia_ManForEachPi( p, pObj, i )
2179 fprintf( pFile, "%s, ", Gia_ObjGetDumpName(NULL, 'x', i, nDigitsI) );
2180 fprintf( pFile, "\n " );
2181 Gia_ManForEachPo( p, pObj, i )
2182 fprintf( pFile, "%s%s ", Gia_ObjGetDumpName(NULL, 'z', i, nDigitsO), i < Gia_ManPoNum(p)-1 ? ",":"" );
2183 fprintf( pFile, "\n);\n\n" );
2184 fprintf( pFile, " input" );
2185 Gia_ManForEachPi( p, pObj, i )
2186 fprintf( pFile, " %s%s", Gia_ObjGetDumpName(NULL, 'x', i, nDigitsI), i < Gia_ManPiNum(p)-1 ? ",":"" );
2187 fprintf( pFile, ";\n" );
2188 fprintf( pFile, " output" );
2189 Gia_ManForEachPo( p, pObj, i )
2190 fprintf( pFile, " %s%s", Gia_ObjGetDumpName(NULL, 'z', i, nDigitsO), i < Gia_ManPoNum(p)-1 ? ",":"" );
2191 fprintf( pFile, ";\n" );
2192 }
2193 fprintf( pFile, "\n" );
2194 Gia_ManForEachPi( p, pObj, i )
2195 fprintf( pFile, " wire n%0*d = %s;\n", nDigits, i+1, p->vNamesIn ? (char *)Vec_PtrEntry(p->vNamesIn, i) : Gia_ObjGetDumpName(p->vNamesIn, 'x', i, nDigitsI) );
2196 fprintf( pFile, "\n" );
2197 Gia_ManForEachAnd( p, pObj, i )
2198 {
2199 fprintf( pFile, " wire n%0*d = ~(", nDigits, i );
2200 Gia_ManDumpNandLit( pFile, nPis, Gia_ObjFaninLit0(pObj, i), nDigits );
2201 fprintf( pFile, " & " );
2202 Gia_ManDumpNandLit( pFile, nPis, Gia_ObjFaninLit1(pObj, i), nDigits );
2203 fprintf( pFile, ");\n" );
2204 }
2205 fprintf( pFile, "\n" );
2206 Gia_ManForEachPo( p, pObj, i )
2207 {
2208 fprintf( pFile, " assign %s = ", p->vNamesOut ? (char *)Vec_PtrEntry(p->vNamesOut, i) : Gia_ObjGetDumpName(p->vNamesOut, 'z', i, nDigitsO) );
2209 Gia_ManDumpNandLit( pFile, nPis, Gia_ObjFaninLit0p(p, pObj), nDigits );
2210 fprintf( pFile, ";\n" );
2211 }
2212 fprintf( pFile, "\nendmodule\n\n" );
2213 fclose( pFile );
2214}
void Gia_ManDumpModuleName(FILE *pFile, char *pName)
Definition giaMan.c:1290
void Gia_ManDumpIoRanges(Gia_Man_t *p, FILE *pFile, int fOuts)
Definition giaMan.c:1867
void Gia_ManDumpIoList(Gia_Man_t *p, FILE *pFile, int fOuts, int fReverse)
Definition giaMan.c:1845
void Gia_ManDumpNandLit(FILE *pFile, int nIns, int Lit, int nDigits)
Definition giaMan.c:2140
char * Gia_ObjGetDumpName(Vec_Ptr_t *vNames, char c, int i, int d)
Definition giaMan.c:1378
Here is the call graph for this function:

◆ Gia_ManDup()

Gia_Man_t * Gia_ManDup ( Gia_Man_t * p)
extern

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

Synopsis [Duplicates AIG without any changes.]

Description []

SideEffects []

SeeAlso []

Definition at line 720 of file giaDup.c.

721{
722 Gia_Man_t * pNew;
723 Gia_Obj_t * pObj;
724 int i;
725 pNew = Gia_ManStart( Gia_ManObjNum(p) );
726 pNew->pName = Abc_UtilStrsav( p->pName );
727 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
728 if ( Gia_ManHasChoices(p) )
729 pNew->pSibls = ABC_CALLOC( int, Gia_ManObjNum(p) );
730 Gia_ManConst0(p)->Value = 0;
731 Gia_ManForEachObj1( p, pObj, i )
732 {
733 if ( Gia_ObjIsBuf(pObj) )
734 pObj->Value = Gia_ManAppendBuf( pNew, Gia_ObjFanin0Copy(pObj) );
735 else if ( Gia_ObjIsAnd(pObj) )
736 {
737 pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
738 if ( Gia_ObjSibl(p, Gia_ObjId(p, pObj)) )
739 pNew->pSibls[Abc_Lit2Var(pObj->Value)] = Abc_Lit2Var(Gia_ObjSiblObj(p, Gia_ObjId(p, pObj))->Value);
740 }
741 else if ( Gia_ObjIsCi(pObj) )
742 pObj->Value = Gia_ManAppendCi( pNew );
743 else if ( Gia_ObjIsCo(pObj) )
744 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
745 }
746 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
747 if ( p->pCexSeq )
748 pNew->pCexSeq = Abc_CexDup( p->pCexSeq, Gia_ManRegNum(p) );
749 return pNew;
750}
#define Gia_ManForEachObj1(p, pObj, i)
Definition gia.h:1192
Abc_Cex_t * pCexSeq
Definition gia.h:150
Abc_Cex_t * Abc_CexDup(Abc_Cex_t *p, int nRegsNew)
Definition utilCex.c:145
Here is the call graph for this function:

◆ Gia_ManDup2()

Gia_Man_t * Gia_ManDup2 ( Gia_Man_t * p1,
Gia_Man_t * p2 )
extern

Definition at line 751 of file giaDup.c.

752{
753 Gia_Man_t * pNew;
754 Gia_Obj_t * pObj;
755 int i;
756 assert( Gia_ManCiNum(p1) == Gia_ManCiNum(p2) );
757 assert( Gia_ManCoNum(p1) == Gia_ManCoNum(p2) );
758 pNew = Gia_ManStart( Gia_ManObjNum(p1) + Gia_ManObjNum(p2) );
759 Gia_ManHashStart( pNew );
760 Gia_ManConst0(p1)->Value = 0;
761 Gia_ManConst0(p2)->Value = 0;
762 Gia_ManForEachCi( p1, pObj, i )
763 pObj->Value = Gia_ManCi(p2, i)->Value = Gia_ManAppendCi( pNew );
764 Gia_ManForEachAnd( p1, pObj, i )
765 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
766 Gia_ManForEachAnd( p2, pObj, i )
767 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
768 Gia_ManForEachCo( p1, pObj, i )
769 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
770 Gia_ManForEachCo( p2, pObj, i )
771 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
772 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p1) );
773 Gia_ManHashStop( pNew );
774 return pNew;
775}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupAndCones()

Gia_Man_t * Gia_ManDupAndCones ( Gia_Man_t * p,
int * pAnds,
int nAnds,
int fTrimPis )
extern

Definition at line 3941 of file giaDup.c.

3942{
3943 Gia_Man_t * pNew;
3944 Vec_Ptr_t * vLeaves, * vNodes, * vRoots;
3945 Gia_Obj_t * pObj;
3946 int i;
3947
3948 // collect initial POs
3949 vLeaves = Vec_PtrAlloc( 100 );
3950 vNodes = Vec_PtrAlloc( 100 );
3951 vRoots = Vec_PtrAlloc( 100 );
3952 for ( i = 0; i < nAnds; i++ )
3953// Vec_PtrPush( vRoots, Gia_ManPo(p, pPos[i]) );
3954 Vec_PtrPush( vRoots, Gia_ManObj(p, pAnds[i]) );
3955
3956 // mark internal nodes
3958 Gia_ObjSetTravIdCurrent( p, Gia_ManConst0(p) );
3959 Vec_PtrForEachEntry( Gia_Obj_t *, vRoots, pObj, i )
3960 Gia_ManDupCones_rec( p, pObj, vLeaves, vNodes, vRoots );
3961 Vec_PtrSort( vLeaves, (int (*)(const void *, const void *))Gia_ObjCompareByCioId );
3962
3963 // start the new manager
3964// Gia_ManFillValue( p );
3965 pNew = Gia_ManStart( Vec_PtrSize(vLeaves) + Vec_PtrSize(vNodes) + Vec_PtrSize(vRoots) + 1);
3966 pNew->pName = Abc_UtilStrsav( p->pName );
3967 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
3968 // map the constant node
3969 Gia_ManConst0(p)->Value = 0;
3970 // create PIs
3971 if ( fTrimPis )
3972 {
3973 Vec_PtrForEachEntry( Gia_Obj_t *, vLeaves, pObj, i )
3974 pObj->Value = Gia_ManAppendCi( pNew );
3975 }
3976 else
3977 {
3978 Gia_ManForEachPi( p, pObj, i )
3979 pObj->Value = Gia_ManAppendCi( pNew );
3980 }
3981 // create LOs
3982// Vec_PtrForEachEntryStart( Gia_Obj_t *, vRoots, pObj, i, nPos )
3983// Gia_ObjRiToRo(p, pObj)->Value = Gia_ManAppendCi( pNew );
3984 // create internal nodes
3985 Vec_PtrForEachEntry( Gia_Obj_t *, vNodes, pObj, i )
3986 if ( Gia_ObjIsMux(p, pObj) )
3987 pObj->Value = Gia_ManAppendMux( pNew, Gia_ObjFanin2Copy(p, pObj), Gia_ObjFanin1Copy(pObj), Gia_ObjFanin0Copy(pObj) );
3988 else if ( Gia_ObjIsXor(pObj) )
3989 pObj->Value = Gia_ManAppendXor( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
3990 else
3991 pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
3992 // create COs
3993 Vec_PtrForEachEntry( Gia_Obj_t *, vRoots, pObj, i )
3994// Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
3995 Gia_ManAppendCo( pNew, pObj->Value );
3996 // finalize
3997// Gia_ManSetRegNum( pNew, Vec_PtrSize(vRoots)-nPos );
3998 Gia_ManSetRegNum( pNew, 0 );
3999 Vec_PtrFree( vLeaves );
4000 Vec_PtrFree( vNodes );
4001 Vec_PtrFree( vRoots );
4002 return pNew;
4003
4004}
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:3861
int Gia_ObjCompareByCioId(Gia_Obj_t **pp1, Gia_Obj_t **pp2)
Definition giaDup.c:3855
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupAndConesLimit()

Gia_Man_t * Gia_ManDupAndConesLimit ( Gia_Man_t * p,
int * pAnds,
int nAnds,
int Level )
extern

Definition at line 4021 of file giaDup.c.

4022{
4023 Gia_Man_t * pNew;
4024 int i;
4025 pNew = Gia_ManStart( 1000 );
4026 pNew->pName = Abc_UtilStrsav( p->pName );
4027 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
4028 Gia_ManLevelNum( p );
4030 Gia_ManConst0(p)->Value = 0;
4031 for ( i = 0; i < nAnds; i++ )
4032 Gia_ManDupAndConesLimit_rec( pNew, p, pAnds[i], Level );
4033 for ( i = 0; i < nAnds; i++ )
4034 Gia_ManAppendCo( pNew, Gia_ManObj(p, pAnds[i])->Value );
4035 return pNew;
4036}
void Gia_ManDupAndConesLimit_rec(Gia_Man_t *pNew, Gia_Man_t *p, int iObj, int Level)
Definition giaDup.c:4005
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupAndConesLimit2()

Gia_Man_t * Gia_ManDupAndConesLimit2 ( Gia_Man_t * p,
int * pAnds,
int nAnds,
int Level )
extern

Definition at line 4054 of file giaDup.c.

4055{
4056 Gia_Man_t * pNew;
4057 int i;
4058 pNew = Gia_ManStart( 1000 );
4059 pNew->pName = Abc_UtilStrsav( p->pName );
4060 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
4062 Gia_ManConst0(p)->Value = 0;
4063 for ( i = 0; i < nAnds; i++ )
4064 Gia_ManDupAndConesLimit2_rec( pNew, p, pAnds[i], Level );
4065 for ( i = 0; i < nAnds; i++ )
4066 Gia_ManAppendCo( pNew, Gia_ManObj(p, pAnds[i])->Value );
4067 return pNew;
4068
4069}
void Gia_ManDupAndConesLimit2_rec(Gia_Man_t *pNew, Gia_Man_t *p, int iObj, int Level)
Definition giaDup.c:4038
Here is the call graph for this function:

◆ Gia_ManDupAndOr()

Gia_Man_t * Gia_ManDupAndOr ( Gia_Man_t * p,
int nOuts,
int fUseOr,
int fCompl )
extern

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

Synopsis [Computes the AND of all POs.]

Description []

SideEffects []

SeeAlso []

Definition at line 3216 of file giaDup.c.

3217{
3218 Gia_Man_t * pNew, * pTemp;
3219 Gia_Obj_t * pObj;
3220 int i, iResult;
3221 assert( Gia_ManRegNum(p) == 0 );
3222 pNew = Gia_ManStart( Gia_ManObjNum(p) );
3223 pNew->pName = Abc_UtilStrsav( p->pName );
3224 Gia_ManConst0(p)->Value = 0;
3225 Gia_ManHashAlloc( pNew );
3226 Gia_ManForEachPi( p, pObj, i )
3227 pObj->Value = Gia_ManAppendCi( pNew );
3228 Gia_ManForEachAnd( p, pObj, i )
3229 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
3230 if ( fUseOr ) // construct OR of all POs
3231 {
3232 iResult = 0;
3233 Gia_ManForEachPo( p, pObj, i )
3234 iResult = Gia_ManHashOr( pNew, iResult, Gia_ObjFanin0Copy(pObj) );
3235 }
3236 else // construct AND of all POs
3237 {
3238 iResult = 1;
3239 Gia_ManForEachPo( p, pObj, i )
3240 iResult = Gia_ManHashAnd( pNew, iResult, Gia_ObjFanin0Copy(pObj) );
3241 }
3242 iResult = Abc_LitNotCond( iResult, (int)(fCompl > 0) );
3243// Gia_ManForEachPo( p, pObj, i )
3244// pObj->Value = Gia_ManAppendCo( pNew, iResult );
3245 for ( i = 0; i < nOuts; i++ )
3246 Gia_ManAppendCo( pNew, iResult );
3247 Gia_ManHashStop( pNew );
3248 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
3249 pNew = Gia_ManCleanup( pTemp = pNew );
3250 Gia_ManStop( pTemp );
3251 return pNew;
3252}
int Gia_ManHashOr(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:621
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupAppend()

void Gia_ManDupAppend ( Gia_Man_t * pNew,
Gia_Man_t * pTwo )
extern

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

Synopsis [Appends second AIG without any changes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1137 of file giaDup.c.

1138{
1139 Gia_Obj_t * pObj;
1140 int i;
1141 if ( pNew->nRegs > 0 )
1142 pNew->nRegs = 0;
1143 if ( Vec_IntSize(&pNew->vHTable) == 0 )
1144 Gia_ManHashStart( pNew );
1145 Gia_ManConst0(pTwo)->Value = 0;
1146 Gia_ManForEachObj1( pTwo, pObj, i )
1147 {
1148 if ( Gia_ObjIsAnd(pObj) )
1149 pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1150 else if ( Gia_ObjIsCi(pObj) )
1151 pObj->Value = Gia_ManAppendCi( pNew );
1152 else if ( Gia_ObjIsCo(pObj) )
1153 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1154 }
1155}
int nRegs
Definition gia.h:101
Here is the call graph for this function:

◆ Gia_ManDupAppendCones()

Gia_Man_t * Gia_ManDupAppendCones ( Gia_Man_t * p,
Gia_Man_t ** ppCones,
int nCones,
int fOnlyRegs )
extern

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

Synopsis [Appends logic cones as additional property outputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 1305 of file giaDup.c.

1306{
1307 Gia_Man_t * pNew, * pOne;
1308 Gia_Obj_t * pObj;
1309 int i, k;
1310 pNew = Gia_ManStart( Gia_ManObjNum(p) );
1311 pNew->pName = Abc_UtilStrsav( p->pName );
1312 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1313 Gia_ManHashAlloc( pNew );
1314 Gia_ManConst0(p)->Value = 0;
1315 Gia_ManForEachCi( p, pObj, i )
1316 pObj->Value = Gia_ManAppendCi( pNew );
1317 Gia_ManForEachAnd( p, pObj, i )
1318 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1319 Gia_ManForEachPo( p, pObj, i )
1320 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1321 for ( k = 0; k < nCones; k++ )
1322 {
1323 pOne = ppCones[k];
1324 assert( Gia_ManPoNum(pOne) == 1 );
1325 assert( Gia_ManRegNum(pOne) == 0 );
1326 if ( fOnlyRegs )
1327 assert( Gia_ManPiNum(pOne) == Gia_ManRegNum(p) );
1328 else
1329 assert( Gia_ManPiNum(pOne) == Gia_ManCiNum(p) );
1330 Gia_ManConst0(pOne)->Value = 0;
1331 Gia_ManForEachPi( pOne, pObj, i )
1332 pObj->Value = Gia_ManCiLit( pNew, fOnlyRegs ? Gia_ManPiNum(p) + i : i );
1333 Gia_ManForEachAnd( pOne, pObj, i )
1334 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1335 Gia_ManForEachPo( pOne, pObj, i )
1336 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1337 }
1338 Gia_ManForEachRi( p, pObj, i )
1339 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1340 Gia_ManHashStop( pNew );
1341 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
1342 pNew = Gia_ManCleanup( pOne = pNew );
1343 Gia_ManStop( pOne );
1344 return pNew;
1345}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupAppendNew()

Gia_Man_t * Gia_ManDupAppendNew ( Gia_Man_t * pOne,
Gia_Man_t * pTwo )
extern

Definition at line 1174 of file giaDup.c.

1175{
1176 Gia_Man_t * pNew;
1177 Gia_Obj_t * pObj;
1178 int i;
1179 pNew = Gia_ManStart( Gia_ManObjNum(pOne) + Gia_ManObjNum(pTwo) );
1180 pNew->pName = Abc_UtilStrsav( pOne->pName );
1181 pNew->pSpec = Abc_UtilStrsav( pOne->pSpec );
1182 Gia_ManHashAlloc( pNew );
1183 Gia_ManConst0(pOne)->Value = 0;
1184 Gia_ManForEachObj1( pOne, pObj, i )
1185 {
1186 if ( Gia_ObjIsAnd(pObj) )
1187 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1188 else if ( Gia_ObjIsCi(pObj) )
1189 pObj->Value = Gia_ManAppendCi( pNew );
1190 }
1191 Gia_ManConst0(pTwo)->Value = 0;
1192 Gia_ManForEachObj1( pTwo, pObj, i )
1193 {
1194 if ( Gia_ObjIsAnd(pObj) )
1195 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1196 else if ( Gia_ObjIsPi(pTwo, pObj) )
1197 pObj->Value = Gia_ManPi(pOne, Gia_ObjCioId(pObj))->Value;
1198 else if ( Gia_ObjIsCi(pObj) )
1199 pObj->Value = Gia_ManAppendCi( pNew );
1200 }
1201 Gia_ManHashStop( pNew );
1202 // primary outputs
1203 Gia_ManForEachPo( pOne, pObj, i )
1204 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1205 Gia_ManForEachPo( pTwo, pObj, i )
1206 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1207 // flop inputs
1208 Gia_ManForEachRi( pOne, pObj, i )
1209 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1210 Gia_ManForEachRi( pTwo, pObj, i )
1211 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1212 Gia_ManSetRegNum( pNew, Gia_ManRegNum(pOne) + Gia_ManRegNum(pTwo) );
1213 return pNew;
1214}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupAppendShare()

void Gia_ManDupAppendShare ( Gia_Man_t * p,
Gia_Man_t * pTwo )
extern

Definition at line 1156 of file giaDup.c.

1157{
1158 Gia_Obj_t * pObj;
1159 int i;
1160 assert( Gia_ManCiNum(pNew) == Gia_ManCiNum(pTwo) );
1161 if ( Vec_IntSize(&pNew->vHTable) == 0 )
1162 Gia_ManHashStart( pNew );
1163 Gia_ManConst0(pTwo)->Value = 0;
1164 Gia_ManForEachObj1( pTwo, pObj, i )
1165 {
1166 if ( Gia_ObjIsAnd(pObj) )
1167 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1168 else if ( Gia_ObjIsCi(pObj) )
1169 pObj->Value = Gia_Obj2Lit( pNew, Gia_ManCi( pNew, Gia_ObjCioId(pObj) ) );
1170 else if ( Gia_ObjIsCo(pObj) )
1171 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1172 }
1173}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupBlock()

Gia_Man_t * Gia_ManDupBlock ( Gia_Man_t * p,
int nBlock )
extern

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

Synopsis [Reduce bit-width of GIA assuming it is Boolean.]

Description []

SideEffects []

SeeAlso []

Definition at line 1976 of file giaDup.c.

1977{
1978 Gia_Man_t * pNew, * pTemp;
1979 Gia_Obj_t * pObj; int i;
1980 assert( Gia_ManCiNum(p) % nBlock == 0 );
1981 assert( Gia_ManCoNum(p) % nBlock == 0 );
1982 pNew = Gia_ManStart( Gia_ManObjNum(p) );
1983 pNew->pName = Abc_UtilStrsav( p->pName );
1984 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1986 Gia_ManConst0(p)->Value = 0;
1987 Gia_ManForEachCi( p, pObj, i )
1988 pObj->Value = (i % nBlock == 0) ? Gia_ManAppendCi(pNew) : 0;
1989 Gia_ManHashAlloc( pNew );
1990 Gia_ManForEachAnd( p, pObj, i )
1991 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1992 Gia_ManForEachCo( p, pObj, i )
1993 if ( i % nBlock == 0 )
1994 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1995 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p)/nBlock );
1996 pNew = Gia_ManCleanup( pTemp = pNew );
1997 Gia_ManStop( pTemp );
1998 return pNew;
1999}
Here is the call graph for this function:

◆ Gia_ManDupChoicesAdd()

void Gia_ManDupChoicesAdd ( Gia_ChMan_t * pMan,
Gia_Man_t * pGia )
extern

Definition at line 6411 of file giaDup.c.

6412{
6413 Gia_Obj_t * pObj; int i;
6414 assert( Gia_ManCiNum(p->pNew) == Gia_ManCiNum(pGia) );
6415 assert( !p->vCoLits || Vec_IntSize(p->vCoLits) == Gia_ManCoNum(pGia) );
6416 assert( Gia_ManRegNum(p->pNew) == Gia_ManRegNum(pGia) );
6417 Gia_ManFillValue( pGia );
6418 Gia_ManForEachCi( pGia, pObj, i )
6419 pObj->Value = Gia_ManCiLit( p->pNew, i );
6420 Gia_ManForEachAnd( pGia, pObj, i )
6421 Gia_ManDupChoicesNode( p, pGia, i );
6422 assert( Vec_IntSize(p->vObj2Tt) == Gia_ManObjNum(p->pNew) );
6423 assert( Vec_IntSize(p->vTt2Obj) == Vec_MemEntryNum(p->vTtMem) );
6424}
void Gia_ManDupChoicesNode(Gia_ChMan_t *p, Gia_Man_t *pGia, int iObj)
Definition giaDup.c:6383
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupChoicesFinish()

Gia_Man_t * Gia_ManDupChoicesFinish ( Gia_ChMan_t * pMan)
extern

Definition at line 6464 of file giaDup.c.

6465{
6466 Gia_Man_t * pTemp, * pNew = p->pNew; int i, iLit;
6467 p->vSibls = Gia_ManDupChoicesCreateSibls( p );
6468 p->pNew->pSibls = Vec_IntReleaseArray( p->vSibls );
6469 Vec_IntForEachEntry( p->vCoLits, iLit, i )
6470 Gia_ManAppendCo( p->pNew, iLit );
6471 Vec_MemFree( p->vTtMem );
6472 Vec_IntFree( p->vSibls );
6473 Vec_IntFree( p->vTt2Obj );
6474 Vec_IntFree( p->vObj2Tt );
6475 Vec_IntFree( p->vCoLits );
6476 ABC_FREE( p->pTruth );
6477 ABC_FREE( p );
6478 pTemp = Gia_ManReorderChoices( pNew );
6479 Gia_ManStop( pNew );
6480 return pTemp;
6481}
Vec_Int_t * Gia_ManDupChoicesCreateSibls(Gia_ChMan_t *p)
Definition giaDup.c:6449
Gia_Man_t * Gia_ManReorderChoices(Gia_Man_t *p)
Definition giaDup.c:6311
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupChoicesStart()

Gia_ChMan_t * Gia_ManDupChoicesStart ( Gia_Man_t * pGia)
extern

Definition at line 6425 of file giaDup.c.

6426{
6428 p->pNew = Gia_ManStart( 10*Gia_ManObjNum(pGia) );
6429 p->pNew->pName = Abc_UtilStrsav( pGia->pName );
6430 p->pNew->pSpec = Abc_UtilStrsav( pGia->pSpec );
6431 p->vTtMem = Vec_MemAllocWithTTs( Gia_ManCiNum(pGia) );
6432 p->vTt2Obj = Vec_IntStartNatural( 1 + Gia_ManCiNum(pGia) );
6433 p->vObj2Tt = Vec_IntAlloc( 10*Gia_ManObjNum(pGia) );
6434 p->nWords = Abc_TtWordNum( Gia_ManCiNum(pGia) );
6435 p->pTruth = ABC_CALLOC( word, p->nWords );
6436 Gia_Obj_t * pObj; int i;
6437 for ( i = 0; i <= Gia_ManCiNum(pGia); i++ )
6438 Vec_IntPush( p->vObj2Tt, Abc_Var2Lit(i, 0) );
6439 Gia_ManForEachCi( pGia, pObj, i )
6440 Gia_ManAppendCi(p->pNew);
6441 Gia_ManSetRegNum( p->pNew, Gia_ManRegNum(pGia) );
6442 Gia_ManHashStart( p->pNew );
6443 Gia_ManDupChoicesAdd( p, pGia );
6444 p->vCoLits = Vec_IntAlloc( Gia_ManCoNum(pGia) );
6445 Gia_ManForEachCo( pGia, pObj, i )
6446 Vec_IntPush( p->vCoLits, Gia_ObjFanin0Copy(pObj) );
6447 return p;
6448}
void Gia_ManDupChoicesAdd(Gia_ChMan_t *p, Gia_Man_t *pGia)
Definition giaDup.c:6411
struct Gia_ChMan_t_ Gia_ChMan_t
Definition gia.h:1416
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupCof()

Gia_Man_t * Gia_ManDupCof ( Gia_Man_t * p,
int iVar )
extern

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}
Gia_Man_t * Gia_ManDupCofInt(Gia_Man_t *p, int iVar)
Definition giaCof.c:780
Here is the call graph for this function:

◆ Gia_ManDupCofactorObj()

Gia_Man_t * Gia_ManDupCofactorObj ( Gia_Man_t * p,
int iObj,
int Value )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 1935 of file giaDup.c.

1936{
1937 Gia_Man_t * pNew, * pTemp;
1938 Gia_Obj_t * pObj;
1939 int i, iObjValue = -1;
1940 assert( Gia_ManRegNum(p) == 0 );
1941 assert( iObj > 0 && iObj < Gia_ManObjNum(p) );
1942 assert( Gia_ObjIsCand(Gia_ManObj(p, iObj)) );
1943 assert( Value == 0 || Value == 1 );
1944 pNew = Gia_ManStart( Gia_ManObjNum(p) );
1945 pNew->pName = Abc_UtilStrsav( p->pName );
1946 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1947 Gia_ManConst0(p)->Value = 0;
1948 Gia_ManHashAlloc( pNew );
1949 Gia_ManForEachObj1( p, pObj, i )
1950 {
1951 if ( Gia_ObjIsCi(pObj) )
1952 pObj->Value = Gia_ManAppendCi( pNew );
1953 else if ( Gia_ObjIsAnd(pObj) )
1954 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1955 else if ( Gia_ObjIsCo(pObj) )
1956 pObj->Value = Gia_ManAppendCo( pNew, Gia_ManHashAnd(pNew, Gia_ObjFanin0Copy(pObj), iObjValue) );
1957 if ( i == iObj )
1958 iObjValue = Abc_LitNotCond(pObj->Value, !Value), pObj->Value = Value;
1959 }
1960 pNew = Gia_ManCleanup( pTemp = pNew );
1961 Gia_ManStop( pTemp );
1962 return pNew;
1963}
Here is the call graph for this function:

◆ Gia_ManDupCofactorVar()

Gia_Man_t * Gia_ManDupCofactorVar ( Gia_Man_t * p,
int iVar,
int Value )
extern

Definition at line 1861 of file giaDup.c.

1862{
1863 Gia_Man_t * pNew, * pTemp;
1864 Gia_Obj_t * pObj;
1865 int i;
1866 assert( iVar >= 0 && iVar < Gia_ManPiNum(p) );
1867 assert( Value == 0 || Value == 1 );
1868 pNew = Gia_ManStart( Gia_ManObjNum(p) );
1869 pNew->pName = Abc_UtilStrsav( p->pName );
1870 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1872 Gia_ManConst0(p)->Value = 0;
1873 Gia_ManForEachCi( p, pObj, i )
1874 pObj->Value = Gia_ManAppendCi(pNew);
1875 Gia_ManPi( p, iVar )->Value = Value; // modification!
1876 Gia_ManHashAlloc( pNew );
1877 Gia_ManForEachCo( p, pObj, i )
1878 Gia_ManDupCofactorVar_rec( pNew, p, Gia_ObjFanin0(pObj) );
1879 Gia_ManForEachCo( p, pObj, i )
1880 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1881 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
1882 pNew->nConstrs = p->nConstrs;
1883 pNew = Gia_ManCleanup( pTemp = pNew );
1884 Gia_ManStop( pTemp );
1885 return pNew;
1886}
void Gia_ManDupCofactorVar_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaDup.c:1852
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupCofAll()

Gia_Man_t * Gia_ManDupCofAll ( Gia_Man_t * p,
int nFanLim,
int fVerbose )
extern

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}
Vec_Int_t * Gia_ManCofVars(Gia_Man_t *p, int nFanLim)
Definition giaCof.c:883
Gia_Man_t * Gia_ManDupCofAllInt(Gia_Man_t *p, Vec_Int_t *vSigs, int fVerbose)
Definition giaCof.c:936
Here is the call graph for this function:

◆ Gia_ManDupCofAllInt()

Gia_Man_t * Gia_ManDupCofAllInt ( Gia_Man_t * p,
Vec_Int_t * vSigs,
int fVerbose )
extern

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}
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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupCollapse()

Gia_Man_t * Gia_ManDupCollapse ( Gia_Man_t * p,
Gia_Man_t * pBoxes,
Vec_Int_t * vBoxPres,
int fSeq )
extern

Definition at line 802 of file giaTim.c.

803{
804 // this procedure assumes that sequential AIG with boxes is unshuffled to have valid boxes
805 Tim_Man_t * pManTime = (Tim_Man_t *)p->pManTime;
806 Gia_Man_t * pNew, * pTemp;
807 Gia_Obj_t * pObj, * pObjBox;
808 int i, k, curCi, curCo, nBBins = 0, nBBouts = 0, nNewPis = 0;
809 assert( !fSeq || p->vRegClasses );
810 //assert( Gia_ManRegNum(p) == 0 );
811 assert( Gia_ManCiNum(p) == Tim_ManPiNum(pManTime) + Gia_ManCoNum(pBoxes) );
812 pNew = Gia_ManStart( Gia_ManObjNum(p) );
813 pNew->pName = Abc_UtilStrsav( p->pName );
814 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
815 if ( Gia_ManHasChoices(p) )
816 pNew->pSibls = ABC_CALLOC( int, Gia_ManObjNum(p) );
817 Gia_ManHashAlloc( pNew );
818 // copy const and real PIs
820 Gia_ManConst0(p)->Value = 0;
822 Gia_ObjSetTravIdCurrent( p, Gia_ManConst0(p) );
823 for ( i = 0; i < Tim_ManPiNum(pManTime); i++ )
824 {
825 pObj = Gia_ManCi( p, i );
826 pObj->Value = Gia_ManAppendCi(pNew);
827 Gia_ObjSetTravIdCurrent( p, pObj );
828 }
829 // create logic for each box
830 curCi = Tim_ManPiNum(pManTime);
831 curCo = 0;
832 for ( i = 0; i < Tim_ManBoxNum(pManTime); i++ )
833 {
834 // clean boxes
835 Gia_ManIncrementTravId( pBoxes );
836 Gia_ObjSetTravIdCurrent( pBoxes, Gia_ManConst0(pBoxes) );
837 Gia_ManConst0(pBoxes)->Value = 0;
838 // add internal nodes
839 //printf( "%d ", Tim_ManBoxIsBlack(pManTime, i) );
840 if ( Tim_ManBoxIsBlack(pManTime, i) )
841 {
842 int fSkip = (vBoxPres != NULL && !Vec_IntEntry(vBoxPres, i));
843 for ( k = 0; k < Tim_ManBoxInputNum(pManTime, i); k++ )
844 {
845 pObj = Gia_ManCo( p, curCo + k );
846 Gia_ManDupCollapse_rec( p, Gia_ObjFanin0(pObj), pNew );
847 pObj->Value = fSkip ? -1 : Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
848 nBBouts++;
849 }
850 for ( k = 0; k < Tim_ManBoxOutputNum(pManTime, i); k++ )
851 {
852 pObj = Gia_ManCi( p, curCi + k );
853 pObj->Value = fSkip ? 0 : Gia_ManAppendCi(pNew);
854 Gia_ObjSetTravIdCurrent( p, pObj );
855 nBBins++;
856 nNewPis += !fSkip;
857 }
858 }
859 else
860 {
861 for ( k = 0; k < Tim_ManBoxInputNum(pManTime, i); k++ )
862 {
863 // build logic
864 pObj = Gia_ManCo( p, curCo + k );
865 Gia_ManDupCollapse_rec( p, Gia_ObjFanin0(pObj), pNew );
866 // transfer to the PI
867 pObjBox = Gia_ManCi( pBoxes, k );
868 pObjBox->Value = Gia_ObjFanin0Copy(pObj);
869 Gia_ObjSetTravIdCurrent( pBoxes, pObjBox );
870 }
871 for ( k = 0; k < Tim_ManBoxOutputNum(pManTime, i); k++ )
872 {
873 // build logic
874 pObjBox = Gia_ManCo( pBoxes, curCi - Tim_ManPiNum(pManTime) + k );
875 Gia_ManDupCollapse_rec( pBoxes, Gia_ObjFanin0(pObjBox), pNew );
876 // transfer to the PI
877 pObj = Gia_ManCi( p, curCi + k );
878 pObj->Value = Gia_ObjFanin0Copy(pObjBox);
879 Gia_ObjSetTravIdCurrent( p, pObj );
880 }
881 }
882 curCo += Tim_ManBoxInputNum(pManTime, i);
883 curCi += Tim_ManBoxOutputNum(pManTime, i);
884 }
885 //printf( "\n" );
886 // add remaining nodes
887 for ( i = Tim_ManCoNum(pManTime) - Tim_ManPoNum(pManTime); i < Tim_ManCoNum(pManTime); i++ )
888 {
889 pObj = Gia_ManCo( p, i );
890 Gia_ManDupCollapse_rec( p, Gia_ObjFanin0(pObj), pNew );
891 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
892 }
893 curCo += Tim_ManPoNum(pManTime);
894 // verify counts
895 assert( curCi == Gia_ManCiNum(p) );
896 assert( curCo == Gia_ManCoNum(p) );
897 Gia_ManSetRegNum( pNew, (fSeq && p->vRegClasses) ? Vec_IntSize(p->vRegClasses) : Gia_ManRegNum(p) );
898 Gia_ManHashStop( pNew );
899 pNew = Gia_ManCleanup( pTemp = pNew );
900 Gia_ManCleanupRemap( p, pTemp );
901 Gia_ManStop( pTemp );
902 if ( nNewPis )
903 {
904 pNew = Gia_ManDupMoveLast( pTemp = pNew, Tim_ManPiNum(pManTime)-Gia_ManRegNum(pNew), nNewPis );
905 Gia_ManCleanupRemap( p, pTemp );
906 Gia_ManStop( pTemp );
907 }
908/*
909 printf( "%d = %d - %d Diff = %d\n",
910 Tim_ManPoNum(pManTime), Gia_ManCoNum(pNew), nBBouts,
911 Tim_ManPoNum(pManTime) - (Gia_ManCoNum(pNew) - nBBouts) );
912
913 printf( "%d = %d - %d Diff = %d\n\n",
914 Tim_ManPiNum(pManTime), Gia_ManCiNum(pNew), nBBins,
915 Tim_ManPiNum(pManTime) - (Gia_ManCiNum(pNew) - nBBins) );
916*/
917 assert( vBoxPres != NULL || Tim_ManPoNum(pManTime) == Gia_ManCoNum(pNew) - nBBouts );
918 assert( vBoxPres != NULL || Tim_ManPiNum(pManTime) == Gia_ManCiNum(pNew) - nBBins );
919 // implement initial state if given
920 if ( fSeq && p->vRegInits && Vec_IntSum(p->vRegInits) )
921 {
922 char * pInit = ABC_ALLOC( char, Vec_IntSize(p->vRegInits) + 1 );
923 Gia_Obj_t * pObj;
924 int i;
925 assert( Vec_IntSize(p->vRegInits) == Gia_ManRegNum(pNew) );
926 Gia_ManForEachRo( pNew, pObj, i )
927 {
928 if ( Vec_IntEntry(p->vRegInits, i) == 0 )
929 pInit[i] = '0';
930 else if ( Vec_IntEntry(p->vRegInits, i) == 1 )
931 pInit[i] = '1';
932 else
933 pInit[i] = 'X';
934 }
935 pInit[i] = 0;
936 pNew = Gia_ManDupZeroUndc( pTemp = pNew, pInit, 0, 0, 1 );
937 pNew->nConstrs = pTemp->nConstrs; pTemp->nConstrs = 0;
938 Gia_ManStop( pTemp );
939 ABC_FREE( pInit );
940 }
941 return pNew;
942}
Gia_Man_t * Gia_ManDupMoveLast(Gia_Man_t *p, int iInsert, int nItems)
Definition giaTim.c:744
void Gia_ManDupCollapse_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Gia_Man_t *pNew)
Definition giaTim.c:787
void Gia_ManCleanupRemap(Gia_Man_t *p, Gia_Man_t *pGia)
Definition giaTim.c:433
int Tim_ManBoxIsBlack(Tim_Man_t *p, int iBox)
Definition timBox.c:258
int Tim_ManBoxOutputNum(Tim_Man_t *p, int iBox)
Definition timBox.c:203
int Tim_ManBoxInputNum(Tim_Man_t *p, int iBox)
Definition timBox.c:187
int Tim_ManCoNum(Tim_Man_t *p)
Definition timMan.c:704
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupConeBack()

int Gia_ManDupConeBack ( Gia_Man_t * p,
Gia_Man_t * pNew,
Vec_Int_t * vCiIds )
extern

Definition at line 2270 of file giaDup.c.

2271{
2272 Gia_Obj_t * pObj, * pRoot; int i;
2273 assert( Gia_ManCiNum(pNew) == Vec_IntSize(vCiIds) );
2274 Gia_ManFillValue(pNew);
2275 Gia_ManConst0(pNew)->Value = 0;
2276 Gia_ManForEachCi( pNew, pObj, i )
2277 pObj->Value = Gia_Obj2Lit( p, Gia_ManCi(p, Vec_IntEntry(vCiIds, i)) );
2278 pRoot = Gia_ManCo(pNew, 0);
2279 Gia_ManDupConeBack_rec( p, pNew, Gia_ObjFanin0(pRoot) );
2280 return Gia_ObjFanin0Copy(pRoot);
2281}
void Gia_ManDupConeBack_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaDup.c:2260
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupConeBackObjs()

int Gia_ManDupConeBackObjs ( Gia_Man_t * p,
Gia_Man_t * pNew,
Vec_Int_t * vObjs )
extern

Definition at line 2282 of file giaDup.c.

2283{
2284 Gia_Obj_t * pObj, * pRoot; int i;
2285 assert( Gia_ManCiNum(pNew) == Vec_IntSize(vObjs) );
2286 Gia_ManFillValue(pNew);
2287 Gia_ManConst0(pNew)->Value = 0;
2288 Gia_ManForEachCi( pNew, pObj, i )
2289 pObj->Value = Abc_Var2Lit( Vec_IntEntry(vObjs, i), 0 );
2290 pRoot = Gia_ManCo(pNew, 0);
2291 Gia_ManDupConeBack_rec( p, pNew, Gia_ObjFanin0(pRoot) );
2292 return Gia_ObjFanin0Copy(pRoot);
2293}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupCones()

Gia_Man_t * Gia_ManDupCones ( Gia_Man_t * p,
int * pPos,
int nPos,
int fTrimPis )
extern

Definition at line 3880 of file giaDup.c.

3881{
3882 Gia_Man_t * pNew;
3883 Vec_Ptr_t * vLeaves, * vNodes, * vRoots;
3884 Gia_Obj_t * pObj;
3885 int i;
3886
3887 // collect initial POs
3888 vLeaves = Vec_PtrAlloc( 100 );
3889 vNodes = Vec_PtrAlloc( 100 );
3890 vRoots = Vec_PtrAlloc( 100 );
3891 for ( i = 0; i < nPos; i++ )
3892 Vec_PtrPush( vRoots, Gia_ManPo(p, pPos[i]) );
3893
3894 // mark internal nodes
3896 Gia_ObjSetTravIdCurrent( p, Gia_ManConst0(p) );
3897 Vec_PtrForEachEntry( Gia_Obj_t *, vRoots, pObj, i )
3898 Gia_ManDupCones_rec( p, pObj, vLeaves, vNodes, vRoots );
3899 Vec_PtrSort( vLeaves, (int (*)(const void *, const void *))Gia_ObjCompareByCioId );
3900
3901 // start the new manager
3902// Gia_ManFillValue( p );
3903 pNew = Gia_ManStart( (fTrimPis ? Vec_PtrSize(vLeaves) : Gia_ManCiNum(p)) + Vec_PtrSize(vNodes) + Vec_PtrSize(vRoots) + 1 );
3904 pNew->pName = Abc_UtilStrsav( p->pName );
3905 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
3906 // map the constant node
3907 Gia_ManConst0(p)->Value = 0;
3908 // create PIs
3909 if ( fTrimPis )
3910 {
3911 Gia_ManForEachPi( p, pObj, i )
3912 pObj->Value = ~0;
3913 Vec_PtrForEachEntry( Gia_Obj_t *, vLeaves, pObj, i )
3914 pObj->Value = Gia_ManAppendCi( pNew );
3915 }
3916 else
3917 {
3918 Gia_ManForEachPi( p, pObj, i )
3919 pObj->Value = Gia_ManAppendCi( pNew );
3920 }
3921 // create LOs
3922 Vec_PtrForEachEntryStart( Gia_Obj_t *, vRoots, pObj, i, nPos )
3923 Gia_ObjRiToRo(p, pObj)->Value = Gia_ManAppendCi( pNew );
3924 // create internal nodes
3925 Vec_PtrForEachEntry( Gia_Obj_t *, vNodes, pObj, i )
3926 if ( Gia_ObjIsXor(pObj) )
3927 pObj->Value = Gia_ManAppendXor( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
3928 else
3929 pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
3930 // create COs
3931 Vec_PtrForEachEntry( Gia_Obj_t *, vRoots, pObj, i )
3932 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
3933 // finalize
3934 Gia_ManSetRegNum( pNew, Vec_PtrSize(vRoots)-nPos );
3935 Vec_PtrFree( vLeaves );
3936 Vec_PtrFree( vNodes );
3937 Vec_PtrFree( vRoots );
3938 return pNew;
3939
3940}
#define Vec_PtrForEachEntryStart(Type, vVec, pEntry, i, Start)
Definition vecPtr.h:57
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupConeSupp()

Gia_Man_t * Gia_ManDupConeSupp ( Gia_Man_t * p,
int iLit,
Vec_Int_t * vCiIds )
extern

Definition at line 2235 of file giaDup.c.

2236{
2237 Gia_Man_t * pNew; int i, iLit0;
2238 Gia_Obj_t * pObj, * pRoot = Gia_ManObj( p, Abc_Lit2Var(iLit) );
2239 Vec_Int_t * vObjs = Vec_IntAlloc( 1000 );
2240 //assert( Gia_ObjIsAnd(pRoot) );
2241 if ( Vec_IntSize(&p->vCopies) < Gia_ManObjNum(p) )
2242 Vec_IntFillExtra( &p->vCopies, Gia_ManObjNum(p), -1 );
2243 pNew = Gia_ManStart( Gia_ManObjNum(p) );
2244 pNew->pName = Abc_UtilStrsav( p->pName );
2245 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
2246 Gia_ManForEachCiVec( vCiIds, p, pObj, i )
2247 Gia_ObjSetCopyArray( p, Gia_ObjId(p, pObj), Gia_ManAppendCi(pNew) );
2248 Gia_ManDupConeSupp_rec( pNew, p, pRoot, vObjs );
2249 iLit0 = Gia_ObjCopyArray( p, Abc_Lit2Var(iLit) );
2250 iLit0 = Abc_LitNotCond( iLit0, Abc_LitIsCompl(iLit) );
2251 Gia_ManAppendCo( pNew, iLit0 );
2252 Gia_ManForEachCiVec( vCiIds, p, pObj, i )
2253 Gia_ObjSetCopyArray( p, Gia_ObjId(p, pObj), -1 );
2254 Gia_ManForEachObjVec( vObjs, p, pObj, i )
2255 Gia_ObjSetCopyArray( p, Gia_ObjId(p, pObj), -1 );
2256 Vec_IntFree( vObjs );
2257 //assert( Vec_IntCountLarger(&p->vCopies, -1) == 0 );
2258 return pNew;
2259}
void Gia_ManDupConeSupp_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vObjs)
Definition giaDup.c:2218
#define Gia_ManForEachCiVec(vVec, p, pObj, i)
Definition gia.h:1232
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupCycled()

Gia_Man_t * Gia_ManDupCycled ( Gia_Man_t * pAig,
Abc_Cex_t * pCex,
int nFrames )
extern

Definition at line 691 of file giaDup.c.

692{
693 Gia_Man_t * pNew;
694 Vec_Bit_t * vInits;
695 Gia_Obj_t * pObj;
696 int i;
698 Gia_ManCycle( p, pCex, nFrames );
699 vInits = Vec_BitAlloc( Gia_ManRegNum(p) );
700 Gia_ManForEachRo( p, pObj, i )
701 Vec_BitPush( vInits, pObj->fMark0 );
702 pNew = Gia_ManDupFlip( p, Vec_BitArray(vInits) );
703 Vec_BitFree( vInits );
705 return pNew;
706}
Gia_Man_t * Gia_ManDupFlip(Gia_Man_t *p, int *pInitState)
Definition giaDup.c:628
void Gia_ManCycle(Gia_Man_t *p, Abc_Cex_t *pCex, int nFrames)
Definition giaDup.c:671
Here is the call graph for this function:

◆ Gia_ManDupDemiter()

Gia_Man_t * Gia_ManDupDemiter ( Gia_Man_t * p,
int fVerbose )
extern

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

Synopsis [Decomposes the miter outputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 4675 of file giaDup.c.

4676{
4677 Vec_Int_t * vSuper;
4678 Vec_Ptr_t * vSuperPtr;
4679 Gia_Man_t * pNew, * pTemp;
4680 Gia_Obj_t * pObj, * pObjPo;
4681 int i, iLit;
4682 assert( Gia_ManPoNum(p) == 1 );
4683 // decompose
4684 pObjPo = Gia_ManPo( p, 0 );
4685 vSuper = Vec_IntAlloc( 100 );
4686 Gia_ManDupWithConstrCollectAnd_rec( p, Gia_ObjFanin0(pObjPo), vSuper, 1 );
4687 assert( Vec_IntSize(vSuper) > 1 );
4688 // report the result
4689 printf( "The miter is %s-decomposable into %d parts.\n", Gia_ObjFaninC0(pObjPo) ? "OR":"AND", Vec_IntSize(vSuper) );
4690 // create levels
4691 Gia_ManLevelNum( p );
4692 Vec_IntForEachEntry( vSuper, iLit, i )
4693 Gia_ManObj(p, Abc_Lit2Var(iLit))->Value = Gia_ObjLevelId(p, Abc_Lit2Var(iLit));
4694 // create pointer array
4695 vSuperPtr = Vec_PtrAlloc( Vec_IntSize(vSuper) );
4696 Vec_IntForEachEntry( vSuper, iLit, i )
4697 Vec_PtrPush( vSuperPtr, Gia_Lit2Obj(p, iLit) );
4698 Vec_PtrSort( vSuperPtr, (int (*)(const void *, const void *))Gia_ManSortByValue );
4699 // create new manager
4700 pNew = Gia_ManStart( Gia_ManObjNum(p) );
4701 pNew->pName = Abc_UtilStrsav( p->pName );
4702 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
4703 Gia_ManConst0(p)->Value = 0;
4704 Gia_ManHashAlloc( pNew );
4705 Gia_ManForEachCi( p, pObj, i )
4706 pObj->Value = Gia_ManAppendCi( pNew );
4707 Gia_ManForEachAnd( p, pObj, i )
4708 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
4709 // create the outputs
4710 Vec_PtrForEachEntry( Gia_Obj_t *, vSuperPtr, pObj, i )
4711 Gia_ManAppendCo( pNew, Gia_ObjLitCopy(p, Gia_Obj2Lit(p, pObj)) ^ Gia_ObjFaninC0(pObjPo) );
4712 Gia_ManForEachRi( p, pObj, i )
4713 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
4714 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
4715 // rehash
4716 pNew = Gia_ManCleanup( pTemp = pNew );
4717 Gia_ManStop( pTemp );
4718 Vec_IntFree( vSuper );
4719 Vec_PtrFree( vSuperPtr );
4720 return pNew;
4721}
int Gia_ManSortByValue(Gia_Obj_t **pp1, Gia_Obj_t **pp2)
Definition giaDup.c:4345
void Gia_ManDupWithConstrCollectAnd_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vSuper, int fFirst)
Definition giaDup.c:4259
Here is the call graph for this function:

◆ Gia_ManDupDfs()

Gia_Man_t * Gia_ManDupDfs ( Gia_Man_t * p)
extern

Definition at line 1748 of file giaDup.c.

1749{
1750 Gia_Man_t * pNew;
1751 Gia_Obj_t * pObj;
1752 int i;
1753 pNew = Gia_ManStart( Gia_ManObjNum(p) );
1754 pNew->pName = Abc_UtilStrsav( p->pName );
1755 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1757 Gia_ManConst0(p)->Value = 0;
1758 Gia_ManForEachCi( p, pObj, i )
1759 pObj->Value = Gia_ManAppendCi(pNew);
1760 Gia_ManForEachCo( p, pObj, i )
1761 Gia_ManDupDfs_rec( pNew, p, Gia_ObjFanin0(pObj) );
1762 Gia_ManForEachCo( p, pObj, i )
1763 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1764 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
1765 pNew->nConstrs = p->nConstrs;
1766 if ( p->pCexSeq )
1767 pNew->pCexSeq = Abc_CexDup( p->pCexSeq, Gia_ManRegNum(p) );
1768 return pNew;
1769}
void Gia_ManDupDfs_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaDup.c:1739
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupDfsCiMap()

Gia_Man_t * Gia_ManDupDfsCiMap ( Gia_Man_t * p,
int * pCi2Lit,
Vec_Int_t * vLits )
extern

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

Synopsis [Duplicates AIG in the DFS order.]

Description []

SideEffects []

SeeAlso []

Definition at line 2708 of file giaDup.c.

2709{
2710 Gia_Man_t * pNew;
2711 Gia_Obj_t * pObj;
2712 int i;
2714 pNew = Gia_ManStart( Gia_ManObjNum(p) );
2715 pNew->pName = Abc_UtilStrsav( p->pName );
2716 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
2717 Gia_ManConst0(p)->Value = 0;
2718 Gia_ManForEachCi( p, pObj, i )
2719 {
2720 pObj->Value = Gia_ManAppendCi(pNew);
2721 if ( ~pCi2Lit[i] )
2722 pObj->Value = Abc_LitNotCond( Gia_ManObj(p, Abc_Lit2Var(pCi2Lit[i]))->Value, Abc_LitIsCompl(pCi2Lit[i]) );
2723 }
2724 Gia_ManHashAlloc( pNew );
2725 if ( vLits )
2726 {
2727 int iLit, iLitRes;
2728 Vec_IntForEachEntry( vLits, iLit, i )
2729 {
2730 iLitRes = Gia_ManDupDfs2_rec( pNew, p, Gia_ManObj(p, Abc_Lit2Var(iLit)) );
2731 Gia_ManAppendCo( pNew, Abc_LitNotCond( iLitRes, Abc_LitIsCompl(iLit)) );
2732 }
2733 }
2734 else
2735 {
2736 Gia_ManForEachCo( p, pObj, i )
2737 {
2738 Gia_ManDupDfs2_rec( pNew, p, Gia_ObjFanin0(pObj) );
2739 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
2740 }
2741 }
2742 Gia_ManHashStop( pNew );
2743 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
2744 return pNew;
2745}
int Gia_ManDupDfs2_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaDup.c:1668
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupDfsClasses()

Gia_Man_t * Gia_ManDupDfsClasses ( Gia_Man_t * p)
extern

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

Synopsis [Duplicates AIG in the DFS order.]

Description []

SideEffects []

SeeAlso []

Definition at line 2795 of file giaDup.c.

2796{
2797 Gia_Man_t * pNew, * pTemp;
2798 Gia_Obj_t * pObj;
2799 int i;
2800 assert( p->pReprsOld != NULL );
2802 pNew = Gia_ManStart( Gia_ManObjNum(p) );
2803 pNew->pName = Abc_UtilStrsav( p->pName );
2804 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
2805 Gia_ManConst0(p)->Value = 0;
2806 Gia_ManForEachCi( p, pObj, i )
2807 pObj->Value = Gia_ManAppendCi(pNew);
2808 Gia_ManHashAlloc( pNew );
2809 Gia_ManForEachCo( p, pObj, i )
2810 Gia_ManDupDfs_rec( pNew, p, pObj );
2811 Gia_ManHashStop( pNew );
2812 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
2813 pNew = Gia_ManCleanup( pTemp = pNew );
2814 Gia_ManStop( pTemp );
2815 return pNew;
2816}
Here is the call graph for this function:

◆ Gia_ManDupDfsCone()

Gia_Man_t * Gia_ManDupDfsCone ( Gia_Man_t * p,
Gia_Obj_t * pRoot )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 2188 of file giaDup.c.

2189{
2190 Gia_Man_t * pNew;
2191 Gia_Obj_t * pObj;
2192 int i;
2193 assert( Gia_ObjIsCo(pRoot) );
2195 pNew = Gia_ManStart( Gia_ManObjNum(p) );
2196 pNew->pName = Abc_UtilStrsav( p->pName );
2197 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
2198 Gia_ManConst0(p)->Value = 0;
2199 Gia_ManForEachCi( p, pObj, i )
2200 pObj->Value = Gia_ManAppendCi(pNew);
2201 Gia_ManDupDfs_rec( pNew, p, Gia_ObjFanin0(pRoot) );
2202 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pRoot) );
2203 Gia_ManSetRegNum( pNew, 0 );
2204 return pNew;
2205}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupDfsLitArray()

Gia_Man_t * Gia_ManDupDfsLitArray ( Gia_Man_t * p,
Vec_Int_t * vLits )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 2346 of file giaDup.c.

2347{
2348 Gia_Man_t * pNew;
2349 Gia_Obj_t * pObj;
2350 int i, iLit, iLitRes;
2352 pNew = Gia_ManStart( Gia_ManObjNum(p) );
2353 pNew->pName = Abc_UtilStrsav( p->pName );
2354 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
2355 Gia_ManConst0(p)->Value = 0;
2356 Gia_ManForEachCi( p, pObj, i )
2357 pObj->Value = Gia_ManAppendCi(pNew);
2358 Vec_IntForEachEntry( vLits, iLit, i )
2359 {
2360 iLitRes = Gia_ManDupDfs2_rec( pNew, p, Gia_ManObj(p, Abc_Lit2Var(iLit)) );
2361 Gia_ManAppendCo( pNew, Abc_LitNotCond( iLitRes, Abc_LitIsCompl(iLit)) );
2362 }
2363 Gia_ManSetRegNum( pNew, 0 );
2364 return pNew;
2365}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupDfsNode()

Gia_Man_t * Gia_ManDupDfsNode ( Gia_Man_t * p,
Gia_Obj_t * pObj )
extern

Definition at line 2321 of file giaDup.c.

2322{
2323 Gia_Man_t * pNew;
2324 assert( Gia_ObjIsAnd(pRoot) );
2326 pNew = Gia_ManStart( Gia_ManObjNum(p) );
2327 pNew->pName = Abc_UtilStrsav( p->pName );
2328 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
2329 Gia_ManConst0(p)->Value = 0;
2330 Gia_ManDupDfs3_rec( pNew, p, pRoot );
2331 Gia_ManAppendCo( pNew, pRoot->Value );
2332 return pNew;
2333}
void Gia_ManDupDfs3_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaDup.c:2307
Here is the call graph for this function:

◆ Gia_ManDupDfsOnePo()

Gia_Man_t * Gia_ManDupDfsOnePo ( Gia_Man_t * p,
int iPo )
extern

Definition at line 1770 of file giaDup.c.

1771{
1772 Gia_Man_t * pNew, * pTemp;
1773 Gia_Obj_t * pObj;
1774 int i;
1775 assert( iPo >= 0 && iPo < Gia_ManPoNum(p) );
1776 pNew = Gia_ManStart( Gia_ManObjNum(p) );
1777 pNew->pName = Abc_UtilStrsav( p->pName );
1778 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1780 Gia_ManConst0(p)->Value = 0;
1781 Gia_ManForEachCi( p, pObj, i )
1782 pObj->Value = Gia_ManAppendCi(pNew);
1783 Gia_ManForEachCo( p, pObj, i )
1784 if ( !Gia_ObjIsPo(p, pObj) || i == iPo )
1785 Gia_ManDupDfs_rec( pNew, p, Gia_ObjFanin0(pObj) );
1786 Gia_ManForEachCo( p, pObj, i )
1787 if ( !Gia_ObjIsPo(p, pObj) || i == iPo )
1788 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1789 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
1790 pNew = Gia_ManCleanup( pTemp = pNew );
1791 Gia_ManStop( pTemp );
1792 return pNew;
1793}
Here is the call graph for this function:

◆ Gia_ManDupDfsRehash()

Gia_Man_t * Gia_ManDupDfsRehash ( Gia_Man_t * p)
extern

Definition at line 1815 of file giaDup.c.

1816{
1817 Gia_Man_t * pNew, * pTemp;
1818 Gia_Obj_t * pObj;
1819 int i;
1820 pNew = Gia_ManStart( Gia_ManObjNum(p) );
1821 pNew->pName = Abc_UtilStrsav( p->pName );
1822 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1824 Gia_ManConst0(p)->Value = 0;
1825 Gia_ManForEachCi( p, pObj, i )
1826 pObj->Value = Gia_ManAppendCi(pNew);
1827 Gia_ManHashAlloc( pNew );
1828 Gia_ManForEachCo( p, pObj, i )
1829 Gia_ManDupDfsRehash_rec( pNew, p, Gia_ObjFanin0(pObj) );
1830 Gia_ManForEachCo( p, pObj, i )
1831 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1832 pNew = Gia_ManCleanup( pTemp = pNew );
1833 Gia_ManStop( pTemp );
1834 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
1835 pNew->nConstrs = p->nConstrs;
1836 if ( p->pCexSeq )
1837 pNew->pCexSeq = Abc_CexDup( p->pCexSeq, Gia_ManRegNum(p) );
1838 return pNew;
1839}
void Gia_ManDupDfsRehash_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaDup.c:1806
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupDfsSkip()

Gia_Man_t * Gia_ManDupDfsSkip ( Gia_Man_t * p)
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 2158 of file giaDup.c.

2159{
2160 Gia_Man_t * pNew;
2161 Gia_Obj_t * pObj;
2162 int i;
2164 pNew = Gia_ManStart( Gia_ManObjNum(p) );
2165 pNew->pName = Abc_UtilStrsav( p->pName );
2166 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
2167 Gia_ManConst0(p)->Value = 0;
2168 Gia_ManForEachCi( p, pObj, i )
2169 pObj->Value = Gia_ManAppendCi(pNew);
2170 Gia_ManForEachCo( p, pObj, i )
2171 if ( pObj->fMark1 == 0 )
2172 Gia_ManDupDfs_rec( pNew, p, pObj );
2173 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
2174 return pNew;
2175}
Here is the call graph for this function:

◆ Gia_ManDupExist()

Gia_Man_t * Gia_ManDupExist ( Gia_Man_t * p,
int iVar )
extern

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

Synopsis [Existentially quantified given variable.]

Description []

SideEffects []

SeeAlso []

Definition at line 2012 of file giaDup.c.

2013{
2014 Gia_Man_t * pNew, * pTemp;
2015 Gia_Obj_t * pObj;
2016 int i;
2017 assert( iVar >= 0 && iVar < Gia_ManPiNum(p) );
2018 assert( Gia_ManPoNum(p) == 1 );
2019 assert( Gia_ManRegNum(p) == 0 );
2021 // find the cofactoring variable
2022 pNew = Gia_ManStart( Gia_ManObjNum(p) );
2023 pNew->pName = Abc_UtilStrsav( p->pName );
2024 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
2025 Gia_ManHashAlloc( pNew );
2026 // compute negative cofactor
2027 Gia_ManConst0(p)->Value = 0;
2028 Gia_ManForEachCi( p, pObj, i )
2029 pObj->Value = Gia_ManAppendCi(pNew);
2030 Gia_ManPi( p, iVar )->Value = Abc_Var2Lit( 0, 0 );
2031 Gia_ManForEachAnd( p, pObj, i )
2032 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
2033 Gia_ManForEachPo( p, pObj, i )
2034 pObj->Value = Gia_ObjFanin0Copy(pObj);
2035 // compute the positive cofactor
2036 Gia_ManPi( p, iVar )->Value = Abc_Var2Lit( 0, 1 );
2037 Gia_ManForEachAnd( p, pObj, i )
2038 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
2039 // create OR gate
2040 Gia_ManForEachPo( p, pObj, i )
2041 pObj->Value = Gia_ManAppendCo( pNew, Gia_ManHashOr(pNew, Gia_ObjFanin0Copy(pObj), pObj->Value) );
2042 Gia_ManHashStop( pNew );
2043 pNew = Gia_ManCleanup( pTemp = pNew );
2044 Gia_ManStop( pTemp );
2045 return pNew;
2046}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupFlip()

Gia_Man_t * Gia_ManDupFlip ( Gia_Man_t * p,
int * pInitState )
extern

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 628 of file giaDup.c.

629{
630 Gia_Man_t * pNew;
631 Gia_Obj_t * pObj;
632 int i;
633 pNew = Gia_ManStart( Gia_ManObjNum(p) );
634 pNew->pName = Abc_UtilStrsav( p->pName );
635 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
636 Gia_ManConst0(p)->Value = 0;
637 Gia_ManForEachObj1( p, pObj, i )
638 {
639 if ( Gia_ObjIsAnd(pObj) )
640 pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
641 else if ( Gia_ObjIsCi(pObj) )
642 {
643 pObj->Value = Gia_ManAppendCi( pNew );
644 if ( Gia_ObjCioId(pObj) >= Gia_ManPiNum(p) )
645 pObj->Value = Abc_LitNotCond( pObj->Value, Abc_InfoHasBit((unsigned *)pInitState, Gia_ObjCioId(pObj) - Gia_ManPiNum(p)) );
646 }
647 else if ( Gia_ObjIsCo(pObj) )
648 {
649 pObj->Value = Gia_ObjFanin0Copy(pObj);
650 if ( Gia_ObjCioId(pObj) >= Gia_ManPoNum(p) )
651 pObj->Value = Abc_LitNotCond( pObj->Value, Abc_InfoHasBit((unsigned *)pInitState, Gia_ObjCioId(pObj) - Gia_ManPoNum(p)) );
652 pObj->Value = Gia_ManAppendCo( pNew, pObj->Value );
653 }
654 }
655 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
656 return pNew;
657}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupFlopClass()

Gia_Man_t * Gia_ManDupFlopClass ( Gia_Man_t * p,
int iClass )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 1399 of file giaDup.c.

1400{
1401 Gia_Man_t * pNew;
1402 Gia_Obj_t * pObj;
1403 int i, Counter1 = 0, Counter2 = 0;
1404 assert( p->vFlopClasses != NULL );
1405 pNew = Gia_ManStart( Gia_ManObjNum(p) );
1406 pNew->pName = Abc_UtilStrsav( p->pName );
1407 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1409 Gia_ManConst0(p)->Value = 0;
1410 Gia_ManForEachPi( p, pObj, i )
1411 pObj->Value = Gia_ManAppendCi( pNew );
1412 Gia_ManForEachRo( p, pObj, i )
1413 if ( Vec_IntEntry(p->vFlopClasses, i) != iClass )
1414 pObj->Value = Gia_ManAppendCi( pNew );
1415 Gia_ManForEachRo( p, pObj, i )
1416 if ( Vec_IntEntry(p->vFlopClasses, i) == iClass )
1417 pObj->Value = Gia_ManAppendCi( pNew ), Counter1++;
1418 Gia_ManForEachAnd( p, pObj, i )
1419 pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1420 Gia_ManForEachPo( p, pObj, i )
1421 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1422 Gia_ManForEachRi( p, pObj, i )
1423 if ( Vec_IntEntry(p->vFlopClasses, i) != iClass )
1424 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1425 Gia_ManForEachRi( p, pObj, i )
1426 if ( Vec_IntEntry(p->vFlopClasses, i) == iClass )
1427 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) ), Counter2++;
1428 assert( Counter1 == Counter2 );
1429 Gia_ManSetRegNum( pNew, Counter1 );
1430 return pNew;
1431}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupFromVecs()

Gia_Man_t * Gia_ManDupFromVecs ( Gia_Man_t * p,
Vec_Int_t * vCis,
Vec_Int_t * vAnds,
Vec_Int_t * vCos,
int nRegs )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 4176 of file giaDup.c.

4177{
4178 Gia_Man_t * pNew;
4179 Gia_Obj_t * pObj;
4180 int i;
4181 // start the new manager
4182 pNew = Gia_ManStart( 5000 );
4183 pNew->pName = Abc_UtilStrsav( p->pName );
4184 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
4185 // create constant
4186 Gia_ManConst0(p)->Value = 0;
4187 // create PIs
4188 Gia_ManForEachObjVec( vCis, p, pObj, i )
4189 pObj->Value = Gia_ManAppendCi( pNew );
4190 // create internal nodes
4191 Gia_ManForEachObjVec( vAnds, p, pObj, i )
4192 pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
4193 // create ROs
4194 Gia_ManForEachObjVec( vCos, p, pObj, i )
4195 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
4196 Gia_ManSetRegNum( pNew, nRegs );
4197 return pNew;
4198}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupHashMapping()

Gia_Man_t * Gia_ManDupHashMapping ( Gia_Man_t * p)
extern

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

Synopsis [Performs hashing for a mapped AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 2772 of file giaIf.c.

2773{
2774 Gia_Man_t * pNew;
2775 Vec_Int_t * vMapping;
2776 Gia_Obj_t * pObj, * pFanin;
2777 int i, k;
2778 assert( Gia_ManHasMapping(p) );
2779 // copy the old manager with hashing
2780 pNew = Gia_ManStart( Gia_ManObjNum(p) );
2781 pNew->pName = Abc_UtilStrsav( p->pName );
2782 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
2783 Gia_ManHashAlloc( pNew );
2785 Gia_ManConst0(p)->Value = 0;
2786 Gia_ManForEachCi( p, pObj, i )
2787 pObj->Value = Gia_ManAppendCi( pNew );
2788 Gia_ManForEachAnd( p, pObj, i )
2789 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
2790 Gia_ManForEachCo( p, pObj, i )
2791 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
2792 Gia_ManHashStop( pNew );
2793 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
2794 // recreate mapping
2795 vMapping = Vec_IntAlloc( Vec_IntSize(p->vMapping) );
2796 Vec_IntFill( vMapping, Gia_ManObjNum(p), 0 );
2797 Gia_ManForEachLut( p, i )
2798 {
2799 pObj = Gia_ManObj( p, i );
2800 Vec_IntWriteEntry( vMapping, Abc_Lit2Var(pObj->Value), Vec_IntSize(vMapping) );
2801 Vec_IntPush( vMapping, Gia_ObjLutSize(p, i) );
2802 Gia_LutForEachFaninObj( p, i, pFanin, k )
2803 Vec_IntPush( vMapping, Abc_Lit2Var(pFanin->Value) );
2804 Vec_IntPush( vMapping, Abc_Lit2Var(pObj->Value) );
2805 }
2806 pNew->vMapping = vMapping;
2807 return pNew;
2808}
#define Gia_LutForEachFaninObj(p, i, pFanin, k)
Definition gia.h:1165
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupLastPis()

Gia_Man_t * Gia_ManDupLastPis ( Gia_Man_t * p,
int nLastPis )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 597 of file giaDup.c.

598{
599 Gia_Man_t * pNew;
600 Gia_Obj_t * pObj;
601 int i;
602 assert( Gia_ManRegNum(p) == 0 );
603 pNew = Gia_ManStart( Gia_ManObjNum(p) );
604 pNew->pName = Abc_UtilStrsav( p->pName );
605 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
606 Gia_ManConst0(p)->Value = 0;
607 Gia_ManForEachCi( p, pObj, i )
608 pObj->Value = (i < Gia_ManCiNum(p) - nLastPis) ? ~0 : Gia_ManAppendCi(pNew);
609 Gia_ManForEachAnd( p, pObj, i )
610 pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
611 Gia_ManForEachCo( p, pObj, i )
612 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
613 return pNew;
614}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupLevelized()

Gia_Man_t * Gia_ManDupLevelized ( Gia_Man_t * p)
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 4135 of file giaDup.c.

4136{
4137 Gia_Man_t * pNew;
4138 Gia_Obj_t * pObj;
4139 int i, nLevels = Gia_ManLevelNum( p );
4140 int * pCounts = ABC_CALLOC( int, nLevels + 1 );
4141 int * pNodes = ABC_ALLOC( int, Gia_ManAndNum(p) );
4142 Gia_ManForEachAnd( p, pObj, i )
4143 pCounts[Gia_ObjLevel(p, pObj)]++;
4144 for ( i = 1; i <= nLevels; i++ )
4145 pCounts[i] += pCounts[i-1];
4146 Gia_ManForEachAnd( p, pObj, i )
4147 pNodes[pCounts[Gia_ObjLevel(p, pObj)-1]++] = i;
4148 // duplicate
4149 pNew = Gia_ManStart( Gia_ManObjNum(p) );
4150 pNew->pName = Abc_UtilStrsav( p->pName );
4151 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
4152 Gia_ManConst0(p)->Value = 0;
4153 Gia_ManForEachCi( p, pObj, i )
4154 pObj->Value = Gia_ManAppendCi( pNew );
4155 for ( i = 0; i < Gia_ManAndNum(p) && (pObj = Gia_ManObj(p, pNodes[i])); i++ )
4156 pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
4157 Gia_ManForEachCo( p, pObj, i )
4158 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
4159 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
4160 ABC_FREE( pCounts );
4161 ABC_FREE( pNodes );
4162 return pNew;
4163}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupMap()

Gia_Man_t * Gia_ManDupMap ( Gia_Man_t * p,
Vec_Int_t * vMap )
extern

Definition at line 846 of file giaDup.c.

847{
848 Gia_Man_t * pNew, * pTemp;
849 Gia_Obj_t * pObj;
850 int i;
851 pNew = Gia_ManStart( Gia_ManObjNum(p) );
852 pNew->pName = Abc_UtilStrsav( p->pName );
853 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
854 Gia_ManConst0(p)->Value = 0;
855 Gia_ManHashAlloc( pNew );
856 Gia_ManForEachObj1( p, pObj, i )
857 {
858 if ( Vec_IntEntry(vMap, i) >= 0 )
859 pObj->Value = Gia_ManObj( p, Vec_IntEntry(vMap, i) )->Value;
860 else if ( Gia_ObjIsAnd(pObj) )
861 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
862 else if ( Gia_ObjIsCi(pObj) )
863 pObj->Value = Gia_ManAppendCi( pNew );
864 else if ( Gia_ObjIsCo(pObj) )
865 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
866 }
867 pNew = Gia_ManCleanup( pTemp = pNew );
868 Gia_ManStop( pTemp );
869 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
870 return pNew;
871}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupMarked()

Gia_Man_t * Gia_ManDupMarked ( Gia_Man_t * p)
extern

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

Synopsis [Duplicates AIG without any changes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1444 of file giaDup.c.

1445{
1446 Gia_Man_t * pNew;
1447 Gia_Obj_t * pObj;
1448 int i, nRos = 0, nRis = 0;
1449 int CountMarked = 0;
1450 Gia_ManForEachObj( p, pObj, i )
1451 CountMarked += pObj->fMark0;
1453 pNew = Gia_ManStart( Gia_ManObjNum(p) - CountMarked );
1454 if ( p->pMuxes )
1455 pNew->pMuxes = ABC_CALLOC( unsigned, pNew->nObjsAlloc );
1456 pNew->nConstrs = p->nConstrs;
1457 pNew->pName = Abc_UtilStrsav( p->pName );
1458 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1459 Gia_ManConst0(p)->Value = 0;
1460 Gia_ManForEachObj1( p, pObj, i )
1461 {
1462 if ( pObj->fMark0 )
1463 {
1464 assert( !Gia_ObjIsBuf(pObj) );
1465 pObj->fMark0 = 0;
1466 continue;
1467 }
1468 if ( Gia_ObjIsBuf(pObj) )
1469 pObj->Value = Gia_ManAppendBuf( pNew, Gia_ObjFanin0Copy(pObj) );
1470 else if ( Gia_ObjIsAnd(pObj) )
1471 {
1472 if ( Gia_ObjIsXor(pObj) )
1473 pObj->Value = Gia_ManAppendXorReal( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1474 else if ( Gia_ObjIsMux(p, pObj) )
1475 pObj->Value = Gia_ManAppendMuxReal( pNew, Gia_ObjFanin2Copy(p, pObj), Gia_ObjFanin1Copy(pObj), Gia_ObjFanin0Copy(pObj) );
1476 else
1477 pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1478 }
1479 else if ( Gia_ObjIsCi(pObj) )
1480 {
1481 pObj->Value = Gia_ManAppendCi( pNew );
1482 nRos += Gia_ObjIsRo(p, pObj);
1483 }
1484 else if ( Gia_ObjIsCo(pObj) )
1485 {
1486// Gia_Obj_t * pFanin = Gia_ObjFanin0(pObj);
1487 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1488 nRis += Gia_ObjIsRi(p, pObj);
1489 }
1490 }
1491 assert( pNew->nObjsAlloc == pNew->nObjs );
1492 assert( nRos == nRis );
1493 Gia_ManSetRegNum( pNew, nRos );
1494 if ( p->pReprs && p->pNexts )
1495 {
1496 Gia_Obj_t * pRepr;
1497 pNew->pReprs = ABC_CALLOC( Gia_Rpr_t, Gia_ManObjNum(pNew) );
1498 for ( i = 0; i < Gia_ManObjNum(pNew); i++ )
1499 Gia_ObjSetRepr( pNew, i, GIA_VOID );
1500 Gia_ManForEachObj1( p, pObj, i )
1501 {
1502 if ( !~pObj->Value )
1503 continue;
1504 pRepr = Gia_ObjReprObj( p, i );
1505 if ( pRepr == NULL )
1506 continue;
1507 if ( !~pRepr->Value )
1508 continue;
1509 assert( !Gia_ObjIsBuf(pObj) );
1510 if ( Abc_Lit2Var(pObj->Value) != Abc_Lit2Var(pRepr->Value) )
1511 Gia_ObjSetRepr( pNew, Abc_Lit2Var(pObj->Value), Abc_Lit2Var(pRepr->Value) );
1512 }
1513 pNew->pNexts = Gia_ManDeriveNexts( pNew );
1514 }
1515 if ( Gia_ManHasChoices(p) )
1516 {
1517 Gia_Obj_t * pSibl;
1518 pNew->pSibls = ABC_CALLOC( int, Gia_ManObjNum(pNew) );
1519 Gia_ManForEachObj1( p, pObj, i )
1520 {
1521 if ( !~pObj->Value )
1522 continue;
1523 pSibl = Gia_ObjSiblObj( p, i );
1524 if ( pSibl == NULL )
1525 continue;
1526 if ( !~pSibl->Value )
1527 continue;
1528 assert( !Gia_ObjIsBuf(pObj) );
1529 assert( Abc_Lit2Var(pObj->Value) > Abc_Lit2Var(pSibl->Value) );
1530 pNew->pSibls[Abc_Lit2Var(pObj->Value)] = Abc_Lit2Var(pSibl->Value);
1531 }
1532 }
1533 return pNew;
1534}
unsigned * pMuxes
Definition gia.h:106
int nObjsAlloc
Definition gia.h:104
int nObjs
Definition gia.h:103
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupMux()

Gia_Man_t * Gia_ManDupMux ( int iVar,
Gia_Man_t * pCof1,
Gia_Man_t * pCof0 )
extern

Definition at line 1887 of file giaDup.c.

1888{
1889 Gia_Man_t * pGia[2] = {pCof0, pCof1};
1890 Gia_Man_t * pNew, * pTemp;
1891 Gia_Obj_t * pObj;
1892 int i, n;
1893 assert( Gia_ManRegNum(pCof0) == 0 );
1894 assert( Gia_ManRegNum(pCof1) == 0 );
1895 assert( Gia_ManCoNum(pCof0) == 1 );
1896 assert( Gia_ManCoNum(pCof1) == 1 );
1897 assert( Gia_ManCiNum(pCof1) == Gia_ManCiNum(pCof0) );
1898 assert( iVar >= 0 && iVar < Gia_ManCiNum(pCof1) );
1899 pNew = Gia_ManStart( Gia_ManObjNum(pCof1) + Gia_ManObjNum(pCof0) );
1900 pNew->pName = Abc_UtilStrsav( pCof1->pName );
1901 pNew->pSpec = Abc_UtilStrsav( pCof1->pSpec );
1902 Gia_ManHashAlloc( pNew );
1903 for ( n = 0; n < 2; n++ )
1904 {
1905 Gia_ManFillValue( pGia[n] );
1906 Gia_ManConst0(pGia[n])->Value = 0;
1907 Gia_ManForEachCi( pGia[n], pObj, i )
1908 pObj->Value = n ? Gia_ManCi(pGia[0], i)->Value : Gia_ManAppendCi(pNew);
1909 Gia_ManForEachCo( pGia[n], pObj, i )
1910 Gia_ManDupCofactorVar_rec( pNew, pGia[n], Gia_ObjFanin0(pObj) );
1911 }
1912 Gia_ManForEachCo( pGia[0], pObj, i )
1913 {
1914 int Ctrl = Gia_ManCi(pGia[0], iVar)->Value;
1915 int Lit1 = Gia_ObjFanin0Copy(Gia_ManCo(pGia[1], i));
1916 int Lit0 = Gia_ObjFanin0Copy(pObj);
1917 Gia_ManAppendCo( pNew, Gia_ManHashMux( pNew, Ctrl, Lit1, Lit0 ) );
1918 }
1919 pNew = Gia_ManCleanup( pTemp = pNew );
1920 Gia_ManStop( pTemp );
1921 return pNew;
1922}
int Gia_ManHashMux(Gia_Man_t *p, int iCtrl, int iData1, int iData0)
Definition giaHash.c:692
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupMuxes()

Gia_Man_t * Gia_ManDupMuxes ( Gia_Man_t * p,
int Limit )
extern

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

Synopsis [Derives GIA with MUXes.]

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

SideEffects []

SeeAlso []

Definition at line 98 of file giaMuxes.c.

99{
100 Gia_Man_t * pNew, * pTemp;
101 Gia_Obj_t * pObj, * pFan0, * pFan1, * pFanC, * pSiblNew, * pObjNew;
102 int i;
103 assert( p->pMuxes == NULL );
104 assert( Limit >= 0 ); // allows to create AIG with XORs without MUXes
105 ABC_FREE( p->pRefs );
107 // start the new manager
108 pNew = Gia_ManStart( Gia_ManObjNum(p) );
109 pNew->pName = Abc_UtilStrsav( p->pName );
110 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
111 pNew->pMuxes = ABC_CALLOC( unsigned, pNew->nObjsAlloc );
112 if ( Gia_ManHasChoices(p) )
113 pNew->pSibls = ABC_CALLOC( int, pNew->nObjsAlloc );
114 Gia_ManConst0(p)->Value = 0;
115 Gia_ManHashStart( pNew );
116 Gia_ManForEachObj1( p, pObj, i )
117 {
118 if ( Gia_ObjIsCi(pObj) )
119 pObj->Value = Gia_ManAppendCi( pNew );
120 else if ( Gia_ObjIsCo(pObj) )
121 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
122 else if ( Gia_ObjIsBuf(pObj) )
123 pObj->Value = Gia_ManAppendBuf( pNew, Gia_ObjFanin0Copy(pObj) );
124 else if ( !Gia_ObjIsMuxType(pObj) || Gia_ObjSibl(p, Gia_ObjFaninId0(pObj, i)) || Gia_ObjSibl(p, Gia_ObjFaninId1(pObj, i)) )
125 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
126 else if ( Gia_ObjRecognizeExor(pObj, &pFan0, &pFan1) )
127 pObj->Value = Gia_ManHashXorReal( pNew, Gia_ObjLitCopy(p, Gia_ObjToLit(p, pFan0)), Gia_ObjLitCopy(p, Gia_ObjToLit(p, pFan1)) );
128 else if ( Gia_ObjRefNum(p, Gia_ObjFanin0(pObj)) + Gia_ObjRefNum(p, Gia_ObjFanin1(pObj)) > Limit )
129 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
130 else
131 {
132 pFanC = Gia_ObjRecognizeMux( pObj, &pFan1, &pFan0 );
133 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)) );
134 }
135 if ( !Gia_ObjSibl(p, i) )
136 continue;
137 pObjNew = Gia_ManObj( pNew, Abc_Lit2Var(pObj->Value) );
138 pSiblNew = Gia_ManObj( pNew, Abc_Lit2Var(Gia_ObjSiblObj(p, i)->Value) );
139 if ( Gia_ObjIsAnd(pObjNew) && Gia_ObjIsAnd(pSiblNew) && Gia_ObjId(pNew, pObjNew) > Gia_ObjId(pNew, pSiblNew) )
140 pNew->pSibls[Gia_ObjId(pNew, pObjNew)] = Gia_ObjId(pNew, pSiblNew);
141 }
142 Gia_ManHashStop( pNew );
143 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
144 // perform cleanup
145 pNew = Gia_ManCleanup( pTemp = pNew );
146 Gia_ManStop( pTemp );
147 return pNew;
148}
int Gia_ManHashMuxReal(Gia_Man_t *p, int iLitC, int iLit1, int iLit0)
Definition giaHash.c:521
int Gia_ManHashXorReal(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:469
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupNoBuf()

Gia_Man_t * Gia_ManDupNoBuf ( Gia_Man_t * p)
extern

Definition at line 823 of file giaDup.c.

824{
825 Gia_Man_t * pNew;
826 Gia_Obj_t * pObj;
827 int i;
828 pNew = Gia_ManStart( Gia_ManObjNum(p) );
829 pNew->pName = Abc_UtilStrsav( p->pName );
830 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
831 Gia_ManConst0(p)->Value = 0;
832 Gia_ManForEachObj1( p, pObj, i )
833 {
834 if ( Gia_ObjIsBuf(pObj) )
835 pObj->Value = Gia_ObjFanin0Copy(pObj);
836 else if ( Gia_ObjIsAnd(pObj) )
837 pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
838 else if ( Gia_ObjIsCi(pObj) )
839 pObj->Value = Gia_ManAppendCi( pNew );
840 else if ( Gia_ObjIsCo(pObj) )
841 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
842 }
843 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
844 return pNew;
845}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupNoMuxes()

Gia_Man_t * Gia_ManDupNoMuxes ( Gia_Man_t * p,
int fSkipBufs )
extern

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

Synopsis [Derives GIA without MUXes.]

Description []

SideEffects []

SeeAlso []

Definition at line 228 of file giaMuxes.c.

229{
230 Gia_Man_t * pNew, * pTemp;
231 Gia_Obj_t * pObj;
232 int i;
233 assert( p->pMuxes != NULL || Gia_ManXorNum(p) );
234 // start the new manager
235 pNew = Gia_ManStart( 5000 );
236 pNew->pName = Abc_UtilStrsav( p->pName );
237 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
238 Gia_ManConst0(p)->Value = 0;
239 Gia_ManHashStart( pNew );
240 Gia_ManForEachObj1( p, pObj, i )
241 {
242 if ( Gia_ObjIsCi(pObj) )
243 pObj->Value = Gia_ManAppendCi( pNew );
244 else if ( Gia_ObjIsCo(pObj) )
245 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
246 else if ( Gia_ObjIsBuf(pObj) )
247 pObj->Value = fSkipBufs ? Gia_ObjFanin0Copy(pObj) : Gia_ManAppendBuf( pNew, Gia_ObjFanin0Copy(pObj) );
248 else if ( Gia_ObjIsMuxId(p, i) )
249 pObj->Value = Gia_ManHashMux( pNew, Gia_ObjFanin2Copy(p, pObj), Gia_ObjFanin1Copy(pObj), Gia_ObjFanin0Copy(pObj) );
250 else if ( Gia_ObjIsXor(pObj) )
251 pObj->Value = Gia_ManHashXor( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
252 else
253 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
254 }
255 Gia_ManHashStop( pNew );
256 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
257 // perform cleanup
258 pNew = Gia_ManCleanup( pTemp = pNew );
259 Gia_ManStop( pTemp );
260 return pNew;
261}
int Gia_ManHashXor(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:668
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupNormalize()

Gia_Man_t * Gia_ManDupNormalize ( Gia_Man_t * p,
int fHashMapping )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 139 of file giaTim.c.

140{
141 Gia_Man_t * pNew;
142 Gia_Obj_t * pObj;
143 int i;
145 pNew = Gia_ManStart( Gia_ManObjNum(p) );
146 pNew->pName = Abc_UtilStrsav( p->pName );
147 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
148 Gia_ManConst0(p)->Value = 0;
149 if ( !Gia_ManIsSeqWithBoxes(p) )
150 {
151 Gia_ManForEachCi( p, pObj, i )
152 pObj->Value = Gia_ManAppendCi(pNew);
153 }
154 else
155 {
156 // current CI order: PIs + FOs + NewCIs
157 // desired reorder: PIs + NewCIs + FOs
158 int nCIs = Tim_ManPiNum( (Tim_Man_t *)p->pManTime );
159 int nAll = Tim_ManCiNum( (Tim_Man_t *)p->pManTime );
160 int nPis = nCIs - Gia_ManRegNum(p);
161 assert( nAll == Gia_ManCiNum(p) );
162 assert( nPis > 0 );
163 // copy PIs first
164 for ( i = 0; i < nPis; i++ )
165 Gia_ManCi(p, i)->Value = Gia_ManAppendCi(pNew);
166 // copy new CIs second
167 for ( i = nCIs; i < nAll; i++ )
168 Gia_ManCi(p, i)->Value = Gia_ManAppendCi(pNew);
169 // copy flops last
170 for ( i = nCIs - Gia_ManRegNum(p); i < nCIs; i++ )
171 Gia_ManCi(p, i)->Value = Gia_ManAppendCi(pNew);
172 printf( "Warning: Shuffled CI order to be correct sequential AIG.\n" );
173 }
174 if ( fHashMapping ) Gia_ManHashAlloc( pNew );
175 Gia_ManForEachAnd( p, pObj, i )
176 if ( Gia_ObjIsBuf(pObj) )
177 pObj->Value = Gia_ManAppendBuf( pNew, Gia_ObjFanin0Copy(pObj) );
178 else if ( fHashMapping )
179 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
180 else
181 pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
182 if ( fHashMapping ) Gia_ManHashStop( pNew );
183 Gia_ManForEachCo( p, pObj, i )
184 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
185 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
186 pNew->nConstrs = p->nConstrs;
188 Gia_ManDupRemapEquiv( pNew, p );
189 return pNew;
190}
int Gia_ManIsNormalized(Gia_Man_t *p)
Definition giaTim.c:114
int Gia_ManIsSeqWithBoxes(Gia_Man_t *p)
Definition giaTim.c:98
void Gia_ManDupRemapEquiv(Gia_Man_t *pNew, Gia_Man_t *p)
Definition giaDup.c:82
int Tim_ManCiNum(Tim_Man_t *p)
Definition timMan.c:700
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupOneHot()

Gia_Man_t * Gia_ManDupOneHot ( Gia_Man_t * p)
extern

Definition at line 4108 of file giaDup.c.

4109{
4110 Gia_Man_t * pOneHot, * pNew = Gia_ManDup( p );
4111 if ( Gia_ManRegNum(pNew) == 0 )
4112 {
4113 Abc_Print( 0, "Appending 1-hotness constraints to the PIs.\n" );
4114 pOneHot = Gia_ManOneHot( 0, Gia_ManCiNum(pNew) );
4115 }
4116 else
4117 pOneHot = Gia_ManOneHot( Gia_ManPiNum(pNew), Gia_ManRegNum(pNew) );
4118 Gia_ManDupAppendShare( pNew, pOneHot );
4119 pNew->nConstrs += Gia_ManPoNum(pOneHot);
4120 Gia_ManStop( pOneHot );
4121 return pNew;
4122}
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition giaDup.c:720
void Gia_ManDupAppendShare(Gia_Man_t *pNew, Gia_Man_t *pTwo)
Definition giaDup.c:1156
Gia_Man_t * Gia_ManOneHot(int nSkips, int nVars)
Definition giaDup.c:4082
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupOntop()

Gia_Man_t * Gia_ManDupOntop ( Gia_Man_t * p,
Gia_Man_t * p2 )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 2590 of file giaDup.c.

2591{
2592 Gia_Man_t * pTemp, * pNew;
2593 Gia_Obj_t * pObj;
2594 int i;
2595 assert( Gia_ManPoNum(p) == Gia_ManPiNum(p2) );
2596 assert( Gia_ManRegNum(p) == 0 );
2597 assert( Gia_ManRegNum(p2) == 0 );
2598 pNew = Gia_ManStart( Gia_ManObjNum(p)+Gia_ManObjNum(p2) );
2599 pNew->pName = Abc_UtilStrsav( p->pName );
2600 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
2601 Gia_ManHashAlloc( pNew );
2602 // dup first AIG
2603 Gia_ManConst0(p)->Value = 0;
2604 Gia_ManForEachCi( p, pObj, i )
2605 pObj->Value = Gia_ManAppendCi(pNew);
2606 Gia_ManForEachAnd( p, pObj, i )
2607 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
2608 // dup second AIG
2609 Gia_ManConst0(p2)->Value = 0;
2610 Gia_ManForEachCo( p, pObj, i )
2611 Gia_ManPi(p2, i)->Value = Gia_ObjFanin0Copy(pObj);
2612 Gia_ManForEachAnd( p2, pObj, i )
2613 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
2614 Gia_ManForEachCo( p2, pObj, i )
2615 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
2616 Gia_ManHashStop( pNew );
2617// Gia_ManPrintStats( pGiaNew, 0 );
2618 pNew = Gia_ManCleanup( pTemp = pNew );
2619 Gia_ManStop( pTemp );
2620 return pNew;
2621}
Here is the call graph for this function:

◆ Gia_ManDupOrderAiger()

Gia_Man_t * Gia_ManDupOrderAiger ( Gia_Man_t * p)
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 532 of file giaDup.c.

533{
534 Gia_Man_t * pNew;
535 Gia_Obj_t * pObj;
536 int i;
537 pNew = Gia_ManStart( Gia_ManObjNum(p) );
538 pNew->pName = Abc_UtilStrsav( p->pName );
539 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
540 Gia_ManConst0(p)->Value = 0;
541 Gia_ManForEachCi( p, pObj, i )
542 pObj->Value = Gia_ManAppendCi(pNew);
543 Gia_ManForEachAnd( p, pObj, i )
544 pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
545 Gia_ManForEachCo( p, pObj, i )
546 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
547 Gia_ManDupRemapEquiv( pNew, p );
548 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
550 return pNew;
551}
void Gia_ManDupRemapEquiv(Gia_Man_t *pNew, Gia_Man_t *p)
Definition giaDup.c:82
Here is the call graph for this function:

◆ Gia_ManDupOrderDfs()

Gia_Man_t * Gia_ManDupOrderDfs ( Gia_Man_t * p)
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 206 of file giaDup.c.

207{
208 Gia_Man_t * pNew;
209 Gia_Obj_t * pObj;
210 int i;
212 pNew = Gia_ManStart( Gia_ManObjNum(p) );
213 pNew->pName = Abc_UtilStrsav( p->pName );
214 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
215 Gia_ManConst0(p)->Value = 0;
216 Gia_ManForEachCo( p, pObj, i )
217 Gia_ManDupOrderDfs_rec( pNew, p, pObj );
218 Gia_ManForEachCi( p, pObj, i )
219 if ( !~pObj->Value )
220 pObj->Value = Gia_ManAppendCi(pNew);
221 assert( Gia_ManCiNum(pNew) == Gia_ManCiNum(p) );
222 Gia_ManDupRemapCis( pNew, p );
223 Gia_ManDupRemapEquiv( pNew, p );
224 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
225 return pNew;
226}
int Gia_ManDupOrderDfs_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaDup.c:180
void Gia_ManDupRemapCis(Gia_Man_t *pNew, Gia_Man_t *p)
Definition giaDup.c:128
Here is the call graph for this function:

◆ Gia_ManDupOrderDfsChoices()

Gia_Man_t * Gia_ManDupOrderDfsChoices ( Gia_Man_t * p)
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 438 of file giaDup.c.

439{
440 Gia_Man_t * pNew;
441 Gia_Obj_t * pObj;
442 int i;
443 assert( p->pReprs && p->pNexts );
445 pNew = Gia_ManStart( Gia_ManObjNum(p) );
446 pNew->pName = Abc_UtilStrsav( p->pName );
447 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
448 pNew->pNexts = ABC_CALLOC( int, Gia_ManObjNum(p) );
449 Gia_ManConst0(p)->Value = 0;
450 Gia_ManForEachCi( p, pObj, i )
451 pObj->Value = Gia_ManAppendCi(pNew);
452 Gia_ManForEachCo( p, pObj, i )
453 {
454 Gia_ManDupOrderDfsChoices_rec( pNew, p, Gia_ObjFanin0(pObj) );
455 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
456 }
457 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
458// Gia_ManDeriveReprs( pNew );
459 return pNew;
460}
void Gia_ManDupOrderDfsChoices_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaDup.c:408
Here is the call graph for this function:

◆ Gia_ManDupOrderDfsReverse()

Gia_Man_t * Gia_ManDupOrderDfsReverse ( Gia_Man_t * p,
int fRevFans,
int fRevOuts )
extern

Definition at line 482 of file giaDup.c.

483{
484 Gia_Man_t * pNew;
485 Gia_Obj_t * pObj;
486 int i;
488 pNew = Gia_ManStart( Gia_ManObjNum(p) );
489 pNew->pName = Abc_UtilStrsav( p->pName );
490 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
491 Gia_ManConst0(p)->Value = 0;
492 Gia_ManForEachCi( p, pObj, i )
493 pObj->Value = Gia_ManAppendCi(pNew);
494 if ( fRevOuts )
495 {
496 if ( fRevFans )
497 Gia_ManForEachCoReverse( p, pObj, i )
498 Gia_ManDupOrderDfs2_rec( pNew, p, Gia_ObjFanin0(pObj) );
499 else
500 Gia_ManForEachCoReverse( p, pObj, i )
501 Gia_ManDupOrderDfs_rec( pNew, p, Gia_ObjFanin0(pObj) );
502 }
503 else
504 {
505 if ( fRevFans )
506 Gia_ManForEachCo( p, pObj, i )
507 Gia_ManDupOrderDfs2_rec( pNew, p, Gia_ObjFanin0(pObj) );
508 else
509 Gia_ManForEachCo( p, pObj, i )
510 Gia_ManDupOrderDfs_rec( pNew, p, Gia_ObjFanin0(pObj) );
511 }
512 Gia_ManForEachCo( p, pObj, i )
513 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
514 Gia_ManDupRemapCis( pNew, p );
515 Gia_ManDupRemapCos( pNew, p );
516 Gia_ManDupRemapEquiv( pNew, p );
517 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
518 return pNew;
519}
void Gia_ManDupRemapCos(Gia_Man_t *pNew, Gia_Man_t *p)
Definition giaDup.c:154
int Gia_ManDupOrderDfs2_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaDup.c:473
#define Gia_ManForEachCoReverse(p, pObj, i)
Definition gia.h:1242
Here is the call graph for this function:

◆ Gia_ManDupOutputGroup()

Gia_Man_t * Gia_ManDupOutputGroup ( Gia_Man_t * p,
int iOutStart,
int iOutStop )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 313 of file giaDup.c.

314{
315 Gia_Man_t * pNew;
316 Gia_Obj_t * pObj;
317 int i;
319 pNew = Gia_ManStart( Gia_ManObjNum(p) );
320 pNew->pName = Abc_UtilStrsav( p->pName );
321 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
322 Gia_ManConst0(p)->Value = 0;
323 for ( i = iOutStart; i < iOutStop; i++ )
324 {
325 pObj = Gia_ManCo( p, i );
326 Gia_ManDupOrderDfs_rec( pNew, p, pObj );
327 }
328 return pNew;
329}
Here is the call graph for this function:

◆ Gia_ManDupOutputVec()

Gia_Man_t * Gia_ManDupOutputVec ( Gia_Man_t * p,
Vec_Int_t * vOutPres )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 342 of file giaDup.c.

343{
344 Gia_Man_t * pNew;
345 Gia_Obj_t * pObj;
346 int i;
347 assert( Gia_ManRegNum(p) == 0 );
348 assert( Gia_ManPoNum(p) == Vec_IntSize(vOutPres) );
350 pNew = Gia_ManStart( Gia_ManObjNum(p) );
351 pNew->pName = Abc_UtilStrsav( p->pName );
352 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
353 Gia_ManConst0(p)->Value = 0;
354 Gia_ManForEachPi( p, pObj, i )
355 pObj->Value = Gia_ManAppendCi(pNew);
356 Gia_ManForEachPo( p, pObj, i )
357 if ( Vec_IntEntry(vOutPres, i) )
358 Gia_ManDupOrderDfs_rec( pNew, p, Gia_ObjFanin0(pObj) );
359 Gia_ManForEachPo( p, pObj, i )
360 if ( Vec_IntEntry(vOutPres, i) )
361 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
362 return pNew;
363}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupPerm()

Gia_Man_t * Gia_ManDupPerm ( Gia_Man_t * p,
Vec_Int_t * vPiPerm )
extern

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

Synopsis [Duplicates AIG without any changes.]

Description []

SideEffects []

SeeAlso []

Definition at line 929 of file giaDup.c.

930{
931// Vec_Int_t * vPiPermInv;
932 Gia_Man_t * pNew;
933 Gia_Obj_t * pObj;
934 int i;
935 assert( Vec_IntSize(vPiPerm) == Gia_ManPiNum(p) );
936 pNew = Gia_ManStart( Gia_ManObjNum(p) );
937 pNew->pName = Abc_UtilStrsav( p->pName );
938 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
939 Gia_ManConst0(p)->Value = 0;
940// vPiPermInv = Vec_IntInvert( vPiPerm, -1 );
941 Gia_ManForEachPi( p, pObj, i )
942// Gia_ManPi(p, Vec_IntEntry(vPiPermInv,i))->Value = Gia_ManAppendCi( pNew );
943 Gia_ManPi(p, Vec_IntEntry(vPiPerm,i))->Value = Gia_ManAppendCi( pNew );
944// Vec_IntFree( vPiPermInv );
945 Gia_ManForEachObj1( p, pObj, i )
946 {
947 if ( Gia_ObjIsBuf(pObj) )
948 pObj->Value = Gia_ManAppendBuf( pNew, Gia_ObjFanin0Copy(pObj) );
949 else if ( Gia_ObjIsAnd(pObj) )
950 pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
951 else if ( Gia_ObjIsCi(pObj) )
952 {
953 if ( Gia_ObjIsRo(p, pObj) )
954 pObj->Value = Gia_ManAppendCi( pNew );
955 }
956 else if ( Gia_ObjIsCo(pObj) )
957 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
958 }
959 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
960 return pNew;
961}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupPermFlop()

Gia_Man_t * Gia_ManDupPermFlop ( Gia_Man_t * p,
Vec_Int_t * vFfPerm )
extern

Definition at line 962 of file giaDup.c.

963{
964 //Vec_Int_t * vPermInv;
965 Gia_Man_t * pNew;
966 Gia_Obj_t * pObj;
967 int i;
968 assert( Vec_IntSize(vFfPerm) == Gia_ManRegNum(p) );
969 //vPermInv = Vec_IntInvert( vFfPerm, -1 );
970 pNew = Gia_ManStart( Gia_ManObjNum(p) );
971 pNew->pName = Abc_UtilStrsav( p->pName );
972 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
973 Gia_ManConst0(p)->Value = 0;
974 Gia_ManForEachPi( p, pObj, i )
975 pObj->Value = Gia_ManAppendCi(pNew);
976 Gia_ManForEachRo( p, pObj, i )
977 //Gia_ManRo(p, Vec_IntEntry(vPermInv, i))->Value = Gia_ManAppendCi(pNew);
978 Gia_ManRo(p, Vec_IntEntry(vFfPerm, i))->Value = Gia_ManAppendCi( pNew );
979 Gia_ManForEachAnd( p, pObj, i )
980 pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
981 Gia_ManForEachPo( p, pObj, i )
982 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
983 Gia_ManForEachRi( p, pObj, i )
984 //pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy( Gia_ManRi(p, Vec_IntEntry(vPermInv, i)) ) );
985 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy( Gia_ManRi(p, Vec_IntEntry(vFfPerm, i)) ) );
986 //Vec_IntFree( vPermInv );
987 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
988 return pNew;
989}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupPermFlopGap()

Gia_Man_t * Gia_ManDupPermFlopGap ( Gia_Man_t * p,
Vec_Int_t * vFfPerm )
extern

Definition at line 1026 of file giaDup.c.

1027{
1028 Vec_Int_t * vPerm = Vec_IntCondense( vFfMask, -1 );
1029 Gia_Man_t * pPerm = Gia_ManDupPermFlop( p, vPerm );
1030 Gia_Man_t * pSpread = Gia_ManDupSpreadFlop( pPerm, vFfMask );
1031 Vec_IntFree( vPerm );
1032 Gia_ManStop( pPerm );
1033 return pSpread;
1034}
Gia_Man_t * Gia_ManDupPermFlop(Gia_Man_t *p, Vec_Int_t *vFfPerm)
Definition giaDup.c:962
Gia_Man_t * Gia_ManDupSpreadFlop(Gia_Man_t *p, Vec_Int_t *vFfMask)
Definition giaDup.c:990
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupRemapEquiv()

void Gia_ManDupRemapEquiv ( Gia_Man_t * pNew,
Gia_Man_t * p )
extern

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

Synopsis [Removes pointers to the unmarked nodes..]

Description []

SideEffects []

SeeAlso []

Definition at line 82 of file giaDup.c.

83{
84 Vec_Int_t * vClass;
85 int i, k, iNode, iRepr, iPrev;
86 if ( p->pReprs == NULL )
87 return;
88 assert( pNew->pReprs == NULL && pNew->pNexts == NULL );
89 // start representatives
90 pNew->pReprs = ABC_CALLOC( Gia_Rpr_t, Gia_ManObjNum(pNew) );
91 for ( i = 0; i < Gia_ManObjNum(pNew); i++ )
92 Gia_ObjSetRepr( pNew, i, GIA_VOID );
93 // iterate over constant candidates
95 Gia_ObjSetRepr( pNew, Abc_Lit2Var(Gia_ManObj(p, i)->Value), 0 );
96 // iterate over class candidates
97 vClass = Vec_IntAlloc( 100 );
99 {
100 Vec_IntClear( vClass );
101 Gia_ClassForEachObj( p, i, k )
102 Vec_IntPushUnique( vClass, Abc_Lit2Var(Gia_ManObj(p, k)->Value) );
103 assert( Vec_IntSize( vClass ) > 1 );
104 Vec_IntSort( vClass, 0 );
105 iRepr = iPrev = Vec_IntEntry( vClass, 0 );
106 Vec_IntForEachEntryStart( vClass, iNode, k, 1 )
107 {
108 Gia_ObjSetRepr( pNew, iNode, iRepr );
109 assert( iPrev < iNode );
110 iPrev = iNode;
111 }
112 }
113 Vec_IntFree( vClass );
114 pNew->pNexts = Gia_ManDeriveNexts( pNew );
115}
#define Gia_ManForEachConst(p, i)
Definition gia.h:1099
#define Gia_ClassForEachObj(p, i, iObj)
Definition gia.h:1107
#define Gia_ManForEachClass(p, i)
Definition gia.h:1101
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupRemapLiterals()

void Gia_ManDupRemapLiterals ( Vec_Int_t * vLits,
Gia_Man_t * p )
extern

FUNCTION DEFINITIONS ///.

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

Synopsis [Removes pointers to the unmarked nodes..]

Description [Array vLits contains literals of p. At the same time, each object pObj of p points to a literal of pNew. This procedure remaps literals in array vLits into literals of pNew.]

SideEffects []

SeeAlso []

Definition at line 54 of file giaDup.c.

55{
56 Gia_Obj_t * pObj;
57 int i, iLit, iLitNew;
58 Vec_IntForEachEntry( vLits, iLit, i )
59 {
60 if ( iLit < 0 )
61 continue;
62 pObj = Gia_ManObj( p, Abc_Lit2Var(iLit) );
63 if ( ~pObj->Value == 0 )
64 iLitNew = -1;
65 else
66 iLitNew = Abc_LitNotCond( pObj->Value, Abc_LitIsCompl(iLit) );
67 Vec_IntWriteEntry( vLits, i, iLitNew );
68 }
69}
Here is the caller graph for this function:

◆ Gia_ManDupRemovePis()

Gia_Man_t * Gia_ManDupRemovePis ( Gia_Man_t * p,
int nRemPis )
extern

Definition at line 802 of file giaDup.c.

803{
804 Gia_Man_t * pNew;
805 Gia_Obj_t * pObj;
806 int i;
807 pNew = Gia_ManStart( Gia_ManObjNum(p) );
808 pNew->pName = Abc_UtilStrsav( p->pName );
809 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
810 Gia_ManConst0(p)->Value = 0;
811 Gia_ManForEachObj1( p, pObj, i )
812 {
813 if ( Gia_ObjIsAnd(pObj) )
814 pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
815 else if ( Gia_ObjIsCi(pObj) && Gia_ObjCioId(pObj) < Gia_ManCiNum(p)-nRemPis )
816 pObj->Value = Gia_ManAppendCi( pNew );
817 else if ( Gia_ObjIsCo(pObj) )
818 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
819 }
820 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
821 return pNew;
822}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupSelectedOutputs()

Gia_Man_t * Gia_ManDupSelectedOutputs ( Gia_Man_t * p,
Vec_Int_t * vOutsLeft )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 376 of file giaDup.c.

377{
378 Gia_Man_t * pNew;
379 Gia_Obj_t * pObj;
380 int i, iOut;
381 assert( Gia_ManRegNum(p) == 0 );
382 assert( Gia_ManPoNum(p) >= Vec_IntSize(vOutsLeft) );
384 pNew = Gia_ManStart( Gia_ManObjNum(p) );
385 pNew->pName = Abc_UtilStrsav( p->pName );
386 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
387 Gia_ManConst0(p)->Value = 0;
388 Gia_ManForEachPi( p, pObj, i )
389 pObj->Value = Gia_ManAppendCi(pNew);
390 Vec_IntForEachEntry( vOutsLeft, iOut, i )
391 Gia_ManDupOrderDfs_rec( pNew, p, Gia_ObjFanin0(Gia_ManPo(p, iOut)) );
392 Vec_IntForEachEntry( vOutsLeft, iOut, i )
393 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(Gia_ManPo(p, iOut)) );
394 return pNew;
395}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupSelf()

Gia_Man_t * Gia_ManDupSelf ( Gia_Man_t * p)
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 1359 of file giaDup.c.

1360{
1361 Gia_Man_t * pNew, * pTemp;
1362 Gia_Obj_t * pObj;
1363 int i, iCtrl;
1364 pNew = Gia_ManStart( Gia_ManObjNum(p) );
1365 pNew->pName = Abc_UtilStrsav( p->pName );
1366 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1367 Gia_ManHashAlloc( pNew );
1369 Gia_ManConst0(p)->Value = 0;
1370 iCtrl = Gia_ManAppendCi( pNew );
1371 Gia_ManForEachCi( p, pObj, i )
1372 pObj->Value = Gia_ManAppendCi( pNew );
1373 Gia_ManForEachAnd( p, pObj, i )
1374 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1375 Gia_ManForEachPo( p, pObj, i )
1376 pObj->Value = Gia_ObjFanin0Copy(pObj);
1377 Gia_ManForEachRi( p, pObj, i )
1378 pObj->Value = Gia_ManHashMux( pNew, iCtrl, Gia_ObjFanin0Copy(pObj), Gia_ObjRiToRo(p, pObj)->Value );
1379 Gia_ManForEachCo( p, pObj, i )
1380 Gia_ManAppendCo( pNew, pObj->Value );
1381 Gia_ManHashStop( pNew );
1382 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
1383 pNew = Gia_ManCleanup( pTemp = pNew );
1384 Gia_ManStop( pTemp );
1385 return pNew;
1386}
Here is the call graph for this function:

◆ Gia_ManDupSliced()

Gia_Man_t * Gia_ManDupSliced ( Gia_Man_t * p,
int nSuppMax )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 4211 of file giaDup.c.

4212{
4213 Gia_Man_t * pNew;
4214 Gia_Obj_t * pObj;
4215 int i;
4216 // start the new manager
4217 pNew = Gia_ManStart( 5000 );
4218 pNew->pName = Abc_UtilStrsav( p->pName );
4219 // create constant and PIs
4220 Gia_ManConst0(p)->Value = 0;
4221 Gia_ManForEachCi( p, pObj, i )
4222 pObj->Value = Gia_ManAppendCi( pNew );
4223 // create internal nodes
4225 Gia_ManForEachAnd( p, pObj, i )
4226 if ( Gia_ManSuppSize(p, &i, 1) <= nSuppMax )
4227 {
4228 pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
4229 pObj->fMark0 = 1;
4230 }
4231 else
4232 {
4233 Gia_ObjFanin0(pObj)->fMark1 = 1;
4234 Gia_ObjFanin1(pObj)->fMark1 = 1;
4235 }
4236 Gia_ManForEachCo( p, pObj, i )
4237 Gia_ObjFanin0(pObj)->fMark1 = 1;
4238 // add POs for the nodes pointed to
4239 Gia_ManForEachAnd( p, pObj, i )
4240 if ( pObj->fMark0 && pObj->fMark1 )
4241 Gia_ManAppendCo( pNew, pObj->Value );
4242 // cleanup and leave
4244 return pNew;
4245}
int Gia_ManSuppSize(Gia_Man_t *p, int *pNodes, int nNodes)
Definition giaDfs.c:324
int nSuppMax
Definition llb3Image.c:83
Here is the call graph for this function:

◆ Gia_ManDupTimes()

Gia_Man_t * Gia_ManDupTimes ( Gia_Man_t * p,
int nTimes )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 1547 of file giaDup.c.

1548{
1549 Gia_Man_t * pNew;
1550 Gia_Obj_t * pObj;
1551 Vec_Int_t * vPis, * vPos, * vRis, * vRos;
1552 int i, t, Entry;
1553 assert( nTimes > 0 );
1554 pNew = Gia_ManStart( Gia_ManObjNum(p) );
1555 pNew->pName = Abc_UtilStrsav( p->pName );
1556 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1557 Gia_ManConst0(p)->Value = 0;
1558 vPis = Vec_IntAlloc( Gia_ManPiNum(p) * nTimes );
1559 vPos = Vec_IntAlloc( Gia_ManPoNum(p) * nTimes );
1560 vRis = Vec_IntAlloc( Gia_ManRegNum(p) * nTimes );
1561 vRos = Vec_IntAlloc( Gia_ManRegNum(p) * nTimes );
1562 for ( t = 0; t < nTimes; t++ )
1563 {
1564 Gia_ManForEachObj1( p, pObj, i )
1565 {
1566 if ( Gia_ObjIsAnd(pObj) )
1567 pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1568 else if ( Gia_ObjIsCi(pObj) )
1569 {
1570 pObj->Value = Gia_ManAppendCi( pNew );
1571 if ( Gia_ObjIsPi(p, pObj) )
1572 Vec_IntPush( vPis, Abc_Lit2Var(pObj->Value) );
1573 else
1574 Vec_IntPush( vRos, Abc_Lit2Var(pObj->Value) );
1575 }
1576 else if ( Gia_ObjIsCo(pObj) )
1577 {
1578 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1579 if ( Gia_ObjIsPo(p, pObj) )
1580 Vec_IntPush( vPos, Abc_Lit2Var(pObj->Value) );
1581 else
1582 Vec_IntPush( vRis, Abc_Lit2Var(pObj->Value) );
1583 }
1584 }
1585 }
1586 Vec_IntClear( pNew->vCis );
1587 Vec_IntForEachEntry( vPis, Entry, i )
1588 {
1589 Gia_ObjSetCioId( Gia_ManObj(pNew, Entry), Vec_IntSize(pNew->vCis) );
1590 Vec_IntPush( pNew->vCis, Entry );
1591 }
1592 Vec_IntForEachEntry( vRos, Entry, i )
1593 {
1594 Gia_ObjSetCioId( Gia_ManObj(pNew, Entry), Vec_IntSize(pNew->vCis) );
1595 Vec_IntPush( pNew->vCis, Entry );
1596 }
1597 Vec_IntClear( pNew->vCos );
1598 Vec_IntForEachEntry( vPos, Entry, i )
1599 {
1600 Gia_ObjSetCioId( Gia_ManObj(pNew, Entry), Vec_IntSize(pNew->vCos) );
1601 Vec_IntPush( pNew->vCos, Entry );
1602 }
1603 Vec_IntForEachEntry( vRis, Entry, i )
1604 {
1605 Gia_ObjSetCioId( Gia_ManObj(pNew, Entry), Vec_IntSize(pNew->vCos) );
1606 Vec_IntPush( pNew->vCos, Entry );
1607 }
1608 Vec_IntFree( vPis );
1609 Vec_IntFree( vPos );
1610 Vec_IntFree( vRis );
1611 Vec_IntFree( vRos );
1612 Gia_ManSetRegNum( pNew, nTimes * Gia_ManRegNum(p) );
1613 return pNew;
1614}
Vec_Int_t * vCos
Definition gia.h:111
Vec_Int_t * vCis
Definition gia.h:110
Here is the call graph for this function:

◆ Gia_ManDupTopAnd()

Gia_Man_t * Gia_ManDupTopAnd ( Gia_Man_t * p,
int fVerbose )
extern

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

Synopsis [Detect topmost gate.]

Description []

SideEffects []

SeeAlso []

Definition at line 2930 of file giaDup.c.

2931{
2932 Gia_Man_t * pNew, * pTemp;
2933 int fContinue, iIter = 0;
2934 pNew = Gia_ManDupNormalize( p, 0 );
2935 for ( fContinue = 1; fContinue; )
2936 {
2937 pNew = Gia_ManDupTopAnd_iter( pTemp = pNew, fVerbose );
2938 if ( Gia_ManCoNum(pNew) == Gia_ManCoNum(pTemp) && Gia_ManAndNum(pNew) == Gia_ManAndNum(pTemp) )
2939 fContinue = 0;
2940 Gia_ManStop( pTemp );
2941 if ( fVerbose )
2942 {
2943 printf( "Iter %2d : ", ++iIter );
2944 Gia_ManPrintStatsShort( pNew );
2945 }
2946 }
2947 return pNew;
2948}
Gia_Man_t * Gia_ManDupTopAnd_iter(Gia_Man_t *p, int fVerbose)
Definition giaDup.c:2829
void Gia_ManPrintStatsShort(Gia_Man_t *p)
Definition giaMan.c:658
Here is the call graph for this function:

◆ Gia_ManDupTrimmed()

Gia_Man_t * Gia_ManDupTrimmed ( Gia_Man_t * p,
int fTrimCis,
int fTrimCos,
int fDualOut,
int OutValue )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 2431 of file giaDup.c.

2432{
2433 Vec_Int_t * vNonZero = NULL;
2434 Gia_Man_t * pNew, * pTemp;
2435 Gia_Obj_t * pObj;
2436 int i, Entry;
2437 // collect non-zero
2438 if ( fDualOut && fTrimCos )
2439 vNonZero = Gia_ManDupTrimmedNonZero( p );
2440 // start new manager
2441 pNew = Gia_ManStart( Gia_ManObjNum(p) );
2442 pNew->pName = Abc_UtilStrsav( p->pName );
2443 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
2444 // check if there are PIs to be added
2446 Gia_ManForEachPi( p, pObj, i )
2447 if ( !fTrimCis || Gia_ObjRefNum(p, pObj) )
2448 break;
2449 if ( i == Gia_ManPiNum(p) ) // there is no PIs - add dummy PI
2450 Gia_ManAppendCi(pNew);
2451 // add the ROs
2453 Gia_ManConst0(p)->Value = 0;
2454 Gia_ManForEachCi( p, pObj, i )
2455 if ( !fTrimCis || Gia_ObjRefNum(p, pObj) || Gia_ObjIsRo(p, pObj) )
2456 pObj->Value = Gia_ManAppendCi(pNew);
2457 Gia_ManForEachAnd( p, pObj, i )
2458 pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
2459 if ( fDualOut && fTrimCos )
2460 {
2461 Vec_IntForEachEntry( vNonZero, Entry, i )
2462 {
2463 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(Gia_ManPo(p, 2*Entry+0)) );
2464 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(Gia_ManPo(p, 2*Entry+1)) );
2465 }
2466 if ( Gia_ManPoNum(pNew) == 0 ) // nothing - add dummy PO
2467 {
2468// Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(Gia_ManPo(p, 0)) );
2469// Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(Gia_ManPo(p, 1)) );
2470 Gia_ManAppendCo( pNew, 0 );
2471 Gia_ManAppendCo( pNew, 0 );
2472 }
2473 Gia_ManForEachRi( p, pObj, i )
2474 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
2475 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
2476 // cleanup
2477 pNew = Gia_ManSeqStructSweep( pTemp = pNew, 1, 1, 0 );
2478 Gia_ManStop( pTemp );
2479 // trim the PIs
2480// pNew = Gia_ManDupTrimmed( pTemp = pNew, 1, 0, 0 );
2481// Gia_ManStop( pTemp );
2482 }
2483 else
2484 {
2485 // check if there are POs to be added
2486 Gia_ManForEachPo( p, pObj, i )
2487 if ( !fTrimCos || !Gia_ManPoIsToRemove(p, pObj, OutValue) )
2488 break;
2489 if ( i == Gia_ManPoNum(p) ) // there is no POs - add dummy PO
2490 Gia_ManAppendCo( pNew, 0 );
2491 Gia_ManForEachCo( p, pObj, i )
2492 if ( !fTrimCos || !Gia_ManPoIsToRemove(p, pObj, OutValue) || Gia_ObjIsRi(p, pObj) )
2493 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
2494 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
2495 }
2496 Vec_IntFreeP( &vNonZero );
2497 assert( !Gia_ManHasDangling( pNew ) );
2498 return pNew;
2499}
int Gia_ManPoIsToRemove(Gia_Man_t *p, Gia_Obj_t *pObj, int Value)
Definition giaDup.c:2411
Vec_Int_t * Gia_ManDupTrimmedNonZero(Gia_Man_t *p)
Definition giaDup.c:2378
Gia_Man_t * Gia_ManSeqStructSweep(Gia_Man_t *p, int fConst, int fEquiv, int fVerbose)
Definition giaScl.c:258
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupUniv()

Gia_Man_t * Gia_ManDupUniv ( Gia_Man_t * p,
int iVar )
extern

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

Synopsis [Existentially quantified given variable.]

Description []

SideEffects []

SeeAlso []

Definition at line 2059 of file giaDup.c.

2060{
2061 Gia_Man_t * pNew, * pTemp;
2062 Gia_Obj_t * pObj;
2063 int i;
2064 assert( iVar >= 0 && iVar < Gia_ManPiNum(p) );
2065 assert( Gia_ManRegNum(p) == 0 );
2067 // find the cofactoring variable
2068 pNew = Gia_ManStart( Gia_ManObjNum(p) );
2069 pNew->pName = Abc_UtilStrsav( p->pName );
2070 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
2071 Gia_ManHashAlloc( pNew );
2072 // compute negative cofactor
2073 Gia_ManConst0(p)->Value = 0;
2074 Gia_ManForEachCi( p, pObj, i )
2075 pObj->Value = Gia_ManAppendCi(pNew);
2076 Gia_ManPi( p, iVar )->Value = Abc_Var2Lit( 0, 0 );
2077 Gia_ManForEachAnd( p, pObj, i )
2078 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
2079 Gia_ManForEachPo( p, pObj, i )
2080 pObj->Value = Gia_ObjFanin0Copy(pObj);
2081 // compute the positive cofactor
2082 Gia_ManPi( p, iVar )->Value = Abc_Var2Lit( 0, 1 );
2083 Gia_ManForEachAnd( p, pObj, i )
2084 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
2085 // create OR gate
2086 Gia_ManForEachPo( p, pObj, i )
2087 {
2088 if ( i == 0 )
2089 pObj->Value = Gia_ManAppendCo( pNew, Gia_ManHashAnd(pNew, Gia_ObjFanin0Copy(pObj), pObj->Value) );
2090 else
2091 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
2092 }
2093 Gia_ManHashStop( pNew );
2094 pNew = Gia_ManCleanup( pTemp = pNew );
2095 Gia_ManStop( pTemp );
2096 return pNew;
2097}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupUnnormalize()

Gia_Man_t * Gia_ManDupUnnormalize ( Gia_Man_t * p)
extern

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

Synopsis [Duplicates AIG according to the timing manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 382 of file giaTim.c.

383{
384 Vec_Int_t * vNodes;
385 Gia_Man_t * pNew;
386 Gia_Obj_t * pObj;
387 int i;
388 assert( !Gia_ManBufNum(p) );
389 vNodes = Gia_ManOrderWithBoxes( p );
390 if ( vNodes == NULL )
391 return NULL;
393 pNew = Gia_ManStart( Gia_ManObjNum(p) );
394 pNew->pName = Abc_UtilStrsav( p->pName );
395 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
396 if ( Gia_ManHasChoices(p) )
397 pNew->pSibls = ABC_CALLOC( int, Gia_ManObjNum(p) );
398 Gia_ManForEachObjVec( vNodes, p, pObj, i )
399 {
400 if ( Gia_ObjIsBuf(pObj) )
401 pObj->Value = Gia_ManAppendBuf( pNew, Gia_ObjFanin0Copy(pObj) );
402 else if ( Gia_ObjIsAnd(pObj) )
403 {
404 pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
405 if ( Gia_ObjSibl(p, Gia_ObjId(p, pObj)) )
406 pNew->pSibls[Abc_Lit2Var(pObj->Value)] = Abc_Lit2Var(Gia_ObjSiblObj(p, Gia_ObjId(p, pObj))->Value);
407 }
408 else if ( Gia_ObjIsCi(pObj) )
409 pObj->Value = Gia_ManAppendCi( pNew );
410 else if ( Gia_ObjIsCo(pObj) )
411 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
412 else if ( Gia_ObjIsConst0(pObj) )
413 pObj->Value = 0;
414 else assert( 0 );
415 }
416 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
417 Vec_IntFree( vNodes );
418 return pNew;
419}
Vec_Int_t * Gia_ManOrderWithBoxes(Gia_Man_t *p)
Definition giaTim.c:286
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupUnshuffleInputs()

Gia_Man_t * Gia_ManDupUnshuffleInputs ( Gia_Man_t * p)
extern

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

Synopsis [Reorders flops for sequential AIGs with boxes.]

Description []

SideEffects []

SeeAlso []

Definition at line 203 of file giaTim.c.

204{
205 Gia_Man_t * pNew;
206 Gia_Obj_t * pObj;
207 int i, nCIs, nAll, nPis;
208 // sanity checks
212 pNew = Gia_ManStart( Gia_ManObjNum(p) );
213 pNew->pName = Abc_UtilStrsav( p->pName );
214 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
215 Gia_ManConst0(p)->Value = 0;
216 // change input order
217 // desired reorder: PIs + NewCIs + FOs
218 // current CI order: PIs + FOs + NewCIs
219 nCIs = Tim_ManPiNum( (Tim_Man_t *)p->pManTime );
220 nAll = Tim_ManCiNum( (Tim_Man_t *)p->pManTime );
221 nPis = nCIs - Gia_ManRegNum(p);
222 assert( nAll == Gia_ManCiNum(p) );
223 assert( nPis > 0 );
224 // copy PIs first
225 for ( i = 0; i < nPis; i++ )
226 Gia_ManCi(p, i)->Value = Gia_ManAppendCi(pNew);
227 // copy flops second
228 for ( i = nAll - Gia_ManRegNum(p); i < nAll; i++ )
229 Gia_ManCi(p, i)->Value = Gia_ManAppendCi(pNew);
230 // copy new CIs last
231 for ( i = nPis; i < nAll - Gia_ManRegNum(p); i++ )
232 Gia_ManCi(p, i)->Value = Gia_ManAppendCi(pNew);
233 printf( "Warning: Unshuffled CI order to be correct AIG with boxes.\n" );
234 // other things
235 Gia_ManForEachAnd( p, pObj, i )
236 pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
237 Gia_ManForEachCo( p, pObj, i )
238 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
239 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
240 pNew->nConstrs = p->nConstrs;
242 Gia_ManDupRemapEquiv( pNew, p );
243 return pNew;
244}
Here is the call graph for this function:

◆ Gia_ManDupWithAttributes()

Gia_Man_t * Gia_ManDupWithAttributes ( Gia_Man_t * p)
extern

Definition at line 776 of file giaDup.c.

777{
778 Gia_Man_t * pNew = Gia_ManDup(p);
779 Gia_ManTransferMapping( pNew, p );
780 Gia_ManTransferPacking( pNew, p );
781 if ( p->pManTime )
782 pNew->pManTime = Tim_ManDup( (Tim_Man_t *)p->pManTime, 0 );
783 if ( p->pAigExtra )
784 pNew->pAigExtra = Gia_ManDup( p->pAigExtra );
785 if ( p->nAnd2Delay )
786 pNew->nAnd2Delay = p->nAnd2Delay;
787 if ( p->vRegClasses )
788 pNew->vRegClasses = Vec_IntDup( p->vRegClasses );
789 if ( p->vRegInits )
790 pNew->vRegInits = Vec_IntDup( p->vRegInits );
791 if ( p->vConfigs )
792 pNew->vConfigs = Vec_IntDup( p->vConfigs );
793 if ( p->pCellStr )
794 pNew->pCellStr = Abc_UtilStrsav( p->pCellStr );
795 // copy names if present
796 if ( p->vNamesIn )
797 pNew->vNamesIn = Vec_PtrDupStr( p->vNamesIn );
798 if ( p->vNamesOut )
799 pNew->vNamesOut = Vec_PtrDupStr( p->vNamesOut );
800 return pNew;
801}
Tim_Man_t * Tim_ManDup(Tim_Man_t *p, int fUnitDelay)
Definition timMan.c:86
Here is the call graph for this function:

◆ Gia_ManDupWithConstraints()

Gia_Man_t * Gia_ManDupWithConstraints ( Gia_Man_t * p,
Vec_Int_t * vPoTypes )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 3816 of file giaDup.c.

3817{
3818 Gia_Man_t * pNew;
3819 Gia_Obj_t * pObj;
3820 int i, nConstr = 0;
3821 pNew = Gia_ManStart( Gia_ManObjNum(p) );
3822 pNew->pName = Abc_UtilStrsav( p->pName );
3823 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
3824 Gia_ManConst0(p)->Value = 0;
3825 Gia_ManForEachCi( p, pObj, i )
3826 pObj->Value = Gia_ManAppendCi(pNew);
3827 Gia_ManForEachAnd( p, pObj, i )
3828 pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
3829 Gia_ManForEachPo( p, pObj, i )
3830 if ( Vec_IntEntry(vPoTypes, i) == 0 ) // regular PO
3831 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
3832 Gia_ManForEachPo( p, pObj, i )
3833 if ( Vec_IntEntry(vPoTypes, i) == 1 ) // constraint (should be complemented!)
3834 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) ^ 1 ), nConstr++;
3835 Gia_ManForEachRi( p, pObj, i )
3836 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
3837// Gia_ManDupRemapEquiv( pNew, p );
3838 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
3839 pNew->nConstrs = nConstr;
3840 assert( Gia_ManIsNormalized(pNew) );
3841 return pNew;
3842}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupWithNewPo()

Gia_Man_t * Gia_ManDupWithNewPo ( Gia_Man_t * p1,
Gia_Man_t * p2 )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 2634 of file giaDup.c.

2635{
2636 Gia_Man_t * pTemp, * pNew;
2637 Gia_Obj_t * pObj;
2638 int i;
2639 // there is no flops in p2
2640 assert( Gia_ManRegNum(p2) == 0 );
2641 // there is only one PO in p2
2642// assert( Gia_ManPoNum(p2) == 1 );
2643 // input count of p2 is equal to flop count of p1
2644 assert( Gia_ManPiNum(p2) == Gia_ManRegNum(p1) );
2645
2646 // start new AIG
2647 pNew = Gia_ManStart( Gia_ManObjNum(p1)+Gia_ManObjNum(p2) );
2648 pNew->pName = Abc_UtilStrsav( p1->pName );
2649 pNew->pSpec = Abc_UtilStrsav( p1->pSpec );
2650 Gia_ManHashAlloc( pNew );
2651 // dup first AIG
2652 Gia_ManConst0(p1)->Value = 0;
2653 Gia_ManForEachCi( p1, pObj, i )
2654 pObj->Value = Gia_ManAppendCi(pNew);
2655 Gia_ManForEachAnd( p1, pObj, i )
2656 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
2657 // dup second AIG
2658 Gia_ManConst0(p2)->Value = 0;
2659 Gia_ManForEachPi( p2, pObj, i )
2660 pObj->Value = Gia_ManRo(p1, i)->Value;
2661 Gia_ManForEachAnd( p2, pObj, i )
2662 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
2663 // add property output
2664 Gia_ManForEachPo( p2, pObj, i )
2665 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
2666 // add flop inputs
2667 Gia_ManForEachRi( p1, pObj, i )
2668 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
2669 Gia_ManHashStop( pNew );
2670 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p1) );
2671 pNew = Gia_ManCleanup( pTemp = pNew );
2672 Gia_ManStop( pTemp );
2673 return pNew;
2674}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupZero()

Gia_Man_t * Gia_ManDupZero ( Gia_Man_t * p)
extern

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

Synopsis [Duplicates AIG without any changes.]

Description []

SideEffects []

SeeAlso []

Definition at line 905 of file giaDup.c.

906{
907 Gia_Man_t * pNew; int i;
908 pNew = Gia_ManStart( 1 + Gia_ManCiNum(p) + Gia_ManCoNum(p) );
909 pNew->pName = Abc_UtilStrsav( p->pName );
910 for ( i = 0; i < Gia_ManCiNum(p); i++ )
911 Gia_ManAppendCi( pNew );
912 for ( i = 0; i < Gia_ManCoNum(p); i++ )
913 Gia_ManAppendCo( pNew, 0 );
914 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
915 return pNew;
916}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupZeroUndc()

Gia_Man_t * Gia_ManDupZeroUndc ( Gia_Man_t * p,
char * pInit,
int nNewPis,
int fGiaSimple,
int fVerbose )
extern

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

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

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

SideEffects []

SeeAlso []

Definition at line 3569 of file giaDup.c.

3570{
3571 Gia_Man_t * pNew;
3572 Gia_Obj_t * pObj;
3573 int CountPis = Gia_ManPiNum(p), * pPiLits;
3574 int i, iResetFlop = -1, Count1 = 0;
3575 //printf( "Using %s\n", pInit );
3576 // map X-valued flops into new PIs
3577 assert( (int)strlen(pInit) == Gia_ManRegNum(p) );
3578 pPiLits = ABC_FALLOC( int, Gia_ManRegNum(p) );
3579 for ( i = 0; i < Gia_ManRegNum(p); i++ )
3580 if ( pInit[i] == 'x' || pInit[i] == 'X' )
3581 pPiLits[i] = CountPis++;
3582 // create new manager
3583 pNew = Gia_ManStart( Gia_ManObjNum(p) );
3584 pNew->pName = Abc_UtilStrsav( p->pName );
3585 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
3586 pNew->fGiaSimple = fGiaSimple;
3587 Gia_ManConst0(p)->Value = 0;
3588 // create primary inputs
3589 Gia_ManForEachPi( p, pObj, i )
3590 pObj->Value = Gia_ManAppendCi( pNew );
3591 // create additional primary inputs
3592 for ( i = Gia_ManPiNum(p); i < CountPis; i++ )
3593 Gia_ManAppendCi( pNew );
3594 // create additional primary inputs
3595 for ( i = 0; i < nNewPis; i++ )
3596 Gia_ManAppendCi( pNew );
3597 // create flop outputs
3598 Gia_ManForEachRo( p, pObj, i )
3599 pObj->Value = Gia_ManAppendCi( pNew );
3600 // create reset flop output
3601 if ( CountPis > Gia_ManPiNum(p) )
3602 iResetFlop = Gia_ManAppendCi( pNew );
3603 // update flop outputs
3605 Gia_ManForEachRo( p, pObj, i )
3606 {
3607 if ( pInit[i] == '1' )
3608 pObj->Value = Abc_LitNot(pObj->Value), Count1++;
3609 else if ( pInit[i] == 'x' || pInit[i] == 'X' )
3610 {
3611 if ( pObj->fMark0 ) // only add MUX if the flop has fanout
3612 pObj->Value = Gia_ManAppendMux( pNew, iResetFlop, pObj->Value, Gia_Obj2Lit(pNew, Gia_ManPi(pNew, pPiLits[i])) );
3613 }
3614 else if ( pInit[i] != '0' )
3615 assert( 0 );
3616 }
3618 ABC_FREE( pPiLits );
3619 // build internal nodes
3620 Gia_ManForEachAnd( p, pObj, i )
3621 pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
3622 // create POs
3623 Gia_ManForEachPo( p, pObj, i )
3624 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
3625 // create flop inputs
3626 Gia_ManForEachRi( p, pObj, i )
3627 if ( pInit[i] == '1' )
3628 pObj->Value = Gia_ManAppendCo( pNew, Abc_LitNot(Gia_ObjFanin0Copy(pObj)) );
3629 else
3630 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
3631 // create reset flop input
3632 if ( CountPis > Gia_ManPiNum(p) )
3633 Gia_ManAppendCo( pNew, 1 );
3634 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) + (int)(CountPis > Gia_ManPiNum(p)) );
3635 if ( fVerbose )
3636 printf( "Converted %d 1-valued FFs and %d DC-valued FFs.\n", Count1, CountPis-Gia_ManPiNum(p) );
3637 return pNew;
3638}
#define ABC_FALLOC(type, num)
Definition abc_global.h:266
void Gia_ManMarkFanoutDrivers(Gia_Man_t *p)
Definition giaUtil.c:1779
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManEdgeFromArray()

void Gia_ManEdgeFromArray ( Gia_Man_t * p,
Vec_Int_t * vArray )
extern

FUNCTION DEFINITIONS ///.

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

Synopsis [Transforms edge assignment.]

Description []

SideEffects []

SeeAlso []

Definition at line 72 of file giaEdge.c.

73{
74 int i, iObj1, iObj2, Count = 0;
75 Vec_IntFreeP( &p->vEdge1 );
76 Vec_IntFreeP( &p->vEdge2 );
77 p->vEdge1 = Vec_IntStart( Gia_ManObjNum(p) );
78 p->vEdge2 = Vec_IntStart( Gia_ManObjNum(p) );
79 Vec_IntForEachEntryDouble( vArray, iObj1, iObj2, i )
80 {
81 assert( iObj1 < iObj2 );
82 Count += Gia_ObjEdgeAdd( iObj1, iObj2, p->vEdge1, p->vEdge2 );
83 Count += Gia_ObjEdgeAdd( iObj2, iObj1, p->vEdge1, p->vEdge2 );
84 }
85 if ( Count )
86 printf( "Found %d violations during edge conversion.\n", Count );
87}
#define Vec_IntForEachEntryDouble(vVec, Entry1, Entry2, i)
Definition vecInt.h:72
Here is the caller graph for this function:

◆ Gia_ManEdgeToArray()

Vec_Int_t * Gia_ManEdgeToArray ( Gia_Man_t * p)
extern

Definition at line 88 of file giaEdge.c.

89{
90 int iObj, iFanin;
91 Vec_Int_t * vArray = Vec_IntAlloc( 1000 );
92 assert( p->vEdge1 && p->vEdge2 );
93 assert( Vec_IntSize(p->vEdge1) == Gia_ManObjNum(p) );
94 assert( Vec_IntSize(p->vEdge2) == Gia_ManObjNum(p) );
95 for ( iObj = 0; iObj < Gia_ManObjNum(p); iObj++ )
96 {
97 iFanin = Vec_IntEntry( p->vEdge1, iObj );
98 if ( iFanin && iFanin < iObj )
99 Vec_IntPushTwo( vArray, iFanin, iObj );
100 iFanin = Vec_IntEntry( p->vEdge2, iObj );
101 if ( iFanin && iFanin < iObj )
102 Vec_IntPushTwo( vArray, iFanin, iObj );
103 }
104 return vArray;
105}
Here is the caller graph for this function:

◆ Gia_ManEquivCountClasses()

int Gia_ManEquivCountClasses ( Gia_Man_t * p)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 376 of file giaEquiv.c.

377{
378 int i, Counter = 0;
379 if ( p->pReprs == NULL )
380 return 0;
381 for ( i = 1; i < Gia_ManObjNum(p); i++ )
382 Counter += Gia_ObjIsHead(p, i);
383 return Counter;
384}

◆ Gia_ManEquivCountLits()

int Gia_ManEquivCountLits ( Gia_Man_t * p)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 450 of file giaEquiv.c.

451{
452 int i, Counter = 0, Counter0 = 0, CounterX = 0;
453 if ( p->pReprs == NULL || p->pNexts == NULL )
454 return 0;
455 for ( i = 1; i < Gia_ManObjNum(p); i++ )
456 {
457 if ( Gia_ObjIsHead(p, i) )
458 Counter++;
459 else if ( Gia_ObjIsConst(p, i) )
460 Counter0++;
461 else if ( Gia_ObjIsNone(p, i) )
462 CounterX++;
463 }
464 CounterX -= Gia_ManCoNum(p);
465 return Gia_ManCiNum(p) + Gia_ManAndNum(p) - Counter - CounterX;
466}
Here is the caller graph for this function:

◆ Gia_ManEquivCountLitsAll()

int Gia_ManEquivCountLitsAll ( Gia_Man_t * p)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 357 of file giaEquiv.c.

358{
359 int i, nLits = 0;
360 for ( i = 0; i < Gia_ManObjNum(p); i++ )
361 nLits += (Gia_ObjRepr(p, i) != GIA_VOID);
362 return nLits;
363}
Here is the caller graph for this function:

◆ Gia_ManEquivFixOutputPairs()

void Gia_ManEquivFixOutputPairs ( Gia_Man_t * p)
extern

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

Synopsis [Reduces AIG using equivalence classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 882 of file giaEquiv.c.

883{
884 Gia_Obj_t * pObj0, * pObj1;
885 int i;
886 assert( (Gia_ManPoNum(p) & 1) == 0 );
887 Gia_ManForEachPo( p, pObj0, i )
888 {
889 pObj1 = Gia_ManPo( p, ++i );
890 if ( Gia_ObjChild0(pObj0) != Gia_ObjChild0(pObj1) )
891 continue;
892 pObj0->iDiff0 = Gia_ObjId(p, pObj0);
893 pObj0->fCompl0 = 0;
894 pObj1->iDiff0 = Gia_ObjId(p, pObj1);
895 pObj1->fCompl0 = 0;
896 }
897}
unsigned fCompl0
Definition gia.h:80
unsigned iDiff0
Definition gia.h:79
Here is the caller graph for this function:

◆ Gia_ManEquivImprove()

void Gia_ManEquivImprove ( Gia_Man_t * p)
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 1780 of file giaEquiv.c.

1781{
1782 Vec_Int_t * vClass;
1783 int i, k, iNode, iRepr;
1784 int iReprBest, iLevelBest, iLevelCur, iMffcBest, iMffcCur;
1785 assert( p->pReprs != NULL && p->pNexts != NULL );
1786 Gia_ManLevelNum( p );
1788 // iterate over class candidates
1789 vClass = Vec_IntAlloc( 100 );
1791 {
1792 Vec_IntClear( vClass );
1793 iReprBest = -1;
1794 iLevelBest = iMffcBest = ABC_INFINITY;
1795 Gia_ClassForEachObj( p, i, k )
1796 {
1797 iLevelCur = Gia_ObjLevel( p,Gia_ManObj(p, k) );
1798 iMffcCur = Gia_NodeMffcSize( p, Gia_ManObj(p, k) );
1799 if ( iLevelBest > iLevelCur || (iLevelBest == iLevelCur && iMffcBest > iMffcCur) )
1800 {
1801 iReprBest = k;
1802 iLevelBest = iLevelCur;
1803 iMffcBest = iMffcCur;
1804 }
1805 Vec_IntPush( vClass, k );
1806 }
1807 assert( Vec_IntSize( vClass ) > 1 );
1808 assert( iReprBest > 0 );
1809 if ( i == iReprBest )
1810 continue;
1811/*
1812 Abc_Print( 1, "Repr/Best = %6d/%6d. Lev = %3d/%3d. Mffc = %3d/%3d.\n",
1813 i, iReprBest, Gia_ObjLevel( p,Gia_ManObj(p, i) ), Gia_ObjLevel( p,Gia_ManObj(p, iReprBest) ),
1814 Gia_NodeMffcSize( p, Gia_ManObj(p, i) ), Gia_NodeMffcSize( p, Gia_ManObj(p, iReprBest) ) );
1815*/
1816 iRepr = iReprBest;
1817 Gia_ObjSetRepr( p, iRepr, GIA_VOID );
1818 Gia_ObjSetProved( p, i );
1819 Gia_ObjUnsetProved( p, iRepr );
1820 Vec_IntForEachEntry( vClass, iNode, k )
1821 if ( iNode != iRepr )
1822 Gia_ObjSetRepr( p, iNode, iRepr );
1823 }
1824 Vec_IntFree( vClass );
1825 ABC_FREE( p->pNexts );
1826// p->pNexts = Gia_ManDeriveNexts( p );
1827}
int Gia_NodeMffcSize(Gia_Man_t *p, Gia_Obj_t *pNode)
Definition giaUtil.c:1230
Here is the call graph for this function:

◆ Gia_ManEquivPrintClasses()

void Gia_ManEquivPrintClasses ( Gia_Man_t * p,
int fVerbose,
float Mem )
extern

Definition at line 501 of file giaEquiv.c.

502{
503 int i, Counter = 0, Counter0 = 0, CounterX = 0, Proved = 0, nLits;
504 for ( i = 1; i < Gia_ManObjNum(p); i++ )
505 {
506 if ( Gia_ObjIsHead(p, i) )
507 Counter++;
508 else if ( Gia_ObjIsConst(p, i) )
509 Counter0++;
510 else if ( Gia_ObjIsNone(p, i) )
511 CounterX++;
512 if ( Gia_ObjProved(p, i) )
513 Proved++;
514 }
515 CounterX -= Gia_ManCoNum(p);
516 nLits = Gia_ManCiNum(p) + Gia_ManAndNum(p) - Counter - CounterX;
517// Abc_Print( 1, "cst =%8d cls =%7d lit =%8d unused =%8d proof =%6d mem =%5.2f MB\n",
518// Counter0, Counter, nLits, CounterX, Proved, (Mem == 0.0) ? 8.0*Gia_ManObjNum(p)/(1<<20) : Mem );
519 Abc_Print( 1, "cst =%8d cls =%7d lit =%8d unused =%8d proof =%6d\n",
520 Counter0, Counter, nLits, CounterX, Proved );
521 assert( Gia_ManEquivCheckLits( p, nLits ) );
522 if ( fVerbose )
523 {
524// int Ent;
525 Abc_Print( 1, "Const0 (%d) = ", Counter0 );
527 Abc_Print( 1, "%d ", i );
528 Abc_Print( 1, "\n" );
529 Counter = 0;
531 Gia_ManEquivPrintOne( p, i, ++Counter );
532/*
533 Gia_ManLevelNum( p );
534 Gia_ManForEachClass( p, i )
535 if ( i % 100 == 0 )
536 {
537// Abc_Print( 1, "%d ", Gia_ManEquivCountOne(p, i) );
538 Gia_ClassForEachObj( p, i, Ent )
539 {
540 Abc_Print( 1, "%d ", Gia_ObjLevel( p, Gia_ManObj(p, Ent) ) );
541 }
542 Abc_Print( 1, "\n" );
543 }
544*/
545 }
546}
void Gia_ManEquivPrintOne(Gia_Man_t *p, int i, int Counter)
Definition giaEquiv.c:489
int Gia_ManEquivCheckLits(Gia_Man_t *p, int nLits)
Definition giaEquiv.c:397
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManEquivPrintOne()

void Gia_ManEquivPrintOne ( Gia_Man_t * p,
int i,
int Counter )
extern

Definition at line 489 of file giaEquiv.c.

490{
491 int Ent;
492 Abc_Print( 1, "Class %4d : Num = %2d {", Counter, Gia_ManEquivCountOne(p, i) );
493 Gia_ClassForEachObj( p, i, Ent )
494 {
495 Abc_Print( 1," %d", Ent );
496 if ( p->pReprs[Ent].fColorA || p->pReprs[Ent].fColorB )
497 Abc_Print( 1," <%d%d>", p->pReprs[Ent].fColorA, p->pReprs[Ent].fColorB );
498 }
499 Abc_Print( 1, " }\n" );
500}
int Gia_ManEquivCountOne(Gia_Man_t *p, int i)
Definition giaEquiv.c:479
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManEquivReduce()

Gia_Man_t * Gia_ManEquivReduce ( Gia_Man_t * p,
int fUseAll,
int fDualOut,
int fSkipPhase,
int fVerbose )
extern

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

Synopsis [Reduces AIG using equivalence classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 677 of file giaEquiv.c.

678{
679 Gia_Man_t * pNew;
680 Gia_Obj_t * pObj;
681 int i;
682 if ( !p->pReprs && p->pSibls )
683 {
684 int * pMap = ABC_FALLOC( int, Gia_ManObjNum(p) );
685 p->pReprs = ABC_CALLOC( Gia_Rpr_t, Gia_ManObjNum(p) );
686 for ( i = 0; i < Gia_ManObjNum(p); i++ )
687 Gia_ObjSetRepr( p, i, GIA_VOID );
688 for ( i = 0; i < Gia_ManObjNum(p); i++ )
689 if ( p->pSibls[i] > 0 )
690 {
691 if ( pMap[p->pSibls[i]] == -1 )
692 pMap[p->pSibls[i]] = p->pSibls[i];
693 pMap[i] = pMap[p->pSibls[i]];
694 }
695 for ( i = 0; i < Gia_ManObjNum(p); i++ )
696 if ( p->pSibls[i] > 0 )
697 Gia_ObjSetRepr( p, i, pMap[i] );
698 //printf( "Created equivalence classes.\n" );
699 ABC_FREE( p->pNexts );
700 p->pNexts = Gia_ManDeriveNexts( p );
701 ABC_FREE( pMap );
702 }
703 if ( !p->pReprs )
704 {
705 Abc_Print( 1, "Gia_ManEquivReduce(): Equivalence classes are not available.\n" );
706 return NULL;
707 }
708 if ( fDualOut && (Gia_ManPoNum(p) & 1) )
709 {
710 Abc_Print( 1, "Gia_ManEquivReduce(): Dual-output miter should have even number of POs.\n" );
711 return NULL;
712 }
713 // check if there are any equivalences defined
714 Gia_ManForEachObj( p, pObj, i )
715 if ( Gia_ObjReprObj(p, i) != NULL )
716 break;
717 if ( i == Gia_ManObjNum(p) )
718 {
719// Abc_Print( 1, "Gia_ManEquivReduce(): There are no equivalences to reduce.\n" );
720// return NULL;
721 return Gia_ManDup( p );
722 }
723/*
724 if ( !Gia_ManCheckTopoOrder( p ) )
725 {
726 Abc_Print( 1, "Gia_ManEquivReduce(): AIG is not in a correct topological order.\n" );
727 return NULL;
728 }
729*/
730 if ( !fSkipPhase )
732 if ( fDualOut )
733 Gia_ManEquivSetColors( p, fVerbose );
734 pNew = Gia_ManStart( Gia_ManObjNum(p) );
735 pNew->pName = Abc_UtilStrsav( p->pName );
736 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
738 Gia_ManConst0(p)->Value = 0;
739 Gia_ManForEachCi( p, pObj, i )
740 pObj->Value = Gia_ManAppendCi(pNew);
741 Gia_ManHashAlloc( pNew );
742 Gia_ManForEachCo( p, pObj, i )
743 Gia_ManEquivReduce_rec( pNew, p, Gia_ObjFanin0(pObj), fUseAll, fDualOut );
744 Gia_ManForEachCo( p, pObj, i )
745 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
746 Gia_ManHashStop( pNew );
747 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
748 return pNew;
749}
int Gia_ManEquivSetColors(Gia_Man_t *p, int fVerbose)
Definition giaEquiv.c:1097
void Gia_ManEquivReduce_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj, int fUseAll, int fDualOut)
Definition giaEquiv.c:649
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManEquivReduceAndRemap()

Gia_Man_t * Gia_ManEquivReduceAndRemap ( Gia_Man_t * p,
int fSeq,
int fMiterPairs )
extern

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

Synopsis [Reduces AIG while remapping equivalence classes.]

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

SideEffects []

SeeAlso []

Definition at line 1040 of file giaEquiv.c.

1041{
1042 Gia_Man_t * pNew, * pFinal;
1043 pNew = Gia_ManEquivReduce( p, 0, 0, 0, 0 );
1044 if ( pNew == NULL )
1045 return NULL;
1046 Gia_ManOrigIdsRemap( p, pNew );
1047 if ( fMiterPairs )
1049 if ( fSeq )
1050 Gia_ManSeqMarkUsed( pNew );
1051 else
1052 Gia_ManCombMarkUsed( pNew );
1054 pFinal = Gia_ManDupMarked( pNew );
1055 Gia_ManOrigIdsRemap( pNew, pFinal );
1056 Gia_ManEquivDeriveReprs( p, pNew, pFinal );
1057 Gia_ManStop( pNew );
1058 pFinal = Gia_ManEquivRemapDfs( pNew = pFinal );
1059 Gia_ManOrigIdsRemap( pNew, pFinal );
1060 Gia_ManStop( pNew );
1061 return pFinal;
1062}
void Gia_ManEquivFixOutputPairs(Gia_Man_t *p)
Definition giaEquiv.c:882
Gia_Man_t * Gia_ManEquivReduce(Gia_Man_t *p, int fUseAll, int fDualOut, int fSkipPhase, int fVerbose)
Definition giaEquiv.c:677
void Gia_ManEquivDeriveReprs(Gia_Man_t *p, Gia_Man_t *pNew, Gia_Man_t *pFinal)
Definition giaEquiv.c:935
void Gia_ManEquivUpdatePointers(Gia_Man_t *p, Gia_Man_t *pNew)
Definition giaEquiv.c:910
Gia_Man_t * Gia_ManEquivRemapDfs(Gia_Man_t *p)
Definition giaEquiv.c:994
void Gia_ManOrigIdsRemap(Gia_Man_t *p, Gia_Man_t *pNew)
Definition giaEquiv.c:56
int Gia_ManCombMarkUsed(Gia_Man_t *p)
Definition giaScl.c:60
int Gia_ManSeqMarkUsed(Gia_Man_t *p)
Definition giaScl.c:156
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManEquivSetColors()

int Gia_ManEquivSetColors ( Gia_Man_t * p,
int fVerbose )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 1097 of file giaEquiv.c.

1098{
1099 Gia_Obj_t * pObj;
1100 int i, nNodes[2], nDiffs[2];
1101 assert( (Gia_ManPoNum(p) & 1) == 0 );
1102 Gia_ObjSetColors( p, 0 );
1103 Gia_ManForEachPi( p, pObj, i )
1104 Gia_ObjSetColors( p, Gia_ObjId(p,pObj) );
1105 nNodes[0] = nNodes[1] = Gia_ManPiNum(p);
1106 Gia_ManForEachPo( p, pObj, i )
1107 nNodes[i&1] += Gia_ManEquivSetColor_rec( p, Gia_ObjFanin0(pObj), i&1 );
1108// Gia_ManForEachObj( p, pObj, i )
1109// if ( Gia_ObjIsCi(pObj) || Gia_ObjIsAnd(pObj) )
1110// assert( Gia_ObjColors(p, i) );
1111 nDiffs[0] = Gia_ManCandNum(p) - nNodes[0];
1112 nDiffs[1] = Gia_ManCandNum(p) - nNodes[1];
1113 if ( fVerbose )
1114 {
1115 Abc_Print( 1, "CI+AND = %7d A = %7d B = %7d Ad = %7d Bd = %7d AB = %7d.\n",
1116 Gia_ManCandNum(p), nNodes[0], nNodes[1], nDiffs[0], nDiffs[1],
1117 Gia_ManCandNum(p) - nDiffs[0] - nDiffs[1] );
1118 }
1119 return (nDiffs[0] + nDiffs[1]) / 2;
1120}
int Gia_ManEquivSetColor_rec(Gia_Man_t *p, Gia_Obj_t *pObj, int fOdds)
Definition giaEquiv.c:1075
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManEquivToChoices()

Gia_Man_t * Gia_ManEquivToChoices ( Gia_Man_t * p,
int nSnapshots )
extern

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

Synopsis [Reduces AIG using equivalence classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 2034 of file giaEquiv.c.

2035{
2036 Vec_Int_t * vNodes;
2037 Gia_Man_t * pNew, * pTemp;
2038 Gia_Obj_t * pObj, * pRepr;
2039 int i;
2040//Gia_ManEquivPrintClasses( p, 0, 0 );
2041 assert( (Gia_ManCoNum(p) % nSnapshots) == 0 );
2042 Gia_ManSetPhase( p );
2043 pNew = Gia_ManStart( Gia_ManObjNum(p) );
2044 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
2045 pNew->pName = Abc_UtilStrsav( p->pName );
2046 pNew->pReprs = ABC_CALLOC( Gia_Rpr_t, Gia_ManObjNum(p) );
2047 pNew->pNexts = ABC_CALLOC( int, Gia_ManObjNum(p) );
2048 for ( i = 0; i < Gia_ManObjNum(p); i++ )
2049 pNew->pReprs[i].iRepr = GIA_VOID;
2051 Gia_ManConst0(p)->Value = 0;
2052 Gia_ManForEachCi( p, pObj, i )
2053 pObj->Value = Gia_ManAppendCi(pNew);
2054 Gia_ManForEachRo( p, pObj, i )
2055 if ( (pRepr = Gia_ObjReprObj(p, Gia_ObjId(p, pObj))) )
2056 {
2057 assert( Gia_ObjIsConst0(pRepr) || Gia_ObjIsRo(p, pRepr) );
2058 pObj->Value = pRepr->Value;
2059 }
2060 Gia_ManHashAlloc( pNew );
2061 Gia_ManForEachCo( p, pObj, i )
2062 Gia_ManEquivToChoices_rec( pNew, p, Gia_ObjFanin0(pObj) );
2063 vNodes = Gia_ManGetDangling( p );
2064 Gia_ManForEachObjVec( vNodes, p, pObj, i )
2065 Gia_ManEquivToChoices_rec( pNew, p, pObj );
2066 Vec_IntFree( vNodes );
2067 Gia_ManForEachCo( p, pObj, i )
2068 if ( i % nSnapshots == 0 )
2069 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
2070 Gia_ManHashStop( pNew );
2071 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
2073//Gia_ManEquivPrintClasses( pNew, 0, 0 );
2074 pNew = Gia_ManCleanup( pTemp = pNew );
2075 Gia_ManStop( pTemp );
2076//Gia_ManEquivPrintClasses( pNew, 0, 0 );
2077 return pNew;
2078}
void Gia_ManEquivToChoices_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaEquiv.c:1925
void Gia_ManRemoveBadChoices(Gia_Man_t *p)
Definition giaEquiv.c:1986
Vec_Int_t * Gia_ManGetDangling(Gia_Man_t *p)
Definition giaUtil.c:1422
unsigned iRepr
Definition gia.h:60
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManEquivTransform()

void Gia_ManEquivTransform ( Gia_Man_t * p,
int fVerbose )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 1519 of file giaEquiv.c.

1520{
1521 extern void Cec_ManSimClassCreate( Gia_Man_t * p, Vec_Int_t * vClass );
1522 Vec_Int_t * vClass, * vClassNew;
1523 int iRepr, iNode, Ent, k;
1524 int nRemovedLits = 0, nRemovedClas = 0;
1525 int nTotalLits = 0, nTotalClas = 0;
1526 Gia_Obj_t * pObj;
1527 int i;
1528 assert( p->pReprs && p->pNexts );
1529 vClass = Vec_IntAlloc( 100 );
1530 vClassNew = Vec_IntAlloc( 100 );
1531 Gia_ManForEachObj( p, pObj, i )
1532 if ( Gia_ObjIsCi(pObj) || Gia_ObjIsAnd(pObj) )
1533 assert( Gia_ObjColors(p, i) );
1535 {
1536 nTotalClas++;
1537 Vec_IntClear( vClass );
1538 Vec_IntClear( vClassNew );
1539 Gia_ClassForEachObj( p, iRepr, iNode )
1540 {
1541 nTotalLits++;
1542 Vec_IntPush( vClass, iNode );
1543 assert( Gia_ObjColors(p, iNode) );
1544 if ( Gia_ObjColors(p, iNode) != 3 )
1545 Vec_IntPush( vClassNew, iNode );
1546 else
1547 nRemovedLits++;
1548 }
1549 Vec_IntForEachEntry( vClass, Ent, k )
1550 {
1551 p->pReprs[Ent].fFailed = p->pReprs[Ent].fProved = 0;
1552 p->pReprs[Ent].iRepr = GIA_VOID;
1553 p->pNexts[Ent] = 0;
1554 }
1555 if ( Vec_IntSize(vClassNew) < 2 )
1556 {
1557 nRemovedClas++;
1558 continue;
1559 }
1560 Cec_ManSimClassCreate( p, vClassNew );
1561 }
1562 Vec_IntFree( vClass );
1563 Vec_IntFree( vClassNew );
1564 if ( fVerbose )
1565 Abc_Print( 1, "Removed classes = %6d (out of %6d). Removed literals = %6d (out of %6d).\n",
1566 nRemovedClas, nTotalClas, nRemovedLits, nTotalLits );
1567}
void Cec_ManSimClassCreate(Gia_Man_t *p, Vec_Int_t *vClass)
Definition cecClass.c:234
#define Gia_ManForEachClassReverse(p, i)
Definition gia.h:1105
Here is the call graph for this function:

◆ Gia_ManEvalEdgeCount()

int Gia_ManEvalEdgeCount ( Gia_Man_t * p)
extern

Definition at line 284 of file giaEdge.c.

285{
286 return (Vec_IntCountPositive(p->vEdge1) + Vec_IntCountPositive(p->vEdge2))/2;
287}
Here is the caller graph for this function:

◆ Gia_ManEvalEdgeDelay()

int Gia_ManEvalEdgeDelay ( Gia_Man_t * p)
extern

Definition at line 201 of file giaEdge.c.

202{
203 int k, iLut, DelayMax = 0;
204 assert( p->vEdge1 && p->vEdge2 );
205 Vec_IntFreeP( &p->vEdgeDelay );
206 p->vEdgeDelay = Vec_IntStart( Gia_ManObjNum(p) );
207 if ( Gia_ManHasMapping(p) )
208 {
209 if ( p->pManTime != NULL && Tim_ManBoxNum((Tim_Man_t*)p->pManTime) )
210 {
211 Gia_Obj_t * pObj;
212 Vec_Int_t * vNodes = Gia_ManOrderWithBoxes( p );
213 Tim_ManIncrementTravId( (Tim_Man_t*)p->pManTime );
214 Gia_ManForEachObjVec( vNodes, p, pObj, k )
215 {
216 iLut = Gia_ObjId( p, pObj );
217 if ( Gia_ObjIsAnd(pObj) )
218 {
219 if ( Gia_ObjIsLut(p, iLut) )
220 Vec_IntWriteEntry( p->vEdgeDelay, iLut, Gia_ObjEvalEdgeDelay(p, iLut, p->vEdgeDelay) );
221 }
222 else if ( Gia_ObjIsCi(pObj) )
223 {
224 int arrTime = Tim_ManGetCiArrival( (Tim_Man_t*)p->pManTime, Gia_ObjCioId(pObj) );
225 Vec_IntWriteEntry( p->vEdgeDelay, iLut, arrTime );
226 }
227 else if ( Gia_ObjIsCo(pObj) )
228 {
229 int arrTime = Vec_IntEntry( p->vEdgeDelay, Gia_ObjFaninId0(pObj, iLut) );
230 Tim_ManSetCoArrival( (Tim_Man_t*)p->pManTime, Gia_ObjCioId(pObj), arrTime );
231 }
232 else if ( !Gia_ObjIsConst0(pObj) )
233 assert( 0 );
234 }
235 Vec_IntFree( vNodes );
236 }
237 else
238 {
239 Gia_ManForEachLut( p, iLut )
240 Vec_IntWriteEntry( p->vEdgeDelay, iLut, Gia_ObjEvalEdgeDelay(p, iLut, p->vEdgeDelay) );
241 }
242 }
243 else if ( Gia_ManHasMapping2(p) )
244 {
245 if ( p->pManTime != NULL && Tim_ManBoxNum((Tim_Man_t*)p->pManTime) )
246 {
247 Gia_Obj_t * pObj;
248 Vec_Int_t * vNodes = Gia_ManOrderWithBoxes( p );
249 Tim_ManIncrementTravId( (Tim_Man_t*)p->pManTime );
250 Gia_ManForEachObjVec( vNodes, p, pObj, k )
251 {
252 iLut = Gia_ObjId( p, pObj );
253 if ( Gia_ObjIsAnd(pObj) )
254 {
255 if ( Gia_ObjIsLut2(p, iLut) )
256 Vec_IntWriteEntry( p->vEdgeDelay, iLut, Gia_ObjEvalEdgeDelay(p, iLut, p->vEdgeDelay) );
257 }
258 else if ( Gia_ObjIsCi(pObj) )
259 {
260 int arrTime = Tim_ManGetCiArrival( (Tim_Man_t*)p->pManTime, Gia_ObjCioId(pObj) );
261 Vec_IntWriteEntry( p->vEdgeDelay, iLut, arrTime );
262 }
263 else if ( Gia_ObjIsCo(pObj) )
264 {
265 int arrTime = Vec_IntEntry( p->vEdgeDelay, Gia_ObjFaninId0(pObj, iLut) );
266 Tim_ManSetCoArrival( (Tim_Man_t*)p->pManTime, Gia_ObjCioId(pObj), arrTime );
267 }
268 else if ( !Gia_ObjIsConst0(pObj) )
269 assert( 0 );
270 }
271 Vec_IntFree( vNodes );
272 }
273 else
274 {
275 Gia_ManForEachLut2( p, iLut )
276 Vec_IntWriteEntry( p->vEdgeDelay, iLut, Gia_ObjEvalEdgeDelay(p, iLut, p->vEdgeDelay) );
277 }
278 }
279 else assert( 0 );
280 Gia_ManForEachCoDriverId( p, iLut, k )
281 DelayMax = Abc_MaxInt( DelayMax, Vec_IntEntry(p->vEdgeDelay, iLut) );
282 return DelayMax;
283}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManEvalSolutionOne()

int Gia_ManEvalSolutionOne ( Gia_Man_t * p,
Vec_Wrd_t * vSims,
Vec_Wrd_t * vIsfs,
Vec_Int_t * vCands,
Vec_Int_t * vSet,
int nWords,
int fVerbose )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 277 of file giaDecs.c.

278{
279 Vec_Wrd_t * vTruths = Gia_ManDeriveTruths( p, vSims, vIsfs, vCands, vSet, nWords );
280 int nTtWords = Vec_WrdSize(vTruths)/2, nVars = Vec_IntSize(vSet);
281 word * pTruth[2] = { Vec_WrdEntryP(vTruths, 0*nTtWords),
282 Vec_WrdEntryP(vTruths, 1*nTtWords) };
283 int nNodesResub = Gia_ManCountResub( vTruths, nVars, 0 );
284 int nNodesBidec = nVars > 2 ? Gia_ManCountBidec( vTruths, nVars, 0 ) : 999;
285 int nNodesIsop = nVars > 2 ? Gia_ManCountIsop( vTruths, nVars, 0 ) : 999;
286 int nNodesBdd = nVars > 2 ? Gia_ManCountBdd( vTruths, nVars, 0 ) : 999;
287 int nNodesMin = Abc_MinInt( Abc_MinInt(nNodesResub, nNodesBidec), Abc_MinInt(nNodesIsop, nNodesBdd) );
288 if ( fVerbose )
289 {
290 printf( "Size = %2d ", nVars );
291 printf( "Resub =%3d ", nNodesResub );
292 printf( "Bidec =%3d ", nNodesBidec );
293 printf( "Isop =%3d ", nNodesIsop );
294 printf( "Bdd =%3d ", nNodesBdd );
295 Abc_TtIsfPrint( pTruth[0], pTruth[1], nTtWords );
296 if ( nVars <= 6 )
297 {
298 printf( " " );
299 Extra_PrintHex( stdout, (unsigned*)pTruth[0], nVars );
300 printf( " " );
301 Extra_PrintHex( stdout, (unsigned*)pTruth[1], nVars );
302 }
303 printf( "\n" );
304 }
305 Vec_WrdFree( vTruths );
306 if ( nNodesMin > 500 )
307 return -1;
308 if ( nNodesMin == nNodesResub )
309 return (nNodesMin << 2) | 0;
310 if ( nNodesMin == nNodesBidec )
311 return (nNodesMin << 2) | 1;
312 if ( nNodesMin == nNodesIsop )
313 return (nNodesMin << 2) | 2;
314 if ( nNodesMin == nNodesBdd )
315 return (nNodesMin << 2) | 3;
316 return -1;
317}
int Gia_ManCountBidec(Vec_Wrd_t *vTruths, int nVars, int fVerbose)
Definition giaDecs.c:187
int Gia_ManCountIsop(Vec_Wrd_t *vTruths, int nVars, int fVerbose)
Definition giaDecs.c:209
int Gia_ManCountResub(Vec_Wrd_t *vTruths, int nVars, int fVerbose)
Definition giaDecs.c:148
int Gia_ManCountBdd(Vec_Wrd_t *vTruths, int nVars, int fVerbose)
Definition giaDecs.c:227
void Extra_PrintHex(FILE *pFile, unsigned *pTruth, int nVars)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManEvaluateSwitching()

float Gia_ManEvaluateSwitching ( Gia_Man_t * p)
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 746 of file giaSwitch.c.

747{
748 Gia_Obj_t * pObj;
749 float SwitchTotal = 0.0;
750 int i;
751 assert( p->pSwitching );
752 ABC_FREE( p->pRefs );
754 Gia_ManForEachObj( p, pObj, i )
755 SwitchTotal += (float)Gia_ObjRefNum(p, pObj) * p->pSwitching[i] / 255;
756 return SwitchTotal;
757}
Here is the call graph for this function:

◆ Gia_ManEvalWindow()

int Gia_ManEvalWindow ( Gia_Man_t * p,
Vec_Int_t * vLeaves,
Vec_Int_t * vNodes,
Vec_Wec_t * vWin,
Vec_Int_t * vTemp,
int fUseTwo )
extern

Definition at line 633 of file giaEdge.c.

634{
635 int DelayMax;
636 assert( Vec_IntSize(vNodes) == Vec_WecSize(vWin) );
637 Gia_ManUpdateMapping( p, vNodes, vWin );
638 DelayMax = Gia_ManComputeEdgeDelay( p, fUseTwo );
639 Gia_ManUpdateMapping( p, vNodes, vWin );
640 return DelayMax;
641}
int Gia_ManComputeEdgeDelay(Gia_Man_t *p, int fUseTwo)
Definition giaEdge.c:390
void Gia_ManUpdateMapping(Gia_Man_t *p, Vec_Int_t *vNodes, Vec_Wec_t *vWin)
Definition giaEdge.c:610
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManExtractWindow()

Gia_Man_t * Gia_ManExtractWindow ( Gia_Man_t * p,
int LevelMax,
int nTimeWindow,
int fVerbose )
extern

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}
Vec_Int_t * Gia_ManFindLatest(Gia_Man_t *p, int LevelMax, int nTimeWindow)
Definition giaBalMap.c:186
Gia_Man_t * Gia_ManExtractWin(Gia_Man_t *p, Vec_Int_t *vOuts, int fPoOnly)
Definition giaBalMap.c:114
Here is the call graph for this function:

◆ Gia_ManFanoutStart()

void Gia_ManFanoutStart ( Gia_Man_t * p)
extern

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}
void Gia_ObjAddFanout(Gia_Man_t *p, Gia_Obj_t *pObj, Gia_Obj_t *pFanout)
Definition giaFanout.c:116
Here is the call graph for this function:

◆ Gia_ManFanoutStop()

void Gia_ManFanoutStop ( Gia_Man_t * p)
extern

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}

◆ Gia_ManFillValue()

void Gia_ManFillValue ( Gia_Man_t * p)
extern

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

Synopsis [Cleans the value.]

Description []

SideEffects []

SeeAlso []

Definition at line 369 of file giaUtil.c.

370{
371 int i;
372 for ( i = 0; i < p->nObjs; i++ )
373 p->pObjs[i].Value = ~0;
374}

◆ Gia_ManFilterEquivsForSpeculation()

int Gia_ManFilterEquivsForSpeculation ( Gia_Man_t * pGia,
char * pName1,
char * pName2,
int fLatchA,
int fLatchB )
extern

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

Synopsis [Reduces AIG using equivalence classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 2267 of file giaEquiv.c.

2268{
2269 Gia_Man_t * pGia1, * pGia2, * pMiter;
2270 Gia_Obj_t * pObj1, * pObj2, * pObjM, * pObj;
2271 int i, iObj, iNext, Counter = 0;
2272 if ( pGia->pReprs == NULL || pGia->pNexts == NULL )
2273 {
2274 Abc_Print( 1, "Equivalences are not defined.\n" );
2275 return 0;
2276 }
2277 pGia1 = Gia_AigerRead( pName1, 0, 0, 0 );
2278 if ( pGia1 == NULL )
2279 {
2280 Abc_Print( 1, "Cannot read first file %s.\n", pName1 );
2281 return 0;
2282 }
2283 pGia2 = Gia_AigerRead( pName2, 0, 0, 0 );
2284 if ( pGia2 == NULL )
2285 {
2286 Gia_ManStop( pGia2 );
2287 Abc_Print( 1, "Cannot read second file %s.\n", pName2 );
2288 return 0;
2289 }
2290 pMiter = Gia_ManMiter( pGia1, pGia2, 0, 0, 1, 0, 0 );
2291 if ( pMiter == NULL )
2292 {
2293 Gia_ManStop( pGia1 );
2294 Gia_ManStop( pGia2 );
2295 Abc_Print( 1, "Cannot create sequential miter.\n" );
2296 return 0;
2297 }
2298 // make sure the miter is isomorphic
2299 if ( Gia_ManObjNum(pGia) != Gia_ManObjNum(pMiter) )
2300 {
2301 Gia_ManStop( pGia1 );
2302 Gia_ManStop( pGia2 );
2303 Gia_ManStop( pMiter );
2304 Abc_Print( 1, "The number of objects in different.\n" );
2305 return 0;
2306 }
2307 if ( memcmp( pGia->pObjs, pMiter->pObjs, sizeof(Gia_Obj_t) * Gia_ManObjNum(pGia) ) )
2308 {
2309 Gia_ManStop( pGia1 );
2310 Gia_ManStop( pGia2 );
2311 Gia_ManStop( pMiter );
2312 Abc_Print( 1, "The AIG structure of the miter does not match.\n" );
2313 return 0;
2314 }
2315 // transfer copies
2316 Gia_ManCleanMark0( pGia );
2317 Gia_ManForEachObj( pGia1, pObj1, i )
2318 {
2319 if ( pObj1->Value == ~0 )
2320 continue;
2321 pObjM = Gia_ManObj( pMiter, Abc_Lit2Var(pObj1->Value) );
2322 pObj = Gia_ManObj( pGia, Gia_ObjId(pMiter, pObjM) );
2323 pObj->fMark0 = 1;
2324 }
2325 Gia_ManCleanMark1( pGia );
2326 Gia_ManForEachObj( pGia2, pObj2, i )
2327 {
2328 if ( pObj2->Value == ~0 )
2329 continue;
2330 pObjM = Gia_ManObj( pMiter, Abc_Lit2Var(pObj2->Value) );
2331 pObj = Gia_ManObj( pGia, Gia_ObjId(pMiter, pObjM) );
2332 pObj->fMark1 = 1;
2333 }
2334
2335 // filter equivalences
2336 Gia_ManForEachConst( pGia, i )
2337 {
2338 Gia_ObjUnsetRepr( pGia, i );
2339 assert( pGia->pNexts[i] == 0 );
2340 }
2341 Gia_ManForEachClass( pGia, i )
2342 {
2343 // find the first colorA and colorB
2344 int ClassA = -1, ClassB = -1;
2345 Gia_ClassForEachObj( pGia, i, iObj )
2346 {
2347 pObj = Gia_ManObj( pGia, iObj );
2348 if ( ClassA == -1 && pObj->fMark0 && !pObj->fMark1 )
2349 {
2350 if ( fLatchA && !Gia_ObjIsRo(pGia, pObj) )
2351 continue;
2352 ClassA = iObj;
2353 }
2354 if ( ClassB == -1 && pObj->fMark1 && !pObj->fMark0 )
2355 {
2356 if ( fLatchB && !Gia_ObjIsRo(pGia, pObj) )
2357 continue;
2358 ClassB = iObj;
2359 }
2360 }
2361 // undo equivalence classes
2362 for ( iObj = i, iNext = Gia_ObjNext(pGia, iObj); iObj;
2363 iObj = iNext, iNext = Gia_ObjNext(pGia, iObj) )
2364 {
2365 Gia_ObjUnsetRepr( pGia, iObj );
2366 Gia_ObjSetNext( pGia, iObj, 0 );
2367 }
2368 assert( !Gia_ObjIsHead(pGia, i) );
2369 if ( ClassA > 0 && ClassB > 0 )
2370 {
2371 if ( ClassA > ClassB )
2372 {
2373 ClassA ^= ClassB;
2374 ClassB ^= ClassA;
2375 ClassA ^= ClassB;
2376 }
2377 assert( ClassA < ClassB );
2378 Gia_ObjSetNext( pGia, ClassA, ClassB );
2379 Gia_ObjSetRepr( pGia, ClassB, ClassA );
2380 Counter++;
2381 assert( Gia_ObjIsHead(pGia, ClassA) );
2382 }
2383 }
2384 Abc_Print( 1, "The number of two-node classes after filtering = %d.\n", Counter );
2385//Gia_ManEquivPrintClasses( pGia, 1, 0 );
2386
2387 Gia_ManCleanMark0( pGia );
2388 Gia_ManCleanMark1( pGia );
2389 return 1;
2390}
Gia_Man_t * Gia_AigerRead(char *pFileName, int fGiaSimple, int fSkipStrash, int fCheck)
Definition giaAiger.c:1017
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:2983
Gia_Obj_t * pObjs
Definition gia.h:105
Here is the call graph for this function:

◆ Gia_ManFilterEquivsUsingLatches()

void Gia_ManFilterEquivsUsingLatches ( Gia_Man_t * pGia,
int fFlopsOnly,
int fFlopsWith,
int fUseRiDrivers )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 2552 of file giaEquiv.c.

2553{
2554 Gia_Obj_t * pObjR;
2555 Vec_Int_t * vNodes, * vFfIds;
2556 int i, k, iObj, iNext, iPrev, iRepr;
2557 int iLitsOld = 0, iLitsNew = 0;
2558 assert( fFlopsOnly ^ fFlopsWith );
2559 vNodes = Vec_IntAlloc( 100 );
2560 // select nodes "flop" node IDs
2561 vFfIds = Vec_IntStart( Gia_ManObjNum(pGia) );
2562 if ( fUseRiDrivers )
2563 {
2564 Gia_ManForEachRi( pGia, pObjR, i )
2565 Vec_IntWriteEntry( vFfIds, Gia_ObjFaninId0p(pGia, pObjR), 1 );
2566 }
2567 else
2568 {
2569 Gia_ManForEachRo( pGia, pObjR, i )
2570 Vec_IntWriteEntry( vFfIds, Gia_ObjId(pGia, pObjR), 1 );
2571 }
2572 // remove all non-flop constants
2573 Gia_ManForEachConst( pGia, i )
2574 {
2575 iLitsOld++;
2576 assert( pGia->pNexts[i] == 0 );
2577 if ( !Vec_IntEntry(vFfIds, i) )
2578 Gia_ObjUnsetRepr( pGia, i );
2579 else
2580 iLitsNew++;
2581 }
2582 // clear the classes
2583 if ( fFlopsOnly )
2584 {
2585 Gia_ManForEachClass( pGia, i )
2586 {
2587 Vec_IntClear( vNodes );
2588 Gia_ClassForEachObj( pGia, i, iObj )
2589 {
2590 if ( Vec_IntEntry(vFfIds, iObj) )
2591 Vec_IntPush( vNodes, iObj );
2592 iLitsOld++;
2593 }
2594 iLitsOld--;
2595 // undo equivalence classes
2596 for ( iObj = i, iNext = Gia_ObjNext(pGia, iObj); iObj;
2597 iObj = iNext, iNext = Gia_ObjNext(pGia, iObj) )
2598 {
2599 Gia_ObjUnsetRepr( pGia, iObj );
2600 Gia_ObjSetNext( pGia, iObj, 0 );
2601 }
2602 assert( !Gia_ObjIsHead(pGia, i) );
2603 if ( Vec_IntSize(vNodes) > 1 )
2604 {
2605 // create new class
2606 iPrev = iRepr = Vec_IntEntry( vNodes, 0 );
2607 Vec_IntForEachEntryStart( vNodes, iObj, k, 1 )
2608 {
2609 Gia_ObjSetRepr( pGia, iObj, iRepr );
2610 Gia_ObjSetNext( pGia, iPrev, iObj );
2611 iPrev = iObj;
2612 iLitsNew++;
2613 }
2614 assert( Gia_ObjNext(pGia, iPrev) == 0 );
2615 }
2616 }
2617 }
2618 else
2619 {
2620 Gia_ManForEachClass( pGia, i )
2621 {
2622 int fSeenFlop = 0;
2623 Gia_ClassForEachObj( pGia, i, iObj )
2624 {
2625 if ( Vec_IntEntry(vFfIds, iObj) )
2626 fSeenFlop = 1;
2627 iLitsOld++;
2628 iLitsNew++;
2629 }
2630 iLitsOld--;
2631 iLitsNew--;
2632 if ( fSeenFlop )
2633 continue;
2634 // undo equivalence classes
2635 for ( iObj = i, iNext = Gia_ObjNext(pGia, iObj); iObj;
2636 iObj = iNext, iNext = Gia_ObjNext(pGia, iObj) )
2637 {
2638 Gia_ObjUnsetRepr( pGia, iObj );
2639 Gia_ObjSetNext( pGia, iObj, 0 );
2640 iLitsNew--;
2641 }
2642 iLitsNew++;
2643 assert( !Gia_ObjIsHead(pGia, i) );
2644 }
2645 }
2646 Vec_IntFree( vNodes );
2647 Vec_IntFree( vFfIds );
2648 Abc_Print( 1, "The number of literals: Before = %d. After = %d.\n", iLitsOld, iLitsNew );
2649}

◆ Gia_ManFilterEquivsUsingParts()

int Gia_ManFilterEquivsUsingParts ( Gia_Man_t * pGia,
char * pName1,
char * pName2 )
extern

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

Synopsis [Reduces AIG using equivalence classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 2404 of file giaEquiv.c.

2405{
2406 Vec_Int_t * vNodes;
2407 Gia_Man_t * pGia1, * pGia2, * pMiter;
2408 Gia_Obj_t * pObj1, * pObj2, * pObjM, * pObj = NULL;
2409 int i, k, iObj, iNext, iPrev, iRepr;
2410 int iLitsOld, iLitsNew;
2411 if ( pGia->pReprs == NULL || pGia->pNexts == NULL )
2412 {
2413 Abc_Print( 1, "Equivalences are not defined.\n" );
2414 return 0;
2415 }
2416 pGia1 = Gia_AigerRead( pName1, 0, 0, 0 );
2417 if ( pGia1 == NULL )
2418 {
2419 Abc_Print( 1, "Cannot read first file %s.\n", pName1 );
2420 return 0;
2421 }
2422 pGia2 = Gia_AigerRead( pName2, 0, 0, 0 );
2423 if ( pGia2 == NULL )
2424 {
2425 Gia_ManStop( pGia2 );
2426 Abc_Print( 1, "Cannot read second file %s.\n", pName2 );
2427 return 0;
2428 }
2429 pMiter = Gia_ManMiter( pGia1, pGia2, 0, 0, 1, 0, 0 );
2430 if ( pMiter == NULL )
2431 {
2432 Gia_ManStop( pGia1 );
2433 Gia_ManStop( pGia2 );
2434 Abc_Print( 1, "Cannot create sequential miter.\n" );
2435 return 0;
2436 }
2437 // make sure the miter is isomorphic
2438 if ( Gia_ManObjNum(pGia) != Gia_ManObjNum(pMiter) )
2439 {
2440 Gia_ManStop( pGia1 );
2441 Gia_ManStop( pGia2 );
2442 Gia_ManStop( pMiter );
2443 Abc_Print( 1, "The number of objects in different.\n" );
2444 return 0;
2445 }
2446 if ( memcmp( pGia->pObjs, pMiter->pObjs, sizeof(Gia_Obj_t) * Gia_ManObjNum(pGia) ) )
2447 {
2448 Gia_ManStop( pGia1 );
2449 Gia_ManStop( pGia2 );
2450 Gia_ManStop( pMiter );
2451 Abc_Print( 1, "The AIG structure of the miter does not match.\n" );
2452 return 0;
2453 }
2454 // transfer copies
2455 Gia_ManCleanMark0( pGia );
2456 Gia_ManForEachObj( pGia1, pObj1, i )
2457 {
2458 if ( pObj1->Value == ~0 )
2459 continue;
2460 pObjM = Gia_ManObj( pMiter, Abc_Lit2Var(pObj1->Value) );
2461 pObj = Gia_ManObj( pGia, Gia_ObjId(pMiter, pObjM) );
2462 pObj->fMark0 = 1;
2463 }
2464 Gia_ManCleanMark1( pGia );
2465 Gia_ManForEachObj( pGia2, pObj2, i )
2466 {
2467 if ( pObj2->Value == ~0 )
2468 continue;
2469 pObjM = Gia_ManObj( pMiter, Abc_Lit2Var(pObj2->Value) );
2470 pObj = Gia_ManObj( pGia, Gia_ObjId(pMiter, pObjM) );
2471 pObj->fMark1 = 1;
2472 }
2473
2474 // filter equivalences
2475 iLitsOld = iLitsNew = 0;
2476 Gia_ManForEachConst( pGia, i )
2477 {
2478 iLitsOld++;
2479 pObj = Gia_ManObj( pGia, i );
2480 assert( pGia->pNexts[i] == 0 );
2481 assert( pObj->fMark0 || pObj->fMark1 );
2482 if ( pObj->fMark0 && pObj->fMark1 ) // belongs to both A and B
2483 Gia_ObjUnsetRepr( pGia, i );
2484 else
2485 iLitsNew++;
2486 }
2487 // filter equivalences
2488 vNodes = Vec_IntAlloc( 100 );
2489 Gia_ManForEachClass( pGia, i )
2490 {
2491 int fSeenA = 0, fSeenB = 0;
2492 assert( pObj->fMark0 || pObj->fMark1 );
2493 Vec_IntClear( vNodes );
2494 Gia_ClassForEachObj( pGia, i, iObj )
2495 {
2496 pObj = Gia_ManObj( pGia, iObj );
2497 if ( pObj->fMark0 && !pObj->fMark1 )
2498 {
2499 fSeenA = 1;
2500 Vec_IntPush( vNodes, iObj );
2501 }
2502 if ( !pObj->fMark0 && pObj->fMark1 )
2503 {
2504 fSeenB = 1;
2505 Vec_IntPush( vNodes, iObj );
2506 }
2507 iLitsOld++;
2508 }
2509 iLitsOld--;
2510 // undo equivalence classes
2511 for ( iObj = i, iNext = Gia_ObjNext(pGia, iObj); iObj;
2512 iObj = iNext, iNext = Gia_ObjNext(pGia, iObj) )
2513 {
2514 Gia_ObjUnsetRepr( pGia, iObj );
2515 Gia_ObjSetNext( pGia, iObj, 0 );
2516 }
2517 assert( !Gia_ObjIsHead(pGia, i) );
2518 if ( fSeenA && fSeenB && Vec_IntSize(vNodes) > 1 )
2519 {
2520 // create new class
2521 iPrev = iRepr = Vec_IntEntry( vNodes, 0 );
2522 Vec_IntForEachEntryStart( vNodes, iObj, k, 1 )
2523 {
2524 Gia_ObjSetRepr( pGia, iObj, iRepr );
2525 Gia_ObjSetNext( pGia, iPrev, iObj );
2526 iPrev = iObj;
2527 iLitsNew++;
2528 }
2529 assert( Gia_ObjNext(pGia, iPrev) == 0 );
2530 }
2531 }
2532 Vec_IntFree( vNodes );
2533 Abc_Print( 1, "The number of literals: Before = %d. After = %d.\n", iLitsOld, iLitsNew );
2534//Gia_ManEquivPrintClasses( pGia, 1, 0 );
2535
2536 Gia_ManCleanMark0( pGia );
2537 Gia_ManCleanMark1( pGia );
2538 return 1;
2539}
Here is the call graph for this function:

◆ Gia_ManFindFailedPoCex()

int Gia_ManFindFailedPoCex ( Gia_Man_t * pAig,
Abc_Cex_t * p,
int nOutputs )
extern

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

Synopsis [Resimulates the counter-example.]

Description []

SideEffects []

SeeAlso []

Definition at line 91 of file giaCex.c.

92{
93 Gia_Obj_t * pObj, * pObjRi, * pObjRo;
94 int RetValue, i, k, iBit = 0;
95 assert( Gia_ManPiNum(pAig) == p->nPis );
97 Gia_ManForEachRo( pAig, pObj, i )
98 pObj->fMark0 = Abc_InfoHasBit(p->pData, iBit++);
99 iBit = p->nRegs;
100 for ( i = 0; i <= p->iFrame; i++ )
101 {
102 Gia_ManForEachPi( pAig, pObj, k )
103 pObj->fMark0 = Abc_InfoHasBit(p->pData, iBit++);
104 Gia_ManForEachAnd( pAig, pObj, k )
105 pObj->fMark0 = (Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj)) &
106 (Gia_ObjFanin1(pObj)->fMark0 ^ Gia_ObjFaninC1(pObj));
107 Gia_ManForEachCo( pAig, pObj, k )
108 pObj->fMark0 = Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj);
109 Gia_ManForEachRiRo( pAig, pObjRi, pObjRo, k )
110 pObjRo->fMark0 = pObjRi->fMark0;
111 }
112 assert( iBit == p->nBits );
113 // figure out the number of failed output
114 RetValue = -1;
115// for ( i = Gia_ManPoNum(pAig) - 1; i >= nOutputs; i-- )
116 for ( i = nOutputs; i < Gia_ManPoNum(pAig); i++ )
117 {
118 if ( Gia_ManPo(pAig, i)->fMark0 )
119 {
120 RetValue = i;
121 break;
122 }
123 }
124 Gia_ManCleanMark0(pAig);
125 return RetValue;
126}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManFirstFanouts()

Vec_Int_t * Gia_ManFirstFanouts ( Gia_Man_t * p)
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 1861 of file giaUtil.c.

1862{
1863 Vec_Int_t * vFans = Vec_IntStart( Gia_ManObjNum(p) );
1864 Gia_Obj_t * pObj;
1865 int i;
1866 Gia_ManForEachObj( p, pObj, i )
1867 {
1868 if ( Gia_ObjIsAnd(pObj) )
1869 {
1870 if ( Vec_IntEntry(vFans, Gia_ObjFaninId0p(p, pObj)) == 0 )
1871 Vec_IntWriteEntry(vFans, Gia_ObjFaninId0p(p, pObj), i);
1872 if ( Vec_IntEntry(vFans, Gia_ObjFaninId1p(p, pObj)) == 0 )
1873 Vec_IntWriteEntry(vFans, Gia_ObjFaninId1p(p, pObj), i);
1874 if ( Gia_ObjIsMuxId(p, i) && Vec_IntEntry(vFans, Gia_ObjFaninId2p(p, pObj)) == 0 )
1875 Vec_IntWriteEntry(vFans, Gia_ObjFaninId2p(p, pObj), i);
1876 }
1877 else if ( Gia_ObjIsCo(pObj) )
1878 {
1879 if ( Vec_IntEntry(vFans, Gia_ObjFaninId0p(p, pObj)) == 0 )
1880 Vec_IntWriteEntry(vFans, Gia_ObjFaninId0p(p, pObj), i);
1881 }
1882 }
1883 return vFans;
1884}
Here is the caller graph for this function:

◆ Gia_ManFraigSweepSimple()

Gia_Man_t * Gia_ManFraigSweepSimple ( Gia_Man_t * p,
void * pPars )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 606 of file giaSweep.c.

607{
608 Gia_Man_t * pNew;
609 assert( p->pManTime == NULL || Gia_ManBoxNum(p) == 0 );
610 Gia_ManFraigSweepPerform( p, pPars );
611 pNew = Gia_ManEquivReduce( p, 1, 0, 0, 0 );
612 if ( pNew == NULL )
613 pNew = Gia_ManDup(p);
614 Gia_ManTransferTiming( pNew, p );
615 return pNew;
616}
void Gia_ManFraigSweepPerform(Gia_Man_t *p, void *pPars)
Definition giaSweep.c:585
Gia_Man_t * Gia_ManEquivReduce(Gia_Man_t *p, int fUseAll, int fDualOut, int fSkipPhase, int fVerbose)
Definition giaEquiv.c:677
int Gia_ManBoxNum(Gia_Man_t *p)
DECLARATIONS ///.
Definition giaTim.c:50
Here is the call graph for this function:

◆ Gia_ManFrames()

Gia_Man_t * Gia_ManFrames ( Gia_Man_t * pAig,
Gia_ParFra_t * pPars )
extern

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 )
890 Vec_IntWriteEntry( vPoLits, i, Abc_LitNot(Gia_ManAppendAnd2(pFrames, Abc_LitNot(Vec_IntEntry(vPoLits, i)), Abc_LitNot(Gia_ObjFanin0Copy(pObj)))) );
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_ManFramesInit(Gia_Man_t *pAig, Gia_ParFra_t *pPars)
Definition giaFrames.c:727
int fInit
Definition gia.h:297
int nFrames
Definition gia.h:296
int fDisableSt
Definition gia.h:299
int fVerbose
Definition gia.h:301
int fOrPos
Definition gia.h:300
Here is the call graph for this function:

◆ Gia_ManFramesInitSpecial()

Gia_Man_t * Gia_ManFramesInitSpecial ( Gia_Man_t * pAig,
int nFrames,
int fVerbose )
extern

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}
Here is the call graph for this function:

◆ Gia_ManFraSetDefaultParams()

void Gia_ManFraSetDefaultParams ( Gia_ParFra_t * p)
extern

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}
struct Gia_ParFra_t_ Gia_ParFra_t
Definition gia.h:293
Here is the call graph for this function:

◆ Gia_ManFront()

Gia_Man_t * Gia_ManFront ( Gia_Man_t * p)
extern

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}
int Gia_ManCrossCutSimple(Gia_Man_t *p)
Definition giaFront.c:106
void Gia_ManCreateValueRefs(Gia_Man_t *p)
Definition giaUtil.c:750
#define GIA_NONE
INCLUDES ///.
Definition gia.h:45
int nFront
Definition gia.h:124
unsigned iDiff1
Definition gia.h:84
unsigned fCompl1
Definition gia.h:85
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManFrontTest()

void Gia_ManFrontTest ( Gia_Man_t * p)
extern

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}
void Gia_ManFrontTransform(Gia_Man_t *p)
Definition giaFront.c:65
Gia_Man_t * Gia_ManFront(Gia_Man_t *p)
Definition giaFront.c:147
Here is the call graph for this function:

◆ Gia_ManGetCiLevels()

Vec_Int_t * Gia_ManGetCiLevels ( Gia_Man_t * p)
extern

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

Synopsis [Assigns levels using CI level information.]

Description []

SideEffects []

SeeAlso []

Definition at line 609 of file giaUtil.c.

610{
611 Vec_Int_t * vCiLevels;
612 Gia_Obj_t * pObj;
613 int i;
614 if ( p->vLevels == NULL )
615 return NULL;
616 vCiLevels = Vec_IntAlloc( Gia_ManCiNum(p) );
617 Gia_ManForEachCi( p, pObj, i )
618 Vec_IntPush( vCiLevels, Gia_ObjLevel(p, pObj) );
619 return vCiLevels;
620}
Here is the caller graph for this function:

◆ Gia_ManGetDangling()

Vec_Int_t * Gia_ManGetDangling ( Gia_Man_t * p)
extern

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

Synopsis [Returns 1 if AIG has dangling nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1422 of file giaUtil.c.

1423{
1424 Vec_Int_t * vDangles;
1425 Gia_Obj_t * pObj;
1426 int i;
1427 Gia_ManForEachObj( p, pObj, i )
1428 {
1429 pObj->fMark0 = 0;
1430 if ( Gia_ObjIsAnd(pObj) )
1431 {
1432 Gia_ObjFanin0(pObj)->fMark0 = 1;
1433 Gia_ObjFanin1(pObj)->fMark0 = 1;
1434 }
1435 else if ( Gia_ObjIsCo(pObj) )
1436 Gia_ObjFanin0(pObj)->fMark0 = 1;
1437 }
1438 vDangles = Vec_IntAlloc( 100 );
1439 Gia_ManForEachAnd( p, pObj, i )
1440 if ( !pObj->fMark0 )
1441 Vec_IntPush( vDangles, i );
1443 return vDangles;
1444}
void Gia_ManCleanMark0(Gia_Man_t *p)
Definition giaUtil.c:256
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManHasDangling()

int Gia_ManHasDangling ( Gia_Man_t * p)
extern

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

Synopsis [Returns 1 if AIG has dangling nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1353 of file giaUtil.c.

1354{
1355 Gia_Obj_t * pObj;
1356 int i, Counter = 0;
1357 Gia_ManForEachObj( p, pObj, i )
1358 {
1359 pObj->fMark0 = 0;
1360 if ( Gia_ObjIsCo(pObj) )
1361 Gia_ObjFanin0(pObj)->fMark0 = 1;
1362 else if ( Gia_ObjIsMux(p, pObj) )
1363 {
1364 Gia_ObjFanin0(pObj)->fMark0 = 1;
1365 Gia_ObjFanin1(pObj)->fMark0 = 1;
1366 Gia_ObjFanin2(p, pObj)->fMark0 = 1;
1367 }
1368 else if ( Gia_ObjIsAnd(pObj) )
1369 {
1370 Gia_ObjFanin0(pObj)->fMark0 = 1;
1371 Gia_ObjFanin1(pObj)->fMark0 = 1;
1372 }
1373 }
1374 Gia_ManForEachAnd( p, pObj, i )
1375 Counter += !pObj->fMark0;
1377 return Counter;
1378}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManHashAlloc()

void Gia_ManHashAlloc ( Gia_Man_t * p)
extern

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

Synopsis [Starts the hash table.]

Description []

SideEffects []

SeeAlso []

Definition at line 105 of file giaHash.c.

106{
107 assert( Vec_IntSize(&p->vHTable) == 0 );
108 Vec_IntFill( &p->vHTable, Abc_PrimeCudd( Gia_ManAndNum(p) ? Gia_ManAndNum(p) + 1000 : p->nObjsAlloc ), 0 );
109 Vec_IntGrow( &p->vHash, Abc_MaxInt(Vec_IntSize(&p->vHTable), Gia_ManObjNum(p)) );
110 Vec_IntFill( &p->vHash, Gia_ManObjNum(p), 0 );
111//printf( "Alloced table with %d entries.\n", Vec_IntSize(&p->vHTable) );
112}

◆ Gia_ManHashAnd()

int Gia_ManHashAnd ( Gia_Man_t * p,
int iLit0,
int iLit1 )
extern

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

Synopsis [Hashes AND gate.]

Description []

SideEffects []

SeeAlso []

Definition at line 576 of file giaHash.c.

577{
578 if ( iLit0 < 2 )
579 return iLit0 ? iLit1 : 0;
580 if ( iLit1 < 2 )
581 return iLit1 ? iLit0 : 0;
582 if ( iLit0 == iLit1 )
583 return iLit1;
584 if ( iLit0 == Abc_LitNot(iLit1) )
585 return 0;
586 if ( p->fGiaSimple )
587 {
588 assert( Vec_IntSize(&p->vHTable) == 0 );
589 return Gia_ManAppendAnd( p, iLit0, iLit1 );
590 }
591 if ( (p->nObjs & 0xFF) == 0 && 2 * Vec_IntSize(&p->vHTable) < Gia_ManAndNum(p) )
593 if ( p->fAddStrash )
594 {
595 Gia_Obj_t * pObj = Gia_ManAddStrash( p, Gia_ObjFromLit(p, iLit0), Gia_ObjFromLit(p, iLit1) );
596 if ( pObj != NULL )
597 return Gia_ObjToLit( p, pObj );
598 }
599 if ( iLit0 > iLit1 )
600 iLit0 ^= iLit1, iLit1 ^= iLit0, iLit0 ^= iLit1;
601 {
602 int * pPlace = Gia_ManHashFind( p, iLit0, iLit1, -1 );
603 if ( *pPlace )
604 {
605 p->nHashHit++;
606 return Abc_Var2Lit( *pPlace, 0 );
607 }
608 p->nHashMiss++;
609 if ( Vec_IntSize(&p->vHash) < Vec_IntCap(&p->vHash) )
610 *pPlace = Abc_Lit2Var( Gia_ManAppendAnd( p, iLit0, iLit1 ) );
611 else
612 {
613 int iNode = Gia_ManAppendAnd( p, iLit0, iLit1 );
614 pPlace = Gia_ManHashFind( p, iLit0, iLit1, -1 );
615 assert( *pPlace == 0 );
616 *pPlace = Abc_Lit2Var( iNode );
617 }
618 return Abc_Var2Lit( *pPlace, 0 );
619 }
620}
void Gia_ManHashResize(Gia_Man_t *p)
Definition giaHash.c:166
Here is the call graph for this function:

◆ Gia_ManHashAndMulti()

int Gia_ManHashAndMulti ( Gia_Man_t * p,
Vec_Int_t * vLits )
extern

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

Synopsis [Creates well-balanced AND gate.]

Description []

SideEffects []

SeeAlso []

Definition at line 783 of file giaHash.c.

784{
785 if ( Vec_IntSize(vLits) == 0 )
786 return 0;
787 while ( Vec_IntSize(vLits) > 1 )
788 {
789 int i, k = 0, Lit1, Lit2, LitRes;
790 Vec_IntForEachEntryDouble( vLits, Lit1, Lit2, i )
791 {
792 LitRes = Gia_ManHashAnd( p, Lit1, Lit2 );
793 Vec_IntWriteEntry( vLits, k++, LitRes );
794 }
795 if ( Vec_IntSize(vLits) & 1 )
796 Vec_IntWriteEntry( vLits, k++, Vec_IntEntryLast(vLits) );
797 Vec_IntShrink( vLits, k );
798 }
799 assert( Vec_IntSize(vLits) == 1 );
800 return Vec_IntEntry(vLits, 0);
801}
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:576
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManHashAndMulti2()

int Gia_ManHashAndMulti2 ( Gia_Man_t * p,
Vec_Int_t * vLits )
extern

Definition at line 802 of file giaHash.c.

803{
804 int i, iLit, iRes = 1;
805 Vec_IntForEachEntry( vLits, iLit, i )
806 iRes = Gia_ManHashAnd( p, iRes, iLit );
807 return iRes;
808}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManHashAndTry()

int Gia_ManHashAndTry ( Gia_Man_t * p,
int iLit0,
int iLit1 )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 637 of file giaHash.c.

638{
639 if ( iLit0 < 2 )
640 return iLit0 ? iLit1 : 0;
641 if ( iLit1 < 2 )
642 return iLit1 ? iLit0 : 0;
643 if ( iLit0 == iLit1 )
644 return iLit1;
645 if ( iLit0 == Abc_LitNot(iLit1) )
646 return 0;
647 if ( iLit0 > iLit1 )
648 iLit0 ^= iLit1, iLit1 ^= iLit0, iLit0 ^= iLit1;
649 {
650 int * pPlace = Gia_ManHashFind( p, iLit0, iLit1, -1 );
651 if ( *pPlace )
652 return Abc_Var2Lit( *pPlace, 0 );
653 return -1;
654 }
655}
Here is the caller graph for this function:

◆ Gia_ManHashDualMiter()

int Gia_ManHashDualMiter ( Gia_Man_t * p,
Vec_Int_t * vOuts )
extern

Definition at line 809 of file giaHash.c.

810{
811 int i, iLit0, iLit1, iRes = 0;
812 Vec_IntForEachEntryDouble( vOuts, iLit0, iLit1, i )
813 iRes = Gia_ManHashOr( p, iRes, Gia_ManHashXor(p, iLit0, iLit1) );
814 return iRes;
815}
int Gia_ManHashOr(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:621
int Gia_ManHashXor(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:668
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManHashLookup()

int Gia_ManHashLookup ( Gia_Man_t * p,
Gia_Obj_t * p0,
Gia_Obj_t * p1 )
extern

Definition at line 87 of file giaHash.c.

88{
89 int iLit0 = Gia_ObjToLit( p, p0 );
90 int iLit1 = Gia_ObjToLit( p, p1 );
91 return Gia_ManHashLookupInt( p, iLit0, iLit1 );
92}
int Gia_ManHashLookupInt(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:81
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManHashLookupInt()

int Gia_ManHashLookupInt ( Gia_Man_t * p,
int iLit0,
int iLit1 )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 81 of file giaHash.c.

82{
83 if ( iLit0 > iLit1 )
84 iLit0 ^= iLit1, iLit1 ^= iLit0, iLit0 ^= iLit1;
85 return Abc_Var2Lit( *Gia_ManHashFind( p, iLit0, iLit1, -1 ), 0 );
86}
Here is the caller graph for this function:

◆ Gia_ManHashMaj()

int Gia_ManHashMaj ( Gia_Man_t * p,
int iData0,
int iData1,
int iData2 )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 720 of file giaHash.c.

721{
722 int iTemp0 = Gia_ManHashOr( p, iData1, iData2 );
723 int iTemp1 = Gia_ManHashAnd( p, iData0, iTemp0 );
724 int iTemp2 = Gia_ManHashAnd( p, iData1, iData2 );
725 return Gia_ManHashOr( p, iTemp1, iTemp2 );
726}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManHashMux()

int Gia_ManHashMux ( Gia_Man_t * p,
int iCtrl,
int iData1,
int iData0 )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 692 of file giaHash.c.

693{
694 if ( p->fGiaSimple )
695 return Gia_ManHashOr(p, Gia_ManHashAnd(p, iCtrl, iData1), Gia_ManHashAnd(p, Abc_LitNot(iCtrl), iData0) );
696 else
697 {
698 int iTemp0, iTemp1, fCompl = 0;
699 if ( iData0 > iData1 )
700 iData0 ^= iData1, iData1 ^= iData0, iData0 ^= iData1, iCtrl = Abc_LitNot(iCtrl);
701 if ( Abc_LitIsCompl(iData1) )
702 iData0 = Abc_LitNot(iData0), iData1 = Abc_LitNot(iData1), fCompl = 1;
703 iTemp0 = Gia_ManHashAnd( p, Abc_LitNot(iCtrl), iData0 );
704 iTemp1 = Gia_ManHashAnd( p, iCtrl, iData1 );
705 return Abc_LitNotCond( Gia_ManHashAnd( p, Abc_LitNot(iTemp0), Abc_LitNot(iTemp1) ), !fCompl );
706 }
707}
Here is the call graph for this function:

◆ Gia_ManHashMuxReal()

int Gia_ManHashMuxReal ( Gia_Man_t * p,
int iLitC,
int iLit1,
int iLit0 )
extern

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

Synopsis [Hashes MUX gate.]

Description []

SideEffects []

SeeAlso []

Definition at line 521 of file giaHash.c.

522{
523 int fCompl = 0;
524 assert( p->fAddStrash == 0 );
525 if ( iLitC < 2 )
526 return iLitC ? iLit1 : iLit0;
527 if ( iLit0 < 2 )
528 return iLit0 ? Gia_ManHashOr(p, Abc_LitNot(iLitC), iLit1) : Gia_ManHashAnd(p, iLitC, iLit1);
529 if ( iLit1 < 2 )
530 return iLit1 ? Gia_ManHashOr(p, iLitC, iLit0) : Gia_ManHashAnd(p, Abc_LitNot(iLitC), iLit0);
531 assert( iLit0 > 1 && iLit1 > 1 && iLitC > 1 );
532 if ( iLit0 == iLit1 )
533 return iLit0;
534 if ( iLitC == iLit0 || iLitC == Abc_LitNot(iLit1) )
535 return Gia_ManHashAnd(p, iLit0, iLit1);
536 if ( iLitC == iLit1 || iLitC == Abc_LitNot(iLit0) )
537 return Gia_ManHashOr(p, iLit0, iLit1);
538 if ( Abc_Lit2Var(iLit0) == Abc_Lit2Var(iLit1) )
539 return Gia_ManHashXorReal( p, iLitC, iLit0 );
540 if ( iLit0 > iLit1 )
541 iLit0 ^= iLit1, iLit1 ^= iLit0, iLit0 ^= iLit1, iLitC = Abc_LitNot(iLitC);
542 if ( Abc_LitIsCompl(iLit1) )
543 iLit0 = Abc_LitNot(iLit0), iLit1 = Abc_LitNot(iLit1), fCompl = 1;
544 {
545 int *pPlace = Gia_ManHashFind( p, iLit0, iLit1, iLitC );
546 if ( *pPlace )
547 {
548 p->nHashHit++;
549 return Abc_Var2Lit( *pPlace, fCompl );
550 }
551 p->nHashMiss++;
552 if ( Vec_IntSize(&p->vHash) < Vec_IntCap(&p->vHash) )
553 *pPlace = Abc_Lit2Var( Gia_ManAppendMuxReal( p, iLitC, iLit1, iLit0 ) );
554 else
555 {
556 int iNode = Gia_ManAppendMuxReal( p, iLitC, iLit1, iLit0 );
557 pPlace = Gia_ManHashFind( p, iLit0, iLit1, iLitC );
558 assert( *pPlace == 0 );
559 *pPlace = Abc_Lit2Var( iNode );
560 }
561 return Abc_Var2Lit( *pPlace, fCompl );
562 }
563}
int Gia_ManHashXorReal(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:469
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManHashOr()

int Gia_ManHashOr ( Gia_Man_t * p,
int iLit0,
int iLit1 )
extern

Definition at line 621 of file giaHash.c.

622{
623 return Abc_LitNot(Gia_ManHashAnd( p, Abc_LitNot(iLit0), Abc_LitNot(iLit1) ));
624}
Here is the call graph for this function:

◆ Gia_ManHashProfile()

void Gia_ManHashProfile ( Gia_Man_t * p)
extern

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

Synopsis [Profiles the hash table.]

Description []

SideEffects []

SeeAlso []

Definition at line 207 of file giaHash.c.

208{
209 int iEntry;
210 int i, Counter, Limit;
211 printf( "Table size = %d. Entries = %d. ", Vec_IntSize(&p->vHTable), Gia_ManAndNum(p) );
212 printf( "Hits = %d. Misses = %d.\n", (int)p->nHashHit, (int)p->nHashMiss );
213 Limit = Abc_MinInt( 1000, Vec_IntSize(&p->vHTable) );
214 for ( i = 0; i < Limit; i++ )
215 {
216 Counter = 0;
217 for ( iEntry = Vec_IntEntry(&p->vHTable, i);
218 iEntry;
219 iEntry = iEntry? Vec_IntEntry(&p->vHash, iEntry) : 0 )
220 Counter++;
221 if ( Counter )
222 printf( "%d ", Counter );
223 }
224 printf( "\n" );
225}

◆ Gia_ManHashStart()

void Gia_ManHashStart ( Gia_Man_t * p)
extern

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

Synopsis [Starts the hash table.]

Description []

SideEffects []

SeeAlso []

Definition at line 125 of file giaHash.c.

126{
127 Gia_Obj_t * pObj;
128 int * pPlace, i;
130 Gia_ManForEachAnd( p, pObj, i )
131 {
132 pPlace = Gia_ManHashFind( p, Gia_ObjFaninLit0(pObj, i), Gia_ObjFaninLit1(pObj, i), Gia_ObjFaninLit2(p, i) );
133 assert( *pPlace == 0 );
134 *pPlace = i;
135 }
136}
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition giaHash.c:105
Here is the call graph for this function:

◆ Gia_ManHashStop()

void Gia_ManHashStop ( Gia_Man_t * p)
extern

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

Synopsis [Stops the hash table.]

Description []

SideEffects []

SeeAlso []

Definition at line 149 of file giaHash.c.

150{
151 Vec_IntErase( &p->vHTable );
152 Vec_IntErase( &p->vHash );
153}

◆ Gia_ManHashXor()

int Gia_ManHashXor ( Gia_Man_t * p,
int iLit0,
int iLit1 )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 668 of file giaHash.c.

669{
670 if ( p->fGiaSimple )
671 return Gia_ManHashOr(p, Gia_ManHashAnd(p, iLit0, Abc_LitNot(iLit1)), Gia_ManHashAnd(p, Abc_LitNot(iLit0), iLit1) );
672 else
673 {
674 int fCompl = Abc_LitIsCompl(iLit0) ^ Abc_LitIsCompl(iLit1);
675 int iTemp0 = Gia_ManHashAnd( p, Abc_LitRegular(iLit0), Abc_LitNot(Abc_LitRegular(iLit1)) );
676 int iTemp1 = Gia_ManHashAnd( p, Abc_LitRegular(iLit1), Abc_LitNot(Abc_LitRegular(iLit0)) );
677 return Abc_LitNotCond( Gia_ManHashAnd( p, Abc_LitNot(iTemp0), Abc_LitNot(iTemp1) ), !fCompl );
678 }
679}
Here is the call graph for this function:

◆ Gia_ManHashXorReal()

int Gia_ManHashXorReal ( Gia_Man_t * p,
int iLit0,
int iLit1 )
extern

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

Synopsis [Hashes XOR gate.]

Description []

SideEffects []

SeeAlso []

Definition at line 469 of file giaHash.c.

470{
471 int fCompl = 0;
472 assert( p->fAddStrash == 0 );
473 if ( iLit0 < 2 )
474 return iLit0 ? Abc_LitNot(iLit1) : iLit1;
475 if ( iLit1 < 2 )
476 return iLit1 ? Abc_LitNot(iLit0) : iLit0;
477 if ( iLit0 == iLit1 )
478 return 0;
479 if ( iLit0 == Abc_LitNot(iLit1) )
480 return 1;
481 if ( (p->nObjs & 0xFF) == 0 && 2 * Vec_IntSize(&p->vHTable) < Gia_ManAndNum(p) )
483 if ( iLit0 < iLit1 )
484 iLit0 ^= iLit1, iLit1 ^= iLit0, iLit0 ^= iLit1;
485 if ( Abc_LitIsCompl(iLit0) )
486 iLit0 = Abc_LitNot(iLit0), fCompl ^= 1;
487 if ( Abc_LitIsCompl(iLit1) )
488 iLit1 = Abc_LitNot(iLit1), fCompl ^= 1;
489 {
490 int *pPlace = Gia_ManHashFind( p, iLit0, iLit1, -1 );
491 if ( *pPlace )
492 {
493 p->nHashHit++;
494 return Abc_Var2Lit( *pPlace, fCompl );
495 }
496 p->nHashMiss++;
497 if ( Vec_IntSize(&p->vHash) < Vec_IntCap(&p->vHash) )
498 *pPlace = Abc_Lit2Var( Gia_ManAppendXorReal( p, iLit0, iLit1 ) );
499 else
500 {
501 int iNode = Gia_ManAppendXorReal( p, iLit0, iLit1 );
502 pPlace = Gia_ManHashFind( p, iLit0, iLit1, -1 );
503 assert( *pPlace == 0 );
504 *pPlace = Abc_Lit2Var( iNode );
505 }
506 return Abc_Var2Lit( *pPlace, fCompl );
507 }
508}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManIncrementTravId()

void Gia_ManIncrementTravId ( Gia_Man_t * p)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 190 of file giaUtil.c.

191{
192 if ( p->pTravIds == NULL )
193 {
194 p->nTravIdsAlloc = Gia_ManObjNum(p) + 100;
195 p->pTravIds = ABC_CALLOC( int, p->nTravIdsAlloc );
196 p->nTravIds = 0;
197 }
198 while ( p->nTravIdsAlloc < Gia_ManObjNum(p) )
199 {
200 p->nTravIdsAlloc *= 2;
201 p->pTravIds = ABC_REALLOC( int, p->pTravIds, p->nTravIdsAlloc );
202 memset( p->pTravIds + p->nTravIdsAlloc/2, 0, sizeof(int) * p->nTravIdsAlloc/2 );
203 }
204 p->nTravIds++;
205}
#define ABC_REALLOC(type, obj, num)
Definition abc_global.h:268
Here is the call graph for this function:

◆ Gia_ManIncrSimCheckEqual()

int Gia_ManIncrSimCheckEqual ( Gia_Man_t * p,
int iLit0,
int iLit1 )
extern

Definition at line 1214 of file giaSim.c.

1215{
1216 assert( iLit0 > 1 && iLit1 > 1 );
1218 Gia_ManIncrSimCone_rec( p, Abc_Lit2Var(iLit0) );
1219 Gia_ManIncrSimCone_rec( p, Abc_Lit2Var(iLit1) );
1220// return 1; // disable
1221 return Gia_ManBuiltInSimCheckEqual( p, iLit0, iLit1 );
1222}
void Gia_ManIncrSimCone_rec(Gia_Man_t *p, int iObj)
Definition giaSim.c:1191
int Gia_ManBuiltInSimCheckEqual(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaSim.c:902
void Gia_ManIncrSimUpdate(Gia_Man_t *p)
Definition giaSim.c:1131
Here is the call graph for this function:

◆ Gia_ManIncrSimCheckOver()

int Gia_ManIncrSimCheckOver ( Gia_Man_t * p,
int iLit0,
int iLit1 )
extern

Definition at line 1205 of file giaSim.c.

1206{
1207 assert( iLit0 > 1 && iLit1 > 1 );
1209 Gia_ManIncrSimCone_rec( p, Abc_Lit2Var(iLit0) );
1210 Gia_ManIncrSimCone_rec( p, Abc_Lit2Var(iLit1) );
1211// return 0; // disable
1212 return Gia_ManBuiltInSimCheckOver( p, iLit0, iLit1 );
1213}
int Gia_ManBuiltInSimCheckOver(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaSim.c:859
Here is the call graph for this function:

◆ Gia_ManIncrSimSet()

void Gia_ManIncrSimSet ( Gia_Man_t * p,
Vec_Int_t * vObjLits )
extern

Definition at line 1174 of file giaSim.c.

1175{
1176 int i, iLit;
1177 assert( Vec_IntSize(vObjLits) > 0 );
1178 p->iTimeStamp++;
1179 Vec_IntForEachEntry( vObjLits, iLit, i )
1180 {
1181 word * pSims = Gia_ManBuiltInData( p, Abc_Lit2Var(iLit) );
1182 if ( Gia_ObjIsAnd(Gia_ManObj(p, Abc_Lit2Var(iLit))) )
1183 continue;
1184 //assert( Vec_IntEntry(p->vTimeStamps, Abc_Lit2Var(iLit)) == p->iTimeStamp-1 );
1185 Vec_IntWriteEntry(p->vTimeStamps, Abc_Lit2Var(iLit), p->iTimeStamp);
1186 if ( Abc_TtGetBit(pSims, p->iPatsPi) == Abc_LitIsCompl(iLit) )
1187 Abc_TtXorBit(pSims, p->iPatsPi);
1188 }
1189 p->iPatsPi = (p->iPatsPi == p->nSimWords * 64 - 1) ? 0 : p->iPatsPi + 1;
1190}

◆ Gia_ManIncrSimStart()

void Gia_ManIncrSimStart ( Gia_Man_t * p,
int nWords,
int nObjs )
extern

Definition at line 1150 of file giaSim.c.

1151{
1152 assert( !p->fIncrSim );
1153 p->fIncrSim = 1;
1154 p->iPatsPi = 0;
1155 p->nSimWords = nWords;
1156 // init time stamps
1157 p->iTimeStamp = 1;
1158 p->vTimeStamps = Vec_IntAlloc( p->nSimWords );
1159 // init object sim info
1160 p->iNextPi = 0;
1161 p->vSims = Vec_WrdAlloc( p->nSimWords * nObjs );
1162 Gia_ManRandomW( 1 );
1163}
Here is the call graph for this function:

◆ Gia_ManInvertConstraints()

void Gia_ManInvertConstraints ( Gia_Man_t * pAig)
extern

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

Synopsis [Complements the constraint outputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 1641 of file giaUtil.c.

1642{
1643 Gia_Obj_t * pObj;
1644 int i;
1645 if ( Gia_ManConstrNum(pAig) == 0 )
1646 return;
1647 Gia_ManForEachPo( pAig, pObj, i )
1648 if ( i >= Gia_ManPoNum(pAig) - Gia_ManConstrNum(pAig) )
1649 Gia_ObjFlipFaninC0( pObj );
1650}
Here is the caller graph for this function:

◆ Gia_ManInvertPos()

void Gia_ManInvertPos ( Gia_Man_t * pAig)
extern

Definition at line 1651 of file giaUtil.c.

1652{
1653 Gia_Obj_t * pObj;
1654 int i;
1655 Gia_ManForEachPo( pAig, pObj, i )
1656 Gia_ObjFlipFaninC0( pObj );
1657}
Here is the caller graph for this function:

◆ Gia_ManIsNormalized()

int Gia_ManIsNormalized ( Gia_Man_t * p)
extern

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

Synopsis [Makes sure the manager is normalized.]

Description []

SideEffects []

SeeAlso []

Definition at line 114 of file giaTim.c.

115{
116 int i, nOffset;
117 nOffset = 1;
118 for ( i = 0; i < Gia_ManCiNum(p); i++ )
119 if ( !Gia_ObjIsCi( Gia_ManObj(p, nOffset+i) ) )
120 return 0;
121 nOffset = 1 + Gia_ManCiNum(p) + Gia_ManAndNum(p);
122 for ( i = 0; i < Gia_ManCoNum(p); i++ )
123 if ( !Gia_ObjIsCo( Gia_ManObj(p, nOffset+i) ) )
124 return 0;
125 return 1;
126}
Here is the caller graph for this function:

◆ Gia_ManIsoCanonicize()

Gia_Man_t * Gia_ManIsoCanonicize ( Gia_Man_t * p,
int fVerbose )
extern

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}
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
Vec_Ptr_t * Gia_IsoDeriveEquivPos(Gia_Man_t *pGia, int fForward, int fVerbose)
Definition giaIso.c:720
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:4176
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition vecVec.h:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManIsoReduce()

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 )
extern

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}
Vec_Str_t * Gia_ManIsoFindString(Gia_Man_t *p, int iPo, int fVerbose, Vec_Int_t **pvPiPerm)
Definition giaIso.c:998
int Vec_IntCountNonTrivial(Vec_Ptr_t *vEquivs, int *pnUsed)
Definition giaIso.c:1049
Gia_Man_t * Gia_ManTransformMiter(Gia_Man_t *p)
Definition giaDup.c:3376
Gia_Man_t * Gia_ManDupCones(Gia_Man_t *p, int *pPos, int nPos, int fTrimPis)
Definition giaDup.c:3880
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManIsoReduce2()

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 )
extern

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}
Vec_Wec_t * Gia_Iso2ManPerform(Gia_Man_t *pGia, int fVerbose)
Definition giaIso2.c:680
Vec_Wec_t * Gia_Iso2ManCheckIsoClassesSkip(Gia_Man_t *p, Vec_Wec_t *vEquivs)
Definition giaIso2.c:569
Vec_Wec_t * Gia_Iso2ManCheckIsoClasses(Gia_Man_t *p, Vec_Wec_t *vEquivs)
Definition giaIso2.c:628
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.
Definition vecWec.h:42
Here is the call graph for this function:

◆ Gia_ManIsSeqWithBoxes()

int Gia_ManIsSeqWithBoxes ( Gia_Man_t * p)
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 98 of file giaTim.c.

99{
100 return (Gia_ManRegNum(p) > 0 && Gia_ManBoxNum(p) > 0);
101}
ABC_NAMESPACE_IMPL_START int Gia_ManBoxNum(Gia_Man_t *p)
DECLARATIONS ///.
Definition giaTim.c:50
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManLevelize()

Vec_Vec_t * Gia_ManLevelize ( Gia_Man_t * p)
extern

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

Synopsis [Levelizes the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 403 of file giaDfs.c.

404{
405 Gia_Obj_t * pObj;
406 Vec_Vec_t * vLevels;
407 int nLevels, Level, i;
408 nLevels = Gia_ManLevelNum( p );
409 vLevels = Vec_VecStart( nLevels + 1 );
410 Gia_ManForEachAnd( p, pObj, i )
411 {
412 Level = Gia_ObjLevel( p, pObj );
413 assert( Level <= nLevels );
414 Vec_VecPush( vLevels, Level, pObj );
415 }
416 return vLevels;
417}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManLevelizeR()

Vec_Wec_t * Gia_ManLevelizeR ( Gia_Man_t * p)
extern

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

Synopsis [Levelizes the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 430 of file giaDfs.c.

431{
432 Gia_Obj_t * pObj;
433 Vec_Wec_t * vLevels;
434 int nLevels, Level, i;
435 nLevels = Gia_ManLevelRNum( p );
436 vLevels = Vec_WecStart( nLevels + 1 );
437 Gia_ManForEachObj( p, pObj, i )
438 {
439 if ( i == 0 || (!Gia_ObjIsCo(pObj) && !Gia_ObjLevel(p, pObj)) )
440 continue;
441 Level = Gia_ObjLevel( p, pObj );
442 assert( Level <= nLevels );
443 Vec_WecPush( vLevels, Level, i );
444 }
445 return vLevels;
446}
int Gia_ManLevelRNum(Gia_Man_t *p)
Definition giaUtil.c:566
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManLevelNum()

int Gia_ManLevelNum ( Gia_Man_t * p)
extern

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

Synopsis [Assigns levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 546 of file giaUtil.c.

547{
548 Gia_Obj_t * pObj;
549 int i;
550 Gia_ManCleanLevels( p, Gia_ManObjNum(p) );
551 p->nLevels = 0;
552 Gia_ManForEachObj( p, pObj, i )
553 {
554 if ( !p->fGiaSimple && Gia_ObjIsBuf(pObj) )
555 Gia_ObjSetBufLevel( p, pObj );
556 else if ( Gia_ObjIsAnd(pObj) )
557 Gia_ObjSetGateLevel( p, pObj );
558 else if ( Gia_ObjIsCo(pObj) )
559 Gia_ObjSetCoLevel( p, pObj );
560 else
561 Gia_ObjSetLevel( p, pObj, 0 );
562 p->nLevels = Abc_MaxInt( p->nLevels, Gia_ObjLevel(p, pObj) );
563 }
564 return p->nLevels;
565}
void Gia_ManCleanLevels(Gia_Man_t *p, int Size)
Definition giaUtil.c:511
Here is the call graph for this function:

◆ Gia_ManLevelRNum()

int Gia_ManLevelRNum ( Gia_Man_t * p)
extern

Definition at line 566 of file giaUtil.c.

567{
568 Gia_Obj_t * pObj;
569 int i;
570 Gia_ManCleanLevels( p, Gia_ManObjNum(p) );
571 p->nLevels = 0;
572 Gia_ManForEachObjReverse( p, pObj, i )
573 {
574 if ( !p->fGiaSimple && Gia_ObjIsBuf(pObj) )
575 Gia_ObjUpdateLevelId( p, Gia_ObjFaninId0(pObj, i), Gia_ObjLevel(p, pObj) );
576 else if ( Gia_ObjIsAnd(pObj) )
577 {
578 Gia_ObjUpdateLevelId( p, Gia_ObjFaninId0(pObj, i), 1+Gia_ObjLevel(p, pObj) );
579 Gia_ObjUpdateLevelId( p, Gia_ObjFaninId1(pObj, i), 1+Gia_ObjLevel(p, pObj) );
580 }
581 else if ( Gia_ObjIsCo(pObj) )
582 Gia_ObjUpdateLevelId( p, Gia_ObjFaninId0(pObj, i), 1 );
583 else
584 p->nLevels = Abc_MaxInt( p->nLevels, Gia_ObjLevel(p, pObj) );
585 }
586 return p->nLevels;
587}
#define Gia_ManForEachObjReverse(p, pObj, i)
Definition gia.h:1206
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManLevelWithBoxes()

int Gia_ManLevelWithBoxes ( Gia_Man_t * p)
extern

Definition at line 478 of file giaTim.c.

479{
480 int nAnd2Delay = p->nAnd2Delay ? p->nAnd2Delay : 1;
481 Tim_Man_t * pManTime = (Tim_Man_t *)p->pManTime;
482 Gia_Obj_t * pObj, * pObjIn;
483 int i, k, j, curCi, curCo, LevelMax;
484 assert( Gia_ManRegNum(p) == 0 );
485 assert( Gia_ManBufNum(p) == 0 );
486 // copy const and real PIs
487 Gia_ManCleanLevels( p, Gia_ManObjNum(p) );
488 Gia_ObjSetLevel( p, Gia_ManConst0(p), 0 );
490 Gia_ObjSetTravIdCurrent( p, Gia_ManConst0(p) );
491 for ( i = 0; i < Tim_ManPiNum(pManTime); i++ )
492 {
493 pObj = Gia_ManCi( p, i );
494 Gia_ObjSetLevel( p, pObj, Tim_ManGetCiArrival(pManTime, i) / nAnd2Delay );
495 Gia_ObjSetTravIdCurrent( p, pObj );
496 }
497 // create logic for each box
498 curCi = Tim_ManPiNum(pManTime);
499 curCo = 0;
500 for ( i = 0; i < Tim_ManBoxNum(pManTime); i++ )
501 {
502 int nBoxInputs = Tim_ManBoxInputNum( pManTime, i );
503 int nBoxOutputs = Tim_ManBoxOutputNum( pManTime, i );
504 float * pDelayTable = Tim_ManBoxDelayTable( pManTime, i );
505 // compute level for TFI of box inputs
506 for ( k = 0; k < nBoxInputs; k++ )
507 {
508 pObj = Gia_ManCo( p, curCo + k );
509 if ( Gia_ManLevelWithBoxes_rec( p, Gia_ObjFanin0(pObj) ) )
510 {
511 printf( "Boxes are not in a topological order. Switching to level computation without boxes.\n" );
512 return Gia_ManLevelNum( p );
513 }
514 // set box input level
515 Gia_ObjSetCoLevel( p, pObj );
516 }
517 // compute level for box outputs
518 for ( k = 0; k < nBoxOutputs; k++ )
519 {
520 pObj = Gia_ManCi( p, curCi + k );
521 Gia_ObjSetTravIdCurrent( p, pObj );
522 // evaluate delay of this output
523 LevelMax = 0;
524 assert( nBoxInputs == (int)pDelayTable[1] );
525 for ( j = 0; j < nBoxInputs && (pObjIn = Gia_ManCo(p, curCo + j)); j++ )
526 if ( (int)pDelayTable[3+k*nBoxInputs+j] != -ABC_INFINITY )
527 LevelMax = Abc_MaxInt( LevelMax, Gia_ObjLevel(p, pObjIn) + ((int)pDelayTable[3+k*nBoxInputs+j] / nAnd2Delay) );
528 // set box output level
529 Gia_ObjSetLevel( p, pObj, LevelMax );
530 }
531 curCo += nBoxInputs;
532 curCi += nBoxOutputs;
533 }
534 // add remaining nodes
535 p->nLevels = 0;
536 for ( i = Tim_ManCoNum(pManTime) - Tim_ManPoNum(pManTime); i < Tim_ManCoNum(pManTime); i++ )
537 {
538 pObj = Gia_ManCo( p, i );
539 Gia_ManLevelWithBoxes_rec( p, Gia_ObjFanin0(pObj) );
540 Gia_ObjSetCoLevel( p, pObj );
541 p->nLevels = Abc_MaxInt( p->nLevels, Gia_ObjLevel(p, pObj) );
542 }
543 curCo += Tim_ManPoNum(pManTime);
544 // verify counts
545 assert( curCi == Gia_ManCiNum(p) );
546 assert( curCo == Gia_ManCoNum(p) );
547// printf( "Max level is %d.\n", p->nLevels );
548 return p->nLevels;
549}
int Gia_ManLevelWithBoxes_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaTim.c:461
void Gia_ManCleanLevels(Gia_Man_t *p, int Size)
Definition giaUtil.c:511
float * Tim_ManBoxDelayTable(Tim_Man_t *p, int iBox)
Definition timBox.c:235
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManLoadValue()

void Gia_ManLoadValue ( Gia_Man_t * p,
Vec_Int_t * vValues )
extern

Definition at line 1841 of file giaUtil.c.

1842{
1843 Gia_Obj_t * pObj;
1844 int i;
1845 Gia_ManForEachObj( p, pObj, i )
1846 pObj->Value = Vec_IntEntry(vValues, i);
1847}

◆ Gia_ManLutFaninCount()

int Gia_ManLutFaninCount ( Gia_Man_t * p)
extern

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

Synopsis [Prints mapping statistics.]

Description []

SideEffects []

SeeAlso []

Definition at line 108 of file giaIf.c.

109{
110 int i, Counter = 0;
111 Gia_ManForEachLut( p, i )
112 Counter += Gia_ObjLutSize(p, i);
113 return Counter;
114}
Here is the caller graph for this function:

◆ Gia_ManLutLevel()

int Gia_ManLutLevel ( Gia_Man_t * p,
int ** ppLevels )
extern

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

Synopsis [Prints mapping statistics.]

Description []

SideEffects []

SeeAlso []

Definition at line 165 of file giaIf.c.

166{
167 Gia_Obj_t * pObj;
168 int i, k, iFan, Level;
169 int * pLevels = ABC_CALLOC( int, Gia_ManObjNum(p) );
170 Gia_ManForEachLut( p, i )
171 {
172 Level = 0;
173 Gia_LutForEachFanin( p, i, iFan, k )
174 if ( Level < pLevels[iFan] )
175 Level = pLevels[iFan];
176 pLevels[i] = Level + 1;
177 }
178 Level = 0;
179 Gia_ManForEachCo( p, pObj, k )
180 {
181 int LevelFan = pLevels[Gia_ObjFaninId0p(p, pObj)];
182 Level = Abc_MaxInt( Level, LevelFan );
183 pLevels[Gia_ObjId(p, pObj)] = LevelFan;
184 }
185 if ( ppLevels )
186 *ppLevels = pLevels;
187 else
188 ABC_FREE( pLevels );
189 return Level;
190}
Here is the caller graph for this function:

◆ Gia_ManLutLevelWithBoxes()

int Gia_ManLutLevelWithBoxes ( Gia_Man_t * p)
extern

Definition at line 581 of file giaTim.c.

582{
583// int nAnd2Delay = p->nAnd2Delay ? p->nAnd2Delay : 1;
584 Tim_Man_t * pManTime = (Tim_Man_t *)p->pManTime;
585 Gia_Obj_t * pObj, * pObjIn;
586 int i, k, j, curCi, curCo, LevelMax;
587 assert( Gia_ManRegNum(p) == 0 );
588 if ( pManTime == NULL )
589 return Gia_ManLutLevel(p, NULL);
590 // copy const and real PIs
591 Gia_ManCleanLevels( p, Gia_ManObjNum(p) );
592 Gia_ObjSetLevel( p, Gia_ManConst0(p), 0 );
594 Gia_ObjSetTravIdCurrent( p, Gia_ManConst0(p) );
595 for ( i = 0; i < Tim_ManPiNum(pManTime); i++ )
596 {
597 pObj = Gia_ManCi( p, i );
598// Gia_ObjSetLevel( p, pObj, Tim_ManGetCiArrival(pManTime, i) / nAnd2Delay );
599 Gia_ObjSetLevel( p, pObj, 0 );
600 Gia_ObjSetTravIdCurrent( p, pObj );
601 }
602 // create logic for each box
603 curCi = Tim_ManPiNum(pManTime);
604 curCo = 0;
605 for ( i = 0; i < Tim_ManBoxNum(pManTime); i++ )
606 {
607 int nBoxInputs = Tim_ManBoxInputNum( pManTime, i );
608 int nBoxOutputs = Tim_ManBoxOutputNum( pManTime, i );
609 float * pDelayTable = Tim_ManBoxDelayTable( pManTime, i );
610 // compute level for TFI of box inputs
611 for ( k = 0; k < nBoxInputs; k++ )
612 {
613 pObj = Gia_ManCo( p, curCo + k );
614 if ( Gia_ManLutLevelWithBoxes_rec( p, Gia_ObjFanin0(pObj) ) )
615 {
616 printf( "Boxes are not in a topological order. Switching to level computation without boxes.\n" );
617 return Gia_ManLevelNum( p );
618 }
619 // set box input level
620 Gia_ObjSetCoLevel( p, pObj );
621 }
622 // compute level for box outputs
623 for ( k = 0; k < nBoxOutputs; k++ )
624 {
625 pObj = Gia_ManCi( p, curCi + k );
626 Gia_ObjSetTravIdCurrent( p, pObj );
627 // evaluate delay of this output
628 LevelMax = 0;
629 assert( nBoxInputs == (int)pDelayTable[1] );
630 for ( j = 0; j < nBoxInputs && (pObjIn = Gia_ManCo(p, curCo + j)); j++ )
631 if ( (int)pDelayTable[3+k*nBoxInputs+j] != -ABC_INFINITY )
632// LevelMax = Abc_MaxInt( LevelMax, Gia_ObjLevel(p, pObjIn) + ((int)pDelayTable[3+k*nBoxInputs+j] / nAnd2Delay) );
633 LevelMax = Abc_MaxInt( LevelMax, Gia_ObjLevel(p, pObjIn) + 1 );
634 // set box output level
635 Gia_ObjSetLevel( p, pObj, LevelMax );
636 }
637 curCo += nBoxInputs;
638 curCi += nBoxOutputs;
639 }
640 // add remaining nodes
641 p->nLevels = 0;
642 for ( i = Tim_ManCoNum(pManTime) - Tim_ManPoNum(pManTime); i < Tim_ManCoNum(pManTime); i++ )
643 {
644 pObj = Gia_ManCo( p, i );
645 Gia_ManLutLevelWithBoxes_rec( p, Gia_ObjFanin0(pObj) );
646 Gia_ObjSetCoLevel( p, pObj );
647 p->nLevels = Abc_MaxInt( p->nLevels, Gia_ObjLevel(p, pObj) );
648 }
649 curCo += Tim_ManPoNum(pManTime);
650 // verify counts
651 assert( curCi == Gia_ManCiNum(p) );
652 assert( curCo == Gia_ManCoNum(p) );
653// printf( "Max level is %d.\n", p->nLevels );
654 return p->nLevels;
655}
int Gia_ManLutLevelWithBoxes_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaTim.c:562
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManLutNum()

int Gia_ManLutNum ( Gia_Man_t * p)
extern

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

Synopsis [Prints mapping statistics.]

Description []

SideEffects []

SeeAlso []

Definition at line 146 of file giaIf.c.

147{
148 int i, Counter = 0;
149 Gia_ManForEachLut( p, i )
150 Counter ++;
151 return Counter;
152}
Here is the caller graph for this function:

◆ Gia_ManLutParams()

void Gia_ManLutParams ( Gia_Man_t * p,
int * pnCurLuts,
int * pnCurEdges,
int * pnCurLevels )
extern

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

Synopsis [Prints mapping statistics.]

Description []

SideEffects []

SeeAlso []

Definition at line 203 of file giaIf.c.

204{
205 int fDisable2Lut = 1;
206 if ( p->pManTime && Tim_ManBoxNum((Tim_Man_t *)p->pManTime) )
207 {
208 int i;
209 *pnCurLuts = 0;
210 *pnCurEdges = 0;
211 Gia_ManForEachLut( p, i )
212 {
213 (*pnCurLuts)++;
214 (*pnCurEdges) += Gia_ObjLutSize(p, i);
215 }
216 *pnCurLevels = Gia_ManLutLevelWithBoxes( p );
217 }
218 else
219 {
220 Gia_Obj_t * pObj;
221 int i, k, iFan;
222 int * pLevels = ABC_CALLOC( int, Gia_ManObjNum(p) );
223 *pnCurLuts = 0;
224 *pnCurEdges = 0;
225 *pnCurLevels = 0;
226 Gia_ManForEachLut( p, i )
227 {
228 if ( Gia_ObjLutIsMux(p, i) && !(fDisable2Lut && Gia_ObjLutSize(p, i) == 2) )
229 {
230 int pFanins[3];
231 if ( Gia_ObjLutSize(p, i) == 3 )
232 {
233 Gia_ManPrintGetMuxFanins( p, Gia_ManObj(p, i), pFanins );
234 pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[pFanins[0]]+1 );
235 pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[pFanins[1]] );
236 pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[pFanins[2]] );
237 }
238 else if ( Gia_ObjLutSize(p, i) == 2 )
239 {
240 pObj = Gia_ManObj( p, i );
241 pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[Gia_ObjFaninId0(pObj, i)] );
242 pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[Gia_ObjFaninId1(pObj, i)] );
243 }
244 *pnCurLevels = Abc_MaxInt( *pnCurLevels, pLevels[i] );
245 (*pnCurEdges)++;
246 //nMuxF++;
247 continue;
248 }
249 (*pnCurLuts)++;
250 (*pnCurEdges) += Gia_ObjLutSize(p, i);
251 Gia_LutForEachFanin( p, i, iFan, k )
252 pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[iFan] );
253 pLevels[i]++;
254 *pnCurLevels = Abc_MaxInt( *pnCurLevels, pLevels[i] );
255 }
256 ABC_FREE( pLevels );
257 }
258}
void Gia_ManPrintGetMuxFanins(Gia_Man_t *p, Gia_Obj_t *pObj, int *pFanins)
Definition giaIf.c:411
int Gia_ManLutLevelWithBoxes(Gia_Man_t *p)
Definition giaTim.c:581
Here is the call graph for this function:

◆ Gia_ManLutSizeMax()

int Gia_ManLutSizeMax ( Gia_Man_t * p)
extern

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

Synopsis [Prints mapping statistics.]

Description []

SideEffects []

SeeAlso []

Definition at line 127 of file giaIf.c.

128{
129 int i, nSizeMax = -1;
130 Gia_ManForEachLut( p, i )
131 nSizeMax = Abc_MaxInt( nSizeMax, Gia_ObjLutSize(p, i) );
132 return nSizeMax;
133}
Here is the caller graph for this function:

◆ Gia_ManMappingVerify()

void Gia_ManMappingVerify ( Gia_Man_t * p)
extern

Definition at line 2257 of file giaIf.c.

2258{
2259 Gia_Obj_t * pObj, * pFanin;
2260 int i, Result = 1;
2261 assert( Gia_ManHasMapping(p) );
2263 Gia_ManForEachBuf( p, pObj, i )
2264 {
2265 pFanin = Gia_ObjFanin0(pObj);
2266 if ( !Gia_ObjIsAndNotBuf(pFanin) )
2267 continue;
2268 if ( !Gia_ObjIsLut(p, Gia_ObjId(p, pFanin)) )
2269 {
2270 Abc_Print( -1, "Gia_ManMappingVerify: Buffer driver %d does not have mapping.\n", Gia_ObjId(p, pFanin) );
2271 Result = 0;
2272 continue;
2273 }
2274 Result &= Gia_ManMappingVerify_rec( p, pFanin );
2275 }
2276 Gia_ManForEachCo( p, pObj, i )
2277 {
2278 pFanin = Gia_ObjFanin0(pObj);
2279 if ( !Gia_ObjIsAndNotBuf(pFanin) )
2280 continue;
2281 if ( !Gia_ObjIsLut(p, Gia_ObjId(p, pFanin)) )
2282 {
2283 Abc_Print( -1, "Gia_ManMappingVerify: CO driver %d does not have mapping.\n", Gia_ObjId(p, pFanin) );
2284 Result = 0;
2285 continue;
2286 }
2287 Result &= Gia_ManMappingVerify_rec( p, pFanin );
2288 }
2289// if ( Result && Gia_NtkIsRoot(p) )
2290// Abc_Print( 1, "Mapping verified correctly.\n" );
2291}
int Gia_ManMappingVerify_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaIf.c:2238
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManMapShrink4()

Gia_Man_t * Gia_ManMapShrink4 ( Gia_Man_t * p,
int fKeepLevel,
int fVerbose )
extern

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;
59 assert( Gia_ManHasMapping(p) );
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
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 );
82 Gia_ManCleanLevels( pNew, Gia_ManObjNum(p) );
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}
#define ABC_PRT(a, t)
Definition abc_global.h:255
void Dar_LibPrepare(int nSubgraphs)
Definition darLib.c:478
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
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
void Gia_ManCleanTruth(Gia_Man_t *p)
Definition giaUtil.c:528
Here is the call graph for this function:

◆ Gia_ManMapShrink6()

Gia_Man_t * Gia_ManMapShrink6 ( Gia_Man_t * p,
int nFanoutMax,
int fKeepLevel,
int fVerbose )
extern

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;
410 assert( Gia_ManHasMapping(p) );
411 pMan = Shr_ManAlloc( 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}
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
word Shr_ManComputeTruth6(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vLeaves, Vec_Wrd_t *vTruths)
Definition giaShrink6.c:335
Gia_Man_t * Shr_ManFree(Shr_Man_t *p)
Definition giaShrink6.c:128
Shr_Man_t * Shr_ManAlloc(Gia_Man_t *pGia)
FUNCTION DEFINITIONS ///.
Definition giaShrink6.c:96
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
struct Shr_Man_t_ Shr_Man_t
Definition giaShrink6.c:52
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
Vec_Int_t * Rsb_ManGetFanins(Rsb_Man_t *p)
Definition rsbMan.c:84
Gia_Man_t * pNew
Definition giaShrink6.c:56
Vec_Int_t * vDivs
Definition giaShrink6.c:64
Vec_Int_t * vLeaves
Definition giaShrink6.c:67
Rsb_Man_t * pManRsb
Definition giaShrink6.c:72
Vec_Int_t * vDivResub
Definition giaShrink6.c:66
Vec_Wrd_t * vDivTruths
Definition giaShrink6.c:70
Vec_Wrd_t * vTruths
Definition giaShrink6.c:69
Gia_Man_t * pGia
Definition giaShrink6.c:55
Bdc_Man_t * pManDec
Definition giaShrink6.c:73
Here is the call graph for this function:

◆ Gia_ManMarkDangling()

int Gia_ManMarkDangling ( Gia_Man_t * p)
extern

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

Synopsis [Returns 1 if AIG has dangling nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1391 of file giaUtil.c.

1392{
1393 Gia_Obj_t * pObj;
1394 int i, Counter = 0;
1395 Gia_ManForEachObj( p, pObj, i )
1396 {
1397 pObj->fMark0 = 0;
1398 if ( Gia_ObjIsAnd(pObj) )
1399 {
1400 Gia_ObjFanin0(pObj)->fMark0 = 1;
1401 Gia_ObjFanin1(pObj)->fMark0 = 1;
1402 }
1403 else if ( Gia_ObjIsCo(pObj) )
1404 Gia_ObjFanin0(pObj)->fMark0 = 1;
1405 }
1406 Gia_ManForEachAnd( p, pObj, i )
1407 Counter += !pObj->fMark0;
1408 return Counter;
1409}
Here is the caller graph for this function:

◆ Gia_ManMarkFanoutDrivers()

void Gia_ManMarkFanoutDrivers ( Gia_Man_t * p)
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 1779 of file giaUtil.c.

1780{
1781 Gia_Obj_t * pObj;
1782 int i;
1783 Gia_ManForEachObj( p, pObj, i )
1784 {
1785 pObj->fMark0 = 0;
1786 if ( Gia_ObjIsAnd(pObj) )
1787 {
1788 Gia_ObjFanin0(pObj)->fMark0 = 1;
1789 Gia_ObjFanin1(pObj)->fMark0 = 1;
1790 }
1791 else if ( Gia_ObjIsCo(pObj) )
1792 Gia_ObjFanin0(pObj)->fMark0 = 1;
1793 }
1794}
Here is the caller graph for this function:

◆ Gia_ManMemory()

double Gia_ManMemory ( Gia_Man_t * p)
extern

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

Synopsis [Returns memory used in megabytes.]

Description []

SideEffects []

SeeAlso []

Definition at line 194 of file giaMan.c.

195{
196 double Memory = sizeof(Gia_Man_t);
197 Memory += sizeof(Gia_Obj_t) * Gia_ManObjNum(p);
198 Memory += sizeof(int) * Gia_ManCiNum(p);
199 Memory += sizeof(int) * Gia_ManCoNum(p);
200 Memory += sizeof(int) * Vec_IntSize(&p->vHTable);
201 Memory += sizeof(int) * Gia_ManObjNum(p) * (p->pRefs != NULL);
202 Memory += Vec_IntMemory( p->vLevels );
203 Memory += Vec_IntMemory( p->vCellMapping );
204 Memory += Vec_IntMemory( &p->vCopies );
205 Memory += Vec_FltMemory( p->vInArrs );
206 Memory += Vec_FltMemory( p->vOutReqs );
207 Memory += Vec_PtrMemory( p->vNamesIn );
208 Memory += Vec_PtrMemory( p->vNamesOut );
209 Memory += Vec_PtrMemory( p->vNamesNode );
210 return Memory;
211}
Here is the caller graph for this function:

◆ Gia_ManMiter()

Gia_Man_t * Gia_ManMiter ( Gia_Man_t * p0,
Gia_Man_t * p1,
int nInsDup,
int fDualOut,
int fSeq,
int fImplic,
int fVerbose )
extern

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

Synopsis [Creates miter of two designs.]

Description []

SideEffects []

SeeAlso []

Definition at line 2983 of file giaDup.c.

2984{
2985 Gia_Man_t * pNew, * pTemp;
2986 Gia_Obj_t * pObj;
2987 int i, iLit;
2988 if ( fSeq )
2989 {
2990 if ( Gia_ManPiNum(p0) != Gia_ManPiNum(p1) )
2991 {
2992 printf( "Gia_ManMiter(): Designs have different number of PIs.\n" );
2993 return NULL;
2994 }
2995 if ( Gia_ManPoNum(p0) != Gia_ManPoNum(p1) )
2996 {
2997 printf( "Gia_ManMiter(): Designs have different number of POs.\n" );
2998 return NULL;
2999 }
3000 if ( Gia_ManRegNum(p0) == 0 || Gia_ManRegNum(p1) == 0 )
3001 {
3002 printf( "Gia_ManMiter(): At least one of the designs has no registers.\n" );
3003 return NULL;
3004 }
3005 }
3006 else
3007 {
3008 if ( Gia_ManCiNum(p0) != Gia_ManCiNum(p1) )
3009 {
3010 printf( "Gia_ManMiter(): Designs have different number of CIs.\n" );
3011 return NULL;
3012 }
3013 if ( Gia_ManCoNum(p0) != Gia_ManCoNum(p1) )
3014 {
3015 printf( "Gia_ManMiter(): Designs have different number of COs.\n" );
3016 return NULL;
3017 }
3018 }
3019 // start the manager
3020 pNew = Gia_ManStart( Gia_ManObjNum(p0) + Gia_ManObjNum(p1) );
3021 pNew->pName = Abc_UtilStrsav( "miter" );
3022 // map combinational inputs
3023 Gia_ManFillValue( p0 );
3024 Gia_ManFillValue( p1 );
3025 Gia_ManConst0(p0)->Value = 0;
3026 Gia_ManConst0(p1)->Value = 0;
3027 // map internal nodes and outputs
3028 Gia_ManHashAlloc( pNew );
3029 if ( fSeq )
3030 {
3031 // create primary inputs
3032 Gia_ManForEachPi( p0, pObj, i )
3033 pObj->Value = Gia_ManAppendCi( pNew );
3034 Gia_ManForEachPi( p1, pObj, i )
3035 if ( i < Gia_ManPiNum(p1) - nInsDup )
3036 pObj->Value = Gia_ObjToLit( pNew, Gia_ManPi(pNew, i) );
3037 else
3038 pObj->Value = Gia_ManAppendCi( pNew );
3039 // create latch outputs
3040 Gia_ManForEachRo( p0, pObj, i )
3041 pObj->Value = Gia_ManAppendCi( pNew );
3042 Gia_ManForEachRo( p1, pObj, i )
3043 pObj->Value = Gia_ManAppendCi( pNew );
3044 // create primary outputs
3045 Gia_ManForEachPo( p0, pObj, i )
3046 {
3047 Gia_ManMiter_rec( pNew, p0, Gia_ObjFanin0(pObj) );
3048 Gia_ManMiter_rec( pNew, p1, Gia_ObjFanin0(Gia_ManPo(p1,i)) );
3049 if ( fDualOut )
3050 {
3051 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
3052 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(Gia_ManPo(p1,i)) );
3053 }
3054 else if ( fImplic )
3055 {
3056 iLit = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Abc_LitNot(Gia_ObjFanin0Copy(Gia_ManPo(p1,i))) );
3057 Gia_ManAppendCo( pNew, iLit );
3058 }
3059 else
3060 {
3061 iLit = Gia_ManHashXor( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin0Copy(Gia_ManPo(p1,i)) );
3062 Gia_ManAppendCo( pNew, iLit );
3063 }
3064 }
3065 // create register inputs
3066 Gia_ManForEachRi( p0, pObj, i )
3067 {
3068 Gia_ManMiter_rec( pNew, p0, Gia_ObjFanin0(pObj) );
3069 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
3070 }
3071 Gia_ManForEachRi( p1, pObj, i )
3072 {
3073 Gia_ManMiter_rec( pNew, p1, Gia_ObjFanin0(pObj) );
3074 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
3075 }
3076 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p0) + Gia_ManRegNum(p1) );
3077 }
3078 else
3079 {
3080 // create combinational inputs
3081 Gia_ManForEachCi( p0, pObj, i )
3082 pObj->Value = Gia_ManAppendCi( pNew );
3083 Gia_ManForEachCi( p1, pObj, i )
3084 if ( i < Gia_ManCiNum(p1) - nInsDup )
3085 pObj->Value = Gia_ObjToLit( pNew, Gia_ManCi(pNew, i) );
3086 else
3087 pObj->Value = Gia_ManAppendCi( pNew );
3088 // create combinational outputs
3089 Gia_ManForEachCo( p0, pObj, i )
3090 {
3091 Gia_ManMiter_rec( pNew, p0, Gia_ObjFanin0(pObj) );
3092 Gia_ManMiter_rec( pNew, p1, Gia_ObjFanin0(Gia_ManCo(p1,i)) );
3093 if ( fDualOut )
3094 {
3095 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
3096 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(Gia_ManCo(p1,i)) );
3097 }
3098 else if ( fImplic )
3099 {
3100 iLit = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Abc_LitNot(Gia_ObjFanin0Copy(Gia_ManPo(p1,i))) );
3101 Gia_ManAppendCo( pNew, iLit );
3102 }
3103 else
3104 {
3105 iLit = Gia_ManHashXor( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin0Copy(Gia_ManCo(p1,i)) );
3106 Gia_ManAppendCo( pNew, iLit );
3107 }
3108 }
3109 }
3110 Gia_ManHashStop( pNew );
3111 pNew = Gia_ManCleanup( pTemp = pNew );
3112 Gia_ManStop( pTemp );
3113
3114 pNew = Gia_ManDupNormalize( pTemp = pNew, 0 );
3115 Gia_ManStop( pTemp );
3116 return pNew;
3117}
int Gia_ManMiter_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaDup.c:2962
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManMiter2()

Gia_Man_t * Gia_ManMiter2 ( Gia_Man_t * pStart,
char * pInit,
int fVerbose )
extern

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

Synopsis [Creates miter of two designs.]

Description []

SideEffects []

SeeAlso []

Definition at line 3651 of file giaDup.c.

3652{
3653 Vec_Int_t * vCiValues, * vCoValues0, * vCoValues1;
3654 Gia_Man_t * pNew, * pUndc, * pTemp;
3655 Gia_Obj_t * pObj;
3656 char * pInitNew;
3657 int i, k;
3658 // check PI values
3659 for ( i = 0; i < Gia_ManPiNum(pStart); i++ )
3660 assert( pInit[i] == 'x' || pInit[i] == 'X' );
3661 // normalize the manager
3662 pUndc = Gia_ManDupZeroUndc( pStart, pInit + Gia_ManPiNum(pStart), 0, 0, fVerbose );
3663 // create new init string
3664 pInitNew = ABC_ALLOC( char, Gia_ManPiNum(pUndc)+1 );
3665 for ( i = 0; i < Gia_ManPiNum(pStart); i++ )
3666 pInitNew[i] = pInit[i];
3667 for ( i = k = Gia_ManPiNum(pStart); i < Gia_ManCiNum(pStart); i++ )
3668 if ( pInit[i] == 'x' || pInit[i] == 'X' )
3669 pInitNew[k++] = pInit[i];
3670 pInitNew[k] = 0;
3671 assert( k == Gia_ManPiNum(pUndc) );
3672 // derive miter
3673 pNew = Gia_ManStart( Gia_ManObjNum(pUndc) );
3674 pNew->pName = Abc_UtilStrsav( pUndc->pName );
3675 pNew->pSpec = Abc_UtilStrsav( pUndc->pSpec );
3676 Gia_ManConst0(pUndc)->Value = 0;
3677 Gia_ManHashAlloc( pNew );
3678 // add PIs of the first side
3679 Gia_ManForEachPi( pUndc, pObj, i )
3680 pObj->Value = Gia_ManAppendCi( pNew );
3681 // add PIs of the second side
3682 vCiValues = Vec_IntAlloc( Gia_ManPiNum(pUndc) );
3683 Gia_ManForEachPi( pUndc, pObj, i )
3684 if ( pInitNew[i] == 'x' )
3685 Vec_IntPush( vCiValues, Gia_Obj2Lit( pNew, Gia_ManPi(pNew, i) ) );
3686 else if ( pInitNew[i] == 'X' )
3687 Vec_IntPush( vCiValues, Gia_ManAppendCi( pNew ) );
3688 else assert( 0 );
3689 // build flops and internal nodes
3690 Gia_ManForEachRo( pUndc, pObj, i )
3691 pObj->Value = Gia_ManAppendCi( pNew );
3692 Gia_ManForEachAnd( pUndc, pObj, i )
3693 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
3694 // collect CO values
3695 vCoValues0 = Vec_IntAlloc( Gia_ManPoNum(pUndc) );
3696 Gia_ManForEachCo( pUndc, pObj, i )
3697 Vec_IntPush( vCoValues0, Gia_ObjFanin0Copy(pObj) );
3698 // build the other side
3699 Gia_ManForEachPi( pUndc, pObj, i )
3700 pObj->Value = Vec_IntEntry( vCiValues, i );
3701 Gia_ManForEachRo( pUndc, pObj, i )
3702 pObj->Value = Gia_ManAppendCi( pNew );
3703 Gia_ManForEachAnd( pUndc, pObj, i )
3704 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
3705 // collect CO values
3706 vCoValues1 = Vec_IntAlloc( Gia_ManPoNum(pUndc) );
3707 Gia_ManForEachCo( pUndc, pObj, i )
3708 Vec_IntPush( vCoValues1, Gia_ObjFanin0Copy(pObj) );
3709 // create POs
3710 Gia_ManForEachPo( pUndc, pObj, i )
3711 pObj->Value = Gia_ManAppendCo( pNew, Gia_ManHashXor( pNew, Vec_IntEntry(vCoValues0, i), Vec_IntEntry(vCoValues1, i) ) );
3712 // create flop inputs
3713 Gia_ManForEachRi( pUndc, pObj, i )
3714 pObj->Value = Gia_ManAppendCo( pNew, Vec_IntEntry(vCoValues0, Gia_ManPoNum(pUndc)+i) );
3715 Gia_ManForEachRi( pUndc, pObj, i )
3716 pObj->Value = Gia_ManAppendCo( pNew, Vec_IntEntry(vCoValues1, Gia_ManPoNum(pUndc)+i) );
3717 Vec_IntFree( vCoValues0 );
3718 Vec_IntFree( vCoValues1 );
3719 Vec_IntFree( vCiValues );
3720 ABC_FREE( pInitNew );
3721 // cleanup
3722 Gia_ManHashStop( pNew );
3723 Gia_ManSetRegNum( pNew, 2*Gia_ManRegNum(pUndc) );
3724 Gia_ManStop( pUndc );
3725 pNew = Gia_ManCleanup( pTemp = pNew );
3726 Gia_ManStop( pTemp );
3727 return pNew;
3728}
Gia_Man_t * Gia_ManDupZeroUndc(Gia_Man_t *p, char *pInit, int nNewPis, int fGiaSimple, int fVerbose)
Definition giaDup.c:3569
Here is the call graph for this function:

◆ Gia_ManMiterInverse()

Gia_Man_t * Gia_ManMiterInverse ( Gia_Man_t * pBot,
Gia_Man_t * pTop,
int fDualOut,
int fVerbose )
extern

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

Synopsis [Creates miter of two designs.]

Description []

SideEffects []

SeeAlso []

Definition at line 3130 of file giaDup.c.

3131{
3132 Gia_Man_t * pNew, * pTemp;
3133 Gia_Obj_t * pObj;
3134 int i, iLit;
3135 int nInputs1 = Gia_ManCiNum(pTop) - Gia_ManCoNum(pBot);
3136 int nInputs2 = Gia_ManCiNum(pBot) - Gia_ManCoNum(pTop);
3137 if ( nInputs1 == nInputs2 )
3138 printf( "Assuming that the circuits have %d shared inputs, ordered first.\n", nInputs1 );
3139 else
3140 {
3141 printf( "The number of inputs and outputs does not match.\n" );
3142 return NULL;
3143 }
3144 pNew = Gia_ManStart( Gia_ManObjNum(pBot) + Gia_ManObjNum(pTop) );
3145 pNew->pName = Abc_UtilStrsav( "miter" );
3146 Gia_ManFillValue( pBot );
3147 Gia_ManFillValue( pTop );
3148 Gia_ManConst0(pBot)->Value = 0;
3149 Gia_ManConst0(pTop)->Value = 0;
3150 Gia_ManHashAlloc( pNew );
3151 Gia_ManForEachCi( pBot, pObj, i )
3152 pObj->Value = Gia_ManAppendCi( pNew );
3153// Gia_ManForEachCo( pBot, pObj, i )
3154// Gia_ManMiter_rec( pNew, pBot, Gia_ObjFanin0(pObj) );
3155 Gia_ManForEachAnd( pBot, pObj, i )
3156 {
3157 if ( Gia_ObjIsBuf(pObj) )
3158 pObj->Value = Gia_ManAppendBuf( pNew, Gia_ObjFanin0Copy(pObj) );
3159 else if ( Gia_ObjIsAnd(pObj) )
3160 pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
3161 }
3162 Gia_ManForEachCo( pBot, pObj, i )
3163 pObj->Value = Gia_ObjFanin0Copy(pObj);
3164 Gia_ManForEachCi( pTop, pObj, i )
3165 if ( i < nInputs1 )
3166 pObj->Value = Gia_ManCi(pBot, i)->Value;
3167 else
3168 pObj->Value = Gia_ManCo(pBot, i-nInputs1)->Value;
3169// Gia_ManForEachCo( pTop, pObj, i )
3170// Gia_ManMiter_rec( pNew, pTop, Gia_ObjFanin0(pObj) );
3171 Gia_ManForEachAnd( pTop, pObj, i )
3172 {
3173 if ( Gia_ObjIsBuf(pObj) )
3174 pObj->Value = Gia_ManAppendBuf( pNew, Gia_ObjFanin0Copy(pObj) );
3175 else if ( Gia_ObjIsAnd(pObj) )
3176 pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
3177 }
3178 Gia_ManForEachCo( pTop, pObj, i )
3179 {
3180 if ( fDualOut )
3181 {
3182 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
3183 Gia_ManAppendCo( pNew, Gia_ManCi(pBot, i+nInputs1)->Value );
3184 }
3185 else
3186 {
3187 iLit = Gia_ManHashXor( pNew, Gia_ObjFanin0Copy(pObj), Gia_ManCi(pBot, i+nInputs1)->Value );
3188 Gia_ManAppendCo( pNew, iLit );
3189 }
3190 }
3191 Gia_ManHashStop( pNew );
3192 pNew = Gia_ManCleanup( pTemp = pNew );
3193 Gia_ManStop( pTemp );
3194 assert( (pBot->vBarBufs == NULL) == (pTop->vBarBufs == NULL) );
3195 if ( pBot->vBarBufs )
3196 {
3197 pNew->vBarBufs = Vec_IntAlloc( 1000 );
3198 Vec_IntAppend( pNew->vBarBufs, pBot->vBarBufs );
3199 Vec_IntAppend( pNew->vBarBufs, pTop->vBarBufs );
3200 //printf( "Miter has %d buffers (%d groups).\n", pNew->nBufs, Vec_IntSize(pNew->vBarBufs) );
3201 }
3202 return pNew;
3203}
Vec_Int_t * vBarBufs
Definition gia.h:163
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManNonRegBoxNum()

int Gia_ManNonRegBoxNum ( Gia_Man_t * p)
extern

Definition at line 58 of file giaTim.c.

59{
61}
int Gia_ManRegBoxNum(Gia_Man_t *p)
Definition giaTim.c:54
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManOrderReverse()

Vec_Int_t * Gia_ManOrderReverse ( Gia_Man_t * p)
extern

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 459 of file giaDfs.c.

460{
461 Gia_Obj_t * pObj;
462 Vec_Vec_t * vLevels;
463 Vec_Ptr_t * vLevel;
464 Vec_Int_t * vResult;
465 int i, k;
466 vLevels = Vec_VecStart( 100 );
467 // make sure levels are assigned
468 Gia_ManForEachAnd( p, pObj, i )
469 assert( Gia_ObjLevel(p, pObj) > 0 );
470 // add CO nodes based on the level of their fanin
471 Gia_ManForEachCo( p, pObj, i )
472 Vec_VecPush( vLevels, Gia_ObjLevel(p, Gia_ObjFanin0(pObj)), pObj );
473 // add other nodes based on their level
474 Gia_ManForEachObj( p, pObj, i )
475 if ( !Gia_ObjIsCo(pObj) )
476 Vec_VecPush( vLevels, Gia_ObjLevel(p, pObj), pObj );
477 // put the nodes in the reverse topological order
478 vResult = Vec_IntAlloc( Gia_ManObjNum(p) );
479 Vec_VecForEachLevelReverse( vLevels, vLevel, i )
480 Vec_PtrForEachEntry( Gia_Obj_t *, vLevel, pObj, k )
481 Vec_IntPush( vResult, Gia_ObjId(p, pObj) );
482 Vec_VecFree( vLevels );
483 return vResult;
484}
#define Vec_VecForEachLevelReverse(vGlob, vVec, i)
Definition vecVec.h:63
Here is the caller graph for this function:

◆ Gia_ManOrderWithBoxes()

Vec_Int_t * Gia_ManOrderWithBoxes ( Gia_Man_t * p)
extern

Definition at line 286 of file giaTim.c.

287{
288 Tim_Man_t * pManTime = (Tim_Man_t *)p->pManTime;
289 Vec_Int_t * vNodes;
290 Gia_Obj_t * pObj;
291 int i, k, curCi, curCo;
292 assert( pManTime != NULL );
294 // start trav IDs
296 // start the array
297 vNodes = Vec_IntAlloc( Gia_ManObjNum(p) );
298 // include constant
299 Vec_IntPush( vNodes, 0 );
300 Gia_ObjSetTravIdCurrent( p, Gia_ManConst0(p) );
301 // include primary inputs
302 for ( i = 0; i < Tim_ManPiNum(pManTime); i++ )
303 {
304 pObj = Gia_ManCi( p, i );
305 Vec_IntPush( vNodes, Gia_ObjId(p, pObj) );
306 Gia_ObjSetTravIdCurrent( p, pObj );
307 assert( Gia_ObjId(p, pObj) == i+1 );
308 }
309 // for each box, include box nodes
310 curCi = Tim_ManPiNum(pManTime);
311 curCo = 0;
312 for ( i = 0; i < Tim_ManBoxNum(pManTime); i++ )
313 {
314 // add internal nodes
315 for ( k = 0; k < Tim_ManBoxInputNum(pManTime, i); k++ )
316 {
317 pObj = Gia_ManCo( p, curCo + k );
318 if ( Gia_ManOrderWithBoxes_rec( p, Gia_ObjFanin0(pObj), vNodes ) )
319 {
320 int iCiNum = p->iData2;
321 int iBoxNum = Tim_ManBoxFindFromCiNum( pManTime, iCiNum );
322 printf( "The command has to terminate. Boxes are not in a topological order.\n" );
323 printf( "The following information may help debugging (numbers are 0-based):\n" );
324 printf( "Input %d of BoxA %d (1stCI = %d; 1stCO = %d) has TFI with CI %d,\n",
325 k, i, Tim_ManBoxOutputFirst(pManTime, i), Tim_ManBoxInputFirst(pManTime, i), iCiNum );
326 printf( "which corresponds to output %d of BoxB %d (1stCI = %d; 1stCO = %d).\n",
327 iCiNum - Tim_ManBoxOutputFirst(pManTime, iBoxNum), iBoxNum,
328 Tim_ManBoxOutputFirst(pManTime, iBoxNum), Tim_ManBoxInputFirst(pManTime, iBoxNum) );
329 printf( "In a correct topological order, BoxB should precede BoxA.\n" );
330 Vec_IntFree( vNodes );
331 p->iData2 = 0;
332 return NULL;
333 }
334 }
335 // add POs corresponding to box inputs
336 for ( k = 0; k < Tim_ManBoxInputNum(pManTime, i); k++ )
337 {
338 pObj = Gia_ManCo( p, curCo + k );
339 Vec_IntPush( vNodes, Gia_ObjId(p, pObj) );
340 }
341 curCo += Tim_ManBoxInputNum(pManTime, i);
342 // add PIs corresponding to box outputs
343 for ( k = 0; k < Tim_ManBoxOutputNum(pManTime, i); k++ )
344 {
345 pObj = Gia_ManCi( p, curCi + k );
346 Vec_IntPush( vNodes, Gia_ObjId(p, pObj) );
347 Gia_ObjSetTravIdCurrent( p, pObj );
348 }
349 curCi += Tim_ManBoxOutputNum(pManTime, i);
350 }
351 // add remaining nodes
352 for ( i = Tim_ManCoNum(pManTime) - Tim_ManPoNum(pManTime); i < Tim_ManCoNum(pManTime); i++ )
353 {
354 pObj = Gia_ManCo( p, i );
355 Gia_ManOrderWithBoxes_rec( p, Gia_ObjFanin0(pObj), vNodes );
356 }
357 // add POs
358 for ( i = Tim_ManCoNum(pManTime) - Tim_ManPoNum(pManTime); i < Tim_ManCoNum(pManTime); i++ )
359 {
360 pObj = Gia_ManCo( p, i );
361 Vec_IntPush( vNodes, Gia_ObjId(p, pObj) );
362 }
363 curCo += Tim_ManPoNum(pManTime);
364 // verify counts
365 assert( curCi == Gia_ManCiNum(p) );
366 assert( curCo == Gia_ManCoNum(p) );
367 //assert( Vec_IntSize(vNodes) == Gia_ManObjNum(p) );
368 return vNodes;
369}
int Gia_ManOrderWithBoxes_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vNodes)
Definition giaTim.c:258
int Tim_ManBoxFindFromCiNum(Tim_Man_t *p, int iCiNum)
Definition timBox.c:307
int Tim_ManBoxInputFirst(Tim_Man_t *p, int iBox)
Definition timBox.c:123
int Tim_ManBoxOutputFirst(Tim_Man_t *p, int iBox)
Definition timBox.c:155
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManOrigIdsInit()

void Gia_ManOrigIdsInit ( Gia_Man_t * p)
extern

DECLARATIONS ///.

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

FileName [giaEquiv.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Scalable AIG package.]

Synopsis [Manipulation of equivalence classes.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Manipulating original IDs.]

Description []

SideEffects []

SeeAlso []

Definition at line 46 of file giaEquiv.c.

47{
48 Vec_IntFreeP( &p->vIdsOrig );
49 p->vIdsOrig = Vec_IntStartNatural( Gia_ManObjNum(p) );
50}
Here is the caller graph for this function:

◆ Gia_ManOrigIdsReduce()

Gia_Man_t * Gia_ManOrigIdsReduce ( Gia_Man_t * p,
Vec_Int_t * vPairs )
extern

Definition at line 106 of file giaEquiv.c.

107{
108 Gia_Man_t * pNew = NULL;
109 Gia_Obj_t * pObj, * pRepr; int i;
110 Vec_Int_t * vMap = Gia_ManOrigIdsRemapPairs( vPairs, Gia_ManObjNum(p) );
112 pNew = Gia_ManStart( Gia_ManObjNum(p) );
113 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
114 pNew->pName = Abc_UtilStrsav( p->pName );
116 Gia_ManConst0(p)->Value = 0;
117 Gia_ManForEachCi( p, pObj, i )
118 pObj->Value = Gia_ManAppendCi(pNew);
119 Gia_ManHashAlloc( pNew );
120 Gia_ManForEachAnd( p, pObj, i )
121 {
122 if ( Vec_IntEntry(vMap, i) == -1 )
123 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
124 else
125 {
126 pRepr = Gia_ManObj( p, Vec_IntEntry(vMap, i) );
127 pObj->Value = Abc_LitNotCond( pRepr->Value, pRepr->fPhase ^ pObj->fPhase );
128 }
129 }
130 Gia_ManHashStop( pNew );
131 Gia_ManForEachCo( p, pObj, i )
132 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
133 Vec_IntFree( vMap );
134 // compute equivalences
135 assert( !p->pReprs && !p->pNexts );
136 p->pReprs = ABC_CALLOC( Gia_Rpr_t, Gia_ManObjNum(p) );
137 for ( i = 0; i < Gia_ManObjNum(p); i++ )
138 Gia_ObjSetRepr( p, i, GIA_VOID );
139 Gia_ManFillValue(pNew);
140 Gia_ManForEachAnd( p, pObj, i )
141 {
142 int iRepr = Abc_Lit2Var(pObj->Value);
143 if ( iRepr == 0 )
144 {
145 Gia_ObjSetRepr( p, i, 0 );
146 continue;
147 }
148 pRepr = Gia_ManObj( pNew, iRepr );
149 if ( !~pRepr->Value ) // first time
150 {
151 pRepr->Value = i;
152 continue;
153 }
154 // add equivalence
155 Gia_ObjSetRepr( p, i, pRepr->Value );
156 }
157 p->pNexts = Gia_ManDeriveNexts( p );
158 return pNew;
159}
Vec_Int_t * Gia_ManOrigIdsRemapPairs(Vec_Int_t *vEquivPairs, int nObjs)
Definition giaEquiv.c:87
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManOrigIdsRemap()

void Gia_ManOrigIdsRemap ( Gia_Man_t * p,
Gia_Man_t * pNew )
extern

Definition at line 56 of file giaEquiv.c.

57{
58 Gia_Obj_t * pObj; int i;
59 if ( p->vIdsOrig == NULL )
60 return;
61 Gia_ManOrigIdsStart( pNew );
62 Vec_IntWriteEntry( pNew->vIdsOrig, 0, 0 );
63 Gia_ManForEachObj1( p, pObj, i )
64 if ( ~pObj->Value && Abc_Lit2Var(pObj->Value) && Vec_IntEntry(p->vIdsOrig, i) != -1 && Vec_IntEntry(pNew->vIdsOrig, Abc_Lit2Var(pObj->Value)) == -1 )
65 Vec_IntWriteEntry( pNew->vIdsOrig, Abc_Lit2Var(pObj->Value), Vec_IntEntry(p->vIdsOrig, i) );
66 Gia_ManForEachObj( pNew, pObj, i )
67 assert( Vec_IntEntry(pNew->vIdsOrig, i) >= 0 );
68}
void Gia_ManOrigIdsStart(Gia_Man_t *p)
Definition giaEquiv.c:51
Vec_Int_t * vIdsOrig
Definition gia.h:189
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManOrigIdsStart()

void Gia_ManOrigIdsStart ( Gia_Man_t * p)
extern

Definition at line 51 of file giaEquiv.c.

52{
53 Vec_IntFreeP( &p->vIdsOrig );
54 p->vIdsOrig = Vec_IntStartFull( Gia_ManObjNum(p) );
55}
Here is the caller graph for this function:

◆ Gia_ManPerformBidec()

Gia_Man_t * Gia_ManPerformBidec ( Gia_Man_t * p,
int fVerbose )
extern

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
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}
struct Bdc_Par_t_ Bdc_Par_t
Definition bdc.h:44
struct Bdc_Man_t_ Bdc_Man_t
Definition bdc.h:43
void Bdc_ManFree(Bdc_Man_t *p)
Definition bdcCore.c:113
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
Here is the call graph for this function:

◆ Gia_ManPerformDsdBalance()

Gia_Man_t * Gia_ManPerformDsdBalance ( Gia_Man_t * p,
int nLutSize,
int nCutNum,
int nRelaxRatio,
int fVerbose )
extern

Definition at line 2678 of file giaIf.c.

2679{
2680 Gia_Man_t * pNew;
2681 If_Man_t * pIfMan;
2682 If_Par_t Pars, * pPars = &Pars;
2683 If_ManSetDefaultPars( pPars );
2684 pPars->nCutsMax = nCutNum;
2685 pPars->nRelaxRatio = nRelaxRatio;
2686 pPars->fVerbose = fVerbose;
2687 pPars->nLutSize = nLutSize;
2688 pPars->fDsdBalance = 1;
2689 pPars->fUseDsd = 1;
2690 pPars->fCutMin = 1;
2691 pPars->fTruth = 1;
2692 pPars->fExpRed = 0;
2693 if ( Abc_FrameReadManDsd2() == NULL )
2695 // perform mapping
2696 pIfMan = Gia_ManToIf( p, pPars );
2698 if ( pPars->fDsdBalance )
2699 If_DsdManAllocIsops( pIfMan->pIfDsdMan, pPars->nLutSize );
2700 If_ManPerformMapping( pIfMan );
2701 pNew = Gia_ManFromIfAig( pIfMan );
2702 If_ManStop( pIfMan );
2703 Gia_ManTransferTiming( pNew, p );
2704 // transfer name
2705 assert( pNew->pName == NULL );
2706 pNew->pName = Abc_UtilStrsav( p->pName );
2707 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
2708 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
2709 return pNew;
2710}
ABC_DLL void * Abc_FrameReadManDsd2()
Definition mainFrame.c:68
ABC_DLL void Abc_FrameSetManDsd2(void *pMan)
Definition mainFrame.c:103
If_Man_t * Gia_ManToIf(Gia_Man_t *p, If_Par_t *pPars)
Definition giaIf.c:893
void Gia_ManTransferTiming(Gia_Man_t *p, Gia_Man_t *pGia)
Definition giaIf.c:2370
Gia_Man_t * Gia_ManFromIfAig(If_Man_t *pIfMan)
Definition giaIf.c:1032
struct If_Par_t_ If_Par_t
Definition if.h:78
void If_DsdManAllocIsops(If_DsdMan_t *p, int nLutSize)
Definition ifDsd.c:306
struct If_DsdMan_t_ If_DsdMan_t
Definition if.h:84
void If_ManSetDefaultPars(If_Par_t *pPars)
FUNCTION DECLARATIONS ///.
Definition ifCore.c:47
If_DsdMan_t * If_DsdManAlloc(int nVars, int nLutSize)
Definition ifDsd.c:264
void If_ManStop(If_Man_t *p)
Definition ifMan.c:212
int If_ManPerformMapping(If_Man_t *p)
Definition ifCore.c:82
struct If_Man_t_ If_Man_t
BASIC TYPES ///.
Definition if.h:77
If_DsdMan_t * pIfDsdMan
Definition if.h:260
int fUseDsd
Definition if.h:140
int nRelaxRatio
Definition if.h:112
int fTruth
Definition if.h:160
int nLutSize
Definition if.h:104
int fExpRed
Definition if.h:120
int nCutsMax
Definition if.h:105
int fVerbose
Definition if.h:152
int fDsdBalance
Definition if.h:128
int fCutMin
Definition if.h:125
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManPerformDsdBalanceWin()

Gia_Man_t * Gia_ManPerformDsdBalanceWin ( Gia_Man_t * p,
int LevelMax,
int nTimeWindow,
int nLutSize,
int nCutNum,
int nRelaxRatio,
int fVerbose )
extern

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_ManInsertWin(Gia_Man_t *p, Vec_Int_t *vOuts, Gia_Man_t *pWin)
Definition giaBalMap.c:136
Here is the call graph for this function:

◆ Gia_ManPerformFx()

Gia_Man_t * Gia_ManPerformFx ( Gia_Man_t * p,
int nNewNodesMax,
int LitCountMax,
int fReverse,
int fVerbose,
int fVeryVerbose )
extern

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 465 of file giaFx.c.

466{
467 extern int Fx_FastExtract( Vec_Wec_t * vCubes, int ObjIdMax, int nNewNodesMax, int LitCountMax, int fCanonDivs, int fVerbose, int fVeryVerbose );
468 Gia_Man_t * pNew = NULL;
469 Vec_Wec_t * vCubes;
470 Vec_Str_t * vCompl;
471 if ( Gia_ManAndNum(p) == 0 )
472 {
473 pNew = Gia_ManDup(p);
474 Gia_ManTransferTiming( pNew, p );
475 return pNew;
476 }
477// abctime clk;
478 assert( Gia_ManHasMapping(p) );
479 // collect information
480 vCubes = Gia_ManFxRetrieve( p, &vCompl, fReverse );
481 // call the fast extract procedure
482// clk = Abc_Clock();
483 Fx_FastExtract( vCubes, Vec_StrSize(vCompl), nNewNodesMax, LitCountMax, 0, fVerbose, fVeryVerbose );
484// Abc_PrintTime( 1, "Fx runtime", Abc_Clock() - clk );
485 // insert information
486 pNew = Gia_ManFxInsert( p, vCubes, vCompl );
487 Gia_ManTransferTiming( pNew, p );
488 // cleanup
489 Vec_WecFree( vCubes );
490 Vec_StrFree( vCompl );
491 return pNew;
492}
int Fx_FastExtract(Vec_Wec_t *vCubes, int ObjIdMax, int nNewNodesMax, int LitCountMax, int fCanonDivs, int fVerbose, int fVeryVerbose)
Definition abcFx.c:1166
Gia_Man_t * Gia_ManFxInsert(Gia_Man_t *p, Vec_Wec_t *vCubes, Vec_Str_t *vCompls)
Definition giaFx.c:323
Vec_Wec_t * Gia_ManFxRetrieve(Gia_Man_t *p, Vec_Str_t **pvCompl, int fReverse)
Definition giaFx.c:197
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManPerformLfMapping()

Gia_Man_t * Gia_ManPerformLfMapping ( Gia_Man_t * p,
Jf_Par_t * pPars,
int fNormalized )
extern

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

Synopsis [Interface of LUT mapping package.]

Description []

SideEffects []

SeeAlso []

Definition at line 2292 of file giaLf.c.

2293{
2294 Gia_Man_t * pNew;
2295 assert( !pPars->fCutGroup || pPars->nLutSize == 9 || pPars->nLutSize == 11 || pPars->nLutSize == 13 );
2296 // reconstruct GIA according to the hierarchy manager
2297 assert( pPars->pTimesArr == NULL );
2298 assert( pPars->pTimesReq == NULL );
2299 if ( p->pManTime )
2300 {
2301 if ( fNormalized )
2302 {
2303 pNew = Gia_ManDupUnnormalize( p );
2304 if ( pNew == NULL )
2305 return NULL;
2306 Gia_ManTransferTiming( pNew, p );
2307 p = pNew;
2308 // set arrival and required times
2309 pPars->pTimesArr = Tim_ManGetArrTimes( (Tim_Man_t *)p->pManTime );
2310 pPars->pTimesReq = Tim_ManGetReqTimes( (Tim_Man_t *)p->pManTime );
2311 }
2312 else
2313 p = Gia_ManDup( p );
2314 }
2315 else
2316 p = Gia_ManDup( p );
2317 // perform mapping
2318 pNew = Lf_ManPerformMappingInt( p, pPars );
2319 if ( pNew != p )
2320 {
2321 // transfer name
2322 ABC_FREE( pNew->pName );
2323 ABC_FREE( pNew->pSpec );
2324 pNew->pName = Abc_UtilStrsav( p->pName );
2325 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
2326 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
2327 // return the original (unmodified by the mapper) timing manager
2328 Gia_ManTransferTiming( pNew, p );
2329 Gia_ManStop( p );
2330 }
2331 // normalize and transfer mapping
2332 pNew = Gia_ManDupNormalize( p = pNew, 0 );
2333 Gia_ManTransferMapping( pNew, p );
2334// Gia_ManTransferPacking( pNew, p );
2335 Gia_ManTransferTiming( pNew, p );
2336 Gia_ManStop( p );
2337 return pNew;
2338}
Gia_Man_t * Lf_ManPerformMappingInt(Gia_Man_t *pGia, Jf_Par_t *pPars)
Definition giaLf.c:2182
Gia_Man_t * Gia_ManDupUnnormalize(Gia_Man_t *p)
Definition giaTim.c:382
float * pTimesArr
Definition gia.h:389
float * pTimesReq
Definition gia.h:390
int fCutGroup
Definition gia.h:369
Here is the call graph for this function:

◆ Gia_ManPerformMapping()

Gia_Man_t * Gia_ManPerformMapping ( Gia_Man_t * p,
void * pIfPars )
extern

Definition at line 2598 of file giaIf.c.

2599{
2600 Gia_Man_t * pNew;
2601 if ( p->pManTime && Tim_ManBoxNum((Tim_Man_t*)p->pManTime) && Gia_ManIsNormalized(p) )
2602 {
2603 pNew = Gia_ManDupUnnormalize( p );
2604 if ( pNew == NULL )
2605 return NULL;
2606 Gia_ManTransferTiming( pNew, p );
2607 p = pNew;
2608 // mapping
2609 pNew = Gia_ManPerformMappingInt( p, (If_Par_t *)pp );
2610 if ( pNew != p )
2611 {
2612 Gia_ManTransferTiming( pNew, p );
2613 Gia_ManStop( p );
2614 }
2615 // normalize
2616 pNew = Gia_ManDupNormalize( p = pNew, ((If_Par_t *)pp)->fHashMapping );
2617 Gia_ManTransferMapping( pNew, p );
2618 Gia_ManTransferPacking( pNew, p );
2619 Gia_ManTransferTiming( pNew, p );
2620 Gia_ManStop( p );
2621 assert( Gia_ManIsNormalized(pNew) );
2622 }
2623 else
2624 {
2625 pNew = Gia_ManPerformMappingInt( p, (If_Par_t *)pp );
2626 Gia_ManTransferTiming( pNew, p );
2627 if ( ((If_Par_t *)pp)->fHashMapping )
2628 {
2629 pNew = Gia_ManDupHashMapping( p = pNew );
2630 Gia_ManTransferPacking( pNew, p );
2631 Gia_ManTransferTiming( pNew, p );
2632 Gia_ManStop( p );
2633 }
2634 }
2635 pNew->MappedDelay = (int)((If_Par_t *)pp)->FinalDelay;
2636 pNew->MappedArea = (int)((If_Par_t *)pp)->FinalArea;
2637 return pNew;
2638}
Gia_Man_t * Gia_ManPerformMappingInt(Gia_Man_t *p, If_Par_t *pPars)
Definition giaIf.c:2485
Gia_Man_t * Gia_ManDupHashMapping(Gia_Man_t *p)
Definition giaIf.c:2772
void Gia_ManTransferMapping(Gia_Man_t *p, Gia_Man_t *pGia)
Definition giaIf.c:2305
void Gia_ManTransferPacking(Gia_Man_t *p, Gia_Man_t *pGia)
Definition giaIf.c:2336
int MappedDelay
Definition gia.h:205
int MappedArea
Definition gia.h:204
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManPerformSopBalance()

Gia_Man_t * Gia_ManPerformSopBalance ( Gia_Man_t * p,
int nCutNum,
int nRelaxRatio,
int fVerbose )
extern

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

Synopsis [Interface of other mapping-based procedures.]

Description []

SideEffects []

SeeAlso []

Definition at line 2651 of file giaIf.c.

2652{
2653 Gia_Man_t * pNew;
2654 If_Man_t * pIfMan;
2655 If_Par_t Pars, * pPars = &Pars;
2656 If_ManSetDefaultPars( pPars );
2657 pPars->nCutsMax = nCutNum;
2658 pPars->nRelaxRatio = nRelaxRatio;
2659 pPars->fVerbose = fVerbose;
2660 pPars->nLutSize = 6;
2661 pPars->fDelayOpt = 1;
2662 pPars->fCutMin = 1;
2663 pPars->fTruth = 1;
2664 pPars->fExpRed = 0;
2665 // perform mapping
2666 pIfMan = Gia_ManToIf( p, pPars );
2667 If_ManPerformMapping( pIfMan );
2668 pNew = Gia_ManFromIfAig( pIfMan );
2669 If_ManStop( pIfMan );
2670 Gia_ManTransferTiming( pNew, p );
2671 // transfer name
2672 assert( pNew->pName == NULL );
2673 pNew->pName = Abc_UtilStrsav( p->pName );
2674 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
2675 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
2676 return pNew;
2677}
int fDelayOpt
Definition if.h:126
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManPerformSopBalanceWin()

Gia_Man_t * Gia_ManPerformSopBalanceWin ( Gia_Man_t * p,
int LevelMax,
int nTimeWindow,
int nCutNum,
int nRelaxRatio,
int fVerbose )
extern

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_ManPerformSopBalance(Gia_Man_t *p, int nCutNum, int nRelaxRatio, int fVerbose)
Definition giaIf.c:2651
Here is the call graph for this function:

◆ Gia_ManPermuteInputs()

Gia_Man_t * Gia_ManPermuteInputs ( Gia_Man_t * p,
int nPpis,
int nExtra )
extern

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

Synopsis [Permute inputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 2758 of file giaDup.c.

2759{
2760 Gia_Man_t * pNew;
2761 Gia_Obj_t * pObj;
2762 int i;
2763 pNew = Gia_ManStart( Gia_ManObjNum(p) );
2764 pNew->pName = Abc_UtilStrsav( p->pName );
2765 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
2766 Gia_ManConst0(p)->Value = 0;
2767 for ( i = 0; i < Gia_ManPiNum(p) - nPpis - nExtra; i++ ) // regular PIs
2768 Gia_ManCi(p, i)->Value = Gia_ManAppendCi( pNew );
2769 for ( i = Gia_ManPiNum(p) - nExtra; i < Gia_ManPiNum(p); i++ ) // extra PIs due to DC values
2770 Gia_ManCi(p, i)->Value = Gia_ManAppendCi( pNew );
2771 for ( i = Gia_ManPiNum(p) - nPpis - nExtra; i < Gia_ManPiNum(p) - nExtra; i++ ) // pseudo-PIs
2772 Gia_ManCi(p, i)->Value = Gia_ManAppendCi( pNew );
2773 for ( i = Gia_ManPiNum(p); i < Gia_ManCiNum(p); i++ ) // flop outputs
2774 Gia_ManCi(p, i)->Value = Gia_ManAppendCi( pNew );
2775 assert( Gia_ManCiNum(pNew) == Gia_ManCiNum(p) );
2776 Gia_ManForEachAnd( p, pObj, i )
2777 pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
2778 Gia_ManForEachCo( p, pObj, i )
2779 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
2780 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
2781 return pNew;
2782}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManPrint()

void Gia_ManPrint ( Gia_Man_t * p)
extern

Definition at line 1543 of file giaUtil.c.

1544{
1545 Gia_Obj_t * pObj;
1546 int i;
1547 printf( "GIA manager has %d ANDs, %d XORs, %d MUXes.\n",
1548 Gia_ManAndNum(p) - Gia_ManXorNum(p) - Gia_ManMuxNum(p), Gia_ManXorNum(p), Gia_ManMuxNum(p) );
1549 Gia_ManForEachObj( p, pObj, i )
1550 Gia_ObjPrint( p, pObj );
1551}
void Gia_ObjPrint(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaUtil.c:1456
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManPrintCo()

void Gia_ManPrintCo ( Gia_Man_t * p,
Gia_Obj_t * pObj )
extern

Definition at line 1563 of file giaUtil.c.

1564{
1565 assert( Gia_ObjIsCo(pObj) );
1566 printf( "TFI cone of CO number %d:\n", Gia_ObjCioId(pObj) );
1567 Gia_ManPrintCo_rec( p, Gia_ObjFanin0(pObj) );
1568 Gia_ObjPrint( p, pObj );
1569}
void Gia_ManPrintCo_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaUtil.c:1552
Here is the call graph for this function:

◆ Gia_ManPrintCone()

void Gia_ManPrintCone ( Gia_Man_t * p,
Gia_Obj_t * pObj,
int * pLeaves,
int nLeaves,
Vec_Int_t * vNodes )
extern

Definition at line 1582 of file giaUtil.c.

1583{
1584 int i;
1585 Vec_IntClear( vNodes );
1586 for ( i = 0; i < nLeaves; i++ )
1587 Vec_IntPush( vNodes, pLeaves[i] );
1588 Gia_ManPrintCollect_rec( p, pObj, vNodes );
1589 printf( "GIA logic cone for node %d:\n", Gia_ObjId(p, pObj) );
1590 Gia_ManForEachObjVec( vNodes, p, pObj, i )
1591 Gia_ObjPrint( p, pObj );
1592}
void Gia_ManPrintCollect_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vNodes)
Definition giaUtil.c:1571
Here is the call graph for this function:

◆ Gia_ManPrintCone2()

void Gia_ManPrintCone2 ( Gia_Man_t * p,
Gia_Obj_t * pObj )
extern

Definition at line 1618 of file giaUtil.c.

1619{
1620 Vec_Int_t * vNodes;
1621 int i;
1622 vNodes = Vec_IntAlloc( 100 );
1623 Gia_ManPrintCollect2_rec( p, pObj, vNodes );
1624 printf( "GIA logic cone for node %d:\n", Gia_ObjId(p, pObj) );
1625 Gia_ManForEachObjVec( vNodes, p, pObj, i )
1626 Gia_ObjPrint( p, pObj );
1627 Vec_IntFree( vNodes );
1628}
void Gia_ManPrintCollect2_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vNodes)
Definition giaUtil.c:1606
Here is the call graph for this function:

◆ Gia_ManPrintConeMulti()

void Gia_ManPrintConeMulti ( Gia_Man_t * p,
Vec_Int_t * vObjs,
Vec_Int_t * vLeaves,
Vec_Int_t * vNodes )
extern

Definition at line 1593 of file giaUtil.c.

1594{
1595 Gia_Obj_t * pObj;
1596 int i;
1597 Vec_IntClear( vNodes );
1598 Vec_IntAppend( vNodes, vLeaves );
1599 Gia_ManForEachObjVec( vObjs, p, pObj, i )
1600 Gia_ManPrintCollect_rec( p, pObj, vNodes );
1601 printf( "GIA logic cone for %d nodes:\n", Vec_IntSize(vObjs) );
1602 Gia_ManForEachObjVec( vNodes, p, pObj, i )
1603 Gia_ObjPrint( p, pObj );
1604}
Here is the call graph for this function:

◆ Gia_ManPrintFanio()

void Gia_ManPrintFanio ( Gia_Man_t * pGia,
int nNodes )
extern

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 );
754
755 if ( nNodes > 0 )
756 {
757 Cof_ManResetTravId( p );
758 Gia_ManHashStart( pGia );
759 Cof_ManPrintHighFanout( p, nNodes );
760 Gia_ManHashStop( pGia );
761ABC_PRMn( "Memory for logic network", 4*p->nObjData );
762ABC_PRT( "Time", Abc_Clock() - clk );
763 }
764
765 Cof_ManStop( p );
766}
#define ABC_PRMn(a, f)
Definition abc_global.h:261
struct Cof_Man_t_ Cof_Man_t
Definition giaCof.c:55
void Cof_ManPrintHighFanout(Cof_Man_t *p, int nNodes)
Definition giaCof.c:541
void Cof_ManStop(Cof_Man_t *p)
Definition giaCof.c:203
void Cof_ManPrintFanio(Cof_Man_t *p)
Definition giaCof.c:605
Cof_Man_t * Cof_ManCreateLogicSimple(Gia_Man_t *pGia)
FUNCTION DEFINITIONS ///.
Definition giaCof.c:126
Here is the call graph for this function:

◆ Gia_ManPrintLutStats()

void Gia_ManPrintLutStats ( Gia_Man_t * p)
extern

Definition at line 727 of file giaIf.c.

728{
729 int i, nSizeMax, pCounts[33] = {0};
730 nSizeMax = Gia_ManLutSizeMax( p );
731 if ( nSizeMax > 32 )
732 {
733 Abc_Print( 1, "The max LUT size (%d) is too large.\n", nSizeMax );
734 return;
735 }
736 Gia_ManForEachLut( p, i )
737 pCounts[ Gia_ObjLutSize(p, i) ]++;
738 Gia_ManPrintNodeProfile( pCounts, nSizeMax );
739}
void Gia_ManPrintNodeProfile(int *pCounts, int nSizeMax)
Definition giaIf.c:714
int Gia_ManLutSizeMax(Gia_Man_t *p)
Definition giaIf.c:127
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManPrintMappingStats()

void Gia_ManPrintMappingStats ( Gia_Man_t * p,
char * pDumpFile )
extern

Definition at line 532 of file giaIf.c.

533{
534 int fDisable2Lut = 1;
535 Gia_Obj_t * pObj;
536 int * pLevels;
537 int i, k, iFan, nLutSize = 0, nLuts = 0, nFanins = 0, LevelMax = 0, Ave = 0, nMuxF = 0;
538 if ( !Gia_ManHasMapping(p) )
539 return;
540 pLevels = ABC_CALLOC( int, Gia_ManObjNum(p) );
541 Gia_ManForEachLut( p, i )
542 {
543 if ( Gia_ObjLutIsMux(p, i) && !(fDisable2Lut && Gia_ObjLutSize(p, i) == 2) )
544 {
545 int pFanins[3];
546 if ( Gia_ObjLutSize(p, i) == 3 )
547 {
548 Gia_ManPrintGetMuxFanins( p, Gia_ManObj(p, i), pFanins );
549 pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[pFanins[0]]+1 );
550 pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[pFanins[1]] );
551 pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[pFanins[2]] );
552 }
553 else if ( Gia_ObjLutSize(p, i) == 2 )
554 {
555 pObj = Gia_ManObj( p, i );
556 pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[Gia_ObjFaninId0(pObj, i)] );
557 pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[Gia_ObjFaninId1(pObj, i)] );
558 }
559 LevelMax = Abc_MaxInt( LevelMax, pLevels[i] );
560 nFanins++;
561 nMuxF++;
562 continue;
563 }
564 nLuts++;
565 nFanins += Gia_ObjLutSize(p, i);
566 nLutSize = Abc_MaxInt( nLutSize, Gia_ObjLutSize(p, i) );
567 Gia_LutForEachFanin( p, i, iFan, k )
568 pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[iFan] );
569 pLevels[i]++;
570 LevelMax = Abc_MaxInt( LevelMax, pLevels[i] );
571 }
572 Gia_ManForEachCo( p, pObj, i )
573 Ave += pLevels[Gia_ObjFaninId0p(p, pObj)];
574 ABC_FREE( pLevels );
575
576#ifdef WIN32
577 {
578 HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
579 Abc_Print( 1, "Mapping (K=%d) : ", nLutSize );
580 SetConsoleTextAttribute( hConsole, 14 ); // yellow
581 Abc_Print( 1, "lut =%7d ", nLuts );
582 if ( nMuxF )
583 Abc_Print( 1, "muxF =%7d ", nMuxF );
584 SetConsoleTextAttribute( hConsole, 10 ); // green
585 Abc_Print( 1, "edge =%8d ", nFanins );
586 SetConsoleTextAttribute( hConsole, 12 ); // red
587 Abc_Print( 1, "lev =%5d ", LevelMax );
588 Abc_Print( 1, "(%.2f) ", (float)Ave / Gia_ManCoNum(p) );
589// Abc_Print( 1, "over =%5.1f %% ", 100.0 * Gia_ManComputeOverlap(p) / Gia_ManAndNum(p) );
590 if ( p->pManTime && Tim_ManBoxNum((Tim_Man_t *)p->pManTime) )
591 Abc_Print( 1, "levB =%5d ", Gia_ManLutLevelWithBoxes(p) );
592 SetConsoleTextAttribute( hConsole, 7 ); // normal
593 Abc_Print( 1, "mem =%5.2f MB", 4.0*(Gia_ManObjNum(p) + 2*nLuts + nFanins)/(1<<20) );
594 Abc_Print( 1, "\n" );
595 }
596#else
597 Abc_Print( 1, "Mapping (K=%d) : ", nLutSize );
598 Abc_Print( 1, "%slut =%7d%s ", "\033[1;33m", nLuts, "\033[0m" ); // yellow
599 Abc_Print( 1, "%sedge =%8d%s ", "\033[1;32m", nFanins, "\033[0m" ); // green
600 Abc_Print( 1, "%slev =%5d%s ", "\033[1;31m", LevelMax, "\033[0m" ); // red
601 Abc_Print( 1, "%s(%.2f)%s ", "\033[1;31m", (float)Ave / Gia_ManCoNum(p), "\033[0m" );
602// Abc_Print( 1, "over =%5.1f %% ", 100.0 * Gia_ManComputeOverlap(p) / Gia_ManAndNum(p) );
603 if ( p->pManTime && Tim_ManBoxNum((Tim_Man_t *)p->pManTime) )
604 Abc_Print( 1, "%slevB =%5d%s ", "\033[1;31m", Gia_ManLutLevelWithBoxes(p), "\033[0m" );
605 Abc_Print( 1, "mem =%5.2f MB", 4.0*(Gia_ManObjNum(p) + 2*nLuts + nFanins)/(1<<20) );
606 Abc_Print( 1, "\n" );
607#endif
608
609 if ( nMuxF )
611
612 //return;
613 if ( pDumpFile )
614 {
615 static char FileNameOld[1000] = {0};
616 static abctime clk = 0;
617 FILE * pTable = fopen( pDumpFile, "a+" );
618 if ( strcmp( FileNameOld, p->pName ) )
619 {
620 sprintf( FileNameOld, "%s_out", p->pName );
621 fprintf( pTable, "\n" );
622 fprintf( pTable, "%s ", p->pName );
623 fprintf( pTable, " " );
624 //fprintf( pTable, "%d ", Gia_ManAndNum(p) );
625 fprintf( pTable, "%d ", Gia_ManRegNum(p) );
626 fprintf( pTable, "%d ", nLuts );
627 fprintf( pTable, "%d ", Gia_ManLutLevelWithBoxes(p) );
628 //fprintf( pTable, "%d ", Gia_ManRegBoxNum(p) );
629 //fprintf( pTable, "%d ", Gia_ManNonRegBoxNum(p) );
630 //fprintf( pTable, "%.2f", 1.0*(Abc_Clock() - clk)/CLOCKS_PER_SEC );
631 clk = Abc_Clock();
632 }
633 else
634 {
635 //printf( "This part of the code is currently not used.\n" );
636 //assert( 0 );
637 fprintf( pTable, " " );
638 fprintf( pTable, " " );
639 fprintf( pTable, "%d ", Gia_ManRegNum(p) );
640 fprintf( pTable, "%d ", nLuts );
641 fprintf( pTable, "%d ", Gia_ManLutLevelWithBoxes(p) );
642 //fprintf( pTable, "%d ", Gia_ManRegBoxNum(p) );
643 //fprintf( pTable, "%d ", Gia_ManNonRegBoxNum(p) );
644// fprintf( pTable, "%.2f", 1.0*(Abc_Clock() - clk)/CLOCKS_PER_SEC );
645 clk = Abc_Clock();
646 }
647 fclose( pTable );
648 }
649
650}
int Gia_ManCountDupLut(Gia_Man_t *p)
Definition giaIf.c:419
int strcmp()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManPrintMiterStatus()

void Gia_ManPrintMiterStatus ( Gia_Man_t * p)
extern

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

Synopsis [Prints stats for the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 679 of file giaMan.c.

680{
681 Gia_Obj_t * pObj, * pChild;
682 int i, nSat = 0, nUnsat = 0, nUndec = 0, iOut = -1;
683 Gia_ManForEachPo( p, pObj, i )
684 {
685 pChild = Gia_ObjChild0(pObj);
686 // check if the output is constant 0
687 if ( pChild == Gia_ManConst0(p) )
688 nUnsat++;
689 // check if the output is constant 1
690 else if ( pChild == Gia_ManConst1(p) )
691 {
692 nSat++;
693 if ( iOut == -1 )
694 iOut = i;
695 }
696 // check if the output is a primary input
697 else if ( Gia_ObjIsPi(p, Gia_Regular(pChild)) )
698 {
699 nSat++;
700 if ( iOut == -1 )
701 iOut = i;
702 }
703/*
704 // check if the output is 1 for the 0000 pattern
705 else if ( Gia_Regular(pChild)->fPhase != (unsigned)Gia_IsComplement(pChild) )
706 {
707 nSat++;
708 if ( iOut == -1 )
709 iOut = i;
710 }
711*/
712 else
713 nUndec++;
714 }
715 Abc_Print( 1, "Outputs = %7d. Unsat = %7d. Sat = %7d. Undec = %7d.\n",
716 Gia_ManPoNum(p), nUnsat, nSat, nUndec );
717}

◆ Gia_ManPrintMuxStats()

void Gia_ManPrintMuxStats ( Gia_Man_t * p)
extern

Definition at line 63 of file giaMuxes.c.

64{
65 int nAnds, nMuxes, nXors, nTotal;
66 if ( p->pMuxes )
67 {
68 nAnds = Gia_ManAndNotBufNum(p)-Gia_ManXorNum(p)-Gia_ManMuxNum(p);
69 nXors = Gia_ManXorNum(p);
70 nMuxes = Gia_ManMuxNum(p);
71 nTotal = nAnds + 3*nXors + 3*nMuxes;
72 }
73 else
74 {
75 Gia_ManCountMuxXor( p, &nMuxes, &nXors );
76 nAnds = Gia_ManAndNotBufNum(p) - 3*nMuxes - 3*nXors;
77 nTotal = Gia_ManAndNotBufNum(p);
78 }
79 Abc_Print( 1, "stats: " );
80 Abc_Print( 1, "xor =%8d %6.2f %% ", nXors, 300.0*nXors/nTotal );
81 Abc_Print( 1, "mux =%8d %6.2f %% ", nMuxes, 300.0*nMuxes/nTotal );
82 Abc_Print( 1, "and =%8d %6.2f %% ", nAnds, 100.0*nAnds/nTotal );
83 Abc_Print( 1, "obj =%8d ", Gia_ManAndNotBufNum(p) );
84 fflush( stdout );
85}
ABC_NAMESPACE_IMPL_START void Gia_ManCountMuxXor(Gia_Man_t *p, int *pnMuxes, int *pnXors)
DECLARATIONS ///.
Definition giaMuxes.c:49
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManPrintNpnClasses()

void Gia_ManPrintNpnClasses ( Gia_Man_t * p)
extern

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

Synopsis [Prints NPN class statistics.]

Description []

SideEffects []

SeeAlso []

Definition at line 804 of file giaMan.c.

805{
806 extern char ** Kit_DsdNpn4ClassNames();
807 char ** pNames = Kit_DsdNpn4ClassNames();
808 Vec_Int_t * vLeaves, * vTruth, * vVisited;
809 int * pLutClass, ClassCounts[222] = {0};
810 int i, k, iFan, Class, OtherClasses, OtherClasses2, nTotal, Counter, Counter2;
811 unsigned * pTruth; int nLutSize = 0;
812 assert( Gia_ManHasMapping(p) );
813 //assert( Gia_ManLutSizeMax( p ) <= 4 );
814 vLeaves = Vec_IntAlloc( 100 );
815 vVisited = Vec_IntAlloc( 100 );
816 vTruth = Vec_IntAlloc( (1<<16) );
817 pLutClass = ABC_CALLOC( int, Gia_ManObjNum(p) );
819 Gia_ManForEachLut( p, i )
820 {
821 nLutSize = Abc_MaxInt( nLutSize, Gia_ObjLutSize(p,i) );
822 if ( Gia_ObjLutSize(p,i) > 4 )
823 continue;
824 Vec_IntClear( vLeaves );
825 Gia_LutForEachFanin( p, i, iFan, k )
826 Vec_IntPush( vLeaves, iFan );
827 for ( ; k < 4; k++ )
828 Vec_IntPush( vLeaves, 0 );
829 pTruth = Gia_ManConvertAigToTruth( p, Gia_ManObj(p, i), vLeaves, vTruth, vVisited );
830 Class = Dar_LibReturnClass( *pTruth );
831 ClassCounts[ Class ]++;
832 pLutClass[i] = Class;
833 }
834 Vec_IntFree( vLeaves );
835 Vec_IntFree( vTruth );
836 Vec_IntFree( vVisited );
837 Vec_IntFreeP( &p->vTruths );
838 nTotal = 0;
839 for ( i = 0; i < 222; i++ )
840 nTotal += ClassCounts[i];
841 Abc_Print( 1, "NPN CLASS STATISTICS (for %d LUT4 present in the current mapping):\n", nTotal );
842 OtherClasses = 0;
843 for ( i = k = 0; i < 222; i++ )
844 {
845 if ( ClassCounts[i] == 0 )
846 continue;
847// if ( 100.0 * ClassCounts[i] / (nTotal+1) < 0.1 ) // do not show anything below 0.1 percent
848// continue;
849 OtherClasses += ClassCounts[i];
850 Abc_Print( 1, "%3d: Class %3d : Count = %6d (%7.2f %%) %s\n",
851 ++k, i, ClassCounts[i], 100.0 * ClassCounts[i] / (nTotal+1), pNames[i] );
852 }
853 OtherClasses = nTotal - OtherClasses;
854 Abc_Print( 1, "Other : Count = %6d (%7.2f %%)\n",
855 OtherClasses, 100.0 * OtherClasses / (nTotal+1) );
856 // count the number of LUTs that have MUX function and two fanins with MUX functions
857 OtherClasses = OtherClasses2 = 0;
858 ABC_FREE( p->pRefs );
860 Gia_ManForEachLut( p, i )
861 {
862 if ( pLutClass[i] != 109 )
863 continue;
864 Counter = Counter2 = 0;
865 Gia_LutForEachFanin( p, i, iFan, k )
866 {
867 Counter += (pLutClass[iFan] == 109);
868 Counter2 += (pLutClass[iFan] == 109) && (Gia_ObjRefNumId(p, iFan) == 1);
869 }
870 OtherClasses += (Counter > 1);
871 OtherClasses2 += (Counter2 > 1);
872// Abc_Print( 1, "%d -- ", pLutClass[i] );
873// Gia_LutForEachFanin( p, i, iFan, k )
874// Abc_Print( 1, "%d ", pLutClass[iFan] );
875// Abc_Print( 1, "\n" );
876 }
877 ABC_FREE( p->pRefs );
878 Abc_Print( 1, "Approximate number of 4:1 MUX structures: All = %6d (%7.2f %%) MFFC = %6d (%7.2f %%)\n",
879 OtherClasses, 100.0 * OtherClasses / (nTotal+1),
880 OtherClasses2, 100.0 * OtherClasses2 / (nTotal+1) );
881 // print information about LUT pairs
882 if ( nLutSize <= 4 )
883 {
884 int nTopPairs = 100, nTopShow = 30;
885 int i, j, k, iFan, * pVec = NULL;
886 Vec_Int_t * vPairs = Vec_IntAlloc( 3 * nTopPairs );
887 Gia_ManForEachLut( p, j ) {
888 Gia_LutForEachFanin( p, j, iFan, k ) {
889 int Num1 = pLutClass[iFan];
890 int Num2 = pLutClass[j];
891 assert( Vec_IntSize(vPairs) % 3 == 0 );
892 for ( i = 0; i < Vec_IntSize(vPairs); i += 3 )
893 if ( Vec_IntEntry(vPairs, i+0) == Num1 && Vec_IntEntry(vPairs, i+1) == Num2 )
894 break;
895 if ( i == Vec_IntSize(vPairs) ) {
896 if ( Vec_IntSize(vPairs) < 3*nTopPairs ) {
897 Vec_IntPush( vPairs, Num1 );
898 Vec_IntPush( vPairs, Num2 );
899 Vec_IntPush( vPairs, 1 );
900 }
901 continue;
902 }
903 // found this pair
904 assert( Vec_IntEntry(vPairs, i+0) == Num1 );
905 assert( Vec_IntEntry(vPairs, i+1) == Num2 );
906 Vec_IntAddToEntry( vPairs, i+2, 1 );
907 // sort
908 pVec = Vec_IntArray( vPairs );
909 while ( i > 0 && pVec[i+2] > pVec[i-1] ) {
910 ABC_SWAP( int, pVec[i+0], pVec[i-3] )
911 ABC_SWAP( int, pVec[i+1], pVec[i-2] )
912 ABC_SWAP( int, pVec[i+2], pVec[i-1] )
913 i -= 3;
914 }
915 while ( i < Vec_IntSize(vPairs) - 3 && pVec[i+2] < pVec[i+5] ) {
916 ABC_SWAP( int, pVec[i+0], pVec[i+3] )
917 ABC_SWAP( int, pVec[i+1], pVec[i+4] )
918 ABC_SWAP( int, pVec[i+2], pVec[i+5] )
919 i += 3;
920 assert( 0 );
921 }
922 }
923 }
924 pVec = Vec_IntArray( vPairs );
925 nTopShow = Abc_MinInt( nTopShow, Vec_IntSize(vPairs)/3 );
926 for ( i = 0; i < 3*nTopShow; i += 3 )
927 printf( "%3d : (%3d %3d) x %3d\n", i/3, pVec[i+0], pVec[i+1], pVec[i+2] );
928 Vec_IntFree( vPairs );
929 }
930 ABC_FREE( pLutClass );
931}
#define ABC_SWAP(Type, a, b)
Definition abc_global.h:253
int Dar_LibReturnClass(unsigned uTruth)
Definition darLib.c:194
void Gia_ManSetRefsMapped(Gia_Man_t *p)
Definition giaIf.c:271
char ** Kit_DsdNpn4ClassNames()
Definition kitDsd.c:3049
for(p=first;p->value< newval;p=p->next)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManPrintOutputLutStats()

void Gia_ManPrintOutputLutStats ( Gia_Man_t * p)
extern

Definition at line 497 of file giaIf.c.

498{
499 int Limit = 100000;
500 int nLutSize = Gia_ManLutSizeMax(p);
501 Vec_Int_t * vLuts = Vec_IntAlloc( 1000 );
502 Vec_Int_t * vNodes = Vec_IntStart( Limit );
503 Vec_Int_t * vLevels = Vec_IntStart( Limit );
504 Vec_Int_t * vLevel = Vec_IntStart( Gia_ManObjNum(p) );
505 int i, DriverId, Value, nTotalLuts = 0;
506 Gia_ManForEachCoDriverId( p, DriverId, i ) {
507 Vec_IntClear( vLuts );
509 Gia_ManCollectLuts_rec( p, DriverId, vLuts );
510 if ( Vec_IntSize(vLuts) < Limit )
511 Vec_IntAddToEntry( vNodes, Vec_IntSize(vLuts), 1 );
512 int Level = Gia_ManCountLutLevels( p, vLuts, vLevel );
513 if ( Level < Limit )
514 Vec_IntAddToEntry( vLevels, Level, 1 );
515 nTotalLuts += Vec_IntSize(vLuts);
516 }
517 printf( "Level count statistics for %d AIG outputs:\n", Gia_ManCoNum(p) );
518 Vec_IntForEachEntry( vLevels, Value, i )
519 if ( Value )
520 printf( " %2d level : Function count = %8d (%6.2f %%)\n", i, Value, 100.0*Value/Gia_ManCoNum(p) );
521 printf( "LUT count statistics for %d AIG outputs:\n", Gia_ManCoNum(p) );
522 Vec_IntForEachEntry( vNodes, Value, i )
523 if ( Value )
524 printf( " %2d LUT%d : Function count = %8d (%6.2f %%)\n", i, nLutSize, Value, 100.0*Value/Gia_ManCoNum(p) );
525 printf( "Sum total of LUT counts for all outputs = %d. Shared LUT count = %d.\n", nTotalLuts, Gia_ManLutNum(p) );
526 Vec_IntFree( vLuts );
527 Vec_IntFree( vNodes );
528 Vec_IntFree( vLevels );
529 Vec_IntFree( vLevel );
530}
void Gia_ManCollectLuts_rec(Gia_Man_t *p, int iObj, Vec_Int_t *vLuts)
Definition giaIf.c:473
int Gia_ManLutNum(Gia_Man_t *p)
Definition giaIf.c:146
int Gia_ManCountLutLevels(Gia_Man_t *p, Vec_Int_t *vLuts, Vec_Int_t *vLevel)
Definition giaIf.c:483
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManPrintOutputProb()

Vec_Flt_t * Gia_ManPrintOutputProb ( Gia_Man_t * p)
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 848 of file giaSwitch.c.

849{
850 Vec_Flt_t * vSimData;
851 Gia_Man_t * pDfs = Gia_ManDup( p );
852 assert( Gia_ManObjNum(pDfs) == Gia_ManObjNum(p) );
853 vSimData = (Vec_Flt_t *)Gia_ManComputeSwitchProbs( pDfs, (Gia_ManRegNum(p) ? 16 : 1), 0, 1 );
854 Gia_ManStop( pDfs );
855 return vSimData;
856}
typedefABC_NAMESPACE_HEADER_START struct Vec_Flt_t_ Vec_Flt_t
INCLUDES ///.
Definition vecFlt.h:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManPrintPackingStats()

void Gia_ManPrintPackingStats ( Gia_Man_t * p)
extern

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

Synopsis [Prints mapping statistics.]

Description []

SideEffects []

SeeAlso []

Definition at line 663 of file giaIf.c.

664{
665 int fVerbose = 0;
666 int nObjToShow = 200;
667 int nNumStr[5] = {0};
668 int i, k, Entry, nEntries, nEntries2, MaxSize = -1, Count = 0;
669 if ( p->vPacking == NULL )
670 return;
671 nEntries = Vec_IntEntry( p->vPacking, 0 );
672 nEntries2 = 0;
673 Vec_IntForEachEntryStart( p->vPacking, Entry, i, 1 )
674 {
675 assert( Entry > 0 && Entry < 4 );
676 nNumStr[Entry]++;
677 i++;
678 if ( fVerbose && nEntries2 < nObjToShow ) Abc_Print( 1, "{ " );
679 for ( k = 0; k < Entry; k++, i++ )
680 if ( fVerbose && nEntries2 < nObjToShow ) Abc_Print( 1, "%d ", Vec_IntEntry(p->vPacking, i) );
681 if ( fVerbose && nEntries2 < nObjToShow ) Abc_Print( 1, "}\n" );
682 i--;
683 nEntries2++;
684 }
685 assert( nEntries == nEntries2 );
686 if ( nNumStr[3] > 0 )
687 MaxSize = 3;
688 else if ( nNumStr[2] > 0 )
689 MaxSize = 2;
690 else if ( nNumStr[1] > 0 )
691 MaxSize = 1;
692 Abc_Print( 1, "Packing (N=%d) : ", MaxSize );
693 for ( i = 1; i <= MaxSize; i++ )
694 {
695 Abc_Print( 1, "%d x LUT = %d ", i, nNumStr[i] );
696 Count += i * nNumStr[i];
697 }
698 Abc_Print( 1, "Total = %d ", nEntries2 );
699 Abc_Print( 1, "Total LUT = %d", Count );
700 Abc_Print( 1, "\n" );
701}
Here is the caller graph for this function:

◆ Gia_ManPrintStats()

void Gia_ManPrintStats ( Gia_Man_t * p,
Gps_Par_t * pPars )
extern

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

Synopsis [Prints stats for the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 495 of file giaMan.c.

496{
497 extern float Gia_ManLevelAve( Gia_Man_t * p );
498 int fHaveLevels = p->vLevels != NULL;
499 if ( pPars && pPars->fMiter )
500 {
502 return;
503 }
504 if ( pPars && pPars->fNoColor )
505 {
506 if ( p->pName )
507 Abc_Print( 1, "%-8s : ", p->pName );
508 }
509 else
510 {
511#ifdef WIN32
512 SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), 15 ); // bright
513 if ( p->pName )
514 Abc_Print( 1, "%-8s : ", p->pName );
515 SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), 7 ); // normal
516#else
517 if ( p->pName )
518 Abc_Print( 1, "%s%-8s%s : ", "\033[1;37m", p->pName, "\033[0m" ); // bright
519#endif
520 }
521 Abc_Print( 1, "i/o =%7d/%7d",
522 Gia_ManPiNum(p) - Gia_ManBoxCiNum(p) - Gia_ManRegBoxNum(p),
523 Gia_ManPoNum(p) - Gia_ManBoxCoNum(p) - Gia_ManRegBoxNum(p) );
524 if ( Gia_ManConstrNum(p) )
525 Abc_Print( 1, "(c=%d)", Gia_ManConstrNum(p) );
526 if ( Gia_ManRegNum(p) )
527 Abc_Print( 1, " ff =%7d", Gia_ManRegNum(p) );
528 if ( Gia_ManRegBoxNum(p) )
529 Abc_Print( 1, " boxff =%d(%d)", Gia_ManRegBoxNum(p), Gia_ManClockDomainNum(p) );
530 if ( pPars && pPars->fNoColor )
531 {
532 Abc_Print( 1, " %s =%8d", p->pMuxes? "nod" : "and", Gia_ManAndNum(p) );
533 Abc_Print( 1, " lev =%5d", Gia_ManLevelNum(p) );
534 Abc_Print( 1, " (%.2f)", Gia_ManLevelAve(p) );
535 }
536 else
537 {
538#ifdef WIN32
539 {
540 HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
541 SetConsoleTextAttribute( hConsole, 11 ); // blue
542 Abc_Print( 1, " %s =%8d", p->pMuxes? "nod" : "and", Gia_ManAndNum(p) );
543 SetConsoleTextAttribute( hConsole, 13 ); // magenta
544 Abc_Print( 1, " lev =%5d", Gia_ManLevelNum(p) );
545 Abc_Print( 1, " (%7.2f)", Gia_ManLevelAve(p) );
546 SetConsoleTextAttribute( hConsole, 7 ); // normal
547 }
548#else
549 Abc_Print( 1, " %s%s =%8d%s", "\033[1;36m", p->pMuxes? "nod" : "and", Gia_ManAndNum(p), "\033[0m" ); // blue
550 Abc_Print( 1, " %slev =%5d%s", "\033[1;35m", Gia_ManLevelNum(p), "\033[0m" ); // magenta
551 Abc_Print( 1, " %s(%.2f)%s", "\033[1;35m", Gia_ManLevelAve(p), "\033[0m" );
552#endif
553 }
554 if ( !fHaveLevels )
555 Vec_IntFreeP( &p->vLevels );
556 if ( pPars && pPars->fCut )
557 Abc_Print( 1, " cut = %d(%d)", Gia_ManCrossCut(p, 0), Gia_ManCrossCut(p, 1) );
558 Abc_Print( 1, " mem =%5.2f MB", Gia_ManMemory(p)/(1<<20) );
559 if ( Gia_ManHasChoices(p) )
560 Abc_Print( 1, " ch =%5d", Gia_ManChoiceNum(p) );
561 if ( p->pManTime )
562 Abc_Print( 1, " box = %d", Gia_ManNonRegBoxNum(p) );
563 if ( p->pManTime )
564 Abc_Print( 1, " bb = %d", Gia_ManBlackBoxNum(p) );
565 if ( Gia_ManBufNum(p) )
566 Abc_Print( 1, " buf = %d", Gia_ManBufNum(p) );
567 if ( Gia_ManXorNum(p) && p->pMuxes == NULL )
568 Abc_Print( 1, " xor = %d", Gia_ManXorNum(p) );
569 if ( pPars && pPars->fMuxXor )
570 printf( "\nXOR/MUX " ), Gia_ManPrintMuxStats( p );
571 if ( pPars && pPars->fSwitch )
572 {
573 static int nPiPo = 0;
574 static float PrevSwiTotal = 0;
575 float SwiTotal = Gia_ManComputeSwitching( p, 48, 16, 0 );
576 Abc_Print( 1, " power =%8.1f", SwiTotal );
577 if ( PrevSwiTotal > 0 && nPiPo == Gia_ManCiNum(p) + Gia_ManCoNum(p) )
578 Abc_Print( 1, " %6.2f %%", 100.0*(PrevSwiTotal-SwiTotal)/PrevSwiTotal );
579 else if ( PrevSwiTotal == 0 || nPiPo != Gia_ManCiNum(p) + Gia_ManCoNum(p) )
580 PrevSwiTotal = SwiTotal, nPiPo = Gia_ManCiNum(p) + Gia_ManCoNum(p);
581 }
582// Abc_Print( 1, "obj =%5d ", Gia_ManObjNum(p) );
583 Abc_Print( 1, "\n" );
584
585// Gia_ManSatExperiment( p );
586 if ( p->pReprs && p->pNexts )
587 Gia_ManEquivPrintClasses( p, 0, 0.0 );
588 if ( Gia_ManHasMapping(p) && (pPars == NULL || !pPars->fSkipMap) )
589 Gia_ManPrintMappingStats( p, pPars ? pPars->pDumpFile : NULL );
590 else if ( pPars && pPars->pDumpFile )
591 Gia_ManLogAigStats( p, pPars->pDumpFile );
592 if ( pPars && pPars->fNpn && Gia_ManHasMapping(p) )
594 if ( p->vPacking )
596 if ( p->vEdge1 )
598 if ( pPars && pPars->fLutProf && Gia_ManHasMapping(p) )
600 if ( p->pPlacement )
602// if ( p->pManTime )
603// Tim_ManPrintStats( (Tim_Man_t *)p->pManTime, p->nAnd2Delay );
607// if ( p->vRegClasses )
608// {
609// printf( "The design has %d flops with the following class info: ", Vec_IntSize(p->vRegClasses) );
610// Vec_IntPrint( p->vRegClasses );
611// }
612 if ( p->vInitClasses )
613 Gia_ManPrintInitClasses( p->vInitClasses );
614 // check integrity of boxes
616/*
617 if ( Gia_ManRegBoxNum(p) )
618 {
619 int i, Limit = Vec_IntFindMax(p->vRegClasses);
620 for ( i = 1; i <= Limit; i++ )
621 printf( "%d ", Vec_IntCountEntry(p->vRegClasses, i) );
622 printf( "\n" );
623 }
624*/
625 if ( pPars && pPars->fTents )
626 {
627/*
628 int k, Entry, Prev = 1;
629 Vec_Int_t * vLimit = Vec_IntAlloc( 1000 );
630 Gia_Man_t * pNew = Gia_ManUnrollDup( p, vLimit );
631 Abc_Print( 1, "Tents: " );
632 Vec_IntForEachEntryStart( vLimit, Entry, k, 1 )
633 Abc_Print( 1, "%d=%d ", k, Entry-Prev ), Prev = Entry;
634 Abc_Print( 1, " Unused=%d.", Gia_ManObjNum(p) - Gia_ManObjNum(pNew) );
635 Abc_Print( 1, "\n" );
636 Vec_IntFree( vLimit );
637 Gia_ManStop( pNew );
638*/
640 }
641 if ( pPars && pPars->fSlacks )
643 if ( Gia_ManHasMapping(p) && pPars->fMapOutStats )
645}
void Gia_ManPrintGateClasses(Gia_Man_t *p)
Definition absDup.c:331
void Gia_ManPrintObjClasses(Gia_Man_t *p)
Definition absDup.c:367
void Gia_ManPrintFlopClasses(Gia_Man_t *p)
Definition absDup.c:301
int Gia_ManPrintEdges(Gia_Man_t *p)
Definition giaMan.c:437
double Gia_ManMemory(Gia_Man_t *p)
Definition giaMan.c:194
void Gia_ManPrintTents(Gia_Man_t *p)
Definition giaMan.c:312
void Gia_ManPrintInitClasses(Vec_Int_t *vInits)
Definition giaMan.c:361
void Gia_ManPrintPlacement(Gia_Man_t *p)
Definition giaMan.c:275
void Gia_ManLogAigStats(Gia_Man_t *p, char *pDumpFile)
Definition giaMan.c:470
void Gia_ManPrintStatsMiter(Gia_Man_t *p, int fVerbose)
Definition giaMan.c:730
void Gia_ManPrintNpnClasses(Gia_Man_t *p)
Definition giaMan.c:804
ABC_NAMESPACE_IMPL_START void Gia_ManDfsSlacksPrint(Gia_Man_t *p)
DECLARATIONS ///.
Definition giaMan.c:1213
float Gia_ManLevelAve(Gia_Man_t *p)
Definition giaUtil.c:588
int Gia_ManNonRegBoxNum(Gia_Man_t *p)
Definition giaTim.c:58
void Gia_ManPrintMappingStats(Gia_Man_t *p, char *pDumpFile)
Definition giaIf.c:532
int Gia_ManBoxCiNum(Gia_Man_t *p)
Definition giaTim.c:66
float Gia_ManComputeSwitching(Gia_Man_t *p, int nFrames, int nPref, int fProbOne)
Definition giaSwitch.c:808
void Gia_ManPrintPackingStats(Gia_Man_t *p)
Definition giaIf.c:663
void Gia_ManPrintLutStats(Gia_Man_t *p)
Definition giaIf.c:727
void Gia_ManEquivPrintClasses(Gia_Man_t *p, int fVerbose, float Mem)
Definition giaEquiv.c:501
void Gia_ManPrintOutputLutStats(Gia_Man_t *p)
Definition giaIf.c:497
void Gia_ManPrintMuxStats(Gia_Man_t *p)
Definition giaMuxes.c:63
int Gia_ManCrossCut(Gia_Man_t *p, int fReverse)
Definition giaUtil.c:916
int Gia_ManClockDomainNum(Gia_Man_t *p)
Definition giaTim.c:74
void Gia_ManCheckIntegrityWithBoxes(Gia_Man_t *p)
Definition giaSweep.c:441
int Gia_ManBlackBoxNum(Gia_Man_t *p)
Definition giaTim.c:62
int Gia_ManBoxCoNum(Gia_Man_t *p)
Definition giaTim.c:70
int fMiter
Definition gia.h:269
char * pDumpFile
Definition gia.h:274
int fTents
Definition gia.h:263
int fNpn
Definition gia.h:266
int fLutProf
Definition gia.h:267
int fCut
Definition gia.h:265
int fSlacks
Definition gia.h:271
int fMuxXor
Definition gia.h:268
int fSwitch
Definition gia.h:264
int fSkipMap
Definition gia.h:270
int fNoColor
Definition gia.h:272
int fMapOutStats
Definition gia.h:273
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManPrintStatsMiter()

void Gia_ManPrintStatsMiter ( Gia_Man_t * p,
int fVerbose )
extern

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

Synopsis [Statistics of the miter.]

Description []

SideEffects []

SeeAlso []

Definition at line 730 of file giaMan.c.

731{
732 Gia_Obj_t * pObj;
733 Vec_Flt_t * vProb;
734 int i, iObjId;
737 vProb = Gia_ManPrintOutputProb( p );
738 printf( "Statistics for each outputs of the miter:\n" );
739 Gia_ManForEachPo( p, pObj, i )
740 {
741 iObjId = Gia_ObjId(p, pObj);
742 printf( "%4d : ", i );
743 printf( "Level = %5d ", Gia_ObjLevelId(p, iObjId) );
744 printf( "Supp = %5d ", Gia_ManSuppSize(p, &iObjId, 1) );
745 printf( "Cone = %5d ", Gia_ManConeSize(p, &iObjId, 1) );
746 printf( "Mffc = %5d ", Gia_NodeMffcSize(p, Gia_ObjFanin0(pObj)) );
747 printf( "Prob = %8.4f ", Vec_FltEntry(vProb, iObjId) );
748 printf( "\n" );
749 }
750 Vec_FltFree( vProb );
751}
Vec_Flt_t * Gia_ManPrintOutputProb(Gia_Man_t *p)
Definition giaSwitch.c:848
int Gia_ManConeSize(Gia_Man_t *p, int *pNodes, int nNodes)
Definition giaDfs.c:375
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManPrintStatsShort()

void Gia_ManPrintStatsShort ( Gia_Man_t * p)
extern

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

Synopsis [Prints stats for the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 658 of file giaMan.c.

659{
660 Abc_Print( 1, "i/o =%7d/%7d ", Gia_ManPiNum(p), Gia_ManPoNum(p) );
661 Abc_Print( 1, "ff =%7d ", Gia_ManRegNum(p) );
662 Abc_Print( 1, "and =%8d ", Gia_ManAndNum(p) );
663 Abc_Print( 1, "lev =%5d ", Gia_ManLevelNum(p) );
664// Abc_Print( 1, "mem =%5.2f MB", 12.0*Gia_ManObjNum(p)/(1<<20) );
665 Abc_Print( 1, "\n" );
666}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManProdAdderGen()

void Gia_ManProdAdderGen ( int nArgA,
int nArgB,
int Seed,
int fSigned,
int fCla )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 5609 of file giaDup.c.

5610{
5611 extern void Wlc_BlastReduceMatrix( Gia_Man_t * pNew, Vec_Wec_t * vProds, Vec_Wec_t * vLevels, Vec_Int_t * vRes, int fSigned, int fCla );
5612 int i, k, x, fCompl, iLit; char pNameP[32], pNameT[32];
5613 Vec_Wec_t * vProds = Vec_WecStart( nArgA + nArgB );
5614 Vec_Wec_t * vLevels = Vec_WecStart( nArgA + nArgB );
5615 Vec_Int_t * vRes = Vec_IntAlloc( nArgA + nArgB );
5616 Vec_Int_t * vArgA = Vec_IntAlloc( nArgA );
5617 Vec_Int_t * vArgB = Vec_IntAlloc( nArgB ), * vLevel;
5618 Gia_Man_t * pProd = Gia_ManStart( 1000 );
5619 Gia_Man_t * pTree = Gia_ManStart( 1000 ), * pTemp;
5620 Gia_ManHashAlloc( pTree );
5621 pProd->pName = Abc_UtilStrsav( "prod" );
5622 pTree->pName = Abc_UtilStrsav( "tree" );
5623 for ( x = 0; x < nArgA; x++ )
5624 Vec_IntPush( vArgA, Gia_ManAppendCi(pProd) );
5625 for ( x = 0; x < nArgB; x++ )
5626 Vec_IntPush( vArgB, Gia_ManAppendCi(pProd) );
5627 for ( x = 0; x < nArgA + nArgB; x++ )
5628 {
5629 for ( i = 0; i < nArgA; i++ )
5630 for ( k = 0; k < nArgB; k++ )
5631 {
5632 if ( i + k != x )
5633 continue;
5634 fCompl = fSigned && ((i == nArgA-1) ^ (k == nArgB-1));
5635 iLit = Abc_LitNotCond(Gia_ManAppendAnd(pProd, Vec_IntEntry(vArgA, i), Vec_IntEntry(vArgB, k)), fCompl);
5636 Gia_ManAppendCo( pProd, iLit );
5637 Vec_WecPush( vProds, i+k, Gia_ManAppendCi(pTree) );
5638 Vec_WecPush( vLevels, i+k, 0 );
5639 }
5640 }
5641 if ( fSigned )
5642 {
5643 Vec_WecPush( vProds, nArgA, 1 );
5644 Vec_WecPush( vLevels, nArgA, 0 );
5645
5646 Vec_WecPush( vProds, nArgA+nArgB-1, 1 );
5647 Vec_WecPush( vLevels, nArgA+nArgB-1, 0 );
5648 }
5649 if ( Seed )
5650 {
5651 Abc_Random( 1 );
5652 for ( x = 0; x < Seed; x++ )
5653 Abc_Random( 0 );
5654 Vec_WecForEachLevel( vProds, vLevel, x )
5655 if ( Vec_IntSize(vLevel) > 1 )
5656 Vec_IntRandomizeOrder( vLevel );
5657 }
5658 Wlc_BlastReduceMatrix( pTree, vProds, vLevels, vRes, fSigned, fCla );
5659 Vec_IntShrink( vRes, nArgA + nArgB );
5660 assert( Vec_IntSize(vRes) == nArgA + nArgB );
5661 Vec_IntForEachEntry( vRes, iLit, x )
5662 Gia_ManAppendCo( pTree, iLit );
5663 pTree = Gia_ManCleanup( pTemp = pTree );
5664 Gia_ManStop( pTemp );
5665
5666 sprintf( pNameP, "prod%d%d.aig", nArgA, nArgB );
5667 sprintf( pNameT, "tree%d%d.aig", nArgA, nArgB );
5668 Gia_AigerWrite( pProd, pNameP, 0, 0, 0 );
5669 Gia_AigerWrite( pTree, pNameT, 0, 0, 0 );
5670 Gia_ManStop( pProd );
5671 Gia_ManStop( pTree );
5672 printf( "Dumped files \"%s\" and \"%s\".\n", pNameP, pNameT );
5673
5674 Vec_WecFree( vProds );
5675 Vec_WecFree( vLevels );
5676 Vec_IntFree( vArgA );
5677 Vec_IntFree( vArgB );
5678 Vec_IntFree( vRes );
5679}
unsigned Abc_Random(int fReset)
Definition utilSort.c:1004
void Gia_AigerWrite(Gia_Man_t *p, char *pFileName, int fWriteSymbols, int fCompact, int fWriteNewLine)
Definition giaAiger.c:1595
void Wlc_BlastReduceMatrix(Gia_Man_t *pNew, Vec_Wec_t *vProds, Vec_Wec_t *vLevels, Vec_Int_t *vRes, int fSigned, int fCla)
Definition wlcBlast.c:971
Here is the call graph for this function:

◆ Gia_ManPtrWrdDumpBin()

void Gia_ManPtrWrdDumpBin ( char * pFileName,
Vec_Ptr_t * p,
int fVerbose )
extern

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

Synopsis [Serialization.]

Description []

SideEffects []

SeeAlso []

Definition at line 2660 of file giaSimBase.c.

2661{
2662 Vec_Wrd_t * vLevel;
2663 int i, nSize, RetValue;
2664 FILE * pFile = fopen( pFileName, "wb" );
2665 if ( pFile == NULL )
2666 {
2667 printf( "Cannot open file \"%s\" for writing.\n", pFileName );
2668 return;
2669 }
2670 nSize = Vec_PtrSize(p);
2671 RetValue = fwrite( &nSize, 1, sizeof(int), pFile );
2672 Vec_PtrForEachEntry( Vec_Wrd_t *, p, vLevel, i )
2673 {
2674 nSize = Vec_WrdSize(vLevel);
2675 RetValue += fwrite( &nSize, 1, sizeof(int), pFile );
2676 RetValue += fwrite( Vec_WrdArray(vLevel), 1, sizeof(word)*nSize, pFile );
2677 }
2678 fclose( pFile );
2679 if ( fVerbose )
2680 printf( "Written %d arrays into file \"%s\".\n", Vec_PtrSize(p), pFileName );
2681}

◆ Gia_ManPtrWrdReadBin()

Vec_Ptr_t * Gia_ManPtrWrdReadBin ( char * pFileName,
int fVerbose )
extern

Definition at line 2682 of file giaSimBase.c.

2683{
2684 Vec_Ptr_t * p = NULL; Vec_Wrd_t * vLevel; int i, nSize, RetValue;
2685 FILE * pFile = fopen( pFileName, "rb" );
2686 if ( pFile == NULL )
2687 {
2688 printf( "Cannot open file \"%s\" for reading.\n", pFileName );
2689 return NULL;
2690 }
2691 fseek( pFile, 0, SEEK_END );
2692 nSize = ftell( pFile );
2693 if ( nSize == 0 )
2694 {
2695 printf( "The input file is empty.\n" );
2696 fclose( pFile );
2697 return NULL;
2698 }
2699 if ( nSize % (int)sizeof(int) > 0 )
2700 {
2701 printf( "Cannot read file with integers because it is not aligned at 4 bytes (remainder = %d).\n", nSize % (int)sizeof(int) );
2702 fclose( pFile );
2703 return NULL;
2704 }
2705 rewind( pFile );
2706 RetValue = fread( &nSize, 1, sizeof(int), pFile );
2707 assert( RetValue == 4 );
2708 p = Vec_PtrAlloc( nSize );
2709 for ( i = 0; i < nSize; i++ )
2710 Vec_PtrPush( p, Vec_WrdAlloc(100) );
2711 Vec_PtrForEachEntry( Vec_Wrd_t *, p, vLevel, i )
2712 {
2713 RetValue = fread( &nSize, 1, sizeof(int), pFile );
2714 assert( RetValue == 4 );
2715 Vec_WrdFill( vLevel, nSize, 0 );
2716 RetValue = fread( Vec_WrdArray(vLevel), 1, sizeof(word)*nSize, pFile );
2717 assert( RetValue == 8*nSize );
2718 }
2719 fclose( pFile );
2720 if ( fVerbose )
2721 printf( "Read %d arrays from file \"%s\".\n", Vec_PtrSize(p), pFileName );
2722 return p;
2723}
VOID_HACK rewind()
Here is the call graph for this function:

◆ Gia_ManQuantExist()

int Gia_ManQuantExist ( Gia_Man_t * p,
int iLit,
int(* pFuncCiToKeep )(void *, int),
void * pData )
extern

Definition at line 505 of file giaExist.c.

506{
507 int Res;
508 Vec_Int_t * vQuantCis = Vec_IntAlloc( 100 );
509 Vec_Int_t * vQuantSide = Vec_IntAlloc( 100 );
510 Vec_Int_t * vQuantAnds = Vec_IntAlloc( 100 );
511 Gia_ManQuantCollect( p0, Abc_Lit2Var(iLit), pFuncCiToKeep, pData, vQuantCis, vQuantSide, vQuantAnds );
512 Res = Gia_ManQuantExistInt( p0, iLit, vQuantCis, vQuantSide, vQuantAnds );
513 Vec_IntFree( vQuantCis );
514 Vec_IntFree( vQuantSide );
515 Vec_IntFree( vQuantAnds );
516 return Res;
517}
void Gia_ManQuantCollect(Gia_Man_t *p, int iObj, int(*pFuncCiToKeep)(void *, int), void *pData, Vec_Int_t *vQuantCis, Vec_Int_t *vQuantSide, Vec_Int_t *vQuantAnds)
Definition giaExist.c:403
int Gia_ManQuantExistInt(Gia_Man_t *p0, int iLit, Vec_Int_t *vCis, Vec_Int_t *vSide, Vec_Int_t *vAnds)
Definition giaExist.c:452
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManQuantSetSuppAnd()

void Gia_ManQuantSetSuppAnd ( Gia_Man_t * p,
Gia_Obj_t * pObj )
extern

Definition at line 144 of file giaExist.c.

145{
146 int iObj = Gia_ObjId(p, pObj);
147 int iFan0 = Gia_ObjFaninId0(pObj, iObj);
148 int iFan1 = Gia_ObjFaninId1(pObj, iObj);
149 assert( Gia_ObjIsAnd(pObj) );
151 Abc_TtOr( Gia_ManQuantInfo(p, pObj), Gia_ManQuantInfoId(p, iFan0), Gia_ManQuantInfoId(p, iFan1), p->nSuppWords );
152}
void Gia_ManQuantSetSuppZero(Gia_Man_t *p)
Definition giaExist.c:110
Here is the call graph for this function:

◆ Gia_ManQuantSetSuppCi()

void Gia_ManQuantSetSuppCi ( Gia_Man_t * p,
Gia_Obj_t * pObj )
extern

Definition at line 117 of file giaExist.c.

118{
119 assert( Gia_ObjIsCi(pObj) );
120 assert( p->vSuppWords != NULL );
121 if ( p->iSuppPi == 64 * p->nSuppWords )
122 {
123 word Data; int w, Count = 0, Size = Vec_WrdSize(p->vSuppWords);
124 Vec_Wrd_t * vTemp = Vec_WrdAlloc( Size ? 2 * Size : 1000 );
125 Vec_WrdForEachEntry( p->vSuppWords, Data, w )
126 {
127 Vec_WrdPush( vTemp, Data );
128 if ( ++Count == p->nSuppWords )
129 {
130 Vec_WrdPush( vTemp, 0 );
131 Count = 0;
132 }
133 }
134 Vec_WrdFree( p->vSuppWords );
135 p->vSuppWords = vTemp;
136 p->nSuppWords++;
137 assert( Vec_WrdSize(p->vSuppWords) == p->nSuppWords * Gia_ManObjNum(p) );
138 //printf( "Resizing to %d words.\n", p->nSuppWords );
139 }
140 assert( p->iSuppPi == Vec_IntSize(&p->vSuppVars) );
141 Vec_IntPush( &p->vSuppVars, Gia_ObjCioId(pObj) );
142 Abc_TtSetBit( Gia_ManQuantInfo(p, pObj), p->iSuppPi++ );
143}
Here is the caller graph for this function:

◆ Gia_ManQuantSetSuppStart()

void Gia_ManQuantSetSuppStart ( Gia_Man_t * p)
extern

Definition at line 100 of file giaExist.c.

101{
102 assert( Gia_ManObjNum(p) == 1 );
103 assert( p->vSuppWords == NULL );
104 assert( Vec_IntSize(&p->vSuppVars) == 0 );
105 p->iSuppPi = 0;
106 p->nSuppWords = 1;
107 p->vSuppWords = Vec_WrdAlloc( 1000 );
108 Vec_WrdPush( p->vSuppWords, 0 );
109}
Here is the caller graph for this function:

◆ Gia_ManQuantSetSuppZero()

void Gia_ManQuantSetSuppZero ( Gia_Man_t * p)
extern

Definition at line 110 of file giaExist.c.

111{
112 int w;
113 for ( w = 0; w < p->nSuppWords; w++ )
114 Vec_WrdPush( p->vSuppWords, 0 );
115 assert( Vec_WrdSize(p->vSuppWords) == p->nSuppWords * Gia_ManObjNum(p) );
116}
Here is the caller graph for this function:

◆ Gia_ManQuantUpdateCiSupp()

void Gia_ManQuantUpdateCiSupp ( Gia_Man_t * p,
int iObj )
extern

Definition at line 157 of file giaExist.c.

158{
159 if ( Abc_TtIsConst0( Gia_ManQuantInfoId(p, iObj), p->nSuppWords ) )
160 Gia_ManQuantSetSuppCi( p, Gia_ManObj(p, iObj) );
161 assert( !Abc_TtIsConst0( Gia_ManQuantInfoId(p, iObj), p->nSuppWords ) );
162}
void Gia_ManQuantSetSuppCi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaExist.c:117
Here is the call graph for this function:

◆ Gia_ManRandom()

unsigned Gia_ManRandom ( int fReset)
extern

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#ifdef _MSC_VER
52 static unsigned int m_z = NUMBER1;
53 static unsigned int m_w = NUMBER2;
54#else
55 static __thread unsigned int m_z = NUMBER1;
56 static __thread unsigned int m_w = NUMBER2;
57#endif
58 if ( fReset )
59 {
60 m_z = NUMBER1;
61 m_w = NUMBER2;
62 }
63 m_z = 36969 * (m_z & 65535) + (m_z >> 16);
64 m_w = 18000 * (m_w & 65535) + (m_w >> 16);
65 return (m_z << 16) + m_w;
66}
#define NUMBER2
Definition aigUtil.c:1157
#define NUMBER1
Definition aigUtil.c:1156

◆ Gia_ManRandomInfo()

void Gia_ManRandomInfo ( Vec_Ptr_t * vInfo,
int iInputStart,
int iWordStart,
int iWordStop )
extern

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

Synopsis [Creates random info for the primary inputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 85 of file giaUtil.c.

86{
87 unsigned * pInfo;
88 int i, w;
89 Vec_PtrForEachEntryStart( unsigned *, vInfo, pInfo, i, iInputStart )
90 for ( w = iWordStart; w < iWordStop; w++ )
91 pInfo[w] = Gia_ManRandom(0);
92}
unsigned Gia_ManRandom(int fReset)
FUNCTION DEFINITIONS ///.
Definition giaUtil.c:49
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManRandomW()

word Gia_ManRandomW ( int fReset)
extern

Definition at line 67 of file giaUtil.c.

68{
69 return ((word)Gia_ManRandom(fReset) << 32) | ((word)Gia_ManRandom(fReset) << 0);
70}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManReadMiniAig()

Gia_Man_t * Gia_ManReadMiniAig ( char * pFileName,
int fGiaSimple )
extern

Definition at line 220 of file giaMini.c.

221{
222 Mini_Aig_t * p = Mini_AigLoad( pFileName );
223 Gia_Man_t * pTemp, * pGia = Gia_ManFromMiniAig( p, NULL, fGiaSimple );
224 ABC_FREE( pGia->pName );
225 pGia->pName = Extra_FileNameGeneric( pFileName );
226 Mini_AigStop( p );
227 Gia_ManReadMiniAigNames( pFileName, pGia );
228 if ( !Gia_ManIsNormalized(pGia) )
229 {
230 pGia = Gia_ManDupNormalize( pTemp = pGia, 0 );
231 ABC_SWAP( Vec_Ptr_t *, pTemp->vNamesIn, pGia->vNamesIn );
232 ABC_SWAP( Vec_Ptr_t *, pTemp->vNamesOut, pGia->vNamesOut );
233 Gia_ManStop( pTemp );
234 }
235 return pGia;
236}
char * Extra_FileNameGeneric(char *FileName)
void Gia_ManReadMiniAigNames(char *pFileName, Gia_Man_t *pGia)
Definition giaMini.c:185
Gia_Man_t * Gia_ManFromMiniAig(Mini_Aig_t *p, Vec_Int_t **pvCopies, int fGiaSimple)
Definition giaMini.c:62
struct Mini_Aig_t_ Mini_Aig_t
BASIC TYPES ///.
Definition miniaig.h:48
Here is the call graph for this function:

◆ Gia_ManReadMiniLut()

Gia_Man_t * Gia_ManReadMiniLut ( char * pFileName)
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 587 of file giaMini.c.

588{
589 Mini_Lut_t * p = Mini_LutLoad( pFileName );
590 Gia_Man_t * pGia = Gia_ManFromMiniLut( p, NULL );
591 ABC_FREE( pGia->pName );
592 pGia->pName = Extra_FileNameGeneric( pFileName );
593 Mini_LutStop( p );
594 return pGia;
595}
Gia_Man_t * Gia_ManFromMiniLut(Mini_Lut_t *p, Vec_Int_t **pvCopies)
Definition giaMini.c:259
struct Mini_Lut_t_ Mini_Lut_t
BASIC TYPES ///.
Definition minilut.h:47
Here is the call graph for this function:

◆ Gia_ManReduceConst()

Gia_Man_t * Gia_ManReduceConst ( Gia_Man_t * pAig,
int fVerbose )
extern

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 );
744 pCi2Lit = Gia_ManTerCreateMap( p, fVerbose );
746 pNew = Gia_ManDupDfsCiMap( pAig, pCi2Lit, NULL );
747 ABC_FREE( pCi2Lit );
748 return pNew;
749}
Gia_ManTer_t * Gia_ManTerSimulate(Gia_Man_t *pAig, int fVerbose)
Definition giaTsim.c:668
struct Gia_ManTer_t_ Gia_ManTer_t
Definition giaTsim.c:45
void Gia_ManTerDelete(Gia_ManTer_t *p)
Definition giaTsim.c:133
int * Gia_ManTerCreateMap(Gia_ManTer_t *p, int fVerbose)
Definition giaTsim.c:627
void Gia_ManTerAnalyze(Gia_ManTer_t *p)
Definition giaTsim.c:547
Gia_Man_t * Gia_ManDupDfsCiMap(Gia_Man_t *p, int *pCi2Lit, Vec_Int_t *vLits)
Definition giaDup.c:2708
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManRegBoxNum()

int Gia_ManRegBoxNum ( Gia_Man_t * p)
extern

Definition at line 54 of file giaTim.c.

55{
56 return p->vRegClasses ? Vec_IntSize(p->vRegClasses) : 0;
57}
Here is the caller graph for this function:

◆ Gia_ManRehash()

Gia_Man_t * Gia_ManRehash ( Gia_Man_t * p,
int fAddStrash )
extern

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

Synopsis [Rehashes AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 739 of file giaHash.c.

740{
741 Gia_Man_t * pNew, * pTemp;
742 Gia_Obj_t * pObj;
743 int i;
744 pNew = Gia_ManStart( Gia_ManObjNum(p) );
745 pNew->pName = Abc_UtilStrsav( p->pName );
746 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
747 pNew->fAddStrash = fAddStrash;
748 Gia_ManHashAlloc( pNew );
749 Gia_ManConst0(p)->Value = 0;
750 Gia_ManForEachObj( p, pObj, i )
751 {
752 //if ( Gia_ObjIsBuf(pObj) )
753 // pObj->Value = Gia_ManAppendBuf( pNew, Gia_ObjFanin0Copy(pObj) );
754 //else
755 if ( Gia_ObjIsAnd(pObj) )
756 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
757 else if ( Gia_ObjIsCi(pObj) )
758 pObj->Value = Gia_ManAppendCi( pNew );
759 else if ( Gia_ObjIsCo(pObj) )
760 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
761 }
762 Gia_ManHashStop( pNew );
763 pNew->fAddStrash = 0;
764 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
765// printf( "Top gate is %s\n", Gia_ObjFaninC0(Gia_ManCo(pNew, 0))? "OR" : "AND" );
766 pNew = Gia_ManCleanup( pTemp = pNew );
767 Gia_ManStop( pTemp );
768 return pNew;
769}
void Gia_ManHashStop(Gia_Man_t *p)
Definition giaHash.c:149
int fAddStrash
Definition gia.h:114
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManRemoveEnables()

Gia_Man_t * Gia_ManRemoveEnables ( Gia_Man_t * p)
extern

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 = NULL, * 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}
Here is the call graph for this function:

◆ Gia_ManReportImprovement()

void Gia_ManReportImprovement ( Gia_Man_t * p,
Gia_Man_t * pNew )
extern

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

Synopsis [Reports the reduction of the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 782 of file giaMan.c.

783{
784 Abc_Print( 1, "REG: Beg = %5d. End = %5d. (R =%5.1f %%) ",
785 Gia_ManRegNum(p), Gia_ManRegNum(pNew),
786 Gia_ManRegNum(p)? 100.0*(Gia_ManRegNum(p)-Gia_ManRegNum(pNew))/Gia_ManRegNum(p) : 0.0 );
787 Abc_Print( 1, "AND: Beg = %6d. End = %6d. (R =%5.1f %%)",
788 Gia_ManAndNum(p), Gia_ManAndNum(pNew),
789 Gia_ManAndNum(p)? 100.0*(Gia_ManAndNum(p)-Gia_ManAndNum(pNew))/Gia_ManAndNum(p) : 0.0 );
790 Abc_Print( 1, "\n" );
791}
Here is the caller graph for this function:

◆ Gia_ManRequiredLevel()

Vec_Int_t * Gia_ManRequiredLevel ( Gia_Man_t * p)
extern

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

Synopsis [Compute required levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 702 of file giaUtil.c.

703{
704 Vec_Int_t * vRequired;
705 Gia_Obj_t * pObj;
706 int i, LevelMax = 0;
707 vRequired = Gia_ManReverseLevel( p );
708 Gia_ManForEachCi( p, pObj, i )
709 LevelMax = Abc_MaxInt( LevelMax, Vec_IntEntry(vRequired, Gia_ObjId(p, pObj)) );
710 Gia_ManForEachObj( p, pObj, i )
711 Vec_IntWriteEntry( vRequired, i, LevelMax - Vec_IntEntry(vRequired, i) );
712 return vRequired;
713}
Vec_Int_t * Gia_ManReverseLevel(Gia_Man_t *p)
Definition giaUtil.c:658
Here is the call graph for this function:

◆ Gia_ManRetimeForward()

Gia_Man_t * Gia_ManRetimeForward ( Gia_Man_t * p,
int nMaxIters,
int fVerbose )
extern

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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManReverseLevel()

Vec_Int_t * Gia_ManReverseLevel ( Gia_Man_t * p)
extern

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

Synopsis [Compute reverse levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 658 of file giaUtil.c.

659{
660 Vec_Int_t * vLevelRev;
661 Gia_Obj_t * pObj;
662 int i;
663 vLevelRev = Vec_IntStart( Gia_ManObjNum(p) );
664 Gia_ManForEachAndReverse( p, pObj, i )
665 {
666 int LevelR = Vec_IntEntry( vLevelRev, i );
667 if ( Gia_ObjIsMux(p, pObj) )
668 {
669 Vec_IntUpdateEntry( vLevelRev, Gia_ObjFaninId0(pObj, i), LevelR + 2 );
670 Vec_IntUpdateEntry( vLevelRev, Gia_ObjFaninId1(pObj, i), LevelR + 2 );
671 Vec_IntUpdateEntry( vLevelRev, Gia_ObjFaninId2(p, i), LevelR + 2 );
672 }
673 else if ( Gia_ObjIsXor(pObj) )
674 {
675 Vec_IntUpdateEntry( vLevelRev, Gia_ObjFaninId0(pObj, i), LevelR + 2 );
676 Vec_IntUpdateEntry( vLevelRev, Gia_ObjFaninId1(pObj, i), LevelR + 2 );
677 }
678 else if ( Gia_ObjIsBuf(pObj) )
679 {
680 Vec_IntUpdateEntry( vLevelRev, Gia_ObjFaninId0(pObj, i), LevelR );
681 }
682 else
683 {
684 Vec_IntUpdateEntry( vLevelRev, Gia_ObjFaninId0(pObj, i), LevelR + 1 );
685 Vec_IntUpdateEntry( vLevelRev, Gia_ObjFaninId1(pObj, i), LevelR + 1 );
686 }
687 }
688 return vLevelRev;
689}
#define Gia_ManForEachAndReverse(p, pObj, i)
Definition gia.h:1222
Here is the caller graph for this function:

◆ Gia_ManRrr()

Gia_Man_t * Gia_ManRrr ( Gia_Man_t * pGia,
int iSeed,
int nWords,
int nTimeout,
int nSchedulerVerbose,
int nPartitionerVerbose,
int nOptimizerVerbose,
int nAnalyzerVerbose,
int nSimulatorVerbose,
int nSatSolverVerbose,
int fUseBddCspf,
int fUseBddMspf,
int nConflictLimit,
int nSortType,
int nOptimizerFlow,
int nSchedulerFlow,
int nPartitionType,
int nDistance,
int nJobs,
int nThreads,
int nPartitionSize,
int nPartitionSizeMin,
int fDeterministic,
int nParallelPartitions,
int fOptOnInsert,
int fGreedy )
extern

Definition at line 8 of file giaRrr.cpp.

8 {
12 Par.iSeed = iSeed;
13 Par.nWords = nWords;
14 Par.nTimeout = nTimeout;
15 Par.nSchedulerVerbose = nSchedulerVerbose;
16 Par.nPartitionerVerbose = nPartitionerVerbose;
17 Par.nOptimizerVerbose = nOptimizerVerbose;
18 Par.nAnalyzerVerbose = nAnalyzerVerbose;
19 Par.nSimulatorVerbose = nSimulatorVerbose;
20 Par.nSatSolverVerbose = nSatSolverVerbose;
21 Par.fUseBddCspf = fUseBddCspf;
22 Par.fUseBddMspf = fUseBddMspf;
23 Par.nConflictLimit = nConflictLimit;
24 Par.nSortType = nSortType;
25 Par.nOptimizerFlow = nOptimizerFlow;
26 Par.nSchedulerFlow = nSchedulerFlow;
27 Par.nPartitionType = nPartitionType;
28 Par.nDistance = nDistance;
29 Par.nJobs = nJobs;
30 Par.nThreads = nThreads;
31 Par.nPartitionSize = nPartitionSize;
32 Par.nPartitionSizeMin = nPartitionSizeMin;
33 Par.fDeterministic = fDeterministic;
34 Par.nParallelPartitions = nParallelPartitions;
35 Par.fOptOnInsert = fOptOnInsert;
36 Par.fGreedy = fGreedy;
37 rrr::Perform(&ntk, &Par);
38 Gia_Man_t *pNew = rrr::CreateGia(&ntk, false);
39 return pNew;
40}
void Read(Ntk *pFrom, Reader &reader, bool fNew=true)
void Perform(Ntk *pNtk, Parameter const *pPar)
Definition rrr.h:19
void GiaReader(Gia_Man_t *pGia, Ntk *pNtk)
Definition rrrAbc.h:14
Gia_Man_t * CreateGia(Ntk *pNtk, bool fHash=true)
Definition rrrAbc.h:32
Here is the call graph for this function:

◆ Gia_ManSaveValue()

Vec_Int_t * Gia_ManSaveValue ( Gia_Man_t * p)
extern

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

Synopsis [Save/load value from file.]

Description []

SideEffects []

SeeAlso []

Definition at line 1831 of file giaUtil.c.

1832{
1833 Vec_Int_t * vValues;
1834 Gia_Obj_t * pObj;
1835 int i;
1836 vValues = Vec_IntAlloc( Gia_ManObjNum(p) );
1837 Gia_ManForEachObj( p, pObj, i )
1838 Vec_IntPush( vValues, pObj->Value );
1839 return vValues;
1840}

◆ Gia_ManSeqCleanup()

Gia_Man_t * Gia_ManSeqCleanup ( Gia_Man_t * p)
extern

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

Synopsis [Performs sequential cleanup.]

Description []

SideEffects []

SeeAlso []

Definition at line 183 of file giaScl.c.

184{
186 return Gia_ManDupMarked( p );
187}
int Gia_ManSeqMarkUsed(Gia_Man_t *p)
Definition giaScl.c:156
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManSeqMarkUsed()

int Gia_ManSeqMarkUsed ( Gia_Man_t * p)
extern

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;
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}
int Gia_ManSeqMarkUsed_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vRoots)
Definition giaScl.c:128
Vec_Int_t * Gia_ManCollectPoIds(Gia_Man_t *p)
Definition giaUtil.c:960
void Gia_ManSetMark0(Gia_Man_t *p)
Definition giaUtil.c:237
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManSeqStructSweep()

Gia_Man_t * Gia_ManSeqStructSweep ( Gia_Man_t * p,
int fConst,
int fEquiv,
int fVerbose )
extern

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}
Gia_Man_t * Gia_ManReduceEquiv(Gia_Man_t *p, int fVerbose)
Definition giaScl.c:200
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition giaScl.c:84
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:782
Gia_Man_t * Gia_ManReduceConst(Gia_Man_t *pAig, int fVerbose)
Definition giaTsim.c:737
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManSetFailedPoCex()

int Gia_ManSetFailedPoCex ( Gia_Man_t * pAig,
Abc_Cex_t * p )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 139 of file giaCex.c.

140{
141 Gia_Obj_t * pObj, * pObjRi, * pObjRo;
142 int i, k, iBit = 0;
143 assert( Gia_ManPiNum(pAig) == p->nPis );
144 Gia_ManCleanMark0(pAig);
145 p->iPo = -1;
146// Gia_ManForEachRo( pAig, pObj, i )
147// pObj->fMark0 = Abc_InfoHasBit(p->pData, iBit++);
148 iBit = p->nRegs;
149 for ( i = 0; i <= p->iFrame; i++ )
150 {
151 Gia_ManForEachPi( pAig, pObj, k )
152 pObj->fMark0 = Abc_InfoHasBit(p->pData, iBit++);
153 Gia_ManForEachAnd( pAig, pObj, k )
154 pObj->fMark0 = (Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj)) &
155 (Gia_ObjFanin1(pObj)->fMark0 ^ Gia_ObjFaninC1(pObj));
156 Gia_ManForEachCo( pAig, pObj, k )
157 pObj->fMark0 = Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj);
158 Gia_ManForEachRiRo( pAig, pObjRi, pObjRo, k )
159 pObjRo->fMark0 = pObjRi->fMark0;
160 // check the POs
161 Gia_ManForEachPo( pAig, pObj, k )
162 {
163 if ( !pObj->fMark0 )
164 continue;
165 p->iPo = k;
166 p->iFrame = i;
167 p->nBits = iBit;
168 break;
169 }
170 }
171 Gia_ManCleanMark0(pAig);
172 return p->iPo;
173}
Here is the call graph for this function:

◆ Gia_ManSetIfParsDefault()

void Gia_ManSetIfParsDefault ( void * pp)
extern

FUNCTION DEFINITIONS ///.

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

Synopsis [Load the network into FPGA manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 59 of file giaIf.c.

60{
61 If_Par_t * pPars = (If_Par_t *)pp;
62// extern void * Abc_FrameReadLibLut();
63 If_Par_t * p = (If_Par_t *)pPars;
64 // set defaults
65 memset( p, 0, sizeof(If_Par_t) );
66 // user-controlable paramters
67 p->nLutSize = -1;
68// p->nLutSize = 6;
69 p->nCutsMax = 8;
70 p->nFlowIters = 1;
71 p->nAreaIters = 2;
72 p->DelayTarget = -1;
73 p->Epsilon = (float)0.005;
74 p->fPreprocess = 1;
75 p->fArea = 0;
76 p->fFancy = 0;
77 p->fExpRed = 1;
78 p->fLatchPaths = 0;
79 p->fEdge = 1;
80 p->fPower = 0;
81 p->fCutMin = 0;
82 p->fVerbose = 0;
83 p->pLutStruct = NULL;
84 // internal parameters
85 p->fTruth = 0;
86 p->nLatchesCi = 0;
87 p->nLatchesCo = 0;
88 p->fLiftLeaves = 0;
89 p->fUseCoAttrs = 1; // use CO attributes
90 p->pLutLib = NULL;
91 p->pTimesArr = NULL;
92 p->pTimesReq = NULL;
93 p->pFuncCost = NULL;
94}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManSetLevels()

int Gia_ManSetLevels ( Gia_Man_t * p,
Vec_Int_t * vCiLevels )
extern

Definition at line 621 of file giaUtil.c.

622{
623 Gia_Obj_t * pObj;
624 int i;
625 if ( vCiLevels == NULL )
626 return Gia_ManLevelNum( p );
627 assert( Vec_IntSize(vCiLevels) == Gia_ManCiNum(p) );
628 Gia_ManCleanLevels( p, Gia_ManObjNum(p) );
629 p->nLevels = 0;
630 Gia_ManForEachCi( p, pObj, i )
631 {
632 Gia_ObjSetLevel( p, pObj, Vec_IntEntry(vCiLevels, i) );
633 p->nLevels = Abc_MaxInt( p->nLevels, Gia_ObjLevel(p, pObj) );
634 }
635 Gia_ManForEachObj( p, pObj, i )
636 {
637 if ( Gia_ObjIsAnd(pObj) )
638 Gia_ObjSetGateLevel( p, pObj );
639 else if ( Gia_ObjIsCo(pObj) )
640 Gia_ObjSetCoLevel( p, pObj );
641 else continue;
642 p->nLevels = Abc_MaxInt( p->nLevels, Gia_ObjLevel(p, pObj) );
643 }
644 return p->nLevels;
645}
int Gia_ManLevelNum(Gia_Man_t *p)
Definition giaUtil.c:546
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManSetLutRefs()

void Gia_ManSetLutRefs ( Gia_Man_t * p)
extern

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

Synopsis [Assigns levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 295 of file giaIf.c.

296{
297 Gia_Obj_t * pObj;
298 int i, k, iFan;
299 ABC_FREE( p->pLutRefs );
300 p->pLutRefs = ABC_CALLOC( int, Gia_ManObjNum(p) );
301 Gia_ManForEachCo( p, pObj, i )
302 Gia_ObjLutRefIncId( p, Gia_ObjFaninId0p(p, pObj) );
303 Gia_ManForEachLut( p, i )
304 Gia_LutForEachFanin( p, i, iFan, k )
305 Gia_ObjLutRefIncId( p, iFan );
306}
Here is the caller graph for this function:

◆ Gia_ManSetMark0()

void Gia_ManSetMark0 ( Gia_Man_t * p)
extern

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

Synopsis [Sets phases of the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 237 of file giaUtil.c.

238{
239 Gia_Obj_t * pObj;
240 int i;
241 Gia_ManForEachObj( p, pObj, i )
242 pObj->fMark0 = 1;
243}
Here is the caller graph for this function:

◆ Gia_ManSetMark1()

void Gia_ManSetMark1 ( Gia_Man_t * p)
extern

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

Synopsis [Sets phases of the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 294 of file giaUtil.c.

295{
296 Gia_Obj_t * pObj;
297 int i;
298 Gia_ManForEachObj( p, pObj, i )
299 pObj->fMark1 = 1;
300}

◆ Gia_ManSetPhase()

void Gia_ManSetPhase ( Gia_Man_t * p)
extern

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

Synopsis [Sets phases of the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 420 of file giaUtil.c.

421{
422 Gia_Obj_t * pObj;
423 int i;
424 Gia_ManForEachObj( p, pObj, i )
425 Gia_ObjSetPhase( p, pObj );
426}
void Gia_ObjSetPhase(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaUtil.c:387
Here is the call graph for this function:

◆ Gia_ManSetPhase1()

void Gia_ManSetPhase1 ( Gia_Man_t * p)
extern

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

Synopsis [Sets phases of the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 450 of file giaUtil.c.

451{
452 Gia_Obj_t * pObj;
453 int i;
454 Gia_ManForEachCi( p, pObj, i )
455 pObj->fPhase = 1;
456 Gia_ManForEachObj( p, pObj, i )
457 if ( !Gia_ObjIsCi(pObj) )
458 Gia_ObjSetPhase( p, pObj );
459}
Here is the call graph for this function:

◆ Gia_ManSetPhasePattern()

void Gia_ManSetPhasePattern ( Gia_Man_t * p,
Vec_Int_t * vCiValues )
extern

Definition at line 427 of file giaUtil.c.

428{
429 Gia_Obj_t * pObj;
430 int i;
431 assert( Gia_ManCiNum(p) == Vec_IntSize(vCiValues) );
432 Gia_ManForEachObj( p, pObj, i )
433 if ( Gia_ObjIsCi(pObj) )
434 pObj->fPhase = Vec_IntEntry( vCiValues, Gia_ObjCioId(pObj) );
435 else
436 Gia_ObjSetPhase( p, pObj );
437}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManSetRefsMapped()

void Gia_ManSetRefsMapped ( Gia_Man_t * p)
extern

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

Synopsis [Assigns levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 271 of file giaIf.c.

272{
273 Gia_Obj_t * pObj;
274 int i, k, iFan;
275 ABC_FREE( p->pRefs );
276 p->pRefs = ABC_CALLOC( int, Gia_ManObjNum(p) );
277 Gia_ManForEachCo( p, pObj, i )
278 Gia_ObjRefIncId( p, Gia_ObjFaninId0p(p, pObj) );
279 Gia_ManForEachLut( p, i )
280 Gia_LutForEachFanin( p, i, iFan, k )
281 Gia_ObjRefIncId( p, iFan );
282}
Here is the caller graph for this function:

◆ Gia_ManSetRegNum()

void Gia_ManSetRegNum ( Gia_Man_t * p,
int nRegs )
extern

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

Synopsis [Prints stats for the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 764 of file giaMan.c.

765{
766 assert( p->nRegs == 0 );
767 p->nRegs = nRegs;
768}

◆ Gia_ManShow()

void Gia_ManShow ( Gia_Man_t * pMan,
Vec_Int_t * vBold,
int fAdders,
int fFadds,
int fPath )
extern

Definition at line 1126 of file giaShow.c.

1127{
1128 extern void Abc_ShowFile( char * FileNameDot, int fKeepDot );
1129 char FileNameDot[200];
1130 FILE * pFile;
1131 Vec_Int_t * vXors = NULL, * vAdds = fAdders ? Ree_ManComputeCuts( pMan, &vXors, 0 ) : NULL;
1132 sprintf( FileNameDot, "%s", Extra_FileNameGenericAppend(pMan->pName ? pMan->pName : (char *)"unknown", ".dot") );
1133 // check that the file can be opened
1134 if ( (pFile = fopen( FileNameDot, "w" )) == NULL )
1135 {
1136 fprintf( stdout, "Cannot open the intermediate file \"%s\".\n", FileNameDot );
1137 return;
1138 }
1139 fclose( pFile );
1140 // generate the file
1141 if ( fPath )
1142 Gia_ShowPath( pMan, FileNameDot );
1143 else if ( fAdders )
1144 Gia_ShowProcess( pMan, FileNameDot, vBold, vAdds, vXors, fFadds );
1145 else
1146 Gia_WriteDotAigSimple( pMan, FileNameDot, vBold );
1147 // visualize the file
1148 Abc_ShowFile( FileNameDot, 0 );
1149
1150 Vec_IntFreeP( &vAdds );
1151 Vec_IntFreeP( &vXors );
1152}
ABC_NAMESPACE_IMPL_START void Abc_ShowFile(char *FileNameDot, int fKeepDot)
DECLARATIONS ///.
Definition abcShow.c:326
Vec_Int_t * Ree_ManComputeCuts(Gia_Man_t *p, Vec_Int_t **pvXors, int fVerbose)
Definition acecRe.c:408
char * Extra_FileNameGenericAppend(char *pBase, char *pSuffix)
void Gia_ShowProcess(Gia_Man_t *p, char *pFileName, Vec_Int_t *vBold, Vec_Int_t *vAdds, Vec_Int_t *vXors, int fFadds)
Definition giaShow.c:1116
void Gia_WriteDotAigSimple(Gia_Man_t *p, char *pFileName, Vec_Int_t *vBold)
Definition giaShow.c:339
void Gia_ShowPath(Gia_Man_t *p, char *pFileName)
FUNCTION DEFINITIONS ///.
Definition giaShow.c:51
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManSim2Array()

Vec_Wec_t * Gia_ManSim2Array ( Vec_Ptr_t * vSims)
extern

Definition at line 2570 of file giaSimBase.c.

2571{
2572 Vec_Wec_t * vRes = Vec_WecStart( Vec_PtrSize(vSims) );
2573 Vec_Int_t * vLevel; int i;
2574 Vec_WecForEachLevel( vRes, vLevel, i )
2575 Gia_ManSim2ArrayOne( (Vec_Wrd_t *)Vec_PtrEntry(vSims, i), vLevel );
2576 return vRes;
2577}
void Gia_ManSim2ArrayOne(Vec_Wrd_t *vSimsPi, Vec_Int_t *vRes)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManSim2ArrayOne()

void Gia_ManSim2ArrayOne ( Vec_Wrd_t * vSimsPi,
Vec_Int_t * vRes )
extern

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

Synopsis [Serialization.]

Description []

SideEffects []

SeeAlso []

Definition at line 2558 of file giaSimBase.c.

2559{
2560 word * pInfo = Vec_WrdArray(vSimsPi); int w, i;
2561 word * pCare = pInfo + Vec_WrdSize(vSimsPi);
2562 Vec_IntClear( vRes );
2563 for ( w = 0; w < Vec_WrdSize(vSimsPi); w++ )
2564 if ( pCare[w] )
2565 for ( i = 0; i < 64; i++ )
2566 if ( Abc_TtGetBit(pCare, w*64+i) )
2567 Vec_IntPush( vRes, Abc_Var2Lit(w*64+i, Abc_TtGetBit(pInfo, w*64+i)) );
2568 Vec_IntPush( vRes, Vec_WrdSize(vSimsPi) );
2569}
Here is the caller graph for this function:

◆ Gia_ManSimInfoInit()

void Gia_ManSimInfoInit ( Gia_ManSim_t * p)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 430 of file giaSim.c.

431{
432 int iPioNum, i;
433 Vec_IntForEachEntry( p->vCis2Ids, iPioNum, i )
434 {
435 if ( iPioNum < Gia_ManPiNum(p->pAig) )
436 Gia_ManSimInfoRandom( p, Gia_SimDataCi(p, i) );
437 else
438 Gia_ManSimInfoZero( p, Gia_SimDataCi(p, i) );
439 }
440}
Here is the caller graph for this function:

◆ Gia_ManSimInfoTransfer()

void Gia_ManSimInfoTransfer ( Gia_ManSim_t * p)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 453 of file giaSim.c.

454{
455 int iPioNum, i;
456 Vec_IntForEachEntry( p->vCis2Ids, iPioNum, i )
457 {
458 if ( iPioNum < Gia_ManPiNum(p->pAig) )
459 Gia_ManSimInfoRandom( p, Gia_SimDataCi(p, i) );
460 else
461 Gia_ManSimInfoCopy( p, Gia_SimDataCi(p, i), Gia_SimDataCo(p, Gia_ManPoNum(p->pAig)+iPioNum-Gia_ManPiNum(p->pAig)) );
462 }
463}
Here is the caller graph for this function:

◆ Gia_ManSimPatSim()

Vec_Wrd_t * Gia_ManSimPatSim ( Gia_Man_t * p)
extern

Definition at line 125 of file giaSimBase.c.

126{
127 Gia_Obj_t * pObj;
128 int i, nWords = Vec_WrdSize(pGia->vSimsPi) / Gia_ManCiNum(pGia);
129 Vec_Wrd_t * vSims = Vec_WrdStart( Gia_ManObjNum(pGia) * nWords );
130 assert( Vec_WrdSize(pGia->vSimsPi) % Gia_ManCiNum(pGia) == 0 );
131 Gia_ManSimPatAssignInputs( pGia, nWords, vSims, pGia->vSimsPi );
132 Gia_ManForEachAnd( pGia, pObj, i )
133 Gia_ManSimPatSimAnd( pGia, i, pObj, nWords, vSims );
134 Gia_ManForEachCo( pGia, pObj, i )
135 Gia_ManSimPatSimPo( pGia, Gia_ObjId(pGia, pObj), pObj, nWords, vSims );
136 return vSims;
137}
void Gia_ManSimPatAssignInputs(Gia_Man_t *p, int nWords, Vec_Wrd_t *vSims, Vec_Wrd_t *vSimsIn)
FUNCTION DEFINITIONS ///.
Definition giaSimBase.c:85
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManSimPatSimOut()

Vec_Wrd_t * Gia_ManSimPatSimOut ( Gia_Man_t * pGia,
Vec_Wrd_t * vSimsPi,
int fOuts )
extern

Definition at line 138 of file giaSimBase.c.

139{
140 Gia_Obj_t * pObj;
141 int i, nWords = Vec_WrdSize(vSimsPi) / Gia_ManCiNum(pGia);
142 Vec_Wrd_t * vSimsCo = fOuts ? Vec_WrdStart( Gia_ManCoNum(pGia) * nWords ) : NULL;
143 Vec_Wrd_t * vSims = Vec_WrdStart( Gia_ManObjNum(pGia) * nWords );
144 assert( Vec_WrdSize(vSimsPi) % Gia_ManCiNum(pGia) == 0 );
145 Gia_ManSimPatAssignInputs( pGia, nWords, vSims, vSimsPi );
146 Gia_ManForEachAnd( pGia, pObj, i )
147 Gia_ManSimPatSimAnd( pGia, i, pObj, nWords, vSims );
148 Gia_ManForEachCo( pGia, pObj, i )
149 Gia_ManSimPatSimPo( pGia, Gia_ObjId(pGia, pObj), pObj, nWords, vSims );
150 if ( !fOuts )
151 return vSims;
152 Gia_ManForEachCo( pGia, pObj, i )
153 memcpy( Vec_WrdEntryP(vSimsCo, i*nWords), Vec_WrdEntryP(vSims, Gia_ObjId(pGia, pObj)*nWords), sizeof(word)*nWords );
154 Vec_WrdFree( vSims );
155 return vSimsCo;
156}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManSimSetDefaultParams()

void Gia_ManSimSetDefaultParams ( Gia_ParSim_t * p)
extern

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

Synopsis [This procedure sets default parameters.]

Description []

SideEffects []

SeeAlso []

Definition at line 165 of file giaSim.c.

166{
167 memset( p, 0, sizeof(Gia_ParSim_t) );
168 // user-controlled parameters
169 p->nWords = 8; // the number of machine words
170 p->nIters = 32; // the number of timeframes
171 p->RandSeed = 0; // the seed to generate random numbers
172 p->TimeLimit = 60; // time limit in seconds
173 p->fCheckMiter = 0; // check if miter outputs are non-zero
174 p->fVerbose = 0; // enables verbose output
175 p->iOutFail = -1; // index of the failed output
176}
struct Gia_ParSim_t_ Gia_ParSim_t
Definition gia.h:306
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManSimSimulate()

int Gia_ManSimSimulate ( Gia_Man_t * pAig,
Gia_ParSim_t * pPars )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 599 of file giaSim.c.

600{
601 extern int Gia_ManSimSimulateEquiv( Gia_Man_t * pAig, Gia_ParSim_t * pPars );
602 Gia_ManSim_t * p;
603 abctime clkTotal = Abc_Clock();
604 int i, iOut, iPat, RetValue = 0;
605 abctime nTimeToStop = pPars->TimeLimit ? pPars->TimeLimit * CLOCKS_PER_SEC + Abc_Clock(): 0;
606 if ( pAig->pReprs && pAig->pNexts )
607 return Gia_ManSimSimulateEquiv( pAig, pPars );
608 ABC_FREE( pAig->pCexSeq );
609 p = Gia_ManSimCreate( pAig, pPars );
610 Gia_ManResetRandom( pPars );
612 for ( i = 0; i < pPars->nIters; i++ )
613 {
615 if ( pPars->fVerbose )
616 {
617 Abc_Print( 1, "Frame %4d out of %4d and timeout %3d sec. ", i+1, pPars->nIters, pPars->TimeLimit );
618 Abc_Print( 1, "Time = %7.2f sec\r", (1.0*Abc_Clock()-clkTotal)/CLOCKS_PER_SEC );
619 }
620 if ( pPars->fCheckMiter && Gia_ManCheckPos( p, &iOut, &iPat ) )
621 {
622 Gia_ManResetRandom( pPars );
623 pPars->iOutFail = iOut;
624 pAig->pCexSeq = Gia_ManGenerateCounter( pAig, i, iOut, p->nWords, iPat, p->vCis2Ids );
625 Abc_Print( 1, "Output %d of miter \"%s\" was asserted in frame %d. ", iOut, pAig->pName, i );
626 if ( !Gia_ManVerifyCex( pAig, pAig->pCexSeq, 0 ) )
627 {
628// Abc_Print( 1, "\n" );
629 Abc_Print( 1, "\nGenerated counter-example is INVALID. " );
630// Abc_Print( 1, "\n" );
631 }
632 else
633 {
634// Abc_Print( 1, "\n" );
635// if ( pPars->fVerbose )
636// Abc_Print( 1, "\nGenerated counter-example is verified correctly. " );
637// Abc_Print( 1, "\n" );
638 }
639 RetValue = 1;
640 break;
641 }
642 if ( Abc_Clock() > nTimeToStop )
643 {
644 i++;
645 break;
646 }
647 if ( i < pPars->nIters - 1 )
649 }
651 if ( pAig->pCexSeq == NULL )
652 Abc_Print( 1, "No bug detected after simulating %d frames with %d words. ", i, pPars->nWords );
653 Abc_PrintTime( 1, "Time", Abc_Clock() - clkTotal );
654 return RetValue;
655}
int Gia_ManSimSimulateEquiv(Gia_Man_t *pAig, Gia_ParSim_t *pPars)
Definition giaSim2.c:638
void Gia_ManSimDelete(Gia_ManSim_t *p)
Definition giaSim.c:189
void Gia_ManResetRandom(Gia_ParSim_t *pPars)
Definition giaSim.c:580
Gia_ManSim_t * Gia_ManSimCreate(Gia_Man_t *pAig, Gia_ParSim_t *pPars)
Definition giaSim.c:211
void Gia_ManSimInfoTransfer(Gia_ManSim_t *p)
Definition giaSim.c:453
void Gia_ManSimInfoInit(Gia_ManSim_t *p)
Definition giaSim.c:430
Abc_Cex_t * Gia_ManGenerateCounter(Gia_Man_t *pAig, int iFrame, int iOut, int nWords, int iPat, Vec_Int_t *vCis2Ids)
Definition giaSim.c:543
void Gia_ManSimulateRound(Gia_ManSim_t *p)
Definition giaSim.c:476
struct Gia_ManSim_t_ Gia_ManSim_t
Definition gia.h:319
int Gia_ManVerifyCex(Gia_Man_t *pAig, Abc_Cex_t *p, int fDualOut)
DECLARATIONS ///.
Definition giaCex.c:48
int nWords
Definition gia.h:310
int fCheckMiter
Definition gia.h:314
int TimeLimit
Definition gia.h:313
int iOutFail
Definition gia.h:316
int nIters
Definition gia.h:311
int fVerbose
Definition gia.h:315
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManSimulateRound()

void Gia_ManSimulateRound ( Gia_ManSim_t * p)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 476 of file giaSim.c.

477{
478 Gia_Obj_t * pObj;
479 int i, iCis = 0, iCos = 0;
480 assert( p->pAig->nFront > 0 );
481 assert( Gia_ManConst0(p->pAig)->Value == 0 );
482 Gia_ManSimInfoZero( p, Gia_SimData(p, 0) );
483 Gia_ManForEachObj1( p->pAig, pObj, i )
484 {
485 if ( Gia_ObjIsAndOrConst0(pObj) )
486 {
487 assert( Gia_ObjValue(pObj) < p->pAig->nFront );
488 Gia_ManSimulateNode( p, pObj );
489 }
490 else if ( Gia_ObjIsCo(pObj) )
491 {
492 assert( Gia_ObjValue(pObj) == GIA_NONE );
493 Gia_ManSimulateCo( p, iCos++, pObj );
494 }
495 else // if ( Gia_ObjIsCi(pObj) )
496 {
497 assert( Gia_ObjValue(pObj) < p->pAig->nFront );
498 Gia_ManSimulateCi( p, pObj, iCis++ );
499 }
500 }
501 assert( Gia_ManCiNum(p->pAig) == iCis );
502 assert( Gia_ManCoNum(p->pAig) == iCos );
503}
Here is the caller graph for this function:

◆ Gia_ManSolveProblem()

void Gia_ManSolveProblem ( Gia_Man_t * pGia,
Emb_Par_t * pPars )
extern

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
1800clk = Abc_Clock();
1801 if ( pPars->fCluster )
1802 {
1803 p = Emb_ManStart( pGia );
1804 if ( pPars->fVerbose )
1805 {
1806 printf( "Clustered: " );
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 );
1819clkSetup = Abc_Clock() - clk;
1820
1821clk = Abc_Clock();
1822 Emb_ManComputeDimensions( p, pPars->nDims );
1823if ( pPars->fVerbose )
1824ABC_PRT( "Setup ", clkSetup );
1825if ( pPars->fVerbose )
1826ABC_PRT( "Dimensions", Abc_Clock() - clk );
1827
1828clk = Abc_Clock();
1829 Emb_ManComputeCovariance( p, pPars->nDims );
1830if ( pPars->fVerbose )
1831ABC_PRT( "Matrix ", Abc_Clock() - clk );
1832
1833clk = Abc_Clock();
1834 Emb_ManComputeEigenvectors( p, pPars->nDims, pPars->nSols );
1835 Emb_ManComputeSolutions( p, pPars->nDims, pPars->nSols );
1836 Emb_ManDerivePlacement( p, pPars->nSols );
1837if ( pPars->fVerbose )
1838ABC_PRT( "Eigenvecs ", Abc_Clock() - clk );
1839
1840 if ( pPars->fRefine )
1841 {
1842clk = Abc_Clock();
1843 Emb_ManPlacementRefine( p, pPars->nIters, pPars->fVerbose );
1844if ( pPars->fVerbose )
1845ABC_PRT( "Refinement", Abc_Clock() - clk );
1846 }
1847
1848 if ( (pPars->fDump || pPars->fDumpLarge) && pPars->nSols == 2 )
1849 {
1850clk = Abc_Clock();
1851 Emb_ManDumpGnuplot( p, pGia->pName, pPars->fDumpLarge, pPars->fShowImage );
1852if ( pPars->fVerbose )
1853ABC_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}
void Emb_ManStop(Emb_Man_t *p)
Definition giaEmbed.c:651
void Emb_ManDumpGnuplot(Emb_Man_t *p, char *pName, int fDumpLarge, int fShowImage)
Definition giaEmbed.c:1695
void Emb_ManComputeEigenvectors(Emb_Man_t *p, int nDims, int nSols)
Definition giaEmbed.c:1358
Emb_Man_t * Emb_ManStartSimple(Gia_Man_t *pGia)
Definition giaEmbed.c:172
void Emb_ManComputeSolutions(Emb_Man_t *p, int nDims, int nSols)
Definition giaEmbed.c:1397
Emb_Man_t * Emb_ManStart(Gia_Man_t *pGia)
Definition giaEmbed.c:493
void Emb_ManDerivePlacement(Emb_Man_t *p, int nSols)
Definition giaEmbed.c:1427
void Emb_ManPrintStats(Emb_Man_t *p)
Definition giaEmbed.c:622
void Emb_ManPlacementRefine(Emb_Man_t *p, int nIters, int fVerbose)
Definition giaEmbed.c:1524
void Emb_ManSetValue(Emb_Man_t *p)
Definition giaEmbed.c:470
struct Emb_Man_t_ Emb_Man_t
Definition giaEmbed.c:69
void Emb_ManComputeCovariance(Emb_Man_t *p, int nDims)
Definition giaEmbed.c:1191
void Emb_ManComputeDimensions(Emb_Man_t *p, int nDims)
Definition giaEmbed.c:1102
int nIters
Definition gia.h:282
int fDumpLarge
Definition gia.h:286
int nDims
Definition gia.h:280
int fRefine
Definition gia.h:283
int fVerbose
Definition gia.h:288
int fDump
Definition gia.h:285
int fCluster
Definition gia.h:284
int nSols
Definition gia.h:281
int fShowImage
Definition gia.h:287
unsigned yCoord
Definition gia.h:73
unsigned xCoord
Definition gia.h:71
Here is the call graph for this function:

◆ Gia_ManSpecReduce()

Gia_Man_t * Gia_ManSpecReduce ( Gia_Man_t * p,
int fDualOut,
int fSynthesis,
int fSpeculate,
int fSkipSome,
int fVerbose )
extern

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

Synopsis [Reduces AIG using equivalence classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1253 of file giaEquiv.c.

1254{
1255 Gia_Man_t * pNew, * pTemp;
1256 Gia_Obj_t * pObj;
1257 Vec_Int_t * vXorLits;
1258 int i, iLitNew;
1259 Vec_Int_t * vTrace = NULL, * vGuide = NULL;
1260 if ( !p->pReprs )
1261 {
1262 Abc_Print( 1, "Gia_ManSpecReduce(): Equivalence classes are not available.\n" );
1263 return NULL;
1264 }
1265 if ( fDualOut && (Gia_ManPoNum(p) & 1) )
1266 {
1267 Abc_Print( 1, "Gia_ManSpecReduce(): Dual-output miter should have even number of POs.\n" );
1268 return NULL;
1269 }
1270 if ( fSkipSome )
1271 {
1272 vGuide = Vec_IntAlloc( 100 );
1273 pTemp = Gia_ManSpecReduceTrace( p, vGuide, NULL );
1274 Gia_ManStop( pTemp );
1275 assert( Vec_IntSize(vGuide) == Gia_ManEquivCountLitsAll(p) );
1276 vTrace = Vec_IntAlloc( 100 );
1277 }
1278 vXorLits = Vec_IntAlloc( 1000 );
1279 Gia_ManSetPhase( p );
1281 if ( fDualOut )
1282 Gia_ManEquivSetColors( p, fVerbose );
1283 pNew = Gia_ManStart( Gia_ManObjNum(p) );
1284 pNew->pName = Abc_UtilStrsav( p->pName );
1285 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1286 Gia_ManHashAlloc( pNew );
1287 Gia_ManConst0(p)->Value = 0;
1288 Gia_ManForEachCi( p, pObj, i )
1289 pObj->Value = Gia_ManAppendCi(pNew);
1290 Gia_ManForEachRo( p, pObj, i )
1291 Gia_ManSpecBuild( pNew, p, pObj, vXorLits, fDualOut, fSpeculate, vTrace, vGuide, NULL );
1292 Gia_ManForEachCo( p, pObj, i )
1293 Gia_ManSpecReduce_rec( pNew, p, Gia_ObjFanin0(pObj), vXorLits, fDualOut, fSpeculate, vTrace, vGuide, NULL );
1294 if ( !fSynthesis )
1295 {
1296 Gia_ManForEachPo( p, pObj, i )
1297 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1298 }
1299 Vec_IntForEachEntry( vXorLits, iLitNew, i )
1300 Gia_ManAppendCo( pNew, iLitNew );
1301 if ( Vec_IntSize(vXorLits) == 0 )
1302 {
1303 Abc_Print( 1, "Speculatively reduced model has no primary outputs.\n" );
1304 Gia_ManAppendCo( pNew, 0 );
1305 }
1306 Gia_ManForEachRi( p, pObj, i )
1307 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1308 Gia_ManHashStop( pNew );
1309 Vec_IntFree( vXorLits );
1310 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
1311 pNew = Gia_ManCleanup( pTemp = pNew );
1312 Gia_ManStop( pTemp );
1313
1314 // update using trace
1315 if ( fSkipSome )
1316 {
1317 // count the number of non-zero entries
1318 int iLit, nAddPos = 0;
1319 Vec_IntForEachEntry( vGuide, iLit, i )
1320 if ( iLit )
1321 nAddPos++;
1322 if ( nAddPos )
1323 assert( Gia_ManPoNum(pNew) == Gia_ManPoNum(p) + nAddPos );
1324 }
1325 Vec_IntFreeP( &vTrace );
1326 Vec_IntFreeP( &vGuide );
1327 return pNew;
1328}
int Gia_ManEquivCountLitsAll(Gia_Man_t *p)
Definition giaEquiv.c:357
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:1175
Gia_Man_t * Gia_ManSpecReduceTrace(Gia_Man_t *p, Vec_Int_t *vTrace, Vec_Int_t *vMap)
Definition giaEquiv.c:1197
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManSpecReduceInit()

Gia_Man_t * Gia_ManSpecReduceInit ( Gia_Man_t * p,
Abc_Cex_t * pInit,
int nFrames,
int fDualOut )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 1390 of file giaEquiv.c.

1391{
1392 Gia_Man_t * pNew, * pTemp;
1393 Gia_Obj_t * pObj, * pObjRi, * pObjRo;
1394 Vec_Int_t * vXorLits;
1395 int f, i, iLitNew;
1396 if ( !p->pReprs )
1397 {
1398 Abc_Print( 1, "Gia_ManSpecReduceInit(): Equivalence classes are not available.\n" );
1399 return NULL;
1400 }
1401 if ( Gia_ManRegNum(p) == 0 )
1402 {
1403 Abc_Print( 1, "Gia_ManSpecReduceInit(): Circuit is not sequential.\n" );
1404 return NULL;
1405 }
1406 if ( Gia_ManRegNum(p) != pInit->nRegs )
1407 {
1408 Abc_Print( 1, "Gia_ManSpecReduceInit(): Mismatch in the number of registers.\n" );
1409 return NULL;
1410 }
1411 if ( fDualOut && (Gia_ManPoNum(p) & 1) )
1412 {
1413 Abc_Print( 1, "Gia_ManSpecReduceInit(): Dual-output miter should have even number of POs.\n" );
1414 return NULL;
1415 }
1416
1417/*
1418 if ( !Gia_ManCheckTopoOrder( p ) )
1419 {
1420 Abc_Print( 1, "Gia_ManSpecReduceInit(): AIG is not in a correct topological order.\n" );
1421 return NULL;
1422 }
1423*/
1424 assert( pInit->nRegs == Gia_ManRegNum(p) && pInit->nPis == 0 );
1425 Vec_IntFill( &p->vCopies, nFrames * Gia_ManObjNum(p), -1 );
1426 vXorLits = Vec_IntAlloc( 1000 );
1427 Gia_ManSetPhase( p );
1428 if ( fDualOut )
1430 pNew = Gia_ManStart( nFrames * Gia_ManObjNum(p) );
1431 pNew->pName = Abc_UtilStrsav( p->pName );
1432 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1433 Gia_ManHashAlloc( pNew );
1434 Gia_ManForEachRo( p, pObj, i )
1435 Gia_ObjSetCopyF( p, 0, pObj, Abc_InfoHasBit(pInit->pData, i) );
1436 for ( f = 0; f < nFrames; f++ )
1437 {
1438 Gia_ObjSetCopyF( p, f, Gia_ManConst0(p), 0 );
1439 Gia_ManForEachPi( p, pObj, i )
1440 Gia_ObjSetCopyF( p, f, pObj, Gia_ManAppendCi(pNew) );
1441 Gia_ManForEachRo( p, pObj, i )
1442 Gia_ManSpecBuildInit( pNew, p, pObj, vXorLits, f, fDualOut );
1443 Gia_ManForEachCo( p, pObj, i )
1444 {
1445 Gia_ManSpecReduceInit_rec( pNew, p, Gia_ObjFanin0(pObj), vXorLits, f, fDualOut );
1446 Gia_ObjSetCopyF( p, f, pObj, Gia_ObjFanin0CopyF(p, f, pObj) );
1447 }
1448 if ( f == nFrames - 1 )
1449 break;
1450 Gia_ManForEachRiRo( p, pObjRi, pObjRo, i )
1451 Gia_ObjSetCopyF( p, f+1, pObjRo, Gia_ObjCopyF(p, f, pObjRi) );
1452 }
1453 Vec_IntForEachEntry( vXorLits, iLitNew, i )
1454 Gia_ManAppendCo( pNew, iLitNew );
1455 if ( Vec_IntSize(vXorLits) == 0 )
1456 {
1457// Abc_Print( 1, "Speculatively reduced model has no primary outputs.\n" );
1458 Gia_ManAppendCo( pNew, 0 );
1459 }
1460 Vec_IntErase( &p->vCopies );
1461 Vec_IntFree( vXorLits );
1462 Gia_ManHashStop( pNew );
1463 pNew = Gia_ManCleanup( pTemp = pNew );
1464 Gia_ManStop( pTemp );
1465 return pNew;
1466}
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:1368
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:1341
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManSpecReduceInitFrames()

Gia_Man_t * Gia_ManSpecReduceInitFrames ( Gia_Man_t * p,
Abc_Cex_t * pInit,
int nFramesMax,
int * pnFrames,
int fDualOut,
int nMinOutputs )
extern

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 1480 of file giaEquiv.c.

1481{
1482 Gia_Man_t * pFrames;
1483 int f, nLits;
1484 nLits = Gia_ManEquivCountLits( p );
1485 for ( f = 1; ; f++ )
1486 {
1487 pFrames = Gia_ManSpecReduceInit( p, pInit, f, fDualOut );
1488 if ( (nMinOutputs == 0 && Gia_ManPoNum(pFrames) >= nLits/2+1) ||
1489 (nMinOutputs != 0 && Gia_ManPoNum(pFrames) >= nMinOutputs) )
1490 break;
1491 if ( f == nFramesMax )
1492 break;
1493 if ( Gia_ManAndNum(pFrames) > 500000 )
1494 {
1495 Gia_ManStop( pFrames );
1496 return NULL;
1497 }
1498 Gia_ManStop( pFrames );
1499 pFrames = NULL;
1500 }
1501 if ( f == nFramesMax )
1502 Abc_Print( 1, "Stopped unrolling after %d frames.\n", nFramesMax );
1503 if ( pnFrames )
1504 *pnFrames = f;
1505 return pFrames;
1506}
int Gia_ManEquivCountLits(Gia_Man_t *p)
Definition giaEquiv.c:450
Gia_Man_t * Gia_ManSpecReduceInit(Gia_Man_t *p, Abc_Cex_t *pInit, int nFrames, int fDualOut)
Definition giaEquiv.c:1390
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManSpeedup()

Gia_Man_t * Gia_ManSpeedup ( Gia_Man_t * p,
int Percentage,
int Degree,
int fVerbose,
int fVeryVerbose )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 629 of file giaSpeedup.c.

630{
631 Gia_Man_t * pNew, * pTemp;
632 Vec_Int_t * vTimeCries, * vTimeFanins;
633 int iObj, iFanin, iFanin2, nNodesNew;
634 float tDelta, tArrival;
635 int i, k, k2, Counter, CounterRes, nTimeCris;
636 int fUseLutLib = (p->pLutLib != NULL);
637 void * pTempTim = NULL;
638 unsigned * puTCEdges;
639 assert( Gia_ManHasMapping(p) );
640 if ( !fUseLutLib && p->pManTime )
641 {
642 pTempTim = p->pManTime;
643 p->pManTime = Tim_ManDup( (Tim_Man_t *)pTempTim, 1 );
644 }
645 // perform delay trace
646 tArrival = Gia_ManDelayTraceLut( p );
647 tDelta = fUseLutLib ? tArrival*Percentage/100.0 : 1.0;
648 if ( fVerbose )
649 {
650 printf( "Max delay = %.2f. Delta = %.2f. ", tArrival, tDelta );
651 printf( "Using %s model. ", fUseLutLib ? "LUT library" : "unit-delay" );
652 if ( fUseLutLib )
653 printf( "Percentage = %d. ", Percentage );
654 printf( "\n" );
655 }
656 // mark the timing critical nodes and edges
657 puTCEdges = ABC_CALLOC( unsigned, Gia_ManObjNum(p) );
658 Gia_ManForEachLut( p, iObj )
659 {
660 if ( Gia_ObjTimeSlack(p, iObj) >= tDelta )
661 continue;
662 puTCEdges[iObj] = Gia_LutDelayTraceTCEdges( p, iObj, tDelta );
663 }
664 if ( fVerbose )
665 {
666 Counter = CounterRes = 0;
667 Gia_ManForEachLut( p, iObj )
668 {
669 Gia_LutForEachFanin( p, iObj, iFanin, k )
670 if ( !Gia_ObjIsCi(Gia_ManObj(p, iFanin)) && Gia_ObjTimeSlack(p, iFanin) < tDelta )
671 Counter++;
672 CounterRes += Gia_WordCountOnes( puTCEdges[iObj] );
673 }
674 printf( "Edges: Total = %7d. 0-slack = %7d. Critical = %7d. Ratio = %4.2f\n",
675 Gia_ManLutFaninCount(p), Counter, CounterRes, Counter? 1.0*CounterRes/Counter : 0.0 );
676 }
677
678 // start the resulting network
679 pNew = Gia_ManDup( p );
680 Gia_ManHashStart( pNew );
681 nNodesNew = 1000 + 3 * Gia_ManObjNum(pNew);
682 pNew->pNexts = ABC_CALLOC( int, nNodesNew );
683 pNew->pReprs = ABC_CALLOC( Gia_Rpr_t, nNodesNew );
684 for ( i = 0; i < nNodesNew; i++ )
685 Gia_ObjSetRepr( pNew, i, GIA_VOID );
686
687 // collect nodes to be used for resynthesis
688 Counter = CounterRes = 0;
689 vTimeCries = Vec_IntAlloc( 16 );
690 vTimeFanins = Vec_IntAlloc( 16 );
691 Gia_ManForEachLut( p, iObj )
692 {
693 if ( Gia_ObjTimeSlack(p, iObj) >= tDelta )
694 continue;
695 // count the number of non-PI timing-critical nodes
696 nTimeCris = 0;
697 Gia_LutForEachFanin( p, iObj, iFanin, k )
698 if ( !Gia_ObjIsCi(Gia_ManObj(p, iFanin)) && (puTCEdges[iObj] & (1<<k)) )
699 nTimeCris++;
700 if ( !fVeryVerbose && nTimeCris == 0 )
701 continue;
702 Counter++;
703 // count the total number of timing critical second-generation nodes
704 Vec_IntClear( vTimeCries );
705 if ( nTimeCris )
706 {
707 Gia_LutForEachFanin( p, iObj, iFanin, k )
708 if ( !Gia_ObjIsCi(Gia_ManObj(p, iFanin)) && (puTCEdges[iObj] & (1<<k)) )
709 Gia_LutForEachFanin( p, iFanin, iFanin2, k2 )
710 if ( puTCEdges[iFanin] & (1<<k2) )
711 Vec_IntPushUnique( vTimeCries, iFanin2 );
712 }
713// if ( !fVeryVerbose && (Vec_IntSize(vTimeCries) == 0 || Vec_IntSize(vTimeCries) > Degree) )
714 if ( (Vec_IntSize(vTimeCries) == 0 || Vec_IntSize(vTimeCries) > Degree) )
715 continue;
716 CounterRes++;
717 // collect second generation nodes
718 Vec_IntClear( vTimeFanins );
719 Gia_LutForEachFanin( p, iObj, iFanin, k )
720 {
721 if ( Gia_ObjIsCi(Gia_ManObj(p, iFanin)) )
722 Vec_IntPushUnique( vTimeFanins, iFanin );
723 else
724 Gia_LutForEachFanin( p, iFanin, iFanin2, k2 )
725 Vec_IntPushUnique( vTimeFanins, iFanin2 );
726 }
727 // print the results
728 if ( fVeryVerbose )
729 {
730 printf( "%5d Node %5d : %d %2d %2d ", Counter, iObj,
731 nTimeCris, Vec_IntSize(vTimeCries), Vec_IntSize(vTimeFanins) );
732 Gia_LutForEachFanin( p, iObj, iFanin, k )
733 printf( "%d(%.2f)%s ", iFanin, Gia_ObjTimeSlack(p, iFanin), (puTCEdges[iObj] & (1<<k))? "*":"" );
734 printf( "\n" );
735 }
736 // add the node to choices
737 if ( Vec_IntSize(vTimeCries) == 0 || Vec_IntSize(vTimeCries) > Degree )
738 continue;
739 // order the fanins in the increasing order of criticalily
740 if ( Vec_IntSize(vTimeCries) > 1 )
741 {
742 iFanin = Vec_IntEntry( vTimeCries, 0 );
743 iFanin2 = Vec_IntEntry( vTimeCries, 1 );
744 if ( Gia_ObjTimeSlack(p, iFanin) < Gia_ObjTimeSlack(p, iFanin2) )
745 {
746 Vec_IntWriteEntry( vTimeCries, 0, iFanin2 );
747 Vec_IntWriteEntry( vTimeCries, 1, iFanin );
748 }
749 }
750 if ( Vec_IntSize(vTimeCries) > 2 )
751 {
752 iFanin = Vec_IntEntry( vTimeCries, 1 );
753 iFanin2 = Vec_IntEntry( vTimeCries, 2 );
754 if ( Gia_ObjTimeSlack(p, iFanin) < Gia_ObjTimeSlack(p, iFanin2) )
755 {
756 Vec_IntWriteEntry( vTimeCries, 1, iFanin2 );
757 Vec_IntWriteEntry( vTimeCries, 2, iFanin );
758 }
759 iFanin = Vec_IntEntry( vTimeCries, 0 );
760 iFanin2 = Vec_IntEntry( vTimeCries, 1 );
761 if ( Gia_ObjTimeSlack(p, iFanin) < Gia_ObjTimeSlack(p, iFanin2) )
762 {
763 Vec_IntWriteEntry( vTimeCries, 0, iFanin2 );
764 Vec_IntWriteEntry( vTimeCries, 1, iFanin );
765 }
766 }
767 // add choice
768 Gia_ManSpeedupObj( pNew, p, Gia_ManObj(p,iObj), vTimeFanins, vTimeCries );
769 // quit if the number of nodes is large
770 if ( Gia_ManObjNum(pNew) > nNodesNew - 100 )
771 {
772 printf( "Speedup stopped adding choices because there was too many to add.\n" );
773 break;
774 }
775 }
776 Gia_ManTimeStop( p );
777 Vec_IntFree( vTimeCries );
778 Vec_IntFree( vTimeFanins );
779 ABC_FREE( puTCEdges );
780 if ( fVerbose )
781 printf( "Nodes: Total = %7d. 0-slack = %7d. Workable = %7d. Ratio = %4.2f\n",
782 Gia_ManLutNum(p), Counter, CounterRes, Counter? 1.0*CounterRes/Counter : 0.0 );
783 if ( pTempTim )
784 {
785 Tim_ManStop( (Tim_Man_t *)p->pManTime );
786 p->pManTime = pTempTim;
787 }
788 // derive AIG with choices
789//Gia_ManPrintStats( pNew, 0 );
790 pTemp = Gia_ManEquivToChoices( pNew, 1 );
791 Gia_ManStop( pNew );
792//Gia_ManPrintStats( pTemp, 0 );
793// pNew = Gia_ManDupOrderDfsChoices( pTemp );
794// Gia_ManStop( pTemp );
795//Gia_ManPrintStats( pNew, 0 );
796// return pNew;
797 return pTemp;
798}
unsigned Gia_LutDelayTraceTCEdges(Gia_Man_t *p, int iObj, float tDelta)
Definition giaSpeedup.c:502
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:573
int Gia_ManLutFaninCount(Gia_Man_t *p)
Definition giaIf.c:108
Gia_Man_t * Gia_ManEquivToChoices(Gia_Man_t *p, int nSnapshots)
Definition giaEquiv.c:2034
void Tim_ManStop(Tim_Man_t *p)
Definition timMan.c:378
Here is the call graph for this function:

◆ Gia_ManStart()

Gia_Man_t * Gia_ManStart ( int nObjsMax)
extern

FUNCTION DEFINITIONS ///.

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

Synopsis [Creates AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 57 of file giaMan.c.

58{
59 Gia_Man_t * p;
60 assert( nObjsMax > 0 );
61 p = ABC_CALLOC( Gia_Man_t, 1 );
62 p->nObjsAlloc = nObjsMax;
63 p->pObjs = ABC_CALLOC( Gia_Obj_t, nObjsMax );
64 p->pObjs->iDiff0 = p->pObjs->iDiff1 = GIA_NONE;
65 p->nObjs = 1;
66 p->vCis = Vec_IntAlloc( nObjsMax / 20 );
67 p->vCos = Vec_IntAlloc( nObjsMax / 20 );
68 return p;
69}

◆ Gia_ManStaticFanoutStart()

void Gia_ManStaticFanoutStart ( Gia_Man_t * p)
extern

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;
249 p->vFanoutNums = Vec_IntAllocArray( p->pRefs, Gia_ManObjNum(p) );
250 p->pRefs = pRefsOld;
251 // start the fanout maps
252 p->vFanout = Gia_ManStartFanoutMap( p, p->vFanoutNums );
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) && !Gia_ObjIsBuf(pObj) )
265 {
266 pFanin = Gia_ObjFanin1(pObj);
267 iFanout = Vec_IntEntry( vCounts, Gia_ObjId(p, pFanin) );
268 Gia_ObjSetFanout( p, pFanin, iFanout, pObj );
269 Vec_IntAddToEntry( vCounts, Gia_ObjId(p, pFanin), 1 );
270 }
271 if ( Gia_ObjIsMux(p, pObj) )
272 {
273
274 pFanin = Gia_ObjFanin2(p, pObj);
275 iFanout = Vec_IntEntry( vCounts, Gia_ObjId(p, pFanin) );
276 Gia_ObjSetFanout( p, pFanin, iFanout, pObj );
277 Vec_IntAddToEntry( vCounts, Gia_ObjId(p, pFanin), 1 );
278 }
279 }
280 // double-check the current number of fanouts added
281 Gia_ManForEachObj( p, pObj, i )
282 assert( Vec_IntEntry(vCounts, i) == Gia_ObjFanoutNum(p, pObj) );
283 Vec_IntFree( vCounts );
284}
Vec_Int_t * Gia_ManStartFanoutMap(Gia_Man_t *p, Vec_Int_t *vFanoutNums)
Definition giaFanout.c:211
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManStaticFanoutStop()

void Gia_ManStaticFanoutStop ( Gia_Man_t * p)
extern

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

Synopsis [Deallocates static fanout.]

Description []

SideEffects []

SeeAlso []

Definition at line 393 of file giaFanout.c.

394{
395 Vec_IntFreeP( &p->vFanoutNums );
396 Vec_IntFreeP( &p->vFanout );
397}
Here is the caller graph for this function:

◆ Gia_ManStaticMappingFanoutStart()

void Gia_ManStaticMappingFanoutStart ( Gia_Man_t * p,
Vec_Int_t ** pvIndex )
extern

Definition at line 335 of file giaFanout.c.

336{
337 Vec_Int_t * vCounts;
338 int * pRefsOld;
339 Gia_Obj_t * pObj, * pFanin;
340 int i, k, iFan, iFanout, Index;
341 assert( p->vFanoutNums == NULL );
342 assert( p->vFanout == NULL );
343 // recompute reference counters
344 pRefsOld = p->pLutRefs; p->pLutRefs = NULL;
346 p->vFanoutNums = Vec_IntAllocArray( p->pLutRefs, Gia_ManObjNum(p) );
347 p->pLutRefs = pRefsOld;
348 // start the fanout maps
349 p->vFanout = Gia_ManStartMappingFanoutMap( p, p->vFanoutNums );
350 if ( pvIndex )
351 *pvIndex = Vec_IntStart( Vec_IntSize(p->vFanout) );
352 // incrementally add fanouts
353 vCounts = Vec_IntStart( Gia_ManObjNum(p) );
354 Gia_ManForEachLut( p, i )
355 {
357 pObj = Gia_ManObj( p, i );
358 Gia_LutForEachFaninIndex( p, i, iFan, k, Index )
359 {
360 pFanin = Gia_ManObj( p, iFan );
361 iFanout = Vec_IntEntry( vCounts, iFan );
362 Gia_ObjSetFanout( p, pFanin, iFanout, pObj );
363 Vec_IntAddToEntry( vCounts, iFan, 1 );
364 if ( pvIndex )
365 Vec_IntWriteEntry( *pvIndex, Vec_IntEntry(p->vFanout, iFan) + iFanout, Index );
366 }
367 }
368 Gia_ManForEachCo( p, pObj, i )
369 {
370 iFan = Gia_ObjFaninId0p(p, pObj);
371 pFanin = Gia_ManObj( p, iFan );
372 iFanout = Vec_IntEntry( vCounts, iFan );
373 Gia_ObjSetFanout( p, pFanin, iFanout, pObj );
374 Vec_IntAddToEntry( vCounts, iFan, 1 );
375 }
376 // double-check the current number of fanouts added
377 Gia_ManForEachObj( p, pObj, i )
378 assert( Vec_IntEntry(vCounts, i) == Gia_ObjFanoutNum(p, pObj) );
379 Vec_IntFree( vCounts );
380}
Vec_Int_t * Gia_ManStartMappingFanoutMap(Gia_Man_t *p, Vec_Int_t *vFanoutNums)
Definition giaFanout.c:298
void Gia_ObjCheckDupMappingFanins(Gia_Man_t *p, int iObj)
Definition giaFanout.c:327
void Gia_ManSetLutRefs(Gia_Man_t *p)
Definition giaIf.c:295
#define Gia_LutForEachFaninIndex(p, i, iFan, k, Index)
Definition gia.h:1163
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManStgPrint()

void Gia_ManStgPrint ( FILE * pFile,
Vec_Int_t * vLines,
int nIns,
int nOuts,
int nStates )
extern

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}
void Extra_PrintBinary(FILE *pFile, unsigned Sign[], int nBits)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManStgRead()

Gia_Man_t * Gia_ManStgRead ( char * pFileName,
int kHot,
int fVerbose )
extern

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}
Gia_Man_t * Gia_ManStgKHot(Vec_Int_t *vLines, int nIns, int nOuts, int nStates, int kHot, int fVerbose)
Definition giaStg.c:215
Vec_Int_t * Gia_ManStgReadLines(char *pFileName, int *pnIns, int *pnOuts, int *pnStates)
Definition giaStg.c:440
Here is the call graph for this function:

◆ Gia_ManStop()

void Gia_ManStop ( Gia_Man_t * p)
extern

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

Synopsis [Deletes AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 82 of file giaMan.c.

83{
84 if ( p->vSeqModelVec )
85 Vec_PtrFreeFree( p->vSeqModelVec );
87 Tim_ManStopP( (Tim_Man_t **)&p->pManTime );
88 assert( p->pManTime == NULL );
89 Vec_PtrFreeFree( p->vNamesIn );
90 Vec_PtrFreeFree( p->vNamesOut );
91 Vec_PtrFreeFree( p->vNamesNode );
92 Vec_IntFreeP( &p->vSwitching );
93 Vec_IntFreeP( &p->vSuper );
94 Vec_IntFreeP( &p->vStore );
95 Vec_IntFreeP( &p->vClassNew );
96 Vec_IntFreeP( &p->vClassOld );
97 Vec_IntFreeP( &p->vPats );
98 Vec_BitFreeP( &p->vPolars );
99 Vec_WrdFreeP( &p->vSims );
100 Vec_WrdFreeP( &p->vSimsT );
101 Vec_WrdFreeP( &p->vSimsPi );
102 Vec_WrdFreeP( &p->vSimsPo );
103 Vec_IntFreeP( &p->vTimeStamps );
104 Vec_FltFreeP( &p->vTiming );
105 Vec_VecFreeP( &p->vClockDoms );
106 Vec_IntFreeP( &p->vCofVars );
107 Vec_IntFreeP( &p->vIdsOrig );
108 Vec_IntFreeP( &p->vIdsEquiv );
109 Vec_IntFreeP( &p->vLutConfigs );
110 Vec_IntFreeP( &p->vEdgeDelay );
111 Vec_IntFreeP( &p->vEdgeDelayR );
112 Vec_IntFreeP( &p->vEdge1 );
113 Vec_IntFreeP( &p->vEdge2 );
114 Vec_IntFreeP( &p->vUserPiIds );
115 Vec_IntFreeP( &p->vUserPoIds );
116 Vec_IntFreeP( &p->vUserFfIds );
117 Vec_IntFreeP( &p->vFlopClasses );
118 Vec_IntFreeP( &p->vGateClasses );
119 Vec_IntFreeP( &p->vObjClasses );
120 Vec_IntFreeP( &p->vInitClasses );
121 Vec_IntFreeP( &p->vRegClasses );
122 Vec_IntFreeP( &p->vRegInits );
123 Vec_IntFreeP( &p->vDoms );
124 Vec_IntFreeP( &p->vBarBufs );
125 Vec_IntFreeP( &p->vXors );
126 Vec_IntFreeP( &p->vLevels );
127 Vec_IntFreeP( &p->vTruths );
128 Vec_IntErase( &p->vCopies );
129 Vec_IntErase( &p->vCopies2 );
130 Vec_IntFreeP( &p->vVar2Obj );
131 Vec_IntErase( &p->vCopiesTwo );
132 Vec_IntErase( &p->vSuppVars );
133 Vec_IntErase( &p->vVarMap );
134 Vec_WrdFreeP( &p->vSuppWords );
135 Vec_IntFreeP( &p->vTtNums );
136 Vec_IntFreeP( &p->vTtNodes );
137 Vec_WrdFreeP( &p->vTtMemory );
138 Vec_PtrFreeP( &p->vTtInputs );
139 Vec_IntFreeP( &p->vMapping );
140 Vec_WecFreeP( &p->vMapping2 );
141 Vec_WecFreeP( &p->vFanouts2 );
142 Vec_IntFreeP( &p->vCellMapping );
143 Vec_IntFreeP( &p->vPacking );
144 Vec_IntFreeP( &p->vConfigs );
145 ABC_FREE( p->pCellStr );
146 Vec_FltFreeP( &p->vInArrs );
147 Vec_FltFreeP( &p->vOutReqs );
148 Vec_IntFreeP( &p->vCiArrs );
149 Vec_IntFreeP( &p->vCoReqs );
150 Vec_IntFreeP( &p->vCoArrs );
151 Vec_IntFreeP( &p->vCoAttrs );
152 Vec_IntFreeP( &p->vWeights );
153 Gia_ManStopP( &p->pAigExtra );
154 Vec_IntFree( p->vCis );
155 Vec_IntFree( p->vCos );
156 Vec_IntErase( &p->vHash );
157 Vec_IntErase( &p->vHTable );
158 Vec_IntErase( &p->vRefs );
159 Vec_StrFreeP( &p->vStopsF );
160 Vec_StrFreeP( &p->vStopsB );
161 ABC_FREE( p->pData2 );
162 ABC_FREE( p->pTravIds );
163 ABC_FREE( p->pPlacement );
164 ABC_FREE( p->pSwitching );
165 ABC_FREE( p->pCexSeq );
166 ABC_FREE( p->pCexComb );
167 ABC_FREE( p->pIso );
168// ABC_FREE( p->pMapping );
169 ABC_FREE( p->pFanData );
170 ABC_FREE( p->pReprsOld );
171 ABC_FREE( p->pReprs );
172 ABC_FREE( p->pNexts );
173 ABC_FREE( p->pSibls );
174 ABC_FREE( p->pRefs );
175 ABC_FREE( p->pLutRefs );
176 ABC_FREE( p->pMuxes );
177 ABC_FREE( p->pObjs );
178 ABC_FREE( p->pSpec );
179 ABC_FREE( p->pName );
180 ABC_FREE( p );
181}
void Gia_ManStopP(Gia_Man_t **p)
Definition giaMan.c:224
void Tim_ManStopP(Tim_Man_t **p)
Definition timMan.c:387
Here is the call graph for this function:

◆ Gia_ManStopP()

void Gia_ManStopP ( Gia_Man_t ** p)
extern

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

Synopsis [Stops the AIG manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 224 of file giaMan.c.

225{
226 if ( *p == NULL )
227 return;
228 Gia_ManStop( *p );
229 *p = NULL;
230}
void Gia_ManStop(Gia_Man_t *p)
Definition giaMan.c:82
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManSupportAnd()

int Gia_ManSupportAnd ( Gia_ManMin_t * p,
int iLit0,
int iLit1 )
extern

Definition at line 280 of file giaSupp.c.

280{ return 0; }
Here is the caller graph for this function:

◆ Gia_ManSuppSize()

int Gia_ManSuppSize ( Gia_Man_t * p,
int * pNodes,
int nNodes )
extern

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

Synopsis [Collects support nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 324 of file giaDfs.c.

325{
326 Gia_Obj_t * pObj;
327 int i, Counter = 0;
329 Gia_ObjSetTravIdCurrent( p, Gia_ManConst0(p) );
330 for ( i = 0; i < nNodes; i++ )
331 {
332 pObj = Gia_ManObj( p, pNodes[i] );
333 if ( Gia_ObjIsCo(pObj) )
334 Counter += Gia_ManSuppSize_rec( p, Gia_ObjFanin0(pObj) );
335 else
336 Counter += Gia_ManSuppSize_rec( p, pObj );
337 }
338 return Counter;
339}
int Gia_ManSuppSize_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaDfs.c:260
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManSuppStart()

Gia_ManMin_t * Gia_ManSuppStart ( Gia_Man_t * pGia)
extern

DECLARATIONS ///.

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

FileName [giaSupp.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Scalable AIG package.]

Synopsis [Support minimization for AIGs.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]

Definition at line 279 of file giaSupp.c.

279{ return NULL; }
Here is the caller graph for this function:

◆ Gia_ManSuppStop()

void Gia_ManSuppStop ( Gia_ManMin_t * p)
extern

Definition at line 281 of file giaSupp.c.

281{}
Here is the caller graph for this function:

◆ Gia_ManSwapPos()

void Gia_ManSwapPos ( Gia_Man_t * p,
int i )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 1808 of file giaUtil.c.

1809{
1810 int Lit0, LitI;
1811 assert( i >= 0 && i < Gia_ManPoNum(p) );
1812 if ( i == 0 )
1813 return;
1814 Lit0 = Gia_ObjFaninLit0p( p, Gia_ManPo(p, 0) );
1815 LitI = Gia_ObjFaninLit0p( p, Gia_ManPo(p, i) );
1816 Gia_ManPatchCoDriver( p, 0, LitI );
1817 Gia_ManPatchCoDriver( p, i, Lit0 );
1818}
Here is the caller graph for this function:

◆ Gia_ManSweepWithBoxes()

Gia_Man_t * Gia_ManSweepWithBoxes ( Gia_Man_t * p,
void * pParsC,
void * pParsS,
int fConst,
int fEquiv,
int fVerbose,
int fVerbEquivs )
extern

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

Synopsis [Reduces root model with scorr.]

Description []

SideEffects []

SeeAlso []

Definition at line 739 of file giaSweep.c.

740{
741 Gia_Man_t * pClp, * pNew, * pTemp;
742 int * pReprs, pFlopTypes[3] = {0};
743 int nFlopsNew, nFlops;
744 assert( Gia_ManRegNum(p) == 0 );
745 assert( p->pAigExtra != NULL );
746 // consider seq synthesis with multiple clock domains
747 if ( pParsC == NULL && Gia_ManClockDomainNum(p) > 1 )
748 return Gia_ManSweepWithBoxesAndDomains( p, pParsS, fConst, fEquiv, fVerbose, fVerbEquivs );
749 // order AIG objects
750 pNew = Gia_ManDupUnnormalize( p );
751 if ( pNew == NULL )
752 return NULL;
753 Gia_ManTransferTiming( pNew, p );
754 nFlops = Vec_IntCountEntry(pNew->vRegClasses, 1);
755 // find global equivalences
756 pClp = Gia_ManDupCollapse( pNew, pNew->pAigExtra, NULL, pParsC ? 0 : 1 );
757 //Gia_DumpAiger( pClp, p->pSpec, 1, 1 );
758 // compute equivalences
759 if ( pParsC )
760 Gia_ManFraigSweepPerform( pClp, pParsC );
761 else if ( pParsS )
763 else
764 Gia_ManSeqCleanupClasses( pClp, fConst, fEquiv, fVerbose );
765 // transfer equivalences
766 pReprs = Gia_ManFraigSelectReprs( pNew, pClp, fVerbose, pFlopTypes );
767 Gia_ManStop( pClp );
768 // reduce AIG
769 Gia_ManTransferTiming( p, pNew );
770 pNew = Gia_ManFraigReduceGia( pTemp = pNew, pReprs );
771 Gia_ManTransferTiming( pNew, p );
772 Gia_ManStop( pTemp );
773 ABC_FREE( pReprs );
774 // derive new AIG
775 pNew = Gia_ManDupWithBoxes( pTemp = pNew, pParsC ? 0 : 1 );
776 Gia_ManStop( pTemp );
777 // report
778 nFlopsNew = Vec_IntCountEntry(pNew->vRegClasses, 1);
779 pFlopTypes[2] = nFlops - nFlopsNew - (pFlopTypes[0] + pFlopTypes[1]);
780 if ( fVerbEquivs )
781 {
782 printf( "Domain %2d : %5d -> %5d : ", 1, nFlops, nFlopsNew );
783 printf( "EqConst =%4d. EqFlop =%4d. Dangling =%4d. Unused =%4d.\n",
784 pFlopTypes[0], pFlopTypes[1], Abc_MaxInt(0, pFlopTypes[2]), Abc_MaxInt(0, -pFlopTypes[2]) );
785 }
786 // normalize the result
787 pNew = Gia_ManDupNormalize( pTemp = pNew, 0 );
788 Gia_ManTransferTiming( pNew, pTemp );
789 Gia_ManStop( pTemp );
790 // check integrity
791 //Gia_ManCheckIntegrityWithBoxes( pNew );
792 return pNew;
793}
int Cec_ManLSCorrespondenceClasses(Gia_Man_t *pAig, Cec_ParCor_t *pPars)
Definition cecCorr.c:924
struct Cec_ParCor_t_ Cec_ParCor_t
Definition cec.h:145
void Gia_ManSeqCleanupClasses(Gia_Man_t *p, int fConst, int fEquiv, int fVerbose)
Definition giaAig.c:676
Gia_Man_t * Gia_ManSweepWithBoxesAndDomains(Gia_Man_t *p, void *pParsS, int fConst, int fEquiv, int fVerbose, int fVerbEquivs)
Definition giaSweep.c:671
int * Gia_ManFraigSelectReprs(Gia_Man_t *p, Gia_Man_t *pClp, int fVerbose, int pFlopTypes[3])
Definition giaSweep.c:478
Gia_Man_t * Gia_ManFraigReduceGia(Gia_Man_t *p, int *pReprs)
Definition giaSweep.c:346
Gia_Man_t * Gia_ManDupWithBoxes(Gia_Man_t *p, int fSeq)
Definition giaSweep.c:124
Gia_Man_t * Gia_ManDupCollapse(Gia_Man_t *p, Gia_Man_t *pBoxes, Vec_Int_t *vBoxPres, int fSeq)
Definition giaTim.c:802
Here is the call graph for this function:

◆ Gia_ManTestDistance()

void Gia_ManTestDistance ( Gia_Man_t * pGia)
extern

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 );
911ABC_PRT( "Time", Abc_Clock() - clk );
913 Emb_ManStop( p );
914}
void Gia_ManTestDistanceInternal(Emb_Man_t *p)
Definition giaEmbed.c:838
Here is the call graph for this function:

◆ Gia_ManTransductionBdd()

Gia_Man_t * Gia_ManTransductionBdd ( Gia_Man_t * pGia,
int nType,
int fMspf,
int nRandom,
int nSortType,
int nPiShuffle,
int nParameter,
int fLevel,
Gia_Man_t * pExdc,
int fNewLine,
int nVerbose )
extern

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

FileName [giaTransduction.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Scalable AIG package.]

Synopsis [Implementation of transduction method.]

Author [Yukio Miyasaka]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - May 2023.]

Revision [

Id
giaTransduction.c,v 1.00 2023/05/10 00:00:00 Exp

]

Definition at line 35 of file giaTransduction.cpp.

35 {
36 if(nRandom) {
37 srand(nRandom);
38 nSortType = rand() % 4;
39 nPiShuffle = rand();
40 nParameter = rand() % 16;
41 }
43 Transduction::Transduction<NewBdd::Man, NewBdd::Param, NewBdd::lit, 0xffffffff> t(pGia, nVerbose, fNewLine, nSortType, nPiShuffle, fLevel, pExdc, p);
44 int count = t.CountWires();
45 switch(nType) {
46 case 0:
47 count -= fMspf? t.Mspf(): t.Cspf();
48 break;
49 case 1:
50 count -= t.Resub(fMspf);
51 break;
52 case 2:
53 count -= t.ResubMono(fMspf);
54 break;
55 case 3:
56 count -= t.ResubShared(fMspf);
57 break;
58 case 4:
59 count -= t.RepeatResub(false, fMspf);
60 break;
61 case 5:
62 count -= t.RepeatResub(true, fMspf);
63 break;
64 case 6: {
65 bool fInner = (nParameter / 4) % 2;
66 count -= t.RepeatInner(fMspf, fInner);
67 break;
68 }
69 case 7: {
70 bool fInner = (nParameter / 4) % 2;
71 bool fOuter = (nParameter / 8) % 2;
72 count -= t.RepeatOuter(fMspf, fInner, fOuter);
73 break;
74 }
75 case 8: {
76 bool fFirstMerge = nParameter % 2;
77 bool fMspfMerge = fMspf? (nParameter / 2) % 2: false;
78 bool fInner = (nParameter / 4) % 2;
79 bool fOuter = (nParameter / 8) % 2;
80 count -= t.RepeatAll(fFirstMerge, fMspfMerge, fMspf, fInner, fOuter);
81 break;
82 }
83 default:
84 std::cout << "Unknown transduction type " << nType << std::endl;
85 }
86 assert(t.Verify());
87 assert(count == t.CountWires());
88 return t.GenerateAig();
89}
#define false
Definition place_base.h:29
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManTransductionTt()

Gia_Man_t * Gia_ManTransductionTt ( Gia_Man_t * pGia,
int nType,
int fMspf,
int nRandom,
int nSortType,
int nPiShuffle,
int nParameter,
int fLevel,
Gia_Man_t * pExdc,
int fNewLine,
int nVerbose )
extern

Definition at line 91 of file giaTransduction.cpp.

91 {
92 if(nRandom) {
93 srand(nRandom);
94 nSortType = rand() % 4;
95 nPiShuffle = rand();
96 nParameter = rand() % 16;
97 }
99 Transduction::Transduction<NewTt::Man, NewTt::Param, NewTt::lit, 0xffffffff> t(pGia, nVerbose, fNewLine, nSortType, nPiShuffle, fLevel, pExdc, p);
100 int count = t.CountWires();
101 switch(nType) {
102 case 0:
103 count -= fMspf? t.Mspf(): t.Cspf();
104 break;
105 case 1:
106 count -= t.Resub(fMspf);
107 break;
108 case 2:
109 count -= t.ResubMono(fMspf);
110 break;
111 case 3:
112 count -= t.ResubShared(fMspf);
113 break;
114 case 4:
115 count -= t.RepeatResub(false, fMspf);
116 break;
117 case 5:
118 count -= t.RepeatResub(true, fMspf);
119 break;
120 case 6: {
121 bool fInner = (nParameter / 4) % 2;
122 count -= t.RepeatInner(fMspf, fInner);
123 break;
124 }
125 case 7: {
126 bool fInner = (nParameter / 4) % 2;
127 bool fOuter = (nParameter / 8) % 2;
128 count -= t.RepeatOuter(fMspf, fInner, fOuter);
129 break;
130 }
131 case 8: {
132 bool fFirstMerge = nParameter % 2;
133 bool fMspfMerge = fMspf? (nParameter / 2) % 2: false;
134 bool fInner = (nParameter / 4) % 2;
135 bool fOuter = (nParameter / 8) % 2;
136 count -= t.RepeatAll(fFirstMerge, fMspfMerge, fMspf, fInner, fOuter);
137 break;
138 }
139 default:
140 std::cout << "Unknown transduction type " << nType << std::endl;
141 }
142 assert(t.Verify());
143 assert(count == t.CountWires());
144 return t.GenerateAig();
145}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManTransferMapping()

void Gia_ManTransferMapping ( Gia_Man_t * p,
Gia_Man_t * pGia )
extern

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

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

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

SideEffects []

SeeAlso []

Definition at line 2305 of file giaIf.c.

2306{
2307 Gia_Obj_t * pObj;
2308 int i, k, iFan, iPlace;
2309 if ( !Gia_ManHasMapping(pGia) )
2310 return;
2311 Gia_ManMappingVerify( pGia );
2312 Vec_IntFreeP( &p->vMapping );
2313 p->vMapping = Vec_IntAlloc( 2 * Gia_ManObjNum(p) );
2314 Vec_IntFill( p->vMapping, Gia_ManObjNum(p), 0 );
2315 Gia_ManForEachLut( pGia, i )
2316 {
2317 if ( Gia_ObjValue(Gia_ManObj(pGia, i)) == ~0 ) // handle dangling LUT
2318 continue;
2319 assert( !Abc_LitIsCompl(Gia_ObjValue(Gia_ManObj(pGia, i))) );
2320 pObj = Gia_ManObj( p, Abc_Lit2Var(Gia_ObjValue(Gia_ManObj(pGia, i))) );
2321 Vec_IntWriteEntry( p->vMapping, Gia_ObjId(p, pObj), Vec_IntSize(p->vMapping) );
2322 iPlace = Vec_IntSize( p->vMapping );
2323 Vec_IntPush( p->vMapping, Gia_ObjLutSize(pGia, i) );
2324 Gia_LutForEachFanin( pGia, i, iFan, k )
2325 {
2326 if ( Gia_ObjValue(Gia_ManObj(pGia, iFan)) == ~0 ) // handle dangling LUT fanin
2327 Vec_IntAddToEntry( p->vMapping, iPlace, -1 );
2328 else
2329 Vec_IntPush( p->vMapping, Abc_Lit2Var(Gia_ObjValue(Gia_ManObj(pGia, iFan))) );
2330 }
2331 iFan = Abc_Lit2Var( Gia_ObjValue(Gia_ManObj(pGia, Abc_AbsInt(Gia_ObjLutMuxId(pGia, i)))) );
2332 Vec_IntPush( p->vMapping, Gia_ObjLutIsMux(pGia, i) ? -iFan : iFan );
2333 }
2335}
void Gia_ManMappingVerify(Gia_Man_t *p)
Definition giaIf.c:2257
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManTransferPacking()

void Gia_ManTransferPacking ( Gia_Man_t * p,
Gia_Man_t * pGia )
extern

Definition at line 2336 of file giaIf.c.

2337{
2338 Vec_Int_t * vPackingNew;
2339 Gia_Obj_t * pObj, * pObjNew;
2340 int i, k, Entry, nEntries, nEntries2;
2341 if ( pGia->vPacking == NULL )
2342 return;
2343 nEntries = Vec_IntEntry( pGia->vPacking, 0 );
2344 nEntries2 = 0;
2345 // create new packing info
2346 vPackingNew = Vec_IntAlloc( Vec_IntSize(pGia->vPacking) );
2347 Vec_IntPush( vPackingNew, nEntries );
2348 Vec_IntForEachEntryStart( pGia->vPacking, Entry, i, 1 )
2349 {
2350 assert( Entry > 0 && Entry < 4 );
2351 Vec_IntPush( vPackingNew, Entry );
2352 i++;
2353 for ( k = 0; k < Entry; k++, i++ )
2354 {
2355 pObj = Gia_ManObj(pGia, Vec_IntEntry(pGia->vPacking, i));
2356 pObjNew = Gia_ManObj(p, Abc_Lit2Var(Gia_ObjValue(pObj)));
2357 assert( Gia_ObjIsLut(pGia, Gia_ObjId(pGia, pObj)) );
2358 assert( Gia_ObjIsLut(p, Gia_ObjId(p, pObjNew)) );
2359 Vec_IntPush( vPackingNew, Gia_ObjId(p, pObjNew) );
2360// printf( "%d -> %d ", Vec_IntEntry(pGia->vPacking, i), Gia_ObjId(p, pObjNew) );
2361 }
2362 i--;
2363 nEntries2++;
2364 }
2365 assert( nEntries == nEntries2 );
2366 // attach packing info
2367 assert( p->vPacking == NULL );
2368 p->vPacking = vPackingNew;
2369}
Here is the caller graph for this function:

◆ Gia_ManTransferTiming()

void Gia_ManTransferTiming ( Gia_Man_t * p,
Gia_Man_t * pGia )
extern

Definition at line 2370 of file giaIf.c.

2371{
2372 if ( p == pGia )
2373 return;
2374 if ( pGia->vCiArrs || pGia->vCoReqs || pGia->vCoArrs || pGia->vCoAttrs )
2375 {
2376 p->vCiArrs = pGia->vCiArrs; pGia->vCiArrs = NULL;
2377 p->vCoReqs = pGia->vCoReqs; pGia->vCoReqs = NULL;
2378 p->vCoArrs = pGia->vCoArrs; pGia->vCoArrs = NULL;
2379 p->vCoAttrs = pGia->vCoAttrs; pGia->vCoAttrs = NULL;
2380 p->And2Delay = pGia->And2Delay;
2381 }
2382 if ( pGia->vInArrs || pGia->vOutReqs )
2383 {
2384 p->vInArrs = pGia->vInArrs; pGia->vInArrs = NULL;
2385 p->vOutReqs = pGia->vOutReqs; pGia->vOutReqs = NULL;
2386 p->DefInArrs = pGia->DefInArrs;
2387 p->DefOutReqs = pGia->DefOutReqs;
2388 p->And2Delay = pGia->And2Delay;
2389 }
2390 if ( pGia->vNamesIn || pGia->vNamesOut || pGia->vNamesNode )
2391 {
2392 p->vNamesIn = pGia->vNamesIn; pGia->vNamesIn = NULL;
2393 p->vNamesOut = pGia->vNamesOut; pGia->vNamesOut = NULL;
2394 p->vNamesNode = pGia->vNamesNode; pGia->vNamesNode = NULL;
2395 }
2396 if ( pGia->vConfigs || pGia->pCellStr )
2397 {
2398 p->vConfigs = pGia->vConfigs; pGia->vConfigs = NULL;
2399 p->pCellStr = pGia->pCellStr; pGia->pCellStr = NULL;
2400 }
2401 if ( pGia->pManTime == NULL )
2402 return;
2403 p->pManTime = pGia->pManTime; pGia->pManTime = NULL;
2404 p->pAigExtra = pGia->pAigExtra; pGia->pAigExtra = NULL;
2405 p->vRegClasses = pGia->vRegClasses; pGia->vRegClasses = NULL;
2406 p->vRegInits = pGia->vRegInits; pGia->vRegInits = NULL;
2407 p->nAnd2Delay = pGia->nAnd2Delay; pGia->nAnd2Delay = 0;
2408}
Vec_Int_t * vCoAttrs
Definition gia.h:173
int And2Delay
Definition gia.h:175
Vec_Int_t * vCoArrs
Definition gia.h:172
float DefOutReqs
Definition gia.h:177
Vec_Int_t * vCoReqs
Definition gia.h:171
float DefInArrs
Definition gia.h:176
Vec_Int_t * vCiArrs
Definition gia.h:170
Here is the caller graph for this function:

◆ Gia_ManTransformMiter()

Gia_Man_t * Gia_ManTransformMiter ( Gia_Man_t * p)
extern

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

Synopsis [Transforms the circuit into a regular miter.]

Description []

SideEffects []

SeeAlso []

Definition at line 3376 of file giaDup.c.

3377{
3378 Gia_Man_t * pNew, * pTemp;
3379 Gia_Obj_t * pObj, * pObj2;
3380 int i, iLit;
3381 assert( (Gia_ManPoNum(p) & 1) == 0 );
3382 pNew = Gia_ManStart( Gia_ManObjNum(p) );
3383 pNew->pName = Abc_UtilStrsav( p->pName );
3384 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
3385 Gia_ManConst0(p)->Value = 0;
3386 Gia_ManHashAlloc( pNew );
3387 Gia_ManForEachCi( p, pObj, i )
3388 pObj->Value = Gia_ManAppendCi( pNew );
3389 Gia_ManForEachAnd( p, pObj, i )
3390 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
3391 Gia_ManForEachPo( p, pObj, i )
3392 {
3393 pObj2 = Gia_ManPo( p, ++i );
3394 iLit = Gia_ManHashXor( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin0Copy(pObj2) );
3395 Gia_ManAppendCo( pNew, iLit );
3396 }
3397 Gia_ManForEachRi( p, pObj, i )
3398 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
3399 Gia_ManHashStop( pNew );
3400 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
3401 pNew = Gia_ManCleanup( pTemp = pNew );
3402 Gia_ManStop( pTemp );
3403 if ( p->vNamesIn )
3404 pNew->vNamesIn = Vec_PtrDupStr(p->vNamesIn);
3405 if ( p->vNamesOut )
3406 pNew->vNamesOut = Gia_ManMiterNames(p->vNamesOut, Gia_ManPoNum(p));
3407 return pNew;
3408}
Vec_Ptr_t * Gia_ManMiterNames(Vec_Ptr_t *p, int nOuts)
Definition giaDup.c:3309
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManTransformMiter2()

Gia_Man_t * Gia_ManTransformMiter2 ( Gia_Man_t * p)
extern

Definition at line 3409 of file giaDup.c.

3410{
3411 Gia_Man_t * pNew, * pTemp;
3412 Gia_Obj_t * pObj, * pObj2;
3413 int i, iLit, nPart = Gia_ManPoNum(p)/2;
3414 assert( (Gia_ManPoNum(p) & 1) == 0 );
3415 pNew = Gia_ManStart( Gia_ManObjNum(p) );
3416 pNew->pName = Abc_UtilStrsav( p->pName );
3417 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
3418 Gia_ManConst0(p)->Value = 0;
3419 Gia_ManHashAlloc( pNew );
3420 Gia_ManForEachCi( p, pObj, i )
3421 pObj->Value = Gia_ManAppendCi( pNew );
3422 Gia_ManForEachAnd( p, pObj, i )
3423 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
3424 Gia_ManForEachPo( p, pObj, i )
3425 {
3426 if ( i == nPart )
3427 break;
3428 pObj2 = Gia_ManPo( p, nPart + i );
3429 iLit = Gia_ManHashXor( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin0Copy(pObj2) );
3430 Gia_ManAppendCo( pNew, iLit );
3431 }
3432 Gia_ManForEachRi( p, pObj, i )
3433 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
3434 Gia_ManHashStop( pNew );
3435 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
3436 pNew = Gia_ManCleanup( pTemp = pNew );
3437 Gia_ManStop( pTemp );
3438 return pNew;
3439}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManTransformToDual()

Gia_Man_t * Gia_ManTransformToDual ( Gia_Man_t * p)
extern

Definition at line 3440 of file giaDup.c.

3441{
3442 Gia_Man_t * pNew;
3443 Gia_Obj_t * pObj;
3444 int i;
3445 pNew = Gia_ManStart( Gia_ManObjNum(p) );
3446 pNew->pName = Abc_UtilStrsav( p->pName );
3447 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
3448 Gia_ManConst0(p)->Value = 0;
3449 Gia_ManHashAlloc( pNew );
3450 Gia_ManForEachCi( p, pObj, i )
3451 pObj->Value = Gia_ManAppendCi( pNew );
3452 Gia_ManForEachAnd( p, pObj, i )
3453 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
3454 Gia_ManForEachPo( p, pObj, i )
3455 {
3456 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
3457 Gia_ManAppendCo( pNew, 0 );
3458 }
3459 Gia_ManForEachRi( p, pObj, i )
3460 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
3461 Gia_ManHashStop( pNew );
3462 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
3463 return pNew;
3464}
Here is the call graph for this function:

◆ Gia_ManTransformTwoWord2DualOutput()

Gia_Man_t * Gia_ManTransformTwoWord2DualOutput ( Gia_Man_t * p)
extern

Definition at line 3465 of file giaDup.c.

3466{
3467 Gia_Man_t * pNew, * pTemp;
3468 Gia_Obj_t * pObj, * pObj2;
3469 int i, nPart = Gia_ManPoNum(p)/2;
3470 assert( (Gia_ManPoNum(p) & 1) == 0 );
3471 pNew = Gia_ManStart( Gia_ManObjNum(p) );
3472 pNew->pName = Abc_UtilStrsav( p->pName );
3473 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
3474 Gia_ManConst0(p)->Value = 0;
3475 Gia_ManHashAlloc( pNew );
3476 Gia_ManForEachCi( p, pObj, i )
3477 pObj->Value = Gia_ManAppendCi( pNew );
3478 Gia_ManForEachAnd( p, pObj, i )
3479 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
3480 Gia_ManForEachPo( p, pObj, i )
3481 {
3482 if ( i == nPart )
3483 break;
3484 pObj2 = Gia_ManPo( p, nPart + i );
3485 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
3486 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj2) );
3487 }
3488 Gia_ManForEachRi( p, pObj, i )
3489 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
3490 Gia_ManHashStop( pNew );
3491 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
3492 pNew = Gia_ManCleanup( pTemp = pNew );
3493 Gia_ManStop( pTemp );
3494 return pNew;
3495}
Here is the call graph for this function:

◆ Gia_ManTtopt()

Gia_Man_t * Gia_ManTtopt ( Gia_Man_t * p,
int nIns,
int nOuts,
int nRounds )
extern

Definition at line 1109 of file giaTtopt.cpp.

1110{
1111 Gia_Man_t * pNew;
1112 Gia_Obj_t * pObj;
1113 Vec_Int_t * vSupp;
1114 word v;
1115 word * pTruth;
1116 int i, g, k, nInputs;
1117 Gia_ManLevelNum( p );
1118 pNew = Gia_ManStart( Gia_ManObjNum(p) );
1119 pNew->pName = Abc_UtilStrsav( p->pName );
1120 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1121 Gia_ManForEachCi( p, pObj, k )
1122 Gia_ManAppendCi( pNew );
1124 Gia_ManHashStart( pNew );
1125 for ( g = 0; g < Gia_ManCoNum(p); g += nOuts )
1126 {
1127 vSupp = Gia_ManCollectSuppNew( p, g, nOuts );
1128 nInputs = Vec_IntSize( vSupp );
1129 Ttopt::TruthTableReo tt( nInputs, nOuts );
1130 for ( k = 0; k < nOuts; k++ )
1131 {
1132 pObj = Gia_ManCo( p, g+k );
1133 pTruth = Gia_ObjComputeTruthTableCut( p, Gia_ObjFanin0(pObj), vSupp );
1134 if ( nInputs >= 6 )
1135 for ( i = 0; i < tt.nSize; i++ )
1136 tt.t[i + tt.nSize * k] = Gia_ObjFaninC0(pObj)? ~pTruth[i]: pTruth[i];
1137 else
1138 {
1139 i = k * (1 << nInputs);
1140 v = (Gia_ObjFaninC0(pObj)? ~pTruth[0]: pTruth[0]) & tt.ones[nInputs];
1141 tt.t[i / tt.ww] |= v << (i % tt.ww);
1142 }
1143 }
1144 tt.RandomSiftReo( nRounds );
1145 Ttopt::TruthTable tt2( nInputs, nOuts );
1146 tt2.t = tt.t;
1147 tt2.Reo( tt.vLevels );
1148 tt2.BDDGenerateAig( pNew, vSupp );
1149 Vec_IntFree( vSupp );
1150 }
1152 Gia_ManHashStop( pNew );
1153 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
1154 return pNew;
1155}
word * Gia_ObjComputeTruthTableCut(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vLeaves)
Definition giaTruth.c:628
void Gia_ObjComputeTruthTableStart(Gia_Man_t *p, int nVarsMax)
Definition giaTruth.c:552
Vec_Int_t * Gia_ManCollectSuppNew(Gia_Man_t *p, int iOut, int nOuts)
Definition giaMinLut.c:632
void Gia_ObjComputeTruthTableStop(Gia_Man_t *p)
Definition giaTruth.c:568
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManTtoptCare()

Gia_Man_t * Gia_ManTtoptCare ( Gia_Man_t * p,
int nIns,
int nOuts,
int nRounds,
char * pFileName,
int nRarity )
extern

Definition at line 1157 of file giaTtopt.cpp.

1158{
1159 int fVerbose = 0;
1160 Gia_Man_t * pNew;
1161 Gia_Obj_t * pObj;
1162 Vec_Int_t * vSupp;
1163 word v;
1164 word * pTruth, * pCare;
1165 int i, g, k, nInputs;
1166 Vec_Wrd_t * vSimI = Vec_WrdReadBin( pFileName, fVerbose );
1167 Gia_ManLevelNum( p );
1168 pNew = Gia_ManStart( Gia_ManObjNum(p) );
1169 pNew->pName = Abc_UtilStrsav( p->pName );
1170 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1171 Gia_ManForEachCi( p, pObj, k )
1172 Gia_ManAppendCi( pNew );
1174 Gia_ManHashStart( pNew );
1175 for ( g = 0; g < Gia_ManCoNum(p); g += nOuts )
1176 {
1177 vSupp = Gia_ManCollectSuppNew( p, g, nOuts );
1178 nInputs = Vec_IntSize( vSupp );
1179 if ( nInputs == 0 )
1180 {
1181 for ( k = 0; k < nOuts; k++ )
1182 {
1183 pObj = Gia_ManCo( p, g+k );
1184 pTruth = Gia_ObjComputeTruthTableCut( p, Gia_ObjFanin0(pObj), vSupp );
1185 Gia_ManAppendCo( pNew, pTruth[0] & 1 );
1186 }
1187 Vec_IntFree( vSupp );
1188 continue;
1189 }
1190 Ttopt::TruthTableLevelTSM tt( nInputs, nOuts );
1191 for ( k = 0; k < nOuts; k++ )
1192 {
1193 pObj = Gia_ManCo( p, g+k );
1194 pTruth = Gia_ObjComputeTruthTableCut( p, Gia_ObjFanin0(pObj), vSupp );
1195 if ( nInputs >= 6 )
1196 for ( i = 0; i < tt.nSize; i++ )
1197 tt.t[i + tt.nSize * k] = Gia_ObjFaninC0(pObj)? ~pTruth[i]: pTruth[i];
1198 else
1199 {
1200 i = k * (1 << nInputs);
1201 v = (Gia_ObjFaninC0(pObj)? ~pTruth[0]: pTruth[0]) & tt.ones[nInputs];
1202 tt.t[i / tt.ww] |= v << (i % tt.ww);
1203 }
1204 }
1205 i = 1 << Vec_IntSize( vSupp );
1206 pCare = Gia_ManCountFraction( p, vSimI, vSupp, nRarity, fVerbose, &i );
1207 tt.care[0] = pCare[0];
1208 for ( i = 1; i < tt.nSize; i++ )
1209 tt.care[i] = pCare[i];
1210 ABC_FREE( pCare );
1211 tt.RandomSiftReo( nRounds );
1212 tt.Optimize();
1213 tt.BDDGenerateAig( pNew, vSupp );
1214 Vec_IntFree( vSupp );
1215 }
1217 Gia_ManHashStop( pNew );
1218 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
1219 Vec_WrdFreeP( &vSimI );
1220 return pNew;
1221}
word * Gia_ManCountFraction(Gia_Man_t *p, Vec_Wrd_t *vSimI, Vec_Int_t *vSupp, int Thresh, int fVerbose, int *pCare)
Definition giaMinLut.c:531
Here is the call graph for this function:

◆ Gia_ManUnrollAbs()

Vec_Ptr_t * Gia_ManUnrollAbs ( Gia_Man_t * p,
int nFrames )
extern

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}
Gia_Man_t * Gia_ManUnrollDup(Gia_Man_t *p, Vec_Int_t *vLimit)
Definition giaFrames.c:107
Here is the call graph for this function:

◆ Gia_ManUnrollAdd()

void * Gia_ManUnrollAdd ( void * pMan,
int fMax )
extern

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 = 0, 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}
struct Gia_ManUnr_t_ Gia_ManUnr_t
Definition giaFrames.c:41
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManUnrollAndCofactor()

Gia_Man_t * Gia_ManUnrollAndCofactor ( Gia_Man_t * p,
int nFrames,
int nFanMax,
int fVerbose )
extern

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}
Gia_Man_t * Gia_ManUnrollInit(Gia_Man_t *p, int nFrames)
Definition giaEnable.c:360
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
Vec_Int_t * Gia_ManDetectSeqSignalsWithFanout(Gia_Man_t *p, int nFanMax, int fVerbose)
Definition giaEnable.c:224
Gia_Man_t * Gia_ManDupCofAllInt(Gia_Man_t *p, Vec_Int_t *vSigs, int fVerbose)
Definition giaCof.c:936
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManUnrollDup()

Gia_Man_t * Gia_ManUnrollDup ( Gia_Man_t * p,
Vec_Int_t * vLimit )
extern

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
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_ManUnrollDup_rec(Gia_Man_t *pNew, Gia_Obj_t *pObj, int Id)
FUNCTION DEFINITIONS ///.
Definition giaFrames.c:75
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManUnrollLastLit()

int Gia_ManUnrollLastLit ( void * pMan)
extern

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}
Here is the caller graph for this function:

◆ Gia_ManUnrollStart()

void * Gia_ManUnrollStart ( Gia_Man_t * pAig,
Gia_ParFra_t * pPars )
extern

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}
Gia_ManUnr_t * Gia_ManUnrStart(Gia_Man_t *pAig, Gia_ParFra_t *pPars)
Definition giaFrames.c:225
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManUnrollStop()

void Gia_ManUnrollStop ( void * pMan)
extern

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}
void Gia_ManStopP(Gia_Man_t **p)
Definition giaMan.c:224
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManUpdateCopy()

void Gia_ManUpdateCopy ( Vec_Int_t * vCopy,
Gia_Man_t * p )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 2352 of file giaUtil.c.

2353{
2354 Gia_Obj_t * pObj;
2355 int i, iLit;
2356 Vec_IntForEachEntry( vCopy, iLit, i )
2357 {
2358 if ( iLit == -1 )
2359 continue;
2360 pObj = Gia_ManObj( p, Abc_Lit2Var(iLit) );
2361 if ( !~pObj->Value )
2362 Vec_IntWriteEntry( vCopy, i, -1 );
2363 else
2364 Vec_IntWriteEntry( vCopy, i, Abc_LitNotCond(pObj->Value, Abc_LitIsCompl(iLit)) );
2365 }
2366}
Here is the caller graph for this function:

◆ Gia_ManUpdateExtraAig()

Gia_Man_t * Gia_ManUpdateExtraAig ( void * pTime,
Gia_Man_t * p,
Vec_Int_t * vBoxPres )
extern

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

Synopsis [Update AIG of the holes.]

Description []

SideEffects []

SeeAlso []

Definition at line 694 of file giaTim.c.

695{
696 Gia_Man_t * pNew;
697 Tim_Man_t * pManTime = (Tim_Man_t *)pTime;
698 Vec_Int_t * vOutPres = Vec_IntAlloc( 100 );
699 int i, k, curPo = 0;
700 assert( Vec_IntSize(vBoxPres) == Tim_ManBoxNum(pManTime) );
701 assert( Gia_ManCoNum(p) == Tim_ManCiNum(pManTime) - Tim_ManPiNum(pManTime) );
702 for ( i = 0; i < Tim_ManBoxNum(pManTime); i++ )
703 {
704 for ( k = 0; k < Tim_ManBoxOutputNum(pManTime, i); k++ )
705 Vec_IntPush( vOutPres, Vec_IntEntry(vBoxPres, i) );
706 curPo += Tim_ManBoxOutputNum(pManTime, i);
707 }
708 assert( curPo == Gia_ManCoNum(p) );
709 pNew = Gia_ManDupOutputVec( p, vOutPres );
710 Vec_IntFree( vOutPres );
711 return pNew;
712}
Gia_Man_t * Gia_ManDupOutputVec(Gia_Man_t *p, Vec_Int_t *vOutPres)
Definition giaDup.c:342
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManUpdateExtraAig2()

Gia_Man_t * Gia_ManUpdateExtraAig2 ( void * pTime,
Gia_Man_t * pAig,
Vec_Int_t * vBoxesLeft )
extern

Definition at line 713 of file giaTim.c.

714{
715 Gia_Man_t * pNew;
716 Tim_Man_t * pManTime = (Tim_Man_t *)pTime;
717 int nRealPis = Tim_ManPiNum(pManTime);
718 Vec_Int_t * vOutsLeft = Vec_IntAlloc( 100 );
719 int i, k, iBox, iOutFirst;
720 assert( Vec_IntSize(vBoxesLeft) <= Tim_ManBoxNum(pManTime) );
721 assert( Gia_ManCoNum(p) == Tim_ManCiNum(pManTime) - nRealPis );
722 Vec_IntForEachEntry( vBoxesLeft, iBox, i )
723 {
724 iOutFirst = Tim_ManBoxOutputFirst(pManTime, iBox) - nRealPis;
725 for ( k = 0; k < Tim_ManBoxOutputNum(pManTime, iBox); k++ )
726 Vec_IntPush( vOutsLeft, iOutFirst + k );
727 }
728 pNew = Gia_ManDupSelectedOutputs( p, vOutsLeft );
729 Vec_IntFree( vOutsLeft );
730 return pNew;
731}
Gia_Man_t * Gia_ManDupSelectedOutputs(Gia_Man_t *p, Vec_Int_t *vOutsLeft)
Definition giaDup.c:376
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManUpdateMapping()

void Gia_ManUpdateMapping ( Gia_Man_t * p,
Vec_Int_t * vNodes,
Vec_Wec_t * vWin )
extern

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

Synopsis [Finds edge assignment.]

Description []

SideEffects []

SeeAlso []

Definition at line 610 of file giaEdge.c.

611{
612 int i, iNode;
613 Vec_IntForEachEntry( vNodes, iNode, i )
614 ABC_SWAP( Vec_Int_t, *Vec_WecEntry(p->vMapping2, iNode), *Vec_WecEntry(vWin, i) );
615}
Here is the caller graph for this function:

◆ Gia_ManUpdateTimMan()

void * Gia_ManUpdateTimMan ( Gia_Man_t * p,
Vec_Int_t * vBoxPres )
extern

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

Synopsis [Update hierarchy/timing manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 668 of file giaTim.c.

669{
670 Tim_Man_t * pManTime = (Tim_Man_t *)p->pManTime;
671 assert( pManTime != NULL );
672 assert( Vec_IntSize(vBoxPres) == Tim_ManBoxNum(pManTime) );
673 return Tim_ManTrim( pManTime, vBoxPres );
674}
Tim_Man_t * Tim_ManTrim(Tim_Man_t *p, Vec_Int_t *vBoxPres)
Definition timMan.c:166
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManUpdateTimMan2()

void * Gia_ManUpdateTimMan2 ( Gia_Man_t * p,
Vec_Int_t * vBoxesLeft,
int nTermsDiff )
extern

Definition at line 675 of file giaTim.c.

676{
677 Tim_Man_t * pManTime = (Tim_Man_t *)p->pManTime;
678 assert( pManTime != NULL );
679 assert( Vec_IntSize(vBoxesLeft) <= Tim_ManBoxNum(pManTime) );
680 return Tim_ManReduce( pManTime, vBoxesLeft, nTermsDiff );
681}
Tim_Man_t * Tim_ManReduce(Tim_Man_t *p, Vec_Int_t *vBoxesLeft, int nTermsDiff)
Definition timMan.c:254
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManVerifyCex()

int Gia_ManVerifyCex ( Gia_Man_t * pAig,
Abc_Cex_t * p,
int fDualOut )
extern

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 48 of file giaCex.c.

49{
50 Gia_Obj_t * pObj, * pObjRi, * pObjRo;
51 int RetValue, i, k, iBit = 0;
53 Gia_ManForEachRo( pAig, pObj, i )
54 pObj->fMark0 = Abc_InfoHasBit(p->pData, iBit++);
55 for ( i = 0; i <= p->iFrame; i++ )
56 {
57 Gia_ManForEachPi( pAig, pObj, k )
58 pObj->fMark0 = Abc_InfoHasBit(p->pData, iBit++);
59 Gia_ManForEachAnd( pAig, pObj, k )
60 pObj->fMark0 = (Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj)) &
61 (Gia_ObjFanin1(pObj)->fMark0 ^ Gia_ObjFaninC1(pObj));
62 Gia_ManForEachCo( pAig, pObj, k )
63 pObj->fMark0 = Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj);
64 if ( i == p->iFrame )
65 break;
66 Gia_ManForEachRiRo( pAig, pObjRi, pObjRo, k )
67 {
68 pObjRo->fMark0 = pObjRi->fMark0;
69 }
70 }
71 assert( iBit == p->nBits );
72 if ( fDualOut )
73 RetValue = Gia_ManPo(pAig, 2*p->iPo)->fMark0 ^ Gia_ManPo(pAig, 2*p->iPo+1)->fMark0;
74 else
75 RetValue = Gia_ManPo(pAig, p->iPo)->fMark0;
77 return RetValue;
78}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManVerifyWithBoxes()

int Gia_ManVerifyWithBoxes ( Gia_Man_t * pGia,
int nBTLimit,
int nTimeLim,
int fSeq,
int fDumpFiles,
int fVerbose,
char * pFileSpec )
extern

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

Synopsis [Verify XAIG against its spec.]

Description []

SideEffects []

SeeAlso []

Definition at line 955 of file giaTim.c.

956{
957 int Status = -1;
958 Gia_Man_t * pSpec, * pGia0, * pGia1, * pMiter;
959 Vec_Int_t * vBoxPres = NULL;
960 if ( pFileSpec == NULL && pGia->pSpec == NULL )
961 {
962 printf( "Spec file is not given. Use standard flow.\n" );
963 return Status;
964 }
965 if ( Gia_ManBoxNum(pGia) && pGia->pAigExtra == NULL )
966 {
967 printf( "Design has no box logic. Use standard flow.\n" );
968 return Status;
969 }
970 // read original AIG
971 pSpec = Gia_AigerRead( pFileSpec ? pFileSpec : pGia->pSpec, 0, 0, 0 );
972 if ( Gia_ManBoxNum(pSpec) && pSpec->pAigExtra == NULL )
973 {
974 Gia_ManStop( pSpec );
975 printf( "Spec has no box logic. Use standard flow.\n" );
976 return Status;
977 }
978 // prepare miter
979 if ( pGia->pManTime == NULL && pSpec->pManTime == NULL )
980 {
981 pGia0 = Gia_ManDup( pSpec );
982 pGia1 = Gia_ManDup( pGia );
983 }
984 else
985 {
986 // if timing managers have different number of black boxes,
987 // it is possible that some of the boxes are swept away
988 if ( pSpec->pManTime && Tim_ManBlackBoxNum((Tim_Man_t *)pSpec->pManTime) > 0 && Gia_ManBoxNum(pGia) > 0 )
989 {
990 // specification cannot have fewer boxes than implementation
991 if ( Gia_ManBoxNum(pSpec) < Gia_ManBoxNum(pGia) )
992 {
993 printf( "Spec has less boxes than the design. Cannot proceed.\n" );
994 return Status;
995 }
996 // to align the boxes, find what boxes of pSpec are dropped in pGia
997 if ( Gia_ManBoxNum(pSpec) > Gia_ManBoxNum(pGia) )
998 {
999 vBoxPres = Tim_ManAlignTwo( (Tim_Man_t *)pSpec->pManTime, (Tim_Man_t *)pGia->pManTime );
1000 if ( vBoxPres == NULL )
1001 {
1002 printf( "Boxes of spec and design cannot be aligned. Cannot proceed.\n" );
1003 return Status;
1004 }
1005 }
1006 }
1007 // collapse two designs
1008 if ( Gia_ManBoxNum(pSpec) > 0 )
1009 pGia0 = Gia_ManDupCollapse( pSpec, pSpec->pAigExtra, vBoxPres, fSeq );
1010 else
1011 pGia0 = Gia_ManDup( pSpec );
1012 if ( Gia_ManBoxNum(pGia) > 0 )
1013 pGia1 = Gia_ManDupCollapse( pGia, pGia->pAigExtra, NULL, fSeq );
1014 else
1015 pGia1 = Gia_ManDup( pGia );
1016 Vec_IntFreeP( &vBoxPres );
1017 }
1018 if ( fDumpFiles )
1019 {
1020 char pFileName0[1000], pFileName1[1000];
1021 char * pNameGeneric = Extra_FileNameGeneric( pFileSpec ? pFileSpec : pGia->pSpec );
1022 sprintf( pFileName0, "%s_spec.aig", pNameGeneric );
1023 sprintf( pFileName1, "%s_impl.aig", pNameGeneric );
1024 Gia_AigerWrite( pGia0, pFileName0, 0, 0, 0 );
1025 Gia_AigerWrite( pGia1, pFileName1, 0, 0, 0 );
1026 ABC_FREE( pNameGeneric );
1027 printf( "Dumped two parts of the miter into files \"%s\" and \"%s\".\n", pFileName0, pFileName1 );
1028 }
1029 // compute the miter
1030 if ( fSeq )
1031 {
1032 pMiter = Gia_ManMiter( pGia0, pGia1, 0, 0, 1, 0, fVerbose );
1033 if ( pMiter )
1034 {
1035 Aig_Man_t * pMan;
1036 Fra_Sec_t SecPar, * pSecPar = &SecPar;
1037 Fra_SecSetDefaultParams( pSecPar );
1038 pSecPar->fRetimeFirst = 0;
1039 pSecPar->nBTLimit = nBTLimit;
1040 pSecPar->TimeLimit = nTimeLim;
1041 pSecPar->fVerbose = fVerbose;
1042 pMan = Gia_ManToAig( pMiter, 0 );
1043 Gia_ManStop( pMiter );
1044 Status = Fra_FraigSec( pMan, pSecPar, NULL );
1045 Aig_ManStop( pMan );
1046 }
1047 }
1048 else
1049 {
1050 pMiter = Gia_ManMiter( pGia0, pGia1, 0, 1, 0, 0, fVerbose );
1051 if ( pMiter )
1052 {
1053 Cec_ParCec_t ParsCec, * pPars = &ParsCec;
1055 pPars->nBTLimit = nBTLimit;
1056 pPars->TimeLimit = nTimeLim;
1057 pPars->fVerbose = fVerbose;
1058 Status = Cec_ManVerify( pMiter, pPars );
1059 if ( pPars->iOutFail >= 0 )
1060 Abc_Print( 1, "Verification failed for at least one output (%d).\n", pPars->iOutFail );
1061 Gia_ManStop( pMiter );
1062 }
1063 }
1064 Gia_ManStop( pGia0 );
1065 Gia_ManStop( pGia1 );
1066 Gia_ManStop( pSpec );
1067 return Status;
1068}
void Aig_ManStop(Aig_Man_t *p)
Definition aigMan.c:187
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition aig.h:50
void Cec_ManCecSetDefaultParams(Cec_ParCec_t *p)
Definition cecCore.c:159
struct Cec_ParCec_t_ Cec_ParCec_t
Definition cec.h:129
int Cec_ManVerify(Gia_Man_t *p, Cec_ParCec_t *pPars)
MACRO DEFINITIONS ///.
Definition cecCec.c:326
void Fra_SecSetDefaultParams(Fra_Sec_t *p)
DECLARATIONS ///.
Definition fraSec.c:52
struct Fra_Sec_t_ Fra_Sec_t
Definition fra.h:55
int Fra_FraigSec(Aig_Man_t *p, Fra_Sec_t *pParSec, Aig_Man_t **ppResult)
Definition fraSec.c:118
Aig_Man_t * Gia_ManToAig(Gia_Man_t *p, int fChoices)
Definition giaAig.c:318
Gia_Man_t * Gia_ManDupCollapse(Gia_Man_t *p, Gia_Man_t *pBoxes, Vec_Int_t *vBoxPres, int fSeq)
Definition giaTim.c:802
int nBTLimit
Definition cec.h:132
int iOutFail
Definition cec.h:141
int TimeLimit
Definition cec.h:133
int fVerbose
Definition cec.h:140
int nBTLimit
Definition fra.h:119
int fVerbose
Definition fra.h:139
int fRetimeFirst
Definition fra.h:127
int TimeLimit
Definition fra.h:141
Vec_Int_t * Tim_ManAlignTwo(Tim_Man_t *pSpec, Tim_Man_t *pImpl)
Definition timMan.c:347
Here is the call graph for this function:

◆ Gia_ManWriteMiniAig()

void Gia_ManWriteMiniAig ( Gia_Man_t * pGia,
char * pFileName )
extern

Definition at line 237 of file giaMini.c.

238{
239 Mini_Aig_t * p = Gia_ManToMiniAig( pGia );
240 Mini_AigDump( p, pFileName );
241 //Mini_AigDumpVerilog( "test_miniaig.v", "top", p );
242 Mini_AigStop( p );
243}
Mini_Aig_t * Gia_ManToMiniAig(Gia_Man_t *pGia)
Definition giaMini.c:118
Here is the call graph for this function:

◆ Gia_ManWriteMiniLut()

void Gia_ManWriteMiniLut ( Gia_Man_t * pGia,
char * pFileName )
extern

Definition at line 596 of file giaMini.c.

597{
598 Mini_Lut_t * p = Gia_ManToMiniLut( pGia );
599 Mini_LutDump( p, pFileName );
600 Mini_LutStop( p );
601}
Mini_Lut_t * Gia_ManToMiniLut(Gia_Man_t *pGia)
Definition giaMini.c:411
Here is the call graph for this function:

◆ Gia_MmFixedEntryFetch()

char * Gia_MmFixedEntryFetch ( Gia_MmFixed_t * p)
extern

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}
Here is the caller graph for this function:

◆ Gia_MmFixedEntryRecycle()

void Gia_MmFixedEntryRecycle ( Gia_MmFixed_t * p,
char * pEntry )
extern

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}
Here is the caller graph for this function:

◆ Gia_MmFixedReadMaxEntriesUsed()

int Gia_MmFixedReadMaxEntriesUsed ( Gia_MmFixed_t * p)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 287 of file giaMem.c.

288{
289 return p->nEntriesMax;
290}

◆ Gia_MmFixedReadMemUsage()

int Gia_MmFixedReadMemUsage ( Gia_MmFixed_t * p)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 271 of file giaMem.c.

272{
273 return p->nMemoryAlloc;
274}

◆ Gia_MmFixedRestart()

void Gia_MmFixedRestart ( Gia_MmFixed_t * p)
extern

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}

◆ Gia_MmFixedStart()

Gia_MmFixed_t * Gia_MmFixedStart ( int nEntrySize,
int nEntriesMax )
extern

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{
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}
struct Gia_MmFixed_t_ Gia_MmFixed_t
BASIC TYPES ///.
Definition gia.h:52
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_MmFixedStop()

void Gia_MmFixedStop ( Gia_MmFixed_t * p,
int fVerbose )
extern

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",
142 p->nEntriesUsed, p->nEntriesMax, p->nEntrySize * p->nEntriesUsed, p->nMemoryAlloc );
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}
Here is the caller graph for this function:

◆ Gia_MmFlexEntryFetch()

char * Gia_MmFlexEntryFetch ( Gia_MmFlex_t * p,
int nBytes )
extern

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}

◆ Gia_MmFlexReadMemUsage()

int Gia_MmFlexReadMemUsage ( Gia_MmFlex_t * p)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 439 of file giaMem.c.

440{
441 return p->nMemoryUsed;
442}

◆ Gia_MmFlexRestart()

void Gia_MmFlexRestart ( Gia_MmFlex_t * p)
extern

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}

◆ Gia_MmFlexStart()

Gia_MmFlex_t * Gia_MmFlexStart ( )
extern

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}
struct Gia_MmFlex_t_ Gia_MmFlex_t
Definition gia.h:53
Here is the call graph for this function:

◆ Gia_MmFlexStop()

void Gia_MmFlexStop ( Gia_MmFlex_t * p,
int fVerbose )
extern

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",
347 p->nEntriesUsed, p->nMemoryUsed, p->nMemoryAlloc );
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}

◆ Gia_MmStepEntryFetch()

char * Gia_MmStepEntryFetch ( Gia_MmStep_t * p,
int nBytes )
extern

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}
char * Gia_MmFixedEntryFetch(Gia_MmFixed_t *p)
Definition giaMem.c:161
Here is the call graph for this function:

◆ Gia_MmStepEntryRecycle()

void Gia_MmStepEntryRecycle ( Gia_MmStep_t * p,
char * pEntry,
int nBytes )
extern

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}
void Gia_MmFixedEntryRecycle(Gia_MmFixed_t *p, char *pEntry)
Definition giaMem.c:212
Here is the call graph for this function:

◆ Gia_MmStepReadMemUsage()

int Gia_MmStepReadMemUsage ( Gia_MmStep_t * p)
extern

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_MmStepStart()

Gia_MmStep_t * Gia_MmStepStart ( int nSteps)
extern

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}
Gia_MmFixed_t * Gia_MmFixedStart(int nEntrySize, int nEntriesMax)
FUNCTION DEFINITIONS ///.
Definition giaMem.c:96
struct Gia_MmStep_t_ Gia_MmStep_t
Definition gia.h:54
Here is the call graph for this function:

◆ Gia_MmStepStop()

void Gia_MmStepStop ( Gia_MmStep_t * p,
int fVerbose )
extern

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}
void Gia_MmFixedStop(Gia_MmFixed_t *p, int fVerbose)
Definition giaMem.c:132
Here is the call graph for this function:

◆ Gia_NodeMffcMapping()

int Gia_NodeMffcMapping ( Gia_Man_t * p)
extern

Definition at line 1324 of file giaUtil.c.

1325{
1326 int i, Id, Count = 0;
1327 int * pRefsOld;
1328 Vec_Int_t * vMapping, * vSupp = Vec_IntAlloc( 100 );
1329 vMapping = Vec_IntAlloc( 2 * Gia_ManObjNum(p) );
1330 Vec_IntFill( vMapping, Gia_ManObjNum(p), 0 );
1331 pRefsOld = p->pRefs; p->pRefs = NULL;
1332 Gia_ManCreateRefs( p );
1333 Gia_ManForEachCoDriverId( p, Id, i )
1334 Count += Gia_NodeMffcMapping_rec( p, Id, vMapping, vSupp );
1335 p->pRefs = pRefsOld;
1336 Vec_IntFree( vSupp );
1337 p->vMapping = vMapping;
1338 //printf( "Mapping is %.2fx larger than AIG manager.\n", 1.0*Vec_IntSize(vMapping)/Gia_ManObjNum(p) );
1339 return Count;
1340}
int Gia_NodeMffcMapping_rec(Gia_Man_t *p, int iObj, Vec_Int_t *vMapping, Vec_Int_t *vSupp)
Definition giaUtil.c:1306
void Gia_ManCreateRefs(Gia_Man_t *p)
Definition giaUtil.c:779
Here is the call graph for this function:

◆ Gia_NodeMffcSize()

int Gia_NodeMffcSize ( Gia_Man_t * p,
Gia_Obj_t * pNode )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 1230 of file giaUtil.c.

1231{
1232 int ConeSize1, ConeSize2;
1233 assert( !Gia_IsComplement(pNode) );
1234 assert( Gia_ObjIsCand(pNode) );
1235 ConeSize1 = Gia_NodeDeref_rec( p, pNode );
1236 ConeSize2 = Gia_NodeRef_rec( p, pNode, 0 );
1237 assert( ConeSize1 == ConeSize2 );
1238 assert( ConeSize1 >= 0 );
1239 return ConeSize1;
1240}
int Gia_NodeDeref_rec(Gia_Man_t *p, Gia_Obj_t *pNode)
Definition giaUtil.c:1155
int Gia_NodeRef_rec(Gia_Man_t *p, Gia_Obj_t *pNode, int fMark)
Definition giaUtil.c:1184
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_NodeMffcSizeMark()

int Gia_NodeMffcSizeMark ( Gia_Man_t * p,
Gia_Obj_t * pNode )
extern

Definition at line 1241 of file giaUtil.c.

1242{
1243 int ConeSize1, ConeSize2;
1244 assert( !Gia_IsComplement(pNode) );
1245 assert( Gia_ObjIsCand(pNode) );
1246 ConeSize1 = Gia_NodeDeref_rec( p, pNode );
1248 ConeSize2 = Gia_NodeRef_rec( p, pNode, 1 );
1249 assert( ConeSize1 == ConeSize2 );
1250 assert( ConeSize1 >= 0 );
1251 return ConeSize1;
1252}
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition giaUtil.c:190
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_NodeMffcSizeSupp()

int Gia_NodeMffcSizeSupp ( Gia_Man_t * p,
Gia_Obj_t * pNode,
Vec_Int_t * vSupp )
extern

Definition at line 1279 of file giaUtil.c.

1280{
1281 int ConeSize1, ConeSize2;
1282 assert( !Gia_IsComplement(pNode) );
1283 assert( Gia_ObjIsAnd(pNode) );
1284 Vec_IntClear( vSupp );
1286 ConeSize1 = Gia_NodeDeref_rec( p, pNode );
1287 Gia_NodeCollect_rec( p, Gia_ObjFanin0(pNode), vSupp );
1288 Gia_NodeCollect_rec( p, Gia_ObjFanin1(pNode), vSupp );
1289 ConeSize2 = Gia_NodeRef_rec( p, pNode, 0 );
1290 assert( ConeSize1 == ConeSize2 );
1291 assert( ConeSize1 >= 0 );
1292 return ConeSize1;
1293}
void Gia_NodeCollect_rec(Gia_Man_t *p, Gia_Obj_t *pNode, Vec_Int_t *vSupp)
Definition giaUtil.c:1265
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ObjAddFanout()

void Gia_ObjAddFanout ( Gia_Man_t * p,
Gia_Obj_t * pObj,
Gia_Obj_t * pFanout )
extern

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(p, 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}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ObjCheckEdge()

int Gia_ObjCheckEdge ( Gia_Man_t * p,
int iObj,
int iNext )
extern

Definition at line 172 of file giaEdge.c.

173{
174 return Gia_ObjHaveEdge( p, iObj, iNext );
175}
Here is the caller graph for this function:

◆ Gia_ObjCheckMffc()

int Gia_ObjCheckMffc ( Gia_Man_t * p,
Gia_Obj_t * pRoot,
int Limit,
Vec_Int_t * vNodes,
Vec_Int_t * vLeaves,
Vec_Int_t * vInners )
extern

Definition at line 71 of file giaResub.c.

72{
73 int RetValue, iObj, i;
74 Vec_IntClear( vNodes );
75 RetValue = Gia_ObjCheckMffc_rec( p, pRoot, Limit, vNodes );
76 if ( RetValue )
77 {
78 Vec_IntClear( vLeaves );
79 Vec_IntClear( vInners );
80 Vec_IntSort( vNodes, 0 );
81 Vec_IntForEachEntry( vNodes, iObj, i )
82 if ( Gia_ObjRefNumId(p, iObj) > 0 || Gia_ObjIsCi(Gia_ManObj(p, iObj)) )
83 {
84 if ( !Vec_IntSize(vLeaves) || Vec_IntEntryLast(vLeaves) != iObj )
85 Vec_IntPush( vLeaves, iObj );
86 }
87 else
88 {
89 if ( !Vec_IntSize(vInners) || Vec_IntEntryLast(vInners) != iObj )
90 Vec_IntPush( vInners, iObj );
91 }
92 Vec_IntPush( vInners, Gia_ObjId(p, pRoot) );
93 }
94 Vec_IntForEachEntry( vNodes, iObj, i )
95 Gia_ObjRefIncId( p, iObj );
96 return RetValue;
97}
ABC_NAMESPACE_IMPL_START int Gia_ObjCheckMffc_rec(Gia_Man_t *p, Gia_Obj_t *pObj, int Limit, Vec_Int_t *vNodes)
DECLARATIONS ///.
Definition giaResub.c:49
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ObjCollectInternal()

void Gia_ObjCollectInternal ( Gia_Man_t * p,
Gia_Obj_t * pObj )
extern

Definition at line 429 of file giaTruth.c.

430{
431 Vec_IntClear( p->vTtNodes );
433}
void Gia_ObjCollectInternal_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaTruth.c:417
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ObjComputeTruth6Cis()

word Gia_ObjComputeTruth6Cis ( Gia_Man_t * p,
int iLit,
Vec_Int_t * vSupp,
Vec_Wrd_t * vTemp )
extern

Definition at line 345 of file giaTruth.c.

346{
347 int iObj = Abc_Lit2Var(iLit);
348 Vec_IntClear( vSupp );
349 if ( !iObj ) return Abc_LitIsCompl(iLit) ? ~(word)0 : (word)0;
352 if ( Vec_IntSize(vSupp) > 6 )
353 return 0;
354 Gia_ObjComputeTruth6( p, iObj, vSupp, vTemp );
355 return Abc_LitIsCompl(iLit) ? ~Vec_WrdEntry(vTemp, iObj) : Vec_WrdEntry(vTemp, iObj);
356}
void Gia_ObjComputeTruth6CisSupport_rec(Gia_Man_t *p, int iObj, Vec_Int_t *vSupp)
Definition giaTruth.c:330
word Gia_ObjComputeTruth6(Gia_Man_t *p, int iObj, Vec_Int_t *vSupp, Vec_Wrd_t *vTemp)
Definition giaTruth.c:316
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ObjComputeTruthTable()

word * Gia_ObjComputeTruthTable ( Gia_Man_t * p,
Gia_Obj_t * pObj )
extern

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 447 of file giaTruth.c.

448{
449 Gia_Obj_t * pTemp, * pRoot;
450 word * pTruth, * pTruthL, * pTruth0, * pTruth1;
451 int i;
452 if ( p->vTtMemory == NULL )
453 {
454 p->nTtVars = Gia_ManPiNum( p );
455 p->nTtWords = Abc_Truth6WordNum( p->nTtVars );
456 p->vTtNums = Vec_IntStart( Gia_ManObjNum(p) + 1000 );
457 p->vTtNodes = Vec_IntAlloc( 256 );
458 p->vTtInputs = Vec_PtrAllocTruthTables( Abc_MaxInt(6, p->nTtVars) );
459 p->vTtMemory = Vec_WrdStart( p->nTtWords * 256 );
460 }
461 else
462 {
463 // make sure the number of primary inputs did not change
464 // since the truth table computation storage was prepared
465 assert( p->nTtVars == Gia_ManPiNum(p) );
466 }
467 // extend ID numbers
468 if ( Vec_IntSize(p->vTtNums) < Gia_ManObjNum(p) )
469 Vec_IntFillExtra( p->vTtNums, Gia_ManObjNum(p), 0 );
470 // collect internal nodes
471 pRoot = Gia_ObjIsCo(pObj) ? Gia_ObjFanin0(pObj) : pObj;
472 Gia_ObjCollectInternal( p, pRoot );
473 // extend TT storage
474 if ( Vec_WrdSize(p->vTtMemory) < p->nTtWords * (Vec_IntSize(p->vTtNodes) + 2) )
475 Vec_WrdFillExtra( p->vTtMemory, p->nTtWords * (Vec_IntSize(p->vTtNodes) + 2), 0 );
476 // compute the truth table for internal nodes
477 Gia_ManForEachObjVec( p->vTtNodes, p, pTemp, i )
478 {
479 pTemp->fMark0 = 0; // unmark nodes marked by Gia_ObjCollectInternal()
480 pTruth = Gla_ObjTruthNode(p, pTemp);
481 pTruthL = pTruth + p->nTtWords;
482 pTruth0 = Gia_ObjIsAnd(Gia_ObjFanin0(pTemp)) ? Gla_ObjTruthNode(p, Gia_ObjFanin0(pTemp)) : Gla_ObjTruthElem(p, Gia_ObjCioId(Gia_ObjFanin0(pTemp)) );
483 pTruth1 = Gia_ObjIsAnd(Gia_ObjFanin1(pTemp)) ? Gla_ObjTruthNode(p, Gia_ObjFanin1(pTemp)) : Gla_ObjTruthElem(p, Gia_ObjCioId(Gia_ObjFanin1(pTemp)) );
484 if ( Gia_ObjFaninC0(pTemp) )
485 {
486 if ( Gia_ObjFaninC1(pTemp) )
487 while ( pTruth < pTruthL )
488 *pTruth++ = ~*pTruth0++ & ~*pTruth1++;
489 else
490 while ( pTruth < pTruthL )
491 *pTruth++ = ~*pTruth0++ & *pTruth1++;
492 }
493 else
494 {
495 if ( Gia_ObjFaninC1(pTemp) )
496 while ( pTruth < pTruthL )
497 *pTruth++ = *pTruth0++ & ~*pTruth1++;
498 else
499 while ( pTruth < pTruthL )
500 *pTruth++ = *pTruth0++ & *pTruth1++;
501 }
502 }
503 // compute the final table
504 if ( Gia_ObjIsConst0(pRoot) )
505 pTruth = Gla_ObjTruthConst0( p, Gla_ObjTruthFree1(p) );
506 else if ( Gia_ObjIsPi(p, pRoot) )
507 pTruth = Gla_ObjTruthElem( p, Gia_ObjCioId(pRoot) );
508 else if ( Gia_ObjIsAnd(pRoot) )
509 pTruth = Gla_ObjTruthNode( p, pRoot );
510 else
511 pTruth = NULL;
512 return Gla_ObjTruthDup( p, Gla_ObjTruthFree2(p), pTruth, Gia_ObjIsCo(pObj) && Gia_ObjFaninC0(pObj) );
513}
void Gia_ObjCollectInternal(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaTruth.c:429
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ObjComputeTruthTable6()

word Gia_ObjComputeTruthTable6 ( Gia_Man_t * p,
Gia_Obj_t * pObj,
Vec_Int_t * vSupp,
Vec_Wrd_t * vTruths )
extern

Definition at line 386 of file giaTruth.c.

387{
388 Gia_Obj_t * pLeaf;
389 int i;
390 assert( Vec_IntSize(vSupp) <= 6 );
391 assert( Gia_ObjIsAnd(pObj) );
392 assert( !pObj->fMark0 );
393 Vec_WrdClear( vTruths );
395 Gia_ManForEachObjVec( vSupp, p, pLeaf, i )
396 {
397 assert( pLeaf->fMark0 || Gia_ObjIsRo(p, pLeaf) );
398 pLeaf->Value = Vec_WrdSize(vTruths);
399 Vec_WrdPush( vTruths, s_Truth6[i] );
400 Gia_ObjSetTravIdCurrent(p, pLeaf);
401 }
402 Gia_ObjComputeTruthTable6_rec( p, pObj, vTruths );
403 return Vec_WrdEntryLast( vTruths );
404}
void Gia_ObjComputeTruthTable6_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Wrd_t *vTruths)
Definition giaTruth.c:369
Here is the call graph for this function:

◆ Gia_ObjComputeTruthTable6Lut()

word Gia_ObjComputeTruthTable6Lut ( Gia_Man_t * p,
int iObj,
Vec_Wrd_t * vTemp )
extern

Definition at line 289 of file giaTruth.c.

290{
291 int i, Fanin;
292 assert( Vec_WrdSize(vTemp) == Gia_ManObjNum(p) );
293 assert( Gia_ObjIsLut(p, iObj) );
295 Gia_LutForEachFanin( p, iObj, Fanin, i )
296 {
297 Gia_ObjSetTravIdCurrentId( p, Fanin );
298 Vec_WrdWriteEntry( vTemp, Fanin, s_Truth6[i] );
299 }
300 assert( i <= 6 );
301 Gia_ObjComputeTruthTable6Lut_rec( p, iObj, vTemp );
302 return Vec_WrdEntry( vTemp, iObj );
303}
void Gia_ObjComputeTruthTable6Lut_rec(Gia_Man_t *p, int iObj, Vec_Wrd_t *vTemp)
Definition giaTruth.c:273
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ObjComputeTruthTableCut()

word * Gia_ObjComputeTruthTableCut ( Gia_Man_t * p,
Gia_Obj_t * pRoot,
Vec_Int_t * vLeaves )
extern

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 628 of file giaTruth.c.

629{
630 Gia_Obj_t * pTemp;
631 word * pTruth, * pTruthL, * pTruth0, * pTruth1;
632 int i, iObj, Id0, Id1, Index = Vec_IntFind(vLeaves, Gia_ObjId(p, pRoot));
633 assert( p->vTtMemory != NULL );
634 assert( Vec_IntSize(vLeaves) <= p->nTtVars );
635 if ( Index >= 0 )
636 return Gla_ObjTruthElem( p, Index );
637 if ( Gia_ObjIsConst0(pRoot) )
638 {
639 if ( Vec_WrdSize(p->vTtMemory) < p->nTtWords )
640 Vec_WrdFillExtra( p->vTtMemory, p->nTtWords, 0 );
641 return Gla_ObjTruthConst0( p, Gla_ObjTruthFree1(p) );
642 }
643 assert( Gia_ObjIsAnd(pRoot) );
644 // extend ID numbers
645 if ( Vec_IntSize(p->vTtNums) < Gia_ManObjNum(p) )
646 Vec_IntFillExtra( p->vTtNums, Gia_ManObjNum(p), -ABC_INFINITY );
647 // collect internal nodes
648 Gia_ObjCollectInternalCut( p, Gia_ObjId(p, pRoot), vLeaves );
649 // extend TT storage
650 if ( Vec_WrdSize(p->vTtMemory) < p->nTtWords * (Vec_IntSize(p->vTtNodes) + 2) )
651 Vec_WrdFillExtra( p->vTtMemory, p->nTtWords * (Vec_IntSize(p->vTtNodes) + 2), 0 );
652 // compute the truth table for internal nodes
653 Vec_IntForEachEntryStart( p->vTtNodes, iObj, i, 1 )
654 {
655 assert( i == Gia_ObjNumId(p, iObj) );
656 pTemp = Gia_ManObj( p, iObj );
657 pTruth = Gla_ObjTruthNodeId( p, i );
658 pTruthL = pTruth + p->nTtWords;
659 Id0 = Gia_ObjNumId( p, Gia_ObjFaninId0(pTemp, iObj) );
660 Id1 = Gia_ObjNumId( p, Gia_ObjFaninId1(pTemp, iObj) );
661 pTruth0 = (Id0 > 0) ? Gla_ObjTruthNodeId(p, Id0) : Gla_ObjTruthElem(p, -Id0);
662 pTruth1 = (Id1 > 0) ? Gla_ObjTruthNodeId(p, Id1) : Gla_ObjTruthElem(p, -Id1);
663 if ( Gia_ObjFaninC0(pTemp) )
664 {
665 if ( Gia_ObjFaninC1(pTemp) )
666 while ( pTruth < pTruthL )
667 *pTruth++ = ~*pTruth0++ & ~*pTruth1++;
668 else
669 while ( pTruth < pTruthL )
670 *pTruth++ = ~*pTruth0++ & *pTruth1++;
671 }
672 else
673 {
674 if ( Gia_ObjFaninC1(pTemp) )
675 while ( pTruth < pTruthL )
676 *pTruth++ = *pTruth0++ & ~*pTruth1++;
677 else
678 while ( pTruth < pTruthL )
679 *pTruth++ = *pTruth0++ & *pTruth1++;
680 }
681 }
682 pTruth = Gla_ObjTruthNode( p, pRoot );
683 // unmark leaves marked by Gia_ObjCollectInternal()
684 Vec_IntForEachEntry( vLeaves, iObj, i )
685 Gia_ObjResetNumId( p, iObj );
686 Vec_IntForEachEntryStart( p->vTtNodes, iObj, i, 1 )
687 Gia_ObjResetNumId( p, iObj );
688 return pTruth;
689}
void Gia_ObjCollectInternalCut(Gia_Man_t *p, int iRoot, Vec_Int_t *vLeaves)
Definition giaTruth.c:599
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ObjComputeTruthTableStart()

void Gia_ObjComputeTruthTableStart ( Gia_Man_t * p,
int nVarsMax )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 552 of file giaTruth.c.

553{
554 assert( p->vTtMemory == NULL );
555 p->nTtVars = nVarsMax;
556 p->nTtWords = Abc_Truth6WordNum( p->nTtVars );
557 p->vTtNodes = Vec_IntAlloc( 256 );
558 p->vTtInputs = Vec_PtrAllocTruthTables( Abc_MaxInt(6, p->nTtVars) );
559 p->vTtMemory = Vec_WrdStart( p->nTtWords * 64 );
560 p->vTtNums = Vec_IntAlloc( Gia_ManObjNum(p) + 1000 );
561 Vec_IntFill( p->vTtNums, Vec_IntCap(p->vTtNums), -ABC_INFINITY );
562 if ( nVarsMax >= 6 ) {
563 word * pTruth; int i;
564 Vec_PtrForEachEntry( word *, p->vTtInputs, pTruth, i )
565 Abc_TtFlipVar5( pTruth, nVarsMax );
566 }
567}
Here is the caller graph for this function:

◆ Gia_ObjComputeTruthTableStop()

void Gia_ObjComputeTruthTableStop ( Gia_Man_t * p)
extern

Definition at line 568 of file giaTruth.c.

569{
570 p->nTtVars = 0;
571 p->nTtWords = 0;
572 Vec_IntFreeP( &p->vTtNums );
573 Vec_IntFreeP( &p->vTtNodes );
574 Vec_PtrFreeP( &p->vTtInputs );
575 Vec_WrdFreeP( &p->vTtMemory );
576}
Here is the caller graph for this function:

◆ Gia_ObjIsMuxType()

int Gia_ObjIsMuxType ( Gia_Obj_t * pNode)
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 982 of file giaUtil.c.

983{
984 Gia_Obj_t * pNode0, * pNode1;
985 // check that the node is regular
986 assert( !Gia_IsComplement(pNode) );
987 // if the node is not AND, this is not MUX
988 if ( !Gia_ObjIsAnd(pNode) || Gia_ObjIsBuf(pNode) )
989 return 0;
990 // if the children are not complemented, this is not MUX
991 if ( !Gia_ObjFaninC0(pNode) || !Gia_ObjFaninC1(pNode) )
992 return 0;
993 // get children
994 pNode0 = Gia_ObjFanin0(pNode);
995 pNode1 = Gia_ObjFanin1(pNode);
996 // if the children are not ANDs, this is not MUX
997 if ( !Gia_ObjIsAnd(pNode0) || !Gia_ObjIsAnd(pNode1) )
998 return 0;
999 // otherwise the node is MUX iff it has a pair of equal grandchildren
1000 return (Gia_ObjFanin0(pNode0) == Gia_ObjFanin0(pNode1) && (Gia_ObjFaninC0(pNode0) ^ Gia_ObjFaninC0(pNode1))) ||
1001 (Gia_ObjFanin0(pNode0) == Gia_ObjFanin1(pNode1) && (Gia_ObjFaninC0(pNode0) ^ Gia_ObjFaninC1(pNode1))) ||
1002 (Gia_ObjFanin1(pNode0) == Gia_ObjFanin0(pNode1) && (Gia_ObjFaninC1(pNode0) ^ Gia_ObjFaninC0(pNode1))) ||
1003 (Gia_ObjFanin1(pNode0) == Gia_ObjFanin1(pNode1) && (Gia_ObjFaninC1(pNode0) ^ Gia_ObjFaninC1(pNode1)));
1004}
Here is the caller graph for this function:

◆ Gia_ObjPrint()

void Gia_ObjPrint ( Gia_Man_t * p,
Gia_Obj_t * pObj )
extern

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

Synopsis [Verbose printing of the AIG node.]

Description []

SideEffects []

SeeAlso []

Definition at line 1456 of file giaUtil.c.

1457{
1458 if ( pObj == NULL )
1459 {
1460 printf( "Object is NULL." );
1461 return;
1462 }
1463 if ( Gia_IsComplement(pObj) )
1464 {
1465 printf( "Compl " );
1466 pObj = Gia_Not(pObj);
1467 }
1468 assert( !Gia_IsComplement(pObj) );
1469 printf( "Obj %4d : ", Gia_ObjId(p, pObj) );
1470 if ( Gia_ObjIsConst0(pObj) )
1471 printf( "constant 0" );
1472 else if ( Gia_ObjIsPi(p, pObj) )
1473 printf( "PI" );
1474 else if ( Gia_ObjIsPo(p, pObj) )
1475 printf( "PO( %4d%s )", Gia_ObjFaninId0p(p, pObj), (Gia_ObjFaninC0(pObj)? "\'" : " ") );
1476 else if ( Gia_ObjIsCi(pObj) )
1477 printf( "RO( %4d%s )", Gia_ObjFaninId0p(p, Gia_ObjRoToRi(p, pObj)), (Gia_ObjFaninC0(Gia_ObjRoToRi(p, pObj))? "\'" : " ") );
1478 else if ( Gia_ObjIsCo(pObj) )
1479 printf( "RI( %4d%s )", Gia_ObjFaninId0p(p, pObj), (Gia_ObjFaninC0(pObj)? "\'" : " ") );
1480// else if ( Gia_ObjIsBuf(pObj) )
1481// printf( "BUF( %d%s )", Gia_ObjFaninId0p(p, pObj), (Gia_ObjFaninC0(pObj)? "\'" : " ") );
1482 else if ( Gia_ObjIsXor(pObj) )
1483 printf( "XOR( %4d%s, %4d%s )",
1484 Gia_ObjFaninId0p(p, pObj), (Gia_ObjFaninC0(pObj)? "\'" : " "),
1485 Gia_ObjFaninId1p(p, pObj), (Gia_ObjFaninC1(pObj)? "\'" : " ") );
1486 else if ( Gia_ObjIsMuxId(p, Gia_ObjId(p, pObj)) )
1487 printf( "MUX( %4d%s, %4d%s, %4d%s )",
1488 Gia_ObjFaninId2p(p, pObj), (Gia_ObjFaninC2(p, pObj)? "\'" : " "),
1489 Gia_ObjFaninId1p(p, pObj), (Gia_ObjFaninC1(pObj)? "\'" : " "),
1490 Gia_ObjFaninId0p(p, pObj), (Gia_ObjFaninC0(pObj)? "\'" : " ") );
1491 else
1492 printf( "AND( %4d%s, %4d%s )",
1493 Gia_ObjFaninId0p(p, pObj), (Gia_ObjFaninC0(pObj)? "\'" : " "),
1494 Gia_ObjFaninId1p(p, pObj), (Gia_ObjFaninC1(pObj)? "\'" : " ") );
1495 if ( p->pRefs )
1496 printf( " (refs = %3d)", Gia_ObjRefNum(p, pObj) );
1497 if ( pObj->fMark0 )
1498 printf( " mark0" );
1499 if ( pObj->fMark1 )
1500 printf( " mark1" );
1501 if ( Gia_ManHasMapping(p) && Gia_ObjIsLut(p, Gia_ObjId(p, pObj)) )
1502 {
1503 int i, iFan;
1504 printf( " Cut = { " );
1505 Gia_LutForEachFanin( p, Gia_ObjId(p, pObj), iFan, i )
1506 printf( "%d ", iFan );
1507 printf( "}" );
1508 }
1509 if ( Gia_ManHasMapping2(p) && Gia_ObjIsLut2(p, Gia_ObjId(p, pObj)) )
1510 {
1511 int i, iFan;
1512 printf( " Cut = { " );
1513 Gia_LutForEachFanin2( p, Gia_ObjId(p, pObj), iFan, i )
1514 printf( "%d ", iFan );
1515 printf( "}" );
1516 }
1517 printf( "\n" );
1518/*
1519 if ( p->pRefs )
1520 {
1521 Gia_Obj_t * pFanout;
1522 int i;
1523 int iFan = -1; // Suppress "might be used uninitialized"
1524 printf( "\nFanouts:\n" );
1525 Gia_ObjForEachFanout( p, pObj, pFanout, iFan, i )
1526 {
1527 printf( " " );
1528 printf( "Node %4d : ", Gia_ObjId(pFanout) );
1529 if ( Gia_ObjIsPo(pFanout) )
1530 printf( "PO( %4d%s )", Gia_ObjFanin0(pFanout)->Id, (Gia_ObjFaninC0(pFanout)? "\'" : " ") );
1531 else if ( Gia_ObjIsBuf(pFanout) )
1532 printf( "BUF( %d%s )", Gia_ObjFanin0(pFanout)->Id, (Gia_ObjFaninC0(pFanout)? "\'" : " ") );
1533 else
1534 printf( "AND( %4d%s, %4d%s )",
1535 Gia_ObjFanin0(pFanout)->Id, (Gia_ObjFaninC0(pFanout)? "\'" : " "),
1536 Gia_ObjFanin1(pFanout)->Id, (Gia_ObjFaninC1(pFanout)? "\'" : " ") );
1537 printf( "\n" );
1538 }
1539 return;
1540 }
1541*/
1542}
#define Gia_LutForEachFanin2(p, i, iFan, k)
Definition gia.h:1176
Here is the caller graph for this function:

◆ Gia_ObjRecognizeExor()

int Gia_ObjRecognizeExor ( Gia_Obj_t * pObj,
Gia_Obj_t ** ppFan0,
Gia_Obj_t ** ppFan1 )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 1018 of file giaUtil.c.

1019{
1020 Gia_Obj_t * p0, * p1;
1021 assert( !Gia_IsComplement(pObj) );
1022 if ( !Gia_ObjIsAnd(pObj) || Gia_ObjIsBuf(pObj) )
1023 return 0;
1024 assert( Gia_ObjIsAnd(pObj) );
1025 p0 = Gia_ObjChild0(pObj);
1026 p1 = Gia_ObjChild1(pObj);
1027 if ( !Gia_IsComplement(p0) || !Gia_IsComplement(p1) )
1028 return 0;
1029 p0 = Gia_Regular(p0);
1030 p1 = Gia_Regular(p1);
1031 if ( !Gia_ObjIsAnd(p0) || !Gia_ObjIsAnd(p1) )
1032 return 0;
1033 if ( Gia_ObjFanin0(p0) != Gia_ObjFanin0(p1) || Gia_ObjFanin1(p0) != Gia_ObjFanin1(p1) )
1034 return 0;
1035 if ( Gia_ObjFaninC0(p0) == Gia_ObjFaninC0(p1) || Gia_ObjFaninC1(p0) == Gia_ObjFaninC1(p1) )
1036 return 0;
1037 if ( ppFan0 ) *ppFan0 = Gia_ObjChild0(p0);
1038 if ( ppFan1 ) *ppFan1 = Gia_ObjChild1(p0);
1039 return 1;
1040}
Here is the caller graph for this function:

◆ Gia_ObjRecognizeMux()

Gia_Obj_t * Gia_ObjRecognizeMux ( Gia_Obj_t * pNode,
Gia_Obj_t ** ppNodeT,
Gia_Obj_t ** ppNodeE )
extern

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

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

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

SideEffects []

SeeAlso []

Definition at line 1056 of file giaUtil.c.

1057{
1058 Gia_Obj_t * pNode0, * pNode1;
1059 assert( !Gia_IsComplement(pNode) );
1060 assert( Gia_ObjIsMuxType(pNode) );
1061 // get children
1062 pNode0 = Gia_ObjFanin0(pNode);
1063 pNode1 = Gia_ObjFanin1(pNode);
1064
1065 // find the control variable
1066 if ( Gia_ObjFanin1(pNode0) == Gia_ObjFanin1(pNode1) && (Gia_ObjFaninC1(pNode0) ^ Gia_ObjFaninC1(pNode1)) )
1067 {
1068// if ( FrGia_IsComplement(pNode1->p2) )
1069 if ( Gia_ObjFaninC1(pNode0) )
1070 { // pNode2->p2 is positive phase of C
1071 *ppNodeT = Gia_Not(Gia_ObjChild0(pNode1));//pNode2->p1);
1072 *ppNodeE = Gia_Not(Gia_ObjChild0(pNode0));//pNode1->p1);
1073 return Gia_ObjChild1(pNode1);//pNode2->p2;
1074 }
1075 else
1076 { // pNode1->p2 is positive phase of C
1077 *ppNodeT = Gia_Not(Gia_ObjChild0(pNode0));//pNode1->p1);
1078 *ppNodeE = Gia_Not(Gia_ObjChild0(pNode1));//pNode2->p1);
1079 return Gia_ObjChild1(pNode0);//pNode1->p2;
1080 }
1081 }
1082 else if ( Gia_ObjFanin0(pNode0) == Gia_ObjFanin0(pNode1) && (Gia_ObjFaninC0(pNode0) ^ Gia_ObjFaninC0(pNode1)) )
1083 {
1084// if ( FrGia_IsComplement(pNode1->p1) )
1085 if ( Gia_ObjFaninC0(pNode0) )
1086 { // pNode2->p1 is positive phase of C
1087 *ppNodeT = Gia_Not(Gia_ObjChild1(pNode1));//pNode2->p2);
1088 *ppNodeE = Gia_Not(Gia_ObjChild1(pNode0));//pNode1->p2);
1089 return Gia_ObjChild0(pNode1);//pNode2->p1;
1090 }
1091 else
1092 { // pNode1->p1 is positive phase of C
1093 *ppNodeT = Gia_Not(Gia_ObjChild1(pNode0));//pNode1->p2);
1094 *ppNodeE = Gia_Not(Gia_ObjChild1(pNode1));//pNode2->p2);
1095 return Gia_ObjChild0(pNode0);//pNode1->p1;
1096 }
1097 }
1098 else if ( Gia_ObjFanin0(pNode0) == Gia_ObjFanin1(pNode1) && (Gia_ObjFaninC0(pNode0) ^ Gia_ObjFaninC1(pNode1)) )
1099 {
1100// if ( FrGia_IsComplement(pNode1->p1) )
1101 if ( Gia_ObjFaninC0(pNode0) )
1102 { // pNode2->p2 is positive phase of C
1103 *ppNodeT = Gia_Not(Gia_ObjChild0(pNode1));//pNode2->p1);
1104 *ppNodeE = Gia_Not(Gia_ObjChild1(pNode0));//pNode1->p2);
1105 return Gia_ObjChild1(pNode1);//pNode2->p2;
1106 }
1107 else
1108 { // pNode1->p1 is positive phase of C
1109 *ppNodeT = Gia_Not(Gia_ObjChild1(pNode0));//pNode1->p2);
1110 *ppNodeE = Gia_Not(Gia_ObjChild0(pNode1));//pNode2->p1);
1111 return Gia_ObjChild0(pNode0);//pNode1->p1;
1112 }
1113 }
1114 else if ( Gia_ObjFanin1(pNode0) == Gia_ObjFanin0(pNode1) && (Gia_ObjFaninC1(pNode0) ^ Gia_ObjFaninC0(pNode1)) )
1115 {
1116// if ( FrGia_IsComplement(pNode1->p2) )
1117 if ( Gia_ObjFaninC1(pNode0) )
1118 { // pNode2->p1 is positive phase of C
1119 *ppNodeT = Gia_Not(Gia_ObjChild1(pNode1));//pNode2->p2);
1120 *ppNodeE = Gia_Not(Gia_ObjChild0(pNode0));//pNode1->p1);
1121 return Gia_ObjChild0(pNode1);//pNode2->p1;
1122 }
1123 else
1124 { // pNode1->p2 is positive phase of C
1125 *ppNodeT = Gia_Not(Gia_ObjChild0(pNode0));//pNode1->p1);
1126 *ppNodeE = Gia_Not(Gia_ObjChild1(pNode1));//pNode2->p2);
1127 return Gia_ObjChild1(pNode0);//pNode1->p2;
1128 }
1129 }
1130 assert( 0 ); // this is not MUX
1131 return NULL;
1132}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ObjRecognizeMuxLits()

int Gia_ObjRecognizeMuxLits ( Gia_Man_t * p,
Gia_Obj_t * pNode,
int * iLitT,
int * iLitE )
extern

Definition at line 1133 of file giaUtil.c.

1134{
1135 Gia_Obj_t * pNodeT, * pNodeE;
1136 Gia_Obj_t * pCtrl = Gia_ObjRecognizeMux( pNode, &pNodeT, &pNodeE );
1137 assert( pCtrl != NULL );
1138 *iLitT = Gia_Obj2Lit( p, pNodeT );
1139 *iLitE = Gia_Obj2Lit( p, pNodeE );
1140 return Gia_Obj2Lit( p, pCtrl );
1141}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ObjRemoveFanout()

void Gia_ObjRemoveFanout ( Gia_Man_t * p,
Gia_Obj_t * pObj,
Gia_Obj_t * pFanout )
extern

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(p, 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}

◆ Gia_ObjSetPhase()

void Gia_ObjSetPhase ( Gia_Man_t * p,
Gia_Obj_t * pObj )
extern

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

Synopsis [Sets the phase of one object.]

Description []

SideEffects []

SeeAlso []

Definition at line 387 of file giaUtil.c.

388{
389 if ( Gia_ObjIsAnd(pObj) )
390 {
391 int fPhase0 = Gia_ObjPhase(Gia_ObjFanin0(pObj)) ^ Gia_ObjFaninC0(pObj);
392 int fPhase1 = Gia_ObjPhase(Gia_ObjFanin1(pObj)) ^ Gia_ObjFaninC1(pObj);
393 if ( Gia_ObjIsMux(p, pObj) )
394 {
395 int fPhase2 = Gia_ObjPhase(Gia_ObjFanin2(p, pObj)) ^ Gia_ObjFaninC2(p, pObj);
396 pObj->fPhase = (fPhase2 && fPhase1) || (!fPhase2 && fPhase0);
397 }
398 else if ( Gia_ObjIsXor(pObj) )
399 pObj->fPhase = fPhase0 ^ fPhase1;
400 else
401 pObj->fPhase = fPhase0 & fPhase1;
402 }
403 else if ( Gia_ObjIsCo(pObj) )
404 pObj->fPhase = (Gia_ObjPhase(Gia_ObjFanin0(pObj)) ^ Gia_ObjFaninC0(pObj));
405 else
406 pObj->fPhase = 0;
407}
Here is the caller graph for this function:

◆ Gia_ResubToTruth6()

word Gia_ResubToTruth6 ( Vec_Int_t * vResub)
extern

Definition at line 73 of file giaDecs.c.

74{
75 word Res;
76 int iRoot = Vec_IntEntryLast(vResub);
77 if ( iRoot < 2 )
78 return iRoot ? ~(word)0 : 0;
79 assert( iRoot != 2 && iRoot != 3 );
80 Res = Gia_ResubToTruth6_rec( vResub, Abc_Lit2Var(iRoot)-2, Gia_ResubVarNum(vResub) );
81 return Abc_LitIsCompl(iRoot) ? ~Res : Res;
82}
word Gia_ResubToTruth6_rec(Vec_Int_t *vResub, int iNode, int nVars)
Definition giaDecs.c:57
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ResubVarNum()

int Gia_ResubVarNum ( Vec_Int_t * vResub)
extern

FUNCTION DEFINITIONS ///.

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 51 of file giaDecs.c.

52{
53 if ( Vec_IntSize(vResub) == 1 )
54 return Vec_IntEntryLast(vResub) >= 2;
55 return Vec_IntEntryLast(vResub)/2 - Vec_IntSize(vResub)/2 - 1;
56}
Here is the caller graph for this function:

◆ Gia_SatVerifyPattern()

void Gia_SatVerifyPattern ( Gia_Man_t * p,
Gia_Obj_t * pRoot,
Vec_Int_t * vCex,
Vec_Int_t * vVisit )
extern

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) );
98 assert( !Gia_ObjIsConst0(Gia_ObjFanin0(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 );
104 Sat_ObjSetXValue( Gia_ManCi(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}
void Gia_SatCollectCone(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vVisit)
Definition giaPat.c:73
#define GIA_ZER
Definition gia.h:921
#define GIA_ONE
Definition gia.h:922
Here is the call graph for this function:

◆ Gia_SimDataCiExt()

unsigned * Gia_SimDataCiExt ( Gia_ManSim_t * p,
int i )
extern

Definition at line 36 of file giaSim.c.

36{ return Gia_SimDataCi(p, i); }

◆ Gia_SimDataCoExt()

unsigned * Gia_SimDataCoExt ( Gia_ManSim_t * p,
int i )
extern

Definition at line 37 of file giaSim.c.

37{ return Gia_SimDataCo(p, i); }

◆ Gia_SimDataExt()

unsigned * Gia_SimDataExt ( Gia_ManSim_t * p,
int i )
extern

Definition at line 35 of file giaSim.c.

35{ return Gia_SimData(p, i); }

◆ Gia_SortFloats()

int * Gia_SortFloats ( float * pArray,
int * pPerm,
int nSize )
extern

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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_SweeperCheckEquiv()

int Gia_SweeperCheckEquiv ( Gia_Man_t * pGia,
int Probe1,
int Probe2 )
extern

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
841clk = 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 );
845p->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] );
852p->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 );
858p->timeSatSat += Abc_Clock() - clk;
859 p->nSatCallsSat++;
860 return 0;
861 }
862 else // if ( RetValue1 == l_Undef )
863 {
864p->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
881clk = 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 );
885p->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] );
892p->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 );
898p->timeSatSat += Abc_Clock() - clk;
899 p->nSatCallsSat++;
900 return 0;
901 }
902 else // if ( RetValue1 == l_Undef )
903 {
904p->timeSatUndec += Abc_Clock() - clk;
905 p->nSatCallsUndec++;
906 return -1;
907 }
908 // return SAT proof
909 p->nSatProofs++;
910 return 1;
911}
#define l_True
Definition bmcBmcS.c:35
#define l_False
Definition bmcBmcS.c:36
#define sat_solver_addclause
Definition cecSatG2.c:37
#define sat_solver_solve
Definition cecSatG2.c:45
typedefABC_NAMESPACE_IMPL_START struct Swp_Man_t_ Swp_Man_t
DECLARATIONS ///.
Definition giaSweeper.c:56
int Gia_SweeperProbeLit(Gia_Man_t *p, int ProbeId)
Definition giaSweeper.c:276
void * pData
Definition gia.h:198
Here is the call graph for this function:

◆ Gia_SweeperCleanup()

Gia_Man_t * Gia_SweeperCleanup ( Gia_Man_t * p,
char * pCommLime )
extern

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 Abc_FrameUpdateGia(Abc_Frame_t *pAbc, Gia_Man_t *pNew)
Definition abc.c:824
Gia_Man_t * Abc_FrameGetGia(Abc_Frame_t *pAbc)
Definition abc.c:869
ABC_DLL Abc_Frame_t * Abc_FrameGetGlobalFrame()
Definition mainFrame.c:643
ABC_DLL int Cmd_CommandExecute(Abc_Frame_t *pAbc, const char *sCommand)
Definition cmdApi.c:193
sat_solver * sat_solver_new(void)
Definition satSolver.c:1137
void sat_solver_setnvars(sat_solver *s, int n)
Definition satSolver.c:1272
void sat_solver_delete(sat_solver *s)
Definition satSolver.c:1341
Here is the call graph for this function:

◆ Gia_SweeperCollectValidProbeIds()

Vec_Int_t * Gia_SweeperCollectValidProbeIds ( Gia_Man_t * p)
extern

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}

◆ Gia_SweeperCondCheckUnsat()

int Gia_SweeperCondCheckUnsat ( Gia_Man_t * pGia)
extern

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
947clk = 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 );
950p->timeSat += Abc_Clock() - clk;
951 if ( RetValue == l_False )
952 {
953 assert( Vec_IntSize(p->vCondProbes) > 0 );
954p->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 );
962p->timeSatSat += Abc_Clock() - clk;
963 p->nSatCallsSat++;
964 return 0;
965 }
966 else // if ( RetValue1 == l_Undef )
967 {
968p->timeSatUndec += Abc_Clock() - clk;
969 p->nSatCallsUndec++;
970 return -1;
971 }
972}
Here is the call graph for this function:

◆ Gia_SweeperCondPop()

int Gia_SweeperCondPop ( Gia_Man_t * p)
extern

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}

◆ Gia_SweeperCondPush()

void Gia_SweeperCondPush ( Gia_Man_t * p,
int ProbeId )
extern

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}
Here is the caller graph for this function:

◆ Gia_SweeperCondVector()

Vec_Int_t * Gia_SweeperCondVector ( Gia_Man_t * p)
extern

Definition at line 329 of file giaSweeper.c.

330{
331 Swp_Man_t * pSwp = (Swp_Man_t *)p->pData;
332 return pSwp->vCondProbes;
333}
Here is the caller graph for this function:

◆ Gia_SweeperExtractUserLogic()

Gia_Man_t * Gia_SweeperExtractUserLogic ( Gia_Man_t * p,
Vec_Int_t * vProbeIds,
Vec_Ptr_t * vInNames,
Vec_Ptr_t * vOutNames )
extern

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}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_SweeperFraig()

int Gia_SweeperFraig ( Gia_Man_t * p,
Vec_Int_t * vProbeIds,
char * pCommLime,
int nWords,
int nConfs,
int fVerify,
int fVerbose )
extern

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}
int Gia_SweeperProbeUpdate(Gia_Man_t *p, int ProbeId, int iLitNew)
Definition giaSweeper.c:267
Gia_Man_t * Gia_SweeperSweep(Gia_Man_t *p, Vec_Int_t *vProbeOuts, int nWords, int nConfs, int fVerify, int fVerbose)
Vec_Int_t * Gia_SweeperGraft(Gia_Man_t *pDst, Vec_Int_t *vProbes, Gia_Man_t *pSrc)
Definition giaSweeper.c:985
int Gia_SweeperIsRunning(Gia_Man_t *pGia)
Definition giaSweeper.c:164
Here is the call graph for this function:

◆ Gia_SweeperGetCex()

Vec_Int_t * Gia_SweeperGetCex ( Gia_Man_t * p)
extern

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}

◆ Gia_SweeperGraft()

Vec_Int_t * Gia_SweeperGraft ( Gia_Man_t * pDst,
Vec_Int_t * vProbes,
Gia_Man_t * pSrc )
extern

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;
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}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_SweeperIsRunning()

int Gia_SweeperIsRunning ( Gia_Man_t * p)
extern

Definition at line 164 of file giaSweeper.c.

165{
166 return (pGia->pData != NULL);
167}
Here is the caller graph for this function:

◆ Gia_SweeperLogicDump()

void Gia_SweeperLogicDump ( Gia_Man_t * p,
Vec_Int_t * vProbeIds,
int fDumpConds,
char * pFileName )
extern

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, 0 );
443 Gia_ManStop( pGiaOuts );
444 printf( " into file \"%s\".\n", pFileName );
445}
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
Vec_Int_t * Gia_SweeperCondVector(Gia_Man_t *p)
Definition giaSweeper.c:329
void Gia_ManDupAppendShare(Gia_Man_t *p, Gia_Man_t *pTwo)
Definition giaDup.c:1156
Here is the call graph for this function:

◆ Gia_SweeperPrintStats()

void Gia_SweeperPrintStats ( Gia_Man_t * p)
extern

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}
#define ABC_PRTP(a, t, T)
Definition abc_global.h:258
#define ABC_PRMP(a, f, F)
Definition abc_global.h:262
double Gia_SweeperMemUsage(Gia_Man_t *pGia)
Definition giaSweeper.c:168
double sat_solver_memory(sat_solver *s)
Definition satSolver.c:1479
void Sat_SolverPrintStats(FILE *pFile, sat_solver *p)
Definition satUtil.c:193
Here is the call graph for this function:

◆ Gia_SweeperProbeCreate()

int Gia_SweeperProbeCreate ( Gia_Man_t * p,
int iLit )
extern

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}
Here is the caller graph for this function:

◆ Gia_SweeperProbeDelete()

int Gia_SweeperProbeDelete ( Gia_Man_t * p,
int ProbeId )
extern

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}

◆ Gia_SweeperProbeLit()

int Gia_SweeperProbeLit ( Gia_Man_t * p,
int ProbeId )
extern

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}
Here is the caller graph for this function:

◆ Gia_SweeperProbeUpdate()

int Gia_SweeperProbeUpdate ( Gia_Man_t * p,
int ProbeId,
int iLitNew )
extern

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}
Here is the caller graph for this function:

◆ Gia_SweeperRun()

int Gia_SweeperRun ( Gia_Man_t * p,
Vec_Int_t * vProbeIds,
char * pCommLime,
int fVerbose )
extern

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}
Here is the call graph for this function:

◆ Gia_SweeperSetConflictLimit()

void Gia_SweeperSetConflictLimit ( Gia_Man_t * p,
int nConfMax )
extern

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}

◆ Gia_SweeperSetRuntimeLimit()

void Gia_SweeperSetRuntimeLimit ( Gia_Man_t * p,
int nSeconds )
extern

Definition at line 225 of file giaSweeper.c.

226{
227 Swp_Man_t * pSwp = (Swp_Man_t *)p->pData;
228 pSwp->nTimeOut = nSeconds;
229}

◆ Gia_SweeperStart()

Gia_Man_t * Gia_SweeperStart ( Gia_Man_t * p)
extern

Definition at line 145 of file giaSweeper.c.

146{
147 if ( pGia == NULL )
148 pGia = Gia_ManStart( 10000 );
149 if ( Vec_IntSize(&pGia->vHTable) == 0 )
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}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_SweeperStop()

void Gia_SweeperStop ( Gia_Man_t * p)
extern

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}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_TimeStamp()

char * Gia_TimeStamp ( )
extern

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

Synopsis [Returns the time stamp.]

Description [The file should be closed.]

SideEffects []

SeeAlso []

Definition at line 106 of file giaUtil.c.

107{
108 static char Buffer[100];
109 char * TimeStamp;
110 time_t ltime;
111 // get the current time
112 time( &ltime );
113 TimeStamp = asctime( localtime( &ltime ) );
114 TimeStamp[ strlen(TimeStamp) - 1 ] = 0;
115 strcpy( Buffer, TimeStamp );
116 return Buffer;
117}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Jf_ManDeriveCnf()

Gia_Man_t * Jf_ManDeriveCnf ( Gia_Man_t * p,
int fCnfObjIds )
extern

Definition at line 1749 of file giaJf.c.

1750{
1751 Jf_Par_t Pars, * pPars = &Pars;
1752 Jf_ManSetDefaultPars( pPars );
1753 pPars->fGenCnf = 1;
1754 pPars->fCnfObjIds = fCnfObjIds;
1755 return Jf_ManPerformMapping( p, pPars );
1756}
void Jf_ManSetDefaultPars(Jf_Par_t *pPars)
Definition giaJf.c:1682
Gia_Man_t * Jf_ManPerformMapping(Gia_Man_t *pGia, Jf_Par_t *pPars)
Definition giaJf.c:1715
int fGenCnf
Definition gia.h:360
int fCnfObjIds
Definition gia.h:362
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Jf_ManPerformMapping()

Gia_Man_t * Jf_ManPerformMapping ( Gia_Man_t * pGia,
Jf_Par_t * pPars )
extern

Definition at line 1715 of file giaJf.c.

1716{
1717 Gia_Man_t * pNew = pGia;
1718 Jf_Man_t * p; int i;
1719 assert( !Gia_ManBufNum(pGia) );
1720 assert( !pPars->fCutMin || !pPars->fFuncDsd || pPars->nLutSize <= 6 );
1721 if ( pPars->fGenCnf )
1722 pPars->fCutMin = 1, pPars->fFuncDsd = 1, pPars->fOptEdge = 0;
1723 if ( pPars->fCutMin && !pPars->fFuncDsd )
1724 pPars->fCoarsen = 0;
1725 p = Jf_ManAlloc( pGia, pPars );
1726 p->pCutCmp = pPars->fAreaOnly ? Jf_CutCompareArea : Jf_CutCompareDelay;
1727 Jf_ManComputeCuts( p, 0 );
1728 Jf_ManComputeRefs( p ); Jf_ManPrintStats( p, "Start" );
1729 for ( i = 0; i < pPars->nRounds; i++ )
1730 {
1731 if ( !p->pPars->fGenCnf )
1732 {
1733 Jf_ManPropagateFlow( p, pPars->fOptEdge ); Jf_ManPrintStats( p, "Flow " );
1734 }
1735 Jf_ManPropagateEla( p, 0 ); Jf_ManPrintStats( p, "Area " );
1736 Jf_ManPropagateEla( p, 1 ); Jf_ManPrintStats( p, "Edge " );
1737 }
1738 if ( p->pPars->fVeryVerbose && p->pPars->fCutMin && !p->pPars->fFuncDsd )
1739 Vec_MemDumpTruthTables( p->vTtMem, Gia_ManName(p->pGia), p->pPars->nLutSize );
1740 if ( p->pPars->fPureAig )
1741 pNew = Jf_ManDeriveGia(p);
1742 else if ( p->pPars->fCutMin )
1743 pNew = Jf_ManDeriveMappingGia(p);
1744 else
1746 Jf_ManFree( p );
1747 return pNew;
1748}
Gia_Man_t * Jf_ManDeriveMappingGia(Jf_Man_t *p)
Definition giaJf.c:1431
Gia_Man_t * Jf_ManDeriveGia(Jf_Man_t *p)
Definition giaJf.c:1580
void Jf_ManPrintStats(Jf_Man_t *p, char *pTitle)
Definition giaJf.c:1702
struct Jf_Man_t_ Jf_Man_t
Definition giaJf.c:52
Jf_Man_t * Jf_ManAlloc(Gia_Man_t *pGia, Jf_Par_t *pPars)
Definition giaJf.c:365
int Jf_ManComputeRefs(Jf_Man_t *p)
Definition giaJf.c:1308
void Jf_ManDeriveMapping(Jf_Man_t *p)
Definition giaJf.c:1544
void Jf_ManComputeCuts(Jf_Man_t *p, int fEdge)
Definition giaJf.c:1240
float Jf_CutCompareArea(Jf_Cut_t *pOld, Jf_Cut_t *pNew)
Definition giaJf.c:949
float Jf_CutCompareDelay(Jf_Cut_t *pOld, Jf_Cut_t *pNew)
Definition giaJf.c:940
void Jf_ManPropagateEla(Jf_Man_t *p, int fEdge)
Definition giaJf.c:1392
void Jf_ManPropagateFlow(Jf_Man_t *p, int fEdge)
Definition giaJf.c:1381
void Jf_ManFree(Jf_Man_t *p)
Definition giaJf.c:396
int nRounds
Definition gia.h:339
int fFuncDsd
Definition gia.h:359
int fOptEdge
Definition gia.h:354
int fAreaOnly
Definition gia.h:350
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Jf_ManSetDefaultPars()

void Jf_ManSetDefaultPars ( Jf_Par_t * pPars)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1682 of file giaJf.c.

1683{
1684 memset( pPars, 0, sizeof(Jf_Par_t) );
1685 pPars->nLutSize = 6;
1686 pPars->nCutNum = 8;
1687 pPars->nRounds = 1;
1688 pPars->nVerbLimit = 5;
1689 pPars->DelayTarget = -1;
1690 pPars->fAreaOnly = 1;
1691 pPars->fOptEdge = 1;
1692 pPars->fCoarsen = 0;
1693 pPars->fCutMin = 0;
1694 pPars->fFuncDsd = 0;
1695 pPars->fGenCnf = 0;
1696 pPars->fPureAig = 0;
1697 pPars->fVerbose = 0;
1698 pPars->fVeryVerbose = 0;
1699 pPars->nLutSizeMax = JF_LEAF_MAX;
1700 pPars->nCutNumMax = JF_CUT_MAX;
1701}
#define JF_CUT_MAX
Definition giaJf.c:38
#define JF_LEAF_MAX
DECLARATIONS ///.
Definition giaJf.c:36
int nCutNumMax
Definition gia.h:373
int nLutSizeMax
Definition gia.h:372
int fVeryVerbose
Definition gia.h:371
int fPureAig
Definition gia.h:365
int fVerbose
Definition gia.h:370
int nVerbLimit
Definition gia.h:345
int DelayTarget
Definition gia.h:349
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Lf_ManPerformMapping()

Gia_Man_t * Lf_ManPerformMapping ( Gia_Man_t * pGia,
Jf_Par_t * pPars )
extern

Definition at line 2242 of file giaLf.c.

2243{
2244 Gia_Man_t * pNew;
2245 if ( p->pManTime && Tim_ManBoxNum((Tim_Man_t*)p->pManTime) && Gia_ManIsNormalized(p) )
2246 {
2247 Tim_Man_t * pTimOld = (Tim_Man_t *)p->pManTime;
2248 p->pManTime = Tim_ManDup( pTimOld, 1 );
2249 pNew = Gia_ManDupUnnormalize( p );
2250 if ( pNew == NULL )
2251 return NULL;
2252 Gia_ManTransferTiming( pNew, p );
2253 p = pNew;
2254 // mapping
2255 pNew = Lf_ManPerformMappingInt( p, pPars );
2256 if ( pNew != p )
2257 {
2258 Gia_ManTransferTiming( pNew, p );
2259 Gia_ManStop( p );
2260 }
2261 // normalize
2262 pNew = Gia_ManDupNormalize( p = pNew, 0 );
2263 Gia_ManTransferMapping( pNew, p );
2264// Gia_ManTransferPacking( pNew, p );
2265 Gia_ManTransferTiming( pNew, p );
2266 Gia_ManStop( p ); // do not delete if the original one!
2267 // cleanup
2268 Tim_ManStop( (Tim_Man_t *)pNew->pManTime );
2269 pNew->pManTime = pTimOld;
2270 assert( Gia_ManIsNormalized(pNew) );
2271 }
2272 else
2273 {
2274 // mapping
2275 pNew = Lf_ManPerformMappingInt( p, pPars );
2276 Gia_ManTransferTiming( pNew, p );
2277 }
2278 return pNew;
2279}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Lf_ManSetDefaultPars()

void Lf_ManSetDefaultPars ( Jf_Par_t * pPars)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 2021 of file giaLf.c.

2022{
2023 memset( pPars, 0, sizeof(Jf_Par_t) );
2024 pPars->nLutSize = 6;
2025 pPars->nCutNum = 8;
2026 pPars->nProcNum = 0;
2027 pPars->nRounds = 4;
2028 pPars->nRoundsEla = 1;
2029 pPars->nRelaxRatio = 0;
2030 pPars->nCoarseLimit = 3;
2031 pPars->nAreaTuner = 1;
2032 pPars->nVerbLimit = 5;
2033 pPars->DelayTarget = -1;
2034 pPars->fAreaOnly = 0;
2035 pPars->fOptEdge = 1;
2036 pPars->fUseMux7 = 0;
2037 pPars->fPower = 0;
2038 pPars->fCoarsen = 1;
2039 pPars->fCutMin = 0;
2040 pPars->fFuncDsd = 0;
2041 pPars->fGenCnf = 0;
2042 pPars->fPureAig = 0;
2043 pPars->fCutHashing = 0;
2044 pPars->fCutSimple = 0;
2045 pPars->fVerbose = 0;
2046 pPars->fVeryVerbose = 0;
2047 pPars->nLutSizeMax = LF_LEAF_MAX;
2048 pPars->nCutNumMax = LF_CUT_MAX;
2049}
#define LF_CUT_MAX
Definition giaLf.c:34
#define LF_LEAF_MAX
DECLARATIONS ///.
Definition giaLf.c:33
int fCutSimple
Definition gia.h:368
int nProcNum
Definition gia.h:338
int nRoundsEla
Definition gia.h:340
int fUseMux7
Definition gia.h:355
int fPower
Definition gia.h:356
int fCutHashing
Definition gia.h:367
int nCoarseLimit
Definition gia.h:342
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Mf_ManGenerateCnf()

void * Mf_ManGenerateCnf ( Gia_Man_t * pGia,
int nLutSize,
int fCnfObjIds,
int fAddOrCla,
int fMapping,
int fVerbose )
extern

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

Synopsis [CNF generation]

Description []

SideEffects []

SeeAlso []

Definition at line 1877 of file giaMf.c.

1878{
1879 Gia_Man_t * pNew;
1880 Jf_Par_t Pars, * pPars = &Pars;
1881 assert( nLutSize >= 3 && nLutSize <= 8 );
1882 Mf_ManSetDefaultPars( pPars );
1883 pPars->fGenCnf = 1;
1884 pPars->fCoarsen = !fCnfObjIds;
1885 pPars->nLutSize = nLutSize;
1886 pPars->fCnfObjIds = fCnfObjIds;
1887 pPars->fAddOrCla = fAddOrCla;
1888 pPars->fCnfMapping = fMapping;
1889 pPars->fVerbose = fVerbose;
1890 pNew = Mf_ManPerformMapping( pGia, pPars );
1891 Gia_ManStopP( &pNew );
1892// Cnf_DataPrint( (Cnf_Dat_t *)pGia->pData, 1 );
1893 return pGia->pData;
1894}
Gia_Man_t * Mf_ManPerformMapping(Gia_Man_t *pGia, Jf_Par_t *pPars)
Definition giaMf.c:1822
void Mf_ManSetDefaultPars(Jf_Par_t *pPars)
Definition giaMf.c:1441
int fCnfMapping
Definition gia.h:364
int fAddOrCla
Definition gia.h:363
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Mf_ManPerformMapping()

Gia_Man_t * Mf_ManPerformMapping ( Gia_Man_t * pGia,
Jf_Par_t * pPars )
extern

Definition at line 1822 of file giaMf.c.

1823{
1824 Mf_Man_t * p;
1825 Gia_Man_t * pNew, * pCls;
1826 if ( pPars->fGenCnf || pPars->fGenLit )
1827 pPars->fCutMin = 1;
1828 if ( Gia_ManHasChoices(pGia) )
1829 pPars->fCutMin = 1, pPars->fCoarsen = 0;
1830 pCls = pPars->fCoarsen ? Gia_ManDupMuxes(pGia, pPars->nCoarseLimit) : pGia;
1831 p = Mf_ManAlloc( pCls, pPars );
1832 p->pGia0 = pGia;
1833 if ( pPars->fVerbose && pPars->fCoarsen )
1834 {
1835 printf( "Initial " ); Gia_ManPrintMuxStats( pGia ); printf( "\n" );
1836 printf( "Derived " ); Gia_ManPrintMuxStats( pCls ); printf( "\n" );
1837 }
1838 Mf_ManPrintInit( p );
1840 for ( p->Iter = 1; p->Iter < p->pPars->nRounds; p->Iter++ )
1842 p->fUseEla = 1;
1843 for ( ; p->Iter < p->pPars->nRounds + pPars->nRoundsEla; p->Iter++ )
1845 //Mf_ManOptimization( p );
1846 if ( pPars->fVeryVerbose && pPars->fCutMin )
1847 Vec_MemDumpTruthTables( p->vTtMem, Gia_ManName(p->pGia), pPars->nLutSize );
1848 if ( pPars->fCutMin )
1849 pNew = Mf_ManDeriveMappingGia( p );
1850 else if ( pPars->fCoarsen )
1851 pNew = Mf_ManDeriveMappingCoarse( p );
1852 else
1853 pNew = Mf_ManDeriveMapping( p );
1854 if ( p->pPars->fGenCnf )
1855 pGia->pData = Mf_ManDeriveCnf( p, p->pPars->fCnfObjIds, p->pPars->fAddOrCla );
1856 //if ( p->pPars->fGenCnf || p->pPars->fGenLit )
1857 // Mf_ManProfileTruths( p );
1858 Gia_ManMappingVerify( pNew );
1859 Mf_ManPrintQuit( p, pNew );
1860 Mf_ManFree( p );
1861 if ( pCls != pGia )
1862 Gia_ManStop( pCls );
1863 return pNew;
1864}
void Mf_ManPrintQuit(Mf_Man_t *p, Gia_Man_t *pNew)
Definition giaMf.c:1497
Gia_Man_t * Mf_ManDeriveMapping(Mf_Man_t *p)
Definition giaMf.c:1229
Cnf_Dat_t * Mf_ManDeriveCnf(Mf_Man_t *p, int fCnfObjIds, int fAddOrCla)
Definition giaMf.c:337
struct Mf_Man_t_ Mf_Man_t
Definition giaMf.c:62
Gia_Man_t * Mf_ManDeriveMappingCoarse(Mf_Man_t *p)
Definition giaMf.c:1251
void Mf_ManFree(Mf_Man_t *p)
Definition giaMf.c:1414
void Mf_ManComputeMapping(Mf_Man_t *p)
Definition giaMf.c:1814
void Mf_ManPrintInit(Mf_Man_t *p)
Definition giaMf.c:1481
Gia_Man_t * Mf_ManDeriveMappingGia(Mf_Man_t *p)
Definition giaMf.c:1292
void Mf_ManComputeCuts(Mf_Man_t *p)
Definition giaMf.c:1531
Mf_Man_t * Mf_ManAlloc(Gia_Man_t *pGia, Jf_Par_t *pPars)
Definition giaMf.c:1381
void Gia_ManMappingVerify(Gia_Man_t *p)
Definition giaIf.c:2257
int fGenLit
Definition gia.h:361
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Mf_ManSetDefaultPars()

void Mf_ManSetDefaultPars ( Jf_Par_t * pPars)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1441 of file giaMf.c.

1442{
1443 memset( pPars, 0, sizeof(Jf_Par_t) );
1444 pPars->nLutSize = 6;
1445 pPars->nCutNum = 8;
1446 pPars->nProcNum = 0;
1447 pPars->nRounds = 2;
1448 pPars->nRoundsEla = 1;
1449 pPars->nRelaxRatio = 0;
1450 pPars->nCoarseLimit = 3;
1451 pPars->nAreaTuner = 1;
1452 pPars->nVerbLimit = 5;
1453 pPars->DelayTarget = -1;
1454 pPars->fAreaOnly = 0;
1455 pPars->fOptEdge = 1;
1456 pPars->fCoarsen = 1;
1457 pPars->fCutMin = 0;
1458 pPars->fGenCnf = 0;
1459 pPars->fGenLit = 0;
1460 pPars->fPureAig = 0;
1461 pPars->fVerbose = 0;
1462 pPars->fVeryVerbose = 0;
1463 pPars->nLutSizeMax = MF_LEAF_MAX;
1464 pPars->nCutNumMax = MF_CUT_MAX;
1465}
#define MF_LEAF_MAX
DECLARATIONS ///.
Definition giaMf.c:35
#define MF_CUT_MAX
Definition giaMf.c:36
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sat_ManTest()

int Sat_ManTest ( Gia_Man_t * pGia,
Gia_Obj_t * pObj,
int nConfsMax )
extern

◆ Tas_ManAlloc()

Tas_Man_t * Tas_ManAlloc ( Gia_Man_t * pAig,
int nBTLimit )
extern

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 );
197 p->pClauses.pData = ABC_ALLOC( Gia_Obj_t *, p->pClauses.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}
void Tas_SetDefaultParams(Tas_Par_t *pPars)
FUNCTION DEFINITIONS ///.
Definition giaCTas.c:162
struct Tas_Man_t_ Tas_Man_t
Definition gia.h:1821
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Tas_ManSatPrintStats()

void Tas_ManSatPrintStats ( Tas_Man_t * p)
extern

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}
Here is the caller graph for this function:

◆ Tas_ManSolve()

int Tas_ManSolve ( Tas_Man_t * p,
Gia_Obj_t * pObj,
Gia_Obj_t * pObj2 )
extern

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}
int s_Counter2
Definition giaCTas.c:639
int Tas_ManSolve_rec(Tas_Man_t *p, int Level)
Definition giaCTas.c:1285
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Tas_ManSolveArray()

int Tas_ManSolveArray ( Tas_Man_t * p,
Vec_Ptr_t * vObjs )
extern

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}
int s_Counter4
Definition giaCTas.c:641
int s_Counter3
Definition giaCTas.c:640
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Tas_ManSolveMiterNc()

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

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 )
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 Tas_ManSatPrintStats(Tas_Man_t *p)
Definition giaCTas.c:1487
Tas_Man_t * Tas_ManAlloc(Gia_Man_t *pAig, int nBTLimit)
Definition giaCTas.c:187
Vec_Int_t * Tas_ReadModel(Tas_Man_t *p)
Definition giaCTas.c:250
void Tas_ManStop(Tas_Man_t *p)
Definition giaCTas.c:223
int Tas_ManSolve(Tas_Man_t *p, Gia_Obj_t *pObj, Gia_Obj_t *pObj2)
Definition giaCTas.c:1366
void Gia_ManCleanPhase(Gia_Man_t *p)
Definition giaUtil.c:472
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Tas_ManStop()

void Tas_ManStop ( Tas_Man_t * p)
extern

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}
Here is the caller graph for this function:

◆ Tas_ReadModel()

Vec_Int_t * Tas_ReadModel ( Tas_Man_t * p)
extern

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

Synopsis [Returns satisfying assignment.]

Description []

SideEffects []

SeeAlso []

Definition at line 250 of file giaCTas.c.

251{
252 return p->vModel;
253}
Here is the caller graph for this function: