ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
AbcGlucoseCmd2.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 Glucose2_Init( Abc_Frame_t *pAbc );
30extern void Glucose2_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", "&glucose2", 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
85 Glucose2_Pars pPars;
87 while ( ( c = Extra_UtilGetopt( argc, argv, "Cpvh" ) ) != EOF )
88 {
89 switch ( c )
90 {
91 case 'C':
92 if ( globalUtilOptind >= argc )
93 {
94 Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" );
95 goto usage;
96 }
97 nConfls = atoi(argv[globalUtilOptind]);
99 if ( nConfls < 0 )
100 goto usage;
101 break;
102 case 'p':
103 pre ^= 1;
104 break;
105 case 'v':
106 verb ^= 1;
107 break;
108 case 'h':
109 goto usage;
110 default:
111 goto usage;
112 }
113 }
114
115 pPars = Glucose_CreatePars(pre,verb,0,nConfls);
116
117 if ( argc == globalUtilOptind + 1 )
118 {
119 Glucose2_SolveCnf( argv[globalUtilOptind], &pPars );
120 return 0;
121 }
122
123 if ( pAbc->pGia == NULL )
124 {
125 Abc_Print( -1, "Abc_CommandGlucose(): There is no AIG.\n" );
126 return 1;
127 }
128
129 if ( Glucose2_SolveAig( pAbc->pGia, &pPars ) == 10 )
130 Abc_FrameReplaceCex( pAbc, &pAbc->pGia->pCexComb );
131
132 return 0;
133
134usage:
135 Abc_Print( -2, "usage: &glucose2 [-C num] [-pvh] <file.cnf>\n" );
136 Abc_Print( -2, "\t run Glucose 3.0 by Gilles Audemard and Laurent Simon\n" );
137 Abc_Print( -2, "\t-C num : conflict limit [default = %d]\n", nConfls );
138 Abc_Print( -2, "\t-p : enable preprocessing [default = %d]\n",pre);
139 Abc_Print( -2, "\t-v : verbosity [default = %d]\n",verb);
140 Abc_Print( -2, "\t-h : print the command usage\n");
141 Abc_Print( -2, "\t<file.cnf> : (optional) CNF file to solve\n");
142 return 1;
143}
144
148
void Glucose2_SolveCnf(char *pFileName, Glucose2_Pars *pPars)
int Glucose2_SolveAig(Gia_Man_t *p, Glucose2_Pars *pPars)
typedefABC_NAMESPACE_HEADER_START struct Glucose2_Pars_ Glucose2_Pars
BASIC TYPES ///.
Definition AbcGlucose2.h:45
ABC_NAMESPACE_HEADER_START void Glucose2_Init(Abc_Frame_t *pAbc)
FUNCTION DEFINITIONS ///.
void Glucose2_End(Abc_Frame_t *pAbc)
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