-
Notifications
You must be signed in to change notification settings - Fork 19
SystemVerilog: SVA abort properties #618
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
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
CORE | ||
sva_abort1.sv | ||
--module main --bound 10 | ||
^\[main\.p0\] always \(accept_on \(main\.counter == 0\) main\.counter != 0\): PROVED up to bound 10$ | ||
^\[main\.p1\] always \(accept_on \(1\) 0\): PROVED up to bound 10$ | ||
^\[main\.p2\] always \(accept_on \(main\.counter == 1\) main\.counter == 0\): REFUTED$ | ||
^\[main\.p3\] always \(reject_on \(main\.counter != 0\) 1\): REFUTED$ | ||
^\[main\.p4\] always \(reject_on \(1\) 1\): REFUTED$ | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
-- | ||
^warning: ignoring | ||
-- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
module main(input clk); | ||
|
||
// count up | ||
reg [7:0] counter = 0; | ||
|
||
always_ff @(posedge clk) | ||
counter++; | ||
|
||
// expected to pass | ||
p0: assert property (@(posedge clk) accept_on (counter == 0) counter != 0); | ||
|
||
// expected to pass vacuously | ||
p1: assert property (@(posedge clk) accept_on (1) 0); | ||
|
||
// expected to fail when counter reaches 2 | ||
p2: assert property (@(posedge clk) accept_on (counter == 1) counter == 0); | ||
|
||
// expected to fail when counter reaches 2 | ||
p3: assert property (@(posedge clk) reject_on (counter != 0) 1); | ||
|
||
// expected to fail | ||
p4: assert property (@(posedge clk) reject_on (1) 1); | ||
|
||
endmodule |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,10 @@ Author: Daniel Kroening, [email protected] | |
/// sva_s_nexttime φ --> Xφ | ||
/// sva_if --> ? : | ||
/// a sva_disable_iff b --> a ∨ b | ||
/// a sva_accept_on b --> a ∨ b | ||
/// a sva_reject_on b --> ¬a ∧ b | ||
/// a sva_sync_accept_on b --> a ∨ b | ||
/// a sva_sync_reject_on b --> ¬a ∧ b | ||
/// ¬Xφ --> X¬φ | ||
/// ¬¬φ --> φ | ||
/// ¬Gφ --> F¬φ | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,8 +12,8 @@ Author: Daniel Kroening, [email protected] | |
#include <util/bitvector_expr.h> | ||
#include <util/std_expr.h> | ||
|
||
class sva_abort_exprt; | ||
class sva_case_exprt; | ||
class sva_disable_iff_exprt; | ||
class sva_if_exprt; | ||
class sva_ranged_predicate_exprt; | ||
|
||
|
@@ -121,9 +121,10 @@ class expr2verilogt | |
std::string convert_sva_binary(const std::string &name, const binary_exprt &); | ||
|
||
std::string | ||
convert_sva_indexed_binary(const std::string &name, const binary_exprt &); | ||
convert_sva_abort(const std::string &name, const sva_abort_exprt &); | ||
|
||
std::string convert_sva_disable_iff(const sva_disable_iff_exprt &); | ||
std::string | ||
convert_sva_indexed_binary(const std::string &name, const binary_exprt &); | ||
|
||
virtual std::string | ||
convert_replication(const replication_exprt &, verilog_precedencet); | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,14 +11,12 @@ Author: Daniel Kroening, [email protected] | |
|
||
#include <util/std_expr.h> | ||
|
||
class sva_disable_iff_exprt : public binary_predicate_exprt | ||
/// accept_on, reject_on, sync_accept_on, sync_reject_on, disable_iff | ||
class sva_abort_exprt : public binary_predicate_exprt | ||
{ | ||
public: | ||
explicit sva_disable_iff_exprt(exprt condition, exprt property) | ||
: binary_predicate_exprt( | ||
std::move(condition), | ||
ID_sva_disable_iff, | ||
std::move(property)) | ||
sva_abort_exprt(irep_idt id, exprt condition, exprt property) | ||
: binary_predicate_exprt(std::move(condition), id, std::move(property)) | ||
{ | ||
} | ||
|
||
|
@@ -47,6 +45,30 @@ class sva_disable_iff_exprt : public binary_predicate_exprt | |
using binary_predicate_exprt::op1; | ||
}; | ||
|
||
static inline const sva_abort_exprt &to_sva_abort_expr(const exprt &expr) | ||
{ | ||
sva_abort_exprt::check(expr, validation_modet::INVARIANT); | ||
return static_cast<const sva_abort_exprt &>(expr); | ||
} | ||
|
||
static inline sva_abort_exprt &to_sva_abort_expr(exprt &expr) | ||
{ | ||
sva_abort_exprt::check(expr, validation_modet::INVARIANT); | ||
return static_cast<sva_abort_exprt &>(expr); | ||
} | ||
|
||
class sva_disable_iff_exprt : public sva_abort_exprt | ||
{ | ||
public: | ||
sva_disable_iff_exprt(exprt condition, exprt property) | ||
: sva_abort_exprt( | ||
ID_sva_disable_iff, | ||
std::move(condition), | ||
std::move(property)) | ||
{ | ||
} | ||
}; | ||
|
||
static inline const sva_disable_iff_exprt & | ||
to_sva_disable_iff_expr(const exprt &expr) | ||
{ | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Are there really three different ways that all just express disjunction?
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.
Yes. They differ slightly if you are building a simulator.