61 unsigned * pInfo, * pInfo0, * pInfo1, * pInfoMask, * pInfoMask2;
62 int i, w, f, RetValue = 1;
65 printf(
"Simulating %d nodes and %d flops for %d frames with %d words... ",
74 for ( w = 0; w <
nWords; w++ )
80 for ( w = 0; w <
nWords; w++ )
86 for ( f = 0; f < nFrames; f++ )
92 for ( w = 0; w <
nWords; w++ )
100 for ( w = 0; w <
nWords; w++ )
101 pInfo[w] = pInfo0[w];
112 for ( w = 0; w <
nWords; w++ )
113 pInfo[w] = ~(pInfo0[w] | pInfo1[w]);
115 for ( w = 0; w <
nWords; w++ )
116 pInfo[w] = ~pInfo0[w] & pInfo1[w];
121 for ( w = 0; w <
nWords; w++ )
122 pInfo[w] = pInfo0[w] & ~pInfo1[w];
124 for ( w = 0; w <
nWords; w++ )
125 pInfo[w] = pInfo0[w] & pInfo1[w];
129 for ( w = 0; w <
nWords; w++ )
130 pInfoMask[w] = pInfoMask2[w] = 0;
140 for ( w = 0; w <
nWords; w++ )
141 pInfo[w] = ~pInfo0[w];
145 for ( w = 0; w <
nWords; w++ )
146 pInfo[w] = pInfo0[w];
153 for ( w = 0; w <
nWords; w++ )
154 pInfo[w] |= ~pInfo0[w];
158 for ( w = 0; w <
nWords; w++ )
159 pInfo[w] |= pInfo0[w];
165 for ( w = 0; w <
nWords; w++ )
166 pInfoMask[w] |= pInfo[w];
170 for ( w = 0; w <
nWords; w++ )
171 pInfoMask2[w] |= pInfo[w];
178 for ( w = 0; w <
nWords; w++ )
183 for ( w = 0; w <
nWords; w++ )
184 if ( pInfo[w] & ~pInfoMask2[w] )
188 printf(
"Primary output %d fails on some input patterns.\n", i );
193 for ( w = 0; w <
nWords; w++ )
206 printf(
"Primary output : " );
209 printf(
"ProbOne = %f ", (
float)
Vec_IntEntry(vProbs, i)/(32*nWords*nFrames) );
210 printf(
"ProbOneC = %f ", (
float)
Vec_IntEntry(vProbs2, i)/(32*nWords*nFrames) );
239 Aig_Obj_t * pObj, * pObjLi, * pObjLo, * pObjNew;
251 for ( f = 0; f < nFrames; f++ )
254 for ( f = 0; f < nFrames; f++ )
262 for ( f = 0; f < nFrames; f++ )
274 if ( f < nFrames - 1 )
318 status =
sat_solver_solve( pSat, &Lit, &Lit + 1, (ABC_INT64_T)nConfs, 0, 0, 0 );
364 printf(
"Filtered cands: " );
415 assert( p->pObjCopies == NULL );
416 p->pObjCopies = pObjMap;
434 Aig_Obj_t * pObj, * pObjLi, * pObjLo, * pObjNew;
444 for ( f = 0; f < nFrames; f++ )
447 for ( f = 0; f < nFrames; f++ )
454 for ( f = 0; f < nFrames; f++ )
465 if ( f < nFrames - 1 )
470 for ( f = nFrames-1; f < nFrames; f++ )
480 assert( pAig->pObjCopies == NULL );
481 pAig->pObjCopies = pObjMap;
532 status =
sat_solver_solve( pSat, Lits, Lits + 2, (ABC_INT64_T)nConfs, (ABC_INT64_T)nProps, 0, 0 );
550 printf(
"Warning: Reached the limit on the number of patterns.\n" );
587 for ( f = 0; f < nFrames; f++ )
596 pRepr = p->pObjCopies[nFrames*i + nFrames-1-f];
624 printf(
"Level %d. Cands =%d ", k,
Vec_PtrSize(vNodes) );
634 printf(
"Found %3d constraints after filtering.\n",
Vec_VecSizeSize(vCands) );
639 printf(
"Level %d. Constr =%d ", k,
Vec_PtrSize(vNodes) );
663 int iPat = 0, nWordsAlloc = 16;
672 int i, j, k, Lit, status, nCands = 0;
676 printf(
"The number of outputs is different from 1.\n" );
686 printf(
"Detecting constraints with %d frames, %d conflicts, and %d propagations.\n", nFrames, nConfs, nProps );
687 printf(
"Frames: " );
699 status =
sat_solver_solve( pSat, &Lit, &Lit + 1, (ABC_INT64_T)nConfs, 0, 0, 0 );
702 printf(
"The problem is trivially UNSAT (inductive with k=%d).\n", nFrames-1 );
710 printf(
"Solver could not solve the original problem.\n" );
726 memset( (
char*)pInfo, 0xff, 4*nWordsAlloc );
741 for ( k = 0; k < nWordsAlloc; k++ )
742 if ( pInfo[k] != ~0 )
744 if ( k == nWordsAlloc )
748 pObj->
fMarkA = 1, nCands++;
753 for ( k = 0; k < nWordsAlloc; k++ )
756 if ( k == nWordsAlloc )
760 pObj->
fMarkB = 1, nCands++;
772 printf(
"Found %3d classes of candidates.\n", nCands );
774 for ( k = 0; k < nFrames; k++ )
780 pRepr = p->pObjCopies[nFrames*i + nFrames-1-k];
788 for ( j = 0; j < k; j++ )
799 for ( j = 0; j < k; j++ )
815 printf(
"Level %d. Cands =%d ", k,
Vec_PtrSize(vNodes) );
825 printf(
"Found %3d constraints after filtering.\n",
Vec_VecSizeSize(vCands) );
830 printf(
"Level %d. Constr =%d ", k,
Vec_PtrSize(vNodes) );
883 int i, j, k, nNewFlops;
906 for ( j = 0; j < i; j++ )
920 for ( j = 0; j < i; j++ )
945 Aig_Obj_t * pMiter, * pFlopOut, * pFlopIn, * pObj;
976 pFlopIn =
Aig_Or( pAigNew, pMiter, pFlopOut );
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
#define Vec_VecForEachLevel(vGlob, vVec, i)
MACRO DEFINITIONS ///.
static ABC_NAMESPACE_IMPL_START Aig_Obj_t * Aig_ObjFrames(Aig_Obj_t **pObjMap, int nFs, Aig_Obj_t *pObj, int i)
DECLARATIONS ///.
static Aig_Obj_t * Aig_ObjChild0Frames(Aig_Obj_t **pObjMap, int nFs, Aig_Obj_t *pObj, int i)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
static int Aig_ObjPhase(Aig_Obj_t *pObj)
static void Vec_VecPush(Vec_Vec_t *p, int Level, void *Entry)
static Vec_Vec_t * Vec_VecAlloc(int nCap)
FUNCTION DEFINITIONS ///.
static int Aig_ObjFaninId0(Aig_Obj_t *pObj)
static int Aig_ManConstrNum(Aig_Man_t *p)
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
static int Saig_ManPoNum(Aig_Man_t *p)
static int Saig_ObjIsLo(Aig_Man_t *p, Aig_Obj_t *pObj)
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
void Aig_ManStop(Aig_Man_t *p)
static int Abc_InfoHasBit(unsigned *p, int i)
int Aig_ManSeqCleanup(Aig_Man_t *p)
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
#define Saig_ManForEachLiLo(p, pObjLi, pObjLo, i)
static Aig_Obj_t * Saig_ObjLoToLi(Aig_Man_t *p, Aig_Obj_t *pObj)
int sat_solver_solve(sat_solver *s, lit *begin, lit *end, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, ABC_INT64_T nConfLimitGlobal, ABC_INT64_T nInsLimitGlobal)
static void Abc_InfoXorBit(unsigned *p, int i)
void sat_solver_delete(sat_solver *s)
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Aig_Man_t * Aig_ManDupDfs(Aig_Man_t *p)
void Aig_ManPrintStats(Aig_Man_t *p)
static int Aig_IsComplement(Aig_Obj_t *p)
static void Vec_PtrCleanSimInfo(Vec_Ptr_t *vInfo, int iWord, int nWords)
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
static Aig_Obj_t * Aig_ManConst0(Aig_Man_t *p)
#define Aig_ManForEachCo(p, pObj, i)
Aig_Man_t * Saig_ManUnrollCOI(Aig_Man_t *pAig, int nFrames)
unsigned Aig_ManRandom(int fReset)
static Aig_Obj_t * Aig_Not(Aig_Obj_t *p)
static void Aig_ObjSetFrames(Aig_Obj_t **pObjMap, int nFs, Aig_Obj_t *pObj, int i, Aig_Obj_t *pNode)
static int Aig_ObjFaninId1(Aig_Obj_t *pObj)
static abctime Abc_Clock()
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
static int Vec_PtrSize(Vec_Ptr_t *p)
static void * Vec_PtrPop(Vec_Ptr_t *p)
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
static int Aig_ManNodeNum(Aig_Man_t *p)
static int sat_solver_var_value(sat_solver *s, int v)
static int Vec_PtrFind(Vec_Ptr_t *p, void *Entry)
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Aig_Man_t * Aig_ManFrames(Aig_Man_t *pAig, int nFs, int fInit, int fOuts, int fRegs, int fEnlarge, Aig_Obj_t ***ppObjMap)
FUNCTION DEFINITIONS ///.
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
static void Abc_PrintTime(int level, const char *pStr, abctime time)
void Saig_ManFilterUsingInd(Aig_Man_t *p, Vec_Vec_t *vCands, int nConfs, int nProps, int fVerbose)
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
int Saig_ManFilterUsingIndOne_new(Aig_Man_t *p, Aig_Man_t *pFrame, sat_solver *pSat, Cnf_Dat_t *pCnf, int nConfs, int nProps, int Counter)
static Aig_Obj_t * Aig_ObjRealCopy(Aig_Obj_t *pObj)
static int Aig_ManCoNum(Aig_Man_t *p)
static Vec_Int_t * Vec_IntStart(int nSize)
static int Saig_ManConstrNum(Aig_Man_t *p)
static int Aig_WordCountOnes(unsigned uWord)
static void Bar_ProgressUpdate(Bar_Progress_t *p, int nItemsCur, char *pString)
#define Aig_ManForEachNode(p, pObj, i)
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
#define Saig_ManForEachLi(p, pObj, i)
static void Vec_IntAddToEntry(Vec_Int_t *p, int i, int Addition)
#define Aig_ManForEachLiLoSeq(p, pObjLi, pObjLo, k)
static int Aig_ObjIsNone(Aig_Obj_t *pObj)
static lit toLitCond(int v, int c)
static int Vec_IntEntry(Vec_Int_t *p, int i)
#define ABC_NAMESPACE_IMPL_END
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Aig_Obj_t * Aig_Or(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
static Aig_Obj_t * Aig_ObjChild1Frames(Aig_Obj_t **pObjMap, int nFs, Aig_Obj_t *pObj, int i)
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
static int Saig_ManRegNum(Aig_Man_t *p)
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
static int Aig_ManObjNumMax(Aig_Man_t *p)
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
#define ABC_NAMESPACE_IMPL_START
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
int Saig_DetectTryPolarity(sat_solver *pSat, int nConfs, int nProps, Cnf_Dat_t *pCnf, Aig_Obj_t *pObj, int iPol, Vec_Ptr_t *vInfo, int *piPat, int fVerbose)
void Saig_CollectSatValues(sat_solver *pSat, Cnf_Dat_t *pCnf, Vec_Ptr_t *vInfo, int *piPat)
static int Aig_ManRegNum(Aig_Man_t *p)
static int Vec_PtrReadWordsSimInfo(Vec_Ptr_t *p)
void * Cnf_DataWriteIntoSolver(Cnf_Dat_t *p, int nFrames, int fInit)
#define Aig_ManForEachObj(p, pObj, i)
Cnf_Dat_t * Cnf_DeriveSimple(Aig_Man_t *p, int nOutputs)
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Aig_Man_t * Saig_ManDupUnfoldConstrsFunc(Aig_Man_t *pAig, int nFrames, int nConfs, int nProps, int fOldAlgo, int fVerbose)
void Aig_ManCleanMarkAB(Aig_Man_t *p)
static int Vec_VecSizeSize(Vec_Vec_t *p)
static int Aig_ObjIsCand(Aig_Obj_t *pObj)
#define Aig_ManForEachLoSeq(p, pObj, i)
#define ABC_CALLOC(type, num)
void Cnf_DataFree(Cnf_Dat_t *p)
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Vec_Vec_t * Saig_ManDetectConstrFunc(Aig_Man_t *p, int nFrames, int nConfs, int nProps, int fVerbose)
Aig_Man_t * Saig_ManUnrollCOI_(Aig_Man_t *p, int nFrames)
void Saig_ManDetectConstrFuncTest(Aig_Man_t *p, int nFrames, int nConfs, int nProps, int fOldAlgo, int fVerbose)
static void Vec_VecFreeP(Vec_Vec_t **p)
#define Saig_ManForEachPo(p, pObj, i)
static int Aig_ObjId(Aig_Obj_t *pObj)
Aig_Man_t * Saig_ManDupFoldConstrsFunc(Aig_Man_t *pAig, int fCompl, int fVerbose)
Vec_Vec_t * Ssw_ManFindDirectImplications(Aig_Man_t *p, int nFrames, int nConfs, int nProps, int fVerbose)
static Vec_Ptr_t * Vec_VecEntry(Vec_Vec_t *p, int i)
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
static void Vec_IntFree(Vec_Int_t *p)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
#define Aig_ManForEachPoSeq(p, pObj, i)
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
static void Vec_PtrShrink(Vec_Ptr_t *p, int nSizeNew)
Aig_Man_t * Aig_ManDupWithoutPos(Aig_Man_t *p)
char * Abc_UtilStrsav(char *s)
int sat_solver_get_var_value(sat_solver *s, int v)
void Bar_ProgressStop(Bar_Progress_t *p)
int Aig_ManCleanup(Aig_Man_t *p)
Aig_Man_t * Saig_ManCreateIndMiter(Aig_Man_t *pAig, Vec_Vec_t *vCands)
Bar_Progress_t * Bar_ProgressStart(FILE *pFile, int nItemsTotal)
FUNCTION DEFINITIONS ///.
#define Aig_ManForEachPiSeq(p, pObj, i)
SEQUENTIAL ITERATORS ///.
static Vec_Ptr_t * Vec_PtrAllocSimInfo(int nEntries, int nWords)
static void Vec_PtrFree(Vec_Ptr_t *p)
int Ssw_ManProfileConstraints(Aig_Man_t *p, int nWords, int nFrames, int fVerbose)
FUNCTION DEFINITIONS ///.
#define Saig_ManForEachPi(p, pObj, i)