Skip to content

Commit 270c867

Browse files
committed
SVA: allow parentheses around sequences
This allows the use of parentheses ( ... ) in sequences. Raised in #931.
1 parent f6c38d9 commit 270c867

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

regression/verilog/SVA/sequence6.desc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
sequence6.sv
3+
4+
^\[main\.p0\] \(1 ##1 1\) \|-> main\.x == 1: PROVED up to bound 5$
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--
8+
^warning: ignoring
9+
--
10+

regression/verilog/SVA/sequence6.sv

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module main;
2+
3+
reg [31:0] x;
4+
wire clk;
5+
6+
initial x=0;
7+
8+
always @(posedge clk)
9+
x<=x+1;
10+
11+
// passes
12+
initial p0: assert property ((1 ##1 1) |-> x==1);
13+
14+
endmodule

src/verilog/parser.y

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2555,12 +2555,23 @@ expression_or_dist_brace:
25552555
{ $$ = $1; mto($1, $3); }
25562556
;
25572557

2558+
// The 1800-2017 grammar has an ambiguity where
2559+
// '(' expression ')' can either be an expression or a sequence_expr,
2560+
// which yields a reduce/reduce conflict. Hence, we split the rules
2561+
// for sequence_expr into sequence_expr and sequence_expr_proper.
2562+
25582563
sequence_expr:
2564+
expression_or_dist
2565+
| sequence_expr_proper
2566+
;
2567+
2568+
sequence_expr_proper:
25592569
cycle_delay_range sequence_expr %prec "##"
25602570
{ $$=$1; mto($$, $2); }
25612571
| sequence_expr cycle_delay_range sequence_expr %prec "##"
25622572
{ init($$, ID_sva_sequence_concatenation); mto($$, $1); mto($2, $3); mto($$, $2); }
2563-
| expression_or_dist
2573+
| '(' sequence_expr_proper ')'
2574+
{ $$ = $2; }
25642575
| expression_or_dist boolean_abbrev
25652576
{ $$ = $2;
25662577
// preserve the operand ordering as in the source code

0 commit comments

Comments
 (0)