src/base/io/ioWriteCnf.c File Reference

#include "io.h"
#include "satSolver.h"
Include dependency graph for ioWriteCnf.c:

Go to the source code of this file.

Functions

int Io_WriteCnf (Abc_Ntk_t *pNtk, char *pFileName, int fAllPrimes)
void Io_WriteCnfOutputPiMapping (FILE *pFile, int incrementVars)

Variables

static Abc_Ntk_ts_pNtk = NULL

Function Documentation

int Io_WriteCnf ( Abc_Ntk_t pNtk,
char *  pFileName,
int  fAllPrimes 
)

FUNCTION DEFINITIONS ///Function*************************************************************

Synopsis [Write the miter cone into a CNF file for the SAT solver.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file ioWriteCnf.c.

00046 {
00047     sat_solver * pSat;
00048     if ( Abc_NtkIsStrash(pNtk) )
00049         printf( "Io_WriteCnf() warning: Generating CNF by applying heuristic AIG to CNF conversion.\n" );
00050     else
00051         printf( "Io_WriteCnf() warning: Generating CNF by convering logic nodes into CNF clauses.\n" );
00052     if ( Abc_NtkPoNum(pNtk) != 1 )
00053     {
00054         fprintf( stdout, "Io_WriteCnf(): Currently can only process the miter (the network with one PO).\n" );
00055         return 0;
00056     }
00057     if ( Abc_NtkLatchNum(pNtk) != 0 )
00058     {
00059         fprintf( stdout, "Io_WriteCnf(): Currently can only process the miter for combinational circuits.\n" );
00060         return 0;
00061     }
00062     if ( Abc_NtkNodeNum(pNtk) == 0 )
00063     {
00064         fprintf( stdout, "The network has no logic nodes. No CNF file is generaled.\n" );
00065         return 0;
00066     }
00067     // convert to logic BDD network
00068     if ( Abc_NtkIsLogic(pNtk) )
00069         Abc_NtkToBdd( pNtk );
00070     // create solver with clauses
00071     pSat = Abc_NtkMiterSatCreate( pNtk, fAllPrimes );
00072     if ( pSat == NULL )
00073     {
00074         fprintf( stdout, "The problem is trivially UNSAT. No CNF file is generated.\n" );
00075         return 1;
00076     }        
00077     // write the clauses
00078     s_pNtk = pNtk;
00079     Sat_SolverWriteDimacs( pSat, pFileName, 0, 0, 1 );
00080     s_pNtk = NULL;
00081     // free the solver
00082     sat_solver_delete( pSat );
00083     return 1;
00084 }

void Io_WriteCnfOutputPiMapping ( FILE *  pFile,
int  incrementVars 
)

Function*************************************************************

Synopsis [Output the mapping of PIs into variable numbers.]

Description []

SideEffects []

SeeAlso []

Definition at line 97 of file ioWriteCnf.c.

00098 {
00099     extern Vec_Int_t * Abc_NtkGetCiSatVarNums( Abc_Ntk_t * pNtk );
00100     Abc_Ntk_t * pNtk = s_pNtk;
00101     Vec_Int_t * vCiIds;
00102     Abc_Obj_t * pObj;
00103     int i;
00104     vCiIds = Abc_NtkGetCiSatVarNums( pNtk );
00105     fprintf( pFile, "c PI variable numbers: <PI_name> <SAT_var_number>\n" );
00106     Abc_NtkForEachCi( pNtk, pObj, i )
00107         fprintf( pFile, "c %s %d\n", Abc_ObjName(pObj), Vec_IntEntry(vCiIds, i) + (int)(incrementVars > 0) );
00108     Vec_IntFree( vCiIds );
00109 }


Variable Documentation

Abc_Ntk_t* s_pNtk = NULL [static]

CFile****************************************************************

FileName [ioWriteCnf.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Command processing package.]

Synopsis [Procedures to output CNF of the miter cone.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id
ioWriteCnf.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

] DECLARATIONS ///

Definition at line 28 of file ioWriteCnf.c.


Generated on Tue Jan 5 12:18:47 2010 for abc70930 by  doxygen 1.6.1