48static inline void Io_ReadPlaPrintCube(
word *
p,
int nVars )
50 char Symbs[3] = {
'-',
'0',
'1'};
int v;
51 for ( v = 0; v < nVars; v++ )
52 printf(
"%c", Symbs[Abc_TtGetQua(
p, v)] );
69 word Test;
int c, fFound = 0;
70 for ( c = 0; c <
nWords; c++ )
78 Test = ((
p[c] ^ q[c]) | ((
p[c] ^ q[c]) >> 1)) &
ABC_CONST(0x5555555555555555);
79 if ( !Abc_TtOnlyOneOne(Test) )
85static inline int Io_ReadPlaConsensus(
word *
p,
word * q,
int nWords,
int * piVar )
87 word Test;
int c, fFound = 0;
88 for ( c = 0; c <
nWords; c++ )
95 Test = ((
p[c] ^ q[c]) & ((
p[c] ^ q[c]) >> 1)) &
ABC_CONST(0x5555555555555555);
96 if ( !Abc_TtOnlyOneOne(Test) )
99 *piVar = c * 32 + Abc_Tt6FirstBit(Test)/2;
119 Vec_BitFill( vMarks, nCubes, 0 );
120 for ( c1 = 0; c1 < nCubes; c1++ )
121 if ( !Vec_BitEntry(vMarks, c1) )
122 for ( c2 = c1 + 1; c2 < nCubes; c2++ )
123 if ( !Vec_BitEntry(vMarks, c2) )
124 if ( Abc_TtEqual(pCs[c1], pCs[c2],
nWords) )
125 Vec_BitWriteEntry( vMarks, c2, 1 );
130 Vec_BitFill( vMarks, nCubes, 0 );
131 for ( c1 = 0; c1 < nCubes; c1++ )
132 if ( !Vec_BitEntry(vMarks, c1) )
133 for ( c2 = c1 + 1; c2 < nCubes; c2++ )
134 if ( !Vec_BitEntry(vMarks, c2) )
136 if ( Abc_TtImply(pCs[c1], pCs[c2],
nWords) )
137 Vec_BitWriteEntry( vMarks, c2, 1 );
138 else if ( Abc_TtImply(pCs[c2], pCs[c1],
nWords) )
140 Vec_BitWriteEntry( vMarks, c1, 1 );
148 for ( c1 = c = 0; c1 < nCubes; c1++ )
149 if ( !Vec_BitEntry(vMarks, c1) )
154 Abc_TtCopy( pCs[c++], pCs[c1],
nWords, 0 );
160 int c1, c2, Res, Counter = 0;
161 Vec_BitFill( vMarks, nCubes, 0 );
162 for ( c1 = 0; c1 < nCubes; c1++ )
163 if ( !Vec_BitEntry(vMarks, c1) )
164 for ( c2 = c1 + 1; c2 < nCubes; c2++ )
165 if ( !Vec_BitEntry(vMarks, c2) )
167 Res = Io_ReadPlaDistance1( pCs[c1], pCs[c2],
nWords );
170 Abc_TtAnd( pCs[c1], pCs[c1], pCs[c2],
nWords, 0 );
171 Vec_BitWriteEntry( vMarks, c2, 1 );
179 int c1, c2, Res, Counter = 0, iVar = -1, Val0, Val1;
180 Vec_BitFill( vMarks, nCubes, 0 );
181 for ( c1 = 0; c1 < nCubes; c1++ )
182 if ( !Vec_BitEntry(vMarks, c1) )
183 for ( c2 = c1 + 1; c2 < nCubes; c2++ )
184 if ( !Vec_BitEntry(vMarks, c2) )
186 Res = Io_ReadPlaConsensus( pCs[c1], pCs[c2],
nWords, &iVar );
190 Val0 = Abc_TtGetQua( pCs[c1], iVar );
191 Val1 = Abc_TtGetQua( pCs[c2], iVar );
193 Abc_TtXorQua( pCs[c1], iVar, Val0 );
194 Abc_TtXorQua( pCs[c2], iVar, Val1 );
196 if ( Abc_TtImply(pCs[c1], pCs[c2],
nWords) )
198 Abc_TtXorQua( pCs[c1], iVar, Val0 );
199 Vec_BitWriteEntry( vMarks, c2, 1 );
202 else if ( Abc_TtImply(pCs[c2], pCs[c1],
nWords) )
204 Abc_TtXorQua( pCs[c2], iVar, Val1 );
205 Vec_BitWriteEntry( vMarks, c1, 1 );
211 Abc_TtXorQua( pCs[c1], iVar, Val0 );
212 Abc_TtXorQua( pCs[c2], iVar, Val1 );
242 char * pSop = Vec_StrArray( vSop ), * pCube, Lit;
245 int nWords = Abc_Bit6WordNum( 2*nVars ), c, v;
248 for ( c = 1; c < nCubes; c++ )
249 pCs[c] = pCs[c-1] +
nWords;
255 Abc_TtSetBit( pCs[c], Abc_Var2Lit(v,0) );
256 else if ( Lit ==
'1' )
257 Abc_TtSetBit( pCs[c], Abc_Var2Lit(v,1) );
265 char Symbs[3] = {
'-',
'0',
'1'};
int c, v;
266 Vec_StrClear( vSop );
267 for ( c = 0; c < nCubes; c++ )
269 for ( v = 0; v < nVars; v++ )
270 Vec_StrPush( vSop, Symbs[Abc_TtGetQua(pCs[c], v)] );
271 Vec_StrPrintStr( vSop,
" 1\n" );
273 Vec_StrPush( vSop, 0 );
280 int nWords = Abc_Bit6WordNum( 2*nVars );
281 int nCubesNew, Count, Iter = 0;
282 Vec_Bit_t * vMarks = Vec_BitStart( nCubes );
284 printf(
"Cover %5d : V =%5d C%d =%5d", iCover, nVars, Iter, nCubes );
301 printf(
" C%d =%5d", Iter, nCubes );
305 printf(
"%4d", Count );
313 Vec_BitFree( vMarks );
341 pNtk = Io_ReadPlaNetwork(
p, fZeros, fBoth, fOnDc, fSkipPrepro );
349 printf(
"Io_ReadPla: The network check has failed.\n" );
374 int nInputs = -1, nOutputs = -1, nProducts = -1;
375 char * pCubeIn, * pCubeOut;
376 int i, k, iLine, nCubes;
377 unsigned char nDigits;
391 if (
strncmp( (
char *)vTokens->pArray[0],
".e", 2 ) == 0 )
395 if (
strncmp( (
char *)vTokens->pArray[0],
".type", 5 ) == 0 )
399 if (
strcmp( (
char *)vTokens->pArray[0],
".model" ) == 0 )
406 if ( vTokens->nSize == 1 )
408 printf(
"%s (line %d): Wrong number of token.\n",
416 if (
strcmp( (
char *)vTokens->pArray[0],
".i" ) == 0 )
417 nInputs = atoi((
char *)vTokens->pArray[1]);
418 else if (
strcmp( (
char *)vTokens->pArray[0],
".o" ) == 0 )
419 nOutputs = atoi((
char *)vTokens->pArray[1]);
420 else if (
strcmp( (
char *)vTokens->pArray[0],
".p" ) == 0 )
421 nProducts = atoi((
char *)vTokens->pArray[1]);
422 else if (
strcmp( (
char *)vTokens->pArray[0],
".ilb" ) == 0 )
424 if ( vTokens->nSize - 1 != nInputs )
425 printf(
"Warning: Mismatch between the number of PIs on the .i line (%d) and the number of PIs on the .ilb line (%d).\n", nInputs, vTokens->nSize - 1 );
426 for ( i = 1; i < vTokens->nSize; i++ )
429 else if (
strcmp( (
char *)vTokens->pArray[0],
".ob" ) == 0 )
431 if ( vTokens->nSize - 1 != nOutputs )
432 printf(
"Warning: Mismatch between the number of POs on the .o line (%d) and the number of POs on the .ob line (%d).\n", nOutputs, vTokens->nSize - 1 );
433 for ( i = 1; i < vTokens->nSize; i++ )
439 if ( Abc_NtkPiNum(pNtk) == 0 )
449 nDigits = (
unsigned char)Abc_Base10Log( nInputs );
450 for ( i = 0; i < nInputs; i++ )
452 sprintf( Buffer,
"x%0*d", nDigits, i );
456 if ( Abc_NtkPoNum(pNtk) == 0 )
458 if ( nOutputs == -1 )
466 nDigits = (
unsigned char)Abc_Base10Log( nOutputs );
467 for ( i = 0; i < nOutputs; i++ )
469 sprintf( Buffer,
"z%0*d", nDigits, i );
473 if ( Abc_NtkNodeNum(pNtk) == 0 )
480 ppSops[i] = Vec_StrAlloc( 100 );
482 pNode = Abc_NtkCreateNode(pNtk);
491 if ( vTokens->nSize != 2 )
493 printf(
"%s (line %d): Input and output cubes are not specified.\n",
500 pCubeIn = (
char *)vTokens->pArray[0];
501 pCubeOut = (
char *)vTokens->pArray[1];
502 if ( (
int)
strlen(pCubeIn) != nInputs )
504 printf(
"%s (line %d): Input cube length (%d) differs from the number of inputs (%d).\n",
510 if ( (
int)
strlen(pCubeOut) != nOutputs )
512 printf(
"%s (line %d): Output cube length (%d) differs from the number of outputs (%d).\n",
521 for ( i = 0; i < nOutputs; i++ )
523 if ( pCubeOut[i] ==
'0' )
525 Vec_StrPrintStr( ppSops[i], pCubeIn );
526 Vec_StrPrintStr( ppSops[i],
" 1\n" );
532 for ( i = 0; i < nOutputs; i++ )
534 if ( pCubeOut[i] ==
'0' || pCubeOut[i] ==
'1' )
536 Vec_StrPrintStr( ppSops[i], pCubeIn );
537 Vec_StrPrintStr( ppSops[i],
" 1\n" );
543 for ( i = 0; i < nOutputs; i++ )
545 if ( pCubeOut[i] ==
'-' || pCubeOut[i] ==
'1' )
547 Vec_StrPrintStr( ppSops[i], pCubeIn );
548 Vec_StrPrintStr( ppSops[i],
" 1\n" );
554 for ( i = 0; i < nOutputs; i++ )
556 if ( pCubeOut[i] ==
'1' )
558 Vec_StrPrintStr( ppSops[i], pCubeIn );
559 Vec_StrPrintStr( ppSops[i],
" 1\n" );
567 if ( nProducts != -1 && nCubes != nProducts )
568 printf(
"Warning: Mismatch between the number of cubes (%d) and the number on .p line (%d).\n",
574 pNode = Abc_ObjFanin0Ntk( Abc_ObjFanin0(pTermPo) );
575 if ( ppSops[i]->nSize == 0 )
579 Vec_StrFree( ppSops[i] );
582 Vec_StrPush( ppSops[i], 0 );
586 Vec_StrFree( ppSops[i] );
struct Abc_Obj_t_ Abc_Obj_t
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
#define Abc_NtkForEachPo(pNtk, pPo, i)
ABC_DLL int Abc_NtkCheckRead(Abc_Ntk_t *pNtk)
#define Abc_CubeForEachVar(pCube, Value, i)
ABC_DLL Abc_Ntk_t * Abc_NtkStartRead(char *pName)
struct Abc_Ntk_t_ Abc_Ntk_t
ABC_DLL void Abc_NtkFinalizeRead(Abc_Ntk_t *pNtk)
#define Abc_SopForEachCube(pSop, nFanins, pCube)
#define Abc_NtkForEachPi(pNtk, pPi, i)
ABC_DLL int Abc_SopGetVarNum(char *pSop)
ABC_DLL void Abc_ObjRemoveFanins(Abc_Obj_t *pObj)
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
ABC_DLL int Abc_SopGetCubeNum(char *pSop)
ABC_DLL char * Abc_SopRegister(Mem_Flex_t *pMan, const char *pName)
DECLARATIONS ///.
#define ABC_ALLOC(type, num)
#define ABC_CALLOC(type, num)
#define ABC_CONST(number)
PARAMETERS ///.
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
struct Vec_Str_t_ Vec_Str_t
ABC_NAMESPACE_IMPL_START typedef char ProgressBar
Abc_Obj_t * Io_ReadCreatePo(Abc_Ntk_t *pNtk, char *pName)
Abc_Obj_t * Io_ReadCreatePi(Abc_Ntk_t *pNtk, char *pName)
word ** Io_ReadPlaCubeSetup(Vec_Str_t *vSop)
int Io_ReadPlaRemoveMarked(word **pCs, int nCubes, int nWords, Vec_Bit_t *vMarks)
int Io_ReadPlaSelfSubsumption(word **pCs, int nCubes, int nWords, Vec_Bit_t *vMarks)
void Io_ReadPlaCubeSetdown(Vec_Str_t *vSop, word **pCs, int nCubes, int nVars)
void Io_ReadPlaMarkContained(word **pCs, int nCubes, int nWords, Vec_Bit_t *vMarks)
int Io_ReadPlaMergeDistance1(word **pCs, int nCubes, int nWords, Vec_Bit_t *vMarks)
void Io_ReadPlaMarkIdentical(word **pCs, int nCubes, int nWords, Vec_Bit_t *vMarks)
void Io_ReadPlaCubePreprocess(Vec_Str_t *vSop, int iCover, int fVerbose)
Abc_Ntk_t * Io_ReadPla(char *pFileName, int fZeros, int fBoth, int fOnDc, int fSkipPrepro, int fCheck)
unsigned __int64 word
DECLARATIONS ///.
struct Mem_Flex_t_ Mem_Flex_t
typedefABC_NAMESPACE_HEADER_START struct Vec_Bit_t_ Vec_Bit_t
INCLUDES ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.