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

Go to the source code of this file.

Data Structures

struct  Abc_Time_t_
 
struct  Abc_Obj_t_
 
struct  Abc_Ntk_t_
 
struct  Abc_Des_t_
 

Macros

#define Abc_NtkForEachObj(pNtk, pObj, i)
 ITERATORS ///. More...
 
#define Abc_NtkForEachObjReverse(pNtk, pNode, i)
 
#define Abc_NtkForEachObjVec(vIds, pNtk, pObj, i)
 
#define Abc_NtkForEachObjVecStart(vIds, pNtk, pObj, i, Start)
 
#define Abc_NtkForEachNet(pNtk, pNet, i)
 
#define Abc_NtkForEachNode(pNtk, pNode, i)
 
#define Abc_NtkForEachNodeNotBarBuf(pNtk, pNode, i)
 
#define Abc_NtkForEachNode1(pNtk, pNode, i)
 
#define Abc_NtkForEachNodeNotBarBuf1(pNtk, pNode, i)
 
#define Abc_NtkForEachNodeReverse(pNtk, pNode, i)
 
#define Abc_NtkForEachNodeReverse1(pNtk, pNode, i)
 
#define Abc_NtkForEachBarBuf(pNtk, pNode, i)
 
#define Abc_NtkForEachGate(pNtk, pNode, i)
 
#define Abc_AigForEachAnd(pNtk, pNode, i)
 
#define Abc_NtkForEachNodeCi(pNtk, pNode, i)
 
#define Abc_NtkForEachNodeCo(pNtk, pNode, i)
 
#define Abc_NtkForEachBox(pNtk, pObj, i)   for ( i = 0; (i < Vec_PtrSize((pNtk)->vBoxes)) && (((pObj) = Abc_NtkBox(pNtk, i)), 1); i++ )
 
#define Abc_NtkForEachLatch(pNtk, pObj, i)
 
#define Abc_NtkForEachLatchInput(pNtk, pObj, i)
 
#define Abc_NtkForEachLatchOutput(pNtk, pObj, i)
 
#define Abc_NtkForEachWhitebox(pNtk, pObj, i)
 
#define Abc_NtkForEachBlackbox(pNtk, pObj, i)
 
#define Abc_NtkForEachPi(pNtk, pPi, i)   for ( i = 0; (i < Abc_NtkPiNum(pNtk)) && (((pPi) = Abc_NtkPi(pNtk, i)), 1); i++ )
 
#define Abc_NtkForEachCi(pNtk, pCi, i)   for ( i = 0; (i < Abc_NtkCiNum(pNtk)) && (((pCi) = Abc_NtkCi(pNtk, i)), 1); i++ )
 
#define Abc_NtkForEachPo(pNtk, pPo, i)   for ( i = 0; (i < Abc_NtkPoNum(pNtk)) && (((pPo) = Abc_NtkPo(pNtk, i)), 1); i++ )
 
#define Abc_NtkForEachCo(pNtk, pCo, i)   for ( i = 0; (i < Abc_NtkCoNum(pNtk)) && (((pCo) = Abc_NtkCo(pNtk, i)), 1); i++ )
 
#define Abc_NtkForEachLiPo(pNtk, pCo, i)   for ( i = 0; (i < Abc_NtkCoNum(pNtk)) && (((pCo) = Abc_NtkCo(pNtk, i < pNtk->nBarBufs ? Abc_NtkCoNum(pNtk) - pNtk->nBarBufs + i : i - pNtk->nBarBufs)), 1); i++ )
 
#define Abc_ObjForEachFanin(pObj, pFanin, i)   for ( i = 0; (i < Abc_ObjFaninNum(pObj)) && (((pFanin) = Abc_ObjFanin(pObj, i)), 1); i++ )
 
#define Abc_ObjForEachFanout(pObj, pFanout, i)   for ( i = 0; (i < Abc_ObjFanoutNum(pObj)) && (((pFanout) = Abc_ObjFanout(pObj, i)), 1); i++ )
 
#define Abc_CubeForEachVar(pCube, Value, i)   for ( i = 0; (pCube[i] != ' ') && (Value = pCube[i]); i++ )
 
#define Abc_SopForEachCube(pSop, nFanins, pCube)   for ( pCube = (pSop); *pCube; pCube += (nFanins) + 3 )
 
#define Abc_SopForEachCubePair(pSop, nFanins, pCube, pCube2)
 

Typedefs

typedef struct Abc_Des_t_ Abc_Des_t
 BASIC TYPES ///. More...
 
typedef struct Abc_Ntk_t_ Abc_Ntk_t
 
typedef struct Abc_Obj_t_ Abc_Obj_t
 
typedef struct Abc_Aig_t_ Abc_Aig_t
 
typedef struct Abc_ManTime_t_ Abc_ManTime_t
 
typedef struct Abc_ManCut_t_ Abc_ManCut_t
 
typedef struct Abc_Time_t_ Abc_Time_t
 
typedef struct Odc_Man_t_ Odc_Man_t
 

Enumerations

enum  Abc_NtkType_t {
  ABC_NTK_NONE = 0, ABC_NTK_NETLIST, ABC_NTK_LOGIC, ABC_NTK_STRASH,
  ABC_NTK_OTHER
}
 INCLUDES ///. More...
 
enum  Abc_NtkFunc_t {
  ABC_FUNC_NONE = 0, ABC_FUNC_SOP, ABC_FUNC_BDD, ABC_FUNC_AIG,
  ABC_FUNC_MAP, ABC_FUNC_BLIFMV, ABC_FUNC_BLACKBOX, ABC_FUNC_OTHER
}
 
enum  Abc_ObjType_t {
  ABC_OBJ_NONE = 0, ABC_OBJ_CONST1, ABC_OBJ_PI, ABC_OBJ_PO,
  ABC_OBJ_BI, ABC_OBJ_BO, ABC_OBJ_NET, ABC_OBJ_NODE,
  ABC_OBJ_LATCH, ABC_OBJ_WHITEBOX, ABC_OBJ_BLACKBOX, ABC_OBJ_NUMBER
}
 
enum  Abc_InitType_t {
  ABC_INIT_NONE = 0, ABC_INIT_ZERO, ABC_INIT_ONE, ABC_INIT_DC,
  ABC_INIT_OTHER
}
 

Functions

static unsigned Abc_InfoRandomWord ()
 MACRO DEFINITIONS ///. More...
 
static void Abc_InfoRandom (unsigned *p, int nWords)
 
static void Abc_InfoClear (unsigned *p, int nWords)
 
static void Abc_InfoFill (unsigned *p, int nWords)
 
static void Abc_InfoNot (unsigned *p, int nWords)
 
static int Abc_InfoIsZero (unsigned *p, int nWords)
 
static int Abc_InfoIsOne (unsigned *p, int nWords)
 
static void Abc_InfoCopy (unsigned *p, unsigned *q, int nWords)
 
static void Abc_InfoAnd (unsigned *p, unsigned *q, int nWords)
 
static void Abc_InfoOr (unsigned *p, unsigned *q, int nWords)
 
static void Abc_InfoXor (unsigned *p, unsigned *q, int nWords)
 
static int Abc_InfoIsOrOne (unsigned *p, unsigned *q, int nWords)
 
static int Abc_InfoIsOrOne3 (unsigned *p, unsigned *q, unsigned *r, int nWords)
 
static int Abc_NtkIsNetlist (Abc_Ntk_t *pNtk)
 
static int Abc_NtkIsLogic (Abc_Ntk_t *pNtk)
 
static int Abc_NtkIsStrash (Abc_Ntk_t *pNtk)
 
static int Abc_NtkHasSop (Abc_Ntk_t *pNtk)
 
static int Abc_NtkHasBdd (Abc_Ntk_t *pNtk)
 
static int Abc_NtkHasAig (Abc_Ntk_t *pNtk)
 
static int Abc_NtkHasMapping (Abc_Ntk_t *pNtk)
 
static int Abc_NtkHasBlifMv (Abc_Ntk_t *pNtk)
 
static int Abc_NtkHasBlackbox (Abc_Ntk_t *pNtk)
 
static int Abc_NtkIsSopNetlist (Abc_Ntk_t *pNtk)
 
static int Abc_NtkIsAigNetlist (Abc_Ntk_t *pNtk)
 
static int Abc_NtkIsMappedNetlist (Abc_Ntk_t *pNtk)
 
static int Abc_NtkIsBlifMvNetlist (Abc_Ntk_t *pNtk)
 
static int Abc_NtkIsSopLogic (Abc_Ntk_t *pNtk)
 
static int Abc_NtkIsBddLogic (Abc_Ntk_t *pNtk)
 
static int Abc_NtkIsAigLogic (Abc_Ntk_t *pNtk)
 
static int Abc_NtkIsMappedLogic (Abc_Ntk_t *pNtk)
 
static char * Abc_NtkName (Abc_Ntk_t *pNtk)
 
static char * Abc_NtkSpec (Abc_Ntk_t *pNtk)
 
static Abc_Ntk_tAbc_NtkExdc (Abc_Ntk_t *pNtk)
 
static Abc_Ntk_tAbc_NtkBackup (Abc_Ntk_t *pNtk)
 
static int Abc_NtkStep (Abc_Ntk_t *pNtk)
 
static void Abc_NtkSetName (Abc_Ntk_t *pNtk, char *pName)
 
static void Abc_NtkSetSpec (Abc_Ntk_t *pNtk, char *pName)
 
static void Abc_NtkSetBackup (Abc_Ntk_t *pNtk, Abc_Ntk_t *pNetBackup)
 
static void Abc_NtkSetStep (Abc_Ntk_t *pNtk, int iStep)
 
static int Abc_NtkObjNum (Abc_Ntk_t *pNtk)
 
static int Abc_NtkObjNumMax (Abc_Ntk_t *pNtk)
 
static int Abc_NtkPiNum (Abc_Ntk_t *pNtk)
 
static int Abc_NtkPoNum (Abc_Ntk_t *pNtk)
 
static int Abc_NtkCiNum (Abc_Ntk_t *pNtk)
 
static int Abc_NtkCoNum (Abc_Ntk_t *pNtk)
 
static int Abc_NtkBoxNum (Abc_Ntk_t *pNtk)
 
static int Abc_NtkBiNum (Abc_Ntk_t *pNtk)
 
static int Abc_NtkBoNum (Abc_Ntk_t *pNtk)
 
static int Abc_NtkNetNum (Abc_Ntk_t *pNtk)
 
static int Abc_NtkNodeNum (Abc_Ntk_t *pNtk)
 
static int Abc_NtkLatchNum (Abc_Ntk_t *pNtk)
 
static int Abc_NtkWhiteboxNum (Abc_Ntk_t *pNtk)
 
static int Abc_NtkBlackboxNum (Abc_Ntk_t *pNtk)
 
static int Abc_NtkIsComb (Abc_Ntk_t *pNtk)
 
static int Abc_NtkHasOnlyLatchBoxes (Abc_Ntk_t *pNtk)
 
static int Abc_NtkConstrNum (Abc_Ntk_t *pNtk)
 
ABC_DLL Abc_Obj_tAbc_NtkCreateObj (Abc_Ntk_t *pNtk, Abc_ObjType_t Type)
 
static Abc_Obj_tAbc_NtkCreatePi (Abc_Ntk_t *pNtk)
 
static Abc_Obj_tAbc_NtkCreatePo (Abc_Ntk_t *pNtk)
 
static Abc_Obj_tAbc_NtkCreateBi (Abc_Ntk_t *pNtk)
 
static Abc_Obj_tAbc_NtkCreateBo (Abc_Ntk_t *pNtk)
 
static Abc_Obj_tAbc_NtkCreateNet (Abc_Ntk_t *pNtk)
 
static Abc_Obj_tAbc_NtkCreateNode (Abc_Ntk_t *pNtk)
 
static Abc_Obj_tAbc_NtkCreateLatch (Abc_Ntk_t *pNtk)
 
static Abc_Obj_tAbc_NtkCreateWhitebox (Abc_Ntk_t *pNtk)
 
static Abc_Obj_tAbc_NtkCreateBlackbox (Abc_Ntk_t *pNtk)
 
static Abc_Obj_tAbc_NtkObj (Abc_Ntk_t *pNtk, int i)
 
static Abc_Obj_tAbc_NtkPi (Abc_Ntk_t *pNtk, int i)
 
static Abc_Obj_tAbc_NtkPo (Abc_Ntk_t *pNtk, int i)
 
static Abc_Obj_tAbc_NtkCi (Abc_Ntk_t *pNtk, int i)
 
static Abc_Obj_tAbc_NtkCo (Abc_Ntk_t *pNtk, int i)
 
static Abc_Obj_tAbc_NtkBox (Abc_Ntk_t *pNtk, int i)
 
static int Abc_ObjIsComplement (Abc_Obj_t *p)
 
static Abc_Obj_tAbc_ObjRegular (Abc_Obj_t *p)
 
static Abc_Obj_tAbc_ObjNot (Abc_Obj_t *p)
 
static Abc_Obj_tAbc_ObjNotCond (Abc_Obj_t *p, int c)
 
static unsigned Abc_ObjType (Abc_Obj_t *pObj)
 
static unsigned Abc_ObjId (Abc_Obj_t *pObj)
 
static int Abc_ObjLevel (Abc_Obj_t *pObj)
 
static Vec_Int_tAbc_ObjFaninVec (Abc_Obj_t *pObj)
 
static Vec_Int_tAbc_ObjFanoutVec (Abc_Obj_t *pObj)
 
static Abc_Obj_tAbc_ObjCopy (Abc_Obj_t *pObj)
 
static Abc_Ntk_tAbc_ObjNtk (Abc_Obj_t *pObj)
 
static Abc_Ntk_tAbc_ObjModel (Abc_Obj_t *pObj)
 
static void * Abc_ObjData (Abc_Obj_t *pObj)
 
static Abc_Obj_tAbc_ObjEquiv (Abc_Obj_t *pObj)
 
static Abc_Obj_tAbc_ObjCopyCond (Abc_Obj_t *pObj)
 
static void Abc_ObjSetLevel (Abc_Obj_t *pObj, int Level)
 
static void Abc_ObjSetCopy (Abc_Obj_t *pObj, Abc_Obj_t *pCopy)
 
static void Abc_ObjSetData (Abc_Obj_t *pObj, void *pData)
 
static int Abc_ObjIsNone (Abc_Obj_t *pObj)
 
static int Abc_ObjIsPi (Abc_Obj_t *pObj)
 
static int Abc_ObjIsPo (Abc_Obj_t *pObj)
 
static int Abc_ObjIsBi (Abc_Obj_t *pObj)
 
static int Abc_ObjIsBo (Abc_Obj_t *pObj)
 
static int Abc_ObjIsCi (Abc_Obj_t *pObj)
 
static int Abc_ObjIsCo (Abc_Obj_t *pObj)
 
static int Abc_ObjIsTerm (Abc_Obj_t *pObj)
 
static int Abc_ObjIsNet (Abc_Obj_t *pObj)
 
static int Abc_ObjIsNode (Abc_Obj_t *pObj)
 
static int Abc_ObjIsLatch (Abc_Obj_t *pObj)
 
static int Abc_ObjIsBox (Abc_Obj_t *pObj)
 
static int Abc_ObjIsWhitebox (Abc_Obj_t *pObj)
 
static int Abc_ObjIsBlackbox (Abc_Obj_t *pObj)
 
static int Abc_ObjIsBarBuf (Abc_Obj_t *pObj)
 
static void Abc_ObjBlackboxToWhitebox (Abc_Obj_t *pObj)
 
static int Abc_ObjFaninNum (Abc_Obj_t *pObj)
 
static int Abc_ObjFanoutNum (Abc_Obj_t *pObj)
 
static int Abc_ObjFaninId (Abc_Obj_t *pObj, int i)
 
static int Abc_ObjFaninId0 (Abc_Obj_t *pObj)
 
static int Abc_ObjFaninId1 (Abc_Obj_t *pObj)
 
static int Abc_ObjFanoutEdgeNum (Abc_Obj_t *pObj, Abc_Obj_t *pFanout)
 
static Abc_Obj_tAbc_ObjFanout (Abc_Obj_t *pObj, int i)
 
static Abc_Obj_tAbc_ObjFanout0 (Abc_Obj_t *pObj)
 
static Abc_Obj_tAbc_ObjFanin (Abc_Obj_t *pObj, int i)
 
static Abc_Obj_tAbc_ObjFanin0 (Abc_Obj_t *pObj)
 
static Abc_Obj_tAbc_ObjFanin1 (Abc_Obj_t *pObj)
 
static Abc_Obj_tAbc_ObjFanin0Ntk (Abc_Obj_t *pObj)
 
static Abc_Obj_tAbc_ObjFanout0Ntk (Abc_Obj_t *pObj)
 
static int Abc_ObjFaninC0 (Abc_Obj_t *pObj)
 
static int Abc_ObjFaninC1 (Abc_Obj_t *pObj)
 
static int Abc_ObjFaninC (Abc_Obj_t *pObj, int i)
 
static void Abc_ObjSetFaninC (Abc_Obj_t *pObj, int i)
 
static void Abc_ObjXorFaninC (Abc_Obj_t *pObj, int i)
 
static Abc_Obj_tAbc_ObjChild (Abc_Obj_t *pObj, int i)
 
static Abc_Obj_tAbc_ObjChild0 (Abc_Obj_t *pObj)
 
static Abc_Obj_tAbc_ObjChild1 (Abc_Obj_t *pObj)
 
static Abc_Obj_tAbc_ObjChildCopy (Abc_Obj_t *pObj, int i)
 
static Abc_Obj_tAbc_ObjChild0Copy (Abc_Obj_t *pObj)
 
static Abc_Obj_tAbc_ObjChild1Copy (Abc_Obj_t *pObj)
 
static Abc_Obj_tAbc_ObjChild0Data (Abc_Obj_t *pObj)
 
static Abc_Obj_tAbc_ObjChild1Data (Abc_Obj_t *pObj)
 
static Abc_Obj_tAbc_ObjFromLit (Abc_Ntk_t *p, int iLit)
 
static int Abc_ObjToLit (Abc_Obj_t *p)
 
static int Abc_ObjFaninPhase (Abc_Obj_t *p, int i)
 
static void Abc_ObjFaninFlipPhase (Abc_Obj_t *p, int i)
 
static int Abc_AigNodeIsConst (Abc_Obj_t *pNode)
 
static int Abc_AigNodeIsAnd (Abc_Obj_t *pNode)
 
static int Abc_AigNodeIsChoice (Abc_Obj_t *pNode)
 
static int Abc_NodeIsPersistant (Abc_Obj_t *pNode)
 
static void Abc_NodeSetPersistant (Abc_Obj_t *pNode)
 
static void Abc_NodeClearPersistant (Abc_Obj_t *pNode)
 
static void Abc_NtkIncrementTravId (Abc_Ntk_t *p)
 
static int Abc_NodeTravId (Abc_Obj_t *p)
 
static void Abc_NodeSetTravId (Abc_Obj_t *p, int TravId)
 
static void Abc_NodeSetTravIdCurrent (Abc_Obj_t *p)
 
static void Abc_NodeSetTravIdPrevious (Abc_Obj_t *p)
 
static int Abc_NodeIsTravIdCurrent (Abc_Obj_t *p)
 
static int Abc_NodeIsTravIdPrevious (Abc_Obj_t *p)
 
static void Abc_NodeSetTravIdCurrentId (Abc_Ntk_t *p, int i)
 
static int Abc_NodeIsTravIdCurrentId (Abc_Ntk_t *p, int i)
 
static void Abc_LatchSetInitNone (Abc_Obj_t *pLatch)
 
static void Abc_LatchSetInit0 (Abc_Obj_t *pLatch)
 
static void Abc_LatchSetInit1 (Abc_Obj_t *pLatch)
 
static void Abc_LatchSetInitDc (Abc_Obj_t *pLatch)
 
static int Abc_LatchIsInitNone (Abc_Obj_t *pLatch)
 
static int Abc_LatchIsInit0 (Abc_Obj_t *pLatch)
 
static int Abc_LatchIsInit1 (Abc_Obj_t *pLatch)
 
static int Abc_LatchIsInitDc (Abc_Obj_t *pLatch)
 
static int Abc_LatchInit (Abc_Obj_t *pLatch)
 
static void * Abc_NtkGlobalBdd (Abc_Ntk_t *pNtk)
 
static void * Abc_NtkGlobalBddMan (Abc_Ntk_t *pNtk)
 
static void ** Abc_NtkGlobalBddArray (Abc_Ntk_t *pNtk)
 
static void * Abc_ObjGlobalBdd (Abc_Obj_t *pObj)
 
static void Abc_ObjSetGlobalBdd (Abc_Obj_t *pObj, void *bF)
 
static void * Abc_NtkMvVar (Abc_Ntk_t *pNtk)
 
static void * Abc_NtkMvVarMan (Abc_Ntk_t *pNtk)
 
static void * Abc_ObjMvVar (Abc_Obj_t *pObj)
 
static int Abc_ObjMvVarNum (Abc_Obj_t *pObj)
 
static void Abc_ObjSetMvVar (Abc_Obj_t *pObj, void *pV)
 
ABC_DLL Abc_Aig_tAbc_AigAlloc (Abc_Ntk_t *pNtk)
 FUNCTION DECLARATIONS ///. More...
 
ABC_DLL void Abc_AigFree (Abc_Aig_t *pMan)
 
ABC_DLL int Abc_AigCleanup (Abc_Aig_t *pMan)
 
ABC_DLL int Abc_AigCheck (Abc_Aig_t *pMan)
 
ABC_DLL int Abc_AigLevel (Abc_Ntk_t *pNtk)
 
ABC_DLL Abc_Obj_tAbc_AigConst1 (Abc_Ntk_t *pNtk)
 
ABC_DLL Abc_Obj_tAbc_AigAnd (Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
 
ABC_DLL Abc_Obj_tAbc_AigAndLookup (Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
 
ABC_DLL Abc_Obj_tAbc_AigXorLookup (Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1, int *pType)
 
ABC_DLL Abc_Obj_tAbc_AigMuxLookup (Abc_Aig_t *pMan, Abc_Obj_t *pC, Abc_Obj_t *pT, Abc_Obj_t *pE, int *pType)
 
ABC_DLL Abc_Obj_tAbc_AigOr (Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
 
ABC_DLL Abc_Obj_tAbc_AigXor (Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
 
ABC_DLL Abc_Obj_tAbc_AigMux (Abc_Aig_t *pMan, Abc_Obj_t *pC, Abc_Obj_t *p1, Abc_Obj_t *p0)
 
ABC_DLL Abc_Obj_tAbc_AigMiter (Abc_Aig_t *pMan, Vec_Ptr_t *vPairs, int fImplic)
 
ABC_DLL void Abc_AigReplace (Abc_Aig_t *pMan, Abc_Obj_t *pOld, Abc_Obj_t *pNew, int fUpdateLevel)
 
ABC_DLL void Abc_AigDeleteNode (Abc_Aig_t *pMan, Abc_Obj_t *pOld)
 
ABC_DLL void Abc_AigRehash (Abc_Aig_t *pMan)
 
ABC_DLL int Abc_AigNodeHasComplFanoutEdge (Abc_Obj_t *pNode)
 
ABC_DLL int Abc_AigNodeHasComplFanoutEdgeTrav (Abc_Obj_t *pNode)
 
ABC_DLL void Abc_AigPrintNode (Abc_Obj_t *pNode)
 
ABC_DLL int Abc_AigNodeIsAcyclic (Abc_Obj_t *pNode, Abc_Obj_t *pRoot)
 
ABC_DLL void Abc_AigCheckFaninOrder (Abc_Aig_t *pMan)
 
ABC_DLL void Abc_AigSetNodePhases (Abc_Ntk_t *pNtk)
 
ABC_DLL Vec_Ptr_tAbc_AigUpdateStart (Abc_Aig_t *pMan, Vec_Ptr_t **pvUpdatedNets)
 
ABC_DLL void Abc_AigUpdateStop (Abc_Aig_t *pMan)
 
ABC_DLL void Abc_AigUpdateReset (Abc_Aig_t *pMan)
 
ABC_DLL int Abc_NtkAttach (Abc_Ntk_t *pNtk)
 FUNCTION DEFINITIONS ///. More...
 
ABC_DLL Abc_Ntk_tAbc_NtkToBarBufs (Abc_Ntk_t *pNtk)
 
ABC_DLL Abc_Ntk_tAbc_NtkFromBarBufs (Abc_Ntk_t *pNtkBase, Abc_Ntk_t *pNtk)
 
ABC_DLL Abc_Ntk_tAbc_NtkBarBufsToBuffers (Abc_Ntk_t *pNtk)
 
ABC_DLL Abc_Ntk_tAbc_NtkBarBufsFromBuffers (Abc_Ntk_t *pNtkBase, Abc_Ntk_t *pNtk)
 
ABC_DLL void Abc_NtkStartMvVars (Abc_Ntk_t *pNtk)
 DECLARATIONS ///. More...
 
ABC_DLL void Abc_NtkFreeMvVars (Abc_Ntk_t *pNtk)
 
ABC_DLL void Abc_NtkSetMvVarValues (Abc_Obj_t *pObj, int nValues)
 
ABC_DLL Abc_Ntk_tAbc_NtkStrashBlifMv (Abc_Ntk_t *pNtk)
 
ABC_DLL Abc_Ntk_tAbc_NtkInsertBlifMv (Abc_Ntk_t *pNtkBase, Abc_Ntk_t *pNtkLogic)
 
ABC_DLL int Abc_NtkConvertToBlifMv (Abc_Ntk_t *pNtk)
 
ABC_DLL char * Abc_NodeConvertSopToMvSop (int nVars, Vec_Int_t *vSop0, Vec_Int_t *vSop1)
 
ABC_DLL int Abc_NodeEvalMvCost (int nVars, Vec_Int_t *vSop0, Vec_Int_t *vSop1)
 
ABC_DLL Abc_Ntk_tAbc_NtkBalance (Abc_Ntk_t *pNtk, int fDuplicate, int fSelective, int fUpdateLevel)
 FUNCTION DEFINITIONS ///. More...
 
ABC_DLL int Abc_NtkCheck (Abc_Ntk_t *pNtk)
 FUNCTION DEFINITIONS ///. More...
 
ABC_DLL int Abc_NtkCheckRead (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NtkDoCheck (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NtkCheckObj (Abc_Ntk_t *pNtk, Abc_Obj_t *pObj)
 
ABC_DLL int Abc_NtkCompareSignals (Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int fOnlyPis, int fComb)
 
ABC_DLL int Abc_NtkIsAcyclicHierarchy (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NtkCheckUniqueCiNames (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NtkCheckUniqueCoNames (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NtkCheckUniqueCioNames (Abc_Ntk_t *pNtk)
 
ABC_DLL Abc_Ntk_tAbc_NtkCollapse (Abc_Ntk_t *pNtk, int fBddSizeMax, int fDualRail, int fReorder, int fVerbose)
 FUNCTION DEFINITIONS ///. More...
 
ABC_DLL void * Abc_NodeGetCutsRecursive (void *p, Abc_Obj_t *pObj, int fDag, int fTree)
 
ABC_DLL void * Abc_NodeGetCuts (void *p, Abc_Obj_t *pObj, int fDag, int fTree)
 
ABC_DLL void Abc_NodeGetCutsSeq (void *p, Abc_Obj_t *pObj, int fFirst)
 
ABC_DLL void * Abc_NodeReadCuts (void *p, Abc_Obj_t *pObj)
 
ABC_DLL void Abc_NodeFreeCuts (void *p, Abc_Obj_t *pObj)
 
ABC_DLL int Abc_NtkPhaseFrameNum (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NtkDarPrintCone (Abc_Ntk_t *pNtk)
 
ABC_DLL Abc_Ntk_tAbc_NtkBalanceExor (Abc_Ntk_t *pNtk, int fUpdateLevel, int fVerbose)
 
ABC_DLL Abc_Ntk_tAbc_NtkDarLatchSweep (Abc_Ntk_t *pNtk, int fLatchConst, int fLatchEqual, int fSaveNames, int fUseMvSweep, int nFramesSymb, int nFramesSatur, int fVerbose, int fVeryVerbose)
 
ABC_DLL float Abc_NtkDelayTraceLut (Abc_Ntk_t *pNtk, int fUseLutLib)
 
ABC_DLL Vec_Ptr_tAbc_NtkDfs (Abc_Ntk_t *pNtk, int fCollectAll)
 
ABC_DLL Vec_Ptr_tAbc_NtkDfsNodes (Abc_Ntk_t *pNtk, Abc_Obj_t **ppNodes, int nNodes)
 
ABC_DLL Vec_Ptr_tAbc_NtkDfsReverse (Abc_Ntk_t *pNtk)
 
ABC_DLL Vec_Ptr_tAbc_NtkDfsReverseNodes (Abc_Ntk_t *pNtk, Abc_Obj_t **ppNodes, int nNodes)
 
ABC_DLL Vec_Ptr_tAbc_NtkDfsReverseNodesContained (Abc_Ntk_t *pNtk, Abc_Obj_t **ppNodes, int nNodes)
 
ABC_DLL Vec_Ptr_tAbc_NtkDfsSeq (Abc_Ntk_t *pNtk)
 
ABC_DLL Vec_Ptr_tAbc_NtkDfsSeqReverse (Abc_Ntk_t *pNtk)
 
ABC_DLL Vec_Ptr_tAbc_NtkDfsIter (Abc_Ntk_t *pNtk, int fCollectAll)
 
ABC_DLL Vec_Ptr_tAbc_NtkDfsIterNodes (Abc_Ntk_t *pNtk, Vec_Ptr_t *vRoots)
 
ABC_DLL Vec_Ptr_tAbc_NtkDfsHie (Abc_Ntk_t *pNtk, int fCollectAll)
 
ABC_DLL int Abc_NtkIsDfsOrdered (Abc_Ntk_t *pNtk)
 
ABC_DLL Vec_Ptr_tAbc_NtkDfsWithBoxes (Abc_Ntk_t *pNtk)
 
ABC_DLL Vec_Ptr_tAbc_NtkSupport (Abc_Ntk_t *pNtk)
 
ABC_DLL Vec_Ptr_tAbc_NtkNodeSupport (Abc_Ntk_t *pNtk, Abc_Obj_t **ppNodes, int nNodes)
 
ABC_DLL Vec_Ptr_tAbc_AigDfs (Abc_Ntk_t *pNtk, int fCollectAll, int fCollectCos)
 
ABC_DLL Vec_Ptr_tAbc_AigDfsMap (Abc_Ntk_t *pNtk)
 
ABC_DLL Vec_Vec_tAbc_DfsLevelized (Abc_Obj_t *pNode, int fTfi)
 
ABC_DLL Vec_Vec_tAbc_NtkLevelize (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NtkLevel (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NtkLevelReverse (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NtkIsAcyclic (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NtkIsAcyclicWithBoxes (Abc_Ntk_t *pNtk)
 
ABC_DLL Vec_Ptr_tAbc_AigGetLevelizedOrder (Abc_Ntk_t *pNtk, int fCollectCis)
 
ABC_DLL void Abc_ObjAddFanin (Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
 
ABC_DLL void Abc_ObjDeleteFanin (Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
 
ABC_DLL void Abc_ObjRemoveFanins (Abc_Obj_t *pObj)
 
ABC_DLL void Abc_ObjPatchFanin (Abc_Obj_t *pObj, Abc_Obj_t *pFaninOld, Abc_Obj_t *pFaninNew)
 
ABC_DLL Abc_Obj_tAbc_ObjInsertBetween (Abc_Obj_t *pNodeIn, Abc_Obj_t *pNodeOut, Abc_ObjType_t Type)
 
ABC_DLL void Abc_ObjTransferFanout (Abc_Obj_t *pObjOld, Abc_Obj_t *pObjNew)
 
ABC_DLL void Abc_ObjReplace (Abc_Obj_t *pObjOld, Abc_Obj_t *pObjNew)
 
ABC_DLL int Abc_ObjFanoutFaninNum (Abc_Obj_t *pFanout, Abc_Obj_t *pFanin)
 
ABC_DLL int Abc_NtkMakeLegit (Abc_Ntk_t *pNtk)
 
ABC_DLL Abc_Ntk_tAbc_NtkFraig (Abc_Ntk_t *pNtk, void *pParams, int fAllNodes, int fExdc)
 FUNCTION DEFINITIONS ///. More...
 
ABC_DLL void * Abc_NtkToFraig (Abc_Ntk_t *pNtk, void *pParams, int fAllNodes, int fExdc)
 
ABC_DLL Abc_Ntk_tAbc_NtkFraigTrust (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NtkFraigStore (Abc_Ntk_t *pNtk)
 
ABC_DLL Abc_Ntk_tAbc_NtkFraigRestore ()
 
ABC_DLL void Abc_NtkFraigStoreClean ()
 
ABC_DLL int Abc_NtkSopToBdd (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NtkBddToSop (Abc_Ntk_t *pNtk, int fDirect)
 
ABC_DLL void Abc_NodeBddToCnf (Abc_Obj_t *pNode, Mem_Flex_t *pMmMan, Vec_Str_t *vCube, int fAllPrimes, char **ppSop0, char **ppSop1)
 
ABC_DLL void Abc_NtkLogicMakeDirectSops (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NtkSopToAig (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NtkAigToBdd (Abc_Ntk_t *pNtk)
 
ABC_DLL Gia_Man_tAbc_NtkAigToGia (Abc_Ntk_t *p)
 
ABC_DLL int Abc_NtkMapToSop (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NtkToSop (Abc_Ntk_t *pNtk, int fDirect)
 
ABC_DLL int Abc_NtkToBdd (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NtkToAig (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NtkHaigStart (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NtkHaigStop (Abc_Ntk_t *pNtk)
 
ABC_DLL Abc_Ntk_tAbc_NtkHaigUse (Abc_Ntk_t *pNtk)
 
ABC_DLL Abc_Ntk_tAbc_NtkFlattenLogicHierarchy (Abc_Ntk_t *pNtk)
 
ABC_DLL Abc_Ntk_tAbc_NtkConvertBlackboxes (Abc_Ntk_t *pNtk)
 
ABC_DLL Abc_Ntk_tAbc_NtkInsertNewLogic (Abc_Ntk_t *pNtkH, Abc_Ntk_t *pNtkL)
 
ABC_DLL void Abc_NtkPrintBoxInfo (Abc_Ntk_t *pNtk)
 
ABC_DLL Gia_Man_tAbc_NtkFlattenHierarchyGia (Abc_Ntk_t *pNtk, Vec_Ptr_t **pvBuffers, int fVerbose)
 
ABC_DLL void Abc_NtkInsertHierarchyGia (Abc_Ntk_t *pNtk, Abc_Ntk_t *pNew, int fVerbose)
 
ABC_DLL int Abc_NtkLatchIsSelfFeed (Abc_Obj_t *pLatch)
 
ABC_DLL int Abc_NtkCountSelfFeedLatches (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NtkRemoveSelfFeedLatches (Abc_Ntk_t *pNtk)
 
ABC_DLL Vec_Int_tAbc_NtkCollectLatchValues (Abc_Ntk_t *pNtk)
 
ABC_DLL char * Abc_NtkCollectLatchValuesStr (Abc_Ntk_t *pNtk)
 
ABC_DLL void Abc_NtkInsertLatchValues (Abc_Ntk_t *pNtk, Vec_Int_t *vValues)
 
ABC_DLL Abc_Obj_tAbc_NtkAddLatch (Abc_Ntk_t *pNtk, Abc_Obj_t *pDriver, Abc_InitType_t Init)
 
ABC_DLL void Abc_NtkConvertDcLatches (Abc_Ntk_t *pNtk)
 
ABC_DLL Vec_Ptr_tAbc_NtkConverLatchNamesIntoNumbers (Abc_Ntk_t *pNtk)
 
ABC_DLL Abc_Des_tAbc_DesCreate (char *pName)
 DECLARATIONS ///. More...
 
ABC_DLL void Abc_DesCleanManPointer (Abc_Des_t *p, void *pMan)
 
ABC_DLL void Abc_DesFree (Abc_Des_t *p, Abc_Ntk_t *pNtk)
 
ABC_DLL Abc_Des_tAbc_DesDup (Abc_Des_t *p)
 
ABC_DLL void Abc_DesPrint (Abc_Des_t *p)
 
ABC_DLL int Abc_DesAddModel (Abc_Des_t *p, Abc_Ntk_t *pNtk)
 
ABC_DLL Abc_Ntk_tAbc_DesFindModelByName (Abc_Des_t *p, char *pName)
 
ABC_DLL int Abc_DesFindTopLevelModels (Abc_Des_t *p)
 
ABC_DLL Abc_Ntk_tAbc_DesDeriveRoot (Abc_Des_t *p)
 
ABC_DLL void Abc_NtkWriteLogFile (char *pFileName, Abc_Cex_t *pSeqCex, int Status, int nFrames, char *pCommand)
 DECLARATIONS ///. More...
 
ABC_DLL Abc_Obj_tAbc_NtkFetchTwinNode (Abc_Obj_t *pNode)
 
ABC_DLL int Abc_NtkMinimumBase (Abc_Ntk_t *pNtk)
 FUNCTION DEFINITIONS ///. More...
 
ABC_DLL int Abc_NodeMinimumBase (Abc_Obj_t *pNode)
 
ABC_DLL int Abc_NtkRemoveDupFanins (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NodeRemoveDupFanins (Abc_Obj_t *pNode)
 
ABC_DLL Abc_Ntk_tAbc_NtkMiter (Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int fComb, int nPartSize, int fImplic, int fMulti)
 FUNCTION DEFINITIONS ///. More...
 
ABC_DLL void Abc_NtkMiterAddCone (Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkMiter, Abc_Obj_t *pNode)
 
ABC_DLL Abc_Ntk_tAbc_NtkMiterAnd (Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int fOr, int fCompl2)
 
ABC_DLL Abc_Ntk_tAbc_NtkMiterCofactor (Abc_Ntk_t *pNtk, Vec_Int_t *vPiValues)
 
ABC_DLL Abc_Ntk_tAbc_NtkMiterForCofactors (Abc_Ntk_t *pNtk, int Out, int In1, int In2)
 
ABC_DLL Abc_Ntk_tAbc_NtkMiterQuantify (Abc_Ntk_t *pNtk, int In, int fExist)
 
ABC_DLL Abc_Ntk_tAbc_NtkMiterQuantifyPis (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NtkMiterIsConstant (Abc_Ntk_t *pMiter)
 
ABC_DLL void Abc_NtkMiterReport (Abc_Ntk_t *pMiter)
 
ABC_DLL Abc_Ntk_tAbc_NtkFrames (Abc_Ntk_t *pNtk, int nFrames, int fInitial, int fVerbose)
 
ABC_DLL int Abc_NtkCombinePos (Abc_Ntk_t *pNtk, int fAnd, int fXor)
 
ABC_DLL char * Abc_ObjName (Abc_Obj_t *pNode)
 DECLARATIONS ///. More...
 
ABC_DLL char * Abc_ObjAssignName (Abc_Obj_t *pObj, char *pName, char *pSuffix)
 
ABC_DLL char * Abc_ObjNamePrefix (Abc_Obj_t *pObj, char *pPrefix)
 
ABC_DLL char * Abc_ObjNameSuffix (Abc_Obj_t *pObj, char *pSuffix)
 
ABC_DLL char * Abc_ObjNameDummy (char *pPrefix, int Num, int nDigits)
 
ABC_DLL void Abc_NtkTrasferNames (Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkNew)
 
ABC_DLL void Abc_NtkTrasferNamesNoLatches (Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkNew)
 
ABC_DLL Vec_Ptr_tAbc_NodeGetFaninNames (Abc_Obj_t *pNode)
 
ABC_DLL Vec_Ptr_tAbc_NodeGetFakeNames (int nNames)
 
ABC_DLL void Abc_NodeFreeNames (Vec_Ptr_t *vNames)
 
ABC_DLL char ** Abc_NtkCollectCioNames (Abc_Ntk_t *pNtk, int fCollectCos)
 
ABC_DLL int Abc_NodeCompareNames (Abc_Obj_t **pp1, Abc_Obj_t **pp2)
 
ABC_DLL void Abc_NtkOrderObjsByName (Abc_Ntk_t *pNtk, int fComb)
 
ABC_DLL void Abc_NtkAddDummyPiNames (Abc_Ntk_t *pNtk)
 
ABC_DLL void Abc_NtkAddDummyPoNames (Abc_Ntk_t *pNtk)
 
ABC_DLL void Abc_NtkAddDummyBoxNames (Abc_Ntk_t *pNtk)
 
ABC_DLL void Abc_NtkShortNames (Abc_Ntk_t *pNtk)
 
ABC_DLL void Abc_NtkStartNameIds (Abc_Ntk_t *p)
 
ABC_DLL void Abc_NtkTransferNameIds (Abc_Ntk_t *p, Abc_Ntk_t *pNew)
 
ABC_DLL void Abc_NtkUpdateNameIds (Abc_Ntk_t *p)
 
ABC_DLL Abc_Ntk_tAbc_NtkToLogic (Abc_Ntk_t *pNtk)
 FUNCTION DEFINITIONS ///. More...
 
ABC_DLL Abc_Ntk_tAbc_NtkToNetlist (Abc_Ntk_t *pNtk)
 
ABC_DLL Abc_Ntk_tAbc_NtkToNetlistBench (Abc_Ntk_t *pNtk)
 
ABC_DLL Abc_Ntk_tAbc_NtkDeriveFromBdd (void *dd, void *bFunc, char *pNamePo, Vec_Ptr_t *vNamesPi)
 FUNCTION DEFINITIONS ///. More...
 
ABC_DLL Abc_Ntk_tAbc_NtkBddToMuxes (Abc_Ntk_t *pNtk)
 
ABC_DLL void * Abc_NtkBuildGlobalBdds (Abc_Ntk_t *pNtk, int fBddSizeMax, int fDropInternal, int fReorder, int fVerbose)
 
ABC_DLL void * Abc_NtkFreeGlobalBdds (Abc_Ntk_t *pNtk, int fFreeMan)
 
ABC_DLL int Abc_NtkSizeOfGlobalBdds (Abc_Ntk_t *pNtk)
 
ABC_DLL Abc_Ntk_tAbc_NtkAlloc (Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
 DECLARATIONS ///. More...
 
ABC_DLL Abc_Ntk_tAbc_NtkStartFrom (Abc_Ntk_t *pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func)
 
ABC_DLL Abc_Ntk_tAbc_NtkStartFromNoLatches (Abc_Ntk_t *pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func)
 
ABC_DLL void Abc_NtkFinalize (Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkNew)
 
ABC_DLL Abc_Ntk_tAbc_NtkStartRead (char *pName)
 
ABC_DLL void Abc_NtkFinalizeRead (Abc_Ntk_t *pNtk)
 
ABC_DLL Abc_Ntk_tAbc_NtkDup (Abc_Ntk_t *pNtk)
 
ABC_DLL Abc_Ntk_tAbc_NtkDupDfs (Abc_Ntk_t *pNtk)
 
ABC_DLL Abc_Ntk_tAbc_NtkDupTransformMiter (Abc_Ntk_t *pNtk)
 
ABC_DLL Abc_Ntk_tAbc_NtkCreateCone (Abc_Ntk_t *pNtk, Abc_Obj_t *pNode, char *pNodeName, int fUseAllCis)
 
ABC_DLL Abc_Ntk_tAbc_NtkCreateConeArray (Abc_Ntk_t *pNtk, Vec_Ptr_t *vRoots, int fUseAllCis)
 
ABC_DLL void Abc_NtkAppendToCone (Abc_Ntk_t *pNtkNew, Abc_Ntk_t *pNtk, Vec_Ptr_t *vRoots)
 
ABC_DLL Abc_Ntk_tAbc_NtkCreateMffc (Abc_Ntk_t *pNtk, Abc_Obj_t *pNode, char *pNodeName)
 
ABC_DLL Abc_Ntk_tAbc_NtkCreateTarget (Abc_Ntk_t *pNtk, Vec_Ptr_t *vRoots, Vec_Int_t *vValues)
 
ABC_DLL Abc_Ntk_tAbc_NtkCreateFromNode (Abc_Ntk_t *pNtk, Abc_Obj_t *pNode)
 
ABC_DLL Abc_Ntk_tAbc_NtkCreateWithNode (char *pSop)
 
ABC_DLL void Abc_NtkDelete (Abc_Ntk_t *pNtk)
 
ABC_DLL void Abc_NtkFixNonDrivenNets (Abc_Ntk_t *pNtk)
 
ABC_DLL void Abc_NtkMakeComb (Abc_Ntk_t *pNtk, int fRemoveLatches)
 
ABC_DLL void Abc_NtkPermute (Abc_Ntk_t *pNtk, int fInputs, int fOutputs, int fFlops, char *pFlopPermFile)
 
ABC_DLL void Abc_NtkUnpermute (Abc_Ntk_t *pNtk)
 
ABC_DLL Abc_Obj_tAbc_ObjAlloc (Abc_Ntk_t *pNtk, Abc_ObjType_t Type)
 DECLARATIONS ///. More...
 
ABC_DLL void Abc_ObjRecycle (Abc_Obj_t *pObj)
 
ABC_DLL void Abc_NtkDeleteObj (Abc_Obj_t *pObj)
 
ABC_DLL void Abc_NtkDeleteObjPo (Abc_Obj_t *pObj)
 
ABC_DLL void Abc_NtkDeleteObj_rec (Abc_Obj_t *pObj, int fOnlyNodes)
 
ABC_DLL void Abc_NtkDeleteAll_rec (Abc_Obj_t *pObj)
 
ABC_DLL Abc_Obj_tAbc_NtkDupObj (Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
 
ABC_DLL Abc_Obj_tAbc_NtkDupBox (Abc_Ntk_t *pNtkNew, Abc_Obj_t *pBox, int fCopyName)
 
ABC_DLL Abc_Obj_tAbc_NtkCloneObj (Abc_Obj_t *pNode)
 
ABC_DLL Abc_Obj_tAbc_NtkFindNode (Abc_Ntk_t *pNtk, char *pName)
 
ABC_DLL Abc_Obj_tAbc_NtkFindNet (Abc_Ntk_t *pNtk, char *pName)
 
ABC_DLL Abc_Obj_tAbc_NtkFindCi (Abc_Ntk_t *pNtk, char *pName)
 
ABC_DLL Abc_Obj_tAbc_NtkFindCo (Abc_Ntk_t *pNtk, char *pName)
 
ABC_DLL Abc_Obj_tAbc_NtkFindOrCreateNet (Abc_Ntk_t *pNtk, char *pName)
 
ABC_DLL Abc_Obj_tAbc_NtkCreateNodeConst0 (Abc_Ntk_t *pNtk)
 
ABC_DLL Abc_Obj_tAbc_NtkCreateNodeConst1 (Abc_Ntk_t *pNtk)
 
ABC_DLL Abc_Obj_tAbc_NtkCreateNodeInv (Abc_Ntk_t *pNtk, Abc_Obj_t *pFanin)
 
ABC_DLL Abc_Obj_tAbc_NtkCreateNodeBuf (Abc_Ntk_t *pNtk, Abc_Obj_t *pFanin)
 
ABC_DLL Abc_Obj_tAbc_NtkCreateNodeAnd (Abc_Ntk_t *pNtk, Vec_Ptr_t *vFanins)
 
ABC_DLL Abc_Obj_tAbc_NtkCreateNodeOr (Abc_Ntk_t *pNtk, Vec_Ptr_t *vFanins)
 
ABC_DLL Abc_Obj_tAbc_NtkCreateNodeExor (Abc_Ntk_t *pNtk, Vec_Ptr_t *vFanins)
 
ABC_DLL Abc_Obj_tAbc_NtkCreateNodeMux (Abc_Ntk_t *pNtk, Abc_Obj_t *pNodeC, Abc_Obj_t *pNode1, Abc_Obj_t *pNode0)
 
ABC_DLL int Abc_NodeIsConst (Abc_Obj_t *pNode)
 
ABC_DLL int Abc_NodeIsConst0 (Abc_Obj_t *pNode)
 
ABC_DLL int Abc_NodeIsConst1 (Abc_Obj_t *pNode)
 
ABC_DLL int Abc_NodeIsBuf (Abc_Obj_t *pNode)
 
ABC_DLL int Abc_NodeIsInv (Abc_Obj_t *pNode)
 
ABC_DLL void Abc_NodeComplement (Abc_Obj_t *pNode)
 
ABC_DLL void Abc_NodeComplementInput (Abc_Obj_t *pNode, Abc_Obj_t *pFanin)
 
ABC_DLL Odc_Man_tAbc_NtkDontCareAlloc (int nVarsMax, int nLevels, int fVerbose, int fVeryVerbose)
 FUNCTION DEFINITIONS ///. More...
 
ABC_DLL void Abc_NtkDontCareClear (Odc_Man_t *p)
 
ABC_DLL void Abc_NtkDontCareFree (Odc_Man_t *p)
 
ABC_DLL int Abc_NtkDontCareCompute (Odc_Man_t *p, Abc_Obj_t *pNode, Vec_Ptr_t *vLeaves, unsigned *puTruth)
 
ABC_DLL float Abc_NtkMfsTotalSwitching (Abc_Ntk_t *pNtk)
 
ABC_DLL void Abc_NtkPrintStats (Abc_Ntk_t *pNtk, int fFactored, int fSaveBest, int fDumpResult, int fUseLutLib, int fPrintMuxes, int fPower, int fGlitch, int fSkipBuf)
 
ABC_DLL void Abc_NtkPrintIo (FILE *pFile, Abc_Ntk_t *pNtk, int fPrintFlops)
 
ABC_DLL void Abc_NtkPrintLatch (FILE *pFile, Abc_Ntk_t *pNtk)
 
ABC_DLL void Abc_NtkPrintFanio (FILE *pFile, Abc_Ntk_t *pNtk, int fUsePis)
 
ABC_DLL void Abc_NtkPrintFanioNew (FILE *pFile, Abc_Ntk_t *pNtk, int fMffc)
 
ABC_DLL void Abc_NodePrintFanio (FILE *pFile, Abc_Obj_t *pNode)
 
ABC_DLL void Abc_NtkPrintFactor (FILE *pFile, Abc_Ntk_t *pNtk, int fUseRealNames)
 
ABC_DLL void Abc_NodePrintFactor (FILE *pFile, Abc_Obj_t *pNode, int fUseRealNames)
 
ABC_DLL void Abc_NtkPrintLevel (FILE *pFile, Abc_Ntk_t *pNtk, int fProfile, int fListNodes, int fVerbose)
 
ABC_DLL void Abc_NodePrintLevel (FILE *pFile, Abc_Obj_t *pNode)
 
ABC_DLL void Abc_NtkPrintSkews (FILE *pFile, Abc_Ntk_t *pNtk, int fPrintAll)
 
ABC_DLL void Abc_ObjPrint (FILE *pFile, Abc_Obj_t *pObj)
 
ABC_DLL void Abc_NtkShow6VarFunc (char *pF0, char *pF1)
 
ABC_DLL int Abc_NtkMiterProve (Abc_Ntk_t **ppNtk, void *pParams)
 FUNCTION DEFINITIONS ///. More...
 
ABC_DLL int Abc_NtkIvyProve (Abc_Ntk_t **ppNtk, void *pPars)
 
ABC_DLL void Abc_NtkRecStart3 (Gia_Man_t *p, int nVars, int nCuts, int fFuncOnly, int fVerbose)
 
ABC_DLL void Abc_NtkRecStop3 ()
 
ABC_DLL void Abc_NtkRecAdd3 (Abc_Ntk_t *pNtk, int fUseSOPB)
 
ABC_DLL void Abc_NtkRecPs3 (int fPrintLib)
 
ABC_DLL Gia_Man_tAbc_NtkRecGetGia3 ()
 
ABC_DLL int Abc_NtkRecIsRunning3 ()
 
ABC_DLL void Abc_NtkRecLibMerge3 (Gia_Man_t *pGia)
 
ABC_DLL int Abc_NtkRecInputNum3 ()
 
ABC_DLL Abc_ManCut_tAbc_NtkManCutStart (int nNodeSizeMax, int nConeSizeMax, int nNodeFanStop, int nConeFanStop)
 
ABC_DLL void Abc_NtkManCutStop (Abc_ManCut_t *p)
 
ABC_DLL Vec_Ptr_tAbc_NtkManCutReadCutLarge (Abc_ManCut_t *p)
 
ABC_DLL Vec_Ptr_tAbc_NtkManCutReadCutSmall (Abc_ManCut_t *p)
 
ABC_DLL Vec_Ptr_tAbc_NtkManCutReadVisited (Abc_ManCut_t *p)
 
ABC_DLL Vec_Ptr_tAbc_NodeFindCut (Abc_ManCut_t *p, Abc_Obj_t *pRoot, int fContain)
 
ABC_DLL void Abc_NodeConeCollect (Abc_Obj_t **ppRoots, int nRoots, Vec_Ptr_t *vFanins, Vec_Ptr_t *vVisited, int fIncludeFanins)
 
ABC_DLL Vec_Ptr_tAbc_NodeCollectTfoCands (Abc_ManCut_t *p, Abc_Obj_t *pRoot, Vec_Ptr_t *vFanins, int LevelMax)
 
ABC_DLL int Abc_NodeMffcSize (Abc_Obj_t *pNode)
 FUNCTION DEFINITIONS ///. More...
 
ABC_DLL int Abc_NodeMffcSizeSupp (Abc_Obj_t *pNode)
 
ABC_DLL int Abc_NodeMffcSizeStop (Abc_Obj_t *pNode)
 
ABC_DLL int Abc_NodeMffcLabelAig (Abc_Obj_t *pNode)
 
ABC_DLL int Abc_NodeMffcLabel (Abc_Obj_t *pNode)
 
ABC_DLL void Abc_NodeMffcConeSupp (Abc_Obj_t *pNode, Vec_Ptr_t *vCone, Vec_Ptr_t *vSupp)
 
ABC_DLL int Abc_NodeDeref_rec (Abc_Obj_t *pNode)
 
ABC_DLL int Abc_NodeRef_rec (Abc_Obj_t *pNode)
 
ABC_DLL int Abc_NtkRefactor (Abc_Ntk_t *pNtk, int nNodeSizeMax, int nConeSizeMax, int fUpdateLevel, int fUseZeros, int fUseDcs, int fVerbose)
 FUNCTION DEFINITIONS ///. More...
 
ABC_DLL int Abc_NtkRewrite (Abc_Ntk_t *pNtk, int fUpdateLevel, int fUseZeros, int fVerbose, int fVeryVerbose, int fPlaceEnable)
 FUNCTION DEFINITIONS ///. More...
 
ABC_DLL int Abc_NtkMiterSat (Abc_Ntk_t *pNtk, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, int fVerbose, ABC_INT64_T *pNumConfs, ABC_INT64_T *pNumInspects)
 FUNCTION DEFINITIONS ///. More...
 
ABC_DLL void * Abc_NtkMiterSatCreate (Abc_Ntk_t *pNtk, int fAllPrimes)
 
ABC_DLL char * Abc_SopRegister (Mem_Flex_t *pMan, char *pName)
 DECLARATIONS ///. More...
 
ABC_DLL char * Abc_SopStart (Mem_Flex_t *pMan, int nCubes, int nVars)
 
ABC_DLL char * Abc_SopCreateConst0 (Mem_Flex_t *pMan)
 
ABC_DLL char * Abc_SopCreateConst1 (Mem_Flex_t *pMan)
 
ABC_DLL char * Abc_SopCreateAnd2 (Mem_Flex_t *pMan, int fCompl0, int fCompl1)
 
ABC_DLL char * Abc_SopCreateAnd (Mem_Flex_t *pMan, int nVars, int *pfCompl)
 
ABC_DLL char * Abc_SopCreateNand (Mem_Flex_t *pMan, int nVars)
 
ABC_DLL char * Abc_SopCreateOr (Mem_Flex_t *pMan, int nVars, int *pfCompl)
 
ABC_DLL char * Abc_SopCreateOrMultiCube (Mem_Flex_t *pMan, int nVars, int *pfCompl)
 
ABC_DLL char * Abc_SopCreateNor (Mem_Flex_t *pMan, int nVars)
 
ABC_DLL char * Abc_SopCreateXor (Mem_Flex_t *pMan, int nVars)
 
ABC_DLL char * Abc_SopCreateXorSpecial (Mem_Flex_t *pMan, int nVars)
 
ABC_DLL char * Abc_SopCreateNxor (Mem_Flex_t *pMan, int nVars)
 
ABC_DLL char * Abc_SopCreateMux (Mem_Flex_t *pMan)
 
ABC_DLL char * Abc_SopCreateInv (Mem_Flex_t *pMan)
 
ABC_DLL char * Abc_SopCreateBuf (Mem_Flex_t *pMan)
 
ABC_DLL char * Abc_SopCreateFromTruth (Mem_Flex_t *pMan, int nVars, unsigned *pTruth)
 
ABC_DLL char * Abc_SopCreateFromIsop (Mem_Flex_t *pMan, int nVars, Vec_Int_t *vCover)
 
ABC_DLL int Abc_SopGetCubeNum (char *pSop)
 
ABC_DLL int Abc_SopGetLitNum (char *pSop)
 
ABC_DLL int Abc_SopGetVarNum (char *pSop)
 
ABC_DLL int Abc_SopGetPhase (char *pSop)
 
ABC_DLL int Abc_SopGetIthCareLit (char *pSop, int i)
 
ABC_DLL void Abc_SopComplement (char *pSop)
 
ABC_DLL void Abc_SopComplementVar (char *pSop, int iVar)
 
ABC_DLL int Abc_SopIsComplement (char *pSop)
 
ABC_DLL int Abc_SopIsConst0 (char *pSop)
 
ABC_DLL int Abc_SopIsConst1 (char *pSop)
 
ABC_DLL int Abc_SopIsBuf (char *pSop)
 
ABC_DLL int Abc_SopIsInv (char *pSop)
 
ABC_DLL int Abc_SopIsAndType (char *pSop)
 
ABC_DLL int Abc_SopIsOrType (char *pSop)
 
ABC_DLL int Abc_SopIsExorType (char *pSop)
 
ABC_DLL int Abc_SopCheck (char *pSop, int nFanins)
 
ABC_DLL char * Abc_SopFromTruthBin (char *pTruth)
 
ABC_DLL char * Abc_SopFromTruthHex (char *pTruth)
 
ABC_DLL char * Abc_SopEncoderPos (Mem_Flex_t *pMan, int iValue, int nValues)
 
ABC_DLL char * Abc_SopEncoderLog (Mem_Flex_t *pMan, int iBit, int nValues)
 
ABC_DLL char * Abc_SopDecoderPos (Mem_Flex_t *pMan, int nValues)
 
ABC_DLL char * Abc_SopDecoderLog (Mem_Flex_t *pMan, int nValues)
 
ABC_DLL word Abc_SopToTruth (char *pSop, int nInputs)
 
ABC_DLL void Abc_SopToTruth7 (char *pSop, int nInputs, word r[2])
 
ABC_DLL void Abc_SopToTruthBig (char *pSop, int nInputs, word **pVars, word *pCube, word *pRes)
 
ABC_DLL Abc_Ntk_tAbc_NtkRestrash (Abc_Ntk_t *pNtk, int fCleanup)
 FUNCTION DEFINITIONS ///. More...
 
ABC_DLL Abc_Ntk_tAbc_NtkRestrashZero (Abc_Ntk_t *pNtk, int fCleanup)
 
ABC_DLL Abc_Ntk_tAbc_NtkStrash (Abc_Ntk_t *pNtk, int fAllNodes, int fCleanup, int fRecord)
 
ABC_DLL Abc_Obj_tAbc_NodeStrash (Abc_Ntk_t *pNtkNew, Abc_Obj_t *pNode, int fRecord)
 
ABC_DLL int Abc_NtkAppend (Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int fAddPos)
 
ABC_DLL Abc_Ntk_tAbc_NtkTopmost (Abc_Ntk_t *pNtk, int nLevels)
 
ABC_DLL int Abc_NtkSweep (Abc_Ntk_t *pNtk, int fVerbose)
 
ABC_DLL int Abc_NtkCleanup (Abc_Ntk_t *pNtk, int fVerbose)
 
ABC_DLL int Abc_NtkCleanupNodes (Abc_Ntk_t *pNtk, Vec_Ptr_t *vNodes, int fVerbose)
 
ABC_DLL int Abc_NtkCleanupSeq (Abc_Ntk_t *pNtk, int fLatchSweep, int fAutoSweep, int fVerbose)
 
ABC_DLL int Abc_NtkSweepBufsInvs (Abc_Ntk_t *pNtk, int fVerbose)
 
ABC_DLL Abc_Time_tAbc_NtkReadDefaultArrival (Abc_Ntk_t *pNtk)
 FUNCTION DEFINITIONS ///. More...
 
ABC_DLL Abc_Time_tAbc_NtkReadDefaultRequired (Abc_Ntk_t *pNtk)
 
ABC_DLL Abc_Time_tAbc_NodeReadArrival (Abc_Obj_t *pNode)
 
ABC_DLL Abc_Time_tAbc_NodeReadRequired (Abc_Obj_t *pNode)
 
ABC_DLL float Abc_NodeReadArrivalAve (Abc_Obj_t *pNode)
 
ABC_DLL float Abc_NodeReadRequiredAve (Abc_Obj_t *pNode)
 
ABC_DLL float Abc_NodeReadArrivalWorst (Abc_Obj_t *pNode)
 
ABC_DLL float Abc_NodeReadRequiredWorst (Abc_Obj_t *pNode)
 
ABC_DLL Abc_Time_tAbc_NtkReadDefaultInputDrive (Abc_Ntk_t *pNtk)
 
ABC_DLL Abc_Time_tAbc_NtkReadDefaultOutputLoad (Abc_Ntk_t *pNtk)
 
ABC_DLL Abc_Time_tAbc_NodeReadInputDrive (Abc_Ntk_t *pNtk, int iPi)
 
ABC_DLL Abc_Time_tAbc_NodeReadOutputLoad (Abc_Ntk_t *pNtk, int iPo)
 
ABC_DLL float Abc_NodeReadInputDriveWorst (Abc_Ntk_t *pNtk, int iPi)
 
ABC_DLL float Abc_NodeReadOutputLoadWorst (Abc_Ntk_t *pNtk, int iPo)
 
ABC_DLL void Abc_NtkTimeSetDefaultArrival (Abc_Ntk_t *pNtk, float Rise, float Fall)
 
ABC_DLL void Abc_NtkTimeSetDefaultRequired (Abc_Ntk_t *pNtk, float Rise, float Fall)
 
ABC_DLL void Abc_NtkTimeSetArrival (Abc_Ntk_t *pNtk, int ObjId, float Rise, float Fall)
 
ABC_DLL void Abc_NtkTimeSetRequired (Abc_Ntk_t *pNtk, int ObjId, float Rise, float Fall)
 
ABC_DLL void Abc_NtkTimeSetDefaultInputDrive (Abc_Ntk_t *pNtk, float Rise, float Fall)
 
ABC_DLL void Abc_NtkTimeSetDefaultOutputLoad (Abc_Ntk_t *pNtk, float Rise, float Fall)
 
ABC_DLL void Abc_NtkTimeSetInputDrive (Abc_Ntk_t *pNtk, int PiNum, float Rise, float Fall)
 
ABC_DLL void Abc_NtkTimeSetOutputLoad (Abc_Ntk_t *pNtk, int PoNum, float Rise, float Fall)
 
ABC_DLL void Abc_NtkTimeInitialize (Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkOld)
 
ABC_DLL void Abc_ManTimeStop (Abc_ManTime_t *p)
 
ABC_DLL void Abc_ManTimeDup (Abc_Ntk_t *pNtkOld, Abc_Ntk_t *pNtkNew)
 
ABC_DLL void Abc_NtkSetNodeLevelsArrival (Abc_Ntk_t *pNtk)
 
ABC_DLL float * Abc_NtkGetCiArrivalFloats (Abc_Ntk_t *pNtk)
 
ABC_DLL float * Abc_NtkGetCoRequiredFloats (Abc_Ntk_t *pNtk)
 
ABC_DLL Abc_Time_tAbc_NtkGetCiArrivalTimes (Abc_Ntk_t *pNtk)
 
ABC_DLL Abc_Time_tAbc_NtkGetCoRequiredTimes (Abc_Ntk_t *pNtk)
 
ABC_DLL float Abc_NtkDelayTrace (Abc_Ntk_t *pNtk, Abc_Obj_t *pOut, Abc_Obj_t *pIn, int fPrint)
 
ABC_DLL int Abc_ObjLevelNew (Abc_Obj_t *pObj)
 
ABC_DLL int Abc_ObjReverseLevelNew (Abc_Obj_t *pObj)
 
ABC_DLL int Abc_ObjRequiredLevel (Abc_Obj_t *pObj)
 
ABC_DLL int Abc_ObjReverseLevel (Abc_Obj_t *pObj)
 
ABC_DLL void Abc_ObjSetReverseLevel (Abc_Obj_t *pObj, int LevelR)
 
ABC_DLL void Abc_NtkStartReverseLevels (Abc_Ntk_t *pNtk, int nMaxLevelIncrease)
 
ABC_DLL void Abc_NtkStopReverseLevels (Abc_Ntk_t *pNtk)
 
ABC_DLL void Abc_NtkUpdateLevel (Abc_Obj_t *pObjNew, Vec_Vec_t *vLevels)
 
ABC_DLL void Abc_NtkUpdateReverseLevel (Abc_Obj_t *pObjNew, Vec_Vec_t *vLevels)
 
ABC_DLL void Abc_NtkUpdate (Abc_Obj_t *pObj, Abc_Obj_t *pObjNew, Vec_Vec_t *vLevels)
 
ABC_DLL void * Abc_NtkAttrFree (Abc_Ntk_t *pNtk, int Attr, int fFreeMan)
 DECLARATIONS ///. More...
 
ABC_DLL void Abc_NtkOrderCisCos (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NtkGetCubeNum (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NtkGetCubePairNum (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NtkGetLitNum (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NtkGetLitFactNum (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NtkGetBddNodeNum (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NtkGetAigNodeNum (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NtkGetClauseNum (Abc_Ntk_t *pNtk)
 
ABC_DLL double Abc_NtkGetMappedArea (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NtkGetExorNum (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NtkGetMuxNum (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NtkGetBufNum (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NtkGetChoiceNum (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NtkGetFaninMax (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NtkGetFanoutMax (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NtkGetTotalFanins (Abc_Ntk_t *pNtk)
 
ABC_DLL void Abc_NtkCleanCopy (Abc_Ntk_t *pNtk)
 
ABC_DLL void Abc_NtkCleanCopy_rec (Abc_Ntk_t *pNtk)
 
ABC_DLL void Abc_NtkCleanData (Abc_Ntk_t *pNtk)
 
ABC_DLL void Abc_NtkFillTemp (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NtkCountCopy (Abc_Ntk_t *pNtk)
 
ABC_DLL Vec_Ptr_tAbc_NtkSaveCopy (Abc_Ntk_t *pNtk)
 
ABC_DLL void Abc_NtkLoadCopy (Abc_Ntk_t *pNtk, Vec_Ptr_t *vCopies)
 
ABC_DLL void Abc_NtkCleanNext (Abc_Ntk_t *pNtk)
 
ABC_DLL void Abc_NtkCleanNext_rec (Abc_Ntk_t *pNtk)
 
ABC_DLL void Abc_NtkCleanMarkA (Abc_Ntk_t *pNtk)
 
ABC_DLL void Abc_NtkCleanMarkB (Abc_Ntk_t *pNtk)
 
ABC_DLL void Abc_NtkCleanMarkC (Abc_Ntk_t *pNtk)
 
ABC_DLL void Abc_NtkCleanMarkAB (Abc_Ntk_t *pNtk)
 
ABC_DLL void Abc_NtkCleanMarkABC (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NodeFindFanin (Abc_Obj_t *pNode, Abc_Obj_t *pFanin)
 
ABC_DLL Abc_Obj_tAbc_NodeFindCoFanout (Abc_Obj_t *pNode)
 
ABC_DLL Abc_Obj_tAbc_NodeFindNonCoFanout (Abc_Obj_t *pNode)
 
ABC_DLL Abc_Obj_tAbc_NodeHasUniqueCoFanout (Abc_Obj_t *pNode)
 
ABC_DLL int Abc_NtkLogicHasSimpleCos (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NtkLogicMakeSimpleCos (Abc_Ntk_t *pNtk, int fDuplicate)
 
ABC_DLL void Abc_VecObjPushUniqueOrderByLevel (Vec_Ptr_t *p, Abc_Obj_t *pNode)
 
ABC_DLL int Abc_NodeIsExorType (Abc_Obj_t *pNode)
 
ABC_DLL int Abc_NodeIsMuxType (Abc_Obj_t *pNode)
 
ABC_DLL int Abc_NodeIsMuxControlType (Abc_Obj_t *pNode)
 
ABC_DLL Abc_Obj_tAbc_NodeRecognizeMux (Abc_Obj_t *pNode, Abc_Obj_t **ppNodeT, Abc_Obj_t **ppNodeE)
 
ABC_DLL int Abc_NtkPrepareTwoNtks (FILE *pErr, Abc_Ntk_t *pNtk, char **argv, int argc, Abc_Ntk_t **ppNtk1, Abc_Ntk_t **ppNtk2, int *pfDelete1, int *pfDelete2)
 
ABC_DLL void Abc_NodeCollectFanins (Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
 
ABC_DLL void Abc_NodeCollectFanouts (Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
 
ABC_DLL Vec_Ptr_tAbc_NtkCollectLatches (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NodeCompareLevelsIncrease (Abc_Obj_t **pp1, Abc_Obj_t **pp2)
 
ABC_DLL int Abc_NodeCompareLevelsDecrease (Abc_Obj_t **pp1, Abc_Obj_t **pp2)
 
ABC_DLL Vec_Int_tAbc_NtkFanoutCounts (Abc_Ntk_t *pNtk)
 
ABC_DLL Vec_Ptr_tAbc_NtkCollectObjects (Abc_Ntk_t *pNtk)
 
ABC_DLL Vec_Int_tAbc_NtkGetCiIds (Abc_Ntk_t *pNtk)
 
ABC_DLL void Abc_NtkReassignIds (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_ObjPointerCompare (void **pp1, void **pp2)
 
ABC_DLL void Abc_NtkTransferCopy (Abc_Ntk_t *pNtk)
 
ABC_DLL void Abc_NtkInvertConstraints (Abc_Ntk_t *pNtk)
 
ABC_DLL void Abc_NtkPrintCiLevels (Abc_Ntk_t *pNtk)
 
ABC_DLL void Abc_NtkReverseTopoOrder (Abc_Ntk_t *pNtk)
 
ABC_DLL int Abc_NtkIsTopo (Abc_Ntk_t *pNtk)
 
ABC_DLL void Abc_NtkTransferPhases (Abc_Ntk_t *pNtkNew, Abc_Ntk_t *pNtk)
 
ABC_DLL int * Abc_NtkVerifyGetCleanModel (Abc_Ntk_t *pNtk, int nFrames)
 
ABC_DLL int * Abc_NtkVerifySimulatePattern (Abc_Ntk_t *pNtk, int *pModel)
 
ABC_DLL int Abc_NtkIsTrueCex (Abc_Ntk_t *pNtk, Abc_Cex_t *pCex)
 
ABC_DLL int Abc_NtkIsValidCex (Abc_Ntk_t *pNtk, Abc_Cex_t *pCex)
 

Macro Definition Documentation

#define Abc_AigForEachAnd (   pNtk,
  pNode,
 
)
Value:
for ( i = 0; (i < Vec_PtrSize((pNtk)->vObjs)) && (((pNode) = Abc_NtkObj(pNtk, i)), 1); i++ ) \
if ( (pNode) == NULL || !Abc_AigNodeIsAnd(pNode) ) {} else
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static int Abc_AigNodeIsAnd(Abc_Obj_t *pNode)
Definition: abc.h:397

Definition at line 485 of file abc.h.

#define Abc_CubeForEachVar (   pCube,
  Value,
 
)    for ( i = 0; (pCube[i] != ' ') && (Value = pCube[i]); i++ )

Definition at line 529 of file abc.h.

#define Abc_NtkForEachBarBuf (   pNtk,
  pNode,
 
)
Value:
for ( i = 0; (i < Vec_PtrSize((pNtk)->vObjs)) && (((pNode) = Abc_NtkObj(pNtk, i)), 1); i++ ) \
if ( (pNode) == NULL || !Abc_ObjIsBarBuf(pNode) ) {} else
static int Abc_ObjIsBarBuf(Abc_Obj_t *pObj)
Definition: abc.h:360
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295

Definition at line 479 of file abc.h.

#define Abc_NtkForEachBlackbox (   pNtk,
  pObj,
 
)
Value:
for ( i = 0; (i < Vec_PtrSize((pNtk)->vBoxes)) && (((pObj) = Abc_NtkBox(pNtk, i)), 1); i++ ) \
if ( !Abc_ObjIsBlackbox(pObj) ) {} else
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static Abc_Obj_t * Abc_NtkBox(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:319
static int Abc_ObjIsBlackbox(Abc_Obj_t *pObj)
Definition: abc.h:359

Definition at line 509 of file abc.h.

#define Abc_NtkForEachBox (   pNtk,
  pObj,
 
)    for ( i = 0; (i < Vec_PtrSize((pNtk)->vBoxes)) && (((pObj) = Abc_NtkBox(pNtk, i)), 1); i++ )

Definition at line 495 of file abc.h.

#define Abc_NtkForEachCi (   pNtk,
  pCi,
 
)    for ( i = 0; (i < Abc_NtkCiNum(pNtk)) && (((pCi) = Abc_NtkCi(pNtk, i)), 1); i++ )

Definition at line 515 of file abc.h.

#define Abc_NtkForEachCo (   pNtk,
  pCo,
 
)    for ( i = 0; (i < Abc_NtkCoNum(pNtk)) && (((pCo) = Abc_NtkCo(pNtk, i)), 1); i++ )

Definition at line 519 of file abc.h.

#define Abc_NtkForEachGate (   pNtk,
  pNode,
 
)
Value:
for ( i = 0; (i < Vec_PtrSize((pNtk)->vObjs)) && (((pNode) = Abc_NtkObj(pNtk, i)), 1); i++ ) \
if ( (pNode) == NULL || !Abc_ObjIsGate(pNode) ) {} else
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295

Definition at line 482 of file abc.h.

#define Abc_NtkForEachLatch (   pNtk,
  pObj,
 
)
Value:
for ( i = 0; (i < Vec_PtrSize((pNtk)->vBoxes)) && (((pObj) = Abc_NtkBox(pNtk, i)), 1); i++ ) \
if ( !Abc_ObjIsLatch(pObj) ) {} else
static int Abc_ObjIsLatch(Abc_Obj_t *pObj)
Definition: abc.h:356
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static Abc_Obj_t * Abc_NtkBox(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:319

Definition at line 497 of file abc.h.

#define Abc_NtkForEachLatchInput (   pNtk,
  pObj,
 
)
Value:
for ( i = 0; (i < Vec_PtrSize((pNtk)->vBoxes)); i++ ) \
if ( !(Abc_ObjIsLatch(Abc_NtkBox(pNtk, i)) && (((pObj) = Abc_ObjFanin0(Abc_NtkBox(pNtk, i))), 1)) ) {} else
static int Abc_ObjIsLatch(Abc_Obj_t *pObj)
Definition: abc.h:356
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static Abc_Obj_t * Abc_NtkBox(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:319

Definition at line 500 of file abc.h.

#define Abc_NtkForEachLatchOutput (   pNtk,
  pObj,
 
)
Value:
for ( i = 0; (i < Vec_PtrSize((pNtk)->vBoxes)); i++ ) \
if ( !(Abc_ObjIsLatch(Abc_NtkBox(pNtk, i)) && (((pObj) = Abc_ObjFanout0(Abc_NtkBox(pNtk, i))), 1)) ) {} else
static int Abc_ObjIsLatch(Abc_Obj_t *pObj)
Definition: abc.h:356
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static Abc_Obj_t * Abc_NtkBox(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:319
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371

Definition at line 503 of file abc.h.

#define Abc_NtkForEachLiPo (   pNtk,
  pCo,
 
)    for ( i = 0; (i < Abc_NtkCoNum(pNtk)) && (((pCo) = Abc_NtkCo(pNtk, i < pNtk->nBarBufs ? Abc_NtkCoNum(pNtk) - pNtk->nBarBufs + i : i - pNtk->nBarBufs)), 1); i++ )

Definition at line 521 of file abc.h.

#define Abc_NtkForEachNet (   pNtk,
  pNet,
 
)
Value:
for ( i = 0; (i < Vec_PtrSize((pNtk)->vObjs)) && (((pNet) = Abc_NtkObj(pNtk, i)), 1); i++ ) \
if ( (pNet) == NULL || !Abc_ObjIsNet(pNet) ) {} else
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static int Abc_ObjIsNet(Abc_Obj_t *pObj)
Definition: abc.h:354

Definition at line 458 of file abc.h.

#define Abc_NtkForEachNode (   pNtk,
  pNode,
 
)
Value:
for ( i = 0; (i < Vec_PtrSize((pNtk)->vObjs)) && (((pNode) = Abc_NtkObj(pNtk, i)), 1); i++ ) \
if ( (pNode) == NULL || !Abc_ObjIsNode(pNode) ) {} else
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355

Definition at line 461 of file abc.h.

#define Abc_NtkForEachNode1 (   pNtk,
  pNode,
 
)
Value:
for ( i = 0; (i < Vec_PtrSize((pNtk)->vObjs)) && (((pNode) = Abc_NtkObj(pNtk, i)), 1); i++ ) \
if ( (pNode) == NULL || !Abc_ObjIsNode(pNode) || !Abc_ObjFaninNum(pNode) ) {} else
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355

Definition at line 467 of file abc.h.

#define Abc_NtkForEachNodeCi (   pNtk,
  pNode,
 
)
Value:
for ( i = 0; (i < Vec_PtrSize((pNtk)->vObjs)) && (((pNode) = Abc_NtkObj(pNtk, i)), 1); i++ ) \
if ( (pNode) == NULL || (!Abc_ObjIsNode(pNode) && !Abc_ObjIsCi(pNode)) ) {} else
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
Definition: abc.h:351
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355

Definition at line 488 of file abc.h.

#define Abc_NtkForEachNodeCo (   pNtk,
  pNode,
 
)
Value:
for ( i = 0; (i < Vec_PtrSize((pNtk)->vObjs)) && (((pNode) = Abc_NtkObj(pNtk, i)), 1); i++ ) \
if ( (pNode) == NULL || (!Abc_ObjIsNode(pNode) && !Abc_ObjIsCo(pNode)) ) {} else
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
Definition: abc.h:352
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355

Definition at line 491 of file abc.h.

#define Abc_NtkForEachNodeNotBarBuf (   pNtk,
  pNode,
 
)
Value:
for ( i = 0; (i < Vec_PtrSize((pNtk)->vObjs)) && (((pNode) = Abc_NtkObj(pNtk, i)), 1); i++ ) \
if ( (pNode) == NULL || !Abc_ObjIsNode(pNode) || Abc_ObjIsBarBuf(pNode) ) {} else
static int Abc_ObjIsBarBuf(Abc_Obj_t *pObj)
Definition: abc.h:360
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355

Definition at line 464 of file abc.h.

#define Abc_NtkForEachNodeNotBarBuf1 (   pNtk,
  pNode,
 
)
Value:
for ( i = 0; (i < Vec_PtrSize((pNtk)->vObjs)) && (((pNode) = Abc_NtkObj(pNtk, i)), 1); i++ ) \
if ( (pNode) == NULL || !Abc_ObjIsNode(pNode) || !Abc_ObjFaninNum(pNode) || Abc_ObjIsBarBuf(pNode) ) {} else
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Abc_ObjIsBarBuf(Abc_Obj_t *pObj)
Definition: abc.h:360
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355

Definition at line 470 of file abc.h.

#define Abc_NtkForEachNodeReverse (   pNtk,
  pNode,
 
)
Value:
for ( i = Vec_PtrSize((pNtk)->vObjs) - 1; (i >= 0) && (((pNode) = Abc_NtkObj(pNtk, i)), 1); i-- ) \
if ( (pNode) == NULL || !Abc_ObjIsNode(pNode) ) {} else
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355

Definition at line 473 of file abc.h.

#define Abc_NtkForEachNodeReverse1 (   pNtk,
  pNode,
 
)
Value:
for ( i = Vec_PtrSize((pNtk)->vObjs) - 1; (i >= 0) && (((pNode) = Abc_NtkObj(pNtk, i)), 1); i-- ) \
if ( (pNode) == NULL || !Abc_ObjIsNode(pNode) || !Abc_ObjFaninNum(pNode) ) {} else
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355

Definition at line 476 of file abc.h.

#define Abc_NtkForEachObj (   pNtk,
  pObj,
 
)
Value:
for ( i = 0; (i < Vec_PtrSize((pNtk)->vObjs)) && (((pObj) = Abc_NtkObj(pNtk, i)), 1); i++ ) \
if ( (pObj) == NULL ) {} else
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295

ITERATORS ///.

Definition at line 446 of file abc.h.

#define Abc_NtkForEachObjReverse (   pNtk,
  pNode,
 
)
Value:
for ( i = Vec_PtrSize((pNtk)->vObjs) - 1; (i >= 0) && (((pNode) = Abc_NtkObj(pNtk, i)), 1); i-- ) \
if ( (pNode) == NULL ) {} else
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295

Definition at line 449 of file abc.h.

#define Abc_NtkForEachObjVec (   vIds,
  pNtk,
  pObj,
 
)
Value:
for ( i = 0; i < Vec_IntSize(vIds) && (((pObj) = Abc_NtkObj(pNtk, Vec_IntEntry(vIds,i))), 1); i++ ) \
if ( (pObj) == NULL ) {} else
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252

Definition at line 452 of file abc.h.

#define Abc_NtkForEachObjVecStart (   vIds,
  pNtk,
  pObj,
  i,
  Start 
)
Value:
for ( i = Start; i < Vec_IntSize(vIds) && (((pObj) = Abc_NtkObj(pNtk, Vec_IntEntry(vIds,i))), 1); i++ ) \
if ( (pObj) == NULL ) {} else
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252

Definition at line 455 of file abc.h.

#define Abc_NtkForEachPi (   pNtk,
  pPi,
 
)    for ( i = 0; (i < Abc_NtkPiNum(pNtk)) && (((pPi) = Abc_NtkPi(pNtk, i)), 1); i++ )

Definition at line 513 of file abc.h.

#define Abc_NtkForEachPo (   pNtk,
  pPo,
 
)    for ( i = 0; (i < Abc_NtkPoNum(pNtk)) && (((pPo) = Abc_NtkPo(pNtk, i)), 1); i++ )

Definition at line 517 of file abc.h.

#define Abc_NtkForEachWhitebox (   pNtk,
  pObj,
 
)
Value:
for ( i = 0; (i < Vec_PtrSize((pNtk)->vBoxes)) && (((pObj) = Abc_NtkBox(pNtk, i)), 1); i++ ) \
if ( !Abc_ObjIsWhitebox(pObj) ) {} else
static int Abc_ObjIsWhitebox(Abc_Obj_t *pObj)
Definition: abc.h:358
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static Abc_Obj_t * Abc_NtkBox(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:319

Definition at line 506 of file abc.h.

#define Abc_ObjForEachFanin (   pObj,
  pFanin,
 
)    for ( i = 0; (i < Abc_ObjFaninNum(pObj)) && (((pFanin) = Abc_ObjFanin(pObj, i)), 1); i++ )

Definition at line 524 of file abc.h.

#define Abc_ObjForEachFanout (   pObj,
  pFanout,
 
)    for ( i = 0; (i < Abc_ObjFanoutNum(pObj)) && (((pFanout) = Abc_ObjFanout(pObj, i)), 1); i++ )

Definition at line 526 of file abc.h.

#define Abc_SopForEachCube (   pSop,
  nFanins,
  pCube 
)    for ( pCube = (pSop); *pCube; pCube += (nFanins) + 3 )

Definition at line 531 of file abc.h.

#define Abc_SopForEachCubePair (   pSop,
  nFanins,
  pCube,
  pCube2 
)
Value:
Abc_SopForEachCube( pSop, nFanins, pCube ) \
Abc_SopForEachCube( pCube + (nFanins) + 3, nFanins, pCube2 )
#define Abc_SopForEachCube(pSop, nFanins, pCube)
Definition: abc.h:531

Definition at line 533 of file abc.h.

Typedef Documentation

typedef struct Abc_Aig_t_ Abc_Aig_t

Definition at line 117 of file abc.h.

typedef struct Abc_Des_t_ Abc_Des_t

BASIC TYPES ///.

Definition at line 114 of file abc.h.

typedef struct Abc_ManCut_t_ Abc_ManCut_t

Definition at line 119 of file abc.h.

typedef struct Abc_ManTime_t_ Abc_ManTime_t

Definition at line 118 of file abc.h.

typedef struct Abc_Ntk_t_ Abc_Ntk_t

Definition at line 115 of file abc.h.

typedef struct Abc_Obj_t_ Abc_Obj_t

Definition at line 116 of file abc.h.

typedef struct Abc_Time_t_ Abc_Time_t

Definition at line 120 of file abc.h.

typedef struct Odc_Man_t_ Odc_Man_t

Definition at line 803 of file abc.h.

Enumeration Type Documentation

Enumerator
ABC_INIT_NONE 
ABC_INIT_ZERO 
ABC_INIT_ONE 
ABC_INIT_DC 
ABC_INIT_OTHER 

Definition at line 102 of file abc.h.

102  {
103  ABC_INIT_NONE = 0, // 0: unknown
104  ABC_INIT_ZERO, // 1: zero
105  ABC_INIT_ONE, // 2: one
106  ABC_INIT_DC, // 3: don't-care
107  ABC_INIT_OTHER // 4: unused
Abc_InitType_t
Definition: abc.h:102
Enumerator
ABC_FUNC_NONE 
ABC_FUNC_SOP 
ABC_FUNC_BDD 
ABC_FUNC_AIG 
ABC_FUNC_MAP 
ABC_FUNC_BLIFMV 
ABC_FUNC_BLACKBOX 
ABC_FUNC_OTHER 

Definition at line 63 of file abc.h.

63  {
64  ABC_FUNC_NONE = 0, // 0: unknown
65  ABC_FUNC_SOP, // 1: sum-of-products
66  ABC_FUNC_BDD, // 2: binary decision diagrams
67  ABC_FUNC_AIG, // 3: and-inverter graphs
68  ABC_FUNC_MAP, // 4: standard cell library
69  ABC_FUNC_BLIFMV, // 5: BLIF-MV node functions
70  ABC_FUNC_BLACKBOX, // 6: black box about which nothing is known
71  ABC_FUNC_OTHER // 7: unused
Abc_NtkFunc_t
Definition: abc.h:63

INCLUDES ///.

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

FileName [abc.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Network and node package.]

Synopsis [External declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

Id:
abc.h,v 1.1 2008/05/14 22:13:11 wudenni Exp

]PARAMETERS ///

Enumerator
ABC_NTK_NONE 
ABC_NTK_NETLIST 
ABC_NTK_LOGIC 
ABC_NTK_STRASH 
ABC_NTK_OTHER 

Definition at line 54 of file abc.h.

54  {
55  ABC_NTK_NONE = 0, // 0: unknown
56  ABC_NTK_NETLIST, // 1: network with PIs/POs, latches, nodes, and nets
57  ABC_NTK_LOGIC, // 2: network with PIs/POs, latches, and nodes
58  ABC_NTK_STRASH, // 3: structurally hashed AIG (two input AND gates with c-attributes on edges)
59  ABC_NTK_OTHER // 4: unused
Abc_NtkType_t
INCLUDES ///.
Definition: abc.h:54
Enumerator
ABC_OBJ_NONE 
ABC_OBJ_CONST1 
ABC_OBJ_PI 
ABC_OBJ_PO 
ABC_OBJ_BI 
ABC_OBJ_BO 
ABC_OBJ_NET 
ABC_OBJ_NODE 
ABC_OBJ_LATCH 
ABC_OBJ_WHITEBOX 
ABC_OBJ_BLACKBOX 
ABC_OBJ_NUMBER 

Definition at line 86 of file abc.h.

86  {
87  ABC_OBJ_NONE = 0, // 0: unknown
88  ABC_OBJ_CONST1, // 1: constant 1 node (AIG only)
89  ABC_OBJ_PI, // 2: primary input terminal
90  ABC_OBJ_PO, // 3: primary output terminal
91  ABC_OBJ_BI, // 4: box input terminal
92  ABC_OBJ_BO, // 5: box output terminal
93  ABC_OBJ_NET, // 6: net
94  ABC_OBJ_NODE, // 7: node
95  ABC_OBJ_LATCH, // 8: latch
96  ABC_OBJ_WHITEBOX, // 9: box with known contents
97  ABC_OBJ_BLACKBOX, // 10: box with unknown contents
98  ABC_OBJ_NUMBER // 11: unused
Definition: abc.h:91
Abc_ObjType_t
Definition: abc.h:86
Definition: abc.h:89
Definition: abc.h:90
Definition: abc.h:92

Function Documentation

ABC_DLL Abc_Aig_t* Abc_AigAlloc ( Abc_Ntk_t pNtkAig)

FUNCTION DECLARATIONS ///.

FUNCTION DECLARATIONS ///.

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

Synopsis [Allocates the local AIG manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 128 of file abcAig.c.

129 {
130  Abc_Aig_t * pMan;
131  // start the manager
132  pMan = ABC_ALLOC( Abc_Aig_t, 1 );
133  memset( pMan, 0, sizeof(Abc_Aig_t) );
134  // allocate the table
135  pMan->nBins = Abc_PrimeCudd( 10000 );
136  pMan->pBins = ABC_ALLOC( Abc_Obj_t *, pMan->nBins );
137  memset( pMan->pBins, 0, sizeof(Abc_Obj_t *) * pMan->nBins );
138  pMan->vNodes = Vec_PtrAlloc( 100 );
139  pMan->vLevels = Vec_VecAlloc( 100 );
140  pMan->vLevelsR = Vec_VecAlloc( 100 );
141  pMan->vStackReplaceOld = Vec_PtrAlloc( 100 );
142  pMan->vStackReplaceNew = Vec_PtrAlloc( 100 );
143  // create the constant node
144  assert( pNtkAig->vObjs->nSize == 0 );
145  pMan->pConst1 = Abc_NtkCreateObj( pNtkAig, ABC_OBJ_NODE );
146  pMan->pConst1->Type = ABC_OBJ_CONST1;
147  pMan->pConst1->fPhase = 1;
148  pNtkAig->nObjCounts[ABC_OBJ_NODE]--;
149  // save the current network
150  pMan->pNtkAig = pNtkAig;
151  return pMan;
152 }
char * memset()
int nObjCounts[ABC_OBJ_NUMBER]
Definition: abc.h:171
static int Abc_PrimeCudd(unsigned int p)
Definition: abc_global.h:383
static Vec_Vec_t * Vec_VecAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecVec.h:145
Vec_Ptr_t * vStackReplaceOld
Definition: abcAig.c:60
Vec_Ptr_t * vNodes
Definition: abcAig.c:59
Vec_Vec_t * vLevelsR
Definition: abcAig.c:63
Abc_Ntk_t * pNtkAig
Definition: abcAig.c:54
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
Vec_Ptr_t * vObjs
Definition: abc.h:162
ABC_DLL Abc_Obj_t * Abc_NtkCreateObj(Abc_Ntk_t *pNtk, Abc_ObjType_t Type)
Definition: abcObj.c:106
int nBins
Definition: abcAig.c:57
unsigned Type
Definition: abc.h:133
Vec_Ptr_t * vStackReplaceNew
Definition: abcAig.c:61
Vec_Vec_t * vLevels
Definition: abcAig.c:62
DECLARATIONS ///.
Definition: abcAig.c:52
Abc_Obj_t * pConst1
Definition: abcAig.c:55
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
Abc_Obj_t ** pBins
Definition: abcAig.c:56
#define assert(ex)
Definition: util_old.h:213
unsigned fPhase
Definition: abc.h:137
ABC_DLL Abc_Obj_t* Abc_AigAnd ( Abc_Aig_t pMan,
Abc_Obj_t p0,
Abc_Obj_t p1 
)

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

Synopsis [Performs canonicization step.]

Description [The argument nodes can be complemented.]

SideEffects []

SeeAlso []

Definition at line 700 of file abcAig.c.

701 {
702  Abc_Obj_t * pAnd;
703  if ( (pAnd = Abc_AigAndLookup( pMan, p0, p1 )) )
704  return pAnd;
705  return Abc_AigAndCreate( pMan, p0, p1 );
706 }
Abc_Obj_t * Abc_AigAndLookup(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:403
static Abc_Obj_t * Abc_AigAndCreate(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:319
ABC_DLL Abc_Obj_t* Abc_AigAndLookup ( Abc_Aig_t pMan,
Abc_Obj_t p0,
Abc_Obj_t p1 
)

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

Synopsis [Performs canonicization step.]

Description [The argument nodes can be complemented.]

SideEffects []

SeeAlso []

Definition at line 403 of file abcAig.c.

404 {
405  Abc_Obj_t * pAnd, * pConst1;
406  unsigned Key;
407  assert( Abc_ObjRegular(p0)->pNtk->pManFunc == pMan );
408  assert( Abc_ObjRegular(p1)->pNtk->pManFunc == pMan );
409  // check for trivial cases
410  pConst1 = Abc_AigConst1(pMan->pNtkAig);
411  if ( p0 == p1 )
412  return p0;
413  if ( p0 == Abc_ObjNot(p1) )
414  return Abc_ObjNot(pConst1);
415  if ( Abc_ObjRegular(p0) == pConst1 )
416  {
417  if ( p0 == pConst1 )
418  return p1;
419  return Abc_ObjNot(pConst1);
420  }
421  if ( Abc_ObjRegular(p1) == pConst1 )
422  {
423  if ( p1 == pConst1 )
424  return p0;
425  return Abc_ObjNot(pConst1);
426  }
427 /*
428  {
429  int nFans0 = Abc_ObjFanoutNum( Abc_ObjRegular(p0) );
430  int nFans1 = Abc_ObjFanoutNum( Abc_ObjRegular(p1) );
431  if ( nFans0 == 0 || nFans1 == 0 )
432  pMan->nStrash0++;
433  else if ( nFans0 == 1 || nFans1 == 1 )
434  pMan->nStrash1++;
435  else if ( nFans0 <= 100 && nFans1 <= 100 )
436  pMan->nStrash5++;
437  else
438  pMan->nStrash2++;
439  }
440 */
441  {
442  int nFans0 = Abc_ObjFanoutNum( Abc_ObjRegular(p0) );
443  int nFans1 = Abc_ObjFanoutNum( Abc_ObjRegular(p1) );
444  if ( nFans0 == 0 || nFans1 == 0 )
445  return NULL;
446  }
447 
448  // order the arguments
449  if ( Abc_ObjRegular(p0)->Id > Abc_ObjRegular(p1)->Id )
450  pAnd = p0, p0 = p1, p1 = pAnd;
451  // get the hash key for these two nodes
452  Key = Abc_HashKey2( p0, p1, pMan->nBins );
453  // find the matching node in the table
454  Abc_AigBinForEachEntry( pMan->pBins[Key], pAnd )
455  if ( p0 == Abc_ObjChild0(pAnd) && p1 == Abc_ObjChild1(pAnd) )
456  {
457 // assert( Abc_ObjFanoutNum(Abc_ObjRegular(p0)) && Abc_ObjFanoutNum(p1) );
458  return pAnd;
459  }
460  return NULL;
461 }
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
Abc_Ntk_t * pNtkAig
Definition: abcAig.c:54
int nBins
Definition: abcAig.c:57
static Abc_Obj_t * Abc_ObjChild0(Abc_Obj_t *pObj)
Definition: abc.h:383
Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
#define Abc_AigBinForEachEntry(pBin, pEnt)
Definition: abcAig.c:74
if(last==0)
Definition: sparse_int.h:34
static Abc_Obj_t * Abc_ObjRegular(Abc_Obj_t *p)
Definition: abc.h:323
Abc_Obj_t ** pBins
Definition: abcAig.c:56
#define assert(ex)
Definition: util_old.h:213
static Abc_Obj_t * Abc_ObjNot(Abc_Obj_t *p)
Definition: abc.h:324
static unsigned Abc_HashKey2(Abc_Obj_t *p0, Abc_Obj_t *p1, int TableSize)
Definition: abcAig.c:90
static Abc_Obj_t * Abc_ObjChild1(Abc_Obj_t *pObj)
Definition: abc.h:384
ABC_DLL int Abc_AigCheck ( Abc_Aig_t pMan)

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

Synopsis [Makes sure that every node in the table is in the network and vice versa.]

Description []

SideEffects []

SeeAlso []

Definition at line 226 of file abcAig.c.

227 {
228  Abc_Obj_t * pObj, * pAnd;
229  int i, nFanins, Counter;
230  Abc_NtkForEachNode( pMan->pNtkAig, pObj, i )
231  {
232  nFanins = Abc_ObjFaninNum(pObj);
233  if ( nFanins == 0 )
234  {
235  if ( !Abc_AigNodeIsConst(pObj) )
236  {
237  printf( "Abc_AigCheck: The AIG has non-standard constant nodes.\n" );
238  return 0;
239  }
240  continue;
241  }
242  if ( nFanins == 1 )
243  {
244  printf( "Abc_AigCheck: The AIG has single input nodes.\n" );
245  return 0;
246  }
247  if ( nFanins > 2 )
248  {
249  printf( "Abc_AigCheck: The AIG has non-standard nodes.\n" );
250  return 0;
251  }
252  if ( pObj->Level != 1 + (unsigned)Abc_MaxInt( Abc_ObjFanin0(pObj)->Level, Abc_ObjFanin1(pObj)->Level ) )
253  printf( "Abc_AigCheck: Node \"%s\" has level that does not agree with the fanin levels.\n", Abc_ObjName(pObj) );
254  pAnd = Abc_AigAndLookup( pMan, Abc_ObjChild0(pObj), Abc_ObjChild1(pObj) );
255  if ( pAnd != pObj )
256  printf( "Abc_AigCheck: Node \"%s\" is not in the structural hashing table.\n", Abc_ObjName(pObj) );
257  }
258  // count the number of nodes in the table
259  Counter = 0;
260  for ( i = 0; i < pMan->nBins; i++ )
261  Abc_AigBinForEachEntry( pMan->pBins[i], pAnd )
262  Counter++;
263  if ( Counter != Abc_NtkNodeNum(pMan->pNtkAig) )
264  {
265  printf( "Abc_AigCheck: The number of nodes in the structural hashing table is wrong.\n" );
266  return 0;
267  }
268  // if the node is a choice node, nodes in its class should not have fanouts
269  Abc_NtkForEachNode( pMan->pNtkAig, pObj, i )
270  if ( Abc_AigNodeIsChoice(pObj) )
271  for ( pAnd = (Abc_Obj_t *)pObj->pData; pAnd; pAnd = (Abc_Obj_t *)pAnd->pData )
272  if ( Abc_ObjFanoutNum(pAnd) > 0 )
273  {
274  printf( "Abc_AigCheck: Representative %s", Abc_ObjName(pAnd) );
275  printf( " of choice node %s has %d fanouts.\n", Abc_ObjName(pObj), Abc_ObjFanoutNum(pAnd) );
276  return 0;
277  }
278  return 1;
279 }
static Abc_Obj_t * Abc_ObjFanin1(Abc_Obj_t *pObj)
Definition: abc.h:374
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
Abc_Obj_t * Abc_AigAndLookup(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:403
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
Abc_Ntk_t * pNtkAig
Definition: abcAig.c:54
static int Abc_AigNodeIsConst(Abc_Obj_t *pNode)
Definition: abc.h:396
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
int nBins
Definition: abcAig.c:57
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
for(p=first;p->value< newval;p=p->next)
unsigned Level
Definition: abc.h:142
static Abc_Obj_t * Abc_ObjChild0(Abc_Obj_t *pObj)
Definition: abc.h:383
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
Definition: abc.h:293
#define Abc_AigBinForEachEntry(pBin, pEnt)
Definition: abcAig.c:74
if(last==0)
Definition: sparse_int.h:34
static int Counter
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
static int Abc_AigNodeIsChoice(Abc_Obj_t *pNode)
Definition: abc.h:398
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
Abc_Obj_t ** pBins
Definition: abcAig.c:56
static Abc_Obj_t * Abc_ObjChild1(Abc_Obj_t *pObj)
Definition: abc.h:384
ABC_DLL void Abc_AigCheckFaninOrder ( Abc_Aig_t pMan)

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

Synopsis [Resizes the hash table of AIG nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1362 of file abcAig.c.

1363 {
1364  Abc_Obj_t * pEnt;
1365  int i;
1366  for ( i = 0; i < pMan->nBins; i++ )
1367  Abc_AigBinForEachEntry( pMan->pBins[i], pEnt )
1368  {
1369  if ( Abc_ObjRegular(Abc_ObjChild0(pEnt))->Id > Abc_ObjRegular(Abc_ObjChild1(pEnt))->Id )
1370  {
1371 // int i0 = Abc_ObjRegular(Abc_ObjChild0(pEnt))->Id;
1372 // int i1 = Abc_ObjRegular(Abc_ObjChild1(pEnt))->Id;
1373  printf( "Node %d has incorrect ordering of fanins.\n", pEnt->Id );
1374  }
1375  }
1376 }
int nBins
Definition: abcAig.c:57
static Abc_Obj_t * Abc_ObjChild0(Abc_Obj_t *pObj)
Definition: abc.h:383
#define Abc_AigBinForEachEntry(pBin, pEnt)
Definition: abcAig.c:74
static Abc_Obj_t * Abc_ObjRegular(Abc_Obj_t *p)
Definition: abc.h:323
int Id
Definition: abc.h:132
Abc_Obj_t ** pBins
Definition: abcAig.c:56
static Abc_Obj_t * Abc_ObjChild1(Abc_Obj_t *pObj)
Definition: abc.h:384
ABC_DLL int Abc_AigCleanup ( Abc_Aig_t pMan)

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

Synopsis [Returns the number of dangling nodes removed.]

Description []

SideEffects []

SeeAlso []

Definition at line 194 of file abcAig.c.

195 {
196  Vec_Ptr_t * vDangles;
197  Abc_Obj_t * pAnd;
198  int i, nNodesOld;
199 // printf( "Strash0 = %d. Strash1 = %d. Strash100 = %d. StrashM = %d.\n",
200 // pMan->nStrash0, pMan->nStrash1, pMan->nStrash5, pMan->nStrash2 );
201  nNodesOld = pMan->nEntries;
202  // collect the AND nodes that do not fanout
203  vDangles = Vec_PtrAlloc( 100 );
204  for ( i = 0; i < pMan->nBins; i++ )
205  Abc_AigBinForEachEntry( pMan->pBins[i], pAnd )
206  if ( Abc_ObjFanoutNum(pAnd) == 0 )
207  Vec_PtrPush( vDangles, pAnd );
208  // process the dangling nodes and their MFFCs
209  Vec_PtrForEachEntry( Abc_Obj_t *, vDangles, pAnd, i )
210  Abc_AigDeleteNode( pMan, pAnd );
211  Vec_PtrFree( vDangles );
212  return nNodesOld - pMan->nEntries;
213 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
void Abc_AigDeleteNode(Abc_Aig_t *pMan, Abc_Obj_t *pNode)
Definition: abcAig.c:972
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
int nBins
Definition: abcAig.c:57
#define Abc_AigBinForEachEntry(pBin, pEnt)
Definition: abcAig.c:74
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
Abc_Obj_t ** pBins
Definition: abcAig.c:56
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
int nEntries
Definition: abcAig.c:58
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL Abc_Obj_t* Abc_AigConst1 ( Abc_Ntk_t pNtk)

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

Synopsis [Performs canonicization step.]

Description [The argument nodes can be complemented.]

SideEffects []

SeeAlso []

Definition at line 683 of file abcAig.c.

684 {
685  assert( Abc_NtkIsStrash(pNtk) );
686  return ((Abc_Aig_t *)pNtk->pManFunc)->pConst1;
687 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
DECLARATIONS ///.
Definition: abcAig.c:52
void * pManFunc
Definition: abc.h:191
#define assert(ex)
Definition: util_old.h:213
ABC_DLL void Abc_AigDeleteNode ( Abc_Aig_t pMan,
Abc_Obj_t pNode 
)

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

Synopsis [Performs internal deletion step.]

Description []

SideEffects []

SeeAlso []

Definition at line 972 of file abcAig.c.

973 {
974  Abc_Obj_t * pNode0, * pNode1, * pTemp;
975  int i, k;
976 
977  // make sure the node is regular and dangling
978  assert( !Abc_ObjIsComplement(pNode) );
979  assert( Abc_ObjIsNode(pNode) );
980  assert( Abc_ObjFaninNum(pNode) == 2 );
981  assert( Abc_ObjFanoutNum(pNode) == 0 );
982 
983  // when deleting an old node that is scheduled for replacement, remove it from the replacement queue
984  Vec_PtrForEachEntry( Abc_Obj_t *, pMan->vStackReplaceOld, pTemp, i )
985  if ( pNode == pTemp )
986  {
987  // remove the entry from the replacement array
988  for ( k = i; k < pMan->vStackReplaceOld->nSize - 1; k++ )
989  {
990  pMan->vStackReplaceOld->pArray[k] = pMan->vStackReplaceOld->pArray[k+1];
991  pMan->vStackReplaceNew->pArray[k] = pMan->vStackReplaceNew->pArray[k+1];
992  }
993  pMan->vStackReplaceOld->nSize--;
994  pMan->vStackReplaceNew->nSize--;
995  }
996 
997  // when deleting a new node that should replace another node, do not delete
998  Vec_PtrForEachEntry( Abc_Obj_t *, pMan->vStackReplaceNew, pTemp, i )
999  if ( pNode == Abc_ObjRegular(pTemp) )
1000  return;
1001 
1002  // remember the node's fanins
1003  pNode0 = Abc_ObjFanin0( pNode );
1004  pNode1 = Abc_ObjFanin1( pNode );
1005 
1006  // add the node to the list of updated nodes
1007  if ( pMan->vUpdatedNets )
1008  {
1009  Vec_PtrPushUnique( pMan->vUpdatedNets, pNode0 );
1010  Vec_PtrPushUnique( pMan->vUpdatedNets, pNode1 );
1011  }
1012 
1013  // remove the node from the table
1014  Abc_AigAndDelete( pMan, pNode );
1015  // if the node is in the level structure, remove it
1016  if ( pNode->fMarkA )
1017  Abc_AigRemoveFromLevelStructure( pMan->vLevels, pNode );
1018  if ( pNode->fMarkB )
1020  // remove the node from the network
1021  Abc_NtkDeleteObj( pNode );
1022 
1023  // call recursively for the fanins
1024  if ( Abc_ObjIsNode(pNode0) && pNode0->vFanouts.nSize == 0 )
1025  Abc_AigDeleteNode( pMan, pNode0 );
1026  if ( Abc_ObjIsNode(pNode1) && pNode1->vFanouts.nSize == 0 )
1027  Abc_AigDeleteNode( pMan, pNode1 );
1028 }
static Abc_Obj_t * Abc_ObjFanin1(Abc_Obj_t *pObj)
Definition: abc.h:374
unsigned fMarkA
Definition: abc.h:134
static int Vec_PtrPushUnique(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:656
Vec_Ptr_t * vStackReplaceOld
Definition: abcAig.c:60
void Abc_AigDeleteNode(Abc_Aig_t *pMan, Abc_Obj_t *pNode)
Definition: abcAig.c:972
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
Vec_Vec_t * vLevelsR
Definition: abcAig.c:63
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
Vec_Ptr_t * vUpdatedNets
Definition: abcAig.c:65
Vec_Ptr_t * vStackReplaceNew
Definition: abcAig.c:61
Vec_Vec_t * vLevels
Definition: abcAig.c:62
static void Abc_AigAndDelete(Abc_Aig_t *pMan, Abc_Obj_t *pThis)
Definition: abcAig.c:542
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
ABC_DLL void Abc_NtkDeleteObj(Abc_Obj_t *pObj)
Definition: abcObj.c:167
if(last==0)
Definition: sparse_int.h:34
static void Abc_AigRemoveFromLevelStructure(Vec_Vec_t *vStruct, Abc_Obj_t *pNode)
Definition: abcAig.c:1162
Vec_Int_t vFanouts
Definition: abc.h:144
static Abc_Obj_t * Abc_ObjRegular(Abc_Obj_t *p)
Definition: abc.h:323
unsigned fMarkB
Definition: abc.h:135
static void Abc_AigRemoveFromLevelStructureR(Vec_Vec_t *vStruct, Abc_Obj_t *pNode)
Definition: abcAig.c:1191
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static int Abc_ObjIsComplement(Abc_Obj_t *p)
Definition: abc.h:322
ABC_DLL Vec_Ptr_t* Abc_AigDfs ( Abc_Ntk_t pNtk,
int  fCollectAll,
int  fCollectCos 
)

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

Synopsis [Returns the DFS ordered array of logic nodes.]

Description [Collects only the internal nodes, leaving out CIs/COs. However it marks both CIs and COs with the current TravId.]

SideEffects []

SeeAlso []

Definition at line 1014 of file abcDfs.c.

1015 {
1016  Vec_Ptr_t * vNodes;
1017  Abc_Obj_t * pNode;
1018  int i;
1019  assert( Abc_NtkIsStrash(pNtk) );
1020  // set the traversal ID
1021  Abc_NtkIncrementTravId( pNtk );
1022  // start the array of nodes
1023  vNodes = Vec_PtrAlloc( 100 );
1024  // go through the PO nodes and call for each of them
1025  Abc_NtkForEachCo( pNtk, pNode, i )
1026  {
1027  Abc_AigDfs_rec( Abc_ObjFanin0(pNode), vNodes );
1028  Abc_NodeSetTravIdCurrent( pNode );
1029  if ( fCollectCos )
1030  Vec_PtrPush( vNodes, pNode );
1031  }
1032  // collect dangling nodes if asked to
1033  if ( fCollectAll )
1034  {
1035  Abc_NtkForEachNode( pNtk, pNode, i )
1036  if ( !Abc_NodeIsTravIdCurrent(pNode) )
1037  Abc_AigDfs_rec( pNode, vNodes );
1038  }
1039  return vNodes;
1040 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
void Abc_AigDfs_rec(Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
Definition: abcDfs.c:978
if(last==0)
Definition: sparse_int.h:34
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:411
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
#define assert(ex)
Definition: util_old.h:213
static void Abc_NodeSetTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:409
ABC_DLL Vec_Ptr_t* Abc_AigDfsMap ( Abc_Ntk_t pNtk)

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

Synopsis [Returns the DFS ordered array of logic nodes.]

Description [Collects only the internal nodes, leaving out CIs/COs. However it marks both CIs and COs with the current TravId.]

SideEffects []

SeeAlso []

Definition at line 1054 of file abcDfs.c.

1055 {
1056  Vec_Ptr_t * vNodes;
1057  Abc_Obj_t * pNode;
1058  int i;
1059  assert( Abc_NtkIsStrash(pNtk) );
1060  // set the traversal ID
1061  Abc_NtkIncrementTravId( pNtk );
1062  // start the array of nodes
1063  vNodes = Vec_PtrAlloc( 100 );
1064  // collect cones of barbufs
1065  Abc_NtkForEachCo( pNtk, pNode, i )
1066  {
1067  if ( i < Abc_NtkCoNum(pNtk) - pNtk->nBarBufs )
1068  continue;
1069  Abc_AigDfs_rec( Abc_ObjFanin0(pNode), vNodes );
1070  Abc_NodeSetTravIdCurrent( pNode );
1071  // collect latch as a placeholder
1073  Vec_PtrPush( vNodes, Abc_ObjFanout0(pNode) );
1074  }
1075  // collect nodes of real POs
1076  Abc_NtkForEachCo( pNtk, pNode, i )
1077  {
1078  if ( i >= Abc_NtkCoNum(pNtk) - pNtk->nBarBufs )
1079  break;
1080  Abc_AigDfs_rec( Abc_ObjFanin0(pNode), vNodes );
1081  assert( Abc_ObjIsCo(pNode) );
1082  Abc_NodeSetTravIdCurrent( pNode );
1083  }
1084  return vNodes;
1085 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_ObjIsLatch(Abc_Obj_t *pObj)
Definition: abc.h:356
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
Definition: abc.h:352
void Abc_AigDfs_rec(Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
Definition: abcDfs.c:978
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
int nBarBufs
Definition: abc.h:174
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
#define assert(ex)
Definition: util_old.h:213
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371
static void Abc_NodeSetTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:409
ABC_DLL void Abc_AigFree ( Abc_Aig_t pMan)

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

Synopsis [Deallocates the local AIG manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 165 of file abcAig.c.

166 {
167  assert( Vec_PtrSize( pMan->vStackReplaceOld ) == 0 );
168  assert( Vec_PtrSize( pMan->vStackReplaceNew ) == 0 );
169  // free the table
170  if ( pMan->vAddedCells )
171  Vec_PtrFree( pMan->vAddedCells );
172  if ( pMan->vUpdatedNets )
173  Vec_PtrFree( pMan->vUpdatedNets );
174  Vec_VecFree( pMan->vLevels );
175  Vec_VecFree( pMan->vLevelsR );
176  Vec_PtrFree( pMan->vStackReplaceOld );
177  Vec_PtrFree( pMan->vStackReplaceNew );
178  Vec_PtrFree( pMan->vNodes );
179  ABC_FREE( pMan->pBins );
180  ABC_FREE( pMan );
181 }
Vec_Ptr_t * vStackReplaceOld
Definition: abcAig.c:60
Vec_Ptr_t * vNodes
Definition: abcAig.c:59
Vec_Vec_t * vLevelsR
Definition: abcAig.c:63
Vec_Ptr_t * vAddedCells
Definition: abcAig.c:64
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void Vec_VecFree(Vec_Vec_t *p)
Definition: vecVec.h:347
Vec_Ptr_t * vUpdatedNets
Definition: abcAig.c:65
Vec_Ptr_t * vStackReplaceNew
Definition: abcAig.c:61
Vec_Vec_t * vLevels
Definition: abcAig.c:62
#define ABC_FREE(obj)
Definition: abc_global.h:232
Abc_Obj_t ** pBins
Definition: abcAig.c:56
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL Vec_Ptr_t* Abc_AigGetLevelizedOrder ( Abc_Ntk_t pNtk,
int  fCollectCis 
)

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

Synopsis [Returns nodes by level from the smallest to the largest.]

Description [Correctly handles the case of choice nodes, by first spreading them out across several levels and then collecting.]

SideEffects [What happens with dangling nodes???]

SeeAlso []

Definition at line 1649 of file abcDfs.c.

1650 {
1651  Vec_Ptr_t * vNodes, * vLevels;
1652  Abc_Obj_t * pNode, ** ppHead;
1653  int LevelMax, i;
1654  assert( Abc_NtkIsStrash(pNtk) );
1655  // set the correct levels
1656  Abc_NtkCleanCopy( pNtk );
1657  LevelMax = Abc_AigSetChoiceLevels( pNtk );
1658  // relink nodes by level
1659  vLevels = Vec_PtrStart( LevelMax + 1 );
1660  Abc_NtkForEachNode( pNtk, pNode, i )
1661  {
1662  ppHead = ((Abc_Obj_t **)vLevels->pArray) + (int)(ABC_PTRINT_T)pNode->pCopy;
1663  pNode->pCopy = *ppHead;
1664  *ppHead = pNode;
1665  }
1666  // recollect nodes
1667  vNodes = Vec_PtrStart( Abc_NtkNodeNum(pNtk) );
1668  Vec_PtrForEachEntryStart( Abc_Obj_t *, vLevels, pNode, i, !fCollectCis )
1669  for ( ; pNode; pNode = pNode->pCopy )
1670  Vec_PtrPush( vNodes, pNode );
1671  Vec_PtrFree( vLevels );
1672  return vNodes;
1673 }
static Vec_Ptr_t * Vec_PtrStart(int nSize)
Definition: vecPtr.h:106
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
#define Vec_PtrForEachEntryStart(Type, vVec, pEntry, i, Start)
Definition: vecPtr.h:57
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
for(p=first;p->value< newval;p=p->next)
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
Definition: abc.h:293
Abc_Obj_t * pCopy
Definition: abc.h:148
int Abc_AigSetChoiceLevels(Abc_Ntk_t *pNtk)
Definition: abcDfs.c:1611
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:507
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL int Abc_AigLevel ( Abc_Ntk_t pNtk)

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

Synopsis [Computes the number of logic levels not counting PIs/POs.]

Description []

SideEffects []

SeeAlso []

Definition at line 292 of file abcAig.c.

293 {
294  Abc_Obj_t * pNode;
295  int i, LevelsMax;
296  assert( Abc_NtkIsStrash(pNtk) );
297  if ( pNtk->nBarBufs )
298  return Abc_NtkLevel( pNtk );
299  // perform the traversal
300  LevelsMax = 0;
301  Abc_NtkForEachCo( pNtk, pNode, i )
302  if ( LevelsMax < (int)Abc_ObjFanin0(pNode)->Level )
303  LevelsMax = (int)Abc_ObjFanin0(pNode)->Level;
304  return LevelsMax;
305 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
if(last==0)
Definition: sparse_int.h:34
int nBarBufs
Definition: abc.h:174
#define assert(ex)
Definition: util_old.h:213
ABC_DLL int Abc_NtkLevel(Abc_Ntk_t *pNtk)
Definition: abcDfs.c:1265
ABC_DLL Abc_Obj_t* Abc_AigMiter ( Abc_Aig_t pMan,
Vec_Ptr_t vPairs,
int  fImplic 
)

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

Synopsis [Implements the miter.]

Description []

SideEffects []

SeeAlso []

Definition at line 789 of file abcAig.c.

790 {
791  int i;
792  if ( vPairs->nSize == 0 )
793  return Abc_ObjNot( Abc_AigConst1(pMan->pNtkAig) );
794  assert( vPairs->nSize % 2 == 0 );
795  // go through the cubes of the node's SOP
796  if ( fImplic )
797  {
798  for ( i = 0; i < vPairs->nSize; i += 2 )
799  vPairs->pArray[i/2] = Abc_AigAnd( pMan, (Abc_Obj_t *)vPairs->pArray[i], Abc_ObjNot((Abc_Obj_t *)vPairs->pArray[i+1]) );
800  }
801  else
802  {
803  for ( i = 0; i < vPairs->nSize; i += 2 )
804  vPairs->pArray[i/2] = Abc_AigXor( pMan, (Abc_Obj_t *)vPairs->pArray[i], (Abc_Obj_t *)vPairs->pArray[i+1] );
805  }
806  vPairs->nSize = vPairs->nSize/2;
807  return Abc_AigMiter_rec( pMan, (Abc_Obj_t **)vPairs->pArray, vPairs->nSize );
808 }
Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:700
Abc_Ntk_t * pNtkAig
Definition: abcAig.c:54
Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
#define assert(ex)
Definition: util_old.h:213
static Abc_Obj_t * Abc_ObjNot(Abc_Obj_t *p)
Definition: abc.h:324
Abc_Obj_t * Abc_AigMiter_rec(Abc_Aig_t *pMan, Abc_Obj_t **ppObjs, int nObjs)
Definition: abcAig.c:768
Abc_Obj_t * Abc_AigXor(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:735
ABC_DLL Abc_Obj_t* Abc_AigMux ( Abc_Aig_t pMan,
Abc_Obj_t pC,
Abc_Obj_t p1,
Abc_Obj_t p0 
)

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

Synopsis [Implements Boolean XOR.]

Description []

SideEffects []

SeeAlso []

Definition at line 752 of file abcAig.c.

753 {
754  return Abc_AigOr( pMan, Abc_AigAnd(pMan, pC, p1), Abc_AigAnd(pMan, Abc_ObjNot(pC), p0) );
755 }
Abc_Obj_t * Abc_AigOr(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:719
Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:700
static Abc_Obj_t * Abc_ObjNot(Abc_Obj_t *p)
Definition: abc.h:324
ABC_DLL Abc_Obj_t* Abc_AigMuxLookup ( Abc_Aig_t pMan,
Abc_Obj_t pC,
Abc_Obj_t pT,
Abc_Obj_t pE,
int *  pType 
)

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

Synopsis [Returns the gate implementing EXOR of the two arguments if it exists.]

Description [The argument nodes can be complemented.]

SideEffects []

SeeAlso []

Definition at line 508 of file abcAig.c.

509 {
510  Abc_Obj_t * pNode1, * pNode2, * pNode;
511  // set the flag to zero
512  if ( pType ) *pType = 0;
513  // check the case of MUX(c,t,e) = OR(ct', c'e')'
514  if ( (pNode1 = Abc_AigAndLookup(pMan, pC, Abc_ObjNot(pT))) &&
515  (pNode2 = Abc_AigAndLookup(pMan, Abc_ObjNot(pC), Abc_ObjNot(pE))) )
516  {
517  pNode = Abc_AigAndLookup( pMan, Abc_ObjNot(pNode1), Abc_ObjNot(pNode2) );
518  if ( pNode && pType ) *pType = 1;
519  return pNode;
520  }
521  // check the case of MUX(c,t,e) = OR(ct, c'e)
522  if ( (pNode1 = Abc_AigAndLookup(pMan, pC, pT)) &&
523  (pNode2 = Abc_AigAndLookup(pMan, Abc_ObjNot(pC), pE)) )
524  {
525  pNode = Abc_AigAndLookup( pMan, Abc_ObjNot(pNode1), Abc_ObjNot(pNode2) );
526  return pNode? Abc_ObjNot(pNode) : NULL;
527  }
528  return NULL;
529 }
Abc_Obj_t * Abc_AigAndLookup(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:403
static Abc_Obj_t * Abc_ObjNot(Abc_Obj_t *p)
Definition: abc.h:324
ABC_DLL int Abc_AigNodeHasComplFanoutEdge ( Abc_Obj_t pNode)

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

Synopsis [Returns 1 if the node has at least one complemented fanout.]

Description [A fanout is complemented if the fanout's fanin edge pointing to the given node is complemented.]

SideEffects []

SeeAlso []

Definition at line 1224 of file abcAig.c.

1225 {
1226  Abc_Obj_t * pFanout;
1227  int i, iFanin;
1228  Abc_ObjForEachFanout( pNode, pFanout, i )
1229  {
1230  iFanin = Vec_IntFind( &pFanout->vFanins, pNode->Id );
1231  assert( iFanin >= 0 );
1232  if ( Abc_ObjFaninC( pFanout, iFanin ) )
1233  return 1;
1234  }
1235  return 0;
1236 }
static int Vec_IntFind(Vec_Int_t *p, int Entry)
Definition: vecInt.h:895
Vec_Int_t vFanins
Definition: abc.h:143
static int Abc_ObjFaninC(Abc_Obj_t *pObj, int i)
Definition: abc.h:379
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition: abc.h:526
int Id
Definition: abc.h:132
#define assert(ex)
Definition: util_old.h:213
ABC_DLL int Abc_AigNodeHasComplFanoutEdgeTrav ( Abc_Obj_t pNode)

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

Synopsis [Returns 1 if the node has at least one complemented fanout.]

Description [A fanout is complemented if the fanout's fanin edge pointing to the given node is complemented. Only the fanouts with current TravId are counted.]

SideEffects []

SeeAlso []

Definition at line 1251 of file abcAig.c.

1252 {
1253  Abc_Obj_t * pFanout;
1254  int i, iFanin;
1255  Abc_ObjForEachFanout( pNode, pFanout, i )
1256  {
1257  if ( !Abc_NodeIsTravIdCurrent(pFanout) )
1258  continue;
1259  iFanin = Vec_IntFind( &pFanout->vFanins, pNode->Id );
1260  assert( iFanin >= 0 );
1261  if ( Abc_ObjFaninC( pFanout, iFanin ) )
1262  return 1;
1263  }
1264  return 0;
1265 }
static int Vec_IntFind(Vec_Int_t *p, int Entry)
Definition: vecInt.h:895
Vec_Int_t vFanins
Definition: abc.h:143
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:411
static int Abc_ObjFaninC(Abc_Obj_t *pObj, int i)
Definition: abc.h:379
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition: abc.h:526
int Id
Definition: abc.h:132
#define assert(ex)
Definition: util_old.h:213
ABC_DLL int Abc_AigNodeIsAcyclic ( Abc_Obj_t pNode,
Abc_Obj_t pRoot 
)

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

Synopsis [Check if the node has a combination loop of depth 1 or 2.]

Description []

SideEffects []

SeeAlso []

Definition at line 1313 of file abcAig.c.

1314 {
1315  Abc_Obj_t * pFanin0, * pFanin1;
1316  Abc_Obj_t * pChild00, * pChild01;
1317  Abc_Obj_t * pChild10, * pChild11;
1318  if ( !Abc_AigNodeIsAnd(pNode) )
1319  return 1;
1320  pFanin0 = Abc_ObjFanin0(pNode);
1321  pFanin1 = Abc_ObjFanin1(pNode);
1322  if ( pRoot == pFanin0 || pRoot == pFanin1 )
1323  return 0;
1324  if ( Abc_ObjIsCi(pFanin0) )
1325  {
1326  pChild00 = NULL;
1327  pChild01 = NULL;
1328  }
1329  else
1330  {
1331  pChild00 = Abc_ObjFanin0(pFanin0);
1332  pChild01 = Abc_ObjFanin1(pFanin0);
1333  if ( pRoot == pChild00 || pRoot == pChild01 )
1334  return 0;
1335  }
1336  if ( Abc_ObjIsCi(pFanin1) )
1337  {
1338  pChild10 = NULL;
1339  pChild11 = NULL;
1340  }
1341  else
1342  {
1343  pChild10 = Abc_ObjFanin0(pFanin1);
1344  pChild11 = Abc_ObjFanin1(pFanin1);
1345  if ( pRoot == pChild10 || pRoot == pChild11 )
1346  return 0;
1347  }
1348  return 1;
1349 }
static Abc_Obj_t * Abc_ObjFanin1(Abc_Obj_t *pObj)
Definition: abc.h:374
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
Definition: abc.h:351
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_AigNodeIsAnd(Abc_Obj_t *pNode)
Definition: abc.h:397
static int Abc_AigNodeIsAnd ( Abc_Obj_t pNode)
inlinestatic

Definition at line 397 of file abc.h.

397 { assert(!Abc_ObjIsComplement(pNode)); assert(Abc_NtkIsStrash(pNode->pNtk)); return Abc_ObjFaninNum(pNode) == 2; }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
Abc_Ntk_t * pNtk
Definition: abc.h:130
#define assert(ex)
Definition: util_old.h:213
static int Abc_ObjIsComplement(Abc_Obj_t *p)
Definition: abc.h:322
static int Abc_AigNodeIsChoice ( Abc_Obj_t pNode)
inlinestatic

Definition at line 398 of file abc.h.

398 { assert(!Abc_ObjIsComplement(pNode)); assert(Abc_NtkIsStrash(pNode->pNtk)); return pNode->pData != NULL && Abc_ObjFanoutNum(pNode) > 0; }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
Abc_Ntk_t * pNtk
Definition: abc.h:130
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
static int Abc_ObjIsComplement(Abc_Obj_t *p)
Definition: abc.h:322
static int Abc_AigNodeIsConst ( Abc_Obj_t pNode)
inlinestatic

Definition at line 396 of file abc.h.

396 { assert(Abc_NtkIsStrash(Abc_ObjRegular(pNode)->pNtk)); return Abc_ObjRegular(pNode)->Type == ABC_OBJ_CONST1; }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
unsigned Type
Definition: abc.h:133
static Abc_Obj_t * Abc_ObjRegular(Abc_Obj_t *p)
Definition: abc.h:323
#define assert(ex)
Definition: util_old.h:213
ABC_DLL Abc_Obj_t* Abc_AigOr ( Abc_Aig_t pMan,
Abc_Obj_t p0,
Abc_Obj_t p1 
)

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

Synopsis [Implements Boolean OR.]

Description []

SideEffects []

SeeAlso []

Definition at line 719 of file abcAig.c.

720 {
721  return Abc_ObjNot( Abc_AigAnd( pMan, Abc_ObjNot(p0), Abc_ObjNot(p1) ) );
722 }
Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:700
static Abc_Obj_t * Abc_ObjNot(Abc_Obj_t *p)
Definition: abc.h:324
ABC_DLL void Abc_AigPrintNode ( Abc_Obj_t pNode)

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

Synopsis [Prints the AIG node for debugging purposes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1279 of file abcAig.c.

1280 {
1281  Abc_Obj_t * pNodeR = Abc_ObjRegular(pNode);
1282  if ( Abc_ObjIsCi(pNodeR) )
1283  {
1284  printf( "CI %4s%s.\n", Abc_ObjName(pNodeR), Abc_ObjIsComplement(pNode)? "\'" : "" );
1285  return;
1286  }
1287  if ( Abc_AigNodeIsConst(pNodeR) )
1288  {
1289  printf( "Constant 1 %s.\n", Abc_ObjIsComplement(pNode)? "(complemented)" : "" );
1290  return;
1291  }
1292  // print the node's function
1293  printf( "%7s%s", Abc_ObjName(pNodeR), Abc_ObjIsComplement(pNode)? "\'" : "" );
1294  printf( " = " );
1295  printf( "%7s%s", Abc_ObjName(Abc_ObjFanin0(pNodeR)), Abc_ObjFaninC0(pNodeR)? "\'" : "" );
1296  printf( " * " );
1297  printf( "%7s%s", Abc_ObjName(Abc_ObjFanin1(pNodeR)), Abc_ObjFaninC1(pNodeR)? "\'" : "" );
1298  printf( "\n" );
1299 }
static Abc_Obj_t * Abc_ObjFanin1(Abc_Obj_t *pObj)
Definition: abc.h:374
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
Definition: abc.h:351
static int Abc_ObjFaninC1(Abc_Obj_t *pObj)
Definition: abc.h:378
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
static int Abc_AigNodeIsConst(Abc_Obj_t *pNode)
Definition: abc.h:396
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static Abc_Obj_t * Abc_ObjRegular(Abc_Obj_t *p)
Definition: abc.h:323
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
static int Abc_ObjIsComplement(Abc_Obj_t *p)
Definition: abc.h:322
ABC_DLL void Abc_AigRehash ( Abc_Aig_t pMan)

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

Synopsis [Resizes the hash table of AIG nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 628 of file abcAig.c.

629 {
630  Abc_Obj_t ** pBinsNew;
631  Abc_Obj_t * pEnt, * pEnt2;
632  int * pArray;
633  unsigned Key;
634  int Counter, Temp, i;
635 
636  // allocate a new array
637  pBinsNew = ABC_ALLOC( Abc_Obj_t *, pMan->nBins );
638  memset( pBinsNew, 0, sizeof(Abc_Obj_t *) * pMan->nBins );
639  // rehash the entries from the old table
640  Counter = 0;
641  for ( i = 0; i < pMan->nBins; i++ )
642  Abc_AigBinForEachEntrySafe( pMan->pBins[i], pEnt, pEnt2 )
643  {
644  // swap the fanins if needed
645  pArray = pEnt->vFanins.pArray;
646  if ( pArray[0] > pArray[1] )
647  {
648  Temp = pArray[0];
649  pArray[0] = pArray[1];
650  pArray[1] = Temp;
651  Temp = pEnt->fCompl0;
652  pEnt->fCompl0 = pEnt->fCompl1;
653  pEnt->fCompl1 = Temp;
654  }
655  // rehash the node
656  Key = Abc_HashKey2( Abc_ObjChild0(pEnt), Abc_ObjChild1(pEnt), pMan->nBins );
657  pEnt->pNext = pBinsNew[Key];
658  pBinsNew[Key] = pEnt;
659  Counter++;
660  }
661  assert( Counter == pMan->nEntries );
662  // replace the table and the parameters
663  ABC_FREE( pMan->pBins );
664  pMan->pBins = pBinsNew;
665 }
char * memset()
unsigned fCompl0
Definition: abc.h:140
Vec_Int_t vFanins
Definition: abc.h:143
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
int nBins
Definition: abcAig.c:57
unsigned fCompl1
Definition: abc.h:141
#define Abc_AigBinForEachEntrySafe(pBin, pEnt, pEnt2)
Definition: abcAig.c:78
static Abc_Obj_t * Abc_ObjChild0(Abc_Obj_t *pObj)
Definition: abc.h:383
static int Counter
#define ABC_FREE(obj)
Definition: abc_global.h:232
Abc_Obj_t ** pBins
Definition: abcAig.c:56
Abc_Obj_t * pNext
Definition: abc.h:131
#define assert(ex)
Definition: util_old.h:213
static unsigned Abc_HashKey2(Abc_Obj_t *p0, Abc_Obj_t *p1, int TableSize)
Definition: abcAig.c:90
int nEntries
Definition: abcAig.c:58
static Abc_Obj_t * Abc_ObjChild1(Abc_Obj_t *pObj)
Definition: abc.h:384
ABC_DLL void Abc_AigReplace ( Abc_Aig_t pMan,
Abc_Obj_t pOld,
Abc_Obj_t pNew,
int  fUpdateLevel 
)

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

Synopsis [Replaces one AIG node by the other.]

Description []

SideEffects []

SeeAlso []

Definition at line 850 of file abcAig.c.

851 {
852  assert( Vec_PtrSize(pMan->vStackReplaceOld) == 0 );
853  assert( Vec_PtrSize(pMan->vStackReplaceNew) == 0 );
854  Vec_PtrPush( pMan->vStackReplaceOld, pOld );
855  Vec_PtrPush( pMan->vStackReplaceNew, pNew );
856  assert( !Abc_ObjIsComplement(pOld) );
857  // process the replacements
858  while ( Vec_PtrSize(pMan->vStackReplaceOld) )
859  {
860  pOld = (Abc_Obj_t *)Vec_PtrPop( pMan->vStackReplaceOld );
861  pNew = (Abc_Obj_t *)Vec_PtrPop( pMan->vStackReplaceNew );
862  Abc_AigReplace_int( pMan, pOld, pNew, fUpdateLevel );
863  }
864  if ( fUpdateLevel )
865  {
866  Abc_AigUpdateLevel_int( pMan );
867  if ( pMan->pNtkAig->vLevelsR )
868  Abc_AigUpdateLevelR_int( pMan );
869  }
870 }
Vec_Int_t * vLevelsR
Definition: abc.h:196
Vec_Ptr_t * vStackReplaceOld
Definition: abcAig.c:60
Abc_Ntk_t * pNtkAig
Definition: abcAig.c:54
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static void Abc_AigUpdateLevel_int(Abc_Aig_t *pMan)
Definition: abcAig.c:1046
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void * Vec_PtrPop(Vec_Ptr_t *p)
Definition: vecPtr.h:677
Vec_Ptr_t * vStackReplaceNew
Definition: abcAig.c:61
#define assert(ex)
Definition: util_old.h:213
static void Abc_AigUpdateLevelR_int(Abc_Aig_t *pMan)
Definition: abcAig.c:1102
static int Abc_ObjIsComplement(Abc_Obj_t *p)
Definition: abc.h:322
static void Abc_AigReplace_int(Abc_Aig_t *pMan, Abc_Obj_t *pOld, Abc_Obj_t *pNew, int fUpdateLevel)
Definition: abcAig.c:883
ABC_DLL void Abc_AigSetNodePhases ( Abc_Ntk_t pNtk)

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

Synopsis [Sets the correct phase of the nodes.]

Description [The AIG nodes should be in the DFS order.]

SideEffects []

SeeAlso []

Definition at line 1389 of file abcAig.c.

1390 {
1391  Abc_Obj_t * pObj;
1392  int i;
1393  assert( Abc_NtkIsDfsOrdered(pNtk) );
1394  Abc_AigConst1(pNtk)->fPhase = 1;
1395  Abc_NtkForEachPi( pNtk, pObj, i )
1396  pObj->fPhase = 0;
1397  Abc_NtkForEachLatchOutput( pNtk, pObj, i )
1398  pObj->fPhase = Abc_LatchIsInit1(pObj);
1399  Abc_AigForEachAnd( pNtk, pObj, i )
1400  pObj->fPhase = (Abc_ObjFanin0(pObj)->fPhase ^ Abc_ObjFaninC0(pObj)) & (Abc_ObjFanin1(pObj)->fPhase ^ Abc_ObjFaninC1(pObj));
1401  Abc_NtkForEachPo( pNtk, pObj, i )
1402  pObj->fPhase = (Abc_ObjFanin0(pObj)->fPhase ^ Abc_ObjFaninC0(pObj));
1403  Abc_NtkForEachLatchInput( pNtk, pObj, i )
1404  pObj->fPhase = (Abc_ObjFanin0(pObj)->fPhase ^ Abc_ObjFaninC0(pObj));
1405 }
static Abc_Obj_t * Abc_ObjFanin1(Abc_Obj_t *pObj)
Definition: abc.h:374
static int Abc_ObjFaninC1(Abc_Obj_t *pObj)
Definition: abc.h:378
#define Abc_NtkForEachLatchOutput(pNtk, pObj, i)
Definition: abc.h:503
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
#define Abc_AigForEachAnd(pNtk, pNode, i)
Definition: abc.h:485
Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
static int Abc_LatchIsInit1(Abc_Obj_t *pLatch)
Definition: abc.h:423
#define Abc_NtkForEachLatchInput(pNtk, pObj, i)
Definition: abc.h:500
ABC_DLL int Abc_NtkIsDfsOrdered(Abc_Ntk_t *pNtk)
Definition: abcDfs.c:667
#define assert(ex)
Definition: util_old.h:213
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
unsigned fPhase
Definition: abc.h:137
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
ABC_DLL void Abc_AigUpdateReset ( Abc_Aig_t pMan)

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

Synopsis [Start the update list.]

Description []

SideEffects []

SeeAlso []

Definition at line 1460 of file abcAig.c.

1461 {
1462  assert( pMan->vAddedCells != NULL );
1463  Vec_PtrClear( pMan->vAddedCells );
1464  Vec_PtrClear( pMan->vUpdatedNets );
1465 }
Vec_Ptr_t * vAddedCells
Definition: abcAig.c:64
Vec_Ptr_t * vUpdatedNets
Definition: abcAig.c:65
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
ABC_DLL Vec_Ptr_t* Abc_AigUpdateStart ( Abc_Aig_t pMan,
Vec_Ptr_t **  pvUpdatedNets 
)

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

Synopsis [Start the update list.]

Description []

SideEffects []

SeeAlso []

Definition at line 1420 of file abcAig.c.

1421 {
1422  assert( pMan->vAddedCells == NULL );
1423  pMan->vAddedCells = Vec_PtrAlloc( 1000 );
1424  pMan->vUpdatedNets = Vec_PtrAlloc( 1000 );
1425  *pvUpdatedNets = pMan->vUpdatedNets;
1426  return pMan->vAddedCells;
1427 }
Vec_Ptr_t * vAddedCells
Definition: abcAig.c:64
Vec_Ptr_t * vUpdatedNets
Definition: abcAig.c:65
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define assert(ex)
Definition: util_old.h:213
ABC_DLL void Abc_AigUpdateStop ( Abc_Aig_t pMan)

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

Synopsis [Start the update list.]

Description []

SideEffects []

SeeAlso []

Definition at line 1440 of file abcAig.c.

1441 {
1442  assert( pMan->vAddedCells != NULL );
1443  Vec_PtrFree( pMan->vAddedCells );
1444  Vec_PtrFree( pMan->vUpdatedNets );
1445  pMan->vAddedCells = NULL;
1446  pMan->vUpdatedNets = NULL;
1447 }
Vec_Ptr_t * vAddedCells
Definition: abcAig.c:64
Vec_Ptr_t * vUpdatedNets
Definition: abcAig.c:65
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL Abc_Obj_t* Abc_AigXor ( Abc_Aig_t pMan,
Abc_Obj_t p0,
Abc_Obj_t p1 
)

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

Synopsis [Implements Boolean XOR.]

Description []

SideEffects []

SeeAlso []

Definition at line 735 of file abcAig.c.

736 {
737  return Abc_AigOr( pMan, Abc_AigAnd(pMan, p0, Abc_ObjNot(p1)),
738  Abc_AigAnd(pMan, p1, Abc_ObjNot(p0)) );
739 }
Abc_Obj_t * Abc_AigOr(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:719
Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:700
static Abc_Obj_t * Abc_ObjNot(Abc_Obj_t *p)
Definition: abc.h:324
ABC_DLL Abc_Obj_t* Abc_AigXorLookup ( Abc_Aig_t pMan,
Abc_Obj_t p0,
Abc_Obj_t p1,
int *  pType 
)

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

Synopsis [Returns the gate implementing EXOR of the two arguments if it exists.]

Description [The argument nodes can be complemented.]

SideEffects []

SeeAlso []

Definition at line 474 of file abcAig.c.

475 {
476  Abc_Obj_t * pNode1, * pNode2, * pNode;
477  // set the flag to zero
478  if ( pType ) *pType = 0;
479  // check the case of XOR(a,b) = OR(ab, a'b')'
480  if ( (pNode1 = Abc_AigAndLookup(pMan, Abc_ObjNot(p0), Abc_ObjNot(p1))) &&
481  (pNode2 = Abc_AigAndLookup(pMan, p0, p1)) )
482  {
483  pNode = Abc_AigAndLookup( pMan, Abc_ObjNot(pNode1), Abc_ObjNot(pNode2) );
484  if ( pNode && pType ) *pType = 1;
485  return pNode;
486  }
487  // check the case of XOR(a,b) = OR(a'b, ab')
488  if ( (pNode1 = Abc_AigAndLookup(pMan, p0, Abc_ObjNot(p1))) &&
489  (pNode2 = Abc_AigAndLookup(pMan, Abc_ObjNot(p0), p1)) )
490  {
491  pNode = Abc_AigAndLookup( pMan, Abc_ObjNot(pNode1), Abc_ObjNot(pNode2) );
492  return pNode? Abc_ObjNot(pNode) : NULL;
493  }
494  return NULL;
495 }
Abc_Obj_t * Abc_AigAndLookup(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:403
static Abc_Obj_t * Abc_ObjNot(Abc_Obj_t *p)
Definition: abc.h:324
ABC_DLL int Abc_DesAddModel ( Abc_Des_t p,
Abc_Ntk_t pNtk 
)

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

Synopsis [Create the library.]

Description []

SideEffects []

SeeAlso []

Definition at line 226 of file abcLib.c.

227 {
228  if ( st__is_member( p->tModules, (char *)pNtk->pName ) )
229  return 0;
230  st__insert( p->tModules, (char *)pNtk->pName, (char *)pNtk );
231  assert( pNtk->Id == 0 );
232  pNtk->Id = Vec_PtrSize(p->vModules);
233  Vec_PtrPush( p->vModules, pNtk );
234  pNtk->pDesign = p;
235  return 1;
236 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int st__insert(st__table *table, const char *key, char *value)
Definition: st.c:171
st__table * tModules
Definition: abc.h:224
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define st__is_member(table, key)
Definition: st.h:70
int Id
Definition: abc.h:184
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Vec_Ptr_t * vModules
Definition: abc.h:223
#define assert(ex)
Definition: util_old.h:213
Abc_Des_t * pDesign
Definition: abc.h:180
char * pName
Definition: abc.h:158
ABC_DLL void Abc_DesCleanManPointer ( Abc_Des_t p,
void *  pMan 
)

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

Synopsis [Removes all pointers to the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 70 of file abcLib.c.

71 {
72  Abc_Ntk_t * pTemp;
73  int i;
74  if ( p == NULL )
75  return;
76  if ( p->pManFunc == pMan )
77  p->pManFunc = NULL;
78  Vec_PtrForEachEntry( Abc_Ntk_t *, p->vModules, pTemp, i )
79  if ( pTemp->pManFunc == pMan )
80  pTemp->pManFunc = NULL;
81 }
void * pManFunc
Definition: abc.h:221
if(last==0)
Definition: sparse_int.h:34
Vec_Ptr_t * vModules
Definition: abc.h:223
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
ABC_DLL Abc_Des_t* Abc_DesCreate ( char *  pName)

DECLARATIONS ///.

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

FileName [abcLib.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Network and node package.]

Synopsis [Functions to manipulate verilog libraries.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Create the library.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file abcLib.c.

46 {
47  Abc_Des_t * p;
48  p = ABC_ALLOC( Abc_Des_t, 1 );
49  memset( p, 0, sizeof(Abc_Des_t) );
50  p->pName = Abc_UtilStrsav( pName );
52  p->vTops = Vec_PtrAlloc( 100 );
53  p->vModules = Vec_PtrAlloc( 100 );
54  p->pManFunc = Hop_ManStart();
55  p->pLibrary = NULL;
56  return p;
57 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
st__table * tModules
Definition: abc.h:224
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
char * pName
Definition: abc.h:220
int strcmp()
void * pManFunc
Definition: abc.h:221
st__table * st__init_table(st__compare_func_type compare, st__hash_func_type hash)
Definition: st.c:72
int st__strhash(const char *string, int modulus)
Definition: st.c:449
Abc_Des_t * pLibrary
Definition: abc.h:225
Hop_Man_t * Hop_ManStart()
DECLARATIONS ///.
Definition: hopMan.c:45
Vec_Ptr_t * vTops
Definition: abc.h:222
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
Vec_Ptr_t * vModules
Definition: abc.h:223
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
ABC_DLL Abc_Ntk_t* Abc_DesDeriveRoot ( Abc_Des_t p)

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

Synopsis [Frees the library.]

Description []

SideEffects []

SeeAlso []

Definition at line 269 of file abcLib.c.

270 {
271  Abc_Ntk_t * pNtk;
272  if ( Vec_PtrSize(p->vModules) > 1 )
273  {
274  printf( "The design includes more than one module and is currently not used.\n" );
275  return NULL;
276  }
277  pNtk = (Abc_Ntk_t *)Vec_PtrEntry( p->vModules, 0 ); Vec_PtrClear( p->vModules );
278  pNtk->pManFunc = p->pManFunc; p->pManFunc = NULL;
279  return pNtk;
280 }
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
void * pManFunc
Definition: abc.h:221
void * pManFunc
Definition: abc.h:191
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
Vec_Ptr_t * vModules
Definition: abc.h:223
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
ABC_DLL Abc_Des_t* Abc_DesDup ( Abc_Des_t p)

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

Synopsis [Duplicated the library.]

Description []

SideEffects []

SeeAlso []

Definition at line 133 of file abcLib.c.

134 {
135  Abc_Des_t * pNew;
136  Abc_Ntk_t * pTemp;
137  Abc_Obj_t * pObj;
138  int i, k;
139  pNew = Abc_DesCreate( p->pName );
140  Vec_PtrForEachEntry( Abc_Ntk_t *, p->vModules, pTemp, i )
141  Abc_DesAddModel( pNew, Abc_NtkDup(pTemp) );
142  Vec_PtrForEachEntry( Abc_Ntk_t *, p->vTops, pTemp, i )
143  Vec_PtrPush( pNew->vTops, pTemp->pCopy );
144  Vec_PtrForEachEntry( Abc_Ntk_t *, p->vModules, pTemp, i )
145  pTemp->pCopy->pAltView = pTemp->pAltView ? pTemp->pAltView->pCopy : NULL;
146  // update box models
147  Vec_PtrForEachEntry( Abc_Ntk_t *, p->vModules, pTemp, i )
148  Abc_NtkForEachBox( pTemp, pObj, k )
149  if ( Abc_ObjIsWhitebox(pObj) || Abc_ObjIsBlackbox(pObj) )
150  pObj->pCopy->pData = Abc_ObjModel(pObj)->pCopy;
151  return pNew;
152 }
ABC_DLL Abc_Ntk_t * Abc_NtkDup(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:419
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Abc_ObjIsWhitebox(Abc_Obj_t *pObj)
Definition: abc.h:358
char * pName
Definition: abc.h:220
static Abc_Ntk_t * Abc_ObjModel(Abc_Obj_t *pObj)
Definition: abc.h:335
if(last==0)
Definition: sparse_int.h:34
int Abc_DesAddModel(Abc_Des_t *p, Abc_Ntk_t *pNtk)
Definition: abcLib.c:226
#define Abc_NtkForEachBox(pNtk, pObj, i)
Definition: abc.h:495
Vec_Ptr_t * vModules
Definition: abc.h:223
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static int Abc_ObjIsBlackbox(Abc_Obj_t *pObj)
Definition: abc.h:359
ABC_NAMESPACE_IMPL_START Abc_Des_t * Abc_DesCreate(char *pName)
DECLARATIONS ///.
Definition: abcLib.c:45
ABC_DLL Abc_Ntk_t* Abc_DesFindModelByName ( Abc_Des_t p,
char *  pName 
)

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

Synopsis [Create the library.]

Description []

SideEffects []

SeeAlso []

Definition at line 249 of file abcLib.c.

250 {
251  Abc_Ntk_t * pNtk;
252  if ( ! st__is_member( p->tModules, (char *)pName ) )
253  return NULL;
254  st__lookup( p->tModules, (char *)pName, (char **)&pNtk );
255  return pNtk;
256 }
st__table * tModules
Definition: abc.h:224
#define st__is_member(table, key)
Definition: st.h:70
int st__lookup(st__table *table, const char *key, char **value)
Definition: st.c:114
ABC_DLL int Abc_DesFindTopLevelModels ( Abc_Des_t p)

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

Synopsis [Detects the top-level models.]

Description []

SideEffects []

SeeAlso []

Definition at line 293 of file abcLib.c.

294 {
295  Abc_Ntk_t * pNtk, * pNtkBox;
296  Abc_Obj_t * pObj;
297  int i, k;
298  assert( Vec_PtrSize( p->vModules ) > 0 );
299  // clear the models
300  Vec_PtrForEachEntry( Abc_Ntk_t *, p->vModules, pNtk, i )
301  pNtk->fHieVisited = 0;
302  // mark all the models reachable from other models
303  Vec_PtrForEachEntry( Abc_Ntk_t *, p->vModules, pNtk, i )
304  {
305  Abc_NtkForEachBox( pNtk, pObj, k )
306  {
307  if ( Abc_ObjIsLatch(pObj) )
308  continue;
309  if ( pObj->pData == NULL )
310  continue;
311  pNtkBox = (Abc_Ntk_t *)pObj->pData;
312  pNtkBox->fHieVisited = 1;
313  }
314  }
315  // collect the models that are not marked
316  Vec_PtrClear( p->vTops );
317  Vec_PtrForEachEntry( Abc_Ntk_t *, p->vModules, pNtk, i )
318  {
319  if ( pNtk->fHieVisited == 0 )
320  Vec_PtrPush( p->vTops, pNtk );
321  else
322  pNtk->fHieVisited = 0;
323  }
324  return Vec_PtrSize( p->vTops );
325 }
static int Abc_ObjIsLatch(Abc_Obj_t *pObj)
Definition: abc.h:356
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Vec_Ptr_t * vTops
Definition: abc.h:222
#define Abc_NtkForEachBox(pNtk, pObj, i)
Definition: abc.h:495
Vec_Ptr_t * vModules
Definition: abc.h:223
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
void * pData
Definition: abc.h:145
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
int fHieVisited
Definition: abc.h:182
ABC_DLL void Abc_DesFree ( Abc_Des_t p,
Abc_Ntk_t pNtkSave 
)

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

Synopsis [Frees the library.]

Description []

SideEffects []

SeeAlso []

Definition at line 94 of file abcLib.c.

95 {
96  Abc_Ntk_t * pNtk;
97  int i;
98  if ( p->pName )
99  ABC_FREE( p->pName );
100  if ( p->pManFunc )
101  Hop_ManStop( (Hop_Man_t *)p->pManFunc );
102  if ( p->tModules )
103  st__free_table( p->tModules );
104  if ( p->vModules )
105  {
106  Vec_PtrForEachEntry( Abc_Ntk_t *, p->vModules, pNtk, i )
107  {
108  if ( pNtk == pNtkSave )
109  continue;
110  pNtk->pDesign = NULL;
111  if ( (pNtkSave && pNtk->pManFunc == pNtkSave->pManFunc) || (pNtk->pManFunc == p->pManFunc) )
112  pNtk->pManFunc = NULL;
113  Abc_NtkDelete( pNtk );
114  }
115  Vec_PtrFree( p->vModules );
116  }
117  if ( p->vTops )
118  Vec_PtrFree( p->vTops );
119  ABC_FREE( p );
120 }
void st__free_table(st__table *table)
Definition: st.c:81
st__table * tModules
Definition: abc.h:224
char * pName
Definition: abc.h:220
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
void Hop_ManStop(Hop_Man_t *p)
Definition: hopMan.c:84
void * pManFunc
Definition: abc.h:221
void * pManFunc
Definition: abc.h:191
Vec_Ptr_t * vTops
Definition: abc.h:222
#define ABC_FREE(obj)
Definition: abc_global.h:232
Vec_Ptr_t * vModules
Definition: abc.h:223
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
Abc_Des_t * pDesign
Definition: abc.h:180
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL void Abc_DesPrint ( Abc_Des_t p)

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

Synopsis [Prints the library.]

Description []

SideEffects []

SeeAlso []

Definition at line 194 of file abcLib.c.

195 {
196  Abc_Ntk_t * pNtk;
197  Abc_Obj_t * pObj;
198  int i, k;
199  printf( "Models of design %s:\n", p->pName );
200  Vec_PtrForEachEntry( Abc_Ntk_t *, p->vModules, pNtk, i )
201  {
202  printf( "%2d : %20s ", i+1, pNtk->pName );
203  printf( "nd = %6d lat = %6d whitebox = %3d blackbox = %3d\n",
204  Abc_NtkNodeNum(pNtk), Abc_NtkLatchNum(pNtk),
205  Abc_NtkWhiteboxNum(pNtk), Abc_NtkBlackboxNum(pNtk) );
206  if ( Abc_NtkBlackboxNum(pNtk) == 0 )
207  continue;
208  Abc_NtkForEachWhitebox( pNtk, pObj, k )
209  printf( " %20s (whitebox)\n", Abc_NtkName((Abc_Ntk_t *)pObj->pData) );
210  Abc_NtkForEachBlackbox( pNtk, pObj, k )
211  printf( " %20s (blackbox)\n", Abc_NtkName((Abc_Ntk_t *)pObj->pData) );
212  }
213 }
#define Abc_NtkForEachWhitebox(pNtk, pObj, i)
Definition: abc.h:506
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
char * pName
Definition: abc.h:220
static int Abc_NtkWhiteboxNum(Abc_Ntk_t *pNtk)
Definition: abc.h:295
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
Definition: abc.h:293
#define Abc_NtkForEachBlackbox(pNtk, pObj, i)
Definition: abc.h:509
static char * Abc_NtkName(Abc_Ntk_t *pNtk)
Definition: abc.h:270
Vec_Ptr_t * vModules
Definition: abc.h:223
static int Abc_NtkBlackboxNum(Abc_Ntk_t *pNtk)
Definition: abc.h:296
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
char * pName
Definition: abc.h:158
ABC_DLL Vec_Vec_t* Abc_DfsLevelized ( Abc_Obj_t pNode,
int  fTfi 
)

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

Synopsis [Collects nodes in the DFS manner by level.]

Description [The number of levels should be set!!!]

SideEffects []

SeeAlso []

Definition at line 1129 of file abcDfs.c.

1130 {
1131  Vec_Vec_t * vLevels;
1132  Abc_Obj_t * pFanout;
1133  int i;
1134  assert( fTfi == 0 );
1135  assert( !Abc_NtkIsNetlist(pNode->pNtk) );
1136  // set the traversal ID
1137  Abc_NtkIncrementTravId( pNode->pNtk );
1138  vLevels = Vec_VecAlloc( 100 );
1139  if ( Abc_ObjIsNode(pNode) )
1140  Abc_DfsLevelizedTfo_rec( pNode, vLevels );
1141  else
1142  {
1143  assert( Abc_ObjIsCi(pNode) );
1144  Abc_NodeSetTravIdCurrent( pNode );
1145  Abc_ObjForEachFanout( pNode, pFanout, i )
1146  Abc_DfsLevelizedTfo_rec( pFanout, vLevels );
1147  }
1148  return vLevels;
1149 }
static Vec_Vec_t * Vec_VecAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecVec.h:145
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
Definition: abc.h:351
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
void Abc_DfsLevelizedTfo_rec(Abc_Obj_t *pNode, Vec_Vec_t *vLevels)
Definition: abcDfs.c:1098
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
Abc_Ntk_t * pNtk
Definition: abc.h:130
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition: abc.h:526
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
#define assert(ex)
Definition: util_old.h:213
static void Abc_NodeSetTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:409
static void Abc_InfoAnd ( unsigned *  p,
unsigned *  q,
int  nWords 
)
inlinestatic

Definition at line 242 of file abc.h.

242 { int i; for ( i = nWords - 1; i >= 0; i-- ) p[i] &= q[i]; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nWords
Definition: abcNpn.c:127
static void Abc_InfoClear ( unsigned *  p,
int  nWords 
)
inlinestatic

Definition at line 236 of file abc.h.

236 { memset( p, 0, sizeof(unsigned) * nWords ); }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nWords
Definition: abcNpn.c:127
static void Abc_InfoCopy ( unsigned *  p,
unsigned *  q,
int  nWords 
)
inlinestatic

Definition at line 241 of file abc.h.

241 { int i; for ( i = nWords - 1; i >= 0; i-- ) p[i] = q[i]; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nWords
Definition: abcNpn.c:127
static void Abc_InfoFill ( unsigned *  p,
int  nWords 
)
inlinestatic

Definition at line 237 of file abc.h.

237 { memset( p, 0xff, sizeof(unsigned) * nWords );}
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nWords
Definition: abcNpn.c:127
static int Abc_InfoIsOne ( unsigned *  p,
int  nWords 
)
inlinestatic

Definition at line 240 of file abc.h.

240 { int i; for ( i = nWords - 1; i >= 0; i-- ) if ( ~p[i] ) return 0; return 1; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nWords
Definition: abcNpn.c:127
static int Abc_InfoIsOrOne ( unsigned *  p,
unsigned *  q,
int  nWords 
)
inlinestatic

Definition at line 245 of file abc.h.

245 { int i; for ( i = nWords - 1; i >= 0; i-- ) if ( ~(p[i] | q[i]) ) return 0; return 1; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nWords
Definition: abcNpn.c:127
static int Abc_InfoIsOrOne3 ( unsigned *  p,
unsigned *  q,
unsigned *  r,
int  nWords 
)
inlinestatic

Definition at line 246 of file abc.h.

246 { int i; for ( i = nWords - 1; i >= 0; i-- ) if ( ~(p[i] | q[i] | r[i]) ) return 0; return 1; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nWords
Definition: abcNpn.c:127
static int Abc_InfoIsZero ( unsigned *  p,
int  nWords 
)
inlinestatic

Definition at line 239 of file abc.h.

239 { int i; for ( i = nWords - 1; i >= 0; i-- ) if ( p[i] ) return 0; return 1; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nWords
Definition: abcNpn.c:127
static void Abc_InfoNot ( unsigned *  p,
int  nWords 
)
inlinestatic

Definition at line 238 of file abc.h.

238 { int i; for ( i = nWords - 1; i >= 0; i-- ) p[i] = ~p[i]; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nWords
Definition: abcNpn.c:127
static void Abc_InfoOr ( unsigned *  p,
unsigned *  q,
int  nWords 
)
inlinestatic

Definition at line 243 of file abc.h.

243 { int i; for ( i = nWords - 1; i >= 0; i-- ) p[i] |= q[i]; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nWords
Definition: abcNpn.c:127
static void Abc_InfoRandom ( unsigned *  p,
int  nWords 
)
inlinestatic

Definition at line 235 of file abc.h.

235 { int i; for ( i = nWords - 1; i >= 0; i-- ) p[i] = Abc_InfoRandomWord(); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static unsigned Abc_InfoRandomWord()
MACRO DEFINITIONS ///.
Definition: abc.h:234
int nWords
Definition: abcNpn.c:127
static unsigned Abc_InfoRandomWord ( )
inlinestatic

MACRO DEFINITIONS ///.

Definition at line 234 of file abc.h.

234 { return ((((unsigned)rand()) << 24) ^ (((unsigned)rand()) << 12) ^ ((unsigned)rand())); } // #define RAND_MAX 0x7fff
static void Abc_InfoXor ( unsigned *  p,
unsigned *  q,
int  nWords 
)
inlinestatic

Definition at line 244 of file abc.h.

244 { int i; for ( i = nWords - 1; i >= 0; i-- ) p[i] ^= q[i]; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nWords
Definition: abcNpn.c:127
static int Abc_LatchInit ( Abc_Obj_t pLatch)
inlinestatic

Definition at line 425 of file abc.h.

425 { assert(Abc_ObjIsLatch(pLatch)); return (int)(ABC_PTRINT_T)pLatch->pData; }
static int Abc_ObjIsLatch(Abc_Obj_t *pObj)
Definition: abc.h:356
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
static int Abc_LatchIsInit0 ( Abc_Obj_t pLatch)
inlinestatic

Definition at line 422 of file abc.h.

422 { assert(Abc_ObjIsLatch(pLatch)); return pLatch->pData == (void *)ABC_INIT_ZERO; }
static int Abc_ObjIsLatch(Abc_Obj_t *pObj)
Definition: abc.h:356
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
static int Abc_LatchIsInit1 ( Abc_Obj_t pLatch)
inlinestatic

Definition at line 423 of file abc.h.

423 { assert(Abc_ObjIsLatch(pLatch)); return pLatch->pData == (void *)ABC_INIT_ONE; }
static int Abc_ObjIsLatch(Abc_Obj_t *pObj)
Definition: abc.h:356
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
static int Abc_LatchIsInitDc ( Abc_Obj_t pLatch)
inlinestatic

Definition at line 424 of file abc.h.

424 { assert(Abc_ObjIsLatch(pLatch)); return pLatch->pData == (void *)ABC_INIT_DC; }
static int Abc_ObjIsLatch(Abc_Obj_t *pObj)
Definition: abc.h:356
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
static int Abc_LatchIsInitNone ( Abc_Obj_t pLatch)
inlinestatic

Definition at line 421 of file abc.h.

421 { assert(Abc_ObjIsLatch(pLatch)); return pLatch->pData == (void *)ABC_INIT_NONE; }
static int Abc_ObjIsLatch(Abc_Obj_t *pObj)
Definition: abc.h:356
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
static void Abc_LatchSetInit0 ( Abc_Obj_t pLatch)
inlinestatic

Definition at line 418 of file abc.h.

418 { assert(Abc_ObjIsLatch(pLatch)); pLatch->pData = (void *)ABC_INIT_ZERO; }
static int Abc_ObjIsLatch(Abc_Obj_t *pObj)
Definition: abc.h:356
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
static void Abc_LatchSetInit1 ( Abc_Obj_t pLatch)
inlinestatic

Definition at line 419 of file abc.h.

419 { assert(Abc_ObjIsLatch(pLatch)); pLatch->pData = (void *)ABC_INIT_ONE; }
static int Abc_ObjIsLatch(Abc_Obj_t *pObj)
Definition: abc.h:356
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
static void Abc_LatchSetInitDc ( Abc_Obj_t pLatch)
inlinestatic

Definition at line 420 of file abc.h.

420 { assert(Abc_ObjIsLatch(pLatch)); pLatch->pData = (void *)ABC_INIT_DC; }
static int Abc_ObjIsLatch(Abc_Obj_t *pObj)
Definition: abc.h:356
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
static void Abc_LatchSetInitNone ( Abc_Obj_t pLatch)
inlinestatic

Definition at line 417 of file abc.h.

417 { assert(Abc_ObjIsLatch(pLatch)); pLatch->pData = (void *)ABC_INIT_NONE; }
static int Abc_ObjIsLatch(Abc_Obj_t *pObj)
Definition: abc.h:356
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
ABC_DLL void Abc_ManTimeDup ( Abc_Ntk_t pNtkOld,
Abc_Ntk_t pNtkNew 
)

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

Synopsis [Duplicates the timing manager with the PI/PO timing info.]

Description [The PIs/POs of the new network should be allocated.]

SideEffects []

SeeAlso []

Definition at line 481 of file abcTiming.c.

482 {
483  Abc_Obj_t * pObj;
484  Abc_Time_t ** ppTimesOld, ** ppTimesNew;
485  int i;
486  if ( pNtkOld->pManTime == NULL )
487  return;
488  assert( Abc_NtkCiNum(pNtkOld) == Abc_NtkCiNum(pNtkNew) );
489  assert( Abc_NtkCoNum(pNtkOld) == Abc_NtkCoNum(pNtkNew) );
490  assert( Abc_NtkLatchNum(pNtkOld) == Abc_NtkLatchNum(pNtkNew) );
491  // create the new timing manager
492  pNtkNew->pManTime = Abc_ManTimeStart(pNtkNew);
493  Abc_ManTimeExpand( pNtkNew->pManTime, Abc_NtkObjNumMax(pNtkNew), 0 );
494  // set the default timing
495  pNtkNew->pManTime->tArrDef = pNtkOld->pManTime->tArrDef;
496  pNtkNew->pManTime->tReqDef = pNtkOld->pManTime->tReqDef;
497  // set the CI timing
498  ppTimesOld = (Abc_Time_t **)pNtkOld->pManTime->vArrs->pArray;
499  ppTimesNew = (Abc_Time_t **)pNtkNew->pManTime->vArrs->pArray;
500  Abc_NtkForEachCi( pNtkOld, pObj, i )
501  *ppTimesNew[ Abc_NtkCi(pNtkNew,i)->Id ] = *ppTimesOld[ pObj->Id ];
502  // set the CO timing
503  ppTimesOld = (Abc_Time_t **)pNtkOld->pManTime->vReqs->pArray;
504  ppTimesNew = (Abc_Time_t **)pNtkNew->pManTime->vReqs->pArray;
505  Abc_NtkForEachCo( pNtkOld, pObj, i )
506  *ppTimesNew[ Abc_NtkCo(pNtkNew,i)->Id ] = *ppTimesOld[ pObj->Id ];
507  // duplicate input drive
508  pNtkNew->pManTime->tInDriveDef = pNtkOld->pManTime->tInDriveDef;
509  pNtkNew->pManTime->tOutLoadDef = pNtkOld->pManTime->tOutLoadDef;
510  if ( pNtkOld->pManTime->tInDrive )
511  {
512  pNtkNew->pManTime->tInDrive = ABC_ALLOC( Abc_Time_t, Abc_NtkCiNum(pNtkOld) );
513  memcpy( pNtkNew->pManTime->tInDrive, pNtkOld->pManTime->tInDrive, sizeof(Abc_Time_t) * Abc_NtkCiNum(pNtkOld) );
514  }
515  if ( pNtkOld->pManTime->tOutLoad )
516  {
517  pNtkNew->pManTime->tOutLoad = ABC_ALLOC( Abc_Time_t, Abc_NtkCiNum(pNtkOld) );
518  memcpy( pNtkNew->pManTime->tOutLoad, pNtkOld->pManTime->tOutLoad, sizeof(Abc_Time_t) * Abc_NtkCoNum(pNtkOld) );
519  }
520 }
Abc_Time_t * tOutLoad
Definition: abcTiming.c:41
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
Vec_Ptr_t * vArrs
Definition: abcTiming.c:36
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
char * memcpy()
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static Abc_Obj_t * Abc_NtkCi(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:317
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
static Abc_Obj_t * Abc_NtkCo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:318
static void Abc_ManTimeExpand(Abc_ManTime_t *p, int nSize, int fProgressive)
Definition: abcTiming.c:533
Abc_Time_t tInDriveDef
Definition: abcTiming.c:38
Abc_Time_t tArrDef
Definition: abcTiming.c:34
Abc_Time_t * tInDrive
Definition: abcTiming.c:40
Vec_Ptr_t * vReqs
Definition: abcTiming.c:37
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
static Abc_ManTime_t * Abc_ManTimeStart(Abc_Ntk_t *pNtk)
Definition: abcTiming.c:431
int Id
Definition: abc.h:132
Abc_ManTime_t * pManTime
Definition: abc.h:192
#define assert(ex)
Definition: util_old.h:213
Abc_Time_t tOutLoadDef
Definition: abcTiming.c:39
Abc_Time_t tReqDef
Definition: abcTiming.c:35
ABC_DLL void Abc_ManTimeStop ( Abc_ManTime_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 455 of file abcTiming.c.

456 {
457  if ( p->tInDrive )
458  ABC_FREE( p->tInDrive );
459  if ( p->tOutLoad )
460  ABC_FREE( p->tOutLoad );
461  if ( Vec_PtrSize(p->vArrs) > 0 )
462  ABC_FREE( p->vArrs->pArray[0] );
463  Vec_PtrFree( p->vArrs );
464  if ( Vec_PtrSize(p->vReqs) > 0 )
465  ABC_FREE( p->vReqs->pArray[0] );
466  Vec_PtrFree( p->vReqs );
467  ABC_FREE( p );
468 }
Abc_Time_t * tOutLoad
Definition: abcTiming.c:41
Vec_Ptr_t * vArrs
Definition: abcTiming.c:36
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Abc_Time_t * tInDrive
Definition: abcTiming.c:40
Vec_Ptr_t * vReqs
Definition: abcTiming.c:37
#define ABC_FREE(obj)
Definition: abc_global.h:232
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL void Abc_NodeBddToCnf ( Abc_Obj_t pNode,
Mem_Flex_t pMmMan,
Vec_Str_t vCube,
int  fAllPrimes,
char **  ppSop0,
char **  ppSop1 
)

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

Synopsis [Computes the SOPs of the negative and positive phase of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 490 of file abcFunc.c.

491 {
492  assert( Abc_NtkHasBdd(pNode->pNtk) );
493  *ppSop0 = Abc_ConvertBddToSop( pMmMan, (DdManager *)pNode->pNtk->pManFunc, (DdNode *)pNode->pData, (DdNode *)pNode->pData, Abc_ObjFaninNum(pNode), fAllPrimes, vCube, 0 );
494  *ppSop1 = Abc_ConvertBddToSop( pMmMan, (DdManager *)pNode->pNtk->pManFunc, (DdNode *)pNode->pData, (DdNode *)pNode->pData, Abc_ObjFaninNum(pNode), fAllPrimes, vCube, 1 );
495 }
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
Definition: cudd.h:278
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
void * pManFunc
Definition: abc.h:191
char * Abc_ConvertBddToSop(Mem_Flex_t *pMan, DdManager *dd, DdNode *bFuncOn, DdNode *bFuncOnDc, int nFanins, int fAllPrimes, Vec_Str_t *vCube, int fMode)
Definition: abcFunc.c:209
Abc_Ntk_t * pNtk
Definition: abc.h:130
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
static void Abc_NodeClearPersistant ( Abc_Obj_t pNode)
inlinestatic

Definition at line 403 of file abc.h.

403 { assert( Abc_AigNodeIsAnd(pNode) ); pNode->fPersist = 0; }
static int Abc_AigNodeIsAnd(Abc_Obj_t *pNode)
Definition: abc.h:397
#define assert(ex)
Definition: util_old.h:213
unsigned fPersist
Definition: abc.h:139
ABC_DLL void Abc_NodeCollectFanins ( Abc_Obj_t pNode,
Vec_Ptr_t vNodes 
)

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

Synopsis [Returns 1 if it is an AIG with choice nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1587 of file abcUtil.c.

1588 {
1589  Abc_Obj_t * pFanin;
1590  int i;
1591  Vec_PtrClear(vNodes);
1592  Abc_ObjForEachFanin( pNode, pFanin, i )
1593  Vec_PtrPush( vNodes, pFanin );
1594 }
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
ABC_DLL void Abc_NodeCollectFanouts ( Abc_Obj_t pNode,
Vec_Ptr_t vNodes 
)

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

Synopsis [Returns 1 if it is an AIG with choice nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1607 of file abcUtil.c.

1608 {
1609  Abc_Obj_t * pFanout;
1610  int i;
1611  Vec_PtrClear(vNodes);
1612  Abc_ObjForEachFanout( pNode, pFanout, i )
1613  Vec_PtrPush( vNodes, pFanout );
1614 }
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition: abc.h:526
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
ABC_DLL Vec_Ptr_t* Abc_NodeCollectTfoCands ( Abc_ManCut_t p,
Abc_Obj_t pRoot,
Vec_Ptr_t vLeaves,
int  LevelMax 
)

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

Synopsis [Collects the TFO of the cut in the topological order.]

Description [TFO of the cut is defined as a set of nodes, for which the cut is a cut, that is, every path from the collected nodes to the CIs goes through a node in the cut. The nodes are collected if their level does not exceed the given number (LevelMax). The nodes are returned in the topological order. If the root node is given, its MFFC is marked, so that the collected nodes do not contain any nodes in the MFFC.]

SideEffects []

SeeAlso []

Definition at line 692 of file abcReconv.c.

693 {
694  Abc_Ntk_t * pNtk = pRoot->pNtk;
695  Vec_Ptr_t * vVec;
696  Abc_Obj_t * pNode, * pFanout;
697  int i, k, v, LevelMin;
698  assert( Abc_NtkIsStrash(pNtk) );
699 
700  // assuming that the structure is clean
701  Vec_VecForEachLevel( p->vLevels, vVec, i )
702  assert( vVec->nSize == 0 );
703 
704  // put fanins into the structure while labeling them
705  Abc_NtkIncrementTravId( pNtk );
706  LevelMin = -1;
707  Vec_PtrForEachEntry( Abc_Obj_t *, vLeaves, pNode, i )
708  {
709  if ( pNode->Level > (unsigned)LevelMax )
710  continue;
711  Abc_NodeSetTravIdCurrent( pNode );
712  Vec_VecPush( p->vLevels, pNode->Level, pNode );
713  if ( LevelMin < (int)pNode->Level )
714  LevelMin = pNode->Level;
715  }
716  assert( LevelMin >= 0 );
717 
718  // mark MFFC
719  if ( pRoot )
720  Abc_NodeMffcLabelAig( pRoot );
721 
722  // go through the levels up
723  Vec_PtrClear( p->vNodesTfo );
724  Vec_VecForEachEntryStart( Abc_Obj_t *, p->vLevels, pNode, i, k, LevelMin )
725  {
726  if ( i > LevelMax )
727  break;
728  // if the node is not marked, it is not a fanin
729  if ( !Abc_NodeIsTravIdCurrent(pNode) )
730  {
731  // check if it belongs to the TFO
732  if ( !Abc_NodeIsTravIdCurrent(Abc_ObjFanin0(pNode)) ||
734  continue;
735  // save the node in the TFO and label it
736  Vec_PtrPush( p->vNodesTfo, pNode );
737  Abc_NodeSetTravIdCurrent( pNode );
738  }
739  // go through the fanouts and add them to the structure if they meet the conditions
740  Abc_ObjForEachFanout( pNode, pFanout, v )
741  {
742  // skip if fanout is a CO or its level exceeds
743  if ( Abc_ObjIsCo(pFanout) || pFanout->Level > (unsigned)LevelMax )
744  continue;
745  // skip if it is already added or if it is in MFFC
746  if ( Abc_NodeIsTravIdCurrent(pFanout) )
747  continue;
748  // add it to the structure but do not mark it (until tested later)
749  Vec_VecPushUnique( p->vLevels, pFanout->Level, pFanout );
750  }
751  }
752 
753  // clear the levelized structure
754  Vec_VecForEachLevelStart( p->vLevels, vVec, i, LevelMin )
755  {
756  if ( i > LevelMax )
757  break;
758  Vec_PtrClear( vVec );
759  }
760  return p->vNodesTfo;
761 }
#define Vec_VecForEachLevel(vGlob, vVec, i)
MACRO DEFINITIONS ///.
Definition: vecVec.h:55
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Abc_Obj_t * Abc_ObjFanin1(Abc_Obj_t *pObj)
Definition: abc.h:374
static void Vec_VecPush(Vec_Vec_t *p, int Level, void *Entry)
Definition: vecVec.h:456
#define Vec_VecForEachLevelStart(vGlob, vVec, i, LevelStart)
Definition: vecVec.h:57
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
ABC_DLL int Abc_NodeMffcLabelAig(Abc_Obj_t *pNode)
Definition: abcRefs.c:100
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
unsigned Level
Definition: abc.h:142
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
Definition: abc.h:352
#define Vec_VecForEachEntryStart(Type, vGlob, pEntry, i, k, LevelStart)
Definition: vecVec.h:92
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:411
Abc_Ntk_t * pNtk
Definition: abc.h:130
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition: abc.h:526
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
Vec_Vec_t * vLevels
Definition: abcReconv.c:42
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
Vec_Ptr_t * vNodesTfo
Definition: abcReconv.c:43
static void Abc_NodeSetTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:409
static void Vec_VecPushUnique(Vec_Vec_t *p, int Level, void *Entry)
Definition: vecVec.h:492
ABC_DLL int Abc_NodeCompareLevelsDecrease ( Abc_Obj_t **  pp1,
Abc_Obj_t **  pp2 
)

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

Synopsis [Procedure used for sorting the nodes in decreasing order of levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 1675 of file abcUtil.c.

1676 {
1677  int Diff = Abc_ObjRegular(*pp1)->Level - Abc_ObjRegular(*pp2)->Level;
1678  if ( Diff > 0 )
1679  return -1;
1680  if ( Diff < 0 )
1681  return 1;
1682  Diff = Abc_ObjRegular(*pp1)->Id - Abc_ObjRegular(*pp2)->Id;
1683  if ( Diff > 0 )
1684  return -1;
1685  if ( Diff < 0 )
1686  return 1;
1687  return 0;
1688 }
unsigned Level
Definition: abc.h:142
if(last==0)
Definition: sparse_int.h:34
static Abc_Obj_t * Abc_ObjRegular(Abc_Obj_t *p)
Definition: abc.h:323
int Id
Definition: abc.h:132
ABC_DLL int Abc_NodeCompareLevelsIncrease ( Abc_Obj_t **  pp1,
Abc_Obj_t **  pp2 
)

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 1649 of file abcUtil.c.

1650 {
1651  int Diff = Abc_ObjRegular(*pp1)->Level - Abc_ObjRegular(*pp2)->Level;
1652  if ( Diff < 0 )
1653  return -1;
1654  if ( Diff > 0 )
1655  return 1;
1656  Diff = Abc_ObjRegular(*pp1)->Id - Abc_ObjRegular(*pp2)->Id;
1657  if ( Diff < 0 )
1658  return -1;
1659  if ( Diff > 0 )
1660  return 1;
1661  return 0;
1662 }
unsigned Level
Definition: abc.h:142
if(last==0)
Definition: sparse_int.h:34
static Abc_Obj_t * Abc_ObjRegular(Abc_Obj_t *p)
Definition: abc.h:323
int Id
Definition: abc.h:132
ABC_DLL int Abc_NodeCompareNames ( Abc_Obj_t **  pp1,
Abc_Obj_t **  pp2 
)

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

Synopsis [Procedure used for sorting the nodes in decreasing order of levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 309 of file abcNames.c.

310 {
311  int Diff = strcmp( (char *)(*pp1)->pCopy, (char *)(*pp2)->pCopy );
312  if ( Diff < 0 )
313  return -1;
314  if ( Diff > 0 )
315  return 1;
316  Diff = (*pp1)->Id - (*pp2)->Id;
317  if ( Diff < 0 )
318  return -1;
319  if ( Diff > 0 )
320  return 1;
321  return 0;
322 }
int strcmp()
ABC_DLL void Abc_NodeComplement ( Abc_Obj_t pNode)

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

Synopsis [Complements the local functions of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 980 of file abcObj.c.

981 {
982  assert( Abc_NtkIsLogic(pNode->pNtk) || Abc_NtkIsNetlist(pNode->pNtk) );
983  assert( Abc_ObjIsNode(pNode) );
984  if ( Abc_NtkHasSop(pNode->pNtk) )
985  Abc_SopComplement( (char *)pNode->pData );
986  else if ( Abc_NtkHasAig(pNode->pNtk) )
987  pNode->pData = Hop_Not( (Hop_Obj_t *)pNode->pData );
988  else if ( Abc_NtkHasBdd(pNode->pNtk) )
989  pNode->pData = Cudd_Not( pNode->pData );
990  else
991  assert( 0 );
992 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
#define Cudd_Not(node)
Definition: cudd.h:367
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static Hop_Obj_t * Hop_Not(Hop_Obj_t *p)
Definition: hop.h:127
Definition: hop.h:65
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
Abc_Ntk_t * pNtk
Definition: abc.h:130
ABC_DLL void Abc_SopComplement(char *pSop)
Definition: abcSop.c:600
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
void * pData
Definition: abc.h:145
ABC_DLL void Abc_NodeComplementInput ( Abc_Obj_t pNode,
Abc_Obj_t pFanin 
)

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

Synopsis [Changes the polarity of one fanin.]

Description []

SideEffects []

SeeAlso []

Definition at line 1005 of file abcObj.c.

1006 {
1007  int iFanin;
1008  if ( (iFanin = Vec_IntFind( &pNode->vFanins, pFanin->Id )) == -1 )
1009  {
1010  printf( "Node %s should be among", Abc_ObjName(pFanin) );
1011  printf( " the fanins of node %s...\n", Abc_ObjName(pNode) );
1012  return;
1013  }
1014  if ( Abc_NtkHasSop(pNode->pNtk) )
1015  Abc_SopComplementVar( (char *)pNode->pData, iFanin );
1016  else if ( Abc_NtkHasAig(pNode->pNtk) )
1017  pNode->pData = Hop_Complement( (Hop_Man_t *)pNode->pNtk->pManFunc, (Hop_Obj_t *)pNode->pData, iFanin );
1018  else if ( Abc_NtkHasBdd(pNode->pNtk) )
1019  {
1020  DdManager * dd = (DdManager *)pNode->pNtk->pManFunc;
1021  DdNode * bVar, * bCof0, * bCof1;
1022  bVar = Cudd_bddIthVar( dd, iFanin );
1023  bCof0 = Cudd_Cofactor( dd, (DdNode *)pNode->pData, Cudd_Not(bVar) ); Cudd_Ref( bCof0 );
1024  bCof1 = Cudd_Cofactor( dd, (DdNode *)pNode->pData, bVar ); Cudd_Ref( bCof1 );
1025  Cudd_RecursiveDeref( dd, (DdNode *)pNode->pData );
1026  pNode->pData = Cudd_bddIte( dd, bVar, bCof0, bCof1 ); Cudd_Ref( (DdNode *)pNode->pData );
1027  Cudd_RecursiveDeref( dd, bCof0 );
1028  Cudd_RecursiveDeref( dd, bCof1 );
1029  }
1030  else
1031  assert( 0 );
1032 }
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
Definition: cudd.h:278
#define Cudd_Not(node)
Definition: cudd.h:367
static int Vec_IntFind(Vec_Int_t *p, int Entry)
Definition: vecInt.h:895
Vec_Int_t vFanins
Definition: abc.h:143
DdNode * Cudd_bddIte(DdManager *dd, DdNode *f, DdNode *g, DdNode *h)
Definition: cuddBddIte.c:143
Definition: hop.h:65
ABC_DLL void Abc_SopComplementVar(char *pSop, int iVar)
Definition: abcSop.c:630
void * pManFunc
Definition: abc.h:191
DdNode * Cudd_Cofactor(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddCof.c:123
Abc_Ntk_t * pNtk
Definition: abc.h:130
int Id
Definition: abc.h:132
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
DdNode * Cudd_bddIthVar(DdManager *dd, int i)
Definition: cuddAPI.c:416
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
void * pData
Definition: abc.h:145
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
Hop_Obj_t * Hop_Complement(Hop_Man_t *p, Hop_Obj_t *pRoot, int iVar)
Definition: hopDfs.c:469
ABC_DLL void Abc_NodeConeCollect ( Abc_Obj_t **  ppRoots,
int  nRoots,
Vec_Ptr_t vLeaves,
Vec_Ptr_t vVisited,
int  fIncludeFanins 
)

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

Synopsis [Get the nodes contained in the cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 441 of file abcReconv.c.

442 {
443  Abc_Obj_t * pTemp;
444  int i;
445  // mark the fanins of the cone
446  Abc_NodesMark( vLeaves );
447  // collect the nodes in the DFS order
448  Vec_PtrClear( vVisited );
449  // add the fanins
450  if ( fIncludeFanins )
451  Vec_PtrForEachEntry( Abc_Obj_t *, vLeaves, pTemp, i )
452  Vec_PtrPush( vVisited, pTemp );
453  // add other nodes
454  for ( i = 0; i < nRoots; i++ )
455  Abc_NodeConeMarkCollect_rec( ppRoots[i], vVisited );
456  // unmark both sets
457  Abc_NodesUnmark( vLeaves );
458  Abc_NodesUnmark( vVisited );
459 }
static void Abc_NodesMark(Vec_Ptr_t *vVisited)
FUNCTION DEFINITIONS ///.
Definition: abcReconv.c:65
static void Abc_NodeConeMarkCollect_rec(Abc_Obj_t *pNode, Vec_Ptr_t *vVisited)
Definition: abcReconv.c:472
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
for(p=first;p->value< newval;p=p->next)
static void Abc_NodesUnmark(Vec_Ptr_t *vVisited)
Definition: abcReconv.c:84
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
ABC_DLL char* Abc_NodeConvertSopToMvSop ( int  nVars,
Vec_Int_t vSop0,
Vec_Int_t vSop1 
)

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

Synopsis [Converts SOP into MV-SOP.]

Description []

SideEffects []

SeeAlso []

Definition at line 1028 of file abcBlifMv.c.

1029 {
1030  char * pMvSop, * pCur;
1031  unsigned uCube;
1032  int nCubes, nSize, Value, i, k;
1033  // consider the case of the constant node
1034  if ( Vec_IntSize(vSop0) == 0 || Vec_IntSize(vSop1) == 0 )
1035  {
1036  // (temporary) create a tautology cube
1037  pMvSop = ABC_ALLOC( char, nVars + 3 );
1038  for ( k = 0; k < nVars; k++ )
1039  pMvSop[k] = '-';
1040  pMvSop[nVars] = '0' + (int)(Vec_IntSize(vSop1) > 0);
1041  pMvSop[nVars+1] = '\n';
1042  pMvSop[nVars+2] = 0;
1043  return pMvSop;
1044  }
1045  // find the total number of cubes
1046  nCubes = Vec_IntSize(vSop0) + Vec_IntSize(vSop1);
1047  // find the size of the MVSOP represented as a C-string
1048  // (each cube has nVars variables + one output literal + end-of-line,
1049  // and the string is zero-terminated)
1050  nSize = nCubes * (nVars + 2) + 1;
1051  // allocate memory
1052  pMvSop = pCur = ABC_ALLOC( char, nSize );
1053  // fill in the negative polarity cubes
1054  Vec_IntForEachEntry( vSop0, uCube, i )
1055  {
1056  for ( k = 0; k < nVars; k++ )
1057  {
1058  Value = (uCube >> (2*k)) & 3;
1059  if ( Value == 1 )
1060  *pCur++ = '0';
1061  else if ( Value == 2 )
1062  *pCur++ = '1';
1063  else if ( Value == 0 )
1064  *pCur++ = '-';
1065  else
1066  assert( 0 );
1067  }
1068  *pCur++ = '0';
1069  *pCur++ = '\n';
1070  }
1071  // fill in the positive polarity cubes
1072  Vec_IntForEachEntry( vSop1, uCube, i )
1073  {
1074  for ( k = 0; k < nVars; k++ )
1075  {
1076  Value = (uCube >> (2*k)) & 3;
1077  if ( Value == 1 )
1078  *pCur++ = '0';
1079  else if ( Value == 2 )
1080  *pCur++ = '1';
1081  else if ( Value == 0 )
1082  *pCur++ = '-';
1083  else
1084  assert( 0 );
1085  }
1086  *pCur++ = '1';
1087  *pCur++ = '\n';
1088  }
1089  *pCur++ = 0;
1090  assert( pCur - pMvSop == nSize );
1091  return pMvSop;
1092 }
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define assert(ex)
Definition: util_old.h:213
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
ABC_DLL int Abc_NodeDeref_rec ( Abc_Obj_t pNode)

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

Synopsis [Dereferences the node's MFFC.]

Description []

SideEffects []

SeeAlso []

Definition at line 215 of file abcRefs.c.

216 {
217  Abc_Obj_t * pFanin;
218  int i, Counter = 1;
219  if ( Abc_ObjIsCi(pNode) )
220  return 0;
221  Abc_ObjForEachFanin( pNode, pFanin, i )
222  {
223  assert( pFanin->vFanouts.nSize > 0 );
224  if ( --pFanin->vFanouts.nSize == 0 )
225  Counter += Abc_NodeDeref_rec( pFanin );
226  }
227  return Counter;
228 }
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
Definition: abc.h:351
int Abc_NodeDeref_rec(Abc_Obj_t *pNode)
Definition: abcRefs.c:215
static int Counter
Vec_Int_t vFanouts
Definition: abc.h:144
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
#define assert(ex)
Definition: util_old.h:213
ABC_DLL int Abc_NodeEvalMvCost ( int  nVars,
Vec_Int_t vSop0,
Vec_Int_t vSop1 
)

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

Synopsis [Evaluates the cost of the cut.]

Description [The Boolean function of the cut is specified by two SOPs, which represent the negative/positive polarities of the cut function. Converts these two SOPs into a mutually-agreed-upon representation to be passed to the internal cost-evaluation procedure (see the above prototype Abc_NodeEvalMvCostInternal).]

SideEffects []

SeeAlso []

Definition at line 1135 of file abcBlifMv.c.

1136 {
1137  char * pMvSop;
1138  int * pVarValues;
1139  int i, RetValue;
1140  // collect the input and output values (currently, they are binary)
1141  pVarValues = ABC_ALLOC( int, nVars + 1 );
1142  for ( i = 0; i <= nVars; i++ )
1143  pVarValues[i] = 2;
1144  // prepare MV-SOP for evaluation
1145  pMvSop = Abc_NodeConvertSopToMvSop( nVars, vSop0, vSop1 );
1146  // have a look at the MV-SOP:
1147 // printf( "%s\n", pMvSop );
1148  // get the result of internal cost evaluation
1149  RetValue = Abc_NodeEvalMvCostInternal( nVars, pVarValues, pMvSop );
1150  // cleanup
1151  ABC_FREE( pVarValues );
1152  ABC_FREE( pMvSop );
1153  return RetValue;
1154 }
char * Abc_NodeConvertSopToMvSop(int nVars, Vec_Int_t *vSop0, Vec_Int_t *vSop1)
Definition: abcBlifMv.c:1028
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
#define ABC_FREE(obj)
Definition: abc_global.h:232
int Abc_NodeEvalMvCostInternal(int nVars, int *pVarValues, char *pMvSop)
Definition: abcBlifMv.c:1111
ABC_DLL Abc_Obj_t* Abc_NodeFindCoFanout ( Abc_Obj_t pNode)

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

Synopsis [Checks if the internal node has CO fanout.]

Description []

SideEffects []

SeeAlso []

Definition at line 779 of file abcUtil.c.

780 {
781  Abc_Obj_t * pFanout;
782  int i;
783  Abc_ObjForEachFanout( pNode, pFanout, i )
784  if ( Abc_ObjIsCo(pFanout) )
785  return pFanout;
786  return NULL;
787 }
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
Definition: abc.h:352
if(last==0)
Definition: sparse_int.h:34
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition: abc.h:526
ABC_DLL Vec_Ptr_t* Abc_NodeFindCut ( Abc_ManCut_t p,
Abc_Obj_t pRoot,
int  fContain 
)

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

Synopsis [Finds a fanin-limited, reconvergence-driven cut for the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 253 of file abcReconv.c.

254 {
255  Abc_Obj_t * pNode;
256  int i;
257 
258  assert( !Abc_ObjIsComplement(pRoot) );
259  assert( Abc_ObjIsNode(pRoot) );
260 
261  // start the visited nodes and mark them
262  Vec_PtrClear( p->vVisited );
263  Vec_PtrPush( p->vVisited, pRoot );
264  Vec_PtrPush( p->vVisited, Abc_ObjFanin0(pRoot) );
265  Vec_PtrPush( p->vVisited, Abc_ObjFanin1(pRoot) );
266  pRoot->fMarkB = 1;
267  Abc_ObjFanin0(pRoot)->fMarkB = 1;
268  Abc_ObjFanin1(pRoot)->fMarkB = 1;
269 
270  // start the cut
272  Vec_PtrPush( p->vNodeLeaves, Abc_ObjFanin0(pRoot) );
273  Vec_PtrPush( p->vNodeLeaves, Abc_ObjFanin1(pRoot) );
274 
275  // compute the cut
278 
279  // return if containing cut is not requested
280  if ( !fContain )
281  {
282  // unmark both fMarkA and fMarkB in tbe TFI
284  return p->vNodeLeaves;
285  }
286 
287 //printf( "\n\n\n" );
288  // compute the containing cut
289  assert( p->nNodeSizeMax < p->nConeSizeMax );
290  // copy the current boundary
292  Vec_PtrForEachEntry( Abc_Obj_t *, p->vNodeLeaves, pNode, i )
293  Vec_PtrPush( p->vConeLeaves, pNode );
294  // compute the containing cut
295  while ( Abc_NodeBuildCutLevelOne_int( p->vVisited, p->vConeLeaves, p->nConeSizeMax, p->nConeFanStop ) );
296  assert( Vec_PtrSize(p->vConeLeaves) <= p->nConeSizeMax );
297  // unmark TFI using fMarkA and fMarkB
298  Abc_NodesUnmarkB( p->vVisited );
299  return p->vNodeLeaves;
300 }
Vec_Ptr_t * vConeLeaves
Definition: abcReconv.c:40
static Abc_Obj_t * Abc_ObjFanin1(Abc_Obj_t *pObj)
Definition: abc.h:374
Vec_Ptr_t * vNodeLeaves
Definition: abcReconv.c:39
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
int nNodeSizeMax
Definition: abcReconv.c:34
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
int nNodeFanStop
Definition: abcReconv.c:36
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
int nConeSizeMax
Definition: abcReconv.c:35
static int Abc_NodeBuildCutLevelOne_int(Vec_Ptr_t *vVisited, Vec_Ptr_t *vLeaves, int nSizeLimit, int nFaninLimit)
Definition: abcReconv.c:316
Vec_Ptr_t * vVisited
Definition: abcReconv.c:41
unsigned fMarkB
Definition: abc.h:135
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static int Abc_ObjIsComplement(Abc_Obj_t *p)
Definition: abc.h:322
static void Abc_NodesUnmarkB(Vec_Ptr_t *vVisited)
Definition: abcReconv.c:103
ABC_DLL int Abc_NodeFindFanin ( Abc_Obj_t pNode,
Abc_Obj_t pFanin 
)

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

Synopsis [Returns the index of the given fanin.]

Description []

SideEffects []

SeeAlso []

Definition at line 758 of file abcUtil.c.

759 {
760  Abc_Obj_t * pThis;
761  int i;
762  Abc_ObjForEachFanin( pNode, pThis, i )
763  if ( pThis == pFanin )
764  return i;
765  return -1;
766 }
if(last==0)
Definition: sparse_int.h:34
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
ABC_DLL Abc_Obj_t* Abc_NodeFindNonCoFanout ( Abc_Obj_t pNode)

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

Synopsis [Checks if the internal node has CO fanout.]

Description []

SideEffects []

SeeAlso []

Definition at line 800 of file abcUtil.c.

801 {
802  Abc_Obj_t * pFanout;
803  int i;
804  Abc_ObjForEachFanout( pNode, pFanout, i )
805  if ( !Abc_ObjIsCo(pFanout) )
806  return pFanout;
807  return NULL;
808 }
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
Definition: abc.h:352
if(last==0)
Definition: sparse_int.h:34
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition: abc.h:526
ABC_DLL void Abc_NodeFreeCuts ( void *  p,
Abc_Obj_t pObj 
)

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

Synopsis [Computes the cuts for the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 527 of file base/abci/abcCut.c.

528 {
529  Cut_NodeFreeCuts( (Cut_Man_t *)p, pObj->Id );
530 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Cut_NodeFreeCuts(Cut_Man_t *p, int Node)
Definition: cutApi.c:184
int Id
Definition: abc.h:132
ABC_DLL void Abc_NodeFreeNames ( Vec_Ptr_t vNames)

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

Synopsis [Gets fanin node names.]

Description []

SideEffects []

SeeAlso []

Definition at line 257 of file abcNames.c.

258 {
259  int i;
260  if ( vNames == NULL )
261  return;
262  for ( i = 0; i < vNames->nSize; i++ )
263  ABC_FREE( vNames->pArray[i] );
264  Vec_PtrFree( vNames );
265 }
#define ABC_FREE(obj)
Definition: abc_global.h:232
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL void* Abc_NodeGetCuts ( void *  p,
Abc_Obj_t pObj,
int  fDag,
int  fTree 
)

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

Synopsis [Computes the cuts for the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 433 of file base/abci/abcCut.c.

434 {
435  Abc_Obj_t * pFanin;
436  int fDagNode, fTriv, TreeCode = 0;
437 // assert( Abc_NtkIsStrash(pObj->pNtk) );
438  assert( Abc_ObjFaninNum(pObj) == 2 );
439 
440  // check if the node is a DAG node
441  fDagNode = (Abc_ObjFanoutNum(pObj) > 1 && !Abc_NodeIsMuxControlType(pObj));
442  // increment the counter of DAG nodes
443  if ( fDagNode ) Cut_ManIncrementDagNodes( (Cut_Man_t *)p );
444  // add the trivial cut if the node is a DAG node, or if we compute all cuts
445  fTriv = fDagNode || !fDag;
446  // check if fanins are DAG nodes
447  if ( fTree )
448  {
449  pFanin = Abc_ObjFanin0(pObj);
450  TreeCode |= (Abc_ObjFanoutNum(pFanin) > 1 && !Abc_NodeIsMuxControlType(pFanin));
451  pFanin = Abc_ObjFanin1(pObj);
452  TreeCode |= ((Abc_ObjFanoutNum(pFanin) > 1 && !Abc_NodeIsMuxControlType(pFanin)) << 1);
453  }
454 
455  // changes due to the global/local cut computation
456  {
457  Cut_Params_t * pParams = Cut_ManReadParams((Cut_Man_t *)p);
458  if ( pParams->fLocal )
459  {
460  Vec_Int_t * vNodeAttrs = Cut_ManReadNodeAttrs((Cut_Man_t *)p);
461  fDagNode = Vec_IntEntry( vNodeAttrs, pObj->Id );
462  if ( fDagNode ) Cut_ManIncrementDagNodes( (Cut_Man_t *)p );
463 // fTriv = fDagNode || !pParams->fGlobal;
464  fTriv = !Vec_IntEntry( vNodeAttrs, pObj->Id );
465  TreeCode = 0;
466  pFanin = Abc_ObjFanin0(pObj);
467  TreeCode |= Vec_IntEntry( vNodeAttrs, pFanin->Id );
468  pFanin = Abc_ObjFanin1(pObj);
469  TreeCode |= (Vec_IntEntry( vNodeAttrs, pFanin->Id ) << 1);
470  }
471  }
472  return Cut_NodeComputeCuts( (Cut_Man_t *)p, pObj->Id, Abc_ObjFaninId0(pObj), Abc_ObjFaninId1(pObj),
473  Abc_ObjFaninC0(pObj), Abc_ObjFaninC1(pObj), fTriv, TreeCode );
474 }
static Abc_Obj_t * Abc_ObjFanin1(Abc_Obj_t *pObj)
Definition: abc.h:374
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Abc_ObjFaninC1(Abc_Obj_t *pObj)
Definition: abc.h:378
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_ObjFaninId0(Abc_Obj_t *pObj)
Definition: abc.h:367
ABC_DLL int Abc_NodeIsMuxControlType(Abc_Obj_t *pNode)
Definition: abcUtil.c:1357
void Cut_ManIncrementDagNodes(Cut_Man_t *p)
Definition: cutMan.c:309
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Cut_Cut_t * Cut_NodeComputeCuts(Cut_Man_t *p, int Node, int Node0, int Node1, int fCompl0, int fCompl1, int fTriv, int TreeCode)
Definition: cutNode.c:369
int Id
Definition: abc.h:132
#define assert(ex)
Definition: util_old.h:213
static int Abc_ObjFaninId1(Abc_Obj_t *pObj)
Definition: abc.h:368
Cut_Params_t * Cut_ManReadParams(Cut_Man_t *p)
Definition: cutMan.c:277
Vec_Int_t * Cut_ManReadNodeAttrs(Cut_Man_t *p)
Definition: cutMan.c:293
ABC_DLL void* Abc_NodeGetCutsRecursive ( void *  p,
Abc_Obj_t pObj,
int  fDag,
int  fTree 
)

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

Synopsis [Computes the cuts for the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 412 of file base/abci/abcCut.c.

413 {
414  void * pList;
415  if ( (pList = Abc_NodeReadCuts( p, pObj )) )
416  return pList;
417  Abc_NodeGetCutsRecursive( p, Abc_ObjFanin0(pObj), fDag, fTree );
418  Abc_NodeGetCutsRecursive( p, Abc_ObjFanin1(pObj), fDag, fTree );
419  return Abc_NodeGetCuts( p, pObj, fDag, fTree );
420 }
void * Abc_NodeGetCutsRecursive(void *p, Abc_Obj_t *pObj, int fDag, int fTree)
static Abc_Obj_t * Abc_ObjFanin1(Abc_Obj_t *pObj)
Definition: abc.h:374
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
void * Abc_NodeGetCuts(void *p, Abc_Obj_t *pObj, int fDag, int fTree)
void * Abc_NodeReadCuts(void *p, Abc_Obj_t *pObj)
ABC_DLL void Abc_NodeGetCutsSeq ( void *  p,
Abc_Obj_t pObj,
int  fTriv 
)

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

Synopsis [Computes the cuts for the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 487 of file base/abci/abcCut.c.

488 {
489 /*
490  int CutSetNum;
491  assert( Abc_NtkIsSeq(pObj->pNtk) );
492  assert( Abc_ObjFaninNum(pObj) == 2 );
493  fTriv = pObj->fMarkC ? 0 : fTriv;
494  CutSetNum = pObj->fMarkC ? (int)pObj->pCopy : -1;
495  Cut_NodeComputeCutsSeq( p, pObj->Id, Abc_ObjFaninId0(pObj), Abc_ObjFaninId1(pObj),
496  Abc_ObjFaninC0(pObj), Abc_ObjFaninC1(pObj), Seq_ObjFaninL0(pObj), Seq_ObjFaninL1(pObj), fTriv, CutSetNum );
497 */
498 }
ABC_DLL Vec_Ptr_t* Abc_NodeGetFakeNames ( int  nNames)

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

Synopsis [Gets fanin node names.]

Description []

SideEffects []

SeeAlso []

Definition at line 221 of file abcNames.c.

222 {
223  Vec_Ptr_t * vNames;
224  char Buffer[5];
225  int i;
226 
227  vNames = Vec_PtrAlloc( nNames );
228  for ( i = 0; i < nNames; i++ )
229  {
230  if ( nNames < 26 )
231  {
232  Buffer[0] = 'a' + i;
233  Buffer[1] = 0;
234  }
235  else
236  {
237  Buffer[0] = 'a' + i%26;
238  Buffer[1] = '0' + i/26;
239  Buffer[2] = 0;
240  }
241  Vec_PtrPush( vNames, Extra_UtilStrsav(Buffer) );
242  }
243  return vNames;
244 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
char * Extra_UtilStrsav(const char *s)
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
ABC_DLL Vec_Ptr_t* Abc_NodeGetFaninNames ( Abc_Obj_t pNode)

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

Synopsis [Gets fanin node names.]

Description []

SideEffects []

SeeAlso []

Definition at line 199 of file abcNames.c.

200 {
201  Vec_Ptr_t * vNodes;
202  Abc_Obj_t * pFanin;
203  int i;
204  vNodes = Vec_PtrAlloc( 100 );
205  Abc_ObjForEachFanin( pNode, pFanin, i )
206  Vec_PtrPush( vNodes, Abc_UtilStrsav(Abc_ObjName(pFanin)) );
207  return vNodes;
208 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
ABC_NAMESPACE_IMPL_START char * Abc_ObjName(Abc_Obj_t *pObj)
DECLARATIONS ///.
Definition: abcNames.c:48
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
ABC_DLL Abc_Obj_t* Abc_NodeHasUniqueCoFanout ( Abc_Obj_t pNode)

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

Synopsis [Checks if the internal node has CO drivers with the same name.]

Description [Checks if the internal node can borrow its name from CO fanouts. This is possible if all COs with non-complemented fanin edge pointing to this node have the same name.]

SideEffects []

SeeAlso []

Definition at line 823 of file abcUtil.c.

824 {
825  Abc_Obj_t * pFanout, * pFanoutCo;
826  int i;
827  pFanoutCo = NULL;
828  Abc_ObjForEachFanout( pNode, pFanout, i )
829  {
830  if ( !Abc_ObjIsCo(pFanout) )
831  continue;
832  if ( Abc_ObjFaninC0(pFanout) )
833  continue;
834  if ( pFanoutCo == NULL )
835  {
836  assert( Abc_ObjFaninNum(pFanout) == 1 );
837  assert( Abc_ObjFanin0(pFanout) == pNode );
838  pFanoutCo = pFanout;
839  continue;
840  }
841  if ( strcmp( Abc_ObjName(pFanoutCo), Abc_ObjName(pFanout) ) ) // they have diff names
842  return NULL;
843  }
844  return pFanoutCo;
845 }
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
Definition: abc.h:352
int strcmp()
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition: abc.h:526
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
#define assert(ex)
Definition: util_old.h:213
ABC_DLL int Abc_NodeIsBuf ( Abc_Obj_t pNode)

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

Synopsis [Returns 1 if the node is a buffer.]

Description []

SideEffects []

SeeAlso []

Definition at line 920 of file abcObj.c.

921 {
922  Abc_Ntk_t * pNtk = pNode->pNtk;
923  assert( Abc_NtkIsLogic(pNtk) || Abc_NtkIsNetlist(pNtk) );
924  assert( Abc_ObjIsNode(pNode) );
925  if ( Abc_ObjFaninNum(pNode) != 1 )
926  return 0;
927  if ( Abc_NtkHasSop(pNtk) )
928  return Abc_SopIsBuf((char *)pNode->pData);
929  if ( Abc_NtkHasBdd(pNtk) )
930  return !Cudd_IsComplement(pNode->pData);
931  if ( Abc_NtkHasAig(pNtk) )
932  return !Hop_IsComplement((Hop_Obj_t *)pNode->pData);
933  if ( Abc_NtkHasMapping(pNtk) )
935  assert( 0 );
936  return 0;
937 }
Mio_Gate_t * Mio_LibraryReadBuf(Mio_Library_t *pLib)
Definition: mioApi.c:47
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
ABC_DLL void * Abc_FrameReadLibGen()
Definition: mainFrame.c:56
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
Definition: hop.h:65
ABC_DLL int Abc_SopIsBuf(char *pSop)
Definition: abcSop.c:708
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
#define Cudd_IsComplement(node)
Definition: cudd.h:425
static int Hop_IsComplement(Hop_Obj_t *p)
Definition: hop.h:129
STRUCTURE DEFINITIONS ///.
Definition: mioInt.h:61
Abc_Ntk_t * pNtk
Definition: abc.h:130
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
void * pData
Definition: abc.h:145
ABC_DLL int Abc_NodeIsConst ( Abc_Obj_t pNode)

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

Synopsis [Returns 1 if the node is a constant 0 node.]

Description []

SideEffects []

SeeAlso []

Definition at line 843 of file abcObj.c.

844 {
845  assert( Abc_NtkIsLogic(pNode->pNtk) || Abc_NtkIsNetlist(pNode->pNtk) );
846  return Abc_ObjIsNode(pNode) && Abc_ObjFaninNum(pNode) == 0;
847 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
Abc_Ntk_t * pNtk
Definition: abc.h:130
#define assert(ex)
Definition: util_old.h:213
ABC_DLL int Abc_NodeIsConst0 ( Abc_Obj_t pNode)

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

Synopsis [Returns 1 if the node is a constant 0 node.]

Description []

SideEffects []

SeeAlso []

Definition at line 860 of file abcObj.c.

861 {
862  Abc_Ntk_t * pNtk = pNode->pNtk;
863  assert( Abc_NtkIsLogic(pNtk) || Abc_NtkIsNetlist(pNtk) );
864  assert( Abc_ObjIsNode(pNode) );
865  if ( !Abc_NodeIsConst(pNode) )
866  return 0;
867  if ( Abc_NtkHasSop(pNtk) )
868  return Abc_SopIsConst0((char *)pNode->pData);
869  if ( Abc_NtkHasBdd(pNtk) )
870  return Cudd_IsComplement(pNode->pData);
871  if ( Abc_NtkHasAig(pNtk) )
872  return Hop_IsComplement((Hop_Obj_t *)pNode->pData)? 1:0;
873  if ( Abc_NtkHasMapping(pNtk) )
875  assert( 0 );
876  return 0;
877 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
ABC_DLL void * Abc_FrameReadLibGen()
Definition: mainFrame.c:56
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
Definition: hop.h:65
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
#define Cudd_IsComplement(node)
Definition: cudd.h:425
int Abc_NodeIsConst(Abc_Obj_t *pNode)
Definition: abcObj.c:843
static int Hop_IsComplement(Hop_Obj_t *p)
Definition: hop.h:129
STRUCTURE DEFINITIONS ///.
Definition: mioInt.h:61
ABC_DLL int Abc_SopIsConst0(char *pSop)
Definition: abcSop.c:676
Abc_Ntk_t * pNtk
Definition: abc.h:130
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
void * pData
Definition: abc.h:145
Mio_Gate_t * Mio_LibraryReadConst0(Mio_Library_t *pLib)
Definition: mioApi.c:49
ABC_DLL int Abc_NodeIsConst1 ( Abc_Obj_t pNode)

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

Synopsis [Returns 1 if the node is a constant 1 node.]

Description []

SideEffects []

SeeAlso []

Definition at line 890 of file abcObj.c.

891 {
892  Abc_Ntk_t * pNtk = pNode->pNtk;
893  assert( Abc_NtkIsLogic(pNtk) || Abc_NtkIsNetlist(pNtk) );
894  assert( Abc_ObjIsNode(pNode) );
895  if ( !Abc_NodeIsConst(pNode) )
896  return 0;
897  if ( Abc_NtkHasSop(pNtk) )
898  return Abc_SopIsConst1((char *)pNode->pData);
899  if ( Abc_NtkHasBdd(pNtk) )
900  return !Cudd_IsComplement(pNode->pData);
901  if ( Abc_NtkHasAig(pNtk) )
902  return !Hop_IsComplement((Hop_Obj_t *)pNode->pData);
903  if ( Abc_NtkHasMapping(pNtk) )
905  assert( 0 );
906  return 0;
907 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
ABC_DLL void * Abc_FrameReadLibGen()
Definition: mainFrame.c:56
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
Definition: hop.h:65
Mio_Gate_t * Mio_LibraryReadConst1(Mio_Library_t *pLib)
Definition: mioApi.c:50
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
#define Cudd_IsComplement(node)
Definition: cudd.h:425
int Abc_NodeIsConst(Abc_Obj_t *pNode)
Definition: abcObj.c:843
static int Hop_IsComplement(Hop_Obj_t *p)
Definition: hop.h:129
STRUCTURE DEFINITIONS ///.
Definition: mioInt.h:61
ABC_DLL int Abc_SopIsConst1(char *pSop)
Definition: abcSop.c:692
Abc_Ntk_t * pNtk
Definition: abc.h:130
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
void * pData
Definition: abc.h:145
ABC_DLL int Abc_NodeIsExorType ( Abc_Obj_t pNode)

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 1259 of file abcUtil.c.

1260 {
1261  Abc_Obj_t * pNode0, * pNode1;
1262  // check that the node is regular
1263  assert( !Abc_ObjIsComplement(pNode) );
1264  // if the node is not AND, this is not EXOR
1265  if ( !Abc_AigNodeIsAnd(pNode) )
1266  return 0;
1267  // if the children are not complemented, this is not EXOR
1268  if ( !Abc_ObjFaninC0(pNode) || !Abc_ObjFaninC1(pNode) )
1269  return 0;
1270  // get children
1271  pNode0 = Abc_ObjFanin0(pNode);
1272  pNode1 = Abc_ObjFanin1(pNode);
1273  // if the children are not ANDs, this is not EXOR
1274  if ( Abc_ObjFaninNum(pNode0) != 2 || Abc_ObjFaninNum(pNode1) != 2 )
1275  return 0;
1276  // this is AIG, which means the fanins should be ordered
1277  assert( Abc_ObjFaninId0(pNode0) != Abc_ObjFaninId1(pNode1) ||
1278  Abc_ObjFaninId0(pNode1) != Abc_ObjFaninId1(pNode0) );
1279  // if grand children are not the same, this is not EXOR
1280  if ( Abc_ObjFaninId0(pNode0) != Abc_ObjFaninId0(pNode1) ||
1281  Abc_ObjFaninId1(pNode0) != Abc_ObjFaninId1(pNode1) )
1282  return 0;
1283  // finally, if the complemented edges are matched, this is not EXOR
1284  if ( Abc_ObjFaninC0(pNode0) == Abc_ObjFaninC0(pNode1) ||
1285  Abc_ObjFaninC1(pNode0) == Abc_ObjFaninC1(pNode1) )
1286  return 0;
1287  return 1;
1288 }
static Abc_Obj_t * Abc_ObjFanin1(Abc_Obj_t *pObj)
Definition: abc.h:374
static int Abc_ObjFaninC1(Abc_Obj_t *pObj)
Definition: abc.h:378
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_ObjFaninId0(Abc_Obj_t *pObj)
Definition: abc.h:367
static int Abc_AigNodeIsAnd(Abc_Obj_t *pNode)
Definition: abc.h:397
#define assert(ex)
Definition: util_old.h:213
static int Abc_ObjFaninId1(Abc_Obj_t *pObj)
Definition: abc.h:368
static int Abc_ObjIsComplement(Abc_Obj_t *p)
Definition: abc.h:322
ABC_DLL int Abc_NodeIsInv ( Abc_Obj_t pNode)

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

Synopsis [Returns 1 if the node is an inverter.]

Description []

SideEffects []

SeeAlso []

Definition at line 950 of file abcObj.c.

951 {
952  Abc_Ntk_t * pNtk = pNode->pNtk;
953  assert( Abc_NtkIsLogic(pNtk) || Abc_NtkIsNetlist(pNtk) );
954  assert( Abc_ObjIsNode(pNode) );
955  if ( Abc_ObjFaninNum(pNode) != 1 )
956  return 0;
957  if ( Abc_NtkHasSop(pNtk) )
958  return Abc_SopIsInv((char *)pNode->pData);
959  if ( Abc_NtkHasBdd(pNtk) )
960  return Cudd_IsComplement(pNode->pData);
961  if ( Abc_NtkHasAig(pNtk) )
962  return Hop_IsComplement((Hop_Obj_t *)pNode->pData)? 1:0;
963  if ( Abc_NtkHasMapping(pNtk) )
965  assert( 0 );
966  return 0;
967 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
ABC_DLL void * Abc_FrameReadLibGen()
Definition: mainFrame.c:56
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
ABC_DLL int Abc_SopIsInv(char *pSop)
Definition: abcSop.c:728
Definition: hop.h:65
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
#define Cudd_IsComplement(node)
Definition: cudd.h:425
static int Hop_IsComplement(Hop_Obj_t *p)
Definition: hop.h:129
STRUCTURE DEFINITIONS ///.
Definition: mioInt.h:61
Abc_Ntk_t * pNtk
Definition: abc.h:130
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
void * pData
Definition: abc.h:145
Mio_Gate_t * Mio_LibraryReadInv(Mio_Library_t *pLib)
Definition: mioApi.c:48
ABC_DLL int Abc_NodeIsMuxControlType ( Abc_Obj_t pNode)

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

Synopsis [Returns 1 if the node is the control type of the MUX.]

Description []

SideEffects []

SeeAlso []

Definition at line 1357 of file abcUtil.c.

1358 {
1359  Abc_Obj_t * pNode0, * pNode1;
1360  // check that the node is regular
1361  assert( !Abc_ObjIsComplement(pNode) );
1362  // skip the node that do not have two fanouts
1363  if ( Abc_ObjFanoutNum(pNode) != 2 )
1364  return 0;
1365  // get the fanouts
1366  pNode0 = Abc_ObjFanout( pNode, 0 );
1367  pNode1 = Abc_ObjFanout( pNode, 1 );
1368  // if they have more than one fanout, we are not interested
1369  if ( Abc_ObjFanoutNum(pNode0) != 1 || Abc_ObjFanoutNum(pNode1) != 1 )
1370  return 0;
1371  // if the fanouts have the same fanout, this is MUX or EXOR (or a redundant gate (CA)(CB))
1372  return Abc_ObjFanout0(pNode0) == Abc_ObjFanout0(pNode1);
1373 }
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
#define assert(ex)
Definition: util_old.h:213
static Abc_Obj_t * Abc_ObjFanout(Abc_Obj_t *pObj, int i)
Definition: abc.h:370
static int Abc_ObjIsComplement(Abc_Obj_t *p)
Definition: abc.h:322
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371
ABC_DLL int Abc_NodeIsMuxType ( Abc_Obj_t pNode)

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 1301 of file abcUtil.c.

1302 {
1303  Abc_Obj_t * pNode0, * pNode1;
1304  // check that the node is regular
1305  assert( !Abc_ObjIsComplement(pNode) );
1306  // if the node is not AND, this is not MUX
1307  if ( !Abc_AigNodeIsAnd(pNode) )
1308  return 0;
1309  // if the children are not complemented, this is not MUX
1310  if ( !Abc_ObjFaninC0(pNode) || !Abc_ObjFaninC1(pNode) )
1311  return 0;
1312  // get children
1313  pNode0 = Abc_ObjFanin0(pNode);
1314  pNode1 = Abc_ObjFanin1(pNode);
1315  // if the children are not ANDs, this is not MUX
1316  if ( !Abc_AigNodeIsAnd(pNode0) || !Abc_AigNodeIsAnd(pNode1) )
1317  return 0;
1318  // otherwise the node is MUX iff it has a pair of equal grandchildren with opposite polarity
1319  return (Abc_ObjFaninId0(pNode0) == Abc_ObjFaninId0(pNode1) && (Abc_ObjFaninC0(pNode0) ^ Abc_ObjFaninC0(pNode1))) ||
1320  (Abc_ObjFaninId0(pNode0) == Abc_ObjFaninId1(pNode1) && (Abc_ObjFaninC0(pNode0) ^ Abc_ObjFaninC1(pNode1))) ||
1321  (Abc_ObjFaninId1(pNode0) == Abc_ObjFaninId0(pNode1) && (Abc_ObjFaninC1(pNode0) ^ Abc_ObjFaninC0(pNode1))) ||
1322  (Abc_ObjFaninId1(pNode0) == Abc_ObjFaninId1(pNode1) && (Abc_ObjFaninC1(pNode0) ^ Abc_ObjFaninC1(pNode1)));
1323 }
static Abc_Obj_t * Abc_ObjFanin1(Abc_Obj_t *pObj)
Definition: abc.h:374
static int Abc_ObjFaninC1(Abc_Obj_t *pObj)
Definition: abc.h:378
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_ObjFaninId0(Abc_Obj_t *pObj)
Definition: abc.h:367
static int Abc_AigNodeIsAnd(Abc_Obj_t *pNode)
Definition: abc.h:397
#define assert(ex)
Definition: util_old.h:213
static int Abc_ObjFaninId1(Abc_Obj_t *pObj)
Definition: abc.h:368
static int Abc_ObjIsComplement(Abc_Obj_t *p)
Definition: abc.h:322
static int Abc_NodeIsPersistant ( Abc_Obj_t pNode)
inlinestatic

Definition at line 401 of file abc.h.

401 { assert( Abc_AigNodeIsAnd(pNode) ); return pNode->fPersist; }
static int Abc_AigNodeIsAnd(Abc_Obj_t *pNode)
Definition: abc.h:397
#define assert(ex)
Definition: util_old.h:213
unsigned fPersist
Definition: abc.h:139
static int Abc_NodeIsTravIdCurrent ( Abc_Obj_t p)
inlinestatic

Definition at line 411 of file abc.h.

411 { return (Abc_NodeTravId(p) == Abc_ObjNtk(p)->nTravIds); }
static Abc_Ntk_t * Abc_ObjNtk(Abc_Obj_t *pObj)
Definition: abc.h:334
static int Abc_NodeTravId(Abc_Obj_t *p)
Definition: abc.h:407
static int Abc_NodeIsTravIdCurrentId ( Abc_Ntk_t p,
int  i 
)
inlinestatic

Definition at line 414 of file abc.h.

414 { return (Vec_IntGetEntry(&p->vTravIds, i) == p->nTravIds); }
static int Vec_IntGetEntry(Vec_Int_t *p, int i)
Definition: bblif.c:401
Vec_Int_t vTravIds
Definition: abc.h:188
int nTravIds
Definition: abc.h:187
static int Abc_NodeIsTravIdPrevious ( Abc_Obj_t p)
inlinestatic

Definition at line 412 of file abc.h.

412 { return (Abc_NodeTravId(p) == Abc_ObjNtk(p)->nTravIds-1); }
static Abc_Ntk_t * Abc_ObjNtk(Abc_Obj_t *pObj)
Definition: abc.h:334
static int Abc_NodeTravId(Abc_Obj_t *p)
Definition: abc.h:407
ABC_DLL void Abc_NodeMffcConeSupp ( Abc_Obj_t pNode,
Vec_Ptr_t vCone,
Vec_Ptr_t vSupp 
)

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

Synopsis [Collects the support of the derefed MFFC.]

Description []

SideEffects []

SeeAlso []

Definition at line 299 of file abcRefs.c.

300 {
301  assert( Abc_ObjIsNode(pNode) );
302  assert( !Abc_ObjIsComplement(pNode) );
303  if ( vCone ) Vec_PtrClear( vCone );
304  if ( vSupp ) Vec_PtrClear( vSupp );
305  Abc_NtkIncrementTravId( pNode->pNtk );
306  Abc_NodeMffcConeSupp_rec( pNode, vCone, vSupp, 1 );
307 // printf( "\n" );
308 }
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
Abc_Ntk_t * pNtk
Definition: abc.h:130
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
static int Abc_ObjIsComplement(Abc_Obj_t *p)
Definition: abc.h:322
void Abc_NodeMffcConeSupp_rec(Abc_Obj_t *pNode, Vec_Ptr_t *vCone, Vec_Ptr_t *vSupp, int fTopmost)
Definition: abcRefs.c:266
ABC_DLL int Abc_NodeMffcLabel ( Abc_Obj_t pNode)

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

Synopsis [Collects the internal nodes of the MFFC limited by cut.]

Description []

SideEffects [Increments the trav ID and marks visited nodes.]

SeeAlso []

Definition at line 437 of file abcRefs.c.

438 {
439  int Count1, Count2;
440  // dereference the node
441  Count1 = Abc_NodeDeref_rec( pNode );
442  // collect the nodes inside the MFFC
443  Abc_NtkIncrementTravId( pNode->pNtk );
444  Abc_NodeMffcLabel_rec( pNode, 1 );
445  // reference it back
446  Count2 = Abc_NodeRef_rec( pNode );
447  assert( Count1 == Count2 );
448  return Count1;
449 }
int Abc_NodeDeref_rec(Abc_Obj_t *pNode)
Definition: abcRefs.c:215
int Abc_NodeRef_rec(Abc_Obj_t *pNode)
Definition: abcRefs.c:241
void Abc_NodeMffcLabel_rec(Abc_Obj_t *pNode, int fTopmost)
Definition: abcRefs.c:408
Abc_Ntk_t * pNtk
Definition: abc.h:130
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
#define assert(ex)
Definition: util_old.h:213
ABC_DLL int Abc_NodeMffcLabelAig ( Abc_Obj_t pNode)

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

Synopsis [Labels MFFC with the current traversal ID.]

Description []

SideEffects []

SeeAlso []

Definition at line 100 of file abcRefs.c.

101 {
102  int nConeSize1, nConeSize2;
103  assert( Abc_NtkIsStrash(pNode->pNtk) );
104  assert( !Abc_ObjIsComplement( pNode ) );
105  assert( Abc_ObjIsNode( pNode ) );
106  if ( Abc_ObjFaninNum(pNode) == 0 )
107  return 0;
108  nConeSize1 = Abc_NodeRefDeref( pNode, 0, 1 ); // dereference
109  nConeSize2 = Abc_NodeRefDeref( pNode, 1, 0 ); // reference
110  assert( nConeSize1 == nConeSize2 );
111  assert( nConeSize1 > 0 );
112  return nConeSize1;
113 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
static ABC_NAMESPACE_IMPL_START int Abc_NodeRefDeref(Abc_Obj_t *pNode, int fReference, int fLabel)
DECLARATIONS ///.
Definition: abcRefs.c:126
Abc_Ntk_t * pNtk
Definition: abc.h:130
#define assert(ex)
Definition: util_old.h:213
static int Abc_ObjIsComplement(Abc_Obj_t *p)
Definition: abc.h:322
ABC_DLL int Abc_NodeMffcSize ( Abc_Obj_t pNode)

FUNCTION DEFINITIONS ///.

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

Synopsis [Returns the MFFC size.]

Description []

SideEffects []

SeeAlso []

Definition at line 48 of file abcRefs.c.

49 {
50  int nConeSize1, nConeSize2;
51 // assert( Abc_NtkIsStrash(pNode->pNtk) );
52 // assert( !Abc_ObjIsComplement( pNode ) );
53  assert( Abc_ObjIsNode( pNode ) );
54  if ( Abc_ObjFaninNum(pNode) == 0 )
55  return 0;
56  nConeSize1 = Abc_NodeRefDeref( pNode, 0, 0 ); // dereference
57  nConeSize2 = Abc_NodeRefDeref( pNode, 1, 0 ); // reference
58  assert( nConeSize1 == nConeSize2 );
59  assert( nConeSize1 > 0 );
60  return nConeSize1;
61 }
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
static ABC_NAMESPACE_IMPL_START int Abc_NodeRefDeref(Abc_Obj_t *pNode, int fReference, int fLabel)
DECLARATIONS ///.
Definition: abcRefs.c:126
#define assert(ex)
Definition: util_old.h:213
ABC_DLL int Abc_NodeMffcSizeStop ( Abc_Obj_t pNode)

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

Synopsis [Returns the MFFC size while stopping at the complemented edges.]

Description []

SideEffects []

SeeAlso []

Definition at line 74 of file abcRefs.c.

75 {
76  int nConeSize1, nConeSize2;
77  assert( Abc_NtkIsStrash(pNode->pNtk) );
78  assert( !Abc_ObjIsComplement( pNode ) );
79  assert( Abc_ObjIsNode( pNode ) );
80  if ( Abc_ObjFaninNum(pNode) == 0 )
81  return 0;
82  nConeSize1 = Abc_NodeRefDerefStop( pNode, 0 ); // dereference
83  nConeSize2 = Abc_NodeRefDerefStop( pNode, 1 ); // reference
84  assert( nConeSize1 == nConeSize2 );
85  assert( nConeSize1 > 0 );
86  return nConeSize1;
87 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Abc_NodeRefDerefStop(Abc_Obj_t *pNode, int fReference)
Definition: abcRefs.c:171
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
Abc_Ntk_t * pNtk
Definition: abc.h:130
#define assert(ex)
Definition: util_old.h:213
static int Abc_ObjIsComplement(Abc_Obj_t *p)
Definition: abc.h:322
ABC_DLL int Abc_NodeMffcSizeSupp ( Abc_Obj_t pNode)
ABC_DLL int Abc_NodeMinimumBase ( Abc_Obj_t pNode)

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

Synopsis [Makes one node minimum base.]

Description [Returns 1 if the node is changed.]

SideEffects []

SeeAlso []

Definition at line 70 of file abcMinBase.c.

71 {
72  Vec_Str_t * vSupport;
73  Vec_Ptr_t * vFanins;
74  DdNode * bTemp;
75  int i, nVars;
76 
77  assert( Abc_NtkIsBddLogic(pNode->pNtk) );
78  assert( Abc_ObjIsNode(pNode) );
79 
80  // compute support
81  vSupport = Vec_StrAlloc( 10 );
82  nVars = Abc_NodeSupport( Cudd_Regular(pNode->pData), vSupport, Abc_ObjFaninNum(pNode) );
83  if ( nVars == Abc_ObjFaninNum(pNode) )
84  {
85  Vec_StrFree( vSupport );
86  return 0;
87  }
88 
89  // remove unused fanins
90  vFanins = Vec_PtrAlloc( Abc_ObjFaninNum(pNode) );
91  Abc_NodeCollectFanins( pNode, vFanins );
92  for ( i = 0; i < vFanins->nSize; i++ )
93  if ( vSupport->pArray[i] == 0 )
94  Abc_ObjDeleteFanin( pNode, (Abc_Obj_t *)vFanins->pArray[i] );
95  assert( nVars == Abc_ObjFaninNum(pNode) );
96 
97  // update the function of the node
98  pNode->pData = Extra_bddRemapUp( (DdManager *)pNode->pNtk->pManFunc, bTemp = (DdNode *)pNode->pData ); Cudd_Ref( (DdNode *)pNode->pData );
99  Cudd_RecursiveDeref( (DdManager *)pNode->pNtk->pManFunc, bTemp );
100  Vec_PtrFree( vFanins );
101  Vec_StrFree( vSupport );
102  return 1;
103 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
Definition: cudd.h:278
#define Cudd_Regular(node)
Definition: cudd.h:397
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static Vec_Str_t * Vec_StrAlloc(int nCap)
Definition: bblif.c:495
void * pManFunc
Definition: abc.h:191
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
static ABC_NAMESPACE_IMPL_START int Abc_NodeSupport(DdNode *bFunc, Vec_Str_t *vSupport, int nVars)
DECLARATIONS ///.
Definition: abcMinBase.c:241
char * pArray
Definition: bblif.c:51
static void Vec_StrFree(Vec_Str_t *p)
Definition: bblif.c:616
DdNode * Extra_bddRemapUp(DdManager *dd, DdNode *bF)
Definition: extraBddMisc.c:145
Abc_Ntk_t * pNtk
Definition: abc.h:130
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static int Abc_NtkIsBddLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:265
ABC_DLL void Abc_NodeCollectFanins(Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
Definition: abcUtil.c:1587
ABC_DLL void Abc_ObjDeleteFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:111
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL void Abc_NodePrintFactor ( FILE *  pFile,
Abc_Obj_t pNode,
int  fUseRealNames 
)

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

Synopsis [Prints the factored form of one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 825 of file abcPrint.c.

826 {
827  Dec_Graph_t * pGraph;
828  Vec_Ptr_t * vNamesIn;
829  if ( Abc_ObjIsCo(pNode) )
830  pNode = Abc_ObjFanin0(pNode);
831  if ( Abc_ObjIsPi(pNode) )
832  {
833  fprintf( pFile, "Skipping the PI node.\n" );
834  return;
835  }
836  if ( Abc_ObjIsLatch(pNode) )
837  {
838  fprintf( pFile, "Skipping the latch.\n" );
839  return;
840  }
841  assert( Abc_ObjIsNode(pNode) );
842  pGraph = Dec_Factor( (char *)pNode->pData );
843  if ( fUseRealNames )
844  {
845  vNamesIn = Abc_NodeGetFaninNames(pNode);
846  Dec_GraphPrint( stdout, pGraph, (char **)vNamesIn->pArray, Abc_ObjName(pNode) );
847  Abc_NodeFreeNames( vNamesIn );
848  }
849  else
850  Dec_GraphPrint( stdout, pGraph, (char **)NULL, Abc_ObjName(pNode) );
851  Dec_GraphFree( pGraph );
852 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_ObjIsLatch(Abc_Obj_t *pObj)
Definition: abc.h:356
static int Abc_ObjIsPi(Abc_Obj_t *pObj)
Definition: abc.h:347
Dec_Graph_t * Dec_Factor(char *pSop)
FUNCTION DECLARATIONS ///.
Definition: decFactor.c:55
ABC_DLL Vec_Ptr_t * Abc_NodeGetFaninNames(Abc_Obj_t *pNode)
Definition: abcNames.c:199
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
Definition: abc.h:352
ABC_DLL void Abc_NodeFreeNames(Vec_Ptr_t *vNames)
Definition: abcNames.c:257
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
void Dec_GraphPrint(FILE *pFile, Dec_Graph_t *pGraph, char *pNamesIn[], char *pNameOut)
FUNCTION DEFINITIONS ///.
Definition: decPrint.c:49
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
static void Dec_GraphFree(Dec_Graph_t *pGraph)
Definition: dec.h:307
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
ABC_DLL void Abc_NodePrintFanio ( FILE *  pFile,
Abc_Obj_t pNode 
)

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

Synopsis [Prints the fanins/fanouts of a node.]

Description []

SideEffects []

SeeAlso []

Definition at line 752 of file abcPrint.c.

753 {
754  Abc_Obj_t * pNode2;
755  int i;
756  if ( Abc_ObjIsPo(pNode) )
757  pNode = Abc_ObjFanin0(pNode);
758 
759  fprintf( pFile, "Node %s", Abc_ObjName(pNode) );
760  fprintf( pFile, "\n" );
761 
762  fprintf( pFile, "Fanins (%d): ", Abc_ObjFaninNum(pNode) );
763  Abc_ObjForEachFanin( pNode, pNode2, i )
764  fprintf( pFile, " %s", Abc_ObjName(pNode2) );
765  fprintf( pFile, "\n" );
766 
767  fprintf( pFile, "Fanouts (%d): ", Abc_ObjFaninNum(pNode) );
768  Abc_ObjForEachFanout( pNode, pNode2, i )
769  fprintf( pFile, " %s", Abc_ObjName(pNode2) );
770  fprintf( pFile, "\n" );
771 }
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition: abc.h:526
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
static int Abc_ObjIsPo(Abc_Obj_t *pObj)
Definition: abc.h:348
ABC_DLL void Abc_NodePrintLevel ( FILE *  pFile,
Abc_Obj_t pNode 
)

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

Synopsis [Prints the factored form of one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 985 of file abcPrint.c.

986 {
987  Abc_Obj_t * pDriver;
988  Vec_Ptr_t * vNodes;
989 
990  pDriver = Abc_ObjIsCo(pNode)? Abc_ObjFanin0(pNode) : pNode;
991  if ( Abc_ObjIsPi(pDriver) )
992  {
993  fprintf( pFile, "Primary input.\n" );
994  return;
995  }
996  if ( Abc_ObjIsLatch(pDriver) )
997  {
998  fprintf( pFile, "Latch.\n" );
999  return;
1000  }
1001  if ( Abc_NodeIsConst(pDriver) )
1002  {
1003  fprintf( pFile, "Constant %d.\n", !Abc_ObjFaninC0(pNode) );
1004  return;
1005  }
1006  // print the level
1007  fprintf( pFile, "Level = %3d. ", pDriver->Level );
1008  // print the size of MFFC
1009  fprintf( pFile, "Mffc = %5d. ", Abc_NodeMffcSize(pDriver) );
1010  // print the size of the shole cone
1011  vNodes = Abc_NtkDfsNodes( pNode->pNtk, &pDriver, 1 );
1012  fprintf( pFile, "Cone = %5d. ", Vec_PtrSize(vNodes) );
1013  Vec_PtrFree( vNodes );
1014  fprintf( pFile, "\n" );
1015 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
ABC_DLL int Abc_NodeIsConst(Abc_Obj_t *pNode)
Definition: abcObj.c:843
static int Abc_ObjIsLatch(Abc_Obj_t *pObj)
Definition: abc.h:356
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
static int Abc_ObjIsPi(Abc_Obj_t *pObj)
Definition: abc.h:347
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
unsigned Level
Definition: abc.h:142
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
Definition: abc.h:352
ABC_DLL int Abc_NodeMffcSize(Abc_Obj_t *pNode)
FUNCTION DEFINITIONS ///.
Definition: abcRefs.c:48
Abc_Ntk_t * pNtk
Definition: abc.h:130
ABC_DLL Vec_Ptr_t * Abc_NtkDfsNodes(Abc_Ntk_t *pNtk, Abc_Obj_t **ppNodes, int nNodes)
Definition: abcDfs.c:120
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL Abc_Time_t* Abc_NodeReadArrival ( Abc_Obj_t pNode)

Definition at line 77 of file abcTiming.c.

78 {
79  assert( pNode->pNtk->pManTime );
80  return Abc_NodeArrival(pNode);
81 }
Abc_Ntk_t * pNtk
Definition: abc.h:130
Abc_ManTime_t * pManTime
Definition: abc.h:192
#define assert(ex)
Definition: util_old.h:213
static Abc_Time_t * Abc_NodeArrival(Abc_Obj_t *pNode)
Definition: abcTiming.c:49
ABC_DLL float Abc_NodeReadArrivalAve ( Abc_Obj_t pNode)

Definition at line 87 of file abcTiming.c.

88 {
89  return 0.5 * Abc_NodeArrival(pNode)->Rise + 0.5 * Abc_NodeArrival(pNode)->Fall;
90 }
float Fall
Definition: abc.h:125
static Abc_Time_t * Abc_NodeArrival(Abc_Obj_t *pNode)
Definition: abcTiming.c:49
float Rise
Definition: abc.h:124
ABC_DLL float Abc_NodeReadArrivalWorst ( Abc_Obj_t pNode)

Definition at line 95 of file abcTiming.c.

96 {
97  return Abc_MaxFloat( Abc_NodeArrival(pNode)->Rise, Abc_NodeArrival(pNode)->Fall );
98 }
static float Abc_MaxFloat(float a, float b)
Definition: abc_global.h:243
static Abc_Time_t * Abc_NodeArrival(Abc_Obj_t *pNode)
Definition: abcTiming.c:49
ABC_DLL void* Abc_NodeReadCuts ( void *  p,
Abc_Obj_t pObj 
)

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

Synopsis [Computes the cuts for the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 511 of file base/abci/abcCut.c.

512 {
513  return Cut_NodeReadCutsNew( (Cut_Man_t *)p, pObj->Id );
514 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Id
Definition: abc.h:132
Cut_Cut_t * Cut_NodeReadCutsNew(Cut_Man_t *p, int Node)
MACRO DEFINITIONS ///.
Definition: cutApi.c:45
ABC_DLL Abc_Time_t* Abc_NodeReadInputDrive ( Abc_Ntk_t pNtk,
int  iPi 
)

Definition at line 125 of file abcTiming.c.

126 {
127  assert( pNtk->pManTime );
128  return pNtk->pManTime->tInDrive ? pNtk->pManTime->tInDrive + iPi : NULL;
129 }
Abc_Time_t * tInDrive
Definition: abcTiming.c:40
Abc_ManTime_t * pManTime
Definition: abc.h:192
#define assert(ex)
Definition: util_old.h:213
ABC_DLL float Abc_NodeReadInputDriveWorst ( Abc_Ntk_t pNtk,
int  iPi 
)

Definition at line 135 of file abcTiming.c.

136 {
137  return Abc_MaxFloat( Abc_NodeReadInputDrive(pNtk, iPi)->Rise, Abc_NodeReadInputDrive(pNtk, iPi)->Fall );
138 }
static float Abc_MaxFloat(float a, float b)
Definition: abc_global.h:243
Abc_Time_t * Abc_NodeReadInputDrive(Abc_Ntk_t *pNtk, int iPi)
Definition: abcTiming.c:125
ABC_DLL Abc_Time_t* Abc_NodeReadOutputLoad ( Abc_Ntk_t pNtk,
int  iPo 
)

Definition at line 130 of file abcTiming.c.

131 {
132  assert( pNtk->pManTime );
133  return pNtk->pManTime->tOutLoad ? pNtk->pManTime->tOutLoad + iPo : NULL;
134 }
Abc_Time_t * tOutLoad
Definition: abcTiming.c:41
Abc_ManTime_t * pManTime
Definition: abc.h:192
#define assert(ex)
Definition: util_old.h:213
ABC_DLL float Abc_NodeReadOutputLoadWorst ( Abc_Ntk_t pNtk,
int  iPo 
)

Definition at line 139 of file abcTiming.c.

140 {
141  return Abc_MaxFloat( Abc_NodeReadOutputLoad(pNtk, iPo)->Rise, Abc_NodeReadOutputLoad(pNtk, iPo)->Fall );
142 }
static float Abc_MaxFloat(float a, float b)
Definition: abc_global.h:243
Abc_Time_t * Abc_NodeReadOutputLoad(Abc_Ntk_t *pNtk, int iPo)
Definition: abcTiming.c:130
ABC_DLL Abc_Time_t* Abc_NodeReadRequired ( Abc_Obj_t pNode)

Definition at line 82 of file abcTiming.c.

83 {
84  assert( pNode->pNtk->pManTime );
85  return Abc_NodeRequired(pNode);
86 }
Abc_Ntk_t * pNtk
Definition: abc.h:130
Abc_ManTime_t * pManTime
Definition: abc.h:192
#define assert(ex)
Definition: util_old.h:213
static Abc_Time_t * Abc_NodeRequired(Abc_Obj_t *pNode)
Definition: abcTiming.c:50
ABC_DLL float Abc_NodeReadRequiredAve ( Abc_Obj_t pNode)

Definition at line 91 of file abcTiming.c.

92 {
93  return 0.5 * Abc_NodeReadRequired(pNode)->Rise + 0.5 * Abc_NodeReadRequired(pNode)->Fall;
94 }
Abc_Time_t * Abc_NodeReadRequired(Abc_Obj_t *pNode)
Definition: abcTiming.c:82
float Fall
Definition: abc.h:125
float Rise
Definition: abc.h:124
ABC_DLL float Abc_NodeReadRequiredWorst ( Abc_Obj_t pNode)

Definition at line 99 of file abcTiming.c.

100 {
101  return Abc_MaxFloat( Abc_NodeReadRequired(pNode)->Rise, Abc_NodeReadRequired(pNode)->Fall );
102 }
Abc_Time_t * Abc_NodeReadRequired(Abc_Obj_t *pNode)
Definition: abcTiming.c:82
static float Abc_MaxFloat(float a, float b)
Definition: abc_global.h:243
ABC_DLL Abc_Obj_t* Abc_NodeRecognizeMux ( Abc_Obj_t pNode,
Abc_Obj_t **  ppNodeT,
Abc_Obj_t **  ppNodeE 
)

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

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

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

SideEffects []

SeeAlso []

Definition at line 1389 of file abcUtil.c.

1390 {
1391  Abc_Obj_t * pNode0, * pNode1;
1392  assert( !Abc_ObjIsComplement(pNode) );
1393  assert( Abc_NodeIsMuxType(pNode) );
1394  // get children
1395  pNode0 = Abc_ObjFanin0(pNode);
1396  pNode1 = Abc_ObjFanin1(pNode);
1397  // find the control variable
1398 // if ( pNode1->p1 == Fraig_Not(pNode2->p1) )
1399  if ( Abc_ObjFaninId0(pNode0) == Abc_ObjFaninId0(pNode1) && (Abc_ObjFaninC0(pNode0) ^ Abc_ObjFaninC0(pNode1)) )
1400  {
1401 // if ( Fraig_IsComplement(pNode1->p1) )
1402  if ( Abc_ObjFaninC0(pNode0) )
1403  { // pNode2->p1 is positive phase of C
1404  *ppNodeT = Abc_ObjNot(Abc_ObjChild1(pNode1));//pNode2->p2);
1405  *ppNodeE = Abc_ObjNot(Abc_ObjChild1(pNode0));//pNode1->p2);
1406  return Abc_ObjChild0(pNode1);//pNode2->p1;
1407  }
1408  else
1409  { // pNode1->p1 is positive phase of C
1410  *ppNodeT = Abc_ObjNot(Abc_ObjChild1(pNode0));//pNode1->p2);
1411  *ppNodeE = Abc_ObjNot(Abc_ObjChild1(pNode1));//pNode2->p2);
1412  return Abc_ObjChild0(pNode0);//pNode1->p1;
1413  }
1414  }
1415 // else if ( pNode1->p1 == Fraig_Not(pNode2->p2) )
1416  else if ( Abc_ObjFaninId0(pNode0) == Abc_ObjFaninId1(pNode1) && (Abc_ObjFaninC0(pNode0) ^ Abc_ObjFaninC1(pNode1)) )
1417  {
1418 // if ( Fraig_IsComplement(pNode1->p1) )
1419  if ( Abc_ObjFaninC0(pNode0) )
1420  { // pNode2->p2 is positive phase of C
1421  *ppNodeT = Abc_ObjNot(Abc_ObjChild0(pNode1));//pNode2->p1);
1422  *ppNodeE = Abc_ObjNot(Abc_ObjChild1(pNode0));//pNode1->p2);
1423  return Abc_ObjChild1(pNode1);//pNode2->p2;
1424  }
1425  else
1426  { // pNode1->p1 is positive phase of C
1427  *ppNodeT = Abc_ObjNot(Abc_ObjChild1(pNode0));//pNode1->p2);
1428  *ppNodeE = Abc_ObjNot(Abc_ObjChild0(pNode1));//pNode2->p1);
1429  return Abc_ObjChild0(pNode0);//pNode1->p1;
1430  }
1431  }
1432 // else if ( pNode1->p2 == Fraig_Not(pNode2->p1) )
1433  else if ( Abc_ObjFaninId1(pNode0) == Abc_ObjFaninId0(pNode1) && (Abc_ObjFaninC1(pNode0) ^ Abc_ObjFaninC0(pNode1)) )
1434  {
1435 // if ( Fraig_IsComplement(pNode1->p2) )
1436  if ( Abc_ObjFaninC1(pNode0) )
1437  { // pNode2->p1 is positive phase of C
1438  *ppNodeT = Abc_ObjNot(Abc_ObjChild1(pNode1));//pNode2->p2);
1439  *ppNodeE = Abc_ObjNot(Abc_ObjChild0(pNode0));//pNode1->p1);
1440  return Abc_ObjChild0(pNode1);//pNode2->p1;
1441  }
1442  else
1443  { // pNode1->p2 is positive phase of C
1444  *ppNodeT = Abc_ObjNot(Abc_ObjChild0(pNode0));//pNode1->p1);
1445  *ppNodeE = Abc_ObjNot(Abc_ObjChild1(pNode1));//pNode2->p2);
1446  return Abc_ObjChild1(pNode0);//pNode1->p2;
1447  }
1448  }
1449 // else if ( pNode1->p2 == Fraig_Not(pNode2->p2) )
1450  else if ( Abc_ObjFaninId1(pNode0) == Abc_ObjFaninId1(pNode1) && (Abc_ObjFaninC1(pNode0) ^ Abc_ObjFaninC1(pNode1)) )
1451  {
1452 // if ( Fraig_IsComplement(pNode1->p2) )
1453  if ( Abc_ObjFaninC1(pNode0) )
1454  { // pNode2->p2 is positive phase of C
1455  *ppNodeT = Abc_ObjNot(Abc_ObjChild0(pNode1));//pNode2->p1);
1456  *ppNodeE = Abc_ObjNot(Abc_ObjChild0(pNode0));//pNode1->p1);
1457  return Abc_ObjChild1(pNode1);//pNode2->p2;
1458  }
1459  else
1460  { // pNode1->p2 is positive phase of C
1461  *ppNodeT = Abc_ObjNot(Abc_ObjChild0(pNode0));//pNode1->p1);
1462  *ppNodeE = Abc_ObjNot(Abc_ObjChild0(pNode1));//pNode2->p1);
1463  return Abc_ObjChild1(pNode0);//pNode1->p2;
1464  }
1465  }
1466  assert( 0 ); // this is not MUX
1467  return NULL;
1468 }
static Abc_Obj_t * Abc_ObjFanin1(Abc_Obj_t *pObj)
Definition: abc.h:374
static int Abc_ObjFaninC1(Abc_Obj_t *pObj)
Definition: abc.h:378
int Abc_NodeIsMuxType(Abc_Obj_t *pNode)
Definition: abcUtil.c:1301
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_ObjFaninId0(Abc_Obj_t *pObj)
Definition: abc.h:367
static Abc_Obj_t * Abc_ObjChild0(Abc_Obj_t *pObj)
Definition: abc.h:383
#define assert(ex)
Definition: util_old.h:213
static Abc_Obj_t * Abc_ObjNot(Abc_Obj_t *p)
Definition: abc.h:324
static int Abc_ObjFaninId1(Abc_Obj_t *pObj)
Definition: abc.h:368
static int Abc_ObjIsComplement(Abc_Obj_t *p)
Definition: abc.h:322
static Abc_Obj_t * Abc_ObjChild1(Abc_Obj_t *pObj)
Definition: abc.h:384
ABC_DLL int Abc_NodeRef_rec ( Abc_Obj_t pNode)

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

Synopsis [References the node's MFFC.]

Description []

SideEffects []

SeeAlso []

Definition at line 241 of file abcRefs.c.

242 {
243  Abc_Obj_t * pFanin;
244  int i, Counter = 1;
245  if ( Abc_ObjIsCi(pNode) )
246  return 0;
247  Abc_ObjForEachFanin( pNode, pFanin, i )
248  {
249  if ( pFanin->vFanouts.nSize++ == 0 )
250  Counter += Abc_NodeRef_rec( pFanin );
251  }
252  return Counter;
253 }
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
Definition: abc.h:351
int Abc_NodeRef_rec(Abc_Obj_t *pNode)
Definition: abcRefs.c:241
static int Counter
Vec_Int_t vFanouts
Definition: abc.h:144
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
ABC_DLL int Abc_NodeRemoveDupFanins ( Abc_Obj_t pNode)

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

Synopsis [Removes duplicated fanins if present.]

Description [Returns the number of fanins removed.]

SideEffects []

SeeAlso []

Definition at line 180 of file abcMinBase.c.

181 {
182  int Counter = 0;
183  while ( Abc_NodeRemoveDupFanins_int(pNode) )
184  Counter++;
185  return Counter;
186 }
int Abc_NodeRemoveDupFanins_int(Abc_Obj_t *pNode)
Definition: abcMinBase.c:138
static int Counter
static void Abc_NodeSetPersistant ( Abc_Obj_t pNode)
inlinestatic

Definition at line 402 of file abc.h.

402 { assert( Abc_AigNodeIsAnd(pNode) ); pNode->fPersist = 1; }
static int Abc_AigNodeIsAnd(Abc_Obj_t *pNode)
Definition: abc.h:397
#define assert(ex)
Definition: util_old.h:213
unsigned fPersist
Definition: abc.h:139
static void Abc_NodeSetTravId ( Abc_Obj_t p,
int  TravId 
)
inlinestatic

Definition at line 408 of file abc.h.

408 { Vec_IntSetEntry(&Abc_ObjNtk(p)->vTravIds, Abc_ObjId(p), TravId ); }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
static void Vec_IntSetEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:418
static Abc_Ntk_t * Abc_ObjNtk(Abc_Obj_t *pObj)
Definition: abc.h:334
static void Abc_NodeSetTravIdCurrent ( Abc_Obj_t p)
inlinestatic

Definition at line 409 of file abc.h.

409 { Abc_NodeSetTravId( p, Abc_ObjNtk(p)->nTravIds ); }
static void Abc_NodeSetTravId(Abc_Obj_t *p, int TravId)
Definition: abc.h:408
static Abc_Ntk_t * Abc_ObjNtk(Abc_Obj_t *pObj)
Definition: abc.h:334
static void Abc_NodeSetTravIdCurrentId ( Abc_Ntk_t p,
int  i 
)
inlinestatic

Definition at line 413 of file abc.h.

413 { Vec_IntSetEntry(&p->vTravIds, i, p->nTravIds ); }
static void Vec_IntSetEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:418
Vec_Int_t vTravIds
Definition: abc.h:188
int nTravIds
Definition: abc.h:187
static void Abc_NodeSetTravIdPrevious ( Abc_Obj_t p)
inlinestatic

Definition at line 410 of file abc.h.

410 { Abc_NodeSetTravId( p, Abc_ObjNtk(p)->nTravIds-1 ); }
static void Abc_NodeSetTravId(Abc_Obj_t *p, int TravId)
Definition: abc.h:408
static Abc_Ntk_t * Abc_ObjNtk(Abc_Obj_t *pObj)
Definition: abc.h:334
ABC_DLL Abc_Obj_t* Abc_NodeStrash ( Abc_Ntk_t pNtkNew,
Abc_Obj_t pNodeOld,
int  fRecord 
)

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

Synopsis [Strashes one logic node.]

Description [Assume the network is in the AIG form]

SideEffects []

SeeAlso []

Definition at line 468 of file abcStrash.c.

469 {
470  Hop_Man_t * pMan;
471  Hop_Obj_t * pRoot;
472  Abc_Obj_t * pFanin;
473  int i;
474  assert( Abc_ObjIsNode(pNodeOld) );
475  assert( Abc_NtkHasAig(pNodeOld->pNtk) && !Abc_NtkIsStrash(pNodeOld->pNtk) );
476  // get the local AIG manager and the local root node
477  pMan = (Hop_Man_t *)pNodeOld->pNtk->pManFunc;
478  pRoot = (Hop_Obj_t *)pNodeOld->pData;
479  // check the constant case
480  if ( Abc_NodeIsConst(pNodeOld) || Hop_Regular(pRoot) == Hop_ManConst1(pMan) )
481  return Abc_ObjNotCond( Abc_AigConst1(pNtkNew), Hop_IsComplement(pRoot) );
482  // perform special case-strashing using the record of AIG subgraphs
483 /*
484  if ( fRecord && Abc_NtkRecIsRunning() && Abc_ObjFaninNum(pNodeOld) > 2 && Abc_ObjFaninNum(pNodeOld) <= Abc_NtkRecVarNum() )
485  {
486  extern Vec_Int_t * Abc_NtkRecMemory();
487  extern int Abc_NtkRecStrashNode( Abc_Ntk_t * pNtkNew, Abc_Obj_t * pObj, unsigned * pTruth, int nVars );
488  int nVars = Abc_NtkRecVarNum();
489  Vec_Int_t * vMemory = Abc_NtkRecMemory();
490  unsigned * pTruth = Hop_ManConvertAigToTruth( pMan, Hop_Regular(pRoot), nVars, vMemory, 0 );
491  assert( Extra_TruthSupportSize(pTruth, nVars) == Abc_ObjFaninNum(pNodeOld) ); // should be swept
492  if ( Hop_IsComplement(pRoot) )
493  Extra_TruthNot( pTruth, pTruth, nVars );
494  if ( Abc_NtkRecStrashNode( pNtkNew, pNodeOld, pTruth, nVars ) )
495  return pNodeOld->pCopy;
496  }
497 */
498  // set elementary variables
499  Abc_ObjForEachFanin( pNodeOld, pFanin, i )
500  Hop_IthVar(pMan, i)->pData = pFanin->pCopy;
501  // strash the AIG of this node
502  Abc_NodeStrash_rec( (Abc_Aig_t *)pNtkNew->pManFunc, Hop_Regular(pRoot) );
504  // return the final node
505  return Abc_ObjNotCond( (Abc_Obj_t *)Hop_Regular(pRoot)->pData, Hop_IsComplement(pRoot) );
506 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
ABC_DLL int Abc_NodeIsConst(Abc_Obj_t *pNode)
Definition: abcObj.c:843
static Hop_Obj_t * Hop_ManConst1(Hop_Man_t *p)
Definition: hop.h:132
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
Definition: hop.h:65
DECLARATIONS ///.
Definition: abcAig.c:52
void Hop_ConeUnmark_rec(Hop_Obj_t *pObj)
Definition: hopDfs.c:257
void * pManFunc
Definition: abc.h:191
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
static int Hop_IsComplement(Hop_Obj_t *p)
Definition: hop.h:129
void Abc_NodeStrash_rec(Abc_Aig_t *pMan, Hop_Obj_t *pObj)
Definition: abcStrash.c:445
Abc_Ntk_t * pNtk
Definition: abc.h:130
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
static Abc_Obj_t * Abc_ObjNotCond(Abc_Obj_t *p, int c)
Definition: abc.h:325
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
void * pData
Definition: abc.h:145
static Hop_Obj_t * Hop_Regular(Hop_Obj_t *p)
Definition: hop.h:126
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
Hop_Obj_t * Hop_IthVar(Hop_Man_t *p, int i)
FUNCTION DEFINITIONS ///.
Definition: hopOper.c:63
static int Abc_NodeTravId ( Abc_Obj_t p)
inlinestatic

Definition at line 407 of file abc.h.

407 { return Vec_IntGetEntry(&Abc_ObjNtk(p)->vTravIds, Abc_ObjId(p)); }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
static int Vec_IntGetEntry(Vec_Int_t *p, int i)
Definition: bblif.c:401
static Abc_Ntk_t * Abc_ObjNtk(Abc_Obj_t *pObj)
Definition: abc.h:334
ABC_DLL void Abc_NtkAddDummyBoxNames ( Abc_Ntk_t pNtk)

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

Synopsis [Adds dummy names.]

Description []

SideEffects []

SeeAlso []

Definition at line 418 of file abcNames.c.

419 {
420  char * pName, PrefLi[100], PrefLo[100];
421  Abc_Obj_t * pObj;
422  int nDigits, i, k, CountCur, CountMax = 0;
423  // if PIs/POs already have nodes with what looks like latch names
424  // we need to add different prefix for the new latches
425  Abc_NtkForEachPi( pNtk, pObj, i )
426  {
427  CountCur = 0;
428  pName = Abc_ObjName(pObj);
429  for ( k = 0; pName[k]; k++ )
430  if ( pName[k] == 'l' )
431  CountCur++;
432  else
433  break;
434  CountMax = Abc_MaxInt( CountMax, CountCur );
435  }
436  Abc_NtkForEachPo( pNtk, pObj, i )
437  {
438  CountCur = 0;
439  pName = Abc_ObjName(pObj);
440  for ( k = 0; pName[k]; k++ )
441  if ( pName[k] == 'l' )
442  CountCur++;
443  else
444  break;
445  CountMax = Abc_MaxInt( CountMax, CountCur );
446  }
447 //printf( "CountMax = %d\n", CountMax );
448  assert( CountMax < 100-2 );
449  for ( i = 0; i <= CountMax; i++ )
450  PrefLi[i] = PrefLo[i] = 'l';
451  PrefLi[i] = 'i';
452  PrefLo[i] = 'o';
453  PrefLi[i+1] = 0;
454  PrefLo[i+1] = 0;
455  // create latch names
456  assert( !Abc_NtkIsNetlist(pNtk) );
457  nDigits = Abc_Base10Log( Abc_NtkLatchNum(pNtk) );
458  Abc_NtkForEachLatch( pNtk, pObj, i )
459  {
460  Abc_ObjAssignName( pObj, Abc_ObjNameDummy("l", i, nDigits), NULL );
461  Abc_ObjAssignName( Abc_ObjFanin0(pObj), Abc_ObjNameDummy(PrefLi, i, nDigits), NULL );
462  Abc_ObjAssignName( Abc_ObjFanout0(pObj), Abc_ObjNameDummy(PrefLo, i, nDigits), NULL );
463  }
464 /*
465  nDigits = Abc_Base10Log( Abc_NtkBlackboxNum(pNtk) );
466  Abc_NtkForEachBlackbox( pNtk, pObj, i )
467  {
468  pName = Abc_ObjAssignName( pObj, Abc_ObjNameDummy("B", i, nDigits), NULL );
469  nDigitsF = Abc_Base10Log( Abc_ObjFaninNum(pObj) );
470  Abc_ObjForEachFanin( pObj, pTerm, k )
471  Abc_ObjAssignName( Abc_ObjFanin0(pObj), pName, Abc_ObjNameDummy("i", k, nDigitsF) );
472  nDigitsF = Abc_Base10Log( Abc_ObjFanoutNum(pObj) );
473  Abc_ObjForEachFanout( pObj, pTerm, k )
474  Abc_ObjAssignName( Abc_ObjFanin0(pObj), pName, Abc_ObjNameDummy("o", k, nDigitsF) );
475  }
476 */
477 }
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition: abcNames.c:68
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_Base10Log(unsigned n)
Definition: abc_global.h:252
ABC_NAMESPACE_IMPL_START char * Abc_ObjName(Abc_Obj_t *pObj)
DECLARATIONS ///.
Definition: abcNames.c:48
#define Abc_NtkForEachLatch(pNtk, pObj, i)
Definition: abc.h:497
char * Abc_ObjNameDummy(char *pPrefix, int Num, int nDigits)
Definition: abcNames.c:121
#define assert(ex)
Definition: util_old.h:213
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
ABC_DLL void Abc_NtkAddDummyPiNames ( Abc_Ntk_t pNtk)

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

Synopsis [Adds dummy names.]

Description []

SideEffects []

SeeAlso []

Definition at line 378 of file abcNames.c.

379 {
380  Abc_Obj_t * pObj;
381  int nDigits, i;
382  nDigits = Abc_Base10Log( Abc_NtkPiNum(pNtk) );
383  Abc_NtkForEachPi( pNtk, pObj, i )
384  Abc_ObjAssignName( pObj, Abc_ObjNameDummy("pi", i, nDigits), NULL );
385 }
char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition: abcNames.c:68
static int Abc_Base10Log(unsigned n)
Definition: abc_global.h:252
char * Abc_ObjNameDummy(char *pPrefix, int Num, int nDigits)
Definition: abcNames.c:121
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:285
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
ABC_DLL void Abc_NtkAddDummyPoNames ( Abc_Ntk_t pNtk)

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

Synopsis [Adds dummy names.]

Description []

SideEffects []

SeeAlso []

Definition at line 398 of file abcNames.c.

399 {
400  Abc_Obj_t * pObj;
401  int nDigits, i;
402  nDigits = Abc_Base10Log( Abc_NtkPoNum(pNtk) );
403  Abc_NtkForEachPo( pNtk, pObj, i )
404  Abc_ObjAssignName( pObj, Abc_ObjNameDummy("po", i, nDigits), NULL );
405 }
char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition: abcNames.c:68
static int Abc_Base10Log(unsigned n)
Definition: abc_global.h:252
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:286
char * Abc_ObjNameDummy(char *pPrefix, int Num, int nDigits)
Definition: abcNames.c:121
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
ABC_DLL Abc_Obj_t* Abc_NtkAddLatch ( Abc_Ntk_t pNtk,
Abc_Obj_t pDriver,
Abc_InitType_t  Init 
)

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

Synopsis [Creates latch with the given initial value.]

Description []

SideEffects []

SeeAlso []

Definition at line 260 of file abcLatch.c.

261 {
262  Abc_Obj_t * pLatchOut, * pLatch, * pLatchIn;
263  pLatchOut = Abc_NtkCreateBo(pNtk);
264  pLatch = Abc_NtkCreateLatch(pNtk);
265  pLatchIn = Abc_NtkCreateBi(pNtk);
266  Abc_ObjAssignName( pLatchOut, Abc_ObjName(pLatch), "_lo" );
267  Abc_ObjAssignName( pLatchIn, Abc_ObjName(pLatch), "_li" );
268  Abc_ObjAddFanin( pLatchOut, pLatch );
269  Abc_ObjAddFanin( pLatch, pLatchIn );
270  if ( pDriver )
271  Abc_ObjAddFanin( pLatchIn, pDriver );
272  pLatch->pData = (void *)Init;
273  return pLatchOut;
274 }
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition: abcNames.c:68
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
static Abc_Obj_t * Abc_NtkCreateBo(Abc_Ntk_t *pNtk)
Definition: abc.h:306
static Abc_Obj_t * Abc_NtkCreateLatch(Abc_Ntk_t *pNtk)
Definition: abc.h:309
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
void * pData
Definition: abc.h:145
static Abc_Obj_t * Abc_NtkCreateBi(Abc_Ntk_t *pNtk)
Definition: abc.h:305
ABC_DLL int Abc_NtkAigToBdd ( Abc_Ntk_t pNtk)

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

Synopsis [Converts the network from AIG to BDD representation.]

Description []

SideEffects []

SeeAlso []

Definition at line 733 of file abcFunc.c.

734 {
735  Abc_Obj_t * pNode;
736  Hop_Man_t * pMan;
737  DdNode * pFunc;
738  DdManager * dd, * ddTemp = NULL;
739  Vec_Int_t * vFanins = NULL;
740  int nFaninsMax, i, k, iVar;
741 
742  assert( Abc_NtkHasAig(pNtk) );
743 
744  // start the functionality manager
745  nFaninsMax = Abc_NtkGetFaninMax( pNtk );
746  if ( nFaninsMax == 0 )
747  printf( "Warning: The network has only constant nodes.\n" );
748 
749  dd = Cudd_Init( nFaninsMax, 0, CUDD_UNIQUE_SLOTS, CUDD_CACHE_SLOTS, 0 );
750 
751  // start temporary manager for reordered local functions
752  ddTemp = Cudd_Init( nFaninsMax, 0, CUDD_UNIQUE_SLOTS, CUDD_CACHE_SLOTS, 0 );
754  vFanins = Vec_IntAlloc( nFaninsMax );
755 
756  // set the mapping of elementary AIG nodes into the elementary BDD nodes
757  pMan = (Hop_Man_t *)pNtk->pManFunc;
758  assert( Hop_ManPiNum(pMan) >= nFaninsMax );
759  for ( i = 0; i < nFaninsMax; i++ )
760  Hop_ManPi(pMan, i)->pData = Cudd_bddIthVar(ddTemp, i);
761 
762  // convert each node from SOP to BDD
763  Abc_NtkForEachNode( pNtk, pNode, i )
764  {
765  if ( Abc_ObjIsBarBuf(pNode) )
766  continue;
767  pFunc = Abc_ConvertAigToBdd( ddTemp, (Hop_Obj_t *)pNode->pData );
768  if ( pFunc == NULL )
769  {
770  printf( "Abc_NtkAigToBdd: Error while converting AIG into BDD.\n" );
771  return 0;
772  }
773  Cudd_Ref( pFunc );
774  // find variable mapping
775  Vec_IntFill( vFanins, Abc_ObjFaninNum(pNode), -1 );
776  for ( k = iVar = 0; k < nFaninsMax; k++ )
777  if ( ddTemp->invperm[k] < Abc_ObjFaninNum(pNode) )
778  Vec_IntWriteEntry( vFanins, ddTemp->invperm[k], iVar++ );
779  assert( iVar == Abc_ObjFaninNum(pNode) );
780  // transfer to the main manager
781  pNode->pData = Extra_TransferPermute( ddTemp, dd, pFunc, Vec_IntArray(vFanins) );
782  Cudd_Ref( (DdNode *)pNode->pData );
783  Cudd_RecursiveDeref( ddTemp, pFunc );
784  // update variable order
785  Vec_IntClear( vFanins );
786  for ( k = 0; k < nFaninsMax; k++ )
787  if ( ddTemp->invperm[k] < Abc_ObjFaninNum(pNode) )
788  Vec_IntPush( vFanins, Vec_IntEntry(&pNode->vFanins, ddTemp->invperm[k]) );
789  for ( k = 0; k < Abc_ObjFaninNum(pNode); k++ )
790  Vec_IntWriteEntry( &pNode->vFanins, k, Vec_IntEntry(vFanins, k) );
791  }
792 
793 // printf( "Reorderings performed = %d.\n", Cudd_ReadReorderings(ddTemp) );
794  Extra_StopManager( ddTemp );
795  Vec_IntFreeP( &vFanins );
796  Hop_ManStop( (Hop_Man_t *)pNtk->pManFunc );
797  pNtk->pManFunc = dd;
798 
799  // update the network type
800  pNtk->ntkFunc = ABC_FUNC_BDD;
801  return 1;
802 }
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
#define CUDD_UNIQUE_SLOTS
Definition: cudd.h:97
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
Definition: cudd.h:278
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
DdNode * Extra_TransferPermute(DdManager *ddSource, DdManager *ddDestination, DdNode *f, int *Permute)
Definition: extraBddMisc.c:87
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Abc_ObjIsBarBuf(Abc_Obj_t *pObj)
Definition: abc.h:360
ABC_DLL int Abc_NtkGetFaninMax(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:453
#define CUDD_CACHE_SLOTS
Definition: cudd.h:98
Vec_Int_t vFanins
Definition: abc.h:143
void Extra_StopManager(DdManager *dd)
Definition: extraBddMisc.c:223
Definition: hop.h:65
void Hop_ManStop(Hop_Man_t *p)
Definition: hopMan.c:84
static Hop_Obj_t * Hop_ManPi(Hop_Man_t *p, int i)
Definition: hop.h:134
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
void * pManFunc
Definition: abc.h:191
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
DdManager * Cudd_Init(unsigned int numVars, unsigned int numVarsZ, unsigned int numSlots, unsigned int cacheSize, unsigned long maxMemory)
Definition: cuddInit.c:125
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
void * pData
Definition: hop.h:68
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
DdNode * Cudd_bddIthVar(DdManager *dd, int i)
Definition: cuddAPI.c:416
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
int * invperm
Definition: cuddInt.h:388
void Cudd_AutodynEnable(DdManager *unique, Cudd_ReorderingType method)
Definition: cuddAPI.c:669
void * pData
Definition: abc.h:145
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
static DdNode * Abc_ConvertAigToBdd(DdManager *dd, Hop_Obj_t *pRoot)
Definition: abcFunc.c:863
static int Hop_ManPiNum(Hop_Man_t *p)
Definition: hop.h:145
ABC_DLL Gia_Man_t* Abc_NtkAigToGia ( Abc_Ntk_t p)

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

Synopsis [Converts the network from AIG to BDD representation.]

Description []

SideEffects []

SeeAlso []

Definition at line 935 of file abcFunc.c.

936 {
937  Gia_Man_t * pNew;
938  Hop_Man_t * pHopMan;
939  Hop_Obj_t * pHopObj;
940  Vec_Int_t * vMapping;
941  Vec_Ptr_t * vNodes;
942  Abc_Obj_t * pNode, * pFanin;
943  int i, k, nObjs;
945  pHopMan = (Hop_Man_t *)p->pManFunc;
946  // create new manager
947  pNew = Gia_ManStart( 10000 );
948  pNew->pName = Abc_UtilStrsav( Abc_NtkName(p) );
949  pNew->pSpec = Abc_UtilStrsav( Abc_NtkSpec(p) );
950  Abc_NtkCleanCopy( p );
951  Hop_ManConst1(pHopMan)->iData = 1;
952  // create primary inputs
953  Abc_NtkForEachCi( p, pNode, i )
954  pNode->iTemp = Gia_ManAppendCi(pNew);
955  // find the number of objects
956  nObjs = 1 + Abc_NtkCiNum(p) + Abc_NtkCoNum(p);
957  Abc_NtkForEachNode( p, pNode, i )
958  nObjs += Abc_ObjIsBarBuf(pNode) ? 1 : Hop_DagSize( (Hop_Obj_t *)pNode->pData );
959  vMapping = Vec_IntStart( nObjs );
960  // iterate through nodes used in the mapping
961  vNodes = Abc_NtkDfs( p, 0 );
962  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pNode, i )
963  {
964  if ( Abc_ObjIsBarBuf(pNode) )
965  {
966  assert( !Abc_ObjFaninC0(pNode) );
967  pNode->iTemp = Gia_ManAppendBuf( pNew, Abc_ObjFanin0(pNode)->iTemp );
968  continue;
969  }
970  Abc_ObjForEachFanin( pNode, pFanin, k )
971  Hop_ManPi(pHopMan, k)->iData = pFanin->iTemp;
972  pHopObj = Hop_Regular( (Hop_Obj_t *)pNode->pData );
973  if ( Hop_DagSize(pHopObj) > 0 )
974  {
975  assert( Abc_ObjFaninNum(pNode) <= Hop_ManPiNum(pHopMan) );
976  Abc_ConvertAigToGia( pNew, pHopObj );
977  if ( !Gia_ObjIsAnd(Gia_ManObj(pNew, Abc_Lit2Var(pHopObj->iData))) )
978  continue;
979  if ( Vec_IntEntry(vMapping, Abc_Lit2Var(pHopObj->iData)) )
980  continue;
981  Vec_IntWriteEntry( vMapping, Abc_Lit2Var(pHopObj->iData), Vec_IntSize(vMapping) );
982  Vec_IntPush( vMapping, Abc_ObjFaninNum(pNode) );
983  Abc_ObjForEachFanin( pNode, pFanin, k )
984  Vec_IntPush( vMapping, Abc_Lit2Var(pFanin->iTemp) );
985  Vec_IntPush( vMapping, Abc_Lit2Var(pHopObj->iData) );
986  }
987  pNode->iTemp = Abc_LitNotCond( pHopObj->iData, Hop_IsComplement( (Hop_Obj_t *)pNode->pData ) );
988  }
989  Vec_PtrFree( vNodes );
990  // create primary outputs
991  Abc_NtkForEachCo( p, pNode, i )
992  Gia_ManAppendCo( pNew, Abc_ObjFanin0(pNode)->iTemp );
993  Gia_ManSetRegNum( pNew, Abc_NtkLatchNum(p) );
994  // finish mapping
995  assert( Gia_ManObjNum(pNew) <= nObjs );
996  assert( pNew->vMapping == NULL );
997  pNew->vMapping = vMapping;
998  return pNew;
999 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Hop_Obj_t * Hop_ManConst1(Hop_Man_t *p)
Definition: hop.h:132
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
int Hop_DagSize(Hop_Obj_t *pObj)
Definition: hopDfs.c:279
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
int iData
Definition: hop.h:69
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Abc_ObjIsBarBuf(Abc_Obj_t *pObj)
Definition: abc.h:360
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
Definition: abcDfs.c:81
static int Abc_NtkIsAigLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:266
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: hop.h:65
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
int Abc_ConvertAigToGia(Gia_Man_t *p, Hop_Obj_t *pRoot)
Definition: abcFunc.c:914
static Hop_Obj_t * Hop_ManPi(Hop_Man_t *p, int i)
Definition: hop.h:134
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
void * pManFunc
Definition: abc.h:191
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
char * pName
Definition: gia.h:97
static int Gia_ManAppendBuf(Gia_Man_t *p, int iLit)
Definition: gia.h:694
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
if(last==0)
Definition: sparse_int.h:34
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
static int Hop_IsComplement(Hop_Obj_t *p)
Definition: hop.h:129
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static char * Abc_NtkName(Abc_Ntk_t *pNtk)
Definition: abc.h:270
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
Definition: gia.h:95
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:507
#define assert(ex)
Definition: util_old.h:213
static char * Abc_NtkSpec(Abc_Ntk_t *pNtk)
Definition: abc.h:271
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static Hop_Obj_t * Hop_Regular(Hop_Obj_t *p)
Definition: hop.h:126
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
static int Hop_ManPiNum(Hop_Man_t *p)
Definition: hop.h:145
ABC_DLL Abc_Ntk_t* Abc_NtkAlloc ( Abc_NtkType_t  Type,
Abc_NtkFunc_t  Func,
int  fUseMemMan 
)

DECLARATIONS ///.

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

FileName [abcNtk.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Network and node package.]

Synopsis [Network creation/duplication/deletion procedures.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Creates a new Ntk.]

Description []

SideEffects []

SeeAlso []

Definition at line 50 of file abcNtk.c.

51 {
52  Abc_Ntk_t * pNtk;
53  pNtk = ABC_ALLOC( Abc_Ntk_t, 1 );
54  memset( pNtk, 0, sizeof(Abc_Ntk_t) );
55  pNtk->ntkType = Type;
56  pNtk->ntkFunc = Func;
57  // start the object storage
58  pNtk->vObjs = Vec_PtrAlloc( 100 );
59  pNtk->vPios = Vec_PtrAlloc( 100 );
60  pNtk->vPis = Vec_PtrAlloc( 100 );
61  pNtk->vPos = Vec_PtrAlloc( 100 );
62  pNtk->vCis = Vec_PtrAlloc( 100 );
63  pNtk->vCos = Vec_PtrAlloc( 100 );
64  pNtk->vBoxes = Vec_PtrAlloc( 100 );
65  pNtk->vLtlProperties = Vec_PtrAlloc( 100 );
66  // start the memory managers
67  pNtk->pMmObj = fUseMemMan? Mem_FixedStart( sizeof(Abc_Obj_t) ) : NULL;
68  pNtk->pMmStep = fUseMemMan? Mem_StepStart( ABC_NUM_STEPS ) : NULL;
69  // get ready to assign the first Obj ID
70  pNtk->nTravIds = 1;
71  // start the functionality manager
72  if ( !Abc_NtkIsStrash(pNtk) )
73  Vec_PtrPush( pNtk->vObjs, NULL );
74  if ( Abc_NtkIsStrash(pNtk) )
75  pNtk->pManFunc = Abc_AigAlloc( pNtk );
76  else if ( Abc_NtkHasSop(pNtk) || Abc_NtkHasBlifMv(pNtk) )
77  pNtk->pManFunc = Mem_FlexStart();
78  else if ( Abc_NtkHasBdd(pNtk) )
80  else if ( Abc_NtkHasAig(pNtk) )
81  pNtk->pManFunc = Hop_ManStart();
82  else if ( Abc_NtkHasMapping(pNtk) )
83  pNtk->pManFunc = Abc_FrameReadLibGen();
84  else if ( !Abc_NtkHasBlackbox(pNtk) )
85  assert( 0 );
86  // name manager
87  pNtk->pManName = Nm_ManCreate( 200 );
88  // attribute manager
90  // estimated AndGateDelay
91  pNtk->AndGateDelay = 0.0;
92  return pNtk;
93 }
char * memset()
static Vec_Ptr_t * Vec_PtrStart(int nSize)
Definition: vecPtr.h:106
Vec_Ptr_t * vAttrs
Definition: abc.h:214
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
Vec_Ptr_t * vLtlProperties
Definition: abc.h:169
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
#define CUDD_UNIQUE_SLOTS
Definition: cudd.h:97
ABC_DLL void * Abc_FrameReadLibGen()
Definition: mainFrame.c:56
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
Nm_Man_t * pManName
Definition: abc.h:160
Vec_Ptr_t * vBoxes
Definition: abc.h:168
float AndGateDelay
Definition: abc.h:194
Vec_Ptr_t * vPios
Definition: abc.h:167
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
#define CUDD_CACHE_SLOTS
Definition: cudd.h:98
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
Vec_Ptr_t * vObjs
Definition: abc.h:162
Vec_Ptr_t * vPis
Definition: abc.h:163
static int Abc_NtkHasBlifMv(Abc_Ntk_t *pNtk)
Definition: abc.h:257
Vec_Ptr_t * vCis
Definition: abc.h:165
Mem_Fixed_t * Mem_FixedStart(int nEntrySize)
FUNCTION DEFINITIONS ///.
Definition: mem.c:100
void * pManFunc
Definition: abc.h:191
Mem_Flex_t * Mem_FlexStart()
Definition: mem.c:311
Mem_Fixed_t * pMmObj
Definition: abc.h:189
Vec_Ptr_t * vPos
Definition: abc.h:164
Vec_Ptr_t * vCos
Definition: abc.h:166
static int Abc_NtkHasBlackbox(Abc_Ntk_t *pNtk)
Definition: abc.h:258
ABC_DLL Abc_Aig_t * Abc_AigAlloc(Abc_Ntk_t *pNtk)
FUNCTION DECLARATIONS ///.
Definition: abcAig.c:128
DdManager * Cudd_Init(unsigned int numVars, unsigned int numVarsZ, unsigned int numSlots, unsigned int cacheSize, unsigned long maxMemory)
Definition: cuddInit.c:125
Hop_Man_t * Hop_ManStart()
DECLARATIONS ///.
Definition: hopMan.c:45
Mem_Step_t * Mem_StepStart(int nSteps)
Definition: mem.c:474
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
Nm_Man_t * Nm_ManCreate(int nSize)
MACRO DEFINITIONS ///.
Definition: nmApi.c:45
Mem_Step_t * pMmStep
Definition: abc.h:190
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
int nTravIds
Definition: abc.h:187
Abc_NtkType_t ntkType
Definition: abc.h:156
#define ABC_NUM_STEPS
INCLUDES ///.
Definition: abcInt.h:36
ABC_DLL int Abc_NtkAppend ( Abc_Ntk_t pNtk1,
Abc_Ntk_t pNtk2,
int  fAddPos 
)

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

Synopsis [Appends the second network to the first.]

Description [Modifies the first network by adding the logic of the second. Performs structural hashing while appending the networks. Does not change the second network. Returns 0 if the appending failed, 1 otherise.]

SideEffects []

SeeAlso []

Definition at line 320 of file abcStrash.c.

321 {
322  Abc_Obj_t * pObj;
323  char * pName;
324  int i, nNewCis;
325  // the first network should be an AIG
326  assert( Abc_NtkIsStrash(pNtk1) );
327  assert( Abc_NtkIsLogic(pNtk2) || Abc_NtkIsStrash(pNtk2) );
328  if ( Abc_NtkIsLogic(pNtk2) && !Abc_NtkToAig(pNtk2) )
329  {
330  printf( "Converting to AIGs has failed.\n" );
331  return 0;
332  }
333  // check that the networks have the same PIs
334  // reorder PIs of pNtk2 according to pNtk1
335  if ( !Abc_NtkCompareSignals( pNtk1, pNtk2, 1, 1 ) )
336  printf( "Abc_NtkAppend(): The union of the network PIs is computed (warning).\n" );
337  // perform strashing
338  nNewCis = 0;
339  Abc_NtkCleanCopy( pNtk2 );
340  if ( Abc_NtkIsStrash(pNtk2) )
341  Abc_AigConst1(pNtk2)->pCopy = Abc_AigConst1(pNtk1);
342  Abc_NtkForEachCi( pNtk2, pObj, i )
343  {
344  pName = Abc_ObjName(pObj);
345  pObj->pCopy = Abc_NtkFindCi(pNtk1, Abc_ObjName(pObj));
346  if ( pObj->pCopy == NULL )
347  {
348  pObj->pCopy = Abc_NtkDupObj(pNtk1, pObj, 1);
349  nNewCis++;
350  }
351  }
352  if ( nNewCis )
353  printf( "Warning: Procedure Abc_NtkAppend() added %d new CIs.\n", nNewCis );
354  // add pNtk2 to pNtk1 while strashing
355  if ( Abc_NtkIsLogic(pNtk2) )
356  Abc_NtkStrashPerform( pNtk2, pNtk1, 1, 0 );
357  else
358  Abc_NtkForEachNode( pNtk2, pObj, i )
359  pObj->pCopy = Abc_AigAnd( (Abc_Aig_t *)pNtk1->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild1Copy(pObj) );
360  // add the COs of the second network
361  if ( fAddPos )
362  {
363  Abc_NtkForEachPo( pNtk2, pObj, i )
364  {
365  Abc_NtkDupObj( pNtk1, pObj, 0 );
366  Abc_ObjAddFanin( pObj->pCopy, Abc_ObjChild0Copy(pObj) );
367  Abc_ObjAssignName( pObj->pCopy, Abc_ObjName(pObj), NULL );
368  }
369  }
370  else
371  {
372  Abc_Obj_t * pObjOld, * pDriverOld, * pDriverNew;
373  int fCompl, iNodeId;
374  // OR the choices
375  Abc_NtkForEachCo( pNtk2, pObj, i )
376  {
378 // if ( iNodeId < 0 )
379 // continue;
380  assert( iNodeId >= 0 );
381  pObjOld = Abc_NtkObj( pNtk1, iNodeId );
382  // derive the new driver
383  pDriverOld = Abc_ObjChild0( pObjOld );
384  pDriverNew = Abc_ObjChild0Copy( pObj );
385  pDriverNew = Abc_AigOr( (Abc_Aig_t *)pNtk1->pManFunc, pDriverOld, pDriverNew );
386  if ( Abc_ObjRegular(pDriverOld) == Abc_ObjRegular(pDriverNew) )
387  continue;
388  // replace the old driver by the new driver
389  fCompl = Abc_ObjRegular(pDriverOld)->fPhase ^ Abc_ObjRegular(pDriverNew)->fPhase;
390  Abc_ObjPatchFanin( pObjOld, Abc_ObjRegular(pDriverOld), Abc_ObjNotCond(Abc_ObjRegular(pDriverNew), fCompl) );
391  }
392  }
393  // make sure that everything is okay
394  if ( !Abc_NtkCheck( pNtk1 ) )
395  {
396  printf( "Abc_NtkAppend: The network check has failed.\n" );
397  return 0;
398  }
399  return 1;
400 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
Definition: abc.h:91
ABC_DLL Abc_Obj_t * Abc_AigOr(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:719
static ABC_NAMESPACE_IMPL_START void Abc_NtkStrashPerform(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkNew, int fAllNodes, int fRecord)
DECLARATIONS ///.
Definition: abcStrash.c:413
Nm_Man_t * pManName
Definition: abc.h:160
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
static Abc_Obj_t * Abc_ObjChild1Copy(Abc_Obj_t *pObj)
Definition: abc.h:387
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition: abcObj.c:337
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
ABC_DLL int Abc_NtkCompareSignals(Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int fOnlyPis, int fComb)
Definition: abcCheck.c:741
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition: abcNames.c:68
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
DECLARATIONS ///.
Definition: abcAig.c:52
ABC_DLL Abc_Obj_t * Abc_NtkFindCi(Abc_Ntk_t *pNtk, char *pName)
Definition: abcObj.c:530
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
static Abc_Obj_t * Abc_ObjChild0(Abc_Obj_t *pObj)
Definition: abc.h:383
ABC_DLL void Abc_ObjPatchFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFaninOld, Abc_Obj_t *pFaninNew)
Definition: abcFanio.c:172
void * pManFunc
Definition: abc.h:191
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:700
static Abc_Obj_t * Abc_ObjChild0Copy(Abc_Obj_t *pObj)
Definition: abc.h:386
Abc_Obj_t * pCopy
Definition: abc.h:148
int Nm_ManFindIdByNameTwoTypes(Nm_Man_t *p, char *pName, int Type1, int Type2)
Definition: nmApi.c:239
if(last==0)
Definition: sparse_int.h:34
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
static Abc_Obj_t * Abc_ObjRegular(Abc_Obj_t *p)
Definition: abc.h:323
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
Definition: abc.h:90
ABC_DLL int Abc_NtkToAig(Abc_Ntk_t *pNtk)
Definition: abcFunc.c:1192
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:507
static Abc_Obj_t * Abc_ObjNotCond(Abc_Obj_t *p, int c)
Definition: abc.h:325
#define assert(ex)
Definition: util_old.h:213
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
unsigned fPhase
Definition: abc.h:137
ABC_DLL void Abc_NtkAppendToCone ( Abc_Ntk_t pNtkNew,
Abc_Ntk_t pNtk,
Vec_Ptr_t vRoots 
)

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

Synopsis [Adds new nodes to the cone.]

Description []

SideEffects []

SeeAlso []

Definition at line 969 of file abcNtk.c.

970 {
971  Vec_Ptr_t * vNodes;
972  Abc_Obj_t * pObj;
973  int i, iNodeId;
974 
975  assert( Abc_NtkIsStrash(pNtkNew) );
976  assert( Abc_NtkIsStrash(pNtk) );
977 
978  // collect the nodes in the TFI of the output (mark the TFI)
979  vNodes = Abc_NtkDfsNodes( pNtk, (Abc_Obj_t **)Vec_PtrArray(vRoots), Vec_PtrSize(vRoots) );
980 
981  // establish connection between the constant nodes
982  Abc_AigConst1(pNtk)->pCopy = Abc_AigConst1(pNtkNew);
983 
984  // create the PIs
985  Abc_NtkForEachCi( pNtk, pObj, i )
986  {
987  // skip CIs that are not used
988  if ( !Abc_NodeIsTravIdCurrent(pObj) )
989  continue;
990  // find the corresponding CI in the new network
992  if ( iNodeId == -1 )
993  {
994  pObj->pCopy = Abc_NtkCreatePi(pNtkNew);
995  Abc_ObjAssignName( pObj->pCopy, Abc_ObjName(pObj), NULL );
996  }
997  else
998  pObj->pCopy = Abc_NtkObj( pNtkNew, iNodeId );
999  }
1000 
1001  // copy the nodes
1002  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
1003  pObj->pCopy = Abc_AigAnd( (Abc_Aig_t *)pNtkNew->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild1Copy(pObj) );
1004  Vec_PtrFree( vNodes );
1005 
1006  // do not add the COs
1007  if ( !Abc_NtkCheck( pNtkNew ) )
1008  fprintf( stdout, "Abc_NtkAppendToCone(): Network check has failed.\n" );
1009 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
Nm_Man_t * pManName
Definition: abc.h:160
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
void Abc_NtkAppendToCone(Abc_Ntk_t *pNtkNew, Abc_Ntk_t *pNtk, Vec_Ptr_t *vRoots)
Definition: abcNtk.c:969
static Abc_Obj_t * Abc_ObjChild1Copy(Abc_Obj_t *pObj)
Definition: abc.h:387
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition: abcNames.c:68
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
DECLARATIONS ///.
Definition: abcAig.c:52
static void check(int expr)
Definition: satSolver.c:46
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:700
static Abc_Obj_t * Abc_ObjChild0Copy(Abc_Obj_t *pObj)
Definition: abc.h:386
Abc_Obj_t * pCopy
Definition: abc.h:148
int Nm_ManFindIdByNameTwoTypes(Nm_Man_t *p, char *pName, int Type1, int Type2)
Definition: nmApi.c:239
if(last==0)
Definition: sparse_int.h:34
static Abc_Obj_t * Abc_NtkCreatePi(Abc_Ntk_t *pNtk)
Definition: abc.h:303
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:411
Definition: abc.h:89
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
Definition: abc.h:92
#define assert(ex)
Definition: util_old.h:213
ABC_DLL Vec_Ptr_t * Abc_NtkDfsNodes(Abc_Ntk_t *pNtk, Abc_Obj_t **ppNodes, int nNodes)
Definition: abcDfs.c:120
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void ** Vec_PtrArray(Vec_Ptr_t *p)
Definition: vecPtr.h:279
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL int Abc_NtkAttach ( Abc_Ntk_t pNtk)

FUNCTION DEFINITIONS ///.

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

Synopsis [Attaches gates from the current library to the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 60 of file abcAttach.c.

61 {
62  Mio_Library_t * pGenlib;
63  unsigned ** puTruthGates;
64  unsigned uTruths[6][2];
65  Abc_Obj_t * pNode;
66  Mio_Gate_t ** ppGates;
67  int nGates, nFanins, i;
68 
69  assert( Abc_NtkIsSopLogic(pNtk) );
70 
71  // check that the library is available
72  pGenlib = (Mio_Library_t *)Abc_FrameReadLibGen();
73  if ( pGenlib == NULL )
74  {
75  printf( "The current library is not available.\n" );
76  return 0;
77  }
78 
79  // start the truth tables
80  Abc_AttachSetupTruthTables( uTruths );
81 
82  // collect all the gates
83  ppGates = Mio_CollectRoots( pGenlib, 6, (float)1.0e+20, 1, &nGates, 0 );
84 
85  // derive the gate truth tables
86  puTruthGates = ABC_ALLOC( unsigned *, nGates );
87  puTruthGates[0] = ABC_ALLOC( unsigned, 2 * nGates );
88  for ( i = 1; i < nGates; i++ )
89  puTruthGates[i] = puTruthGates[i-1] + 2;
90  for ( i = 0; i < nGates; i++ )
91  Mio_DeriveTruthTable( ppGates[i], uTruths, Mio_GateReadPinNum(ppGates[i]), 6, puTruthGates[i] );
92 
93  // assign the gates to pNode->pCopy
94  Abc_NtkCleanCopy( pNtk );
95  Abc_NtkForEachNode( pNtk, pNode, i )
96  {
97  nFanins = Abc_ObjFaninNum(pNode);
98  if ( nFanins == 0 )
99  {
100  if ( Abc_SopIsConst1((char *)pNode->pData) )
101  pNode->pCopy = (Abc_Obj_t *)Mio_LibraryReadConst1(pGenlib);
102  else
103  pNode->pCopy = (Abc_Obj_t *)Mio_LibraryReadConst0(pGenlib);
104  }
105  else if ( nFanins == 1 )
106  {
107  if ( Abc_SopIsBuf((char *)pNode->pData) )
108  pNode->pCopy = (Abc_Obj_t *)Mio_LibraryReadBuf(pGenlib);
109  else
110  pNode->pCopy = (Abc_Obj_t *)Mio_LibraryReadInv(pGenlib);
111  }
112  else if ( nFanins > 6 )
113  {
114  printf( "Cannot attach gate with more than 6 inputs to node %s.\n", Abc_ObjName(pNode) );
115  ABC_FREE( puTruthGates[0] );
116  ABC_FREE( puTruthGates );
117  ABC_FREE( ppGates );
118  return 0;
119  }
120  else if ( !Abc_NodeAttach( pNode, ppGates, puTruthGates, nGates, uTruths ) )
121  {
122  printf( "Could not attach the library gate to node %s.\n", Abc_ObjName(pNode) );
123  ABC_FREE( puTruthGates[0] );
124  ABC_FREE( puTruthGates );
125  ABC_FREE( ppGates );
126  return 0;
127  }
128  }
129  ABC_FREE( puTruthGates[0] );
130  ABC_FREE( puTruthGates );
131  ABC_FREE( ppGates );
132  ABC_FREE( s_pPerms );
133 
134  // perform the final transformation
135  Abc_NtkForEachNode( pNtk, pNode, i )
136  {
137  if ( pNode->pCopy == NULL )
138  {
139  printf( "Some elementary gates (constant, buffer, or inverter) are missing in the library.\n" );
140  return 0;
141  }
142  }
143 
144  // replace SOP representation by the gate representation
145  Abc_NtkForEachNode( pNtk, pNode, i )
146  pNode->pData = pNode->pCopy, pNode->pCopy = NULL;
147  pNtk->ntkFunc = ABC_FUNC_MAP;
148  Extra_MmFlexStop( (Extra_MmFlex_t *)pNtk->pManFunc );
149  pNtk->pManFunc = pGenlib;
150 
151  printf( "Library gates are successfully attached to the nodes.\n" );
152 
153  // make sure that everything is okay
154  if ( !Abc_NtkCheck( pNtk ) )
155  {
156  printf( "Abc_NtkAttach: The network check has failed.\n" );
157  return 0;
158  }
159  return 1;
160 }
Mio_Gate_t * Mio_LibraryReadBuf(Mio_Library_t *pLib)
Definition: mioApi.c:47
ABC_DLL void * Abc_FrameReadLibGen()
Definition: mainFrame.c:56
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
static int Abc_NtkIsSopLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:264
static char ** s_pPerms
Definition: abcAttach.c:42
ABC_DLL int Abc_SopIsBuf(char *pSop)
Definition: abcSop.c:708
Mio_Gate_t * Mio_LibraryReadConst1(Mio_Library_t *pLib)
Definition: mioApi.c:50
int Mio_GateReadPinNum(Mio_Gate_t *pGate)
Definition: mioApi.c:151
Abc_Obj_t * pCopy
Definition: abc.h:148
if(last==0)
Definition: sparse_int.h:34
STRUCTURE DEFINITIONS ///.
Definition: mioInt.h:61
ABC_DLL int Abc_SopIsConst1(char *pSop)
Definition: abcSop.c:692
void Mio_DeriveTruthTable(Mio_Gate_t *pGate, unsigned uTruthsIn[][2], int nSigns, int nInputs, unsigned uTruthRes[])
Definition: mioUtils.c:608
static void Abc_AttachSetupTruthTables(unsigned uTruths[][2])
Definition: abcAttach.c:210
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
#define ABC_FREE(obj)
Definition: abc_global.h:232
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
Mio_Gate_t ** Mio_CollectRoots(Mio_Library_t *pLib, int nInputs, float tDelay, int fSkipInv, int *pnGates, int fVerbose)
Definition: mioUtils.c:302
static int Abc_NodeAttach(Abc_Obj_t *pNode, Mio_Gate_t **ppGates, unsigned **puTruthGates, int nGates, unsigned uTruths[][2])
Definition: abcAttach.c:173
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:507
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
Mio_Gate_t * Mio_LibraryReadConst0(Mio_Library_t *pLib)
Definition: mioApi.c:49
Mio_Gate_t * Mio_LibraryReadInv(Mio_Library_t *pLib)
Definition: mioApi.c:48
void Extra_MmFlexStop(Extra_MmFlex_t *p)
ABC_DLL void* Abc_NtkAttrFree ( Abc_Ntk_t pNtk,
int  Attr,
int  fFreeMan 
)

DECLARATIONS ///.

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

FileName [abcUtil.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Network and node package.]

Synopsis [Various utilities.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Frees one attribute manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 50 of file abcUtil.c.

51 {
52  void * pUserMan;
53  Vec_Att_t * pAttrMan;
54  pAttrMan = (Vec_Att_t *)Vec_PtrEntry( pNtk->vAttrs, Attr );
55  Vec_PtrWriteEntry( pNtk->vAttrs, Attr, NULL );
56  pUserMan = Vec_AttFree( pAttrMan, fFreeMan );
57  return pUserMan;
58 }
Vec_Ptr_t * vAttrs
Definition: abc.h:214
static void * Vec_AttFree(Vec_Att_t *p, int fFreeMan)
Definition: vecAtt.h:126
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static Abc_Ntk_t* Abc_NtkBackup ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 273 of file abc.h.

273 { return pNtk->pNetBackup; }
Abc_Ntk_t * pNetBackup
Definition: abc.h:177
ABC_DLL Abc_Ntk_t* Abc_NtkBalance ( Abc_Ntk_t pNtk,
int  fDuplicate,
int  fSelective,
int  fUpdateLevel 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Balances the AIG network.]

Description []

SideEffects []

SeeAlso []

Definition at line 53 of file abcBalance.c.

54 {
55 // extern void Abc_NtkHaigTranfer( Abc_Ntk_t * pNtkOld, Abc_Ntk_t * pNtkNew );
56  Abc_Ntk_t * pNtkAig;
57  assert( Abc_NtkIsStrash(pNtk) );
58  // compute the required times
59  if ( fSelective )
60  {
61  Abc_NtkStartReverseLevels( pNtk, 0 );
63  }
64  // perform balancing
65  pNtkAig = Abc_NtkStartFrom( pNtk, ABC_NTK_STRASH, ABC_FUNC_AIG );
66  // transfer HAIG
67 // Abc_NtkHaigTranfer( pNtk, pNtkAig );
68  // perform balancing
69  Abc_NtkBalancePerform( pNtk, pNtkAig, fDuplicate, fSelective, fUpdateLevel );
70  Abc_NtkFinalize( pNtk, pNtkAig );
71  Abc_AigCleanup( (Abc_Aig_t *)pNtkAig->pManFunc );
72  // undo the required times
73  if ( fSelective )
74  {
76  Abc_NtkCleanMarkA( pNtk );
77  }
78  if ( pNtk->pExdc )
79  pNtkAig->pExdc = Abc_NtkDup( pNtk->pExdc );
80  // make sure everything is okay
81  if ( !Abc_NtkCheck( pNtkAig ) )
82  {
83  printf( "Abc_NtkBalance: The network check has failed.\n" );
84  Abc_NtkDelete( pNtkAig );
85  return NULL;
86  }
87 //Abc_NtkPrintCiLevels( pNtkAig );
88  return pNtkAig;
89 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
Abc_Ntk_t * pExdc
Definition: abc.h:201
ABC_DLL Abc_Ntk_t * Abc_NtkDup(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:419
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
DECLARATIONS ///.
Definition: abcAig.c:52
static ABC_NAMESPACE_IMPL_START void Abc_NtkBalancePerform(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkAig, int fDuplicate, int fSelective, int fUpdateLevel)
DECLARATIONS ///.
Definition: abcBalance.c:102
ABC_DLL void Abc_NtkStopReverseLevels(Abc_Ntk_t *pNtk)
Definition: abcTiming.c:1190
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
void * pManFunc
Definition: abc.h:191
ABC_DLL void Abc_NtkCleanMarkA(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:663
ABC_DLL Abc_Ntk_t * Abc_NtkStartFrom(Abc_Ntk_t *pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func)
Definition: abcNtk.c:106
ABC_DLL int Abc_AigCleanup(Abc_Aig_t *pMan)
Definition: abcAig.c:194
static void Abc_NtkMarkCriticalNodes(Abc_Ntk_t *pNtk)
Definition: abcBalance.c:612
ABC_DLL void Abc_NtkFinalize(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkNew)
Definition: abcNtk.c:302
ABC_DLL void Abc_NtkStartReverseLevels(Abc_Ntk_t *pNtk, int nMaxLevelIncrease)
Definition: abcTiming.c:1162
#define assert(ex)
Definition: util_old.h:213
ABC_DLL Abc_Ntk_t* Abc_NtkBalanceExor ( Abc_Ntk_t pNtk,
int  fUpdateLevel,
int  fVerbose 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 3935 of file abcDar.c.

3936 {
3937  extern void Dar_BalancePrintStats( Aig_Man_t * p );
3938  Abc_Ntk_t * pNtkAig;
3939  Aig_Man_t * pMan, * pTemp;//, * pTemp2;
3940  assert( Abc_NtkIsStrash(pNtk) );
3941  // derive AIG with EXORs
3942  pMan = Abc_NtkToDar( pNtk, 1, 0 );
3943  if ( pMan == NULL )
3944  return NULL;
3945 // Aig_ManPrintStats( pMan );
3946  if ( fVerbose )
3947  Dar_BalancePrintStats( pMan );
3948  // perform balancing
3949  pTemp = Dar_ManBalance( pMan, fUpdateLevel );
3950 // Aig_ManPrintStats( pTemp );
3951  // create logic network
3952  pNtkAig = Abc_NtkFromDar( pNtk, pTemp );
3953  Aig_ManStop( pTemp );
3954  Aig_ManStop( pMan );
3955  return pNtkAig;
3956 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
Abc_Ntk_t * Abc_NtkFromDar(Abc_Ntk_t *pNtkOld, Aig_Man_t *pMan)
Definition: abcDar.c:414
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
void Dar_BalancePrintStats(Aig_Man_t *p)
Definition: darBalance.c:716
#define assert(ex)
Definition: util_old.h:213
Aig_Man_t * Dar_ManBalance(Aig_Man_t *p, int fUpdateLevel)
Definition: darBalance.c:554
Aig_Man_t * Abc_NtkToDar(Abc_Ntk_t *pNtk, int fExors, int fRegisters)
DECLARATIONS ///.
Definition: abcDar.c:233
ABC_DLL Abc_Ntk_t* Abc_NtkBarBufsFromBuffers ( Abc_Ntk_t pNtkBase,
Abc_Ntk_t pNtk 
)

Definition at line 462 of file abcBarBuf.c.

463 {
464  Abc_Ntk_t * pNtkNew;
465  Abc_Obj_t * pObj, * pFanin, * pLatch;
466  int i, k, nBarBufs;
467  assert( Abc_NtkIsLogic(pNtkBase) );
468  assert( Abc_NtkIsLogic(pNtk) );
469  assert( pNtkBase->nBarBufs == Abc_NtkLatchNum(pNtkBase) );
470  // start the network
471  pNtkNew = Abc_NtkStartFrom( pNtkBase, pNtk->ntkType, pNtk->ntkFunc );
472  // transfer PI pointers
473  Abc_NtkForEachPi( pNtk, pObj, i )
474  pObj->pCopy = Abc_NtkPi(pNtkNew, i);
475  // assuming that the order/number of barbufs remains the same
476  nBarBufs = 0;
477  Abc_NtkForEachNode( pNtk, pObj, i )
478  {
479  if ( Abc_ObjIsBarBuf(pObj) )
480  {
481  pLatch = Abc_NtkBox(pNtkNew, nBarBufs++);
482  Abc_ObjAddFanin( Abc_ObjFanin0(pLatch), Abc_ObjFanin0(pObj)->pCopy );
483  pObj->pCopy = Abc_ObjFanout0(pLatch);
484  }
485  else
486  {
487  Abc_NtkDupObj( pNtkNew, pObj, 1 );
488  Abc_ObjForEachFanin( pObj, pFanin, k )
489  Abc_ObjAddFanin( pObj->pCopy, pFanin->pCopy );
490  }
491  }
492  assert( nBarBufs == pNtkBase->nBarBufs );
493  // connect POs
494  Abc_NtkForEachPo( pNtk, pObj, i )
495  Abc_ObjAddFanin( Abc_NtkPo(pNtkNew, i), Abc_ObjFanin0(pObj)->pCopy );
496  return pNtkNew;
497 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static int Abc_ObjIsBarBuf(Abc_Obj_t *pObj)
Definition: abc.h:360
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition: abcObj.c:337
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
ABC_DLL Abc_Ntk_t * Abc_NtkStartFrom(Abc_Ntk_t *pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func)
Definition: abcNtk.c:106
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
static Abc_Obj_t * Abc_NtkBox(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:319
static Abc_Obj_t * Abc_NtkPo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:316
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
int nBarBufs
Definition: abc.h:174
#define assert(ex)
Definition: util_old.h:213
static Abc_Obj_t * Abc_NtkPi(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:315
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
Abc_NtkType_t ntkType
Definition: abc.h:156
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
ABC_DLL Abc_Ntk_t* Abc_NtkBarBufsToBuffers ( Abc_Ntk_t pNtk)

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

Synopsis [Converts the network to dedicated barbufs and back.]

Description []

SideEffects []

SeeAlso []

Definition at line 424 of file abcBarBuf.c.

425 {
426  Vec_Ptr_t * vNodes;
427  Abc_Ntk_t * pNtkNew;
428  Abc_Obj_t * pObj, * pFanin;
429  int i, k;
430  assert( Abc_NtkIsLogic(pNtk) );
431  assert( pNtk->pDesign == NULL );
432  assert( pNtk->nBarBufs > 0 );
433  assert( pNtk->nBarBufs == Abc_NtkLatchNum(pNtk) );
434  vNodes = Abc_NtkToBarBufsCollect( pNtk );
435  // start the network
436  pNtkNew = Abc_NtkAlloc( ABC_NTK_LOGIC, pNtk->ntkFunc, 1 );
437  pNtkNew->pName = Extra_UtilStrsav(pNtk->pName);
438  pNtkNew->pSpec = Extra_UtilStrsav(pNtk->pSpec);
439  // create objects
440  Abc_NtkCleanCopy( pNtk );
441  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
442  {
443  if ( Abc_ObjIsPi(pObj) )
444  Abc_NtkDupObj( pNtkNew, pObj, 1 );
445  else if ( Abc_ObjIsPo( pObj) )
446  Abc_ObjAddFanin( Abc_NtkDupObj(pNtkNew, pObj, 1), Abc_ObjFanin0(pObj)->pCopy );
447  else if ( Abc_ObjIsBi(pObj) || Abc_ObjIsBo(pObj) )
448  pObj->pCopy = Abc_ObjFanin0(pObj)->pCopy;
449  else if ( Abc_ObjIsLatch(pObj) )
450  Abc_ObjAddFanin( (pObj->pCopy = Abc_NtkCreateNode(pNtkNew)), Abc_ObjFanin0(pObj)->pCopy );
451  else if ( Abc_ObjIsNode(pObj) )
452  {
453  Abc_NtkDupObj( pNtkNew, pObj, 1 );
454  Abc_ObjForEachFanin( pObj, pFanin, k )
455  Abc_ObjAddFanin( pObj->pCopy, pFanin->pCopy );
456  }
457  else assert( 0 );
458  }
459  Vec_PtrFree( vNodes );
460  return pNtkNew;
461 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_ObjIsBo(Abc_Obj_t *pObj)
Definition: abc.h:350
static int Abc_ObjIsLatch(Abc_Obj_t *pObj)
Definition: abc.h:356
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition: abcObj.c:337
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
static int Abc_ObjIsPi(Abc_Obj_t *pObj)
Definition: abc.h:347
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
char * Extra_UtilStrsav(const char *s)
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
ABC_DLL Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
Abc_Obj_t * pCopy
Definition: abc.h:148
else
Definition: sparse_int.h:55
char * pSpec
Definition: abc.h:159
Vec_Ptr_t * Abc_NtkToBarBufsCollect(Abc_Ntk_t *pNtk)
Definition: abcBarBuf.c:352
static int Abc_ObjIsBi(Abc_Obj_t *pObj)
Definition: abc.h:349
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
int nBarBufs
Definition: abc.h:174
static Abc_Obj_t * Abc_NtkCreateNode(Abc_Ntk_t *pNtk)
Definition: abc.h:308
static int Abc_ObjIsPo(Abc_Obj_t *pObj)
Definition: abc.h:348
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:507
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
Abc_Des_t * pDesign
Definition: abc.h:180
char * pName
Definition: abc.h:158
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL Abc_Ntk_t* Abc_NtkBddToMuxes ( Abc_Ntk_t pNtk)

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

Synopsis [Creates the network isomorphic to the union of local BDDs of the nodes.]

Description [The nodes of the local BDDs are converted into the network nodes with logic functions equal to the MUX.]

SideEffects []

SeeAlso []

Definition at line 125 of file abcNtbdd.c.

126 {
127  Abc_Ntk_t * pNtkNew;
128  assert( Abc_NtkIsBddLogic(pNtk) );
129  pNtkNew = Abc_NtkStartFrom( pNtk, ABC_NTK_LOGIC, ABC_FUNC_SOP );
130  Abc_NtkBddToMuxesPerform( pNtk, pNtkNew );
131  Abc_NtkFinalize( pNtk, pNtkNew );
132  // make sure everything is okay
133  if ( !Abc_NtkCheck( pNtkNew ) )
134  {
135  printf( "Abc_NtkBddToMuxes: The network check has failed.\n" );
136  Abc_NtkDelete( pNtkNew );
137  return NULL;
138  }
139  return pNtkNew;
140 }
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
ABC_DLL Abc_Ntk_t * Abc_NtkStartFrom(Abc_Ntk_t *pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func)
Definition: abcNtk.c:106
ABC_DLL void Abc_NtkFinalize(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkNew)
Definition: abcNtk.c:302
static ABC_NAMESPACE_IMPL_START void Abc_NtkBddToMuxesPerform(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkNew)
DECLARATIONS ///.
Definition: abcNtbdd.c:153
static int Abc_NtkIsBddLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:265
#define assert(ex)
Definition: util_old.h:213
ABC_DLL int Abc_NtkBddToSop ( Abc_Ntk_t pNtk,
int  fDirect 
)

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

Synopsis [Converts the network from BDD to SOP representation.]

Description [If the flag is set to 1, forces the direct phase of all covers.]

SideEffects []

SeeAlso []

Definition at line 359 of file abcFunc.c.

360 {
361  extern void Abc_NtkSortSops( Abc_Ntk_t * pNtk );
362  Abc_Obj_t * pNode;
363  Mem_Flex_t * pManNew;
364  DdManager * dd = (DdManager *)pNtk->pManFunc;
365  DdNode * bFunc;
366  Vec_Str_t * vCube;
367  int i, fMode;
368 
369  if ( fDirect )
370  fMode = 1;
371  else
372  fMode = -1;
373 
374  assert( Abc_NtkHasBdd(pNtk) );
375  if ( dd->size > 0 )
376  Cudd_zddVarsFromBddVars( dd, 2 );
377  // create the new manager
378  pManNew = Mem_FlexStart();
379 
380  // go through the objects
381  vCube = Vec_StrAlloc( 100 );
382  Abc_NtkForEachNode( pNtk, pNode, i )
383  {
384  if ( Abc_ObjIsBarBuf(pNode) )
385  continue;
386  assert( pNode->pData );
387  bFunc = (DdNode *)pNode->pData;
388  pNode->pNext = (Abc_Obj_t *)Abc_ConvertBddToSop( pManNew, dd, bFunc, bFunc, Abc_ObjFaninNum(pNode), 0, vCube, fMode );
389  if ( pNode->pNext == NULL )
390  {
391  Mem_FlexStop( pManNew, 0 );
392  Abc_NtkCleanNext( pNtk );
393 // printf( "Converting from BDDs to SOPs has failed.\n" );
394  Vec_StrFree( vCube );
395  return 0;
396  }
397  }
398  Vec_StrFree( vCube );
399 
400  // update the network type
401  pNtk->ntkFunc = ABC_FUNC_SOP;
402  // set the new manager
403  pNtk->pManFunc = pManNew;
404  // transfer from next to data
405  Abc_NtkForEachNode( pNtk, pNode, i )
406  {
407  if ( Abc_ObjIsBarBuf(pNode) )
408  continue;
409  Cudd_RecursiveDeref( dd, (DdNode *)pNode->pData );
410  pNode->pData = pNode->pNext;
411  pNode->pNext = NULL;
412  }
413 
414  // check for remaining references in the package
415  Extra_StopManager( dd );
416 
417  // reorder fanins and cubes to make SOPs more human-readable
418  Abc_NtkSortSops( pNtk );
419  return 1;
420 }
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
Definition: cudd.h:278
int size
Definition: cuddInt.h:361
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Abc_ObjIsBarBuf(Abc_Obj_t *pObj)
Definition: abc.h:360
static Vec_Str_t * Vec_StrAlloc(int nCap)
Definition: bblif.c:495
void Extra_StopManager(DdManager *dd)
Definition: extraBddMisc.c:223
void * pManFunc
Definition: abc.h:191
Mem_Flex_t * Mem_FlexStart()
Definition: mem.c:311
char * Abc_ConvertBddToSop(Mem_Flex_t *pMan, DdManager *dd, DdNode *bFuncOn, DdNode *bFuncOnDc, int nFanins, int fAllPrimes, Vec_Str_t *vCube, int fMode)
Definition: abcFunc.c:209
static void Vec_StrFree(Vec_Str_t *p)
Definition: bblif.c:616
if(last==0)
Definition: sparse_int.h:34
ABC_DLL void Abc_NtkCleanNext(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:636
void Abc_NtkSortSops(Abc_Ntk_t *pNtk)
Definition: abcFanOrder.c:348
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
void Mem_FlexStop(Mem_Flex_t *p, int fVerbose)
Definition: mem.c:343
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
Abc_Obj_t * pNext
Definition: abc.h:131
int Cudd_zddVarsFromBddVars(DdManager *dd, int multiplicity)
Definition: cuddAPI.c:519
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
static int Abc_NtkBiNum ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 290 of file abc.h.

290 { return pNtk->nObjCounts[ABC_OBJ_BI]; }
int nObjCounts[ABC_OBJ_NUMBER]
Definition: abc.h:171
Definition: abc.h:91
static int Abc_NtkBlackboxNum ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 296 of file abc.h.

296 { return pNtk->nObjCounts[ABC_OBJ_BLACKBOX]; }
int nObjCounts[ABC_OBJ_NUMBER]
Definition: abc.h:171
static int Abc_NtkBoNum ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 291 of file abc.h.

291 { return pNtk->nObjCounts[ABC_OBJ_BO]; }
int nObjCounts[ABC_OBJ_NUMBER]
Definition: abc.h:171
Definition: abc.h:92
static Abc_Obj_t* Abc_NtkBox ( Abc_Ntk_t pNtk,
int  i 
)
inlinestatic

Definition at line 319 of file abc.h.

319 { return (Abc_Obj_t *)Vec_PtrEntry( pNtk->vBoxes, i ); }
Vec_Ptr_t * vBoxes
Definition: abc.h:168
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Abc_NtkBoxNum ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 289 of file abc.h.

289 { return Vec_PtrSize(pNtk->vBoxes); }
Vec_Ptr_t * vBoxes
Definition: abc.h:168
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
ABC_DLL void* Abc_NtkBuildGlobalBdds ( Abc_Ntk_t pNtk,
int  nBddSizeMax,
int  fDropInternal,
int  fReorder,
int  fVerbose 
)

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

Synopsis [Derives global BDDs for the COs of the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 251 of file abcNtbdd.c.

252 {
253  ProgressBar * pProgress;
254  Abc_Obj_t * pObj, * pFanin;
255  Vec_Att_t * pAttMan;
256  DdManager * dd;
257  DdNode * bFunc;
258  int i, k, Counter;
259 
260  // remove dangling nodes
261  Abc_AigCleanup( (Abc_Aig_t *)pNtk->pManFunc );
262 
263  // start the manager
264  assert( Abc_NtkGlobalBdd(pNtk) == NULL );
266  pAttMan = Vec_AttAlloc( Abc_NtkObjNumMax(pNtk) + 1, dd, (void (*)(void*))Extra_StopManager, NULL, (void (*)(void*,void*))Cudd_RecursiveDeref );
267  Vec_PtrWriteEntry( pNtk->vAttrs, VEC_ATTR_GLOBAL_BDD, pAttMan );
268 
269  // set reordering
270  if ( fReorder )
272 
273  // assign the constant node BDD
274  pObj = Abc_AigConst1(pNtk);
275  if ( Abc_ObjFanoutNum(pObj) > 0 )
276  {
277  bFunc = dd->one;
278  Abc_ObjSetGlobalBdd( pObj, bFunc ); Cudd_Ref( bFunc );
279  }
280  // set the elementary variables
281  Abc_NtkForEachCi( pNtk, pObj, i )
282  if ( Abc_ObjFanoutNum(pObj) > 0 )
283  {
284  bFunc = dd->vars[i];
285 // bFunc = dd->vars[Abc_NtkCiNum(pNtk) - 1 - i];
286  Abc_ObjSetGlobalBdd( pObj, bFunc ); Cudd_Ref( bFunc );
287  }
288 
289  // collect the global functions of the COs
290  Counter = 0;
291  // construct the BDDs
292  pProgress = Extra_ProgressBarStart( stdout, Abc_NtkNodeNum(pNtk) );
293  Abc_NtkForEachCo( pNtk, pObj, i )
294  {
295  bFunc = Abc_NodeGlobalBdds_rec( dd, Abc_ObjFanin0(pObj), nBddSizeMax, fDropInternal, pProgress, &Counter, fVerbose );
296  if ( bFunc == NULL )
297  {
298  if ( fVerbose )
299  printf( "Constructing global BDDs is aborted.\n" );
300  Abc_NtkFreeGlobalBdds( pNtk, 0 );
301  Cudd_Quit( dd );
302 
303  // reset references
304  Abc_NtkForEachObj( pNtk, pObj, i )
305  if ( !Abc_ObjIsBox(pObj) && !Abc_ObjIsBi(pObj) )
306  pObj->vFanouts.nSize = 0;
307  Abc_NtkForEachObj( pNtk, pObj, i )
308  if ( !Abc_ObjIsBox(pObj) && !Abc_ObjIsBo(pObj) )
309  Abc_ObjForEachFanin( pObj, pFanin, k )
310  pFanin->vFanouts.nSize++;
311  return NULL;
312  }
313  bFunc = Cudd_NotCond( bFunc, (int)Abc_ObjFaninC0(pObj) ); Cudd_Ref( bFunc );
314  Abc_ObjSetGlobalBdd( pObj, bFunc );
315  }
316  Extra_ProgressBarStop( pProgress );
317 
318 /*
319  // derefence the intermediate BDDs
320  Abc_NtkForEachNode( pNtk, pObj, i )
321  if ( pObj->pCopy )
322  {
323  Cudd_RecursiveDeref( dd, (DdNode *)pObj->pCopy );
324  pObj->pCopy = NULL;
325  }
326 */
327 /*
328  // make sure all nodes are derefed
329  Abc_NtkForEachObj( pNtk, pObj, i )
330  {
331  if ( pObj->pCopy != NULL )
332  printf( "Abc_NtkBuildGlobalBdds() error: Node %d has BDD assigned\n", pObj->Id );
333  if ( pObj->vFanouts.nSize > 0 )
334  printf( "Abc_NtkBuildGlobalBdds() error: Node %d has refs assigned\n", pObj->Id );
335  }
336 */
337  // reset references
338  Abc_NtkForEachObj( pNtk, pObj, i )
339  if ( !Abc_ObjIsBox(pObj) && !Abc_ObjIsBi(pObj) )
340  pObj->vFanouts.nSize = 0;
341  Abc_NtkForEachObj( pNtk, pObj, i )
342  if ( !Abc_ObjIsBox(pObj) && !Abc_ObjIsBo(pObj) )
343  Abc_ObjForEachFanin( pObj, pFanin, k )
344  pFanin->vFanouts.nSize++;
345 
346  // reorder one more time
347  if ( fReorder )
348  {
350  Cudd_AutodynDisable( dd );
351  }
352 // Cudd_PrintInfo( dd, stdout );
353  return dd;
354 }
Vec_Ptr_t * vAttrs
Definition: abc.h:214
#define CUDD_UNIQUE_SLOTS
Definition: cudd.h:97
void * Abc_NtkFreeGlobalBdds(Abc_Ntk_t *pNtk, int fFreeMan)
Definition: abcNtbdd.c:476
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
Definition: cudd.h:278
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
static int Abc_ObjIsBo(Abc_Obj_t *pObj)
Definition: abc.h:350
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
static void * Abc_NtkGlobalBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:428
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
#define CUDD_CACHE_SLOTS
Definition: cudd.h:98
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
void Extra_StopManager(DdManager *dd)
Definition: extraBddMisc.c:223
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
DECLARATIONS ///.
Definition: abcAig.c:52
void * pManFunc
Definition: abc.h:191
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
Definition: abc.h:293
static DdNode * Abc_NodeGlobalBdds_rec(DdManager *dd, Abc_Obj_t *pNode, int nBddSizeMax, int fDropInternal, ProgressBar *pProgress, int *pCounter, int fVerbose)
Definition: abcNtbdd.c:367
DECLARATIONS ///.
ABC_DLL int Abc_AigCleanup(Abc_Aig_t *pMan)
Definition: abcAig.c:194
DdManager * Cudd_Init(unsigned int numVars, unsigned int numVarsZ, unsigned int numSlots, unsigned int cacheSize, unsigned long maxMemory)
Definition: cuddInit.c:125
if(last==0)
Definition: sparse_int.h:34
static int Counter
void Extra_ProgressBarStop(ProgressBar *p)
static void Abc_ObjSetGlobalBdd(Abc_Obj_t *pObj, void *bF)
Definition: abc.h:432
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
void Cudd_AutodynDisable(DdManager *unique)
Definition: cuddAPI.c:708
static int Abc_ObjIsBi(Abc_Obj_t *pObj)
Definition: abc.h:349
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
static Vec_Att_t * Vec_AttAlloc(int nSize, void *pMan, void(*pFuncFreeMan)(void *), void *(*pFuncStartObj)(void *), void(*pFuncFreeObj)(void *, void *))
MACRO DEFINITIONS ///.
Definition: vecAtt.h:96
DdNode ** vars
Definition: cuddInt.h:390
ProgressBar * Extra_ProgressBarStart(FILE *pFile, int nItemsTotal)
FUNCTION DEFINITIONS ///.
DdNode * one
Definition: cuddInt.h:345
#define Cudd_NotCond(node, c)
Definition: cudd.h:383
#define assert(ex)
Definition: util_old.h:213
static int Abc_ObjIsBox(Abc_Obj_t *pObj)
Definition: abc.h:357
void Cudd_Quit(DdManager *unique)
Definition: cuddInit.c:225
int Cudd_ReduceHeap(DdManager *table, Cudd_ReorderingType heuristic, int minsize)
Definition: cuddReorder.c:176
void Cudd_AutodynEnable(DdManager *unique, Cudd_ReorderingType method)
Definition: cuddAPI.c:669
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
ABC_DLL int Abc_NtkCheck ( Abc_Ntk_t pNtk)

FUNCTION DEFINITIONS ///.

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

Synopsis [Checks the integrity of the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 61 of file abcCheck.c.

62 {
63  return !Abc_FrameIsFlagEnabled( "check" ) || Abc_NtkDoCheck( pNtk );
64 }
ABC_DLL int Abc_FrameIsFlagEnabled(char *pFlag)
Definition: mainFrame.c:113
int Abc_NtkDoCheck(Abc_Ntk_t *pNtk)
Definition: abcCheck.c:93
ABC_DLL int Abc_NtkCheckObj ( Abc_Ntk_t pNtk,
Abc_Obj_t pObj 
)

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

Synopsis [Checks the connectivity of the object.]

Description []

SideEffects []

SeeAlso []

Definition at line 414 of file abcCheck.c.

415 {
416  Abc_Obj_t * pFanin, * pFanout;
417  int Value = 1;
418  int i, k;
419 
420  // check the network
421  if ( pObj->pNtk != pNtk )
422  {
423  fprintf( stdout, "NetworkCheck: Object \"%s\" does not belong to the network.\n", Abc_ObjName(pObj) );
424  return 0;
425  }
426  // check the object ID
427  if ( pObj->Id < 0 || (int)pObj->Id >= Abc_NtkObjNumMax(pNtk) )
428  {
429  fprintf( stdout, "NetworkCheck: Object \"%s\" has incorrect ID.\n", Abc_ObjName(pObj) );
430  return 0;
431  }
432 
433  if ( !Abc_FrameIsFlagEnabled("checkfio") )
434  return Value;
435 
436  // go through the fanins of the object and make sure fanins have this object as a fanout
437  Abc_ObjForEachFanin( pObj, pFanin, i )
438  {
439  if ( Vec_IntFind( &pFanin->vFanouts, pObj->Id ) == -1 )
440  {
441  fprintf( stdout, "NodeCheck: Object \"%s\" has fanin ", Abc_ObjName(pObj) );
442  fprintf( stdout, "\"%s\" but the fanin does not have it as a fanout.\n", Abc_ObjName(pFanin) );
443  Value = 0;
444  }
445  }
446  // go through the fanouts of the object and make sure fanouts have this object as a fanin
447  Abc_ObjForEachFanout( pObj, pFanout, i )
448  {
449  if ( Vec_IntFind( &pFanout->vFanins, pObj->Id ) == -1 )
450  {
451  fprintf( stdout, "NodeCheck: Object \"%s\" has fanout ", Abc_ObjName(pObj) );
452  fprintf( stdout, "\"%s\" but the fanout does not have it as a fanin.\n", Abc_ObjName(pFanout) );
453  Value = 0;
454  }
455  }
456 
457  // make sure fanins are not duplicated
458  for ( i = 0; i < pObj->vFanins.nSize; i++ )
459  for ( k = i + 1; k < pObj->vFanins.nSize; k++ )
460  if ( pObj->vFanins.pArray[k] == pObj->vFanins.pArray[i] )
461  {
462  printf( "Warning: Node %s has", Abc_ObjName(pObj) );
463  printf( " duplicated fanin %s.\n", Abc_ObjName(Abc_ObjFanin(pObj,k)) );
464  }
465 
466  // save time: do not check large fanout lists
467  if ( pObj->vFanouts.nSize > 100 )
468  return Value;
469 
470  // make sure fanouts are not duplicated
471  for ( i = 0; i < pObj->vFanouts.nSize; i++ )
472  for ( k = i + 1; k < pObj->vFanouts.nSize; k++ )
473  if ( pObj->vFanouts.pArray[k] == pObj->vFanouts.pArray[i] )
474  {
475  printf( "Warning: Node %s has", Abc_ObjName(pObj) );
476  printf( " duplicated fanout %s.\n", Abc_ObjName(Abc_ObjFanout(pObj,k)) );
477  }
478 
479  return Value;
480 }
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
static int Vec_IntFind(Vec_Int_t *p, int Entry)
Definition: vecInt.h:895
Vec_Int_t vFanins
Definition: abc.h:143
Vec_Int_t vFanouts
Definition: abc.h:144
Abc_Ntk_t * pNtk
Definition: abc.h:130
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition: abc.h:526
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
int Id
Definition: abc.h:132
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
ABC_DLL int Abc_FrameIsFlagEnabled(char *pFlag)
Definition: mainFrame.c:113
static Abc_Obj_t * Abc_ObjFanout(Abc_Obj_t *pObj, int i)
Definition: abc.h:370
static Abc_Obj_t * Abc_ObjFanin(Abc_Obj_t *pObj, int i)
Definition: abc.h:372
ABC_DLL int Abc_NtkCheckRead ( Abc_Ntk_t pNtk)

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

Synopsis [Checks the integrity of the network after reading.]

Description []

SideEffects []

SeeAlso []

Definition at line 77 of file abcCheck.c.

78 {
79  return !Abc_FrameIsFlagEnabled( "checkread" ) || Abc_NtkDoCheck( pNtk );
80 }
ABC_DLL int Abc_FrameIsFlagEnabled(char *pFlag)
Definition: mainFrame.c:113
int Abc_NtkDoCheck(Abc_Ntk_t *pNtk)
Definition: abcCheck.c:93
ABC_DLL int Abc_NtkCheckUniqueCiNames ( Abc_Ntk_t pNtk)

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

Synopsis [Returns 0 if CI names are repeated.]

Description []

SideEffects []

SeeAlso []

Definition at line 854 of file abcCheck.c.

855 {
856  Vec_Ptr_t * vNames;
857  Abc_Obj_t * pObj;
858  int i, fRetValue = 1;
859  assert( !Abc_NtkIsNetlist(pNtk) );
860  vNames = Vec_PtrAlloc( Abc_NtkCiNum(pNtk) );
861  Abc_NtkForEachCi( pNtk, pObj, i )
862  Vec_PtrPush( vNames, Abc_ObjName(pObj) );
863  Vec_PtrSort( vNames, (int (*)())Abc_NtkNamesCompare );
864  for ( i = 1; i < Abc_NtkCiNum(pNtk); i++ )
865  if ( !strcmp( (const char *)Vec_PtrEntry(vNames,i-1), (const char *)Vec_PtrEntry(vNames,i) ) )
866  {
867  printf( "Abc_NtkCheck: Repeated CI names: %s and %s.\n", (char*)Vec_PtrEntry(vNames,i-1), (char*)Vec_PtrEntry(vNames,i) );
868  fRetValue = 0;
869  }
870  Vec_PtrFree( vNames );
871  return fRetValue;
872 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static void Vec_PtrSort(Vec_Ptr_t *p, int(*Vec_PtrSortCompare)()) ___unused
Definition: vecPtr.h:851
int Abc_NtkNamesCompare(char **pName1, char **pName2)
Definition: abcCheck.c:838
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
for(p=first;p->value< newval;p=p->next)
int strcmp()
if(last==0)
Definition: sparse_int.h:34
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
#define assert(ex)
Definition: util_old.h:213
#define const
Definition: zconf.h:196
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL int Abc_NtkCheckUniqueCioNames ( Abc_Ntk_t pNtk)

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

Synopsis [Returns 0 if there is a pair of CI/CO with the same name and logic in between.]

Description []

SideEffects []

SeeAlso []

Definition at line 919 of file abcCheck.c.

920 {
921  Abc_Obj_t * pObj, * pObjCi, * pFanin;
922  int i, nCiId, fRetValue = 1;
923  assert( !Abc_NtkIsNetlist(pNtk) );
924  Abc_NtkForEachCo( pNtk, pObj, i )
925  {
927  if ( nCiId == -1 )
928  continue;
929  pObjCi = Abc_NtkObj( pNtk, nCiId );
930  assert( !strcmp( Abc_ObjName(pObj), Abc_ObjName(pObjCi) ) );
931  pFanin = Abc_ObjFanin0(pObj);
932  if ( pFanin != pObjCi )
933  {
934  printf( "Abc_NtkCheck: A CI/CO pair share the name (%s) but do not link directly. The name of the CO fanin is %s.\n",
935  Abc_ObjName(pObj), Abc_ObjName(Abc_ObjFanin0(pObj)) );
936  fRetValue = 0;
937  }
938  }
939  return fRetValue;
940 }
Nm_Man_t * pManName
Definition: abc.h:160
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
int strcmp()
int Nm_ManFindIdByNameTwoTypes(Nm_Man_t *p, char *pName, int Type1, int Type2)
Definition: nmApi.c:239
Definition: abc.h:89
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
Definition: abc.h:92
#define assert(ex)
Definition: util_old.h:213
ABC_DLL int Abc_NtkCheckUniqueCoNames ( Abc_Ntk_t pNtk)

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

Synopsis [Returns 0 if CO names are repeated.]

Description []

SideEffects []

SeeAlso []

Definition at line 885 of file abcCheck.c.

886 {
887  Vec_Ptr_t * vNames;
888  Abc_Obj_t * pObj;
889  int i, fRetValue = 1;
890  assert( !Abc_NtkIsNetlist(pNtk) );
891  vNames = Vec_PtrAlloc( Abc_NtkCoNum(pNtk) );
892  Abc_NtkForEachCo( pNtk, pObj, i )
893  Vec_PtrPush( vNames, Abc_ObjName(pObj) );
894  Vec_PtrSort( vNames, (int (*)())Abc_NtkNamesCompare );
895  for ( i = 1; i < Abc_NtkCoNum(pNtk); i++ )
896  {
897 // printf( "%s\n", Vec_PtrEntry(vNames,i) );
898  if ( !strcmp( (const char *)Vec_PtrEntry(vNames,i-1), (const char *)Vec_PtrEntry(vNames,i) ) )
899  {
900  printf( "Abc_NtkCheck: Repeated CO names: %s and %s.\n", (char*)Vec_PtrEntry(vNames,i-1), (char*)Vec_PtrEntry(vNames,i) );
901  fRetValue = 0;
902  }
903  }
904  Vec_PtrFree( vNames );
905  return fRetValue;
906 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static void Vec_PtrSort(Vec_Ptr_t *p, int(*Vec_PtrSortCompare)()) ___unused
Definition: vecPtr.h:851
int Abc_NtkNamesCompare(char **pName1, char **pName2)
Definition: abcCheck.c:838
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
for(p=first;p->value< newval;p=p->next)
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
int strcmp()
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
static Abc_Obj_t* Abc_NtkCi ( Abc_Ntk_t pNtk,
int  i 
)
inlinestatic

Definition at line 317 of file abc.h.

317 { return (Abc_Obj_t *)Vec_PtrEntry( pNtk->vCis, i ); }
Vec_Ptr_t * vCis
Definition: abc.h:165
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Abc_NtkCiNum ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 287 of file abc.h.

287 { return Vec_PtrSize(pNtk->vCis); }
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Vec_Ptr_t * vCis
Definition: abc.h:165
ABC_DLL void Abc_NtkCleanCopy ( Abc_Ntk_t pNtk)

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

Synopsis [Cleans the copy field of all objects.]

Description []

SideEffects []

SeeAlso []

Definition at line 507 of file abcUtil.c.

508 {
509  Abc_Obj_t * pObj;
510  int i;
511  Abc_NtkForEachObj( pNtk, pObj, i )
512  pObj->pCopy = NULL;
513 }
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
ABC_DLL void Abc_NtkCleanCopy_rec ( Abc_Ntk_t pNtk)

Definition at line 514 of file abcUtil.c.

515 {
516  Abc_Obj_t * pObj;
517  int i;
518  Abc_NtkCleanCopy( pNtk );
519  Abc_NtkForEachBox( pNtk, pObj, i )
521 }
void Abc_NtkCleanCopy_rec(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:514
static Abc_Ntk_t * Abc_ObjModel(Abc_Obj_t *pObj)
Definition: abc.h:335
#define Abc_NtkForEachBox(pNtk, pObj, i)
Definition: abc.h:495
void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:507
ABC_DLL void Abc_NtkCleanData ( Abc_Ntk_t pNtk)

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

Synopsis [Cleans the copy field of all objects.]

Description []

SideEffects []

SeeAlso []

Definition at line 534 of file abcUtil.c.

535 {
536  Abc_Obj_t * pObj;
537  int i;
538  Abc_NtkForEachObj( pNtk, pObj, i )
539  pObj->pData = NULL;
540 }
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
ABC_DLL void Abc_NtkCleanMarkA ( Abc_Ntk_t pNtk)

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

Synopsis [Cleans the copy field of all objects.]

Description []

SideEffects []

SeeAlso []

Definition at line 663 of file abcUtil.c.

664 {
665  Abc_Obj_t * pObj;
666  int i;
667  Abc_NtkForEachObj( pNtk, pObj, i )
668  pObj->fMarkA = 0;
669 }
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
ABC_DLL void Abc_NtkCleanMarkAB ( Abc_Ntk_t pNtk)

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

Synopsis [Cleans the copy field of all objects.]

Description []

SideEffects []

SeeAlso []

Definition at line 720 of file abcUtil.c.

721 {
722  Abc_Obj_t * pObj;
723  int i;
724  Abc_NtkForEachObj( pNtk, pObj, i )
725  pObj->fMarkA = pObj->fMarkB = 0;
726 }
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
ABC_DLL void Abc_NtkCleanMarkABC ( Abc_Ntk_t pNtk)

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

Synopsis [Cleans the copy field of all objects.]

Description []

SideEffects []

SeeAlso []

Definition at line 739 of file abcUtil.c.

740 {
741  Abc_Obj_t * pObj;
742  int i;
743  Abc_NtkForEachObj( pNtk, pObj, i )
744  pObj->fMarkA = pObj->fMarkB = pObj->fMarkC = 0;
745 }
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
ABC_DLL void Abc_NtkCleanMarkB ( Abc_Ntk_t pNtk)

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

Synopsis [Cleans the copy field of all objects.]

Description []

SideEffects []

SeeAlso []

Definition at line 682 of file abcUtil.c.

683 {
684  Abc_Obj_t * pObj;
685  int i;
686  Abc_NtkForEachObj( pNtk, pObj, i )
687  pObj->fMarkB = 0;
688 }
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
ABC_DLL void Abc_NtkCleanMarkC ( Abc_Ntk_t pNtk)

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

Synopsis [Cleans the copy field of all objects.]

Description []

SideEffects []

SeeAlso []

Definition at line 701 of file abcUtil.c.

702 {
703  Abc_Obj_t * pObj;
704  int i;
705  Abc_NtkForEachObj( pNtk, pObj, i )
706  pObj->fMarkC = 0;
707 }
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
ABC_DLL void Abc_NtkCleanNext ( Abc_Ntk_t pNtk)

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

Synopsis [Cleans the copy field of all objects.]

Description []

SideEffects []

SeeAlso []

Definition at line 636 of file abcUtil.c.

637 {
638  Abc_Obj_t * pObj;
639  int i;
640  Abc_NtkForEachObj( pNtk, pObj, i )
641  pObj->pNext = NULL;
642 }
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
ABC_DLL void Abc_NtkCleanNext_rec ( Abc_Ntk_t pNtk)

Definition at line 643 of file abcUtil.c.

644 {
645  Abc_Obj_t * pObj;
646  int i;
647  Abc_NtkCleanNext( pNtk );
648  Abc_NtkForEachBox( pNtk, pObj, i )
650 }
void Abc_NtkCleanNext(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:636
static Abc_Ntk_t * Abc_ObjModel(Abc_Obj_t *pObj)
Definition: abc.h:335
#define Abc_NtkForEachBox(pNtk, pObj, i)
Definition: abc.h:495
void Abc_NtkCleanNext_rec(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:643
ABC_DLL int Abc_NtkCleanup ( Abc_Ntk_t pNtk,
int  fVerbose 
)

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

Synopsis [Removes dangling nodes.]

Description [Returns the number of nodes removed.]

SideEffects []

SeeAlso []

Definition at line 476 of file abcSweep.c.

477 {
478  Vec_Ptr_t * vNodes;
479  int Counter;
480  assert( Abc_NtkIsLogic(pNtk) );
481  // mark the nodes reachable from the POs
482  vNodes = Abc_NtkDfs( pNtk, 0 );
483  Counter = Abc_NtkReduceNodes( pNtk, vNodes );
484  if ( fVerbose )
485  printf( "Cleanup removed %d dangling nodes.\n", Counter );
486  Vec_PtrFree( vNodes );
487  return Counter;
488 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
Definition: abcDfs.c:81
static int Counter
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkReduceNodes(Abc_Ntk_t *pNtk, Vec_Ptr_t *vNodes)
Definition: abcSweep.c:535
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL int Abc_NtkCleanupNodes ( Abc_Ntk_t pNtk,
Vec_Ptr_t vRoots,
int  fVerbose 
)

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

Synopsis [Removes dangling nodes.]

Description [Returns the number of nodes removed.]

SideEffects []

SeeAlso []

Definition at line 501 of file abcSweep.c.

502 {
503  Vec_Ptr_t * vNodes, * vStarts;
504  Abc_Obj_t * pObj;
505  int i, Counter;
506  assert( Abc_NtkIsLogic(pNtk) );
507  // collect starting nodes into one array
508  vStarts = Vec_PtrAlloc( 1000 );
509  Abc_NtkForEachCo( pNtk, pObj, i )
510  Vec_PtrPush( vStarts, pObj );
511  Vec_PtrForEachEntry( Abc_Obj_t *, vRoots, pObj, i )
512  if ( pObj )
513  Vec_PtrPush( vStarts, pObj );
514  // mark the nodes reachable from the POs
515  vNodes = Abc_NtkDfsNodes( pNtk, (Abc_Obj_t **)Vec_PtrArray(vStarts), Vec_PtrSize(vStarts) );
516  Vec_PtrFree( vStarts );
517  Counter = Abc_NtkReduceNodes( pNtk, vNodes );
518  if ( fVerbose )
519  printf( "Cleanup removed %d dangling nodes.\n", Counter );
520  Vec_PtrFree( vNodes );
521  return Counter;
522 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
if(last==0)
Definition: sparse_int.h:34
static int Counter
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define assert(ex)
Definition: util_old.h:213
ABC_DLL Vec_Ptr_t * Abc_NtkDfsNodes(Abc_Ntk_t *pNtk, Abc_Obj_t **ppNodes, int nNodes)
Definition: abcDfs.c:120
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void ** Vec_PtrArray(Vec_Ptr_t *p)
Definition: vecPtr.h:279
static int Abc_NtkReduceNodes(Abc_Ntk_t *pNtk, Vec_Ptr_t *vNodes)
Definition: abcSweep.c:535
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL int Abc_NtkCleanupSeq ( Abc_Ntk_t pNtk,
int  fLatchSweep,
int  fAutoSweep,
int  fVerbose 
)

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

Synopsis [Sequential cleanup.]

Description [Performs three tasks:

  • Removes logic that does not feed into POs.
  • Removes latches driven by constant values equal to the initial state.
  • Replaces the autonomous components by additional PI variables.]

SideEffects []

SeeAlso []

Definition at line 909 of file abcSweep.c.

910 {
911  Vec_Ptr_t * vNodes;
912  int Counter;
913  assert( Abc_NtkIsLogic(pNtk) );
914  // mark the nodes reachable from the POs
915  vNodes = Abc_NtkDfsSeq( pNtk );
916  Vec_PtrFree( vNodes );
917  // remove the non-marked nodes
918  Counter = Abc_NodeRemoveNonCurrentObjects( pNtk );
919  if ( fVerbose )
920  printf( "Cleanup removed %4d dangling objects.\n", Counter );
921  // check if some of the latches can be removed
922  if ( fLatchSweep )
923  {
924  Counter = Abc_NtkLatchSweep( pNtk );
925  if ( fVerbose )
926  printf( "Cleanup removed %4d redundant latches.\n", Counter );
927  }
928  // detect the autonomous components
929  if ( fAutoSweep )
930  {
931  vNodes = Abc_NtkDfsSeqReverse( pNtk );
932  Vec_PtrFree( vNodes );
933  // replace them by PIs
934  Counter = Abc_NtkReplaceAutonomousLogic( pNtk );
935  if ( fVerbose )
936  printf( "Cleanup added %4d additional PIs.\n", Counter );
937  // remove the non-marked nodes
938  Counter = Abc_NodeRemoveNonCurrentObjects( pNtk );
939  if ( fVerbose )
940  printf( "Cleanup removed %4d autonomous objects.\n", Counter );
941  }
942  // check
943  if ( !Abc_NtkCheck( pNtk ) )
944  printf( "Abc_NtkCleanupSeq: The network check has failed.\n" );
945  return 1;
946 }
int Abc_NodeRemoveNonCurrentObjects(Abc_Ntk_t *pNtk)
Definition: abcSweep.c:698
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
ABC_DLL Vec_Ptr_t * Abc_NtkDfsSeq(Abc_Ntk_t *pNtk)
Definition: abcDfs.c:397
ABC_DLL Vec_Ptr_t * Abc_NtkDfsSeqReverse(Abc_Ntk_t *pNtk)
Definition: abcDfs.c:454
static int Counter
int Abc_NtkReplaceAutonomousLogic(Abc_Ntk_t *pNtk)
Definition: abcSweep.c:852
int Abc_NtkLatchSweep(Abc_Ntk_t *pNtk)
Definition: abcSweep.c:802
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL Abc_Obj_t* Abc_NtkCloneObj ( Abc_Obj_t pObj)

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

Synopsis [Clones the objects in the same network but does not assign its function.]

Description []

SideEffects []

SeeAlso []

Definition at line 434 of file abcObj.c.

435 {
436  Abc_Obj_t * pClone, * pFanin;
437  int i;
438  pClone = Abc_NtkCreateObj( pObj->pNtk, (Abc_ObjType_t)pObj->Type );
439  Abc_ObjForEachFanin( pObj, pFanin, i )
440  Abc_ObjAddFanin( pClone, pFanin );
441  return pClone;
442 }
Abc_Obj_t * Abc_NtkCreateObj(Abc_Ntk_t *pNtk, Abc_ObjType_t Type)
Definition: abcObj.c:106
unsigned Type
Definition: abc.h:133
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
Abc_ObjType_t
Definition: abc.h:86
Abc_Ntk_t * pNtk
Definition: abc.h:130
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
static Abc_Obj_t* Abc_NtkCo ( Abc_Ntk_t pNtk,
int  i 
)
inlinestatic

Definition at line 318 of file abc.h.

318 { return (Abc_Obj_t *)Vec_PtrEntry( pNtk->vCos, i ); }
Vec_Ptr_t * vCos
Definition: abc.h:166
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
ABC_DLL Abc_Ntk_t* Abc_NtkCollapse ( Abc_Ntk_t pNtk,
int  fBddSizeMax,
int  fDualRail,
int  fReorder,
int  fVerbose 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Collapses the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 49 of file abcCollapse.c.

50 {
51  Abc_Ntk_t * pNtkNew;
52  abctime clk = Abc_Clock();
53 
54  assert( Abc_NtkIsStrash(pNtk) );
55  // compute the global BDDs
56  if ( Abc_NtkBuildGlobalBdds(pNtk, fBddSizeMax, 1, fReorder, fVerbose) == NULL )
57  return NULL;
58  if ( fVerbose )
59  {
60  DdManager * dd = (DdManager *)Abc_NtkGlobalBddMan( pNtk );
61  printf( "Shared BDD size = %6d nodes. ", Cudd_ReadKeys(dd) - Cudd_ReadDead(dd) );
62  ABC_PRT( "BDD construction time", Abc_Clock() - clk );
63  }
64 
65  // create the new network
66  pNtkNew = Abc_NtkFromGlobalBdds( pNtk );
67 // Abc_NtkFreeGlobalBdds( pNtk );
68  Abc_NtkFreeGlobalBdds( pNtk, 1 );
69  if ( pNtkNew == NULL )
70  {
71 // Cudd_Quit( pNtk->pManGlob );
72 // pNtk->pManGlob = NULL;
73  return NULL;
74  }
75 // Extra_StopManager( pNtk->pManGlob );
76 // pNtk->pManGlob = NULL;
77 
78  // make the network minimum base
79  Abc_NtkMinimumBase( pNtkNew );
80 
81  if ( pNtk->pExdc )
82  pNtkNew->pExdc = Abc_NtkDup( pNtk->pExdc );
83 
84  // make sure that everything is okay
85  if ( !Abc_NtkCheck( pNtkNew ) )
86  {
87  printf( "Abc_NtkCollapse: The network check has failed.\n" );
88  Abc_NtkDelete( pNtkNew );
89  return NULL;
90  }
91  return pNtkNew;
92 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
ABC_DLL int Abc_NtkMinimumBase(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcMinBase.c:48
Abc_Ntk_t * pExdc
Definition: abc.h:201
ABC_DLL Abc_Ntk_t * Abc_NtkDup(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:419
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
static abctime Abc_Clock()
Definition: abc_global.h:279
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
ABC_DLL void * Abc_NtkFreeGlobalBdds(Abc_Ntk_t *pNtk, int fFreeMan)
Definition: abcNtbdd.c:476
static ABC_NAMESPACE_IMPL_START Abc_Ntk_t * Abc_NtkFromGlobalBdds(Abc_Ntk_t *pNtk)
DECLARATIONS ///.
Definition: abcCollapse.c:108
static void * Abc_NtkGlobalBddMan(Abc_Ntk_t *pNtk)
Definition: abc.h:429
#define ABC_PRT(a, t)
Definition: abc_global.h:220
unsigned int Cudd_ReadKeys(DdManager *dd)
Definition: cuddAPI.c:1626
#define assert(ex)
Definition: util_old.h:213
ABC_DLL void * Abc_NtkBuildGlobalBdds(Abc_Ntk_t *pNtk, int fBddSizeMax, int fDropInternal, int fReorder, int fVerbose)
Definition: abcNtbdd.c:251
unsigned int Cudd_ReadDead(DdManager *dd)
Definition: cuddAPI.c:1646
ABC_INT64_T abctime
Definition: abc_global.h:278
ABC_DLL char** Abc_NtkCollectCioNames ( Abc_Ntk_t pNtk,
int  fCollectCos 
)

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

Synopsis [Collects the CI or CO names.]

Description []

SideEffects []

SeeAlso []

Definition at line 278 of file abcNames.c.

279 {
280  Abc_Obj_t * pObj;
281  char ** ppNames;
282  int i;
283  if ( fCollectCos )
284  {
285  ppNames = ABC_ALLOC( char *, Abc_NtkCoNum(pNtk) );
286  Abc_NtkForEachCo( pNtk, pObj, i )
287  ppNames[i] = Abc_ObjName(pObj);
288  }
289  else
290  {
291  ppNames = ABC_ALLOC( char *, Abc_NtkCiNum(pNtk) );
292  Abc_NtkForEachCi( pNtk, pObj, i )
293  ppNames[i] = Abc_ObjName(pObj);
294  }
295  return ppNames;
296 }
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
else
Definition: sparse_int.h:55
ABC_NAMESPACE_IMPL_START char * Abc_ObjName(Abc_Obj_t *pObj)
DECLARATIONS ///.
Definition: abcNames.c:48
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
ABC_DLL Vec_Ptr_t* Abc_NtkCollectLatches ( Abc_Ntk_t pNtk)

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

Synopsis [Collects all latches in the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 1627 of file abcUtil.c.

1628 {
1629  Vec_Ptr_t * vLatches;
1630  Abc_Obj_t * pObj;
1631  int i;
1632  vLatches = Vec_PtrAlloc( 10 );
1633  Abc_NtkForEachObj( pNtk, pObj, i )
1634  Vec_PtrPush( vLatches, pObj );
1635  return vLatches;
1636 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
ABC_DLL Vec_Int_t* Abc_NtkCollectLatchValues ( Abc_Ntk_t pNtk)

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

Synopsis [Strashes one logic node using its SOP.]

Description []

SideEffects []

SeeAlso []

Definition at line 187 of file abcLatch.c.

188 {
189  Vec_Int_t * vValues;
190  Abc_Obj_t * pLatch;
191  int i;
192  vValues = Vec_IntAlloc( Abc_NtkLatchNum(pNtk) );
193  Abc_NtkForEachLatch( pNtk, pLatch, i )
194  Vec_IntPush( vValues, Abc_LatchIsInit1(pLatch) );
195  return vValues;
196 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
#define Abc_NtkForEachLatch(pNtk, pObj, i)
Definition: abc.h:497
static int Abc_LatchIsInit1(Abc_Obj_t *pLatch)
Definition: abc.h:423
ABC_DLL char* Abc_NtkCollectLatchValuesStr ( Abc_Ntk_t pNtk)

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

Synopsis [Derives latch init string.]

Description []

SideEffects []

SeeAlso []

Definition at line 209 of file abcLatch.c.

210 {
211  char * pInits;
212  Abc_Obj_t * pLatch;
213  int i;
214  pInits = ABC_ALLOC( char, Abc_NtkLatchNum(pNtk) + 1 );
215  Abc_NtkForEachLatch( pNtk, pLatch, i )
216  {
217  if ( Abc_LatchIsInit0(pLatch) )
218  pInits[i] = '0';
219  else if ( Abc_LatchIsInit1(pLatch) )
220  pInits[i] = '1';
221  else if ( Abc_LatchIsInitDc(pLatch) )
222  pInits[i] = 'x';
223  else
224  assert( 0 );
225  }
226  pInits[i] = 0;
227  return pInits;
228 }
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
static int Abc_LatchIsInit0(Abc_Obj_t *pLatch)
Definition: abc.h:422
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static int Abc_LatchIsInitDc(Abc_Obj_t *pLatch)
Definition: abc.h:424
#define Abc_NtkForEachLatch(pNtk, pObj, i)
Definition: abc.h:497
static int Abc_LatchIsInit1(Abc_Obj_t *pLatch)
Definition: abc.h:423
#define assert(ex)
Definition: util_old.h:213
ABC_DLL Vec_Ptr_t* Abc_NtkCollectObjects ( Abc_Ntk_t pNtk)

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

Synopsis [Collects all objects into one array.]

Description []

SideEffects []

SeeAlso []

Definition at line 1725 of file abcUtil.c.

1726 {
1727  Vec_Ptr_t * vNodes;
1728  Abc_Obj_t * pNode;
1729  int i;
1730  vNodes = Vec_PtrAlloc( 100 );
1731  Abc_NtkForEachObj( pNtk, pNode, i )
1732  Vec_PtrPush( vNodes, pNode );
1733  return vNodes;
1734 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
ABC_DLL int Abc_NtkCombinePos ( Abc_Ntk_t pNtk,
int  fAnd,
int  fXor 
)

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

Synopsis [Computes OR or AND of the POs.]

Description []

SideEffects []

SeeAlso []

Definition at line 1151 of file abcMiter.c.

1152 {
1153  Abc_Obj_t * pNode, * pMiter;
1154  int i;
1155  assert( Abc_NtkIsStrash(pNtk) );
1156 // assert( Abc_NtkLatchNum(pNtk) == 0 );
1157  if ( Abc_NtkPoNum(pNtk) == 1 )
1158  return 1;
1159  // start the result
1160  if ( fAnd )
1161  pMiter = Abc_AigConst1(pNtk);
1162  else
1163  pMiter = Abc_ObjNot( Abc_AigConst1(pNtk) );
1164  // perform operations on the POs
1165  Abc_NtkForEachPo( pNtk, pNode, i )
1166  if ( fAnd )
1167  pMiter = Abc_AigAnd( (Abc_Aig_t *)pNtk->pManFunc, pMiter, Abc_ObjChild0(pNode) );
1168  else if ( fXor )
1169  pMiter = Abc_AigXor( (Abc_Aig_t *)pNtk->pManFunc, pMiter, Abc_ObjChild0(pNode) );
1170  else
1171  pMiter = Abc_AigOr( (Abc_Aig_t *)pNtk->pManFunc, pMiter, Abc_ObjChild0(pNode) );
1172  // remove the POs and their names
1173  for ( i = Abc_NtkPoNum(pNtk) - 1; i >= 0; i-- )
1174  Abc_NtkDeleteObj( Abc_NtkPo(pNtk, i) );
1175  assert( Abc_NtkPoNum(pNtk) == 0 );
1176  // create the new PO
1177  pNode = Abc_NtkCreatePo( pNtk );
1178  Abc_ObjAddFanin( pNode, pMiter );
1179  Abc_ObjAssignName( pNode, "miter", NULL );
1180  Abc_NtkOrderCisCos( pNtk );
1181  // make sure that everything is okay
1182  if ( !Abc_NtkCheck( pNtk ) )
1183  {
1184  printf( "Abc_NtkOrPos: The network check has failed.\n" );
1185  return 0;
1186  }
1187  return 1;
1188 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
ABC_DLL Abc_Obj_t * Abc_AigOr(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:719
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition: abcNames.c:68
for(p=first;p->value< newval;p=p->next)
DECLARATIONS ///.
Definition: abcAig.c:52
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
ABC_DLL Abc_Obj_t * Abc_AigXor(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:735
static Abc_Obj_t * Abc_ObjChild0(Abc_Obj_t *pObj)
Definition: abc.h:383
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:700
ABC_DLL void Abc_NtkDeleteObj(Abc_Obj_t *pObj)
Definition: abcObj.c:167
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
static Abc_Obj_t * Abc_NtkPo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:316
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:286
#define assert(ex)
Definition: util_old.h:213
static Abc_Obj_t * Abc_ObjNot(Abc_Obj_t *p)
Definition: abc.h:324
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
ABC_DLL void Abc_NtkOrderCisCos(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:71
static Abc_Obj_t * Abc_NtkCreatePo(Abc_Ntk_t *pNtk)
Definition: abc.h:304
ABC_DLL int Abc_NtkCompareSignals ( Abc_Ntk_t pNtk1,
Abc_Ntk_t pNtk2,
int  fOnlyPis,
int  fComb 
)

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

Synopsis [Compares the signals of the networks.]

Description []

SideEffects [Ordering POs by name is a very bad idea! It destroys the natural order of the logic in the circuit.]

SeeAlso []

Definition at line 741 of file abcCheck.c.

742 {
743  Abc_NtkOrderObjsByName( pNtk1, fComb );
744  Abc_NtkOrderObjsByName( pNtk2, fComb );
745  if ( !Abc_NtkComparePis( pNtk1, pNtk2, fComb ) )
746  return 0;
747  if ( !fOnlyPis )
748  {
749  if ( !Abc_NtkCompareBoxes( pNtk1, pNtk2, fComb ) )
750  return 0;
751  if ( !Abc_NtkComparePos( pNtk1, pNtk2, fComb ) )
752  return 0;
753  }
754  return 1;
755 }
static int Abc_NtkComparePos(Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int fComb)
Definition: abcCheck.c:670
static int Abc_NtkComparePis(Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int fComb)
Definition: abcCheck.c:637
int Abc_NtkCompareBoxes(Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int fComb)
Definition: abcCheck.c:703
ABC_DLL void Abc_NtkOrderObjsByName(Abc_Ntk_t *pNtk, int fComb)
Definition: abcNames.c:335
static int Abc_NtkConstrNum ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 299 of file abc.h.

299 { return pNtk->nConstrs; }
int nConstrs
Definition: abc.h:173
static int Abc_NtkCoNum ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 288 of file abc.h.

288 { return Vec_PtrSize(pNtk->vCos); }
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Vec_Ptr_t * vCos
Definition: abc.h:166
ABC_DLL Vec_Ptr_t* Abc_NtkConverLatchNamesIntoNumbers ( Abc_Ntk_t pNtk)

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

Synopsis [Transfors the array of latch names into that of latch numbers.]

Description []

SideEffects []

SeeAlso []

Definition at line 368 of file abcLatch.c.

369 {
370  Vec_Ptr_t * vResult, * vNames;
371  Vec_Int_t * vNumbers;
372  Abc_Obj_t * pObj;
373  char * pName;
374  int i, k, Num;
375  if ( pNtk->vOnehots == NULL )
376  return NULL;
377  // set register numbers
378  Abc_NtkForEachLatch( pNtk, pObj, i )
379  pObj->pNext = (Abc_Obj_t *)(ABC_PTRINT_T)i;
380  // add the numbers
381  vResult = Vec_PtrAlloc( Vec_PtrSize(pNtk->vOnehots) );
382  Vec_PtrForEachEntry( Vec_Ptr_t *, pNtk->vOnehots, vNames, i )
383  {
384  vNumbers = Vec_IntAlloc( Vec_PtrSize(vNames) );
385  Vec_PtrForEachEntry( char *, vNames, pName, k )
386  {
387  Num = Nm_ManFindIdByName( pNtk->pManName, pName, ABC_OBJ_BO );
388  if ( Num < 0 )
389  continue;
390  pObj = Abc_NtkObj( pNtk, Num );
391  if ( Abc_ObjFaninNum(pObj) != 1 || !Abc_ObjIsLatch(Abc_ObjFanin0(pObj)) )
392  continue;
393  Vec_IntPush( vNumbers, (int)(ABC_PTRINT_T)pObj->pNext );
394  }
395  if ( Vec_IntSize( vNumbers ) > 1 )
396  {
397  Vec_PtrPush( vResult, vNumbers );
398 printf( "Converted %d one-hot registers.\n", Vec_IntSize(vNumbers) );
399  }
400  else
401  Vec_IntFree( vNumbers );
402  }
403  // clean the numbers
404  Abc_NtkForEachLatch( pNtk, pObj, i )
405  pObj->pNext = NULL;
406  return vResult;
407 }
int Nm_ManFindIdByName(Nm_Man_t *p, char *pName, int Type)
Definition: nmApi.c:219
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
Nm_Man_t * pManName
Definition: abc.h:160
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Abc_ObjIsLatch(Abc_Obj_t *pObj)
Definition: abc.h:356
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
#define Abc_NtkForEachLatch(pNtk, pObj, i)
Definition: abc.h:497
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
Vec_Ptr_t * vOnehots
Definition: abc.h:211
Definition: abc.h:92
Abc_Obj_t * pNext
Definition: abc.h:131
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
ABC_DLL Abc_Ntk_t* Abc_NtkConvertBlackboxes ( Abc_Ntk_t pNtk)

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

Synopsis [Extracts blackboxes by making them into additional PIs/POs.]

Description [The input netlist has not logic hierarchy. The resulting netlist has additional PIs/POs for each blackbox input/output.]

SideEffects []

SeeAlso []

Definition at line 598 of file abcHie.c.

599 {
600  Abc_Ntk_t * pNtkNew;
601  Abc_Obj_t * pObj, * pNet, * pFanin, * pTerm;
602  int i, k;
603 
604  assert( Abc_NtkIsNetlist(pNtk) );
605  assert( Abc_NtkWhiteboxNum(pNtk) == 0 );
606 
607  // start the network
608  pNtkNew = Abc_NtkAlloc( pNtk->ntkType, pNtk->ntkFunc, 1 );
609  // duplicate the name and the spec
610  pNtkNew->pName = Extra_UtilStrsav( pNtk->pName );
611  pNtkNew->pSpec = Extra_UtilStrsav( pNtk->pSpec );
612 
613  // clean the node copy fields
614  Abc_NtkCleanCopy( pNtk );
615 
616  // mark the nodes that should not be connected
617  Abc_NtkIncrementTravId( pNtk );
618  Abc_NtkForEachBlackbox( pNtk, pObj, i )
619  Abc_NodeSetTravIdCurrent( pObj );
620  Abc_NtkForEachCi( pNtk, pTerm, i )
621  Abc_NodeSetTravIdCurrent( pTerm );
622  Abc_NtkForEachCo( pNtk, pTerm, i )
623  Abc_NodeSetTravIdCurrent( pTerm );
624  // unmark PIs and LIs/LOs
625  Abc_NtkForEachPi( pNtk, pTerm, i )
626  Abc_NodeSetTravIdPrevious( pTerm );
627  Abc_NtkForEachLatchInput( pNtk, pTerm, i )
628  Abc_NodeSetTravIdPrevious( pTerm );
629  Abc_NtkForEachLatchOutput( pNtk, pTerm, i )
630  Abc_NodeSetTravIdPrevious( pTerm );
631  // copy the box outputs
632  Abc_NtkForEachBlackbox( pNtk, pObj, i )
633  Abc_ObjForEachFanout( pObj, pTerm, k )
634  pTerm->pCopy = Abc_NtkCreatePi( pNtkNew );
635 
636  // duplicate other objects
637  Abc_NtkForEachObj( pNtk, pObj, i )
638  if ( !Abc_NodeIsTravIdCurrent(pObj) )
639  Abc_NtkDupObj( pNtkNew, pObj, Abc_ObjIsNet(pObj) );
640 
641  // connect all objects
642  Abc_NtkForEachObj( pNtk, pObj, i )
643  if ( !Abc_NodeIsTravIdCurrent(pObj) )
644  Abc_ObjForEachFanin( pObj, pFanin, k )
645  Abc_ObjAddFanin( pObj->pCopy, pFanin->pCopy );
646 
647  // create unique PO for each net feeding into blackboxes or POs
648  Abc_NtkIncrementTravId( pNtk );
649  Abc_NtkForEachCo( pNtk, pTerm, i )
650  {
651  // skip latch inputs
652  assert( Abc_ObjFanoutNum(pTerm) <= 1 );
653  if ( Abc_ObjFanoutNum(pTerm) > 0 && Abc_ObjIsLatch(Abc_ObjFanout0(pTerm)) )
654  continue;
655  // check if the net is visited
656  pNet = Abc_ObjFanin0(pTerm);
657  if ( Abc_NodeIsTravIdCurrent(pNet) )
658  continue;
659  // create PO
660  Abc_NodeSetTravIdCurrent( pNet );
661  Abc_ObjAddFanin( Abc_NtkCreatePo(pNtkNew), pNet->pCopy );
662  }
663 
664  // check integrity
665  if ( !Abc_NtkCheck( pNtkNew ) )
666  {
667  fprintf( stdout, "Abc_NtkConvertBlackboxes(): Network check has failed.\n" );
668  Abc_NtkDelete( pNtkNew );
669  return NULL;
670  }
671  return pNtkNew;
672 }
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static int Abc_ObjIsLatch(Abc_Obj_t *pObj)
Definition: abc.h:356
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
#define Abc_NtkForEachLatchOutput(pNtk, pObj, i)
Definition: abc.h:503
static void Abc_NodeSetTravIdPrevious(Abc_Obj_t *p)
Definition: abc.h:410
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition: abcObj.c:337
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
static int Abc_NtkWhiteboxNum(Abc_Ntk_t *pNtk)
Definition: abc.h:295
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
char * Extra_UtilStrsav(const char *s)
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
ABC_DLL Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
Abc_Obj_t * pCopy
Definition: abc.h:148
#define Abc_NtkForEachBlackbox(pNtk, pObj, i)
Definition: abc.h:509
if(last==0)
Definition: sparse_int.h:34
static Abc_Obj_t * Abc_NtkCreatePi(Abc_Ntk_t *pNtk)
Definition: abc.h:303
char * pSpec
Definition: abc.h:159
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:411
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition: abc.h:526
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
#define Abc_NtkForEachLatchInput(pNtk, pObj, i)
Definition: abc.h:500
static int Abc_ObjIsNet(Abc_Obj_t *pObj)
Definition: abc.h:354
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:507
#define assert(ex)
Definition: util_old.h:213
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
static Abc_Obj_t * Abc_NtkCreatePo(Abc_Ntk_t *pNtk)
Definition: abc.h:304
char * pName
Definition: abc.h:158
Abc_NtkType_t ntkType
Definition: abc.h:156
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
static void Abc_NodeSetTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:409
ABC_DLL void Abc_NtkConvertDcLatches ( Abc_Ntk_t pNtk)

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

Synopsis [Converts registers with DC values into additional PIs.]

Description []

SideEffects []

SeeAlso []

Definition at line 314 of file abcLatch.c.

315 {
316  Abc_Obj_t * pCtrl, * pLatch, * pMux, * pPi;
318  int i, fFound = 0, Counter;
319  // check if there are latches with DC values
320  Abc_NtkForEachLatch( pNtk, pLatch, i )
321  if ( Abc_LatchIsInitDc(pLatch) )
322  {
323  fFound = 1;
324  break;
325  }
326  if ( !fFound )
327  return;
328  // add control latch
329  pCtrl = Abc_NtkAddLatch( pNtk, Abc_NtkCreateNodeConst1(pNtk), Init );
330  // add fanouts for each latch with DC values
331  Counter = 0;
332  Abc_NtkForEachLatch( pNtk, pLatch, i )
333  {
334  if ( !Abc_LatchIsInitDc(pLatch) )
335  continue;
336  // change latch value
337  pLatch->pData = (void *)Init;
338  // if the latch output has the same name as a PO, rename it
339  if ( Abc_NodeFindCoFanout( Abc_ObjFanout0(pLatch) ) )
340  {
341  Nm_ManDeleteIdName( pLatch->pNtk->pManName, Abc_ObjFanout0(pLatch)->Id );
342  Abc_ObjAssignName( Abc_ObjFanout0(pLatch), Abc_ObjName(pLatch), "_lo" );
343  }
344  // create new PIs
345  pPi = Abc_NtkCreatePi( pNtk );
346  Abc_ObjAssignName( pPi, Abc_ObjName(pLatch), "_pi" );
347  // create a new node and transfer fanout from latch output to the new node
348  pMux = Abc_NtkCreateNode( pNtk );
349  Abc_ObjTransferFanout( Abc_ObjFanout0(pLatch), pMux );
350  // convert the node into a mux
351  Abc_NtkNodeConvertToMux( pNtk, pCtrl, Abc_ObjFanout0(pLatch), pPi, pMux );
352  Counter++;
353  }
354  printf( "The number of converted latches with DC values = %d.\n", Counter );
355 }
Abc_Obj_t * Abc_NtkAddLatch(Abc_Ntk_t *pNtk, Abc_Obj_t *pDriver, Abc_InitType_t Init)
Definition: abcLatch.c:260
void Nm_ManDeleteIdName(Nm_Man_t *p, int ObjId)
Definition: nmApi.c:149
Nm_Man_t * pManName
Definition: abc.h:160
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeConst1(Abc_Ntk_t *pNtk)
Definition: abcObj.c:633
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition: abcNames.c:68
void Abc_NtkNodeConvertToMux(Abc_Ntk_t *pNtk, Abc_Obj_t *pNodeC, Abc_Obj_t *pNode1, Abc_Obj_t *pNode0, Abc_Obj_t *pMux)
Definition: abcLatch.c:287
static int Abc_LatchIsInitDc(Abc_Obj_t *pLatch)
Definition: abc.h:424
if(last==0)
Definition: sparse_int.h:34
static int Counter
#define Abc_NtkForEachLatch(pNtk, pObj, i)
Definition: abc.h:497
static Abc_Obj_t * Abc_NtkCreatePi(Abc_Ntk_t *pNtk)
Definition: abc.h:303
ABC_DLL void Abc_ObjTransferFanout(Abc_Obj_t *pObjOld, Abc_Obj_t *pObjNew)
Definition: abcFanio.c:264
Abc_Ntk_t * pNtk
Definition: abc.h:130
ABC_DLL Abc_Obj_t * Abc_NodeFindCoFanout(Abc_Obj_t *pNode)
Definition: abcUtil.c:779
Abc_InitType_t
Definition: abc.h:102
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
static Abc_Obj_t * Abc_NtkCreateNode(Abc_Ntk_t *pNtk)
Definition: abc.h:308
void * pData
Definition: abc.h:145
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371
ABC_DLL int Abc_NtkConvertToBlifMv ( Abc_Ntk_t pNtk)

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

Synopsis [Converts SOP netlist into BLIF-MV netlist.]

Description []

SideEffects []

SeeAlso []

Definition at line 954 of file abcBlifMv.c.

955 {
956  Mem_Flex_t * pMmFlex;
957  Abc_Obj_t * pNode;
958  Vec_Str_t * vCube;
959  char * pSop0, * pSop1, * pBlifMv, * pCube, * pCur;
960  int Value, nCubes, nSize, i, k;
961 
962  assert( Abc_NtkIsNetlist(pNtk) );
963  if ( !Abc_NtkToBdd(pNtk) )
964  {
965  printf( "Converting logic functions to BDDs has failed.\n" );
966  return 0;
967  }
968 
969  pMmFlex = Mem_FlexStart();
970  vCube = Vec_StrAlloc( 100 );
971  Abc_NtkForEachNode( pNtk, pNode, i )
972  {
973  // convert BDD into cubes for on-set and off-set
974  Abc_NodeBddToCnf( pNode, pMmFlex, vCube, 0, &pSop0, &pSop1 );
975  // allocate room for the MV-SOP
976  nCubes = Abc_SopGetCubeNum(pSop0) + Abc_SopGetCubeNum(pSop1);
977  nSize = nCubes*(2*Abc_ObjFaninNum(pNode) + 2)+1;
978  pBlifMv = Mem_FlexEntryFetch( pMmFlex, nSize );
979  // add the cubes
980  pCur = pBlifMv;
981  Abc_SopForEachCube( pSop0, Abc_ObjFaninNum(pNode), pCube )
982  {
983  Abc_CubeForEachVar( pCube, Value, k )
984  {
985  *pCur++ = Value;
986  *pCur++ = ' ';
987  }
988  *pCur++ = '0';
989  *pCur++ = '\n';
990  }
991  Abc_SopForEachCube( pSop1, Abc_ObjFaninNum(pNode), pCube )
992  {
993  Abc_CubeForEachVar( pCube, Value, k )
994  {
995  *pCur++ = Value;
996  *pCur++ = ' ';
997  }
998  *pCur++ = '1';
999  *pCur++ = '\n';
1000  }
1001  *pCur++ = 0;
1002  assert( pCur - pBlifMv == nSize );
1003  // update the node representation
1004  Cudd_RecursiveDeref( (DdManager *)pNtk->pManFunc, (DdNode *)pNode->pData );
1005  pNode->pData = pBlifMv;
1006  }
1007 
1008  // update the functionality type
1009  pNtk->ntkFunc = ABC_FUNC_BLIFMV;
1010  Cudd_Quit( (DdManager *)pNtk->pManFunc );
1011  pNtk->pManFunc = pMmFlex;
1012 
1013  Vec_StrFree( vCube );
1014  return 1;
1015 }
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
Definition: cudd.h:278
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
#define Abc_SopForEachCube(pSop, nFanins, pCube)
Definition: abc.h:531
ABC_DLL int Abc_SopGetCubeNum(char *pSop)
Definition: abcSop.c:489
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static Vec_Str_t * Vec_StrAlloc(int nCap)
Definition: bblif.c:495
#define Abc_CubeForEachVar(pCube, Value, i)
Definition: abc.h:529
char * Mem_FlexEntryFetch(Mem_Flex_t *p, int nBytes)
Definition: mem.c:372
void * pManFunc
Definition: abc.h:191
Mem_Flex_t * Mem_FlexStart()
Definition: mem.c:311
static void Vec_StrFree(Vec_Str_t *p)
Definition: bblif.c:616
ABC_DLL int Abc_NtkToBdd(Abc_Ntk_t *pNtk)
Definition: abcFunc.c:1160
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
ABC_DLL void Abc_NodeBddToCnf(Abc_Obj_t *pNode, Mem_Flex_t *pMmMan, Vec_Str_t *vCube, int fAllPrimes, char **ppSop0, char **ppSop1)
Definition: abcFunc.c:490
#define assert(ex)
Definition: util_old.h:213
void Cudd_Quit(DdManager *unique)
Definition: cuddInit.c:225
void * pData
Definition: abc.h:145
ABC_DLL int Abc_NtkCountCopy ( Abc_Ntk_t pNtk)

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

Synopsis [Counts the number of nodes having non-trivial copies.]

Description []

SideEffects []

SeeAlso []

Definition at line 572 of file abcUtil.c.

573 {
574  Abc_Obj_t * pObj;
575  int i, Counter = 0;
576  Abc_NtkForEachObj( pNtk, pObj, i )
577  {
578  if ( Abc_ObjIsNode(pObj) )
579  Counter += (pObj->pCopy != NULL);
580  }
581  return Counter;
582 }
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
Abc_Obj_t * pCopy
Definition: abc.h:148
static int Counter
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
ABC_DLL int Abc_NtkCountSelfFeedLatches ( Abc_Ntk_t pNtk)

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

Synopsis [Checks if latches form self-loop.]

Description []

SideEffects []

SeeAlso []

Definition at line 89 of file abcLatch.c.

90 {
91  Abc_Obj_t * pLatch;
92  int i, Counter;
93  Counter = 0;
94  Abc_NtkForEachLatch( pNtk, pLatch, i )
95  {
96 // if ( Abc_NtkLatchIsSelfFeed(pLatch) && Abc_ObjFanoutNum(pLatch) > 1 )
97 // printf( "Fanouts = %d.\n", Abc_ObjFanoutNum(pLatch) );
98  Counter += Abc_NtkLatchIsSelfFeed( pLatch );
99  }
100  return Counter;
101 }
static int Counter
#define Abc_NtkForEachLatch(pNtk, pObj, i)
Definition: abc.h:497
int Abc_NtkLatchIsSelfFeed(Abc_Obj_t *pLatch)
Definition: abcLatch.c:68
static Abc_Obj_t* Abc_NtkCreateBi ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 305 of file abc.h.

305 { return Abc_NtkCreateObj( pNtk, ABC_OBJ_BI ); }
Definition: abc.h:91
ABC_DLL Abc_Obj_t * Abc_NtkCreateObj(Abc_Ntk_t *pNtk, Abc_ObjType_t Type)
Definition: abcObj.c:106
static Abc_Obj_t* Abc_NtkCreateBlackbox ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 311 of file abc.h.

311 { return Abc_NtkCreateObj( pNtk, ABC_OBJ_BLACKBOX ); }
ABC_DLL Abc_Obj_t * Abc_NtkCreateObj(Abc_Ntk_t *pNtk, Abc_ObjType_t Type)
Definition: abcObj.c:106
static Abc_Obj_t* Abc_NtkCreateBo ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 306 of file abc.h.

306 { return Abc_NtkCreateObj( pNtk, ABC_OBJ_BO ); }
ABC_DLL Abc_Obj_t * Abc_NtkCreateObj(Abc_Ntk_t *pNtk, Abc_ObjType_t Type)
Definition: abcObj.c:106
Definition: abc.h:92
ABC_DLL Abc_Ntk_t* Abc_NtkCreateCone ( Abc_Ntk_t pNtk,
Abc_Obj_t pNode,
char *  pNodeName,
int  fUseAllCis 
)

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

Synopsis [Creates the network composed of one logic cone.]

Description []

SideEffects []

SeeAlso []

Definition at line 819 of file abcNtk.c.

820 {
821  Abc_Ntk_t * pNtkNew;
822  Vec_Ptr_t * vNodes;
823  Abc_Obj_t * pObj, * pFanin, * pNodeCoNew;
824  char Buffer[1000];
825  int i, k;
826 
827  assert( Abc_NtkIsLogic(pNtk) || Abc_NtkIsStrash(pNtk) );
828  assert( Abc_ObjIsNode(pNode) || (Abc_NtkIsStrash(pNtk) && (Abc_AigNodeIsConst(pNode) || Abc_ObjIsCi(pNode))) );
829 
830  // start the network
831  pNtkNew = Abc_NtkAlloc( pNtk->ntkType, pNtk->ntkFunc, 1 );
832  // set the name
833  sprintf( Buffer, "%s_%s", pNtk->pName, pNodeName );
834  pNtkNew->pName = Extra_UtilStrsav(Buffer);
835 
836  // establish connection between the constant nodes
837  if ( Abc_NtkIsStrash(pNtk) )
838  Abc_AigConst1(pNtk)->pCopy = Abc_AigConst1(pNtkNew);
839 
840  // collect the nodes in the TFI of the output (mark the TFI)
841  vNodes = Abc_NtkDfsNodes( pNtk, &pNode, 1 );
842  // create the PIs
843  Abc_NtkForEachCi( pNtk, pObj, i )
844  {
845  if ( fUseAllCis || Abc_NodeIsTravIdCurrent(pObj) ) // TravId is set by DFS
846  {
847  pObj->pCopy = Abc_NtkCreatePi(pNtkNew);
848  Abc_ObjAssignName( pObj->pCopy, Abc_ObjName(pObj), NULL );
849  }
850  }
851  // add the PO corresponding to this output
852  pNodeCoNew = Abc_NtkCreatePo( pNtkNew );
853  Abc_ObjAssignName( pNodeCoNew, pNodeName, NULL );
854  // copy the nodes
855  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
856  {
857  // if it is an AIG, add to the hash table
858  if ( Abc_NtkIsStrash(pNtk) )
859  {
860  pObj->pCopy = Abc_AigAnd( (Abc_Aig_t *)pNtkNew->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild1Copy(pObj) );
861  }
862  else
863  {
864  Abc_NtkDupObj( pNtkNew, pObj, 0 );
865  Abc_ObjForEachFanin( pObj, pFanin, k )
866  Abc_ObjAddFanin( pObj->pCopy, pFanin->pCopy );
867  }
868  }
869  // connect the internal nodes to the new CO
870  Abc_ObjAddFanin( pNodeCoNew, pNode->pCopy );
871  Vec_PtrFree( vNodes );
872 
873  if ( !Abc_NtkCheck( pNtkNew ) )
874  fprintf( stdout, "Abc_NtkCreateCone(): Network check has failed.\n" );
875  return pNtkNew;
876 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
Definition: abc.h:351
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
static Abc_Obj_t * Abc_ObjChild1Copy(Abc_Obj_t *pObj)
Definition: abc.h:387
Abc_Ntk_t * Abc_NtkCreateCone(Abc_Ntk_t *pNtk, Abc_Obj_t *pNode, char *pNodeName, int fUseAllCis)
Definition: abcNtk.c:819
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition: abcObj.c:337
static int Abc_AigNodeIsConst(Abc_Obj_t *pNode)
Definition: abc.h:396
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition: abcNames.c:68
DECLARATIONS ///.
Definition: abcAig.c:52
char * Extra_UtilStrsav(const char *s)
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
static void check(int expr)
Definition: satSolver.c:46
void * pManFunc
Definition: abc.h:191
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:700
static Abc_Obj_t * Abc_ObjChild0Copy(Abc_Obj_t *pObj)
Definition: abc.h:386
Abc_Obj_t * pCopy
Definition: abc.h:148
if(last==0)
Definition: sparse_int.h:34
char * sprintf()
static Abc_Obj_t * Abc_NtkCreatePi(Abc_Ntk_t *pNtk)
Definition: abc.h:303
ABC_NAMESPACE_IMPL_START Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:411
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
#define assert(ex)
Definition: util_old.h:213
ABC_DLL Vec_Ptr_t * Abc_NtkDfsNodes(Abc_Ntk_t *pNtk, Abc_Obj_t **ppNodes, int nNodes)
Definition: abcDfs.c:120
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static Abc_Obj_t * Abc_NtkCreatePo(Abc_Ntk_t *pNtk)
Definition: abc.h:304
char * pName
Definition: abc.h:158
Abc_NtkType_t ntkType
Definition: abc.h:156
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL Abc_Ntk_t* Abc_NtkCreateConeArray ( Abc_Ntk_t pNtk,
Vec_Ptr_t vRoots,
int  fUseAllCis 
)

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

Synopsis [Creates the network composed of several logic cones.]

Description []

SideEffects []

SeeAlso []

Definition at line 889 of file abcNtk.c.

890 {
891  Abc_Ntk_t * pNtkNew;
892  Vec_Ptr_t * vNodes;
893  Abc_Obj_t * pObj, * pFanin, * pNodeCoNew;
894  char Buffer[1000];
895  int i, k;
896 
897  assert( Abc_NtkIsLogic(pNtk) || Abc_NtkIsStrash(pNtk) );
898 
899  // start the network
900  pNtkNew = Abc_NtkAlloc( pNtk->ntkType, pNtk->ntkFunc, 1 );
901  // set the name
902  sprintf( Buffer, "%s_part", pNtk->pName );
903  pNtkNew->pName = Extra_UtilStrsav(Buffer);
904 
905  // establish connection between the constant nodes
906  if ( Abc_NtkIsStrash(pNtk) )
907  Abc_AigConst1(pNtk)->pCopy = Abc_AigConst1(pNtkNew);
908 
909  // collect the nodes in the TFI of the output (mark the TFI)
910  vNodes = Abc_NtkDfsNodes( pNtk, (Abc_Obj_t **)Vec_PtrArray(vRoots), Vec_PtrSize(vRoots) );
911 
912  // create the PIs
913  Abc_NtkForEachCi( pNtk, pObj, i )
914  {
915  if ( fUseAllCis || Abc_NodeIsTravIdCurrent(pObj) ) // TravId is set by DFS
916  {
917  pObj->pCopy = Abc_NtkCreatePi(pNtkNew);
918  Abc_ObjAssignName( pObj->pCopy, Abc_ObjName(pObj), NULL );
919  }
920  }
921 
922  // copy the nodes
923  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
924  {
925  // if it is an AIG, add to the hash table
926  if ( Abc_NtkIsStrash(pNtk) )
927  {
928  pObj->pCopy = Abc_AigAnd( (Abc_Aig_t *)pNtkNew->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild1Copy(pObj) );
929  }
930  else
931  {
932  Abc_NtkDupObj( pNtkNew, pObj, 0 );
933  Abc_ObjForEachFanin( pObj, pFanin, k )
934  Abc_ObjAddFanin( pObj->pCopy, pFanin->pCopy );
935  }
936  }
937  Vec_PtrFree( vNodes );
938 
939  // add the POs corresponding to the root nodes
940  Vec_PtrForEachEntry( Abc_Obj_t *, vRoots, pObj, i )
941  {
942  // create the PO node
943  pNodeCoNew = Abc_NtkCreatePo( pNtkNew );
944  // connect the internal nodes to the new CO
945  if ( Abc_ObjIsCo(pObj) )
946  Abc_ObjAddFanin( pNodeCoNew, Abc_ObjChild0Copy(pObj) );
947  else
948  Abc_ObjAddFanin( pNodeCoNew, pObj->pCopy );
949  // assign the name
950  Abc_ObjAssignName( pNodeCoNew, Abc_ObjName(pObj), NULL );
951  }
952 
953  if ( !Abc_NtkCheck( pNtkNew ) )
954  fprintf( stdout, "Abc_NtkCreateConeArray(): Network check has failed.\n" );
955  return pNtkNew;
956 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
static Abc_Obj_t * Abc_ObjChild1Copy(Abc_Obj_t *pObj)
Definition: abc.h:387
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition: abcObj.c:337
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition: abcNames.c:68
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
DECLARATIONS ///.
Definition: abcAig.c:52
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
Definition: abc.h:352
char * Extra_UtilStrsav(const char *s)
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
void * pManFunc
Definition: abc.h:191
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:700
static Abc_Obj_t * Abc_ObjChild0Copy(Abc_Obj_t *pObj)
Definition: abc.h:386
Abc_Obj_t * pCopy
Definition: abc.h:148
char * sprintf()
static Abc_Obj_t * Abc_NtkCreatePi(Abc_Ntk_t *pNtk)
Definition: abc.h:303
ABC_NAMESPACE_IMPL_START Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:411
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
#define assert(ex)
Definition: util_old.h:213
ABC_DLL Vec_Ptr_t * Abc_NtkDfsNodes(Abc_Ntk_t *pNtk, Abc_Obj_t **ppNodes, int nNodes)
Definition: abcDfs.c:120
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static Abc_Obj_t * Abc_NtkCreatePo(Abc_Ntk_t *pNtk)
Definition: abc.h:304
static void ** Vec_PtrArray(Vec_Ptr_t *p)
Definition: vecPtr.h:279
char * pName
Definition: abc.h:158
Abc_NtkType_t ntkType
Definition: abc.h:156
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL Abc_Ntk_t* Abc_NtkCreateFromNode ( Abc_Ntk_t pNtk,
Abc_Obj_t pNode 
)

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

Synopsis [Creates the network composed of one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 1154 of file abcNtk.c.

1155 {
1156  Abc_Ntk_t * pNtkNew;
1157  Abc_Obj_t * pFanin, * pNodePo;
1158  int i;
1159  // start the network
1160  pNtkNew = Abc_NtkAlloc( pNtk->ntkType, pNtk->ntkFunc, 1 );
1161  pNtkNew->pName = Extra_UtilStrsav(Abc_ObjName(pNode));
1162  // add the PIs corresponding to the fanins of the node
1163  Abc_ObjForEachFanin( pNode, pFanin, i )
1164  {
1165  pFanin->pCopy = Abc_NtkCreatePi( pNtkNew );
1166  Abc_ObjAssignName( pFanin->pCopy, Abc_ObjName(pFanin), NULL );
1167  }
1168  // duplicate and connect the node
1169  pNode->pCopy = Abc_NtkDupObj( pNtkNew, pNode, 0 );
1170  Abc_ObjForEachFanin( pNode, pFanin, i )
1171  Abc_ObjAddFanin( pNode->pCopy, pFanin->pCopy );
1172  // create the only PO
1173  pNodePo = Abc_NtkCreatePo( pNtkNew );
1174  Abc_ObjAddFanin( pNodePo, pNode->pCopy );
1175  Abc_ObjAssignName( pNodePo, Abc_ObjName(pNode), NULL );
1176  if ( !Abc_NtkCheck( pNtkNew ) )
1177  fprintf( stdout, "Abc_NtkCreateFromNode(): Network check has failed.\n" );
1178  return pNtkNew;
1179 }
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition: abcObj.c:337
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition: abcNames.c:68
Abc_Ntk_t * Abc_NtkCreateFromNode(Abc_Ntk_t *pNtk, Abc_Obj_t *pNode)
Definition: abcNtk.c:1154
char * Extra_UtilStrsav(const char *s)
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
static void check(int expr)
Definition: satSolver.c:46
Abc_Obj_t * pCopy
Definition: abc.h:148
if(last==0)
Definition: sparse_int.h:34
static Abc_Obj_t * Abc_NtkCreatePi(Abc_Ntk_t *pNtk)
Definition: abc.h:303
ABC_NAMESPACE_IMPL_START Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
static Abc_Obj_t * Abc_NtkCreatePo(Abc_Ntk_t *pNtk)
Definition: abc.h:304
char * pName
Definition: abc.h:158
Abc_NtkType_t ntkType
Definition: abc.h:156
static Abc_Obj_t* Abc_NtkCreateLatch ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 309 of file abc.h.

309 { return Abc_NtkCreateObj( pNtk, ABC_OBJ_LATCH ); }
ABC_DLL Abc_Obj_t * Abc_NtkCreateObj(Abc_Ntk_t *pNtk, Abc_ObjType_t Type)
Definition: abcObj.c:106
ABC_DLL Abc_Ntk_t* Abc_NtkCreateMffc ( Abc_Ntk_t pNtk,
Abc_Obj_t pNode,
char *  pNodeName 
)

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

Synopsis [Creates the network composed of MFFC of one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 1022 of file abcNtk.c.

1023 {
1024  Abc_Ntk_t * pNtkNew;
1025  Abc_Obj_t * pObj, * pFanin, * pNodeCoNew;
1026  Vec_Ptr_t * vCone, * vSupp;
1027  char Buffer[1000];
1028  int i, k;
1029 
1030  assert( Abc_NtkIsLogic(pNtk) || Abc_NtkIsStrash(pNtk) );
1031  assert( Abc_ObjIsNode(pNode) );
1032 
1033  // start the network
1034  pNtkNew = Abc_NtkAlloc( pNtk->ntkType, pNtk->ntkFunc, 1 );
1035  // set the name
1036  sprintf( Buffer, "%s_%s", pNtk->pName, pNodeName );
1037  pNtkNew->pName = Extra_UtilStrsav(Buffer);
1038 
1039  // establish connection between the constant nodes
1040  if ( Abc_NtkIsStrash(pNtk) )
1041  Abc_AigConst1(pNtk)->pCopy = Abc_AigConst1(pNtkNew);
1042 
1043  // collect the nodes in MFFC
1044  vCone = Vec_PtrAlloc( 100 );
1045  vSupp = Vec_PtrAlloc( 100 );
1046  Abc_NodeDeref_rec( pNode );
1047  Abc_NodeMffcConeSupp( pNode, vCone, vSupp );
1048  Abc_NodeRef_rec( pNode );
1049  // create the PIs
1050  Vec_PtrForEachEntry( Abc_Obj_t *, vSupp, pObj, i )
1051  {
1052  pObj->pCopy = Abc_NtkCreatePi(pNtkNew);
1053  Abc_ObjAssignName( pObj->pCopy, Abc_ObjName(pObj), NULL );
1054  }
1055  // create the PO
1056  pNodeCoNew = Abc_NtkCreatePo( pNtkNew );
1057  Abc_ObjAssignName( pNodeCoNew, pNodeName, NULL );
1058  // copy the nodes
1059  Vec_PtrForEachEntry( Abc_Obj_t *, vCone, pObj, i )
1060  {
1061  // if it is an AIG, add to the hash table
1062  if ( Abc_NtkIsStrash(pNtk) )
1063  {
1064  pObj->pCopy = Abc_AigAnd( (Abc_Aig_t *)pNtkNew->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild1Copy(pObj) );
1065  }
1066  else
1067  {
1068  Abc_NtkDupObj( pNtkNew, pObj, 0 );
1069  Abc_ObjForEachFanin( pObj, pFanin, k )
1070  Abc_ObjAddFanin( pObj->pCopy, pFanin->pCopy );
1071  }
1072  }
1073  // connect the topmost node
1074  Abc_ObjAddFanin( pNodeCoNew, pNode->pCopy );
1075  Vec_PtrFree( vCone );
1076  Vec_PtrFree( vSupp );
1077 
1078  if ( !Abc_NtkCheck( pNtkNew ) )
1079  fprintf( stdout, "Abc_NtkCreateMffc(): Network check has failed.\n" );
1080  return pNtkNew;
1081 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
static Abc_Obj_t * Abc_ObjChild1Copy(Abc_Obj_t *pObj)
Definition: abc.h:387
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition: abcObj.c:337
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition: abcNames.c:68
ABC_DLL int Abc_NodeRef_rec(Abc_Obj_t *pNode)
Definition: abcRefs.c:241
DECLARATIONS ///.
Definition: abcAig.c:52
char * Extra_UtilStrsav(const char *s)
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
static void check(int expr)
Definition: satSolver.c:46
void * pManFunc
Definition: abc.h:191
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:700
static Abc_Obj_t * Abc_ObjChild0Copy(Abc_Obj_t *pObj)
Definition: abc.h:386
Abc_Obj_t * pCopy
Definition: abc.h:148
Abc_Ntk_t * Abc_NtkCreateMffc(Abc_Ntk_t *pNtk, Abc_Obj_t *pNode, char *pNodeName)
Definition: abcNtk.c:1022
if(last==0)
Definition: sparse_int.h:34
ABC_DLL void Abc_NodeMffcConeSupp(Abc_Obj_t *pNode, Vec_Ptr_t *vCone, Vec_Ptr_t *vSupp)
Definition: abcRefs.c:299
char * sprintf()
static Abc_Obj_t * Abc_NtkCreatePi(Abc_Ntk_t *pNtk)
Definition: abc.h:303
ABC_NAMESPACE_IMPL_START Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
ABC_DLL int Abc_NodeDeref_rec(Abc_Obj_t *pNode)
Definition: abcRefs.c:215
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static Abc_Obj_t * Abc_NtkCreatePo(Abc_Ntk_t *pNtk)
Definition: abc.h:304
char * pName
Definition: abc.h:158
Abc_NtkType_t ntkType
Definition: abc.h:156
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
static Abc_Obj_t* Abc_NtkCreateNet ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 307 of file abc.h.

307 { return Abc_NtkCreateObj( pNtk, ABC_OBJ_NET ); }
ABC_DLL Abc_Obj_t * Abc_NtkCreateObj(Abc_Ntk_t *pNtk, Abc_ObjType_t Type)
Definition: abcObj.c:106
static Abc_Obj_t* Abc_NtkCreateNode ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 308 of file abc.h.

308 { return Abc_NtkCreateObj( pNtk, ABC_OBJ_NODE ); }
ABC_DLL Abc_Obj_t * Abc_NtkCreateObj(Abc_Ntk_t *pNtk, Abc_ObjType_t Type)
Definition: abcObj.c:106
ABC_DLL Abc_Obj_t* Abc_NtkCreateNodeAnd ( Abc_Ntk_t pNtk,
Vec_Ptr_t vFanins 
)

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

Synopsis [Creates AND.]

Description []

SideEffects []

SeeAlso []

Definition at line 722 of file abcObj.c.

723 {
724  Abc_Obj_t * pNode;
725  int i;
726  assert( Abc_NtkIsLogic(pNtk) || Abc_NtkIsNetlist(pNtk) );
727  pNode = Abc_NtkCreateNode( pNtk );
728  for ( i = 0; i < vFanins->nSize; i++ )
729  Abc_ObjAddFanin( pNode, (Abc_Obj_t *)vFanins->pArray[i] );
730  if ( Abc_NtkHasSop(pNtk) )
731  pNode->pData = Abc_SopCreateAnd( (Mem_Flex_t *)pNtk->pManFunc, Vec_PtrSize(vFanins), NULL );
732  else if ( Abc_NtkHasBdd(pNtk) )
733  pNode->pData = Extra_bddCreateAnd( (DdManager *)pNtk->pManFunc, Vec_PtrSize(vFanins) ), Cudd_Ref((DdNode *)pNode->pData);
734  else if ( Abc_NtkHasAig(pNtk) )
735  pNode->pData = Hop_CreateAnd( (Hop_Man_t *)pNtk->pManFunc, Vec_PtrSize(vFanins) );
736  else
737  assert( 0 );
738  return pNode;
739 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
Definition: cudd.h:278
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
ABC_DLL char * Abc_SopCreateAnd(Mem_Flex_t *pMan, int nVars, int *pfCompl)
Definition: abcSop.c:162
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
void * pManFunc
Definition: abc.h:191
Hop_Obj_t * Hop_CreateAnd(Hop_Man_t *p, int nVars)
Definition: hopOper.c:320
DdNode * Extra_bddCreateAnd(DdManager *dd, int nVars)
Definition: extraBddMisc.c:858
static Abc_Obj_t * Abc_NtkCreateNode(Abc_Ntk_t *pNtk)
Definition: abc.h:308
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
void * pData
Definition: abc.h:145
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
ABC_DLL Abc_Obj_t* Abc_NtkCreateNodeBuf ( Abc_Ntk_t pNtk,
Abc_Obj_t pFanin 
)

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

Synopsis [Creates buffer.]

Description []

SideEffects []

SeeAlso []

Definition at line 692 of file abcObj.c.

693 {
694  Abc_Obj_t * pNode;
695  assert( Abc_NtkIsLogic(pNtk) || Abc_NtkIsNetlist(pNtk) );
696  pNode = Abc_NtkCreateNode( pNtk );
697  if ( pFanin ) Abc_ObjAddFanin( pNode, pFanin );
698  if ( Abc_NtkHasSop(pNtk) )
699  pNode->pData = Abc_SopRegister( (Mem_Flex_t *)pNtk->pManFunc, "1 1\n" );
700  else if ( Abc_NtkHasBdd(pNtk) )
701  pNode->pData = Cudd_bddIthVar((DdManager *)pNtk->pManFunc,0), Cudd_Ref( (DdNode *)pNode->pData );
702  else if ( Abc_NtkHasAig(pNtk) )
703  pNode->pData = Hop_IthVar((Hop_Man_t *)pNtk->pManFunc,0);
704  else if ( Abc_NtkHasMapping(pNtk) )
706  else
707  assert( 0 );
708  return pNode;
709 }
Mio_Gate_t * Mio_LibraryReadBuf(Mio_Library_t *pLib)
Definition: mioApi.c:47
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
ABC_DLL void * Abc_FrameReadLibGen()
Definition: mainFrame.c:56
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
Definition: cudd.h:278
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
void * pManFunc
Definition: abc.h:191
ABC_DLL char * Abc_SopRegister(Mem_Flex_t *pMan, char *pName)
DECLARATIONS ///.
Definition: abcSop.c:56
STRUCTURE DEFINITIONS ///.
Definition: mioInt.h:61
DdNode * Cudd_bddIthVar(DdManager *dd, int i)
Definition: cuddAPI.c:416
static Abc_Obj_t * Abc_NtkCreateNode(Abc_Ntk_t *pNtk)
Definition: abc.h:308
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
void * pData
Definition: abc.h:145
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
Hop_Obj_t * Hop_IthVar(Hop_Man_t *p, int i)
FUNCTION DEFINITIONS ///.
Definition: hopOper.c:63
ABC_DLL Abc_Obj_t* Abc_NtkCreateNodeConst0 ( Abc_Ntk_t pNtk)

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

Synopsis [Creates constant 0 node.]

Description []

SideEffects []

SeeAlso []

Definition at line 604 of file abcObj.c.

605 {
606  Abc_Obj_t * pNode;
607  assert( Abc_NtkIsLogic(pNtk) || Abc_NtkIsNetlist(pNtk) );
608  pNode = Abc_NtkCreateNode( pNtk );
609  if ( Abc_NtkHasSop(pNtk) || Abc_NtkHasBlifMv(pNtk) )
610  pNode->pData = Abc_SopRegister( (Mem_Flex_t *)pNtk->pManFunc, " 0\n" );
611  else if ( Abc_NtkHasBdd(pNtk) )
612  pNode->pData = Cudd_ReadLogicZero((DdManager *)pNtk->pManFunc), Cudd_Ref( (DdNode *)pNode->pData );
613  else if ( Abc_NtkHasAig(pNtk) )
614  pNode->pData = Hop_ManConst0((Hop_Man_t *)pNtk->pManFunc);
615  else if ( Abc_NtkHasMapping(pNtk) )
617  else if ( !Abc_NtkHasBlackbox(pNtk) )
618  assert( 0 );
619  return pNode;
620 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
ABC_DLL void * Abc_FrameReadLibGen()
Definition: mainFrame.c:56
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
Definition: cudd.h:278
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
DdNode * Cudd_ReadLogicZero(DdManager *dd)
Definition: cuddAPI.c:1058
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
static int Abc_NtkHasBlifMv(Abc_Ntk_t *pNtk)
Definition: abc.h:257
void * pManFunc
Definition: abc.h:191
ABC_DLL char * Abc_SopRegister(Mem_Flex_t *pMan, char *pName)
DECLARATIONS ///.
Definition: abcSop.c:56
static int Abc_NtkHasBlackbox(Abc_Ntk_t *pNtk)
Definition: abc.h:258
STRUCTURE DEFINITIONS ///.
Definition: mioInt.h:61
static Abc_Obj_t * Abc_NtkCreateNode(Abc_Ntk_t *pNtk)
Definition: abc.h:308
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
static Hop_Obj_t * Hop_ManConst0(Hop_Man_t *p)
Definition: hop.h:131
void * pData
Definition: abc.h:145
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
Mio_Gate_t * Mio_LibraryReadConst0(Mio_Library_t *pLib)
Definition: mioApi.c:49
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
ABC_DLL Abc_Obj_t* Abc_NtkCreateNodeConst1 ( Abc_Ntk_t pNtk)

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

Synopsis [Creates constant 1 node.]

Description []

SideEffects []

SeeAlso []

Definition at line 633 of file abcObj.c.

634 {
635  Abc_Obj_t * pNode;
636  assert( Abc_NtkIsLogic(pNtk) || Abc_NtkIsNetlist(pNtk) );
637  pNode = Abc_NtkCreateNode( pNtk );
638  if ( Abc_NtkHasSop(pNtk) || Abc_NtkHasBlifMv(pNtk) )
639  pNode->pData = Abc_SopRegister( (Mem_Flex_t *)pNtk->pManFunc, " 1\n" );
640  else if ( Abc_NtkHasBdd(pNtk) )
641  pNode->pData = Cudd_ReadOne((DdManager *)pNtk->pManFunc), Cudd_Ref( (DdNode *)pNode->pData );
642  else if ( Abc_NtkHasAig(pNtk) )
643  pNode->pData = Hop_ManConst1((Hop_Man_t *)pNtk->pManFunc);
644  else if ( Abc_NtkHasMapping(pNtk) )
646  else if ( !Abc_NtkHasBlackbox(pNtk) )
647  assert( 0 );
648  return pNode;
649 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
ABC_DLL void * Abc_FrameReadLibGen()
Definition: mainFrame.c:56
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
Definition: cudd.h:278
static Hop_Obj_t * Hop_ManConst1(Hop_Man_t *p)
Definition: hop.h:132
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
static int Abc_NtkHasBlifMv(Abc_Ntk_t *pNtk)
Definition: abc.h:257
Mio_Gate_t * Mio_LibraryReadConst1(Mio_Library_t *pLib)
Definition: mioApi.c:50
void * pManFunc
Definition: abc.h:191
ABC_DLL char * Abc_SopRegister(Mem_Flex_t *pMan, char *pName)
DECLARATIONS ///.
Definition: abcSop.c:56
static int Abc_NtkHasBlackbox(Abc_Ntk_t *pNtk)
Definition: abc.h:258
STRUCTURE DEFINITIONS ///.
Definition: mioInt.h:61
DdNode * Cudd_ReadOne(DdManager *dd)
Definition: cuddAPI.c:987
static Abc_Obj_t * Abc_NtkCreateNode(Abc_Ntk_t *pNtk)
Definition: abc.h:308
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
void * pData
Definition: abc.h:145
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
ABC_DLL Abc_Obj_t* Abc_NtkCreateNodeExor ( Abc_Ntk_t pNtk,
Vec_Ptr_t vFanins 
)

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

Synopsis [Creates EXOR.]

Description []

SideEffects []

SeeAlso []

Definition at line 782 of file abcObj.c.

783 {
784  Abc_Obj_t * pNode;
785  int i;
786  assert( Abc_NtkIsLogic(pNtk) || Abc_NtkIsNetlist(pNtk) );
787  pNode = Abc_NtkCreateNode( pNtk );
788  for ( i = 0; i < vFanins->nSize; i++ )
789  Abc_ObjAddFanin( pNode, (Abc_Obj_t *)vFanins->pArray[i] );
790  if ( Abc_NtkHasSop(pNtk) )
791  pNode->pData = Abc_SopCreateXorSpecial( (Mem_Flex_t *)pNtk->pManFunc, Vec_PtrSize(vFanins) );
792  else if ( Abc_NtkHasBdd(pNtk) )
793  pNode->pData = Extra_bddCreateExor( (DdManager *)pNtk->pManFunc, Vec_PtrSize(vFanins) ), Cudd_Ref((DdNode *)pNode->pData);
794  else if ( Abc_NtkHasAig(pNtk) )
795  pNode->pData = Hop_CreateExor( (Hop_Man_t *)pNtk->pManFunc, Vec_PtrSize(vFanins) );
796  else
797  assert( 0 );
798  return pNode;
799 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
Definition: cudd.h:278
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
Hop_Obj_t * Hop_CreateExor(Hop_Man_t *p, int nVars)
Definition: hopOper.c:362
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
void * pManFunc
Definition: abc.h:191
DdNode * Extra_bddCreateExor(DdManager *dd, int nVars)
Definition: extraBddMisc.c:908
ABC_DLL char * Abc_SopCreateXorSpecial(Mem_Flex_t *pMan, int nVars)
Definition: abcSop.c:291
static Abc_Obj_t * Abc_NtkCreateNode(Abc_Ntk_t *pNtk)
Definition: abc.h:308
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
void * pData
Definition: abc.h:145
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
ABC_DLL Abc_Obj_t* Abc_NtkCreateNodeInv ( Abc_Ntk_t pNtk,
Abc_Obj_t pFanin 
)

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

Synopsis [Creates inverter.]

Description []

SideEffects []

SeeAlso []

Definition at line 662 of file abcObj.c.

663 {
664  Abc_Obj_t * pNode;
665  assert( Abc_NtkIsLogic(pNtk) || Abc_NtkIsNetlist(pNtk) );
666  pNode = Abc_NtkCreateNode( pNtk );
667  if ( pFanin ) Abc_ObjAddFanin( pNode, pFanin );
668  if ( Abc_NtkHasSop(pNtk) )
669  pNode->pData = Abc_SopRegister( (Mem_Flex_t *)pNtk->pManFunc, "0 1\n" );
670  else if ( Abc_NtkHasBdd(pNtk) )
671  pNode->pData = Cudd_Not(Cudd_bddIthVar((DdManager *)pNtk->pManFunc,0)), Cudd_Ref( (DdNode *)pNode->pData );
672  else if ( Abc_NtkHasAig(pNtk) )
673  pNode->pData = Hop_Not(Hop_IthVar((Hop_Man_t *)pNtk->pManFunc,0));
674  else if ( Abc_NtkHasMapping(pNtk) )
676  else
677  assert( 0 );
678  return pNode;
679 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
ABC_DLL void * Abc_FrameReadLibGen()
Definition: mainFrame.c:56
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
Definition: cudd.h:278
#define Cudd_Not(node)
Definition: cudd.h:367
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
static Hop_Obj_t * Hop_Not(Hop_Obj_t *p)
Definition: hop.h:127
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
void * pManFunc
Definition: abc.h:191
ABC_DLL char * Abc_SopRegister(Mem_Flex_t *pMan, char *pName)
DECLARATIONS ///.
Definition: abcSop.c:56
STRUCTURE DEFINITIONS ///.
Definition: mioInt.h:61
DdNode * Cudd_bddIthVar(DdManager *dd, int i)
Definition: cuddAPI.c:416
static Abc_Obj_t * Abc_NtkCreateNode(Abc_Ntk_t *pNtk)
Definition: abc.h:308
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
void * pData
Definition: abc.h:145
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
Mio_Gate_t * Mio_LibraryReadInv(Mio_Library_t *pLib)
Definition: mioApi.c:48
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
Hop_Obj_t * Hop_IthVar(Hop_Man_t *p, int i)
FUNCTION DEFINITIONS ///.
Definition: hopOper.c:63
ABC_DLL Abc_Obj_t* Abc_NtkCreateNodeMux ( Abc_Ntk_t pNtk,
Abc_Obj_t pNodeC,
Abc_Obj_t pNode1,
Abc_Obj_t pNode0 
)

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

Synopsis [Creates MUX.]

Description []

SideEffects []

SeeAlso []

Definition at line 812 of file abcObj.c.

813 {
814  Abc_Obj_t * pNode;
815  assert( Abc_NtkIsLogic(pNtk) );
816  pNode = Abc_NtkCreateNode( pNtk );
817  Abc_ObjAddFanin( pNode, pNodeC );
818  Abc_ObjAddFanin( pNode, pNode1 );
819  Abc_ObjAddFanin( pNode, pNode0 );
820  if ( Abc_NtkHasSop(pNtk) )
821  pNode->pData = Abc_SopRegister( (Mem_Flex_t *)pNtk->pManFunc, "11- 1\n0-1 1\n" );
822  else if ( Abc_NtkHasBdd(pNtk) )
824  else if ( Abc_NtkHasAig(pNtk) )
825  pNode->pData = Hop_Mux((Hop_Man_t *)pNtk->pManFunc,Hop_IthVar((Hop_Man_t *)pNtk->pManFunc,0),Hop_IthVar((Hop_Man_t *)pNtk->pManFunc,1),Hop_IthVar((Hop_Man_t *)pNtk->pManFunc,2));
826  else
827  assert( 0 );
828  return pNode;
829 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
Definition: cudd.h:278
DdNode * Cudd_bddIte(DdManager *dd, DdNode *f, DdNode *g, DdNode *h)
Definition: cuddBddIte.c:143
Hop_Obj_t * Hop_Mux(Hop_Man_t *p, Hop_Obj_t *pC, Hop_Obj_t *p1, Hop_Obj_t *p0)
Definition: hopOper.c:187
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
void * pManFunc
Definition: abc.h:191
ABC_DLL char * Abc_SopRegister(Mem_Flex_t *pMan, char *pName)
DECLARATIONS ///.
Definition: abcSop.c:56
DdNode * Cudd_bddIthVar(DdManager *dd, int i)
Definition: cuddAPI.c:416
static Abc_Obj_t * Abc_NtkCreateNode(Abc_Ntk_t *pNtk)
Definition: abc.h:308
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
void * pData
Definition: abc.h:145
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
Hop_Obj_t * Hop_IthVar(Hop_Man_t *p, int i)
FUNCTION DEFINITIONS ///.
Definition: hopOper.c:63
ABC_DLL Abc_Obj_t* Abc_NtkCreateNodeOr ( Abc_Ntk_t pNtk,
Vec_Ptr_t vFanins 
)

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

Synopsis [Creates OR.]

Description []

SideEffects []

SeeAlso []

Definition at line 752 of file abcObj.c.

753 {
754  Abc_Obj_t * pNode;
755  int i;
756  assert( Abc_NtkIsLogic(pNtk) || Abc_NtkIsNetlist(pNtk) );
757  pNode = Abc_NtkCreateNode( pNtk );
758  for ( i = 0; i < vFanins->nSize; i++ )
759  Abc_ObjAddFanin( pNode, (Abc_Obj_t *)vFanins->pArray[i] );
760  if ( Abc_NtkHasSop(pNtk) )
761  pNode->pData = Abc_SopCreateOr( (Mem_Flex_t *)pNtk->pManFunc, Vec_PtrSize(vFanins), NULL );
762  else if ( Abc_NtkHasBdd(pNtk) )
763  pNode->pData = Extra_bddCreateOr( (DdManager *)pNtk->pManFunc, Vec_PtrSize(vFanins) ), Cudd_Ref((DdNode *)pNode->pData);
764  else if ( Abc_NtkHasAig(pNtk) )
765  pNode->pData = Hop_CreateOr( (Hop_Man_t *)pNtk->pManFunc, Vec_PtrSize(vFanins) );
766  else
767  assert( 0 );
768  return pNode;
769 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
Definition: cudd.h:278
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
DdNode * Extra_bddCreateOr(DdManager *dd, int nVars)
Definition: extraBddMisc.c:883
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
void * pManFunc
Definition: abc.h:191
Hop_Obj_t * Hop_CreateOr(Hop_Man_t *p, int nVars)
Definition: hopOper.c:341
static Abc_Obj_t * Abc_NtkCreateNode(Abc_Ntk_t *pNtk)
Definition: abc.h:308
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
void * pData
Definition: abc.h:145
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
ABC_DLL char * Abc_SopCreateOr(Mem_Flex_t *pMan, int nVars, int *pfCompl)
Definition: abcSop.c:206
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
ABC_DLL Abc_Obj_t * Abc_NtkCreateObj ( Abc_Ntk_t pNtk,
Abc_ObjType_t  Type 
)

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

Synopsis [Adds the node to the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 106 of file abcObj.c.

107 {
108  Abc_Obj_t * pObj;
109  // create new object, assign ID, and add to the array
110  pObj = Abc_ObjAlloc( pNtk, Type );
111  pObj->Id = pNtk->vObjs->nSize;
112  Vec_PtrPush( pNtk->vObjs, pObj );
113  pNtk->nObjCounts[Type]++;
114  pNtk->nObjs++;
115  // perform specialized operations depending on the object type
116  switch (Type)
117  {
118  case ABC_OBJ_NONE:
119  assert(0);
120  break;
121  case ABC_OBJ_CONST1:
122  assert(0);
123  break;
124  case ABC_OBJ_PI:
125 // pObj->iTemp = Vec_PtrSize(pNtk->vCis);
126  Vec_PtrPush( pNtk->vPis, pObj );
127  Vec_PtrPush( pNtk->vCis, pObj );
128  break;
129  case ABC_OBJ_PO:
130 // pObj->iTemp = Vec_PtrSize(pNtk->vCos);
131  Vec_PtrPush( pNtk->vPos, pObj );
132  Vec_PtrPush( pNtk->vCos, pObj );
133  break;
134  case ABC_OBJ_BI:
135  if ( pNtk->vCos ) Vec_PtrPush( pNtk->vCos, pObj );
136  break;
137  case ABC_OBJ_BO:
138  if ( pNtk->vCis ) Vec_PtrPush( pNtk->vCis, pObj );
139  break;
140  case ABC_OBJ_NET:
141  case ABC_OBJ_NODE:
142  break;
143  case ABC_OBJ_LATCH:
144  pObj->pData = (void *)ABC_INIT_NONE;
145  case ABC_OBJ_WHITEBOX:
146  case ABC_OBJ_BLACKBOX:
147  if ( pNtk->vBoxes ) Vec_PtrPush( pNtk->vBoxes, pObj );
148  break;
149  default:
150  assert(0);
151  break;
152  }
153  return pObj;
154 }
int nObjCounts[ABC_OBJ_NUMBER]
Definition: abc.h:171
Definition: abc.h:91
Vec_Ptr_t * vBoxes
Definition: abc.h:168
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
Vec_Ptr_t * vObjs
Definition: abc.h:162
Vec_Ptr_t * vPis
Definition: abc.h:163
int nObjs
Definition: abc.h:172
Vec_Ptr_t * vCis
Definition: abc.h:165
Vec_Ptr_t * vPos
Definition: abc.h:164
Vec_Ptr_t * vCos
Definition: abc.h:166
ABC_NAMESPACE_IMPL_START Abc_Obj_t * Abc_ObjAlloc(Abc_Ntk_t *pNtk, Abc_ObjType_t Type)
DECLARATIONS ///.
Definition: abcObj.c:49
Definition: abc.h:89
int Id
Definition: abc.h:132
Definition: abc.h:90
Definition: abc.h:92
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
static Abc_Obj_t* Abc_NtkCreatePi ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 303 of file abc.h.

303 { return Abc_NtkCreateObj( pNtk, ABC_OBJ_PI ); }
ABC_DLL Abc_Obj_t * Abc_NtkCreateObj(Abc_Ntk_t *pNtk, Abc_ObjType_t Type)
Definition: abcObj.c:106
Definition: abc.h:89
static Abc_Obj_t* Abc_NtkCreatePo ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 304 of file abc.h.

304 { return Abc_NtkCreateObj( pNtk, ABC_OBJ_PO ); }
ABC_DLL Abc_Obj_t * Abc_NtkCreateObj(Abc_Ntk_t *pNtk, Abc_ObjType_t Type)
Definition: abcObj.c:106
Definition: abc.h:90
ABC_DLL Abc_Ntk_t* Abc_NtkCreateTarget ( Abc_Ntk_t pNtk,
Vec_Ptr_t vRoots,
Vec_Int_t vValues 
)

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

Synopsis [Creates the miter composed of one multi-output cone.]

Description []

SideEffects []

SeeAlso []

Definition at line 1094 of file abcNtk.c.

1095 {
1096  Vec_Ptr_t * vNodes;
1097  Abc_Ntk_t * pNtkNew;
1098  Abc_Obj_t * pObj, * pFinal, * pOther, * pNodePo;
1099  int i;
1100 
1101  assert( Abc_NtkIsLogic(pNtk) );
1102 
1103  // start the network
1104  Abc_NtkCleanCopy( pNtk );
1105  pNtkNew = Abc_NtkAlloc( ABC_NTK_STRASH, ABC_FUNC_AIG, 1 );
1106  pNtkNew->pName = Extra_UtilStrsav(pNtk->pName);
1107 
1108  // collect the nodes in the TFI of the output
1109  vNodes = Abc_NtkDfsNodes( pNtk, (Abc_Obj_t **)vRoots->pArray, vRoots->nSize );
1110  // create the PIs
1111  Abc_NtkForEachCi( pNtk, pObj, i )
1112  {
1113  pObj->pCopy = Abc_NtkCreatePi(pNtkNew);
1114  Abc_ObjAssignName( pObj->pCopy, Abc_ObjName(pObj), NULL );
1115  }
1116  // copy the nodes
1117  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
1118  pObj->pCopy = Abc_NodeStrash( pNtkNew, pObj, 0 );
1119  Vec_PtrFree( vNodes );
1120 
1121  // add the PO
1122  pFinal = Abc_AigConst1( pNtkNew );
1123  Vec_PtrForEachEntry( Abc_Obj_t *, vRoots, pObj, i )
1124  {
1125  if ( Abc_ObjIsCo(pObj) )
1126  pOther = Abc_ObjFanin0(pObj)->pCopy;
1127  else
1128  pOther = pObj->pCopy;
1129  if ( Vec_IntEntry(vValues, i) == 0 )
1130  pOther = Abc_ObjNot(pOther);
1131  pFinal = Abc_AigAnd( (Abc_Aig_t *)pNtkNew->pManFunc, pFinal, pOther );
1132  }
1133 
1134  // add the PO corresponding to this output
1135  pNodePo = Abc_NtkCreatePo( pNtkNew );
1136  Abc_ObjAddFanin( pNodePo, pFinal );
1137  Abc_ObjAssignName( pNodePo, "miter", NULL );
1138  if ( !Abc_NtkCheck( pNtkNew ) )
1139  fprintf( stdout, "Abc_NtkCreateTarget(): Network check has failed.\n" );
1140  return pNtkNew;
1141 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition: abcNames.c:68
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
DECLARATIONS ///.
Definition: abcAig.c:52
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
Definition: abc.h:352
char * Extra_UtilStrsav(const char *s)
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:700
Abc_Obj_t * pCopy
Definition: abc.h:148
ABC_DLL Abc_Obj_t * Abc_NodeStrash(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pNode, int fRecord)
Definition: abcStrash.c:468
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static Abc_Obj_t * Abc_NtkCreatePi(Abc_Ntk_t *pNtk)
Definition: abc.h:303
ABC_NAMESPACE_IMPL_START Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:507
#define assert(ex)
Definition: util_old.h:213
static Abc_Obj_t * Abc_ObjNot(Abc_Obj_t *p)
Definition: abc.h:324
ABC_DLL Vec_Ptr_t * Abc_NtkDfsNodes(Abc_Ntk_t *pNtk, Abc_Obj_t **ppNodes, int nNodes)
Definition: abcDfs.c:120
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static Abc_Obj_t * Abc_NtkCreatePo(Abc_Ntk_t *pNtk)
Definition: abc.h:304
char * pName
Definition: abc.h:158
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
static Abc_Obj_t* Abc_NtkCreateWhitebox ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 310 of file abc.h.

310 { return Abc_NtkCreateObj( pNtk, ABC_OBJ_WHITEBOX ); }
ABC_DLL Abc_Obj_t * Abc_NtkCreateObj(Abc_Ntk_t *pNtk, Abc_ObjType_t Type)
Definition: abcObj.c:106
ABC_DLL Abc_Ntk_t* Abc_NtkCreateWithNode ( char *  pSop)

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

Synopsis [Creates the network composed of one node with the given SOP.]

Description []

SideEffects []

SeeAlso []

Definition at line 1192 of file abcNtk.c.

1193 {
1194  Abc_Ntk_t * pNtkNew;
1195  Abc_Obj_t * pFanin, * pNode, * pNodePo;
1196  Vec_Ptr_t * vNames;
1197  int i, nVars;
1198  // start the network
1199  pNtkNew = Abc_NtkAlloc( ABC_NTK_LOGIC, ABC_FUNC_SOP, 1 );
1200  pNtkNew->pName = Extra_UtilStrsav("ex");
1201  // create PIs
1202  Vec_PtrPush( pNtkNew->vObjs, NULL );
1203  nVars = Abc_SopGetVarNum( pSop );
1204  vNames = Abc_NodeGetFakeNames( nVars );
1205  for ( i = 0; i < nVars; i++ )
1206  Abc_ObjAssignName( Abc_NtkCreatePi(pNtkNew), (char *)Vec_PtrEntry(vNames, i), NULL );
1207  Abc_NodeFreeNames( vNames );
1208  // create the node, add PIs as fanins, set the function
1209  pNode = Abc_NtkCreateNode( pNtkNew );
1210  Abc_NtkForEachPi( pNtkNew, pFanin, i )
1211  Abc_ObjAddFanin( pNode, pFanin );
1212  pNode->pData = Abc_SopRegister( (Mem_Flex_t *)pNtkNew->pManFunc, pSop );
1213  // create the only PO
1214  pNodePo = Abc_NtkCreatePo(pNtkNew);
1215  Abc_ObjAddFanin( pNodePo, pNode );
1216  Abc_ObjAssignName( pNodePo, "F", NULL );
1217  if ( !Abc_NtkCheck( pNtkNew ) )
1218  fprintf( stdout, "Abc_NtkCreateWithNode(): Network check has failed.\n" );
1219  return pNtkNew;
1220 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
Abc_Ntk_t * Abc_NtkCreateWithNode(char *pSop)
Definition: abcNtk.c:1192
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
Vec_Ptr_t * vObjs
Definition: abc.h:162
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition: abcNames.c:68
char * Extra_UtilStrsav(const char *s)
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
static void check(int expr)
Definition: satSolver.c:46
ABC_DLL void Abc_NodeFreeNames(Vec_Ptr_t *vNames)
Definition: abcNames.c:257
ABC_DLL char * Abc_SopRegister(Mem_Flex_t *pMan, char *pName)
DECLARATIONS ///.
Definition: abcSop.c:56
ABC_DLL Vec_Ptr_t * Abc_NodeGetFakeNames(int nNames)
Definition: abcNames.c:221
if(last==0)
Definition: sparse_int.h:34
static Abc_Obj_t * Abc_NtkCreatePi(Abc_Ntk_t *pNtk)
Definition: abc.h:303
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
ABC_NAMESPACE_IMPL_START Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
static Abc_Obj_t * Abc_NtkCreateNode(Abc_Ntk_t *pNtk)
Definition: abc.h:308
ABC_DLL int Abc_SopGetVarNum(char *pSop)
Definition: abcSop.c:536
static Abc_Obj_t * Abc_NtkCreatePo(Abc_Ntk_t *pNtk)
Definition: abc.h:304
char * pName
Definition: abc.h:158
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
ABC_DLL Abc_Ntk_t* Abc_NtkDarLatchSweep ( Abc_Ntk_t pNtk,
int  fLatchConst,
int  fLatchEqual,
int  fSaveNames,
int  fUseMvSweep,
int  nFramesSymb,
int  nFramesSatur,
int  fVerbose,
int  fVeryVerbose 
)

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 3203 of file abcDar.c.

3204 {
3205  extern void Aig_ManPrintControlFanouts( Aig_Man_t * p );
3206  Abc_Ntk_t * pNtkAig;
3207  Aig_Man_t * pMan, * pTemp;
3208  pMan = Abc_NtkToDar( pNtk, 0, 1 );
3209  if ( pMan == NULL )
3210  return NULL;
3211  if ( fSaveNames )
3212  {
3213  Aig_ManSeqCleanup( pMan );
3214  if ( fLatchConst && pMan->nRegs )
3215  pMan = Aig_ManConstReduce( pMan, fUseMvSweep, nFramesSymb, nFramesSatur, fVerbose, fVeryVerbose );
3216  if ( fLatchEqual && pMan->nRegs )
3217  pMan = Aig_ManReduceLaches( pMan, fVerbose );
3218  }
3219  else
3220  {
3221  if ( pMan->vFlopNums )
3222  Vec_IntFree( pMan->vFlopNums );
3223  pMan->vFlopNums = NULL;
3224  pMan = Aig_ManScl( pTemp = pMan, fLatchConst, fLatchEqual, fUseMvSweep, nFramesSymb, nFramesSatur, fVerbose, fVeryVerbose );
3225  Aig_ManStop( pTemp );
3226  }
3227 
3228  pNtkAig = Abc_NtkFromDarSeqSweep( pNtk, pMan );
3229 //Aig_ManPrintControlFanouts( pMan );
3230  Aig_ManStop( pMan );
3231  return pNtkAig;
3232 }
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
int Aig_ManSeqCleanup(Aig_Man_t *p)
Definition: aigScl.c:158
void Aig_ManPrintControlFanouts(Aig_Man_t *p)
Definition: aigUtil.c:1027
Aig_Man_t * Aig_ManReduceLaches(Aig_Man_t *p, int fVerbose)
Definition: aigScl.c:455
Aig_Man_t * Aig_ManScl(Aig_Man_t *pAig, int fLatchConst, int fLatchEqual, int fUseMvSweep, int nFramesSymb, int nFramesSatur, int fVerbose, int fVeryVerbose)
Definition: aigScl.c:650
Aig_Man_t * Aig_ManConstReduce(Aig_Man_t *p, int fUseMvSweep, int nFramesSymb, int nFramesSatur, int fVerbose, int fVeryVerbose)
Definition: aigTsim.c:498
Abc_Ntk_t * Abc_NtkFromDarSeqSweep(Abc_Ntk_t *pNtkOld, Aig_Man_t *pMan)
Definition: abcDar.c:468
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Aig_Man_t * Abc_NtkToDar(Abc_Ntk_t *pNtk, int fExors, int fRegisters)
DECLARATIONS ///.
Definition: abcDar.c:233
ABC_DLL int Abc_NtkDarPrintCone ( Abc_Ntk_t pNtk)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 3911 of file abcDar.c.

3912 {
3913  extern void Saig_ManPrintCones( Aig_Man_t * pAig );
3914  Aig_Man_t * pMan;
3915  pMan = Abc_NtkToDar( pNtk, 0, 1 );
3916  if ( pMan == NULL )
3917  return 0;
3918  assert( Aig_ManRegNum(pMan) > 0 );
3919  Saig_ManPrintCones( pMan );
3920  Aig_ManStop( pMan );
3921  return 1;
3922 }
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
void Saig_ManPrintCones(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: saigCone.c:159
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#define assert(ex)
Definition: util_old.h:213
Aig_Man_t * Abc_NtkToDar(Abc_Ntk_t *pNtk, int fExors, int fRegisters)
DECLARATIONS ///.
Definition: abcDar.c:233
ABC_DLL float Abc_NtkDelayTrace ( Abc_Ntk_t pNtk,
Abc_Obj_t pOut,
Abc_Obj_t pIn,
int  fPrint 
)

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

Synopsis [Performs delay-trace of the network. If input (pIn) or output (pOut) are given, finds the most-timing-critical path between them and prints it to the standard output. If input and/or output are not given, finds the most-critical path in the network and prints it.]

Description []

SideEffects []

SeeAlso []

Definition at line 919 of file abcTiming.c.

920 {
921  Vec_Int_t * vSlacks = NULL;
922  Abc_Obj_t * pNode, * pDriver;
923  Vec_Ptr_t * vNodes;
924  Abc_Time_t * pTime;
925  float tArrivalMax;
926  int i;
927 
928  assert( Abc_NtkIsMappedLogic(pNtk) );
929  assert( pOut == NULL || Abc_ObjIsCo(pOut) );
930  assert( pIn == NULL || Abc_ObjIsCi(pIn) );
931 
932  // create slacks (need slacks if printing is requested even if pIn/pOut are not given)
933  if ( pOut || pIn || fPrint )
934  vSlacks = Abc_NtkDelayTraceSlackStart( pNtk );
935 
936  // compute the timing
937  Abc_NtkTimePrepare( pNtk );
938  vNodes = Abc_NtkDfs( pNtk, 1 );
939  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pNode, i )
940  Abc_NodeDelayTraceArrival( pNode, vSlacks );
941  Vec_PtrFree( vNodes );
942 
943  // get the latest arrival times
944  tArrivalMax = -ABC_INFINITY;
945  Abc_NtkForEachCo( pNtk, pNode, i )
946  {
947  pDriver = Abc_ObjFanin0(pNode);
948  pTime = Abc_NodeArrival(pDriver);
949  if ( tArrivalMax < Abc_MaxFloat(pTime->Fall, pTime->Rise) )
950  tArrivalMax = Abc_MaxFloat(pTime->Fall, pTime->Rise);
951  }
952 
953  // determine the output to print
954  if ( fPrint && pOut == NULL )
955  {
956  Abc_NtkForEachCo( pNtk, pNode, i )
957  {
958  pDriver = Abc_ObjFanin0(pNode);
959  pTime = Abc_NodeArrival(pDriver);
960  if ( tArrivalMax == Abc_MaxFloat(pTime->Fall, pTime->Rise) )
961  pOut = pNode;
962  }
963  assert( pOut != NULL );
964  }
965 
966  if ( fPrint )
967  {
968  Vec_Ptr_t * vPath = Vec_PtrAlloc( 100 );
969  Vec_Int_t * vBest = Vec_IntStartFull( Abc_NtkObjNumMax(pNtk) );
970  // traverse to determine the critical path
971  Abc_NtkIncrementTravId( pNtk );
972  if ( !Abc_NtkDelayTraceCritPath_rec( vSlacks, Abc_ObjFanin0(pOut), pIn, vBest ) )
973  {
974  if ( pIn == NULL )
975  printf( "The logic cone of PO \"%s\" has no primary inputs.\n", Abc_ObjName(pOut) );
976  else
977  printf( "There is no combinational path between PI \"%s\" and PO \"%s\".\n", Abc_ObjName(pIn), Abc_ObjName(pOut) );
978  }
979  else
980  {
981  float Slack = 0.0, SlackAdd;
982  int k, iFanin, Length = 0;
983  Abc_Obj_t * pFanin;
984  // check the additional slack
986  // collect the critical path
987  Abc_NtkDelayTraceCritPathCollect_rec( vSlacks, Abc_ObjFanin0(pOut), vBest, vPath );
988  if ( pIn == NULL )
989  pIn = (Abc_Obj_t *)Vec_PtrEntry( vPath, 0 );
990  // find the longest gate name
991  Vec_PtrForEachEntry( Abc_Obj_t *, vPath, pNode, i )
992  if ( Abc_ObjIsNode(pNode) )
993  Length = Abc_MaxInt( Length, strlen(Mio_GateReadName((Mio_Gate_t *)pNode->pData)) );
994  // print critical path
995  Abc_NtkLevel( pNtk );
996  printf( "Critical path from PI \"%s\" to PO \"%s\":\n", Abc_ObjName(pIn), Abc_ObjName(pOut) );
997  Vec_PtrForEachEntry( Abc_Obj_t *, vPath, pNode, i )
998  {
999  printf( "Level %3d : ", Abc_ObjLevel(pNode) );
1000  if ( Abc_ObjIsCi(pNode) )
1001  {
1002  printf( "Primary input \"%s\". ", Abc_ObjName(pNode) );
1003  printf( "Arrival time =%6.1f. ", Abc_NodeReadArrivalWorst(pNode) );
1004  printf( "\n" );
1005  continue;
1006  }
1007  if ( Abc_ObjIsCo(pNode) )
1008  {
1009  printf( "Primary output \"%s\". ", Abc_ObjName(pNode) );
1010  printf( "Arrival =%6.1f. ", Abc_NodeReadArrivalWorst(pNode) );
1011  }
1012  else
1013  {
1014  assert( Abc_ObjIsNode(pNode) );
1015  iFanin = Abc_NodeFindFanin( pNode, (Abc_Obj_t *)Vec_PtrEntry(vPath,i-1) );
1016  Slack = Abc_NtkDelayTraceSlack(vSlacks, pNode, iFanin);
1017  printf( "%10s/", Abc_ObjName(pNode) );
1018  printf( "%-4s", Mio_GateReadPinName((Mio_Gate_t *)pNode->pData, iFanin) );
1019  printf( " (%s)", Mio_GateReadName((Mio_Gate_t *)pNode->pData) );
1020  for ( k = strlen(Mio_GateReadName((Mio_Gate_t *)pNode->pData)); k < Length; k++ )
1021  printf( " " );
1022  printf( " " );
1023  printf( "Arrival =%6.1f. ", Abc_NodeReadArrivalWorst(pNode) );
1024  printf( "I/O times: (" );
1025  Abc_ObjForEachFanin( pNode, pFanin, k )
1026  printf( "%s%.1f", (k? ", ":""), Abc_NodeReadArrivalWorst(pFanin) );
1027 // printf( " -> %.1f)", Abc_NodeReadArrival(pNode)->Worst + Slack + SlackAdd );
1028  printf( " -> %.1f)", Abc_NodeReadArrivalWorst(pNode) );
1029  }
1030  printf( "\n" );
1031  }
1032  printf( "Level %3d : ", Abc_ObjLevel(Abc_ObjFanin0(pOut)) + 1 );
1033  printf( "Primary output \"%s\". ", Abc_ObjName(pOut) );
1034  printf( "Required time = %6.1f. ", Abc_NodeReadRequiredWorst(pOut) );
1035  printf( "Path slack = %6.1f.\n", SlackAdd );
1036  }
1037  Vec_PtrFree( vPath );
1038  Vec_IntFree( vBest );
1039  }
1040 
1041  Vec_IntFreeP( &vSlacks );
1042  return tArrivalMax;
1043 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
Definition: abc.h:351
static float Abc_NtkDelayTraceSlack(Vec_Int_t *vSlacks, Abc_Obj_t *pObj, int iFanin)
Definition: abcTiming.c:735
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
ABC_DLL int Abc_NodeFindFanin(Abc_Obj_t *pNode, Abc_Obj_t *pFanin)
Definition: abcUtil.c:758
char * Mio_GateReadPinName(Mio_Gate_t *pGate, int iPin)
Definition: mioApi.c:192
void Abc_NtkDelayTraceCritPathCollect_rec(Vec_Int_t *vSlacks, Abc_Obj_t *pNode, Vec_Int_t *vBest, Vec_Ptr_t *vPath)
Definition: abcTiming.c:796
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
Definition: abcDfs.c:81
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static Vec_Int_t * Vec_IntStartFull(int nSize)
Definition: vecInt.h:119
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static float Abc_MaxFloat(float a, float b)
Definition: abc_global.h:243
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
Definition: abc.h:352
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
float Abc_NodeReadArrivalWorst(Abc_Obj_t *pNode)
Definition: abcTiming.c:95
static int Abc_ObjLevel(Abc_Obj_t *pObj)
Definition: abc.h:330
float Abc_NodeReadRequiredWorst(Abc_Obj_t *pNode)
Definition: abcTiming.c:99
if(last==0)
Definition: sparse_int.h:34
int Abc_NtkDelayTraceCritPath_rec(Vec_Int_t *vSlacks, Abc_Obj_t *pNode, Abc_Obj_t *pLeaf, Vec_Int_t *vBest)
Definition: abcTiming.c:755
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
void Abc_NodeDelayTraceArrival(Abc_Obj_t *pNode, Vec_Int_t *vSlacks)
Definition: abcTiming.c:819
Vec_Int_t * Abc_NtkDelayTraceSlackStart(Abc_Ntk_t *pNtk)
Definition: abcTiming.c:707
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
float Fall
Definition: abc.h:125
static int Abc_NtkIsMappedLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:267
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
void Abc_NtkTimePrepare(Abc_Ntk_t *pNtk)
Definition: abcTiming.c:377
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
#define assert(ex)
Definition: util_old.h:213
int strlen()
static Abc_Time_t * Abc_NodeArrival(Abc_Obj_t *pNode)
Definition: abcTiming.c:49
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
ABC_DLL int Abc_NtkLevel(Abc_Ntk_t *pNtk)
Definition: abcDfs.c:1265
char * Mio_GateReadName(Mio_Gate_t *pGate)
Definition: mioApi.c:143
float Rise
Definition: abc.h:124
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL float Abc_NtkDelayTraceLut ( Abc_Ntk_t pNtk,
int  fUseLutLib 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 100 of file abcSpeedup.c.

101 {
102  int fUseSorting = 1;
103  int pPinPerm[32];
104  float pPinDelays[32];
105  If_LibLut_t * pLutLib;
106  Abc_Obj_t * pNode, * pFanin;
107  Vec_Ptr_t * vNodes;
108  float tArrival, tRequired, tSlack, * pDelays;
109  int i, k;
110 
111  assert( Abc_NtkIsLogic(pNtk) );
112  // get the library
113  pLutLib = fUseLutLib? (If_LibLut_t *)Abc_FrameReadLibLut() : NULL;
114  if ( pLutLib && pLutLib->LutMax < Abc_NtkGetFaninMax(pNtk) )
115  {
116  printf( "The max LUT size (%d) is less than the max fanin count (%d).\n",
117  pLutLib->LutMax, Abc_NtkGetFaninMax(pNtk) );
118  return -ABC_INFINITY;
119  }
120 
121  // initialize the arrival times
122  ABC_FREE( pNtk->pLutTimes );
123  pNtk->pLutTimes = ABC_ALLOC( float, 3 * Abc_NtkObjNumMax(pNtk) );
124  for ( i = 0; i < Abc_NtkObjNumMax(pNtk); i++ )
125  {
126  pNtk->pLutTimes[3*i+0] = pNtk->pLutTimes[3*i+2] = 0;
127  pNtk->pLutTimes[3*i+1] = ABC_INFINITY;
128  }
129 
130  // propagate arrival times
131  vNodes = Abc_NtkDfs( pNtk, 1 );
132  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pNode, i )
133  {
134  tArrival = -ABC_INFINITY;
135  if ( pLutLib == NULL )
136  {
137  Abc_ObjForEachFanin( pNode, pFanin, k )
138  if ( tArrival < Abc_ObjArrival(pFanin) + 1.0 )
139  tArrival = Abc_ObjArrival(pFanin) + 1.0;
140  }
141  else if ( !pLutLib->fVarPinDelays )
142  {
143  pDelays = pLutLib->pLutDelays[Abc_ObjFaninNum(pNode)];
144  Abc_ObjForEachFanin( pNode, pFanin, k )
145  if ( tArrival < Abc_ObjArrival(pFanin) + pDelays[0] )
146  tArrival = Abc_ObjArrival(pFanin) + pDelays[0];
147  }
148  else
149  {
150  pDelays = pLutLib->pLutDelays[Abc_ObjFaninNum(pNode)];
151  if ( fUseSorting )
152  {
153  Abc_NtkDelayTraceSortPins( pNode, pPinPerm, pPinDelays );
154  Abc_ObjForEachFanin( pNode, pFanin, k )
155  if ( tArrival < Abc_ObjArrival(Abc_ObjFanin(pNode,pPinPerm[k])) + pDelays[k] )
156  tArrival = Abc_ObjArrival(Abc_ObjFanin(pNode,pPinPerm[k])) + pDelays[k];
157  }
158  else
159  {
160  Abc_ObjForEachFanin( pNode, pFanin, k )
161  if ( tArrival < Abc_ObjArrival(pFanin) + pDelays[k] )
162  tArrival = Abc_ObjArrival(pFanin) + pDelays[k];
163  }
164  }
165  if ( Abc_ObjFaninNum(pNode) == 0 )
166  tArrival = 0.0;
167  Abc_ObjSetArrival( pNode, tArrival );
168  }
169  Vec_PtrFree( vNodes );
170 
171  // get the latest arrival times
172  tArrival = -ABC_INFINITY;
173  Abc_NtkForEachCo( pNtk, pNode, i )
174  if ( tArrival < Abc_ObjArrival(Abc_ObjFanin0(pNode)) )
175  tArrival = Abc_ObjArrival(Abc_ObjFanin0(pNode));
176 
177  // initialize the required times
178  Abc_NtkForEachCo( pNtk, pNode, i )
179  if ( Abc_ObjRequired(Abc_ObjFanin0(pNode)) > tArrival )
180  Abc_ObjSetRequired( Abc_ObjFanin0(pNode), tArrival );
181 
182  // propagate the required times
183  vNodes = Abc_NtkDfsReverse( pNtk );
184  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pNode, i )
185  {
186  if ( pLutLib == NULL )
187  {
188  tRequired = Abc_ObjRequired(pNode) - (float)1.0;
189  Abc_ObjForEachFanin( pNode, pFanin, k )
190  if ( Abc_ObjRequired(pFanin) > tRequired )
191  Abc_ObjSetRequired( pFanin, tRequired );
192  }
193  else if ( !pLutLib->fVarPinDelays )
194  {
195  pDelays = pLutLib->pLutDelays[Abc_ObjFaninNum(pNode)];
196  tRequired = Abc_ObjRequired(pNode) - pDelays[0];
197  Abc_ObjForEachFanin( pNode, pFanin, k )
198  if ( Abc_ObjRequired(pFanin) > tRequired )
199  Abc_ObjSetRequired( pFanin, tRequired );
200  }
201  else
202  {
203  pDelays = pLutLib->pLutDelays[Abc_ObjFaninNum(pNode)];
204  if ( fUseSorting )
205  {
206  Abc_NtkDelayTraceSortPins( pNode, pPinPerm, pPinDelays );
207  Abc_ObjForEachFanin( pNode, pFanin, k )
208  {
209  tRequired = Abc_ObjRequired(pNode) - pDelays[k];
210  if ( Abc_ObjRequired(Abc_ObjFanin(pNode,pPinPerm[k])) > tRequired )
211  Abc_ObjSetRequired( Abc_ObjFanin(pNode,pPinPerm[k]), tRequired );
212  }
213  }
214  else
215  {
216  Abc_ObjForEachFanin( pNode, pFanin, k )
217  {
218  tRequired = Abc_ObjRequired(pNode) - pDelays[k];
219  if ( Abc_ObjRequired(pFanin) > tRequired )
220  Abc_ObjSetRequired( pFanin, tRequired );
221  }
222  }
223  }
224  // set slack for this object
225  tSlack = Abc_ObjRequired(pNode) - Abc_ObjArrival(pNode);
226  assert( tSlack + 0.001 > 0.0 );
227  Abc_ObjSetSlack( pNode, tSlack < 0.0 ? 0.0 : tSlack );
228  }
229  Vec_PtrFree( vNodes );
230  return tArrival;
231 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
static void Abc_ObjSetSlack(Abc_Obj_t *pNode, float Time)
Definition: abcSpeedup.c:39
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
int LutMax
Definition: if.h:173
ABC_DLL int Abc_NtkGetFaninMax(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:453
float pLutDelays[IF_MAX_LUTSIZE+1][IF_MAX_LUTSIZE+1]
Definition: if.h:176
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static ABC_NAMESPACE_IMPL_START float Abc_ObjArrival(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcSpeedup.c:33
static void Abc_ObjSetArrival(Abc_Obj_t *pNode, float Time)
Definition: abcSpeedup.c:37
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
Definition: abcDfs.c:81
static float Abc_ObjRequired(Abc_Obj_t *pNode)
Definition: abcSpeedup.c:34
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
ABC_DLL Vec_Ptr_t * Abc_NtkDfsReverse(Abc_Ntk_t *pNtk)
Definition: abcDfs.c:190
static void Abc_ObjSetRequired(Abc_Obj_t *pNode, float Time)
Definition: abcSpeedup.c:38
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
void Abc_NtkDelayTraceSortPins(Abc_Obj_t *pNode, int *pPinPerm, float *pPinDelays)
FUNCTION DEFINITIONS ///.
Definition: abcSpeedup.c:56
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
#define assert(ex)
Definition: util_old.h:213
static Abc_Obj_t * Abc_ObjFanin(Abc_Obj_t *pObj, int i)
Definition: abc.h:372
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
ABC_DLL void * Abc_FrameReadLibLut()
Definition: mainFrame.c:54
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
float * pLutTimes
Definition: abc.h:210
ABC_DLL void Abc_NtkDelete ( Abc_Ntk_t pNtk)

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

Synopsis [Deletes the Ntk.]

Description []

SideEffects []

SeeAlso []

Definition at line 1233 of file abcNtk.c.

1234 {
1235  Abc_Obj_t * pObj;
1236  void * pAttrMan;
1237  int TotalMemory, i;
1238 // int LargePiece = (4 << ABC_NUM_STEPS);
1239  if ( pNtk == NULL )
1240  return;
1241  // free EXDC Ntk
1242  if ( pNtk->pExdc )
1243  Abc_NtkDelete( pNtk->pExdc );
1244  if ( pNtk->pExcare )
1245  Abc_NtkDelete( (Abc_Ntk_t *)pNtk->pExcare );
1246  // dereference the BDDs
1247  if ( Abc_NtkHasBdd(pNtk) )
1248  {
1249  Abc_NtkForEachNode( pNtk, pObj, i )
1250  Cudd_RecursiveDeref( (DdManager *)pNtk->pManFunc, (DdNode *)pObj->pData );
1251  }
1252  // make sure all the marks are clean
1253  Abc_NtkForEachObj( pNtk, pObj, i )
1254  {
1255  // free large fanout arrays
1256 // if ( pNtk->pMmObj && pObj->vFanouts.nCap * 4 > LargePiece )
1257 // ABC_FREE( pObj->vFanouts.pArray );
1258  // these flags should be always zero
1259  // if this is not true, something is wrong somewhere
1260  assert( pObj->fMarkA == 0 );
1261  assert( pObj->fMarkB == 0 );
1262  assert( pObj->fMarkC == 0 );
1263  }
1264  // free the nodes
1265  if ( pNtk->pMmStep == NULL )
1266  {
1267  Abc_NtkForEachObj( pNtk, pObj, i )
1268  {
1269  ABC_FREE( pObj->vFanouts.pArray );
1270  ABC_FREE( pObj->vFanins.pArray );
1271  }
1272  }
1273  if ( pNtk->pMmObj == NULL )
1274  {
1275  Abc_NtkForEachObj( pNtk, pObj, i )
1276  ABC_FREE( pObj );
1277  }
1278 
1279  // free the arrays
1280  Vec_PtrFree( pNtk->vPios );
1281  Vec_PtrFree( pNtk->vPis );
1282  Vec_PtrFree( pNtk->vPos );
1283  Vec_PtrFree( pNtk->vCis );
1284  Vec_PtrFree( pNtk->vCos );
1285  Vec_PtrFree( pNtk->vObjs );
1286  Vec_PtrFree( pNtk->vBoxes );
1287  ABC_FREE( pNtk->vTravIds.pArray );
1288  if ( pNtk->vLevelsR ) Vec_IntFree( pNtk->vLevelsR );
1289  ABC_FREE( pNtk->pModel );
1290  ABC_FREE( pNtk->pSeqModel );
1291  if ( pNtk->vSeqModelVec )
1292  Vec_PtrFreeFree( pNtk->vSeqModelVec );
1293  TotalMemory = 0;
1294  TotalMemory += pNtk->pMmObj? Mem_FixedReadMemUsage(pNtk->pMmObj) : 0;
1295  TotalMemory += pNtk->pMmStep? Mem_StepReadMemUsage(pNtk->pMmStep) : 0;
1296 // fprintf( stdout, "The total memory allocated internally by the network = %0.2f MB.\n", ((double)TotalMemory)/(1<<20) );
1297  // free the storage
1298  if ( pNtk->pMmObj )
1299  Mem_FixedStop( pNtk->pMmObj, 0 );
1300  if ( pNtk->pMmStep )
1301  Mem_StepStop ( pNtk->pMmStep, 0 );
1302  // name manager
1303  Nm_ManFree( pNtk->pManName );
1304  // free the timing manager
1305  if ( pNtk->pManTime )
1306  Abc_ManTimeStop( pNtk->pManTime );
1307  Vec_IntFreeP( &pNtk->vPhases );
1308  // start the functionality manager
1309  if ( Abc_NtkIsStrash(pNtk) )
1310  Abc_AigFree( (Abc_Aig_t *)pNtk->pManFunc );
1311  else if ( Abc_NtkHasSop(pNtk) || Abc_NtkHasBlifMv(pNtk) )
1312  Mem_FlexStop( (Mem_Flex_t *)pNtk->pManFunc, 0 );
1313  else if ( Abc_NtkHasBdd(pNtk) )
1314  Extra_StopManager( (DdManager *)pNtk->pManFunc );
1315  else if ( Abc_NtkHasAig(pNtk) )
1316  { if ( pNtk->pManFunc ) Hop_ManStop( (Hop_Man_t *)pNtk->pManFunc ); }
1317  else if ( Abc_NtkHasMapping(pNtk) )
1318  pNtk->pManFunc = NULL;
1319  else if ( !Abc_NtkHasBlackbox(pNtk) )
1320  assert( 0 );
1321  // free the hierarchy
1322  if ( pNtk->pDesign )
1323  {
1324  Abc_DesFree( pNtk->pDesign, pNtk );
1325  pNtk->pDesign = NULL;
1326  }
1327 // if ( pNtk->pBlackBoxes )
1328 // Vec_IntFree( pNtk->pBlackBoxes );
1329  // free node attributes
1330  Vec_PtrForEachEntry( Abc_Obj_t *, pNtk->vAttrs, pAttrMan, i )
1331  if ( pAttrMan )
1332  Vec_AttFree( (Vec_Att_t *)pAttrMan, 1 );
1333  assert( pNtk->pSCLib == NULL );
1334  Vec_IntFreeP( &pNtk->vGates );
1335  Vec_PtrFree( pNtk->vAttrs );
1336  Vec_IntFreeP( &pNtk->vNameIds );
1337  ABC_FREE( pNtk->pWLoadUsed );
1338  ABC_FREE( pNtk->pName );
1339  ABC_FREE( pNtk->pSpec );
1340  ABC_FREE( pNtk->pLutTimes );
1341  if ( pNtk->vOnehots )
1342  Vec_VecFree( (Vec_Vec_t *)pNtk->vOnehots );
1343  Vec_PtrFreeP( &pNtk->vLtlProperties );
1344  Vec_IntFreeP( &pNtk->vObjPerm );
1345  Vec_IntFreeP( &pNtk->vTopo );
1346  ABC_FREE( pNtk );
1347 }
void Mem_StepStop(Mem_Step_t *p, int fVerbose)
Definition: mem.c:510
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
Definition: cudd.h:278
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
Abc_Ntk_t * pExdc
Definition: abc.h:201
static void Vec_PtrFreeFree(Vec_Ptr_t *p)
Definition: vecPtr.h:569
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
ABC_DLL void Abc_AigFree(Abc_Aig_t *pMan)
Definition: abcAig.c:165
Vec_Int_t vFanins
Definition: abc.h:143
void Mem_FixedStop(Mem_Fixed_t *p, int fVerbose)
Definition: mem.c:139
static int Abc_NtkHasBlifMv(Abc_Ntk_t *pNtk)
Definition: abc.h:257
void Extra_StopManager(DdManager *dd)
Definition: extraBddMisc.c:223
static void Vec_VecFree(Vec_Vec_t *p)
Definition: vecVec.h:347
DECLARATIONS ///.
Definition: abcAig.c:52
int Mem_StepReadMemUsage(Mem_Step_t *p)
Definition: mem.c:593
void Hop_ManStop(Hop_Man_t *p)
Definition: hopMan.c:84
ABC_DLL void Abc_DesFree(Abc_Des_t *p, Abc_Ntk_t *pNtk)
Definition: abcLib.c:94
Mem_Fixed_t * pMmObj
Definition: abc.h:189
static int Abc_NtkHasBlackbox(Abc_Ntk_t *pNtk)
Definition: abc.h:258
void * pExcare
Definition: abc.h:202
void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
static void * Vec_AttFree(Vec_Att_t *p, int fFreeMan)
Definition: vecAtt.h:126
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
void Mem_FlexStop(Mem_Flex_t *p, int fVerbose)
Definition: mem.c:343
Vec_Int_t vFanouts
Definition: abc.h:144
ABC_DLL void Abc_ManTimeStop(Abc_ManTime_t *p)
Definition: abcTiming.c:455
#define ABC_FREE(obj)
Definition: abc_global.h:232
static void Vec_PtrFreeP(Vec_Ptr_t **p)
Definition: vecPtr.h:240
Mem_Step_t * pMmStep
Definition: abc.h:190
int Mem_FixedReadMemUsage(Mem_Fixed_t *p)
Definition: mem.c:277
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
void Nm_ManFree(Nm_Man_t *p)
Definition: nmApi.c:76
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL void Abc_NtkDeleteAll_rec ( Abc_Obj_t pObj)

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

Synopsis [Deletes the node and MFFC of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 310 of file abcObj.c.

311 {
312  Vec_Ptr_t * vNodes;
313  int i;
314  assert( !Abc_ObjIsComplement(pObj) );
315  assert( Abc_ObjFanoutNum(pObj) == 0 );
316  // delete fanins and fanouts
317  vNodes = Vec_PtrAlloc( 100 );
318  Abc_NodeCollectFanins( pObj, vNodes );
319  Abc_NtkDeleteObj( pObj );
320  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
321  if ( !Abc_ObjIsNode(pObj) && Abc_ObjFanoutNum(pObj) == 0 )
322  Abc_NtkDeleteAll_rec( pObj );
323  Vec_PtrFree( vNodes );
324 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
void Abc_NtkDeleteAll_rec(Abc_Obj_t *pObj)
Definition: abcObj.c:310
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
void Abc_NtkDeleteObj(Abc_Obj_t *pObj)
Definition: abcObj.c:167
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
if(last==0)
Definition: sparse_int.h:34
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
ABC_DLL void Abc_NodeCollectFanins(Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
Definition: abcUtil.c:1587
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static int Abc_ObjIsComplement(Abc_Obj_t *p)
Definition: abc.h:322
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL void Abc_NtkDeleteObj ( Abc_Obj_t pObj)

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

Synopsis [Deletes the object from the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 167 of file abcObj.c.

168 {
169  Abc_Ntk_t * pNtk = pObj->pNtk;
170  Vec_Ptr_t * vNodes;
171  int i;
172  assert( !Abc_ObjIsComplement(pObj) );
173  // remove from the table of names
174  if ( Nm_ManFindNameById(pObj->pNtk->pManName, pObj->Id) )
175  Nm_ManDeleteIdName(pObj->pNtk->pManName, pObj->Id);
176  // delete fanins and fanouts
177  vNodes = Vec_PtrAlloc( 100 );
178  Abc_NodeCollectFanouts( pObj, vNodes );
179  for ( i = 0; i < vNodes->nSize; i++ )
180  Abc_ObjDeleteFanin( (Abc_Obj_t *)vNodes->pArray[i], pObj );
181  Abc_NodeCollectFanins( pObj, vNodes );
182  for ( i = 0; i < vNodes->nSize; i++ )
183  Abc_ObjDeleteFanin( pObj, (Abc_Obj_t *)vNodes->pArray[i] );
184  Vec_PtrFree( vNodes );
185  // remove from the list of objects
186  Vec_PtrWriteEntry( pNtk->vObjs, pObj->Id, NULL );
187  pObj->Id = (1<<26)-1;
188  pNtk->nObjCounts[pObj->Type]--;
189  pNtk->nObjs--;
190  // perform specialized operations depending on the object type
191  switch (pObj->Type)
192  {
193  case ABC_OBJ_NONE:
194  assert(0);
195  break;
196  case ABC_OBJ_CONST1:
197  assert(0);
198  break;
199  case ABC_OBJ_PI:
200  Vec_PtrRemove( pNtk->vPis, pObj );
201  Vec_PtrRemove( pNtk->vCis, pObj );
202  break;
203  case ABC_OBJ_PO:
204  Vec_PtrRemove( pNtk->vPos, pObj );
205  Vec_PtrRemove( pNtk->vCos, pObj );
206  break;
207  case ABC_OBJ_BI:
208  if ( pNtk->vCos ) Vec_PtrRemove( pNtk->vCos, pObj );
209  break;
210  case ABC_OBJ_BO:
211  if ( pNtk->vCis ) Vec_PtrRemove( pNtk->vCis, pObj );
212  break;
213  case ABC_OBJ_NET:
214  break;
215  case ABC_OBJ_NODE:
216  if ( Abc_NtkHasBdd(pNtk) )
217  Cudd_RecursiveDeref( (DdManager *)pNtk->pManFunc, (DdNode *)pObj->pData );
218  pObj->pData = NULL;
219  break;
220  case ABC_OBJ_LATCH:
221  case ABC_OBJ_WHITEBOX:
222  case ABC_OBJ_BLACKBOX:
223  if ( pNtk->vBoxes ) Vec_PtrRemove( pNtk->vBoxes, pObj );
224  break;
225  default:
226  assert(0);
227  break;
228  }
229  // recycle the object memory
230  Abc_ObjRecycle( pObj );
231 }
int nObjCounts[ABC_OBJ_NUMBER]
Definition: abc.h:171
Definition: abc.h:91
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
void Nm_ManDeleteIdName(Nm_Man_t *p, int ObjId)
Definition: nmApi.c:149
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
Nm_Man_t * pManName
Definition: abc.h:160
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
Definition: cudd.h:278
Vec_Ptr_t * vBoxes
Definition: abc.h:168
void Abc_ObjRecycle(Abc_Obj_t *pObj)
Definition: abcObj.c:74
Vec_Ptr_t * vObjs
Definition: abc.h:162
Vec_Ptr_t * vPis
Definition: abc.h:163
unsigned Type
Definition: abc.h:133
static void Vec_PtrRemove(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:714
int nObjs
Definition: abc.h:172
Vec_Ptr_t * vCis
Definition: abc.h:165
void * pManFunc
Definition: abc.h:191
Vec_Ptr_t * vPos
Definition: abc.h:164
Vec_Ptr_t * vCos
Definition: abc.h:166
char * Nm_ManFindNameById(Nm_Man_t *p, int ObjId)
Definition: nmApi.c:199
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
Abc_Ntk_t * pNtk
Definition: abc.h:130
Definition: abc.h:89
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
int Id
Definition: abc.h:132
Definition: abc.h:90
ABC_DLL void Abc_NodeCollectFanins(Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
Definition: abcUtil.c:1587
Definition: abc.h:92
ABC_DLL void Abc_ObjDeleteFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:111
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
ABC_DLL void Abc_NodeCollectFanouts(Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
Definition: abcUtil.c:1607
static int Abc_ObjIsComplement(Abc_Obj_t *p)
Definition: abc.h:322
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL void Abc_NtkDeleteObj_rec ( Abc_Obj_t pObj,
int  fOnlyNodes 
)

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

Synopsis [Deletes the node and MFFC of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 273 of file abcObj.c.

274 {
275  Vec_Ptr_t * vNodes;
276  int i;
277  assert( !Abc_ObjIsComplement(pObj) );
278  assert( !Abc_ObjIsPi(pObj) );
279  assert( Abc_ObjFanoutNum(pObj) == 0 );
280  // delete fanins and fanouts
281  vNodes = Vec_PtrAlloc( 100 );
282  Abc_NodeCollectFanins( pObj, vNodes );
283  Abc_NtkDeleteObj( pObj );
284  if ( fOnlyNodes )
285  {
286  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
287  if ( Abc_ObjIsNode(pObj) && Abc_ObjFanoutNum(pObj) == 0 )
288  Abc_NtkDeleteObj_rec( pObj, fOnlyNodes );
289  }
290  else
291  {
292  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
293  if ( !Abc_ObjIsPi(pObj) && Abc_ObjFanoutNum(pObj) == 0 )
294  Abc_NtkDeleteObj_rec( pObj, fOnlyNodes );
295  }
296  Vec_PtrFree( vNodes );
297 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
static int Abc_ObjIsPi(Abc_Obj_t *pObj)
Definition: abc.h:347
void Abc_NtkDeleteObj_rec(Abc_Obj_t *pObj, int fOnlyNodes)
Definition: abcObj.c:273
void Abc_NtkDeleteObj(Abc_Obj_t *pObj)
Definition: abcObj.c:167
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
ABC_DLL void Abc_NodeCollectFanins(Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
Definition: abcUtil.c:1587
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static int Abc_ObjIsComplement(Abc_Obj_t *p)
Definition: abc.h:322
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL void Abc_NtkDeleteObjPo ( Abc_Obj_t pObj)

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

Synopsis [Deletes the PO from the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 244 of file abcObj.c.

245 {
246  assert( Abc_ObjIsPo(pObj) );
247  // remove from the table of names
248  if ( Nm_ManFindNameById(pObj->pNtk->pManName, pObj->Id) )
249  Nm_ManDeleteIdName(pObj->pNtk->pManName, pObj->Id);
250  // delete fanins
251  Abc_ObjDeleteFanin( pObj, Abc_ObjFanin0(pObj) );
252  // remove from the list of objects
253  Vec_PtrWriteEntry( pObj->pNtk->vObjs, pObj->Id, NULL );
254  pObj->Id = (1<<26)-1;
255  pObj->pNtk->nObjCounts[pObj->Type]--;
256  pObj->pNtk->nObjs--;
257  // recycle the object memory
258  Abc_ObjRecycle( pObj );
259 }
int nObjCounts[ABC_OBJ_NUMBER]
Definition: abc.h:171
void Nm_ManDeleteIdName(Nm_Man_t *p, int ObjId)
Definition: nmApi.c:149
Nm_Man_t * pManName
Definition: abc.h:160
void Abc_ObjRecycle(Abc_Obj_t *pObj)
Definition: abcObj.c:74
Vec_Ptr_t * vObjs
Definition: abc.h:162
unsigned Type
Definition: abc.h:133
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
int nObjs
Definition: abc.h:172
char * Nm_ManFindNameById(Nm_Man_t *p, int ObjId)
Definition: nmApi.c:199
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
Abc_Ntk_t * pNtk
Definition: abc.h:130
int Id
Definition: abc.h:132
static int Abc_ObjIsPo(Abc_Obj_t *pObj)
Definition: abc.h:348
ABC_DLL void Abc_ObjDeleteFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:111
#define assert(ex)
Definition: util_old.h:213
ABC_DLL Abc_Ntk_t* Abc_NtkDeriveFromBdd ( void *  dd0,
void *  bFunc,
char *  pNamePo,
Vec_Ptr_t vNamesPi 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Constructs the network isomorphic to the given BDD.]

Description [Assumes that the BDD depends on the variables whose indexes correspond to the names in the array (pNamesPi). Otherwise, returns NULL. The resulting network comes with one node, whose functionality is equal to the given BDD. To decompose this BDD into the network of multiplexers use Abc_NtkBddToMuxes(). To decompose this BDD into an And-Inverter Graph, use Abc_NtkStrash().]

SideEffects []

SeeAlso []

Definition at line 56 of file abcNtbdd.c.

57 {
58  DdManager * dd = (DdManager *)dd0;
59  Abc_Ntk_t * pNtk;
60  Vec_Ptr_t * vNamesPiFake = NULL;
61  Abc_Obj_t * pNode, * pNodePi, * pNodePo;
62  DdNode * bSupp, * bTemp;
63  char * pName;
64  int i;
65 
66  // supply fake names if real names are not given
67  if ( pNamePo == NULL )
68  pNamePo = "F";
69  if ( vNamesPi == NULL )
70  {
71  vNamesPiFake = Abc_NodeGetFakeNames( dd->size );
72  vNamesPi = vNamesPiFake;
73  }
74 
75  // make sure BDD depends on the variables whose index
76  // does not exceed the size of the array with PI names
77  bSupp = Cudd_Support( dd, (DdNode *)bFunc ); Cudd_Ref( bSupp );
78  for ( bTemp = bSupp; bTemp != Cudd_ReadOne(dd); bTemp = cuddT(bTemp) )
79  if ( (int)Cudd_NodeReadIndex(bTemp) >= Vec_PtrSize(vNamesPi) )
80  break;
81  Cudd_RecursiveDeref( dd, bSupp );
82  if ( bTemp != Cudd_ReadOne(dd) )
83  return NULL;
84 
85  // start the network
87  pNtk->pName = Extra_UtilStrsav(pNamePo);
88  // make sure the new manager has enough inputs
89  Cudd_bddIthVar( (DdManager *)pNtk->pManFunc, Vec_PtrSize(vNamesPi) );
90  // add the PIs corresponding to the names
91  Vec_PtrForEachEntry( char *, vNamesPi, pName, i )
92  Abc_ObjAssignName( Abc_NtkCreatePi(pNtk), pName, NULL );
93  // create the node
94  pNode = Abc_NtkCreateNode( pNtk );
95  pNode->pData = (DdNode *)Cudd_bddTransfer( dd, (DdManager *)pNtk->pManFunc, (DdNode *)bFunc ); Cudd_Ref((DdNode *)pNode->pData);
96  Abc_NtkForEachPi( pNtk, pNodePi, i )
97  Abc_ObjAddFanin( pNode, pNodePi );
98  // create the only PO
99  pNodePo = Abc_NtkCreatePo( pNtk );
100  Abc_ObjAddFanin( pNodePo, pNode );
101  Abc_ObjAssignName( pNodePo, pNamePo, NULL );
102  // make the network minimum base
103  Abc_NtkMinimumBase( pNtk );
104  if ( vNamesPiFake )
105  Abc_NodeFreeNames( vNamesPiFake );
106  if ( !Abc_NtkCheck( pNtk ) )
107  fprintf( stdout, "Abc_NtkDeriveFromBdd(): Network check has failed.\n" );
108  return pNtk;
109 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
Definition: cudd.h:278
ABC_DLL int Abc_NtkMinimumBase(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcMinBase.c:48
DdNode * Cudd_Support(DdManager *dd, DdNode *f)
Definition: cuddUtil.c:740
int size
Definition: cuddInt.h:361
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition: abcNames.c:68
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
char * Extra_UtilStrsav(const char *s)
DdNode * Cudd_bddTransfer(DdManager *ddSource, DdManager *ddDestination, DdNode *f)
Definition: cuddBridge.c:409
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
ABC_DLL Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
static void check(int expr)
Definition: satSolver.c:46
ABC_DLL void Abc_NodeFreeNames(Vec_Ptr_t *vNames)
Definition: abcNames.c:257
void * pManFunc
Definition: abc.h:191
ABC_DLL Vec_Ptr_t * Abc_NodeGetFakeNames(int nNames)
Definition: abcNames.c:221
if(last==0)
Definition: sparse_int.h:34
static Abc_Obj_t * Abc_NtkCreatePi(Abc_Ntk_t *pNtk)
Definition: abc.h:303
#define cuddT(node)
Definition: cuddInt.h:636
DdNode * Cudd_ReadOne(DdManager *dd)
Definition: cuddAPI.c:987
unsigned int Cudd_NodeReadIndex(DdNode *node)
Definition: cuddAPI.c:2277
DdNode * Cudd_bddIthVar(DdManager *dd, int i)
Definition: cuddAPI.c:416
static Abc_Obj_t * Abc_NtkCreateNode(Abc_Ntk_t *pNtk)
Definition: abc.h:308
Abc_Ntk_t * Abc_NtkDeriveFromBdd(void *dd0, void *bFunc, char *pNamePo, Vec_Ptr_t *vNamesPi)
FUNCTION DEFINITIONS ///.
Definition: abcNtbdd.c:56
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static Abc_Obj_t * Abc_NtkCreatePo(Abc_Ntk_t *pNtk)
Definition: abc.h:304
char * pName
Definition: abc.h:158
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
ABC_DLL Vec_Ptr_t* Abc_NtkDfs ( Abc_Ntk_t pNtk,
int  fCollectAll 
)

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

Synopsis [Returns the DFS ordered array of logic nodes.]

Description [Collects only the internal nodes, leaving out CIs and CO. However it marks with the current TravId both CIs and COs.]

SideEffects []

SeeAlso []

Definition at line 81 of file abcDfs.c.

82 {
83  Vec_Ptr_t * vNodes;
84  Abc_Obj_t * pObj;
85  int i;
86  // set the traversal ID
87  Abc_NtkIncrementTravId( pNtk );
88  // start the array of nodes
89  vNodes = Vec_PtrAlloc( 100 );
90  Abc_NtkForEachObj( pNtk, pObj, i )
91  {
92  if ( !Abc_ObjIsCo(pObj) && !Abc_ObjIsBarBuf(pObj) )
93  continue;
96  if ( Abc_ObjIsBarBuf(pObj) )
97  Vec_PtrPush( vNodes, pObj );
98  }
99  // collect dangling nodes if asked to
100  if ( fCollectAll )
101  {
102  Abc_NtkForEachNode( pNtk, pObj, i )
103  if ( !Abc_NodeIsTravIdCurrent(pObj) )
104  Abc_NtkDfs_rec( pObj, vNodes );
105  }
106  return vNodes;
107 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Abc_Obj_t * Abc_ObjFanin0Ntk(Abc_Obj_t *pObj)
Definition: abc.h:375
static int Abc_ObjIsBarBuf(Abc_Obj_t *pObj)
Definition: abc.h:360
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
Definition: abc.h:352
if(last==0)
Definition: sparse_int.h:34
ABC_NAMESPACE_IMPL_START void Abc_NtkDfs_rec(Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
DECLARATIONS ///.
Definition: abcDfs.c:45
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:411
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
static void Abc_NodeSetTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:409
ABC_DLL Vec_Ptr_t* Abc_NtkDfsHie ( Abc_Ntk_t pNtk,
int  fCollectAll 
)

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

Synopsis [Returns the DFS ordered array of all objects.]

Description [This procedure collects everything from POs to PIs.]

SideEffects []

SeeAlso []

Definition at line 634 of file abcDfs.c.

635 {
636  Vec_Ptr_t * vNodes;
637  Abc_Obj_t * pObj;
638  int i;
639  // set the traversal ID
640  Abc_NtkIncrementTravId( pNtk );
641  // start the array of nodes
642  vNodes = Vec_PtrAlloc( 100 );
643  Abc_NtkForEachPo( pNtk, pObj, i )
644  Abc_NtkDfsHie_rec( pObj, vNodes );
645  // collect dangling nodes if asked to
646  if ( fCollectAll )
647  {
648  Abc_NtkForEachObj( pNtk, pObj, i )
649  if ( !Abc_NodeIsTravIdCurrent(pObj) )
650  Abc_NtkDfs_rec( pObj, vNodes );
651  }
652  return vNodes;
653 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
if(last==0)
Definition: sparse_int.h:34
ABC_NAMESPACE_IMPL_START void Abc_NtkDfs_rec(Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
DECLARATIONS ///.
Definition: abcDfs.c:45
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:411
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
void Abc_NtkDfsHie_rec(Abc_Obj_t *pObj, Vec_Ptr_t *vNodes)
Definition: abcDfs.c:607
ABC_DLL Vec_Ptr_t* Abc_NtkDfsIter ( Abc_Ntk_t pNtk,
int  fCollectAll 
)

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

Synopsis [Returns the DFS ordered array of logic nodes.]

Description [Collects only the internal nodes, leaving CIs and CO. However it marks with the current TravId both CIs and COs.]

SideEffects []

SeeAlso []

Definition at line 542 of file abcDfs.c.

543 {
544  Vec_Ptr_t * vNodes, * vStack;
545  Abc_Obj_t * pObj;
546  int i;
547  // set the traversal ID
548  Abc_NtkIncrementTravId( pNtk );
549  // start the array of nodes
550  vNodes = Vec_PtrAlloc( 1000 );
551  vStack = Vec_PtrAlloc( 1000 );
552  Abc_NtkForEachCo( pNtk, pObj, i )
553  {
554  Abc_NodeSetTravIdCurrent( pObj );
555  Abc_NtkDfs_iter( vStack, Abc_ObjFanin0Ntk(Abc_ObjFanin0(pObj)), vNodes );
556  }
557  // collect dangling nodes if asked to
558  if ( fCollectAll )
559  {
560  Abc_NtkForEachNode( pNtk, pObj, i )
561  if ( !Abc_NodeIsTravIdCurrent(pObj) )
562  Abc_NtkDfs_iter( vStack, pObj, vNodes );
563  }
564  Vec_PtrFree( vStack );
565  return vNodes;
566 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Abc_Obj_t * Abc_ObjFanin0Ntk(Abc_Obj_t *pObj)
Definition: abc.h:375
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
if(last==0)
Definition: sparse_int.h:34
void Abc_NtkDfs_iter(Vec_Ptr_t *vStack, Abc_Obj_t *pRoot, Vec_Ptr_t *vNodes)
Definition: abcDfs.c:484
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:411
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
static void Abc_NodeSetTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:409
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL Vec_Ptr_t* Abc_NtkDfsIterNodes ( Abc_Ntk_t pNtk,
Vec_Ptr_t vRoots 
)

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

Synopsis [Returns the DFS ordered array of logic nodes.]

Description [Collects only the internal nodes, leaving CIs and CO. However it marks with the current TravId both CIs and COs.]

SideEffects []

SeeAlso []

Definition at line 580 of file abcDfs.c.

581 {
582  Vec_Ptr_t * vNodes, * vStack;
583  Abc_Obj_t * pObj;
584  int i;
585  Abc_NtkIncrementTravId( pNtk );
586  vNodes = Vec_PtrAlloc( 1000 );
587  vStack = Vec_PtrAlloc( 1000 );
588  Vec_PtrForEachEntry( Abc_Obj_t *, vRoots, pObj, i )
590  Abc_NtkDfs_iter( vStack, Abc_ObjRegular(pObj), vNodes );
591  Vec_PtrFree( vStack );
592  return vNodes;
593 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
if(last==0)
Definition: sparse_int.h:34
void Abc_NtkDfs_iter(Vec_Ptr_t *vStack, Abc_Obj_t *pRoot, Vec_Ptr_t *vNodes)
Definition: abcDfs.c:484
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:411
static Abc_Obj_t * Abc_ObjRegular(Abc_Obj_t *p)
Definition: abc.h:323
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL Vec_Ptr_t* Abc_NtkDfsNodes ( Abc_Ntk_t pNtk,
Abc_Obj_t **  ppNodes,
int  nNodes 
)

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

Synopsis [Returns the DFS ordered array of logic nodes.]

Description [Collects only the internal nodes, leaving out PIs, POs and latches.]

SideEffects []

SeeAlso []

Definition at line 120 of file abcDfs.c.

121 {
122  Vec_Ptr_t * vNodes;
123  int i;
124  // set the traversal ID
125  Abc_NtkIncrementTravId( pNtk );
126  // start the array of nodes
127  vNodes = Vec_PtrAlloc( 100 );
128  // go through the PO nodes and call for each of them
129  for ( i = 0; i < nNodes; i++ )
130  {
131  if ( Abc_NtkIsStrash(pNtk) && Abc_AigNodeIsConst(ppNodes[i]) )
132  continue;
133  if ( Abc_ObjIsCo(ppNodes[i]) )
134  {
135  Abc_NodeSetTravIdCurrent(ppNodes[i]);
136  Abc_NtkDfs_rec( Abc_ObjFanin0Ntk(Abc_ObjFanin0(ppNodes[i])), vNodes );
137  }
138  else if ( Abc_ObjIsNode(ppNodes[i]) || Abc_ObjIsCi(ppNodes[i]) )
139  Abc_NtkDfs_rec( ppNodes[i], vNodes );
140  }
141  return vNodes;
142 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
Definition: abc.h:351
static Abc_Obj_t * Abc_ObjFanin0Ntk(Abc_Obj_t *pObj)
Definition: abc.h:375
static int Abc_AigNodeIsConst(Abc_Obj_t *pNode)
Definition: abc.h:396
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
Definition: abc.h:352
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
ABC_NAMESPACE_IMPL_START void Abc_NtkDfs_rec(Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
DECLARATIONS ///.
Definition: abcDfs.c:45
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
static void Abc_NodeSetTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:409
ABC_DLL Vec_Ptr_t* Abc_NtkDfsReverse ( Abc_Ntk_t pNtk)

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

Synopsis [Returns the reverse DFS ordered array of logic nodes.]

Description [Collects only the internal nodes, leaving out CIs/COs. However it marks both CIs and COs with the current TravId.]

SideEffects []

SeeAlso []

Definition at line 190 of file abcDfs.c.

191 {
192  Vec_Ptr_t * vNodes;
193  Abc_Obj_t * pObj, * pFanout;
194  int i, k;
195  // set the traversal ID
196  Abc_NtkIncrementTravId( pNtk );
197  // start the array of nodes
198  vNodes = Vec_PtrAlloc( 100 );
199  Abc_NtkForEachCi( pNtk, pObj, i )
200  {
201  Abc_NodeSetTravIdCurrent( pObj );
202  pObj = Abc_ObjFanout0Ntk(pObj);
203  Abc_ObjForEachFanout( pObj, pFanout, k )
204  Abc_NtkDfsReverse_rec( pFanout, vNodes );
205  }
206  // add constant nodes in the end
207  if ( !Abc_NtkIsStrash(pNtk) ) {
208  Abc_NtkForEachNode( pNtk, pObj, i )
209  if ( Abc_NodeIsConst(pObj) )
210  Vec_PtrPush( vNodes, pObj );
211  }
212  return vNodes;
213 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
ABC_DLL int Abc_NodeIsConst(Abc_Obj_t *pNode)
Definition: abcObj.c:843
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
if(last==0)
Definition: sparse_int.h:34
static Abc_Obj_t * Abc_ObjFanout0Ntk(Abc_Obj_t *pObj)
Definition: abc.h:376
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition: abc.h:526
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
void Abc_NtkDfsReverse_rec(Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
Definition: abcDfs.c:156
static void Abc_NodeSetTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:409
ABC_DLL Vec_Ptr_t* Abc_NtkDfsReverseNodes ( Abc_Ntk_t pNtk,
Abc_Obj_t **  ppNodes,
int  nNodes 
)

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

Synopsis [Returns the levelized array of TFO nodes.]

Description [Collects the levelized array of internal nodes, leaving out CIs/COs. However it marks both CIs and COs with the current TravId.]

SideEffects []

SeeAlso []

Definition at line 263 of file abcDfs.c.

264 {
265  Vec_Ptr_t * vNodes;
266  Abc_Obj_t * pObj, * pFanout;
267  int i, k;
268  assert( Abc_NtkIsStrash(pNtk) );
269  // set the traversal ID
270  Abc_NtkIncrementTravId( pNtk );
271  // start the array of nodes
272  vNodes = Vec_PtrStart( Abc_AigLevel(pNtk) + 1 );
273  for ( i = 0; i < nNodes; i++ )
274  {
275  pObj = ppNodes[i];
276  assert( Abc_ObjIsCi(pObj) );
277  Abc_NodeSetTravIdCurrent( pObj );
278  pObj = Abc_ObjFanout0Ntk(pObj);
279  Abc_ObjForEachFanout( pObj, pFanout, k )
280  Abc_NtkDfsReverseNodes_rec( pFanout, vNodes );
281  }
282  return vNodes;
283 }
static Vec_Ptr_t * Vec_PtrStart(int nSize)
Definition: vecPtr.h:106
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
Definition: abc.h:351
void Abc_NtkDfsReverseNodes_rec(Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
Definition: abcDfs.c:226
ABC_DLL int Abc_AigLevel(Abc_Ntk_t *pNtk)
Definition: abcAig.c:292
static Abc_Obj_t * Abc_ObjFanout0Ntk(Abc_Obj_t *pObj)
Definition: abc.h:376
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition: abc.h:526
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
#define assert(ex)
Definition: util_old.h:213
static void Abc_NodeSetTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:409
ABC_DLL Vec_Ptr_t* Abc_NtkDfsReverseNodesContained ( Abc_Ntk_t pNtk,
Abc_Obj_t **  ppNodes,
int  nNodes 
)

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

Synopsis [Returns the levelized array of TFO nodes.]

Description [Collects the levelized array of internal nodes, leaving out CIs/COs. However it marks both CIs and COs with the current TravId. Collects only the nodes whose support does not exceed the set of given CI nodes.]

SideEffects []

SeeAlso []

Definition at line 298 of file abcDfs.c.

299 {
300  Vec_Ptr_t * vNodes;
301  Abc_Obj_t * pObj, * pFanout, * pFanin;
302  int i, k, m, nLevels;
303  // set the levels
304  nLevels = Abc_NtkLevel( pNtk );
305  // set the traversal ID
306  Abc_NtkIncrementTravId( pNtk );
307  // start the array of nodes
308  vNodes = Vec_PtrStart( nLevels + 2 );
309  for ( i = 0; i < nNodes; i++ )
310  {
311  pObj = ppNodes[i];
312  assert( Abc_ObjIsCi(pObj) );
313  Abc_NodeSetTravIdCurrent( pObj );
314  // add to the array
315  assert( pObj->Level == 0 );
316  pObj->pCopy = (Abc_Obj_t *)Vec_PtrEntry( vNodes, pObj->Level );
317  Vec_PtrWriteEntry( vNodes, pObj->Level, pObj );
318  }
319  // iterate through the levels
320  for ( i = 0; i <= nLevels; i++ )
321  {
322  // iterate through the nodes on each level
323  for ( pObj = (Abc_Obj_t *)Vec_PtrEntry(vNodes, i); pObj; pObj = pObj->pCopy )
324  {
325  // iterate through the fanouts of each node
326  Abc_ObjForEachFanout( pObj, pFanout, k )
327  {
328  // skip visited nodes
329  if ( Abc_NodeIsTravIdCurrent(pFanout) )
330  continue;
331  // visit the fanins of this fanout
332  Abc_ObjForEachFanin( pFanout, pFanin, m )
333  {
334  if ( !Abc_NodeIsTravIdCurrent(pFanin) )
335  break;
336  }
337  if ( m < Abc_ObjFaninNum(pFanout) )
338  continue;
339  // all fanins are already collected
340 
341  // mark the node as visited
342  Abc_NodeSetTravIdCurrent( pFanout );
343  // handle the COs
344  if ( Abc_ObjIsCo(pFanout) )
345  pFanout->Level = nLevels + 1;
346  // add to the array
347  pFanout->pCopy = (Abc_Obj_t *)Vec_PtrEntry( vNodes, pFanout->Level );
348  Vec_PtrWriteEntry( vNodes, pFanout->Level, pFanout );
349  // handle the COs
350  if ( Abc_ObjIsCo(pFanout) )
351  pFanout->Level = 0;
352  }
353  }
354  }
355  return vNodes;
356 }
static Vec_Ptr_t * Vec_PtrStart(int nSize)
Definition: vecPtr.h:106
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
Definition: abc.h:351
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
int Abc_NtkLevel(Abc_Ntk_t *pNtk)
Definition: abcDfs.c:1265
unsigned Level
Definition: abc.h:142
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
Definition: abc.h:352
Abc_Obj_t * pCopy
Definition: abc.h:148
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:411
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition: abc.h:526
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
#define assert(ex)
Definition: util_old.h:213
static void Abc_NodeSetTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:409
ABC_DLL Vec_Ptr_t* Abc_NtkDfsSeq ( Abc_Ntk_t pNtk)

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

Synopsis [Returns the array of nodes and latches reachable from POs.]

Description []

SideEffects []

SeeAlso []

Definition at line 397 of file abcDfs.c.

398 {
399  Vec_Ptr_t * vNodes;
400  Abc_Obj_t * pObj;
401  int i;
402  assert( !Abc_NtkIsNetlist(pNtk) );
403  // set the traversal ID
404  Abc_NtkIncrementTravId( pNtk );
405  // start the array of nodes
406  vNodes = Vec_PtrAlloc( 100 );
407  Abc_NtkForEachPo( pNtk, pObj, i )
408  Abc_NtkDfsSeq_rec( pObj, vNodes );
409  // mark the PIs
410  Abc_NtkForEachPi( pNtk, pObj, i )
411  Abc_NtkDfsSeq_rec( pObj, vNodes );
412  return vNodes;
413 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
void Abc_NtkDfsSeq_rec(Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
Definition: abcDfs.c:370
#define assert(ex)
Definition: util_old.h:213
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
ABC_DLL Vec_Ptr_t* Abc_NtkDfsSeqReverse ( Abc_Ntk_t pNtk)

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

Synopsis [Returns the array of nodes and latches reachable from POs.]

Description []

SideEffects []

SeeAlso []

Definition at line 454 of file abcDfs.c.

455 {
456  Vec_Ptr_t * vNodes;
457  Abc_Obj_t * pObj;
458  int i;
459  assert( !Abc_NtkIsNetlist(pNtk) );
460  // set the traversal ID
461  Abc_NtkIncrementTravId( pNtk );
462  // start the array of nodes
463  vNodes = Vec_PtrAlloc( 100 );
464  Abc_NtkForEachPi( pNtk, pObj, i )
465  Abc_NtkDfsSeqReverse_rec( pObj, vNodes );
466  // mark the logic feeding into POs
467  Abc_NtkForEachPo( pNtk, pObj, i )
468  Abc_NtkDfsSeq_rec( pObj, vNodes );
469  return vNodes;
470 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
void Abc_NtkDfsSeq_rec(Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
Definition: abcDfs.c:370
#define assert(ex)
Definition: util_old.h:213
void Abc_NtkDfsSeqReverse_rec(Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
Definition: abcDfs.c:427
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
ABC_DLL Vec_Ptr_t* Abc_NtkDfsWithBoxes ( Abc_Ntk_t pNtk)

Definition at line 768 of file abcDfs.c.

769 {
770  Vec_Ptr_t * vNodes;
771  Abc_Obj_t * pObj;
772  int i;
773  Abc_NtkIncrementTravId( pNtk );
774  vNodes = Vec_PtrAlloc( 100 );
775  Abc_NtkForEachPo( pNtk, pObj, i )
776  {
779  }
780  return vNodes;
781 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Abc_Obj_t * Abc_ObjFanin0Ntk(Abc_Obj_t *pObj)
Definition: abc.h:375
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
void Abc_NtkDfsWithBoxes_rec(Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
Definition: abcDfs.c:746
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
static int Abc_ObjIsNet(Abc_Obj_t *pObj)
Definition: abc.h:354
#define assert(ex)
Definition: util_old.h:213
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
ABC_DLL int Abc_NtkDoCheck ( Abc_Ntk_t pNtk)

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

Synopsis [Checks the integrity of the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 93 of file abcCheck.c.

94 {
95  Abc_Obj_t * pObj, * pNet, * pNode;
96  int i;
97 
98  // check network types
99  if ( !Abc_NtkIsNetlist(pNtk) && !Abc_NtkIsLogic(pNtk) && !Abc_NtkIsStrash(pNtk) )
100  {
101  fprintf( stdout, "NetworkCheck: Unknown network type.\n" );
102  return 0;
103  }
104  if ( !Abc_NtkHasSop(pNtk) && !Abc_NtkHasBdd(pNtk) && !Abc_NtkHasAig(pNtk) && !Abc_NtkHasMapping(pNtk) && !Abc_NtkHasBlifMv(pNtk) && !Abc_NtkHasBlackbox(pNtk) )
105  {
106  fprintf( stdout, "NetworkCheck: Unknown functionality type.\n" );
107  return 0;
108  }
109  if ( Abc_NtkHasMapping(pNtk) )
110  {
111  if ( pNtk->pManFunc != Abc_FrameReadLibGen() )
112  {
113  fprintf( stdout, "NetworkCheck: The library of the mapped network is not the global library.\n" );
114  return 0;
115  }
116  }
117 
118  if ( Abc_NtkHasOnlyLatchBoxes(pNtk) )
119  {
120  // check CI/CO numbers
121  if ( Abc_NtkPiNum(pNtk) + Abc_NtkLatchNum(pNtk) != Abc_NtkCiNum(pNtk) )
122  {
123  fprintf( stdout, "NetworkCheck: Number of CIs does not match number of PIs and latches.\n" );
124  fprintf( stdout, "One possible reason is that latches are added twice:\n" );
125  fprintf( stdout, "in procedure Abc_NtkCreateObj() and in the user's code.\n" );
126  return 0;
127  }
128  if ( Abc_NtkPoNum(pNtk) + Abc_NtkLatchNum(pNtk) != Abc_NtkCoNum(pNtk) )
129  {
130  fprintf( stdout, "NetworkCheck: Number of COs does not match number of POs, asserts, and latches.\n" );
131  fprintf( stdout, "One possible reason is that latches are added twice:\n" );
132  fprintf( stdout, "in procedure Abc_NtkCreateObj() and in the user's code.\n" );
133  return 0;
134  }
135  }
136 
137  // check the names
138  if ( !Abc_NtkCheckNames( pNtk ) )
139  return 0;
140 
141  // check PIs and POs
142  Abc_NtkCleanCopy( pNtk );
143  if ( !Abc_NtkCheckPis( pNtk ) )
144  return 0;
145  if ( !Abc_NtkCheckPos( pNtk ) )
146  return 0;
147 
148  if ( Abc_NtkHasBlackbox(pNtk) )
149  return 1;
150 
151  // check the connectivity of objects
152  Abc_NtkForEachObj( pNtk, pObj, i )
153  if ( !Abc_NtkCheckObj( pNtk, pObj ) )
154  return 0;
155 
156  // if it is a netlist change nets and latches
157  if ( Abc_NtkIsNetlist(pNtk) )
158  {
159  if ( Abc_NtkNetNum(pNtk) == 0 )
160  fprintf( stdout, "NetworkCheck: Warning! Netlist has no nets.\n" );
161  // check the nets
162  Abc_NtkForEachNet( pNtk, pNet, i )
163  if ( !Abc_NtkCheckNet( pNtk, pNet ) )
164  return 0;
165  }
166  else
167  {
168  if ( Abc_NtkNetNum(pNtk) != 0 )
169  {
170  fprintf( stdout, "NetworkCheck: A network that is not a netlist has nets.\n" );
171  return 0;
172  }
173  }
174 
175  // check the nodes
176  if ( Abc_NtkIsStrash(pNtk) )
177  Abc_AigCheck( (Abc_Aig_t *)pNtk->pManFunc );
178  else
179  {
180  Abc_NtkForEachNode( pNtk, pNode, i )
181  if ( !Abc_NtkCheckNode( pNtk, pNode ) )
182  return 0;
183  }
184 
185  // check the latches
186  Abc_NtkForEachLatch( pNtk, pNode, i )
187  if ( !Abc_NtkCheckLatch( pNtk, pNode ) )
188  return 0;
189 
190  // finally, check for combinational loops
191 // clk = Abc_Clock();
192  if ( !Abc_NtkIsAcyclic( pNtk ) )
193  {
194  fprintf( stdout, "NetworkCheck: Network contains a combinational loop.\n" );
195  return 0;
196  }
197 // ABC_PRT( "Acyclic ", Abc_Clock() - clk );
198 
199  // check the EXDC network if present
200  if ( pNtk->pExdc )
201  Abc_NtkCheck( pNtk->pExdc );
202 /*
203  // check the hierarchy
204  if ( Abc_NtkIsNetlist(pNtk) && pNtk->tName2Model )
205  {
206  stmm_generator * gen;
207  Abc_Ntk_t * pNtkTemp;
208  char * pName;
209  // check other networks
210  stmm_foreach_item( pNtk->tName2Model, gen, &pName, (char **)&pNtkTemp )
211  {
212  pNtkTemp->fHiePath = pNtkTemp->fHieVisited = 0;
213  if ( !Abc_NtkCheck( pNtkTemp ) )
214  return 0;
215  }
216  // check acyclic dependency of the models
217  if ( !Abc_NtkIsAcyclicHierarchy( pNtk ) )
218  {
219  fprintf( stdout, "NetworkCheck: Network hierarchical dependences contains a cycle.\n" );
220  return 0;
221  }
222  }
223 */
224  return 1;
225 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
ABC_DLL void * Abc_FrameReadLibGen()
Definition: mainFrame.c:56
ABC_DLL int Abc_NtkIsAcyclic(Abc_Ntk_t *pNtk)
Definition: abcDfs.c:1422
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
ABC_DLL int Abc_AigCheck(Abc_Aig_t *pMan)
Definition: abcAig.c:226
static int Abc_NtkCheckPos(Abc_Ntk_t *pNtk)
Definition: abcCheck.c:360
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
static int Abc_NtkHasBlifMv(Abc_Ntk_t *pNtk)
Definition: abc.h:257
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
DECLARATIONS ///.
Definition: abcAig.c:52
void * pManFunc
Definition: abc.h:191
static int Abc_NtkHasBlackbox(Abc_Ntk_t *pNtk)
Definition: abc.h:258
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
static int Abc_NtkCheckNet(Abc_Ntk_t *pNtk, Abc_Obj_t *pNet)
Definition: abcCheck.c:493
#define Abc_NtkForEachNet(pNtk, pNet, i)
Definition: abc.h:458
#define Abc_NtkForEachLatch(pNtk, pObj, i)
Definition: abc.h:497
static ABC_NAMESPACE_IMPL_START int Abc_NtkCheckNames(Abc_Ntk_t *pNtk)
DECLARATIONS ///.
Definition: abcCheck.c:238
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
static int Abc_NtkCheckPis(Abc_Ntk_t *pNtk)
Definition: abcCheck.c:312
int Abc_NtkCheckObj(Abc_Ntk_t *pNtk, Abc_Obj_t *pObj)
Definition: abcCheck.c:414
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:286
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:285
static int Abc_NtkCheckNode(Abc_Ntk_t *pNtk, Abc_Obj_t *pNode)
Definition: abcCheck.c:519
static int Abc_NtkHasOnlyLatchBoxes(Abc_Ntk_t *pNtk)
Definition: abc.h:298
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:507
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
static int Abc_NtkCheckLatch(Abc_Ntk_t *pNtk, Abc_Obj_t *pLatch)
Definition: abcCheck.c:571
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
static int Abc_NtkNetNum(Abc_Ntk_t *pNtk)
Definition: abc.h:292
ABC_DLL Odc_Man_t* Abc_NtkDontCareAlloc ( int  nVarsMax,
int  nLevels,
int  fVerbose,
int  fVeryVerbose 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Allocates the don't-care manager.]

Description [The parameters are the max number of cut variables, the number of fanout levels used for the ODC computation, and verbosiness.]

SideEffects []

SeeAlso []

Definition at line 162 of file abcOdc.c.

163 {
164  Odc_Man_t * p;
165  unsigned * pData;
166  int i, k;
167  p = ABC_ALLOC( Odc_Man_t, 1 );
168  memset( p, 0, sizeof(Odc_Man_t) );
169  assert( nVarsMax > 4 && nVarsMax < 16 );
170  assert( nLevels > 0 && nLevels < 10 );
171 
172  srand( 0xABC );
173 
174  // dont'-care parameters
175  p->nVarsMax = nVarsMax;
176  p->nLevels = nLevels;
177  p->fVerbose = fVerbose;
178  p->fVeryVerbose = fVeryVerbose;
179  p->nPercCutoff = 10;
180 
181  // windowing
182  p->vRoots = Vec_PtrAlloc( 128 );
183  p->vBranches = Vec_PtrAlloc( 128 );
184 
185  // internal AIG package
186  // allocate room for objects
188  p->pObjs = ABC_ALLOC( Odc_Obj_t, p->nObjsAlloc * sizeof(Odc_Obj_t) );
189  p->nPis = nVarsMax + 32;
190  p->nObjs = 1 + p->nPis;
191  memset( p->pObjs, 0, p->nObjs * sizeof(Odc_Obj_t) );
192  // set the PI masks
193  for ( i = 0; i < 32; i++ )
194  p->pObjs[1 + p->nVarsMax + i].uMask = (1 << i);
195  // allocate hash table
196  p->nTableSize = p->nObjsAlloc/3 + 1;
197  p->pTable = ABC_ALLOC( Odc_Lit_t, p->nTableSize * sizeof(Odc_Lit_t) );
198  memset( p->pTable, 0, p->nTableSize * sizeof(Odc_Lit_t) );
199  p->vUsedSpots = Vec_IntAlloc( 1000 );
200 
201  // truth tables
202  p->nWords = Abc_TruthWordNum( p->nVarsMax );
203  p->nBits = p->nWords * 8 * sizeof(unsigned);
206 
207  // set elementary truth tables
208  Abc_InfoFill( (unsigned *)Vec_PtrEntry(p->vTruths, 0), p->nWords );
209  for ( k = 0; k < p->nVarsMax; k++ )
210  {
211 // pData = Odc_ObjTruth( p, Odc_Var(p, k) );
212  pData = (unsigned *)Vec_PtrEntry( p->vTruthsElem, k );
213  Abc_InfoClear( pData, p->nWords );
214  for ( i = 0; i < p->nBits; i++ )
215  if ( i & (1 << k) )
216  pData[i>>5] |= (1 << (i&31));
217  }
218 
219  // set random truth table for the additional inputs
220  for ( k = p->nVarsMax; k < p->nPis; k++ )
221  {
222  pData = Odc_ObjTruth( p, Odc_Var(p, k) );
223  Abc_InfoRandom( pData, p->nWords );
224  }
225 
226  // set the miter to the unused value
227  p->iRoot = 0xffff;
228  return p;
229 }
char * memset()
Vec_Ptr_t * vBranches
Definition: abcOdc.c:58
unsigned uMask
Definition: abcOdc.c:42
static unsigned * Odc_ObjTruth(Odc_Man_t *p, Odc_Lit_t Lit)
Definition: abcOdc.c:137
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nVarsMax
Definition: abcOdc.c:48
static Odc_Lit_t Odc_Var(Odc_Man_t *p, int i)
Definition: abcOdc.c:114
static void Abc_InfoFill(unsigned *p, int nWords)
Definition: abc.h:237
#define ABC_DC_MAX_NODES
DECLARATIONS ///.
Definition: abcOdc.c:30
int fVerbose
Definition: abcOdc.c:50
int fVeryVerbose
Definition: abcOdc.c:51
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static int Abc_TruthWordNum(int nVars)
Definition: abc_global.h:256
int nPis
Definition: abcOdc.c:62
Odc_Lit_t iRoot
Definition: abcOdc.c:66
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
int nPercCutoff
Definition: abcOdc.c:52
int nObjs
Definition: abcOdc.c:63
static void Abc_InfoClear(unsigned *p, int nWords)
Definition: abc.h:236
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
Vec_Ptr_t * vTruths
Definition: abcOdc.c:76
int nBits
Definition: abcOdc.c:74
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
Vec_Ptr_t * vRoots
Definition: abcOdc.c:57
Vec_Ptr_t * vTruthsElem
Definition: abcOdc.c:77
Odc_Obj_t * pObjs
Definition: abcOdc.c:65
#define assert(ex)
Definition: util_old.h:213
static void Abc_InfoRandom(unsigned *p, int nWords)
Definition: abc.h:235
int nObjsAlloc
Definition: abcOdc.c:64
Odc_Lit_t * pTable
Definition: abcOdc.c:69
unsigned short Odc_Lit_t
Definition: abcOdc.c:32
Vec_Int_t * vUsedSpots
Definition: abcOdc.c:71
int nLevels
Definition: abcOdc.c:49
int nTableSize
Definition: abcOdc.c:70
static Vec_Ptr_t * Vec_PtrAllocSimInfo(int nEntries, int nWords)
Definition: vecPtr.h:929
int nWords
Definition: abcOdc.c:75
ABC_DLL void Abc_NtkDontCareClear ( Odc_Man_t p)

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

Synopsis [Clears the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 242 of file abcOdc.c.

243 {
244  abctime clk = Abc_Clock();
245  // clean the structural hashing table
246  if ( Vec_IntSize(p->vUsedSpots) > p->nTableSize/3 ) // more than one third
247  memset( p->pTable, 0, sizeof(Odc_Lit_t) * p->nTableSize );
248  else
249  {
250  int iSpot, i;
251  Vec_IntForEachEntry( p->vUsedSpots, iSpot, i )
252  p->pTable[iSpot] = 0;
253  }
254  Vec_IntClear( p->vUsedSpots );
255  // reset the number of nodes
256  p->nObjs = 1 + p->nPis;
257  // reset the root node
258  p->iRoot = 0xffff;
259 
260 p->timeClean += Abc_Clock() - clk;
261 }
char * memset()
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
ABC_INT64_T abctime
Definition: abc_global.h:278
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
Odc_Lit_t * pTable
Definition: abcOdc.c:69
unsigned short Odc_Lit_t
Definition: abcOdc.c:32
Vec_Int_t * vUsedSpots
Definition: abcOdc.c:71
int nTableSize
Definition: abcOdc.c:70
ABC_DLL int Abc_NtkDontCareCompute ( Odc_Man_t p,
Abc_Obj_t pNode,
Vec_Ptr_t vLeaves,
unsigned *  puTruth 
)

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

Synopsis [Computes ODCs for the node in terms of the cut variables.]

Description [Returns the number of don't care minterms in the truth table. In particular, this procedure returns 0 if there is no don't-cares.]

SideEffects []

SeeAlso []

Definition at line 1033 of file abcOdc.c.

1034 {
1035  int nMints, RetValue;
1036  abctime clk, clkTotal = Abc_Clock();
1037 
1038  p->nWins++;
1039 
1040  // set the parameters
1041  assert( !Abc_ObjIsComplement(pNode) );
1042  assert( Abc_ObjIsNode(pNode) );
1043  assert( Vec_PtrSize(vLeaves) <= p->nVarsMax );
1044  p->vLeaves = vLeaves;
1045  p->pNode = pNode;
1046 
1047  // compute the window
1048 clk = Abc_Clock();
1049  RetValue = Abc_NtkDontCareWindow( p );
1050 p->timeWin += Abc_Clock() - clk;
1051  if ( !RetValue )
1052  {
1053 p->timeAbort += Abc_Clock() - clkTotal;
1054  Abc_InfoFill( puTruth, p->nWords );
1055  p->nWinsEmpty++;
1056  return 0;
1057  }
1058 
1059  if ( p->fVeryVerbose )
1060  {
1061  printf( " %5d : ", pNode->Id );
1062  printf( "Leaf = %2d ", Vec_PtrSize(p->vLeaves) );
1063  printf( "Root = %2d ", Vec_PtrSize(p->vRoots) );
1064  printf( "Bran = %2d ", Vec_PtrSize(p->vBranches) );
1065  printf( " | " );
1066  }
1067 
1068  // transfer the window into the AIG package
1069 clk = Abc_Clock();
1071 p->timeMiter += Abc_Clock() - clk;
1072 
1073  // simulate to estimate the amount of don't-cares
1074 clk = Abc_Clock();
1075  nMints = Abc_NtkDontCareSimulateBefore( p, puTruth );
1076 p->timeSim += Abc_Clock() - clk;
1077  if ( p->fVeryVerbose )
1078  {
1079  printf( "AIG = %5d ", Odc_NodeNum(p) );
1080  printf( "%6.2f %% ", 100.0 * (p->nBits - nMints) / p->nBits );
1081  }
1082 
1083  // if there is less then the given percentage of don't-cares, skip
1084  if ( 100.0 * (p->nBits - nMints) / p->nBits < 1.0 * p->nPercCutoff )
1085  {
1086 p->timeAbort += Abc_Clock() - clkTotal;
1087  if ( p->fVeryVerbose )
1088  printf( "Simulation cutoff.\n" );
1089  Abc_InfoFill( puTruth, p->nWords );
1090  p->nSimsEmpty++;
1091  return 0;
1092  }
1093 
1094  // quantify external variables
1095 clk = Abc_Clock();
1096  RetValue = Abc_NtkDontCareQuantify( p );
1097 p->timeQuant += Abc_Clock() - clk;
1098  if ( !RetValue )
1099  {
1100 p->timeAbort += Abc_Clock() - clkTotal;
1101  if ( p->fVeryVerbose )
1102  printf( "=== Overflow! ===\n" );
1103  Abc_InfoFill( puTruth, p->nWords );
1104  p->nQuantsOver++;
1105  return 0;
1106  }
1107 
1108  // get the truth table
1109 clk = Abc_Clock();
1111  nMints = Abc_NtkDontCareSimulate( p, puTruth );
1112 p->timeTruth += Abc_Clock() - clk;
1113  if ( p->fVeryVerbose )
1114  {
1115  printf( "AIG = %5d ", Odc_NodeNum(p) );
1116  printf( "%6.2f %% ", 100.0 * (p->nBits - nMints) / p->nBits );
1117  printf( "\n" );
1118  }
1119 p->timeTotal += Abc_Clock() - clkTotal;
1120  p->nWinsFinish++;
1121  p->nTotalDcs += (int)(100.0 * (p->nBits - nMints) / p->nBits);
1122  return nMints;
1123 }
Vec_Ptr_t * vBranches
Definition: abcOdc.c:58
int Abc_NtkDontCareSimulate(Odc_Man_t *p, unsigned *puTruth)
Definition: abcOdc.c:982
int Abc_NtkDontCareWindow(Odc_Man_t *p)
Definition: abcOdc.c:477
int nVarsMax
Definition: abcOdc.c:48
Abc_Obj_t * pNode
Definition: abcOdc.c:55
abctime timeTruth
Definition: abcOdc.c:94
static void Abc_InfoFill(unsigned *p, int nWords)
Definition: abc.h:237
Vec_Ptr_t * vLeaves
Definition: abcOdc.c:56
abctime timeTotal
Definition: abcOdc.c:95
static int Odc_NodeNum(Odc_Man_t *p)
Definition: abcOdc.c:102
int nTotalDcs
Definition: abcOdc.c:86
int nWinsEmpty
Definition: abcOdc.c:82
abctime timeWin
Definition: abcOdc.c:90
int fVeryVerbose
Definition: abcOdc.c:51
static abctime Abc_Clock()
Definition: abc_global.h:279
abctime timeMiter
Definition: abcOdc.c:91
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
abctime timeAbort
Definition: abcOdc.c:96
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
int Abc_NtkDontCareTransfer(Odc_Man_t *p)
Definition: abcOdc.c:688
int nSimsEmpty
Definition: abcOdc.c:83
int Abc_NtkDontCareQuantify(Odc_Man_t *p)
Definition: abcOdc.c:781
int nPercCutoff
Definition: abcOdc.c:52
abctime timeSim
Definition: abcOdc.c:92
abctime timeQuant
Definition: abcOdc.c:93
int Abc_NtkDontCareSimulateBefore(Odc_Man_t *p, unsigned *puTruth)
Definition: abcOdc.c:1003
int nBits
Definition: abcOdc.c:74
int nWins
Definition: abcOdc.c:81
int Id
Definition: abc.h:132
int nQuantsOver
Definition: abcOdc.c:84
void Abc_NtkDontCareSimulateSetElem(Odc_Man_t *p)
Definition: abcOdc.c:843
Vec_Ptr_t * vRoots
Definition: abcOdc.c:57
#define assert(ex)
Definition: util_old.h:213
static int Abc_ObjIsComplement(Abc_Obj_t *p)
Definition: abc.h:322
ABC_INT64_T abctime
Definition: abc_global.h:278
int nWinsFinish
Definition: abcOdc.c:85
int nWords
Definition: abcOdc.c:75
ABC_DLL void Abc_NtkDontCareFree ( Odc_Man_t p)

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

Synopsis [Frees the don't-care manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 274 of file abcOdc.c.

275 {
276  if ( p->fVerbose )
277  {
278  printf( "Wins = %5d. Empty = %5d. SimsEmpty = %5d. QuantOver = %5d. WinsFinish = %5d.\n",
279  p->nWins, p->nWinsEmpty, p->nSimsEmpty, p->nQuantsOver, p->nWinsFinish );
280  printf( "Ave DCs per window = %6.2f %%. Ave DCs per finished window = %6.2f %%.\n",
281  1.0*p->nTotalDcs/p->nWins, 1.0*p->nTotalDcs/p->nWinsFinish );
282  printf( "Runtime stats of the ODC manager:\n" );
283  ABC_PRT( "Cleaning ", p->timeClean );
284  ABC_PRT( "Windowing ", p->timeWin );
285  ABC_PRT( "Miter ", p->timeMiter );
286  ABC_PRT( "Simulation ", p->timeSim );
287  ABC_PRT( "Quantifying ", p->timeQuant );
288  ABC_PRT( "Truth table ", p->timeTruth );
289  ABC_PRT( "TOTAL ", p->timeTotal );
290  ABC_PRT( "Aborted ", p->timeAbort );
291  }
292  Vec_PtrFree( p->vRoots );
293  Vec_PtrFree( p->vBranches );
294  Vec_PtrFree( p->vTruths );
295  Vec_PtrFree( p->vTruthsElem );
296  Vec_IntFree( p->vUsedSpots );
297  ABC_FREE( p->pObjs );
298  ABC_FREE( p->pTable );
299  ABC_FREE( p );
300 }
Vec_Ptr_t * vBranches
Definition: abcOdc.c:58
abctime timeTruth
Definition: abcOdc.c:94
abctime timeTotal
Definition: abcOdc.c:95
int nTotalDcs
Definition: abcOdc.c:86
int nWinsEmpty
Definition: abcOdc.c:82
int fVerbose
Definition: abcOdc.c:50
abctime timeWin
Definition: abcOdc.c:90
abctime timeMiter
Definition: abcOdc.c:91
abctime timeAbort
Definition: abcOdc.c:96
int nSimsEmpty
Definition: abcOdc.c:83
abctime timeSim
Definition: abcOdc.c:92
abctime timeQuant
Definition: abcOdc.c:93
Vec_Ptr_t * vTruths
Definition: abcOdc.c:76
int nWins
Definition: abcOdc.c:81
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define ABC_PRT(a, t)
Definition: abc_global.h:220
int nQuantsOver
Definition: abcOdc.c:84
Vec_Ptr_t * vRoots
Definition: abcOdc.c:57
Vec_Ptr_t * vTruthsElem
Definition: abcOdc.c:77
Odc_Obj_t * pObjs
Definition: abcOdc.c:65
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
int nWinsFinish
Definition: abcOdc.c:85
abctime timeClean
Definition: abcOdc.c:89
Odc_Lit_t * pTable
Definition: abcOdc.c:69
Vec_Int_t * vUsedSpots
Definition: abcOdc.c:71
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL Abc_Ntk_t* Abc_NtkDup ( Abc_Ntk_t pNtk)

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

Synopsis [Duplicate the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 419 of file abcNtk.c.

420 {
421  Abc_Ntk_t * pNtkNew;
422  Abc_Obj_t * pObj, * pFanin;
423  int i, k;
424  if ( pNtk == NULL )
425  return NULL;
426  // start the network
427  pNtkNew = Abc_NtkStartFrom( pNtk, pNtk->ntkType, pNtk->ntkFunc );
428  // copy the internal nodes
429  if ( Abc_NtkIsStrash(pNtk) )
430  {
431  // copy the AND gates
432  Abc_AigForEachAnd( pNtk, pObj, i )
433  pObj->pCopy = Abc_AigAnd( (Abc_Aig_t *)pNtkNew->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild1Copy(pObj) );
434  // relink the choice nodes
435  Abc_AigForEachAnd( pNtk, pObj, i )
436  if ( pObj->pData )
437  pObj->pCopy->pData = ((Abc_Obj_t *)pObj->pData)->pCopy;
438  // relink the CO nodes
439  Abc_NtkForEachCo( pNtk, pObj, i )
440  Abc_ObjAddFanin( pObj->pCopy, Abc_ObjChild0Copy(pObj) );
441  // get the number of nodes before and after
442  if ( Abc_NtkNodeNum(pNtk) != Abc_NtkNodeNum(pNtkNew) )
443  printf( "Warning: Structural hashing during duplication reduced %d nodes (this is a minor bug).\n",
444  Abc_NtkNodeNum(pNtk) - Abc_NtkNodeNum(pNtkNew) );
445  }
446  else
447  {
448  // duplicate the nets and nodes (CIs/COs/latches already dupped)
449  Abc_NtkForEachObj( pNtk, pObj, i )
450  if ( pObj->pCopy == NULL )
451  Abc_NtkDupObj(pNtkNew, pObj, Abc_NtkHasBlackbox(pNtk) && Abc_ObjIsNet(pObj));
452  // reconnect all objects (no need to transfer attributes on edges)
453  Abc_NtkForEachObj( pNtk, pObj, i )
454  if ( !Abc_ObjIsBox(pObj) && !Abc_ObjIsBo(pObj) )
455  Abc_ObjForEachFanin( pObj, pFanin, k )
456  Abc_ObjAddFanin( pObj->pCopy, pFanin->pCopy );
457  }
458  // duplicate the EXDC Ntk
459  if ( pNtk->pExdc )
460  pNtkNew->pExdc = Abc_NtkDup( pNtk->pExdc );
461  if ( pNtk->pExcare )
462  pNtkNew->pExcare = Abc_NtkDup( (Abc_Ntk_t *)pNtk->pExcare );
463  // duplicate timing manager
464  if ( pNtk->pManTime )
465  Abc_NtkTimeInitialize( pNtkNew, pNtk );
466  if ( pNtk->vPhases )
467  Abc_NtkTransferPhases( pNtkNew, pNtk );
468  if ( pNtk->pWLoadUsed )
469  pNtkNew->pWLoadUsed = Abc_UtilStrsav( pNtk->pWLoadUsed );
470  // check correctness
471  if ( !Abc_NtkCheck( pNtkNew ) )
472  fprintf( stdout, "Abc_NtkDup(): Network check has failed.\n" );
473  pNtk->pCopy = pNtkNew;
474  return pNtkNew;
475 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static int Abc_ObjIsBo(Abc_Obj_t *pObj)
Definition: abc.h:350
Abc_Ntk_t * Abc_NtkDup(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:419
static Abc_Obj_t * Abc_ObjChild1Copy(Abc_Obj_t *pObj)
Definition: abc.h:387
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition: abcObj.c:337
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
DECLARATIONS ///.
Definition: abcAig.c:52
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
static void check(int expr)
Definition: satSolver.c:46
#define Abc_AigForEachAnd(pNtk, pNode, i)
Definition: abc.h:485
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
Definition: abc.h:293
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:700
ABC_DLL void Abc_NtkTransferPhases(Abc_Ntk_t *pNtkNew, Abc_Ntk_t *pNtk)
Definition: abcUtil.c:2875
static Abc_Obj_t * Abc_ObjChild0Copy(Abc_Obj_t *pObj)
Definition: abc.h:386
static int Abc_NtkHasBlackbox(Abc_Ntk_t *pNtk)
Definition: abc.h:258
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
ABC_DLL void Abc_NtkTimeInitialize(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkOld)
Definition: abcTiming.c:321
Abc_Ntk_t * Abc_NtkStartFrom(Abc_Ntk_t *pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func)
Definition: abcNtk.c:106
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
static int Abc_ObjIsNet(Abc_Obj_t *pObj)
Definition: abc.h:354
static int Abc_ObjIsBox(Abc_Obj_t *pObj)
Definition: abc.h:357
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
Abc_NtkType_t ntkType
Definition: abc.h:156
ABC_DLL Abc_Obj_t* Abc_NtkDupBox ( Abc_Ntk_t pNtkNew,
Abc_Obj_t pBox,
int  fCopyName 
)

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

Synopsis [Duplicates the latch with its input/output terminals.]

Description []

SideEffects []

SeeAlso []

Definition at line 407 of file abcObj.c.

408 {
409  Abc_Obj_t * pTerm, * pBoxNew;
410  int i;
411  assert( Abc_ObjIsBox(pBox) );
412  // duplicate the box
413  pBoxNew = Abc_NtkDupObj( pNtkNew, pBox, fCopyName );
414  // duplicate the fanins and connect them
415  Abc_ObjForEachFanin( pBox, pTerm, i )
416  Abc_ObjAddFanin( pBoxNew, Abc_NtkDupObj(pNtkNew, pTerm, fCopyName) );
417  // duplicate the fanouts and connect them
418  Abc_ObjForEachFanout( pBox, pTerm, i )
419  Abc_ObjAddFanin( Abc_NtkDupObj(pNtkNew, pTerm, fCopyName), pBoxNew );
420  return pBoxNew;
421 }
Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition: abcObj.c:337
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition: abc.h:526
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
#define assert(ex)
Definition: util_old.h:213
static int Abc_ObjIsBox(Abc_Obj_t *pObj)
Definition: abc.h:357
ABC_DLL Abc_Ntk_t* Abc_NtkDupDfs ( Abc_Ntk_t pNtk)

Definition at line 476 of file abcNtk.c.

477 {
478  Vec_Ptr_t * vNodes;
479  Abc_Ntk_t * pNtkNew;
480  Abc_Obj_t * pObj, * pFanin;
481  int i, k;
482  if ( pNtk == NULL )
483  return NULL;
484  assert( !Abc_NtkIsStrash(pNtk) && !Abc_NtkIsNetlist(pNtk) );
485  // start the network
486  pNtkNew = Abc_NtkStartFrom( pNtk, pNtk->ntkType, pNtk->ntkFunc );
487  // copy the internal nodes
488  vNodes = Abc_NtkDfs( pNtk, 0 );
489  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
490  Abc_NtkDupObj( pNtkNew, pObj, 0 );
491  Vec_PtrFree( vNodes );
492  // reconnect all objects (no need to transfer attributes on edges)
493  Abc_NtkForEachObj( pNtk, pObj, i )
494  if ( !Abc_ObjIsBox(pObj) && !Abc_ObjIsBo(pObj) )
495  Abc_ObjForEachFanin( pObj, pFanin, k )
496  if ( pObj->pCopy && pFanin->pCopy )
497  Abc_ObjAddFanin( pObj->pCopy, pFanin->pCopy );
498  // duplicate the EXDC Ntk
499  if ( pNtk->pExdc )
500  pNtkNew->pExdc = Abc_NtkDup( pNtk->pExdc );
501  if ( pNtk->pExcare )
502  pNtkNew->pExcare = Abc_NtkDup( (Abc_Ntk_t *)pNtk->pExcare );
503  // duplicate timing manager
504  if ( pNtk->pManTime )
505  Abc_NtkTimeInitialize( pNtkNew, pNtk );
506  if ( pNtk->vPhases )
507  Abc_NtkTransferPhases( pNtkNew, pNtk );
508  if ( pNtk->pWLoadUsed )
509  pNtkNew->pWLoadUsed = Abc_UtilStrsav( pNtk->pWLoadUsed );
510  // check correctness
511  if ( !Abc_NtkCheck( pNtkNew ) )
512  fprintf( stdout, "Abc_NtkDup(): Network check has failed.\n" );
513  pNtk->pCopy = pNtkNew;
514  return pNtkNew;
515 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_ObjIsBo(Abc_Obj_t *pObj)
Definition: abc.h:350
Abc_Ntk_t * Abc_NtkDup(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:419
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition: abcObj.c:337
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
Definition: abcDfs.c:81
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
static void check(int expr)
Definition: satSolver.c:46
ABC_DLL void Abc_NtkTransferPhases(Abc_Ntk_t *pNtkNew, Abc_Ntk_t *pNtk)
Definition: abcUtil.c:2875
if(last==0)
Definition: sparse_int.h:34
ABC_DLL void Abc_NtkTimeInitialize(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkOld)
Definition: abcTiming.c:321
Abc_Ntk_t * Abc_NtkStartFrom(Abc_Ntk_t *pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func)
Definition: abcNtk.c:106
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
#define assert(ex)
Definition: util_old.h:213
static int Abc_ObjIsBox(Abc_Obj_t *pObj)
Definition: abc.h:357
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
Abc_NtkType_t ntkType
Definition: abc.h:156
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL Abc_Obj_t* Abc_NtkDupObj ( Abc_Ntk_t pNtkNew,
Abc_Obj_t pObj,
int  fCopyName 
)

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

Synopsis [Duplicate the Obj.]

Description []

SideEffects []

SeeAlso []

Definition at line 337 of file abcObj.c.

338 {
339  Abc_Obj_t * pObjNew;
340  // create the new object
341  pObjNew = Abc_NtkCreateObj( pNtkNew, (Abc_ObjType_t)pObj->Type );
342  // transfer names of the terminal objects
343  if ( fCopyName )
344  {
345  if ( Abc_ObjIsCi(pObj) )
346  {
347  if ( !Abc_NtkIsNetlist(pNtkNew) )
348  Abc_ObjAssignName( pObjNew, Abc_ObjName(Abc_ObjFanout0Ntk(pObj)), NULL );
349  }
350  else if ( Abc_ObjIsCo(pObj) )
351  {
352  if ( !Abc_NtkIsNetlist(pNtkNew) )
353  {
354  if ( Abc_ObjIsPo(pObj) )
355  Abc_ObjAssignName( pObjNew, Abc_ObjName(Abc_ObjFanin0Ntk(pObj)), NULL );
356  else
357  {
359  Abc_ObjAssignName( pObjNew, Abc_ObjName(pObj), NULL );
360  }
361  }
362  }
363  else if ( Abc_ObjIsBox(pObj) || Abc_ObjIsNet(pObj) )
364  Abc_ObjAssignName( pObjNew, Abc_ObjName(pObj), NULL );
365  }
366  // copy functionality/names
367  if ( Abc_ObjIsNode(pObj) ) // copy the function if functionality is compatible
368  {
369  if ( pNtkNew->ntkFunc == pObj->pNtk->ntkFunc )
370  {
371  if ( Abc_NtkIsStrash(pNtkNew) )
372  {}
373  else if ( Abc_NtkHasSop(pNtkNew) || Abc_NtkHasBlifMv(pNtkNew) )
374  pObjNew->pData = Abc_SopRegister( (Mem_Flex_t *)pNtkNew->pManFunc, (char *)pObj->pData );
375  else if ( Abc_NtkHasBdd(pNtkNew) )
376  pObjNew->pData = Cudd_bddTransfer((DdManager *)pObj->pNtk->pManFunc, (DdManager *)pNtkNew->pManFunc, (DdNode *)pObj->pData), Cudd_Ref((DdNode *)pObjNew->pData);
377  else if ( Abc_NtkHasAig(pNtkNew) )
378  pObjNew->pData = Hop_Transfer((Hop_Man_t *)pObj->pNtk->pManFunc, (Hop_Man_t *)pNtkNew->pManFunc, (Hop_Obj_t *)pObj->pData, Abc_ObjFaninNum(pObj));
379  else if ( Abc_NtkHasMapping(pNtkNew) )
380  pObjNew->pData = pObj->pData;
381  else assert( 0 );
382  }
383  }
384  else if ( Abc_ObjIsNet(pObj) ) // copy the name
385  {
386  }
387  else if ( Abc_ObjIsLatch(pObj) ) // copy the reset value
388  pObjNew->pData = pObj->pData;
389  // transfer HAIG
390 // pObjNew->pEquiv = pObj->pEquiv;
391  // remember the new node in the old node
392  pObj->pCopy = pObjNew;
393  return pObjNew;
394 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
Definition: abc.h:351
Definition: cudd.h:278
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static int Abc_ObjIsLatch(Abc_Obj_t *pObj)
Definition: abc.h:356
static Abc_Obj_t * Abc_ObjFanin0Ntk(Abc_Obj_t *pObj)
Definition: abc.h:375
Hop_Obj_t * Hop_Transfer(Hop_Man_t *pSour, Hop_Man_t *pDest, Hop_Obj_t *pObj, int nVars)
Definition: hopDfs.c:353
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
Abc_Obj_t * Abc_NtkCreateObj(Abc_Ntk_t *pNtk, Abc_ObjType_t Type)
Definition: abcObj.c:106
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition: abcNames.c:68
static int Abc_NtkHasBlifMv(Abc_Ntk_t *pNtk)
Definition: abc.h:257
unsigned Type
Definition: abc.h:133
Definition: hop.h:65
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
Definition: abc.h:352
DdNode * Cudd_bddTransfer(DdManager *ddSource, DdManager *ddDestination, DdNode *f)
Definition: cuddBridge.c:409
void * pManFunc
Definition: abc.h:191
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
ABC_DLL char * Abc_SopRegister(Mem_Flex_t *pMan, char *pName)
DECLARATIONS ///.
Definition: abcSop.c:56
Abc_Obj_t * pCopy
Definition: abc.h:148
Abc_ObjType_t
Definition: abc.h:86
static Abc_Obj_t * Abc_ObjFanout0Ntk(Abc_Obj_t *pObj)
Definition: abc.h:376
Abc_Ntk_t * pNtk
Definition: abc.h:130
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
static int Abc_ObjIsNet(Abc_Obj_t *pObj)
Definition: abc.h:354
static int Abc_ObjIsPo(Abc_Obj_t *pObj)
Definition: abc.h:348
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
static int Abc_ObjIsBox(Abc_Obj_t *pObj)
Definition: abc.h:357
void * pData
Definition: abc.h:145
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371
ABC_DLL Abc_Ntk_t* Abc_NtkDupTransformMiter ( Abc_Ntk_t pNtk)

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

Synopsis [Duplicate the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 563 of file abcNtk.c.

564 {
565  Abc_Ntk_t * pNtkNew;
566  Abc_Obj_t * pObj, * pObj2, * pMiter;
567  int i;
568  assert( Abc_NtkIsStrash(pNtk) );
569  // start the network
570  pNtkNew = Abc_NtkAlloc( pNtk->ntkType, pNtk->ntkFunc, 1 );
571  pNtkNew->nConstrs = pNtk->nConstrs;
572  pNtkNew->nBarBufs = pNtk->nBarBufs;
573  // duplicate the name and the spec
574  pNtkNew->pName = Extra_UtilStrsav(pNtk->pName);
575  pNtkNew->pSpec = Extra_UtilStrsav(pNtk->pSpec);
576  // clean the node copy fields
577  Abc_NtkCleanCopy( pNtk );
578  // map the constant nodes
579  Abc_AigConst1(pNtk)->pCopy = Abc_AigConst1(pNtkNew);
580  // clone CIs/CIs/boxes
581  Abc_NtkForEachPi( pNtk, pObj, i )
582  Abc_NtkDupObj( pNtkNew, pObj, 1 );
583  Abc_NtkForEachPo( pNtk, pObj, i )
584  Abc_NtkDupObj( pNtkNew, pObj, 1 ), i++;
585  Abc_NtkForEachBox( pNtk, pObj, i )
586  Abc_NtkDupBox( pNtkNew, pObj, 1 );
587  // copy the AND gates
588  Abc_AigForEachAnd( pNtk, pObj, i )
589  pObj->pCopy = Abc_AigAnd( (Abc_Aig_t *)pNtkNew->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild1Copy(pObj) );
590  // create new miters
591  Abc_NtkForEachPo( pNtk, pObj, i )
592  {
593  pObj2 = Abc_NtkPo( pNtk, ++i );
594  pMiter = Abc_AigXor( (Abc_Aig_t *)pNtkNew->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild0Copy(pObj2) );
595  Abc_ObjAddFanin( pObj->pCopy, pMiter );
596  }
597  Abc_NtkForEachLatchInput( pNtk, pObj, i )
598  Abc_ObjAddFanin( pObj->pCopy, Abc_ObjChild0Copy(pObj) );
599  // cleanup
600  Abc_AigCleanup( (Abc_Aig_t *)pNtkNew->pManFunc );
601  // check that the CI/CO/latches are copied correctly
602  assert( Abc_NtkPiNum(pNtk) == Abc_NtkPiNum(pNtkNew) );
603  assert( Abc_NtkPoNum(pNtk) == 2*Abc_NtkPoNum(pNtkNew) );
604  assert( Abc_NtkLatchNum(pNtk) == Abc_NtkLatchNum(pNtkNew) );
605  return pNtkNew;
606 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
static Abc_Obj_t * Abc_ObjChild1Copy(Abc_Obj_t *pObj)
Definition: abc.h:387
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition: abcObj.c:337
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
DECLARATIONS ///.
Definition: abcAig.c:52
char * Extra_UtilStrsav(const char *s)
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
#define Abc_AigForEachAnd(pNtk, pNode, i)
Definition: abc.h:485
ABC_DLL Abc_Obj_t * Abc_AigXor(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:735
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:700
static Abc_Obj_t * Abc_ObjChild0Copy(Abc_Obj_t *pObj)
Definition: abc.h:386
Abc_Obj_t * pCopy
Definition: abc.h:148
ABC_DLL Abc_Obj_t * Abc_NtkDupBox(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pBox, int fCopyName)
Definition: abcObj.c:407
ABC_DLL int Abc_AigCleanup(Abc_Aig_t *pMan)
Definition: abcAig.c:194
#define Abc_NtkForEachBox(pNtk, pObj, i)
Definition: abc.h:495
ABC_NAMESPACE_IMPL_START Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
char * pSpec
Definition: abc.h:159
static Abc_Obj_t * Abc_NtkPo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:316
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:286
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
int nBarBufs
Definition: abc.h:174
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:285
#define Abc_NtkForEachLatchInput(pNtk, pObj, i)
Definition: abc.h:500
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:507
#define assert(ex)
Definition: util_old.h:213
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
char * pName
Definition: abc.h:158
Abc_NtkType_t ntkType
Definition: abc.h:156
int nConstrs
Definition: abc.h:173
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
static Abc_Ntk_t* Abc_NtkExdc ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 272 of file abc.h.

272 { return pNtk->pExdc; }
Abc_Ntk_t * pExdc
Definition: abc.h:201
ABC_DLL Vec_Int_t* Abc_NtkFanoutCounts ( Abc_Ntk_t pNtk)

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

Synopsis [Creates the array of fanout counters.]

Description []

SideEffects []

SeeAlso []

Definition at line 1701 of file abcUtil.c.

1702 {
1703  Vec_Int_t * vFanNums;
1704  Abc_Obj_t * pObj;
1705  int i;
1706  vFanNums = Vec_IntAlloc( 0 );
1707  Vec_IntFill( vFanNums, Abc_NtkObjNumMax(pNtk), -1 );
1708  Abc_NtkForEachObj( pNtk, pObj, i )
1709  if ( Abc_ObjIsCi(pObj) || Abc_ObjIsNode(pObj) )
1710  Vec_IntWriteEntry( vFanNums, i, Abc_ObjFanoutNum(pObj) );
1711  return vFanNums;
1712 }
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
Definition: abc.h:351
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
if(last==0)
Definition: sparse_int.h:34
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
ABC_DLL Abc_Obj_t* Abc_NtkFetchTwinNode ( Abc_Obj_t pNode)

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

Synopsis [Returns the twin node if it exists.]

Description []

SideEffects []

SeeAlso []

Definition at line 740 of file abcMap.c.

741 {
742  Abc_Obj_t * pNode2;
743  Mio_Gate_t * pGate = (Mio_Gate_t *)pNode->pData;
744  assert( Abc_NtkHasMapping(pNode->pNtk) );
745  if ( pGate == NULL || Mio_GateReadTwin(pGate) == NULL )
746  return NULL;
747  // assuming the twin node is following next
748  if ( (int)Abc_ObjId(pNode) == Abc_NtkObjNumMax(pNode->pNtk) - 1 )
749  return NULL;
750  pNode2 = Abc_NtkObj( pNode->pNtk, Abc_ObjId(pNode) + 1 );
751  if ( pNode2 == NULL || !Abc_ObjIsNode(pNode2) || Abc_ObjFaninNum(pNode) != Abc_ObjFaninNum(pNode2) )
752  return NULL;
753  if ( Mio_GateReadTwin(pGate) != (Mio_Gate_t *)pNode2->pData )
754  return NULL;
755  return pNode2;
756 }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
Mio_Gate_t * Mio_GateReadTwin(Mio_Gate_t *pGate)
Definition: mioApi.c:150
Abc_Ntk_t * pNtk
Definition: abc.h:130
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
ABC_DLL void Abc_NtkFillTemp ( Abc_Ntk_t pNtk)

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

Synopsis [Cleans the copy field of all objects.]

Description []

SideEffects []

SeeAlso []

Definition at line 553 of file abcUtil.c.

554 {
555  Abc_Obj_t * pObj;
556  int i;
557  Abc_NtkForEachObj( pNtk, pObj, i )
558  pObj->iTemp = -1;
559 }
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
ABC_DLL void Abc_NtkFinalize ( Abc_Ntk_t pNtk,
Abc_Ntk_t pNtkNew 
)

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

Synopsis [Finalizes the network using the existing network as a model.]

Description []

SideEffects []

SeeAlso []

Definition at line 302 of file abcNtk.c.

303 {
304  Abc_Obj_t * pObj, * pDriver, * pDriverNew;
305  int i;
306  // set the COs of the strashed network
307  Abc_NtkForEachCo( pNtk, pObj, i )
308  {
309  pDriver = Abc_ObjFanin0Ntk( Abc_ObjFanin0(pObj) );
310  pDriverNew = Abc_ObjNotCond(pDriver->pCopy, Abc_ObjFaninC0(pObj));
311  Abc_ObjAddFanin( pObj->pCopy, pDriverNew );
312  }
313  // duplicate timing manager
314  if ( pNtk->pManTime )
315  Abc_NtkTimeInitialize( pNtkNew, pNtk );
316  if ( pNtk->vPhases )
317  Abc_NtkTransferPhases( pNtkNew, pNtk );
318  if ( pNtk->pWLoadUsed )
319  pNtkNew->pWLoadUsed = Abc_UtilStrsav( pNtk->pWLoadUsed );
320 }
static Abc_Obj_t * Abc_ObjFanin0Ntk(Abc_Obj_t *pObj)
Definition: abc.h:375
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
ABC_DLL void Abc_NtkTransferPhases(Abc_Ntk_t *pNtkNew, Abc_Ntk_t *pNtk)
Definition: abcUtil.c:2875
Abc_Obj_t * pCopy
Definition: abc.h:148
ABC_DLL void Abc_NtkTimeInitialize(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkOld)
Definition: abcTiming.c:321
Vec_Int_t * vPhases
Definition: abc.h:208
Abc_ManTime_t * pManTime
Definition: abc.h:192
static Abc_Obj_t * Abc_ObjNotCond(Abc_Obj_t *p, int c)
Definition: abc.h:325
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
char * pWLoadUsed
Definition: abc.h:209
ABC_DLL void Abc_NtkFinalizeRead ( Abc_Ntk_t pNtk)

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

Synopsis [Finalizes the network using the existing network as a model.]

Description []

SideEffects []

SeeAlso []

Definition at line 360 of file abcNtk.c.

361 {
362  Abc_Obj_t * pBox, * pObj, * pTerm, * pNet;
363  int i;
364  if ( Abc_NtkHasBlackbox(pNtk) && Abc_NtkBoxNum(pNtk) == 0 )
365  {
366  pBox = Abc_NtkCreateBlackbox(pNtk);
367  Abc_NtkForEachPi( pNtk, pObj, i )
368  {
369  pTerm = Abc_NtkCreateBi(pNtk);
370  Abc_ObjAddFanin( pTerm, Abc_ObjFanout0(pObj) );
371  Abc_ObjAddFanin( pBox, pTerm );
372  }
373  Abc_NtkForEachPo( pNtk, pObj, i )
374  {
375  pTerm = Abc_NtkCreateBo(pNtk);
376  Abc_ObjAddFanin( pTerm, pBox );
377  Abc_ObjAddFanin( Abc_ObjFanin0(pObj), pTerm );
378  }
379  return;
380  }
381  assert( Abc_NtkIsNetlist(pNtk) );
382 
383  // check if constant 0 net is used
384  pNet = Abc_NtkFindNet( pNtk, "1\'b0" );
385  if ( pNet )
386  {
387  if ( Abc_ObjFanoutNum(pNet) == 0 )
388  Abc_NtkDeleteObj(pNet);
389  else if ( Abc_ObjFaninNum(pNet) == 0 )
391  }
392  // check if constant 1 net is used
393  pNet = Abc_NtkFindNet( pNtk, "1\'b1" );
394  if ( pNet )
395  {
396  if ( Abc_ObjFanoutNum(pNet) == 0 )
397  Abc_NtkDeleteObj(pNet);
398  else if ( Abc_ObjFaninNum(pNet) == 0 )
400  }
401  // fix the net drivers
402  Abc_NtkFixNonDrivenNets( pNtk );
403 
404  // reorder the CI/COs to PI/POs first
405  Abc_NtkOrderCisCos( pNtk );
406 }
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
static int Abc_NtkBoxNum(Abc_Ntk_t *pNtk)
Definition: abc.h:289
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeConst1(Abc_Ntk_t *pNtk)
Definition: abcObj.c:633
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
void Abc_NtkFixNonDrivenNets(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1360
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
static Abc_Obj_t * Abc_NtkCreateBo(Abc_Ntk_t *pNtk)
Definition: abc.h:306
ABC_DLL void Abc_NtkDeleteObj(Abc_Obj_t *pObj)
Definition: abcObj.c:167
static int Abc_NtkHasBlackbox(Abc_Ntk_t *pNtk)
Definition: abc.h:258
ABC_DLL Abc_Obj_t * Abc_NtkFindNet(Abc_Ntk_t *pNtk, char *pName)
Definition: abcObj.c:507
static Abc_Obj_t * Abc_NtkCreateBlackbox(Abc_Ntk_t *pNtk)
Definition: abc.h:311
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeConst0(Abc_Ntk_t *pNtk)
Definition: abcObj.c:604
#define assert(ex)
Definition: util_old.h:213
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
static Abc_Obj_t * Abc_NtkCreateBi(Abc_Ntk_t *pNtk)
Definition: abc.h:305
ABC_DLL void Abc_NtkOrderCisCos(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:71
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
ABC_DLL Abc_Obj_t* Abc_NtkFindCi ( Abc_Ntk_t pNtk,
char *  pName 
)

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

Synopsis [Returns CI with the given name.]

Description []

SideEffects []

SeeAlso []

Definition at line 530 of file abcObj.c.

531 {
532  int Num;
533  assert( !Abc_NtkIsNetlist(pNtk) );
534  Num = Nm_ManFindIdByName( pNtk->pManName, pName, ABC_OBJ_PI );
535  if ( Num >= 0 )
536  return Abc_NtkObj( pNtk, Num );
537  Num = Nm_ManFindIdByName( pNtk->pManName, pName, ABC_OBJ_BO );
538  if ( Num >= 0 )
539  return Abc_NtkObj( pNtk, Num );
540  return NULL;
541 }
int Nm_ManFindIdByName(Nm_Man_t *p, char *pName, int Type)
Definition: nmApi.c:219
Nm_Man_t * pManName
Definition: abc.h:160
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
Definition: abc.h:89
Definition: abc.h:92
#define assert(ex)
Definition: util_old.h:213
ABC_DLL Abc_Obj_t* Abc_NtkFindCo ( Abc_Ntk_t pNtk,
char *  pName 
)

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

Synopsis [Returns CO with the given name.]

Description []

SideEffects []

SeeAlso []

Definition at line 554 of file abcObj.c.

555 {
556  int Num;
557  assert( !Abc_NtkIsNetlist(pNtk) );
558  Num = Nm_ManFindIdByName( pNtk->pManName, pName, ABC_OBJ_PO );
559  if ( Num >= 0 )
560  return Abc_NtkObj( pNtk, Num );
561  Num = Nm_ManFindIdByName( pNtk->pManName, pName, ABC_OBJ_BI );
562  if ( Num >= 0 )
563  return Abc_NtkObj( pNtk, Num );
564  return NULL;
565 }
int Nm_ManFindIdByName(Nm_Man_t *p, char *pName, int Type)
Definition: nmApi.c:219
Definition: abc.h:91
Nm_Man_t * pManName
Definition: abc.h:160
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
Definition: abc.h:90
#define assert(ex)
Definition: util_old.h:213
ABC_DLL Abc_Obj_t* Abc_NtkFindNet ( Abc_Ntk_t pNtk,
char *  pName 
)

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

Synopsis [Returns the net with the given name.]

Description []

SideEffects []

SeeAlso []

Definition at line 507 of file abcObj.c.

508 {
509  Abc_Obj_t * pNet;
510  int ObjId;
511  assert( Abc_NtkIsNetlist(pNtk) );
512  ObjId = Nm_ManFindIdByName( pNtk->pManName, pName, ABC_OBJ_NET );
513  if ( ObjId == -1 )
514  return NULL;
515  pNet = Abc_NtkObj( pNtk, ObjId );
516  return pNet;
517 }
int Nm_ManFindIdByName(Nm_Man_t *p, char *pName, int Type)
Definition: nmApi.c:219
Nm_Man_t * pManName
Definition: abc.h:160
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
#define assert(ex)
Definition: util_old.h:213
ABC_DLL Abc_Obj_t* Abc_NtkFindNode ( Abc_Ntk_t pNtk,
char *  pName 
)

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

Synopsis [Returns the net with the given name.]

Description []

SideEffects []

SeeAlso []

Definition at line 456 of file abcObj.c.

457 {
458  Abc_Obj_t * pObj;
459  int Num;
460  // try to find the terminal
461  Num = Nm_ManFindIdByName( pNtk->pManName, pName, ABC_OBJ_PO );
462  if ( Num >= 0 )
463  return Abc_ObjFanin0( Abc_NtkObj( pNtk, Num ) );
464  Num = Nm_ManFindIdByName( pNtk->pManName, pName, ABC_OBJ_BI );
465  if ( Num >= 0 )
466  return Abc_ObjFanin0( Abc_NtkObj( pNtk, Num ) );
467  Num = Nm_ManFindIdByName( pNtk->pManName, pName, ABC_OBJ_NODE );
468  if ( Num >= 0 )
469  return Abc_NtkObj( pNtk, Num );
470  // find the internal node
471  if ( pName[0] != 'n' )
472  {
473  printf( "Name \"%s\" is not found among CO or node names (internal names often look as \"n<num>\").\n", pName );
474  return NULL;
475  }
476  Num = atoi( pName + 1 );
477  if ( Num < 0 || Num >= Abc_NtkObjNumMax(pNtk) )
478  {
479  printf( "The node \"%s\" with ID %d is not in the current network.\n", pName, Num );
480  return NULL;
481  }
482  pObj = Abc_NtkObj( pNtk, Num );
483  if ( pObj == NULL )
484  {
485  printf( "The node \"%s\" with ID %d has been removed from the current network.\n", pName, Num );
486  return NULL;
487  }
488  if ( !Abc_ObjIsNode(pObj) )
489  {
490  printf( "Object with ID %d is not a node.\n", Num );
491  return NULL;
492  }
493  return pObj;
494 }
int Nm_ManFindIdByName(Nm_Man_t *p, char *pName, int Type)
Definition: nmApi.c:219
Definition: abc.h:91
Nm_Man_t * pManName
Definition: abc.h:160
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
Definition: abc.h:90
ABC_DLL Abc_Obj_t* Abc_NtkFindOrCreateNet ( Abc_Ntk_t pNtk,
char *  pName 
)

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

Synopsis [Finds or creates the net.]

Description []

SideEffects []

SeeAlso []

Definition at line 579 of file abcObj.c.

580 {
581  Abc_Obj_t * pNet;
582  assert( Abc_NtkIsNetlist(pNtk) );
583  if ( pName && (pNet = Abc_NtkFindNet( pNtk, pName )) )
584  return pNet;
585 //printf( "Creating net %s.\n", pName );
586  // create a new net
587  pNet = Abc_NtkCreateNet( pNtk );
588  if ( pName )
589  Nm_ManStoreIdName( pNtk->pManName, pNet->Id, pNet->Type, pName, NULL );
590  return pNet;
591 }
Nm_Man_t * pManName
Definition: abc.h:160
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
unsigned Type
Definition: abc.h:133
Abc_Obj_t * Abc_NtkFindNet(Abc_Ntk_t *pNtk, char *pName)
Definition: abcObj.c:507
char * Nm_ManStoreIdName(Nm_Man_t *p, int ObjId, int Type, char *pName, char *pSuffix)
Definition: nmApi.c:112
int Id
Definition: abc.h:132
#define assert(ex)
Definition: util_old.h:213
static Abc_Obj_t * Abc_NtkCreateNet(Abc_Ntk_t *pNtk)
Definition: abc.h:307
ABC_DLL void Abc_NtkFixNonDrivenNets ( Abc_Ntk_t pNtk)

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

Synopsis [Reads the verilog file.]

Description []

SideEffects []

SeeAlso []

Definition at line 1360 of file abcNtk.c.

1361 {
1362  Vec_Ptr_t * vNets;
1363  Abc_Obj_t * pNet, * pNode;
1364  int i;
1365 
1366  if ( Abc_NtkNodeNum(pNtk) == 0 && Abc_NtkBoxNum(pNtk) == 0 )
1367  return;
1368 
1369  // special case
1370  pNet = Abc_NtkFindNet( pNtk, "[_c1_]" );
1371  if ( pNet != NULL )
1372  {
1373  pNode = Abc_NtkCreateNodeConst1( pNtk );
1374  Abc_ObjAddFanin( pNet, pNode );
1375  }
1376 
1377  // check for non-driven nets
1378  vNets = Vec_PtrAlloc( 100 );
1379  Abc_NtkForEachNet( pNtk, pNet, i )
1380  {
1381  if ( Abc_ObjFaninNum(pNet) > 0 )
1382  continue;
1383  // add the constant 0 driver
1384  pNode = Abc_NtkCreateNodeConst0( pNtk );
1385  // add the fanout net
1386  Abc_ObjAddFanin( pNet, pNode );
1387  // add the net to those for which the warning will be printed
1388  Vec_PtrPush( vNets, pNet );
1389  }
1390 
1391  // print the warning
1392  if ( vNets->nSize > 0 )
1393  {
1394  printf( "Warning: Constant-0 drivers added to %d non-driven nets in network \"%s\":\n", Vec_PtrSize(vNets), pNtk->pName );
1395  Vec_PtrForEachEntry( Abc_Obj_t *, vNets, pNet, i )
1396  {
1397  printf( "%s%s", (i? ", ": ""), Abc_ObjName(pNet) );
1398  if ( i == 3 )
1399  {
1400  if ( Vec_PtrSize(vNets) > 3 )
1401  printf( " ..." );
1402  break;
1403  }
1404  }
1405  printf( "\n" );
1406  }
1407  Vec_PtrFree( vNets );
1408 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_NtkBoxNum(Abc_Ntk_t *pNtk)
Definition: abc.h:289
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeConst1(Abc_Ntk_t *pNtk)
Definition: abcObj.c:633
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
Definition: abc.h:293
ABC_DLL Abc_Obj_t * Abc_NtkFindNet(Abc_Ntk_t *pNtk, char *pName)
Definition: abcObj.c:507
#define Abc_NtkForEachNet(pNtk, pNet, i)
Definition: abc.h:458
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeConst0(Abc_Ntk_t *pNtk)
Definition: abcObj.c:604
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
char * pName
Definition: abc.h:158
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL Gia_Man_t* Abc_NtkFlattenHierarchyGia ( Abc_Ntk_t pNtk,
Vec_Ptr_t **  pvBuffers,
int  fVerbose 
)

Definition at line 277 of file abcHieGia.c.

278 {
279  int fUseBufs = 1;
280  Gia_Man_t * pNew, * pTemp;
281  Abc_Ntk_t * pModel;
282  Abc_Obj_t * pTerm;
283  Vec_Ptr_t * vSupers;
284  Vec_Ptr_t * vBuffers = fUseBufs ? Vec_PtrAlloc(1000) : NULL;
285  int i, Counter = 0;
286  assert( Abc_NtkIsNetlist(pNtk) );
287 // Abc_NtkPrintBoxInfo( pNtk );
288 
289  // set the PI/PO numbers
290  Counter -= Abc_NtkPiNum(pNtk) + Abc_NtkPoNum(pNtk);
291  if ( !pNtk->pDesign )
292  Counter += Gia_ManFlattenLogicPrepare( pNtk );
293  else
294  Vec_PtrForEachEntry( Abc_Ntk_t *, pNtk->pDesign->vModules, pModel, i )
295  Counter += Gia_ManFlattenLogicPrepare( pModel );
296 
297  // start the manager
298  pNew = Gia_ManStart( Abc_NtkObjNumMax(pNtk) );
299  pNew->pName = Abc_UtilStrsav(pNtk->pName);
300  pNew->pSpec = Abc_UtilStrsav(pNtk->pSpec);
301 
302  // create PIs and buffers
303  Abc_NtkForEachPi( pNtk, pTerm, i )
304  pTerm->iTemp = Gia_ManAppendCi( pNew );
305 
306  // call recursively
307  vSupers = Vec_PtrAlloc( 100 );
308  Gia_ManHashAlloc( pNew );
309  Abc_NtkForEachPo( pNtk, pTerm, i )
310  Abc_NtkFlattenHierarchyGia_rec( pNew, vSupers, pTerm, vBuffers );
311  Gia_ManHashStop( pNew );
312  Vec_PtrFree( vSupers );
313  printf( "Hierarchy reader flattened %d instances of boxes and added %d barbufs (out of %d).\n",
314  pNtk->pDesign ? Vec_PtrSize(pNtk->pDesign->vModules)-1 : 0, Vec_PtrSize(vBuffers), Counter );
315 
316  // create buffers and POs
317  Abc_NtkForEachPo( pNtk, pTerm, i )
318  Gia_ManAppendCo( pNew, pTerm->iTemp );
319 
320  if ( pvBuffers )
321  *pvBuffers = vBuffers;
322  else
323  Vec_PtrFreeP( &vBuffers );
324 
325  // cleanup
326  pNew = Gia_ManCleanup( pTemp = pNew );
327  Gia_ManStop( pTemp );
328  return pNew;
329 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
int Gia_ManFlattenLogicPrepare(Abc_Ntk_t *pNtk)
Definition: abcHieGia.c:214
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
static int Counter
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:286
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
Definition: gia.h:95
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:285
static void Vec_PtrFreeP(Vec_Ptr_t **p)
Definition: vecPtr.h:240
Vec_Ptr_t * vModules
Definition: abc.h:223
#define assert(ex)
Definition: util_old.h:213
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
Abc_Des_t * pDesign
Definition: abc.h:180
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
int Abc_NtkFlattenHierarchyGia_rec(Gia_Man_t *pNew, Vec_Ptr_t *vSupers, Abc_Obj_t *pObj, Vec_Ptr_t *vBuffers)
Definition: abcHieGia.c:233
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
ABC_DLL Abc_Ntk_t* Abc_NtkFlattenLogicHierarchy ( Abc_Ntk_t pNtk)

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

Synopsis [Flattens the logic hierarchy of the netlist.]

Description []

SideEffects []

SeeAlso []

Definition at line 514 of file abcHie.c.

515 {
516  extern Abc_Des_t * Abc_DesDupBlackboxes( Abc_Des_t * p, Abc_Ntk_t * pNtkSave );
517  Vec_Str_t * vPref;
518  Abc_Ntk_t * pNtkNew;
519  Abc_Obj_t * pTerm, * pNet;
520  int i, Counter = -1;
521 
522  assert( Abc_NtkIsNetlist(pNtk) );
523 // Abc_NtkPrintBoxInfo( pNtk );
524 
525  // start the network
526  pNtkNew = Abc_NtkAlloc( pNtk->ntkType, pNtk->ntkFunc, 1 );
527  // duplicate the name and the spec
528  pNtkNew->pName = Extra_UtilStrsav(pNtk->pName);
529  pNtkNew->pSpec = Extra_UtilStrsav(pNtk->pSpec);
530 
531  // clean the node copy fields
532  Abc_NtkCleanCopy( pNtk );
533 
534  // duplicate PIs/POs and their nets
535  Abc_NtkForEachPi( pNtk, pTerm, i )
536  {
537  Abc_NtkDupObj( pNtkNew, pTerm, 0 );
538  pNet = Abc_ObjFanout0( pTerm );
539  pNet->pCopy = Abc_NtkFindOrCreateNet( pNtkNew, Abc_ObjName(pNet) );
540  Abc_ObjAddFanin( pNet->pCopy, pTerm->pCopy );
541  }
542  Abc_NtkForEachPo( pNtk, pTerm, i )
543  {
544  Abc_NtkDupObj( pNtkNew, pTerm, 0 );
545  pNet = Abc_ObjFanin0( pTerm );
546  pNet->pCopy = Abc_NtkFindOrCreateNet( pNtkNew, Abc_ObjName(pNet) );
547  Abc_ObjAddFanin( pTerm->pCopy, pNet->pCopy );
548  }
549 
550  // recursively flatten hierarchy, create internal logic, add new PI/PO names if there are black boxes
551  vPref = Vec_StrAlloc( 1000 );
552  Vec_StrPrintStr( vPref, Abc_NtkName(pNtk) );
553  Abc_NtkFlattenLogicHierarchy_rec( pNtkNew, pNtk, &Counter, vPref );
554  printf( "Hierarchy reader flattened %d instances of logic boxes and left %d black boxes.\n",
555  Counter, Abc_NtkBlackboxNum(pNtkNew) );
556  Vec_StrFree( vPref );
557 
558  if ( pNtk->pDesign )
559  {
560  // pass on the design
561  assert( Vec_PtrEntry(pNtk->pDesign->vTops, 0) == pNtk );
562  pNtkNew->pDesign = Abc_DesDupBlackboxes( pNtk->pDesign, pNtkNew );
563  // update the pointers
564  Abc_NtkForEachBlackbox( pNtkNew, pTerm, i )
565  pTerm->pData = ((Abc_Ntk_t *)pTerm->pData)->pCopy;
566  }
567 
568  // we may have added property outputs
569  Abc_NtkOrderCisCos( pNtkNew );
570 
571  // copy the timing information
572 // Abc_ManTimeDup( pNtk, pNtkNew );
573  // duplicate EXDC
574  if ( pNtk->pExdc )
575  printf( "EXDC is not transformed.\n" );
576  if ( !Abc_NtkCheck( pNtkNew ) )
577  {
578  fprintf( stdout, "Abc_NtkFlattenLogicHierarchy(): Network check has failed.\n" );
579  Abc_NtkDelete( pNtkNew );
580  return NULL;
581  }
582  return pNtkNew;
583 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition: abcObj.c:337
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
static Vec_Str_t * Vec_StrAlloc(int nCap)
Definition: bblif.c:495
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
void Abc_NtkFlattenLogicHierarchy_rec(Abc_Ntk_t *pNtkNew, Abc_Ntk_t *pNtk, int *pCounter, Vec_Str_t *vPref)
Definition: abcHie.c:265
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
char * Extra_UtilStrsav(const char *s)
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
ABC_DLL Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
Abc_Obj_t * pCopy
Definition: abc.h:148
static void Vec_StrFree(Vec_Str_t *p)
Definition: bblif.c:616
#define Abc_NtkForEachBlackbox(pNtk, pObj, i)
Definition: abc.h:509
Abc_Des_t * Abc_DesDupBlackboxes(Abc_Des_t *p, Abc_Ntk_t *pNtkSave)
Definition: abcLib.c:165
if(last==0)
Definition: sparse_int.h:34
static int Counter
Vec_Ptr_t * vTops
Definition: abc.h:222
ABC_DLL Abc_Obj_t * Abc_NtkFindOrCreateNet(Abc_Ntk_t *pNtk, char *pName)
Definition: abcObj.c:579
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
char * pSpec
Definition: abc.h:159
static char * Abc_NtkName(Abc_Ntk_t *pNtk)
Definition: abc.h:270
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:507
#define assert(ex)
Definition: util_old.h:213
static void Vec_StrPrintStr(Vec_Str_t *p, const char *pStr)
Definition: vecStr.h:627
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
static int Abc_NtkBlackboxNum(Abc_Ntk_t *pNtk)
Definition: abc.h:296
Abc_Des_t * pDesign
Definition: abc.h:180
ABC_DLL void Abc_NtkOrderCisCos(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:71
char * pName
Definition: abc.h:158
Abc_NtkType_t ntkType
Definition: abc.h:156
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
ABC_DLL Abc_Ntk_t* Abc_NtkFraig ( Abc_Ntk_t pNtk,
void *  pParams,
int  fAllNodes,
int  fExdc 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Interfaces the network with the FRAIG package.]

Description []

SideEffects []

SeeAlso []

Definition at line 58 of file abcFraig.c.

59 {
60  Fraig_Params_t * pPars = (Fraig_Params_t *)pParams;
61  Abc_Ntk_t * pNtkNew;
62  Fraig_Man_t * pMan;
63  // check if EXDC is present
64  if ( fExdc && pNtk->pExdc == NULL )
65  fExdc = 0, printf( "Warning: Networks has no EXDC.\n" );
66  // perform fraiging
67  pMan = (Fraig_Man_t *)Abc_NtkToFraig( pNtk, pParams, fAllNodes, fExdc );
68  // add algebraic choices
69 // if ( pPars->fChoicing )
70 // Fraig_ManAddChoices( pMan, 0, 6 );
71  // prove the miter if asked to
72  if ( pPars->fTryProve )
73  Fraig_ManProveMiter( pMan );
74  // reconstruct FRAIG in the new network
75  if ( fExdc )
76  pNtkNew = Abc_NtkFromFraig2( pMan, pNtk );
77  else
78  pNtkNew = Abc_NtkFromFraig( pMan, pNtk );
79  Fraig_ManFree( pMan );
80  if ( pNtk->pExdc )
81  pNtkNew->pExdc = Abc_NtkDup( pNtk->pExdc );
82  // make sure that everything is okay
83  if ( !Abc_NtkCheck( pNtkNew ) )
84  {
85  printf( "Abc_NtkFraig: The network check has failed.\n" );
86  Abc_NtkDelete( pNtkNew );
87  return NULL;
88  }
89  return pNtkNew;
90 }
typedefABC_NAMESPACE_HEADER_START struct Fraig_ManStruct_t_ Fraig_Man_t
INCLUDES ///.
Definition: fraig.h:40
Abc_Ntk_t * pExdc
Definition: abc.h:201
void Fraig_ManFree(Fraig_Man_t *pMan)
Definition: fraigMan.c:262
ABC_DLL Abc_Ntk_t * Abc_NtkDup(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:419
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
ABC_NAMESPACE_IMPL_START Abc_Ntk_t * Abc_NtkFromFraig(Fraig_Man_t *pMan, Abc_Ntk_t *pNtk)
DECLARATIONS ///.
Definition: abcFraig.c:279
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
void * Abc_NtkToFraig(Abc_Ntk_t *pNtk, void *pParams, int fAllNodes, int fExdc)
Definition: abcFraig.c:103
static Abc_Ntk_t * Abc_NtkFromFraig2(Fraig_Man_t *pMan, Abc_Ntk_t *pNtk)
Definition: abcFraig.c:379
void Fraig_ManProveMiter(Fraig_Man_t *p)
Definition: fraigSat.c:85
ABC_DLL Abc_Ntk_t* Abc_NtkFraigRestore ( )

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

Synopsis [Interfaces the network with the FRAIG package.]

Description []

SideEffects []

SeeAlso []

Definition at line 694 of file abcFraig.c.

695 {
696  extern Abc_Ntk_t * Abc_NtkFraigPartitioned( Vec_Ptr_t * vStore, void * pParams );
697  Fraig_Params_t Params;
698  Vec_Ptr_t * vStore;
699  Abc_Ntk_t * pNtk, * pFraig;
700  int nWords1, nWords2, nWordsMin;
701 // abctime clk = Abc_Clock();
702 
703  // get the stored network
704  vStore = Abc_FrameReadStore();
705  if ( Vec_PtrSize(vStore) == 0 )
706  {
707  printf( "There are no network currently in storage.\n" );
708  return NULL;
709  }
710 // printf( "Currently stored %d networks will be fraiged.\n", Vec_PtrSize(vStore) );
711  pNtk = (Abc_Ntk_t *)Vec_PtrEntry( vStore, 0 );
712 
713  // swap the first and last network
714  // this should lead to the primary choice being "better" because of synthesis
715  if ( Vec_PtrSize(vStore) > 1 )
716  {
717  pNtk = (Abc_Ntk_t *)Vec_PtrPop( vStore );
718  Vec_PtrPush( vStore, Vec_PtrEntry(vStore,0) );
719  Vec_PtrWriteEntry( vStore, 0, pNtk );
720  }
721 
722  // to determine the number of simulation patterns
723  // use the following strategy
724  // at least 64 words (32 words random and 32 words dynamic)
725  // no more than 256M for one circuit (128M + 128M)
726  nWords1 = 32;
727  nWords2 = (1<<27) / (Abc_NtkNodeNum(pNtk) + Abc_NtkCiNum(pNtk));
728  nWordsMin = Abc_MinInt( nWords1, nWords2 );
729 
730  // set parameters for fraiging
731  Fraig_ParamsSetDefault( &Params );
732  Params.nPatsRand = nWordsMin * 32; // the number of words of random simulation info
733  Params.nPatsDyna = nWordsMin * 32; // the number of words of dynamic simulation info
734  Params.nBTLimit = 1000; // the max number of backtracks to perform
735  Params.fFuncRed = 1; // performs only one level hashing
736  Params.fFeedBack = 1; // enables solver feedback
737  Params.fDist1Pats = 1; // enables distance-1 patterns
738  Params.fDoSparse = 1; // performs equiv tests for sparse functions
739  Params.fChoicing = 1; // enables recording structural choices
740  Params.fTryProve = 0; // tries to solve the final miter
741  Params.fInternal = 1; // does not show progress bar
742  Params.fVerbose = 0; // the verbosiness flag
743 
744  // perform partitioned computation of structural choices
745  pFraig = Abc_NtkFraigPartitioned( vStore, &Params );
747 //ABC_PRT( "Total choicing time", Abc_Clock() - clk );
748  return pFraig;
749 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
void Abc_NtkFraigStoreClean()
Definition: abcFraig.c:762
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void * Vec_PtrPop(Vec_Ptr_t *p)
Definition: vecPtr.h:677
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
Definition: abc.h:293
static int Abc_MinInt(int a, int b)
Definition: abc_global.h:239
void Fraig_ParamsSetDefault(Fraig_Params_t *pParams)
Definition: fraigMan.c:122
Abc_Ntk_t * Abc_NtkFraigPartitioned(Vec_Ptr_t *vStore, void *pParams)
Definition: abcPart.c:1098
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
ABC_DLL Vec_Ptr_t * Abc_FrameReadStore()
FUNCTION DEFINITIONS ///.
Definition: mainFrame.c:52
ABC_DLL int Abc_NtkFraigStore ( Abc_Ntk_t pNtkAdd)

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

Synopsis [Interfaces the network with the FRAIG package.]

Description []

SideEffects []

SeeAlso []

Definition at line 654 of file abcFraig.c.

655 {
656  Vec_Ptr_t * vStore;
657  Abc_Ntk_t * pNtk;
658  // create the network to be stored
659  pNtk = Abc_NtkStrash( pNtkAdd, 0, 0, 0 );
660  if ( pNtk == NULL )
661  {
662  printf( "Abc_NtkFraigStore: Initial strashing has failed.\n" );
663  return 0;
664  }
665  // get the network currently stored
666  vStore = Abc_FrameReadStore();
667  if ( Vec_PtrSize(vStore) > 0 )
668  {
669  // check that the networks have the same PIs
670  // reorder PIs of pNtk2 according to pNtk1
671  if ( !Abc_NtkCompareSignals( pNtk, (Abc_Ntk_t *)Vec_PtrEntry(vStore, 0), 1, 1 ) )
672  {
673  printf( "Trying to store the network with different primary inputs.\n" );
674  printf( "The previously stored networks are deleted and this one is added.\n" );
676  }
677  }
678  Vec_PtrPush( vStore, pNtk );
679 // printf( "The number of AIG nodes added to storage = %5d.\n", Abc_NtkNodeNum(pNtk) );
680  return 1;
681 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
ABC_DLL Abc_Ntk_t * Abc_NtkStrash(Abc_Ntk_t *pNtk, int fAllNodes, int fCleanup, int fRecord)
Definition: abcStrash.c:265
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
void Abc_NtkFraigStoreClean()
Definition: abcFraig.c:762
ABC_DLL int Abc_NtkCompareSignals(Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int fOnlyPis, int fComb)
Definition: abcCheck.c:741
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
ABC_DLL Vec_Ptr_t * Abc_FrameReadStore()
FUNCTION DEFINITIONS ///.
Definition: mainFrame.c:52
ABC_DLL void Abc_NtkFraigStoreClean ( )

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

Synopsis [Interfaces the network with the FRAIG package.]

Description []

SideEffects []

SeeAlso []

Definition at line 762 of file abcFraig.c.

763 {
764  Vec_Ptr_t * vStore;
765  Abc_Ntk_t * pNtk;
766  int i;
767  vStore = Abc_FrameReadStore();
768  Vec_PtrForEachEntry( Abc_Ntk_t *, vStore, pNtk, i )
769  Abc_NtkDelete( pNtk );
770  Vec_PtrClear( vStore );
771 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
ABC_DLL Vec_Ptr_t * Abc_FrameReadStore()
FUNCTION DEFINITIONS ///.
Definition: mainFrame.c:52
ABC_DLL Abc_Ntk_t* Abc_NtkFraigTrust ( Abc_Ntk_t pNtk)

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

Synopsis [Interfaces the network with the FRAIG package.]

Description []

SideEffects []

SeeAlso []

Definition at line 485 of file abcFraig.c.

486 {
487  Abc_Ntk_t * pNtkNew;
488 
489  if ( !Abc_NtkIsSopLogic(pNtk) )
490  {
491  printf( "Abc_NtkFraigTrust: Trust mode works for netlists and logic SOP networks.\n" );
492  return NULL;
493  }
494 
495  if ( !Abc_NtkFraigTrustCheck(pNtk) )
496  {
497  printf( "Abc_NtkFraigTrust: The network does not look like an AIG with choice nodes.\n" );
498  return NULL;
499  }
500 
501  // perform strashing
502  pNtkNew = Abc_NtkStartFrom( pNtk, ABC_NTK_STRASH, ABC_FUNC_AIG );
503  Abc_NtkFraigTrustOne( pNtk, pNtkNew );
504  Abc_NtkFinalize( pNtk, pNtkNew );
505  Abc_NtkReassignIds( pNtkNew );
506 
507  // print a warning about choice nodes
508  printf( "Warning: The resulting AIG contains %d choice nodes.\n", Abc_NtkGetChoiceNum( pNtkNew ) );
509 
510  // make sure that everything is okay
511  if ( !Abc_NtkCheck( pNtkNew ) )
512  {
513  printf( "Abc_NtkFraigTrust: The network check has failed.\n" );
514  Abc_NtkDelete( pNtkNew );
515  return NULL;
516  }
517  return pNtkNew;
518 }
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
static int Abc_NtkIsSopLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:264
ABC_DLL int Abc_NtkGetChoiceNum(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:430
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
static int Abc_NtkFraigTrustCheck(Abc_Ntk_t *pNtk)
Definition: abcFraig.c:531
ABC_DLL void Abc_NtkReassignIds(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:1769
ABC_DLL Abc_Ntk_t * Abc_NtkStartFrom(Abc_Ntk_t *pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func)
Definition: abcNtk.c:106
ABC_DLL void Abc_NtkFinalize(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkNew)
Definition: abcNtk.c:302
static void Abc_NtkFraigTrustOne(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkNew)
Definition: abcFraig.c:559
ABC_DLL Abc_Ntk_t* Abc_NtkFrames ( Abc_Ntk_t pNtk,
int  nFrames,
int  fInitial,
int  fVerbose 
)

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

Synopsis [Derives the timeframes of the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 772 of file abcMiter.c.

773 {
774  char Buffer[1000];
775  ProgressBar * pProgress;
776  Abc_Ntk_t * pNtkFrames;
777  Abc_Obj_t * pLatch, * pLatchOut;
778  int i, Counter;
779  assert( nFrames > 0 );
780  assert( Abc_NtkIsStrash(pNtk) );
781  assert( Abc_NtkIsDfsOrdered(pNtk) );
783  // start the new network
784  pNtkFrames = Abc_NtkAlloc( ABC_NTK_STRASH, ABC_FUNC_AIG, 1 );
785  sprintf( Buffer, "%s_%d_frames", pNtk->pName, nFrames );
786  pNtkFrames->pName = Extra_UtilStrsav(Buffer);
787  // map the constant nodes
788  Abc_AigConst1(pNtk)->pCopy = Abc_AigConst1(pNtkFrames);
789  // create new latches (or their initial values) and remember them in the new latches
790  if ( !fInitial )
791  {
792  Abc_NtkForEachLatch( pNtk, pLatch, i )
793  Abc_NtkDupBox( pNtkFrames, pLatch, 1 );
794  }
795  else
796  {
797  Counter = 0;
798  Abc_NtkForEachLatch( pNtk, pLatch, i )
799  {
800  pLatchOut = Abc_ObjFanout0(pLatch);
801  if ( Abc_LatchIsInitNone(pLatch) || Abc_LatchIsInitDc(pLatch) ) // don't-care initial value - create a new PI
802  {
803  pLatchOut->pCopy = Abc_NtkCreatePi(pNtkFrames);
804  Abc_ObjAssignName( pLatchOut->pCopy, Abc_ObjName(pLatchOut), NULL );
805  Counter++;
806  }
807  else
808  pLatchOut->pCopy = Abc_ObjNotCond( Abc_AigConst1(pNtkFrames), Abc_LatchIsInit0(pLatch) );
809  }
810  if ( Counter )
811  printf( "Warning: %d uninitialized latches are replaced by free PI variables.\n", Counter );
812  }
813 
814  // create the timeframes
815  pProgress = Extra_ProgressBarStart( stdout, nFrames );
816  for ( i = 0; i < nFrames; i++ )
817  {
818  Extra_ProgressBarUpdate( pProgress, i, NULL );
819  Abc_NtkAddFrame( pNtkFrames, pNtk, i );
820  }
821  Extra_ProgressBarStop( pProgress );
822 
823  // connect the new latches to the outputs of the last frame
824  if ( !fInitial )
825  {
826  // we cannot use pLatch->pCopy here because pLatch->pCopy is used for temporary storage of strashed values
827  Abc_NtkForEachLatch( pNtk, pLatch, i )
828  Abc_ObjAddFanin( Abc_ObjFanin0(pLatch)->pCopy, Abc_ObjFanout0(pLatch)->pCopy );
829  }
830 
831  // remove dangling nodes
832  Abc_AigCleanup( (Abc_Aig_t *)pNtkFrames->pManFunc );
833  // reorder the latches
834  Abc_NtkOrderCisCos( pNtkFrames );
835  // make sure that everything is okay
836  if ( !Abc_NtkCheck( pNtkFrames ) )
837  {
838  printf( "Abc_NtkFrames: The network check has failed.\n" );
839  Abc_NtkDelete( pNtkFrames );
840  return NULL;
841  }
842  return pNtkFrames;
843 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static int Abc_LatchIsInitNone(Abc_Obj_t *pLatch)
Definition: abc.h:421
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
static void Abc_NtkAddFrame(Abc_Ntk_t *pNetNew, Abc_Ntk_t *pNet, int iFrame)
Definition: abcMiter.c:859
static int Abc_LatchIsInit0(Abc_Obj_t *pLatch)
Definition: abc.h:422
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition: abcNames.c:68
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
DECLARATIONS ///.
Definition: abcAig.c:52
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
char * Extra_UtilStrsav(const char *s)
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
ABC_DLL Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
DECLARATIONS ///.
Abc_Obj_t * pCopy
Definition: abc.h:148
ABC_DLL Abc_Obj_t * Abc_NtkDupBox(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pBox, int fCopyName)
Definition: abcObj.c:407
ABC_DLL int Abc_AigCleanup(Abc_Aig_t *pMan)
Definition: abcAig.c:194
static int Abc_LatchIsInitDc(Abc_Obj_t *pLatch)
Definition: abc.h:424
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
char * sprintf()
static int Counter
#define Abc_NtkForEachLatch(pNtk, pObj, i)
Definition: abc.h:497
static Abc_Obj_t * Abc_NtkCreatePi(Abc_Ntk_t *pNtk)
Definition: abc.h:303
void Extra_ProgressBarStop(ProgressBar *p)
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
ProgressBar * Extra_ProgressBarStart(FILE *pFile, int nItemsTotal)
FUNCTION DEFINITIONS ///.
static int Abc_NtkHasOnlyLatchBoxes(Abc_Ntk_t *pNtk)
Definition: abc.h:298
ABC_DLL int Abc_NtkIsDfsOrdered(Abc_Ntk_t *pNtk)
Definition: abcDfs.c:667
static Abc_Obj_t * Abc_ObjNotCond(Abc_Obj_t *p, int c)
Definition: abc.h:325
#define assert(ex)
Definition: util_old.h:213
static void Extra_ProgressBarUpdate(ProgressBar *p, int nItemsCur, char *pString)
Definition: extra.h:243
ABC_DLL void Abc_NtkOrderCisCos(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:71
char * pName
Definition: abc.h:158
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371
ABC_DLL void* Abc_NtkFreeGlobalBdds ( Abc_Ntk_t pNtk,
int  fFreeMan 
)

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

Synopsis [Frees the global BDDs of the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 476 of file abcNtbdd.c.

477 {
478  return Abc_NtkAttrFree( pNtk, VEC_ATTR_GLOBAL_BDD, fFreeMan );
479 }
ABC_DLL void * Abc_NtkAttrFree(Abc_Ntk_t *pNtk, int Attr, int fFreeMan)
DECLARATIONS ///.
Definition: abcUtil.c:50
ABC_DLL void Abc_NtkFreeMvVars ( Abc_Ntk_t pNtk)

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

Synopsis [Stops the Mv-Var manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 66 of file abcBlifMv.c.

67 {
68  Mem_Flex_t * pUserMan;
69  pUserMan = (Mem_Flex_t *)Abc_NtkAttrFree( pNtk, VEC_ATTR_GLOBAL_BDD, 0 );
70  Mem_FlexStop( pUserMan, 0 );
71 }
void Mem_FlexStop(Mem_Flex_t *p, int fVerbose)
Definition: mem.c:343
ABC_DLL void * Abc_NtkAttrFree(Abc_Ntk_t *pNtk, int Attr, int fFreeMan)
DECLARATIONS ///.
Definition: abcUtil.c:50
ABC_DLL Abc_Ntk_t* Abc_NtkFromBarBufs ( Abc_Ntk_t pNtkBase,
Abc_Ntk_t pNtk 
)

Definition at line 263 of file abcBarBuf.c.

264 {
265  Abc_Ntk_t * pNtkNew, * pTemp;
266  Vec_Ptr_t * vLiMaps, * vLoMaps;
267  Abc_Obj_t * pObj, * pLiMap, * pLoMap;
268  int i, k;
269  assert( pNtkBase->pDesign != NULL );
270  assert( Abc_NtkIsNetlist(pNtk) );
271  assert( Abc_NtkIsNetlist(pNtkBase) );
272  assert( Abc_NtkLatchNum(pNtkBase) == 0 );
273  assert( Abc_NtkLatchNum(pNtk) == pNtk->nBarBufs );
274  assert( Abc_NtkWhiteboxNum(pNtk) == 0 );
275  assert( Abc_NtkBlackboxNum(pNtk) == 0 );
276  assert( Abc_NtkPiNum(pNtk) == Abc_NtkPiNum(pNtkBase) );
277  assert( Abc_NtkPoNum(pNtk) == Abc_NtkPoNum(pNtkBase) );
278  // start networks
279  Abc_NtkCleanCopy_rec( pNtkBase );
280  Vec_PtrForEachEntry( Abc_Ntk_t *, pNtkBase->pDesign->vModules, pTemp, i )
281  pTemp->pCopy = Abc_NtkStartFrom( pTemp, pNtk->ntkType, pNtk->ntkFunc );
282  Vec_PtrForEachEntry( Abc_Ntk_t *, pNtkBase->pDesign->vModules, pTemp, i )
283  pTemp->pCopy->pAltView = pTemp->pAltView ? pTemp->pAltView->pCopy : NULL;
284  // update box models
285  Vec_PtrForEachEntry( Abc_Ntk_t *, pNtkBase->pDesign->vModules, pTemp, i )
286  Abc_NtkForEachBox( pTemp, pObj, k )
287  if ( Abc_ObjIsWhitebox(pObj) || Abc_ObjIsBlackbox(pObj) )
288  pObj->pCopy->pData = Abc_ObjModel(pObj)->pCopy;
289  // create the design
290  pNtkNew = pNtkBase->pCopy;
291  pNtkNew->pDesign = Abc_DesCreate( pNtkBase->pDesign->pName );
292  Vec_PtrForEachEntry( Abc_Ntk_t *, pNtkBase->pDesign->vModules, pTemp, i )
293  Abc_DesAddModel( pNtkNew->pDesign, pTemp->pCopy );
294  Vec_PtrForEachEntry( Abc_Ntk_t *, pNtkBase->pDesign->vTops, pTemp, i )
295  Vec_PtrPush( pNtkNew->pDesign->vTops, pTemp->pCopy );
296  assert( Vec_PtrEntry(pNtkNew->pDesign->vTops, 0) == pNtkNew );
297  // transfer copy attributes to pNtk
298  Abc_NtkCleanCopy( pNtk );
299  Abc_NtkForEachPi( pNtk, pObj, i )
300  pObj->pCopy = Abc_NtkPi(pNtkNew, i);
301  Abc_NtkForEachPo( pNtk, pObj, i )
302  pObj->pCopy = Abc_NtkPo(pNtkNew, i);
303  Abc_NtkCollectPiPos( pNtkBase, &vLiMaps, &vLoMaps );
304  assert( Vec_PtrSize(vLiMaps) == Abc_NtkLatchNum(pNtk) );
305  assert( Vec_PtrSize(vLoMaps) == Abc_NtkLatchNum(pNtk) );
306  Vec_PtrForEachEntryTwo( Abc_Obj_t *, vLiMaps, Abc_Obj_t *, vLoMaps, pLiMap, pLoMap, i )
307  {
308  pObj = Abc_NtkBox( pNtk, i );
309  Abc_ObjFanin0(pObj)->pCopy = pLiMap->pCopy;
310  Abc_ObjFanout0(pObj)->pCopy = pLoMap->pCopy;
311  }
312  Vec_PtrFree( vLiMaps );
313  Vec_PtrFree( vLoMaps );
314  // create internal nodes
315  Abc_NtkForEachCo( pNtk, pObj, i )
316  Abc_ObjAddFanin( pObj->pCopy, Abc_NtkFromBarBufs_rec(pObj->pCopy->pNtk, Abc_ObjFanin0(pObj)) );
317  // transfer net names
318  Abc_NtkForEachCi( pNtk, pObj, i )
319  {
320  if ( Abc_ObjFanoutNum(pObj->pCopy) == 0 ) // handle PI without fanout
321  Abc_ObjAddFanin( Abc_NtkCreateNet(pObj->pCopy->pNtk), pObj->pCopy );
322  Nm_ManStoreIdName( pObj->pCopy->pNtk->pManName, Abc_ObjFanout0(pObj->pCopy)->Id, Abc_ObjFanout0(pObj->pCopy)->Type, Abc_ObjName(Abc_ObjFanout0(pObj)), NULL );
323  }
324  Abc_NtkForEachCo( pNtk, pObj, i )
325  Nm_ManStoreIdName( pObj->pCopy->pNtk->pManName, Abc_ObjFanin0(pObj->pCopy)->Id, Abc_ObjFanin0(pObj->pCopy)->Type, Abc_ObjName(Abc_ObjFanin0(pObj)), NULL );
326  return pNtkNew;
327 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
#define Vec_PtrForEachEntryTwo(Type1, vVec1, Type2, vVec2, pEntry1, pEntry2, i)
Definition: vecPtr.h:65
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
ABC_DLL Abc_Des_t * Abc_DesCreate(char *pName)
DECLARATIONS ///.
Definition: abcLib.c:45
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
ABC_DLL int Abc_DesAddModel(Abc_Des_t *p, Abc_Ntk_t *pNtk)
Definition: abcLib.c:226
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
int Abc_NtkCollectPiPos(Abc_Ntk_t *pNtk, Vec_Ptr_t **pvLiMaps, Vec_Ptr_t **pvLoMaps)
Definition: abcBarBuf.c:147
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static int Abc_ObjIsWhitebox(Abc_Obj_t *pObj)
Definition: abc.h:358
static int Abc_NtkWhiteboxNum(Abc_Ntk_t *pNtk)
Definition: abc.h:295
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
unsigned Type
Definition: abc.h:133
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static Abc_Ntk_t * Abc_ObjModel(Abc_Obj_t *pObj)
Definition: abc.h:335
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
char * Nm_ManStoreIdName(Nm_Man_t *p, int ObjId, int Type, char *pName, char *pSuffix)
Definition: nmApi.c:112
ABC_DLL Abc_Ntk_t * Abc_NtkStartFrom(Abc_Ntk_t *pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func)
Definition: abcNtk.c:106
Abc_Obj_t * pCopy
Definition: abc.h:148
if(last==0)
Definition: sparse_int.h:34
ABC_DLL void Abc_NtkCleanCopy_rec(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:514
#define Abc_NtkForEachBox(pNtk, pObj, i)
Definition: abc.h:495
static Abc_Obj_t * Abc_NtkBox(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:319
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static Abc_Obj_t * Abc_NtkPo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:316
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:286
Abc_Obj_t * Abc_NtkFromBarBufs_rec(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj)
Definition: abcBarBuf.c:252
int nBarBufs
Definition: abc.h:174
int Id
Definition: abc.h:132
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:285
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:507
Vec_Ptr_t * vModules
Definition: abc.h:223
#define assert(ex)
Definition: util_old.h:213
static Abc_Obj_t * Abc_NtkPi(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:315
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
static int Abc_NtkBlackboxNum(Abc_Ntk_t *pNtk)
Definition: abc.h:296
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
Abc_Des_t * pDesign
Definition: abc.h:180
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
static Abc_Obj_t * Abc_NtkCreateNet(Abc_Ntk_t *pNtk)
Definition: abc.h:307
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
static int Abc_ObjIsBlackbox(Abc_Obj_t *pObj)
Definition: abc.h:359
ABC_DLL int Abc_NtkGetAigNodeNum ( Abc_Ntk_t pNtk)

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

Synopsis [Reads the number of BDD nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 266 of file abcUtil.c.

267 {
268  Abc_Obj_t * pNode;
269  int i, nNodes = 0;
270  assert( Abc_NtkIsAigLogic(pNtk) );
271  Abc_NtkForEachNode( pNtk, pNode, i )
272  {
273  assert( pNode->pData );
274  if ( Abc_ObjFaninNum(pNode) < 2 )
275  continue;
276 //printf( "%d ", Hop_DagSize( pNode->pData ) );
277  nNodes += pNode->pData? Hop_DagSize( (Hop_Obj_t *)pNode->pData ) : 0;
278  }
279  return nNodes;
280 }
int Hop_DagSize(Hop_Obj_t *pObj)
Definition: hopDfs.c:279
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Abc_NtkIsAigLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:266
Definition: hop.h:65
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
ABC_DLL int Abc_NtkGetBddNodeNum ( Abc_Ntk_t pNtk)

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

Synopsis [Reads the number of BDD nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 240 of file abcUtil.c.

241 {
242  Abc_Obj_t * pNode;
243  int i, nNodes = 0;
244  assert( Abc_NtkIsBddLogic(pNtk) );
245  Abc_NtkForEachNode( pNtk, pNode, i )
246  {
247  assert( pNode->pData );
248  if ( Abc_ObjFaninNum(pNode) < 2 )
249  continue;
250  nNodes += pNode->pData? -1 + Cudd_DagSize( (DdNode *)pNode->pData ) : 0;
251  }
252  return nNodes;
253 }
Definition: cudd.h:278
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
static int Abc_NtkIsBddLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:265
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
int Cudd_DagSize(DdNode *node)
Definition: cuddUtil.c:442
ABC_DLL int Abc_NtkGetBufNum ( Abc_Ntk_t pNtk)

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

Synopsis [Counts the number of exors.]

Description []

SideEffects []

SeeAlso []

Definition at line 410 of file abcUtil.c.

411 {
412  Abc_Obj_t * pNode;
413  int i, Counter = 0;
414  Abc_NtkForEachNode( pNtk, pNode, i )
415  Counter += (Abc_ObjFaninNum(pNode) == 1);
416  return Counter;
417 }
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Counter
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
ABC_DLL int Abc_NtkGetChoiceNum ( Abc_Ntk_t pNtk)

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

Synopsis [Returns 1 if it is an AIG with choice nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 430 of file abcUtil.c.

431 {
432  Abc_Obj_t * pNode;
433  int i, Counter;
434  if ( !Abc_NtkIsStrash(pNtk) )
435  return 0;
436  Counter = 0;
437  Abc_NtkForEachNode( pNtk, pNode, i )
438  Counter += Abc_AigNodeIsChoice( pNode );
439  return Counter;
440 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static int Counter
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
static int Abc_AigNodeIsChoice(Abc_Obj_t *pNode)
Definition: abc.h:398
ABC_DLL float* Abc_NtkGetCiArrivalFloats ( Abc_Ntk_t pNtk)

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

Synopsis [Sets the CI node levels according to the arrival info.]

Description []

SideEffects []

SeeAlso []

Definition at line 658 of file abcTiming.c.

659 {
660  float * p;
661  Abc_Obj_t * pNode;
662  int i;
663  p = ABC_CALLOC( float, Abc_NtkCiNum(pNtk) );
664  if ( pNtk->pManTime == NULL )
665  return p;
666  Abc_NtkForEachCi( pNtk, pNode, i )
667  if ( Abc_NodeReadArrivalWorst(pNode) != 0 )
668  break;
669  if ( i == Abc_NtkCiNum(pNtk) )
670  return NULL;
671  // set the PI arrival times
672  Abc_NtkForEachCi( pNtk, pNode, i )
673  p[i] = Abc_NodeReadArrivalWorst(pNode);
674  return p;
675 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
float Abc_NodeReadArrivalWorst(Abc_Obj_t *pNode)
Definition: abcTiming.c:95
if(last==0)
Definition: sparse_int.h:34
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
Abc_ManTime_t * pManTime
Definition: abc.h:192
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
ABC_DLL Abc_Time_t* Abc_NtkGetCiArrivalTimes ( Abc_Ntk_t pNtk)

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

Synopsis [Sets the CI node levels according to the arrival info.]

Description []

SideEffects []

SeeAlso []

Definition at line 619 of file abcTiming.c.

620 {
621  Abc_Time_t * p;
622  Abc_Obj_t * pNode;
623  int i;
624  p = ABC_CALLOC( Abc_Time_t, Abc_NtkCiNum(pNtk) );
625  if ( pNtk->pManTime == NULL )
626  return p;
627  // set the PI arrival times
628  Abc_NtkForEachCi( pNtk, pNode, i )
629  p[i] = *Abc_NodeArrival(pNode);
630  return p;
631 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
Abc_ManTime_t * pManTime
Definition: abc.h:192
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
static Abc_Time_t * Abc_NodeArrival(Abc_Obj_t *pNode)
Definition: abcTiming.c:49
ABC_DLL Vec_Int_t* Abc_NtkGetCiIds ( Abc_Ntk_t pNtk)

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

Synopsis [Returns the array of CI IDs.]

Description []

SideEffects []

SeeAlso []

Definition at line 1747 of file abcUtil.c.

1748 {
1749  Vec_Int_t * vCiIds;
1750  Abc_Obj_t * pObj;
1751  int i;
1752  vCiIds = Vec_IntAlloc( Abc_NtkCiNum(pNtk) );
1753  Abc_NtkForEachCi( pNtk, pObj, i )
1754  Vec_IntPush( vCiIds, pObj->Id );
1755  return vCiIds;
1756 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
ABC_DLL int Abc_NtkGetClauseNum ( Abc_Ntk_t pNtk)

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

Synopsis [Reads the number of BDD nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 293 of file abcUtil.c.

294 {
295  extern int Abc_CountZddCubes( DdManager * dd, DdNode * zCover );
296  Abc_Obj_t * pNode;
297  DdNode * bCover, * zCover, * bFunc;
298  DdManager * dd = (DdManager *)pNtk->pManFunc;
299  int i, nClauses = 0;
300  assert( Abc_NtkIsBddLogic(pNtk) );
301  Abc_NtkForEachNode( pNtk, pNode, i )
302  {
303  assert( pNode->pData );
304  bFunc = (DdNode *)pNode->pData;
305 
306  bCover = Cudd_zddIsop( dd, bFunc, bFunc, &zCover );
307  Cudd_Ref( bCover );
308  Cudd_Ref( zCover );
309  nClauses += Abc_CountZddCubes( dd, zCover );
310  Cudd_RecursiveDeref( dd, bCover );
311  Cudd_RecursiveDerefZdd( dd, zCover );
312 
313  bCover = Cudd_zddIsop( dd, Cudd_Not(bFunc), Cudd_Not(bFunc), &zCover );
314  Cudd_Ref( bCover );
315  Cudd_Ref( zCover );
316  nClauses += Abc_CountZddCubes( dd, zCover );
317  Cudd_RecursiveDeref( dd, bCover );
318  Cudd_RecursiveDerefZdd( dd, zCover );
319  }
320  return nClauses;
321 }
void Cudd_RecursiveDerefZdd(DdManager *table, DdNode *n)
Definition: cuddRef.c:385
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
Definition: cudd.h:278
#define Cudd_Not(node)
Definition: cudd.h:367
void * pManFunc
Definition: abc.h:191
DdNode * Cudd_zddIsop(DdManager *dd, DdNode *L, DdNode *U, DdNode **zdd_I)
Definition: cuddZddIsop.c:136
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
static int Abc_NtkIsBddLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:265
#define assert(ex)
Definition: util_old.h:213
int Abc_CountZddCubes(DdManager *dd, DdNode *zCover)
Definition: abcFunc.c:593
void * pData
Definition: abc.h:145
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
ABC_DLL float* Abc_NtkGetCoRequiredFloats ( Abc_Ntk_t pNtk)

Definition at line 676 of file abcTiming.c.

677 {
678  float * p;
679  Abc_Obj_t * pNode;
680  int i;
681  if ( pNtk->pManTime == NULL )
682  return NULL;
683  Abc_NtkForEachCo( pNtk, pNode, i )
685  break;
686  if ( i == Abc_NtkCoNum(pNtk) )
687  return NULL;
688  // set the PO required times
689  p = ABC_CALLOC( float, Abc_NtkCoNum(pNtk) );
690  Abc_NtkForEachCo( pNtk, pNode, i )
691  p[i] = Abc_NodeReadRequiredWorst(pNode);
692  return p;
693 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
float Abc_NodeReadRequiredWorst(Abc_Obj_t *pNode)
Definition: abcTiming.c:99
if(last==0)
Definition: sparse_int.h:34
Abc_ManTime_t * pManTime
Definition: abc.h:192
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
ABC_DLL Abc_Time_t* Abc_NtkGetCoRequiredTimes ( Abc_Ntk_t pNtk)

Definition at line 632 of file abcTiming.c.

633 {
634  Abc_Time_t * p;
635  Abc_Obj_t * pNode;
636  int i;
637  p = ABC_CALLOC( Abc_Time_t, Abc_NtkCoNum(pNtk) );
638  if ( pNtk->pManTime == NULL )
639  return p;
640  // set the PO required times
641  Abc_NtkForEachCo( pNtk, pNode, i )
642  p[i] = *Abc_NodeRequired(pNode);
643  return p;
644 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
Abc_ManTime_t * pManTime
Definition: abc.h:192
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
static Abc_Time_t * Abc_NodeRequired(Abc_Obj_t *pNode)
Definition: abcTiming.c:50
ABC_DLL int Abc_NtkGetCubeNum ( Abc_Ntk_t pNtk)

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

Synopsis [Reads the number of cubes of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 112 of file abcUtil.c.

113 {
114  Abc_Obj_t * pNode;
115  int i, nCubes = 0;
116  assert( Abc_NtkHasSop(pNtk) );
117  Abc_NtkForEachNode( pNtk, pNode, i )
118  {
119  if ( Abc_NodeIsConst(pNode) )
120  continue;
121  assert( pNode->pData );
122  nCubes += Abc_SopGetCubeNum( (char *)pNode->pData );
123  }
124  return nCubes;
125 }
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
ABC_DLL int Abc_NodeIsConst(Abc_Obj_t *pNode)
Definition: abcObj.c:843
ABC_DLL int Abc_SopGetCubeNum(char *pSop)
Definition: abcSop.c:489
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
ABC_DLL int Abc_NtkGetCubePairNum ( Abc_Ntk_t pNtk)

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

Synopsis [Reads the number of cubes of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 138 of file abcUtil.c.

139 {
140  Abc_Obj_t * pNode;
141  int i, nCubes, nCubePairs = 0;
142  assert( Abc_NtkHasSop(pNtk) );
143  Abc_NtkForEachNode( pNtk, pNode, i )
144  {
145  if ( Abc_NodeIsConst(pNode) )
146  continue;
147  assert( pNode->pData );
148  nCubes = Abc_SopGetCubeNum( (char *)pNode->pData );
149  nCubePairs += nCubes * (nCubes - 1) / 2;
150  }
151  return nCubePairs;
152 }
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
ABC_DLL int Abc_NodeIsConst(Abc_Obj_t *pNode)
Definition: abcObj.c:843
ABC_DLL int Abc_SopGetCubeNum(char *pSop)
Definition: abcSop.c:489
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
ABC_DLL int Abc_NtkGetExorNum ( Abc_Ntk_t pNtk)

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

Synopsis [Counts the number of exors.]

Description []

SideEffects []

SeeAlso []

Definition at line 370 of file abcUtil.c.

371 {
372  Abc_Obj_t * pNode;
373  int i, Counter = 0;
374  Abc_NtkForEachNode( pNtk, pNode, i )
375  Counter += pNode->fExor;
376  return Counter;
377 }
static int Counter
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
ABC_DLL int Abc_NtkGetFaninMax ( Abc_Ntk_t pNtk)

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

Synopsis [Reads the maximum number of fanins.]

Description []

SideEffects []

SeeAlso []

Definition at line 453 of file abcUtil.c.

454 {
455  Abc_Obj_t * pNode;
456  int i, nFaninsMax = 0;
457  Abc_NtkForEachNode( pNtk, pNode, i )
458  {
459  if ( nFaninsMax < Abc_ObjFaninNum(pNode) )
460  nFaninsMax = Abc_ObjFaninNum(pNode);
461  }
462  return nFaninsMax;
463 }
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
ABC_DLL int Abc_NtkGetFanoutMax ( Abc_Ntk_t pNtk)

Definition at line 464 of file abcUtil.c.

465 {
466  Abc_Obj_t * pNode;
467  int i, nFaninsMax = 0;
468  Abc_NtkForEachNode( pNtk, pNode, i )
469  {
470  if ( nFaninsMax < Abc_ObjFanoutNum(pNode) )
471  nFaninsMax = Abc_ObjFanoutNum(pNode);
472  }
473  return nFaninsMax;
474 }
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
ABC_DLL int Abc_NtkGetLitFactNum ( Abc_Ntk_t pNtk)

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

Synopsis [Counts the number of literals in the factored forms.]

Description []

SideEffects []

SeeAlso []

Definition at line 189 of file abcUtil.c.

190 {
191  Dec_Graph_t * pFactor;
192  Abc_Obj_t * pNode;
193  int nNodes, i;
194  assert( Abc_NtkHasSop(pNtk) );
195  nNodes = 0;
196  Abc_NtkForEachNode( pNtk, pNode, i )
197  {
198  if ( Abc_NodeIsConst(pNode) )
199  continue;
200  pFactor = Dec_Factor( (char *)pNode->pData );
201  nNodes += 1 + Dec_GraphNodeNum(pFactor);
202  Dec_GraphFree( pFactor );
203  }
204  return nNodes;
205 }
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
ABC_DLL int Abc_NodeIsConst(Abc_Obj_t *pNode)
Definition: abcObj.c:843
static int Dec_GraphNodeNum(Dec_Graph_t *pGraph)
Definition: dec.h:421
Dec_Graph_t * Dec_Factor(char *pSop)
FUNCTION DECLARATIONS ///.
Definition: decFactor.c:55
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
static void Dec_GraphFree(Dec_Graph_t *pGraph)
Definition: dec.h:307
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
ABC_DLL int Abc_NtkGetLitNum ( Abc_Ntk_t pNtk)

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

Synopsis [Reads the number of literals in the SOPs of the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 165 of file abcUtil.c.

166 {
167  Abc_Obj_t * pNode;
168  int i, nLits = 0;
169  assert( Abc_NtkHasSop(pNtk) );
170  Abc_NtkForEachNode( pNtk, pNode, i )
171  {
172  assert( pNode->pData );
173  nLits += Abc_SopGetLitNum( (char *)pNode->pData );
174  }
175  return nLits;
176 }
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
ABC_DLL int Abc_SopGetLitNum(char *pSop)
Definition: abcSop.c:511
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
ABC_DLL double Abc_NtkGetMappedArea ( Abc_Ntk_t pNtk)

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

Synopsis [Computes the area of the mapped circuit.]

Description []

SideEffects []

SeeAlso []

Definition at line 334 of file abcUtil.c.

335 {
336  Abc_Obj_t * pObj;
337  double TotalArea;
338  int i;
339  assert( Abc_NtkHasMapping(pNtk) );
340  TotalArea = 0.0;
341  Abc_NtkForEachNode( pNtk, pObj, i )
342  {
343  if ( Abc_ObjIsBarBuf(pObj) )
344  continue;
345 // assert( pObj->pData );
346  if ( pObj->pData == NULL )
347  {
348  printf( "Node without mapping is encountered.\n" );
349  continue;
350  }
351  TotalArea += Mio_GateReadArea( (Mio_Gate_t *)pObj->pData );
352  // assuming that twin gates follow each other
353  if ( Abc_NtkFetchTwinNode(pObj) )
354  i++;
355  }
356  return TotalArea;
357 }
static int Abc_ObjIsBarBuf(Abc_Obj_t *pObj)
Definition: abc.h:360
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
double Mio_GateReadArea(Mio_Gate_t *pGate)
Definition: mioApi.c:145
ABC_DLL Abc_Obj_t * Abc_NtkFetchTwinNode(Abc_Obj_t *pNode)
Definition: abcMap.c:740
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
ABC_DLL int Abc_NtkGetMuxNum ( Abc_Ntk_t pNtk)

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

Synopsis [Counts the number of exors.]

Description []

SideEffects []

SeeAlso []

Definition at line 390 of file abcUtil.c.

391 {
392  Abc_Obj_t * pNode;
393  int i, Counter = 0;
394  Abc_NtkForEachNode( pNtk, pNode, i )
395  Counter += Abc_NodeIsMuxType(pNode);
396  return Counter;
397 }
int Abc_NodeIsMuxType(Abc_Obj_t *pNode)
Definition: abcUtil.c:1301
static int Counter
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
ABC_DLL int Abc_NtkGetTotalFanins ( Abc_Ntk_t pNtk)

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

Synopsis [Reads the total number of all fanins.]

Description []

SideEffects []

SeeAlso []

Definition at line 487 of file abcUtil.c.

488 {
489  Abc_Obj_t * pNode;
490  int i, nFanins = 0;
491  Abc_NtkForEachNode( pNtk, pNode, i )
492  nFanins += Abc_ObjFaninNum(pNode);
493  return nFanins;
494 }
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
static void* Abc_NtkGlobalBdd ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 428 of file abc.h.

428 { return Vec_PtrEntry(pNtk->vAttrs, VEC_ATTR_GLOBAL_BDD); }
Vec_Ptr_t * vAttrs
Definition: abc.h:214
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static void** Abc_NtkGlobalBddArray ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 430 of file abc.h.

430 { return Vec_AttArray( (Vec_Att_t *)Abc_NtkGlobalBdd(pNtk) ); }
static void * Abc_NtkGlobalBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:428
static void ** Vec_AttArray(Vec_Att_t *p)
Definition: vecAtt.h:284
static void* Abc_NtkGlobalBddMan ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 429 of file abc.h.

429 { return Vec_AttMan( (Vec_Att_t *)Abc_NtkGlobalBdd(pNtk) ); }
static void * Abc_NtkGlobalBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:428
static void * Vec_AttMan(Vec_Att_t *p)
Definition: vecAtt.h:268
ABC_DLL int Abc_NtkHaigStart ( Abc_Ntk_t pNtk)
ABC_DLL int Abc_NtkHaigStop ( Abc_Ntk_t pNtk)
ABC_DLL Abc_Ntk_t* Abc_NtkHaigUse ( Abc_Ntk_t pNtk)
static int Abc_NtkHasAig ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 255 of file abc.h.

255 { return pNtk->ntkFunc == ABC_FUNC_AIG; }
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
static int Abc_NtkHasBdd ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 254 of file abc.h.

254 { return pNtk->ntkFunc == ABC_FUNC_BDD; }
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
static int Abc_NtkHasBlackbox ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 258 of file abc.h.

258 { return pNtk->ntkFunc == ABC_FUNC_BLACKBOX; }
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
static int Abc_NtkHasBlifMv ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 257 of file abc.h.

257 { return pNtk->ntkFunc == ABC_FUNC_BLIFMV; }
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
static int Abc_NtkHasMapping ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 256 of file abc.h.

256 { return pNtk->ntkFunc == ABC_FUNC_MAP; }
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
static int Abc_NtkHasOnlyLatchBoxes ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 298 of file abc.h.

298 { return Abc_NtkLatchNum(pNtk) == Abc_NtkBoxNum(pNtk); }
static int Abc_NtkBoxNum(Abc_Ntk_t *pNtk)
Definition: abc.h:289
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
static int Abc_NtkHasSop ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 253 of file abc.h.

253 { return pNtk->ntkFunc == ABC_FUNC_SOP; }
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
static void Abc_NtkIncrementTravId ( Abc_Ntk_t p)
inlinestatic

Definition at line 406 of file abc.h.

406 { if (!p->vTravIds.pArray) Vec_IntFill(&p->vTravIds, Abc_NtkObjNumMax(p)+500, 0); p->nTravIds++; assert(p->nTravIds < (1<<30)); }
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
Vec_Int_t vTravIds
Definition: abc.h:188
#define assert(ex)
Definition: util_old.h:213
int nTravIds
Definition: abc.h:187
ABC_DLL Abc_Ntk_t* Abc_NtkInsertBlifMv ( Abc_Ntk_t pNtkBase,
Abc_Ntk_t pNtkLogic 
)

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

Synopsis [Inserts processed network into original base MV network.]

Description [The original network remembers the interface of combinational logic (PIs/POs/latches names and values). The processed network may be binary or multi-valued (currently, multi-value is not supported). The resulting network has the same interface as the original network while the internal logic is the same as that of the processed network.]

SideEffects []

SeeAlso []

Definition at line 909 of file abcBlifMv.c.

910 {
911  Abc_Ntk_t * pNtkSkel, * pNtkNew;
912  Abc_Obj_t * pBox;
913 
914  assert( Abc_NtkIsNetlist(pNtkBase) );
915  assert( Abc_NtkHasBlifMv(pNtkBase) );
916  assert( Abc_NtkWhiteboxNum(pNtkBase) == 0 );
917  assert( Abc_NtkBlackboxNum(pNtkBase) == 0 );
918 
919  assert( Abc_NtkIsNetlist(pNtkLogic) );
920  assert( Abc_NtkHasBlifMv(pNtkLogic) );
921  assert( Abc_NtkWhiteboxNum(pNtkLogic) == 0 );
922  assert( Abc_NtkBlackboxNum(pNtkLogic) == 0 );
923 
924  // extract the skeleton of the old network
925  pNtkSkel = Abc_NtkSkeletonBlifMv( pNtkBase );
926 
927  // set the implementation of the box to be the same as the processed network
928  assert( Abc_NtkWhiteboxNum(pNtkSkel) == 1 );
929  pBox = Abc_NtkBox( pNtkSkel, 0 );
930  assert( Abc_ObjIsWhitebox(pBox) );
931  assert( pBox->pData == NULL );
932  assert( Abc_ObjFaninNum(pBox) == Abc_NtkPiNum(pNtkLogic) );
933  assert( Abc_ObjFanoutNum(pBox) == Abc_NtkPoNum(pNtkLogic) );
934  pBox->pData = pNtkLogic;
935 
936  // flatten the hierarchy to insert the processed network
937  pNtkNew = Abc_NtkFlattenLogicHierarchy( pNtkSkel );
938  pBox->pData = NULL;
939  Abc_NtkDelete( pNtkSkel );
940  return pNtkNew;
941 }
Abc_Ntk_t * Abc_NtkSkeletonBlifMv(Abc_Ntk_t *pNtk)
Definition: abcBlifMv.c:724
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
ABC_DLL Abc_Ntk_t * Abc_NtkFlattenLogicHierarchy(Abc_Ntk_t *pNtk)
Definition: abcHie.c:514
static int Abc_ObjIsWhitebox(Abc_Obj_t *pObj)
Definition: abc.h:358
static int Abc_NtkHasBlifMv(Abc_Ntk_t *pNtk)
Definition: abc.h:257
static int Abc_NtkWhiteboxNum(Abc_Ntk_t *pNtk)
Definition: abc.h:295
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
static Abc_Obj_t * Abc_NtkBox(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:319
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:286
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:285
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
static int Abc_NtkBlackboxNum(Abc_Ntk_t *pNtk)
Definition: abc.h:296
ABC_DLL void Abc_NtkInsertHierarchyGia ( Abc_Ntk_t pNtk,
Abc_Ntk_t pNew,
int  fVerbose 
)

Definition at line 390 of file abcHieGia.c.

391 {
392  Vec_Ptr_t * vBuffers;
393  Gia_Man_t * pGia = Abc_NtkFlattenHierarchyGia( pNtk, &vBuffers, 0 );
394  Abc_Ntk_t * pModel;
395  Abc_Obj_t * pObj;
396  int i;
397 
398  assert( Gia_ManPiNum(pGia) == Abc_NtkPiNum(pNtk) );
399  assert( Gia_ManPiNum(pGia) == Abc_NtkPiNum(pNew) );
400  assert( Gia_ManPoNum(pGia) == Abc_NtkPoNum(pNtk) );
401  assert( Gia_ManPoNum(pGia) == Abc_NtkPoNum(pNew) );
402  assert( Gia_ManBufNum(pGia) == Vec_PtrSize(vBuffers) );
403  assert( Gia_ManBufNum(pGia) == pNew->nBarBufs2 );
404  Gia_ManStop( pGia );
405 
406  // clean the networks
407  if ( !pNtk->pDesign )
408  Abc_NtkCleanCopy( pNtk );
409  else
410  Vec_PtrForEachEntry( Abc_Ntk_t *, pNtk->pDesign->vModules, pModel, i )
411  Abc_NtkCleanCopy( pModel );
412 
413  // annotate PIs and POs of each network with barbufs
414  Abc_NtkForEachPi( pNew, pObj, i )
415  Abc_NtkPi(pNtk, i)->pCopy = pObj;
416  Abc_NtkForEachPo( pNew, pObj, i )
417  Abc_NtkPo(pNtk, i)->pCopy = pObj;
418  Abc_NtkForEachBarBuf( pNew, pObj, i )
419  ((Abc_Obj_t *)Vec_PtrEntry(vBuffers, i))->pCopy = pObj;
420  Vec_PtrFree( vBuffers );
421 
422  // connect each model
423  Abc_NtkCleanCopy( pNew );
424  Gia_ManInsertOne( pNtk, pNew );
425  if ( pNtk->pDesign )
426  Vec_PtrForEachEntry( Abc_Ntk_t *, pNtk->pDesign->vModules, pModel, i )
427  if ( pModel != pNtk )
428  Gia_ManInsertOne( pModel, pNew );
429 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
int nBarBufs2
Definition: abc.h:175
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Gia_Man_t * Abc_NtkFlattenHierarchyGia(Abc_Ntk_t *pNtk, Vec_Ptr_t **pvBuffers, int fVerbose)
Definition: abcHieGia.c:277
if(last==0)
Definition: sparse_int.h:34
#define Abc_NtkForEachBarBuf(pNtk, pNode, i)
Definition: abc.h:479
void Gia_ManInsertOne(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNew)
Definition: abcHieGia.c:358
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static Abc_Obj_t * Abc_NtkPo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:316
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:286
Definition: gia.h:95
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:285
static int Gia_ManBufNum(Gia_Man_t *p)
Definition: gia.h:392
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:507
Vec_Ptr_t * vModules
Definition: abc.h:223
#define assert(ex)
Definition: util_old.h:213
static Abc_Obj_t * Abc_NtkPi(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:315
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
Abc_Des_t * pDesign
Definition: abc.h:180
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL void Abc_NtkInsertLatchValues ( Abc_Ntk_t pNtk,
Vec_Int_t vValues 
)

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

Synopsis [Strashes one logic node using its SOP.]

Description []

SideEffects []

SeeAlso []

Definition at line 241 of file abcLatch.c.

242 {
243  Abc_Obj_t * pLatch;
244  int i;
245  Abc_NtkForEachLatch( pNtk, pLatch, i )
246  pLatch->pData = (void *)(ABC_PTRINT_T)(vValues? (Vec_IntEntry(vValues,i)? ABC_INIT_ONE : ABC_INIT_ZERO) : ABC_INIT_DC);
247 }
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
#define Abc_NtkForEachLatch(pNtk, pObj, i)
Definition: abc.h:497
ABC_DLL Abc_Ntk_t* Abc_NtkInsertNewLogic ( Abc_Ntk_t pNtkH,
Abc_Ntk_t pNtkL 
)

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

Synopsis [Inserts blackboxes into the netlist.]

Description [The first arg is the netlist with blackboxes without logic hierarchy. The second arg is a non-hierarchical netlist derived from the above netlist after processing. This procedure create a new netlist, which is comparable to the original netlist with blackboxes, except that it contains logic nodes from the netlist after processing.]

SideEffects [This procedure silently assumes that blackboxes appear only in the top-level model. If they appear in other models as well, the name of the model and its number were appended to the names of blackbox inputs/outputs.]

SeeAlso []

Definition at line 691 of file abcHie.c.

692 {
693  Abc_Des_t * pDesign;
694  Abc_Ntk_t * pNtkNew;
695  Abc_Obj_t * pObjH, * pObjL, * pNetH, * pNetL, * pTermH;
696  int i, k;
697 
698  assert( Abc_NtkIsNetlist(pNtkH) );
699  assert( Abc_NtkWhiteboxNum(pNtkH) == 0 );
700  assert( Abc_NtkBlackboxNum(pNtkH) > 0 );
701 
702  assert( Abc_NtkIsNetlist(pNtkL) );
703  assert( Abc_NtkWhiteboxNum(pNtkL) == 0 );
704  assert( Abc_NtkBlackboxNum(pNtkL) == 0 );
705 
706  // prepare the logic network for copying
707  Abc_NtkCleanCopy( pNtkL );
708 
709  // start the network
710  pNtkNew = Abc_NtkAlloc( pNtkL->ntkType, pNtkL->ntkFunc, 1 );
711  // duplicate the name and the spec
712  pNtkNew->pName = Extra_UtilStrsav( pNtkH->pName );
713  pNtkNew->pSpec = Extra_UtilStrsav( pNtkH->pSpec );
714 
715  // make sure every PI/PO has a PI/PO in the processed network
716  Abc_NtkForEachPi( pNtkH, pObjH, i )
717  {
718  pNetH = Abc_ObjFanout0(pObjH);
719  pNetL = Abc_NtkFindNet( pNtkL, Abc_ObjName(pNetH) );
720  if ( pNetL == NULL || !Abc_ObjIsPi( Abc_ObjFanin0(pNetL) ) )
721  {
722  printf( "Error in Abc_NtkInsertNewLogic(): There is no PI corresponding to the PI %s.\n", Abc_ObjName(pNetH) );
723  Abc_NtkDelete( pNtkNew );
724  return NULL;
725  }
726  if ( pNetL->pCopy )
727  {
728  printf( "Error in Abc_NtkInsertNewLogic(): Primary input %s is repeated twice.\n", Abc_ObjName(pNetH) );
729  Abc_NtkDelete( pNtkNew );
730  return NULL;
731  }
732  // create the new net
733  pNetL->pCopy = Abc_NtkFindOrCreateNet( pNtkNew, Abc_ObjName(pNetH) );
734  Abc_NtkDupObj( pNtkNew, Abc_ObjFanin0(pNetL), 0 );
735  }
736 
737  // make sure every BB has a PI/PO in the processed network
738  Abc_NtkForEachBlackbox( pNtkH, pObjH, i )
739  {
740  // duplicate the box
741  Abc_NtkDupBox( pNtkNew, pObjH, 0 );
742  pObjH->pCopy->pData = pObjH->pData;
743  // create PIs
744  Abc_ObjForEachFanout( pObjH, pTermH, k )
745  {
746  pNetH = Abc_ObjFanout0( pTermH );
747  pNetL = Abc_NtkFindNet( pNtkL, Abc_ObjName(pNetH) );
748  if ( pNetL == NULL || !Abc_ObjIsPi( Abc_ObjFanin0(pNetL) ) )
749  {
750  printf( "Error in Abc_NtkInsertNewLogic(): There is no PI corresponding to the inpout %s of blackbox %s.\n", Abc_ObjName(pNetH), Abc_ObjName(pObjH) );
751  Abc_NtkDelete( pNtkNew );
752  return NULL;
753  }
754  if ( pNetL->pCopy )
755  {
756  printf( "Error in Abc_NtkInsertNewLogic(): Box output %s is repeated twice.\n", Abc_ObjName(pNetH) );
757  Abc_NtkDelete( pNtkNew );
758  return NULL;
759  }
760  // create net and map the PI
761  pNetL->pCopy = Abc_NtkFindOrCreateNet( pNtkNew, Abc_ObjName(pNetH) );
762  Abc_ObjFanin0(pNetL)->pCopy = pTermH->pCopy;
763  }
764  }
765 
766  Abc_NtkForEachPo( pNtkH, pObjH, i )
767  {
768  pNetH = Abc_ObjFanin0(pObjH);
769  pNetL = Abc_NtkFindNet( pNtkL, Abc_ObjName(pNetH) );
770  if ( pNetL == NULL || !Abc_ObjIsPo( Abc_ObjFanout0(pNetL) ) )
771  {
772  printf( "Error in Abc_NtkInsertNewLogic(): There is no PO corresponding to the PO %s.\n", Abc_ObjName(pNetH) );
773  Abc_NtkDelete( pNtkNew );
774  return NULL;
775  }
776  if ( pNetL->pCopy )
777  continue;
778  // create the new net
779  pNetL->pCopy = Abc_NtkFindOrCreateNet( pNtkNew, Abc_ObjName(pNetH) );
780  Abc_NtkDupObj( pNtkNew, Abc_ObjFanout0(pNetL), 0 );
781  }
782  Abc_NtkForEachBlackbox( pNtkH, pObjH, i )
783  {
784  Abc_ObjForEachFanin( pObjH, pTermH, k )
785  {
786  char * pName;
787  pNetH = Abc_ObjFanin0( pTermH );
788  pName = Abc_ObjName(pNetH);
789  pNetL = Abc_NtkFindNet( pNtkL, Abc_ObjName(pNetH) );
790  if ( pNetL == NULL || !Abc_ObjIsPo( Abc_ObjFanout0(pNetL) ) )
791  {
792  printf( "There is no PO corresponding to the input %s of blackbox %s.\n", Abc_ObjName(pNetH), Abc_ObjName(pObjH) );
793  Abc_NtkDelete( pNtkNew );
794  return NULL;
795  }
796  // create net and map the PO
797  if ( pNetL->pCopy )
798  {
799  if ( Abc_ObjFanout0(pNetL)->pCopy == NULL )
800  Abc_ObjFanout0(pNetL)->pCopy = pTermH->pCopy;
801  else
802  Abc_ObjAddFanin( pTermH->pCopy, pNetL->pCopy );
803  continue;
804  }
805  pNetL->pCopy = Abc_NtkFindOrCreateNet( pNtkNew, Abc_ObjName(pNetH) );
806  Abc_ObjFanout0(pNetL)->pCopy = pTermH->pCopy;
807  }
808  }
809 
810  // duplicate other objects of the logic network
811  Abc_NtkForEachObj( pNtkL, pObjL, i )
812  if ( pObjL->pCopy == NULL && !Abc_ObjIsPo(pObjL) ) // skip POs feeding into PIs
813  Abc_NtkDupObj( pNtkNew, pObjL, Abc_ObjIsNet(pObjL) );
814 
815  // connect objects
816  Abc_NtkForEachObj( pNtkL, pObjL, i )
817  Abc_ObjForEachFanin( pObjL, pNetL, k )
818  if ( pObjL->pCopy )
819  Abc_ObjAddFanin( pObjL->pCopy, pNetL->pCopy );
820 
821  // transfer the design
822  pDesign = pNtkH->pDesign; pNtkH->pDesign = NULL;
823  assert( Vec_PtrEntry( pDesign->vModules, 0 ) == pNtkH );
824  Vec_PtrWriteEntry( pDesign->vModules, 0, pNtkNew );
825  pNtkNew->pDesign = pDesign;
826 
827  // check integrity
828  if ( !Abc_NtkCheck( pNtkNew ) )
829  {
830  fprintf( stdout, "Abc_NtkInsertNewLogic(): Network check has failed.\n" );
831  Abc_NtkDelete( pNtkNew );
832  return NULL;
833  }
834  return pNtkNew;
835 }
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition: abcObj.c:337
static int Abc_ObjIsPi(Abc_Obj_t *pObj)
Definition: abc.h:347
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
static int Abc_NtkWhiteboxNum(Abc_Ntk_t *pNtk)
Definition: abc.h:295
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
char * Extra_UtilStrsav(const char *s)
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
ABC_DLL Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
Abc_Obj_t * pCopy
Definition: abc.h:148
ABC_DLL Abc_Obj_t * Abc_NtkDupBox(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pBox, int fCopyName)
Definition: abcObj.c:407
#define Abc_NtkForEachBlackbox(pNtk, pObj, i)
Definition: abc.h:509
ABC_DLL Abc_Obj_t * Abc_NtkFindNet(Abc_Ntk_t *pNtk, char *pName)
Definition: abcObj.c:507
if(last==0)
Definition: sparse_int.h:34
ABC_DLL Abc_Obj_t * Abc_NtkFindOrCreateNet(Abc_Ntk_t *pNtk, char *pName)
Definition: abcObj.c:579
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
char * pSpec
Definition: abc.h:159
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition: abc.h:526
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
static int Abc_ObjIsNet(Abc_Obj_t *pObj)
Definition: abc.h:354
static int Abc_ObjIsPo(Abc_Obj_t *pObj)
Definition: abc.h:348
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:507
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
static int Abc_NtkBlackboxNum(Abc_Ntk_t *pNtk)
Definition: abc.h:296
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
char * pName
Definition: abc.h:158
Abc_NtkType_t ntkType
Definition: abc.h:156
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
ABC_DLL void Abc_NtkInvertConstraints ( Abc_Ntk_t pNtk)

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

Synopsis [Complements the constraint outputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 2204 of file abcUtil.c.

2205 {
2206  Abc_Obj_t * pObj;
2207  int i;
2208  if ( Abc_NtkConstrNum(pNtk) == 0 )
2209  return;
2210  Abc_NtkForEachPo( pNtk, pObj, i )
2211  {
2212  if ( i >= Abc_NtkPoNum(pNtk) - Abc_NtkConstrNum(pNtk) )
2213  Abc_ObjXorFaninC( pObj, 0 );
2214  }
2215 }
static int Abc_NtkConstrNum(Abc_Ntk_t *pNtk)
Definition: abc.h:299
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:286
static void Abc_ObjXorFaninC(Abc_Obj_t *pObj, int i)
Definition: abc.h:381
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
ABC_DLL int Abc_NtkIsAcyclic ( Abc_Ntk_t pNtk)

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

Synopsis [Detects combinational loops.]

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

SideEffects []

SeeAlso []

Definition at line 1422 of file abcDfs.c.

1423 {
1424  Abc_Obj_t * pNode;
1425  int fAcyclic;
1426  int i;
1427  // set the traversal ID for this DFS ordering
1428  Abc_NtkIncrementTravId( pNtk );
1429  Abc_NtkIncrementTravId( pNtk );
1430  // pNode->TravId == pNet->nTravIds means "pNode is on the path"
1431  // pNode->TravId == pNet->nTravIds - 1 means "pNode is visited but is not on the path"
1432  // pNode->TravId < pNet->nTravIds - 1 means "pNode is not visited"
1433  // traverse the network to detect cycles
1434  fAcyclic = 1;
1435  Abc_NtkForEachCo( pNtk, pNode, i )
1436  {
1437  pNode = Abc_ObjFanin0Ntk(Abc_ObjFanin0(pNode));
1438  if ( Abc_NodeIsTravIdPrevious(pNode) )
1439  continue;
1440  // traverse the output logic cone
1441  if ( (fAcyclic = Abc_NtkIsAcyclic_rec(pNode)) )
1442  continue;
1443  // stop as soon as the first loop is detected
1444  fprintf( stdout, " CO \"%s\"\n", Abc_ObjName(Abc_ObjFanout0(pNode)) );
1445  break;
1446  }
1447  return fAcyclic;
1448 }
static Abc_Obj_t * Abc_ObjFanin0Ntk(Abc_Obj_t *pObj)
Definition: abc.h:375
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static int Abc_NodeIsTravIdPrevious(Abc_Obj_t *p)
Definition: abc.h:412
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
int Abc_NtkIsAcyclic_rec(Abc_Obj_t *pNode)
Definition: abcDfs.c:1346
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371
ABC_DLL int Abc_NtkIsAcyclicHierarchy ( Abc_Ntk_t pNtk)

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

Synopsis [Returns 0 if the network hierachy contains a cycle.]

Description []

SideEffects []

SeeAlso []

Definition at line 809 of file abcCheck.c.

810 {
811  Abc_Ntk_t * pTemp;
812  int i, RetValue;
813  assert( Abc_NtkIsNetlist(pNtk) && pNtk->pDesign );
814  // clear the modules
815  Vec_PtrForEachEntry( Abc_Ntk_t *, pNtk->pDesign->vModules, pTemp, i )
816  pTemp->fHieVisited = pTemp->fHiePath = 0;
817  // traverse
818  pNtk->fHiePath = 1;
819  RetValue = Abc_NtkIsAcyclicHierarchy_rec( pNtk );
820  pNtk->fHiePath = 0;
821  // clear the modules
822  Vec_PtrForEachEntry( Abc_Ntk_t *, pNtk->pDesign->vModules, pTemp, i )
823  pTemp->fHieVisited = pTemp->fHiePath = 0;
824  return RetValue;
825 }
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
Vec_Ptr_t * vModules
Definition: abc.h:223
#define assert(ex)
Definition: util_old.h:213
int Abc_NtkIsAcyclicHierarchy_rec(Abc_Ntk_t *pNtk)
Definition: abcCheck.c:768
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
Abc_Des_t * pDesign
Definition: abc.h:180
ABC_DLL int Abc_NtkIsAcyclicWithBoxes ( Abc_Ntk_t pNtk)

Definition at line 1510 of file abcDfs.c.

1511 {
1512  Abc_Obj_t * pNode;
1513  int fAcyclic;
1514  int i;
1515  // set the traversal ID for this DFS ordering
1516  Abc_NtkIncrementTravId( pNtk );
1517  Abc_NtkIncrementTravId( pNtk );
1518  // pNode->TravId == pNet->nTravIds means "pNode is on the path"
1519  // pNode->TravId == pNet->nTravIds - 1 means "pNode is visited but is not on the path"
1520  // pNode->TravId < pNet->nTravIds - 1 means "pNode is not visited"
1521  // traverse the network to detect cycles
1522  fAcyclic = 1;
1523  Abc_NtkForEachPo( pNtk, pNode, i )
1524  {
1525  pNode = Abc_ObjFanin0Ntk(Abc_ObjFanin0(pNode));
1526  if ( Abc_ObjIsBo(pNode) )
1527  pNode = Abc_ObjFanin0(pNode);
1528  if ( Abc_NodeIsTravIdPrevious(pNode) )
1529  continue;
1530  // traverse the output logic cone
1531  if ( (fAcyclic = Abc_NtkIsAcyclicWithBoxes_rec(pNode)) )
1532  continue;
1533  // stop as soon as the first loop is detected
1534  fprintf( stdout, " PO \"%s\"\n", Abc_ObjName(Abc_ObjFanout0(pNode)) );
1535  break;
1536  }
1537  if ( fAcyclic )
1538  {
1539  Abc_NtkForEachLatchInput( pNtk, pNode, i )
1540  {
1541  pNode = Abc_ObjFanin0Ntk(Abc_ObjFanin0(pNode));
1542  if ( Abc_ObjIsBo(pNode) )
1543  pNode = Abc_ObjFanin0(pNode);
1544  if ( Abc_NodeIsTravIdPrevious(pNode) )
1545  continue;
1546  // traverse the output logic cone
1547  if ( (fAcyclic = Abc_NtkIsAcyclicWithBoxes_rec(pNode)) )
1548  continue;
1549  // stop as soon as the first loop is detected
1550  fprintf( stdout, " PO \"%s\"\n", Abc_ObjName(Abc_ObjFanout0(pNode)) );
1551  break;
1552  }
1553  }
1554  return fAcyclic;
1555 }
static int Abc_ObjIsBo(Abc_Obj_t *pObj)
Definition: abc.h:350
static Abc_Obj_t * Abc_ObjFanin0Ntk(Abc_Obj_t *pObj)
Definition: abc.h:375
static int Abc_NodeIsTravIdPrevious(Abc_Obj_t *p)
Definition: abc.h:412
int Abc_NtkIsAcyclicWithBoxes_rec(Abc_Obj_t *pNode)
Definition: abcDfs.c:1461
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
#define Abc_NtkForEachLatchInput(pNtk, pObj, i)
Definition: abc.h:500
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371
static int Abc_NtkIsAigLogic ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 266 of file abc.h.

266 { return pNtk->ntkFunc == ABC_FUNC_AIG && pNtk->ntkType == ABC_NTK_LOGIC ; }
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
Abc_NtkType_t ntkType
Definition: abc.h:156
static int Abc_NtkIsAigNetlist ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 261 of file abc.h.

261 { return pNtk->ntkFunc == ABC_FUNC_AIG && pNtk->ntkType == ABC_NTK_NETLIST; }
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
Abc_NtkType_t ntkType
Definition: abc.h:156
static int Abc_NtkIsBddLogic ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 265 of file abc.h.

265 { return pNtk->ntkFunc == ABC_FUNC_BDD && pNtk->ntkType == ABC_NTK_LOGIC ; }
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
Abc_NtkType_t ntkType
Definition: abc.h:156
static int Abc_NtkIsBlifMvNetlist ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 263 of file abc.h.

263 { return pNtk->ntkFunc == ABC_FUNC_BLIFMV && pNtk->ntkType == ABC_NTK_NETLIST; }
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
Abc_NtkType_t ntkType
Definition: abc.h:156
static int Abc_NtkIsComb ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 297 of file abc.h.

297 { return Abc_NtkLatchNum(pNtk) == 0; }
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
ABC_DLL int Abc_NtkIsDfsOrdered ( Abc_Ntk_t pNtk)

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

Synopsis [Returns 1 if the ordering of nodes is DFS.]

Description []

SideEffects []

SeeAlso []

Definition at line 667 of file abcDfs.c.

668 {
669  Abc_Obj_t * pNode, * pFanin;
670  int i, k;
671  // set the traversal ID
672  Abc_NtkIncrementTravId( pNtk );
673  // mark the CIs
674  Abc_NtkForEachCi( pNtk, pNode, i )
675  Abc_NodeSetTravIdCurrent( pNode );
676  // go through the nodes
677  Abc_NtkForEachNode( pNtk, pNode, i )
678  {
679  // check the fanins of the node
680  Abc_ObjForEachFanin( pNode, pFanin, k )
681  if ( !Abc_NodeIsTravIdCurrent(pFanin) )
682  return 0;
683  // check the choices of the node
684  if ( Abc_NtkIsStrash(pNtk) && Abc_AigNodeIsChoice(pNode) )
685  for ( pFanin = (Abc_Obj_t *)pNode->pData; pFanin; pFanin = (Abc_Obj_t *)pFanin->pData )
686  if ( !Abc_NodeIsTravIdCurrent(pFanin) )
687  return 0;
688  // mark the node as visited
689  Abc_NodeSetTravIdCurrent( pNode );
690  }
691  return 1;
692 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
for(p=first;p->value< newval;p=p->next)
if(last==0)
Definition: sparse_int.h:34
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:411
static int Abc_AigNodeIsChoice(Abc_Obj_t *pNode)
Definition: abc.h:398
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
static void Abc_NodeSetTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:409
static int Abc_NtkIsLogic ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 250 of file abc.h.

250 { return pNtk->ntkType == ABC_NTK_LOGIC; }
Abc_NtkType_t ntkType
Definition: abc.h:156
static int Abc_NtkIsMappedLogic ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 267 of file abc.h.

267 { return pNtk->ntkFunc == ABC_FUNC_MAP && pNtk->ntkType == ABC_NTK_LOGIC ; }
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
Abc_NtkType_t ntkType
Definition: abc.h:156
static int Abc_NtkIsMappedNetlist ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 262 of file abc.h.

262 { return pNtk->ntkFunc == ABC_FUNC_MAP && pNtk->ntkType == ABC_NTK_NETLIST; }
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
Abc_NtkType_t ntkType
Definition: abc.h:156
static int Abc_NtkIsNetlist ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 249 of file abc.h.

249 { return pNtk->ntkType == ABC_NTK_NETLIST; }
Abc_NtkType_t ntkType
Definition: abc.h:156
static int Abc_NtkIsSopLogic ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 264 of file abc.h.

264 { return pNtk->ntkFunc == ABC_FUNC_SOP && pNtk->ntkType == ABC_NTK_LOGIC ; }
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
Abc_NtkType_t ntkType
Definition: abc.h:156
static int Abc_NtkIsSopNetlist ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 260 of file abc.h.

260 { return pNtk->ntkFunc == ABC_FUNC_SOP && pNtk->ntkType == ABC_NTK_NETLIST; }
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
Abc_NtkType_t ntkType
Definition: abc.h:156
static int Abc_NtkIsStrash ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 251 of file abc.h.

251 { return pNtk->ntkType == ABC_NTK_STRASH; }
Abc_NtkType_t ntkType
Definition: abc.h:156
ABC_DLL int Abc_NtkIsTopo ( Abc_Ntk_t pNtk)

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

Synopsis [Checks if the logic network is in the topological order.]

Description []

SideEffects []

SeeAlso []

Definition at line 2839 of file abcUtil.c.

2840 {
2841  Abc_Obj_t * pObj, * pFanin;
2842  int i, k, Counter = 0;
2843  Abc_NtkIncrementTravId( pNtk );
2844  Abc_NtkForEachCi( pNtk, pObj, i )
2846  Abc_NtkForEachNode( pNtk, pObj, i )
2847  {
2848  // check if fanins are in the topo order
2849  Abc_ObjForEachFanin( pObj, pFanin, k )
2850  if ( !Abc_NodeIsTravIdCurrent(pFanin) )
2851  break;
2852  if ( k != Abc_ObjFaninNum(pObj) )
2853  {
2854  if ( Counter++ == 0 )
2855  printf( "Node %d is out of topo order.\n", Abc_ObjId(pObj) );
2856  }
2858  }
2859  if ( Counter )
2860  printf( "Topological order does not hold for %d internal nodes.\n", Counter );
2861  return (int)(Counter == 0);
2862 }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
if(last==0)
Definition: sparse_int.h:34
static int Counter
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:411
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
static void Abc_NodeSetTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:409
ABC_DLL int Abc_NtkIsTrueCex ( Abc_Ntk_t pNtk,
Abc_Cex_t pCex 
)

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

Synopsis [Returns the PO values under the given input pattern.]

Description []

SideEffects []

SeeAlso []

Definition at line 1061 of file abcVerify.c.

1062 {
1063  extern Aig_Man_t * Abc_NtkToDar( Abc_Ntk_t * pNtk, int fExors, int fRegisters );
1064  Aig_Man_t * pMan;
1065  int status = 0, fStrashed = 0;
1066  if ( !Abc_NtkIsStrash(pNtk) )
1067  {
1068  pNtk = Abc_NtkStrash(pNtk, 0, 0, 0);
1069  fStrashed = 1;
1070  }
1071  pMan = Abc_NtkToDar( pNtk, 0, 1 );
1072  if ( pMan )
1073  {
1074  status = Saig_ManVerifyCex( pMan, pCex );
1075  Aig_ManStop( pMan );
1076  }
1077  if ( fStrashed )
1078  Abc_NtkDelete( pNtk );
1079  return status;
1080 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
int Saig_ManVerifyCex(Aig_Man_t *pAig, Abc_Cex_t *p)
Definition: saigDup.c:279
ABC_DLL Abc_Ntk_t * Abc_NtkStrash(Abc_Ntk_t *pNtk, int fAllNodes, int fCleanup, int fRecord)
Definition: abcStrash.c:265
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
Aig_Man_t * Abc_NtkToDar(Abc_Ntk_t *pNtk, int fExors, int fRegisters)
Definition: abcDar.c:233
ABC_DLL int Abc_NtkIsValidCex ( Abc_Ntk_t pNtk,
Abc_Cex_t pCex 
)

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

Synopsis [Returns 1 if the number of PIs matches.]

Description []

SideEffects []

SeeAlso []

Definition at line 1093 of file abcVerify.c.

1094 {
1095  return Abc_NtkPiNum(pNtk) == pCex->nPis;
1096 }
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:285
ABC_DLL int Abc_NtkIvyProve ( Abc_Ntk_t **  ppNtk,
void *  pPars 
)

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 498 of file abcIvy.c.

499 {
500  Prove_Params_t * pParams = (Prove_Params_t *)pPars;
501  Abc_Ntk_t * pNtk = *ppNtk, * pNtkTemp;
502  Abc_Obj_t * pObj, * pFanin;
503  Ivy_Man_t * pMan;
504  Aig_Man_t * pMan2;
505  int RetValue;
506  assert( Abc_NtkIsStrash(pNtk) || Abc_NtkIsLogic(pNtk) );
507  // experiment with various parameters settings
508 // pParams->fUseBdds = 1;
509 // pParams->fBddReorder = 1;
510 // pParams->nTotalBacktrackLimit = 10000;
511 
512  // strash the network if it is not strashed already
513  if ( !Abc_NtkIsStrash(pNtk) )
514  {
515  pNtk = Abc_NtkStrash( pNtkTemp = pNtk, 0, 1, 0 );
516  Abc_NtkDelete( pNtkTemp );
517  }
518 
519  // check the case when the 0000 simulation pattern detect the bug
520  pObj = Abc_NtkPo(pNtk,0);
521  pFanin = Abc_ObjFanin0(pObj);
522  if ( Abc_ObjFanin0(pObj)->fPhase != (unsigned)Abc_ObjFaninC0(pObj) )
523  {
524  pNtk->pModel = ABC_CALLOC( int, Abc_NtkCiNum(pNtk) );
525  return 0;
526  }
527 
528  // changed in "src\sat\fraig\fraigMan.c"
529  // pParams->nMiteringLimitStart = 300; // starting mitering limit
530  // to be
531  // pParams->nMiteringLimitStart = 5000; // starting mitering limit
532 
533  // if SAT only, solve without iteration
534 // RetValue = Abc_NtkMiterSat( pNtk, 2*(ABC_INT64_T)pParams->nMiteringLimitStart, (ABC_INT64_T)0, 0, NULL, NULL );
535  pMan2 = Abc_NtkToDar( pNtk, 0, 0 );
536  RetValue = Fra_FraigSat( pMan2, (ABC_INT64_T)pParams->nMiteringLimitStart, (ABC_INT64_T)0, 0, 0, 0, 1, 0, 0, 0 );
537  pNtk->pModel = (int *)pMan2->pData, pMan2->pData = NULL;
538  Aig_ManStop( pMan2 );
539 // pNtk->pModel = Aig_ManReleaseData( pMan2 );
540  if ( RetValue >= 0 )
541  return RetValue;
542 
543  // apply AIG rewriting
544  if ( pParams->fUseRewriting && Abc_NtkNodeNum(pNtk) > 500 )
545  {
546 // abctime clk = Abc_Clock();
547 //printf( "Before rwsat = %d. ", Abc_NtkNodeNum(pNtk) );
548  pParams->fUseRewriting = 0;
549  pNtk = Abc_NtkBalance( pNtkTemp = pNtk, 0, 0, 0 );
550  Abc_NtkDelete( pNtkTemp );
551  Abc_NtkRewrite( pNtk, 0, 0, 0, 0, 0 );
552  pNtk = Abc_NtkBalance( pNtkTemp = pNtk, 0, 0, 0 );
553  Abc_NtkDelete( pNtkTemp );
554  Abc_NtkRewrite( pNtk, 0, 0, 0, 0, 0 );
555  Abc_NtkRefactor( pNtk, 10, 16, 0, 0, 0, 0 );
556 //printf( "After rwsat = %d. ", Abc_NtkNodeNum(pNtk) );
557 //ABC_PRT( "Time", Abc_Clock() - clk );
558  }
559 
560  // convert ABC network into IVY network
561  pMan = Abc_NtkIvyBefore( pNtk, 0, 0 );
562 
563  // solve the CEC problem
564  RetValue = Ivy_FraigProve( &pMan, pParams );
565 // RetValue = -1;
566 
567  // convert IVY network into ABC network
568  pNtk = Abc_NtkIvyAfter( pNtkTemp = pNtk, pMan, 0, 0 );
569  Abc_NtkDelete( pNtkTemp );
570  // transfer model if given
571  pNtk->pModel = (int *)pMan->pData; pMan->pData = NULL;
572  Ivy_ManStop( pMan );
573 
574  // try to prove it using brute force SAT with good CNF encoding
575  if ( RetValue < 0 )
576  {
577  pMan2 = Abc_NtkToDar( pNtk, 0, 0 );
578  // dump the miter before entering high-effort solving
579  if ( pParams->fVerbose )
580  {
581  char pFileName[100];
582  sprintf( pFileName, "cecmiter.aig" );
583  Ioa_WriteAiger( pMan2, pFileName, 0, 0 );
584  printf( "Intermediate reduced miter is written into file \"%s\".\n", pFileName );
585  }
586  RetValue = Fra_FraigSat( pMan2, pParams->nMiteringLimitLast, 0, 0, 0, 0, 0, 0, 0, pParams->fVerbose );
587  pNtk->pModel = (int *)pMan2->pData, pMan2->pData = NULL;
588  Aig_ManStop( pMan2 );
589  }
590 
591  // try to prove it using brute force BDDs
592  if ( RetValue < 0 && pParams->fUseBdds )
593  {
594  if ( pParams->fVerbose )
595  {
596  printf( "Attempting BDDs with node limit %d ...\n", pParams->nBddSizeLimit );
597  fflush( stdout );
598  }
599  pNtk = Abc_NtkCollapse( pNtkTemp = pNtk, pParams->nBddSizeLimit, 0, pParams->fBddReorder, 0 );
600  if ( pNtk )
601  {
602  Abc_NtkDelete( pNtkTemp );
603  RetValue = ( (Abc_NtkNodeNum(pNtk) == 1) && (Abc_ObjFanin0(Abc_NtkPo(pNtk,0))->pData == Cudd_ReadLogicZero((DdManager *)pNtk->pManFunc)) );
604  }
605  else
606  pNtk = pNtkTemp;
607  }
608 
609  // return the result
610  *ppNtk = pNtk;
611  return RetValue;
612 }
ABC_NAMESPACE_IMPL_START Aig_Man_t * Abc_NtkToDar(Abc_Ntk_t *pNtk, int fExors, int fRegisters)
DECLARATIONS ///.
Definition: abcDar.c:233
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
ABC_DLL Abc_Ntk_t * Abc_NtkStrash(Abc_Ntk_t *pNtk, int fAllNodes, int fCleanup, int fRecord)
Definition: abcStrash.c:265
DdNode * Cudd_ReadLogicZero(DdManager *dd)
Definition: cuddAPI.c:1058
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
int Ivy_FraigProve(Ivy_Man_t **ppManAig, void *pPars)
Definition: ivyFraig.c:255
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
void Ivy_ManStop(Ivy_Man_t *p)
Definition: ivyMan.c:238
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
void Aig_ManStop(Aig_Man_t *pMan)
Definition: aigMan.c:187
int * pModel
Definition: abc.h:198
ABC_DLL Abc_Ntk_t * Abc_NtkCollapse(Abc_Ntk_t *pNtk, int fBddSizeMax, int fDualRail, int fReorder, int fVerbose)
FUNCTION DEFINITIONS ///.
Definition: abcCollapse.c:49
void * pManFunc
Definition: abc.h:191
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
Definition: abc.h:293
ABC_DLL int Abc_NtkRewrite(Abc_Ntk_t *pNtk, int fUpdateLevel, int fUseZeros, int fVerbose, int fVeryVerbose, int fPlaceEnable)
FUNCTION DEFINITIONS ///.
Definition: abcRewrite.c:61
ABC_DLL int Abc_NtkRefactor(Abc_Ntk_t *pNtk, int nNodeSizeMax, int nConeSizeMax, int fUpdateLevel, int fUseZeros, int fUseDcs, int fVerbose)
FUNCTION DEFINITIONS ///.
Definition: abcRefactor.c:89
char * sprintf()
void Ioa_WriteAiger(Aig_Man_t *pMan, char *pFileName, int fWriteSymbols, int fCompact)
Definition: ioaWriteAig.c:446
typedefABC_NAMESPACE_HEADER_START struct Ivy_Man_t_ Ivy_Man_t
INCLUDES ///.
Definition: ivy.h:46
Ivy_Man_t * Abc_NtkIvyBefore(Abc_Ntk_t *pNtk, int fSeq, int fUseDc)
FUNCTION DEFINITIONS ///.
Definition: abcIvy.c:84
static Abc_Obj_t * Abc_NtkPo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:316
ABC_DLL Abc_Ntk_t * Abc_NtkBalance(Abc_Ntk_t *pNtk, int fDuplicate, int fSelective, int fUpdateLevel)
FUNCTION DEFINITIONS ///.
Definition: abcBalance.c:53
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
Abc_Ntk_t * Abc_NtkIvyAfter(Abc_Ntk_t *pNtk, Ivy_Man_t *pMan, int fSeq, int fHaig)
Definition: abcIvy.c:137
int Fra_FraigSat(Aig_Man_t *pMan, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, int nLearnedStart, int nLearnedDelta, int nLearnedPerce, int fFlipBits, int fAndOuts, int fNewSolver, int fVerbose)
ITERATORS ///.
Definition: fraCec.c:47
ABC_DLL int Abc_NtkLatchIsSelfFeed ( Abc_Obj_t pLatch)

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

Synopsis [Checks if latches form self-loop.]

Description []

SideEffects []

SeeAlso []

Definition at line 68 of file abcLatch.c.

69 {
70  Abc_Obj_t * pFanin;
71  assert( Abc_ObjIsLatch(pLatch) );
72  pFanin = Abc_ObjFanin0(Abc_ObjFanin0(pLatch));
73  if ( !Abc_ObjIsBo(pFanin) || !Abc_ObjIsLatch(Abc_ObjFanin0(pFanin)) )
74  return 0;
75  return Abc_NtkLatchIsSelfFeed_rec( Abc_ObjFanin0(pFanin), pLatch );
76 }
static int Abc_ObjIsBo(Abc_Obj_t *pObj)
Definition: abc.h:350
static int Abc_ObjIsLatch(Abc_Obj_t *pObj)
Definition: abc.h:356
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
#define assert(ex)
Definition: util_old.h:213
ABC_NAMESPACE_IMPL_START int Abc_NtkLatchIsSelfFeed_rec(Abc_Obj_t *pLatch, Abc_Obj_t *pLatchRoot)
DECLARATIONS ///.
Definition: abcLatch.c:45
static int Abc_NtkLatchNum ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 294 of file abc.h.

294 { return pNtk->nObjCounts[ABC_OBJ_LATCH]; }
int nObjCounts[ABC_OBJ_NUMBER]
Definition: abc.h:171
ABC_DLL int Abc_NtkLevel ( Abc_Ntk_t pNtk)

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

Synopsis [Computes the number of logic levels not counting PIs/POs.]

Description []

SideEffects []

SeeAlso []

Definition at line 1265 of file abcDfs.c.

1266 {
1267  Abc_Obj_t * pNode;
1268  int i, LevelsMax;
1269  // set the CI levels
1270  if ( pNtk->pManTime == NULL || pNtk->AndGateDelay <= 0 )
1271  Abc_NtkForEachCi( pNtk, pNode, i )
1272  pNode->Level = 0;
1273  else
1274  Abc_NtkForEachCi( pNtk, pNode, i )
1275  pNode->Level = (int)(Abc_NodeReadArrivalWorst(pNode) / pNtk->AndGateDelay);
1276  // perform the traversal
1277  LevelsMax = 0;
1278  Abc_NtkIncrementTravId( pNtk );
1279  if ( pNtk->nBarBufs == 0 )
1280  {
1281  Abc_NtkForEachNode( pNtk, pNode, i )
1282  {
1283  Abc_NtkLevel_rec( pNode );
1284  if ( LevelsMax < (int)pNode->Level )
1285  LevelsMax = (int)pNode->Level;
1286  }
1287  }
1288  else
1289  {
1290  Abc_NtkForEachLiPo( pNtk, pNode, i )
1291  {
1292  Abc_Obj_t * pDriver = Abc_ObjFanin0(pNode);
1293  Abc_NtkLevel_rec( pDriver );
1294  if ( LevelsMax < (int)pDriver->Level )
1295  LevelsMax = (int)pDriver->Level;
1296  // transfer the delay
1297  if ( i < pNtk->nBarBufs )
1298  Abc_ObjFanout0(Abc_ObjFanout0(pNode))->Level = pDriver->Level;
1299  }
1300  }
1301  return LevelsMax;
1302 }
float AndGateDelay
Definition: abc.h:194
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
unsigned Level
Definition: abc.h:142
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
ABC_DLL float Abc_NodeReadArrivalWorst(Abc_Obj_t *pNode)
Definition: abcTiming.c:95
#define Abc_NtkForEachLiPo(pNtk, pCo, i)
Definition: abc.h:521
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
Abc_ManTime_t * pManTime
Definition: abc.h:192
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
int Abc_NtkLevel_rec(Abc_Obj_t *pNode)
Definition: abcDfs.c:1163
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371
ABC_DLL Vec_Vec_t* Abc_NtkLevelize ( Abc_Ntk_t pNtk)

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

Synopsis [Computes the number of logic levels not counting PIs/POs.]

Description []

SideEffects []

SeeAlso []

Definition at line 1239 of file abcDfs.c.

1240 {
1241  Abc_Obj_t * pObj;
1242  Vec_Vec_t * vLevels;
1243  int nLevels, i;
1244  nLevels = Abc_NtkLevel( pNtk );
1245  vLevels = Vec_VecStart( nLevels + 1 );
1246  Abc_NtkForEachNode( pNtk, pObj, i )
1247  {
1248  assert( (int)pObj->Level <= nLevels );
1249  Vec_VecPush( vLevels, pObj->Level, pObj );
1250  }
1251  return vLevels;
1252 }
static void Vec_VecPush(Vec_Vec_t *p, int Level, void *Entry)
Definition: vecVec.h:456
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
int Abc_NtkLevel(Abc_Ntk_t *pNtk)
Definition: abcDfs.c:1265
unsigned Level
Definition: abc.h:142
static Vec_Vec_t * Vec_VecStart(int nSize)
Definition: vecVec.h:168
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
#define assert(ex)
Definition: util_old.h:213
ABC_DLL int Abc_NtkLevelReverse ( Abc_Ntk_t pNtk)

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

Synopsis [Computes the number of logic levels not counting PIs/POs.]

Description []

SideEffects []

SeeAlso []

Definition at line 1315 of file abcDfs.c.

1316 {
1317  Abc_Obj_t * pNode;
1318  int i, LevelsMax;
1319  // set the CO levels to zero
1320  Abc_NtkForEachCo( pNtk, pNode, i )
1321  pNode->Level = 0;
1322  // perform the traversal
1323  LevelsMax = 0;
1324  Abc_NtkIncrementTravId( pNtk );
1325  Abc_NtkForEachNode( pNtk, pNode, i )
1326  {
1327  Abc_NtkLevelReverse_rec( pNode );
1328  if ( LevelsMax < (int)pNode->Level )
1329  LevelsMax = (int)pNode->Level;
1330  }
1331  return LevelsMax;
1332 }
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
int Abc_NtkLevelReverse_rec(Abc_Obj_t *pNode)
Definition: abcDfs.c:1201
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
ABC_DLL void Abc_NtkLoadCopy ( Abc_Ntk_t pNtk,
Vec_Ptr_t vCopies 
)

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

Synopsis [Loads copy field of the objects.]

Description []

SideEffects []

SeeAlso []

Definition at line 617 of file abcUtil.c.

618 {
619  Abc_Obj_t * pObj;
620  int i;
621  Abc_NtkForEachObj( pNtk, pObj, i )
622  pObj->pCopy = (Abc_Obj_t *)Vec_PtrEntry( vCopies, i );
623 }
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
ABC_DLL int Abc_NtkLogicHasSimpleCos ( Abc_Ntk_t pNtk)

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

Synopsis [Returns 1 if COs of a logic network are simple.]

Description [The COs of a logic network are simple under three conditions: (1) The edge from CO to its driver is not complemented. (2) If CI is a driver of a CO, they have the same name.] (3) If two COs share the same driver, they have the same name.]

SideEffects []

SeeAlso []

Definition at line 909 of file abcUtil.c.

910 {
911  Abc_Obj_t * pNode, * pDriver;
912  int i;
913  assert( Abc_NtkIsLogic(pNtk) );
914  Abc_NtkIncrementTravId( pNtk );
915  Abc_NtkForEachCo( pNtk, pNode, i )
916  {
917  // if the driver is complemented, this is an error
918  pDriver = Abc_ObjFanin0(pNode);
919  if ( Abc_ObjFaninC0(pNode) )
920  return 0;
921  // if the driver is a CI and has different name, this is an error
922  if ( Abc_ObjIsCi(pDriver) && strcmp(Abc_ObjName(pDriver), Abc_ObjName(pNode)) )
923  return 0;
924  // if the driver is visited for the first time, remember the CO name
925  if ( !Abc_NodeIsTravIdCurrent(pDriver) )
926  {
927  pDriver->pNext = (Abc_Obj_t *)Abc_ObjName(pNode);
928  Abc_NodeSetTravIdCurrent(pDriver);
929  continue;
930  }
931  // the driver has second CO - if they have different name, this is an error
932  if ( strcmp((char *)pDriver->pNext, Abc_ObjName(pNode)) ) // diff names
933  return 0;
934  }
935  return 1;
936 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
Definition: abc.h:351
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
int strcmp()
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:411
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
Abc_Obj_t * pNext
Definition: abc.h:131
#define assert(ex)
Definition: util_old.h:213
static void Abc_NodeSetTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:409
ABC_DLL void Abc_NtkLogicMakeDirectSops ( Abc_Ntk_t pNtk)

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

Synopsis [Removes complemented SOP covers.]

Description []

SideEffects []

SeeAlso []

Definition at line 509 of file abcFunc.c.

510 {
511  DdManager * dd;
512  DdNode * bFunc;
513  Vec_Str_t * vCube;
514  Abc_Obj_t * pNode;
515  int nFaninsMax, fFound, i;
516 
517  assert( Abc_NtkHasSop(pNtk) );
518 
519  // check if there are nodes with complemented SOPs
520  fFound = 0;
521  Abc_NtkForEachNode( pNtk, pNode, i )
522  if ( !Abc_ObjIsBarBuf(pNode) && Abc_SopIsComplement((char *)pNode->pData) )
523  {
524  fFound = 1;
525  break;
526  }
527  if ( !fFound )
528  return;
529 
530  // start the BDD package
531  nFaninsMax = Abc_NtkGetFaninMax( pNtk );
532  if ( nFaninsMax == 0 )
533  printf( "Warning: The network has only constant nodes.\n" );
534  dd = Cudd_Init( nFaninsMax, 0, CUDD_UNIQUE_SLOTS, CUDD_CACHE_SLOTS, 0 );
535 
536  // change the cover of negated nodes
537  vCube = Vec_StrAlloc( 100 );
538  Abc_NtkForEachNode( pNtk, pNode, i )
539  if ( !Abc_ObjIsBarBuf(pNode) && Abc_SopIsComplement((char *)pNode->pData) )
540  {
541  bFunc = Abc_ConvertSopToBdd( dd, (char *)pNode->pData, NULL ); Cudd_Ref( bFunc );
542  pNode->pData = Abc_ConvertBddToSop( (Mem_Flex_t *)pNtk->pManFunc, dd, bFunc, bFunc, Abc_ObjFaninNum(pNode), 0, vCube, 1 );
543  Cudd_RecursiveDeref( dd, bFunc );
544  assert( !Abc_SopIsComplement((char *)pNode->pData) );
545  }
546  Vec_StrFree( vCube );
547  Extra_StopManager( dd );
548 }
#define CUDD_UNIQUE_SLOTS
Definition: cudd.h:97
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
Definition: cudd.h:278
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Abc_ObjIsBarBuf(Abc_Obj_t *pObj)
Definition: abc.h:360
ABC_DLL int Abc_NtkGetFaninMax(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:453
#define CUDD_CACHE_SLOTS
Definition: cudd.h:98
static Vec_Str_t * Vec_StrAlloc(int nCap)
Definition: bblif.c:495
void Extra_StopManager(DdManager *dd)
Definition: extraBddMisc.c:223
void * pManFunc
Definition: abc.h:191
char * Abc_ConvertBddToSop(Mem_Flex_t *pMan, DdManager *dd, DdNode *bFuncOn, DdNode *bFuncOnDc, int nFanins, int fAllPrimes, Vec_Str_t *vCube, int fMode)
Definition: abcFunc.c:209
static void Vec_StrFree(Vec_Str_t *p)
Definition: bblif.c:616
DdManager * Cudd_Init(unsigned int numVars, unsigned int numVarsZ, unsigned int numSlots, unsigned int cacheSize, unsigned long maxMemory)
Definition: cuddInit.c:125
if(last==0)
Definition: sparse_int.h:34
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
DdNode * Abc_ConvertSopToBdd(DdManager *dd, char *pSop, DdNode **pbVars)
FUNCTION DEFINITIONS ///.
Definition: abcFunc.c:56
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
ABC_DLL int Abc_SopIsComplement(char *pSop)
Definition: abcSop.c:655
ABC_DLL int Abc_NtkLogicMakeSimpleCos ( Abc_Ntk_t pNtk,
int  fDuplicate 
)

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

Synopsis [Transforms the network to have simple COs.]

Description []

SideEffects []

SeeAlso []

Definition at line 1047 of file abcUtil.c.

1048 {
1049  Vec_Ptr_t * vDrivers, * vCoTerms;
1050  Abc_Obj_t * pNode, * pDriver, * pDriverNew, * pFanin;
1051  int i, k, LevelMax, nTotal = 0;
1052  assert( Abc_NtkIsLogic(pNtk) );
1053  LevelMax = Abc_NtkLevel(pNtk);
1054 // Abc_NtkLogicMakeSimpleCosTest( pNtk, fDuplicate );
1055 
1056  // fix constant drivers
1057  Abc_NtkForEachCo( pNtk, pNode, i )
1058  {
1059  pDriver = Abc_ObjFanin0(pNode);
1060  if ( !Abc_NodeIsConst(pDriver) )
1061  continue;
1062  pDriverNew = (Abc_ObjFaninC0(pNode) == Abc_NodeIsConst0(pDriver)) ? Abc_NtkCreateNodeConst1(pNtk) : Abc_NtkCreateNodeConst0(pNtk);
1063  if ( Abc_ObjFaninC0(pNode) )
1064  Abc_ObjXorFaninC( pNode, 0 );
1065  Abc_ObjPatchFanin( pNode, pDriver, pDriverNew );
1066  if ( Abc_ObjFanoutNum(pDriver) == 0 )
1067  Abc_NtkDeleteObj( pDriver );
1068  }
1069 
1070  // collect drivers pointed by complemented edges
1071  vDrivers = Vec_PtrAlloc( 100 );
1072  Abc_NtkIncrementTravId( pNtk );
1073  Abc_NtkForEachCo( pNtk, pNode, i )
1074  {
1075  if ( !Abc_ObjFaninC0(pNode) )
1076  continue;
1077  pDriver = Abc_ObjFanin0(pNode);
1078  if ( Abc_NodeIsTravIdCurrent(pDriver) )
1079  continue;
1080  Abc_NodeSetTravIdCurrent(pDriver);
1081  Vec_PtrPush( vDrivers, pDriver );
1082  }
1083  // fix complemented drivers
1084  if ( Vec_PtrSize(vDrivers) > 0 )
1085  {
1086  int nDupGates = 0, nDupInvs = 0, nDupChange = 0;
1087  Vec_Ptr_t * vFanouts = Vec_PtrAlloc( 100 );
1088  Vec_PtrForEachEntry( Abc_Obj_t *, vDrivers, pDriver, i )
1089  {
1090  int fHasDir = 0, fHasInv = 0, fHasOther = 0;
1091  Abc_ObjForEachFanout( pDriver, pNode, k )
1092  {
1093  if ( !Abc_ObjIsCo(pNode) )
1094  {
1095  assert( !Abc_ObjFaninC0(pNode) );
1096  fHasOther = 1;
1097  continue;
1098  }
1099  if ( Abc_ObjFaninC0(pNode) )
1100  fHasInv = 1;
1101  else //if ( Abc_ObjFaninC0(pNode) )
1102  fHasDir = 1;
1103  }
1104  assert( fHasInv );
1105  if ( Abc_ObjIsCi(pDriver) || fHasDir || (fHasOther && Abc_NtkHasMapping(pNtk)) ) // cannot change
1106  {
1107  // duplicate if critical
1108  if ( fDuplicate && Abc_ObjIsNode(pDriver) && Abc_ObjLevel(pDriver) == LevelMax )
1109  {
1110  pDriverNew = Abc_NtkDupObj( pNtk, pDriver, 0 );
1111  Abc_ObjForEachFanin( pDriver, pFanin, k )
1112  Abc_ObjAddFanin( pDriverNew, pFanin );
1113  Abc_NodeComplement( pDriverNew );
1114  nDupGates++;
1115  }
1116  else // add inverter
1117  {
1118  pDriverNew = Abc_NtkCreateNodeInv( pNtk, pDriver );
1119  nDupInvs++;
1120  }
1121  // collect CO fanouts to be redirected to the new node
1122  Vec_PtrClear( vFanouts );
1123  Abc_ObjForEachFanout( pDriver, pNode, k )
1124  if ( Abc_ObjIsCo(pNode) && Abc_ObjFaninC0(pNode) )
1125  Vec_PtrPush( vFanouts, pNode );
1126  assert( Vec_PtrSize(vFanouts) > 0 );
1127  Vec_PtrForEachEntry( Abc_Obj_t *, vFanouts, pNode, k )
1128  {
1129  Abc_ObjXorFaninC( pNode, 0 );
1130  Abc_ObjPatchFanin( pNode, pDriver, pDriverNew );
1131  assert( Abc_ObjIsCi(pDriver) || Abc_ObjFanoutNum(pDriver) > 0 );
1132  }
1133  }
1134  else // can change
1135  {
1136  // change polarity of the driver
1137  assert( Abc_ObjIsNode(pDriver) );
1138  Abc_NodeComplement( pDriver );
1139  Abc_ObjForEachFanout( pDriver, pNode, k )
1140  {
1141  if ( Abc_ObjIsCo(pNode) )
1142  {
1143  assert( Abc_ObjFaninC0(pNode) );
1144  Abc_ObjXorFaninC( pNode, 0 );
1145  }
1146  else if ( Abc_ObjIsNode(pNode) )
1147  Abc_NodeComplementInput( pNode, pDriver );
1148  else assert( 0 );
1149  }
1150  nDupChange++;
1151  }
1152  }
1153  Vec_PtrFree( vFanouts );
1154 // printf( "Resolving inverted CO drivers: Invs = %d. Dups = %d. Changes = %d.\n",
1155 // nDupInvs, nDupGates, nDupChange );
1156  nTotal += nDupInvs + nDupGates;
1157  }
1158  Vec_PtrFree( vDrivers );
1159 
1160  // collect COs that needs fixing by adding buffers or duplicating
1161  vCoTerms = Vec_PtrAlloc( 100 );
1162  Abc_NtkIncrementTravId( pNtk );
1163  Abc_NtkForEachCo( pNtk, pNode, i )
1164  {
1165  // if the driver is a CI and has different name, this is an error
1166  pDriver = Abc_ObjFanin0(pNode);
1167  if ( Abc_ObjIsCi(pDriver) && strcmp(Abc_ObjName(pDriver), Abc_ObjName(pNode)) )
1168  {
1169  Vec_PtrPush( vCoTerms, pNode );
1170  continue;
1171  }
1172  // if the driver is visited for the first time, remember the CO name
1173  if ( !Abc_NodeIsTravIdCurrent(pDriver) )
1174  {
1175  pDriver->pNext = (Abc_Obj_t *)Abc_ObjName(pNode);
1176  Abc_NodeSetTravIdCurrent(pDriver);
1177  continue;
1178  }
1179  // the driver has second CO - if they have different name, this is an error
1180  if ( strcmp((char *)pDriver->pNext, Abc_ObjName(pNode)) ) // diff names
1181  {
1182  Vec_PtrPush( vCoTerms, pNode );
1183  continue;
1184  }
1185  }
1186  // fix duplication problem
1187  if ( Vec_PtrSize(vCoTerms) > 0 )
1188  {
1189  int nDupBufs = 0, nDupGates = 0;
1190  Vec_PtrForEachEntry( Abc_Obj_t *, vCoTerms, pNode, i )
1191  {
1192  pDriver = Abc_ObjFanin0(pNode);
1193  // duplicate if critical
1194  if ( fDuplicate && Abc_ObjIsNode(pDriver) && Abc_ObjLevel(pDriver) == LevelMax )
1195  {
1196  pDriverNew = Abc_NtkDupObj( pNtk, pDriver, 0 );
1197  Abc_ObjForEachFanin( pDriver, pFanin, k )
1198  Abc_ObjAddFanin( pDriverNew, pFanin );
1199  nDupGates++;
1200  }
1201  else // add buffer
1202  {
1203  pDriverNew = Abc_NtkCreateNodeBuf( pNtk, pDriver );
1204  nDupBufs++;
1205  }
1206  // swing the PO
1207  Abc_ObjPatchFanin( pNode, pDriver, pDriverNew );
1208  assert( Abc_ObjIsCi(pDriver) || Abc_ObjFanoutNum(pDriver) > 0 );
1209  }
1210 // printf( "Resolving shared CO drivers: Bufs = %d. Dups = %d.\n", nDupBufs, nDupGates );
1211  nTotal += nDupBufs + nDupGates;
1212  }
1213  Vec_PtrFree( vCoTerms );
1214  return nTotal;
1215 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
Definition: abc.h:351
ABC_DLL int Abc_NodeIsConst(Abc_Obj_t *pNode)
Definition: abcObj.c:843
ABC_DLL int Abc_NodeIsConst0(Abc_Obj_t *pNode)
Definition: abcObj.c:860
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition: abcObj.c:337
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeConst1(Abc_Ntk_t *pNtk)
Definition: abcObj.c:633
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
Definition: abc.h:352
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
int strcmp()
ABC_DLL void Abc_ObjPatchFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFaninOld, Abc_Obj_t *pFaninNew)
Definition: abcFanio.c:172
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
ABC_DLL void Abc_NtkDeleteObj(Abc_Obj_t *pObj)
Definition: abcObj.c:167
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeInv(Abc_Ntk_t *pNtk, Abc_Obj_t *pFanin)
Definition: abcObj.c:662
static int Abc_ObjLevel(Abc_Obj_t *pObj)
Definition: abc.h:330
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeBuf(Abc_Ntk_t *pNtk, Abc_Obj_t *pFanin)
Definition: abcObj.c:692
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:411
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition: abc.h:526
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeConst0(Abc_Ntk_t *pNtk)
Definition: abcObj.c:604
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
static void Abc_ObjXorFaninC(Abc_Obj_t *pObj, int i)
Definition: abc.h:381
Abc_Obj_t * pNext
Definition: abc.h:131
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
ABC_DLL int Abc_NtkLevel(Abc_Ntk_t *pNtk)
Definition: abcDfs.c:1265
ABC_DLL void Abc_NodeComplement(Abc_Obj_t *pNode)
Definition: abcObj.c:980
int nTotal
DECLARATIONS ///.
Definition: cutTruth.c:37
ABC_DLL void Abc_NodeComplementInput(Abc_Obj_t *pNode, Abc_Obj_t *pFanin)
Definition: abcObj.c:1005
static void Abc_NodeSetTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:409
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL void Abc_NtkMakeComb ( Abc_Ntk_t pNtk,
int  fRemoveLatches 
)

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

Synopsis [Converts the network to combinational.]

Description []

SideEffects []

SeeAlso []

Definition at line 1422 of file abcNtk.c.

1423 {
1424  Abc_Obj_t * pObj;
1425  int i;
1426 
1427  if ( Abc_NtkIsComb(pNtk) )
1428  return;
1429 
1430  assert( !Abc_NtkIsNetlist(pNtk) );
1432 
1433  // detach the latches
1434 // Abc_NtkForEachLatch( pNtk, pObj, i )
1435  Vec_PtrForEachEntryReverse( Abc_Obj_t *, pNtk->vBoxes, pObj, i )
1436  Abc_NtkDeleteObj( pObj );
1437  assert( Abc_NtkLatchNum(pNtk) == 0 );
1438  assert( Abc_NtkBoxNum(pNtk) == 0 );
1439 
1440  // move CIs to become PIs
1441  Vec_PtrClear( pNtk->vPis );
1442  Abc_NtkForEachCi( pNtk, pObj, i )
1443  {
1444  if ( Abc_ObjIsBo(pObj) )
1445  {
1446  pObj->Type = ABC_OBJ_PI;
1447  pNtk->nObjCounts[ABC_OBJ_PI]++;
1448  pNtk->nObjCounts[ABC_OBJ_BO]--;
1449  }
1450  Vec_PtrPush( pNtk->vPis, pObj );
1451  }
1452  assert( Abc_NtkBoNum(pNtk) == 0 );
1453 
1454  if ( fRemoveLatches )
1455  {
1456  // remove registers
1457  Vec_Ptr_t * vBos;
1458  vBos = Vec_PtrAlloc( 100 );
1459  Vec_PtrClear( pNtk->vPos );
1460  Abc_NtkForEachCo( pNtk, pObj, i )
1461  if ( Abc_ObjIsBi(pObj) )
1462  Vec_PtrPush( vBos, pObj );
1463  else
1464  Vec_PtrPush( pNtk->vPos, pObj );
1465  // remove COs
1466  Vec_PtrFree( pNtk->vCos );
1467  pNtk->vCos = NULL;
1468  // remove the BOs
1469  Vec_PtrForEachEntry( Abc_Obj_t *, vBos, pObj, i )
1470  Abc_NtkDeleteObj( pObj );
1471  Vec_PtrFree( vBos );
1472  // create COs
1473  pNtk->vCos = Vec_PtrDup( pNtk->vPos );
1474  // cleanup
1475  if ( Abc_NtkIsLogic(pNtk) )
1476  Abc_NtkCleanup( pNtk, 0 );
1477  else if ( Abc_NtkIsStrash(pNtk) )
1478  Abc_AigCleanup( (Abc_Aig_t *)pNtk->pManFunc );
1479  else
1480  assert( 0 );
1481  }
1482  else
1483  {
1484  // move COs to become POs
1485  Vec_PtrClear( pNtk->vPos );
1486  Abc_NtkForEachCo( pNtk, pObj, i )
1487  {
1488  if ( Abc_ObjIsBi(pObj) )
1489  {
1490  pObj->Type = ABC_OBJ_PO;
1491  pNtk->nObjCounts[ABC_OBJ_PO]++;
1492  pNtk->nObjCounts[ABC_OBJ_BI]--;
1493  }
1494  Vec_PtrPush( pNtk->vPos, pObj );
1495  }
1496  }
1497  assert( Abc_NtkBiNum(pNtk) == 0 );
1498 
1499  if ( !Abc_NtkCheck( pNtk ) )
1500  fprintf( stdout, "Abc_NtkMakeComb(): Network check has failed.\n" );
1501 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
Definition: abc.h:91
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_NtkIsComb(Abc_Ntk_t *pNtk)
Definition: abc.h:297
static int Abc_ObjIsBo(Abc_Obj_t *pObj)
Definition: abc.h:350
Vec_Ptr_t * vBoxes
Definition: abc.h:168
#define Vec_PtrForEachEntryReverse(Type, vVec, pEntry, i)
Definition: vecPtr.h:63
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static int Abc_NtkBoxNum(Abc_Ntk_t *pNtk)
Definition: abc.h:289
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static Vec_Ptr_t * Vec_PtrDup(Vec_Ptr_t *pVec)
Definition: vecPtr.h:169
static int Abc_NtkBiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:290
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
ABC_DLL int Abc_NtkCleanup(Abc_Ntk_t *pNtk, int fVerbose)
Definition: abcSweep.c:476
DECLARATIONS ///.
Definition: abcAig.c:52
ABC_DLL void Abc_NtkDeleteObj(Abc_Obj_t *pObj)
Definition: abcObj.c:167
ABC_DLL int Abc_AigCleanup(Abc_Aig_t *pMan)
Definition: abcAig.c:194
static int Abc_NtkBoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:291
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
static int Abc_ObjIsBi(Abc_Obj_t *pObj)
Definition: abc.h:349
Definition: abc.h:89
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static int Abc_NtkHasOnlyLatchBoxes(Abc_Ntk_t *pNtk)
Definition: abc.h:298
Definition: abc.h:90
Definition: abc.h:92
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL int Abc_NtkMakeLegit ( Abc_Ntk_t pNtk)

Definition at line 461 of file abcFanOrder.c.

462 {
463  Abc_Obj_t * pNode;
464  int i, Counter = 0;
465  assert( Abc_NtkHasSop(pNtk) );
466  Abc_NtkForEachNode( pNtk, pNode, i )
467  Counter += Abc_NodeMakeLegit( pNode );
468  if ( Counter )
469  Abc_Print( 0, "%d nodes were made dist1-cube-free and/or single-cube-containment-free.\n", Counter );
470  return 1;
471 }
VOID_HACK free()
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
if(last==0)
Definition: sparse_int.h:34
static int Counter
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
int Abc_NodeMakeLegit(Abc_Obj_t *pNode)
Definition: abcFanOrder.c:450
#define assert(ex)
Definition: util_old.h:213
ABC_DLL Vec_Ptr_t* Abc_NtkManCutReadCutLarge ( Abc_ManCut_t p)

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

Synopsis [Returns the leaves of the cone.]

Description []

SideEffects []

SeeAlso []

Definition at line 637 of file abcReconv.c.

638 {
639  return p->vConeLeaves;
640 }
Vec_Ptr_t * vConeLeaves
Definition: abcReconv.c:40
ABC_DLL Vec_Ptr_t* Abc_NtkManCutReadCutSmall ( Abc_ManCut_t p)

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

Synopsis [Returns the leaves of the cone.]

Description []

SideEffects []

SeeAlso []

Definition at line 653 of file abcReconv.c.

654 {
655  return p->vNodeLeaves;
656 }
Vec_Ptr_t * vNodeLeaves
Definition: abcReconv.c:39
ABC_DLL Vec_Ptr_t* Abc_NtkManCutReadVisited ( Abc_ManCut_t p)

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

Synopsis [Returns the leaves of the cone.]

Description []

SideEffects []

SeeAlso []

Definition at line 669 of file abcReconv.c.

670 {
671  return p->vVisited;
672 }
Vec_Ptr_t * vVisited
Definition: abcReconv.c:41
ABC_DLL Abc_ManCut_t* Abc_NtkManCutStart ( int  nNodeSizeMax,
int  nConeSizeMax,
int  nNodeFanStop,
int  nConeFanStop 
)

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

Synopsis [Starts the resynthesis manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 588 of file abcReconv.c.

589 {
590  Abc_ManCut_t * p;
591  p = ABC_ALLOC( Abc_ManCut_t, 1 );
592  memset( p, 0, sizeof(Abc_ManCut_t) );
593  p->vNodeLeaves = Vec_PtrAlloc( 100 );
594  p->vConeLeaves = Vec_PtrAlloc( 100 );
595  p->vVisited = Vec_PtrAlloc( 100 );
596  p->vLevels = Vec_VecAlloc( 100 );
597  p->vNodesTfo = Vec_PtrAlloc( 100 );
598  p->nNodeSizeMax = nNodeSizeMax;
599  p->nConeSizeMax = nConeSizeMax;
600  p->nNodeFanStop = nNodeFanStop;
601  p->nConeFanStop = nConeFanStop;
602  return p;
603 }
char * memset()
Vec_Ptr_t * vConeLeaves
Definition: abcReconv.c:40
static Vec_Vec_t * Vec_VecAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecVec.h:145
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Vec_Ptr_t * vNodeLeaves
Definition: abcReconv.c:39
int nNodeSizeMax
Definition: abcReconv.c:34
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
int nConeFanStop
Definition: abcReconv.c:37
int nNodeFanStop
Definition: abcReconv.c:36
int nConeSizeMax
Definition: abcReconv.c:35
Vec_Ptr_t * vVisited
Definition: abcReconv.c:41
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
Vec_Vec_t * vLevels
Definition: abcReconv.c:42
DECLARATIONS ///.
Definition: abcReconv.c:31
Vec_Ptr_t * vNodesTfo
Definition: abcReconv.c:43
ABC_DLL void Abc_NtkManCutStop ( Abc_ManCut_t p)

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

Synopsis [Stops the resynthesis manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 616 of file abcReconv.c.

617 {
618  Vec_PtrFree( p->vNodeLeaves );
619  Vec_PtrFree( p->vConeLeaves );
620  Vec_PtrFree( p->vVisited );
621  Vec_VecFree( p->vLevels );
622  Vec_PtrFree( p->vNodesTfo );
623  ABC_FREE( p );
624 }
Vec_Ptr_t * vConeLeaves
Definition: abcReconv.c:40
Vec_Ptr_t * vNodeLeaves
Definition: abcReconv.c:39
static void Vec_VecFree(Vec_Vec_t *p)
Definition: vecVec.h:347
Vec_Ptr_t * vVisited
Definition: abcReconv.c:41
#define ABC_FREE(obj)
Definition: abc_global.h:232
Vec_Vec_t * vLevels
Definition: abcReconv.c:42
Vec_Ptr_t * vNodesTfo
Definition: abcReconv.c:43
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL int Abc_NtkMapToSop ( Abc_Ntk_t pNtk)

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

Synopsis [Unmaps the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 1073 of file abcFunc.c.

1074 {
1075  extern void * Abc_FrameReadLibGen();
1076  Abc_Obj_t * pNode;
1077  char * pSop;
1078  int i;
1079 
1080  assert( Abc_NtkHasMapping(pNtk) );
1081  // update the functionality manager
1082  assert( pNtk->pManFunc == Abc_FrameReadLibGen() );
1083  pNtk->pManFunc = Mem_FlexStart();
1084  pNtk->ntkFunc = ABC_FUNC_SOP;
1085  // update the nodes
1086  Abc_NtkForEachNode( pNtk, pNode, i )
1087  {
1088  if ( Abc_ObjIsBarBuf(pNode) )
1089  continue;
1090  pSop = Mio_GateReadSop((Mio_Gate_t *)pNode->pData);
1091  assert( Abc_SopGetVarNum(pSop) == Abc_ObjFaninNum(pNode) );
1092  pNode->pData = Abc_SopRegister( (Mem_Flex_t *)pNtk->pManFunc, pSop );
1093  }
1094  return 1;
1095 }
ABC_DLL void * Abc_FrameReadLibGen()
Definition: mainFrame.c:56
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Abc_ObjIsBarBuf(Abc_Obj_t *pObj)
Definition: abc.h:360
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
void * pManFunc
Definition: abc.h:191
Mem_Flex_t * Mem_FlexStart()
Definition: mem.c:311
ABC_DLL char * Abc_SopRegister(Mem_Flex_t *pMan, char *pName)
DECLARATIONS ///.
Definition: abcSop.c:56
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
ABC_DLL int Abc_SopGetVarNum(char *pSop)
Definition: abcSop.c:536
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
char * Mio_GateReadSop(Mio_Gate_t *pGate)
Definition: mioApi.c:153
ABC_DLL float Abc_NtkMfsTotalSwitching ( Abc_Ntk_t pNtk)

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

Synopsis [Marks nodes for power-optimization.]

Description []

SideEffects []

SeeAlso []

Definition at line 132 of file abcPrint.c.

133 {
134  extern Aig_Man_t * Abc_NtkToDar( Abc_Ntk_t * pNtk, int fExors, int fRegisters );
135  extern Vec_Int_t * Saig_ManComputeSwitchProbs( Aig_Man_t * p, int nFrames, int nPref, int fProbOne );
136  Vec_Int_t * vSwitching;
137  float * pSwitching;
138  Abc_Ntk_t * pNtkStr;
139  Aig_Man_t * pAig;
140  Aig_Obj_t * pObjAig;
141  Abc_Obj_t * pObjAbc, * pObjAbc2;
142  float Result = (float)0;
143  int i;
144  // strash the network
145  pNtkStr = Abc_NtkStrash( pNtk, 0, 1, 0 );
146  Abc_NtkForEachObj( pNtk, pObjAbc, i )
147  if ( Abc_ObjRegular((Abc_Obj_t *)pObjAbc->pTemp)->Type == ABC_FUNC_NONE || (!Abc_ObjIsCi(pObjAbc) && !Abc_ObjIsNode(pObjAbc)) )
148  pObjAbc->pTemp = NULL;
149  // map network into an AIG
150  pAig = Abc_NtkToDar( pNtkStr, 0, (int)(Abc_NtkLatchNum(pNtk) > 0) );
151  vSwitching = Saig_ManComputeSwitchProbs( pAig, 48, 16, 0 );
152  pSwitching = (float *)vSwitching->pArray;
153  Abc_NtkForEachObj( pNtk, pObjAbc, i )
154  {
155  if ( (pObjAbc2 = Abc_ObjRegular((Abc_Obj_t *)pObjAbc->pTemp)) && (pObjAig = Aig_Regular((Aig_Obj_t *)pObjAbc2->pTemp)) )
156  {
157  Result += Abc_ObjFanoutNum(pObjAbc) * pSwitching[pObjAig->Id];
158 // Abc_ObjPrint( stdout, pObjAbc );
159 // printf( "%d = %.2f\n", i, Abc_ObjFanoutNum(pObjAbc) * pSwitching[pObjAig->Id] );
160  }
161  }
162  Vec_IntFree( vSwitching );
163  Aig_ManStop( pAig );
164  Abc_NtkDelete( pNtkStr );
165  return Result;
166 }
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
Definition: abc.h:351
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
ABC_DLL Abc_Ntk_t * Abc_NtkStrash(Abc_Ntk_t *pNtk, int fAllNodes, int fCleanup, int fRecord)
Definition: abcStrash.c:265
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
void * pTemp
Definition: abc.h:147
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
Vec_Int_t * Saig_ManComputeSwitchProbs(Aig_Man_t *pAig, int nFrames, int nPref, int fProbOne)
Definition: giaSwitch.c:684
Aig_Man_t * Abc_NtkToDar(Abc_Ntk_t *pNtk, int fExors, int fRegisters)
Definition: abcDar.c:233
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
static Abc_Obj_t * Abc_ObjRegular(Abc_Obj_t *p)
Definition: abc.h:323
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
int Id
Definition: aig.h:85
ABC_DLL int Abc_NtkMinimumBase ( Abc_Ntk_t pNtk)

FUNCTION DEFINITIONS ///.

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

Synopsis [Makes nodes minimum base.]

Description [Returns the number of changed nodes.]

SideEffects []

SeeAlso []

Definition at line 48 of file abcMinBase.c.

49 {
50  Abc_Obj_t * pNode;
51  int i, Counter;
52  assert( Abc_NtkIsBddLogic(pNtk) );
53  Counter = 0;
54  Abc_NtkForEachNode( pNtk, pNode, i )
55  Counter += Abc_NodeMinimumBase( pNode );
56  return Counter;
57 }
static int Counter
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
static int Abc_NtkIsBddLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:265
int Abc_NodeMinimumBase(Abc_Obj_t *pNode)
Definition: abcMinBase.c:70
#define assert(ex)
Definition: util_old.h:213
ABC_DLL Abc_Ntk_t* Abc_NtkMiter ( Abc_Ntk_t pNtk1,
Abc_Ntk_t pNtk2,
int  fComb,
int  nPartSize,
int  fImplic,
int  fMulti 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Derives the miter of two networks.]

Description [Preprocesses the networks to make sure that they are strashed.]

SideEffects []

SeeAlso []

Definition at line 56 of file abcMiter.c.

57 {
58  Abc_Ntk_t * pTemp = NULL;
59  int fRemove1, fRemove2;
62  // check that the networks have the same PIs/POs/latches
63  if ( !Abc_NtkCompareSignals( pNtk1, pNtk2, fImplic, fComb ) )
64  return NULL;
65  // make sure the circuits are strashed
66  fRemove1 = (!Abc_NtkIsStrash(pNtk1) || Abc_NtkGetChoiceNum(pNtk1)) && (pNtk1 = Abc_NtkStrash(pNtk1, 0, 0, 0));
67  fRemove2 = (!Abc_NtkIsStrash(pNtk2) || Abc_NtkGetChoiceNum(pNtk2)) && (pNtk2 = Abc_NtkStrash(pNtk2, 0, 0, 0));
68  if ( pNtk1 && pNtk2 )
69  pTemp = Abc_NtkMiterInt( pNtk1, pNtk2, fComb, nPartSize, fImplic, fMulti );
70  if ( fRemove1 ) Abc_NtkDelete( pNtk1 );
71  if ( fRemove2 ) Abc_NtkDelete( pNtk2 );
72  return pTemp;
73 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
ABC_DLL Abc_Ntk_t * Abc_NtkStrash(Abc_Ntk_t *pNtk, int fAllNodes, int fCleanup, int fRecord)
Definition: abcStrash.c:265
ABC_DLL int Abc_NtkCompareSignals(Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int fOnlyPis, int fComb)
Definition: abcCheck.c:741
static ABC_NAMESPACE_IMPL_START Abc_Ntk_t * Abc_NtkMiterInt(Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int fComb, int nPartSize, int fImplic, int fMulti)
DECLARATIONS ///.
Definition: abcMiter.c:86
ABC_DLL int Abc_NtkGetChoiceNum(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:430
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
static int Abc_NtkHasOnlyLatchBoxes(Abc_Ntk_t *pNtk)
Definition: abc.h:298
#define assert(ex)
Definition: util_old.h:213
ABC_DLL void Abc_NtkMiterAddCone ( Abc_Ntk_t pNtk,
Abc_Ntk_t pNtkMiter,
Abc_Obj_t pRoot 
)

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

Synopsis [Performs mitering for one network.]

Description []

SideEffects []

SeeAlso []

Definition at line 251 of file abcMiter.c.

252 {
253  Vec_Ptr_t * vNodes;
254  Abc_Obj_t * pNode;
255  int i;
256  // map the constant nodes
257  Abc_AigConst1(pNtk)->pCopy = Abc_AigConst1(pNtkMiter);
258  // perform strashing
259  vNodes = Abc_NtkDfsNodes( pNtk, &pRoot, 1 );
260  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pNode, i )
261  if ( Abc_AigNodeIsAnd(pNode) )
262  pNode->pCopy = Abc_AigAnd( (Abc_Aig_t *)pNtkMiter->pManFunc, Abc_ObjChild0Copy(pNode), Abc_ObjChild1Copy(pNode) );
263  Vec_PtrFree( vNodes );
264 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
static Abc_Obj_t * Abc_ObjChild1Copy(Abc_Obj_t *pObj)
Definition: abc.h:387
DECLARATIONS ///.
Definition: abcAig.c:52
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:700
static Abc_Obj_t * Abc_ObjChild0Copy(Abc_Obj_t *pObj)
Definition: abc.h:386
Abc_Obj_t * pCopy
Definition: abc.h:148
if(last==0)
Definition: sparse_int.h:34
static int Abc_AigNodeIsAnd(Abc_Obj_t *pNode)
Definition: abc.h:397
ABC_DLL Vec_Ptr_t * Abc_NtkDfsNodes(Abc_Ntk_t *pNtk, Abc_Obj_t **ppNodes, int nNodes)
Definition: abcDfs.c:120
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL Abc_Ntk_t* Abc_NtkMiterAnd ( Abc_Ntk_t pNtk1,
Abc_Ntk_t pNtk2,
int  fOr,
int  fCompl2 
)

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

Synopsis [Derives the AND of two miters.]

Description [The network should have the same names of PIs.]

SideEffects []

SeeAlso []

Definition at line 384 of file abcMiter.c.

385 {
386  char Buffer[1000];
387  Abc_Ntk_t * pNtkMiter;
388  Abc_Obj_t * pOutput1, * pOutput2;
389  Abc_Obj_t * pRoot1, * pRoot2, * pMiter;
390 
391  assert( Abc_NtkIsStrash(pNtk1) );
392  assert( Abc_NtkIsStrash(pNtk2) );
393  assert( 1 == Abc_NtkCoNum(pNtk1) );
394  assert( 1 == Abc_NtkCoNum(pNtk2) );
395  assert( 0 == Abc_NtkLatchNum(pNtk1) );
396  assert( 0 == Abc_NtkLatchNum(pNtk2) );
397  assert( Abc_NtkCiNum(pNtk1) == Abc_NtkCiNum(pNtk2) );
400 
401  // start the new network
402  pNtkMiter = Abc_NtkAlloc( ABC_NTK_STRASH, ABC_FUNC_AIG, 1 );
403 // sprintf( Buffer, "%s_%s_miter", pNtk1->pName, pNtk2->pName );
404  sprintf( Buffer, "product" );
405  pNtkMiter->pName = Extra_UtilStrsav(Buffer);
406 
407  // perform strashing
408  Abc_NtkMiterPrepare( pNtk1, pNtk2, pNtkMiter, 1, -1, 0 );
409  Abc_NtkMiterAddOne( pNtk1, pNtkMiter );
410  Abc_NtkMiterAddOne( pNtk2, pNtkMiter );
411 // Abc_NtkMiterFinalize( pNtk1, pNtk2, pNtkMiter, 1 );
412  pRoot1 = Abc_NtkPo(pNtk1,0);
413  pRoot2 = Abc_NtkPo(pNtk2,0);
414  pOutput1 = Abc_ObjNotCond( Abc_ObjFanin0(pRoot1)->pCopy, Abc_ObjFaninC0(pRoot1) );
415  pOutput2 = Abc_ObjNotCond( Abc_ObjFanin0(pRoot2)->pCopy, (int)Abc_ObjFaninC0(pRoot2) ^ fCompl2 );
416 
417  // create the miter of the two outputs
418  if ( fOr )
419  pMiter = Abc_AigOr( (Abc_Aig_t *)pNtkMiter->pManFunc, pOutput1, pOutput2 );
420  else
421  pMiter = Abc_AigAnd( (Abc_Aig_t *)pNtkMiter->pManFunc, pOutput1, pOutput2 );
422  Abc_ObjAddFanin( Abc_NtkPo(pNtkMiter,0), pMiter );
423 
424  // make sure that everything is okay
425  if ( !Abc_NtkCheck( pNtkMiter ) )
426  {
427  printf( "Abc_NtkMiterAnd: The network check has failed.\n" );
428  Abc_NtkDelete( pNtkMiter );
429  return NULL;
430  }
431  return pNtkMiter;
432 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
ABC_DLL Abc_Obj_t * Abc_AigOr(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:719
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
DECLARATIONS ///.
Definition: abcAig.c:52
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
char * Extra_UtilStrsav(const char *s)
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
ABC_DLL Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
void * pManFunc
Definition: abc.h:191
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:700
char * sprintf()
static void Abc_NtkMiterAddOne(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkMiter)
Definition: abcMiter.c:231
static Abc_Obj_t * Abc_NtkPo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:316
static int Abc_NtkHasOnlyLatchBoxes(Abc_Ntk_t *pNtk)
Definition: abc.h:298
static void Abc_NtkMiterPrepare(Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, Abc_Ntk_t *pNtkMiter, int fComb, int nPartSize, int fMulti)
Definition: abcMiter.c:127
static Abc_Obj_t * Abc_ObjNotCond(Abc_Obj_t *p, int c)
Definition: abc.h:325
#define assert(ex)
Definition: util_old.h:213
char * pName
Definition: abc.h:158
ABC_DLL Abc_Ntk_t* Abc_NtkMiterCofactor ( Abc_Ntk_t pNtk,
Vec_Int_t vPiValues 
)

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

Synopsis [Derives the cofactor of the miter w.r.t. the set of vars.]

Description [The array of variable values contains -1/0/1 for each PI. -1 means this PI remains, 0/1 means this PI is set to 0/1.]

SideEffects []

SeeAlso []

Definition at line 447 of file abcMiter.c.

448 {
449  char Buffer[1000];
450  Abc_Ntk_t * pNtkMiter;
451  Abc_Obj_t * pRoot, * pOutput1;
452  int Value, i;
453 
454  assert( Abc_NtkIsStrash(pNtk) );
455  assert( 1 == Abc_NtkCoNum(pNtk) );
457 
458  // start the new network
459  pNtkMiter = Abc_NtkAlloc( ABC_NTK_STRASH, ABC_FUNC_AIG, 1 );
460  sprintf( Buffer, "%s_miter", pNtk->pName );
461  pNtkMiter->pName = Extra_UtilStrsav(Buffer);
462 
463  // get the root output
464  pRoot = Abc_NtkCo( pNtk, 0 );
465 
466  // perform strashing
467  Abc_NtkMiterPrepare( pNtk, pNtk, pNtkMiter, 1, -1, 0 );
468  // set the first cofactor
469  Vec_IntForEachEntry( vPiValues, Value, i )
470  {
471  if ( Value == -1 )
472  continue;
473  if ( Value == 0 )
474  {
475  Abc_NtkCi(pNtk, i)->pCopy = Abc_ObjNot( Abc_AigConst1(pNtkMiter) );
476  continue;
477  }
478  if ( Value == 1 )
479  {
480  Abc_NtkCi(pNtk, i)->pCopy = Abc_AigConst1(pNtkMiter);
481  continue;
482  }
483  assert( 0 );
484  }
485  // add the first cofactor
486  Abc_NtkMiterAddCone( pNtk, pNtkMiter, pRoot );
487 
488  // save the output
489  pOutput1 = Abc_ObjNotCond( Abc_ObjFanin0(pRoot)->pCopy, Abc_ObjFaninC0(pRoot) );
490 
491  // create the miter of the two outputs
492  Abc_ObjAddFanin( Abc_NtkPo(pNtkMiter,0), pOutput1 );
493 
494  // make sure that everything is okay
495  if ( !Abc_NtkCheck( pNtkMiter ) )
496  {
497  printf( "Abc_NtkMiterCofactor: The network check has failed.\n" );
498  Abc_NtkDelete( pNtkMiter );
499  return NULL;
500  }
501  return pNtkMiter;
502 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
static Abc_Obj_t * Abc_NtkCi(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:317
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
char * Extra_UtilStrsav(const char *s)
static Abc_Obj_t * Abc_NtkCo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:318
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
ABC_DLL Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
Abc_Obj_t * pCopy
Definition: abc.h:148
void Abc_NtkMiterAddCone(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkMiter, Abc_Obj_t *pRoot)
Definition: abcMiter.c:251
char * sprintf()
static Abc_Obj_t * Abc_NtkPo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:316
static int Abc_NtkHasOnlyLatchBoxes(Abc_Ntk_t *pNtk)
Definition: abc.h:298
static void Abc_NtkMiterPrepare(Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, Abc_Ntk_t *pNtkMiter, int fComb, int nPartSize, int fMulti)
Definition: abcMiter.c:127
static Abc_Obj_t * Abc_ObjNotCond(Abc_Obj_t *p, int c)
Definition: abc.h:325
#define assert(ex)
Definition: util_old.h:213
static Abc_Obj_t * Abc_ObjNot(Abc_Obj_t *p)
Definition: abc.h:324
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
char * pName
Definition: abc.h:158
ABC_DLL Abc_Ntk_t* Abc_NtkMiterForCofactors ( Abc_Ntk_t pNtk,
int  Out,
int  In1,
int  In2 
)

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

Synopsis [Derives the miter of two cofactors of one output.]

Description []

SideEffects []

SeeAlso []

Definition at line 514 of file abcMiter.c.

515 {
516  char Buffer[1000];
517  Abc_Ntk_t * pNtkMiter;
518  Abc_Obj_t * pRoot, * pOutput1, * pOutput2, * pMiter;
519 
520  assert( Abc_NtkIsStrash(pNtk) );
521  assert( Out < Abc_NtkCoNum(pNtk) );
522  assert( In1 < Abc_NtkCiNum(pNtk) );
523  assert( In2 < Abc_NtkCiNum(pNtk) );
525 
526  // start the new network
527  pNtkMiter = Abc_NtkAlloc( ABC_NTK_STRASH, ABC_FUNC_AIG, 1 );
528  sprintf( Buffer, "%s_miter", Abc_ObjName(Abc_NtkCo(pNtk, Out)) );
529  pNtkMiter->pName = Extra_UtilStrsav(Buffer);
530 
531  // get the root output
532  pRoot = Abc_NtkCo( pNtk, Out );
533 
534  // perform strashing
535  Abc_NtkMiterPrepare( pNtk, pNtk, pNtkMiter, 1, -1, 0 );
536  // set the first cofactor
537  Abc_NtkCi(pNtk, In1)->pCopy = Abc_ObjNot( Abc_AigConst1(pNtkMiter) );
538  if ( In2 >= 0 )
539  Abc_NtkCi(pNtk, In2)->pCopy = Abc_AigConst1(pNtkMiter);
540  // add the first cofactor
541  Abc_NtkMiterAddCone( pNtk, pNtkMiter, pRoot );
542 
543  // save the output
544  pOutput1 = Abc_ObjFanin0(pRoot)->pCopy;
545 
546  // set the second cofactor
547  Abc_NtkCi(pNtk, In1)->pCopy = Abc_AigConst1(pNtkMiter);
548  if ( In2 >= 0 )
549  Abc_NtkCi(pNtk, In2)->pCopy = Abc_ObjNot( Abc_AigConst1(pNtkMiter) );
550  // add the second cofactor
551  Abc_NtkMiterAddCone( pNtk, pNtkMiter, pRoot );
552 
553  // save the output
554  pOutput2 = Abc_ObjFanin0(pRoot)->pCopy;
555 
556  // create the miter of the two outputs
557  pMiter = Abc_AigXor( (Abc_Aig_t *)pNtkMiter->pManFunc, pOutput1, pOutput2 );
558  Abc_ObjAddFanin( Abc_NtkPo(pNtkMiter,0), pMiter );
559 
560  // make sure that everything is okay
561  if ( !Abc_NtkCheck( pNtkMiter ) )
562  {
563  printf( "Abc_NtkMiter: The network check has failed.\n" );
564  Abc_NtkDelete( pNtkMiter );
565  return NULL;
566  }
567  return pNtkMiter;
568 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
static Abc_Obj_t * Abc_NtkCi(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:317
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
DECLARATIONS ///.
Definition: abcAig.c:52
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
char * Extra_UtilStrsav(const char *s)
static Abc_Obj_t * Abc_NtkCo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:318
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
ABC_DLL Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
ABC_DLL Abc_Obj_t * Abc_AigXor(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:735
void * pManFunc
Definition: abc.h:191
Abc_Obj_t * pCopy
Definition: abc.h:148
void Abc_NtkMiterAddCone(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkMiter, Abc_Obj_t *pRoot)
Definition: abcMiter.c:251
char * sprintf()
static Abc_Obj_t * Abc_NtkPo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:316
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
static int Abc_NtkHasOnlyLatchBoxes(Abc_Ntk_t *pNtk)
Definition: abc.h:298
static void Abc_NtkMiterPrepare(Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, Abc_Ntk_t *pNtkMiter, int fComb, int nPartSize, int fMulti)
Definition: abcMiter.c:127
#define assert(ex)
Definition: util_old.h:213
static Abc_Obj_t * Abc_ObjNot(Abc_Obj_t *p)
Definition: abc.h:324
char * pName
Definition: abc.h:158
ABC_DLL int Abc_NtkMiterIsConstant ( Abc_Ntk_t pMiter)

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

Synopsis [Checks the status of the miter.]

Description [Return 0 if the miter is sat for at least one output. Return 1 if the miter is unsat for all its outputs. Returns -1 if the miter is undecided for some outputs.]

SideEffects []

SeeAlso []

Definition at line 679 of file abcMiter.c.

680 {
681  Abc_Obj_t * pNodePo, * pChild;
682  int i;
683  assert( Abc_NtkIsStrash(pMiter) );
684  Abc_NtkForEachPo( pMiter, pNodePo, i )
685  {
686  pChild = Abc_ObjChild0( pNodePo );
687  // check if the output is constant 1
688  if ( Abc_AigNodeIsConst(pChild) )
689  {
690  assert( Abc_ObjRegular(pChild) == Abc_AigConst1(pMiter) );
691  if ( !Abc_ObjIsComplement(pChild) )
692  {
693  // if the miter is constant 1, return immediately
694 // printf( "MITER IS CONSTANT 1!\n" );
695  return 0;
696  }
697  }
698 /*
699  // check if the output is not constant 0
700  else if ( Abc_ObjRegular(pChild)->fPhase != (unsigned)Abc_ObjIsComplement(pChild) )
701  {
702  return 0;
703  }
704 */
705  // if the miter is undecided (or satisfiable), return immediately
706  else
707  return -1;
708  }
709  // return 1, meaning all outputs are constant zero
710  return 1;
711 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
static int Abc_AigNodeIsConst(Abc_Obj_t *pNode)
Definition: abc.h:396
static Abc_Obj_t * Abc_ObjChild0(Abc_Obj_t *pObj)
Definition: abc.h:383
static Abc_Obj_t * Abc_ObjRegular(Abc_Obj_t *p)
Definition: abc.h:323
#define assert(ex)
Definition: util_old.h:213
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
static int Abc_ObjIsComplement(Abc_Obj_t *p)
Definition: abc.h:322
ABC_DLL int Abc_NtkMiterProve ( Abc_Ntk_t **  ppNtk,
void *  pPars 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Attempts to solve the miter using a number of tricks.]

Description [Returns -1 if timed out; 0 if SAT; 1 if UNSAT. Returns a simplified version of the original network (or a constant 0 network). In case the network is not a constant zero and a SAT assignment is found, pNtk->pModel contains a satisfying assignment.]

SideEffects []

SeeAlso []

Definition at line 59 of file abcProve.c.

60 {
61  Prove_Params_t * pParams = (Prove_Params_t *)pPars;
62  Abc_Ntk_t * pNtk, * pNtkTemp;
63  int RetValue = -1, nIter, nSatFails, Counter;
64  abctime clk; //, timeStart = Abc_Clock();
65  ABC_INT64_T nSatConfs, nSatInspects, nInspectLimit;
66 
67  // get the starting network
68  pNtk = *ppNtk;
69  assert( Abc_NtkIsStrash(pNtk) );
70  assert( Abc_NtkPoNum(pNtk) == 1 );
71 
72  if ( pParams->fVerbose )
73  {
74  printf( "RESOURCE LIMITS: Iterations = %d. Rewriting = %s. Fraiging = %s.\n",
75  pParams->nItersMax, pParams->fUseRewriting? "yes":"no", pParams->fUseFraiging? "yes":"no" );
76  printf( "Miter = %d (%3.1f). Rwr = %d (%3.1f). Fraig = %d (%3.1f). Last = %d.\n",
77  pParams->nMiteringLimitStart, pParams->nMiteringLimitMulti,
78  pParams->nRewritingLimitStart, pParams->nRewritingLimitMulti,
79  pParams->nFraigingLimitStart, pParams->nFraigingLimitMulti, pParams->nMiteringLimitLast );
80  }
81 
82  // if SAT only, solve without iteration
83  if ( !pParams->fUseRewriting && !pParams->fUseFraiging )
84  {
85  clk = Abc_Clock();
86  RetValue = Abc_NtkMiterSat( pNtk, (ABC_INT64_T)pParams->nMiteringLimitLast, (ABC_INT64_T)0, 0, NULL, NULL );
87  Abc_NtkMiterPrint( pNtk, "SAT solving", clk, pParams->fVerbose );
88  *ppNtk = pNtk;
89  return RetValue;
90  }
91 
92  // check the current resource limits
93  for ( nIter = 0; nIter < pParams->nItersMax; nIter++ )
94  {
95  if ( pParams->fVerbose )
96  {
97  printf( "ITERATION %2d : Confs = %6d. FraigBTL = %3d. \n", nIter+1,
98  (int)(pParams->nMiteringLimitStart * pow(pParams->nMiteringLimitMulti,nIter)),
99  (int)(pParams->nFraigingLimitStart * pow(pParams->nFraigingLimitMulti,nIter)) );
100  fflush( stdout );
101  }
102 
103  // try brute-force SAT
104  clk = Abc_Clock();
105  nInspectLimit = pParams->nTotalInspectLimit? pParams->nTotalInspectLimit - pParams->nTotalInspectsMade : 0;
106  RetValue = Abc_NtkMiterSat( pNtk, (ABC_INT64_T)(pParams->nMiteringLimitStart * pow(pParams->nMiteringLimitMulti,nIter)), (ABC_INT64_T)nInspectLimit, 0, &nSatConfs, &nSatInspects );
107  Abc_NtkMiterPrint( pNtk, "SAT solving", clk, pParams->fVerbose );
108  if ( RetValue >= 0 )
109  break;
110 
111  // add to the number of backtracks and inspects
112  pParams->nTotalBacktracksMade += nSatConfs;
113  pParams->nTotalInspectsMade += nSatInspects;
114  // check if global resource limit is reached
115  if ( (pParams->nTotalBacktrackLimit && pParams->nTotalBacktracksMade >= pParams->nTotalBacktrackLimit) ||
116  (pParams->nTotalInspectLimit && pParams->nTotalInspectsMade >= pParams->nTotalInspectLimit) )
117  {
118  printf( "Reached global limit on conflicts/inspects. Quitting.\n" );
119  *ppNtk = pNtk;
120  return -1;
121  }
122 
123  // try rewriting
124  if ( pParams->fUseRewriting )
125  {
126  clk = Abc_Clock();
127  Counter = (int)(pParams->nRewritingLimitStart * pow(pParams->nRewritingLimitMulti,nIter));
128 // Counter = 1;
129  while ( 1 )
130  {
131 /*
132  extern Abc_Ntk_t * Abc_NtkIvyResyn( Abc_Ntk_t * pNtk, int fUpdateLevel, int fVerbose );
133  pNtk = Abc_NtkIvyResyn( pNtkTemp = pNtk, 0, 0 ); Abc_NtkDelete( pNtkTemp );
134  if ( (RetValue = Abc_NtkMiterIsConstant(pNtk)) >= 0 )
135  break;
136  if ( --Counter == 0 )
137  break;
138 */
139 /*
140  Abc_NtkRewrite( pNtk, 0, 0, 0, 0, 0 );
141  if ( (RetValue = Abc_NtkMiterIsConstant(pNtk)) >= 0 )
142  break;
143  if ( --Counter == 0 )
144  break;
145 */
146  Abc_NtkRewrite( pNtk, 0, 0, 0, 0, 0 );
147  if ( (RetValue = Abc_NtkMiterIsConstant(pNtk)) >= 0 )
148  break;
149  if ( --Counter == 0 )
150  break;
151  Abc_NtkRefactor( pNtk, 10, 16, 0, 0, 0, 0 );
152  if ( (RetValue = Abc_NtkMiterIsConstant(pNtk)) >= 0 )
153  break;
154  if ( --Counter == 0 )
155  break;
156  pNtk = Abc_NtkBalance( pNtkTemp = pNtk, 0, 0, 0 ); Abc_NtkDelete( pNtkTemp );
157  if ( (RetValue = Abc_NtkMiterIsConstant(pNtk)) >= 0 )
158  break;
159  if ( --Counter == 0 )
160  break;
161  }
162  Abc_NtkMiterPrint( pNtk, "Rewriting ", clk, pParams->fVerbose );
163  }
164 
165  if ( pParams->fUseFraiging )
166  {
167  // try FRAIGing
168  clk = Abc_Clock();
169  nInspectLimit = pParams->nTotalInspectLimit? pParams->nTotalInspectLimit - pParams->nTotalInspectsMade : 0;
170  pNtk = Abc_NtkMiterFraig( pNtkTemp = pNtk, (int)(pParams->nFraigingLimitStart * pow(pParams->nFraigingLimitMulti,nIter)), nInspectLimit, &RetValue, &nSatFails, &nSatConfs, &nSatInspects ); Abc_NtkDelete( pNtkTemp );
171  Abc_NtkMiterPrint( pNtk, "FRAIGing ", clk, pParams->fVerbose );
172 // printf( "NumFails = %d\n", nSatFails );
173  if ( RetValue >= 0 )
174  break;
175 
176  // add to the number of backtracks and inspects
177  pParams->nTotalBacktracksMade += nSatConfs;
178  pParams->nTotalInspectsMade += nSatInspects;
179  // check if global resource limit is reached
180  if ( (pParams->nTotalBacktrackLimit && pParams->nTotalBacktracksMade >= pParams->nTotalBacktrackLimit) ||
181  (pParams->nTotalInspectLimit && pParams->nTotalInspectsMade >= pParams->nTotalInspectLimit) )
182  {
183  printf( "Reached global limit on conflicts/inspects. Quitting.\n" );
184  *ppNtk = pNtk;
185  return -1;
186  }
187  }
188 
189  }
190 
191  // try to prove it using brute force SAT
192  if ( RetValue < 0 && pParams->fUseBdds )
193  {
194  if ( pParams->fVerbose )
195  {
196  printf( "Attempting BDDs with node limit %d ...\n", pParams->nBddSizeLimit );
197  fflush( stdout );
198  }
199  clk = Abc_Clock();
200  pNtk = Abc_NtkCollapse( pNtkTemp = pNtk, pParams->nBddSizeLimit, 0, pParams->fBddReorder, 0 );
201  if ( pNtk )
202  {
203  Abc_NtkDelete( pNtkTemp );
204  RetValue = ( (Abc_NtkNodeNum(pNtk) == 1) && (Abc_ObjFanin0(Abc_NtkPo(pNtk,0))->pData == Cudd_ReadLogicZero((DdManager *)pNtk->pManFunc)) );
205  }
206  else
207  pNtk = pNtkTemp;
208  Abc_NtkMiterPrint( pNtk, "BDD building", clk, pParams->fVerbose );
209  }
210 
211  if ( RetValue < 0 )
212  {
213  if ( pParams->fVerbose )
214  {
215  printf( "Attempting SAT with conflict limit %d ...\n", pParams->nMiteringLimitLast );
216  fflush( stdout );
217  }
218  clk = Abc_Clock();
219  nInspectLimit = pParams->nTotalInspectLimit? pParams->nTotalInspectLimit - pParams->nTotalInspectsMade : 0;
220  RetValue = Abc_NtkMiterSat( pNtk, (ABC_INT64_T)pParams->nMiteringLimitLast, (ABC_INT64_T)nInspectLimit, 0, NULL, NULL );
221  Abc_NtkMiterPrint( pNtk, "SAT solving", clk, pParams->fVerbose );
222  }
223 
224  // assign the model if it was proved by rewriting (const 1 miter)
225  if ( RetValue == 0 && pNtk->pModel == NULL )
226  {
227  pNtk->pModel = ABC_ALLOC( int, Abc_NtkCiNum(pNtk) );
228  memset( pNtk->pModel, 0, sizeof(int) * Abc_NtkCiNum(pNtk) );
229  }
230  *ppNtk = pNtk;
231  return RetValue;
232 }
char * memset()
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static Abc_Ntk_t * Abc_NtkMiterFraig(Abc_Ntk_t *pNtk, int nBTLimit, ABC_INT64_T nInspLimit, int *pRetValue, int *pNumFails, ABC_INT64_T *pNumConfs, ABC_INT64_T *pNumInspects)
Definition: abcProve.c:245
ABC_NAMESPACE_IMPL_START int Abc_NtkRefactor(Abc_Ntk_t *pNtk, int nNodeSizeMax, int nConeSizeMax, int fUpdateLevel, int fUseZeros, int fUseDcs, int fVerbose)
DECLARATIONS ///.
Definition: abcRefactor.c:89
DdNode * Cudd_ReadLogicZero(DdManager *dd)
Definition: cuddAPI.c:1058
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static abctime Abc_Clock()
Definition: abc_global.h:279
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
int * pModel
Definition: abc.h:198
ABC_DLL Abc_Ntk_t * Abc_NtkCollapse(Abc_Ntk_t *pNtk, int fBddSizeMax, int fDualRail, int fReorder, int fVerbose)
FUNCTION DEFINITIONS ///.
Definition: abcCollapse.c:49
ABC_INT64_T nTotalInspectsMade
Definition: ivyFraig.c:137
void * pManFunc
Definition: abc.h:191
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
Definition: abc.h:293
ABC_INT64_T nTotalBacktracksMade
Definition: ivyFraig.c:136
ABC_DLL int Abc_NtkRewrite(Abc_Ntk_t *pNtk, int fUpdateLevel, int fUseZeros, int fVerbose, int fVeryVerbose, int fPlaceEnable)
FUNCTION DEFINITIONS ///.
Definition: abcRewrite.c:61
static void Abc_NtkMiterPrint(Abc_Ntk_t *pNtk, char *pString, abctime clk, int fVerbose)
Definition: abcProve.c:311
ABC_DLL int Abc_NtkMiterSat(Abc_Ntk_t *pNtk, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, int fVerbose, ABC_INT64_T *pNumConfs, ABC_INT64_T *pNumInspects)
FUNCTION DEFINITIONS ///.
Definition: abcSat.c:53
ABC_INT64_T nTotalInspectLimit
Definition: ivyFraig.c:134
static int Counter
float nRewritingLimitMulti
Definition: ivyFraig.c:123
ABC_INT64_T nTotalBacktrackLimit
Definition: ivyFraig.c:133
ABC_DLL int Abc_NtkMiterIsConstant(Abc_Ntk_t *pMiter)
Definition: abcMiter.c:679
static Abc_Obj_t * Abc_NtkPo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:316
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:286
ABC_DLL Abc_Ntk_t * Abc_NtkBalance(Abc_Ntk_t *pNtk, int fDuplicate, int fSelective, int fUpdateLevel)
FUNCTION DEFINITIONS ///.
Definition: abcBalance.c:53
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
ABC_INT64_T abctime
Definition: abc_global.h:278
ABC_DLL Abc_Ntk_t* Abc_NtkMiterQuantify ( Abc_Ntk_t pNtk,
int  In,
int  fExist 
)

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

Synopsis [Derives the miter of two cofactors of one output.]

Description []

SideEffects []

SeeAlso []

Definition at line 582 of file abcMiter.c.

583 {
584  Abc_Ntk_t * pNtkMiter;
585  Abc_Obj_t * pRoot, * pOutput1, * pOutput2, * pMiter;
586 
587  assert( Abc_NtkIsStrash(pNtk) );
588  assert( 1 == Abc_NtkCoNum(pNtk) );
589  assert( In < Abc_NtkCiNum(pNtk) );
591 
592  // start the new network
593  pNtkMiter = Abc_NtkAlloc( ABC_NTK_STRASH, ABC_FUNC_AIG, 1 );
594  pNtkMiter->pName = Extra_UtilStrsav( Abc_ObjName(Abc_NtkCo(pNtk, 0)) );
595 
596  // get the root output
597  pRoot = Abc_NtkCo( pNtk, 0 );
598 
599  // perform strashing
600  Abc_NtkMiterPrepare( pNtk, pNtk, pNtkMiter, 1, -1, 0 );
601  // set the first cofactor
602  Abc_NtkCi(pNtk, In)->pCopy = Abc_ObjNot( Abc_AigConst1(pNtkMiter) );
603  // add the first cofactor
604  Abc_NtkMiterAddCone( pNtk, pNtkMiter, pRoot );
605  // save the output
606 // pOutput1 = Abc_ObjFanin0(pRoot)->pCopy;
607  pOutput1 = Abc_ObjNotCond( Abc_ObjFanin0(pRoot)->pCopy, Abc_ObjFaninC0(pRoot) );
608 
609  // set the second cofactor
610  Abc_NtkCi(pNtk, In)->pCopy = Abc_AigConst1(pNtkMiter);
611  // add the second cofactor
612  Abc_NtkMiterAddCone( pNtk, pNtkMiter, pRoot );
613  // save the output
614 // pOutput2 = Abc_ObjFanin0(pRoot)->pCopy;
615  pOutput2 = Abc_ObjNotCond( Abc_ObjFanin0(pRoot)->pCopy, Abc_ObjFaninC0(pRoot) );
616 
617  // create the miter of the two outputs
618  if ( fExist )
619  pMiter = Abc_AigOr( (Abc_Aig_t *)pNtkMiter->pManFunc, pOutput1, pOutput2 );
620  else
621  pMiter = Abc_AigAnd( (Abc_Aig_t *)pNtkMiter->pManFunc, pOutput1, pOutput2 );
622  Abc_ObjAddFanin( Abc_NtkPo(pNtkMiter,0), pMiter );
623 
624  // make sure that everything is okay
625  if ( !Abc_NtkCheck( pNtkMiter ) )
626  {
627  printf( "Abc_NtkMiter: The network check has failed.\n" );
628  Abc_NtkDelete( pNtkMiter );
629  return NULL;
630  }
631  return pNtkMiter;
632 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
ABC_DLL Abc_Obj_t * Abc_AigOr(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:719
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
static Abc_Obj_t * Abc_NtkCi(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:317
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
DECLARATIONS ///.
Definition: abcAig.c:52
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
char * Extra_UtilStrsav(const char *s)
static Abc_Obj_t * Abc_NtkCo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:318
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
ABC_DLL Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
void * pManFunc
Definition: abc.h:191
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:700
Abc_Obj_t * pCopy
Definition: abc.h:148
void Abc_NtkMiterAddCone(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkMiter, Abc_Obj_t *pRoot)
Definition: abcMiter.c:251
static Abc_Obj_t * Abc_NtkPo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:316
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
static int Abc_NtkHasOnlyLatchBoxes(Abc_Ntk_t *pNtk)
Definition: abc.h:298
static void Abc_NtkMiterPrepare(Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, Abc_Ntk_t *pNtkMiter, int fComb, int nPartSize, int fMulti)
Definition: abcMiter.c:127
static Abc_Obj_t * Abc_ObjNotCond(Abc_Obj_t *p, int c)
Definition: abc.h:325
#define assert(ex)
Definition: util_old.h:213
static Abc_Obj_t * Abc_ObjNot(Abc_Obj_t *p)
Definition: abc.h:324
char * pName
Definition: abc.h:158
ABC_DLL Abc_Ntk_t* Abc_NtkMiterQuantifyPis ( Abc_Ntk_t pNtk)

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

Synopsis [Quantifies all the PIs existentially from the only PO of the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 645 of file abcMiter.c.

646 {
647  Abc_Ntk_t * pNtkTemp;
648  Abc_Obj_t * pObj;
649  int i;
651 
652  Abc_NtkForEachPi( pNtk, pObj, i )
653  {
654  if ( Abc_ObjFanoutNum(pObj) == 0 )
655  continue;
656  pNtk = Abc_NtkMiterQuantify( pNtkTemp = pNtk, i, 1 );
657  Abc_NtkDelete( pNtkTemp );
658  }
659 
660  return pNtk;
661 }
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
Abc_Ntk_t * Abc_NtkMiterQuantify(Abc_Ntk_t *pNtk, int In, int fExist)
Definition: abcMiter.c:582
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
static int Abc_NtkHasOnlyLatchBoxes(Abc_Ntk_t *pNtk)
Definition: abc.h:298
#define assert(ex)
Definition: util_old.h:213
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
ABC_DLL void Abc_NtkMiterReport ( Abc_Ntk_t pMiter)

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

Synopsis [Reports the status of the miter.]

Description []

SideEffects []

SeeAlso []

Definition at line 724 of file abcMiter.c.

725 {
726  Abc_Obj_t * pChild, * pNode;
727  int i;
728  if ( Abc_NtkPoNum(pMiter) == 1 )
729  {
730  pChild = Abc_ObjChild0( Abc_NtkPo(pMiter,0) );
731  if ( Abc_AigNodeIsConst(pChild) )
732  {
733  if ( Abc_ObjIsComplement(pChild) )
734  printf( "Unsatisfiable.\n" );
735  else
736  printf( "Satisfiable. (Constant 1).\n" );
737  }
738  else
739  printf( "Satisfiable.\n" );
740  }
741  else
742  {
743  Abc_NtkForEachPo( pMiter, pNode, i )
744  {
745  pChild = Abc_ObjChild0( Abc_NtkPo(pMiter,i) );
746  printf( "Output #%2d : ", i );
747  if ( Abc_AigNodeIsConst(pChild) )
748  {
749  if ( Abc_ObjIsComplement(pChild) )
750  printf( "Unsatisfiable.\n" );
751  else
752  printf( "Satisfiable. (Constant 1).\n" );
753  }
754  else
755  printf( "Satisfiable.\n" );
756  }
757  }
758 }
static int Abc_AigNodeIsConst(Abc_Obj_t *pNode)
Definition: abc.h:396
static Abc_Obj_t * Abc_ObjChild0(Abc_Obj_t *pObj)
Definition: abc.h:383
static Abc_Obj_t * Abc_NtkPo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:316
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:286
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
static int Abc_ObjIsComplement(Abc_Obj_t *p)
Definition: abc.h:322
ABC_DLL int Abc_NtkMiterSat ( Abc_Ntk_t pNtk,
ABC_INT64_T  nConfLimit,
ABC_INT64_T  nInsLimit,
int  fVerbose,
ABC_INT64_T *  pNumConfs,
ABC_INT64_T *  pNumInspects 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Attempts to solve the miter using an internal SAT sat_solver.]

Description [Returns -1 if timed out; 0 if SAT; 1 if UNSAT.]

SideEffects []

SeeAlso []

Definition at line 53 of file abcSat.c.

54 {
55  sat_solver * pSat;
56  lbool status;
57  int RetValue;
58  abctime clk;
59 
60  if ( pNumConfs )
61  *pNumConfs = 0;
62  if ( pNumInspects )
63  *pNumInspects = 0;
64 
65  assert( Abc_NtkLatchNum(pNtk) == 0 );
66 
67 // if ( Abc_NtkPoNum(pNtk) > 1 )
68 // fprintf( stdout, "Warning: The miter has %d outputs. SAT will try to prove all of them.\n", Abc_NtkPoNum(pNtk) );
69 
70  // load clauses into the sat_solver
71  clk = Abc_Clock();
72  pSat = (sat_solver *)Abc_NtkMiterSatCreate( pNtk, 0 );
73  if ( pSat == NULL )
74  return 1;
75 //printf( "%d \n", pSat->clauses.size );
76 //sat_solver_delete( pSat );
77 //return 1;
78 
79 // printf( "Created SAT problem with %d variable and %d clauses. ", sat_solver_nvars(pSat), sat_solver_nclauses(pSat) );
80 // ABC_PRT( "Time", Abc_Clock() - clk );
81 
82  // simplify the problem
83  clk = Abc_Clock();
84  status = sat_solver_simplify(pSat);
85 // printf( "Simplified the problem to %d variables and %d clauses. ", sat_solver_nvars(pSat), sat_solver_nclauses(pSat) );
86 // ABC_PRT( "Time", Abc_Clock() - clk );
87  if ( status == 0 )
88  {
89  sat_solver_delete( pSat );
90 // printf( "The problem is UNSATISFIABLE after simplification.\n" );
91  return 1;
92  }
93 
94  // solve the miter
95  clk = Abc_Clock();
96  if ( fVerbose )
97  pSat->verbosity = 1;
98  status = sat_solver_solve( pSat, NULL, NULL, (ABC_INT64_T)nConfLimit, (ABC_INT64_T)nInsLimit, (ABC_INT64_T)0, (ABC_INT64_T)0 );
99  if ( status == l_Undef )
100  {
101 // printf( "The problem timed out.\n" );
102  RetValue = -1;
103  }
104  else if ( status == l_True )
105  {
106 // printf( "The problem is SATISFIABLE.\n" );
107  RetValue = 0;
108  }
109  else if ( status == l_False )
110  {
111 // printf( "The problem is UNSATISFIABLE.\n" );
112  RetValue = 1;
113  }
114  else
115  assert( 0 );
116 // ABC_PRT( "SAT sat_solver time", Abc_Clock() - clk );
117 // printf( "The number of conflicts = %d.\n", (int)pSat->sat_solver_stats.conflicts );
118 
119  // if the problem is SAT, get the counterexample
120  if ( status == l_True )
121  {
122 // Vec_Int_t * vCiIds = Abc_NtkGetCiIds( pNtk );
123  Vec_Int_t * vCiIds = Abc_NtkGetCiSatVarNums( pNtk );
124  pNtk->pModel = Sat_SolverGetModel( pSat, vCiIds->pArray, vCiIds->nSize );
125  Vec_IntFree( vCiIds );
126  }
127  // free the sat_solver
128  if ( fVerbose )
129  Sat_SolverPrintStats( stdout, pSat );
130 
131  if ( pNumConfs )
132  *pNumConfs = (int)pSat->stats.conflicts;
133  if ( pNumInspects )
134  *pNumInspects = (int)pSat->stats.inspects;
135 
136 sat_solver_store_write( pSat, "trace.cnf" );
137 sat_solver_store_free( pSat );
138 
139  sat_solver_delete( pSat );
140  return RetValue;
141 }
char lbool
Definition: satVec.h:133
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
#define l_Undef
Definition: SolverTypes.h:86
int sat_solver_solve(sat_solver *s, lit *begin, lit *end, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, ABC_INT64_T nConfLimitGlobal, ABC_INT64_T nInsLimitGlobal)
Definition: satSolver.c:1700
void sat_solver_delete(sat_solver *s)
Definition: satSolver.c:1141
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
void * Abc_NtkMiterSatCreate(Abc_Ntk_t *pNtk, int fAllPrimes)
Definition: abcSat.c:629
#define l_True
Definition: SolverTypes.h:84
static abctime Abc_Clock()
Definition: abc_global.h:279
stats_t stats
Definition: satSolver.h:156
void sat_solver_store_write(sat_solver *s, char *pFileName)
Definition: satSolver.c:1922
int * pModel
Definition: abc.h:198
Vec_Int_t * Abc_NtkGetCiSatVarNums(Abc_Ntk_t *pNtk)
Definition: abcSat.c:154
if(last==0)
Definition: sparse_int.h:34
ABC_INT64_T inspects
Definition: satVec.h:154
ABC_INT64_T conflicts
Definition: satVec.h:154
int sat_solver_simplify(sat_solver *s)
Definition: satSolver.c:1276
void sat_solver_store_free(sat_solver *s)
Definition: satSolver.c:1927
#define l_False
Definition: SolverTypes.h:85
#define assert(ex)
Definition: util_old.h:213
void Sat_SolverPrintStats(FILE *pFile, sat_solver *p)
Definition: satUtil.c:188
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
ABC_INT64_T abctime
Definition: abc_global.h:278
int * Sat_SolverGetModel(sat_solver *p, int *pVars, int nVars)
Definition: satUtil.c:266
ABC_DLL void* Abc_NtkMiterSatCreate ( Abc_Ntk_t pNtk,
int  fAllPrimes 
)

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

Synopsis [Sets up the SAT sat_solver.]

Description []

SideEffects []

SeeAlso []

Definition at line 629 of file abcSat.c.

630 {
631  sat_solver * pSat;
632  Abc_Obj_t * pNode;
633  int RetValue, i; //, clk = Abc_Clock();
634 
635  assert( Abc_NtkIsStrash(pNtk) || Abc_NtkIsBddLogic(pNtk) );
636  if ( Abc_NtkIsBddLogic(pNtk) )
637  return Abc_NtkMiterSatCreateLogic(pNtk, fAllPrimes);
638 
639  nMuxes = 0;
640  pSat = sat_solver_new();
641 //sat_solver_store_alloc( pSat );
642  RetValue = Abc_NtkMiterSatCreateInt( pSat, pNtk );
644 
645  Abc_NtkForEachObj( pNtk, pNode, i )
646  pNode->fMarkA = 0;
647 // ASat_SolverWriteDimacs( pSat, "temp_sat.cnf", NULL, NULL, 1 );
648  if ( RetValue == 0 )
649  {
650  sat_solver_delete(pSat);
651  return NULL;
652  }
653 // printf( "Ands = %6d. Muxes = %6d (%5.2f %%). ", Abc_NtkNodeNum(pNtk), nMuxes, 300.0*nMuxes/Abc_NtkNodeNum(pNtk) );
654 // ABC_PRT( "Creating sat_solver", Abc_Clock() - clk );
655  return pSat;
656 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
int Abc_NtkMiterSatCreateInt(sat_solver *pSat, Abc_Ntk_t *pNtk)
Definition: abcSat.c:466
void sat_solver_delete(sat_solver *s)
Definition: satSolver.c:1141
static ABC_NAMESPACE_IMPL_START sat_solver * Abc_NtkMiterSatCreateLogic(Abc_Ntk_t *pNtk, int fAllPrimes)
DECLARATIONS ///.
Definition: abcSat.c:836
static int nMuxes
Definition: abcSat.c:36
if(last==0)
Definition: sparse_int.h:34
void sat_solver_store_mark_roots(sat_solver *s)
Definition: satSolver.c:1939
sat_solver * sat_solver_new(void)
Definition: satSolver.c:1001
static int Abc_NtkIsBddLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:265
#define assert(ex)
Definition: util_old.h:213
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
static void* Abc_NtkMvVar ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 435 of file abc.h.

435 { return Vec_PtrEntry(pNtk->vAttrs, VEC_ATTR_MVVAR); }
Vec_Ptr_t * vAttrs
Definition: abc.h:214
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static void* Abc_NtkMvVarMan ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 436 of file abc.h.

436 { return Abc_NtkMvVar(pNtk)? Vec_AttMan( (Vec_Att_t *)Abc_NtkMvVar(pNtk) ) : NULL; }
static void * Abc_NtkMvVar(Abc_Ntk_t *pNtk)
Definition: abc.h:435
static void * Vec_AttMan(Vec_Att_t *p)
Definition: vecAtt.h:268
static char* Abc_NtkName ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 270 of file abc.h.

270 { return pNtk->pName; }
char * pName
Definition: abc.h:158
static int Abc_NtkNetNum ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 292 of file abc.h.

292 { return pNtk->nObjCounts[ABC_OBJ_NET]; }
int nObjCounts[ABC_OBJ_NUMBER]
Definition: abc.h:171
static int Abc_NtkNodeNum ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 293 of file abc.h.

293 { return pNtk->nObjCounts[ABC_OBJ_NODE]; }
int nObjCounts[ABC_OBJ_NUMBER]
Definition: abc.h:171
ABC_DLL Vec_Ptr_t* Abc_NtkNodeSupport ( Abc_Ntk_t pNtk,
Abc_Obj_t **  ppNodes,
int  nNodes 
)

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

Synopsis [Returns the set of CI nodes in the support of the given nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 859 of file abcDfs.c.

860 {
861  Vec_Ptr_t * vNodes;
862  int i;
863  // set the traversal ID
864  Abc_NtkIncrementTravId( pNtk );
865  // start the array of nodes
866  vNodes = Vec_PtrAlloc( 100 );
867  // go through the PO nodes and call for each of them
868  for ( i = 0; i < nNodes; i++ )
869  if ( Abc_ObjIsCo(ppNodes[i]) )
870  Abc_NtkNodeSupport_rec( Abc_ObjFanin0(ppNodes[i]), vNodes );
871  else
872  Abc_NtkNodeSupport_rec( ppNodes[i], vNodes );
873  return vNodes;
874 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
Definition: abc.h:352
void Abc_NtkNodeSupport_rec(Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
Definition: abcDfs.c:795
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
static Abc_Obj_t* Abc_NtkObj ( Abc_Ntk_t pNtk,
int  i 
)
inlinestatic

Definition at line 314 of file abc.h.

314 { return (Abc_Obj_t *)Vec_PtrEntry( pNtk->vObjs, i ); }
Vec_Ptr_t * vObjs
Definition: abc.h:162
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Abc_NtkObjNum ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 283 of file abc.h.

283 { return pNtk->nObjs; }
int nObjs
Definition: abc.h:172
static int Abc_NtkObjNumMax ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 284 of file abc.h.

284 { return Vec_PtrSize(pNtk->vObjs); }
Vec_Ptr_t * vObjs
Definition: abc.h:162
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
ABC_DLL void Abc_NtkOrderCisCos ( Abc_Ntk_t pNtk)

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

Synopsis [Order CI/COs.]

Description []

SideEffects []

SeeAlso []

Definition at line 71 of file abcUtil.c.

72 {
73  Abc_Obj_t * pObj, * pTerm;
74  int i, k;
75  Vec_PtrClear( pNtk->vCis );
76  Vec_PtrClear( pNtk->vCos );
77  Abc_NtkForEachPi( pNtk, pObj, i )
78  Vec_PtrPush( pNtk->vCis, pObj );
79  Abc_NtkForEachPo( pNtk, pObj, i )
80  Vec_PtrPush( pNtk->vCos, pObj );
81  Abc_NtkForEachBox( pNtk, pObj, i )
82  {
83  if ( Abc_ObjIsLatch(pObj) )
84  continue;
85  Abc_ObjForEachFanin( pObj, pTerm, k )
86  Vec_PtrPush( pNtk->vCos, pTerm );
87  Abc_ObjForEachFanout( pObj, pTerm, k )
88  Vec_PtrPush( pNtk->vCis, pTerm );
89  }
90  Abc_NtkForEachBox( pNtk, pObj, i )
91  {
92  if ( !Abc_ObjIsLatch(pObj) )
93  continue;
94  Abc_ObjForEachFanin( pObj, pTerm, k )
95  Vec_PtrPush( pNtk->vCos, pTerm );
96  Abc_ObjForEachFanout( pObj, pTerm, k )
97  Vec_PtrPush( pNtk->vCis, pTerm );
98  }
99 }
static int Abc_ObjIsLatch(Abc_Obj_t *pObj)
Definition: abc.h:356
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
Vec_Ptr_t * vCis
Definition: abc.h:165
Vec_Ptr_t * vCos
Definition: abc.h:166
#define Abc_NtkForEachBox(pNtk, pObj, i)
Definition: abc.h:495
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition: abc.h:526
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
ABC_DLL void Abc_NtkOrderObjsByName ( Abc_Ntk_t pNtk,
int  fComb 
)

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

Synopsis [Orders PIs/POs/latches alphabetically.]

Description []

SideEffects []

SeeAlso []

Definition at line 335 of file abcNames.c.

336 {
337  Abc_Obj_t * pObj;
338  int i;
340  // temporarily store the names in the copy field
341  Abc_NtkForEachPi( pNtk, pObj, i )
342  pObj->pCopy = (Abc_Obj_t *)Abc_ObjName(pObj);
343  Abc_NtkForEachPo( pNtk, pObj, i )
344  pObj->pCopy = (Abc_Obj_t *)Abc_ObjName(pObj);
345  Abc_NtkForEachBox( pNtk, pObj, i )
346  pObj->pCopy = (Abc_Obj_t *)Abc_ObjName(Abc_ObjFanout0(pObj));
347  // order objects alphabetically
348  qsort( (void *)Vec_PtrArray(pNtk->vPis), Vec_PtrSize(pNtk->vPis), sizeof(Abc_Obj_t *),
349  (int (*)(const void *, const void *)) Abc_NodeCompareNames );
350  qsort( (void *)Vec_PtrArray(pNtk->vPos), Vec_PtrSize(pNtk->vPos), sizeof(Abc_Obj_t *),
351  (int (*)(const void *, const void *)) Abc_NodeCompareNames );
352  // if the comparison if combinational (latches as PIs/POs), order them too
353  if ( fComb )
354  qsort( (void *)Vec_PtrArray(pNtk->vBoxes), Vec_PtrSize(pNtk->vBoxes), sizeof(Abc_Obj_t *),
355  (int (*)(const void *, const void *)) Abc_NodeCompareNames );
356  // order CIs/COs first PIs/POs(Asserts) then latches
357  Abc_NtkOrderCisCos( pNtk );
358  // clean the copy fields
359  Abc_NtkForEachPi( pNtk, pObj, i )
360  pObj->pCopy = NULL;
361  Abc_NtkForEachPo( pNtk, pObj, i )
362  pObj->pCopy = NULL;
363  Abc_NtkForEachBox( pNtk, pObj, i )
364  pObj->pCopy = NULL;
365 }
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
int Abc_NodeCompareNames(Abc_Obj_t **pp1, Abc_Obj_t **pp2)
Definition: abcNames.c:309
if(last==0)
Definition: sparse_int.h:34
ABC_NAMESPACE_IMPL_START char * Abc_ObjName(Abc_Obj_t *pObj)
DECLARATIONS ///.
Definition: abcNames.c:48
#define Abc_NtkForEachBox(pNtk, pObj, i)
Definition: abc.h:495
static int Abc_NtkHasOnlyLatchBoxes(Abc_Ntk_t *pNtk)
Definition: abc.h:298
#define assert(ex)
Definition: util_old.h:213
#define const
Definition: zconf.h:196
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
ABC_DLL void Abc_NtkOrderCisCos(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:71
static void ** Vec_PtrArray(Vec_Ptr_t *p)
Definition: vecPtr.h:279
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
ABC_DLL void Abc_NtkPermute ( Abc_Ntk_t pNtk,
int  fInputs,
int  fOutputs,
int  fFlops,
char *  pFlopPermFile 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1906 of file abcNtk.c.

1907 {
1908  Abc_Obj_t * pTemp;
1909  Vec_Int_t * vInputs, * vOutputs, * vFlops, * vTemp;
1910  int i, k, Entry;
1911  // start permutation arrays
1912  if ( pFlopPermFile )
1913  {
1914  vFlops = Abc_NtkReadFlopPerm( pFlopPermFile, Abc_NtkLatchNum(pNtk) );
1915  if ( vFlops == NULL )
1916  return;
1917  fInputs = 0;
1918  fOutputs = 0;
1919  fFlops = 0;
1920  }
1921  else
1922  vFlops = Vec_IntStartNatural( Abc_NtkLatchNum(pNtk) );
1923  vInputs = Vec_IntStartNatural( Abc_NtkPiNum(pNtk) );
1924  vOutputs = Vec_IntStartNatural( Abc_NtkPoNum(pNtk) );
1925  // permute inputs
1926  if ( fInputs )
1927  for ( i = 0; i < Abc_NtkPiNum(pNtk); i++ )
1928  {
1929  k = rand() % Abc_NtkPiNum(pNtk);
1930  // swap indexes
1931  Entry = Vec_IntEntry( vInputs, i );
1932  Vec_IntWriteEntry( vInputs, i, Vec_IntEntry(vInputs, k) );
1933  Vec_IntWriteEntry( vInputs, k, Entry );
1934  // swap PIs
1935  pTemp = (Abc_Obj_t *)Vec_PtrEntry( pNtk->vPis, i );
1936  Vec_PtrWriteEntry( pNtk->vPis, i, Vec_PtrEntry(pNtk->vPis, k) );
1937  Vec_PtrWriteEntry( pNtk->vPis, k, pTemp );
1938  // swap CIs
1939  pTemp = (Abc_Obj_t *)Vec_PtrEntry( pNtk->vCis, i );
1940  Vec_PtrWriteEntry( pNtk->vCis, i, Vec_PtrEntry(pNtk->vCis, k) );
1941  Vec_PtrWriteEntry( pNtk->vCis, k, pTemp );
1942 //printf( "Swapping PIs %d and %d.\n", i, k );
1943  }
1944  // permute outputs
1945  if ( fOutputs )
1946  for ( i = 0; i < Abc_NtkPoNum(pNtk); i++ )
1947  {
1948  k = rand() % Abc_NtkPoNum(pNtk);
1949  // swap indexes
1950  Entry = Vec_IntEntry( vOutputs, i );
1951  Vec_IntWriteEntry( vOutputs, i, Vec_IntEntry(vOutputs, k) );
1952  Vec_IntWriteEntry( vOutputs, k, Entry );
1953  // swap POs
1954  pTemp = (Abc_Obj_t *)Vec_PtrEntry( pNtk->vPos, i );
1955  Vec_PtrWriteEntry( pNtk->vPos, i, Vec_PtrEntry(pNtk->vPos, k) );
1956  Vec_PtrWriteEntry( pNtk->vPos, k, pTemp );
1957  // swap COs
1958  pTemp = (Abc_Obj_t *)Vec_PtrEntry( pNtk->vCos, i );
1959  Vec_PtrWriteEntry( pNtk->vCos, i, Vec_PtrEntry(pNtk->vCos, k) );
1960  Vec_PtrWriteEntry( pNtk->vCos, k, pTemp );
1961 //printf( "Swapping POs %d and %d.\n", i, k );
1962  }
1963  // permute flops
1964  assert( Abc_NtkBoxNum(pNtk) == Abc_NtkLatchNum(pNtk) );
1965  if ( fFlops )
1966  for ( i = 0; i < Abc_NtkLatchNum(pNtk); i++ )
1967  {
1968  k = rand() % Abc_NtkLatchNum(pNtk);
1969  // swap indexes
1970  Entry = Vec_IntEntry( vFlops, i );
1971  Vec_IntWriteEntry( vFlops, i, Vec_IntEntry(vFlops, k) );
1972  Vec_IntWriteEntry( vFlops, k, Entry );
1973  // swap flops
1974  pTemp = (Abc_Obj_t *)Vec_PtrEntry( pNtk->vBoxes, i );
1975  Vec_PtrWriteEntry( pNtk->vBoxes, i, Vec_PtrEntry(pNtk->vBoxes, k) );
1976  Vec_PtrWriteEntry( pNtk->vBoxes, k, pTemp );
1977  // swap CIs
1978  pTemp = (Abc_Obj_t *)Vec_PtrEntry( pNtk->vCis, Abc_NtkPiNum(pNtk)+i );
1979  Vec_PtrWriteEntry( pNtk->vCis, Abc_NtkPiNum(pNtk)+i, Vec_PtrEntry(pNtk->vCis, Abc_NtkPiNum(pNtk)+k) );
1980  Vec_PtrWriteEntry( pNtk->vCis, Abc_NtkPiNum(pNtk)+k, pTemp );
1981  // swap COs
1982  pTemp = (Abc_Obj_t *)Vec_PtrEntry( pNtk->vCos, Abc_NtkPoNum(pNtk)+i );
1983  Vec_PtrWriteEntry( pNtk->vCos, Abc_NtkPoNum(pNtk)+i, Vec_PtrEntry(pNtk->vCos, Abc_NtkPoNum(pNtk)+k) );
1984  Vec_PtrWriteEntry( pNtk->vCos, Abc_NtkPoNum(pNtk)+k, pTemp );
1985 
1986 //printf( "Swapping flops %d and %d.\n", i, k );
1987  }
1988  // invert arrays
1989  vInputs = Vec_IntInvert( vTemp = vInputs, -1 );
1990  Vec_IntFree( vTemp );
1991  vOutputs = Vec_IntInvert( vTemp = vOutputs, -1 );
1992  Vec_IntFree( vTemp );
1993  vFlops = Vec_IntInvert( vTemp = vFlops, -1 );
1994  Vec_IntFree( vTemp );
1995  // pack the results into the output array
1996  Vec_IntFreeP( &pNtk->vObjPerm );
1997  pNtk->vObjPerm = Vec_IntAlloc( Abc_NtkPiNum(pNtk) + Abc_NtkPoNum(pNtk) + Abc_NtkLatchNum(pNtk) );
1998  Vec_IntForEachEntry( vInputs, Entry, i )
1999  Vec_IntPush( pNtk->vObjPerm, Entry );
2000  Vec_IntForEachEntry( vOutputs, Entry, i )
2001  Vec_IntPush( pNtk->vObjPerm, Entry );
2002  Vec_IntForEachEntry( vFlops, Entry, i )
2003  Vec_IntPush( pNtk->vObjPerm, Entry );
2004  // cleanup
2005  Vec_IntFree( vInputs );
2006  Vec_IntFree( vOutputs );
2007  Vec_IntFree( vFlops );
2008 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Vec_Ptr_t * vBoxes
Definition: abc.h:168
static int Abc_NtkBoxNum(Abc_Ntk_t *pNtk)
Definition: abc.h:289
static Vec_Int_t * Vec_IntInvert(Vec_Int_t *p, int Fill)
Definition: vecInt.h:1092
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
Vec_Ptr_t * vPis
Definition: abc.h:163
static Vec_Int_t * Vec_IntStartNatural(int nSize)
Definition: bblif.c:192
Vec_Int_t * vObjPerm
Definition: abc.h:212
Vec_Int_t * Abc_NtkReadFlopPerm(char *pFileName, int nFlops)
Definition: abcNtk.c:1859
Vec_Ptr_t * vCis
Definition: abc.h:165
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
Vec_Ptr_t * vPos
Definition: abc.h:164
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
Vec_Ptr_t * vCos
Definition: abc.h:166
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:286
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:285
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
ABC_DLL int Abc_NtkPhaseFrameNum ( Abc_Ntk_t pNtk)

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

Synopsis [Performs phase abstraction.]

Description []

SideEffects []

SeeAlso []

Definition at line 4002 of file abcDar.c.

4003 {
4004  extern int Saig_ManPhaseFrameNum( Aig_Man_t * p, Vec_Int_t * vInits );
4005  Vec_Int_t * vInits;
4006  Aig_Man_t * pMan;
4007  int nFrames;
4008  pMan = Abc_NtkToDar( pNtk, 0, 1 );
4009  if ( pMan == NULL )
4010  return 1;
4011  vInits = Abc_NtkGetLatchValues(pNtk);
4012  nFrames = Saig_ManPhaseFrameNum( pMan, vInits );
4013  Vec_IntFree( vInits );
4014  Aig_ManStop( pMan );
4015  return nFrames;
4016 }
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
int Saig_ManPhaseFrameNum(Aig_Man_t *p, Vec_Int_t *vInits)
Definition: saigPhase.c:841
Vec_Int_t * Abc_NtkGetLatchValues(Abc_Ntk_t *pNtk)
Definition: abcDar.c:1287
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Aig_Man_t * Abc_NtkToDar(Abc_Ntk_t *pNtk, int fExors, int fRegisters)
DECLARATIONS ///.
Definition: abcDar.c:233
static Abc_Obj_t* Abc_NtkPi ( Abc_Ntk_t pNtk,
int  i 
)
inlinestatic

Definition at line 315 of file abc.h.

315 { return (Abc_Obj_t *)Vec_PtrEntry( pNtk->vPis, i ); }
Vec_Ptr_t * vPis
Definition: abc.h:163
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Abc_NtkPiNum ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 285 of file abc.h.

285 { return Vec_PtrSize(pNtk->vPis); }
Vec_Ptr_t * vPis
Definition: abc.h:163
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static Abc_Obj_t* Abc_NtkPo ( Abc_Ntk_t pNtk,
int  i 
)
inlinestatic

Definition at line 316 of file abc.h.

316 { return (Abc_Obj_t *)Vec_PtrEntry( pNtk->vPos, i ); }
Vec_Ptr_t * vPos
Definition: abc.h:164
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Abc_NtkPoNum ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 286 of file abc.h.

286 { return Vec_PtrSize(pNtk->vPos); }
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Vec_Ptr_t * vPos
Definition: abc.h:164
ABC_DLL int Abc_NtkPrepareTwoNtks ( FILE *  pErr,
Abc_Ntk_t pNtk,
char **  argv,
int  argc,
Abc_Ntk_t **  ppNtk1,
Abc_Ntk_t **  ppNtk2,
int *  pfDelete1,
int *  pfDelete2 
)

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

Synopsis [Prepares two network for a two-argument command similar to "verify".]

Description []

SideEffects []

SeeAlso []

Definition at line 1481 of file abcUtil.c.

1483 {
1484  int fCheck = 1;
1485  FILE * pFile;
1486  Abc_Ntk_t * pNtk1, * pNtk2, * pNtkTemp;
1487  int util_optind = 0;
1488 
1489  *pfDelete1 = 0;
1490  *pfDelete2 = 0;
1491  if ( argc == util_optind )
1492  { // use the spec
1493  if ( pNtk == NULL )
1494  {
1495  fprintf( pErr, "Empty current network.\n" );
1496  return 0;
1497  }
1498  if ( pNtk->pSpec == NULL )
1499  {
1500  fprintf( pErr, "The external spec is not given.\n" );
1501  return 0;
1502  }
1503  pFile = fopen( pNtk->pSpec, "r" );
1504  if ( pFile == NULL )
1505  {
1506  fprintf( pErr, "Cannot open the external spec file \"%s\".\n", pNtk->pSpec );
1507  return 0;
1508  }
1509  else
1510  fclose( pFile );
1511  pNtk1 = Abc_NtkDup(pNtk);
1512  pNtk2 = Io_Read( pNtk->pSpec, Io_ReadFileType(pNtk->pSpec), fCheck, 0 );
1513  if ( pNtk2 == NULL )
1514  return 0;
1515  *pfDelete1 = 1;
1516  *pfDelete2 = 1;
1517  }
1518  else if ( argc == util_optind + 1 )
1519  {
1520  if ( pNtk == NULL )
1521  {
1522  fprintf( pErr, "Empty current network.\n" );
1523  return 0;
1524  }
1525  pNtk1 = Abc_NtkDup(pNtk);
1526  pNtk2 = Io_Read( argv[util_optind], Io_ReadFileType(argv[util_optind]), fCheck, 0 );
1527  if ( pNtk2 == NULL )
1528  return 0;
1529  *pfDelete1 = 1;
1530  *pfDelete2 = 1;
1531  }
1532  else if ( argc == util_optind + 2 )
1533  {
1534  pNtk1 = Io_Read( argv[util_optind], Io_ReadFileType(argv[util_optind]), fCheck, 0 );
1535  if ( pNtk1 == NULL )
1536  return 0;
1537  pNtk2 = Io_Read( argv[util_optind+1], Io_ReadFileType(argv[util_optind+1]), fCheck, 0 );
1538  if ( pNtk2 == NULL )
1539  {
1540  Abc_NtkDelete( pNtk1 );
1541  return 0;
1542  }
1543  *pfDelete1 = 1;
1544  *pfDelete2 = 1;
1545  }
1546  else
1547  {
1548  fprintf( pErr, "Wrong number of arguments.\n" );
1549  return 0;
1550  }
1551 
1552  // make sure the networks are strashed
1553  if ( !Abc_NtkIsStrash(pNtk1) )
1554  {
1555  pNtkTemp = Abc_NtkStrash( pNtk1, 0, 1, 0 );
1556  if ( *pfDelete1 )
1557  Abc_NtkDelete( pNtk1 );
1558  pNtk1 = pNtkTemp;
1559  *pfDelete1 = 1;
1560  }
1561  if ( !Abc_NtkIsStrash(pNtk2) )
1562  {
1563  pNtkTemp = Abc_NtkStrash( pNtk2, 0, 1, 0 );
1564  if ( *pfDelete2 )
1565  Abc_NtkDelete( pNtk2 );
1566  pNtk2 = pNtkTemp;
1567  *pfDelete2 = 1;
1568  }
1569 
1570  *ppNtk1 = pNtk1;
1571  *ppNtk2 = pNtk2;
1572  return 1;
1573 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
int util_optind
ABC_DLL Abc_Ntk_t * Abc_NtkStrash(Abc_Ntk_t *pNtk, int fAllNodes, int fCleanup, int fRecord)
Definition: abcStrash.c:265
ABC_DLL Abc_Ntk_t * Abc_NtkDup(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:419
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
Abc_Ntk_t * Io_Read(char *pFileName, Io_FileType_t FileType, int fCheck, int fBarBufs)
Definition: ioUtil.c:238
Io_FileType_t Io_ReadFileType(char *pFileName)
DECLARATIONS ///.
Definition: ioUtil.c:46
char * pSpec
Definition: abc.h:159
ABC_DLL void Abc_NtkPrintBoxInfo ( Abc_Ntk_t pNtk)

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

Synopsis [Prints information about boxes.]

Description []

SideEffects []

SeeAlso []

Definition at line 431 of file abcHie.c.

432 {
433  Vec_Ptr_t * vMods;
434  Abc_Ntk_t * pModel, * pBoxModel;
435  Abc_Obj_t * pObj;
436  Vec_Int_t * vCounts;
437  int i, k, Num;
438  if ( pNtk->pDesign == NULL || pNtk->pDesign->vModules == NULL )
439  {
440 // printf( "There is no hierarchy information.\n" );
441  return;
442  }
443  // sort models by name
444  vMods = pNtk->pDesign->vModules;
445  Vec_PtrSort( vMods, (int(*)())Abc_NtkCompareNames );
446 // Vec_PtrForEachEntry( Abc_Ntk_t *, vMods, pModel, i )
447 // printf( "%s\n", Abc_NtkName(pModel) );
448 
449  // swap the first model
450  Num = Vec_PtrFind( vMods, pNtk );
451  assert( Num >= 0 && Num < Vec_PtrSize(vMods) );
452  pBoxModel = (Abc_Ntk_t *)Vec_PtrEntry(vMods, 0);
453  Vec_PtrWriteEntry(vMods, 0, (Abc_Ntk_t *)Vec_PtrEntry(vMods, Num) );
454  Vec_PtrWriteEntry(vMods, Num, pBoxModel );
455 
456  // print models
457  vCounts = Vec_IntStart( Vec_PtrSize(vMods) );
458  Vec_PtrForEachEntry( Abc_Ntk_t *, vMods, pModel, i )
459  {
460  if ( Abc_NtkBoxNum(pModel) == 0 )
461  continue;
462  Vec_IntFill( vCounts, Vec_IntSize(vCounts), 0 );
463  Abc_NtkForEachBox( pModel, pObj, k )
464  {
465  pBoxModel = (Abc_Ntk_t *)pObj->pData;
466  if ( pBoxModel == NULL )
467  continue;
468  Num = Vec_PtrFind( vMods, pBoxModel );
469  assert( Num >= 0 && Num < Vec_PtrSize(vMods) );
470  Vec_IntAddToEntry( vCounts, Num, 1 );
471  }
472 
473 // Abc_NtkPrintStats( pModel, 0, 0, 0, 0, 0, 0, 0, 0 );
474  printf( "MODULE " );
475  printf( "%-30s : ", Abc_NtkName(pModel) );
476  printf( "PI=%6d ", Abc_NtkPiNum(pModel) );
477  printf( "PO=%6d ", Abc_NtkPoNum(pModel) );
478  printf( "BB=%6d ", Abc_NtkBoxNum(pModel) );
479  printf( "ND=%6d ", Abc_NtkNodeNum(pModel) ); // sans constants
480  printf( "Lev=%5d ", Abc_NtkLevel(pModel) );
481  printf( "\n" );
482 
483  Vec_IntForEachEntry( vCounts, Num, k )
484  if ( Num )
485  printf( "%15d : %s\n", Num, Abc_NtkName((Abc_Ntk_t *)Vec_PtrEntry(vMods, k)) );
486  }
487  Vec_IntFree( vCounts );
488  Vec_PtrForEachEntry( Abc_Ntk_t *, vMods, pModel, i )
489  {
490  if ( Abc_NtkBoxNum(pModel) != 0 )
491  continue;
492  printf( "MODULE " );
493  printf( "%-30s : ", Abc_NtkName(pModel) );
494  printf( "PI=%6d ", Abc_NtkPiNum(pModel) );
495  printf( "PO=%6d ", Abc_NtkPoNum(pModel) );
496  printf( "BB=%6d ", Abc_NtkBoxNum(pModel) );
497  printf( "ND=%6d ", Abc_NtkNodeNum(pModel) );
498  printf( "Lev=%5d ", Abc_NtkLevel(pModel) );
499  printf( "\n" );
500  }
501 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Abc_NtkBoxNum(Abc_Ntk_t *pNtk)
Definition: abc.h:289
static void Vec_PtrSort(Vec_Ptr_t *p, int(*Vec_PtrSortCompare)()) ___unused
Definition: vecPtr.h:851
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static int Vec_PtrFind(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:694
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
Definition: abc.h:293
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
static void Vec_IntAddToEntry(Vec_Int_t *p, int i, int Addition)
Definition: bblif.c:302
int Abc_NtkCompareNames(Abc_Ntk_t **p1, Abc_Ntk_t **p2)
Definition: abcHie.c:415
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
if(last==0)
Definition: sparse_int.h:34
#define Abc_NtkForEachBox(pNtk, pObj, i)
Definition: abc.h:495
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static char * Abc_NtkName(Abc_Ntk_t *pNtk)
Definition: abc.h:270
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:286
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:285
Vec_Ptr_t * vModules
Definition: abc.h:223
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
Abc_Des_t * pDesign
Definition: abc.h:180
ABC_DLL int Abc_NtkLevel(Abc_Ntk_t *pNtk)
Definition: abcDfs.c:1265
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
ABC_DLL void Abc_NtkPrintCiLevels ( Abc_Ntk_t pNtk)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 2228 of file abcUtil.c.

2229 {
2230  Abc_Obj_t * pObj;
2231  int i;
2232  Abc_NtkForEachCi( pNtk, pObj, i )
2233  printf( "%c=%d ", 'a'+i, pObj->Level );
2234  printf( "\n" );
2235 }
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
ABC_DLL void Abc_NtkPrintFactor ( FILE *  pFile,
Abc_Ntk_t pNtk,
int  fUseRealNames 
)

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

Synopsis [Prints the factored form of one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 805 of file abcPrint.c.

806 {
807  Abc_Obj_t * pNode;
808  int i;
809  assert( Abc_NtkIsSopLogic(pNtk) );
810  Abc_NtkForEachNode( pNtk, pNode, i )
811  Abc_NodePrintFactor( pFile, pNode, fUseRealNames );
812 }
static int Abc_NtkIsSopLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:264
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
void Abc_NodePrintFactor(FILE *pFile, Abc_Obj_t *pNode, int fUseRealNames)
Definition: abcPrint.c:825
#define assert(ex)
Definition: util_old.h:213
ABC_DLL void Abc_NtkPrintFanio ( FILE *  pFile,
Abc_Ntk_t pNtk,
int  fUsePis 
)

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

Synopsis [Prints the distribution of fanins/fanouts in the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 546 of file abcPrint.c.

547 {
548  Abc_Obj_t * pNode;
549  int i, k, nFanins, nFanouts;
550  Vec_Int_t * vFanins, * vFanouts;
551  int nOldSize, nNewSize;
552 
553  vFanins = Vec_IntAlloc( 0 );
554  vFanouts = Vec_IntAlloc( 0 );
555  Vec_IntFill( vFanins, 100, 0 );
556  Vec_IntFill( vFanouts, 100, 0 );
557  Abc_NtkForEachNode( pNtk, pNode, i )
558  {
559  nFanins = Abc_ObjFaninNum(pNode);
560  if ( Abc_NtkIsNetlist(pNtk) )
561  nFanouts = Abc_ObjFanoutNum( Abc_ObjFanout0(pNode) );
562  else
563  nFanouts = Abc_ObjFanoutNum(pNode);
564 // nFanouts = Abc_NodeMffcSize(pNode);
565  if ( nFanins > vFanins->nSize || nFanouts > vFanouts->nSize )
566  {
567  nOldSize = vFanins->nSize;
568  nNewSize = Abc_MaxInt(nFanins, nFanouts) + 10;
569  Vec_IntGrow( vFanins, nNewSize );
570  Vec_IntGrow( vFanouts, nNewSize );
571  for ( k = nOldSize; k < nNewSize; k++ )
572  {
573  Vec_IntPush( vFanins, 0 );
574  Vec_IntPush( vFanouts, 0 );
575  }
576  }
577  vFanins->pArray[nFanins]++;
578  vFanouts->pArray[nFanouts]++;
579  }
580  if ( fUsePis )
581  {
582  Vec_IntFill( vFanouts, Vec_IntSize(vFanouts), 0 );
583  Abc_NtkForEachCi( pNtk, pNode, i )
584  {
585  if ( Abc_NtkIsNetlist(pNtk) )
586  nFanouts = Abc_ObjFanoutNum( Abc_ObjFanout0(pNode) );
587  else
588  nFanouts = Abc_ObjFanoutNum(pNode);
589  vFanouts->pArray[nFanouts]++;
590  }
591  }
592  fprintf( pFile, "The distribution of fanins and fanouts in the network:\n" );
593  fprintf( pFile, " Number Nodes with fanin Nodes with fanout\n" );
594  for ( k = 0; k < vFanins->nSize; k++ )
595  {
596  if ( vFanins->pArray[k] == 0 && vFanouts->pArray[k] == 0 )
597  continue;
598  fprintf( pFile, "%5d : ", k );
599  if ( vFanins->pArray[k] == 0 )
600  fprintf( pFile, " " );
601  else
602  fprintf( pFile, "%12d ", vFanins->pArray[k] );
603  fprintf( pFile, " " );
604  if ( vFanouts->pArray[k] == 0 )
605  fprintf( pFile, " " );
606  else
607  fprintf( pFile, "%12d ", vFanouts->pArray[k] );
608  fprintf( pFile, "\n" );
609  }
610  Vec_IntFree( vFanins );
611  Vec_IntFree( vFanouts );
612 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static void Vec_IntGrow(Vec_Int_t *p, int nCapMin)
Definition: bblif.c:336
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371
ABC_DLL void Abc_NtkPrintFanioNew ( FILE *  pFile,
Abc_Ntk_t pNtk,
int  fMffc 
)

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

Synopsis [Prints the distribution of fanins/fanouts in the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 625 of file abcPrint.c.

626 {
627  char Buffer[100];
628  Abc_Obj_t * pNode;
629  Vec_Int_t * vFanins, * vFanouts;
630  int nFanins, nFanouts, nFaninsMax, nFanoutsMax, nFaninsAll, nFanoutsAll;
631  int i, k, nSizeMax;
632 
633  // determine the largest fanin and fanout
634  nFaninsMax = nFanoutsMax = 0;
635  nFaninsAll = nFanoutsAll = 0;
636  Abc_NtkForEachNode( pNtk, pNode, i )
637  {
638  if ( fMffc && Abc_ObjFanoutNum(pNode) == 1 )
639  continue;
640  nFanins = Abc_ObjFaninNum(pNode);
641  if ( Abc_NtkIsNetlist(pNtk) )
642  nFanouts = Abc_ObjFanoutNum( Abc_ObjFanout0(pNode) );
643  else if ( fMffc )
644  nFanouts = Abc_NodeMffcSize(pNode);
645  else
646  nFanouts = Abc_ObjFanoutNum(pNode);
647  nFaninsAll += nFanins;
648  nFanoutsAll += nFanouts;
649  nFaninsMax = Abc_MaxInt( nFaninsMax, nFanins );
650  nFanoutsMax = Abc_MaxInt( nFanoutsMax, nFanouts );
651  }
652 
653  // allocate storage for fanin/fanout numbers
654  nSizeMax = Abc_MaxInt( 10 * (Abc_Base10Log(nFaninsMax) + 1), 10 * (Abc_Base10Log(nFanoutsMax) + 1) );
655  vFanins = Vec_IntStart( nSizeMax );
656  vFanouts = Vec_IntStart( nSizeMax );
657 
658  // count the number of fanins and fanouts
659  Abc_NtkForEachNode( pNtk, pNode, i )
660  {
661  if ( fMffc && Abc_ObjFanoutNum(pNode) == 1 )
662  continue;
663  nFanins = Abc_ObjFaninNum(pNode);
664  if ( Abc_NtkIsNetlist(pNtk) )
665  nFanouts = Abc_ObjFanoutNum( Abc_ObjFanout0(pNode) );
666  else if ( fMffc )
667  nFanouts = Abc_NodeMffcSize(pNode);
668  else
669  nFanouts = Abc_ObjFanoutNum(pNode);
670 
671  if ( nFanins < 10 )
672  Vec_IntAddToEntry( vFanins, nFanins, 1 );
673  else if ( nFanins < 100 )
674  Vec_IntAddToEntry( vFanins, 10 + nFanins/10, 1 );
675  else if ( nFanins < 1000 )
676  Vec_IntAddToEntry( vFanins, 20 + nFanins/100, 1 );
677  else if ( nFanins < 10000 )
678  Vec_IntAddToEntry( vFanins, 30 + nFanins/1000, 1 );
679  else if ( nFanins < 100000 )
680  Vec_IntAddToEntry( vFanins, 40 + nFanins/10000, 1 );
681  else if ( nFanins < 1000000 )
682  Vec_IntAddToEntry( vFanins, 50 + nFanins/100000, 1 );
683  else if ( nFanins < 10000000 )
684  Vec_IntAddToEntry( vFanins, 60 + nFanins/1000000, 1 );
685 
686  if ( nFanouts < 10 )
687  Vec_IntAddToEntry( vFanouts, nFanouts, 1 );
688  else if ( nFanouts < 100 )
689  Vec_IntAddToEntry( vFanouts, 10 + nFanouts/10, 1 );
690  else if ( nFanouts < 1000 )
691  Vec_IntAddToEntry( vFanouts, 20 + nFanouts/100, 1 );
692  else if ( nFanouts < 10000 )
693  Vec_IntAddToEntry( vFanouts, 30 + nFanouts/1000, 1 );
694  else if ( nFanouts < 100000 )
695  Vec_IntAddToEntry( vFanouts, 40 + nFanouts/10000, 1 );
696  else if ( nFanouts < 1000000 )
697  Vec_IntAddToEntry( vFanouts, 50 + nFanouts/100000, 1 );
698  else if ( nFanouts < 10000000 )
699  Vec_IntAddToEntry( vFanouts, 60 + nFanouts/1000000, 1 );
700  }
701 
702  fprintf( pFile, "The distribution of fanins and fanouts in the network:\n" );
703  fprintf( pFile, " Number Nodes with fanin Nodes with fanout\n" );
704  for ( k = 0; k < nSizeMax; k++ )
705  {
706  if ( vFanins->pArray[k] == 0 && vFanouts->pArray[k] == 0 )
707  continue;
708  if ( k < 10 )
709  fprintf( pFile, "%15d : ", k );
710  else
711  {
712  sprintf( Buffer, "%d - %d", (int)pow((double)10, k/10) * (k%10), (int)pow((double)10, k/10) * (k%10+1) - 1 );
713  fprintf( pFile, "%15s : ", Buffer );
714  }
715  if ( vFanins->pArray[k] == 0 )
716  fprintf( pFile, " " );
717  else
718  fprintf( pFile, "%12d ", vFanins->pArray[k] );
719  fprintf( pFile, " " );
720  if ( vFanouts->pArray[k] == 0 )
721  fprintf( pFile, " " );
722  else
723  fprintf( pFile, "%12d ", vFanouts->pArray[k] );
724  fprintf( pFile, "\n" );
725  }
726  Vec_IntFree( vFanins );
727  Vec_IntFree( vFanouts );
728 
729  fprintf( pFile, "Fanins: Max = %d. Ave = %.2f. Fanouts: Max = %d. Ave = %.2f.\n",
730  nFaninsMax, 1.0*nFaninsAll/Abc_NtkNodeNum(pNtk),
731  nFanoutsMax, 1.0*nFanoutsAll/Abc_NtkNodeNum(pNtk) );
732 /*
733  Abc_NtkForEachCi( pNtk, pNode, i )
734  {
735  printf( "%d ", Abc_ObjFanoutNum(pNode) );
736  }
737  printf( "\n" );
738 */
739 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
Definition: abc.h:293
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
static void Vec_IntAddToEntry(Vec_Int_t *p, int i, int Addition)
Definition: bblif.c:302
static int Abc_Base10Log(unsigned n)
Definition: abc_global.h:252
ABC_DLL int Abc_NodeMffcSize(Abc_Obj_t *pNode)
FUNCTION DEFINITIONS ///.
Definition: abcRefs.c:48
char * sprintf()
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371
ABC_DLL void Abc_NtkPrintIo ( FILE *  pFile,
Abc_Ntk_t pNtk,
int  fPrintFlops 
)

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

Synopsis [Prints PIs/POs and LIs/LOs.]

Description []

SideEffects []

SeeAlso []

Definition at line 436 of file abcPrint.c.

437 {
438  Abc_Obj_t * pObj;
439  int i;
440 
441  fprintf( pFile, "Primary inputs (%d): ", Abc_NtkPiNum(pNtk) );
442  Abc_NtkForEachPi( pNtk, pObj, i )
443  fprintf( pFile, " %s", Abc_ObjName(pObj) );
444 // fprintf( pFile, " %s(%d)", Abc_ObjName(pObj), Abc_ObjFanoutNum(pObj) );
445  fprintf( pFile, "\n" );
446 
447  fprintf( pFile, "Primary outputs (%d):", Abc_NtkPoNum(pNtk) );
448  Abc_NtkForEachPo( pNtk, pObj, i )
449  fprintf( pFile, " %s", Abc_ObjName(pObj) );
450  fprintf( pFile, "\n" );
451 
452  if ( !fPrintFlops )
453  return;
454 
455  fprintf( pFile, "Latches (%d): ", Abc_NtkLatchNum(pNtk) );
456  Abc_NtkForEachLatch( pNtk, pObj, i )
457  fprintf( pFile, " %s(%s=%s)", Abc_ObjName(pObj),
459  fprintf( pFile, "\n" );
460 }
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
if(last==0)
Definition: sparse_int.h:34
#define Abc_NtkForEachLatch(pNtk, pObj, i)
Definition: abc.h:497
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:286
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:285
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
ABC_DLL void Abc_NtkPrintLatch ( FILE *  pFile,
Abc_Ntk_t pNtk 
)

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

Synopsis [Prints statistics about latches.]

Description []

SideEffects []

SeeAlso []

Definition at line 473 of file abcPrint.c.

474 {
475  Abc_Obj_t * pLatch, * pFanin;
476  int i, Counter0, Counter1, Counter2;
477  int InitNums[4], Init;
478 
479  assert( !Abc_NtkIsNetlist(pNtk) );
480  if ( Abc_NtkLatchNum(pNtk) == 0 )
481  {
482  fprintf( pFile, "The network is combinational.\n" );
483  return;
484  }
485 
486  for ( i = 0; i < 4; i++ )
487  InitNums[i] = 0;
488  Counter0 = Counter1 = Counter2 = 0;
489  Abc_NtkForEachLatch( pNtk, pLatch, i )
490  {
491  Init = Abc_LatchInit( pLatch );
492  assert( Init < 4 );
493  InitNums[Init]++;
494 
495  pFanin = Abc_ObjFanin0(Abc_ObjFanin0(pLatch));
496  if ( Abc_NtkIsLogic(pNtk) )
497  {
498  if ( !Abc_NodeIsConst(pFanin) )
499  continue;
500  }
501  else if ( Abc_NtkIsStrash(pNtk) )
502  {
503  if ( !Abc_AigNodeIsConst(pFanin) )
504  continue;
505  }
506  else
507  assert( 0 );
508 
509  // the latch input is a constant node
510  Counter0++;
511  if ( Abc_LatchIsInitDc(pLatch) )
512  {
513  Counter1++;
514  continue;
515  }
516  // count the number of cases when the constant is equal to the initial value
517  if ( Abc_NtkIsStrash(pNtk) )
518  {
519  if ( Abc_LatchIsInit1(pLatch) == !Abc_ObjFaninC0(pLatch) )
520  Counter2++;
521  }
522  else
523  {
525  Counter2++;
526  }
527  }
528 // fprintf( pFile, "%-15s: ", pNtk->pName );
529  fprintf( pFile, "Total latches = %5d. Init0 = %d. Init1 = %d. InitDC = %d. Const data = %d.\n",
530  Abc_NtkLatchNum(pNtk), InitNums[1], InitNums[2], InitNums[3], Counter0 );
531 // fprintf( pFile, "Const fanin = %3d. DC init = %3d. Matching init = %3d. ", Counter0, Counter1, Counter2 );
532 // fprintf( pFile, "Self-feed latches = %2d.\n", -1 ); //Abc_NtkCountSelfFeedLatches(pNtk) );
533 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static int Abc_LatchInit(Abc_Obj_t *pLatch)
Definition: abc.h:425
ABC_DLL int Abc_NodeIsConst(Abc_Obj_t *pNode)
Definition: abcObj.c:843
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
static int Abc_AigNodeIsConst(Abc_Obj_t *pNode)
Definition: abc.h:396
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_LatchIsInitDc(Abc_Obj_t *pLatch)
Definition: abc.h:424
#define Abc_NtkForEachLatch(pNtk, pObj, i)
Definition: abc.h:497
static int Abc_LatchIsInit1(Abc_Obj_t *pLatch)
Definition: abc.h:423
ABC_DLL int Abc_NodeIsConst1(Abc_Obj_t *pNode)
Definition: abcObj.c:890
#define assert(ex)
Definition: util_old.h:213
ABC_DLL void Abc_NtkPrintLevel ( FILE *  pFile,
Abc_Ntk_t pNtk,
int  fProfile,
int  fListNodes,
int  fVerbose 
)

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

Synopsis [Prints the level stats of the PO node.]

Description []

SideEffects []

SeeAlso []

Definition at line 866 of file abcPrint.c.

867 {
868  Abc_Obj_t * pNode;
869  int i, k, Length;
870 
871  if ( fListNodes )
872  {
873  int nLevels;
874  nLevels = Abc_NtkLevel(pNtk);
875  printf( "Nodes by level:\n" );
876  for ( i = 0; i <= nLevels; i++ )
877  {
878  printf( "%2d : ", i );
879  Abc_NtkForEachNode( pNtk, pNode, k )
880  if ( (int)pNode->Level == i )
881  printf( " %s", Abc_ObjName(pNode) );
882  printf( "\n" );
883  }
884  return;
885  }
886 
887  // print the delay profile
888  if ( fProfile && Abc_NtkHasMapping(pNtk) )
889  {
890  int nIntervals = 12;
891  float DelayMax, DelayCur, DelayDelta;
892  int * pLevelCounts;
893  int DelayInt, nOutsSum, nOutsTotal;
894 
895  // get the max delay and delta
896  DelayMax = Abc_NtkDelayTrace( pNtk, NULL, NULL, 0 );
897  DelayDelta = DelayMax/nIntervals;
898  // collect outputs by delay
899  pLevelCounts = ABC_ALLOC( int, nIntervals );
900  memset( pLevelCounts, 0, sizeof(int) * nIntervals );
901  Abc_NtkForEachCo( pNtk, pNode, i )
902  {
903  if ( Abc_ObjIsNode(Abc_ObjFanin0(pNode)) && Abc_ObjFaninNum(Abc_ObjFanin0(pNode)) == 0 )
904  DelayInt = 0;
905  else
906  {
907  DelayCur = Abc_NodeReadArrivalWorst( Abc_ObjFanin0(pNode) );
908  DelayInt = (int)(DelayCur / DelayDelta);
909  if ( DelayInt >= nIntervals )
910  DelayInt = nIntervals - 1;
911  }
912  pLevelCounts[DelayInt]++;
913  }
914 
915  nOutsSum = 0;
916  nOutsTotal = Abc_NtkCoNum(pNtk);
917  for ( i = 0; i < nIntervals; i++ )
918  {
919  nOutsSum += pLevelCounts[i];
920  printf( "[%8.2f - %8.2f] : COs = %4d. %5.1f %%\n",
921  DelayDelta * i, DelayDelta * (i+1), pLevelCounts[i], 100.0 * nOutsSum/nOutsTotal );
922  }
923  ABC_FREE( pLevelCounts );
924  return;
925  }
926  else if ( fProfile )
927  {
928  int LevelMax, * pLevelCounts;
929  int nOutsSum, nOutsTotal;
930 
931  if ( !Abc_NtkIsStrash(pNtk) )
932  Abc_NtkLevel(pNtk);
933 
934  LevelMax = 0;
935  Abc_NtkForEachCo( pNtk, pNode, i )
936  if ( LevelMax < (int)Abc_ObjFanin0(pNode)->Level )
937  LevelMax = Abc_ObjFanin0(pNode)->Level;
938  pLevelCounts = ABC_ALLOC( int, LevelMax + 1 );
939  memset( pLevelCounts, 0, sizeof(int) * (LevelMax + 1) );
940  Abc_NtkForEachCo( pNtk, pNode, i )
941  pLevelCounts[Abc_ObjFanin0(pNode)->Level]++;
942 
943  nOutsSum = 0;
944  nOutsTotal = Abc_NtkCoNum(pNtk);
945  for ( i = 0; i <= LevelMax; i++ )
946  if ( pLevelCounts[i] )
947  {
948  nOutsSum += pLevelCounts[i];
949  printf( "Level = %4d. COs = %4d. %5.1f %%\n", i, pLevelCounts[i], 100.0 * nOutsSum/nOutsTotal );
950  }
951  ABC_FREE( pLevelCounts );
952  return;
953  }
954  assert( Abc_NtkIsStrash(pNtk) );
955 
956  if ( fVerbose )
957  {
958  // find the longest name
959  Length = 0;
960  Abc_NtkForEachCo( pNtk, pNode, i )
961  if ( Length < (int)strlen(Abc_ObjName(pNode)) )
962  Length = strlen(Abc_ObjName(pNode));
963  if ( Length < 5 )
964  Length = 5;
965  // print stats for each output
966  Abc_NtkForEachCo( pNtk, pNode, i )
967  {
968  fprintf( pFile, "CO %4d : %*s ", i, Length, Abc_ObjName(pNode) );
969  Abc_NodePrintLevel( pFile, pNode );
970  }
971  }
972 }
char * memset()
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
ABC_DLL float Abc_NtkDelayTrace(Abc_Ntk_t *pNtk, Abc_Obj_t *pOut, Abc_Obj_t *pIn, int fPrint)
Definition: abcTiming.c:919
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
for(p=first;p->value< newval;p=p->next)
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
if(last==0)
Definition: sparse_int.h:34
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
ABC_DLL float Abc_NodeReadArrivalWorst(Abc_Obj_t *pNode)
Definition: abcTiming.c:95
#define ABC_FREE(obj)
Definition: abc_global.h:232
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
void Abc_NodePrintLevel(FILE *pFile, Abc_Obj_t *pNode)
Definition: abcPrint.c:985
#define assert(ex)
Definition: util_old.h:213
int strlen()
ABC_DLL int Abc_NtkLevel(Abc_Ntk_t *pNtk)
Definition: abcDfs.c:1265
ABC_DLL void Abc_NtkPrintSkews ( FILE *  pFile,
Abc_Ntk_t pNtk,
int  fPrintAll 
)
ABC_DLL void Abc_NtkPrintStats ( Abc_Ntk_t pNtk,
int  fFactored,
int  fSaveBest,
int  fDumpResult,
int  fUseLutLib,
int  fPrintMuxes,
int  fPower,
int  fGlitch,
int  fSkipBuf 
)

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

Synopsis [Print the vital stats of the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 207 of file abcPrint.c.

208 {
209  int nSingles = fSkipBuf ? Abc_NtkGetBufNum(pNtk) : 0;
210  if ( fPrintMuxes && Abc_NtkIsStrash(pNtk) )
211  {
212  extern int Abc_NtkCountMuxes( Abc_Ntk_t * pNtk );
213  int nXors = Abc_NtkGetExorNum(pNtk);
214  int nMuxs = Abc_NtkCountMuxes(pNtk) - nXors;
215  int nAnds = Abc_NtkNodeNum(pNtk) - (nMuxs + nXors) * 3 - nSingles;
216  Abc_Print( 1, "XMA stats: " );
217  Abc_Print( 1,"Xor =%7d (%6.2f %%) ", nXors, 300.0 * nXors / Abc_NtkNodeNum(pNtk) );
218  Abc_Print( 1,"Mux =%7d (%6.2f %%) ", nMuxs, 300.0 * nMuxs / Abc_NtkNodeNum(pNtk) );
219  Abc_Print( 1,"And =%7d (%6.2f %%)", nAnds, 100.0 * nAnds / Abc_NtkNodeNum(pNtk) );
220  Abc_Print( 1,"\n" );
221  return;
222  }
223  if ( fSaveBest )
225 /*
226  if ( fDumpResult )
227  {
228  char Buffer[1000] = {0};
229  const char * pNameGen = pNtk->pSpec? Extra_FileNameGeneric( pNtk->pSpec ) : "nameless_";
230  sprintf( Buffer, "%s_dump.blif", pNameGen );
231  Io_Write( pNtk, Buffer, IO_FILE_BLIF );
232  if ( pNtk->pSpec ) ABC_FREE( pNameGen );
233  }
234 */
235 
236 // if ( Abc_NtkIsStrash(pNtk) )
237 // Abc_AigCountNext( pNtk->pManFunc );
238 
239 #ifdef WIN32
240  SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), 15 ); // bright
241  Abc_Print( 1,"%-30s:", pNtk->pName );
242  SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), 7 ); // normal
243 #else
244  Abc_Print( 1,"%s%-30s:%s", "\033[1;37m", pNtk->pName, "\033[0m" ); // bright
245 #endif
246  Abc_Print( 1," i/o =%5d/%5d", Abc_NtkPiNum(pNtk), Abc_NtkPoNum(pNtk) );
247  if ( Abc_NtkConstrNum(pNtk) )
248  Abc_Print( 1,"(c=%d)", Abc_NtkConstrNum(pNtk) );
249  Abc_Print( 1," lat =%5d", Abc_NtkLatchNum(pNtk) );
250  if ( pNtk->nBarBufs )
251  Abc_Print( 1,"(b=%d)", pNtk->nBarBufs );
252  if ( Abc_NtkIsNetlist(pNtk) )
253  {
254  Abc_Print( 1," net =%5d", Abc_NtkNetNum(pNtk) );
255  Abc_Print( 1," nd =%5d", Abc_NtkNodeNum(pNtk) - nSingles );
256  Abc_Print( 1," wbox =%3d", Abc_NtkWhiteboxNum(pNtk) );
257  Abc_Print( 1," bbox =%3d", Abc_NtkBlackboxNum(pNtk) );
258  }
259  else if ( Abc_NtkIsStrash(pNtk) )
260  {
261  Abc_Print( 1," and =%7d", Abc_NtkNodeNum(pNtk) );
262  if ( Abc_NtkGetChoiceNum(pNtk) )
263  Abc_Print( 1," (choice = %d)", Abc_NtkGetChoiceNum(pNtk) );
264  }
265  else
266  {
267  Abc_Print( 1," nd =%6d", Abc_NtkNodeNum(pNtk) - nSingles );
268  Abc_Print( 1," edge =%7d", Abc_NtkGetTotalFanins(pNtk) - nSingles );
269  }
270 
271  if ( Abc_NtkIsStrash(pNtk) || Abc_NtkIsNetlist(pNtk) )
272  {
273  }
274  else if ( Abc_NtkHasSop(pNtk) )
275  {
276 
277  Abc_Print( 1," cube =%6d", Abc_NtkGetCubeNum(pNtk) - nSingles );
278  if ( fFactored )
279  Abc_Print( 1," lit(sop) =%6d", Abc_NtkGetLitNum(pNtk) - nSingles );
280  if ( fFactored )
281  Abc_Print( 1," lit(fac) =%6d", Abc_NtkGetLitFactNum(pNtk) - nSingles );
282  }
283  else if ( Abc_NtkHasAig(pNtk) )
284  Abc_Print( 1," aig =%6d", Abc_NtkGetAigNodeNum(pNtk) - nSingles );
285  else if ( Abc_NtkHasBdd(pNtk) )
286  Abc_Print( 1," bdd =%6d", Abc_NtkGetBddNodeNum(pNtk) - nSingles );
287  else if ( Abc_NtkHasMapping(pNtk) )
288  {
289  assert( pNtk->pManFunc == Abc_FrameReadLibGen() );
290  Abc_Print( 1," area =%5.2f", Abc_NtkGetMappedArea(pNtk) );
291  Abc_Print( 1," delay =%5.2f", Abc_NtkDelayTrace(pNtk, NULL, NULL, 0) );
292  if ( pNtk->pManTime )
293  Abc_ManTimeStop( pNtk->pManTime );
294  pNtk->pManTime = NULL;
295  }
296  else if ( !Abc_NtkHasBlackbox(pNtk) )
297  {
298  assert( 0 );
299  }
300 
301  if ( Abc_NtkIsStrash(pNtk) )
302  {
303  extern int Abc_NtkGetMultiRefNum( Abc_Ntk_t * pNtk );
304  Abc_Print( 1," lev =%3d", Abc_AigLevel(pNtk) );
305 // Abc_Print( 1," ff = %5d", Abc_NtkNodeNum(pNtk) + 2 * (Abc_NtkCoNum(pNtk)+Abc_NtkGetMultiRefNum(pNtk)) );
306 // Abc_Print( 1," var = %5d", Abc_NtkCiNum(pNtk) + Abc_NtkCoNum(pNtk)+Abc_NtkGetMultiRefNum(pNtk) );
307  }
308  else
309  Abc_Print( 1," lev = %d", Abc_NtkLevel(pNtk) );
310  if ( pNtk->nBarBufs2 )
311  Abc_Print( 1," buf = %d", pNtk->nBarBufs2 );
312  if ( fUseLutLib && Abc_FrameReadLibLut() )
313  Abc_Print( 1," delay =%5.2f", Abc_NtkDelayTraceLut(pNtk, 1) );
314  if ( fUseLutLib && Abc_FrameReadLibLut() )
315  Abc_Print( 1," area =%5.2f", Abc_NtkGetArea(pNtk) );
316  if ( fPower )
317  Abc_Print( 1," power =%7.2f", Abc_NtkMfsTotalSwitching(pNtk) );
318  if ( fGlitch )
319  {
320  extern float Abc_NtkMfsTotalGlitching( Abc_Ntk_t * pNtk );
321  if ( Abc_NtkIsLogic(pNtk) && Abc_NtkGetFaninMax(pNtk) <= 6 )
322  Abc_Print( 1," glitch =%7.2f %%", Abc_NtkMfsTotalGlitching(pNtk) );
323  else
324  printf( "\nCurrently computes glitching only for K-LUT networks with K <= 6." );
325  }
326  Abc_Print( 1,"\n" );
327 
328  // print the statistic into a file
329  if ( fDumpResult )
330  {
331  FILE * pTable = fopen( "abcstats.txt", "a+" );
332  fprintf( pTable, "%s ", pNtk->pName );
333  fprintf( pTable, "%d ", Abc_NtkPiNum(pNtk) );
334  fprintf( pTable, "%d ", Abc_NtkPoNum(pNtk) );
335  fprintf( pTable, "%d ", Abc_NtkNodeNum(pNtk) );
336  fprintf( pTable, "%d ", Abc_NtkGetTotalFanins(pNtk) );
337  fprintf( pTable, "%d ", Abc_NtkLevel(pNtk) );
338  fprintf( pTable, "\n" );
339  fclose( pTable );
340  }
341 /*
342  {
343  FILE * pTable;
344  pTable = fopen( "ibm/seq_stats.txt", "a+" );
345 // fprintf( pTable, "%s ", pNtk->pName );
346 // fprintf( pTable, "%d ", Abc_NtkPiNum(pNtk) );
347 // fprintf( pTable, "%d ", Abc_NtkPoNum(pNtk) );
348  fprintf( pTable, "%d ", Abc_NtkNodeNum(pNtk) );
349  fprintf( pTable, "%d ", Abc_NtkLatchNum(pNtk) );
350  fprintf( pTable, "%d ", Abc_NtkLevel(pNtk) );
351  fprintf( pTable, "\n" );
352  fclose( pTable );
353  }
354 */
355 
356 /*
357  // print the statistic into a file
358  {
359  FILE * pTable;
360  pTable = fopen( "ucsb/stats.txt", "a+" );
361 // fprintf( pTable, "%s ", pNtk->pSpec );
362  fprintf( pTable, "%d ", Abc_NtkNodeNum(pNtk) );
363 // fprintf( pTable, "%d ", Abc_NtkLevel(pNtk) );
364 // fprintf( pTable, "%.0f ", Abc_NtkGetMappedArea(pNtk) );
365 // fprintf( pTable, "%.2f ", Abc_NtkDelayTrace(pNtk) );
366  fprintf( pTable, "\n" );
367  fclose( pTable );
368  }
369 */
370 
371 /*
372  // print the statistic into a file
373  {
374  FILE * pTable;
375  pTable = fopen( "x/stats_new.txt", "a+" );
376  fprintf( pTable, "%s ", pNtk->pName );
377 // fprintf( pTable, "%d ", Abc_NtkPiNum(pNtk) );
378 // fprintf( pTable, "%d ", Abc_NtkPoNum(pNtk) );
379 // fprintf( pTable, "%d ", Abc_NtkLevel(pNtk) );
380 // fprintf( pTable, "%d ", Abc_NtkNodeNum(pNtk) );
381 // fprintf( pTable, "%d ", Abc_NtkGetTotalFanins(pNtk) );
382 // fprintf( pTable, "%d ", Abc_NtkLatchNum(pNtk) );
383 // fprintf( pTable, "%.2f ", (float)(s_MappingMem)/(float)(1<<20) );
384  fprintf( pTable, "%.2f", (float)(s_MappingTime)/(float)(CLOCKS_PER_SEC) );
385 // fprintf( pTable, "%.2f", (float)(s_ResynTime)/(float)(CLOCKS_PER_SEC) );
386  fprintf( pTable, "\n" );
387  fclose( pTable );
388 
389  s_ResynTime = 0;
390  }
391 */
392 
393 /*
394  // print the statistic into a file
395  {
396  static int Counter = 0;
397  extern int timeRetime;
398  FILE * pTable;
399  Counter++;
400  pTable = fopen( "d/stats.txt", "a+" );
401  fprintf( pTable, "%s ", pNtk->pName );
402 // fprintf( pTable, "%d ", Abc_NtkPiNum(pNtk) );
403 // fprintf( pTable, "%d ", Abc_NtkPoNum(pNtk) );
404 // fprintf( pTable, "%d ", Abc_NtkLatchNum(pNtk) );
405  fprintf( pTable, "%d ", Abc_NtkNodeNum(pNtk) );
406  fprintf( pTable, "%.2f ", (float)(timeRetime)/(float)(CLOCKS_PER_SEC) );
407  fprintf( pTable, "\n" );
408  fclose( pTable );
409  }
410 
411 
412  s_TotalNodes += Abc_NtkNodeNum(pNtk);
413  printf( "Total nodes = %6d %6.2f MB Changes = %6d.\n",
414  s_TotalNodes, s_TotalNodes * 20.0 / (1<<20), s_TotalChanges );
415 */
416 
417 // if ( Abc_NtkHasSop(pNtk) )
418 // printf( "The total number of cube pairs = %d.\n", Abc_NtkGetCubePairNum(pNtk) );
419 
420  fflush( stdout );
421  if ( pNtk->pExdc )
422  Abc_NtkPrintStats( pNtk->pExdc, fFactored, fSaveBest, fDumpResult, fUseLutLib, fPrintMuxes, fPower, fGlitch, fSkipBuf );
423 }
ABC_DLL int Abc_NtkGetBufNum(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:410
int Abc_NtkCompareAndSaveBest(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcPrint.c:66
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
ABC_DLL void * Abc_FrameReadLibGen()
Definition: mainFrame.c:56
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
ABC_DLL int Abc_NtkGetExorNum(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:370
ABC_DLL float Abc_NtkDelayTrace(Abc_Ntk_t *pNtk, Abc_Obj_t *pOut, Abc_Obj_t *pIn, int fPrint)
Definition: abcTiming.c:919
ABC_DLL double Abc_NtkGetMappedArea(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:334
Abc_Ntk_t * pExdc
Definition: abc.h:201
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
float Abc_NtkMfsTotalSwitching(Abc_Ntk_t *pNtk)
Definition: abcPrint.c:132
void Abc_NtkPrintStats(Abc_Ntk_t *pNtk, int fFactored, int fSaveBest, int fDumpResult, int fUseLutLib, int fPrintMuxes, int fPower, int fGlitch, int fSkipBuf)
Definition: abcPrint.c:207
int nBarBufs2
Definition: abc.h:175
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
ABC_DLL int Abc_NtkGetFaninMax(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:453
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
float Abc_NtkGetArea(Abc_Ntk_t *pNtk)
Definition: abcPrint.c:179
ABC_DLL int Abc_NtkGetCubeNum(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:112
static int Abc_NtkWhiteboxNum(Abc_Ntk_t *pNtk)
Definition: abc.h:295
ABC_DLL int Abc_NtkGetTotalFanins(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:487
ABC_DLL float Abc_NtkDelayTraceLut(Abc_Ntk_t *pNtk, int fUseLutLib)
Definition: abcSpeedup.c:100
ABC_DLL int Abc_NtkGetChoiceNum(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:430
ABC_DLL int Abc_NtkGetBddNodeNum(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:240
void * pManFunc
Definition: abc.h:191
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
Definition: abc.h:293
ABC_DLL int Abc_NtkGetAigNodeNum(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:266
static int Abc_NtkHasBlackbox(Abc_Ntk_t *pNtk)
Definition: abc.h:258
ABC_DLL int Abc_AigLevel(Abc_Ntk_t *pNtk)
Definition: abcAig.c:292
int Abc_NtkCountMuxes(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:1336
ABC_DLL int Abc_NtkGetLitFactNum(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:189
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static int Abc_NtkConstrNum(Abc_Ntk_t *pNtk)
Definition: abc.h:299
ABC_DLL void Abc_ManTimeStop(Abc_ManTime_t *p)
Definition: abcTiming.c:455
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:286
int nBarBufs
Definition: abc.h:174
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:285
Abc_ManTime_t * pManTime
Definition: abc.h:192
ABC_DLL int Abc_NtkGetLitNum(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:165
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
static int Abc_NtkBlackboxNum(Abc_Ntk_t *pNtk)
Definition: abc.h:296
ABC_DLL int Abc_NtkLevel(Abc_Ntk_t *pNtk)
Definition: abcDfs.c:1265
float Abc_NtkMfsTotalGlitching(Abc_Ntk_t *pNtk)
Definition: abcPrint.c:1439
ABC_DLL void * Abc_FrameReadLibLut()
Definition: mainFrame.c:54
char * pName
Definition: abc.h:158
int Abc_NtkGetMultiRefNum(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:218
static int Abc_NtkNetNum(Abc_Ntk_t *pNtk)
Definition: abc.h:292
ABC_DLL Abc_Time_t* Abc_NtkReadDefaultArrival ( Abc_Ntk_t pNtk)

FUNCTION DEFINITIONS ///.

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

Synopsis [Reads the arrival.required time of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 67 of file abcTiming.c.

68 {
69  assert( pNtk->pManTime );
70  return &pNtk->pManTime->tArrDef;
71 }
Abc_Time_t tArrDef
Definition: abcTiming.c:34
Abc_ManTime_t * pManTime
Definition: abc.h:192
#define assert(ex)
Definition: util_old.h:213
ABC_DLL Abc_Time_t* Abc_NtkReadDefaultInputDrive ( Abc_Ntk_t pNtk)

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

Synopsis [Reads the input drive / output load of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 115 of file abcTiming.c.

116 {
117  assert( pNtk->pManTime );
118  return &pNtk->pManTime->tInDriveDef;
119 }
Abc_Time_t tInDriveDef
Definition: abcTiming.c:38
Abc_ManTime_t * pManTime
Definition: abc.h:192
#define assert(ex)
Definition: util_old.h:213
ABC_DLL Abc_Time_t* Abc_NtkReadDefaultOutputLoad ( Abc_Ntk_t pNtk)

Definition at line 120 of file abcTiming.c.

121 {
122  assert( pNtk->pManTime );
123  return &pNtk->pManTime->tOutLoadDef;
124 }
Abc_ManTime_t * pManTime
Definition: abc.h:192
#define assert(ex)
Definition: util_old.h:213
Abc_Time_t tOutLoadDef
Definition: abcTiming.c:39
ABC_DLL Abc_Time_t* Abc_NtkReadDefaultRequired ( Abc_Ntk_t pNtk)

Definition at line 72 of file abcTiming.c.

73 {
74  assert( pNtk->pManTime );
75  return &pNtk->pManTime->tReqDef;
76 }
Abc_ManTime_t * pManTime
Definition: abc.h:192
#define assert(ex)
Definition: util_old.h:213
Abc_Time_t tReqDef
Definition: abcTiming.c:35
ABC_DLL void Abc_NtkReassignIds ( Abc_Ntk_t pNtk)

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

Synopsis [Puts the nodes into the DFS order and reassign their IDs.]

Description []

SideEffects []

SeeAlso []

Definition at line 1769 of file abcUtil.c.

1770 {
1771  Vec_Ptr_t * vNodes;
1772  Vec_Ptr_t * vObjsNew;
1773  Abc_Obj_t * pNode, * pTemp, * pConst1;
1774  int i, k;
1775  assert( Abc_NtkIsStrash(pNtk) );
1776 //printf( "Total = %d. Current = %d.\n", Abc_NtkObjNumMax(pNtk), Abc_NtkObjNum(pNtk) );
1777  // start the array of objects with new IDs
1778  vObjsNew = Vec_PtrAlloc( pNtk->nObjs );
1779  // put constant node first
1780  pConst1 = Abc_AigConst1(pNtk);
1781  assert( pConst1->Id == 0 );
1782  Vec_PtrPush( vObjsNew, pConst1 );
1783  // put PI nodes next
1784  Abc_NtkForEachPi( pNtk, pNode, i )
1785  {
1786  pNode->Id = Vec_PtrSize( vObjsNew );
1787  Vec_PtrPush( vObjsNew, pNode );
1788  }
1789  // put PO nodes next
1790  Abc_NtkForEachPo( pNtk, pNode, i )
1791  {
1792  pNode->Id = Vec_PtrSize( vObjsNew );
1793  Vec_PtrPush( vObjsNew, pNode );
1794  }
1795  // put latches and their inputs/outputs next
1796  Abc_NtkForEachBox( pNtk, pNode, i )
1797  {
1798  pNode->Id = Vec_PtrSize( vObjsNew );
1799  Vec_PtrPush( vObjsNew, pNode );
1800  Abc_ObjForEachFanin( pNode, pTemp, k )
1801  {
1802  pTemp->Id = Vec_PtrSize( vObjsNew );
1803  Vec_PtrPush( vObjsNew, pTemp );
1804  }
1805  Abc_ObjForEachFanout( pNode, pTemp, k )
1806  {
1807  pTemp->Id = Vec_PtrSize( vObjsNew );
1808  Vec_PtrPush( vObjsNew, pTemp );
1809  }
1810  }
1811  // finally, internal nodes in the DFS order
1812  vNodes = Abc_AigDfs( pNtk, 1, 0 );
1813  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pNode, i )
1814  {
1815  if ( pNode == pConst1 )
1816  continue;
1817  pNode->Id = Vec_PtrSize( vObjsNew );
1818  Vec_PtrPush( vObjsNew, pNode );
1819  }
1820  Vec_PtrFree( vNodes );
1821  assert( Vec_PtrSize(vObjsNew) == pNtk->nObjs );
1822 
1823  // update the fanin/fanout arrays
1824  Abc_NtkForEachObj( pNtk, pNode, i )
1825  {
1826  Abc_ObjForEachFanin( pNode, pTemp, k )
1827  pNode->vFanins.pArray[k] = pTemp->Id;
1828  Abc_ObjForEachFanout( pNode, pTemp, k )
1829  pNode->vFanouts.pArray[k] = pTemp->Id;
1830  }
1831 
1832  // replace the array of objs
1833  Vec_PtrFree( pNtk->vObjs );
1834  pNtk->vObjs = vObjsNew;
1835 
1836  // rehash the AIG
1837  Abc_AigRehash( (Abc_Aig_t *)pNtk->pManFunc );
1838 
1839  // update the name manager!!!
1840 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
ABC_DLL void Abc_AigRehash(Abc_Aig_t *pMan)
Definition: abcAig.c:628
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
DECLARATIONS ///.
Definition: abcAig.c:52
int nObjs
Definition: abc.h:172
#define Abc_NtkForEachBox(pNtk, pObj, i)
Definition: abc.h:495
ABC_DLL Vec_Ptr_t * Abc_AigDfs(Abc_Ntk_t *pNtk, int fCollectAll, int fCollectCos)
Definition: abcDfs.c:1014
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition: abc.h:526
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
int Id
Definition: abc.h:132
#define assert(ex)
Definition: util_old.h:213
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL void Abc_NtkRecAdd3 ( Abc_Ntk_t pNtk,
int  fUseSOPB 
)

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

Synopsis [Top level procedure for library construction.]

Description []

SideEffects []

SeeAlso []

Definition at line 833 of file abcRec3.c.

834 {
835  extern Abc_Ntk_t * Abc_NtkIf( Abc_Ntk_t * pNtk, If_Par_t * pPars );
836  If_Par_t Pars, * pPars = &Pars;
837  Abc_Ntk_t * pNtkNew;
838  int clk = Abc_Clock();
839  if ( Abc_NtkGetChoiceNum( pNtk ) )
840  printf( "Performing recoding structures with choices.\n" );
841  // remember that the manager was used for library construction
842  s_pMan3->fLibConstr = 1;
843  // create hash table if not available
844  if ( s_pMan3->pGia && s_pMan3->pGia->pHTable == NULL )
846 
847  // set defaults
848  memset( pPars, 0, sizeof(If_Par_t) );
849  // user-controlable paramters
850  pPars->nLutSize = s_pMan3->nVars;
851  pPars->nCutsMax = s_pMan3->nCuts;
852  pPars->DelayTarget = -1;
853  pPars->Epsilon = (float)0.005;
854  pPars->fArea = 1;
855  // internal parameters
856  if ( fUseSOPB )
857  {
858  pPars->fTruth = 1;
859  pPars->fCutMin = 0;
860  pPars->fUsePerm = 1;
861  pPars->fDelayOpt = 1;
862  }
863  else
864  {
865  pPars->fTruth = 1;
866  pPars->fCutMin = 1;
867  pPars->fUsePerm = 0;
868  pPars->fDelayOpt = 0;
869  }
870  pPars->fSkipCutFilter = 0;
871  pPars->pFuncCost = NULL;
872  pPars->pFuncUser = Abc_NtkRecAddCut3;
873  // perform recording
874  pNtkNew = Abc_NtkIf( pNtk, pPars );
875  Abc_NtkDelete( pNtkNew );
876 s_pMan3->timeTotal += Abc_Clock() - clk;
877 }
char * memset()
int nLutSize
Definition: if.h:103
int * pHTable
Definition: gia.h:110
Definition: if.h:100
int fSkipCutFilter
Definition: if.h:144
Gia_Man_t * pGia
Definition: abcRec3.c:58
Abc_Ntk_t * Abc_NtkIf(Abc_Ntk_t *pNtk, If_Par_t *pPars)
Definition: abcIf.c:106
abctime timeTotal
Definition: abcRec3.c:93
int(* pFuncCost)(If_Man_t *, If_Cut_t *)
Definition: if.h:163
static abctime Abc_Clock()
Definition: abc_global.h:279
int(* pFuncUser)(If_Man_t *, If_Obj_t *, If_Cut_t *)
Definition: if.h:164
ABC_DLL int Abc_NtkGetChoiceNum(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:430
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
int fUsePerm
Definition: if.h:147
int fTruth
Definition: if.h:146
void Gia_ManHashStart(Gia_Man_t *p)
Definition: giaHash.c:117
float Epsilon
Definition: if.h:110
int Abc_NtkRecAddCut3(If_Man_t *pIfMan, If_Obj_t *pRoot, If_Cut_t *pCut)
Definition: abcRec3.c:691
float DelayTarget
Definition: if.h:109
int fDelayOpt
Definition: if.h:121
int fCutMin
Definition: if.h:120
static Lms_Man_t * s_pMan3
Definition: abcRec3.c:96
int nCutsMax
Definition: if.h:104
int fLibConstr
Definition: abcRec3.c:56
int nVars
Definition: abcRec3.c:52
int nCuts
Definition: abcRec3.c:54
int fArea
Definition: if.h:114
ABC_DLL Gia_Man_t* Abc_NtkRecGetGia3 ( )

Definition at line 1399 of file abcRec3.c.

1400 {
1401  abctime clk = Abc_Clock();
1402  printf( "Before normalizing: Library has %d classes and %d AIG subgraphs with %d AND nodes.\n",
1405  printf( "After normalizing: Library has %d classes and %d AIG subgraphs with %d AND nodes.\n",
1407  Abc_PrintTime( 1, "Normalization runtime", Abc_Clock() - clk );
1408  s_pMan3->fLibConstr = 0;
1409  return s_pMan3->pGia;
1410 }
Vec_Mem_t * vTtMem
Definition: abcRec3.c:59
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
Gia_Man_t * pGia
Definition: abcRec3.c:58
static int Vec_MemEntryNum(Vec_Mem_t *p)
Definition: vecMem.h:151
static abctime Abc_Clock()
Definition: abc_global.h:279
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
void Lms_GiaNormalize(Lms_Man_t *p)
Definition: abcRec3.c:1277
static Lms_Man_t * s_pMan3
Definition: abcRec3.c:96
int fLibConstr
Definition: abcRec3.c:56
ABC_INT64_T abctime
Definition: abc_global.h:278
ABC_DLL int Abc_NtkRecInputNum3 ( )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1391 of file abcRec3.c.

1392 {
1393  return Gia_ManCiNum(s_pMan3->pGia);
1394 }
Gia_Man_t * pGia
Definition: abcRec3.c:58
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
static Lms_Man_t * s_pMan3
Definition: abcRec3.c:96
ABC_DLL int Abc_NtkRecIsRunning3 ( )

Definition at line 1395 of file abcRec3.c.

1396 {
1397  return s_pMan3 != NULL;
1398 }
static Lms_Man_t * s_pMan3
Definition: abcRec3.c:96
ABC_DLL void Abc_NtkRecLibMerge3 ( Gia_Man_t pLib)

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

Synopsis [Recanonicizes the library and add it to the current library.]

Description []

SideEffects []

SeeAlso []

Definition at line 567 of file abcRec3.c.

568 {
569  int fCheck = 0;
570  Lms_Man_t * p = s_pMan3;
571  Gia_Man_t * pGia = p->pGia;
572  Vec_Str_t * vSupps;
573  char pCanonPerm[LMS_VAR_MAX];
574  unsigned uCanonPhase;
575  word * pTruth;
576  int i, k, Index, iFanin0, iFanin1, nLeaves;
577  Gia_Obj_t * pObjPo, * pDriver, * pTemp = NULL;
578  abctime clk, clk2 = Abc_Clock();
579 
580  if ( Gia_ManCiNum(pLib) != Gia_ManCiNum(pGia) )
581  {
582  printf( "The number of Library inputs (%d) differs from the number of Gia inputs (%d).\n", Gia_ManCiNum(pLib), Gia_ManCiNum(pGia) );
583  return;
584  }
585  assert( Gia_ManCiNum(pLib) == Gia_ManCiNum(pGia) );
586 
587  // create hash table if not available
588  if ( pGia->pHTable == NULL )
589  Gia_ManHashStart( pGia );
590 
591  // add AIG subgraphs
592  vSupps = Lms_GiaSuppSizes( pLib );
593  Gia_ManForEachCo( pLib, pObjPo, k )
594  {
595  // get support size
596  nLeaves = Vec_StrEntry(vSupps, k);
597  assert( nLeaves > 1 );
598 
599  // compute the truth table
600 clk = Abc_Clock();
601  pTruth = Gia_ObjComputeTruthTable( pLib, Gia_ObjFanin0(pObjPo) );
602 p->timeTruth += Abc_Clock() - clk;
603  // semi-canonicize
604 clk = Abc_Clock();
605  memcpy( p->pTemp1, pTruth, p->nWords * sizeof(word) );
606 #ifdef LMS_USE_OLD_FORM
607  uCanonPhase = Kit_TruthSemiCanonicize( (unsigned *)p->pTemp1, (unsigned *)p->pTemp2, nLeaves, pCanonPerm );
608 #else
609  uCanonPhase = Abc_TtCanonicize( p->pTemp1, nLeaves, pCanonPerm );
610 #endif
611  Abc_TtStretch5( (unsigned *)p->pTemp1, nLeaves, p->nVars );
612 p->timeCanon += Abc_Clock() - clk;
613  // pCanonPerm and uCanonPhase show what was the variable corresponding to each var in the current truth
614  if ( nLeaves == 2 && Abc_TtSupportSize(pTruth, 2) != 2 )
615  continue;
616 
617 clk = Abc_Clock();
618  // map cut leaves into elementary variables of GIA
619  for ( i = 0; i < nLeaves; i++ )
620  Gia_ManCi( pLib, pCanonPerm[i] )->Value = Abc_Var2Lit( Gia_ObjId(pGia, Gia_ManPi(pGia, i)), (uCanonPhase >> i) & 1 );
621  // build internal nodes
622  assert( Vec_IntSize(pLib->vTtNodes) > 0 );
623  Gia_ManForEachObjVec( pLib->vTtNodes, pLib, pTemp, i )
624  {
625  iFanin0 = Abc_LitNotCond( Gia_ObjFanin0(pTemp)->Value, Gia_ObjFaninC0(pTemp) );
626  iFanin1 = Abc_LitNotCond( Gia_ObjFanin1(pTemp)->Value, Gia_ObjFaninC1(pTemp) );
627  pTemp->Value = Gia_ManHashAnd( pGia, iFanin0, iFanin1 );
628  }
629 p->timeBuild += Abc_Clock() - clk;
630 
631  // check if this node is already driving a PO
632  assert( Gia_ObjIsAnd(pTemp) );
633  pDriver = Gia_ManObj(pGia, Abc_Lit2Var(pTemp->Value));
634  if ( pDriver->fMark1 )
635  {
636  p->nFilterSame++;
637  continue;
638  }
639  pDriver->fMark1 = 1;
640  // create output
641  Gia_ManAppendCo( pGia, Abc_LitNotCond( pTemp->Value, (uCanonPhase >> nLeaves) & 1 ) );
642 
643  // verify truth table
644  if ( fCheck )
645  {
646 clk = Abc_Clock();
647  pTemp = Gia_ManCo(pGia, Gia_ManCoNum(pGia)-1);
648  pTruth = Gia_ObjComputeTruthTable( pGia, Gia_ManCo(pGia, Gia_ManCoNum(pGia)-1) );
649 p->timeCheck += Abc_Clock() - clk;
650  if ( memcmp( p->pTemp1, pTruth, p->nWords * sizeof(word) ) != 0 )
651  {
652 
653  Kit_DsdPrintFromTruth( (unsigned *)pTruth, nLeaves ); printf( "\n" );
654  Kit_DsdPrintFromTruth( (unsigned *)p->pTemp1, nLeaves ); printf( "\n" );
655  printf( "Truth table verification has failed.\n" );
656 
657  // drive PO with constant
658  Gia_ManPatchCoDriver( pGia, Gia_ManCoNum(pGia)-1, 0 );
659  // save truth table ID
660  Vec_IntPush( p->vTruthIds, -1 );
661  p->nFilterTruth++;
662  continue;
663  }
664  }
665 
666 clk = Abc_Clock();
667  // add the resulting truth table to the hash table
668  Index = Vec_MemHashInsert( p->vTtMem, p->pTemp1 );
669  // save truth table ID
670  Vec_IntPush( p->vTruthIds, Index );
671  assert( Gia_ManCoNum(pGia) == Vec_IntSize(p->vTruthIds) );
672  p->nAdded++;
673 p->timeInsert += Abc_Clock() - clk;
674  }
675  Vec_StrFree( vSupps );
676 p->timeTotal += Abc_Clock() - clk2;
677 }
static void Gia_ManPatchCoDriver(Gia_Man_t *p, int iCoIndex, int iLit0)
Definition: gia.h:739
static void Abc_TtStretch5(unsigned *pInOut, int nVarS, int nVarB)
Definition: utilTruth.h:678
Vec_Mem_t * vTtMem
Definition: abcRec3.c:59
int * pHTable
Definition: gia.h:110
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static Gia_Obj_t * Gia_ManCi(Gia_Man_t *p, int v)
Definition: gia.h:403
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nAdded
Definition: abcRec3.c:83
word pTemp2[LMS_MAX_WORD]
Definition: abcRec3.c:74
Gia_Man_t * pGia
Definition: abcRec3.c:58
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
#define LMS_VAR_MAX
Definition: abcRec3.c:31
char * memcpy()
abctime timeCanon
Definition: abcRec3.c:88
abctime timeTotal
Definition: abcRec3.c:93
unsigned fMark1
Definition: gia.h:84
void Kit_DsdPrintFromTruth(unsigned *pTruth, int nVars)
Definition: kitDsd.c:490
static abctime Abc_Clock()
Definition: abc_global.h:279
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
Definition: gia.h:75
abctime timeBuild
Definition: abcRec3.c:89
word * Gia_ObjComputeTruthTable(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaTruth.c:177
word pTemp1[LMS_MAX_WORD]
Definition: abcRec3.c:73
static char Vec_StrEntry(Vec_Str_t *p, int i)
Definition: vecStr.h:336
static Gia_Obj_t * Gia_ManPi(Gia_Man_t *p, int v)
Definition: gia.h:405
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
Vec_Int_t * vTruthIds
Definition: abcRec3.c:61
abctime timeInsert
Definition: abcRec3.c:91
static void Vec_StrFree(Vec_Str_t *p)
Definition: bblif.c:616
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
void Gia_ManHashStart(Gia_Man_t *p)
Definition: giaHash.c:117
int memcmp()
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
int nFilterSame
Definition: abcRec3.c:82
unsigned Kit_TruthSemiCanonicize(unsigned *pInOut, unsigned *pAux, int nVars, char *pCanonPerm)
Definition: kitTruth.c:1657
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition: gia.h:988
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
abctime timeCheck
Definition: abcRec3.c:90
static Gia_Obj_t * Gia_ManCo(Gia_Man_t *p, int v)
Definition: gia.h:404
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Vec_Int_t * vTtNodes
Definition: gia.h:185
Definition: gia.h:95
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
static int Abc_TtSupportSize(word *t, int nVars)
Definition: utilTruth.h:986
unsigned Abc_TtCanonicize(word *pTruth, int nVars, char *pCanonPerm)
FUNCTION DECLARATIONS ///.
Definition: dauCanon.c:895
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
static int Vec_MemHashInsert(Vec_Mem_t *p, word *pEntry)
Definition: vecMem.h:351
static Lms_Man_t * s_pMan3
Definition: abcRec3.c:96
abctime timeTruth
Definition: abcRec3.c:87
int nWords
Definition: abcRec3.c:53
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
int nVars
Definition: abcRec3.c:52
int nFilterTruth
Definition: abcRec3.c:80
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
ABC_INT64_T abctime
Definition: abc_global.h:278
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
Vec_Str_t * Lms_GiaSuppSizes(Gia_Man_t *p)
Definition: abcRec3.c:215
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
ABC_DLL void Abc_NtkRecPs3 ( int  fPrintLib)

Definition at line 1411 of file abcRec3.c.

1412 {
1413  Lms_ManPrint( s_pMan3 );
1414 }
void Lms_ManPrint(Lms_Man_t *p)
Definition: abcRec3.c:524
static Lms_Man_t * s_pMan3
Definition: abcRec3.c:96
ABC_DLL void Abc_NtkRecStart3 ( Gia_Man_t p,
int  nVars,
int  nCuts,
int  fFuncOnly,
int  fVerbose 
)

Definition at line 1415 of file abcRec3.c.

1416 {
1417  assert( s_pMan3 == NULL );
1418  s_pMan3 = Lms_ManStart( p, nVars, nCuts, fFuncOnly, fVerbose );
1419 }
Lms_Man_t * Lms_ManStart(Gia_Man_t *pGia, int nVars, int nCuts, int fFuncOnly, int fVerbose)
Definition: abcRec3.c:305
static Lms_Man_t * s_pMan3
Definition: abcRec3.c:96
#define assert(ex)
Definition: util_old.h:213
ABC_DLL void Abc_NtkRecStop3 ( )

Definition at line 1421 of file abcRec3.c.

1422 {
1423  assert( s_pMan3 != NULL );
1424  Lms_ManStop( s_pMan3 );
1425  s_pMan3 = NULL;
1426 }
void Lms_ManStop(Lms_Man_t *p)
Definition: abcRec3.c:363
static Lms_Man_t * s_pMan3
Definition: abcRec3.c:96
#define assert(ex)
Definition: util_old.h:213
ABC_DLL int Abc_NtkRefactor ( Abc_Ntk_t pNtk,
int  nNodeSizeMax,
int  nConeSizeMax,
int  fUpdateLevel,
int  fUseZeros,
int  fUseDcs,
int  fVerbose 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Performs incremental resynthesis of the AIG.]

Description [Starting from each node, computes a reconvergence-driven cut, derives BDD of the cut function, constructs ISOP, factors the ISOP, and replaces the current implementation of the MFFC of the node by the new factored form, if the number of AIG nodes is reduced and the total number of levels of the AIG network is not increated. Returns the number of AIG nodes saved.]

SideEffects []

SeeAlso []

Definition at line 89 of file abcRefactor.c.

90 {
91  extern void Dec_GraphUpdateNetwork( Abc_Obj_t * pRoot, Dec_Graph_t * pGraph, int fUpdateLevel, int nGain );
92  ProgressBar * pProgress;
93  Abc_ManRef_t * pManRef;
94  Abc_ManCut_t * pManCut;
95  Dec_Graph_t * pFForm;
96  Vec_Ptr_t * vFanins;
97  Abc_Obj_t * pNode;
98  abctime clk, clkStart = Abc_Clock();
99  int i, nNodes;
100 
101  assert( Abc_NtkIsStrash(pNtk) );
102  // cleanup the AIG
104  // start the managers
105  pManCut = Abc_NtkManCutStart( nNodeSizeMax, nConeSizeMax, 2, 1000 );
106  pManRef = Abc_NtkManRefStart( nNodeSizeMax, nConeSizeMax, fUseDcs, fVerbose );
107  pManRef->vLeaves = Abc_NtkManCutReadCutLarge( pManCut );
108  // compute the reverse levels if level update is requested
109  if ( fUpdateLevel )
110  Abc_NtkStartReverseLevels( pNtk, 0 );
111 
112  // resynthesize each node once
113  pManRef->nNodesBeg = Abc_NtkNodeNum(pNtk);
114  nNodes = Abc_NtkObjNumMax(pNtk);
115  pProgress = Extra_ProgressBarStart( stdout, nNodes );
116  Abc_NtkForEachNode( pNtk, pNode, i )
117  {
118  Extra_ProgressBarUpdate( pProgress, i, NULL );
119  // skip the constant node
120 // if ( Abc_NodeIsConst(pNode) )
121 // continue;
122  // skip persistant nodes
123  if ( Abc_NodeIsPersistant(pNode) )
124  continue;
125  // skip the nodes with many fanouts
126  if ( Abc_ObjFanoutNum(pNode) > 1000 )
127  continue;
128  // stop if all nodes have been tried once
129  if ( i >= nNodes )
130  break;
131  // compute a reconvergence-driven cut
132 clk = Abc_Clock();
133  vFanins = Abc_NodeFindCut( pManCut, pNode, fUseDcs );
134 pManRef->timeCut += Abc_Clock() - clk;
135  // evaluate this cut
136 clk = Abc_Clock();
137  pFForm = Abc_NodeRefactor( pManRef, pNode, vFanins, fUpdateLevel, fUseZeros, fUseDcs, fVerbose );
138 pManRef->timeRes += Abc_Clock() - clk;
139  if ( pFForm == NULL )
140  continue;
141  // acceptable replacement found, update the graph
142 clk = Abc_Clock();
143  Dec_GraphUpdateNetwork( pNode, pFForm, fUpdateLevel, pManRef->nLastGain );
144 pManRef->timeNtk += Abc_Clock() - clk;
145  Dec_GraphFree( pFForm );
146 // {
147 // extern int s_TotalChanges;
148 // s_TotalChanges++;
149 // }
150  }
151  Extra_ProgressBarStop( pProgress );
152 pManRef->timeTotal = Abc_Clock() - clkStart;
153  pManRef->nNodesEnd = Abc_NtkNodeNum(pNtk);
154 
155  // print statistics of the manager
156  if ( fVerbose )
157  Abc_NtkManRefPrintStats( pManRef );
158  // delete the managers
159  Abc_NtkManCutStop( pManCut );
160  Abc_NtkManRefStop( pManRef );
161  // put the nodes into the DFS order and reassign their IDs
162  Abc_NtkReassignIds( pNtk );
163 // Abc_AigCheckFaninOrder( pNtk->pManFunc );
164  // fix the levels
165  if ( fUpdateLevel )
166  Abc_NtkStopReverseLevels( pNtk );
167  else
168  Abc_NtkLevel( pNtk );
169  // check
170  if ( !Abc_NtkCheck( pNtk ) )
171  {
172  printf( "Abc_NtkRefactor: The network check has failed.\n" );
173  return 0;
174  }
175  return 1;
176 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
static Dec_Graph_t * Abc_NodeRefactor(Abc_ManRef_t *p, Abc_Obj_t *pNode, Vec_Ptr_t *vFanins, int fUpdateLevel, int fUseZeros, int fUseDcs, int fVerbose)
Definition: abcRefactor.c:189
ABC_DLL Vec_Ptr_t * Abc_NtkManCutReadCutLarge(Abc_ManCut_t *p)
Definition: abcReconv.c:637
void Dec_GraphUpdateNetwork(Abc_Obj_t *pRoot, Dec_Graph_t *pGraph, int fUpdateLevel, int nGain)
Definition: decAbc.c:240
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
static abctime Abc_Clock()
Definition: abc_global.h:279
DECLARATIONS ///.
Definition: abcAig.c:52
ABC_DLL void Abc_NtkStopReverseLevels(Abc_Ntk_t *pNtk)
Definition: abcTiming.c:1190
ABC_DLL Vec_Ptr_t * Abc_NodeFindCut(Abc_ManCut_t *p, Abc_Obj_t *pRoot, int fContain)
Definition: abcReconv.c:253
ABC_DLL void Abc_NtkReassignIds(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:1769
void * pManFunc
Definition: abc.h:191
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
Definition: abc.h:293
DECLARATIONS ///.
ABC_DLL int Abc_AigCleanup(Abc_Aig_t *pMan)
Definition: abcAig.c:194
ABC_DLL void Abc_NtkStartReverseLevels(Abc_Ntk_t *pNtk, int nMaxLevelIncrease)
Definition: abcTiming.c:1162
void Extra_ProgressBarStop(ProgressBar *p)
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
static int Abc_NodeIsPersistant(Abc_Obj_t *pNode)
Definition: abc.h:401
static void Abc_NtkManRefPrintStats(Abc_ManRef_t *p)
Definition: abcRefactor.c:367
ProgressBar * Extra_ProgressBarStart(FILE *pFile, int nItemsTotal)
FUNCTION DEFINITIONS ///.
static Abc_ManRef_t * Abc_NtkManRefStart(int nNodeSizeMax, int nConeSizeMax, int fUseDcs, int fVerbose)
Definition: abcRefactor.c:318
ABC_DLL Abc_ManCut_t * Abc_NtkManCutStart(int nNodeSizeMax, int nConeSizeMax, int nNodeFanStop, int nConeFanStop)
Definition: abcReconv.c:588
static void Dec_GraphFree(Dec_Graph_t *pGraph)
Definition: dec.h:307
#define assert(ex)
Definition: util_old.h:213
static void Extra_ProgressBarUpdate(ProgressBar *p, int nItemsCur, char *pString)
Definition: extra.h:243
ABC_DLL void Abc_NtkManCutStop(Abc_ManCut_t *p)
Definition: abcReconv.c:616
ABC_INT64_T abctime
Definition: abc_global.h:278
ABC_DLL int Abc_NtkLevel(Abc_Ntk_t *pNtk)
Definition: abcDfs.c:1265
static void Abc_NtkManRefStop(Abc_ManRef_t *p)
Definition: abcRefactor.c:348
DECLARATIONS ///.
Definition: abcReconv.c:31
typedefABC_NAMESPACE_IMPL_START struct Abc_ManRef_t_ Abc_ManRef_t
DECLARATIONS ///.
Definition: abcRefactor.c:32
ABC_DLL int Abc_NtkRemoveDupFanins ( Abc_Ntk_t pNtk)

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

Synopsis [Makes nodes of the network fanin-dup-free.]

Description [Returns the number of pairs of duplicated fanins.]

SideEffects []

SeeAlso []

Definition at line 116 of file abcMinBase.c.

117 {
118  Abc_Obj_t * pNode;
119  int i, Counter;
120  assert( Abc_NtkIsBddLogic(pNtk) );
121  Counter = 0;
122  Abc_NtkForEachNode( pNtk, pNode, i )
123  Counter += Abc_NodeRemoveDupFanins( pNode );
124  return Counter;
125 }
static int Counter
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
int Abc_NodeRemoveDupFanins(Abc_Obj_t *pNode)
Definition: abcMinBase.c:180
static int Abc_NtkIsBddLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:265
#define assert(ex)
Definition: util_old.h:213
ABC_DLL int Abc_NtkRemoveSelfFeedLatches ( Abc_Ntk_t pNtk)

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

Synopsis [Replaces self-feeding latches by latches with constant inputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 114 of file abcLatch.c.

115 {
116  Abc_Obj_t * pLatch, * pConst1;
117  int i, Counter;
118  Counter = 0;
119  Abc_NtkForEachLatch( pNtk, pLatch, i )
120  {
121  if ( Abc_NtkLatchIsSelfFeed( pLatch ) )
122  {
123  if ( Abc_NtkIsStrash(pNtk) )
124  pConst1 = Abc_AigConst1(pNtk);
125  else
126  pConst1 = Abc_NtkCreateNodeConst1(pNtk);
127  Abc_ObjPatchFanin( Abc_ObjFanin0(pLatch), Abc_ObjFanin0(Abc_ObjFanin0(pLatch)), pConst1 );
128  Counter++;
129  }
130  }
131  return Counter;
132 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeConst1(Abc_Ntk_t *pNtk)
Definition: abcObj.c:633
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
ABC_DLL void Abc_ObjPatchFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFaninOld, Abc_Obj_t *pFaninNew)
Definition: abcFanio.c:172
static int Counter
#define Abc_NtkForEachLatch(pNtk, pObj, i)
Definition: abc.h:497
int Abc_NtkLatchIsSelfFeed(Abc_Obj_t *pLatch)
Definition: abcLatch.c:68
ABC_DLL Abc_Ntk_t* Abc_NtkRestrash ( Abc_Ntk_t pNtk,
int  fCleanup 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Reapplies structural hashing to the AIG.]

Description [Because of the structural hashing, this procedure should not change the number of nodes. It is useful to detect the bugs in the original AIG.]

SideEffects []

SeeAlso []

Definition at line 49 of file abcStrash.c.

50 {
51 // extern int timeRetime;
52  Vec_Ptr_t * vNodes;
53  Abc_Ntk_t * pNtkAig;
54  Abc_Obj_t * pObj;
55  int i, nNodes;//, RetValue;
56  assert( Abc_NtkIsStrash(pNtk) );
57 //timeRetime = Abc_Clock();
58  // print warning about choice nodes
59  if ( Abc_NtkGetChoiceNum( pNtk ) )
60  printf( "Warning: The choice nodes in the original AIG are removed by strashing.\n" );
61  // start the new network (constants and CIs of the old network will point to the their counterparts in the new network)
62  pNtkAig = Abc_NtkStartFrom( pNtk, ABC_NTK_STRASH, ABC_FUNC_AIG );
63  // restrash the nodes (assuming a topological order of the old network)
64  vNodes = Abc_NtkDfs( pNtk, 0 );
65  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
66  pObj->pCopy = Abc_AigAnd( (Abc_Aig_t *)pNtkAig->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild1Copy(pObj) );
67  Vec_PtrFree( vNodes );
68  // finalize the network
69  Abc_NtkFinalize( pNtk, pNtkAig );
70  // print warning about self-feed latches
71 // if ( Abc_NtkCountSelfFeedLatches(pNtkAig) )
72 // printf( "Warning: The network has %d self-feeding latches.\n", Abc_NtkCountSelfFeedLatches(pNtkAig) );
73  // perform cleanup if requested
74  if ( fCleanup && (nNodes = Abc_AigCleanup((Abc_Aig_t *)pNtkAig->pManFunc)) )
75  {
76 // printf( "Abc_NtkRestrash(): AIG cleanup removed %d nodes (this is a bug).\n", nNodes );
77  }
78  // duplicate EXDC
79  if ( pNtk->pExdc )
80  pNtkAig->pExdc = Abc_NtkDup( pNtk->pExdc );
81  // make sure everything is okay
82  if ( !Abc_NtkCheck( pNtkAig ) )
83  {
84  printf( "Abc_NtkStrash: The network check has failed.\n" );
85  Abc_NtkDelete( pNtkAig );
86  return NULL;
87  }
88 //timeRetime = Abc_Clock() - timeRetime;
89 // if ( RetValue = Abc_NtkRemoveSelfFeedLatches(pNtkAig) )
90 // printf( "Modified %d self-feeding latches. The result may not verify.\n", RetValue );
91  return pNtkAig;
92 
93 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
Abc_Ntk_t * pExdc
Definition: abc.h:201
static Abc_Obj_t * Abc_ObjChild1Copy(Abc_Obj_t *pObj)
Definition: abc.h:387
ABC_DLL Abc_Ntk_t * Abc_NtkDup(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:419
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
Definition: abcDfs.c:81
ABC_DLL int Abc_NtkGetChoiceNum(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:430
DECLARATIONS ///.
Definition: abcAig.c:52
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:700
static Abc_Obj_t * Abc_ObjChild0Copy(Abc_Obj_t *pObj)
Definition: abc.h:386
ABC_DLL Abc_Ntk_t * Abc_NtkStartFrom(Abc_Ntk_t *pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func)
Definition: abcNtk.c:106
ABC_DLL int Abc_AigCleanup(Abc_Aig_t *pMan)
Definition: abcAig.c:194
if(last==0)
Definition: sparse_int.h:34
ABC_DLL void Abc_NtkFinalize(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkNew)
Definition: abcNtk.c:302
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL Abc_Ntk_t* Abc_NtkRestrashZero ( Abc_Ntk_t pNtk,
int  fCleanup 
)

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

Synopsis [Reapplies structural hashing to the AIG.]

Description [Because of the structural hashing, this procedure should not change the number of nodes. It is useful to detect the bugs in the original AIG.]

SideEffects []

SeeAlso []

Definition at line 181 of file abcStrash.c.

182 {
183 // extern int timeRetime;
184  Abc_Ntk_t * pNtkAig;
185  Abc_Obj_t * pObj;
186  int i, nNodes;//, RetValue;
187  int Counter = 0;
188  assert( Abc_NtkIsStrash(pNtk) );
189 //timeRetime = Abc_Clock();
190  // print warning about choice nodes
191  if ( Abc_NtkGetChoiceNum( pNtk ) )
192  printf( "Warning: The choice nodes in the original AIG are removed by strashing.\n" );
193  // start the new network (constants and CIs of the old network will point to the their counterparts in the new network)
194  pNtkAig = Abc_NtkStartFrom( pNtk, ABC_NTK_STRASH, ABC_FUNC_AIG );
195  // complement the 1-values registers
196  Abc_NtkForEachLatch( pNtk, pObj, i )
197  {
198  if ( Abc_LatchIsInitDc(pObj) )
199  Counter++;
200  else if ( Abc_LatchIsInit1(pObj) )
201  Abc_ObjFanout0(pObj)->pCopy = Abc_ObjNot(Abc_ObjFanout0(pObj)->pCopy);
202  }
203  if ( Counter )
204  printf( "Converting %d flops from don't-care to zero initial value.\n", Counter );
205  // restrash the nodes (assuming a topological order of the old network)
206  Abc_NtkForEachNode( pNtk, pObj, i )
207  pObj->pCopy = Abc_AigAnd( (Abc_Aig_t *)pNtkAig->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild1Copy(pObj) );
208  // finalize the network
209  Abc_NtkFinalize( pNtk, pNtkAig );
210  // complement the 1-valued registers
211  Abc_NtkForEachLatch( pNtkAig, pObj, i )
212  if ( Abc_LatchIsInit1(pObj) )
213  {
214  Abc_ObjXorFaninC( Abc_ObjFanin0(pObj), 0 );
215  // if latch has PO as one of its fanouts change latch name
216  if ( Abc_NodeFindCoFanout( Abc_ObjFanout0(pObj) ) )
217  {
218  Nm_ManDeleteIdName( pObj->pNtk->pManName, Abc_ObjFanout0(pObj)->Id );
220  }
221  }
222  // set all constant-0 values
223  Abc_NtkForEachLatch( pNtkAig, pObj, i )
224  Abc_LatchSetInit0( pObj );
225 
226  // print warning about self-feed latches
227 // if ( Abc_NtkCountSelfFeedLatches(pNtkAig) )
228 // printf( "Warning: The network has %d self-feeding latches.\n", Abc_NtkCountSelfFeedLatches(pNtkAig) );
229  // perform cleanup if requested
230  if ( fCleanup && (nNodes = Abc_AigCleanup((Abc_Aig_t *)pNtkAig->pManFunc)) )
231  printf( "Abc_NtkRestrash(): AIG cleanup removed %d nodes (this is a bug).\n", nNodes );
232  // duplicate EXDC
233  if ( pNtk->pExdc )
234  pNtkAig->pExdc = Abc_NtkDup( pNtk->pExdc );
235  // transfer name IDs
236  if ( pNtk->vNameIds )
237  Abc_NtkTransferNameIds( pNtk, pNtkAig );
238  if ( pNtk->vNameIds )
239  Abc_NtkUpdateNameIds( pNtkAig );
240  // make sure everything is okay
241  if ( !Abc_NtkCheck( pNtkAig ) )
242  {
243  printf( "Abc_NtkStrash: The network check has failed.\n" );
244  Abc_NtkDelete( pNtkAig );
245  return NULL;
246  }
247 //timeRetime = Abc_Clock() - timeRetime;
248 // if ( RetValue = Abc_NtkRemoveSelfFeedLatches(pNtkAig) )
249 // printf( "Modified %d self-feeding latches. The result may not verify.\n", RetValue );
250  return pNtkAig;
251 
252 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
void Nm_ManDeleteIdName(Nm_Man_t *p, int ObjId)
Definition: nmApi.c:149
Abc_Ntk_t * Abc_NtkRestrash(Abc_Ntk_t *pNtk, int fCleanup)
FUNCTION DEFINITIONS ///.
Definition: abcStrash.c:49
static Abc_Obj_t * Abc_ObjChild1Copy(Abc_Obj_t *pObj)
Definition: abc.h:387
ABC_DLL Abc_Ntk_t * Abc_NtkDup(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:419
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition: abcNames.c:68
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
ABC_DLL int Abc_NtkGetChoiceNum(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:430
DECLARATIONS ///.
Definition: abcAig.c:52
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:700
static Abc_Obj_t * Abc_ObjChild0Copy(Abc_Obj_t *pObj)
Definition: abc.h:386
ABC_DLL Abc_Ntk_t * Abc_NtkStartFrom(Abc_Ntk_t *pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func)
Definition: abcNtk.c:106
Abc_Obj_t * pCopy
Definition: abc.h:148
ABC_DLL int Abc_AigCleanup(Abc_Aig_t *pMan)
Definition: abcAig.c:194
static int Abc_LatchIsInitDc(Abc_Obj_t *pLatch)
Definition: abc.h:424
ABC_DLL void Abc_NtkUpdateNameIds(Abc_Ntk_t *p)
Definition: abcNames.c:620
if(last==0)
Definition: sparse_int.h:34
ABC_DLL void Abc_NtkFinalize(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkNew)
Definition: abcNtk.c:302
static int Counter
#define Abc_NtkForEachLatch(pNtk, pObj, i)
Definition: abc.h:497
static int Abc_LatchIsInit1(Abc_Obj_t *pLatch)
Definition: abc.h:423
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
ABC_DLL Abc_Obj_t * Abc_NodeFindCoFanout(Abc_Obj_t *pNode)
Definition: abcUtil.c:779
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
static void Abc_ObjXorFaninC(Abc_Obj_t *pObj, int i)
Definition: abc.h:381
ABC_DLL void Abc_NtkTransferNameIds(Abc_Ntk_t *p, Abc_Ntk_t *pNew)
Definition: abcNames.c:588
#define assert(ex)
Definition: util_old.h:213
static Abc_Obj_t * Abc_ObjNot(Abc_Obj_t *p)
Definition: abc.h:324
static void Abc_LatchSetInit0(Abc_Obj_t *pLatch)
Definition: abc.h:418
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371
ABC_DLL void Abc_NtkReverseTopoOrder ( Abc_Ntk_t pNtk)

Definition at line 2615 of file abcUtil.c.

2616 {
2617  Abc_Obj_t * pObj;
2618  int i;
2619  assert( p->vTopo == NULL );
2620  p->vTopo = Vec_IntAlloc( 10 * Abc_NtkObjNumMax(p) );
2621  Vec_IntFill( p->vTopo, 2 * Abc_NtkObjNumMax(p), 0 );
2622  Abc_NtkForEachNode( p, pObj, i )
2623  {
2624  if ( Abc_NtkTopoHasBeg(pObj) )
2625  continue;
2627  Abc_NtkReverseTopoOrder_rec( pObj, 1 );
2628  }
2629  printf( "Nodes = %d. Size = %d. Ratio = %f.\n",
2630  Abc_NtkNodeNum(p), Vec_IntSize(p->vTopo), 1.0*Vec_IntSize(p->vTopo)/Abc_NtkNodeNum(p) );
2631 }
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
Definition: abc.h:293
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
static int Abc_NtkTopoHasBeg(Abc_Obj_t *p)
Definition: abcUtil.c:2575
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
#define assert(ex)
Definition: util_old.h:213
void Abc_NtkReverseTopoOrder_rec(Abc_Obj_t *pObj, int fThisIsPivot)
Definition: abcUtil.c:2581
ABC_DLL int Abc_NtkRewrite ( Abc_Ntk_t pNtk,
int  fUpdateLevel,
int  fUseZeros,
int  fVerbose,
int  fVeryVerbose,
int  fPlaceEnable 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Performs incremental rewriting of the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 61 of file abcRewrite.c.

62 {
63  extern void Dec_GraphUpdateNetwork( Abc_Obj_t * pRoot, Dec_Graph_t * pGraph, int fUpdateLevel, int nGain );
64  ProgressBar * pProgress;
65  Cut_Man_t * pManCut;
66  Rwr_Man_t * pManRwr;
67  Abc_Obj_t * pNode;
68 // Vec_Ptr_t * vAddedCells = NULL, * vUpdatedNets = NULL;
69  Dec_Graph_t * pGraph;
70  int i, nNodes, nGain, fCompl;
71  abctime clk, clkStart = Abc_Clock();
72 
73  assert( Abc_NtkIsStrash(pNtk) );
74  // cleanup the AIG
76 /*
77  {
78  Vec_Vec_t * vParts;
79  vParts = Abc_NtkPartitionSmart( pNtk, 50, 1 );
80  Vec_VecFree( vParts );
81  }
82 */
83 
84  // start placement package
85 // if ( fPlaceEnable )
86 // {
87 // Abc_PlaceBegin( pNtk );
88 // vAddedCells = Abc_AigUpdateStart( pNtk->pManFunc, &vUpdatedNets );
89 // }
90 
91  // start the rewriting manager
92  pManRwr = Rwr_ManStart( 0 );
93  if ( pManRwr == NULL )
94  return 0;
95  // compute the reverse levels if level update is requested
96  if ( fUpdateLevel )
97  Abc_NtkStartReverseLevels( pNtk, 0 );
98  // start the cut manager
99 clk = Abc_Clock();
100  pManCut = Abc_NtkStartCutManForRewrite( pNtk );
101 Rwr_ManAddTimeCuts( pManRwr, Abc_Clock() - clk );
102  pNtk->pManCut = pManCut;
103 
104  if ( fVeryVerbose )
105  Rwr_ScoresClean( pManRwr );
106 
107  // resynthesize each node once
108  pManRwr->nNodesBeg = Abc_NtkNodeNum(pNtk);
109  nNodes = Abc_NtkObjNumMax(pNtk);
110  pProgress = Extra_ProgressBarStart( stdout, nNodes );
111  Abc_NtkForEachNode( pNtk, pNode, i )
112  {
113  Extra_ProgressBarUpdate( pProgress, i, NULL );
114  // stop if all nodes have been tried once
115  if ( i >= nNodes )
116  break;
117  // skip persistant nodes
118  if ( Abc_NodeIsPersistant(pNode) )
119  continue;
120  // skip the nodes with many fanouts
121  if ( Abc_ObjFanoutNum(pNode) > 1000 )
122  continue;
123 
124  // for each cut, try to resynthesize it
125  nGain = Rwr_NodeRewrite( pManRwr, pManCut, pNode, fUpdateLevel, fUseZeros, fPlaceEnable );
126  if ( !(nGain > 0 || (nGain == 0 && fUseZeros)) )
127  continue;
128  // if we end up here, a rewriting step is accepted
129 
130  // get hold of the new subgraph to be added to the AIG
131  pGraph = (Dec_Graph_t *)Rwr_ManReadDecs(pManRwr);
132  fCompl = Rwr_ManReadCompl(pManRwr);
133 
134  // reset the array of the changed nodes
135  if ( fPlaceEnable )
137 
138  // complement the FF if needed
139  if ( fCompl ) Dec_GraphComplement( pGraph );
140 clk = Abc_Clock();
141  Dec_GraphUpdateNetwork( pNode, pGraph, fUpdateLevel, nGain );
142 Rwr_ManAddTimeUpdate( pManRwr, Abc_Clock() - clk );
143  if ( fCompl ) Dec_GraphComplement( pGraph );
144 
145  // use the array of changed nodes to update placement
146 // if ( fPlaceEnable )
147 // Abc_PlaceUpdate( vAddedCells, vUpdatedNets );
148  }
149  Extra_ProgressBarStop( pProgress );
150 Rwr_ManAddTimeTotal( pManRwr, Abc_Clock() - clkStart );
151  // print stats
152  pManRwr->nNodesEnd = Abc_NtkNodeNum(pNtk);
153  if ( fVerbose )
154  Rwr_ManPrintStats( pManRwr );
155 // Rwr_ManPrintStatsFile( pManRwr );
156  if ( fVeryVerbose )
157  Rwr_ScoresReport( pManRwr );
158  // delete the managers
159  Rwr_ManStop( pManRwr );
160  Cut_ManStop( pManCut );
161  pNtk->pManCut = NULL;
162 
163  // start placement package
164 // if ( fPlaceEnable )
165 // {
166 // Abc_PlaceEnd( pNtk );
167 // Abc_AigUpdateStop( pNtk->pManFunc );
168 // }
169 
170  // put the nodes into the DFS order and reassign their IDs
171  {
172 // abctime clk = Abc_Clock();
173  Abc_NtkReassignIds( pNtk );
174 // ABC_PRT( "time", Abc_Clock() - clk );
175  }
176 // Abc_AigCheckFaninOrder( pNtk->pManFunc );
177  // fix the levels
178  if ( fUpdateLevel )
179  Abc_NtkStopReverseLevels( pNtk );
180  else
181  Abc_NtkLevel( pNtk );
182  // check
183  if ( !Abc_NtkCheck( pNtk ) )
184  {
185  printf( "Abc_NtkRewrite: The network check has failed.\n" );
186  return 0;
187  }
188  return 1;
189 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
int Rwr_ManReadCompl(Rwr_Man_t *p)
Definition: rwrMan.c:245
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
int nNodesEnd
Definition: rwr.h:83
Definition: rwr.h:50
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
int nNodesBeg
Definition: rwr.h:82
void Dec_GraphUpdateNetwork(Abc_Obj_t *pRoot, Dec_Graph_t *pGraph, int fUpdateLevel, int nGain)
Definition: decAbc.c:240
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
static abctime Abc_Clock()
Definition: abc_global.h:279
DECLARATIONS ///.
Definition: abcAig.c:52
ABC_DLL void Abc_NtkStopReverseLevels(Abc_Ntk_t *pNtk)
Definition: abcTiming.c:1190
ABC_DLL void Abc_NtkReassignIds(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:1769
void Rwr_ManAddTimeTotal(Rwr_Man_t *p, abctime Time)
Definition: rwrMan.c:293
void * pManFunc
Definition: abc.h:191
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
Definition: abc.h:293
DECLARATIONS ///.
ABC_DLL int Abc_AigCleanup(Abc_Aig_t *pMan)
Definition: abcAig.c:194
void Rwr_ManPrintStats(Rwr_Man_t *p)
Definition: rwrMan.c:143
void Cut_ManStop(Cut_Man_t *p)
Definition: cutMan.c:124
void * Rwr_ManReadDecs(Rwr_Man_t *p)
Definition: rwrMan.c:213
Rwr_Man_t * Rwr_ManStart(int fPrecompute)
DECLARATIONS ///.
Definition: rwrMan.c:47
void * pManCut
Definition: abc.h:193
void Rwr_ManAddTimeUpdate(Rwr_Man_t *p, abctime Time)
Definition: rwrMan.c:277
ABC_DLL void Abc_NtkStartReverseLevels(Abc_Ntk_t *pNtk, int nMaxLevelIncrease)
Definition: abcTiming.c:1162
void Extra_ProgressBarStop(ProgressBar *p)
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
static int Abc_NodeIsPersistant(Abc_Obj_t *pNode)
Definition: abc.h:401
void Rwr_ManAddTimeCuts(Rwr_Man_t *p, abctime Time)
Definition: rwrMan.c:261
void Rwr_ScoresReport(Rwr_Man_t *p)
Definition: rwrEva.c:550
ProgressBar * Extra_ProgressBarStart(FILE *pFile, int nItemsTotal)
FUNCTION DEFINITIONS ///.
#define assert(ex)
Definition: util_old.h:213
static void Extra_ProgressBarUpdate(ProgressBar *p, int nItemsCur, char *pString)
Definition: extra.h:243
static ABC_NAMESPACE_IMPL_START Cut_Man_t * Abc_NtkStartCutManForRewrite(Abc_Ntk_t *pNtk)
DECLARATIONS ///.
Definition: abcRewrite.c:203
ABC_DLL void Abc_AigUpdateReset(Abc_Aig_t *pMan)
Definition: abcAig.c:1460
ABC_INT64_T abctime
Definition: abc_global.h:278
ABC_DLL int Abc_NtkLevel(Abc_Ntk_t *pNtk)
Definition: abcDfs.c:1265
void Rwr_ManStop(Rwr_Man_t *p)
Definition: rwrMan.c:109
int Rwr_NodeRewrite(Rwr_Man_t *p, Cut_Man_t *pManCut, Abc_Obj_t *pNode, int fUpdateLevel, int fUseZeros, int fPlaceEnable)
FUNCTION DEFINITIONS ///.
Definition: rwrEva.c:59
void Rwr_ScoresClean(Rwr_Man_t *p)
Definition: rwrEva.c:504
static void Dec_GraphComplement(Dec_Graph_t *pGraph)
Definition: dec.h:388
ABC_DLL Vec_Ptr_t* Abc_NtkSaveCopy ( Abc_Ntk_t pNtk)

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

Synopsis [Saves copy field of the objects.]

Description []

SideEffects []

SeeAlso []

Definition at line 595 of file abcUtil.c.

596 {
597  Vec_Ptr_t * vCopies;
598  Abc_Obj_t * pObj;
599  int i;
600  vCopies = Vec_PtrStart( Abc_NtkObjNumMax(pNtk) );
601  Abc_NtkForEachObj( pNtk, pObj, i )
602  Vec_PtrWriteEntry( vCopies, i, pObj->pCopy );
603  return vCopies;
604 }
static Vec_Ptr_t * Vec_PtrStart(int nSize)
Definition: vecPtr.h:106
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
static void Abc_NtkSetBackup ( Abc_Ntk_t pNtk,
Abc_Ntk_t pNetBackup 
)
inlinestatic

Definition at line 279 of file abc.h.

279 { pNtk->pNetBackup = pNetBackup; }
Abc_Ntk_t * pNetBackup
Definition: abc.h:177
ABC_DLL void Abc_NtkSetMvVarValues ( Abc_Obj_t pObj,
int  nValues 
)

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

Synopsis [Duplicate the MV variable.]

Description []

SideEffects []

SeeAlso []

Definition at line 84 of file abcBlifMv.c.

85 {
86  Mem_Flex_t * pFlex;
87  struct temp
88  {
89  int nValues;
90  char ** pNames;
91  } * pVarStruct;
92  assert( nValues > 1 );
93  // skip binary signals
94  if ( nValues == 2 )
95  return;
96  // skip already assigned signals
97  if ( Abc_ObjMvVar(pObj) != NULL )
98  return;
99  // create the structure
100  pFlex = (Mem_Flex_t *)Abc_NtkMvVarMan( pObj->pNtk );
101  pVarStruct = (struct temp *)Mem_FlexEntryFetch( pFlex, sizeof(struct temp) );
102  pVarStruct->nValues = nValues;
103  pVarStruct->pNames = NULL;
104  Abc_ObjSetMvVar( pObj, pVarStruct );
105 }
static void Abc_ObjSetMvVar(Abc_Obj_t *pObj, void *pV)
Definition: abc.h:439
static void * Abc_NtkMvVarMan(Abc_Ntk_t *pNtk)
Definition: abc.h:436
char * Mem_FlexEntryFetch(Mem_Flex_t *p, int nBytes)
Definition: mem.c:372
static void * Abc_ObjMvVar(Abc_Obj_t *pObj)
Definition: abc.h:437
Abc_Ntk_t * pNtk
Definition: abc.h:130
#define assert(ex)
Definition: util_old.h:213
static void Abc_NtkSetName ( Abc_Ntk_t pNtk,
char *  pName 
)
inlinestatic

Definition at line 277 of file abc.h.

277 { pNtk->pName = pName; }
char * pName
Definition: abc.h:158
ABC_DLL void Abc_NtkSetNodeLevelsArrival ( Abc_Ntk_t pNtkOld)

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

Synopsis [Sets the CI node levels according to the arrival info.]

Description []

SideEffects []

SeeAlso []

Definition at line 591 of file abcTiming.c.

592 {
593  Abc_Obj_t * pNodeOld, * pNodeNew;
594  float tAndDelay;
595  int i;
596  if ( pNtkOld->pManTime == NULL )
597  return;
599  return;
601  Abc_NtkForEachCi( pNtkOld, pNodeOld, i )
602  {
603  pNodeNew = pNodeOld->pCopy;
604  pNodeNew->Level = (int)(Abc_NodeReadArrivalWorst(pNodeOld) / tAndDelay);
605  }
606 }
ABC_DLL void * Abc_FrameReadLibGen()
Definition: mainFrame.c:56
float Mio_LibraryReadDelayNand2Max(Mio_Library_t *pLib)
Definition: mioApi.c:58
unsigned Level
Definition: abc.h:142
Mio_Gate_t * Mio_LibraryReadNand2(Mio_Library_t *pLib)
Definition: mioApi.c:51
Abc_Obj_t * pCopy
Definition: abc.h:148
float Abc_NodeReadArrivalWorst(Abc_Obj_t *pNode)
Definition: abcTiming.c:95
STRUCTURE DEFINITIONS ///.
Definition: mioInt.h:61
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
Abc_ManTime_t * pManTime
Definition: abc.h:192
static void Abc_NtkSetSpec ( Abc_Ntk_t pNtk,
char *  pName 
)
inlinestatic

Definition at line 278 of file abc.h.

278 { pNtk->pSpec = pName; }
char * pSpec
Definition: abc.h:159
static void Abc_NtkSetStep ( Abc_Ntk_t pNtk,
int  iStep 
)
inlinestatic

Definition at line 280 of file abc.h.

280 { pNtk->iStep = iStep; }
int iStep
Definition: abc.h:178
ABC_DLL void Abc_NtkShortNames ( Abc_Ntk_t pNtk)

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

Synopsis [Replaces names by short names.]

Description []

SideEffects []

SeeAlso []

Definition at line 490 of file abcNames.c.

491 {
492  Nm_ManFree( pNtk->pManName );
493  pNtk->pManName = Nm_ManCreate( Abc_NtkCiNum(pNtk) + Abc_NtkCoNum(pNtk) + Abc_NtkBoxNum(pNtk) );
494  Abc_NtkAddDummyPiNames( pNtk );
495  Abc_NtkAddDummyPoNames( pNtk );
496  Abc_NtkAddDummyBoxNames( pNtk );
497 }
Nm_Man_t * pManName
Definition: abc.h:160
static int Abc_NtkBoxNum(Abc_Ntk_t *pNtk)
Definition: abc.h:289
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
void Abc_NtkAddDummyPoNames(Abc_Ntk_t *pNtk)
Definition: abcNames.c:398
void Abc_NtkAddDummyPiNames(Abc_Ntk_t *pNtk)
Definition: abcNames.c:378
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
void Abc_NtkAddDummyBoxNames(Abc_Ntk_t *pNtk)
Definition: abcNames.c:418
Nm_Man_t * Nm_ManCreate(int nSize)
MACRO DEFINITIONS ///.
Definition: nmApi.c:45
void Nm_ManFree(Nm_Man_t *p)
Definition: nmApi.c:76
ABC_DLL void Abc_NtkShow6VarFunc ( char *  pF0,
char *  pF1 
)

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

Synopsis [Prints K-map of 6-var function represented by truth table.]

Description []

SideEffects []

SeeAlso []

Definition at line 1590 of file abcPrint.c.

1591 {
1592  word F0, F1;
1593  if ( strlen(pF0) != 16 )
1594  {
1595  printf( "Wrong length (%d) of 6-var truth table.\n", (int)strlen(pF0) );
1596  return;
1597  }
1598  if ( strlen(pF1) != 16 )
1599  {
1600  printf( "Wrong length (%d) of 6-var truth table.\n", (int)strlen(pF1) );
1601  return;
1602  }
1603  Extra_ReadHexadecimal( (unsigned *)&F0, pF0, 6 );
1604  Extra_ReadHexadecimal( (unsigned *)&F1, pF1, 6 );
1605  Abc_Show6VarFunc( F0, F1 );
1606 }
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
int Extra_ReadHexadecimal(unsigned Sign[], char *pString, int nVars)
void Abc_Show6VarFunc(word F0, word F1)
Definition: abcPrint.c:1508
int strlen()
ABC_DLL int Abc_NtkSizeOfGlobalBdds ( Abc_Ntk_t pNtk)

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

Synopsis [Returns the shared size of global BDDs of the COs.]

Description []

SideEffects []

SeeAlso []

Definition at line 492 of file abcNtbdd.c.

493 {
494  Vec_Ptr_t * vFuncsGlob;
495  Abc_Obj_t * pObj;
496  int RetValue, i;
497  // complement the global functions
498  vFuncsGlob = Vec_PtrAlloc( Abc_NtkCoNum(pNtk) );
499  Abc_NtkForEachCo( pNtk, pObj, i )
500  Vec_PtrPush( vFuncsGlob, Abc_ObjGlobalBdd(pObj) );
501  RetValue = Cudd_SharingSize( (DdNode **)Vec_PtrArray(vFuncsGlob), Vec_PtrSize(vFuncsGlob) );
502  Vec_PtrFree( vFuncsGlob );
503  return RetValue;
504 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
Definition: cudd.h:278
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
static void * Abc_ObjGlobalBdd(Abc_Obj_t *pObj)
Definition: abc.h:431
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static void ** Vec_PtrArray(Vec_Ptr_t *p)
Definition: vecPtr.h:279
int Cudd_SharingSize(DdNode **nodeArray, int n)
Definition: cuddUtil.c:544
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL int Abc_NtkSopToAig ( Abc_Ntk_t pNtk)

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

Synopsis [Converts the network from SOP to AIG representation.]

Description []

SideEffects []

SeeAlso []

Definition at line 612 of file abcFunc.c.

613 {
614  Abc_Obj_t * pNode;
615  Hop_Man_t * pMan;
616  int i;
617 
618  assert( Abc_NtkHasSop(pNtk) );
619 
620  // make dist1-free and SCC-free
621 // Abc_NtkMakeLegit( pNtk );
622 
623  // start the functionality manager
624  pMan = Hop_ManStart();
625 
626  // convert each node from SOP to BDD
627  Abc_NtkForEachNode( pNtk, pNode, i )
628  {
629  if ( Abc_ObjIsBarBuf(pNode) )
630  continue;
631  assert( pNode->pData );
632  pNode->pData = Abc_ConvertSopToAig( pMan, (char *)pNode->pData );
633  if ( pNode->pData == NULL )
634  {
635  Hop_ManStop( pMan );
636  printf( "Abc_NtkSopToAig: Error while converting SOP into AIG.\n" );
637  return 0;
638  }
639  }
640  Mem_FlexStop( (Mem_Flex_t *)pNtk->pManFunc, 0 );
641  pNtk->pManFunc = pMan;
642 
643  // update the network type
644  pNtk->ntkFunc = ABC_FUNC_AIG;
645  return 1;
646 }
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
static int Abc_ObjIsBarBuf(Abc_Obj_t *pObj)
Definition: abc.h:360
void Hop_ManStop(Hop_Man_t *p)
Definition: hopMan.c:84
void * pManFunc
Definition: abc.h:191
Hop_Man_t * Hop_ManStart()
DECLARATIONS ///.
Definition: hopMan.c:45
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
void Mem_FlexStop(Mem_Flex_t *p, int fVerbose)
Definition: mem.c:343
static Hop_Obj_t * Abc_ConvertSopToAig(Hop_Man_t *pMan, char *pSop)
Definition: abcFunc.c:709
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
ABC_DLL int Abc_NtkSopToBdd ( Abc_Ntk_t pNtk)

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

Synopsis [Converts the network from SOP to BDD representation.]

Description []

SideEffects []

SeeAlso []

Definition at line 113 of file abcFunc.c.

114 {
115  Abc_Obj_t * pNode;
116  DdManager * dd, * ddTemp = NULL;
117  Vec_Int_t * vFanins = NULL;
118  int nFaninsMax, i, k, iVar;
119 
120  assert( Abc_NtkHasSop(pNtk) );
121 
122  // start the functionality manager
123  nFaninsMax = Abc_NtkGetFaninMax( pNtk );
124  if ( nFaninsMax == 0 )
125  printf( "Warning: The network has only constant nodes.\n" );
126  dd = Cudd_Init( nFaninsMax, 0, CUDD_UNIQUE_SLOTS, CUDD_CACHE_SLOTS, 0 );
127 
128  // start temporary manager for reordered local functions
129  if ( nFaninsMax > 10 )
130  {
131  ddTemp = Cudd_Init( nFaninsMax, 0, CUDD_UNIQUE_SLOTS, CUDD_CACHE_SLOTS, 0 );
133  vFanins = Vec_IntAlloc( nFaninsMax );
134  }
135 
136  // convert each node from SOP to BDD
137  Abc_NtkForEachNode( pNtk, pNode, i )
138  {
139  if ( Abc_ObjIsBarBuf(pNode) )
140  continue;
141  assert( pNode->pData );
142  if ( Abc_ObjFaninNum(pNode) > 10 )
143  {
144  DdNode * pFunc = Abc_ConvertSopToBdd( ddTemp, (char *)pNode->pData, NULL );
145  if ( pFunc == NULL )
146  {
147  printf( "Abc_NtkSopToBdd: Error while converting SOP into BDD.\n" );
148  return 0;
149  }
150  Cudd_Ref( pFunc );
151  // find variable mapping
152  Vec_IntFill( vFanins, Abc_ObjFaninNum(pNode), -1 );
153  for ( k = iVar = 0; k < nFaninsMax; k++ )
154  if ( ddTemp->invperm[k] < Abc_ObjFaninNum(pNode) )
155  Vec_IntWriteEntry( vFanins, ddTemp->invperm[k], iVar++ );
156  assert( iVar == Abc_ObjFaninNum(pNode) );
157  // transfer to the main manager
158  pNode->pData = Extra_TransferPermute( ddTemp, dd, pFunc, Vec_IntArray(vFanins) );
159  Cudd_Ref( (DdNode *)pNode->pData );
160  Cudd_RecursiveDeref( ddTemp, pFunc );
161  // update variable order
162  Vec_IntClear( vFanins );
163  for ( k = 0; k < nFaninsMax; k++ )
164  if ( ddTemp->invperm[k] < Abc_ObjFaninNum(pNode) )
165  Vec_IntPush( vFanins, Vec_IntEntry(&pNode->vFanins, ddTemp->invperm[k]) );
166  for ( k = 0; k < Abc_ObjFaninNum(pNode); k++ )
167  Vec_IntWriteEntry( &pNode->vFanins, k, Vec_IntEntry(vFanins, k) );
168  }
169  else
170  {
171  pNode->pData = Abc_ConvertSopToBdd( dd, (char *)pNode->pData, NULL );
172  if ( pNode->pData == NULL )
173  {
174  printf( "Abc_NtkSopToBdd: Error while converting SOP into BDD.\n" );
175  return 0;
176  }
177  Cudd_Ref( (DdNode *)pNode->pData );
178  }
179  }
180 
181  if ( ddTemp )
182  {
183 // printf( "Reorderings performed = %d.\n", Cudd_ReadReorderings(ddTemp) );
184  Extra_StopManager( ddTemp );
185  }
186  Vec_IntFreeP( &vFanins );
187  Mem_FlexStop( (Mem_Flex_t *)pNtk->pManFunc, 0 );
188  pNtk->pManFunc = dd;
189 
190  // update the network type
191  pNtk->ntkFunc = ABC_FUNC_BDD;
192  return 1;
193 }
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
#define CUDD_UNIQUE_SLOTS
Definition: cudd.h:97
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
Definition: cudd.h:278
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
DdNode * Extra_TransferPermute(DdManager *ddSource, DdManager *ddDestination, DdNode *f, int *Permute)
Definition: extraBddMisc.c:87
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Abc_ObjIsBarBuf(Abc_Obj_t *pObj)
Definition: abc.h:360
ABC_DLL int Abc_NtkGetFaninMax(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:453
#define CUDD_CACHE_SLOTS
Definition: cudd.h:98
Vec_Int_t vFanins
Definition: abc.h:143
void Extra_StopManager(DdManager *dd)
Definition: extraBddMisc.c:223
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
void * pManFunc
Definition: abc.h:191
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
DdManager * Cudd_Init(unsigned int numVars, unsigned int numVarsZ, unsigned int numSlots, unsigned int cacheSize, unsigned long maxMemory)
Definition: cuddInit.c:125
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
void Mem_FlexStop(Mem_Flex_t *p, int fVerbose)
Definition: mem.c:343
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
#define assert(ex)
Definition: util_old.h:213
int * invperm
Definition: cuddInt.h:388
void Cudd_AutodynEnable(DdManager *unique, Cudd_ReorderingType method)
Definition: cuddAPI.c:669
void * pData
Definition: abc.h:145
DdNode * Abc_ConvertSopToBdd(DdManager *dd, char *pSop, DdNode **pbVars)
FUNCTION DEFINITIONS ///.
Definition: abcFunc.c:56
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
static char* Abc_NtkSpec ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 271 of file abc.h.

271 { return pNtk->pSpec; }
char * pSpec
Definition: abc.h:159
ABC_DLL Abc_Ntk_t* Abc_NtkStartFrom ( Abc_Ntk_t pNtk,
Abc_NtkType_t  Type,
Abc_NtkFunc_t  Func 
)

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

Synopsis [Starts a new network using existing network as a model.]

Description []

SideEffects []

SeeAlso []

Definition at line 106 of file abcNtk.c.

107 {
108  Abc_Ntk_t * pNtkNew;
109  Abc_Obj_t * pObj;
110  int fCopyNames, i;
111  if ( pNtk == NULL )
112  return NULL;
113  // decide whether to copy the names
114  fCopyNames = ( Type != ABC_NTK_NETLIST );
115  // start the network
116  pNtkNew = Abc_NtkAlloc( Type, Func, 1 );
117  pNtkNew->nConstrs = pNtk->nConstrs;
118  pNtkNew->nBarBufs = pNtk->nBarBufs;
119  // duplicate the name and the spec
120  pNtkNew->pName = Extra_UtilStrsav(pNtk->pName);
121  pNtkNew->pSpec = Extra_UtilStrsav(pNtk->pSpec);
122  // clean the node copy fields
123  Abc_NtkCleanCopy( pNtk );
124  // map the constant nodes
125  if ( Abc_NtkIsStrash(pNtk) && Abc_NtkIsStrash(pNtkNew) )
126  Abc_AigConst1(pNtk)->pCopy = Abc_AigConst1(pNtkNew);
127  // clone CIs/CIs/boxes
128  Abc_NtkForEachPi( pNtk, pObj, i )
129  Abc_NtkDupObj( pNtkNew, pObj, fCopyNames );
130  Abc_NtkForEachPo( pNtk, pObj, i )
131  Abc_NtkDupObj( pNtkNew, pObj, fCopyNames );
132  Abc_NtkForEachBox( pNtk, pObj, i )
133  Abc_NtkDupBox( pNtkNew, pObj, fCopyNames );
134  // transfer logic level
135  Abc_NtkForEachCi( pNtk, pObj, i )
136  pObj->pCopy->Level = pObj->Level;
137  // transfer the names
138 // Abc_NtkTrasferNames( pNtk, pNtkNew );
139  Abc_ManTimeDup( pNtk, pNtkNew );
140  if ( pNtk->vOnehots )
141  pNtkNew->vOnehots = (Vec_Ptr_t *)Vec_VecDupInt( (Vec_Vec_t *)pNtk->vOnehots );
142  if ( pNtk->pSeqModel )
143  pNtkNew->pSeqModel = Abc_CexDup( pNtk->pSeqModel, Abc_NtkLatchNum(pNtk) );
144  if ( pNtk->vObjPerm )
145  pNtkNew->vObjPerm = Vec_IntDup( pNtk->vObjPerm );
146  pNtkNew->AndGateDelay = pNtk->AndGateDelay;
147  // initialize logic level of the CIs
148  if ( pNtk->AndGateDelay != 0.0 && pNtk->pManTime != NULL && pNtk->ntkType != ABC_NTK_STRASH && Type == ABC_NTK_STRASH )
149  {
150  Abc_NtkForEachCi( pNtk, pObj, i )
151  pObj->pCopy->Level = (int)(Abc_NodeReadArrivalAve(pObj) / pNtk->AndGateDelay);
152  }
153  // check that the CI/CO/latches are copied correctly
154  assert( Abc_NtkCiNum(pNtk) == Abc_NtkCiNum(pNtkNew) );
155  assert( Abc_NtkCoNum(pNtk) == Abc_NtkCoNum(pNtkNew) );
156  assert( Abc_NtkLatchNum(pNtk) == Abc_NtkLatchNum(pNtkNew) );
157  return pNtkNew;
158 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition: abcObj.c:337
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
char * Extra_UtilStrsav(const char *s)
static Vec_Vec_t * Vec_VecDupInt(Vec_Vec_t *p)
Definition: vecVec.h:395
Abc_Obj_t * pCopy
Definition: abc.h:148
ABC_DLL Abc_Obj_t * Abc_NtkDupBox(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pBox, int fCopyName)
Definition: abcObj.c:407
if(last==0)
Definition: sparse_int.h:34
#define Abc_NtkForEachBox(pNtk, pObj, i)
Definition: abc.h:495
ABC_NAMESPACE_IMPL_START Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
char * pSpec
Definition: abc.h:159
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
int nBarBufs
Definition: abc.h:174
Abc_Cex_t * Abc_CexDup(Abc_Cex_t *p, int nRegsNew)
Definition: utilCex.c:145
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:507
#define assert(ex)
Definition: util_old.h:213
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
ABC_DLL float Abc_NodeReadArrivalAve(Abc_Obj_t *pNode)
Definition: abcTiming.c:87
char * pName
Definition: abc.h:158
ABC_DLL void Abc_ManTimeDup(Abc_Ntk_t *pNtkOld, Abc_Ntk_t *pNtkNew)
Definition: abcTiming.c:481
int nConstrs
Definition: abc.h:173
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
ABC_DLL Abc_Ntk_t* Abc_NtkStartFromNoLatches ( Abc_Ntk_t pNtk,
Abc_NtkType_t  Type,
Abc_NtkFunc_t  Func 
)

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

Synopsis [Starts a new network using existing network as a model.]

Description []

SideEffects []

SeeAlso []

Definition at line 248 of file abcNtk.c.

249 {
250  Abc_Ntk_t * pNtkNew;
251  Abc_Obj_t * pObj;
252  int i;
253  if ( pNtk == NULL )
254  return NULL;
255  assert( Type != ABC_NTK_NETLIST );
256  // start the network
257  pNtkNew = Abc_NtkAlloc( Type, Func, 1 );
258  pNtkNew->nConstrs = pNtk->nConstrs;
259  pNtkNew->nBarBufs = pNtk->nBarBufs;
260  // duplicate the name and the spec
261  pNtkNew->pName = Extra_UtilStrsav(pNtk->pName);
262  pNtkNew->pSpec = Extra_UtilStrsav(pNtk->pSpec);
263  // clean the node copy fields
264  Abc_NtkCleanCopy( pNtk );
265  // map the constant nodes
266  if ( Abc_NtkIsStrash(pNtk) && Abc_NtkIsStrash(pNtkNew) )
267  Abc_AigConst1(pNtk)->pCopy = Abc_AigConst1(pNtkNew);
268  // clone CIs/CIs/boxes
269  Abc_NtkForEachPi( pNtk, pObj, i )
270  Abc_NtkDupObj( pNtkNew, pObj, 1 );
271  Abc_NtkForEachPo( pNtk, pObj, i )
272  Abc_NtkDupObj( pNtkNew, pObj, 1 );
273  Abc_NtkForEachBox( pNtk, pObj, i )
274  {
275  if ( Abc_ObjIsLatch(pObj) )
276  continue;
277  Abc_NtkDupBox(pNtkNew, pObj, 1);
278  }
279  if ( pNtk->vObjPerm )
280  pNtkNew->vObjPerm = Vec_IntDup( pNtk->vObjPerm );
281  pNtkNew->AndGateDelay = pNtk->AndGateDelay;
282  // transfer the names
283 // Abc_NtkTrasferNamesNoLatches( pNtk, pNtkNew );
284  Abc_ManTimeDup( pNtk, pNtkNew );
285  // check that the CI/CO/latches are copied correctly
286  assert( Abc_NtkPiNum(pNtk) == Abc_NtkPiNum(pNtkNew) );
287  assert( Abc_NtkPoNum(pNtk) == Abc_NtkPoNum(pNtkNew) );
288  return pNtkNew;
289 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
static int Abc_ObjIsLatch(Abc_Obj_t *pObj)
Definition: abc.h:356
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition: abcObj.c:337
char * Extra_UtilStrsav(const char *s)
Abc_Obj_t * pCopy
Definition: abc.h:148
ABC_DLL Abc_Obj_t * Abc_NtkDupBox(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pBox, int fCopyName)
Definition: abcObj.c:407
#define Abc_NtkForEachBox(pNtk, pObj, i)
Definition: abc.h:495
ABC_NAMESPACE_IMPL_START Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
char * pSpec
Definition: abc.h:159
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:286
int nBarBufs
Definition: abc.h:174
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:285
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:507
#define assert(ex)
Definition: util_old.h:213
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
char * pName
Definition: abc.h:158
ABC_DLL void Abc_ManTimeDup(Abc_Ntk_t *pNtkOld, Abc_Ntk_t *pNtkNew)
Definition: abcTiming.c:481
int nConstrs
Definition: abc.h:173
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
ABC_DLL void Abc_NtkStartMvVars ( Abc_Ntk_t pNtk)

DECLARATIONS ///.

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

FileName [abcBlifMv.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Network and node package.]

Synopsis [Procedures to process BLIF-MV networks and AIGs.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Starts the Mv-Var manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 46 of file abcBlifMv.c.

47 {
48  Vec_Att_t * pAttMan;
49  assert( Abc_NtkMvVar(pNtk) == NULL );
50  pAttMan = Vec_AttAlloc( Abc_NtkObjNumMax(pNtk) + 1, Mem_FlexStart(), (void(*)(void*))Mem_FlexStop, NULL, NULL );
51  Vec_PtrWriteEntry( pNtk->vAttrs, VEC_ATTR_MVVAR, pAttMan );
52 //printf( "allocing attr\n" );
53 }
Vec_Ptr_t * vAttrs
Definition: abc.h:214
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
static void * Abc_NtkMvVar(Abc_Ntk_t *pNtk)
Definition: abc.h:435
Mem_Flex_t * Mem_FlexStart()
Definition: mem.c:311
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
void Mem_FlexStop(Mem_Flex_t *p, int fVerbose)
Definition: mem.c:343
static Vec_Att_t * Vec_AttAlloc(int nSize, void *pMan, void(*pFuncFreeMan)(void *), void *(*pFuncStartObj)(void *), void(*pFuncFreeObj)(void *, void *))
MACRO DEFINITIONS ///.
Definition: vecAtt.h:96
#define assert(ex)
Definition: util_old.h:213
ABC_DLL void Abc_NtkStartNameIds ( Abc_Ntk_t p)

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

Synopsis [Saves name IDs into a file.]

Description []

SideEffects []

SeeAlso []

Definition at line 538 of file abcNames.c.

539 {
540  char pFileName[1000];
541  FILE * pFile;
542  Abc_Obj_t * pObj, * pFanin;
543  Vec_Ptr_t * vNodes;
544  int i, Counter = 1;
545  assert( Abc_NtkIsNetlist(p) );
546  assert( p->vNameIds == NULL );
547  assert( strlen(p->pSpec) < 1000 );
548  sprintf( pFileName, "%s_%s_names.txt", Extra_FileNameGenericAppend(p->pSpec,""), Extra_FileNameExtension(p->pSpec) );
549  pFile = fopen( pFileName, "wb" );
551  // add inputs
552  Abc_NtkForEachCi( p, pObj, i )
553  fprintf( pFile, "%s \n", Abc_ObjName(Abc_ObjFanout0(pObj)) ), Vec_IntWriteEntry(p->vNameIds, Abc_ObjId(pObj), 2*Counter++);
554  // add outputs
555  Abc_NtkForEachCo( p, pObj, i )
556  {
557  pFanin = Abc_ObjFanin0(Abc_ObjFanin0(pObj));
558  if ( !Vec_IntEntry(p->vNameIds, Abc_ObjId(pFanin)) )
559  fprintf( pFile, "%s \n", Abc_ObjName(Abc_ObjFanout0(pFanin)) ), Vec_IntWriteEntry(p->vNameIds, Abc_ObjId(pFanin), 2*Counter++);
560  }
561  // add nodes in a topo order
562  vNodes = Abc_NtkDfs( p, 1 );
563  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
564  if ( !Vec_IntEntry(p->vNameIds, Abc_ObjId(pObj)) )
565  fprintf( pFile, "%s \n", Abc_ObjName(Abc_ObjFanout0(pObj)) ), Vec_IntWriteEntry(p->vNameIds, Abc_ObjId(pObj), 2*Counter++);
566  Vec_PtrFree( vNodes );
567  fclose( pFile );
568  // transfer driver node names to COs
569  Abc_NtkForEachCo( p, pObj, i )
570  {
571  pFanin = Abc_ObjFanin0(Abc_ObjFanin0(pObj));
572  Vec_IntWriteEntry( p->vNameIds, Abc_ObjId(pObj), Vec_IntEntry(p->vNameIds, Abc_ObjId(pFanin)) );
573  Vec_IntWriteEntry( p->vNameIds, Abc_ObjId(pFanin), 0 );
574  }
575 }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
Vec_Int_t * vNameIds
Definition: abc.h:215
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
Definition: abcDfs.c:81
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
if(last==0)
Definition: sparse_int.h:34
char * sprintf()
static int Counter
ABC_NAMESPACE_IMPL_START char * Abc_ObjName(Abc_Obj_t *pObj)
DECLARATIONS ///.
Definition: abcNames.c:48
char * pSpec
Definition: abc.h:159
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
#define assert(ex)
Definition: util_old.h:213
char * Extra_FileNameGenericAppend(char *pBase, char *pSuffix)
int strlen()
char * Extra_FileNameExtension(char *FileName)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL Abc_Ntk_t* Abc_NtkStartRead ( char *  pName)

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

Synopsis [Starts a new network using existing network as a model.]

Description []

SideEffects []

SeeAlso []

Definition at line 333 of file abcNtk.c.

334 {
335  Abc_Ntk_t * pNtkNew;
336  // allocate the empty network
337  pNtkNew = Abc_NtkAlloc( ABC_NTK_NETLIST, ABC_FUNC_SOP, 1 );
338  // set the specs
339  pNtkNew->pName = Extra_FileNameGeneric(pName);
340  pNtkNew->pSpec = Extra_UtilStrsav(pName);
341  if ( pNtkNew->pName == NULL || strlen(pNtkNew->pName) == 0 )
342  {
343  ABC_FREE( pNtkNew->pName );
344  pNtkNew->pName = Extra_UtilStrsav("unknown");
345  }
346  return pNtkNew;
347 }
char * Extra_UtilStrsav(const char *s)
char * Extra_FileNameGeneric(char *FileName)
ABC_NAMESPACE_IMPL_START Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
char * pSpec
Definition: abc.h:159
#define ABC_FREE(obj)
Definition: abc_global.h:232
int strlen()
char * pName
Definition: abc.h:158
ABC_DLL void Abc_NtkStartReverseLevels ( Abc_Ntk_t pNtk,
int  nMaxLevelIncrease 
)

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

Synopsis [Prepares for the computation of required levels.]

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

SideEffects []

SeeAlso []

Definition at line 1162 of file abcTiming.c.

1163 {
1164  Vec_Ptr_t * vNodes;
1165  Abc_Obj_t * pObj;
1166  int i;
1167  // remember the maximum number of direct levels
1168  pNtk->LevelMax = Abc_NtkLevel(pNtk) + nMaxLevelIncrease;
1169  // start the reverse levels
1170  pNtk->vLevelsR = Vec_IntAlloc( 0 );
1171  Vec_IntFill( pNtk->vLevelsR, 1 + Abc_NtkObjNumMax(pNtk), 0 );
1172  // compute levels in reverse topological order
1173  vNodes = Abc_NtkDfsReverse( pNtk );
1174  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
1176  Vec_PtrFree( vNodes );
1177 }
Vec_Int_t * vLevelsR
Definition: abc.h:196
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
int LevelMax
Definition: abc.h:195
void Abc_ObjSetReverseLevel(Abc_Obj_t *pObj, int LevelR)
Definition: abcTiming.c:1141
ABC_DLL Vec_Ptr_t * Abc_NtkDfsReverse(Abc_Ntk_t *pNtk)
Definition: abcDfs.c:190
int Abc_ObjReverseLevelNew(Abc_Obj_t *pObj)
Definition: abcTiming.c:1078
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
ABC_DLL int Abc_NtkLevel(Abc_Ntk_t *pNtk)
Definition: abcDfs.c:1265
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
static int Abc_NtkStep ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 274 of file abc.h.

274 { return pNtk->iStep; }
int iStep
Definition: abc.h:178
ABC_DLL void Abc_NtkStopReverseLevels ( Abc_Ntk_t pNtk)

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 1190 of file abcTiming.c.

1191 {
1192  assert( pNtk->vLevelsR );
1193  Vec_IntFree( pNtk->vLevelsR );
1194  pNtk->vLevelsR = NULL;
1195  pNtk->LevelMax = 0;
1196 
1197 }
Vec_Int_t * vLevelsR
Definition: abc.h:196
int LevelMax
Definition: abc.h:195
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
ABC_DLL Abc_Ntk_t* Abc_NtkStrash ( Abc_Ntk_t pNtk,
int  fAllNodes,
int  fCleanup,
int  fRecord 
)

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

Synopsis [Transforms logic network into structurally hashed AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 265 of file abcStrash.c.

266 {
267  Abc_Ntk_t * pNtkAig;
268  int nNodes;
269  assert( Abc_NtkIsLogic(pNtk) || Abc_NtkIsStrash(pNtk) );
270  // consider the special case when the network is already structurally hashed
271  if ( Abc_NtkIsStrash(pNtk) )
272  return Abc_NtkRestrash( pNtk, fCleanup );
273  // convert the node representation in the logic network to the AIG form
274  if ( !Abc_NtkToAig(pNtk) )
275  {
276  printf( "Converting to AIGs has failed.\n" );
277  return NULL;
278  }
279  // perform strashing
280 // Abc_NtkCleanCopy( pNtk );
281  pNtkAig = Abc_NtkStartFrom( pNtk, ABC_NTK_STRASH, ABC_FUNC_AIG );
282  Abc_NtkStrashPerform( pNtk, pNtkAig, fAllNodes, fRecord );
283  Abc_NtkFinalize( pNtk, pNtkAig );
284  // transfer name IDs
285  if ( pNtk->vNameIds )
286  Abc_NtkTransferNameIds( pNtk, pNtkAig );
287  // print warning about self-feed latches
288 // if ( Abc_NtkCountSelfFeedLatches(pNtkAig) )
289 // printf( "Warning: The network has %d self-feeding latches.\n", Abc_NtkCountSelfFeedLatches(pNtkAig) );
290  // perform cleanup if requested
291  nNodes = fCleanup? Abc_AigCleanup((Abc_Aig_t *)pNtkAig->pManFunc) : 0;
292 // if ( nNodes )
293 // printf( "Warning: AIG cleanup removed %d nodes (this is not a bug).\n", nNodes );
294  // duplicate EXDC
295  if ( pNtk->pExdc )
296  pNtkAig->pExdc = Abc_NtkStrash( pNtk->pExdc, fAllNodes, fCleanup, fRecord );
297  // make sure everything is okay
298  if ( !Abc_NtkCheck( pNtkAig ) )
299  {
300  printf( "Abc_NtkStrash: The network check has failed.\n" );
301  Abc_NtkDelete( pNtkAig );
302  return NULL;
303  }
304  return pNtkAig;
305 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static ABC_NAMESPACE_IMPL_START void Abc_NtkStrashPerform(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkNew, int fAllNodes, int fRecord)
DECLARATIONS ///.
Definition: abcStrash.c:413
Vec_Int_t * vNameIds
Definition: abc.h:215
Abc_Ntk_t * pExdc
Definition: abc.h:201
Abc_Ntk_t * Abc_NtkRestrash(Abc_Ntk_t *pNtk, int fCleanup)
FUNCTION DEFINITIONS ///.
Definition: abcStrash.c:49
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
DECLARATIONS ///.
Definition: abcAig.c:52
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
void * pManFunc
Definition: abc.h:191
ABC_DLL Abc_Ntk_t * Abc_NtkStartFrom(Abc_Ntk_t *pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func)
Definition: abcNtk.c:106
ABC_DLL int Abc_AigCleanup(Abc_Aig_t *pMan)
Definition: abcAig.c:194
ABC_DLL void Abc_NtkFinalize(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkNew)
Definition: abcNtk.c:302
ABC_DLL int Abc_NtkToAig(Abc_Ntk_t *pNtk)
Definition: abcFunc.c:1192
ABC_DLL void Abc_NtkTransferNameIds(Abc_Ntk_t *p, Abc_Ntk_t *pNew)
Definition: abcNames.c:588
#define assert(ex)
Definition: util_old.h:213
Abc_Ntk_t * Abc_NtkStrash(Abc_Ntk_t *pNtk, int fAllNodes, int fCleanup, int fRecord)
Definition: abcStrash.c:265
ABC_DLL Abc_Ntk_t* Abc_NtkStrashBlifMv ( Abc_Ntk_t pNtk)

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

Synopsis [Strashes the BLIF-MV netlist.]

Description []

SideEffects []

SeeAlso []

Definition at line 380 of file abcBlifMv.c.

381 {
382  int fUsePositional = 0;
383  Vec_Ptr_t * vNodes;
384  Abc_Obj_t ** pBits;
385  Abc_Obj_t ** pValues;
386  Abc_Ntk_t * pNtkNew;
387  Abc_Obj_t * pObj, * pTemp, * pBit, * pNet;
388  int i, k, v, nValues, nValuesMax, nBits;
389  int nCount1, nCount2;
390 
391  assert( Abc_NtkIsNetlist(pNtk) );
392  assert( Abc_NtkHasBlifMv(pNtk) );
393  assert( Abc_NtkWhiteboxNum(pNtk) == 0 );
394  assert( Abc_NtkBlackboxNum(pNtk) == 0 );
395 
396  // get the largest number of values
397  nValuesMax = 2;
398  Abc_NtkForEachNet( pNtk, pObj, i )
399  {
400  nValues = Abc_ObjMvVarNum(pObj);
401  if ( nValuesMax < nValues )
402  nValuesMax = nValues;
403  }
404  nBits = Abc_Base2Log( nValuesMax );
405  pBits = ABC_ALLOC( Abc_Obj_t *, nBits );
406 
407  // clean the node copy fields
408  Abc_NtkCleanCopy( pNtk );
409  // collect the nodes
410  vNodes = Abc_NtkDfs( pNtk, 0 );
411 
412  // start the network
413  pNtkNew = Abc_NtkAlloc( ABC_NTK_STRASH, ABC_FUNC_AIG, 1 );
414  // duplicate the name and the spec
415  pNtkNew->pName = Extra_UtilStrsav( pNtk->pName );
416 // pNtkNew->pSpec = Extra_UtilStrsav( pNtk->pName );
417 
418  nCount1 = nCount2 = 0;
419  // encode the CI nets
420  Abc_NtkIncrementTravId( pNtk );
421  if ( fUsePositional )
422  {
423  Abc_NtkForEachCi( pNtk, pObj, i )
424  {
425  if ( !Abc_ObjIsPi(pObj) )
426  continue;
427  pNet = Abc_ObjFanout0(pObj);
428  nValues = Abc_ObjMvVarNum(pNet);
429  pValues = ABC_ALLOC( Abc_Obj_t *, nValues );
430  // create PIs for the values
431  for ( v = 0; v < nValues; v++ )
432  {
433  pValues[v] = Abc_NtkCreatePi( pNtkNew );
434  if ( nValuesMax == 2 )
435  Abc_ObjAssignName( pValues[v], Abc_ObjName(pNet), NULL );
436  else
437  Abc_NtkConvertAssignName( pValues[v], pNet, v );
438  }
439  // save the values in the fanout net
440  pNet->pCopy = (Abc_Obj_t *)pValues;
441  // mark the net
442  Abc_NodeSetTravIdCurrent( pNet );
443  }
444  Abc_NtkForEachCi( pNtk, pObj, i )
445  {
446  if ( Abc_ObjIsPi(pObj) )
447  continue;
448  pNet = Abc_ObjFanout0(pObj);
449  nValues = Abc_ObjMvVarNum(pNet);
450  pValues = ABC_ALLOC( Abc_Obj_t *, nValues );
451  // create PIs for the values
452  for ( v = 0; v < nValues; v++ )
453  {
454  pValues[v] = Abc_NtkCreateBo( pNtkNew );
455  if ( nValuesMax == 2 )
456  Abc_ObjAssignName( pValues[v], Abc_ObjName(pNet), NULL );
457  else
458  Abc_NtkConvertAssignName( pValues[v], pNet, v );
459  nCount1++;
460  }
461  // save the values in the fanout net
462  pNet->pCopy = (Abc_Obj_t *)pValues;
463  // mark the net
464  Abc_NodeSetTravIdCurrent( pNet );
465  }
466  }
467  else
468  {
469  Abc_NtkForEachCi( pNtk, pObj, i )
470  {
471  if ( !Abc_ObjIsPi(pObj) )
472  continue;
473  pNet = Abc_ObjFanout0(pObj);
474  nValues = Abc_ObjMvVarNum(pNet);
475  pValues = ABC_ALLOC( Abc_Obj_t *, nValues );
476  // create PIs for the encoding bits
477  nBits = Abc_Base2Log( nValues );
478  for ( k = 0; k < nBits; k++ )
479  {
480  pBits[k] = Abc_NtkCreatePi( pNtkNew );
481  if ( nValuesMax == 2 )
482  Abc_ObjAssignName( pBits[k], Abc_ObjName(pNet), NULL );
483  else
484  Abc_NtkConvertAssignName( pBits[k], pNet, k );
485  }
486  // encode the values
487  for ( v = 0; v < nValues; v++ )
488  {
489  pValues[v] = Abc_AigConst1(pNtkNew);
490  for ( k = 0; k < nBits; k++ )
491  {
492  pBit = Abc_ObjNotCond( pBits[k], (v&(1<<k)) == 0 );
493  pValues[v] = Abc_AigAnd( (Abc_Aig_t *)pNtkNew->pManFunc, pValues[v], pBit );
494  }
495  }
496  // save the values in the fanout net
497  pNet->pCopy = (Abc_Obj_t *)pValues;
498  // mark the net
499  Abc_NodeSetTravIdCurrent( pNet );
500  }
501  Abc_NtkForEachCi( pNtk, pObj, i )
502  {
503  if ( Abc_ObjIsPi(pObj) )
504  continue;
505  pNet = Abc_ObjFanout0(pObj);
506  nValues = Abc_ObjMvVarNum(pNet);
507  pValues = ABC_ALLOC( Abc_Obj_t *, nValues );
508  // create PIs for the encoding bits
509  nBits = Abc_Base2Log( nValues );
510  for ( k = 0; k < nBits; k++ )
511  {
512  pBits[k] = Abc_NtkCreateBo( pNtkNew );
513  if ( nValuesMax == 2 )
514  Abc_ObjAssignName( pBits[k], Abc_ObjName(pNet), NULL );
515  else
516  Abc_NtkConvertAssignName( pBits[k], pNet, k );
517  nCount1++;
518  }
519  // encode the values
520  for ( v = 0; v < nValues; v++ )
521  {
522  pValues[v] = Abc_AigConst1(pNtkNew);
523  for ( k = 0; k < nBits; k++ )
524  {
525  pBit = Abc_ObjNotCond( pBits[k], (v&(1<<k)) == 0 );
526  pValues[v] = Abc_AigAnd( (Abc_Aig_t *)pNtkNew->pManFunc, pValues[v], pBit );
527  }
528  }
529  // save the values in the fanout net
530  pNet->pCopy = (Abc_Obj_t *)pValues;
531  // mark the net
532  Abc_NodeSetTravIdCurrent( pNet );
533  }
534  }
535 
536  // process nodes in the topological order
537  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
538  if ( !Abc_NodeStrashBlifMv( pNtkNew, pObj ) )
539  {
540  Abc_NtkDelete( pNtkNew );
541  return NULL;
542  }
543  Vec_PtrFree( vNodes );
544 
545  // encode the CO nets
546  if ( fUsePositional )
547  {
548  Abc_NtkForEachCo( pNtk, pObj, i )
549  {
550  if ( !Abc_ObjIsPo(pObj) )
551  continue;
552  pNet = Abc_ObjFanin0(pObj);
553  // skip marked nets
554 // if ( Abc_NodeIsTravIdCurrent(pNet) )
555 // continue;
556 // Abc_NodeSetTravIdCurrent( pNet );
557  nValues = Abc_ObjMvVarNum(pNet);
558  pValues = (Abc_Obj_t **)pNet->pCopy;
559  for ( v = 0; v < nValues; v++ )
560  {
561  pTemp = Abc_NtkCreatePo( pNtkNew );
562  Abc_ObjAddFanin( pTemp, pValues[v] );
563  if ( nValuesMax == 2 )
564  Abc_ObjAssignName( pTemp, Abc_ObjName(pNet), NULL );
565  else
566  Abc_NtkConvertAssignName( pTemp, pNet, v );
567  }
568  }
569  Abc_NtkForEachCo( pNtk, pObj, i )
570  {
571  if ( Abc_ObjIsPo(pObj) )
572  continue;
573  pNet = Abc_ObjFanin0(pObj);
574  // skip marked nets
575 // if ( Abc_NodeIsTravIdCurrent(pNet) )
576 // continue;
577 // Abc_NodeSetTravIdCurrent( pNet );
578  nValues = Abc_ObjMvVarNum(pNet);
579  pValues = (Abc_Obj_t **)pNet->pCopy;
580  for ( v = 0; v < nValues; v++ )
581  {
582  pTemp = Abc_NtkCreateBi( pNtkNew );
583  Abc_ObjAddFanin( pTemp, pValues[v] );
584  if ( nValuesMax == 2 )
585  Abc_ObjAssignName( pTemp, Abc_ObjName(pNet), NULL );
586  else
587  Abc_NtkConvertAssignName( pTemp, pNet, v );
588  nCount2++;
589  }
590  }
591  }
592  else // if ( fPositional == 0 )
593  {
594  Abc_NtkForEachCo( pNtk, pObj, i )
595  {
596  if ( !Abc_ObjIsPo(pObj) )
597  continue;
598  pNet = Abc_ObjFanin0(pObj);
599  // skip marked nets
600 // if ( Abc_NodeIsTravIdCurrent(pNet) )
601 // continue;
602 // Abc_NodeSetTravIdCurrent( pNet );
603  nValues = Abc_ObjMvVarNum(pNet);
604  pValues = (Abc_Obj_t **)pNet->pCopy;
605  nBits = Abc_Base2Log( nValues );
606  for ( k = 0; k < nBits; k++ )
607  {
608  pBit = Abc_ObjNot( Abc_AigConst1(pNtkNew) );
609  for ( v = 0; v < nValues; v++ )
610  if ( v & (1<<k) )
611  pBit = Abc_AigOr( (Abc_Aig_t *)pNtkNew->pManFunc, pBit, pValues[v] );
612  pTemp = Abc_NtkCreatePo( pNtkNew );
613  Abc_ObjAddFanin( pTemp, pBit );
614  if ( nValuesMax == 2 )
615  Abc_ObjAssignName( pTemp, Abc_ObjName(pNet), NULL );
616  else
617  Abc_NtkConvertAssignName( pTemp, pNet, k );
618  }
619  }
620  Abc_NtkForEachCo( pNtk, pObj, i )
621  {
622  if ( Abc_ObjIsPo(pObj) )
623  continue;
624  pNet = Abc_ObjFanin0(pObj);
625  // skip marked nets
626 // if ( Abc_NodeIsTravIdCurrent(pNet) )
627 // continue;
628 // Abc_NodeSetTravIdCurrent( pNet );
629  nValues = Abc_ObjMvVarNum(pNet);
630  pValues = (Abc_Obj_t **)pNet->pCopy;
631  nBits = Abc_Base2Log( nValues );
632  for ( k = 0; k < nBits; k++ )
633  {
634  pBit = Abc_ObjNot( Abc_AigConst1(pNtkNew) );
635  for ( v = 0; v < nValues; v++ )
636  if ( v & (1<<k) )
637  pBit = Abc_AigOr( (Abc_Aig_t *)pNtkNew->pManFunc, pBit, pValues[v] );
638  pTemp = Abc_NtkCreateBi( pNtkNew );
639  Abc_ObjAddFanin( pTemp, pBit );
640  if ( nValuesMax == 2 )
641  Abc_ObjAssignName( pTemp, Abc_ObjName(pNet), NULL );
642  else
643  Abc_NtkConvertAssignName( pTemp, pNet, k );
644  nCount2++;
645  }
646  }
647  }
648 
649  if ( Abc_NtkLatchNum(pNtk) )
650  {
651  Vec_Ptr_t * vTemp;
652  Abc_Obj_t * pLatch, * pObjLi, * pObjLo;
653  int i;
654  // move free vars to the front among the PIs
655  vTemp = Vec_PtrAlloc( Vec_PtrSize(pNtkNew->vPis) );
656  Abc_NtkForEachPi( pNtkNew, pObj, i )
657  if ( strncmp( Abc_ObjName(pObj), "free_var_", 9 ) == 0 )
658  Vec_PtrPush( vTemp, pObj );
659  Abc_NtkForEachPi( pNtkNew, pObj, i )
660  if ( strncmp( Abc_ObjName(pObj), "free_var_", 9 ) != 0 )
661  Vec_PtrPush( vTemp, pObj );
662  assert( Vec_PtrSize(vTemp) == Vec_PtrSize(pNtkNew->vPis) );
663  Vec_PtrFree( pNtkNew->vPis );
664  pNtkNew->vPis = vTemp;
665  // move free vars to the front among the CIs
666  vTemp = Vec_PtrAlloc( Vec_PtrSize(pNtkNew->vCis) );
667  Abc_NtkForEachCi( pNtkNew, pObj, i )
668  if ( strncmp( Abc_ObjName(pObj), "free_var_", 9 ) == 0 )
669  Vec_PtrPush( vTemp, pObj );
670  Abc_NtkForEachCi( pNtkNew, pObj, i )
671  if ( strncmp( Abc_ObjName(pObj), "free_var_", 9 ) != 0 )
672  Vec_PtrPush( vTemp, pObj );
673  assert( Vec_PtrSize(vTemp) == Vec_PtrSize(pNtkNew->vCis) );
674  Vec_PtrFree( pNtkNew->vCis );
675  pNtkNew->vCis = vTemp;
676  // create registers
677  assert( nCount1 == nCount2 );
678  for ( i = 0; i < nCount1; i++ )
679  {
680  // create latch
681  pLatch = Abc_NtkCreateLatch( pNtkNew );
682  Abc_LatchSetInit0( pLatch );
683  Abc_ObjAssignName( pLatch, Abc_ObjName(pLatch), NULL );
684  // connect
685  pObjLi = Abc_NtkCo( pNtkNew, Abc_NtkCoNum(pNtkNew)-nCount1+i );
686  pObjLo = Abc_NtkCi( pNtkNew, Abc_NtkCiNum(pNtkNew)-nCount1+i );
687  Abc_ObjAddFanin( pLatch, pObjLi );
688  Abc_ObjAddFanin( pObjLo, pLatch );
689  }
690  }
691 
692  // cleanup
693  ABC_FREE( pBits );
694  Abc_NtkForEachObj( pNtk, pObj, i )
695  if ( pObj->pCopy )
696  ABC_FREE( pObj->pCopy );
697 
698  // remove dangling nodes
699  i = Abc_AigCleanup((Abc_Aig_t *)pNtkNew->pManFunc);
700 // printf( "Cleanup removed %d nodes.\n", i );
701 // Abc_NtkReassignIds( pNtkNew );
702 
703  // check integrity
704  if ( !Abc_NtkCheck( pNtkNew ) )
705  {
706  fprintf( stdout, "Abc_NtkStrashBlifMv(): Network check has failed.\n" );
707  Abc_NtkDelete( pNtkNew );
708  return NULL;
709  }
710  return pNtkNew;
711 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
ABC_DLL Abc_Obj_t * Abc_AigOr(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:719
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
int Abc_NodeStrashBlifMv(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj)
Definition: abcBlifMv.c:140
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
static int Abc_ObjIsPi(Abc_Obj_t *pObj)
Definition: abc.h:347
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static Abc_Obj_t * Abc_NtkCi(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:317
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition: abcNames.c:68
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
Definition: abcDfs.c:81
Vec_Ptr_t * vPis
Definition: abc.h:163
static int Abc_NtkHasBlifMv(Abc_Ntk_t *pNtk)
Definition: abc.h:257
static int Abc_NtkWhiteboxNum(Abc_Ntk_t *pNtk)
Definition: abc.h:295
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
for(p=first;p->value< newval;p=p->next)
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
DECLARATIONS ///.
Definition: abcAig.c:52
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
char * Extra_UtilStrsav(const char *s)
static Abc_Obj_t * Abc_NtkCo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:318
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
ABC_DLL Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
static Abc_Obj_t * Abc_NtkCreateBo(Abc_Ntk_t *pNtk)
Definition: abc.h:306
void * pManFunc
Definition: abc.h:191
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:700
Abc_Obj_t * pCopy
Definition: abc.h:148
ABC_DLL int Abc_AigCleanup(Abc_Aig_t *pMan)
Definition: abcAig.c:194
if(last==0)
Definition: sparse_int.h:34
static Abc_Obj_t * Abc_NtkCreateLatch(Abc_Ntk_t *pNtk)
Definition: abc.h:309
#define Abc_NtkForEachNet(pNtk, pNet, i)
Definition: abc.h:458
static Abc_Obj_t * Abc_NtkCreatePi(Abc_Ntk_t *pNtk)
Definition: abc.h:303
static void Abc_NtkConvertAssignName(Abc_Obj_t *pObj, Abc_Obj_t *pNet, int Index)
Definition: abcBlifMv.c:360
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define ABC_FREE(obj)
Definition: abc_global.h:232
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
static int Abc_Base2Log(unsigned n)
Definition: abc_global.h:251
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
int strncmp()
static int Abc_ObjMvVarNum(Abc_Obj_t *pObj)
Definition: abc.h:438
static int Abc_ObjIsPo(Abc_Obj_t *pObj)
Definition: abc.h:348
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:507
static Abc_Obj_t * Abc_ObjNotCond(Abc_Obj_t *p, int c)
Definition: abc.h:325
#define assert(ex)
Definition: util_old.h:213
static Abc_Obj_t * Abc_ObjNot(Abc_Obj_t *p)
Definition: abc.h:324
static int Abc_NtkBlackboxNum(Abc_Ntk_t *pNtk)
Definition: abc.h:296
static Abc_Obj_t * Abc_NtkCreateBi(Abc_Ntk_t *pNtk)
Definition: abc.h:305
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
static void Abc_LatchSetInit0(Abc_Obj_t *pLatch)
Definition: abc.h:418
static Abc_Obj_t * Abc_NtkCreatePo(Abc_Ntk_t *pNtk)
Definition: abc.h:304
char * pName
Definition: abc.h:158
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
static void Abc_NodeSetTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:409
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL Vec_Ptr_t* Abc_NtkSupport ( Abc_Ntk_t pNtk)

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

Synopsis [Returns the set of CI nodes in the support of the given nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 828 of file abcDfs.c.

829 {
830  Vec_Ptr_t * vNodes;
831  Abc_Obj_t * pNode;
832  int i;
833  // set the traversal ID
834  Abc_NtkIncrementTravId( pNtk );
835  // start the array of nodes
836  vNodes = Vec_PtrAlloc( 100 );
837  // go through the PO nodes and call for each of them
838  Abc_NtkForEachCo( pNtk, pNode, i )
839  Abc_NtkNodeSupport_rec( Abc_ObjFanin0(pNode), vNodes );
840  // add unused CIs
841  Abc_NtkForEachCi( pNtk, pNode, i )
842  if ( !Abc_NodeIsTravIdCurrent( pNode ) )
843  Vec_PtrPush( vNodes, pNode );
844  assert( Vec_PtrSize(vNodes) == Abc_NtkCiNum(pNtk) );
845  return vNodes;
846 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
void Abc_NtkNodeSupport_rec(Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
Definition: abcDfs.c:795
if(last==0)
Definition: sparse_int.h:34
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:411
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
#define assert(ex)
Definition: util_old.h:213
ABC_DLL int Abc_NtkSweep ( Abc_Ntk_t pNtk,
int  fVerbose 
)

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

Synopsis [Tranditional sweep of the network.]

Description [Propagates constant and single-input node, removes dangling nodes.]

SideEffects []

SeeAlso []

Definition at line 574 of file abcSweep.c.

575 {
576  Vec_Ptr_t * vNodes;
577  Abc_Obj_t * pNode, * pFanout, * pDriver;
578  int i, nNodesOld;
579  assert( Abc_NtkIsLogic(pNtk) );
580  // convert network to BDD representation
581  if ( !Abc_NtkToBdd(pNtk) )
582  {
583  fprintf( stdout, "Converting to BDD has failed.\n" );
584  return 1;
585  }
586  // perform cleanup
587  nNodesOld = Abc_NtkNodeNum(pNtk);
588  Abc_NtkCleanup( pNtk, 0 );
589  // prepare nodes for sweeping
591  Abc_NtkMinimumBase(pNtk);
592  // collect sweepable nodes
593  vNodes = Vec_PtrAlloc( 100 );
594  Abc_NtkForEachNode( pNtk, pNode, i )
595  if ( Abc_ObjFaninNum(pNode) < 2 )
596  Vec_PtrPush( vNodes, pNode );
597  // sweep the nodes
598  while ( Vec_PtrSize(vNodes) > 0 )
599  {
600  // get any sweepable node
601  pNode = (Abc_Obj_t *)Vec_PtrPop(vNodes);
602  if ( !Abc_ObjIsNode(pNode) )
603  continue;
604  // get any non-CO fanout of this node
605  pFanout = Abc_NodeFindNonCoFanout(pNode);
606  if ( pFanout == NULL )
607  continue;
608  assert( Abc_ObjIsNode(pFanout) );
609  // transform the function of the fanout
610  if ( Abc_ObjFaninNum(pNode) == 0 )
611  Abc_NodeConstantInput( pFanout, pNode, Abc_NodeIsConst0(pNode) );
612  else
613  {
614  assert( Abc_ObjFaninNum(pNode) == 1 );
615  pDriver = Abc_ObjFanin0(pNode);
616  if ( Abc_NodeIsInv(pNode) )
617  Abc_NodeComplementInput( pFanout, pNode );
618  Abc_ObjPatchFanin( pFanout, pNode, pDriver );
619  }
620  Abc_NodeRemoveDupFanins( pFanout );
621  Abc_NodeMinimumBase( pFanout );
622  // check if the fanout should be added
623  if ( Abc_ObjFaninNum(pFanout) < 2 )
624  Vec_PtrPush( vNodes, pFanout );
625  // check if the node has other fanouts
626  if ( Abc_ObjFanoutNum(pNode) > 0 )
627  Vec_PtrPush( vNodes, pNode );
628  else
629  Abc_NtkDeleteObj_rec( pNode, 1 );
630  }
631  Vec_PtrFree( vNodes );
632  // sweep a node into its CO fanout if all of this is true:
633  // (a) this node is a single-input node
634  // (b) the driver of the node has only one fanout (this node)
635  // (c) the driver is a node
636  Abc_NtkForEachCo( pNtk, pFanout, i )
637  {
638  pNode = Abc_ObjFanin0(pFanout);
639  if ( Abc_ObjFaninNum(pNode) != 1 )
640  continue;
641  pDriver = Abc_ObjFanin0(pNode);
642  if ( !(Abc_ObjFanoutNum(pDriver) == 1 && Abc_ObjIsNode(pDriver)) )
643  continue;
644  // trasform this CO
645  if ( Abc_NodeIsInv(pNode) )
646  pDriver->pData = Cudd_Not(pDriver->pData);
647  Abc_ObjPatchFanin( pFanout, pNode, pDriver );
648  }
649  // perform cleanup
650  Abc_NtkCleanup( pNtk, 0 );
651  // report
652  if ( fVerbose )
653  printf( "Sweep removed %d nodes.\n", nNodesOld - Abc_NtkNodeNum(pNtk) );
654  return nNodesOld - Abc_NtkNodeNum(pNtk);
655 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
#define Cudd_Not(node)
Definition: cudd.h:367
ABC_DLL int Abc_NtkMinimumBase(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcMinBase.c:48
ABC_DLL int Abc_NodeIsConst0(Abc_Obj_t *pNode)
Definition: abcObj.c:860
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
ABC_DLL void Abc_NtkDeleteObj_rec(Abc_Obj_t *pObj, int fOnlyNodes)
Definition: abcObj.c:273
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
ABC_DLL int Abc_NtkRemoveDupFanins(Abc_Ntk_t *pNtk)
Definition: abcMinBase.c:116
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void * Vec_PtrPop(Vec_Ptr_t *p)
Definition: vecPtr.h:677
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
int Abc_NtkCleanup(Abc_Ntk_t *pNtk, int fVerbose)
Definition: abcSweep.c:476
ABC_DLL void Abc_ObjPatchFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFaninOld, Abc_Obj_t *pFaninNew)
Definition: abcFanio.c:172
ABC_DLL Abc_Obj_t * Abc_NodeFindNonCoFanout(Abc_Obj_t *pNode)
Definition: abcUtil.c:800
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
Definition: abc.h:293
if(last==0)
Definition: sparse_int.h:34
ABC_DLL int Abc_NtkToBdd(Abc_Ntk_t *pNtk)
Definition: abcFunc.c:1160
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
static void Abc_NodeConstantInput(Abc_Obj_t *pNode, Abc_Obj_t *pFanin, int fConst0)
Definition: abcSweep.c:669
ABC_DLL int Abc_NodeIsInv(Abc_Obj_t *pNode)
Definition: abcObj.c:950
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
ABC_DLL int Abc_NodeRemoveDupFanins(Abc_Obj_t *pNode)
Definition: abcMinBase.c:180
ABC_DLL int Abc_NodeMinimumBase(Abc_Obj_t *pNode)
Definition: abcMinBase.c:70
ABC_DLL void Abc_NodeComplementInput(Abc_Obj_t *pNode, Abc_Obj_t *pFanin)
Definition: abcObj.c:1005
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL int Abc_NtkSweepBufsInvs ( Abc_Ntk_t pNtk,
int  fVerbose 
)

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

Synopsis [Sweep to remove buffers and inverters.]

Description []

SideEffects []

SeeAlso []

Definition at line 959 of file abcSweep.c.

960 {
961  Hop_Man_t * pMan;
962  Abc_Obj_t * pObj, * pFanin;
963  int i, k, fChanges = 1, Counter = 0;
964  assert( Abc_NtkIsLogic(pNtk) );
965  // convert network to BDD representation
966  if ( !Abc_NtkToAig(pNtk) )
967  {
968  fprintf( stdout, "Converting to SOP has failed.\n" );
969  return 1;
970  }
971  // get AIG manager
972  pMan = (Hop_Man_t *)pNtk->pManFunc;
973  // label selected nodes
974  Abc_NtkIncrementTravId( pNtk );
975  // iterate till no improvement
976  while ( fChanges )
977  {
978  fChanges = 0;
979  Abc_NtkForEachObj( pNtk, pObj, i )
980  {
981  Abc_ObjForEachFanin( pObj, pFanin, k )
982  {
983  // do not eliminate marked fanins
984  if ( Abc_NodeIsTravIdCurrent(pFanin) )
985  continue;
986  // do not eliminate constant nodes
987  if ( !Abc_ObjIsNode(pFanin) || Abc_ObjFaninNum(pFanin) != 1 )
988  continue;
989  // do not eliminate inverters into COs
990  if ( Abc_ObjIsCo(pObj) && Abc_NodeIsInv(pFanin) )
991  continue;
992  // do not eliminate buffers connecting PIs and POs
993 // if ( Abc_ObjIsCo(pObj) && Abc_ObjIsCi(Abc_ObjFanin0(pFanin)) )
994 // continue;
995  fChanges = 1;
996  Counter++;
997  // update function of the node
998  if ( Abc_NodeIsInv(pFanin) )
999  pObj->pData = Hop_Compose( pMan, (Hop_Obj_t *)pObj->pData, Hop_Not(Hop_IthVar(pMan, k)), k );
1000  // update the fanin
1001  Abc_ObjPatchFanin( pObj, pFanin, Abc_ObjFanin0(pFanin) );
1002  if ( Abc_ObjFanoutNum(pFanin) == 0 )
1003  Abc_NtkDeleteObj(pFanin);
1004  }
1005  }
1006  }
1007  if ( fVerbose )
1008  printf( "Removed %d single input nodes.\n", Counter );
1009  return Counter;
1010 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
Hop_Obj_t * Hop_Compose(Hop_Man_t *p, Hop_Obj_t *pRoot, Hop_Obj_t *pFunc, int iVar)
Definition: hopDfs.c:415
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static Hop_Obj_t * Hop_Not(Hop_Obj_t *p)
Definition: hop.h:127
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
Definition: hop.h:65
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
Definition: abc.h:352
ABC_DLL void Abc_ObjPatchFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFaninOld, Abc_Obj_t *pFaninNew)
Definition: abcFanio.c:172
void * pManFunc
Definition: abc.h:191
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
ABC_DLL void Abc_NtkDeleteObj(Abc_Obj_t *pObj)
Definition: abcObj.c:167
static int Counter
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:411
ABC_DLL int Abc_NodeIsInv(Abc_Obj_t *pNode)
Definition: abcObj.c:950
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
ABC_DLL int Abc_NtkToAig(Abc_Ntk_t *pNtk)
Definition: abcFunc.c:1192
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
Hop_Obj_t * Hop_IthVar(Hop_Man_t *p, int i)
FUNCTION DEFINITIONS ///.
Definition: hopOper.c:63
ABC_DLL void Abc_NtkTimeInitialize ( Abc_Ntk_t pNtk,
Abc_Ntk_t pNtkOld 
)

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

Synopsis [Finalizes the timing manager after setting arr/req times.]

Description []

SideEffects []

SeeAlso []

Definition at line 321 of file abcTiming.c.

322 {
323  Abc_Obj_t * pObj;
324  Abc_Time_t ** ppTimes, * pTime;
325  int i;
326  assert( pNtkOld == NULL || pNtkOld->pManTime != NULL );
327  assert( pNtkOld == NULL || Abc_NtkCiNum(pNtk) == Abc_NtkCiNum(pNtkOld) );
328  assert( pNtkOld == NULL || Abc_NtkCoNum(pNtk) == Abc_NtkCoNum(pNtkOld) );
329  if ( pNtk->pManTime == NULL )
330  return;
331  Abc_ManTimeExpand( pNtk->pManTime, Abc_NtkObjNumMax(pNtk), 0 );
332  // set global defaults
333  if ( pNtkOld )
334  {
335  pNtk->pManTime->tArrDef = pNtkOld->pManTime->tArrDef;
336  pNtk->pManTime->tReqDef = pNtkOld->pManTime->tReqDef;
337  pNtk->AndGateDelay = pNtkOld->AndGateDelay;
338  }
339  // set the default timing
340  ppTimes = (Abc_Time_t **)pNtk->pManTime->vArrs->pArray;
341  Abc_NtkForEachCi( pNtk, pObj, i )
342  {
343  pTime = ppTimes[pObj->Id];
344  if ( Abc_MaxFloat(pTime->Fall, pTime->Rise) != -ABC_INFINITY )
345  continue;
346  *pTime = pNtkOld ? *Abc_NodeReadArrival(Abc_NtkCi(pNtkOld, i)) : pNtk->pManTime->tArrDef;
347  }
348  // set the default timing
349  ppTimes = (Abc_Time_t **)pNtk->pManTime->vReqs->pArray;
350  Abc_NtkForEachCo( pNtk, pObj, i )
351  {
352  pTime = ppTimes[pObj->Id];
353  if ( Abc_MaxFloat(pTime->Fall, pTime->Rise) != ABC_INFINITY )
354  continue;
355  *pTime = pNtkOld ? *Abc_NodeReadRequired(Abc_NtkCo(pNtkOld, i)) : pNtk->pManTime->tReqDef;
356  }
357  // set the 0 arrival times for latch outputs and constant nodes
358  ppTimes = (Abc_Time_t **)pNtk->pManTime->vArrs->pArray;
359  Abc_NtkForEachLatchOutput( pNtk, pObj, i )
360  {
361  pTime = ppTimes[pObj->Id];
362  pTime->Fall = pTime->Rise = 0.0;
363  }
364 }
Abc_Time_t * Abc_NodeReadRequired(Abc_Obj_t *pNode)
Definition: abcTiming.c:82
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
float AndGateDelay
Definition: abc.h:194
#define Abc_NtkForEachLatchOutput(pNtk, pObj, i)
Definition: abc.h:503
Vec_Ptr_t * vArrs
Definition: abcTiming.c:36
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static Abc_Obj_t * Abc_NtkCi(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:317
static float Abc_MaxFloat(float a, float b)
Definition: abc_global.h:243
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
static Abc_Obj_t * Abc_NtkCo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:318
static void Abc_ManTimeExpand(Abc_ManTime_t *p, int nSize, int fProgressive)
Definition: abcTiming.c:533
Abc_Time_t tArrDef
Definition: abcTiming.c:34
float Fall
Definition: abc.h:125
Vec_Ptr_t * vReqs
Definition: abcTiming.c:37
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
int Id
Definition: abc.h:132
Abc_ManTime_t * pManTime
Definition: abc.h:192
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
#define assert(ex)
Definition: util_old.h:213
Abc_Time_t * Abc_NodeReadArrival(Abc_Obj_t *pNode)
Definition: abcTiming.c:77
Abc_Time_t tReqDef
Definition: abcTiming.c:35
float Rise
Definition: abc.h:124
ABC_DLL void Abc_NtkTimeSetArrival ( Abc_Ntk_t pNtk,
int  ObjId,
float  Rise,
float  Fall 
)

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

Synopsis [Sets the arrival time for an object.]

Description []

SideEffects []

SeeAlso []

Definition at line 185 of file abcTiming.c.

186 {
187  Vec_Ptr_t * vTimes;
188  Abc_Time_t * pTime;
189  if ( pNtk->pManTime == NULL )
190  pNtk->pManTime = Abc_ManTimeStart(pNtk);
191  if ( pNtk->pManTime->tArrDef.Rise == Rise && pNtk->pManTime->tArrDef.Fall == Fall )
192  return;
193  Abc_ManTimeExpand( pNtk->pManTime, ObjId + 1, 1 );
194  // set the arrival time
195  vTimes = pNtk->pManTime->vArrs;
196  pTime = (Abc_Time_t *)vTimes->pArray[ObjId];
197  pTime->Rise = Rise;
198  pTime->Fall = Fall;
199 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
Vec_Ptr_t * vArrs
Definition: abcTiming.c:36
static void Abc_ManTimeExpand(Abc_ManTime_t *p, int nSize, int fProgressive)
Definition: abcTiming.c:533
Abc_Time_t tArrDef
Definition: abcTiming.c:34
float Fall
Definition: abc.h:125
static Abc_ManTime_t * Abc_ManTimeStart(Abc_Ntk_t *pNtk)
Definition: abcTiming.c:431
Abc_ManTime_t * pManTime
Definition: abc.h:192
float Rise
Definition: abc.h:124
ABC_DLL void Abc_NtkTimeSetDefaultArrival ( Abc_Ntk_t pNtk,
float  Rise,
float  Fall 
)

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

Synopsis [Sets the default arrival time for the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 155 of file abcTiming.c.

156 {
157  if ( Rise == 0.0 && Fall == 0.0 )
158  return;
159  if ( pNtk->pManTime == NULL )
160  pNtk->pManTime = Abc_ManTimeStart(pNtk);
161  pNtk->pManTime->tArrDef.Rise = Rise;
162  pNtk->pManTime->tArrDef.Fall = Fall;
163 }
Abc_Time_t tArrDef
Definition: abcTiming.c:34
float Fall
Definition: abc.h:125
static Abc_ManTime_t * Abc_ManTimeStart(Abc_Ntk_t *pNtk)
Definition: abcTiming.c:431
Abc_ManTime_t * pManTime
Definition: abc.h:192
float Rise
Definition: abc.h:124
ABC_DLL void Abc_NtkTimeSetDefaultInputDrive ( Abc_Ntk_t pNtk,
float  Rise,
float  Fall 
)

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

Synopsis [Sets the default arrival time for the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 227 of file abcTiming.c.

228 {
229  if ( Rise == 0.0 && Fall == 0.0 )
230  return;
231  if ( pNtk->pManTime == NULL )
232  pNtk->pManTime = Abc_ManTimeStart(pNtk);
233  pNtk->pManTime->tInDriveDef.Rise = Rise;
234  pNtk->pManTime->tInDriveDef.Fall = Fall;
235  if ( pNtk->pManTime->tInDrive != NULL )
236  {
237  int i;
238  for ( i = 0; i < Abc_NtkCiNum(pNtk); i++ )
239  if ( pNtk->pManTime->tInDrive[i].Rise == 0 && pNtk->pManTime->tInDrive[i].Fall == 0 )
240  pNtk->pManTime->tInDrive[i] = pNtk->pManTime->tInDriveDef;
241  }
242 }
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
Abc_Time_t tInDriveDef
Definition: abcTiming.c:38
Abc_Time_t * tInDrive
Definition: abcTiming.c:40
float Fall
Definition: abc.h:125
static Abc_ManTime_t * Abc_ManTimeStart(Abc_Ntk_t *pNtk)
Definition: abcTiming.c:431
Abc_ManTime_t * pManTime
Definition: abc.h:192
float Rise
Definition: abc.h:124
ABC_DLL void Abc_NtkTimeSetDefaultOutputLoad ( Abc_Ntk_t pNtk,
float  Rise,
float  Fall 
)

Definition at line 243 of file abcTiming.c.

244 {
245  if ( Rise == 0.0 && Fall == 0.0 )
246  return;
247  if ( pNtk->pManTime == NULL )
248  pNtk->pManTime = Abc_ManTimeStart(pNtk);
249  pNtk->pManTime->tOutLoadDef.Rise = Rise;
250  pNtk->pManTime->tOutLoadDef.Fall = Fall;
251  if ( pNtk->pManTime->tOutLoad != NULL )
252  {
253  int i;
254  for ( i = 0; i < Abc_NtkCoNum(pNtk); i++ )
255  if ( pNtk->pManTime->tOutLoad[i].Rise == 0 && pNtk->pManTime->tOutLoad[i].Fall == 0 )
256  pNtk->pManTime->tOutLoad[i] = pNtk->pManTime->tOutLoadDef;
257  }
258 }
Abc_Time_t * tOutLoad
Definition: abcTiming.c:41
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
float Fall
Definition: abc.h:125
static Abc_ManTime_t * Abc_ManTimeStart(Abc_Ntk_t *pNtk)
Definition: abcTiming.c:431
Abc_ManTime_t * pManTime
Definition: abc.h:192
Abc_Time_t tOutLoadDef
Definition: abcTiming.c:39
float Rise
Definition: abc.h:124
ABC_DLL void Abc_NtkTimeSetDefaultRequired ( Abc_Ntk_t pNtk,
float  Rise,
float  Fall 
)

Definition at line 164 of file abcTiming.c.

165 {
166  if ( Rise == 0.0 && Fall == 0.0 )
167  return;
168  if ( pNtk->pManTime == NULL )
169  pNtk->pManTime = Abc_ManTimeStart(pNtk);
170  pNtk->pManTime->tReqDef.Rise = Rise;
171  pNtk->pManTime->tReqDef.Fall = Fall;
172 }
float Fall
Definition: abc.h:125
static Abc_ManTime_t * Abc_ManTimeStart(Abc_Ntk_t *pNtk)
Definition: abcTiming.c:431
Abc_ManTime_t * pManTime
Definition: abc.h:192
Abc_Time_t tReqDef
Definition: abcTiming.c:35
float Rise
Definition: abc.h:124
ABC_DLL void Abc_NtkTimeSetInputDrive ( Abc_Ntk_t pNtk,
int  PiNum,
float  Rise,
float  Fall 
)

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

Synopsis [Sets the arrival time for an object.]

Description []

SideEffects []

SeeAlso []

Definition at line 271 of file abcTiming.c.

272 {
273  Abc_Time_t * pTime;
274  assert( PiNum >= 0 && PiNum < Abc_NtkCiNum(pNtk) );
275  if ( pNtk->pManTime == NULL )
276  pNtk->pManTime = Abc_ManTimeStart(pNtk);
277  if ( pNtk->pManTime->tInDriveDef.Rise == Rise && pNtk->pManTime->tInDriveDef.Fall == Fall )
278  return;
279  if ( pNtk->pManTime->tInDrive == NULL )
280  {
281  int i;
283  for ( i = 0; i < Abc_NtkCiNum(pNtk); i++ )
284  pNtk->pManTime->tInDrive[i] = pNtk->pManTime->tInDriveDef;
285  }
286  pTime = pNtk->pManTime->tInDrive + PiNum;
287  pTime->Rise = Rise;
288  pTime->Fall = Fall;
289 }
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
Abc_Time_t tInDriveDef
Definition: abcTiming.c:38
Abc_Time_t * tInDrive
Definition: abcTiming.c:40
float Fall
Definition: abc.h:125
static Abc_ManTime_t * Abc_ManTimeStart(Abc_Ntk_t *pNtk)
Definition: abcTiming.c:431
Abc_ManTime_t * pManTime
Definition: abc.h:192
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define assert(ex)
Definition: util_old.h:213
float Rise
Definition: abc.h:124
ABC_DLL void Abc_NtkTimeSetOutputLoad ( Abc_Ntk_t pNtk,
int  PoNum,
float  Rise,
float  Fall 
)

Definition at line 290 of file abcTiming.c.

291 {
292  Abc_Time_t * pTime;
293  assert( PoNum >= 0 && PoNum < Abc_NtkCoNum(pNtk) );
294  if ( pNtk->pManTime == NULL )
295  pNtk->pManTime = Abc_ManTimeStart(pNtk);
296  if ( pNtk->pManTime->tOutLoadDef.Rise == Rise && pNtk->pManTime->tOutLoadDef.Fall == Fall )
297  return;
298  if ( pNtk->pManTime->tOutLoad == NULL )
299  {
300  int i;
302  for ( i = 0; i < Abc_NtkCoNum(pNtk); i++ )
303  pNtk->pManTime->tOutLoad[i] = pNtk->pManTime->tOutLoadDef;
304  }
305  pTime = pNtk->pManTime->tOutLoad + PoNum;
306  pTime->Rise = Rise;
307  pTime->Fall = Fall;
308 }
Abc_Time_t * tOutLoad
Definition: abcTiming.c:41
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
float Fall
Definition: abc.h:125
static Abc_ManTime_t * Abc_ManTimeStart(Abc_Ntk_t *pNtk)
Definition: abcTiming.c:431
Abc_ManTime_t * pManTime
Definition: abc.h:192
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define assert(ex)
Definition: util_old.h:213
Abc_Time_t tOutLoadDef
Definition: abcTiming.c:39
float Rise
Definition: abc.h:124
ABC_DLL void Abc_NtkTimeSetRequired ( Abc_Ntk_t pNtk,
int  ObjId,
float  Rise,
float  Fall 
)

Definition at line 200 of file abcTiming.c.

201 {
202  Vec_Ptr_t * vTimes;
203  Abc_Time_t * pTime;
204  if ( pNtk->pManTime == NULL )
205  pNtk->pManTime = Abc_ManTimeStart(pNtk);
206  if ( pNtk->pManTime->tReqDef.Rise == Rise && pNtk->pManTime->tReqDef.Fall == Fall )
207  return;
208  Abc_ManTimeExpand( pNtk->pManTime, ObjId + 1, 1 );
209  // set the required time
210  vTimes = pNtk->pManTime->vReqs;
211  pTime = (Abc_Time_t *)vTimes->pArray[ObjId];
212  pTime->Rise = Rise;
213  pTime->Fall = Fall;
214 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static void Abc_ManTimeExpand(Abc_ManTime_t *p, int nSize, int fProgressive)
Definition: abcTiming.c:533
float Fall
Definition: abc.h:125
Vec_Ptr_t * vReqs
Definition: abcTiming.c:37
static Abc_ManTime_t * Abc_ManTimeStart(Abc_Ntk_t *pNtk)
Definition: abcTiming.c:431
Abc_ManTime_t * pManTime
Definition: abc.h:192
Abc_Time_t tReqDef
Definition: abcTiming.c:35
float Rise
Definition: abc.h:124
ABC_DLL int Abc_NtkToAig ( Abc_Ntk_t pNtk)

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

Synopsis [Convers logic network to the SOP form.]

Description []

SideEffects []

SeeAlso []

Definition at line 1192 of file abcFunc.c.

1193 {
1194  assert( !Abc_NtkIsStrash(pNtk) );
1195  if ( Abc_NtkHasAig(pNtk) )
1196  return 1;
1197  if ( Abc_NtkHasMapping(pNtk) )
1198  {
1199  Abc_NtkMapToSop(pNtk);
1200  return Abc_NtkSopToAig(pNtk);
1201  }
1202  if ( Abc_NtkHasBdd(pNtk) )
1203  {
1204  if ( !Abc_NtkBddToSop(pNtk,0) )
1205  return 0;
1206  return Abc_NtkSopToAig(pNtk);
1207  }
1208  if ( Abc_NtkHasSop(pNtk) )
1209  return Abc_NtkSopToAig(pNtk);
1210  assert( 0 );
1211  return 0;
1212 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
int Abc_NtkBddToSop(Abc_Ntk_t *pNtk, int fDirect)
Definition: abcFunc.c:359
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
int Abc_NtkMapToSop(Abc_Ntk_t *pNtk)
Definition: abcFunc.c:1073
int Abc_NtkSopToAig(Abc_Ntk_t *pNtk)
Definition: abcFunc.c:612
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
ABC_DLL Abc_Ntk_t* Abc_NtkToBarBufs ( Abc_Ntk_t pNtk)

Definition at line 180 of file abcBarBuf.c.

181 {
182  char Buffer[1000];
183  Vec_Ptr_t * vLiMaps, * vLoMaps;
184  Abc_Ntk_t * pNtkNew, * pTemp;
185  Abc_Obj_t * pLatch, * pObjLi, * pObjLo;
186  Abc_Obj_t * pObj, * pLiMap, * pLoMap;
187  int i, k, nBoxes;
188  assert( Abc_NtkIsNetlist(pNtk) );
189  if ( !Abc_NtkCheckSingleInstance(pNtk) )
190  return NULL;
191  assert( pNtk->pDesign != NULL );
192  // start the network
193  pNtkNew = Abc_NtkAlloc( ABC_NTK_LOGIC, pNtk->ntkFunc, 1 );
194  pNtkNew->pName = Extra_UtilStrsav(pNtk->pName);
195  pNtkNew->pSpec = Extra_UtilStrsav(pNtk->pSpec);
196  // clone CIs/CIs/boxes
197  Abc_NtkCleanCopy_rec( pNtk );
198  Abc_NtkForEachPi( pNtk, pObj, i )
199  Abc_ObjFanout0(pObj)->pCopy = Abc_NtkDupObj( pNtkNew, pObj, 1 );
200  Abc_NtkForEachPo( pNtk, pObj, i )
201  Abc_NtkDupObj( pNtkNew, pObj, 1 );
202  // create latches and transfer copy labels
203  nBoxes = Abc_NtkCollectPiPos( pNtk, &vLiMaps, &vLoMaps );
204  Vec_PtrForEachEntryTwo( Abc_Obj_t *, vLiMaps, Abc_Obj_t *, vLoMaps, pLiMap, pLoMap, i )
205  {
206  pObjLi = Abc_NtkCreateBi(pNtkNew);
207  pLatch = Abc_NtkCreateLatch(pNtkNew);
208  pObjLo = Abc_NtkCreateBo(pNtkNew);
209  Abc_ObjAddFanin( pLatch, pObjLi );
210  Abc_ObjAddFanin( pObjLo, pLatch );
211  pLatch->pData = (void *)ABC_INIT_ZERO;
212  pTemp = NULL;
213  if ( Abc_ObjFanin0(pLiMap)->pNtk != pNtk )
214  pTemp = Abc_ObjFanin0(pLiMap)->pNtk;
215  else if ( Abc_ObjFanout0(pLoMap)->pNtk != pNtk )
216  pTemp = Abc_ObjFanout0(pLoMap)->pNtk;
217  else assert( 0 );
218  sprintf( Buffer, "_%s_in", Abc_NtkName(pTemp) );
219  Abc_ObjAssignName( pObjLi, Abc_ObjName(Abc_ObjFanin0(pLiMap)), Buffer );
220  sprintf( Buffer, "_%s_out", Abc_NtkName(pTemp) );
221  Abc_ObjAssignName( pObjLo, Abc_ObjName(Abc_ObjFanout0(pLoMap)), Buffer );
222  pLiMap->pCopy = pObjLi;
223  Abc_ObjFanout0(pLoMap)->pCopy = pObjLo;
224  assert( Abc_ObjIsNet(Abc_ObjFanout0(pLoMap)) );
225  }
226  Vec_PtrFree( vLiMaps );
227  Vec_PtrFree( vLoMaps );
228  // rebuild networks
229  Vec_PtrForEachEntry( Abc_Ntk_t *, pNtk->pDesign->vModules, pTemp, i )
230  Abc_NtkForEachCo( pTemp, pObj, k )
231  Abc_ObjAddFanin( pObj->pCopy, Abc_NtkToBarBufs_rec(pNtkNew, Abc_ObjFanin0(pObj)) );
232  pNtkNew->nBarBufs = Abc_NtkLatchNum(pNtkNew);
233  printf( "Hierarchy reader flattened %d instances of logic boxes and introduced %d barbufs.\n", nBoxes, pNtkNew->nBarBufs );
234  return pNtkNew;
235 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
#define Vec_PtrForEachEntryTwo(Type1, vVec1, Type2, vVec2, pEntry1, pEntry2, i)
Definition: vecPtr.h:65
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition: abcObj.c:337
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
int Abc_NtkCollectPiPos(Abc_Ntk_t *pNtk, Vec_Ptr_t **pvLiMaps, Vec_Ptr_t **pvLoMaps)
Definition: abcBarBuf.c:147
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition: abcNames.c:68
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
char * Extra_UtilStrsav(const char *s)
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
ABC_DLL Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
int Abc_NtkCheckSingleInstance(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcBarBuf.c:47
static Abc_Obj_t * Abc_NtkCreateBo(Abc_Ntk_t *pNtk)
Definition: abc.h:306
Abc_Obj_t * pCopy
Definition: abc.h:148
ABC_DLL void Abc_NtkCleanCopy_rec(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:514
static Abc_Obj_t * Abc_NtkCreateLatch(Abc_Ntk_t *pNtk)
Definition: abc.h:309
char * sprintf()
char * pSpec
Definition: abc.h:159
Abc_Ntk_t * pNtk
Definition: abc.h:130
static char * Abc_NtkName(Abc_Ntk_t *pNtk)
Definition: abc.h:270
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
Abc_Obj_t * Abc_NtkToBarBufs_rec(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pNet)
Definition: abcBarBuf.c:166
static int Abc_ObjIsNet(Abc_Obj_t *pObj)
Definition: abc.h:354
Vec_Ptr_t * vModules
Definition: abc.h:223
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
static Abc_Obj_t * Abc_NtkCreateBi(Abc_Ntk_t *pNtk)
Definition: abc.h:305
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
Abc_Des_t * pDesign
Definition: abc.h:180
char * pName
Definition: abc.h:158
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL int Abc_NtkToBdd ( Abc_Ntk_t pNtk)

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

Synopsis [Convers logic network to the SOP form.]

Description []

SideEffects []

SeeAlso []

Definition at line 1160 of file abcFunc.c.

1161 {
1162  assert( !Abc_NtkIsStrash(pNtk) );
1163  if ( Abc_NtkHasBdd(pNtk) )
1164  return 1;
1165  if ( Abc_NtkHasMapping(pNtk) )
1166  {
1167  Abc_NtkMapToSop(pNtk);
1168  return Abc_NtkSopToBdd(pNtk);
1169  }
1170  if ( Abc_NtkHasSop(pNtk) )
1171  {
1172  Abc_NtkSopToAig(pNtk);
1173  return Abc_NtkAigToBdd(pNtk);
1174  }
1175  if ( Abc_NtkHasAig(pNtk) )
1176  return Abc_NtkAigToBdd(pNtk);
1177  assert( 0 );
1178  return 0;
1179 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
int Abc_NtkAigToBdd(Abc_Ntk_t *pNtk)
Definition: abcFunc.c:733
int Abc_NtkMapToSop(Abc_Ntk_t *pNtk)
Definition: abcFunc.c:1073
int Abc_NtkSopToBdd(Abc_Ntk_t *pNtk)
Definition: abcFunc.c:113
int Abc_NtkSopToAig(Abc_Ntk_t *pNtk)
Definition: abcFunc.c:612
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
ABC_DLL void* Abc_NtkToFraig ( Abc_Ntk_t pNtk,
void *  pParams,
int  fAllNodes,
int  fExdc 
)

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

Synopsis [Transforms the strashed network into FRAIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 103 of file abcFraig.c.

104 {
105  int fInternal = ((Fraig_Params_t *)pParams)->fInternal;
106  Fraig_Man_t * pMan;
107  ProgressBar * pProgress = NULL;
108  Vec_Ptr_t * vNodes;
109  Abc_Obj_t * pNode;
110  int i;
111 
112  assert( Abc_NtkIsStrash(pNtk) );
113 
114  // create the FRAIG manager
115  pMan = Fraig_ManCreate( (Fraig_Params_t *)pParams );
116 
117  // map the constant node
118  Abc_NtkCleanCopy( pNtk );
120  // create PIs and remember them in the old nodes
121  Abc_NtkForEachCi( pNtk, pNode, i )
122  pNode->pCopy = (Abc_Obj_t *)Fraig_ManReadIthVar(pMan, i);
123 
124  // perform strashing
125  vNodes = Abc_AigDfs( pNtk, fAllNodes, 0 );
126  if ( !fInternal )
127  pProgress = Extra_ProgressBarStart( stdout, vNodes->nSize );
128  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pNode, i )
129  {
130  if ( Abc_ObjFaninNum(pNode) == 0 )
131  continue;
132  if ( pProgress )
133  Extra_ProgressBarUpdate( pProgress, i, NULL );
134  pNode->pCopy = (Abc_Obj_t *)Fraig_NodeAnd( pMan,
135  Fraig_NotCond( Abc_ObjFanin0(pNode)->pCopy, (int)Abc_ObjFaninC0(pNode) ),
136  Fraig_NotCond( Abc_ObjFanin1(pNode)->pCopy, (int)Abc_ObjFaninC1(pNode) ) );
137  }
138  if ( pProgress )
139  Extra_ProgressBarStop( pProgress );
140  Vec_PtrFree( vNodes );
141 
142  // use EXDC to change the mapping of nodes into FRAIG nodes
143  if ( fExdc )
144  Abc_NtkFraigRemapUsingExdc( pMan, pNtk );
145 
146  // set the primary outputs
147  Abc_NtkForEachCo( pNtk, pNode, i )
148  Fraig_ManSetPo( pMan, (Fraig_Node_t *)Abc_ObjNotCond( Abc_ObjFanin0(pNode)->pCopy, Abc_ObjFaninC0(pNode) ) );
149  return pMan;
150 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
void Fraig_ManSetPo(Fraig_Man_t *p, Fraig_Node_t *pNode)
Definition: fraigApi.c:194
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Abc_Obj_t * Abc_ObjFanin1(Abc_Obj_t *pObj)
Definition: abc.h:374
Fraig_Node_t * Fraig_ManReadConst1(Fraig_Man_t *p)
Definition: fraigApi.c:52
typedefABC_NAMESPACE_HEADER_START struct Fraig_ManStruct_t_ Fraig_Man_t
INCLUDES ///.
Definition: fraig.h:40
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
static int Abc_ObjFaninC1(Abc_Obj_t *pObj)
Definition: abc.h:378
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
DECLARATIONS ///.
static void Abc_NtkFraigRemapUsingExdc(Fraig_Man_t *pMan, Abc_Ntk_t *pNtk)
Definition: abcFraig.c:212
Fraig_Node_t * Fraig_NodeAnd(Fraig_Man_t *p, Fraig_Node_t *p1, Fraig_Node_t *p2)
Definition: fraigApi.c:212
Abc_Obj_t * pCopy
Definition: abc.h:148
Fraig_Node_t * Fraig_ManReadIthVar(Fraig_Man_t *p, int i)
Definition: fraigApi.c:168
if(last==0)
Definition: sparse_int.h:34
void Extra_ProgressBarStop(ProgressBar *p)
ABC_DLL Vec_Ptr_t * Abc_AigDfs(Abc_Ntk_t *pNtk, int fCollectAll, int fCollectCos)
Definition: abcDfs.c:1014
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
Fraig_Man_t * Fraig_ManCreate(Fraig_Params_t *pParams)
Definition: fraigMan.c:184
ProgressBar * Extra_ProgressBarStart(FILE *pFile, int nItemsTotal)
FUNCTION DEFINITIONS ///.
#define Fraig_NotCond(p, c)
Definition: fraig.h:110
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:507
static Abc_Obj_t * Abc_ObjNotCond(Abc_Obj_t *p, int c)
Definition: abc.h:325
#define assert(ex)
Definition: util_old.h:213
static void Extra_ProgressBarUpdate(ProgressBar *p, int nItemsCur, char *pString)
Definition: extra.h:243
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL Abc_Ntk_t* Abc_NtkToLogic ( Abc_Ntk_t pNtk)

FUNCTION DEFINITIONS ///.

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

Synopsis [Transform the netlist into a logic network.]

Description []

SideEffects []

SeeAlso []

Definition at line 52 of file abcNetlist.c.

53 {
54  Abc_Ntk_t * pNtkNew;
55  Abc_Obj_t * pObj, * pFanin;
56  int i, k;
57  // consider the case of the AIG
58  if ( Abc_NtkIsStrash(pNtk) )
59  return Abc_NtkAigToLogicSop( pNtk );
60  assert( Abc_NtkIsNetlist(pNtk) );
61  // consider simple case when there is hierarchy
62 // assert( pNtk->pDesign == NULL );
63  assert( Abc_NtkWhiteboxNum(pNtk) == 0 );
64  assert( Abc_NtkBlackboxNum(pNtk) == 0 );
65  // start the network
66  pNtkNew = Abc_NtkStartFrom( pNtk, ABC_NTK_LOGIC, pNtk->ntkFunc );
67  // duplicate the nodes
68  Abc_NtkForEachNode( pNtk, pObj, i )
69  Abc_NtkDupObj(pNtkNew, pObj, 0);
70  // reconnect the internal nodes in the new network
71  Abc_NtkForEachNode( pNtk, pObj, i )
72  Abc_ObjForEachFanin( pObj, pFanin, k )
73  Abc_ObjAddFanin( pObj->pCopy, Abc_ObjFanin0(pFanin)->pCopy );
74  // collect the CO nodes
75  Abc_NtkFinalize( pNtk, pNtkNew );
76  // fix the problem with CO pointing directly to CIs
77  Abc_NtkLogicMakeSimpleCos( pNtkNew, 0 );
78  // duplicate EXDC
79  if ( pNtk->pExdc )
80  pNtkNew->pExdc = Abc_NtkToLogic( pNtk->pExdc );
81  if ( !Abc_NtkCheck( pNtkNew ) )
82  fprintf( stdout, "Abc_NtkToLogic(): Network check has failed.\n" );
83  return pNtkNew;
84 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
Abc_Ntk_t * Abc_NtkToLogic(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcNetlist.c:52
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition: abcObj.c:337
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
static int Abc_NtkWhiteboxNum(Abc_Ntk_t *pNtk)
Definition: abc.h:295
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
static void check(int expr)
Definition: satSolver.c:46
ABC_DLL Abc_Ntk_t * Abc_NtkStartFrom(Abc_Ntk_t *pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func)
Definition: abcNtk.c:106
static Abc_Ntk_t * Abc_NtkAigToLogicSop(Abc_Ntk_t *pNtk)
Definition: abcNetlist.c:243
if(last==0)
Definition: sparse_int.h:34
ABC_DLL void Abc_NtkFinalize(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkNew)
Definition: abcNtk.c:302
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
ABC_DLL int Abc_NtkLogicMakeSimpleCos(Abc_Ntk_t *pNtk, int fDuplicate)
Definition: abcUtil.c:1047
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkBlackboxNum(Abc_Ntk_t *pNtk)
Definition: abc.h:296
ABC_DLL Abc_Ntk_t* Abc_NtkToNetlist ( Abc_Ntk_t pNtk)

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

Synopsis [Transform the logic network into a netlist.]

Description []

SideEffects []

SeeAlso []

Definition at line 97 of file abcNetlist.c.

98 {
99  Abc_Ntk_t * pNtkNew, * pNtkTemp;
100  assert( Abc_NtkIsLogic(pNtk) || Abc_NtkIsStrash(pNtk) );
101  if ( Abc_NtkIsStrash(pNtk) )
102  {
103  pNtkTemp = Abc_NtkAigToLogicSop(pNtk);
104  pNtkNew = Abc_NtkLogicToNetlist( pNtkTemp );
105  Abc_NtkDelete( pNtkTemp );
106  return pNtkNew;
107  }
108  return Abc_NtkLogicToNetlist( pNtk );
109 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static Abc_Ntk_t * Abc_NtkLogicToNetlist(Abc_Ntk_t *pNtk)
Definition: abcNetlist.c:147
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
static Abc_Ntk_t * Abc_NtkAigToLogicSop(Abc_Ntk_t *pNtk)
Definition: abcNetlist.c:243
#define assert(ex)
Definition: util_old.h:213
ABC_DLL Abc_Ntk_t* Abc_NtkToNetlistBench ( Abc_Ntk_t pNtk)

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

Synopsis [Converts the AIG into the netlist.]

Description [This procedure does not copy the choices.]

SideEffects []

SeeAlso []

Definition at line 122 of file abcNetlist.c.

123 {
124  Abc_Ntk_t * pNtkNew, * pNtkTemp;
125  assert( Abc_NtkIsStrash(pNtk) );
126  pNtkTemp = Abc_NtkAigToLogicSopBench( pNtk );
127  pNtkNew = Abc_NtkLogicToNetlist( pNtkTemp );
128  Abc_NtkDelete( pNtkTemp );
129  return pNtkNew;
130 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static Abc_Ntk_t * Abc_NtkLogicToNetlist(Abc_Ntk_t *pNtk)
Definition: abcNetlist.c:147
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
static Abc_Ntk_t * Abc_NtkAigToLogicSopBench(Abc_Ntk_t *pNtk)
Definition: abcNetlist.c:333
#define assert(ex)
Definition: util_old.h:213
ABC_DLL Abc_Ntk_t* Abc_NtkTopmost ( Abc_Ntk_t pNtk,
int  nLevels 
)

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

Synopsis [Copies the topmost levels of the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 548 of file abcStrash.c.

549 {
550  Abc_Ntk_t * pNtkNew;
551  Abc_Obj_t * pObjNew, * pObjPo;
552  int LevelCut;
553  assert( Abc_NtkIsStrash(pNtk) );
554  assert( Abc_NtkCoNum(pNtk) == 1 );
555  // get the cutoff level
556  LevelCut = Abc_MaxInt( 0, Abc_AigLevel(pNtk) - nLevels );
557  // start the network
558  pNtkNew = Abc_NtkAlloc( ABC_NTK_STRASH, ABC_FUNC_AIG, 1 );
559  pNtkNew->pName = Extra_UtilStrsav(pNtk->pName);
560  Abc_AigConst1(pNtk)->pCopy = Abc_AigConst1(pNtkNew);
561  // create PIs below the cut and nodes above the cut
562  Abc_NtkCleanCopy( pNtk );
563  pObjNew = Abc_NtkTopmost_rec( pNtkNew, Abc_ObjFanin0(Abc_NtkPo(pNtk, 0)), LevelCut );
564  pObjNew = Abc_ObjNotCond( pObjNew, Abc_ObjFaninC0(Abc_NtkPo(pNtk, 0)) );
565  // add the PO node and name
566  pObjPo = Abc_NtkCreatePo(pNtkNew);
567  Abc_ObjAddFanin( pObjPo, pObjNew );
568  Abc_NtkAddDummyPiNames( pNtkNew );
569  Abc_ObjAssignName( pObjPo, Abc_ObjName(Abc_NtkPo(pNtk, 0)), NULL );
570  // make sure everything is okay
571  if ( !Abc_NtkCheck( pNtkNew ) )
572  {
573  printf( "Abc_NtkTopmost: The network check has failed.\n" );
574  Abc_NtkDelete( pNtkNew );
575  return NULL;
576  }
577  return pNtkNew;
578 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition: abcNames.c:68
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
Abc_Obj_t * Abc_NtkTopmost_rec(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pNode, int LevelCut)
Definition: abcStrash.c:525
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
char * Extra_UtilStrsav(const char *s)
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
ABC_DLL Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
Abc_Obj_t * pCopy
Definition: abc.h:148
ABC_DLL int Abc_AigLevel(Abc_Ntk_t *pNtk)
Definition: abcAig.c:292
static Abc_Obj_t * Abc_NtkPo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:316
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:507
static Abc_Obj_t * Abc_ObjNotCond(Abc_Obj_t *p, int c)
Definition: abc.h:325
#define assert(ex)
Definition: util_old.h:213
ABC_DLL void Abc_NtkAddDummyPiNames(Abc_Ntk_t *pNtk)
Definition: abcNames.c:378
static Abc_Obj_t * Abc_NtkCreatePo(Abc_Ntk_t *pNtk)
Definition: abc.h:304
char * pName
Definition: abc.h:158
ABC_DLL int Abc_NtkToSop ( Abc_Ntk_t pNtk,
int  fDirect 
)

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

Synopsis [Convers logic network to the SOP form.]

Description []

SideEffects []

SeeAlso []

Definition at line 1124 of file abcFunc.c.

1125 {
1126  assert( !Abc_NtkIsStrash(pNtk) );
1127  if ( Abc_NtkHasSop(pNtk) )
1128  {
1129  if ( !fDirect )
1130  return 1;
1131  if ( !Abc_NtkSopToBdd(pNtk) )
1132  return 0;
1133  return Abc_NtkBddToSop(pNtk, fDirect);
1134  }
1135  if ( Abc_NtkHasMapping(pNtk) )
1136  return Abc_NtkMapToSop(pNtk);
1137  if ( Abc_NtkHasBdd(pNtk) )
1138  return Abc_NtkBddToSop(pNtk, fDirect);
1139  if ( Abc_NtkHasAig(pNtk) )
1140  {
1141  if ( !Abc_NtkAigToBdd(pNtk) )
1142  return 0;
1143  return Abc_NtkBddToSop(pNtk, fDirect);
1144  }
1145  assert( 0 );
1146  return 0;
1147 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
int Abc_NtkBddToSop(Abc_Ntk_t *pNtk, int fDirect)
Definition: abcFunc.c:359
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
int Abc_NtkAigToBdd(Abc_Ntk_t *pNtk)
Definition: abcFunc.c:733
int Abc_NtkMapToSop(Abc_Ntk_t *pNtk)
Definition: abcFunc.c:1073
int Abc_NtkSopToBdd(Abc_Ntk_t *pNtk)
Definition: abcFunc.c:113
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
ABC_DLL void Abc_NtkTransferCopy ( Abc_Ntk_t pNtk)

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

Synopsis [Adjusts the copy pointers.]

Description [This procedure assumes that the network was transformed into another network, which was in turn transformed into yet another network. It makes the pCopy pointers of the original network point to the objects of the yet another network.]

SideEffects []

SeeAlso []

Definition at line 1922 of file abcUtil.c.

1923 {
1924  Abc_Obj_t * pObj;
1925  int i;
1926  Abc_NtkForEachObj( pNtk, pObj, i )
1927  if ( !Abc_ObjIsNet(pObj) )
1928  pObj->pCopy = pObj->pCopy? Abc_ObjCopyCond(pObj->pCopy) : NULL;
1929 }
static Abc_Obj_t * Abc_ObjCopyCond(Abc_Obj_t *pObj)
Definition: abc.h:338
if(last==0)
Definition: sparse_int.h:34
static int Abc_ObjIsNet(Abc_Obj_t *pObj)
Definition: abc.h:354
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
ABC_DLL void Abc_NtkTransferNameIds ( Abc_Ntk_t p,
Abc_Ntk_t pNew 
)

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

Synopsis [Remaps the AIG from the old manager into the new manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 588 of file abcNames.c.

589 {
590  Abc_Obj_t * pObj, * pObjNew;
591  int i;
592  assert( p->vNameIds != NULL );
593  assert( pNew->vNameIds == NULL );
594  pNew->vNameIds = Vec_IntStart( Abc_NtkObjNumMax(pNew) );
595 // Abc_NtkForEachCi( p, pObj, i )
596 // printf( "%d ", Vec_IntEntry(p->vNameIds, Abc_ObjId(pObj)) );
597 // printf( "\n" );
598  Abc_NtkForEachObj( p, pObj, i )
599  if ( pObj->pCopy && i < Vec_IntSize(p->vNameIds) && Vec_IntEntry(p->vNameIds, i) )
600  {
601  pObjNew = Abc_ObjRegular(pObj->pCopy);
602  assert( Abc_ObjNtk(pObjNew) == pNew );
603  if ( Abc_ObjIsCi(pObjNew) && !Abc_ObjIsCi(pObj) ) // do not overwrite CI name by internal node name
604  continue;
606  }
607 }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
Definition: abc.h:351
Vec_Int_t * vNameIds
Definition: abc.h:215
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
Abc_Obj_t * pCopy
Definition: abc.h:148
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
if(last==0)
Definition: sparse_int.h:34
static Abc_Obj_t * Abc_ObjRegular(Abc_Obj_t *p)
Definition: abc.h:323
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define assert(ex)
Definition: util_old.h:213
static Abc_Ntk_t * Abc_ObjNtk(Abc_Obj_t *pObj)
Definition: abc.h:334
static int Abc_ObjIsComplement(Abc_Obj_t *p)
Definition: abc.h:322
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
ABC_DLL void Abc_NtkTransferPhases ( Abc_Ntk_t pNtkNew,
Abc_Ntk_t pNtk 
)

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

Synopsis [Transfers phase information to the new network.]

Description []

SideEffects []

SeeAlso []

Definition at line 2875 of file abcUtil.c.

2876 {
2877  Abc_Obj_t * pObj;
2878  int i;
2879  assert( pNtk->vPhases != NULL );
2880  assert( Vec_IntSize(pNtk->vPhases) == Abc_NtkObjNumMax(pNtk) );
2881  assert( pNtkNew->vPhases == NULL );
2882  pNtkNew->vPhases = Vec_IntStart( Abc_NtkObjNumMax(pNtkNew) );
2883  Abc_NtkForEachObj( pNtk, pObj, i )
2884  if ( pObj->pCopy && !Abc_ObjIsNone( (Abc_Obj_t *)pObj->pCopy ) )
2885  Vec_IntWriteEntry( pNtkNew->vPhases, Abc_ObjId( (Abc_Obj_t *)pObj->pCopy ), Vec_IntEntry(pNtk->vPhases, i) );
2886 }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
static int Abc_ObjIsNone(Abc_Obj_t *pObj)
Definition: abc.h:346
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
if(last==0)
Definition: sparse_int.h:34
Vec_Int_t * vPhases
Definition: abc.h:208
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define assert(ex)
Definition: util_old.h:213
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
ABC_DLL void Abc_NtkTrasferNames ( Abc_Ntk_t pNtk,
Abc_Ntk_t pNtkNew 
)

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

Synopsis [Tranfers names to the old network.]

Description [Assumes that the new nodes are attached using pObj->pCopy.]

SideEffects []

SeeAlso []

Definition at line 139 of file abcNames.c.

140 {
141  Abc_Obj_t * pObj;
142  int i;
143  assert( Abc_NtkPiNum(pNtk) == Abc_NtkPiNum(pNtkNew) );
144  assert( Abc_NtkPoNum(pNtk) == Abc_NtkPoNum(pNtkNew) );
145  assert( Abc_NtkBoxNum(pNtk) == Abc_NtkBoxNum(pNtkNew) );
146  assert( Nm_ManNumEntries(pNtk->pManName) > 0 );
147  assert( Nm_ManNumEntries(pNtkNew->pManName) == 0 );
148  // copy the CI/CO/box names
149  Abc_NtkForEachCi( pNtk, pObj, i )
150  Abc_ObjAssignName( pObj->pCopy, Abc_ObjName(Abc_ObjFanout0Ntk(pObj)), NULL );
151  Abc_NtkForEachCo( pNtk, pObj, i )
152  Abc_ObjAssignName( pObj->pCopy, Abc_ObjName(Abc_ObjFanin0Ntk(pObj)), NULL );
153  Abc_NtkForEachBox( pNtk, pObj, i )
154  Abc_ObjAssignName( pObj->pCopy, Abc_ObjName(pObj), NULL );
155 }
Nm_Man_t * pManName
Definition: abc.h:160
int Nm_ManNumEntries(Nm_Man_t *p)
Definition: nmApi.c:95
static int Abc_NtkBoxNum(Abc_Ntk_t *pNtk)
Definition: abc.h:289
static Abc_Obj_t * Abc_ObjFanin0Ntk(Abc_Obj_t *pObj)
Definition: abc.h:375
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition: abcNames.c:68
ABC_NAMESPACE_IMPL_START char * Abc_ObjName(Abc_Obj_t *pObj)
DECLARATIONS ///.
Definition: abcNames.c:48
static Abc_Obj_t * Abc_ObjFanout0Ntk(Abc_Obj_t *pObj)
Definition: abc.h:376
#define Abc_NtkForEachBox(pNtk, pObj, i)
Definition: abc.h:495
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:286
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:285
#define assert(ex)
Definition: util_old.h:213
ABC_DLL void Abc_NtkTrasferNamesNoLatches ( Abc_Ntk_t pNtk,
Abc_Ntk_t pNtkNew 
)

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

Synopsis [Tranfers names to the old network.]

Description [Assumes that the new nodes are attached using pObj->pCopy.]

SideEffects []

SeeAlso []

Definition at line 168 of file abcNames.c.

169 {
170  Abc_Obj_t * pObj;
171  int i;
172  assert( Abc_NtkPiNum(pNtk) == Abc_NtkPiNum(pNtkNew) );
173  assert( Abc_NtkPoNum(pNtk) == Abc_NtkPoNum(pNtkNew) );
174  assert( Nm_ManNumEntries(pNtk->pManName) > 0 );
175  assert( Nm_ManNumEntries(pNtkNew->pManName) == 0 );
176  // copy the CI/CO/box name and skip latches and theirs inputs/outputs
177  Abc_NtkForEachCi( pNtk, pObj, i )
178  if ( Abc_ObjFaninNum(pObj) == 0 || !Abc_ObjIsLatch(Abc_ObjFanin0(pObj)) )
179  Abc_ObjAssignName( pObj->pCopy, Abc_ObjName(Abc_ObjFanout0Ntk(pObj)), NULL );
180  Abc_NtkForEachCo( pNtk, pObj, i )
181  if ( Abc_ObjFanoutNum(pObj) == 0 || !Abc_ObjIsLatch(Abc_ObjFanout0(pObj)) )
182  Abc_ObjAssignName( pObj->pCopy, Abc_ObjName(Abc_ObjFanin0Ntk(pObj)), NULL );
183  Abc_NtkForEachBox( pNtk, pObj, i )
184  if ( !Abc_ObjIsLatch(pObj) )
185  Abc_ObjAssignName( pObj->pCopy, Abc_ObjName(pObj), NULL );
186 }
Nm_Man_t * pManName
Definition: abc.h:160
int Nm_ManNumEntries(Nm_Man_t *p)
Definition: nmApi.c:95
static int Abc_ObjIsLatch(Abc_Obj_t *pObj)
Definition: abc.h:356
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
static Abc_Obj_t * Abc_ObjFanin0Ntk(Abc_Obj_t *pObj)
Definition: abc.h:375
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition: abcNames.c:68
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
if(last==0)
Definition: sparse_int.h:34
ABC_NAMESPACE_IMPL_START char * Abc_ObjName(Abc_Obj_t *pObj)
DECLARATIONS ///.
Definition: abcNames.c:48
static Abc_Obj_t * Abc_ObjFanout0Ntk(Abc_Obj_t *pObj)
Definition: abc.h:376
#define Abc_NtkForEachBox(pNtk, pObj, i)
Definition: abc.h:495
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:286
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:285
#define assert(ex)
Definition: util_old.h:213
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371
ABC_DLL void Abc_NtkUnpermute ( Abc_Ntk_t pNtk)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 2021 of file abcNtk.c.

2022 {
2023  Vec_Ptr_t * vTemp, * vTemp2, * vLatch;
2024  int i, * pInputs, * pOutputs, * pFlops;
2025  if ( pNtk->vObjPerm == NULL )
2026  {
2027  printf( "Abc_NtkUnpermute(): Initial permutation is not available.\n" );
2028  return;
2029  }
2030  assert( Abc_NtkBoxNum(pNtk) == Abc_NtkLatchNum(pNtk) );
2031  // get reverve permutation
2032  pInputs = Vec_IntArray( pNtk->vObjPerm );
2033  pOutputs = pInputs + Abc_NtkPiNum(pNtk);
2034  pFlops = pOutputs + Abc_NtkPoNum(pNtk);
2035  // create new PI array
2036  vTemp = Vec_PtrAlloc( Abc_NtkPiNum(pNtk) );
2037  for ( i = 0; i < Abc_NtkPiNum(pNtk); i++ )
2038  Vec_PtrPush( vTemp, Abc_NtkPi(pNtk, pInputs[i]) );
2039  Vec_PtrFreeP( &pNtk->vPis );
2040  pNtk->vPis = vTemp;
2041  // create new PO array
2042  vTemp = Vec_PtrAlloc( Abc_NtkPoNum(pNtk) );
2043  for ( i = 0; i < Abc_NtkPoNum(pNtk); i++ )
2044  Vec_PtrPush( vTemp, Abc_NtkPo(pNtk, pOutputs[i]) );
2045  Vec_PtrFreeP( &pNtk->vPos );
2046  pNtk->vPos = vTemp;
2047  // create new CI/CO arrays
2048  vTemp = Vec_PtrDup( pNtk->vPis );
2049  vTemp2 = Vec_PtrDup( pNtk->vPos );
2050  vLatch = Vec_PtrAlloc( Abc_NtkLatchNum(pNtk) );
2051  for ( i = 0; i < Abc_NtkLatchNum(pNtk); i++ )
2052  {
2053 //printf( "Setting flop %d to be %d.\n", i, pFlops[i] );
2054  Vec_PtrPush( vTemp, Abc_NtkCi(pNtk, Abc_NtkPiNum(pNtk) + pFlops[i]) );
2055  Vec_PtrPush( vTemp2, Abc_NtkCo(pNtk, Abc_NtkPoNum(pNtk) + pFlops[i]) );
2056  Vec_PtrPush( vLatch, Abc_NtkBox(pNtk, pFlops[i]) );
2057  }
2058  Vec_PtrFreeP( &pNtk->vCis );
2059  Vec_PtrFreeP( &pNtk->vCos );
2060  Vec_PtrFreeP( &pNtk->vBoxes );
2061  pNtk->vCis = vTemp;
2062  pNtk->vCos = vTemp2;
2063  pNtk->vBoxes = vLatch;
2064  // cleanup
2065  Vec_IntFreeP( &pNtk->vObjPerm );
2066 }
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
Vec_Ptr_t * vBoxes
Definition: abc.h:168
static int Abc_NtkBoxNum(Abc_Ntk_t *pNtk)
Definition: abc.h:289
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static Abc_Obj_t * Abc_NtkCi(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:317
static Vec_Ptr_t * Vec_PtrDup(Vec_Ptr_t *pVec)
Definition: vecPtr.h:169
Vec_Ptr_t * vPis
Definition: abc.h:163
Vec_Int_t * vObjPerm
Definition: abc.h:212
static Abc_Obj_t * Abc_NtkCo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:318
Vec_Ptr_t * vCis
Definition: abc.h:165
Vec_Ptr_t * vPos
Definition: abc.h:164
Vec_Ptr_t * vCos
Definition: abc.h:166
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
static Abc_Obj_t * Abc_NtkBox(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:319
static Abc_Obj_t * Abc_NtkPo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:316
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:286
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:285
static void Vec_PtrFreeP(Vec_Ptr_t **p)
Definition: vecPtr.h:240
#define assert(ex)
Definition: util_old.h:213
static Abc_Obj_t * Abc_NtkPi(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:315
ABC_DLL void Abc_NtkUpdate ( Abc_Obj_t pObj,
Abc_Obj_t pObjNew,
Vec_Vec_t vLevels 
)

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

Synopsis [Replaces the node and incrementally updates levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 1311 of file abcTiming.c.

1312 {
1313  // replace the old node by the new node
1314  pObjNew->Level = pObj->Level;
1315  Abc_ObjReplace( pObj, pObjNew );
1316  // update the level of the node
1317  Abc_NtkUpdateLevel( pObjNew, vLevels );
1318  Abc_ObjSetReverseLevel( pObjNew, 0 );
1319  Abc_NtkUpdateReverseLevel( pObjNew, vLevels );
1320 }
void Abc_NtkUpdateReverseLevel(Abc_Obj_t *pObjNew, Vec_Vec_t *vLevels)
Definition: abcTiming.c:1262
void Abc_ObjSetReverseLevel(Abc_Obj_t *pObj, int LevelR)
Definition: abcTiming.c:1141
unsigned Level
Definition: abc.h:142
ABC_DLL void Abc_ObjReplace(Abc_Obj_t *pObjOld, Abc_Obj_t *pObjNew)
Definition: abcFanio.c:297
void Abc_NtkUpdateLevel(Abc_Obj_t *pObjNew, Vec_Vec_t *vLevels)
Definition: abcTiming.c:1210
ABC_DLL void Abc_NtkUpdateLevel ( Abc_Obj_t pObjNew,
Vec_Vec_t vLevels 
)

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

Synopsis [Incrementally updates level of the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1210 of file abcTiming.c.

1211 {
1212  Abc_Obj_t * pFanout, * pTemp;
1213  int LevelOld, Lev, k, m;
1214 // int Counter = 0, CounterMax = 0;
1215  // check if level has changed
1216  LevelOld = Abc_ObjLevel(pObjNew);
1217  if ( LevelOld == Abc_ObjLevelNew(pObjNew) )
1218  return;
1219  // start the data structure for level update
1220  // we cannot fail to visit a node when using this structure because the
1221  // nodes are stored by their _old_ levels, which are assumed to be correct
1222  Vec_VecClear( vLevels );
1223  Vec_VecPush( vLevels, LevelOld, pObjNew );
1224  pObjNew->fMarkA = 1;
1225  // recursively update level
1226  Vec_VecForEachEntryStart( Abc_Obj_t *, vLevels, pTemp, Lev, k, LevelOld )
1227  {
1228 // Counter--;
1229  pTemp->fMarkA = 0;
1230  assert( Abc_ObjLevel(pTemp) == Lev );
1231  Abc_ObjSetLevel( pTemp, Abc_ObjLevelNew(pTemp) );
1232  // if the level did not change, no need to check the fanout levels
1233  if ( Abc_ObjLevel(pTemp) == Lev )
1234  continue;
1235  // schedule fanout for level update
1236  Abc_ObjForEachFanout( pTemp, pFanout, m )
1237  {
1238  if ( !Abc_ObjIsCo(pFanout) && !pFanout->fMarkA )
1239  {
1240  assert( Abc_ObjLevel(pFanout) >= Lev );
1241  Vec_VecPush( vLevels, Abc_ObjLevel(pFanout), pFanout );
1242 // Counter++;
1243 // CounterMax = Abc_MaxFloat( CounterMax, Counter );
1244  pFanout->fMarkA = 1;
1245  }
1246  }
1247  }
1248 // printf( "%d ", CounterMax );
1249 }
static void Vec_VecPush(Vec_Vec_t *p, int Level, void *Entry)
Definition: vecVec.h:456
unsigned fMarkA
Definition: abc.h:134
int Abc_ObjLevelNew(Abc_Obj_t *pObj)
Definition: abcTiming.c:1058
static void Abc_ObjSetLevel(Abc_Obj_t *pObj, int Level)
Definition: abc.h:341
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
Definition: abc.h:352
static void Vec_VecClear(Vec_Vec_t *p)
Definition: vecVec.h:437
static int Abc_ObjLevel(Abc_Obj_t *pObj)
Definition: abc.h:330
#define Vec_VecForEachEntryStart(Type, vGlob, pEntry, i, k, LevelStart)
Definition: vecVec.h:92
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition: abc.h:526
#define assert(ex)
Definition: util_old.h:213
ABC_DLL void Abc_NtkUpdateNameIds ( Abc_Ntk_t p)

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

Synopsis [Updates file with name IDs.]

Description []

SideEffects []

SeeAlso []

Definition at line 620 of file abcNames.c.

621 {
622  char pFileName[1000];
623  Vec_Int_t * vStarts;
624  Abc_Obj_t * pObj;
625  FILE * pFile;
626  int i, c, iVar, fCompl, fSeenSpace, Counter = 0;
627  assert( !Abc_NtkIsNetlist(p) );
628  assert( strlen(p->pSpec) < 1000 );
629  assert( p->vNameIds != NULL );
630  sprintf( pFileName, "%s_%s_names.txt", Extra_FileNameGenericAppend(p->pSpec,""), Extra_FileNameExtension(p->pSpec) );
631  pFile = fopen( pFileName, "r+" );
632  // collect info about lines
633  fSeenSpace = 0;
634  vStarts = Vec_IntAlloc( 1000 );
635  Vec_IntPush( vStarts, -1 );
636  while ( (c = fgetc(pFile)) != EOF && ++Counter )
637  if ( c == ' ' && !fSeenSpace )
638  Vec_IntPush(vStarts, Counter), fSeenSpace = 1;
639  else if ( c == '\n' )
640  fSeenSpace = 0;
641  // add info about names
642  Abc_NtkForEachObj( p, pObj, i )
643  {
644  if ( i == 0 || i >= Vec_IntSize(p->vNameIds) || !Vec_IntEntry(p->vNameIds, i) )
645  continue;
646  iVar = Abc_Lit2Var( Vec_IntEntry(p->vNameIds, i) );
647  fCompl = Abc_LitIsCompl( Vec_IntEntry(p->vNameIds, i) );
648  assert( iVar < Vec_IntSize(vStarts) );
649  fseek( pFile, Vec_IntEntry(vStarts, iVar), SEEK_SET );
650  fprintf( pFile, "%s%d", fCompl? "-":"", i );
651  }
652  printf( "Saved %d names into file \"%s\".\n", Vec_IntSize(vStarts)-1, pFileName );
653  fclose( pFile );
654  Vec_IntFree( vStarts );
655  Vec_IntFreeP( &p->vNameIds );
656 // Abc_NtkForEachObj( p, pObj, i )
657 // Abc_ObjPrint( stdout, pObj );
658 }
Vec_Int_t * vNameIds
Definition: abc.h:215
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
char * sprintf()
static int Counter
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
#define SEEK_SET
Definition: zconf.h:390
char * pSpec
Definition: abc.h:159
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
#define assert(ex)
Definition: util_old.h:213
char * Extra_FileNameGenericAppend(char *pBase, char *pSuffix)
int strlen()
char * Extra_FileNameExtension(char *FileName)
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
ABC_DLL void Abc_NtkUpdateReverseLevel ( Abc_Obj_t pObjNew,
Vec_Vec_t vLevels 
)

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

Synopsis [Incrementally updates level of the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1262 of file abcTiming.c.

1263 {
1264  Abc_Obj_t * pFanin, * pTemp;
1265  int LevelOld, LevFanin, Lev, k, m;
1266  // check if level has changed
1267  LevelOld = Abc_ObjReverseLevel(pObjNew);
1268  if ( LevelOld == Abc_ObjReverseLevelNew(pObjNew) )
1269  return;
1270  // start the data structure for level update
1271  // we cannot fail to visit a node when using this structure because the
1272  // nodes are stored by their _old_ levels, which are assumed to be correct
1273  Vec_VecClear( vLevels );
1274  Vec_VecPush( vLevels, LevelOld, pObjNew );
1275  pObjNew->fMarkA = 1;
1276  // recursively update level
1277  Vec_VecForEachEntryStart( Abc_Obj_t *, vLevels, pTemp, Lev, k, LevelOld )
1278  {
1279  pTemp->fMarkA = 0;
1280  LevelOld = Abc_ObjReverseLevel(pTemp);
1281  assert( LevelOld == Lev );
1283  // if the level did not change, no need to check the fanout levels
1284  if ( Abc_ObjReverseLevel(pTemp) == Lev )
1285  continue;
1286  // schedule fanins for level update
1287  Abc_ObjForEachFanin( pTemp, pFanin, m )
1288  {
1289  if ( !Abc_ObjIsCi(pFanin) && !pFanin->fMarkA )
1290  {
1291  LevFanin = Abc_ObjReverseLevel( pFanin );
1292  assert( LevFanin >= Lev );
1293  Vec_VecPush( vLevels, LevFanin, pFanin );
1294  pFanin->fMarkA = 1;
1295  }
1296  }
1297  }
1298 }
static void Vec_VecPush(Vec_Vec_t *p, int Level, void *Entry)
Definition: vecVec.h:456
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
Definition: abc.h:351
unsigned fMarkA
Definition: abc.h:134
int Abc_ObjReverseLevel(Abc_Obj_t *pObj)
Definition: abcTiming.c:1121
void Abc_ObjSetReverseLevel(Abc_Obj_t *pObj, int LevelR)
Definition: abcTiming.c:1141
static void Vec_VecClear(Vec_Vec_t *p)
Definition: vecVec.h:437
int Abc_ObjReverseLevelNew(Abc_Obj_t *pObj)
Definition: abcTiming.c:1078
#define Vec_VecForEachEntryStart(Type, vGlob, pEntry, i, k, LevelStart)
Definition: vecVec.h:92
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
#define assert(ex)
Definition: util_old.h:213
ABC_DLL int* Abc_NtkVerifyGetCleanModel ( Abc_Ntk_t pNtk,
int  nFrames 
)

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

Synopsis [Returns a dummy pattern full of zeros.]

Description []

SideEffects []

SeeAlso []

Definition at line 668 of file abcVerify.c.

669 {
670  int * pModel = ABC_ALLOC( int, Abc_NtkCiNum(pNtk) * nFrames );
671  memset( pModel, 0, sizeof(int) * Abc_NtkCiNum(pNtk) * nFrames );
672  return pModel;
673 }
char * memset()
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
ABC_DLL int* Abc_NtkVerifySimulatePattern ( Abc_Ntk_t pNtk,
int *  pModel 
)

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

Synopsis [Returns the PO values under the given input pattern.]

Description []

SideEffects []

SeeAlso []

Definition at line 686 of file abcVerify.c.

687 {
688  Abc_Obj_t * pNode;
689  int * pValues, Value0, Value1, i;
690  int fStrashed = 0;
691  if ( !Abc_NtkIsStrash(pNtk) )
692  {
693  pNtk = Abc_NtkStrash(pNtk, 0, 0, 0);
694  fStrashed = 1;
695  }
696 /*
697  printf( "Counter example: " );
698  Abc_NtkForEachCi( pNtk, pNode, i )
699  printf( " %d", pModel[i] );
700  printf( "\n" );
701 */
702  // increment the trav ID
703  Abc_NtkIncrementTravId( pNtk );
704  // set the CI values
705  Abc_AigConst1(pNtk)->pCopy = (Abc_Obj_t *)1;
706  Abc_NtkForEachCi( pNtk, pNode, i )
707  pNode->pCopy = (Abc_Obj_t *)(ABC_PTRINT_T)pModel[i];
708  // simulate in the topological order
709  Abc_NtkForEachNode( pNtk, pNode, i )
710  {
711  Value0 = ((int)(ABC_PTRINT_T)Abc_ObjFanin0(pNode)->pCopy) ^ (int)Abc_ObjFaninC0(pNode);
712  Value1 = ((int)(ABC_PTRINT_T)Abc_ObjFanin1(pNode)->pCopy) ^ (int)Abc_ObjFaninC1(pNode);
713  pNode->pCopy = (Abc_Obj_t *)(ABC_PTRINT_T)(Value0 & Value1);
714  }
715  // fill the output values
716  pValues = ABC_ALLOC( int, Abc_NtkCoNum(pNtk) );
717  Abc_NtkForEachCo( pNtk, pNode, i )
718  pValues[i] = ((int)(ABC_PTRINT_T)Abc_ObjFanin0(pNode)->pCopy) ^ (int)Abc_ObjFaninC0(pNode);
719  if ( fStrashed )
720  Abc_NtkDelete( pNtk );
721  return pValues;
722 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static Abc_Obj_t * Abc_ObjFanin1(Abc_Obj_t *pObj)
Definition: abc.h:374
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
static int Abc_ObjFaninC1(Abc_Obj_t *pObj)
Definition: abc.h:378
ABC_DLL Abc_Ntk_t * Abc_NtkStrash(Abc_Ntk_t *pNtk, int fAllNodes, int fCleanup, int fRecord)
Definition: abcStrash.c:265
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
Abc_Obj_t * pCopy
Definition: abc.h:148
if(last==0)
Definition: sparse_int.h:34
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
static int Abc_NtkWhiteboxNum ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 295 of file abc.h.

295 { return pNtk->nObjCounts[ABC_OBJ_WHITEBOX]; }
int nObjCounts[ABC_OBJ_NUMBER]
Definition: abc.h:171
ABC_DLL void Abc_NtkWriteLogFile ( char *  pFileName,
Abc_Cex_t pCex,
int  Status,
int  nFrames,
char *  pCommand 
)

DECLARATIONS ///.

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

FileName [abcLog.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Network and node package.]

Synopsis [Log file printing.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 68 of file abcLog.c.

69 {
70  FILE * pFile;
71  int i;
72  pFile = fopen( pFileName, "w" );
73  if ( pFile == NULL )
74  {
75  printf( "Cannot open log file for writing \"%s\".\n" , pFileName );
76  return;
77  }
78  // write <result>
79  if ( Status == 1 )
80  fprintf( pFile, "snl_UNSAT" );
81  else if ( Status == 0 )
82  fprintf( pFile, "snl_SAT" );
83  else if ( Status == -1 )
84  fprintf( pFile, "snl_UNK" );
85  else
86  printf( "Abc_NtkWriteLogFile(): Cannot recognize solving status.\n" );
87  fprintf( pFile, " " );
88  // write <bug_free_depth>
89  fprintf( pFile, "%d", nFrames );
90  fprintf( pFile, " " );
91  // write <engine_name>
92  fprintf( pFile, "%s", pCommand ? pCommand : "unknown" );
93  if ( pCex && Status == 0 )
94  fprintf( pFile, " %d", pCex->iPo );
95  // write <cyc>
96  if ( pCex && pCex->iFrame != nFrames )
97  fprintf( pFile, " %d", pCex->iFrame );
98  fprintf( pFile, "\n" );
99  // write <INIT_STATE>
100  if ( pCex == NULL )
101  fprintf( pFile, "NULL" );
102  else
103  {
104  for ( i = 0; i < pCex->nRegs; i++ )
105  fprintf( pFile, "%d", Abc_InfoHasBit(pCex->pData,i) );
106  }
107  fprintf( pFile, "\n" );
108  // write <TRACE>
109  if ( pCex == NULL )
110  fprintf( pFile, "NULL" );
111  else
112  {
113  assert( pCex->nBits - pCex->nRegs == pCex->nPis * (pCex->iFrame + 1) );
114  for ( i = pCex->nRegs; i < pCex->nBits; i++ )
115  fprintf( pFile, "%d", Abc_InfoHasBit(pCex->pData,i) );
116  }
117  fprintf( pFile, "\n" );
118  fclose( pFile );
119 }
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
#define assert(ex)
Definition: util_old.h:213
ABC_DLL void Abc_ObjAddFanin ( Abc_Obj_t pObj,
Abc_Obj_t pFanin 
)

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

Synopsis [Creates fanout/fanin relationship between the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 84 of file abcFanio.c.

85 {
86  Abc_Obj_t * pFaninR = Abc_ObjRegular(pFanin);
87  assert( !Abc_ObjIsComplement(pObj) );
88  assert( pObj->pNtk == pFaninR->pNtk );
89  assert( pObj->Id >= 0 && pFaninR->Id >= 0 );
90  assert( !Abc_ObjIsPi(pObj) && !Abc_ObjIsPo(pFaninR) ); // fanin of PI or fanout of PO
91  assert( !Abc_ObjIsCo(pObj) || !Abc_ObjFaninNum(pObj) ); // CO with two fanins
92  assert( !Abc_ObjIsNet(pObj) || !Abc_ObjFaninNum(pObj) ); // net with two fanins
93  Vec_IntPushMem( pObj->pNtk->pMmStep, &pObj->vFanins, pFaninR->Id );
94  Vec_IntPushMem( pObj->pNtk->pMmStep, &pFaninR->vFanouts, pObj->Id );
95  if ( Abc_ObjIsComplement(pFanin) )
96  Abc_ObjSetFaninC( pObj, Abc_ObjFaninNum(pObj)-1 );
97 }
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Abc_ObjIsPi(Abc_Obj_t *pObj)
Definition: abc.h:347
Vec_Int_t vFanins
Definition: abc.h:143
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
Definition: abc.h:352
static void Abc_ObjSetFaninC(Abc_Obj_t *pObj, int i)
Definition: abc.h:380
Vec_Int_t vFanouts
Definition: abc.h:144
static Abc_Obj_t * Abc_ObjRegular(Abc_Obj_t *p)
Definition: abc.h:323
Abc_Ntk_t * pNtk
Definition: abc.h:130
int Id
Definition: abc.h:132
static int Abc_ObjIsNet(Abc_Obj_t *pObj)
Definition: abc.h:354
Mem_Step_t * pMmStep
Definition: abc.h:190
static int Abc_ObjIsPo(Abc_Obj_t *pObj)
Definition: abc.h:348
#define assert(ex)
Definition: util_old.h:213
static int Abc_ObjIsComplement(Abc_Obj_t *p)
Definition: abc.h:322
static ABC_NAMESPACE_IMPL_START void Vec_IntPushMem(Mem_Step_t *pMemMan, Vec_Int_t *p, int Entry)
DECLARATIONS ///.
Definition: abcFanio.c:45
ABC_DLL Abc_Obj_t* Abc_ObjAlloc ( Abc_Ntk_t pNtk,
Abc_ObjType_t  Type 
)

DECLARATIONS ///.

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

FileName [abcObj.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Network and node package.]

Synopsis [Object creation/duplication/deletion procedures.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Creates a new object.]

Description []

SideEffects []

SeeAlso []

Definition at line 49 of file abcObj.c.

50 {
51  Abc_Obj_t * pObj;
52  if ( pNtk->pMmObj )
53  pObj = (Abc_Obj_t *)Mem_FixedEntryFetch( pNtk->pMmObj );
54  else
55  pObj = (Abc_Obj_t *)ABC_ALLOC( Abc_Obj_t, 1 );
56  memset( pObj, 0, sizeof(Abc_Obj_t) );
57  pObj->pNtk = pNtk;
58  pObj->Type = Type;
59  pObj->Id = -1;
60  return pObj;
61 }
char * memset()
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
unsigned Type
Definition: abc.h:133
Mem_Fixed_t * pMmObj
Definition: abc.h:189
Abc_Ntk_t * pNtk
Definition: abc.h:130
int Id
Definition: abc.h:132
char * Mem_FixedEntryFetch(Mem_Fixed_t *p)
Definition: mem.c:168
ABC_DLL char* Abc_ObjAssignName ( Abc_Obj_t pObj,
char *  pName,
char *  pSuffix 
)

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

Synopsis [Assigns the given name to the object.]

Description [The object should not have a name assigned. The same name may be used for several objects, which they share the same net in the original netlist. (For example, latch output and primary output may have the same name.) This procedure returns the pointer to the internally stored representation of the given name.]

SideEffects []

SeeAlso []

Definition at line 68 of file abcNames.c.

69 {
70  assert( pName != NULL );
71  return Nm_ManStoreIdName( pObj->pNtk->pManName, pObj->Id, pObj->Type, pName, pSuffix );
72 }
Nm_Man_t * pManName
Definition: abc.h:160
unsigned Type
Definition: abc.h:133
char * Nm_ManStoreIdName(Nm_Man_t *p, int ObjId, int Type, char *pName, char *pSuffix)
Definition: nmApi.c:112
Abc_Ntk_t * pNtk
Definition: abc.h:130
int Id
Definition: abc.h:132
#define assert(ex)
Definition: util_old.h:213
static void Abc_ObjBlackboxToWhitebox ( Abc_Obj_t pObj)
inlinestatic

Definition at line 361 of file abc.h.

int nObjCounts[ABC_OBJ_NUMBER]
Definition: abc.h:171
unsigned Type
Definition: abc.h:133
Abc_Ntk_t * pNtk
Definition: abc.h:130
#define assert(ex)
Definition: util_old.h:213
static int Abc_ObjIsBlackbox(Abc_Obj_t *pObj)
Definition: abc.h:359
static Abc_Obj_t* Abc_ObjChild ( Abc_Obj_t pObj,
int  i 
)
inlinestatic

Definition at line 382 of file abc.h.

382 { return Abc_ObjNotCond( Abc_ObjFanin(pObj,i), Abc_ObjFaninC(pObj,i) );}
static int Abc_ObjFaninC(Abc_Obj_t *pObj, int i)
Definition: abc.h:379
static Abc_Obj_t * Abc_ObjNotCond(Abc_Obj_t *p, int c)
Definition: abc.h:325
static Abc_Obj_t * Abc_ObjFanin(Abc_Obj_t *pObj, int i)
Definition: abc.h:372
static Abc_Obj_t* Abc_ObjChild0 ( Abc_Obj_t pObj)
inlinestatic

Definition at line 383 of file abc.h.

383 { return Abc_ObjNotCond( Abc_ObjFanin0(pObj), Abc_ObjFaninC0(pObj) ); }
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static Abc_Obj_t * Abc_ObjNotCond(Abc_Obj_t *p, int c)
Definition: abc.h:325
static Abc_Obj_t* Abc_ObjChild0Copy ( Abc_Obj_t pObj)
inlinestatic

Definition at line 386 of file abc.h.

386 { return Abc_ObjNotCond( Abc_ObjFanin0(pObj)->pCopy, Abc_ObjFaninC0(pObj) ); }
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static Abc_Obj_t * Abc_ObjNotCond(Abc_Obj_t *p, int c)
Definition: abc.h:325
static Abc_Obj_t* Abc_ObjChild0Data ( Abc_Obj_t pObj)
inlinestatic

Definition at line 388 of file abc.h.

388 { return Abc_ObjNotCond( (Abc_Obj_t *)Abc_ObjFanin0(pObj)->pData, Abc_ObjFaninC0(pObj) ); }
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static Abc_Obj_t * Abc_ObjNotCond(Abc_Obj_t *p, int c)
Definition: abc.h:325
static Abc_Obj_t* Abc_ObjChild1 ( Abc_Obj_t pObj)
inlinestatic

Definition at line 384 of file abc.h.

384 { return Abc_ObjNotCond( Abc_ObjFanin1(pObj), Abc_ObjFaninC1(pObj) ); }
static Abc_Obj_t * Abc_ObjFanin1(Abc_Obj_t *pObj)
Definition: abc.h:374
static int Abc_ObjFaninC1(Abc_Obj_t *pObj)
Definition: abc.h:378
static Abc_Obj_t * Abc_ObjNotCond(Abc_Obj_t *p, int c)
Definition: abc.h:325
static Abc_Obj_t* Abc_ObjChild1Copy ( Abc_Obj_t pObj)
inlinestatic

Definition at line 387 of file abc.h.

387 { return Abc_ObjNotCond( Abc_ObjFanin1(pObj)->pCopy, Abc_ObjFaninC1(pObj) ); }
static Abc_Obj_t * Abc_ObjFanin1(Abc_Obj_t *pObj)
Definition: abc.h:374
static int Abc_ObjFaninC1(Abc_Obj_t *pObj)
Definition: abc.h:378
static Abc_Obj_t * Abc_ObjNotCond(Abc_Obj_t *p, int c)
Definition: abc.h:325
static Abc_Obj_t* Abc_ObjChild1Data ( Abc_Obj_t pObj)
inlinestatic

Definition at line 389 of file abc.h.

389 { return Abc_ObjNotCond( (Abc_Obj_t *)Abc_ObjFanin1(pObj)->pData, Abc_ObjFaninC1(pObj) ); }
static Abc_Obj_t * Abc_ObjFanin1(Abc_Obj_t *pObj)
Definition: abc.h:374
static int Abc_ObjFaninC1(Abc_Obj_t *pObj)
Definition: abc.h:378
static Abc_Obj_t * Abc_ObjNotCond(Abc_Obj_t *p, int c)
Definition: abc.h:325
static Abc_Obj_t* Abc_ObjChildCopy ( Abc_Obj_t pObj,
int  i 
)
inlinestatic

Definition at line 385 of file abc.h.

385 { return Abc_ObjNotCond( Abc_ObjFanin(pObj,i)->pCopy, Abc_ObjFaninC(pObj,i) ); }
static int Abc_ObjFaninC(Abc_Obj_t *pObj, int i)
Definition: abc.h:379
static Abc_Obj_t * Abc_ObjNotCond(Abc_Obj_t *p, int c)
Definition: abc.h:325
static Abc_Obj_t * Abc_ObjFanin(Abc_Obj_t *pObj, int i)
Definition: abc.h:372
static Abc_Obj_t* Abc_ObjCopy ( Abc_Obj_t pObj)
inlinestatic

Definition at line 333 of file abc.h.

333 { return pObj->pCopy; }
Abc_Obj_t * pCopy
Definition: abc.h:148
static Abc_Obj_t* Abc_ObjCopyCond ( Abc_Obj_t pObj)
inlinestatic

Definition at line 338 of file abc.h.

338 { return Abc_ObjRegular(pObj)->pCopy? Abc_ObjNotCond(Abc_ObjRegular(pObj)->pCopy, Abc_ObjIsComplement(pObj)) : NULL; }
Abc_Obj_t * pCopy
Definition: abc.h:148
static Abc_Obj_t * Abc_ObjRegular(Abc_Obj_t *p)
Definition: abc.h:323
static Abc_Obj_t * Abc_ObjNotCond(Abc_Obj_t *p, int c)
Definition: abc.h:325
static int Abc_ObjIsComplement(Abc_Obj_t *p)
Definition: abc.h:322
static void* Abc_ObjData ( Abc_Obj_t pObj)
inlinestatic

Definition at line 336 of file abc.h.

336 { return pObj->pData; }
void * pData
Definition: abc.h:145
ABC_DLL void Abc_ObjDeleteFanin ( Abc_Obj_t pObj,
Abc_Obj_t pFanin 
)

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

Synopsis [Destroys fanout/fanin relationship between the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 111 of file abcFanio.c.

112 {
113  assert( !Abc_ObjIsComplement(pObj) );
114  assert( !Abc_ObjIsComplement(pFanin) );
115  assert( pObj->pNtk == pFanin->pNtk );
116  assert( pObj->Id >= 0 && pFanin->Id >= 0 );
117  if ( !Vec_IntRemove( &pObj->vFanins, pFanin->Id ) )
118  {
119  printf( "The obj %d is not found among the fanins of obj %d ...\n", pFanin->Id, pObj->Id );
120  return;
121  }
122  if ( !Vec_IntRemove( &pFanin->vFanouts, pObj->Id ) )
123  {
124  printf( "The obj %d is not found among the fanouts of obj %d ...\n", pObj->Id, pFanin->Id );
125  return;
126  }
127 }
Vec_Int_t vFanins
Definition: abc.h:143
static int Vec_IntRemove(Vec_Int_t *p, int Entry)
Definition: vecInt.h:915
Vec_Int_t vFanouts
Definition: abc.h:144
Abc_Ntk_t * pNtk
Definition: abc.h:130
int Id
Definition: abc.h:132
#define assert(ex)
Definition: util_old.h:213
static int Abc_ObjIsComplement(Abc_Obj_t *p)
Definition: abc.h:322
static Abc_Obj_t* Abc_ObjEquiv ( Abc_Obj_t pObj)
inlinestatic

Definition at line 337 of file abc.h.

337 { return (Abc_Obj_t *)pObj->pData; }
void * pData
Definition: abc.h:145
static Abc_Obj_t* Abc_ObjFanin ( Abc_Obj_t pObj,
int  i 
)
inlinestatic

Definition at line 372 of file abc.h.

372 { return (Abc_Obj_t *)pObj->pNtk->vObjs->pArray[ pObj->vFanins.pArray[i] ]; }
Vec_Int_t vFanins
Definition: abc.h:143
Vec_Ptr_t * vObjs
Definition: abc.h:162
Abc_Ntk_t * pNtk
Definition: abc.h:130
static Abc_Obj_t* Abc_ObjFanin0 ( Abc_Obj_t pObj)
inlinestatic

Definition at line 373 of file abc.h.

373 { return (Abc_Obj_t *)pObj->pNtk->vObjs->pArray[ pObj->vFanins.pArray[0] ]; }
Vec_Int_t vFanins
Definition: abc.h:143
Vec_Ptr_t * vObjs
Definition: abc.h:162
Abc_Ntk_t * pNtk
Definition: abc.h:130
static Abc_Obj_t* Abc_ObjFanin0Ntk ( Abc_Obj_t pObj)
inlinestatic

Definition at line 375 of file abc.h.

375 { return (Abc_NtkIsNetlist(pObj->pNtk)? Abc_ObjFanin0(pObj) : pObj); }
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
Abc_Ntk_t * pNtk
Definition: abc.h:130
static Abc_Obj_t* Abc_ObjFanin1 ( Abc_Obj_t pObj)
inlinestatic

Definition at line 374 of file abc.h.

374 { return (Abc_Obj_t *)pObj->pNtk->vObjs->pArray[ pObj->vFanins.pArray[1] ]; }
Vec_Int_t vFanins
Definition: abc.h:143
Vec_Ptr_t * vObjs
Definition: abc.h:162
Abc_Ntk_t * pNtk
Definition: abc.h:130
static int Abc_ObjFaninC ( Abc_Obj_t pObj,
int  i 
)
inlinestatic

Definition at line 379 of file abc.h.

379 { assert( i >=0 && i < 2 ); return i? pObj->fCompl1 : pObj->fCompl0; }
unsigned fCompl0
Definition: abc.h:140
unsigned fCompl1
Definition: abc.h:141
#define assert(ex)
Definition: util_old.h:213
static int Abc_ObjFaninC0 ( Abc_Obj_t pObj)
inlinestatic

Definition at line 377 of file abc.h.

377 { return pObj->fCompl0; }
unsigned fCompl0
Definition: abc.h:140
static int Abc_ObjFaninC1 ( Abc_Obj_t pObj)
inlinestatic

Definition at line 378 of file abc.h.

378 { return pObj->fCompl1; }
unsigned fCompl1
Definition: abc.h:141
static void Abc_ObjFaninFlipPhase ( Abc_Obj_t p,
int  i 
)
inlinestatic

Definition at line 393 of file abc.h.

393 { assert(p->pNtk->vPhases); assert( i >= 0 && i < Abc_ObjFaninNum(p) ); *Vec_IntEntryP(p->pNtk->vPhases, Abc_ObjId(p)) ^= (1 << i); }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
Vec_Int_t * vPhases
Definition: abc.h:208
Abc_Ntk_t * pNtk
Definition: abc.h:130
#define assert(ex)
Definition: util_old.h:213
static int * Vec_IntEntryP(Vec_Int_t *p, int i)
Definition: vecInt.h:417
static int Abc_ObjFaninId ( Abc_Obj_t pObj,
int  i 
)
inlinestatic

Definition at line 366 of file abc.h.

366 { return pObj->vFanins.pArray[i]; }
Vec_Int_t vFanins
Definition: abc.h:143
static int Abc_ObjFaninId0 ( Abc_Obj_t pObj)
inlinestatic

Definition at line 367 of file abc.h.

367 { return pObj->vFanins.pArray[0]; }
Vec_Int_t vFanins
Definition: abc.h:143
static int Abc_ObjFaninId1 ( Abc_Obj_t pObj)
inlinestatic

Definition at line 368 of file abc.h.

368 { return pObj->vFanins.pArray[1]; }
Vec_Int_t vFanins
Definition: abc.h:143
static int Abc_ObjFaninNum ( Abc_Obj_t pObj)
inlinestatic

Definition at line 364 of file abc.h.

364 { return pObj->vFanins.nSize; }
Vec_Int_t vFanins
Definition: abc.h:143
static int Abc_ObjFaninPhase ( Abc_Obj_t p,
int  i 
)
inlinestatic

Definition at line 392 of file abc.h.

392 { assert(p->pNtk->vPhases); assert( i >= 0 && i < Abc_ObjFaninNum(p) ); return (Vec_IntEntry(p->pNtk->vPhases, Abc_ObjId(p)) >> i) & 1; }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Vec_Int_t * vPhases
Definition: abc.h:208
Abc_Ntk_t * pNtk
Definition: abc.h:130
#define assert(ex)
Definition: util_old.h:213
static Vec_Int_t* Abc_ObjFaninVec ( Abc_Obj_t pObj)
inlinestatic

Definition at line 331 of file abc.h.

331 { return &pObj->vFanins; }
Vec_Int_t vFanins
Definition: abc.h:143
static Abc_Obj_t* Abc_ObjFanout ( Abc_Obj_t pObj,
int  i 
)
inlinestatic

Definition at line 370 of file abc.h.

370 { return (Abc_Obj_t *)pObj->pNtk->vObjs->pArray[ pObj->vFanouts.pArray[i] ]; }
Vec_Ptr_t * vObjs
Definition: abc.h:162
Vec_Int_t vFanouts
Definition: abc.h:144
Abc_Ntk_t * pNtk
Definition: abc.h:130
static Abc_Obj_t* Abc_ObjFanout0 ( Abc_Obj_t pObj)
inlinestatic

Definition at line 371 of file abc.h.

371 { return (Abc_Obj_t *)pObj->pNtk->vObjs->pArray[ pObj->vFanouts.pArray[0] ]; }
Vec_Ptr_t * vObjs
Definition: abc.h:162
Vec_Int_t vFanouts
Definition: abc.h:144
Abc_Ntk_t * pNtk
Definition: abc.h:130
static Abc_Obj_t* Abc_ObjFanout0Ntk ( Abc_Obj_t pObj)
inlinestatic

Definition at line 376 of file abc.h.

376 { return (Abc_NtkIsNetlist(pObj->pNtk)? Abc_ObjFanout0(pObj) : pObj); }
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
Abc_Ntk_t * pNtk
Definition: abc.h:130
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371
static int Abc_ObjFanoutEdgeNum ( Abc_Obj_t pObj,
Abc_Obj_t pFanout 
)
inlinestatic

Definition at line 369 of file abc.h.

369 { assert( Abc_NtkHasAig(pObj->pNtk) ); if ( Abc_ObjFaninId0(pFanout) == pObj->Id ) return 0; if ( Abc_ObjFaninId1(pFanout) == pObj->Id ) return 1; assert( 0 ); return -1; }
static int Abc_ObjFaninId0(Abc_Obj_t *pObj)
Definition: abc.h:367
Abc_Ntk_t * pNtk
Definition: abc.h:130
int Id
Definition: abc.h:132
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
static int Abc_ObjFaninId1(Abc_Obj_t *pObj)
Definition: abc.h:368
ABC_DLL int Abc_ObjFanoutFaninNum ( Abc_Obj_t pFanout,
Abc_Obj_t pFanin 
)

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

Synopsis [Returns the index of the fanin in the fanin list of the fanout.]

Description []

SideEffects []

SeeAlso []

Definition at line 321 of file abcFanio.c.

322 {
323  Abc_Obj_t * pObj;
324  int i;
325  Abc_ObjForEachFanin( pFanout, pObj, i )
326  if ( pObj == pFanin )
327  return i;
328  return -1;
329 }
if(last==0)
Definition: sparse_int.h:34
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
static int Abc_ObjFanoutNum ( Abc_Obj_t pObj)
inlinestatic

Definition at line 365 of file abc.h.

365 { return pObj->vFanouts.nSize; }
Vec_Int_t vFanouts
Definition: abc.h:144
static Vec_Int_t* Abc_ObjFanoutVec ( Abc_Obj_t pObj)
inlinestatic

Definition at line 332 of file abc.h.

332 { return &pObj->vFanouts; }
Vec_Int_t vFanouts
Definition: abc.h:144
static Abc_Obj_t* Abc_ObjFromLit ( Abc_Ntk_t p,
int  iLit 
)
inlinestatic

Definition at line 390 of file abc.h.

390 { return Abc_ObjNotCond( Abc_NtkObj(p, Abc_Lit2Var(iLit)), Abc_LitIsCompl(iLit) ); }
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
static Abc_Obj_t * Abc_ObjNotCond(Abc_Obj_t *p, int c)
Definition: abc.h:325
static void* Abc_ObjGlobalBdd ( Abc_Obj_t pObj)
inlinestatic

Definition at line 431 of file abc.h.

431 { return Vec_AttEntry( (Vec_Att_t *)Abc_NtkGlobalBdd(pObj->pNtk), pObj->Id ); }
static void * Vec_AttEntry(Vec_Att_t *p, int i)
Definition: vecAtt.h:247
static void * Abc_NtkGlobalBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:428
Abc_Ntk_t * pNtk
Definition: abc.h:130
int Id
Definition: abc.h:132
static unsigned Abc_ObjId ( Abc_Obj_t pObj)
inlinestatic

Definition at line 329 of file abc.h.

329 { return pObj->Id; }
int Id
Definition: abc.h:132
ABC_DLL Abc_Obj_t* Abc_ObjInsertBetween ( Abc_Obj_t pNodeIn,
Abc_Obj_t pNodeOut,
Abc_ObjType_t  Type 
)

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

Synopsis [Inserts one-input node of the type specified between the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 223 of file abcFanio.c.

224 {
225  Abc_Obj_t * pNodeNew;
226  int iFanoutIndex, iFaninIndex;
227  // find pNodeOut among the fanouts of pNodeIn
228  if ( (iFanoutIndex = Vec_IntFind( &pNodeIn->vFanouts, pNodeOut->Id )) == -1 )
229  {
230  printf( "Node %s is not among", Abc_ObjName(pNodeOut) );
231  printf( " the fanouts of node %s...\n", Abc_ObjName(pNodeIn) );
232  return NULL;
233  }
234  // find pNodeIn among the fanins of pNodeOut
235  if ( (iFaninIndex = Vec_IntFind( &pNodeOut->vFanins, pNodeIn->Id )) == -1 )
236  {
237  printf( "Node %s is not among", Abc_ObjName(pNodeIn) );
238  printf( " the fanins of node %s...\n", Abc_ObjName(pNodeOut) );
239  return NULL;
240  }
241  // create the new node
242  pNodeNew = Abc_NtkCreateObj( pNodeIn->pNtk, Type );
243  // add pNodeIn as fanin and pNodeOut as fanout
244  Vec_IntPushMem( pNodeNew->pNtk->pMmStep, &pNodeNew->vFanins, pNodeIn->Id );
245  Vec_IntPushMem( pNodeNew->pNtk->pMmStep, &pNodeNew->vFanouts, pNodeOut->Id );
246  // update the fanout of pNodeIn
247  Vec_IntWriteEntry( &pNodeIn->vFanouts, iFanoutIndex, pNodeNew->Id );
248  // update the fanin of pNodeOut
249  Vec_IntWriteEntry( &pNodeOut->vFanins, iFaninIndex, pNodeNew->Id );
250  return pNodeNew;
251 }
static int Vec_IntFind(Vec_Int_t *p, int Entry)
Definition: vecInt.h:895
Vec_Int_t vFanins
Definition: abc.h:143
ABC_DLL Abc_Obj_t * Abc_NtkCreateObj(Abc_Ntk_t *pNtk, Abc_ObjType_t Type)
Definition: abcObj.c:106
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
Vec_Int_t vFanouts
Definition: abc.h:144
Abc_Ntk_t * pNtk
Definition: abc.h:130
int Id
Definition: abc.h:132
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
Mem_Step_t * pMmStep
Definition: abc.h:190
static ABC_NAMESPACE_IMPL_START void Vec_IntPushMem(Mem_Step_t *pMemMan, Vec_Int_t *p, int Entry)
DECLARATIONS ///.
Definition: abcFanio.c:45
static int Abc_ObjIsBarBuf ( Abc_Obj_t pObj)
inlinestatic

Definition at line 360 of file abc.h.

360 { return Abc_NtkIsLogic(pObj->pNtk) && Vec_IntSize(&pObj->vFanins) == 1 && pObj->pData == NULL; }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
Vec_Int_t vFanins
Definition: abc.h:143
Abc_Ntk_t * pNtk
Definition: abc.h:130
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
void * pData
Definition: abc.h:145
static int Abc_ObjIsBi ( Abc_Obj_t pObj)
inlinestatic

Definition at line 349 of file abc.h.

349 { return pObj->Type == ABC_OBJ_BI; }
Definition: abc.h:91
unsigned Type
Definition: abc.h:133
static int Abc_ObjIsBlackbox ( Abc_Obj_t pObj)
inlinestatic

Definition at line 359 of file abc.h.

359 { return pObj->Type == ABC_OBJ_BLACKBOX;}
unsigned Type
Definition: abc.h:133
static int Abc_ObjIsBo ( Abc_Obj_t pObj)
inlinestatic

Definition at line 350 of file abc.h.

350 { return pObj->Type == ABC_OBJ_BO; }
unsigned Type
Definition: abc.h:133
Definition: abc.h:92
static int Abc_ObjIsBox ( Abc_Obj_t pObj)
inlinestatic

Definition at line 357 of file abc.h.

357 { return pObj->Type == ABC_OBJ_LATCH || pObj->Type == ABC_OBJ_WHITEBOX || pObj->Type == ABC_OBJ_BLACKBOX; }
unsigned Type
Definition: abc.h:133
static int Abc_ObjIsCi ( Abc_Obj_t pObj)
inlinestatic

Definition at line 351 of file abc.h.

351 { return pObj->Type == ABC_OBJ_PI || pObj->Type == ABC_OBJ_BO; }
unsigned Type
Definition: abc.h:133
Definition: abc.h:89
Definition: abc.h:92
static int Abc_ObjIsCo ( Abc_Obj_t pObj)
inlinestatic

Definition at line 352 of file abc.h.

352 { return pObj->Type == ABC_OBJ_PO || pObj->Type == ABC_OBJ_BI; }
Definition: abc.h:91
unsigned Type
Definition: abc.h:133
Definition: abc.h:90
static int Abc_ObjIsComplement ( Abc_Obj_t p)
inlinestatic

Definition at line 322 of file abc.h.

322 { return (int )((ABC_PTRUINT_T)p & (ABC_PTRUINT_T)01); }
static int Abc_ObjIsLatch ( Abc_Obj_t pObj)
inlinestatic

Definition at line 356 of file abc.h.

356 { return pObj->Type == ABC_OBJ_LATCH; }
unsigned Type
Definition: abc.h:133
static int Abc_ObjIsNet ( Abc_Obj_t pObj)
inlinestatic

Definition at line 354 of file abc.h.

354 { return pObj->Type == ABC_OBJ_NET; }
unsigned Type
Definition: abc.h:133
static int Abc_ObjIsNode ( Abc_Obj_t pObj)
inlinestatic

Definition at line 355 of file abc.h.

355 { return pObj->Type == ABC_OBJ_NODE; }
unsigned Type
Definition: abc.h:133
static int Abc_ObjIsNone ( Abc_Obj_t pObj)
inlinestatic

Definition at line 346 of file abc.h.

346 { return pObj->Type == ABC_OBJ_NONE; }
unsigned Type
Definition: abc.h:133
static int Abc_ObjIsPi ( Abc_Obj_t pObj)
inlinestatic

Definition at line 347 of file abc.h.

347 { return pObj->Type == ABC_OBJ_PI; }
unsigned Type
Definition: abc.h:133
Definition: abc.h:89
static int Abc_ObjIsPo ( Abc_Obj_t pObj)
inlinestatic

Definition at line 348 of file abc.h.

348 { return pObj->Type == ABC_OBJ_PO; }
unsigned Type
Definition: abc.h:133
Definition: abc.h:90
static int Abc_ObjIsTerm ( Abc_Obj_t pObj)
inlinestatic

Definition at line 353 of file abc.h.

353 { return Abc_ObjIsCi(pObj) || Abc_ObjIsCo(pObj); }
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
Definition: abc.h:351
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
Definition: abc.h:352
static int Abc_ObjIsWhitebox ( Abc_Obj_t pObj)
inlinestatic

Definition at line 358 of file abc.h.

358 { return pObj->Type == ABC_OBJ_WHITEBOX;}
unsigned Type
Definition: abc.h:133
static int Abc_ObjLevel ( Abc_Obj_t pObj)
inlinestatic

Definition at line 330 of file abc.h.

330 { return pObj->Level; }
unsigned Level
Definition: abc.h:142
ABC_DLL int Abc_ObjLevelNew ( Abc_Obj_t pObj)

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

Synopsis [Computes the level of the node using its fanin levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 1058 of file abcTiming.c.

1059 {
1060  Abc_Obj_t * pFanin;
1061  int i, Level = 0;
1062  Abc_ObjForEachFanin( pObj, pFanin, i )
1063  Level = Abc_MaxFloat( Level, Abc_ObjLevel(pFanin) );
1064  return Level + (int)(Abc_ObjFaninNum(pObj) > 0);
1065 }
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static float Abc_MaxFloat(float a, float b)
Definition: abc_global.h:243
static int Abc_ObjLevel(Abc_Obj_t *pObj)
Definition: abc.h:330
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
static Abc_Ntk_t* Abc_ObjModel ( Abc_Obj_t pObj)
inlinestatic

Definition at line 335 of file abc.h.

335 { assert( pObj->Type == ABC_OBJ_WHITEBOX ); return (Abc_Ntk_t *)pObj->pData; }
unsigned Type
Definition: abc.h:133
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
static void* Abc_ObjMvVar ( Abc_Obj_t pObj)
inlinestatic

Definition at line 437 of file abc.h.

437 { return Abc_NtkMvVar(pObj->pNtk)? Vec_AttEntry( (Vec_Att_t *)Abc_NtkMvVar(pObj->pNtk), pObj->Id ) : NULL; }
static void * Vec_AttEntry(Vec_Att_t *p, int i)
Definition: vecAtt.h:247
static void * Abc_NtkMvVar(Abc_Ntk_t *pNtk)
Definition: abc.h:435
Abc_Ntk_t * pNtk
Definition: abc.h:130
int Id
Definition: abc.h:132
static int Abc_ObjMvVarNum ( Abc_Obj_t pObj)
inlinestatic

Definition at line 438 of file abc.h.

438 { return (Abc_NtkMvVar(pObj->pNtk) && Abc_ObjMvVar(pObj))? *((int*)Abc_ObjMvVar(pObj)) : 2; }
static void * Abc_NtkMvVar(Abc_Ntk_t *pNtk)
Definition: abc.h:435
static void * Abc_ObjMvVar(Abc_Obj_t *pObj)
Definition: abc.h:437
Abc_Ntk_t * pNtk
Definition: abc.h:130
ABC_DLL char* Abc_ObjName ( Abc_Obj_t pObj)

DECLARATIONS ///.

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

FileName [abcNames.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Network and node package.]

Synopsis [Procedures working with net and node names.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Returns the unique name for the object.]

Description [If the name previously did not exist, creates a new unique name but does not assign this name to the object. The temporary unique name is stored in a static buffer inside this procedure. It is important that the name is used before the function is called again!]

SideEffects []

SeeAlso []

Definition at line 48 of file abcNames.c.

49 {
50  return Nm_ManCreateUniqueName( pObj->pNtk->pManName, pObj->Id );
51 }
Nm_Man_t * pManName
Definition: abc.h:160
Abc_Ntk_t * pNtk
Definition: abc.h:130
int Id
Definition: abc.h:132
char * Nm_ManCreateUniqueName(Nm_Man_t *p, int ObjId)
Definition: nmApi.c:175
ABC_DLL char* Abc_ObjNameDummy ( char *  pPrefix,
int  Num,
int  nDigits 
)

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

Synopsis [Returns the dummy PI name.]

Description []

SideEffects []

SeeAlso []

Definition at line 121 of file abcNames.c.

122 {
123  static char Buffer[2000];
124  sprintf( Buffer, "%s%0*d", pPrefix, nDigits, Num );
125  return Buffer;
126 }
char * sprintf()
ABC_DLL char* Abc_ObjNamePrefix ( Abc_Obj_t pObj,
char *  pPrefix 
)

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

Synopsis [Appends name to the prefix]

Description []

SideEffects []

SeeAlso []

Definition at line 85 of file abcNames.c.

86 {
87  static char Buffer[2000];
88  sprintf( Buffer, "%s%s", pPrefix, Abc_ObjName(pObj) );
89  return Buffer;
90 }
char * sprintf()
ABC_NAMESPACE_IMPL_START char * Abc_ObjName(Abc_Obj_t *pObj)
DECLARATIONS ///.
Definition: abcNames.c:48
ABC_DLL char* Abc_ObjNameSuffix ( Abc_Obj_t pObj,
char *  pSuffix 
)

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

Synopsis [Appends suffic to the name.]

Description []

SideEffects []

SeeAlso []

Definition at line 103 of file abcNames.c.

104 {
105  static char Buffer[2000];
106  sprintf( Buffer, "%s%s", Abc_ObjName(pObj), pSuffix );
107  return Buffer;
108 }
char * sprintf()
ABC_NAMESPACE_IMPL_START char * Abc_ObjName(Abc_Obj_t *pObj)
DECLARATIONS ///.
Definition: abcNames.c:48
static Abc_Obj_t* Abc_ObjNot ( Abc_Obj_t p)
inlinestatic

Definition at line 324 of file abc.h.

324 { return (Abc_Obj_t *)((ABC_PTRUINT_T)p ^ (ABC_PTRUINT_T)01); }
static Abc_Obj_t* Abc_ObjNotCond ( Abc_Obj_t p,
int  c 
)
inlinestatic

Definition at line 325 of file abc.h.

325 { return (Abc_Obj_t *)((ABC_PTRUINT_T)p ^ (ABC_PTRUINT_T)(c!=0)); }
static Abc_Ntk_t* Abc_ObjNtk ( Abc_Obj_t pObj)
inlinestatic

Definition at line 334 of file abc.h.

334 { return pObj->pNtk; }
Abc_Ntk_t * pNtk
Definition: abc.h:130
ABC_DLL void Abc_ObjPatchFanin ( Abc_Obj_t pObj,
Abc_Obj_t pFaninOld,
Abc_Obj_t pFaninNew 
)

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

Synopsis [Replaces a fanin of the node.]

Description [The node is pObj. An old fanin of this node (pFaninOld) has to be replaced by a new fanin (pFaninNew). Assumes that the node and the old fanin are not complemented. The new fanin can be complemented. In this case, the polarity of the new fanin will change, compared to the polarity of the old fanin.]

SideEffects []

SeeAlso []

Definition at line 172 of file abcFanio.c.

173 {
174  Abc_Obj_t * pFaninNewR = Abc_ObjRegular(pFaninNew);
175  int iFanin;//, nLats;//, fCompl;
176  assert( !Abc_ObjIsComplement(pObj) );
177  assert( !Abc_ObjIsComplement(pFaninOld) );
178  assert( pFaninOld != pFaninNewR );
179 // assert( pObj != pFaninOld );
180 // assert( pObj != pFaninNewR );
181  assert( pObj->pNtk == pFaninOld->pNtk );
182  assert( pObj->pNtk == pFaninNewR->pNtk );
183  if ( (iFanin = Vec_IntFind( &pObj->vFanins, pFaninOld->Id )) == -1 )
184  {
185  printf( "Node %s is not among", Abc_ObjName(pFaninOld) );
186  printf( " the fanins of node %s...\n", Abc_ObjName(pObj) );
187  return;
188  }
189 
190  // remember the attributes of the old fanin
191 // fCompl = Abc_ObjFaninC(pObj, iFanin);
192  // replace the old fanin entry by the new fanin entry (removes attributes)
193  Vec_IntWriteEntry( &pObj->vFanins, iFanin, pFaninNewR->Id );
194  // set the attributes of the new fanin
195 // if ( fCompl ^ Abc_ObjIsComplement(pFaninNew) )
196 // Abc_ObjSetFaninC( pObj, iFanin );
197  if ( Abc_ObjIsComplement(pFaninNew) )
198  Abc_ObjXorFaninC( pObj, iFanin );
199 
200 // if ( Abc_NtkIsSeq(pObj->pNtk) && (nLats = Seq_ObjFaninL(pObj, iFanin)) )
201 // Seq_ObjSetFaninL( pObj, iFanin, nLats );
202  // update the fanout of the fanin
203  if ( !Vec_IntRemove( &pFaninOld->vFanouts, pObj->Id ) )
204  {
205  printf( "Node %s is not among", Abc_ObjName(pObj) );
206  printf( " the fanouts of its old fanin %s...\n", Abc_ObjName(pFaninOld) );
207 // return;
208  }
209  Vec_IntPushMem( pObj->pNtk->pMmStep, &pFaninNewR->vFanouts, pObj->Id );
210 }
static int Vec_IntFind(Vec_Int_t *p, int Entry)
Definition: vecInt.h:895
Vec_Int_t vFanins
Definition: abc.h:143
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Vec_IntRemove(Vec_Int_t *p, int Entry)
Definition: vecInt.h:915
Vec_Int_t vFanouts
Definition: abc.h:144
static Abc_Obj_t * Abc_ObjRegular(Abc_Obj_t *p)
Definition: abc.h:323
Abc_Ntk_t * pNtk
Definition: abc.h:130
int Id
Definition: abc.h:132
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
static void Abc_ObjXorFaninC(Abc_Obj_t *pObj, int i)
Definition: abc.h:381
Mem_Step_t * pMmStep
Definition: abc.h:190
#define assert(ex)
Definition: util_old.h:213
static int Abc_ObjIsComplement(Abc_Obj_t *p)
Definition: abc.h:322
static ABC_NAMESPACE_IMPL_START void Vec_IntPushMem(Mem_Step_t *pMemMan, Vec_Int_t *p, int Entry)
DECLARATIONS ///.
Definition: abcFanio.c:45
ABC_DLL int Abc_ObjPointerCompare ( void **  pp1,
void **  pp2 
)

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

Synopsis [Compares the pointers.]

Description []

SideEffects []

SeeAlso []

Definition at line 1899 of file abcUtil.c.

1900 {
1901  if ( *pp1 < *pp2 )
1902  return -1;
1903  if ( *pp1 > *pp2 )
1904  return 1;
1905  return 0;
1906 }
ABC_DLL void Abc_ObjPrint ( FILE *  pFile,
Abc_Obj_t pObj 
)

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

Synopsis [Prints information about the object.]

Description []

SideEffects []

SeeAlso []

Definition at line 1287 of file abcPrint.c.

1288 {
1289  Abc_Obj_t * pFanin;
1290  int i;
1291  fprintf( pFile, "Object %5d : ", pObj->Id );
1292  switch ( pObj->Type )
1293  {
1294  case ABC_OBJ_NONE:
1295  fprintf( pFile, "NONE " );
1296  break;
1297  case ABC_OBJ_CONST1:
1298  fprintf( pFile, "Const1 " );
1299  break;
1300  case ABC_OBJ_PI:
1301  fprintf( pFile, "PI " );
1302  break;
1303  case ABC_OBJ_PO:
1304  fprintf( pFile, "PO " );
1305  break;
1306  case ABC_OBJ_BI:
1307  fprintf( pFile, "BI " );
1308  break;
1309  case ABC_OBJ_BO:
1310  fprintf( pFile, "BO " );
1311  break;
1312  case ABC_OBJ_NET:
1313  fprintf( pFile, "Net " );
1314  break;
1315  case ABC_OBJ_NODE:
1316  fprintf( pFile, "Node " );
1317  break;
1318  case ABC_OBJ_LATCH:
1319  fprintf( pFile, "Latch " );
1320  break;
1321  case ABC_OBJ_WHITEBOX:
1322  fprintf( pFile, "Whitebox" );
1323  break;
1324  case ABC_OBJ_BLACKBOX:
1325  fprintf( pFile, "Blackbox" );
1326  break;
1327  default:
1328  assert(0);
1329  break;
1330  }
1331  // print the fanins
1332  fprintf( pFile, " Fanins ( " );
1333  Abc_ObjForEachFanin( pObj, pFanin, i )
1334  fprintf( pFile, "%d ", pFanin->Id );
1335  fprintf( pFile, ") " );
1336 /*
1337  fprintf( pFile, " Fanouts ( " );
1338  Abc_ObjForEachFanout( pObj, pFanin, i )
1339  fprintf( pFile, "%d(%c) ", pFanin->Id, Abc_NodeIsTravIdCurrent(pFanin)? '+' : '-' );
1340  fprintf( pFile, ") " );
1341 */
1342  // print the logic function
1343  if ( Abc_ObjIsNode(pObj) && Abc_NtkIsSopLogic(pObj->pNtk) )
1344  fprintf( pFile, " %s", (char*)pObj->pData );
1345  else
1346  fprintf( pFile, "\n" );
1347 }
Definition: abc.h:91
static int Abc_NtkIsSopLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:264
unsigned Type
Definition: abc.h:133
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
Definition: abc.h:89
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
int Id
Definition: abc.h:132
Definition: abc.h:90
Definition: abc.h:92
#define assert(ex)
Definition: util_old.h:213
ABC_DLL void Abc_ObjRecycle ( Abc_Obj_t pObj)

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

Synopsis [Recycles the object.]

Description []

SideEffects []

SeeAlso []

Definition at line 74 of file abcObj.c.

75 {
76  Abc_Ntk_t * pNtk = pObj->pNtk;
77 // int LargePiece = (4 << ABC_NUM_STEPS);
78  // free large fanout arrays
79 // if ( pNtk->pMmStep && pObj->vFanouts.nCap * 4 > LargePiece )
80 // free( pObj->vFanouts.pArray );
81  if ( pNtk->pMmStep == NULL )
82  {
83  ABC_FREE( pObj->vFanouts.pArray );
84  ABC_FREE( pObj->vFanins.pArray );
85  }
86  // clean the memory to make deleted object distinct from the live one
87  memset( pObj, 0, sizeof(Abc_Obj_t) );
88  // recycle the object
89  if ( pNtk->pMmObj )
90  Mem_FixedEntryRecycle( pNtk->pMmObj, (char *)pObj );
91  else
92  ABC_FREE( pObj );
93 }
char * memset()
Vec_Int_t vFanins
Definition: abc.h:143
Mem_Fixed_t * pMmObj
Definition: abc.h:189
void Mem_FixedEntryRecycle(Mem_Fixed_t *p, char *pEntry)
Definition: mem.c:219
Vec_Int_t vFanouts
Definition: abc.h:144
Abc_Ntk_t * pNtk
Definition: abc.h:130
#define ABC_FREE(obj)
Definition: abc_global.h:232
Mem_Step_t * pMmStep
Definition: abc.h:190
static Abc_Obj_t* Abc_ObjRegular ( Abc_Obj_t p)
inlinestatic

Definition at line 323 of file abc.h.

323 { return (Abc_Obj_t *)((ABC_PTRUINT_T)p & ~(ABC_PTRUINT_T)01); }
ABC_DLL void Abc_ObjRemoveFanins ( Abc_Obj_t pObj)

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

Synopsis [Destroys fanout/fanin relationship between the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 141 of file abcFanio.c.

142 {
143  Vec_Int_t * vFaninsOld;
144  Abc_Obj_t * pFanin;
145  int k;
146  // remove old fanins
147  vFaninsOld = &pObj->vFanins;
148  for ( k = vFaninsOld->nSize - 1; k >= 0; k-- )
149  {
150  pFanin = Abc_NtkObj( pObj->pNtk, vFaninsOld->pArray[k] );
151  Abc_ObjDeleteFanin( pObj, pFanin );
152  }
153  pObj->fCompl0 = 0;
154  pObj->fCompl1 = 0;
155  assert( vFaninsOld->nSize == 0 );
156 }
unsigned fCompl0
Definition: abc.h:140
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
void Abc_ObjDeleteFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:111
Vec_Int_t vFanins
Definition: abc.h:143
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
unsigned fCompl1
Definition: abc.h:141
Abc_Ntk_t * pNtk
Definition: abc.h:130
#define assert(ex)
Definition: util_old.h:213
ABC_DLL void Abc_ObjReplace ( Abc_Obj_t pNodeOld,
Abc_Obj_t pNodeNew 
)

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

Synopsis [Replaces the node by a new node.]

Description []

SideEffects []

SeeAlso []

Definition at line 297 of file abcFanio.c.

298 {
299  assert( !Abc_ObjIsComplement(pNodeOld) );
300  assert( !Abc_ObjIsComplement(pNodeNew) );
301  assert( pNodeOld->pNtk == pNodeNew->pNtk );
302  assert( pNodeOld != pNodeNew );
303  assert( Abc_ObjFanoutNum(pNodeOld) > 0 );
304  // transfer the fanouts to the old node
305  Abc_ObjTransferFanout( pNodeOld, pNodeNew );
306  // remove the old node
307  Abc_NtkDeleteObj_rec( pNodeOld, 1 );
308 }
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
ABC_DLL void Abc_NtkDeleteObj_rec(Abc_Obj_t *pObj, int fOnlyNodes)
Definition: abcObj.c:273
Abc_Ntk_t * pNtk
Definition: abc.h:130
void Abc_ObjTransferFanout(Abc_Obj_t *pNodeFrom, Abc_Obj_t *pNodeTo)
Definition: abcFanio.c:264
#define assert(ex)
Definition: util_old.h:213
static int Abc_ObjIsComplement(Abc_Obj_t *p)
Definition: abc.h:322
ABC_DLL int Abc_ObjRequiredLevel ( Abc_Obj_t pObj)

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

Synopsis [Returns required level of the node.]

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

SideEffects []

SeeAlso []

Definition at line 1102 of file abcTiming.c.

1103 {
1104  Abc_Ntk_t * pNtk = pObj->pNtk;
1105  assert( pNtk->vLevelsR );
1106  return pNtk->LevelMax + 1 - Abc_ObjReverseLevel(pObj);
1107 }
Vec_Int_t * vLevelsR
Definition: abc.h:196
int Abc_ObjReverseLevel(Abc_Obj_t *pObj)
Definition: abcTiming.c:1121
int LevelMax
Definition: abc.h:195
Abc_Ntk_t * pNtk
Definition: abc.h:130
#define assert(ex)
Definition: util_old.h:213
ABC_DLL int Abc_ObjReverseLevel ( Abc_Obj_t pObj)

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

Synopsis [Returns the reverse level of the node.]

Description [The reverse level is the level of the node in reverse topological order, starting from the COs.]

SideEffects []

SeeAlso []

Definition at line 1121 of file abcTiming.c.

1122 {
1123  Abc_Ntk_t * pNtk = pObj->pNtk;
1124  assert( pNtk->vLevelsR );
1125  Vec_IntFillExtra( pNtk->vLevelsR, pObj->Id + 1, 0 );
1126  return Vec_IntEntry(pNtk->vLevelsR, pObj->Id);
1127 }
Vec_Int_t * vLevelsR
Definition: abc.h:196
static void Vec_IntFillExtra(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:376
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Abc_Ntk_t * pNtk
Definition: abc.h:130
int Id
Definition: abc.h:132
#define assert(ex)
Definition: util_old.h:213
ABC_DLL int Abc_ObjReverseLevelNew ( Abc_Obj_t pObj)

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

Synopsis [Computes the reverse level of the node using its fanout levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 1078 of file abcTiming.c.

1079 {
1080  Abc_Obj_t * pFanout;
1081  int i, LevelCur, Level = 0;
1082  Abc_ObjForEachFanout( pObj, pFanout, i )
1083  {
1084  LevelCur = Abc_ObjReverseLevel( pFanout );
1085  Level = Abc_MaxFloat( Level, LevelCur );
1086  }
1087  return Level + 1;
1088 }
int Abc_ObjReverseLevel(Abc_Obj_t *pObj)
Definition: abcTiming.c:1121
static float Abc_MaxFloat(float a, float b)
Definition: abc_global.h:243
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition: abc.h:526
static void Abc_ObjSetCopy ( Abc_Obj_t pObj,
Abc_Obj_t pCopy 
)
inlinestatic

Definition at line 342 of file abc.h.

342 { pObj->pCopy = pCopy; }
Abc_Obj_t * pCopy
Definition: abc.h:148
static void Abc_ObjSetData ( Abc_Obj_t pObj,
void *  pData 
)
inlinestatic

Definition at line 343 of file abc.h.

343 { pObj->pData = pData; }
void * pData
Definition: abc.h:145
static void Abc_ObjSetFaninC ( Abc_Obj_t pObj,
int  i 
)
inlinestatic

Definition at line 380 of file abc.h.

380 { assert( i >=0 && i < 2 ); if ( i ) pObj->fCompl1 = 1; else pObj->fCompl0 = 1; }
unsigned fCompl0
Definition: abc.h:140
unsigned fCompl1
Definition: abc.h:141
#define assert(ex)
Definition: util_old.h:213
static void Abc_ObjSetGlobalBdd ( Abc_Obj_t pObj,
void *  bF 
)
inlinestatic

Definition at line 432 of file abc.h.

432 { Vec_AttWriteEntry( (Vec_Att_t *)Abc_NtkGlobalBdd(pObj->pNtk), pObj->Id, bF ); }
static void * Abc_NtkGlobalBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:428
Abc_Ntk_t * pNtk
Definition: abc.h:130
int Id
Definition: abc.h:132
static void Vec_AttWriteEntry(Vec_Att_t *p, int i, void *pEntry)
Definition: vecAtt.h:227
static void Abc_ObjSetLevel ( Abc_Obj_t pObj,
int  Level 
)
inlinestatic

Definition at line 341 of file abc.h.

341 { pObj->Level = Level; }
unsigned Level
Definition: abc.h:142
static void Abc_ObjSetMvVar ( Abc_Obj_t pObj,
void *  pV 
)
inlinestatic

Definition at line 439 of file abc.h.

439 { Vec_AttWriteEntry( (Vec_Att_t *)Abc_NtkMvVar(pObj->pNtk), pObj->Id, pV ); }
static void * Abc_NtkMvVar(Abc_Ntk_t *pNtk)
Definition: abc.h:435
Abc_Ntk_t * pNtk
Definition: abc.h:130
int Id
Definition: abc.h:132
static void Vec_AttWriteEntry(Vec_Att_t *p, int i, void *pEntry)
Definition: vecAtt.h:227
ABC_DLL void Abc_ObjSetReverseLevel ( Abc_Obj_t pObj,
int  LevelR 
)

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

Synopsis [Sets the reverse level of the node.]

Description [The reverse level is the level of the node in reverse topological order, starting from the COs.]

SideEffects []

SeeAlso []

Definition at line 1141 of file abcTiming.c.

1142 {
1143  Abc_Ntk_t * pNtk = pObj->pNtk;
1144  assert( pNtk->vLevelsR );
1145  Vec_IntFillExtra( pNtk->vLevelsR, pObj->Id + 1, 0 );
1146  Vec_IntWriteEntry( pNtk->vLevelsR, pObj->Id, LevelR );
1147 }
Vec_Int_t * vLevelsR
Definition: abc.h:196
static void Vec_IntFillExtra(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:376
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
Abc_Ntk_t * pNtk
Definition: abc.h:130
int Id
Definition: abc.h:132
#define assert(ex)
Definition: util_old.h:213
static int Abc_ObjToLit ( Abc_Obj_t p)
inlinestatic

Definition at line 391 of file abc.h.

static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
static Abc_Obj_t * Abc_ObjRegular(Abc_Obj_t *p)
Definition: abc.h:323
static int Abc_ObjIsComplement(Abc_Obj_t *p)
Definition: abc.h:322
ABC_DLL void Abc_ObjTransferFanout ( Abc_Obj_t pNodeFrom,
Abc_Obj_t pNodeTo 
)

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

Synopsis [Transfers fanout from the old node to the new node.]

Description []

SideEffects []

SeeAlso []

Definition at line 264 of file abcFanio.c.

265 {
266  Vec_Ptr_t * vFanouts;
267  int nFanoutsOld, i;
268  assert( !Abc_ObjIsComplement(pNodeFrom) );
269  assert( !Abc_ObjIsComplement(pNodeTo) );
270  assert( !Abc_ObjIsPo(pNodeFrom) && !Abc_ObjIsPo(pNodeTo) );
271  assert( pNodeFrom->pNtk == pNodeTo->pNtk );
272  assert( pNodeFrom != pNodeTo );
273  assert( !Abc_ObjIsNode(pNodeFrom) || Abc_ObjFanoutNum(pNodeFrom) > 0 );
274  // get the fanouts of the old node
275  nFanoutsOld = Abc_ObjFanoutNum(pNodeTo);
276  vFanouts = Vec_PtrAlloc( nFanoutsOld );
277  Abc_NodeCollectFanouts( pNodeFrom, vFanouts );
278  // patch the fanin of each of them
279  for ( i = 0; i < vFanouts->nSize; i++ )
280  Abc_ObjPatchFanin( (Abc_Obj_t *)vFanouts->pArray[i], pNodeFrom, pNodeTo );
281  assert( Abc_ObjFanoutNum(pNodeFrom) == 0 );
282  assert( Abc_ObjFanoutNum(pNodeTo) == nFanoutsOld + vFanouts->nSize );
283  Vec_PtrFree( vFanouts );
284 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
void Abc_ObjPatchFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFaninOld, Abc_Obj_t *pFaninNew)
Definition: abcFanio.c:172
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
Abc_Ntk_t * pNtk
Definition: abc.h:130
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static int Abc_ObjIsPo(Abc_Obj_t *pObj)
Definition: abc.h:348
#define assert(ex)
Definition: util_old.h:213
ABC_DLL void Abc_NodeCollectFanouts(Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
Definition: abcUtil.c:1607
static int Abc_ObjIsComplement(Abc_Obj_t *p)
Definition: abc.h:322
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
static unsigned Abc_ObjType ( Abc_Obj_t pObj)
inlinestatic

Definition at line 328 of file abc.h.

328 { return pObj->Type; }
unsigned Type
Definition: abc.h:133
static void Abc_ObjXorFaninC ( Abc_Obj_t pObj,
int  i 
)
inlinestatic

Definition at line 381 of file abc.h.

381 { assert( i >=0 && i < 2 ); if ( i ) pObj->fCompl1^= 1; else pObj->fCompl0^= 1; }
unsigned fCompl0
Definition: abc.h:140
unsigned fCompl1
Definition: abc.h:141
#define assert(ex)
Definition: util_old.h:213
ABC_DLL int Abc_SopCheck ( char *  pSop,
int  nFanins 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 823 of file abcSop.c.

824 {
825  char * pCubes, * pCubesOld;
826  int fFound0 = 0, fFound1 = 0;
827 
828  // check the logic function of the node
829  for ( pCubes = pSop; *pCubes; pCubes++ )
830  {
831  // get the end of the next cube
832  for ( pCubesOld = pCubes; *pCubes != ' '; pCubes++ );
833  // compare the distance
834  if ( pCubes - pCubesOld != nFanins )
835  {
836  fprintf( stdout, "Abc_SopCheck: SOP has a mismatch between its cover size (%d) and its fanin number (%d).\n",
837  (int)(ABC_PTRDIFF_T)(pCubes - pCubesOld), nFanins );
838  return 0;
839  }
840  // check the output values for this cube
841  pCubes++;
842  if ( *pCubes == '0' )
843  fFound0 = 1;
844  else if ( *pCubes == '1' )
845  fFound1 = 1;
846  else if ( *pCubes != 'x' && *pCubes != 'n' )
847  {
848  fprintf( stdout, "Abc_SopCheck: SOP has a strange character (%c) in the output part of its cube.\n", *pCubes );
849  return 0;
850  }
851  // check the last symbol (new line)
852  pCubes++;
853  if ( *pCubes != '\n' )
854  {
855  fprintf( stdout, "Abc_SopCheck: SOP has a cube without new line in the end.\n" );
856  return 0;
857  }
858  }
859  if ( fFound0 && fFound1 )
860  {
861  fprintf( stdout, "Abc_SopCheck: SOP has cubes in both phases.\n" );
862  return 0;
863  }
864  return 1;
865 }
ABC_DLL void Abc_SopComplement ( char *  pSop)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 600 of file abcSop.c.

601 {
602  char * pCur;
603  for ( pCur = pSop; *pCur; pCur++ )
604  if ( *pCur == '\n' )
605  {
606  if ( *(pCur - 1) == '0' )
607  *(pCur - 1) = '1';
608  else if ( *(pCur - 1) == '1' )
609  *(pCur - 1) = '0';
610  else if ( *(pCur - 1) == 'x' )
611  *(pCur - 1) = 'n';
612  else if ( *(pCur - 1) == 'n' )
613  *(pCur - 1) = 'x';
614  else
615  assert( 0 );
616  }
617 }
#define assert(ex)
Definition: util_old.h:213
ABC_DLL void Abc_SopComplementVar ( char *  pSop,
int  iVar 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 630 of file abcSop.c.

631 {
632  char * pCube;
633  int nVars = Abc_SopGetVarNum(pSop);
634  assert( iVar < nVars );
635  Abc_SopForEachCube( pSop, nVars, pCube )
636  {
637  if ( pCube[iVar] == '0' )
638  pCube[iVar] = '1';
639  else if ( pCube[iVar] == '1' )
640  pCube[iVar] = '0';
641  }
642 }
#define Abc_SopForEachCube(pSop, nFanins, pCube)
Definition: abc.h:531
int Abc_SopGetVarNum(char *pSop)
Definition: abcSop.c:536
#define assert(ex)
Definition: util_old.h:213
ABC_DLL char* Abc_SopCreateAnd ( Mem_Flex_t pMan,
int  nVars,
int *  pfCompl 
)

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

Synopsis [Creates the multi-input AND cover.]

Description []

SideEffects []

SeeAlso []

Definition at line 162 of file abcSop.c.

163 {
164  char * pSop;
165  int i;
166  pSop = Abc_SopStart( pMan, 1, nVars );
167  for ( i = 0; i < nVars; i++ )
168  pSop[i] = '1' - (pfCompl? pfCompl[i] : 0);
169  pSop[nVars + 1] = '1';
170  return pSop;
171 }
char * Abc_SopStart(Mem_Flex_t *pMan, int nCubes, int nVars)
Definition: abcSop.c:76
ABC_DLL char* Abc_SopCreateAnd2 ( Mem_Flex_t pMan,
int  fCompl0,
int  fCompl1 
)

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

Synopsis [Creates the AND2 cover.]

Description []

SideEffects []

SeeAlso []

Definition at line 139 of file abcSop.c.

140 {
141  char Buffer[6];
142  Buffer[0] = '1' - fCompl0;
143  Buffer[1] = '1' - fCompl1;
144  Buffer[2] = ' ';
145  Buffer[3] = '1';
146  Buffer[4] = '\n';
147  Buffer[5] = 0;
148  return Abc_SopRegister( pMan, Buffer );
149 }
ABC_NAMESPACE_IMPL_START char * Abc_SopRegister(Mem_Flex_t *pMan, char *pName)
DECLARATIONS ///.
Definition: abcSop.c:56
ABC_DLL char* Abc_SopCreateBuf ( Mem_Flex_t pMan)

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

Synopsis [Creates the buf cover.]

Description []

SideEffects []

SeeAlso []

Definition at line 361 of file abcSop.c.

362 {
363  return Abc_SopRegister(pMan, "1 1\n");
364 }
ABC_NAMESPACE_IMPL_START char * Abc_SopRegister(Mem_Flex_t *pMan, char *pName)
DECLARATIONS ///.
Definition: abcSop.c:56
ABC_DLL char* Abc_SopCreateConst0 ( Mem_Flex_t pMan)

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

Synopsis [Creates the constant 1 cover with 0 variables.]

Description []

SideEffects []

SeeAlso []

Definition at line 123 of file abcSop.c.

124 {
125  return Abc_SopRegister( pMan, " 0\n" );
126 }
ABC_NAMESPACE_IMPL_START char * Abc_SopRegister(Mem_Flex_t *pMan, char *pName)
DECLARATIONS ///.
Definition: abcSop.c:56
ABC_DLL char* Abc_SopCreateConst1 ( Mem_Flex_t pMan)

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

Synopsis [Creates the constant 1 cover with 0 variables.]

Description []

SideEffects []

SeeAlso []

Definition at line 107 of file abcSop.c.

108 {
109  return Abc_SopRegister( pMan, " 1\n" );
110 }
ABC_NAMESPACE_IMPL_START char * Abc_SopRegister(Mem_Flex_t *pMan, char *pName)
DECLARATIONS ///.
Definition: abcSop.c:56
ABC_DLL char* Abc_SopCreateFromIsop ( Mem_Flex_t pMan,
int  nVars,
Vec_Int_t vCover 
)

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

Synopsis [Creates the cover from the ISOP computed from TT.]

Description []

SideEffects []

SeeAlso []

Definition at line 416 of file abcSop.c.

417 {
418  char * pSop, * pCube;
419  int i, k, Entry, Literal;
420  assert( Vec_IntSize(vCover) > 0 );
421  if ( Vec_IntSize(vCover) == 0 )
422  return NULL;
423  // start the cover
424  pSop = Abc_SopStart( pMan, Vec_IntSize(vCover), nVars );
425  // create cubes
426  Vec_IntForEachEntry( vCover, Entry, i )
427  {
428  pCube = pSop + i * (nVars + 3);
429  for ( k = 0; k < nVars; k++ )
430  {
431  Literal = 3 & (Entry >> (k << 1));
432  if ( Literal == 1 )
433  pCube[k] = '0';
434  else if ( Literal == 2 )
435  pCube[k] = '1';
436  else if ( Literal != 0 )
437  assert( 0 );
438  }
439  }
440  return pSop;
441 }
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
char * Abc_SopStart(Mem_Flex_t *pMan, int nCubes, int nVars)
Definition: abcSop.c:76
#define assert(ex)
Definition: util_old.h:213
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
ABC_DLL char* Abc_SopCreateFromTruth ( Mem_Flex_t pMan,
int  nVars,
unsigned *  pTruth 
)

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

Synopsis [Creates the arbitrary cover from the truth table.]

Description []

SideEffects []

SeeAlso []

Definition at line 377 of file abcSop.c.

378 {
379  char * pSop, * pCube;
380  int nMints, Counter, i, k;
381  // count the number of true minterms
382  Counter = 0;
383  nMints = (1 << nVars);
384  for ( i = 0; i < nMints; i++ )
385  Counter += ((pTruth[i>>5] & (1 << (i&31))) > 0);
386  // SOP is not well-defined if the truth table is constant 0
387  assert( Counter > 0 );
388  if ( Counter == 0 )
389  return NULL;
390  // start the cover
391  pSop = Abc_SopStart( pMan, Counter, nVars );
392  // create true minterms
393  Counter = 0;
394  for ( i = 0; i < nMints; i++ )
395  if ( (pTruth[i>>5] & (1 << (i&31))) > 0 )
396  {
397  pCube = pSop + Counter * (nVars + 3);
398  for ( k = 0; k < nVars; k++ )
399  pCube[k] = '0' + ((i & (1 << k)) > 0);
400  Counter++;
401  }
402  return pSop;
403 }
static int Counter
char * Abc_SopStart(Mem_Flex_t *pMan, int nCubes, int nVars)
Definition: abcSop.c:76
#define assert(ex)
Definition: util_old.h:213
ABC_DLL char* Abc_SopCreateInv ( Mem_Flex_t pMan)

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

Synopsis [Creates the inv cover.]

Description []

SideEffects []

SeeAlso []

Definition at line 345 of file abcSop.c.

346 {
347  return Abc_SopRegister(pMan, "0 1\n");
348 }
ABC_NAMESPACE_IMPL_START char * Abc_SopRegister(Mem_Flex_t *pMan, char *pName)
DECLARATIONS ///.
Definition: abcSop.c:56
ABC_DLL char* Abc_SopCreateMux ( Mem_Flex_t pMan)

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

Synopsis [Creates the MUX cover.]

Description [The first input of MUX is the control. The second input is DATA1. The third input is DATA0.]

SideEffects []

SeeAlso []

Definition at line 329 of file abcSop.c.

330 {
331  return Abc_SopRegister(pMan, "11- 1\n0-1 1\n");
332 }
ABC_NAMESPACE_IMPL_START char * Abc_SopRegister(Mem_Flex_t *pMan, char *pName)
DECLARATIONS ///.
Definition: abcSop.c:56
ABC_DLL char* Abc_SopCreateNand ( Mem_Flex_t pMan,
int  nVars 
)

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

Synopsis [Creates the multi-input NAND cover.]

Description []

SideEffects []

SeeAlso []

Definition at line 184 of file abcSop.c.

185 {
186  char * pSop;
187  int i;
188  pSop = Abc_SopStart( pMan, 1, nVars );
189  for ( i = 0; i < nVars; i++ )
190  pSop[i] = '1';
191  pSop[nVars + 1] = '0';
192  return pSop;
193 }
char * Abc_SopStart(Mem_Flex_t *pMan, int nCubes, int nVars)
Definition: abcSop.c:76
ABC_DLL char* Abc_SopCreateNor ( Mem_Flex_t pMan,
int  nVars 
)

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

Synopsis [Creates the multi-input NOR cover.]

Description []

SideEffects []

SeeAlso []

Definition at line 253 of file abcSop.c.

254 {
255  char * pSop;
256  int i;
257  pSop = Abc_SopStart( pMan, 1, nVars );
258  for ( i = 0; i < nVars; i++ )
259  pSop[i] = '0';
260  return pSop;
261 }
char * Abc_SopStart(Mem_Flex_t *pMan, int nCubes, int nVars)
Definition: abcSop.c:76
ABC_DLL char* Abc_SopCreateNxor ( Mem_Flex_t pMan,
int  nVars 
)

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

Synopsis [Creates the multi-input XNOR cover.]

Description []

SideEffects []

SeeAlso []

Definition at line 311 of file abcSop.c.

312 {
313  assert( nVars == 2 );
314  return Abc_SopRegister(pMan, "11 1\n00 1\n");
315 }
ABC_NAMESPACE_IMPL_START char * Abc_SopRegister(Mem_Flex_t *pMan, char *pName)
DECLARATIONS ///.
Definition: abcSop.c:56
#define assert(ex)
Definition: util_old.h:213
ABC_DLL char* Abc_SopCreateOr ( Mem_Flex_t pMan,
int  nVars,
int *  pfCompl 
)

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

Synopsis [Creates the multi-input OR cover.]

Description []

SideEffects []

SeeAlso []

Definition at line 206 of file abcSop.c.

207 {
208  char * pSop;
209  int i;
210  pSop = Abc_SopStart( pMan, 1, nVars );
211  for ( i = 0; i < nVars; i++ )
212  pSop[i] = '0' + (pfCompl? pfCompl[i] : 0);
213  pSop[nVars + 1] = '0';
214  return pSop;
215 }
char * Abc_SopStart(Mem_Flex_t *pMan, int nCubes, int nVars)
Definition: abcSop.c:76
ABC_DLL char* Abc_SopCreateOrMultiCube ( Mem_Flex_t pMan,
int  nVars,
int *  pfCompl 
)

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

Synopsis [Creates the multi-input OR cover.]

Description []

SideEffects []

SeeAlso []

Definition at line 228 of file abcSop.c.

229 {
230  char * pSop, * pCube;
231  int i;
232  pSop = Abc_SopStart( pMan, nVars, nVars );
233  i = 0;
234  Abc_SopForEachCube( pSop, nVars, pCube )
235  {
236  pCube[i] = '1' - (pfCompl? pfCompl[i] : 0);
237  i++;
238  }
239  return pSop;
240 }
#define Abc_SopForEachCube(pSop, nFanins, pCube)
Definition: abc.h:531
char * Abc_SopStart(Mem_Flex_t *pMan, int nCubes, int nVars)
Definition: abcSop.c:76
ABC_DLL char* Abc_SopCreateXor ( Mem_Flex_t pMan,
int  nVars 
)

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

Synopsis [Creates the multi-input XOR cover.]

Description []

SideEffects []

SeeAlso []

Definition at line 274 of file abcSop.c.

275 {
276  assert( nVars == 2 );
277  return Abc_SopRegister(pMan, "01 1\n10 1\n");
278 }
ABC_NAMESPACE_IMPL_START char * Abc_SopRegister(Mem_Flex_t *pMan, char *pName)
DECLARATIONS ///.
Definition: abcSop.c:56
#define assert(ex)
Definition: util_old.h:213
ABC_DLL char* Abc_SopCreateXorSpecial ( Mem_Flex_t pMan,
int  nVars 
)

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

Synopsis [Creates the multi-input XOR cover (special case).]

Description []

SideEffects []

SeeAlso []

Definition at line 291 of file abcSop.c.

292 {
293  char * pSop;
294  pSop = Abc_SopCreateAnd( pMan, nVars, NULL );
295  pSop[nVars+1] = 'x';
296  assert( pSop[nVars+2] == '\n' );
297  return pSop;
298 }
char * Abc_SopCreateAnd(Mem_Flex_t *pMan, int nVars, int *pfCompl)
Definition: abcSop.c:162
#define assert(ex)
Definition: util_old.h:213
ABC_DLL char* Abc_SopDecoderLog ( Mem_Flex_t pMan,
int  nValues 
)

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

Synopsis [Creates the decover node.]

Description [Produces MV-SOP for BLIF-MV representation.]

SideEffects []

SeeAlso []

Definition at line 1129 of file abcSop.c.

1130 {
1131  char * pResult;
1132  Vec_Str_t * vSop;
1133  int i, b, nBits = Abc_Base2Log(nValues);
1134  assert( nValues > 1 && nValues <= (1<<nBits) );
1135  vSop = Vec_StrAlloc( 100 );
1136  for ( i = 0; i < nValues; i++ )
1137  {
1138  for ( b = 0; b < nBits; b++ )
1139  {
1140  Vec_StrPrintNum( vSop, (int)((i & (1 << b)) > 0) );
1141  Vec_StrPush( vSop, ' ' );
1142  }
1143  Vec_StrPrintNum( vSop, i );
1144  Vec_StrPush( vSop, '\n' );
1145  }
1146  Vec_StrPush( vSop, 0 );
1147  pResult = Abc_SopRegister( pMan, Vec_StrArray(vSop) );
1148  Vec_StrFree( vSop );
1149  return pResult;
1150 }
static char * Vec_StrArray(Vec_Str_t *p)
Definition: vecStr.h:272
static void Vec_StrPrintNum(Vec_Str_t *p, int Num)
Definition: vecStr.h:575
ABC_NAMESPACE_IMPL_START char * Abc_SopRegister(Mem_Flex_t *pMan, char *pName)
DECLARATIONS ///.
Definition: abcSop.c:56
static Vec_Str_t * Vec_StrAlloc(int nCap)
Definition: bblif.c:495
static void Vec_StrPush(Vec_Str_t *p, char Entry)
Definition: vecStr.h:535
static void Vec_StrFree(Vec_Str_t *p)
Definition: bblif.c:616
static int Abc_Base2Log(unsigned n)
Definition: abc_global.h:251
#define assert(ex)
Definition: util_old.h:213
ABC_DLL char* Abc_SopDecoderPos ( Mem_Flex_t pMan,
int  nValues 
)

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

Synopsis [Creates the decoder node.]

Description [Produces MV-SOP for BLIF-MV representation.]

SideEffects []

SeeAlso []

Definition at line 1093 of file abcSop.c.

1094 {
1095  char * pResult;
1096  Vec_Str_t * vSop;
1097  int i, k;
1098  assert( nValues > 1 );
1099  vSop = Vec_StrAlloc( 100 );
1100  for ( i = 0; i < nValues; i++ )
1101  {
1102  for ( k = 0; k < nValues; k++ )
1103  {
1104  if ( k == i )
1105  Vec_StrPrintStr( vSop, "1 " );
1106  else
1107  Vec_StrPrintStr( vSop, "- " );
1108  }
1109  Vec_StrPrintNum( vSop, i );
1110  Vec_StrPush( vSop, '\n' );
1111  }
1112  Vec_StrPush( vSop, 0 );
1113  pResult = Abc_SopRegister( pMan, Vec_StrArray(vSop) );
1114  Vec_StrFree( vSop );
1115  return pResult;
1116 }
static char * Vec_StrArray(Vec_Str_t *p)
Definition: vecStr.h:272
static void Vec_StrPrintNum(Vec_Str_t *p, int Num)
Definition: vecStr.h:575
ABC_NAMESPACE_IMPL_START char * Abc_SopRegister(Mem_Flex_t *pMan, char *pName)
DECLARATIONS ///.
Definition: abcSop.c:56
static Vec_Str_t * Vec_StrAlloc(int nCap)
Definition: bblif.c:495
static void Vec_StrPush(Vec_Str_t *p, char Entry)
Definition: vecStr.h:535
static void Vec_StrFree(Vec_Str_t *p)
Definition: bblif.c:616
#define assert(ex)
Definition: util_old.h:213
static void Vec_StrPrintStr(Vec_Str_t *p, const char *pStr)
Definition: vecStr.h:627
ABC_DLL char* Abc_SopEncoderLog ( Mem_Flex_t pMan,
int  iBit,
int  nValues 
)

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

Synopsis [Creates one encoder node.]

Description [Produces MV-SOP for BLIF-MV representation.]

SideEffects []

SeeAlso []

Definition at line 1049 of file abcSop.c.

1050 {
1051  char * pResult;
1052  Vec_Str_t * vSop;
1053  int v, Counter, fFirst = 1, nBits = Abc_Base2Log(nValues);
1054  assert( iBit < nBits );
1055  // count the number of literals
1056  Counter = 0;
1057  for ( v = 0; v < nValues; v++ )
1058  Counter += ( (v & (1 << iBit)) > 0 );
1059  // create the cover
1060  vSop = Vec_StrAlloc( 100 );
1061  Vec_StrPrintStr( vSop, "d0\n" );
1062  if ( Counter > 1 )
1063  Vec_StrPrintStr( vSop, "(" );
1064  for ( v = 0; v < nValues; v++ )
1065  if ( v & (1 << iBit) )
1066  {
1067  if ( fFirst )
1068  fFirst = 0;
1069  else
1070  Vec_StrPush( vSop, ',' );
1071  Vec_StrPrintNum( vSop, v );
1072  }
1073  if ( Counter > 1 )
1074  Vec_StrPrintStr( vSop, ")" );
1075  Vec_StrPrintStr( vSop, " 1\n" );
1076  Vec_StrPush( vSop, 0 );
1077  pResult = Abc_SopRegister( pMan, Vec_StrArray(vSop) );
1078  Vec_StrFree( vSop );
1079  return pResult;
1080 }
static char * Vec_StrArray(Vec_Str_t *p)
Definition: vecStr.h:272
static void Vec_StrPrintNum(Vec_Str_t *p, int Num)
Definition: vecStr.h:575
ABC_NAMESPACE_IMPL_START char * Abc_SopRegister(Mem_Flex_t *pMan, char *pName)
DECLARATIONS ///.
Definition: abcSop.c:56
static Vec_Str_t * Vec_StrAlloc(int nCap)
Definition: bblif.c:495
static void Vec_StrPush(Vec_Str_t *p, char Entry)
Definition: vecStr.h:535
static void Vec_StrFree(Vec_Str_t *p)
Definition: bblif.c:616
static int Counter
static int Abc_Base2Log(unsigned n)
Definition: abc_global.h:251
#define assert(ex)
Definition: util_old.h:213
static void Vec_StrPrintStr(Vec_Str_t *p, const char *pStr)
Definition: vecStr.h:627
ABC_DLL char* Abc_SopEncoderPos ( Mem_Flex_t pMan,
int  iValue,
int  nValues 
)

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

Synopsis [Creates one encoder node.]

Description [Produces MV-SOP for BLIF-MV representation.]

SideEffects []

SeeAlso []

Definition at line 1030 of file abcSop.c.

1031 {
1032  char Buffer[32];
1033  assert( iValue < nValues );
1034  sprintf( Buffer, "d0\n%d 1\n", iValue );
1035  return Abc_SopRegister( pMan, Buffer );
1036 }
ABC_NAMESPACE_IMPL_START char * Abc_SopRegister(Mem_Flex_t *pMan, char *pName)
DECLARATIONS ///.
Definition: abcSop.c:56
char * sprintf()
#define assert(ex)
Definition: util_old.h:213
ABC_DLL char* Abc_SopFromTruthBin ( char *  pTruth)

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

Synopsis [Derives SOP from the truth table representation.]

Description [Truth table is expected to be in the hexadecimal notation.]

SideEffects []

SeeAlso []

Definition at line 879 of file abcSop.c.

880 {
881  char * pSopCover, * pCube;
882  int nTruthSize, nVars, Digit, Length, Mint, i, b;
883  Vec_Int_t * vMints;
884 
885  // get the number of variables
886  nTruthSize = strlen(pTruth);
887  nVars = Abc_Base2Log( nTruthSize );
888  if ( nTruthSize != (1 << (nVars)) )
889  {
890  printf( "String %s does not look like a truth table of a %d-variable function.\n", pTruth, nVars );
891  return NULL;
892  }
893 
894  // collect the on-set minterms
895  vMints = Vec_IntAlloc( 100 );
896  for ( i = 0; i < nTruthSize; i++ )
897  {
898  if ( pTruth[i] >= '0' && pTruth[i] <= '1' )
899  Digit = pTruth[i] - '0';
900  else
901  {
902  Vec_IntFree( vMints );
903  printf( "String %s does not look like a binary representation of the truth table.\n", pTruth );
904  return NULL;
905  }
906  if ( Digit == 1 )
907  Vec_IntPush( vMints, nTruthSize - 1 - i );
908  }
909  if ( Vec_IntSize( vMints ) == 0 || Vec_IntSize( vMints ) == nTruthSize )
910  {
911  Vec_IntFree( vMints );
912  printf( "Cannot create constant function.\n" );
913  return NULL;
914  }
915 
916  // create the SOP representation of the minterms
917  Length = Vec_IntSize(vMints) * (nVars + 3);
918  pSopCover = ABC_ALLOC( char, Length + 1 );
919  pSopCover[Length] = 0;
920  Vec_IntForEachEntry( vMints, Mint, i )
921  {
922  pCube = pSopCover + i * (nVars + 3);
923  for ( b = 0; b < nVars; b++ )
924  if ( Mint & (1 << (nVars-1-b)) )
925 // if ( Mint & (1 << b) )
926  pCube[b] = '1';
927  else
928  pCube[b] = '0';
929  pCube[nVars + 0] = ' ';
930  pCube[nVars + 1] = '1';
931  pCube[nVars + 2] = '\n';
932  }
933  Vec_IntFree( vMints );
934  return pSopCover;
935 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Abc_Base2Log(unsigned n)
Definition: abc_global.h:251
int strlen()
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
ABC_DLL char* Abc_SopFromTruthHex ( char *  pTruth)

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

Synopsis [Derives SOP from the truth table representation.]

Description [Truth table is expected to be in the hexadecimal notation.]

SideEffects []

SeeAlso []

Definition at line 948 of file abcSop.c.

949 {
950  char * pSopCover, * pCube;
951  int nTruthSize, nVars, Digit, Length, Mint, i, b;
952  Vec_Int_t * vMints;
953 
954  // get the number of variables
955  nTruthSize = strlen(pTruth);
956  nVars = (nTruthSize < 2) ? 2 : Abc_Base2Log(nTruthSize) + 2;
957  if ( nTruthSize != (1 << (nVars-2)) )
958  {
959  printf( "String %s does not look like a truth table of a %d-variable function.\n", pTruth, nVars );
960  return NULL;
961  }
962 
963  // collect the on-set minterms
964  vMints = Vec_IntAlloc( 100 );
965  for ( i = 0; i < nTruthSize; i++ )
966  {
967  if ( pTruth[i] >= '0' && pTruth[i] <= '9' )
968  Digit = pTruth[i] - '0';
969  else if ( pTruth[i] >= 'a' && pTruth[i] <= 'f' )
970  Digit = 10 + pTruth[i] - 'a';
971  else if ( pTruth[i] >= 'A' && pTruth[i] <= 'F' )
972  Digit = 10 + pTruth[i] - 'A';
973  else
974  {
975  printf( "String %s does not look like a hexadecimal representation of the truth table.\n", pTruth );
976  return NULL;
977  }
978  for ( b = 0; b < 4; b++ )
979  if ( Digit & (1 << b) )
980  Vec_IntPush( vMints, 4*(nTruthSize-1-i)+b );
981  }
982 
983  // create the SOP representation of the minterms
984  Length = Vec_IntSize(vMints) * (nVars + 3);
985  pSopCover = ABC_ALLOC( char, Length + 1 );
986  pSopCover[Length] = 0;
987  Vec_IntForEachEntry( vMints, Mint, i )
988  {
989  pCube = pSopCover + i * (nVars + 3);
990  for ( b = 0; b < nVars; b++ )
991 // if ( Mint & (1 << (nVars-1-b)) )
992  if ( Mint & (1 << b) )
993  pCube[b] = '1';
994  else
995  pCube[b] = '0';
996  pCube[nVars + 0] = ' ';
997  pCube[nVars + 1] = '1';
998  pCube[nVars + 2] = '\n';
999  }
1000 /*
1001  // create TT representation
1002  {
1003  extern void Bdc_ManDecomposeTest( unsigned uTruth, int nVars );
1004  unsigned uTruth = 0;
1005  int nVarsAll = 4;
1006  assert( nVarsAll == 4 );
1007  assert( nVars <= nVarsAll );
1008  Vec_IntForEachEntry( vMints, Mint, i )
1009  uTruth |= (1 << Mint);
1010 // uTruth = uTruth | (uTruth << 8) | (uTruth << 16) | (uTruth << 24);
1011  uTruth = uTruth | (uTruth << 16);
1012  Bdc_ManDecomposeTest( uTruth, nVarsAll );
1013  }
1014 */
1015  Vec_IntFree( vMints );
1016  return pSopCover;
1017 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Abc_Base2Log(unsigned n)
Definition: abc_global.h:251
int strlen()
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
ABC_DLL int Abc_SopGetCubeNum ( char *  pSop)

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

Synopsis [Reads the number of cubes in the cover.]

Description []

SideEffects []

SeeAlso []

Definition at line 489 of file abcSop.c.

490 {
491  char * pCur;
492  int nCubes = 0;
493  if ( pSop == NULL )
494  return 0;
495  for ( pCur = pSop; *pCur; pCur++ )
496  nCubes += (*pCur == '\n');
497  return nCubes;
498 }
ABC_DLL int Abc_SopGetIthCareLit ( char *  pSop,
int  i 
)

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

Synopsis [Returns the i-th literal of the cover.]

Description []

SideEffects []

SeeAlso []

Definition at line 578 of file abcSop.c.

579 {
580  char * pCube;
581  int nVars;
582  nVars = Abc_SopGetVarNum( pSop );
583  Abc_SopForEachCube( pSop, nVars, pCube )
584  if ( pCube[i] != '-' )
585  return pCube[i] - '0';
586  return -1;
587 }
#define Abc_SopForEachCube(pSop, nFanins, pCube)
Definition: abc.h:531
int Abc_SopGetVarNum(char *pSop)
Definition: abcSop.c:536
if(last==0)
Definition: sparse_int.h:34
ABC_DLL int Abc_SopGetLitNum ( char *  pSop)

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

Synopsis [Reads the number of SOP literals in the cover.]

Description []

SideEffects []

SeeAlso []

Definition at line 511 of file abcSop.c.

512 {
513  char * pCur;
514  int nLits = 0;
515  if ( pSop == NULL )
516  return 0;
517  for ( pCur = pSop; *pCur; pCur++ )
518  {
519  nLits -= (*pCur == '\n');
520  nLits += (*pCur == '0' || *pCur == '1');
521  }
522  return nLits;
523 }
ABC_DLL int Abc_SopGetPhase ( char *  pSop)

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

Synopsis [Reads the phase of the cover.]

Description []

SideEffects []

SeeAlso []

Definition at line 556 of file abcSop.c.

557 {
558  int nVars = Abc_SopGetVarNum( pSop );
559  if ( pSop[nVars+1] == '0' || pSop[nVars+1] == 'n' )
560  return 0;
561  if ( pSop[nVars+1] == '1' || pSop[nVars+1] == 'x' )
562  return 1;
563  assert( 0 );
564  return -1;
565 }
int Abc_SopGetVarNum(char *pSop)
Definition: abcSop.c:536
#define assert(ex)
Definition: util_old.h:213
ABC_DLL int Abc_SopGetVarNum ( char *  pSop)

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

Synopsis [Reads the number of variables in the cover.]

Description []

SideEffects []

SeeAlso []

Definition at line 536 of file abcSop.c.

537 {
538  char * pCur;
539  for ( pCur = pSop; *pCur != '\n'; pCur++ )
540  if ( *pCur == 0 )
541  return -1;
542  return pCur - pSop - 2;
543 }
ABC_DLL int Abc_SopIsAndType ( char *  pSop)

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

Synopsis [Checks if the cover is AND with possibly complemented inputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 748 of file abcSop.c.

749 {
750  char * pCur;
751  if ( Abc_SopGetCubeNum(pSop) != 1 )
752  return 0;
753  for ( pCur = pSop; *pCur != ' '; pCur++ )
754  if ( *pCur == '-' )
755  return 0;
756  if ( pCur[1] != '1' )
757  return 0;
758  return 1;
759 }
int Abc_SopGetCubeNum(char *pSop)
Definition: abcSop.c:489
ABC_DLL int Abc_SopIsBuf ( char *  pSop)

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

Synopsis [Checks if the cover is constant 1.]

Description []

SideEffects []

SeeAlso []

Definition at line 708 of file abcSop.c.

709 {
710  if ( pSop[4] != 0 )
711  return 0;
712  if ( (pSop[0] == '1' && pSop[2] == '1') || (pSop[0] == '0' && pSop[2] == '0') )
713  return 1;
714  return 0;
715 }
ABC_DLL int Abc_SopIsComplement ( char *  pSop)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 655 of file abcSop.c.

656 {
657  char * pCur;
658  for ( pCur = pSop; *pCur; pCur++ )
659  if ( *pCur == '\n' )
660  return (int)(*(pCur - 1) == '0' || *(pCur - 1) == 'n');
661  assert( 0 );
662  return 0;
663 }
#define assert(ex)
Definition: util_old.h:213
ABC_DLL int Abc_SopIsConst0 ( char *  pSop)

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

Synopsis [Checks if the cover is constant 0.]

Description []

SideEffects []

SeeAlso []

Definition at line 676 of file abcSop.c.

677 {
678  return pSop[0] == ' ' && pSop[1] == '0';
679 }
ABC_DLL int Abc_SopIsConst1 ( char *  pSop)

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

Synopsis [Checks if the cover is constant 1.]

Description []

SideEffects []

SeeAlso []

Definition at line 692 of file abcSop.c.

693 {
694  return pSop[0] == ' ' && pSop[1] == '1';
695 }
ABC_DLL int Abc_SopIsExorType ( char *  pSop)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 802 of file abcSop.c.

803 {
804  char * pCur;
805  for ( pCur = pSop; *pCur; pCur++ )
806  if ( *pCur == '\n' )
807  return (int)(*(pCur - 1) == 'x' || *(pCur - 1) == 'n');
808  assert( 0 );
809  return 0;
810 }
#define assert(ex)
Definition: util_old.h:213
ABC_DLL int Abc_SopIsInv ( char *  pSop)

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

Synopsis [Checks if the cover is constant 1.]

Description []

SideEffects []

SeeAlso []

Definition at line 728 of file abcSop.c.

729 {
730  if ( pSop[4] != 0 )
731  return 0;
732  if ( (pSop[0] == '0' && pSop[2] == '1') || (pSop[0] == '1' && pSop[2] == '0') )
733  return 1;
734  return 0;
735 }
ABC_DLL int Abc_SopIsOrType ( char *  pSop)

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

Synopsis [Checks if the cover is OR with possibly complemented inputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 772 of file abcSop.c.

773 {
774  char * pCube, * pCur;
775  int nVars, nLits;
776  nVars = Abc_SopGetVarNum( pSop );
777  if ( nVars != Abc_SopGetCubeNum(pSop) )
778  return 0;
779  Abc_SopForEachCube( pSop, nVars, pCube )
780  {
781  // count the number of literals in the cube
782  nLits = 0;
783  for ( pCur = pCube; *pCur != ' '; pCur++ )
784  nLits += ( *pCur != '-' );
785  if ( nLits != 1 )
786  return 0;
787  }
788  return 1;
789 }
#define Abc_SopForEachCube(pSop, nFanins, pCube)
Definition: abc.h:531
int Abc_SopGetVarNum(char *pSop)
Definition: abcSop.c:536
int Abc_SopGetCubeNum(char *pSop)
Definition: abcSop.c:489
ABC_DLL char* Abc_SopRegister ( Mem_Flex_t pMan,
char *  pName 
)

DECLARATIONS ///.

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

FileName [abcSop.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Network and node package.]

Synopsis [Implementation of a simple SOP representation of nodes.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Registers the cube string with the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 56 of file abcSop.c.

57 {
58  char * pRegName;
59  if ( pName == NULL ) return NULL;
60  pRegName = Mem_FlexEntryFetch( pMan, strlen(pName) + 1 );
61  strcpy( pRegName, pName );
62  return pRegName;
63 }
char * Mem_FlexEntryFetch(Mem_Flex_t *p, int nBytes)
Definition: mem.c:372
char * strcpy()
int strlen()
ABC_DLL char* Abc_SopStart ( Mem_Flex_t pMan,
int  nCubes,
int  nVars 
)

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

Synopsis [Creates the constant 1 cover with the given number of variables and cubes.]

Description []

SideEffects []

SeeAlso []

Definition at line 76 of file abcSop.c.

77 {
78  char * pSopCover, * pCube;
79  int i, Length;
80 
81  Length = nCubes * (nVars + 3);
82  pSopCover = Mem_FlexEntryFetch( pMan, Length + 1 );
83  memset( pSopCover, '-', Length );
84  pSopCover[Length] = 0;
85 
86  for ( i = 0; i < nCubes; i++ )
87  {
88  pCube = pSopCover + i * (nVars + 3);
89  pCube[nVars + 0] = ' ';
90  pCube[nVars + 1] = '1';
91  pCube[nVars + 2] = '\n';
92  }
93  return pSopCover;
94 }
char * memset()
char * Mem_FlexEntryFetch(Mem_Flex_t *p, int nBytes)
Definition: mem.c:372
ABC_DLL word Abc_SopToTruth ( char *  pSop,
int  nInputs 
)

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

Synopsis [Computes truth table of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 1163 of file abcSop.c.

1164 {
1165  static word Truth[8] = {
1166  ABC_CONST(0xAAAAAAAAAAAAAAAA),
1167  ABC_CONST(0xCCCCCCCCCCCCCCCC),
1168  ABC_CONST(0xF0F0F0F0F0F0F0F0),
1169  ABC_CONST(0xFF00FF00FF00FF00),
1170  ABC_CONST(0xFFFF0000FFFF0000),
1171  ABC_CONST(0xFFFFFFFF00000000),
1172  ABC_CONST(0x0000000000000000),
1173  ABC_CONST(0xFFFFFFFFFFFFFFFF)
1174  };
1175  word Cube, Result = 0;
1176  int v, lit = 0;
1177  int nVars = Abc_SopGetVarNum(pSop);
1178  assert( nVars >= 0 && nVars <= 6 );
1179  assert( nVars == nInputs );
1180  do {
1181  Cube = Truth[7];
1182  for ( v = 0; v < nVars; v++, lit++ )
1183  {
1184  if ( pSop[lit] == '1' )
1185  Cube &= Truth[v];
1186  else if ( pSop[lit] == '0' )
1187  Cube &= ~Truth[v];
1188  else if ( pSop[lit] != '-' )
1189  assert( 0 );
1190  }
1191  Result |= Cube;
1192  assert( pSop[lit] == ' ' );
1193  lit++;
1194  lit++;
1195  assert( pSop[lit] == '\n' );
1196  lit++;
1197  } while ( pSop[lit] );
1198  if ( Abc_SopIsComplement(pSop) )
1199  Result = ~Result;
1200  return Result;
1201 }
int lit
Definition: satVec.h:130
int Abc_SopGetVarNum(char *pSop)
Definition: abcSop.c:536
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
int Abc_SopIsComplement(char *pSop)
Definition: abcSop.c:655
static ABC_NAMESPACE_IMPL_START word Truth[8]
DECLARATIONS ///.
Definition: giaShrink6.c:32
#define ABC_CONST(number)
PARAMETERS ///.
Definition: abc_global.h:206
#define assert(ex)
Definition: util_old.h:213
ABC_DLL void Abc_SopToTruth7 ( char *  pSop,
int  nInputs,
word  r[2] 
)

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

Synopsis [Computes truth table of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 1214 of file abcSop.c.

1215 {
1216  static word Truth[7][2] = {
1217  {ABC_CONST(0xAAAAAAAAAAAAAAAA),ABC_CONST(0xAAAAAAAAAAAAAAAA)},
1218  {ABC_CONST(0xCCCCCCCCCCCCCCCC),ABC_CONST(0xCCCCCCCCCCCCCCCC)},
1219  {ABC_CONST(0xF0F0F0F0F0F0F0F0),ABC_CONST(0xF0F0F0F0F0F0F0F0)},
1220  {ABC_CONST(0xFF00FF00FF00FF00),ABC_CONST(0xFF00FF00FF00FF00)},
1221  {ABC_CONST(0xFFFF0000FFFF0000),ABC_CONST(0xFFFF0000FFFF0000)},
1222  {ABC_CONST(0xFFFFFFFF00000000),ABC_CONST(0xFFFFFFFF00000000)},
1223  {ABC_CONST(0x0000000000000000),ABC_CONST(0xFFFFFFFFFFFFFFFF)},
1224  };
1225  word Cube[2];
1226  int v, lit = 0;
1227  int nVars = Abc_SopGetVarNum(pSop);
1228  assert( nVars >= 0 && nVars <= 7 );
1229  assert( nVars == nInputs );
1230  r[0] = r[1] = 0;
1231  do {
1232  Cube[0] = Cube[1] = ~(word)0;
1233  for ( v = 0; v < nVars; v++, lit++ )
1234  {
1235  if ( pSop[lit] == '1' )
1236  {
1237  Cube[0] &= Truth[v][0];
1238  Cube[1] &= Truth[v][1];
1239  }
1240  else if ( pSop[lit] == '0' )
1241  {
1242  Cube[0] &= ~Truth[v][0];
1243  Cube[1] &= ~Truth[v][1];
1244  }
1245  else if ( pSop[lit] != '-' )
1246  assert( 0 );
1247  }
1248  r[0] |= Cube[0];
1249  r[1] |= Cube[1];
1250  assert( pSop[lit] == ' ' );
1251  lit++;
1252  lit++;
1253  assert( pSop[lit] == '\n' );
1254  lit++;
1255  } while ( pSop[lit] );
1256  if ( Abc_SopIsComplement(pSop) )
1257  {
1258  r[0] = ~r[0];
1259  r[1] = ~r[1];
1260  }
1261 }
int lit
Definition: satVec.h:130
int Abc_SopGetVarNum(char *pSop)
Definition: abcSop.c:536
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
int Abc_SopIsComplement(char *pSop)
Definition: abcSop.c:655
static ABC_NAMESPACE_IMPL_START word Truth[8]
DECLARATIONS ///.
Definition: giaShrink6.c:32
#define ABC_CONST(number)
PARAMETERS ///.
Definition: abc_global.h:206
#define assert(ex)
Definition: util_old.h:213
ABC_DLL void Abc_SopToTruthBig ( char *  pSop,
int  nInputs,
word **  pVars,
word pCube,
word pRes 
)

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

Synopsis [Computes truth table of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 1274 of file abcSop.c.

1275 {
1276  int nVars = Abc_SopGetVarNum(pSop);
1277  int nWords = nVars <= 6 ? 1 : 1 << (nVars-6);
1278  int v, i, lit = 0;
1279  assert( nVars >= 0 && nVars <= 16 );
1280  assert( nVars == nInputs );
1281  for ( i = 0; i < nWords; i++ )
1282  pRes[i] = 0;
1283  do {
1284  for ( i = 0; i < nWords; i++ )
1285  pCube[i] = ~(word)0;
1286  for ( v = 0; v < nVars; v++, lit++ )
1287  {
1288  if ( pSop[lit] == '1' )
1289  {
1290  for ( i = 0; i < nWords; i++ )
1291  pCube[i] &= pVars[v][i];
1292  }
1293  else if ( pSop[lit] == '0' )
1294  {
1295  for ( i = 0; i < nWords; i++ )
1296  pCube[i] &= ~pVars[v][i];
1297  }
1298  else if ( pSop[lit] != '-' )
1299  assert( 0 );
1300  }
1301  for ( i = 0; i < nWords; i++ )
1302  pRes[i] |= pCube[i];
1303  assert( pSop[lit] == ' ' );
1304  lit++;
1305  lit++;
1306  assert( pSop[lit] == '\n' );
1307  lit++;
1308  } while ( pSop[lit] );
1309  if ( Abc_SopIsComplement(pSop) )
1310  {
1311  for ( i = 0; i < nWords; i++ )
1312  pRes[i] = ~pRes[i];
1313  }
1314 }
int nWords
Definition: abcNpn.c:127
int lit
Definition: satVec.h:130
int Abc_SopGetVarNum(char *pSop)
Definition: abcSop.c:536
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
int Abc_SopIsComplement(char *pSop)
Definition: abcSop.c:655
#define assert(ex)
Definition: util_old.h:213
ABC_DLL void Abc_VecObjPushUniqueOrderByLevel ( Vec_Ptr_t p,
Abc_Obj_t pNode 
)

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

Synopsis [Inserts a new node in the order by levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 1228 of file abcUtil.c.

1229 {
1230  Abc_Obj_t * pNode1, * pNode2;
1231  int i;
1232  if ( Vec_PtrPushUnique(p, pNode) )
1233  return;
1234  // find the p of the node
1235  for ( i = p->nSize-1; i > 0; i-- )
1236  {
1237  pNode1 = (Abc_Obj_t *)p->pArray[i ];
1238  pNode2 = (Abc_Obj_t *)p->pArray[i-1];
1239  if ( Abc_ObjRegular(pNode1)->Level <= Abc_ObjRegular(pNode2)->Level )
1240  break;
1241  p->pArray[i ] = pNode2;
1242  p->pArray[i-1] = pNode1;
1243  }
1244 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_PtrPushUnique(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:656
unsigned Level
Definition: abc.h:142
static Abc_Obj_t * Abc_ObjRegular(Abc_Obj_t *p)
Definition: abc.h:323