@@ -31,9 +31,7 @@ Function: bmc_cegart::bmc_cegar
31
31
32
32
void bmc_cegart::bmc_cegar ()
33
33
{
34
- make_netlist ();
35
-
36
- if (properties.empty ())
34
+ if (properties.properties .empty ())
37
35
{
38
36
error () << " No properties given" << eom;
39
37
return ;
@@ -68,68 +66,24 @@ Function: bmc_cegart::unwind
68
66
\*******************************************************************/
69
67
70
68
void bmc_cegart::unwind (
71
- unsigned bound,
69
+ std:: size_t bound,
72
70
const netlistt &netlist,
73
- propt &prop )
71
+ cnft &solver )
74
72
{
75
- // allocate timeframes
76
- const auto bmc_map = bmc_mapt{netlist, bound + 1 , prop};
77
-
78
- #if 0
79
- for(unsigned timeframe=0; timeframe<=bound; timeframe++)
80
- bmc_map.timeframe_map[timeframe].resize(aig_map.no_vars);
73
+ ::unwind (netlist, bmc_map, *this , solver);
81
74
82
- // do initial state
83
- for(unsigned v=0; v<aig_map.no_vars; v++)
84
- bmc_map.timeframe_map[0][v]=prop.new_variable();
75
+ // one of the properties needs to fail
76
+ bvt disjuncts;
85
77
86
- // do transitions
87
- for(unsigned timeframe=0; timeframe<bound; timeframe++)
78
+ for (auto &property_it : netlist.properties )
88
79
{
89
- status() << "Round " << timeframe << eom;
90
-
91
- aig.clear_convert_cache();
92
-
93
- // set current state bits
94
- for(unsigned v=0; v<aig_map.no_vars; v++)
95
- {
96
- //std::cout << "SETTING "
97
- // << aig_map.timeframe_map[0][v] << std::endl;
98
-
99
- aig.set_l(prop,
100
- aig_map.timeframe_map[0][v],
101
- bmc_map.timeframe_map[timeframe][v]);
102
- }
80
+ auto &prop_bv = prop_bv_map[property_it.first ];
81
+ unwind_property (property_it.second , bmc_map, prop_bv);
103
82
104
- // convert next state bits
105
- for(unsigned v=0; v<aig_map.no_vars; v++)
106
- {
107
- literalt a=aig_map.timeframe_map[1][v];
108
-
109
- // std::cout << "CONVERTING " << a << std::endl;
110
-
111
- literalt l;
112
-
113
- if(latches.find(v)!=latches.end())
114
- {
115
- assert(aig.can_convert(a));
116
-
117
- l=aig.convert_prop(prop, a);
118
- }
119
- else
120
- l=prop.new_variable();
121
-
122
- bmc_map.timeframe_map[timeframe+1][v]=l;
123
- }
83
+ disjuncts.push_back (!solver.land (prop_bv));
124
84
}
125
85
126
- instantiate(prop, bmc_map, initial_state_predicate, 0, 1,
127
- false, ns);
128
-
129
- // do the property
130
- property(properties, prop_bv, get_message_handler(), prop,
131
- bmc_map, ns);
132
- #endif
86
+ solver.lcnf (disjuncts);
133
87
}
134
88
135
89
/* ******************************************************************\
@@ -144,21 +98,19 @@ Function: bmc_cegart::compute_ct
144
98
145
99
\*******************************************************************/
146
100
147
- unsigned bmc_cegart::compute_ct ()
101
+ std:: size_t bmc_cegart::compute_ct ()
148
102
{
149
- status () << " Computing CT" << eom;
150
-
151
103
status () << " Computing abstract LDG" << eom;
152
104
153
105
ldgt ldg;
154
-
106
+
155
107
ldg.compute (abstract_netlist);
156
-
157
- status () << " Computing CT" << eom;
158
108
159
- unsigned ct=:: compute_ct (ldg) ;
109
+ status () << " Computing abstract CT " << eom ;
160
110
161
- result () << " CT=" << ct << eom;
111
+ auto ct = ::compute_ct (ldg);
112
+
113
+ result () << " Abstract CT=" << ct << eom;
162
114
163
115
return ct;
164
116
}
@@ -182,8 +134,8 @@ void bmc_cegart::cegar_loop()
182
134
while (true )
183
135
{
184
136
abstract ();
185
-
186
- unsigned ct= compute_ct ();
137
+
138
+ auto ct = compute_ct ();
187
139
188
140
if (ct>=MAX_CT)
189
141
{
@@ -192,8 +144,8 @@ void bmc_cegart::cegar_loop()
192
144
}
193
145
194
146
// this is enough
195
- unsigned bound= ct;
196
-
147
+ auto bound = ct;
148
+
197
149
if (verify (bound))
198
150
{
199
151
status () << " VERIFICATION SUCCESSFUL -- PROPERTY HOLDS" << eom;
@@ -212,7 +164,7 @@ void bmc_cegart::cegar_loop()
212
164
213
165
/* ******************************************************************\
214
166
215
- Function: bmc_cegart::make_netlist
167
+ Function: do_bmc_cegar
216
168
217
169
Inputs:
218
170
@@ -222,34 +174,14 @@ Function: bmc_cegart::make_netlist
222
174
223
175
\*******************************************************************/
224
176
225
- void bmc_cegart::make_netlist ()
177
+ int do_bmc_cegar (
178
+ const netlistt &netlist,
179
+ ebmc_propertiest &properties,
180
+ const namespacet &ns,
181
+ message_handlert &message_handler)
226
182
{
227
- // make net-list
228
- status () << " Making Netlist" << eom;
229
-
230
- try
231
- {
232
- const symbolt &module_symbol = ns.lookup (main_module);
233
- const transt &trans = to_trans_expr (module_symbol.value );
234
-
235
- std::map<irep_idt, exprt> property_map;
236
-
237
- convert_trans_to_netlist (
238
- symbol_table,
239
- main_module,
240
- trans,
241
- property_map,
242
- concrete_netlist,
243
- get_message_handler ());
244
- }
245
-
246
- catch (const std::string &error_msg)
247
- {
248
- error () << error_msg << eom;
249
- return ;
250
- }
183
+ bmc_cegart bmc_cegar (netlist, properties, ns, message_handler);
251
184
252
- statistics ()
253
- << " Latches: " << concrete_netlist.var_map .latches .size ()
254
- << " , nodes: " << concrete_netlist.number_of_nodes () << eom;
185
+ bmc_cegar.bmc_cegar ();
186
+ return 0 ;
255
187
}
0 commit comments