Ignore:
Timestamp:
Jan 10, 2012, 6:51:23 PM (12 years ago)
Author:
cecile
Message:

new command generate cnf from network

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vis_dev/vis-2.3/src/debug/debugUtilities.c

    r35 r41  
    8787  return;
    8888}
     89/**Function********************************************************************
     90 
     91  Synopsis    [Performs the sat call]
     92
     93  Description [Retrun the result of SAT call, avec positionnement des options]
     94  SideEffects []
     95
     96  SeeAlso     []
     97
     98******************************************************************************/
     99
     100int Dbg_SatCheck(char * forceAssigName, char * cnfFileName
     101)
     102{
     103 satManager_t *cm;
     104 cm = sat_InitManager(0);
     105 cm->comment = ALLOC(char, 2);
     106 cm->comment[0] = ' ';
     107 cm->comment[1] = '\0';
     108 cm->stdOut = stdout;
     109 cm->stdErr = stderr;
     110
     111 
     112  satOption_t  *satOption;
     113  array_t      *result = NIL(array_t);
     114  int          maxSize;
     115
     116  satOption = sat_InitOption();
     117  satOption->verbose = 2;
     118  //satOption->unsatCoreFileName = "Ucore.txt";
     119  satOption->clauseDeletionHeuristic = 0;
     120  //satOption->coreGeneration = 1 ;
     121  //satOption->minimizeConflictClause = 1;
     122  if(forceAssigName != NULL)
     123    satOption->forcedAssignArr = sat_ReadForcedAssignment(forceAssigName);
     124   cm->option = satOption;
     125   cm->each = sat_InitStatistics();
     126
     127  cm->unitLits = sat_ArrayAlloc(16);
     128  cm->pureLits = sat_ArrayAlloc(16);
     129
     130  maxSize = 1024 << 8;
     131  cm->nodesArray = ALLOC(long, maxSize);
     132  cm->maxNodesArraySize = maxSize;
     133  cm->nodesArraySize = satNodeSize;
     134
     135  sat_AllocLiteralsDB(cm);
     136
     137   sat_ReadCNF(cm,cnfFileName);
     138   sat_Main(cm);
     139
     140   if(cm->status == SAT_UNSAT) {
     141    if(cm->option->forcedAssignArr)
     142      fprintf(cm->stdOut, "%s UNSAT under given assignment\n",
     143              cm->comment);
     144    fprintf(cm->stdOut, "%s UNSATISFIABLE\n", cm->comment);
     145    fflush(cm->stdOut);
     146    sat_ReportStatistics(cm, cm->each);
     147    sat_FreeManager(cm);
     148  }
     149  else if(cm->status == SAT_SAT) {
     150    fprintf(cm->stdOut, "%s SATISFIABLE\n", cm->comment);
     151    fflush(cm->stdOut);
     152    sat_PrintSatisfyingAssignment(cm);
     153    sat_ReportStatistics(cm, cm->each);
     154    sat_FreeManager(cm);
     155  }
     156return cm->status;
     157}
     158/**Function********************************************************************
     159 
     160  Synopsis    [Generate a CNF of the network]
     161
     162  Description [Generate the set of clauses of the unroll network for a given
     163  length and for a given cone of influence]
     164  SideEffects []
     165
     166  SeeAlso     []
     167
     168******************************************************************************/
     169BmcCnfClauses_t*
     170Dbg_GenerateCNF(Ntk_Network_t * network,
     171BmcOption_t * options,
     172st_table  *CoiTable
     173){
     174st_table          *nodeToMvfAigTable = NIL(st_table);  /* node to mvfAig */
     175BmcCnfClauses_t   *cnfClauses = NIL(BmcCnfClauses_t);
     176/*
     177 *nodeToMvfAigTable maps each node to its multi-function And/Inv graph
     178 */
     179nodeToMvfAigTable =
     180(st_table *) Ntk_NetworkReadApplInfo(network, MVFAIG_NETWORK_APPL_KEY);
     181assert(nodeToMvfAigTable != NIL(st_table));
     182/*
     183 * Create a clause database
     184 */
     185cnfClauses = BmcCnfClausesAlloc();
     186/*
     187 * Generate clauses for an initialized path of length k
     188 */
     189BmcCnfGenerateClausesForPath(network, 0, options->maxK, BMC_INITIAL_STATES,
     190                         cnfClauses, nodeToMvfAigTable, CoiTable);
     191return cnfClauses;
     192
     193}
Note: See TracChangeset for help on using the changeset viewer.