-
Notifications
You must be signed in to change notification settings - Fork 267
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
SMT2: support onehot
and onehot0
#8524
Conversation
d343868
to
572d67c
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #8524 +/- ##
===========================================
- Coverage 78.88% 78.46% -0.42%
===========================================
Files 1728 1728
Lines 198669 199820 +1151
Branches 18393 18356 -37
===========================================
+ Hits 156719 156792 +73
- Misses 41950 43028 +1078 ☔ View full report in Codecov by Sentry. |
else if(expr.id() == ID_onehot) | ||
{ | ||
convert_expr(to_onehot_expr(expr).lower()); | ||
} |
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.
What about ID_onehot0
?
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.
Added, thank you
{ | ||
exprt one_seen = false_exprt{}; | ||
const auto width = to_bitvector_type(expr.type()).get_width(); | ||
exprt::operandst more_than_one_seen_disjuncts; |
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.
May I suggest more_than_one_seen_disjuncts.reserve(width);
?
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.
Done
@@ -64,3 +71,34 @@ TEMPLATE_TEST_CASE( | |||
} | |||
} | |||
} | |||
|
|||
TEST_CASE("onehot expression lowering", "[core][util][expr]") |
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.
Thank you for adding this test; but could onehot0
please also be included?
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.
Done
This adds support for the onehot and onehot0 predicates to the SMT2 backend.
This adds support for the
onehot
andonehot0
predicates to the SMT2 backend.