49 static int s_FPrimes[128] = {
50 1009, 1049, 1093, 1151, 1201, 1249, 1297, 1361, 1427, 1459,
51 1499, 1559, 1607, 1657, 1709, 1759, 1823, 1877, 1933, 1997,
52 2039, 2089, 2141, 2213, 2269, 2311, 2371, 2411, 2467, 2543,
53 2609, 2663, 2699, 2741, 2797, 2851, 2909, 2969, 3037, 3089,
54 3169, 3221, 3299, 3331, 3389, 3461, 3517, 3557, 3613, 3671,
55 3719, 3779, 3847, 3907, 3943, 4013, 4073, 4129, 4201, 4243,
56 4289, 4363, 4441, 4493, 4549, 4621, 4663, 4729, 4793, 4871,
57 4933, 4973, 5021, 5087, 5153, 5227, 5281, 5351, 5417, 5471,
58 5519, 5573, 5651, 5693, 5749, 5821, 5861, 5923, 6011, 6073,
59 6131, 6199, 6257, 6301, 6353, 6397, 6481, 6563, 6619, 6689,
60 6737, 6803, 6863, 6917, 6977, 7027, 7109, 7187, 7237, 7309,
61 7393, 7477, 7523, 7561, 7607, 7681, 7727, 7817, 7877, 7933,
62 8011, 8039, 8059, 8081, 8093, 8111, 8123, 8147
70 for ( i =
p->pSml->nWordsPref; i < p->pSml->nWordsTotal; i++ )
71 uHash ^= pSims[i] * s_FPrimes[i & 0x7F];
72 return uHash % nTableSize;
112 unsigned * pSims0, * pSims1;
117 if ( pSims0[i] != pSims1[i] )
135 unsigned * pSimL, * pSimR;
139 for ( k = p->
nWordsPref; k < p->nWordsTotal; k++ )
160 for ( i = p->
nWordsPref; i < p->nWordsTotal; i++ )
285 int i, k, BestPat, * pModel;
292 assert( i < p->pSml->nWordsTotal );
294 for ( k = 0; k < 32; k++ )
295 if ( pSims[i] & (1 << k) )
299 BestPat = i * 32 + k;
386 pSims[i] = fConst1? ~(
unsigned)0 : 0;
436 int f, i, k, Limit, nTruePis;
445 for ( i = 0; i < Limit; i++ )
454 for ( f = 0; f < p->
nFrames; f++ )
467 for ( i = 0; i < Limit; i++ )
487 unsigned * pSims, * pSims0, * pSims1;
488 int fCompl, fCompl0, fCompl1, i;
501 if ( fCompl0 && fCompl1 )
505 pSims[i] = (pSims0[i] | pSims1[i]);
508 pSims[i] = ~(pSims0[i] | pSims1[i]);
510 else if ( fCompl0 && !fCompl1 )
514 pSims[i] = (pSims0[i] | ~pSims1[i]);
517 pSims[i] = (~pSims0[i] & pSims1[i]);
519 else if ( !fCompl0 && fCompl1 )
523 pSims[i] = (~pSims0[i] | pSims1[i]);
526 pSims[i] = (pSims0[i] & ~pSims1[i]);
532 pSims[i] = ~(pSims0[i] & pSims1[i]);
535 pSims[i] = (pSims0[i] & pSims1[i]);
552 unsigned * pSims0, * pSims1;
563 if ( pSims0[i] != pSims1[i] )
581 unsigned * pSims, * pSims0;
582 int fCompl, fCompl0, i;
596 pSims[i] = ~pSims0[i];
599 pSims[i] = pSims0[i];
615 unsigned * pSims0, * pSims1;
627 pSims1[i] = pSims0[i];
669 for ( f = 0; f < p->
nFrames; f++ )
721 if ( !p->
pPars->nFramesK && nChanges < 1 )
722 printf(
"Error: A counter-example did not refine classes!\n" );
741 int nChanges, nClasses;
793 }
while ( (
double)nChanges / nClasses > p->
pPars->dSimSatur );
817 memset( p, 0,
sizeof(
Fra_Sml_t) +
sizeof(
unsigned) * (nPref + nFrames) * nWordsFrame );
884 pFile = fopen( pFileName,
"rb" );
887 printf(
"Cannot open file \"%s\" with simulation patterns.\n", pFileName );
891 while ( (c = fgetc(pFile)) != EOF )
893 if ( c ==
'0' || c ==
'1' )
895 else if ( c !=
' ' && c !=
'\r' && c !=
'\n' && c !=
'\t' )
897 printf(
"File \"%s\" contains symbol (%c) other than \'0\' or \'1\'.\n", pFileName, (
char)c );
925 assert( nPats <= nPatsPadded );
933 for ( k = 0; k < nPats; k++ )
937 for ( ; k < nPatsPadded; k++ )
959 for ( k = 0; k < nPatterns; k++ )
989 if ( vSimInfo == NULL )
993 printf(
"File \"%s\": The number of binary digits (%d) is not divisible by the number of primary inputs (%d).\n",
1048 int iPo, iFrame, iBit, i, k;
1062 for ( i = p->
nWordsPref; i < p->nWordsTotal; i++ )
1072 assert( iFrame < p->nFrames );
1073 assert( iBit < 32 * p->nWordsFrame );
1078 pCex->iFrame = iFrame;
1087 for ( i = 0; i <= iFrame; i++ )
1099 printf(
"Fra_SmlGetCounterExample(): Counter-example is invalid.\n" );
1121 int i, nFrames, nTruePis, nTruePos, iPo, iFrame;
1137 iFrame = i / nTruePos;
1144 pCex->iFrame = iFrame;
1151 if ( pCex->nRegs + i == pCex->nBits - 1 )
1158 printf(
"Fra_SmlGetCounterExample(): Counter-example is invalid.\n" );
void Fra_SmlInitialize(Fra_Sml_t *p, int fInit)
int Fra_ImpRefineUsingCex(Fra_Man_t *p, Vec_Int_t *vImps)
int Fra_SmlNodeCountOnes(Fra_Sml_t *p, Aig_Obj_t *pObj)
int Fra_ClassesRefine1(Fra_Cla_t *p, int fRefineNewClass, int *pSkipped)
void Fra_SmlSavePattern(Fra_Man_t *p)
int Fra_SmlNodeNotEquWeight(Fra_Sml_t *p, int Left, int Right)
void Fra_SmlSimulate(Fra_Man_t *p, int fInit)
Fra_Sml_t * Fra_SmlSimulateComb(Aig_Man_t *pAig, int nWords, int fCheckMiter)
void Fra_SmlAssignRandom(Fra_Sml_t *p, Aig_Obj_t *pObj)
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
void Fra_SmlNodeSimulate(Fra_Sml_t *p, Aig_Obj_t *pObj, int iFrame)
static Aig_Obj_t * Aig_ObjChild0(Aig_Obj_t *pObj)
void Fra_SmlAssignConst(Fra_Sml_t *p, Aig_Obj_t *pObj, int fConst1, int iFrame)
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 Fra_SmlNodesCompareInFrame(Fra_Sml_t *p, Aig_Obj_t *pObj0, Aig_Obj_t *pObj1, int iFrame0, int iFrame1)
int Saig_ManVerifyCex(Aig_Man_t *pAig, Abc_Cex_t *p)
int Fra_ClassesCountLits(Fra_Cla_t *p)
static void Abc_InfoXorBit(unsigned *p, int i)
Fra_Sml_t * Fra_SmlSimulateCombGiven(Aig_Man_t *pAig, char *pFileName, int fCheckMiter, int fVerbose)
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
int Fra_SmlNodeIsConst(Aig_Obj_t *pObj)
static int Aig_IsComplement(Aig_Obj_t *p)
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
#define Aig_ManForEachCo(p, pObj, i)
#define ABC_ALLOC(type, num)
static Vec_Str_t * Vec_StrAlloc(int nCap)
static abctime Abc_Clock()
static void Vec_StrPush(Vec_Str_t *p, char Entry)
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
static int Vec_PtrSize(Vec_Ptr_t *p)
void Fra_SmlSimulateOne(Fra_Sml_t *p)
static int sat_solver_var_value(sat_solver *s, int v)
void Fra_SmlInitializeGiven(Fra_Sml_t *p, Vec_Str_t *vSimInfo)
ABC_NAMESPACE_IMPL_START int Fra_SmlNodeHash(Aig_Obj_t *pObj, int nTableSize)
DECLARATIONS ///.
static unsigned * Fra_ObjSim(Fra_Sml_t *p, int Id)
MACRO DEFINITIONS ///.
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
void Fra_ClassesPrepare(Fra_Cla_t *p, int fLatchCorr, int nMaxLevs)
Abc_Cex_t * Fra_SmlCopyCounterExample(Aig_Man_t *pAig, Aig_Man_t *pFrames, int *pModel)
static int Aig_ManCoNum(Aig_Man_t *p)
static int Abc_MinInt(int a, int b)
int Fra_SmlCheckNonConstOutputs(Fra_Sml_t *p)
static int Aig_WordCountOnes(unsigned uWord)
static char Vec_StrEntry(Vec_Str_t *p, int i)
Vec_Str_t * Fra_SmlSimulateReadFile(char *pFileName)
#define Aig_ManForEachNode(p, pObj, i)
Abc_Cex_t * Fra_SmlGetCounterExample(Fra_Sml_t *p)
static unsigned Fra_ObjRandomSim()
static void Vec_StrFree(Vec_Str_t *p)
static Aig_Obj_t * Aig_ManCi(Aig_Man_t *p, int i)
#define Aig_ManForEachLiLoSeq(p, pObjLi, pObjLo, k)
int Fra_SmlCheckOutput(Fra_Man_t *p)
static int Aig_WordFindFirstBit(unsigned uWord)
static int Aig_ManCiNum(Aig_Man_t *p)
#define ABC_NAMESPACE_IMPL_END
static Aig_Obj_t * Aig_ObjChild1(Aig_Obj_t *pObj)
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Fra_Sml_t * Fra_SmlSimulateSeq(Aig_Man_t *pAig, int nPref, int nFrames, int nWords, int fCheckMiter)
int Fra_OneHotRefineUsingCex(Fra_Man_t *p, Vec_Int_t *vOneHots)
static int Aig_ObjPhaseReal(Aig_Obj_t *pObj)
static void Vec_IntPush(Vec_Int_t *p, int Entry)
void Fra_SmlCheckOutputSavePattern(Fra_Man_t *p, Aig_Obj_t *pObjPo)
void Fra_SmlResimulate(Fra_Man_t *p)
void Fra_SmlNodeCopyFanin(Fra_Sml_t *p, Aig_Obj_t *pObj, int iFrame)
int Fra_SmlNodesAreEqual(Aig_Obj_t *pObj0, Aig_Obj_t *pObj1)
void Fra_SmlPrintOutputs(Fra_Sml_t *p, int nPatterns)
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
void Fra_SmlAssignDist1(Fra_Sml_t *p, unsigned *pPat)
static int Aig_ManObjNumMax(Aig_Man_t *p)
#define ABC_NAMESPACE_IMPL_START
static void Abc_InfoSetBit(unsigned *p, int i)
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
static int Vec_StrSize(Vec_Str_t *p)
static int Aig_ManRegNum(Aig_Man_t *p)
int Fra_ClassesRefine(Fra_Cla_t *p)
#define Aig_ManForEachLoSeq(p, pObj, i)
void Fra_SmlStop(Fra_Sml_t *p)
static int Fra_ObjSatNum(Aig_Obj_t *pObj)
static int Abc_BitWordNum(int nBits)
#define Aig_ManForEachLiSeq(p, pObj, i)
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
void Fra_SmlNodeTransferNext(Fra_Sml_t *p, Aig_Obj_t *pOut, Aig_Obj_t *pIn, int iFrame)
void Abc_CexFree(Abc_Cex_t *p)
#define Aig_ManForEachPoSeq(p, pObj, i)
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
static void Vec_IntClear(Vec_Int_t *p)
void Fra_SmlSavePattern1(Fra_Man_t *p, int fInit)
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Fra_Sml_t * Fra_SmlStart(Aig_Man_t *pAig, int nPref, int nFrames, int nWordsFrame)
#define Aig_ManForEachPiSeq(p, pObj, i)
SEQUENTIAL ITERATORS ///.
static void Vec_StrFreeP(Vec_Str_t **p)
int Fra_SmlNodeIsZero(Fra_Sml_t *p, Aig_Obj_t *pObj)
void Fra_SmlSavePattern0(Fra_Man_t *p, int fInit)