102 pVarStruct->nValues = nValues;
103 pVarStruct->pNames = NULL;
120 char * pStr = *ppStr;
122 assert( *pStr >=
'0' && *pStr <=
'9' );
123 for ( ; *pStr >=
'0' && *pStr <=
'9'; pStr++ )
124 Number = 10 * Number + *pStr -
'0';
142 int fAddFreeVars = 1;
144 Abc_Obj_t ** pValues, ** pValuesF, ** pValuesF2;
145 Abc_Obj_t * pTemp, * pTemp2, * pFanin, * pFanin2, * pNet;
146 int k, v, Def, DefIndex, Index, nValues, nValuesF, nValuesF2;
153 for ( k = 0; k < nValues; k++ )
157 pSop = (
char *)pObj->
pData;
166 while ( *pSop++ !=
'\n' );
175 assert( Index < nValues );
178 if ( fAddFreeVars && nValues == 2 && *pSop ==
'-' )
203 else if ( *pSop ==
'-' )
232 printf(
"Abc_NodeStrashBlifMv(): Cannot handle complement in the MV function of node %s.\n",
Abc_ObjName(
Abc_ObjFanout0(pObj)) );
238 printf(
"Abc_NodeStrashBlifMv(): Cannot handle braces in the MV function of node %s.\n",
Abc_ObjName(
Abc_ObjFanout0(pObj)) );
248 while ( *pSop !=
')' )
251 assert( Index < nValuesF );
253 assert( *pSop ==
')' || *pSop ==
',' );
260 else if ( *pSop ==
'=' )
272 assert( nValuesF == nValuesF2 );
274 for ( v = 0; v < nValues; v++ )
280 assert( Index < nValuesF );
281 pTemp2 = pValuesF[Index];
300 assert( nValuesF == nValues );
301 for ( k = 0; k < nValuesF; k++ )
308 assert( Index < nValues );
317 if ( Def >= 0 || DefIndex >= 0 )
320 for ( k = 0; k < nValues; k++ )
329 pValues[Def] = pTemp;
337 assert( nValuesF == nValues );
338 for ( k = 0; k < nValuesF; k++ )
365 sprintf( Suffix,
"[%d]", Index );
382 int fUsePositional = 0;
387 Abc_Obj_t * pObj, * pTemp, * pBit, * pNet;
388 int i, k, v, nValues, nValuesMax, nBits;
389 int nCount1, nCount2;
401 if ( nValuesMax < nValues )
402 nValuesMax = nValues;
418 nCount1 = nCount2 = 0;
421 if ( fUsePositional )
431 for ( v = 0; v < nValues; v++ )
434 if ( nValuesMax == 2 )
452 for ( v = 0; v < nValues; v++ )
455 if ( nValuesMax == 2 )
478 for ( k = 0; k < nBits; k++ )
481 if ( nValuesMax == 2 )
487 for ( v = 0; v < nValues; v++ )
490 for ( k = 0; k < nBits; k++ )
510 for ( k = 0; k < nBits; k++ )
513 if ( nValuesMax == 2 )
520 for ( v = 0; v < nValues; v++ )
523 for ( k = 0; k < nBits; k++ )
546 if ( fUsePositional )
559 for ( v = 0; v < nValues; v++ )
563 if ( nValuesMax == 2 )
580 for ( v = 0; v < nValues; v++ )
584 if ( nValuesMax == 2 )
606 for ( k = 0; k < nBits; k++ )
609 for ( v = 0; v < nValues; v++ )
614 if ( nValuesMax == 2 )
632 for ( k = 0; k < nBits; k++ )
635 for ( v = 0; v < nValues; v++ )
640 if ( nValuesMax == 2 )
664 pNtkNew->
vPis = vTemp;
675 pNtkNew->
vCis = vTemp;
677 assert( nCount1 == nCount2 );
678 for ( i = 0; i < nCount1; i++ )
706 fprintf( stdout,
"Abc_NtkStrashBlifMv(): Network check has failed.\n" );
726 int fUsePositional = 0;
728 Abc_Obj_t * pObj, * pNet, * pNetNew, * pNodeNew, * pTermNew, * pBoxNew;
729 int i, k, v, nValues, nBits;
759 if ( pNet->
pCopy == NULL )
774 if ( pNet->
pCopy == NULL )
781 if ( fUsePositional )
787 for ( v = 0; v < nValues; v++ )
809 for ( k = 0; k < nBits; k++ )
826 if ( fUsePositional )
838 for ( v = 0; v < nValues; v++ )
862 for ( k = 0; k < nBits; k++ )
887 fprintf( stdout,
"Abc_NtkSkeletonBlifMv(): Network check has failed.\n" );
934 pBox->
pData = pNtkLogic;
959 char * pSop0, * pSop1, * pBlifMv, * pCube, * pCur;
960 int Value, nCubes, nSize, i, k;
965 printf(
"Converting logic functions to BDDs has failed.\n" );
1002 assert( pCur - pBlifMv == nSize );
1005 pNode->
pData = pBlifMv;
1030 char * pMvSop, * pCur;
1032 int nCubes, nSize, Value, i, k;
1038 for ( k = 0; k < nVars; k++ )
1040 pMvSop[nVars] =
'0' + (int)(
Vec_IntSize(vSop1) > 0);
1041 pMvSop[nVars+1] =
'\n';
1042 pMvSop[nVars+2] = 0;
1050 nSize = nCubes * (nVars + 2) + 1;
1052 pMvSop = pCur =
ABC_ALLOC(
char, nSize );
1056 for ( k = 0; k < nVars; k++ )
1058 Value = (uCube >> (2*k)) & 3;
1061 else if ( Value == 2 )
1063 else if ( Value == 0 )
1074 for ( k = 0; k < nVars; k++ )
1076 Value = (uCube >> (2*k)) & 3;
1079 else if ( Value == 2 )
1081 else if ( Value == 0 )
1090 assert( pCur - pMvSop == nSize );
1115 while ( *pMvSop ) Counter += (*pMvSop++ ==
'\n');
1141 pVarValues =
ABC_ALLOC(
int, nVars + 1 );
1142 for ( i = 0; i <= nVars; i++ )
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
ABC_DLL Abc_Obj_t * Abc_AigOr(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
int Abc_NtkConvertToBlifMv(Abc_Ntk_t *pNtk)
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
static Abc_Obj_t * Abc_NtkCreateWhitebox(Abc_Ntk_t *pNtk)
Abc_Ntk_t * Abc_NtkSkeletonBlifMv(Abc_Ntk_t *pNtk)
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
#define Abc_SopForEachCube(pSop, nFanins, pCube)
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
ABC_DLL int Abc_SopGetCubeNum(char *pSop)
Abc_Ntk_t * Abc_NtkStrashBlifMv(Abc_Ntk_t *pNtk)
static void * Abc_NtkMvVar(Abc_Ntk_t *pNtk)
int Abc_NodeStrashBlifMv(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj)
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
static void Abc_ObjSetMvVar(Abc_Obj_t *pObj, void *pV)
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
char * Abc_NodeConvertSopToMvSop(int nVars, Vec_Int_t *vSop0, Vec_Int_t *vSop1)
static int Abc_ObjIsPi(Abc_Obj_t *pObj)
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
ABC_DLL Abc_Ntk_t * Abc_NtkFlattenLogicHierarchy(Abc_Ntk_t *pNtk)
void Abc_NtkFreeMvVars(Abc_Ntk_t *pNtk)
#define ABC_ALLOC(type, num)
#define Abc_NtkForEachCo(pNtk, pCo, i)
static int Abc_ObjIsWhitebox(Abc_Obj_t *pObj)
ABC_DLL char * Abc_SopDecoderPos(Mem_Flex_t *pMan, int nValues)
static void * Abc_NtkMvVarMan(Abc_Ntk_t *pNtk)
void Abc_NtkSetMvVarValues(Abc_Obj_t *pObj, int nValues)
static Abc_Obj_t * Abc_NtkCi(Abc_Ntk_t *pNtk, int i)
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
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)
static int Abc_NtkHasBlifMv(Abc_Ntk_t *pNtk)
static int Abc_NtkWhiteboxNum(Abc_Ntk_t *pNtk)
static int Vec_PtrSize(Vec_Ptr_t *p)
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
for(p=first;p->value< newval;p=p->next)
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
char * Mem_FlexEntryFetch(Mem_Flex_t *p, int nBytes)
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
static Abc_Obj_t * Abc_NtkCo(Abc_Ntk_t *pNtk, int i)
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
ABC_DLL Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
ABC_NAMESPACE_IMPL_START void Abc_NtkStartMvVars(Abc_Ntk_t *pNtk)
DECLARATIONS ///.
static Abc_Obj_t * Abc_NtkCreateBo(Abc_Ntk_t *pNtk)
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Mem_Flex_t * Mem_FlexStart()
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
ABC_DLL char * Abc_SopDecoderLog(Mem_Flex_t *pMan, int nValues)
ABC_DLL char * Abc_SopEncoderLog(Mem_Flex_t *pMan, int iBit, int nValues)
static int Abc_StringGetNumber(char **ppStr)
ABC_DLL Abc_Obj_t * Abc_NtkDupBox(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pBox, int fCopyName)
ABC_DLL int Abc_AigCleanup(Abc_Aig_t *pMan)
static void Vec_StrFree(Vec_Str_t *p)
#define ABC_NAMESPACE_IMPL_END
static Abc_Obj_t * Abc_NtkCreateLatch(Abc_Ntk_t *pNtk)
#define Abc_NtkForEachNet(pNtk, pNet, i)
ABC_DLL int Abc_NtkToBdd(Abc_Ntk_t *pNtk)
static void * Abc_ObjMvVar(Abc_Obj_t *pObj)
#define Abc_NtkForEachLatch(pNtk, pObj, i)
static Abc_Obj_t * Abc_NtkCreatePi(Abc_Ntk_t *pNtk)
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
#define Abc_NtkForEachNode(pNtk, pNode, i)
static Abc_Obj_t * Abc_NtkBox(Abc_Ntk_t *pNtk, int i)
void Mem_FlexStop(Mem_Flex_t *p, int fVerbose)
#define ABC_NAMESPACE_IMPL_START
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
static int Vec_IntSize(Vec_Int_t *p)
static void Abc_NtkConvertAssignName(Abc_Obj_t *pObj, Abc_Obj_t *pNet, int Index)
#define Abc_NtkForEachCi(pNtk, pCi, i)
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
#define Abc_ObjForEachFanin(pObj, pFanin, i)
static Vec_Att_t * Vec_AttAlloc(int nSize, void *pMan, void(*pFuncFreeMan)(void *), void *(*pFuncStartObj)(void *), void(*pFuncFreeObj)(void *, void *))
MACRO DEFINITIONS ///.
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
Abc_Ntk_t * Abc_NtkInsertBlifMv(Abc_Ntk_t *pNtkBase, Abc_Ntk_t *pNtkLogic)
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
static int Abc_Base2Log(unsigned n)
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
static Abc_Obj_t * Abc_NtkCreateNode(Abc_Ntk_t *pNtk)
static int Abc_ObjIsNet(Abc_Obj_t *pObj)
static int Abc_ObjMvVarNum(Abc_Obj_t *pObj)
static int Abc_ObjIsPo(Abc_Obj_t *pObj)
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
static Abc_Obj_t * Abc_ObjNotCond(Abc_Obj_t *p, int c)
ABC_DLL void Abc_NodeBddToCnf(Abc_Obj_t *pNode, Mem_Flex_t *pMmMan, Vec_Str_t *vCube, int fAllPrimes, char **ppSop0, char **ppSop1)
static Abc_Obj_t * Abc_ObjNot(Abc_Obj_t *p)
void Cudd_Quit(DdManager *unique)
#define Abc_NtkForEachPo(pNtk, pPo, i)
static int Abc_NtkBlackboxNum(Abc_Ntk_t *pNtk)
static Abc_Obj_t * Abc_NtkCreateBi(Abc_Ntk_t *pNtk)
static Abc_Obj_t * Abc_ObjFanin(Abc_Obj_t *pObj, int i)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
int Abc_NodeEvalMvCostInternal(int nVars, int *pVarValues, char *pMvSop)
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
static int Abc_ObjIsTerm(Abc_Obj_t *pObj)
ABC_DLL char * Abc_SopEncoderPos(Mem_Flex_t *pMan, int iValue, int nValues)
static void Abc_LatchSetInit0(Abc_Obj_t *pLatch)
static Abc_Obj_t * Abc_NtkCreatePo(Abc_Ntk_t *pNtk)
ABC_DLL void * Abc_NtkAttrFree(Abc_Ntk_t *pNtk, int Attr, int fFreeMan)
DECLARATIONS ///.
int Abc_NodeEvalMvCost(int nVars, Vec_Int_t *vSop0, Vec_Int_t *vSop1)
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
#define Abc_NtkForEachPi(pNtk, pPi, i)
static void Abc_NodeSetTravIdCurrent(Abc_Obj_t *p)
static Abc_Obj_t * Abc_NtkCreateNet(Abc_Ntk_t *pNtk)
static void Vec_PtrFree(Vec_Ptr_t *p)