|
17 | 17 | #include <util/std_expr.h>
|
18 | 18 |
|
19 | 19 | #include <solvers/flattening/boolbv_width.h>
|
| 20 | +#include <solvers/prop/literal_expr.h> |
20 | 21 | #include <temporal-logic/ctl.h>
|
21 | 22 | #include <temporal-logic/ltl.h>
|
22 | 23 | #include <temporal-logic/temporal_logic.h>
|
23 | 24 | #include <verilog/sva_expr.h>
|
24 | 25 |
|
25 | 26 | #include "aig_prop.h"
|
26 |
| -#include "instantiate_netlist.h" |
27 | 27 | #include "netlist.h"
|
28 | 28 | #include "netlist_boolbv.h"
|
29 | 29 |
|
@@ -145,6 +145,8 @@ class convert_trans_to_netlistt:public messaget
|
145 | 145 |
|
146 | 146 | void convert_constraints();
|
147 | 147 |
|
| 148 | + std::optional<exprt> convert_property(const exprt &); |
| 149 | + |
148 | 150 | void map_vars(
|
149 | 151 | const irep_idt &module,
|
150 | 152 | netlistt &dest);
|
@@ -328,9 +330,7 @@ void convert_trans_to_netlistt::operator()(
|
328 | 330 | // properties
|
329 | 331 | for(const auto &[id, property_expr] : properties)
|
330 | 332 | {
|
331 |
| - auto netlist_expr_opt = netlist_property( |
332 |
| - aig_prop, dest.var_map, property_expr, ns, get_message_handler()); |
333 |
| - |
| 333 | + auto netlist_expr_opt = convert_property(property_expr); |
334 | 334 | dest.properties.emplace(id, netlist_expr_opt);
|
335 | 335 | }
|
336 | 336 |
|
@@ -359,6 +359,75 @@ void convert_trans_to_netlistt::operator()(
|
359 | 359 |
|
360 | 360 | /*******************************************************************\
|
361 | 361 |
|
| 362 | +Function: convert_trans_to_netlistt::convert_property |
| 363 | +
|
| 364 | + Inputs: |
| 365 | +
|
| 366 | + Outputs: |
| 367 | +
|
| 368 | + Purpose: |
| 369 | +
|
| 370 | +\*******************************************************************/ |
| 371 | + |
| 372 | +std::optional<exprt> |
| 373 | +convert_trans_to_netlistt::convert_property(const exprt &expr) |
| 374 | +{ |
| 375 | + if(is_temporal_operator(expr)) |
| 376 | + { |
| 377 | + if(is_LTL_operator(expr) || is_CTL_operator(expr)) |
| 378 | + { |
| 379 | + exprt copy = expr; |
| 380 | + for(auto &op : copy.operands()) |
| 381 | + { |
| 382 | + auto op_opt = convert_property(op); |
| 383 | + if(op_opt.has_value()) |
| 384 | + op = op_opt.value(); |
| 385 | + else |
| 386 | + return {}; |
| 387 | + } |
| 388 | + return copy; |
| 389 | + } |
| 390 | + else if(is_SVA_operator(expr)) |
| 391 | + { |
| 392 | + // Try to turn into LTL |
| 393 | + auto LTL_opt = SVA_to_LTL(expr); |
| 394 | + if(LTL_opt.has_value()) |
| 395 | + return convert_property(*LTL_opt); |
| 396 | + else |
| 397 | + return {}; |
| 398 | + } |
| 399 | + else |
| 400 | + return {}; |
| 401 | + } |
| 402 | + else if(!has_temporal_operator(expr)) |
| 403 | + { |
| 404 | + auto l = solver.convert(expr); |
| 405 | + return literal_exprt{l}; |
| 406 | + } |
| 407 | + else if( |
| 408 | + expr.id() == ID_and || expr.id() == ID_or || expr.id() == ID_not || |
| 409 | + expr.id() == ID_implies || expr.id() == ID_xor || expr.id() == ID_xnor) |
| 410 | + { |
| 411 | + exprt copy = expr; |
| 412 | + for(auto &op : copy.operands()) |
| 413 | + { |
| 414 | + auto op_opt = convert_property(op); |
| 415 | + if(op_opt.has_value()) |
| 416 | + op = op_opt.value(); |
| 417 | + else |
| 418 | + return {}; |
| 419 | + } |
| 420 | + return copy; |
| 421 | + } |
| 422 | + else |
| 423 | + { |
| 424 | + // contains temporal operator, but not propositional skeleton |
| 425 | + return {}; |
| 426 | + } |
| 427 | +} |
| 428 | + |
| 429 | +/*******************************************************************\ |
| 430 | +
|
362 | 431 | Function: convert_trans_to_netlistt::convert_constraints
|
363 | 432 |
|
364 | 433 | Inputs:
|
|
0 commit comments