30 static inline int Fra_RegToLit(
int n,
int c ) {
return c? -n-1 : n+1; }
31 static inline int Fra_LitReg(
int n ) {
return (n>0)? n-1 : -n-1; }
54 for ( i = pSeq->
nWordsPref; i < pSeq->nWordsTotal; i++ )
73 unsigned * pSims0, * pSims1;
77 for ( i = pSeq->
nWordsPref; i < pSeq->nWordsTotal; i++ )
78 if ( pSims0[i] != pSims1[i] )
96 unsigned * pSim1, * pSim2;
100 if ( fCompl1 && fCompl2 )
102 for ( k = pSeq->
nWordsPref; k < pSeq->nWordsTotal; k++ )
103 if ( pSim1[k] & pSim2[k] )
108 for ( k = pSeq->
nWordsPref; k < pSeq->nWordsTotal; k++ )
109 if ( pSim1[k] & ~pSim2[k] )
114 for ( k = pSeq->
nWordsPref; k < pSeq->nWordsTotal; k++ )
115 if ( ~pSim1[k] & pSim2[k] )
136 int fSkipConstEqu = 1;
147 assert( i-nTruePis >= 0 );
156 assert( k-nTruePis >= 0 );
194 int i, Out1, Out2, pLits[2];
201 if ( Out1 == 0 && Out2 == 0 )
210 printf(
"Fra_OneHotAssume(): Adding clause makes SAT solver unsat.\n" );
232 int RetValue, i, Out1, Out2;
238 if ( Out1 == 0 && Out2 == 0 )
249 printf(
"Fra_OneHotCheck(): Clause is not refined!\n" );
269 int i, Out1, Out2, RetValue = 0;
276 if ( Out1 == 0 && Out2 == 0 )
305 int i, Out1, Out2,
Counter = 0;
310 if ( Out1 == 0 && Out2 == 0 )
330 int nSimWords = (1<<14);
333 unsigned * pSim1, * pSim2, * pSimTot;
334 int i, w, Out1, Out2, nCovered,
Counter = 0;
341 for ( i = 0; i < nRegs; i++ )
344 for ( w = 0; w < nSimWords; w++ )
350 memset( pSimTot, 0,
sizeof(
unsigned) * nSimWords );
355 if ( Out1 == 0 && Out2 == 0 )
364 for ( w = 0; w < nSimWords; w++ )
365 pSimTot[w] |= pSim1[w] & pSim2[w];
367 for ( w = 0; w < nSimWords; w++ )
368 pSimTot[w] |= pSim1[w] & ~pSim2[w];
370 for ( w = 0; w < nSimWords; w++ )
371 pSimTot[w] |= ~pSim1[w] & pSim2[w];
378 for ( w = 0; w < nSimWords; w++ )
382 printf(
"Care states ratio = %f. ", 1.0 * (nSimWords * 32 - nCovered) / (nSimWords * 32) );
383 printf(
"(%d out of %d patterns) ", nSimWords * 32 - nCovered, nSimWords * 32 );
402 int i, Out1, Out2, nTruePis;
413 if ( Out1 == 0 && Out2 == 0 )
419 pObj =
Aig_Or( pNew, pObj1, pObj2 );
443 int k, i, j, Out1, Out2, pLits[2];
460 printf(
"Fra_OneHotAddKnownConstraint(): Adding clause makes SAT solver unsat.\n" );
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Vec_Int_t * Fra_OneHotCompute(Fra_Man_t *p, Fra_Sml_t *pSim)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
#define Vec_PtrForEachEntryStart(Type, vVec, pEntry, i, Start)
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
int sat_solver_addclause(sat_solver *s, lit *begin, lit *end)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
void Fra_OneHotEstimateCoverage(Fra_Man_t *p, Vec_Int_t *vOneHots)
int Fra_OneHotNodesAreClause(Fra_Sml_t *pSeq, Aig_Obj_t *pObj1, Aig_Obj_t *pObj2, int fCompl1, int fCompl2)
void sat_solver_delete(sat_solver *s)
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
static ABC_NAMESPACE_IMPL_START int Fra_RegToLit(int n, int c)
DECLARATIONS ///.
unsigned Aig_ManRandom(int fReset)
static abctime Abc_Clock()
static unsigned * Fra_ObjSim(Fra_Sml_t *p, int Id)
MACRO DEFINITIONS ///.
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
int Fra_OneHotRefineUsingCex(Fra_Man_t *p, Vec_Int_t *vOneHots)
static int Aig_ManCoNum(Aig_Man_t *p)
int Fra_OneHotCount(Fra_Man_t *p, Vec_Int_t *vOneHots)
static int Aig_WordCountOnes(unsigned uWord)
static unsigned Fra_ObjRandomSim()
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
int Fra_NodesAreClause(Fra_Man_t *p, Aig_Obj_t *pOld, Aig_Obj_t *pNew, int fComplL, int fComplR)
static Aig_Obj_t * Aig_ManCi(Aig_Man_t *p, int i)
static lit toLitCond(int v, int c)
static int Vec_IntEntry(Vec_Int_t *p, int i)
static int Fra_LitReg(int n)
static int Aig_ManCiNum(Aig_Man_t *p)
Aig_Man_t * Fra_OneHotCreateExdc(Fra_Man_t *p, Vec_Int_t *vOneHots)
#define ABC_NAMESPACE_IMPL_END
Aig_Obj_t * Aig_Or(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
static void Vec_IntPush(Vec_Int_t *p, int Entry)
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
int Fra_OneHotNodesAreEqual(Fra_Sml_t *pSeq, Aig_Obj_t *pObj0, Aig_Obj_t *pObj1)
#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)
static int Aig_ManRegNum(Aig_Man_t *p)
void Fra_SmlResimulate(Fra_Man_t *p)
static int Vec_IntSize(Vec_Int_t *p)
#define Aig_ManForEachLoSeq(p, pObj, i)
static int Fra_ObjSatNum(Aig_Obj_t *pObj)
void Fra_OneHotAssume(Fra_Man_t *p, Vec_Int_t *vOneHots)
void Fra_OneHotCheck(Fra_Man_t *p, Vec_Int_t *vOneHots)
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
int Fra_OneHotNodeIsConst(Fra_Sml_t *pSeq, Aig_Obj_t *pObj)
FUNCTION DEFINITIONS ///.
int Aig_ManCleanup(Aig_Man_t *p)
static int Fra_LitSign(int n)
static Vec_Ptr_t * Vec_PtrAllocSimInfo(int nEntries, int nWords)
void Fra_OneHotAddKnownConstraint(Fra_Man_t *p, Vec_Ptr_t *vOnehots)
static void Vec_PtrFree(Vec_Ptr_t *p)