Skip to content

Commit 734c6e7

Browse files
authored
Merge pull request #534 from diffblue/assertion-statement-label
Verilog: stick statement label onto `assert`/`assume`/`cover`
2 parents 5863b3b + 62e0750 commit 734c6e7

File tree

8 files changed

+31
-17
lines changed

8 files changed

+31
-17
lines changed

regression/verilog/SVA/always_with_range1.desc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
CORE
22
always_with_range1.sv
33
--bound 20
4-
^\[main\.property\.1\] always \[0:9\] main\.x < 10: PROVED up to bound 20$
5-
^\[main\.property\.2\] always \[0:\$\] main\.x < 10: REFUTED$
6-
^\[main\.property\.3\] s_always \[0:9\] main\.x < 10: PROVED up to bound 20$
4+
^\[main\.property\.p0\] always \[0:9\] main\.x < 10: PROVED up to bound 20$
5+
^\[main\.property\.p1\] always \[0:\$\] main\.x < 10: REFUTED$
6+
^\[main\.property\.p2\] s_always \[0:9\] main\.x < 10: PROVED up to bound 20$
77
^EXIT=10$
88
^SIGNAL=0$
99
--

regression/verilog/SVA/cover2.desc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
CORE
22
cover2.sv
33
--bound 10 --numbered-trace
4-
^\[main\.property\.1\] cover main\.counter == 1: PROVED$
4+
^\[main\.property\.p0\] cover main\.counter == 1: PROVED$
55
^Trace with 2 states:$
66
^main\.counter@0 = 0$
77
^main\.counter@1 = 1$
8-
^\[main\.property\.2\] cover main\.counter == 100: REFUTED up to bound 10$
8+
^\[main\.property\.p1\] cover main\.counter == 100: REFUTED up to bound 10$
99
^EXIT=10$
1010
^SIGNAL=0$
1111
--

regression/verilog/SVA/initial1.desc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
CORE
22
initial1.sv
33
--module main --bound 1
4-
^\[main\.property\.1\] main\.counter == 0: PROVED up to bound 1$
5-
^\[main\.property\.2\] main\.counter == 100: REFUTED$
6-
^\[main\.property\.3\] ##1 main\.counter == 1: PROVED up to bound 1$
7-
^\[main\.property\.4\] ##1 main\.counter == 100: REFUTED$
8-
^\[main\.property\.5\] s_nexttime main\.counter == 1: PROVED up to bound 1$
4+
^\[main\.property\.p0\] main\.counter == 0: PROVED up to bound 1$
5+
^\[main\.property\.p1\] main\.counter == 100: REFUTED$
6+
^\[main\.property\.p2\] ##1 main\.counter == 1: PROVED up to bound 1$
7+
^\[main\.property\.p3\] ##1 main\.counter == 100: REFUTED$
8+
^\[main\.property\.p4\] s_nexttime main\.counter == 1: PROVED up to bound 1$
99
^EXIT=10$
1010
^SIGNAL=0$
1111
--

regression/verilog/SVA/initial1.sv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ module main(input clk);
2121
initial p2: assert property (##1 counter == 1);
2222

2323
// expected to fail
24-
initial p2: assert property (##1 counter == 100);
24+
initial p3: assert property (##1 counter == 100);
2525

2626
// expected to pass if there are timeframes 0 and 1
27-
initial p3: assert property (s_nexttime counter == 1);
27+
initial p4: assert property (s_nexttime counter == 1);
2828

2929
endmodule

regression/verilog/SVA/sequence1.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CORE
22
sequence1.sv
33
--bound 20 --numbered-trace
4-
^\[main\.property\.1\] ##\[0:9\] main\.x == 100: REFUTED$
4+
^\[main\.property\.p0\] ##\[0:9\] main\.x == 100: REFUTED$
55
^Counterexample with 10 states:$
66
^main\.x@0 = 0$
77
^main\.x@9 = 9$

regression/verilog/SVA/sequence2.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CORE
22
sequence2.sv
33
--bound 10 --numbered-trace
4-
^\[main\.property\.1] ##\[0:\$\] main\.x == 10: REFUTED$
4+
^\[main\.property\.p0] ##\[0:\$\] main\.x == 10: REFUTED$
55
^Counterexample with 7 states:$
66
^main\.x@0 = 0$
77
^main\.x@1 = 1$

regression/verilog/SVA/sequence3.desc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
CORE
22
sequence3.sv
33
--bound 20 --numbered-trace
4-
^\[main\.property\.1\] ##\[\*\] main\.x == 6: REFUTED$
4+
^\[main\.property\.p0\] ##\[\*\] main\.x == 6: REFUTED$
55
^Counterexample with 2 states:$
6-
^\[main\.property\.2\] ##\[\+\] main\.x == 0: REFUTED$
6+
^\[main\.property\.p1\] ##\[\+\] main\.x == 0: REFUTED$
77
^Counterexample with 7 states:$
88
^EXIT=10$
99
^SIGNAL=0$

src/verilog/verilog_typecheck.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1481,7 +1481,21 @@ void verilog_typecheckt::convert_statement(
14811481
else if(statement.id()==ID_force)
14821482
convert_force(to_verilog_force(statement));
14831483
else if(statement.id() == ID_verilog_label_statement)
1484-
convert_statement(to_verilog_label_statement(statement).statement());
1484+
{
1485+
// We stick the label on any assert/assume/conver statement
1486+
auto &label_statement = to_verilog_label_statement(statement);
1487+
auto &sub_statement = label_statement.statement();
1488+
1489+
if(
1490+
sub_statement.id() == ID_verilog_assert_property ||
1491+
sub_statement.id() == ID_verilog_assume_property ||
1492+
sub_statement.id() == ID_verilog_cover_property)
1493+
{
1494+
sub_statement.set(ID_identifier, label_statement.label());
1495+
}
1496+
1497+
convert_statement(sub_statement);
1498+
}
14851499
else if(statement.id() == ID_wait)
14861500
{
14871501
}

0 commit comments

Comments
 (0)