abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
csat_apis.h
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [csat_apis.h]
4 
5  PackageName [Interface to CSAT.]
6 
7  Synopsis [APIs, enums, and data structures expected from the use of CSAT.]
8 
9  Author [Alan Mishchenko <alanmi@eecs.berkeley.edu>]
10 
11  Affiliation [UC Berkeley]
12 
13  Date [Ver. 1.0. Started - August 28, 2005]
14 
15  Revision [$Id: csat_apis.h,v 1.5 2005/12/30 10:54:40 rmukherj Exp $]
16 
17 ***********************************************************************/
18 
19 #ifndef ABC__sat__csat__csat_apis_h
20 #define ABC__sat__csat__csat_apis_h
21 
22 
23 ////////////////////////////////////////////////////////////////////////
24 /// INCLUDES ///
25 ////////////////////////////////////////////////////////////////////////
26 
27 ////////////////////////////////////////////////////////////////////////
28 /// PARAMETERS ///
29 ////////////////////////////////////////////////////////////////////////
30 
31 
32 
34 
35 
36 ////////////////////////////////////////////////////////////////////////
37 /// STRUCTURE DEFINITIONS ///
38 ////////////////////////////////////////////////////////////////////////
39 
40 
43 
44 
45 // GateType defines the gate type that can be added to circuit by
46 // ABC_AddGate();
47 #ifndef _ABC_GATE_TYPE_
48 #define _ABC_GATE_TYPE_
50 {
51  CSAT_CONST = 0, // constant gate
52  CSAT_BPI, // boolean PI
53  CSAT_BPPI, // bit level PSEUDO PRIMARY INPUT
54  CSAT_BAND, // bit level AND
55  CSAT_BNAND, // bit level NAND
56  CSAT_BOR, // bit level OR
57  CSAT_BNOR, // bit level NOR
58  CSAT_BXOR, // bit level XOR
59  CSAT_BXNOR, // bit level XNOR
60  CSAT_BINV, // bit level INVERTER
61  CSAT_BBUF, // bit level BUFFER
62  CSAT_BMUX, // bit level MUX --not supported
63  CSAT_BDFF, // bit level D-type FF
64  CSAT_BSDFF, // bit level scan FF --not supported
65  CSAT_BTRIH, // bit level TRISTATE gate with active high control --not supported
66  CSAT_BTRIL, // bit level TRISTATE gate with active low control --not supported
67  CSAT_BBUS, // bit level BUS --not supported
68  CSAT_BPPO, // bit level PSEUDO PRIMARY OUTPUT
69  CSAT_BPO, // boolean PO
70  CSAT_BCNF, // boolean constraint
71  CSAT_BDC, // boolean don't care gate (2 input)
72 };
73 #endif
74 
75 
76 //CSAT_StatusT defines the return value by ABC_Solve();
77 #ifndef _ABC_STATUS_
78 #define _ABC_STATUS_
80 {
89 };
90 #endif
91 
92 
93 // to identify who called the CSAT solver
94 #ifndef _ABC_CALLER_
95 #define _ABC_CALLER_
97 {
98  BLS = 0,
101 };
102 #endif
103 
104 
105 // CSAT_OptionT defines the solver option about learning
106 // which is used by ABC_SetSolveOption();
107 #ifndef _ABC_OPTION_
108 #define _ABC_OPTION_
110 {
112  IMPLICT_LEARNING, //default
114 };
115 #endif
116 
117 
118 #ifndef _ABC_Target_Result
119 #define _ABC_Target_Result
122 {
123  enum CSAT_StatusT status; // solve status of the target
124  int num_dec; // num of decisions to solve the target
125  int num_imp; // num of implications to solve the target
126  int num_cftg; // num of conflict gates learned
127  int num_cfts; // num of conflict signals in conflict gates
128  double time; // time(in second) used to solve the target
129  int no_sig; // if "status" is SATISFIABLE, "no_sig" is the number of
130  // primary inputs, if the "status" is TIME_OUT, "no_sig" is the
131  // number of constant signals found.
132  char** names; // if the "status" is SATISFIABLE, "names" is the name array of
133  // primary inputs, "values" is the value array of primary
134  // inputs that satisfy the target.
135  // if the "status" is TIME_OUT, "names" is the name array of
136  // constant signals found (signals at the root of decision
137  // tree), "values" is the value array of constant signals found.
138  int* values;
139 };
140 #endif
141 
142 ////////////////////////////////////////////////////////////////////////
143 /// FUNCTION DEFINITIONS ///
144 ////////////////////////////////////////////////////////////////////////
145 
146 // create a new manager
147 extern ABC_Manager ABC_InitManager(void);
148 
149 // release a manager
150 extern void ABC_ReleaseManager(ABC_Manager mng);
151 
152 // set solver options for learning
153 extern void ABC_SetSolveOption(ABC_Manager mng, enum CSAT_OptionT option);
154 
155 // enable checking by brute-force SAT solver (MiniSat-1.14)
156 extern void ABC_UseOnlyCoreSatSolver(ABC_Manager mng);
157 
158 
159 // add a gate to the circuit
160 // the meaning of the parameters are:
161 // type: the type of the gate to be added
162 // name: the name of the gate to be added, name should be unique in a circuit.
163 // nofi: number of fanins of the gate to be added;
164 // fanins: the name array of fanins of the gate to be added
165 extern int ABC_AddGate(ABC_Manager mng,
166  enum GateType type,
167  char* name,
168  int nofi,
169  char** fanins,
170  int dc_attr);
171 
172 // check if there are gates that are not used by any primary ouput.
173 // if no such gates exist, return 1 else return 0;
174 extern int ABC_Check_Integrity(ABC_Manager mng);
175 
176 // THIS PROCEDURE SHOULD BE CALLED AFTER THE NETWORK IS CONSTRUCTED!!!
177 extern void ABC_Network_Finalize( ABC_Manager mng );
178 
179 // set time limit for solving a target.
180 // runtime: time limit (in second).
181 extern void ABC_SetTimeLimit(ABC_Manager mng, int runtime);
182 extern void ABC_SetLearnLimit(ABC_Manager mng, int num);
183 extern void ABC_SetSolveBacktrackLimit(ABC_Manager mng, int num);
184 extern void ABC_SetLearnBacktrackLimit(ABC_Manager mng, int num);
185 extern void ABC_EnableDump(ABC_Manager mng, char* dump_file);
186 
187 extern void ABC_SetTotalBacktrackLimit( ABC_Manager mng, ABC_UINT64_T num );
188 extern void ABC_SetTotalInspectLimit( ABC_Manager mng, ABC_UINT64_T num );
189 extern ABC_UINT64_T ABC_GetTotalBacktracksMade( ABC_Manager mng );
190 extern ABC_UINT64_T ABC_GetTotalInspectsMade( ABC_Manager mng );
191 
192 // the meaning of the parameters are:
193 // nog: number of gates that are in the targets
194 // names: name array of gates
195 // values: value array of the corresponding gates given in "names" to be
196 // solved. the relation of them is AND.
197 extern int ABC_AddTarget(ABC_Manager mng, int nog, char**names, int* values);
198 
199 // initialize the solver internal data structure.
200 extern void ABC_SolveInit(ABC_Manager mng);
201 extern void ABC_AnalyzeTargets(ABC_Manager mng);
202 
203 // solve the targets added by ABC_AddTarget()
204 extern enum CSAT_StatusT ABC_Solve(ABC_Manager mng);
205 
206 // get the solve status of a target
207 // TargetID: the target id returned by ABC_AddTarget().
208 extern CSAT_Target_ResultT * ABC_Get_Target_Result(ABC_Manager mng, int TargetID);
209 extern void ABC_Dump_Bench_File(ABC_Manager mng);
210 
211 // ADDED PROCEDURES:
212 extern void ABC_TargetResFree( CSAT_Target_ResultT * p );
213 
214 extern void CSAT_SetCaller(ABC_Manager mng, enum CSAT_CallerT caller);
215 
216 
217 
219 
220 
221 
222 #endif
223 
224 ////////////////////////////////////////////////////////////////////////
225 /// END OF FILE ///
226 ////////////////////////////////////////////////////////////////////////
CSAT_StatusT
Definition: csat_apis.h:79
int ABC_Check_Integrity(ABC_Manager mng)
Definition: csat_apis.c:332
void ABC_EnableDump(ABC_Manager mng, char *dump_file)
Definition: csat_apis.c:513
ABC_Manager ABC_InitManager(void)
FUNCTION DEFINITIONS ///.
Definition: csat_apis.c:81
void CSAT_SetCaller(ABC_Manager mng, enum CSAT_CallerT caller)
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int ABC_AddTarget(ABC_Manager mng, int nog, char **names, int *values)
Definition: csat_apis.c:534
ABC_UINT64_T ABC_GetTotalBacktracksMade(ABC_Manager mng)
Definition: csat_apis.c:481
void ABC_SolveInit(ABC_Manager mng)
Definition: csat_apis.c:570
void ABC_Dump_Bench_File(ABC_Manager mng)
Definition: csat_apis.c:680
ABC_UINT64_T ABC_GetTotalInspectsMade(ABC_Manager mng)
Definition: csat_apis.c:497
void ABC_SetTimeLimit(ABC_Manager mng, int runtime)
Definition: csat_apis.c:370
GateType
Definition: csat_apis.h:49
void ABC_SetSolveBacktrackLimit(ABC_Manager mng, int num)
Definition: csat_apis.c:418
enum CSAT_StatusT ABC_Solve(ABC_Manager mng)
Definition: csat_apis.c:611
char * name
void ABC_Network_Finalize(ABC_Manager mng)
Definition: csat_apis.c:308
void ABC_UseOnlyCoreSatSolver(ABC_Manager mng)
Definition: csat_apis.c:155
void ABC_SetTotalInspectLimit(ABC_Manager mng, ABC_UINT64_T num)
Definition: csat_apis.c:466
void ABC_ReleaseManager(ABC_Manager mng)
Definition: csat_apis.c:113
enum CSAT_StatusT status
Definition: csat_apis.h:123
#define ABC_NAMESPACE_HEADER_START
NAMESPACES ///.
Definition: abc_global.h:105
void ABC_SetTotalBacktrackLimit(ABC_Manager mng, ABC_UINT64_T num)
Definition: csat_apis.c:450
typedefABC_NAMESPACE_HEADER_START struct ABC_ManagerStruct_t ABC_Manager_t
INCLUDES ///.
Definition: csat_apis.h:41
int ABC_AddGate(ABC_Manager mng, enum GateType type, char *name, int nofi, char **fanins, int dc_attr)
Definition: csat_apis.c:175
#define ABC_NAMESPACE_HEADER_END
Definition: abc_global.h:106
void ABC_SetLearnBacktrackLimit(ABC_Manager mng, int num)
Definition: csat_apis.c:402
CSAT_OptionT
Definition: csat_apis.h:109
runtime()
void ABC_AnalyzeTargets(ABC_Manager mng)
Definition: csat_apis.c:596
void ABC_TargetResFree(CSAT_Target_ResultT *p)
Definition: csat_apis.c:733
void ABC_SetSolveOption(ABC_Manager mng, enum CSAT_OptionT option)
Definition: csat_apis.c:140
CSAT_Target_ResultT * ABC_Get_Target_Result(ABC_Manager mng, int TargetID)
Definition: csat_apis.c:664
void ABC_SetLearnLimit(ABC_Manager mng, int num)
Definition: csat_apis.c:386
CSAT_CallerT
Definition: csat_apis.h:96
struct ABC_ManagerStruct_t * ABC_Manager
Definition: csat_apis.h:42
Definition: csat_apis.h:98