|
24 | 24 | #include "property_checker.h" |
25 | 25 | #include "random_traces.h" |
26 | 26 | #include "ranking_function.h" |
| 27 | +#include "show_properties.h" |
27 | 28 | #include "show_trans.h" |
28 | 29 |
|
29 | 30 | #include <iostream> |
@@ -210,94 +211,97 @@ int ebmc_parse_optionst::doit() |
210 | 211 | // get the transition system |
211 | 212 | auto transition_system = get_transition_system(cmdline, ui_message_handler); |
212 | 213 |
|
| 214 | + // get the properties |
| 215 | + auto properties = ebmc_propertiest::from_command_line( |
| 216 | + cmdline, transition_system, ui_message_handler); |
| 217 | + |
| 218 | + if(cmdline.isset("show-properties")) |
| 219 | + { |
| 220 | + show_properties(properties, ui_message_handler); |
| 221 | + return 0; |
| 222 | + } |
| 223 | + |
| 224 | + if(cmdline.isset("json-properties")) |
| 225 | + { |
| 226 | + json_properties(properties, cmdline.get_value("json-properties")); |
| 227 | + return 0; |
| 228 | + } |
| 229 | + |
| 230 | + // possibly apply liveness-to-safety |
| 231 | + if(cmdline.isset("liveness-to-safety")) |
| 232 | + liveness_to_safety(transition_system, properties); |
| 233 | + |
| 234 | + if(cmdline.isset("show-varmap")) |
| 235 | + { |
| 236 | + auto netlist = |
| 237 | + make_netlist(transition_system, properties, ui_message_handler); |
| 238 | + netlist.var_map.output(std::cout); |
| 239 | + return 0; |
| 240 | + } |
| 241 | + |
| 242 | + if(cmdline.isset("show-ldg")) |
213 | 243 | { |
214 | 244 | ebmc_baset ebmc_base(cmdline, ui_message_handler); |
215 | 245 | ebmc_base.transition_system = std::move(transition_system); |
| 246 | + ebmc_base.properties = std::move(properties); |
| 247 | + ebmc_base.show_ldg(std::cout); |
| 248 | + return 0; |
| 249 | + } |
| 250 | + |
| 251 | + if(cmdline.isset("show-netlist")) |
| 252 | + { |
| 253 | + auto netlist = |
| 254 | + make_netlist(transition_system, properties, ui_message_handler); |
| 255 | + netlist.print(std::cout); |
| 256 | + return 0; |
| 257 | + } |
| 258 | + |
| 259 | + if(cmdline.isset("dot-netlist")) |
| 260 | + { |
| 261 | + auto netlist = |
| 262 | + make_netlist(transition_system, properties, ui_message_handler); |
| 263 | + auto filename = cmdline.value_opt("outfile").value_or("-"); |
| 264 | + output_filet outfile{filename}; |
| 265 | + outfile.stream() << "digraph netlist {\n"; |
| 266 | + netlist.output_dot(outfile.stream()); |
| 267 | + outfile.stream() << "}\n"; |
| 268 | + return 0; |
| 269 | + } |
| 270 | + |
| 271 | + if(cmdline.isset("smv-netlist")) |
| 272 | + { |
| 273 | + auto netlist = |
| 274 | + make_netlist(transition_system, properties, ui_message_handler); |
| 275 | + auto filename = cmdline.value_opt("outfile").value_or("-"); |
| 276 | + output_filet outfile{filename}; |
| 277 | + outfile.stream() << "-- Generated by EBMC " << EBMC_VERSION << '\n'; |
| 278 | + outfile.stream() << "-- Generated from " |
| 279 | + << transition_system.main_symbol->name << '\n'; |
| 280 | + outfile.stream() << '\n'; |
| 281 | + netlist.output_smv(outfile.stream()); |
| 282 | + return 0; |
| 283 | + } |
216 | 284 |
|
217 | | - auto result = ebmc_base.get_properties(); |
218 | | - |
219 | | - if(result != -1) |
220 | | - return result; |
221 | | - |
222 | | - // possibly apply liveness-to-safety |
223 | | - if(cmdline.isset("liveness-to-safety")) |
224 | | - liveness_to_safety(ebmc_base.transition_system, ebmc_base.properties); |
225 | | - |
226 | | - if(cmdline.isset("show-varmap")) |
227 | | - { |
228 | | - netlistt netlist; |
229 | | - if(ebmc_base.make_netlist(netlist)) |
230 | | - return 1; |
231 | | - netlist.var_map.output(std::cout); |
232 | | - return 0; |
233 | | - } |
234 | | - |
235 | | - if(cmdline.isset("show-ldg")) |
236 | | - { |
237 | | - ebmc_base.show_ldg(std::cout); |
238 | | - return 0; |
239 | | - } |
240 | | - |
241 | | - if(cmdline.isset("show-netlist")) |
242 | | - { |
243 | | - netlistt netlist; |
244 | | - if(ebmc_base.make_netlist(netlist)) |
245 | | - return 1; |
246 | | - netlist.print(std::cout); |
247 | | - return 0; |
248 | | - } |
249 | | - |
250 | | - if(cmdline.isset("dot-netlist")) |
251 | | - { |
252 | | - netlistt netlist; |
253 | | - if(ebmc_base.make_netlist(netlist)) |
254 | | - return 1; |
255 | | - auto filename = cmdline.value_opt("outfile").value_or("-"); |
256 | | - output_filet outfile{filename}; |
257 | | - outfile.stream() << "digraph netlist {\n"; |
258 | | - netlist.output_dot(outfile.stream()); |
259 | | - outfile.stream() << "}\n"; |
260 | | - return 0; |
261 | | - } |
262 | | - |
263 | | - if(cmdline.isset("smv-netlist")) |
264 | | - { |
265 | | - netlistt netlist; |
266 | | - if(ebmc_base.make_netlist(netlist)) |
267 | | - return 1; |
268 | | - auto filename = cmdline.value_opt("outfile").value_or("-"); |
269 | | - output_filet outfile{filename}; |
270 | | - outfile.stream() << "-- Generated by EBMC " << EBMC_VERSION << '\n'; |
271 | | - outfile.stream() << "-- Generated from " |
272 | | - << ebmc_base.transition_system.main_symbol->name |
273 | | - << '\n'; |
274 | | - outfile.stream() << '\n'; |
275 | | - netlist.output_smv(outfile.stream()); |
276 | | - return 0; |
277 | | - } |
278 | | - |
279 | | - if(cmdline.isset("cegar")) |
280 | | - { |
281 | | - auto netlist = make_netlist( |
282 | | - ebmc_base.transition_system, |
283 | | - ebmc_base.properties, |
284 | | - ui_message_handler); |
285 | | - const namespacet ns(ebmc_base.transition_system.symbol_table); |
286 | | - return do_bmc_cegar( |
287 | | - netlist, ebmc_base.properties, ns, ui_message_handler); |
288 | | - } |
289 | | - |
290 | | - if(cmdline.isset("compute-ct")) |
291 | | - return ebmc_base.do_compute_ct(); |
292 | | - |
293 | | - auto checker_result = property_checker( |
294 | | - cmdline, |
295 | | - ebmc_base.transition_system, |
296 | | - ebmc_base.properties, |
297 | | - ui_message_handler); |
298 | | - |
299 | | - return checker_result.exit_code(); |
| 285 | + if(cmdline.isset("cegar")) |
| 286 | + { |
| 287 | + auto netlist = |
| 288 | + make_netlist(transition_system, properties, ui_message_handler); |
| 289 | + const namespacet ns(transition_system.symbol_table); |
| 290 | + return do_bmc_cegar(netlist, properties, ns, ui_message_handler); |
300 | 291 | } |
| 292 | + |
| 293 | + if(cmdline.isset("compute-ct")) |
| 294 | + { |
| 295 | + ebmc_baset ebmc_base(cmdline, ui_message_handler); |
| 296 | + ebmc_base.transition_system = std::move(transition_system); |
| 297 | + ebmc_base.properties = std::move(properties); |
| 298 | + return ebmc_base.do_compute_ct(); |
| 299 | + } |
| 300 | + |
| 301 | + auto checker_result = property_checker( |
| 302 | + cmdline, transition_system, properties, ui_message_handler); |
| 303 | + |
| 304 | + return checker_result.exit_code(); |
301 | 305 | } |
302 | 306 | catch(const ebmc_errort &ebmc_error) |
303 | 307 | { |
|
0 commit comments