-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #617 from diffblue/disable_iff1
SystemVerilog: disable iff
- Loading branch information
Showing
11 changed files
with
141 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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,12 @@ | ||
CORE | ||
disable_iff1.sv | ||
--module main --bound 10 --numbered-trace | ||
^\[main\.p0\] always \(disable iff \(main.counter == 0\) main\.counter != 0\): PROVED up to bound 10$ | ||
^\[main\.p1\] always \(disable iff \(1\) 0\): PROVED up to bound 10$ | ||
^\[main\.p2\] always \(disable iff \(main\.counter == 1\) main\.counter == 0\): REFUTED$ | ||
^Counterexample with 3 states:$ | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
-- | ||
^warning: ignoring | ||
-- |
This file contains 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,18 @@ | ||
module main(input clk); | ||
|
||
// count up | ||
reg [7:0] counter = 0; | ||
|
||
always_ff @(posedge clk) | ||
counter++; | ||
|
||
// expected to pass | ||
p0: assert property (@(posedge clk) disable iff (counter == 0) counter != 0); | ||
|
||
// expected to pass vacuously | ||
p1: assert property (@(posedge clk) disable iff (1) 0); | ||
|
||
// expected to fail when counter reaches 2 | ||
p2: assert property (@(posedge clk) disable iff (counter == 1) counter == 0); | ||
|
||
endmodule |
This file contains 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 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 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 |
---|---|---|
|
@@ -19,6 +19,7 @@ Author: Daniel Kroening, [email protected] | |
/// sva_nexttime φ --> Xφ | ||
/// sva_s_nexttime φ --> Xφ | ||
/// sva_if --> ? : | ||
/// a sva_disable_iff b --> a ∨ b | ||
/// ¬Xφ --> X¬φ | ||
/// ¬¬φ --> φ | ||
/// ¬Gφ --> F¬φ | ||
|
This file contains 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 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 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 |
---|---|---|
|
@@ -13,6 +13,7 @@ Author: Daniel Kroening, [email protected] | |
#include <util/std_expr.h> | ||
|
||
class sva_case_exprt; | ||
class sva_disable_iff_exprt; | ||
class sva_if_exprt; | ||
class sva_ranged_predicate_exprt; | ||
|
||
|
@@ -122,6 +123,8 @@ class expr2verilogt | |
std::string | ||
convert_sva_indexed_binary(const std::string &name, const binary_exprt &); | ||
|
||
std::string convert_sva_disable_iff(const sva_disable_iff_exprt &); | ||
|
||
virtual std::string | ||
convert_replication(const replication_exprt &, verilog_precedencet); | ||
|
||
|
This file contains 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 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,6 +11,57 @@ Author: Daniel Kroening, [email protected] | |
|
||
#include <util/std_expr.h> | ||
|
||
class sva_disable_iff_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)) | ||
{ | ||
} | ||
|
||
const exprt &condition() const | ||
{ | ||
return op0(); | ||
} | ||
|
||
exprt &condition() | ||
{ | ||
return op0(); | ||
} | ||
|
||
const exprt &property() const | ||
{ | ||
return op1(); | ||
} | ||
|
||
exprt &property() | ||
{ | ||
return op1(); | ||
} | ||
|
||
protected: | ||
using binary_predicate_exprt::op0; | ||
using binary_predicate_exprt::op1; | ||
}; | ||
|
||
static inline const sva_disable_iff_exprt & | ||
to_sva_disable_iff_expr(const exprt &expr) | ||
{ | ||
PRECONDITION(expr.id() == ID_sva_disable_iff); | ||
sva_disable_iff_exprt::check(expr, validation_modet::INVARIANT); | ||
return static_cast<const sva_disable_iff_exprt &>(expr); | ||
} | ||
|
||
static inline sva_disable_iff_exprt &to_sva_disable_iff_expr(exprt &expr) | ||
{ | ||
PRECONDITION(expr.id() == ID_sva_disable_iff); | ||
sva_disable_iff_exprt::check(expr, validation_modet::INVARIANT); | ||
return static_cast<sva_disable_iff_exprt &>(expr); | ||
} | ||
|
||
class sva_nexttime_exprt : public binary_predicate_exprt | ||
{ | ||
public: | ||
|
This file contains 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