Commit 12d9aaa7 by Niklas Een

Some fixes for VTA under Bridge.

parent 5b800e05
...@@ -129,7 +129,7 @@ void Gia_CreateHeader( FILE * pFile, int Type, int Size, unsigned char * pBuffer ...@@ -129,7 +129,7 @@ void Gia_CreateHeader( FILE * pFile, int Type, int Size, unsigned char * pBuffer
fprintf( pFile, "%.16d", Size ); fprintf( pFile, "%.16d", Size );
fprintf( pFile, " " ); fprintf( pFile, " " );
RetValue = fwrite( pBuffer, Size, 1, pFile ); RetValue = fwrite( pBuffer, Size, 1, pFile );
assert( RetValue == 1 ); assert( RetValue == 1 || Size == 0);
fflush( pFile ); fflush( pFile );
} }
......
...@@ -44,7 +44,7 @@ static void printlits(lit* begin, lit* end) ...@@ -44,7 +44,7 @@ static void printlits(lit* begin, lit* end)
{ {
int i; int i;
for (i = 0; i < end - begin; i++) for (i = 0; i < end - begin; i++)
printf(L_LIT" ",L_lit(begin[i])); Abc_Print(1,L_LIT" ",L_lit(begin[i]));
} }
//================================================================================================= //=================================================================================================
...@@ -300,7 +300,7 @@ static inline void act_clause_rescale(sat_solver2* s) { ...@@ -300,7 +300,7 @@ static inline void act_clause_rescale(sat_solver2* s) {
s->cla_inc *= (float)1e-20; s->cla_inc *= (float)1e-20;
Total += clock() - clk; Total += clock() - clk;
printf( "Rescaling... Cla inc = %10.3f Conf = %10d ", s->cla_inc, s->stats.conflicts ); Abc_Print(1, "Rescaling... Cla inc = %10.3f Conf = %10d ", s->cla_inc, s->stats.conflicts );
Abc_PrintTime( 1, "Time", Total ); Abc_PrintTime( 1, "Time", Total );
} }
static inline void act_var_bump(sat_solver2* s, int v) { static inline void act_var_bump(sat_solver2* s, int v) {
...@@ -340,7 +340,7 @@ static inline void act_clause_rescale(sat_solver2* s) { ...@@ -340,7 +340,7 @@ static inline void act_clause_rescale(sat_solver2* s) {
s->cla_inc = Abc_MaxInt( s->cla_inc, (1<<10) ); s->cla_inc = Abc_MaxInt( s->cla_inc, (1<<10) );
// Total += clock() - clk; // Total += clock() - clk;
// printf( "Rescaling... Cla inc = %5d Conf = %10d ", s->cla_inc, s->stats.conflicts ); // Abc_Print(1, "Rescaling... Cla inc = %5d Conf = %10d ", s->cla_inc, s->stats.conflicts );
// Abc_PrintTime( 1, "Time", Total ); // Abc_PrintTime( 1, "Time", Total );
} }
static inline void act_var_bump(sat_solver2* s, int v) { static inline void act_var_bump(sat_solver2* s, int v) {
...@@ -382,7 +382,7 @@ static int clause_create_new(sat_solver2* s, lit* begin, lit* end, int learnt, i ...@@ -382,7 +382,7 @@ static int clause_create_new(sat_solver2* s, lit* begin, lit* end, int learnt, i
{ {
int nMemAlloc = s->learnts.cap ? 2 * s->learnts.cap : (1 << 20); int nMemAlloc = s->learnts.cap ? 2 * s->learnts.cap : (1 << 20);
s->learnts.ptr = ABC_REALLOC( int, veci_begin(&s->learnts), nMemAlloc ); s->learnts.ptr = ABC_REALLOC( int, veci_begin(&s->learnts), nMemAlloc );
// printf( "Reallocing from %d to %d...\n", s->learnts.cap, nMemAlloc ); // Abc_Print(1, "Reallocing from %d to %d...\n", s->learnts.cap, nMemAlloc );
s->learnts.cap = nMemAlloc; s->learnts.cap = nMemAlloc;
if ( veci_size(&s->learnts) == 0 ) if ( veci_size(&s->learnts) == 0 )
veci_push( &s->learnts, -1 ); veci_push( &s->learnts, -1 );
...@@ -409,7 +409,7 @@ static int clause_create_new(sat_solver2* s, lit* begin, lit* end, int learnt, i ...@@ -409,7 +409,7 @@ static int clause_create_new(sat_solver2* s, lit* begin, lit* end, int learnt, i
s->learnts.size += satset_size(nLits); s->learnts.size += satset_size(nLits);
assert( veci_size(&s->learnts) <= s->learnts.cap ); assert( veci_size(&s->learnts) <= s->learnts.cap );
assert(((ABC_PTRUINT_T)c & 3) == 0); assert(((ABC_PTRUINT_T)c & 3) == 0);
// printf( "Clause for proof %d: ", proof_id ); // Abc_Print(1, "Clause for proof %d: ", proof_id );
// satset_print( c ); // satset_print( c );
// remember the last one // remember the last one
s->hLearntLast = Cid; s->hLearntLast = Cid;
...@@ -420,7 +420,7 @@ static int clause_create_new(sat_solver2* s, lit* begin, lit* end, int learnt, i ...@@ -420,7 +420,7 @@ static int clause_create_new(sat_solver2* s, lit* begin, lit* end, int learnt, i
{ {
int nMemAlloc = s->clauses.cap ? 2 * s->clauses.cap : (1 << 20); int nMemAlloc = s->clauses.cap ? 2 * s->clauses.cap : (1 << 20);
s->clauses.ptr = ABC_REALLOC( int, veci_begin(&s->clauses), nMemAlloc ); s->clauses.ptr = ABC_REALLOC( int, veci_begin(&s->clauses), nMemAlloc );
// printf( "Reallocing from %d to %d...\n", s->clauses.cap, nMemAlloc ); // Abc_Print(1, "Reallocing from %d to %d...\n", s->clauses.cap, nMemAlloc );
s->clauses.cap = nMemAlloc; s->clauses.cap = nMemAlloc;
if ( veci_size(&s->clauses) == 0 ) if ( veci_size(&s->clauses) == 0 )
veci_push( &s->clauses, -1 ); veci_push( &s->clauses, -1 );
...@@ -457,14 +457,14 @@ static inline int solver2_enqueue(sat_solver2* s, lit l, cla from) ...@@ -457,14 +457,14 @@ static inline int solver2_enqueue(sat_solver2* s, lit l, cla from)
{ {
int v = lit_var(l); int v = lit_var(l);
#ifdef VERBOSEDEBUG #ifdef VERBOSEDEBUG
printf(L_IND"enqueue("L_LIT")\n", L_ind, L_lit(l)); Abc_Print(1,L_IND"enqueue("L_LIT")\n", L_ind, L_lit(l));
#endif #endif
if (var_value(s, v) != varX) if (var_value(s, v) != varX)
return var_value(s, v) == lit_sign(l); return var_value(s, v) == lit_sign(l);
else else
{ // New fact -- store it. { // New fact -- store it.
#ifdef VERBOSEDEBUG #ifdef VERBOSEDEBUG
printf(L_IND"bind("L_LIT")\n", L_ind, L_lit(l)); Abc_Print(1,L_IND"bind("L_LIT")\n", L_ind, L_lit(l));
#endif #endif
var_set_value( s, v, lit_sign(l) ); var_set_value( s, v, lit_sign(l) );
var_set_level( s, v, solver2_dlevel(s) ); var_set_level( s, v, solver2_dlevel(s) );
...@@ -475,11 +475,11 @@ static inline int solver2_enqueue(sat_solver2* s, lit l, cla from) ...@@ -475,11 +475,11 @@ static inline int solver2_enqueue(sat_solver2* s, lit l, cla from)
if ( solver2_dlevel(s) == 0 ) if ( solver2_dlevel(s) == 0 )
{ {
satset * c = from ? clause_read( s, from ) : NULL; satset * c = from ? clause_read( s, from ) : NULL;
printf( "Enqueing var %d on level %d with reason clause ", v, solver2_dlevel(s) ); Abc_Print(1, "Enqueing var %d on level %d with reason clause ", v, solver2_dlevel(s) );
if ( c ) if ( c )
satset_print( c ); satset_print( c );
else else
printf( "<none>\n" ); Abc_Print(1, "<none>\n" );
} }
*/ */
return true; return true;
...@@ -491,8 +491,8 @@ static inline int solver2_assume(sat_solver2* s, lit l) ...@@ -491,8 +491,8 @@ static inline int solver2_assume(sat_solver2* s, lit l)
assert(s->qtail == s->qhead); assert(s->qtail == s->qhead);
assert(var_value(s, lit_var(l)) == varX); assert(var_value(s, lit_var(l)) == varX);
#ifdef VERBOSEDEBUG #ifdef VERBOSEDEBUG
printf(L_IND"assume("L_LIT") ", L_ind, L_lit(l)); Abc_Print(1,L_IND"assume("L_LIT") ", L_ind, L_lit(l));
printf( "act = %.20f\n", s->activity[lit_var(l)] ); Abc_Print(1, "act = %.20f\n", s->activity[lit_var(l)] );
#endif #endif
veci_push(&s->trail_lim,s->qtail); veci_push(&s->trail_lim,s->qtail);
return solver2_enqueue(s,l,0); return solver2_enqueue(s,l,0);
...@@ -764,7 +764,7 @@ static void solver2_logging_order(sat_solver2* s, int x) ...@@ -764,7 +764,7 @@ static void solver2_logging_order(sat_solver2* s, int x)
x >>= 1; x >>= 1;
c = clause_read(s, var_reason(s,x)); c = clause_read(s, var_reason(s,x));
// if ( !c ) // if ( !c )
// printf( "solver2_logging_order(): Error in conflict analysis!!!\n" ); // Abc_Print(1, "solver2_logging_order(): Error in conflict analysis!!!\n" );
satset_foreach_var( c, x, i, 1 ){ satset_foreach_var( c, x, i, 1 ){
if ( !var_level(s,x) || (var_tag(s,x) & 1) ) if ( !var_level(s,x) || (var_tag(s,x) & 1) )
continue; continue;
...@@ -886,8 +886,8 @@ static int solver2_analyze(sat_solver2* s, satset* c, veci* learnt) ...@@ -886,8 +886,8 @@ static int solver2_analyze(sat_solver2* s, satset* c, veci* learnt)
#endif #endif
#ifdef VERBOSEDEBUG #ifdef VERBOSEDEBUG
printf(L_IND"Learnt {", L_ind); Abc_Print(1,L_IND"Learnt {", L_ind);
for (i = 0; i < veci_size(learnt); i++) printf(" "L_LIT, L_lit(lits[i])); for (i = 0; i < veci_size(learnt); i++) Abc_Print(1," "L_LIT, L_lit(lits[i]));
#endif #endif
if (veci_size(learnt) > 1){ if (veci_size(learnt) > 1){
lit tmp; lit tmp;
...@@ -906,7 +906,7 @@ static int solver2_analyze(sat_solver2* s, satset* c, veci* learnt) ...@@ -906,7 +906,7 @@ static int solver2_analyze(sat_solver2* s, satset* c, veci* learnt)
#ifdef VERBOSEDEBUG #ifdef VERBOSEDEBUG
{ {
int lev = veci_size(learnt) > 1 ? var_level(s, lit_var(lits[1])) : 0; int lev = veci_size(learnt) > 1 ? var_level(s, lit_var(lits[1])) : 0;
printf(" } at level %d\n", lev); Abc_Print(1," } at level %d\n", lev);
} }
#endif #endif
return proof_id; return proof_id;
...@@ -1029,7 +1029,7 @@ static lbool solver2_search(sat_solver2* s, ABC_INT64_T nof_conflicts) ...@@ -1029,7 +1029,7 @@ static lbool solver2_search(sat_solver2* s, ABC_INT64_T nof_conflicts)
int blevel; int blevel;
#ifdef VERBOSEDEBUG #ifdef VERBOSEDEBUG
printf(L_IND"**CONFLICT**\n", L_ind); Abc_Print(1,L_IND"**CONFLICT**\n", L_ind);
#endif #endif
s->stats.conflicts++; conflictC++; s->stats.conflicts++; conflictC++;
if (solver2_dlevel(s) <= s->root_level){ if (solver2_dlevel(s) <= s->root_level){
...@@ -1242,7 +1242,7 @@ void sat_solver2_delete(sat_solver2* s) ...@@ -1242,7 +1242,7 @@ void sat_solver2_delete(sat_solver2* s)
if ( fVerify ) if ( fVerify )
{ {
veci * pCore = (veci *)Sat_ProofCore( s ); veci * pCore = (veci *)Sat_ProofCore( s );
printf( "UNSAT core contains %d clauses (%6.2f %%).\n", veci_size(pCore), 100.0*veci_size(pCore)/veci_size(&s->clauses) ); Abc_Print(1, "UNSAT core contains %d clauses (%6.2f %%).\n", veci_size(pCore), 100.0*veci_size(pCore)/veci_size(&s->clauses) );
veci_delete( pCore ); veci_delete( pCore );
ABC_FREE( pCore ); ABC_FREE( pCore );
if ( s->fProofLogging ) if ( s->fProofLogging )
...@@ -1250,7 +1250,7 @@ void sat_solver2_delete(sat_solver2* s) ...@@ -1250,7 +1250,7 @@ void sat_solver2_delete(sat_solver2* s)
} }
// report statistics // report statistics
printf( "Used %6.2f Mb for proof-logging. Unit clauses = %d.\n", 1.0 * Vec_SetMemory(&s->Proofs) / (1<<20), s->nUnits ); Abc_Print(1, "Used %6.2f Mb for proof-logging. Unit clauses = %d.\n", 1.0 * Vec_SetMemory(&s->Proofs) / (1<<20), s->nUnits );
// delete vectors // delete vectors
veci_delete(&s->order); veci_delete(&s->order);
...@@ -1390,8 +1390,8 @@ void luby2_test() ...@@ -1390,8 +1390,8 @@ void luby2_test()
{ {
int i; int i;
for ( i = 0; i < 20; i++ ) for ( i = 0; i < 20; i++ )
printf( "%d ", (int)luby2(2,i) ); Abc_Print(1, "%d ", (int)luby2(2,i) );
printf( "\n" ); Abc_Print(1, "\n" );
} }
...@@ -1434,7 +1434,7 @@ void sat_solver2_reducedb(sat_solver2* s) ...@@ -1434,7 +1434,7 @@ void sat_solver2_reducedb(sat_solver2* s)
} }
// report the results // report the results
if ( s->fVerbose ) if ( s->fVerbose )
printf( "reduceDB: Keeping %7d out of %7d clauses (%5.2f %%) ", Abc_Print(1, "reduceDB: Keeping %7d out of %7d clauses (%5.2f %%) ",
veci_size(&s->learnt_live), s->stats.learnts, 100.0 * veci_size(&s->learnt_live) / s->stats.learnts ); veci_size(&s->learnt_live), s->stats.learnts, 100.0 * veci_size(&s->learnt_live) / s->stats.learnts );
// remap clause proofs and clauses // remap clause proofs and clauses
...@@ -1631,7 +1631,7 @@ int sat_solver2_find_clause( sat_solver2* s, int Hand, int fVerbose ) ...@@ -1631,7 +1631,7 @@ int sat_solver2_find_clause( sat_solver2* s, int Hand, int fVerbose )
if ( (pArray[k] >> 1) == Hand ) if ( (pArray[k] >> 1) == Hand )
{ {
if ( fVerbose ) if ( fVerbose )
printf( "Clause found in list %d at position %d.\n", i, k ); Abc_Print(1, "Clause found in list %d at position %d.\n", i, k );
Found = 1; Found = 1;
break; break;
} }
...@@ -1639,7 +1639,7 @@ int sat_solver2_find_clause( sat_solver2* s, int Hand, int fVerbose ) ...@@ -1639,7 +1639,7 @@ int sat_solver2_find_clause( sat_solver2* s, int Hand, int fVerbose )
if ( Found == 0 ) if ( Found == 0 )
{ {
if ( fVerbose ) if ( fVerbose )
printf( "Clause with handle %d is not found.\n", Hand ); Abc_Print(1, "Clause with handle %d is not found.\n", Hand );
} }
return Found; return Found;
} }
...@@ -1659,16 +1659,16 @@ void sat_solver2_verify( sat_solver2* s ) ...@@ -1659,16 +1659,16 @@ void sat_solver2_verify( sat_solver2* s )
} }
if ( k == (int)c->nEnts ) if ( k == (int)c->nEnts )
{ {
printf( "Clause %d is not satisfied. ", c->Id ); Abc_Print(1, "Clause %d is not satisfied. ", c->Id );
satset_print( c ); satset_print( c );
sat_solver2_find_clause( s, satset_handle(&s->clauses, c), 1 ); sat_solver2_find_clause( s, satset_handle(&s->clauses, c), 1 );
Counter++; Counter++;
} }
} }
if ( Counter != 0 ) if ( Counter != 0 )
printf( "Verification failed!\n" ); Abc_Print(1, "Verification failed!\n" );
// else // else
// printf( "Verification passed.\n" ); // Abc_Print(1, "Verification passed.\n" );
} }
...@@ -1775,16 +1775,16 @@ int sat_solver2_solve(sat_solver2* s, lit* begin, lit* end, ABC_INT64_T nConfLim ...@@ -1775,16 +1775,16 @@ int sat_solver2_solve(sat_solver2* s, lit* begin, lit* end, ABC_INT64_T nConfLim
assert(s->root_level == solver2_dlevel(s)); assert(s->root_level == solver2_dlevel(s));
if (s->verbosity >= 1){ if (s->verbosity >= 1){
printf("==================================[MINISAT]===================================\n"); Abc_Print(1,"==================================[MINISAT]===================================\n");
printf("| Conflicts | ORIGINAL | LEARNT | Progress |\n"); Abc_Print(1,"| Conflicts | ORIGINAL | LEARNT | Progress |\n");
printf("| | Clauses Literals | Limit Clauses Literals Lit/Cl | |\n"); Abc_Print(1,"| | Clauses Literals | Limit Clauses Literals Lit/Cl | |\n");
printf("==============================================================================\n"); Abc_Print(1,"==============================================================================\n");
} }
while (status == l_Undef){ while (status == l_Undef){
if (s->verbosity >= 1) if (s->verbosity >= 1)
{ {
printf("| %9.0f | %7.0f %8.0f | %7.0f %7.0f %8.0f %7.1f | %6.3f %% |\n", Abc_Print(1,"| %9.0f | %7.0f %8.0f | %7.0f %7.0f %8.0f %7.1f | %6.3f %% |\n",
(double)s->stats.conflicts, (double)s->stats.conflicts,
(double)s->stats.clauses, (double)s->stats.clauses,
(double)s->stats.clauses_literals, (double)s->stats.clauses_literals,
...@@ -1809,7 +1809,7 @@ int sat_solver2_solve(sat_solver2* s, lit* begin, lit* end, ABC_INT64_T nConfLim ...@@ -1809,7 +1809,7 @@ int sat_solver2_solve(sat_solver2* s, lit* begin, lit* end, ABC_INT64_T nConfLim
break; break;
} }
if (s->verbosity >= 1) if (s->verbosity >= 1)
printf("==============================================================================\n"); Abc_Print(1,"==============================================================================\n");
solver2_canceluntil(s,0); solver2_canceluntil(s,0);
// assert( s->qhead == s->qtail ); // assert( s->qhead == s->qtail );
...@@ -1820,4 +1820,3 @@ int sat_solver2_solve(sat_solver2* s, lit* begin, lit* end, ABC_INT64_T nConfLim ...@@ -1820,4 +1820,3 @@ int sat_solver2_solve(sat_solver2* s, lit* begin, lit* end, ABC_INT64_T nConfLim
ABC_NAMESPACE_IMPL_END ABC_NAMESPACE_IMPL_END
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment