Accept hierarchical refs as cross members -- marked COVIGN for now

Signed-off-by: Matthew Ballance <matt.ballance@gmail.com>
This commit is contained in:
Matthew Ballance 2026-06-22 02:55:35 +00:00
parent 0cd13f80c9
commit b9d251c4e5
3 changed files with 24 additions and 0 deletions

View File

@ -7341,6 +7341,21 @@ cross_itemList<nodep>: // IEEE: part of list_of_cross_items
cross_item<nodep>: // ==IEEE: cross_item cross_item<nodep>: // ==IEEE: cross_item
id/*cover_point_identifier*/ id/*cover_point_identifier*/
{ $$ = new AstCoverpointRef{$<fl>1, *$1}; } { $$ = new AstCoverpointRef{$<fl>1, *$1}; }
// // Verilator extension beyond strict IEEE (cross_item is a simple
// // identifier): some tools accept a hierarchical/dotted reference
// // here. A dotted reference can never name a coverpoint (coverpoint
// // identifiers are flat, local names), so it is necessarily a plain
// // data reference, i.e. an implicit coverpoint over a variable.
// // Verilator does not support implicit coverpoints, so V3Covergroup
// // drops the whole cross with a COVERIGN warning; accept it here so
// // the file parses instead of erroring on the '.'.
| id/*variable*/ crossItemHier
{ $$ = new AstCoverpointRef{$<fl>1, *$1 + *$2}; }
;
crossItemHier<strp>: // Verilator extension: dotted suffix of a hierarchical cross_item
'.' idAny { $$ = PARSEP->newString("." + *$2); }
| crossItemHier '.' idAny { $$ = PARSEP->newString(*$1 + "." + *$3); }
; ;
cross_body<nodep>: // ==IEEE: cross_body cross_body<nodep>: // ==IEEE: cross_body

View File

@ -7,4 +7,8 @@
: ... note: In instance 't' : ... note: In instance 't'
15 | cross_implicit: cross cp_a, var_x; 15 | cross_implicit: cross cp_a, var_x;
| ^~~~~ | ^~~~~
%Warning-COVERIGN: t/t_covergroup_cross_opt_unsup.v:18:29: Unsupported: cross of 's_cfg.m_p' which is not a coverpoint (implicit coverpoint)
: ... note: In instance 't'
18 | cross_hier: cross cp_a, s_cfg.m_p;
| ^~~~~
%Error: Exiting due to %Error: Exiting due to

View File

@ -13,7 +13,12 @@ module t;
option.per_instance = 1; // unsupported for cross; triggers COVERIGN option.per_instance = 1; // unsupported for cross; triggers COVERIGN
} }
cross_implicit: cross cp_a, var_x; cross_implicit: cross cp_a, var_x;
// Hierarchical/dotted cross item: can only be a data reference (implicit
// coverpoint), never a coverpoint; treated as unsupported (COVERIGN)
cross_hier: cross cp_a, s_cfg.m_p;
endgroup endgroup
typedef struct packed {logic m_p; logic h_mode;} cfg_t;
cfg_t s_cfg = '0;
logic var_x = 1'b0; logic var_x = 1'b0;
cg cg_i = new; cg cg_i = new;
initial begin initial begin