33 #define ABC_MUX_CUBES 100000
58 DdNode * bSum, * bCube, * bTemp, * bVar;
67 for ( v = 0; v < nVars; v++ )
83 else if ( Value ==
'1' )
118 int nFaninsMax, i, k, iVar;
124 if ( nFaninsMax == 0 )
125 printf(
"Warning: The network has only constant nodes.\n" );
129 if ( nFaninsMax > 10 )
147 printf(
"Abc_NtkSopToBdd: Error while converting SOP into BDD.\n" );
153 for ( k = iVar = 0; k < nFaninsMax; k++ )
163 for ( k = 0; k < nFaninsMax; k++ )
172 if ( pNode->
pData == NULL )
174 printf(
"Abc_NtkSopToBdd: Error while converting SOP into BDD.\n" );
213 DdNode * bFuncNew, * bCover, * zCover, * zCover0, * zCover1;
214 int nCubes, nCubes0, nCubes1, fPhase;
237 assert( fAllPrimes == 0 );
247 bCover =
Cudd_zddIsop( dd, bFuncOn, bFuncOnDc, &zCover1 );
254 if ( nCubes1 <= nCubes0 )
269 else if ( fMode == 0 )
287 else if ( fMode == 1 )
297 bCover =
Cudd_zddIsop( dd, bFuncOn, bFuncOnDc, &zCover );
313 printf(
"The number of cubes exceeded the predefined limit (%d).\n",
ABC_MUX_CUBES );
321 pSop =
ABC_ALLOC(
char, (nFanins + 3) * nCubes + 1 );
322 pSop[(nFanins + 3) * nCubes] = 0;
333 if ( bFuncOn == bFuncOnDc )
335 if ( bFuncNew != bFuncOn )
336 printf(
"Verification failed.\n" );
341 printf(
"Verification failed.\n" );
389 if ( pNode->
pNext == NULL )
436 DdNode * zC0, * zC1, * zC2;
439 if ( zCover == dd->
zero )
441 if ( zCover == dd->
one )
444 pCube = pSop + (*pnCubes) * (nFanins + 3);
449 Index = zCover->
index/2;
450 assert( Index < nFanins );
452 vCube->
pArray[Index] =
'0';
454 vCube->
pArray[Index] =
'1';
456 vCube->
pArray[Index] =
'-';
515 int nFaninsMax, fFound, i;
532 if ( nFaninsMax == 0 )
533 printf(
"Warning: The network has only constant nodes.\n" );
566 DdNode * zC0, * zC1, * zC2;
567 if ( zCover == dd->
zero )
569 if ( zCover == dd->
one )
633 if ( pNode->
pData == NULL )
636 printf(
"Abc_NtkSopToAig: Error while converting SOP into AIG.\n" );
663 int i, Value, nFanins;
670 for ( i = 0; i < nFanins; i++ )
685 else if ( Value ==
'0' )
689 pSum =
Hop_Or( pMan, pSum, pAnd );
740 int nFaninsMax, i, k, iVar;
746 if ( nFaninsMax == 0 )
747 printf(
"Warning: The network has only constant nodes.\n" );
759 for ( i = 0; i < nFaninsMax; i++ )
770 printf(
"Abc_NtkAigToBdd: Error while converting AIG into BDD.\n" );
776 for ( k = iVar = 0; k < nFaninsMax; k++ )
786 for ( k = 0; k < nFaninsMax; k++ )
static int * Vec_IntArray(Vec_Int_t *p)
static Hop_Obj_t * Hop_ObjFanin1(Hop_Obj_t *pObj)
static int Hop_ObjIsMarkA(Hop_Obj_t *pObj)
void Cudd_RecursiveDerefZdd(DdManager *table, DdNode *n)
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
int Abc_CountZddCubes(DdManager *dd, DdNode *zCover)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
static void Hop_ObjSetMarkA(Hop_Obj_t *pObj)
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
#define CUDD_UNIQUE_SLOTS
ABC_DLL void * Abc_FrameReadLibGen()
Hop_Obj_t * Hop_Or(Hop_Man_t *p, Hop_Obj_t *p0, Hop_Obj_t *p1)
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
void Abc_ConvertAigToBdd_rec2(DdManager *dd, Hop_Obj_t *pObj)
static Hop_Obj_t * Hop_ManConst1(Hop_Man_t *p)
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Hop_Obj_t * Hop_And(Hop_Man_t *p, Hop_Obj_t *p0, Hop_Obj_t *p1)
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
int Hop_DagSize(Hop_Obj_t *pObj)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
void Cudd_Deref(DdNode *node)
#define Abc_SopForEachCube(pSop, nFanins, pCube)
static int Hop_ObjIsNode(Hop_Obj_t *pObj)
#define Cudd_IsConstant(node)
DdNode * Cudd_ReadLogicZero(DdManager *dd)
ABC_DLL int Abc_SopGetCubeNum(char *pSop)
static int Gia_ManAppendCi(Gia_Man_t *p)
int Abc_NtkBddToSop(Abc_Ntk_t *pNtk, int fDirect)
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
static int Abc_ObjIsBarBuf(Abc_Obj_t *pObj)
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
ABC_DLL int Abc_NtkGetFaninMax(Abc_Ntk_t *pNtk)
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
static int Hop_ObjChild0CopyI(Hop_Obj_t *pObj)
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
#define ABC_ALLOC(type, num)
#define Abc_NtkForEachCo(pNtk, pCo, i)
Gia_Man_t * Abc_NtkAigToGia(Abc_Ntk_t *p)
void Abc_CountZddCubes_rec(DdManager *dd, DdNode *zCover, int *pnCubes)
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
int Abc_NtkToAig(Abc_Ntk_t *pNtk)
static Vec_Str_t * Vec_StrAlloc(int nCap)
#define Abc_CubeForEachVar(pCube, Value, i)
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
ABC_DLL int Abc_SopIsExorType(char *pSop)
static void Vec_StrPush(Vec_Str_t *p, char Entry)
static int Abc_NtkIsAigLogic(Abc_Ntk_t *pNtk)
static Hop_Obj_t * Hop_Not(Hop_Obj_t *p)
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
static int Abc_LitNotCond(int Lit, int c)
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
int Abc_NtkToSop(Abc_Ntk_t *pNtk, int fDirect)
void Hop_ConeUnmark_rec(Hop_Obj_t *pObj)
char * Mem_FlexEntryFetch(Mem_Flex_t *p, int nBytes)
Hop_Obj_t * Hop_Exor(Hop_Man_t *p, Hop_Obj_t *p0, Hop_Obj_t *p1)
void Abc_ConvertAigToGia_rec2(Hop_Obj_t *pObj)
int Abc_NtkAigToBdd(Abc_Ntk_t *pNtk)
void Hop_ManStop(Hop_Man_t *p)
int Abc_ConvertAigToGia(Gia_Man_t *p, Hop_Obj_t *pRoot)
static Hop_Obj_t * Hop_ManPi(Hop_Man_t *p, int i)
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Mem_Flex_t * Mem_FlexStart()
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
static Vec_Int_t * Vec_IntStart(int nSize)
ABC_DLL char * Abc_SopRegister(Mem_Flex_t *pMan, char *pName)
DECLARATIONS ///.
Hop_Obj_t * Abc_ConvertSopToAigInternal(Hop_Man_t *pMan, char *pSop)
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
char * Abc_ConvertBddToSop(Mem_Flex_t *pMan, DdManager *dd, DdNode *bFuncOn, DdNode *bFuncOnDc, int nFanins, int fAllPrimes, Vec_Str_t *vCube, int fMode)
static void Vec_StrFree(Vec_Str_t *p)
static Hop_Obj_t * Hop_ObjChild1Copy(Hop_Obj_t *pObj)
Hop_Obj_t * Dec_GraphFactorSop(Hop_Man_t *pMan, char *pSop)
static int Gia_ManAppendBuf(Gia_Man_t *p, int iLit)
static int Vec_IntEntry(Vec_Int_t *p, int i)
static void Vec_StrFill(Vec_Str_t *p, int nSize, char Fill)
#define ABC_NAMESPACE_IMPL_END
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
DdManager * Cudd_Init(unsigned int numVars, unsigned int numVarsZ, unsigned int numSlots, unsigned int cacheSize, unsigned long maxMemory)
void Abc_NtkLogicMakeDirectSops(Abc_Ntk_t *pNtk)
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Hop_Man_t * Hop_ManStart()
DECLARATIONS ///.
void Abc_ConvertAigToAig_rec(Abc_Ntk_t *pNtkAig, Hop_Obj_t *pObj)
ABC_DLL void Abc_NtkCleanNext(Abc_Ntk_t *pNtk)
static int Hop_IsComplement(Hop_Obj_t *p)
DdNode * Cudd_zddIsop(DdManager *dd, DdNode *L, DdNode *U, DdNode **zdd_I)
static Hop_Obj_t * Hop_ObjChild0Copy(Hop_Obj_t *pObj)
static void Vec_IntPush(Vec_Int_t *p, int Entry)
ABC_DLL int Abc_SopIsConst0(char *pSop)
int Abc_NtkMapToSop(Abc_Ntk_t *pNtk)
static void Vec_IntFreeP(Vec_Int_t **p)
static void Hop_ObjClearMarkA(Hop_Obj_t *pObj)
DdNode * Cudd_bddOr(DdManager *dd, DdNode *f, DdNode *g)
void Abc_ConvertAigToBdd_rec1(DdManager *dd, Hop_Obj_t *pObj)
static Hop_Obj_t * Hop_ObjFanin0(Hop_Obj_t *pObj)
void Abc_ConvertAigToGia_rec1(Gia_Man_t *p, Hop_Obj_t *pObj)
static int Hop_ObjIsConst1(Hop_Obj_t *pObj)
void Abc_NtkSortSops(Abc_Ntk_t *pNtk)
#define Abc_NtkForEachNode(pNtk, pNode, i)
void Mem_FlexStop(Mem_Flex_t *p, int fVerbose)
#define ABC_NAMESPACE_IMPL_START
static int Gia_ManAppendAnd2(Gia_Man_t *p, int iLit0, int iLit1)
DdNode * Cudd_ReadOne(DdManager *dd)
int Cudd_bddLeq(DdManager *dd, DdNode *f, DdNode *g)
static int Hop_ObjChild1CopyI(Hop_Obj_t *pObj)
static Hop_Obj_t * Abc_ConvertSopToAig(Hop_Man_t *pMan, char *pSop)
static int Vec_IntSize(Vec_Int_t *p)
static char * Abc_NtkName(Abc_Ntk_t *pNtk)
#define Abc_NtkForEachCi(pNtk, pCi, i)
#define Abc_ObjForEachFanin(pObj, pFanin, i)
int Abc_ConvertZddToSop(DdManager *dd, DdNode *zCover, char *pSop, int nFanins, Vec_Str_t *vCube, int fPhase)
DECLARATIONS ///.
static Hop_Obj_t * Hop_NotCond(Hop_Obj_t *p, int c)
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
DdNode * Cudd_bddIthVar(DdManager *dd, int i)
DdNode * Cudd_bddXor(DdManager *dd, DdNode *f, DdNode *g)
int Abc_NtkSopToBdd(Abc_Ntk_t *pNtk)
static int Abc_Lit2Var(int Lit)
#define Cudd_NotCond(node, c)
void Abc_NodeBddToCnf(Abc_Obj_t *pNode, Mem_Flex_t *pMmMan, Vec_Str_t *vCube, int fAllPrimes, char **ppSop0, char **ppSop1)
ABC_DLL int Abc_SopGetVarNum(char *pSop)
DdNode * Cudd_bddAnd(DdManager *dd, DdNode *f, DdNode *g)
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
int Cudd_zddVarsFromBddVars(DdManager *dd, int multiplicity)
static Abc_Obj_t * Abc_ObjNotCond(Abc_Obj_t *p, int c)
int Abc_NtkSopToAig(Abc_Ntk_t *pNtk)
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
static Hop_Obj_t * Hop_ManConst0(Hop_Man_t *p)
void Cudd_AutodynEnable(DdManager *unique, Cudd_ReorderingType method)
int Abc_NtkSopToBlifMv(Abc_Ntk_t *pNtk)
static char * Abc_NtkSpec(Abc_Ntk_t *pNtk)
#define ABC_MUX_CUBES
DECLARATIONS ///.
DdNode * Abc_ConvertSopToBdd(DdManager *dd, char *pSop, DdNode **pbVars)
FUNCTION DEFINITIONS ///.
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Abc_Obj_t * Abc_ConvertAigToAig(Abc_Ntk_t *pNtkAig, Abc_Obj_t *pObjOld)
DECLARATIONS ///.
static Hop_Obj_t * Hop_Regular(Hop_Obj_t *p)
void Abc_ConvertZddToSop_rec(DdManager *dd, DdNode *zCover, char *pSop, int nFanins, Vec_Str_t *vCube, int fPhase, int *pnCubes)
static void Vec_IntClear(Vec_Int_t *p)
int Abc_NtkToBdd(Abc_Ntk_t *pNtk)
char * Abc_UtilStrsav(char *s)
ABC_DLL int Abc_SopIsComplement(char *pSop)
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
char * Mio_GateReadSop(Mio_Gate_t *pGate)
Hop_Obj_t * Hop_IthVar(Hop_Man_t *p, int i)
FUNCTION DEFINITIONS ///.
ABC_DLL int Abc_SopGetPhase(char *pSop)
static int Gia_ManObjNum(Gia_Man_t *p)
static DdNode * Abc_ConvertAigToBdd(DdManager *dd, Hop_Obj_t *pRoot)
static void Vec_PtrFree(Vec_Ptr_t *p)
static int Hop_ManPiNum(Hop_Man_t *p)