-
Notifications
You must be signed in to change notification settings - Fork 19
SVA: implement ranged s_eventually
operator
#691
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
CORE | ||
s_eventually2.sv | ||
--module main --bound 20 | ||
^EXIT=0$ | ||
^\[main\.p0\] always s_eventually main.reset \|\| main\.counter == 10: PROVED up to bound 20$ | ||
^\[main\.p1\] always \(s_eventually \[0:2\] main.reset \|\| main\.counter == 10\): REFUTED$ | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
-- | ||
^warning: ignoring |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ Author: Daniel Kroening, [email protected] | |
#include <util/ebmc_util.h> | ||
#include <util/expr_util.h> | ||
|
||
#include <ebmc/ebmc_error.h> | ||
#include <temporal-logic/temporal_expr.h> | ||
#include <temporal-logic/temporal_logic.h> | ||
#include <verilog/sva_expr.h> | ||
|
@@ -428,6 +429,45 @@ wl_instantiatet::instantiate_rec(exprt expr, const mp_integer &t) const | |
DATA_INVARIANT(no_timeframes != 0, "must have timeframe"); | ||
return {no_timeframes - 1, conjunction(conjuncts)}; | ||
} | ||
else if(expr.id() == ID_sva_ranged_s_eventually) | ||
{ | ||
auto &phi = to_sva_ranged_s_eventually_expr(expr).op(); | ||
auto &lower = to_sva_ranged_s_eventually_expr(expr).lower(); | ||
auto &upper = to_sva_ranged_s_eventually_expr(expr).upper(); | ||
|
||
auto from_opt = numeric_cast<mp_integer>(lower); | ||
if(!from_opt.has_value()) | ||
throw ebmc_errort() << "failed to convert SVA s_eventually from index"; | ||
|
||
auto from = t + std::max(mp_integer{0}, *from_opt); | ||
|
||
mp_integer to; | ||
|
||
if(upper.id() == ID_infinity) | ||
{ | ||
throw ebmc_errort() | ||
<< "failed to convert SVA s_eventually to index (infinity)"; | ||
} | ||
else | ||
Comment on lines
+444
to
+451
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe this check could be done earlier so that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. RAII won't do it -- it's perfectly fine to initialize with infinity. What's missing here is the comment "the normalizer has rewritten this". I'll implement the case, since I want to rely less on the normalizer doing stuff. It's just one line. |
||
{ | ||
auto to_opt = numeric_cast<mp_integer>(upper); | ||
if(!to_opt.has_value()) | ||
throw ebmc_errort() << "failed to convert SVA s_eventually to index"; | ||
to = std::min(t + *to_opt, no_timeframes - 1); | ||
} | ||
|
||
exprt::operandst disjuncts; | ||
mp_integer time = 0; | ||
|
||
for(mp_integer c = from; c <= to; ++c) | ||
{ | ||
auto tmp = instantiate_property(phi, c, no_timeframes, ns); | ||
time = std::max(time, tmp.first); | ||
disjuncts.push_back(tmp.second); | ||
} | ||
|
||
return {time, disjunction(disjuncts)}; | ||
} | ||
else if(expr.id()==ID_sva_until || | ||
expr.id()==ID_sva_s_until) | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not that this change makes the decisive difference, but:
instantiate_rec
has become very very long and could do with breaking into smaller functions. Perhaps this opportunity could be taken to at least move this case to a function of its own?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do. What bugs me most is the duplication between instantiate_word_level.cpp and property.cpp.