Skip to content

Commit 1ea861b

Browse files
authored
Merge pull request #1353 from diffblue/label-immediate-assertions
SystemVerilog: labeled immediate assert/assume/cover statements
2 parents da3a0d5 + a8c9854 commit 1ea861b

File tree

6 files changed

+21
-9
lines changed

6 files changed

+21
-9
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
* Verilog: semantic fix for output register ports
44
* SystemVerilog: cover sequence
5+
* SystemVerilog: labeled immediate assert/assume/cover statements
56
* SystemVerilog: semantics fix for explicit casts
67

78
# EBMC 5.7

regression/ebmc-spot/sva-buechi/initial2.bmc.desc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
CORE
22
../../verilog/SVA/initial2.sv
33
--buechi --module main
4-
^\[main\.assert\.1\] main\.counter == 1: PROVED \(1-induction\)$
5-
^\[main\.assert\.2\] main\.counter == 2: PROVED \(1-induction\)$
4+
^\[main\.p0\] main\.counter == 1: PROVED \(1-induction\)$
5+
^\[main\.p1\] main\.counter == 2: PROVED \(1-induction\)$
66
^EXIT=0$
77
^SIGNAL=0$
88
--

regression/ebmc-spot/sva-buechi/initial2.k.desc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
CORE
22
../../verilog/SVA/initial2.sv
33
--buechi --k-induction --bound 1 --module main
4-
^\[main\.assert\.1\] main\.counter == 1: PROVED$
5-
^\[main\.assert\.2\] main\.counter == 2: PROVED$
4+
^\[main\.p0\] main\.counter == 1: PROVED$
5+
^\[main\.p1\] main\.counter == 2: PROVED$
66
^EXIT=0$
77
^SIGNAL=0$
88
--

regression/verilog/SVA/initial2.desc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
CORE
22
initial2.sv
33
--module main
4-
^\[main\.assert\.1\] main\.counter == 1: PROVED .*$
5-
^\[main\.assert\.2\] main\.counter == 2: PROVED .*$
4+
^\[main\.p0\] main\.counter == 1: PROVED .*$
5+
^\[main\.p1\] main\.counter == 2: PROVED .*$
66
^EXIT=0$
77
^SIGNAL=0$
88
--

regression/verilog/SVA/initial2.sv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ module main(input clk);
66
initial begin
77
counter = 1;
88
// expected to pass
9-
assert(counter == 1);
9+
p0: assert(counter == 1);
1010
counter = 2;
1111
end
1212

1313
// expected to pass
14-
initial assert property (counter == 2);
14+
initial p1: assert property (counter == 2);
1515

1616
always_ff @(posedge clk)
1717
counter = counter + 1;

src/verilog/parser.y

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3661,7 +3661,18 @@ statement:
36613661
attribute_instance_brace block_identifier TOK_COLON attribute_instance_brace statement_item
36623662
{ init($$, ID_verilog_label_statement);
36633663
stack_expr($$).set(ID_base_name, stack_expr($2).id());
3664-
mto($$, $5); }
3664+
3665+
// We'll stick the label onto any assertion
3666+
auto statement = stack_expr($5).id();
3667+
if(statement == ID_verilog_immediate_assert ||
3668+
statement == ID_verilog_immediate_assume ||
3669+
statement == ID_verilog_immediate_cover)
3670+
{
3671+
stack_expr($5).set(ID_identifier, stack_expr($2).id());
3672+
}
3673+
3674+
mto($$, $5);
3675+
}
36653676
| attribute_instance_brace statement_item
36663677
{ $$=$2; }
36673678
;

0 commit comments

Comments
 (0)