58 pCex->nPis = nRealPis;
59 pCex->nBits = nRegs + nRealPis * nFrames;
69 pCex->nPis = nRealPis;
70 pCex->nBits = nRegs + nRealPis * nFrames;
90 iPo = iFrameOut % nTruePos;
91 iFrame = iFrameOut / nTruePos;
95 pCex->iFrame = iFrame;
116 pCex->iFrame = iFrame;
117 if ( pArray == NULL )
121 for ( i = nRegs; i < pCex->nBits; i++ )
122 if ( pArray[i-nRegs] )
127 for ( i = 0; i < pCex->nBits; i++ )
151 if ( nRegsNew == -1 )
155 pCex->iFrame = p->iFrame;
156 for ( i = p->nRegs; i < p->nBits; i++ )
180 for ( i = 0; i < nPis; i++ )
182 pCex->pData[i>>5] |= (1<<(i & 31));
204 { printf(
"Starting frame is less than 0.\n" );
return NULL; }
206 { printf(
"Stopping frame is less than 0.\n" );
return NULL; }
207 if ( iFrBeg > pCex->iFrame )
208 { printf(
"Starting frame is more than the last frame of CEX (%d).\n", pCex->iFrame );
return NULL; }
209 if ( iFrEnd > pCex->iFrame )
210 { printf(
"Stopping frame is more than the last frame of CEX (%d).\n", pCex->iFrame );
return NULL; }
211 if ( iFrBeg > iFrEnd )
212 { printf(
"Starting frame (%d) should be less than stopping frame (%d).\n", iFrBeg, iFrEnd );
return NULL; }
213 assert( iFrBeg >= 0 && iFrBeg <= pCex->iFrame );
214 assert( iFrEnd >= 0 && iFrEnd <= pCex->iFrame );
215 assert( iFrBeg <= iFrEnd );
217 assert( pCex->nPis == pPart->nPis );
218 assert( iFrEnd - iFrBeg + pPart->iPo >= pPart->iFrame );
220 nFramesGain = iFrEnd - iFrBeg + pPart->iPo - pPart->iFrame;
221 pNew =
Abc_CexAlloc( pCex->nRegs, pCex->nPis, pCex->iFrame + 1 - nFramesGain );
222 pNew->iPo = pCex->iPo;
223 pNew->iFrame = pCex->iFrame - nFramesGain;
225 for ( iBit = 0; iBit < pCex->nRegs; iBit++ )
228 for ( f = 0; f < iFrBeg; f++ )
229 for ( i = 0; i < pCex->nPis; i++, iBit++ )
230 if (
Abc_InfoHasBit(pCex->pData, pCex->nRegs + pCex->nPis * f + i) )
232 for ( f = 0; f < pPart->iFrame; f++ )
233 for ( i = 0; i < pCex->nPis; i++, iBit++ )
234 if (
Abc_InfoHasBit(pPart->pData, pPart->nRegs + pCex->nPis * f + i) )
236 for ( f = iFrEnd; f <= pCex->iFrame; f++ )
237 for ( i = 0; i < pCex->nPis; i++, iBit++ )
238 if (
Abc_InfoHasBit(pCex->pData, pCex->nRegs + pCex->nPis * f + i) )
240 assert( iBit == pNew->nBits );
261 printf(
"The counter example is NULL.\n" );
266 printf(
"The counter example is present but not available (pointer has value \"1\").\n" );
269 for ( k = 0; k < p->nBits; k++ )
271 printf(
"CEX: Po =%4d Frame =%4d FF = %d PI = %d Bit =%8d 1s =%8d (%5.2f %%)\n",
272 p->iPo, p->iFrame, p->nRegs, p->nPis, p->nBits,
273 Counter, 100.0 * Counter / (p->nBits - p->nRegs) );
277 int k,
Counter = 0, Counter2 = 0;
280 printf(
"The counter example is NULL.\n" );
285 printf(
"The counter example is present but not available (pointer has value \"1\").\n" );
288 for ( k = 0; k < p->nBits; k++ )
291 if ( (k - p->nRegs) % p->nPis < nInputs )
294 printf(
"CEX: Po =%4d Frame =%4d FF = %d PI = %d Bit =%8d 1s =%8d (%5.2f %%) 1sIn =%8d (%5.2f %%)\n",
295 p->iPo, p->iFrame, p->nRegs, p->nPis, p->nBits,
296 Counter, 100.0 * Counter / (p->nBits - p->nRegs),
297 Counter2, 100.0 * Counter2 / (p->nBits - p->nRegs - (p->iFrame + 1) * (p->nPis - nInputs)) );
316 printf(
"The counter example is NULL.\n" );
321 printf(
"The counter example is present but not available (pointer has value \"1\").\n" );
325 printf(
"State : " );
326 for ( k = 0; k < p->nRegs; k++ )
329 for ( f = 0; f <= p->iFrame; f++ )
331 printf(
"Frame %3d : ", f );
332 for ( i = 0; i < p->nPis; i++ )
354 if ( *p == (
Abc_Cex_t *)(ABC_PTRINT_T)1 )
393 int nFrames = p->nPis / nPisOld;
394 int nPosNew = nPosOld * nFrames;
395 assert( p->nPis % nPisOld == 0 );
396 assert( p->iPo < nPosNew );
398 pCex->nPis = nPisOld;
400 pCex->iFrame = (p->iFrame + 1) * nFrames - 1;
401 pCex->nBits = p->nBits;
419 int i, k, iBit = nRegsOld, nFrames = p->nPis / nPisOld - 1;
421 assert( p->nPis % nPisOld == 0 );
422 pCex =
Abc_CexAlloc( nRegsOld, nPisOld, nFrames + p->iFrame + 1 );
424 pCex->iFrame = nFrames + p->iFrame;
425 for ( i = 0; i < nFrames; i++ )
426 for ( k = 0; k < nPisOld; k++, iBit++ )
429 for ( i = 0; i <= p->iFrame; i++ )
430 for ( k = 0; k < nPisOld; k++, iBit++ )
433 assert( iBit == pCex->nBits );
451 int nFlops =
strlen(pInit);
452 int i, f, iBit, iAddPi = 0, nAddPis = 0;
454 for ( i = 0; i < nFlops; i++ )
455 nAddPis += (
int)(pInit[i] ==
'x');
457 pCex =
Abc_CexAlloc( nFlops, p->nPis - nAddPis, p->iFrame + 1 );
459 pCex->iFrame = p->iFrame;
460 for ( iBit = 0; iBit < nFlops; iBit++ )
462 if ( pInit[iBit] ==
'1' || (pInit[iBit] ==
'x' &&
Abc_InfoHasBit(p->pData, p->nRegs + p->nPis - nAddPis + iAddPi)) )
464 iAddPi += (int)(pInit[iBit] ==
'x');
466 assert( iAddPi == nAddPis );
468 for ( f = 0; f <= p->iFrame; f++ )
469 for ( i = 0; i < pCex->nPis; i++, iBit++ )
472 assert( iBit == pCex->nBits );
494 pCex->iFrame = p->iFrame;
495 for ( i = p->nRegs; i < p->nBits; i++ )
498 iNew = p->nRegs + p->nPis * ((i - p->nRegs) / p->nPis) +
Vec_IntEntry( vMapOld2New, (i - p->nRegs) % p->nPis );
543 i = i - ((i >> 1) & 0x55555555);
544 i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
545 i = ((i + (i >> 4)) & 0x0F0F0F0F);
546 return (i*(0x01010101))>>24;
552 for ( i = 0; i <
nWords; i++ )
Abc_Cex_t * Abc_CexTransformTempor(Abc_Cex_t *p, int nPisOld, int nPosOld, int nRegsOld)
Abc_Cex_t * Abc_CexTransformUndc(Abc_Cex_t *p, char *pInit)
Abc_Cex_t * Abc_CexMerge(Abc_Cex_t *pCex, Abc_Cex_t *pPart, int iFrBeg, int iFrEnd)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
static int Abc_InfoHasBit(unsigned *p, int i)
ABC_NAMESPACE_IMPL_START Abc_Cex_t * Abc_CexAlloc(int nRegs, int nRealPis, int nFrames)
DECLARATIONS ///.
int Abc_CexCountOnes(Abc_Cex_t *p)
#define ABC_ALLOC(type, num)
static Vec_Int_t * Vec_IntStartFull(int nSize)
void Abc_CexPrintStatsInputs(Abc_Cex_t *p, int nInputs)
Abc_Cex_t * Abc_CexMakeTriv(int nRegs, int nTruePis, int nTruePos, int iFrameOut)
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
static int Vec_IntEntry(Vec_Int_t *p, int i)
void Abc_CexPrintStats(Abc_Cex_t *p)
void Abc_CexFreeP(Abc_Cex_t **p)
#define ABC_NAMESPACE_IMPL_END
#define Vec_IntForEachEntryTwo(vVec1, vVec2, Entry1, Entry2, i)
void Abc_CexPrint(Abc_Cex_t *p)
Abc_Cex_t * Abc_CexAllocFull(int nRegs, int nRealPis, int nFrames)
#define ABC_NAMESPACE_IMPL_START
static void Abc_InfoSetBit(unsigned *p, int i)
static int Vec_IntSize(Vec_Int_t *p)
Abc_Cex_t * Abc_CexDup(Abc_Cex_t *p, int nRegsNew)
Abc_Cex_t * Abc_CexTransformPhase(Abc_Cex_t *p, int nPisOld, int nPosOld, int nRegsOld)
Abc_Cex_t * Abc_CexDeriveFromCombModel(int *pModel, int nPis, int nRegs, int iPo)
static int Abc_CexOnes32(unsigned i)
Abc_Cex_t * Abc_CexPermuteTwo(Abc_Cex_t *p, Vec_Int_t *vPermOld, Vec_Int_t *vPermNew)
static int Abc_BitWordNum(int nBits)
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
static void Vec_IntFree(Vec_Int_t *p)
void Abc_CexFree(Abc_Cex_t *p)
Abc_Cex_t * Abc_CexCreate(int nRegs, int nPis, int *pArray, int iFrame, int iPo, int fSkipRegs)
Abc_Cex_t * Abc_CexPermute(Abc_Cex_t *p, Vec_Int_t *vMapOld2New)