Skip to content

better error reporting when $past is unsupported #689

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions regression/verilog/system-functions/past1.aig.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
CORE
past1.sv
--aig
^\[main\.p0\] ##0 \(\$past\(main\.counter, 0\)\) == 0: FAILURE: property not supported by netlist BMC engine$
^EXIT=10$
^SIGNAL=0$
--
7 changes: 7 additions & 0 deletions regression/verilog/system-functions/past1.bdd.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
CORE
past1.sv
--bdd
^\[main\.p0\] ##0 \(\$past\(main\.counter, 0\)\) == 0: FAILURE: property not supported by BDD engine$
^EXIT=10$
^SIGNAL=0$
--
4 changes: 2 additions & 2 deletions regression/verilog/system-functions/past2.desc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
CORE
past2.sv
--bdd
^file .* line \d+: error: no support for \$past when using AIG backends$
^EXIT=6$
^\[main\.p0\] always \(main\.counter == 0 \|-> \(\$past\(main\.counter, 1\)\) == 0\): FAILURE: property not supported by BDD engine$
^EXIT=10$
^SIGNAL=0$
--
^warning: ignoring
Expand Down
15 changes: 14 additions & 1 deletion src/ebmc/bdd_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Author: Daniel Kroening, [email protected]

#include "bdd_engine.h"

#include <util/expr_util.h>
#include <util/format_expr.h>

#include <solvers/bdd/miniBDD/miniBDD.h>
Expand Down Expand Up @@ -175,6 +176,17 @@ property_checker_resultt bdd_enginet::operator()()
{
try
{
for(auto &property : properties.properties)
{
// no support for $past
if(has_subexpr(property.normalized_expr, ID_verilog_past))
property.failure("property not supported by BDD engine");
}

// any properties left?
if(!properties.has_unknown_property())
return property_checker_resultt::VERIFICATION_RESULT;

const auto property_map = properties.make_property_map();

message.status() << "Building netlist" << messaget::eom;
Expand Down Expand Up @@ -882,7 +894,8 @@ void bdd_enginet::get_atomic_propositions(const exprt &expr)
expr.id() == ID_implies || is_temporal_operator(expr))
{
for(const auto & op : expr.operands())
get_atomic_propositions(op);
if(op.type().id() == ID_bool)
get_atomic_propositions(op);
}
else
{
Expand Down
9 changes: 9 additions & 0 deletions src/ebmc/ebmc_properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,15 @@ class ebmc_propertiest
return true;
}

bool has_unknown_property() const
{
for(const auto &p : properties)
if(p.is_unknown())
return true;

return false;
}

bool requires_lasso_constraints() const
{
for(const auto &p : properties)
Expand Down
5 changes: 5 additions & 0 deletions src/trans-netlist/unwind_netlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Author: Daniel Kroening, [email protected]
#include "unwind_netlist.h"

#include <util/ebmc_util.h>
#include <util/expr_util.h>

#include <temporal-logic/temporal_expr.h>
#include <temporal-logic/temporal_logic.h>
Expand Down Expand Up @@ -170,6 +171,10 @@ Function: netlist_bmc_supports_property

bool netlist_bmc_supports_property(const exprt &expr)
{
// No $past.
if(has_subexpr(expr, ID_verilog_past))
return false;

// We do AG p only.
if(expr.id() == ID_AG)
return !has_temporal_operator(to_AG_expr(expr).op());
Expand Down