Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SVA: allow parentheses around sequences #942

Merged
merged 1 commit into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions regression/verilog/SVA/sequence6.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
CORE
sequence6.sv

^\[main\.p0\] \(1 ##1 1\) \|-> main\.x == 1: PROVED up to bound 5$
^EXIT=0$
^SIGNAL=0$
--
^warning: ignoring
--

14 changes: 14 additions & 0 deletions regression/verilog/SVA/sequence6.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module main;

reg [31:0] x;
wire clk;

initial x=0;

always @(posedge clk)
x<=x+1;

// passes
initial p0: assert property ((1 ##1 1) |-> x==1);

endmodule
13 changes: 12 additions & 1 deletion src/verilog/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -2555,12 +2555,23 @@ expression_or_dist_brace:
{ $$ = $1; mto($1, $3); }
;

// The 1800-2017 grammar has an ambiguity where
// '(' expression ')' can either be an expression or a sequence_expr,
// which yields a reduce/reduce conflict. Hence, we split the rules
// for sequence_expr into sequence_expr and sequence_expr_proper.

sequence_expr:
expression_or_dist
| sequence_expr_proper
;

sequence_expr_proper:
cycle_delay_range sequence_expr %prec "##"
{ $$=$1; mto($$, $2); }
| sequence_expr cycle_delay_range sequence_expr %prec "##"
{ init($$, ID_sva_sequence_concatenation); mto($$, $1); mto($2, $3); mto($$, $2); }
| expression_or_dist
| '(' sequence_expr_proper ')'
{ $$ = $2; }
| expression_or_dist boolean_abbrev
{ $$ = $2;
// preserve the operand ordering as in the source code
Expand Down
Loading