ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
AbcGlucoseCmd.cpp
Go to the documentation of this file.
1
20
21#include "aig/gia/gia.h"
22#include "base/main/mainInt.h"
23
25
26
28
29extern void Glucose_Init( Abc_Frame_t *pAbc );
30extern void Glucose_End( Abc_Frame_t * pAbc );
31
33
35
39
40static int Abc_CommandGlucose( Abc_Frame_t * pAbc, int argc, char ** argv );
41
45
57
59{
60 Cmd_CommandAdd( pAbc, "ABC9", "&glucose", Abc_CommandGlucose, 0 );
61}
62
64{
65}
66
78int Abc_CommandGlucose( Abc_Frame_t * pAbc, int argc, char ** argv )
79{
80 int c = 0;
81 int pre = 1;
82 int verb = 0;
83 int nConfls = 0;
84 int fDumpCnf = 0;
85
86 Glucose_Pars pPars;
88 while ( ( c = Extra_UtilGetopt( argc, argv, "Cpdvh" ) ) != EOF )
89 {
90 switch ( c )
91 {
92 case 'C':
93 if ( globalUtilOptind >= argc )
94 {
95 Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" );
96 goto usage;
97 }
98 nConfls = atoi(argv[globalUtilOptind]);
100 if ( nConfls < 0 )
101 goto usage;
102 break;
103 case 'p':
104 pre ^= 1;
105 break;
106 case 'd':
107 fDumpCnf ^= 1;
108 break;
109 case 'v':
110 verb ^= 1;
111 break;
112 case 'h':
113 goto usage;
114 default:
115 goto usage;
116 }
117 }
118
119 pPars = Glucose_CreatePars(pre,verb,0,nConfls);
120
121 if ( argc == globalUtilOptind + 1 )
122 {
123 Glucose_SolveCnf( argv[globalUtilOptind], &pPars, fDumpCnf );
124 return 0;
125 }
126
127 if ( pAbc->pGia == NULL )
128 {
129 Abc_Print( -1, "Abc_CommandGlucose(): There is no AIG.\n" );
130 return 1;
131 }
132
133 if ( Glucose_SolveAig( pAbc->pGia, &pPars ) == 10 )
134 Abc_FrameReplaceCex( pAbc, &pAbc->pGia->pCexComb );
135
136 return 0;
137
138usage:
139 Abc_Print( -2, "usage: &glucose [-C num] [-pdvh] <file.cnf>\n" );
140 Abc_Print( -2, "\t run Glucose 3.0 by Gilles Audemard and Laurent Simon\n" );
141 Abc_Print( -2, "\t-C num : conflict limit [default = %d]\n", nConfls );
142 Abc_Print( -2, "\t-p : enable preprocessing [default = %d]\n",pre);
143 Abc_Print( -2, "\t-d : enable dumping CNF after proprocessing [default = %d]\n",fDumpCnf);
144 Abc_Print( -2, "\t-v : verbosity [default = %d]\n",verb);
145 Abc_Print( -2, "\t-h : print the command usage\n");
146 Abc_Print( -2, "\t<file.cnf> : (optional) CNF file to solve\n");
147 return 1;
148}
149
153
ABC_NAMESPACE_HEADER_START void Glucose_Init(Abc_Frame_t *pAbc)
FUNCTION DEFINITIONS ///.
void Glucose_End(Abc_Frame_t *pAbc)
void Glucose_SolveCnf(char *pFileName, Glucose_Pars *pPars, int fDumpCnf)
int Glucose_SolveAig(Gia_Man_t *p, Glucose_Pars *pPars)
typedefABC_NAMESPACE_HEADER_START struct Glucose_Pars_ Glucose_Pars
BASIC TYPES ///.
Definition AbcGlucose.h:45
void Abc_FrameReplaceCex(Abc_Frame_t *pAbc, Abc_Cex_t **ppCex)
FUNCTION DEFINITIONS ///.
Definition abc.c:679
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
#define ABC_NAMESPACE_HEADER_END
#define ABC_NAMESPACE_HEADER_START
NAMESPACES ///.
typedefABC_NAMESPACE_HEADER_START struct Abc_Frame_t_ Abc_Frame_t
INCLUDES ///.
Definition abcapis.h:38
void Cmd_CommandAdd(Abc_Frame_t *pAbc, const char *sGroup, const char *sName, Cmd_CommandFuncType pFunc, int fChanges)
Definition cmdApi.c:63
int globalUtilOptind
int Extra_UtilGetopt(int argc, char *argv[], const char *optstring)
ABC_DLL void Extra_UtilGetoptReset()
usage()
Definition main.c:626