Fix parsing of `with` clause inside covergroups (#6618)

This commit is contained in:
Pawel Kojma 2025-11-04 15:12:30 +01:00 committed by GitHub
parent 8eed4e32ba
commit 5d5798b4af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 73 additions and 22 deletions

View File

@ -190,6 +190,7 @@ Paul Bowen-Huggett
Paul Swirhun
Paul Wright
Pawel Jewstafjew
Pawel Kojma
Pawel Sagan
Pengcheng Xu
Peter Birch

View File

@ -6862,11 +6862,11 @@ bins_or_options<nodep>: // ==IEEE: bins_or_options
// // Can't use wildcardE as results in conflicts
| bins_keyword idAny/*bin_identifier*/ bins_orBraE '=' '{' range_list '}' iffE
{ $$ = nullptr; BBCOVERIGN($<fl>4, "Ignoring unsupported: cover bin specification"); DEL($3, $6, $8); }
| bins_keyword idAny/*bin_identifier*/ bins_orBraE '=' '{' range_list '}' yWITH__CUR '{' cgexpr '}' iffE
| bins_keyword idAny/*bin_identifier*/ bins_orBraE '=' '{' range_list '}' yWITH__PAREN '(' cgexpr ')' iffE
{ $$ = nullptr; BBCOVERIGN($<fl>8, "Ignoring unsupported: cover bin 'with' specification"); DEL($3, $6, $10, $12); }
| yWILDCARD bins_keyword idAny/*bin_identifier*/ bins_orBraE '=' '{' range_list '}' iffE
{ $$ = nullptr; BBCOVERIGN($<fl>5, "Ignoring unsupported: cover bin 'wildcard' specification"); DEL($4, $7, $9); }
| yWILDCARD bins_keyword idAny/*bin_identifier*/ bins_orBraE '=' '{' range_list '}' yWITH__CUR '{' cgexpr '}' iffE
| yWILDCARD bins_keyword idAny/*bin_identifier*/ bins_orBraE '=' '{' range_list '}' yWITH__PAREN '(' cgexpr ')' iffE
{ $$ = nullptr; BBCOVERIGN($<fl>9, "Ignoring unsupported: cover bin 'wildcard' 'with' specification"); DEL($4, $7, $11, $13); }
//
// // cgexpr part of trans_list
@ -6980,6 +6980,16 @@ cross_body_item<nodep>: // ==IEEE: cross_body_item
;
select_expression<nodep>: // ==IEEE: select_expression
select_expression_r
{ $$ = $1; }
| select_expression yP_ANDAND select_expression
{ $$ = nullptr; BBCOVERIGN($2, "Ignoring unsupported: coverage select expression '&&'"); DEL($1, $3); }
| select_expression yP_OROR select_expression
{ $$ = nullptr; BBCOVERIGN($2, "Ignoring unsupported: coverage select expression '||'"); DEL($1, $3); }
;
// This non-terminal exists to disambiguate select_expression and make "with" bind tighter
select_expression_r<nodep>:
// // IEEE: select_condition expanded here
yBINSOF '(' bins_expression ')'
{ $$ = nullptr; BBCOVERIGN($1, "Ignoring unsupported: coverage select expression 'binsof'"); DEL($3); }
@ -6993,16 +7003,14 @@ select_expression<nodep>: // ==IEEE: select_expression
{ $$ = nullptr; BBCOVERIGN($1, "Ignoring unsupported: coverage select expression with"); DEL($3); }
| '!' yWITH__PAREN '(' cgexpr ')'
{ $$ = nullptr; BBCOVERIGN($1, "Ignoring unsupported: coverage select expression with"); DEL($4); }
| select_expression_r yWITH__PAREN '(' cgexpr ')'
{ $$ = nullptr; BBCOVERIGN($2, "Ignoring unsupported: coverage select expression with"); DEL($1, $4); }
// // IEEE-2012: Need clarification as to precedence
//UNSUP yWITH__PAREN '(' cgexpr ')' yMATCHES cgexpr { }
// // IEEE-2012: Need clarification as to precedence
//UNSUP '!' yWITH__PAREN '(' cgexpr ')' yMATCHES cgexpr { }
//
| '(' select_expression ')' { $$ = $2; }
| select_expression yP_ANDAND select_expression
{ $$ = nullptr; BBCOVERIGN($2, "Ignoring unsupported: coverage select expression '&&'"); DEL($1, $3); }
| select_expression yP_OROR select_expression
{ $$ = nullptr; BBCOVERIGN($2, "Ignoring unsupported: coverage select expression '||'"); DEL($1, $3); }
// // IEEE-2012: cross_identifier
// // Part of covergroup_expression - generic identifier
// // IEEE-2012: Need clarification as to precedence

View File

@ -223,13 +223,13 @@
118 | { bins ba[2] = {a}; }
| ^
%Warning-COVERIGN: t/t_covergroup_unsup.v:120:23: Ignoring unsupported: cover bin 'with' specification
120 | { bins ba = {a} with { b }; }
120 | { bins ba = {a} with ( b ); }
| ^~~~
%Warning-COVERIGN: t/t_covergroup_unsup.v:122:27: Ignoring unsupported: cover bin 'wildcard' specification
122 | { wildcard bins bwa = {a}; }
| ^
%Warning-COVERIGN: t/t_covergroup_unsup.v:123:34: Ignoring unsupported: cover bin 'wildcard' 'with' specification
123 | { wildcard bins bwaw = {a} with { b }; }
123 | { wildcard bins bwaw = {a} with ( b ); }
| ^~~~
%Warning-COVERIGN: t/t_covergroup_unsup.v:125:20: Ignoring unsupported: cover bin 'default'
125 | { bins def = default; }
@ -381,28 +381,67 @@
%Warning-COVERIGN: t/t_covergroup_unsup.v:157:10: Ignoring unsupported: coverage cross bin
157 | bins bin_or = binsof(a) || binsof(b);
| ^~~~
%Warning-COVERIGN: t/t_covergroup_unsup.v:158:26: Ignoring unsupported: coverage select expression 'binsof'
158 | bins bin_with = binsof(a) with (a);
| ^~~~~~
%Warning-COVERIGN: t/t_covergroup_unsup.v:158:36: Ignoring unsupported: coverage select expression with
158 | bins bin_with = binsof(a) with (a);
| ^~~~
%Warning-COVERIGN: t/t_covergroup_unsup.v:158:10: Ignoring unsupported: coverage cross bin
158 | bins bin_with = binsof(a) with (a);
| ^~~~
%Warning-COVERIGN: t/t_covergroup_unsup.v:159:29: Ignoring unsupported: coverage select expression 'binsof'
159 | bins bin_or_with = binsof(a) || binsof(a) with (a);
| ^~~~~~
%Warning-COVERIGN: t/t_covergroup_unsup.v:159:42: Ignoring unsupported: coverage select expression 'binsof'
159 | bins bin_or_with = binsof(a) || binsof(a) with (a);
| ^~~~~~
%Warning-COVERIGN: t/t_covergroup_unsup.v:159:52: Ignoring unsupported: coverage select expression with
159 | bins bin_or_with = binsof(a) || binsof(a) with (a);
| ^~~~
%Warning-COVERIGN: t/t_covergroup_unsup.v:159:39: Ignoring unsupported: coverage select expression '||'
159 | bins bin_or_with = binsof(a) || binsof(a) with (a);
| ^~
%Warning-COVERIGN: t/t_covergroup_unsup.v:159:10: Ignoring unsupported: coverage cross bin
159 | bins bin_or_with = binsof(a) || binsof(a) with (a);
| ^~~~
%Warning-COVERIGN: t/t_covergroup_unsup.v:160:30: Ignoring unsupported: coverage select expression 'binsof'
160 | bins bin_and_with = binsof(a) && binsof(a) with (a);
| ^~~~~~
%Warning-COVERIGN: t/t_covergroup_unsup.v:160:43: Ignoring unsupported: coverage select expression 'binsof'
160 | bins bin_and_with = binsof(a) && binsof(a) with (a);
| ^~~~~~
%Warning-COVERIGN: t/t_covergroup_unsup.v:160:53: Ignoring unsupported: coverage select expression with
160 | bins bin_and_with = binsof(a) && binsof(a) with (a);
| ^~~~
%Warning-COVERIGN: t/t_covergroup_unsup.v:160:40: Ignoring unsupported: coverage select expression '&&'
160 | bins bin_and_with = binsof(a) && binsof(a) with (a);
| ^~
%Warning-COVERIGN: t/t_covergroup_unsup.v:160:10: Ignoring unsupported: coverage cross bin
160 | bins bin_and_with = binsof(a) && binsof(a) with (a);
| ^~~~
%Warning-COVERIGN: t/t_covergroup_unsup.v:143:7: Ignoring unsupported: cover cross
143 | cross a, b {
| ^~~~~
%Warning-COVERIGN: t/t_covergroup_unsup.v:142:4: Ignoring unsupported: covergroup
142 | covergroup cg_cross_bins;
| ^~~~~~~~~~
%Warning-COVERIGN: t/t_covergroup_unsup.v:161:4: Ignoring unsupported: covergroup
161 | covergroup cgArgs(int cg_lim);
%Warning-COVERIGN: t/t_covergroup_unsup.v:164:4: Ignoring unsupported: covergroup
164 | covergroup cgArgs(int cg_lim);
| ^~~~~~~~~~
%Warning-COVERIGN: t/t_covergroup_unsup.v:168:23: Ignoring unsupported: coverage clocking event
168 | covergroup cov1 @m_z;
%Warning-COVERIGN: t/t_covergroup_unsup.v:171:23: Ignoring unsupported: coverage clocking event
171 | covergroup cov1 @m_z;
| ^
%Warning-COVERIGN: t/t_covergroup_unsup.v:169:10: Ignoring unsupported: coverpoint
169 | coverpoint m_x;
%Warning-COVERIGN: t/t_covergroup_unsup.v:172:10: Ignoring unsupported: coverpoint
172 | coverpoint m_x;
| ^~~~~~~~~~
%Warning-COVERIGN: t/t_covergroup_unsup.v:170:10: Ignoring unsupported: coverpoint
170 | coverpoint m_y;
%Warning-COVERIGN: t/t_covergroup_unsup.v:173:10: Ignoring unsupported: coverpoint
173 | coverpoint m_y;
| ^~~~~~~~~~
%Warning-COVERIGN: t/t_covergroup_unsup.v:168:7: Ignoring unsupported: covergroup
168 | covergroup cov1 @m_z;
%Warning-COVERIGN: t/t_covergroup_unsup.v:171:7: Ignoring unsupported: covergroup
171 | covergroup cov1 @m_z;
| ^~~~~~~~~~
%Warning-COVERIGN: t/t_covergroup_unsup.v:178:7: Ignoring unsupported: covergroup
178 | covergroup extends cg_empty;
%Warning-COVERIGN: t/t_covergroup_unsup.v:181:7: Ignoring unsupported: covergroup
181 | covergroup extends cg_empty;
| ^~~~~~~~~~
%Error: Exiting due to

View File

@ -117,10 +117,10 @@ module t (/*AUTOARG*/
{ bins ba[] = {a}; }
{ bins ba[2] = {a}; }
{ bins ba = {a} with { b }; }
{ bins ba = {a} with ( b ); }
{ wildcard bins bwa = {a}; }
{ wildcard bins bwaw = {a} with { b }; }
{ wildcard bins bwaw = {a} with ( b ); }
{ bins def = default; }
{ bins defs = default sequence; }
@ -155,6 +155,9 @@ module t (/*AUTOARG*/
bins bin_par = (binsof(a));
bins bin_and = binsof(a) && binsof(b);
bins bin_or = binsof(a) || binsof(b);
bins bin_with = binsof(a) with (a);
bins bin_or_with = binsof(a) || binsof(a) with (a);
bins bin_and_with = binsof(a) && binsof(a) with (a);
}
endgroup