48 return pSop[0] ==
' ' && pSop[1] ==
'0';
64 return pSop[0] ==
' ' && pSop[1] ==
'1';
82 if ( (pSop[0] ==
'1' && pSop[2] ==
'1') || (pSop[0] ==
'0' && pSop[2] ==
'0') )
102 if ( (pSop[0] ==
'0' && pSop[2] ==
'1') || (pSop[0] ==
'1' && pSop[2] ==
'0') )
121 for ( pCur = pSop; *pCur !=
'\n'; pCur++ )
124 return pCur - pSop - 2;
144 for ( pCur = pSop; *pCur; pCur++ )
145 nCubes += (*pCur ==
'\n');
163 for ( pCur = pSop; *pCur; pCur++ )
165 return (
int)(*(pCur - 1) ==
'0' || *(pCur - 1) ==
'n');
184 for ( pCur = pSop; *pCur; pCur++ )
187 if ( *(pCur - 1) ==
'0' )
189 else if ( *(pCur - 1) ==
'1' )
191 else if ( *(pCur - 1) ==
'x' )
193 else if ( *(pCur - 1) ==
'n' )
214 char * pSopCover, * pCube;
217 Length = nCubes * (nVars + 3);
219 memset( pSopCover,
'-', Length );
220 pSopCover[Length] = 0;
222 for ( i = 0; i < nCubes; i++ )
224 pCube = pSopCover + i * (nVars + 3);
225 pCube[nVars + 0] =
' ';
226 pCube[nVars + 1] =
'1';
227 pCube[nVars + 2] =
'\n';
246 char * pSop, * pCube;
247 int i, k, Entry, Literal;
256 pCube = pSop + i * (nVars + 3);
257 for ( k = 0; k < nVars; k++ )
259 Literal = 3 & (Entry >> (k << 1));
262 else if ( Literal == 2 )
264 else if ( Literal != 0 )
290 for ( pCube = pSop; *pCube; pCube += nVars + 3 )
293 for ( k = nVars - 1; k >= 0; k-- )
294 if ( pCube[k] ==
'0' )
295 Entry = (Entry << 2) | 1;
296 else if ( pCube[k] ==
'1' )
297 Entry = (Entry << 2) | 2;
298 else if ( pCube[k] ==
'-' )
299 Entry = (Entry << 2);
347 assert( RetValue == 0 || RetValue == 1 );
368 int i, k, Entry, Literal;
375 for ( k = 0; k < nVars; k++ )
377 Literal = 3 & (Entry >> (k << 1));
380 else if ( Literal == 2 )
382 else if ( Literal == 0 )
411 assert( RetValue == 0 || RetValue == 1 );
426 else if ( nVars == 6 )
444 static ABC_UINT64_T
Truth[8] = {
454 ABC_UINT64_T valueAnd, valueOr = Truth[6];
459 for ( v = 0; v < nVars; v++, lit++ )
461 if ( pSop[lit] ==
'1' )
462 valueAnd &= Truth[v];
463 else if ( pSop[lit] ==
'0' )
464 valueAnd &= ~Truth[v];
465 else if ( pSop[lit] !=
'-' )
469 assert( pSop[lit] ==
' ' );
472 assert( pSop[lit] ==
'\n' );
474 }
while ( pSop[lit] );
498 int v, c, nCubes, fCompl = 0;
501 if (
strlen(pSop) % (nVars + 3) != 0 )
503 printf(
"Kit_PlaToTruth(): SOP is represented incorrectly.\n" );
508 nCubes =
strlen(pSop) / (nVars + 3);
509 for ( c = 0; c < nCubes; c++ )
511 fCompl = (pSop[nVars+1] ==
'0');
514 for ( v = 0; v < nVars; v++ )
515 if ( pSop[v] ==
'1' )
517 else if ( pSop[v] ==
'0' )
char * Kit_PlaStart(void *p, int nCubes, int nVars)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
static void Kit_TruthFill(unsigned *pOut, int nVars)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
char * Kit_PlaStoreSop(void *p, char *pSop)
static char * Vec_StrArray(Vec_Str_t *p)
int Kit_PlaGetVarNum(char *pSop)
int Kit_PlaIsComplement(char *pSop)
char * Aig_MmFlexEntryFetch(Aig_MmFlex_t *p, int nBytes)
static void Vec_StrClear(Vec_Str_t *p)
int Kit_PlaIsInv(char *pSop)
static int Kit_TruthIsConst0(unsigned *pIn, int nVars)
int Kit_PlaIsBuf(char *pSop)
static void Vec_StrPush(Vec_Str_t *p, char Entry)
char * Kit_PlaFromTruthNew(unsigned *pTruth, int nVars, Vec_Int_t *vCover, Vec_Str_t *vStr)
static void Kit_TruthAnd(unsigned *pOut, unsigned *pIn0, unsigned *pIn1, int nVars)
char * Kit_PlaFromIsop(Vec_Str_t *vStr, int nVars, Vec_Int_t *vCover)
static int Kit_TruthIsConst1(unsigned *pIn, int nVars)
static void Vec_StrAppend(Vec_Str_t *p, const char *pString)
int Kit_TruthIsop(unsigned *puTruth, int nVars, Vec_Int_t *vMemory, int fTryBoth)
FUNCTION DEFINITIONS ///.
int Kit_PlaIsConst1(char *pSop)
static int Vec_IntEntry(Vec_Int_t *p, int i)
#define ABC_NAMESPACE_IMPL_END
ABC_UINT64_T Kit_PlaToTruth6(char *pSop, int nVars)
static void Vec_IntPush(Vec_Int_t *p, int Entry)
static void Kit_TruthNot(unsigned *pOut, unsigned *pIn, int nVars)
#define ABC_NAMESPACE_IMPL_START
static void Kit_TruthSharp(unsigned *pOut, unsigned *pIn0, unsigned *pIn1, int nVars)
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
char * Kit_PlaCreateFromIsop(void *p, int nVars, Vec_Int_t *vCover)
static ABC_NAMESPACE_IMPL_START word Truth[8]
DECLARATIONS ///.
static int Vec_IntSize(Vec_Int_t *p)
void Kit_PlaToTruth(char *pSop, int nVars, Vec_Ptr_t *vVars, unsigned *pTemp, unsigned *pTruth)
#define ABC_CONST(number)
PARAMETERS ///.
int Kit_PlaGetCubeNum(char *pSop)
char * Kit_PlaFromTruth(void *p, unsigned *pTruth, int nVars, Vec_Int_t *vCover)
void Kit_PlaToIsop(char *pSop, Vec_Int_t *vCover)
ABC_NAMESPACE_IMPL_START int Kit_PlaIsConst0(char *pSop)
DECLARATIONS ///.
static void Vec_IntClear(Vec_Int_t *p)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
static void Kit_TruthClear(unsigned *pOut, int nVars)
static void Kit_TruthOr(unsigned *pOut, unsigned *pIn0, unsigned *pIn1, int nVars)
void Kit_PlaComplement(char *pSop)