33 static inline int Cnf_Lit2Var(
int Lit ) {
return (Lit & 1)? -(Lit >> 1)-1 : (Lit >> 1)+1; }
34 static inline int Cnf_Lit2Var2(
int Lit ) {
return (Lit & 1)? -(Lit >> 1) : (Lit >> 1); }
65 for ( i = 1; i < 4; i++ )
248 FILE * pFile = stdout;
249 int * pLit, * pStop, i;
253 for ( pLit = p->
pClauses[i], pStop = p->
pClauses[i+1]; pLit < pStop; pLit++ )
255 fprintf( pFile,
"\n" );
257 fprintf( pFile,
"\n" );
274 int * pLit, * pStop, i, VarId;
275 pFile =
gzopen( pFileName,
"wb" );
278 printf(
"Cnf_WriteIntoFile(): Output file cannot be opened.\n" );
281 gzprintf( pFile,
"c Result of efficient AIG-to-CNF conversion using package CNF\n" );
287 gzprintf( pFile,
"%d ", fReadable? VarId : VarId+1 );
294 gzprintf( pFile,
"%d ", fReadable? VarId : VarId+1 );
299 for ( pLit = p->
pClauses[i], pStop = p->
pClauses[i+1]; pLit < pStop; pLit++ )
321 int * pLit, * pStop, i, VarId;
327 pFile = fopen( pFileName,
"w" );
330 printf(
"Cnf_WriteIntoFile(): Output file cannot be opened.\n" );
333 fprintf( pFile,
"c Result of efficient AIG-to-CNF conversion using package CNF\n" );
337 fprintf( pFile,
"a " );
339 fprintf( pFile,
"%d ", fReadable? VarId : VarId+1 );
340 fprintf( pFile,
"0\n" );
344 fprintf( pFile,
"e " );
346 fprintf( pFile,
"%d ", fReadable? VarId : VarId+1 );
347 fprintf( pFile,
"0\n" );
351 for ( pLit = p->
pClauses[i], pStop = p->
pClauses[i+1]; pLit < pStop; pLit++ )
353 fprintf( pFile,
"0\n" );
355 fprintf( pFile,
"\n" );
389 int nLitsAll, * pLits, Lits[2];
390 nLitsAll = 2 * p->
nVars;
392 for ( f = 1; f < nFrames; f++ )
414 pLits[i] += nLitsAll;
425 nLitsAll = (f-1) * nLitsAll;
427 pLits[i] -= nLitsAll;
497 int nLitsAll, * pLits, Lits[2];
498 nLitsAll = 2 * p->
nVars;
500 for ( f = 1; f < nFrames; f++ )
522 pLits[i] += nLitsAll;
533 nLitsAll = (f-1) * nLitsAll;
535 pLits[i] -= nLitsAll;
670 assert( iVar < pCnf->nVars );
671 if ( pVarToPol[iVar] )
691 assert( iVarA > 0 && iVarB > 0 && iVarC > 0 );
void * Cnf_DataWriteIntoSolver(Cnf_Dat_t *p, int nFrames, int fInit)
static ABC_NAMESPACE_IMPL_START int Cnf_Lit2Var(int Lit)
DECLARATIONS ///.
void * Cnf_DataWriteIntoSolverInt(void *pSolver, Cnf_Dat_t *p, int nFrames, int fInit)
void Cnf_DataFree(Cnf_Dat_t *p)
int Cnf_DataAddXorClause(void *pSat, int iVarA, int iVarB, int iVarC)
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 ///.
static int lit_var(lit l)
void sat_solver2_delete(sat_solver2 *s)
void sat_solver_delete(sat_solver *s)
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Cnf_Dat_t * Cnf_DataDup(Cnf_Dat_t *p)
#define Aig_ManForEachCo(p, pObj, i)
#define ABC_ALLOC(type, num)
ABC_NAMESPACE_IMPL_START int ZEXPORT gzclose(gzFile file)
sat_solver2 * sat_solver2_new(void)
static int Abc_TruthWordNum(int nVars)
int sat_solver2_addclause(sat_solver2 *s, lit *begin, lit *end, int Id)
void sat_solver2_setnvars(sat_solver2 *s, int n)
int Cnf_DataWriteAndClauses(void *p, Cnf_Dat_t *pCnf)
void Cnf_DataLift(Cnf_Dat_t *p, int nVarsPlus)
static lit lit_neg(lit l)
static int Aig_ManCoNum(Aig_Man_t *p)
void * Cnf_DataWriteIntoSolver2(Cnf_Dat_t *p, int nFrames, int fInit)
void Cnf_ReadMsops(char **ppSopSizes, char ***ppSops)
FUNCTION DEFINITIONS ///.
static int Cnf_Lit2Var2(int Lit)
void Cnf_DataPrint(Cnf_Dat_t *p, int fReadable)
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
int sat_solver2_simplify(sat_solver2 *s)
#define Aig_ManForEachLiLoSeq(p, pObjLi, pObjLo, k)
static lit toLitCond(int v, int c)
void sat_solver_setnvars(sat_solver *s, int n)
static int Aig_ManCiNum(Aig_Man_t *p)
#define ABC_NAMESPACE_IMPL_END
static void Vec_IntPush(Vec_Int_t *p, int Entry)
static void Vec_IntFreeP(Vec_Int_t **p)
static int Aig_ManObjNumMax(Aig_Man_t *p)
int ZEXPORTVA gzprintf(gzFile file, const char *format, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9, int a10, int a11, int a12, int a13, int a14, int a15, int a16, int a17, int a18, int a19, int a20)
#define ABC_NAMESPACE_IMPL_START
Cnf_Man_t * Cnf_ManStart()
FUNCTION DEFINITIONS ///.
int Cnf_DataWriteOrClause2(void *p, Cnf_Dat_t *pCnf)
gzFile ZEXPORT gzopen(const char *path, const char *mode)
int sat_solver_simplify(sat_solver *s)
void Cnf_DataWriteIntoFileGz(Cnf_Dat_t *p, char *pFileName, int fReadable, Vec_Int_t *vForAlls, Vec_Int_t *vExists)
sat_solver * sat_solver_new(void)
void Cnf_DataTranformPolarity(Cnf_Dat_t *pCnf, int fTransformPos)
#define Aig_ManForEachObj(p, pObj, i)
Aig_MmFlex_t * Aig_MmFlexStart()
void Aig_MmFlexStop(Aig_MmFlex_t *p, int fVerbose)
#define Aig_ManForEachLoSeq(p, pObj, i)
#define ABC_CALLOC(type, num)
Cnf_Dat_t * Cnf_DataAlloc(Aig_Man_t *pAig, int nVars, int nClauses, int nLiterals)
void Cnf_DataFlipLastLiteral(Cnf_Dat_t *p)
void Cnf_ManStop(Cnf_Man_t *p)
void Cnf_DataWriteIntoFile(Cnf_Dat_t *p, char *pFileName, int fReadable, Vec_Int_t *vForAlls, Vec_Int_t *vExists)
Vec_Int_t * Cnf_DataCollectPiSatNums(Cnf_Dat_t *pCnf, Aig_Man_t *p)
static void Vec_IntFree(Vec_Int_t *p)
typedefABC_NAMESPACE_HEADER_START struct Cnf_Man_t_ Cnf_Man_t
INCLUDES ///.
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
int Cnf_DataWriteOrClause(void *p, Cnf_Dat_t *pCnf)
static int Aig_ObjIsCo(Aig_Obj_t *pObj)