Skip to content

Commit f067e32

Browse files
authored
Merge pull request #272 from diffblue/expr2verilog-sva-precedence
ebmc: avoid parentheses in SVA output for unary operators
2 parents 31b3d14 + 3e52fed commit f067e32

File tree

11 files changed

+13
-12
lines changed

11 files changed

+13
-12
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CORE
22
counter1.sv
33
--number-of-traces 2 --neural-liveness --neural-engine "echo Candidate: counter\\\\n"
4-
^\[main\.property\.p0\] always \(eventually main.counter == 0\): PROVED$
4+
^\[main\.property\.p0\] always eventually main.counter == 0: PROVED$
55
^EXIT=0$
66
^SIGNAL=0$
77
--
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CORE
22
counter1.sv
33
--ranking-function "(-counter)"
4-
^\[main\.property\.p0\] always \(eventually main.counter == 0\): INCONCLUSIVE$
4+
^\[main\.property\.p0\] always eventually main.counter == 0: INCONCLUSIVE$
55
^EXIT=10$
66
^SIGNAL=0$
77
--
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CORE
22
counter1.sv
33
--ranking-function counter
4-
^\[main\.property\.p0\] always \(eventually main.counter == 0\): PROVED$
4+
^\[main\.property\.p0\] always eventually main.counter == 0: PROVED$
55
^EXIT=0$
66
^SIGNAL=0$
77
--
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CORE
22
counter2.sv
33
--ranking-function counter
4-
^\[main\.property\.p0\] always \(eventually main.counter == 10\): INCONCLUSIVE$
4+
^\[main\.property\.p0\] always eventually main.counter == 10: INCONCLUSIVE$
55
^EXIT=10$
66
^SIGNAL=0$
77
--
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CORE
22
counter2.sv
33
--ranking-function 10-counter
4-
^\[main\.property\.p0\] always \(eventually main.counter == 10\): PROVED$
4+
^\[main\.property\.p0\] always eventually main.counter == 10: PROVED$
55
^EXIT=0$
66
^SIGNAL=0$
77
--

regression/ebmc/ranking-function/counter_in_module1.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CORE
22
counter_in_module1.sv
33
--ranking-function instance.counter
4-
^\[main\.property\.p0\] always \(eventually main.instance.counter == 0\): PROVED$
4+
^\[main\.property\.p0\] always eventually main.instance.counter == 0: PROVED$
55
^EXIT=0$
66
^SIGNAL=0$
77
--
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CORE
22
counter_with_reset1.sv
33
--property main.property.p0 --ranking-function 10-counter
4-
^\[main\.property\.p0\] always \(eventually main.counter == 10\): INCONCLUSIVE$
4+
^\[main\.property\.p0\] always eventually main.counter == 10: INCONCLUSIVE$
55
^EXIT=10$
66
^SIGNAL=0$
77
--
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CORE
22
counter_with_reset1.sv
33
--property main.property.p1 --ranking-function 10-counter
4-
^\[main\.property\.p1\] always \(eventually main.reset \|\| main.counter == 10\): PROVED$
4+
^\[main\.property\.p1\] always eventually main.reset \|\| main.counter == 10: PROVED$
55
^EXIT=0$
66
^SIGNAL=0$
77
--
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CORE
22
lexicographic_ranking_function1.sv
33
--ranking-function "{digit1, digit2}"
4-
^\[main\.property\.p0\] always \(eventually main\.digit1 == 0\): PROVED$
4+
^\[main\.property\.p0\] always eventually main\.digit1 == 0: PROVED$
55
^EXIT=0$
66
^SIGNAL=0$
77
--

regression/verilog/system_verilog_assertion/eventually3.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ eventually3.sv
33
--module main --bound 11
44
^EXIT=10$
55
^SIGNAL=0$
6-
^\[main\.property\.p0\] always \(eventually main\.counter <= 5\): REFUTED$
6+
^\[main\.property\.p0\] always eventually main\.counter <= 5: REFUTED$
77
--
88
^warning: ignoring

src/verilog/expr2verilog.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,9 +386,10 @@ std::string expr2verilogt::convert_sva(
386386
{
387387
if(src.operands().size()==1)
388388
{
389+
auto &op = to_unary_expr(src).op();
389390
unsigned p;
390-
auto s = convert(to_unary_expr(src).op(), p);
391-
if(p == 0)
391+
auto s = convert(op, p);
392+
if(p == 0 && op.operands().size() >= 2)
392393
s = "(" + s + ")";
393394
return name + " " + s;
394395
}

0 commit comments

Comments
 (0)