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 sequence and/or #943

Merged
merged 1 commit into from
Jan 22, 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
9 changes: 6 additions & 3 deletions regression/verilog/SVA/sequence_and1.desc
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
KNOWNBUG
CORE
sequence_and1.sv

^EXIT=0$
^\[main\.p0\] main\.x == 0 and main\.x == 1: REFUTED$
^\[main\.p1\] strong\(main\.x == 0 and main\.x == 1\): REFUTED$
^\[main\.p2\] main\.x == 0 and \(nexttime main\.x == 1\): PROVED up to bound \d+$
^\[main\.p3\] \(nexttime main\.x == 1\) and main\.x == 0: PROVED up to bound \d+$
^EXIT=10$
^SIGNAL=0$
--
^warning: ignoring
--
The grammar for 'SVA sequence and' is missing.
6 changes: 5 additions & 1 deletion regression/verilog/SVA/sequence_and1.sv
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ module main(input clk);
initial p0: assert property (x == 0 and x == 1);

// Given two sequences, 'and' yields a sequence, not a property
initial p1: assert property ((x == 0 and x == 1)[*1]);
initial p1: assert property (strong(x == 0 and x == 1));

// But given a property on either side, 'and' yields a property
initial p2: assert property (x == 0 and nexttime x == 1);
initial p3: assert property (nexttime x == 1 and x == 0);

endmodule
7 changes: 5 additions & 2 deletions regression/verilog/SVA/sequence_or1.desc
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
KNOWNBUG
CORE
sequence_or1.sv

^\[main\.p0\] main\.x == 0 or main\.x == 1: PROVED up to bound \d+$
^\[main\.p1\] strong\(main\.x == 0 or main\.x == 1\): PROVED up to bound \d+$
^\[main\.p2\] main\.x == 0 or \(nexttime main\.x == 1\): PROVED up to bound \d+$
^\[main\.p3\] \(nexttime main\.x == 1\) or main\.x == 1: PROVED up to bound \d+$
^EXIT=0$
^SIGNAL=0$
--
^warning: ignoring
--
The grammar for 'SVA sequence or' is missing.
6 changes: 5 additions & 1 deletion regression/verilog/SVA/sequence_or1.sv
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ module main(input clk);
initial p0: assert property (x == 0 or x == 1);

// Given two sequences, 'or' yields a sequence, not a property
initial p1: assert property ((x == 0 or x == 1)[*1]);
initial p1: assert property (strong(x == 0 or x == 1));

// But given a property on either side, 'or' yields a property
initial p2: assert property (x==0 or nexttime x == 1);
initial p3: assert property (nexttime x==1 or x == 1);

endmodule
11 changes: 10 additions & 1 deletion src/verilog/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,10 @@ int yyverilogerror(const char *error)
// whereas the table gives them in decreasing order.
// The precendence of the assertion operators is lower than
// those in Table 11-2.
//
// SEQUENCE_TO_PROPERTY is an artificial token to give
// the right precedence to the conversion of a sequence_expr
// to a property_expr.
%nonassoc "property_expr_abort" // accept_on, reject_on, ...
%nonassoc "property_expr_clocking_event" // @(...) property_expr
%nonassoc "always" "s_always" "eventually" "s_eventually"
Expand All @@ -564,6 +568,7 @@ int yyverilogerror(const char *error)
%right "iff"
%left "or"
%left "and"
%nonassoc SEQUENCE_TO_PROPERTY
%nonassoc "not" "nexttime" "s_nexttime"
%left "intersect"
%left "within"
Expand Down Expand Up @@ -2419,7 +2424,7 @@ sequence_formal_type:
// for property_expr into property_expr and property_expr_proper.

property_expr:
sequence_expr
sequence_expr %prec SEQUENCE_TO_PROPERTY
| property_expr_proper
;

Expand Down Expand Up @@ -2582,8 +2587,12 @@ sequence_expr_proper:
// preserve the operand ordering as in the source code
stack_expr($$).operands().insert(stack_expr($$).operands().begin(), stack_expr($1));
}
| sequence_expr "and" sequence_expr
{ init($$, ID_sva_and); mto($$, $1); mto($$, $3); }
| sequence_expr "intersect" sequence_expr
{ init($$, ID_sva_sequence_intersect); mto($$, $1); mto($$, $3); }
| sequence_expr "or" sequence_expr
{ init($$, ID_sva_or); mto($$, $1); mto($$, $3); }
| "first_match" '(' sequence_expr ')'
{ init($$, ID_sva_sequence_first_match); mto($$, $3); }
| "first_match" '(' sequence_expr ',' sequence_match_item_brace ')'
Expand Down
Loading