From 39a5bce8a64ad295c2cbe9619da3c4a919a8a182 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sun, 12 Mar 2023 14:11:11 -0400 Subject: [PATCH] Parse covergroup, still unsupported. --- src/verilog.l | 18 +- src/verilog.y | 501 ++++++++++++++------------ test_regress/t/t_covergroup_unsup.out | 380 +++++++++++++++++++ test_regress/t/t_covergroup_unsup.pl | 20 + test_regress/t/t_covergroup_unsup.v | 157 ++++++++ 5 files changed, 831 insertions(+), 245 deletions(-) create mode 100644 test_regress/t/t_covergroup_unsup.out create mode 100755 test_regress/t/t_covergroup_unsup.pl create mode 100644 test_regress/t/t_covergroup_unsup.v diff --git a/src/verilog.l b/src/verilog.l index 947e9ce03..8755dd3d8 100644 --- a/src/verilog.l +++ b/src/verilog.l @@ -498,8 +498,8 @@ vnum {vnum1}|{vnum2}|{vnum3}|{vnum4}|{vnum5} "assume" { FL; return yASSUME; } "before" { FL; return yBEFORE; } "bind" { FL; return yBIND; } - "bins" { ERROR_RSVD_WORD("SystemVerilog 2005"); } - "binsof" { ERROR_RSVD_WORD("SystemVerilog 2005"); } + "bins" { FL; return yBINS; } + "binsof" { FL; return yBINSOF; } "bit" { FL; return yBIT; } "break" { FL; return yBREAK; } "byte" { FL; return yBYTE; } @@ -511,14 +511,14 @@ vnum {vnum1}|{vnum2}|{vnum3}|{vnum4}|{vnum5} "context" { FL; return yCONTEXT; } "continue" { FL; return yCONTINUE; } "cover" { FL; return yCOVER; } - "covergroup" { ERROR_RSVD_WORD("SystemVerilog 2005"); } - "coverpoint" { ERROR_RSVD_WORD("SystemVerilog 2005"); } - "cross" { ERROR_RSVD_WORD("SystemVerilog 2005"); } + "covergroup" { FL; return yCOVERGROUP; } + "coverpoint" { FL; return yCOVERPOINT; } + "cross" { FL; return yCROSS; } "dist" { FL; return yDIST; } "do" { FL; return yDO; } "endclass" { FL; return yENDCLASS; } "endclocking" { FL; return yENDCLOCKING; } - "endgroup" { ERROR_RSVD_WORD("SystemVerilog 2005"); } + "endgroup" { FL; return yENDGROUP; } "endinterface" { FL; return yENDINTERFACE; } "endpackage" { FL; return yENDPACKAGE; } "endprogram" { FL; return yENDPROGRAM; } @@ -533,8 +533,8 @@ vnum {vnum1}|{vnum2}|{vnum3}|{vnum4}|{vnum5} "first_match" { FL; return yFIRST_MATCH; } "forkjoin" { FL; return yFORKJOIN; } "iff" { FL; return yIFF; } - "ignore_bins" { ERROR_RSVD_WORD("SystemVerilog 2005"); } - "illegal_bins" { ERROR_RSVD_WORD("SystemVerilog 2005"); } + "ignore_bins" { FL; return yIGNORE_BINS; } + "illegal_bins" { FL; return yILLEGAL_BINS; } "import" { FL; return yIMPORT; } "inside" { FL; return yINSIDE; } "int" { FL; return yINT; } @@ -585,7 +585,7 @@ vnum {vnum1}|{vnum2}|{vnum3}|{vnum4}|{vnum5} "virtual" { FL; return yVIRTUAL__LEX; } "void" { FL; return yVOID; } "wait_order" { FL; return yWAIT_ORDER; } - "wildcard" { ERROR_RSVD_WORD("SystemVerilog 2005"); } + "wildcard" { FL; return yWILDCARD; } "with" { FL; return yWITH__LEX; } "within" { FL; return yWITHIN; } } diff --git a/src/verilog.y b/src/verilog.y index 20ea127fc..1fdc118a7 100644 --- a/src/verilog.y +++ b/src/verilog.y @@ -550,8 +550,8 @@ BISONPRE_VERSION(3.7,%define api.header.include {"V3ParseBison.h"}) %token yBEFORE "before" %token yBEGIN "begin" %token yBIND "bind" -//UNSUP %token yBINS "bins" -//UNSUP %token yBINSOF "binsof" +%token yBINS "bins" +%token yBINSOF "binsof" %token yBIT "bit" %token yBREAK "break" %token yBUF "buf" @@ -573,9 +573,9 @@ BISONPRE_VERSION(3.7,%define api.header.include {"V3ParseBison.h"}) %token yCONTEXT "context" %token yCONTINUE "continue" %token yCOVER "cover" -//UNSUP %token yCOVERGROUP "covergroup" -//UNSUP %token yCOVERPOINT "coverpoint" -//UNSUP %token yCROSS "cross" +%token yCOVERGROUP "covergroup" +%token yCOVERPOINT "coverpoint" +%token yCROSS "cross" %token yDEASSIGN "deassign" %token yDEFAULT "default" %token yDEFPARAM "defparam" @@ -591,7 +591,7 @@ BISONPRE_VERSION(3.7,%define api.header.include {"V3ParseBison.h"}) %token yENDCLOCKING "endclocking" %token yENDFUNCTION "endfunction" %token yENDGENERATE "endgenerate" -//UNSUP %token yENDGROUP "endgroup" +%token yENDGROUP "endgroup" %token yENDINTERFACE "endinterface" %token yENDMODULE "endmodule" %token yENDPACKAGE "endpackage" @@ -627,8 +627,8 @@ BISONPRE_VERSION(3.7,%define api.header.include {"V3ParseBison.h"}) %token yHIGHZ1 "highz1" %token yIF "if" %token yIFF "iff" -//UNSUP %token yIGNORE_BINS "ignore_bins" -//UNSUP %token yILLEGAL_BINS "illegal_bins" +%token yIGNORE_BINS "ignore_bins" +%token yILLEGAL_BINS "illegal_bins" %token yIMPLEMENTS "implements" %token yIMPLIES "implies" %token yIMPORT "import" @@ -775,7 +775,7 @@ BISONPRE_VERSION(3.7,%define api.header.include {"V3ParseBison.h"}) %token yWEAK0 "weak0" %token yWEAK1 "weak1" %token yWHILE "while" -//UNSUP %token yWILDCARD "wildcard" +%token yWILDCARD "wildcard" %token yWIRE "wire" %token yWITHIN "within" %token yWITH__BRA "with-then-[" @@ -1261,7 +1261,7 @@ package_or_generate_item_declaration: // ==IEEE: package_or_generate_i // // class_constructor_declaration is part of function_declaration // // local_parameter_declaration under parameter_declaration | parameter_declaration ';' { $$ = $1; } - //UNSUP covergroup_declaration { $$ = $1; } + | covergroup_declaration { $$ = $1; } | assertion_item_declaration { $$ = $1; } | ';' { $$ = nullptr; } ; @@ -1417,18 +1417,18 @@ parameter_port_listE: // IEEE: parameter_port_list + empty == paramete paramPortDeclOrArgList: // IEEE: list_of_param_assignments + { parameter_port_declaration } paramPortDeclOrArg { $$ = $1; } | paramPortDeclOrArgList ',' paramPortDeclOrArg { $$ = $1->addNext($3); } - | paramPortDeclOrArgList sigAttrScope {$$ = $1;} + | paramPortDeclOrArgList sigAttrScope { $$ = $1; } ; paramPortDeclOrArg: // IEEE: param_assignment + parameter_port_declaration // // We combine the two as we can't tell which follows a comma - paramPortDeclOrArgSub {$$ = $1;} + paramPortDeclOrArgSub { $$ = $1; } | vlTag { $$ = nullptr; } ; paramPortDeclOrArgSub: parameter_port_declarationFrontE param_assignment { $$ = $2; } | parameter_port_declarationTypeFrontE type_assignment { $$ = $2; } - | sigAttrScope paramPortDeclOrArgSub {$$ = $2; } + | sigAttrScope paramPortDeclOrArgSub { $$ = $2; } ; portsStarE: // IEEE: .* + list_of_ports + list_of_port_declarations + empty @@ -1683,7 +1683,7 @@ anonymous_program_item: // ==IEEE: anonymous_program_item task_declaration { $$ = $1; } | function_declaration { $$ = $1; } | class_declaration { $$ = $1; } - //UNSUP covergroup_declaration { $$ = $1; } + | covergroup_declaration { $$ = $1; } // // class_constructor_declaration is part of function_declaration | ';' { $$ = nullptr; } ; @@ -3629,21 +3629,6 @@ statementVerilatorPragmas: { $$ = new AstPragma{$1, VPragmaType::COVERAGE_BLOCK_OFF}; } ; -//UNSUPoperator_assignment: // IEEE: operator_assignment -//UNSUP ~f~exprLvalue '=' delay_or_event_controlE expr { } -//UNSUP | ~f~exprLvalue yP_PLUSEQ expr { } -//UNSUP | ~f~exprLvalue yP_MINUSEQ expr { } -//UNSUP | ~f~exprLvalue yP_TIMESEQ expr { } -//UNSUP | ~f~exprLvalue yP_DIVEQ expr { } -//UNSUP | ~f~exprLvalue yP_MODEQ expr { } -//UNSUP | ~f~exprLvalue yP_ANDEQ expr { } -//UNSUP | ~f~exprLvalue yP_OREQ expr { } -//UNSUP | ~f~exprLvalue yP_XOREQ expr { } -//UNSUP | ~f~exprLvalue yP_SLEFTEQ expr { } -//UNSUP | ~f~exprLvalue yP_SRIGHTEQ expr { } -//UNSUP | ~f~exprLvalue yP_SSRIGHTEQ expr { } -//UNSUP ; - foperator_assignment: // IEEE: operator_assignment (for first part of expression) fexprLvalue '=' delay_or_event_controlE expr { $$ = new AstAssign{$2, $1, $4, $3}; } // @@ -3797,10 +3782,11 @@ value_range: // ==IEEE: value_range | '[' expr ':' expr ']' { $$ = new AstInsideRange{$1, $2, $4}; } ; -//UNSUPcovergroup_value_range: // ==IEEE-2012: covergroup_value_range -//UNSUP cgexpr { $$ = $1; } -//UNSUP | '[' cgexpr ':' cgexpr ']' { } -//UNSUP ; +covergroup_value_range: // ==IEEE-2012: covergroup_value_range + cgexpr { $$ = $1; } + | '[' cgexpr ':' cgexpr ']' + { $$ = nullptr; BBUNSUP($1, "Unsupported: covergroup value range"); } + ; caseCondList: // IEEE: part of case_item exprTypeCompare { $$ = $1; } @@ -6225,239 +6211,281 @@ boolean_abbrev: // ==IEEE: boolean_abbrev //************************************************ // Covergroup -//UNSUPcovergroup_declaration: // ==IEEE: covergroup_declaration -//UNSUP covergroup_declarationFront coverage_eventE ';' coverage_spec_or_optionListE -//UNSUP yENDGROUP endLabelE -//UNSUP { PARSEP->endgroupCb($5, $5); -//UNSUP SYMP->popScope($$); } -//UNSUP | covergroup_declarationFront '(' tf_port_listE ')' coverage_eventE ';' coverage_spec_or_optionListE -//UNSUP yENDGROUP endLabelE -//UNSUP { PARSEP->endgroupCb($8, $8); -//UNSUP SYMP->popScope($$); } -//UNSUP ; +covergroup_declaration: // ==IEEE: covergroup_declaration + covergroup_declarationFront coverage_eventE ';' + /*cont*/ coverage_spec_or_optionListE + /*cont*/ yENDGROUP endLabelE + { $$ = $1; + SYMP->popScope($$); + GRAMMARP->endLabel($6, $1, $6); } + | covergroup_declarationFront '(' tf_port_listE ')' + /*cont*/ coverage_eventE ';' coverage_spec_or_optionListE + /*cont*/ yENDGROUP endLabelE + { $$ = $1; + SYMP->popScope($$); + GRAMMARP->endLabel($9, $1, $9); } + ; -//UNSUPcovergroup_declarationFront: // IEEE: part of covergroup_declaration -//UNSUP yCOVERGROUP idAny -//UNSUP { SYMP->pushNew($$); -//UNSUP PARSEP->covergroupCb($1, $1, $2); } -//UNSUP ; +covergroup_declarationFront: // IEEE: part of covergroup_declaration + yCOVERGROUP idAny + { $$ = new AstClass{$2, *$2}; + BBUNSUP($1, "Unsupported: covergroup"); + SYMP->pushNew($$); + v3Global.setHasClasses(); } + ; -//UNSUPcgexpr: // IEEE-2012: covergroup_expression, before that just expression -//UNSUP expr { $$ = $1; } -//UNSUP ; +cgexpr: // IEEE-2012: covergroup_expression, before that just expression + expr { $$ = $1; } + ; -//UNSUPcoverage_spec_or_optionListE: // IEEE: [{coverage_spec_or_option}] -//UNSUP /* empty */ { $$ = nullptr; } -//UNSUP | coverage_spec_or_optionList { $$ = $1; } -//UNSUP ; +coverage_spec_or_optionListE: // IEEE: [{coverage_spec_or_option}] + /* empty */ { $$ = nullptr; } + | coverage_spec_or_optionList { $$ = $1; } + ; -//UNSUPcoverage_spec_or_optionList: // IEEE: {coverage_spec_or_option} -//UNSUP coverage_spec_or_option { $$ = $1; } -//UNSUP | coverage_spec_or_optionList coverage_spec_or_option { $$ = addNextNull($1, $2); } -//UNSUP ; +coverage_spec_or_optionList: // IEEE: {coverage_spec_or_option} + coverage_spec_or_option { $$ = $1; } + | coverage_spec_or_optionList coverage_spec_or_option { $$ = addNextNull($1, $2); } + ; -//UNSUPcoverage_spec_or_option: // ==IEEE: coverage_spec_or_option -//UNSUP // // IEEE: coverage_spec -//UNSUP cover_point { $$ = $1; } -//UNSUP | cover_cross { $$ = $1; } -//UNSUP | coverage_option ';' { $$ = $1; } -//UNSUP | error { $$ = nullptr; } -//UNSUP ; +coverage_spec_or_option: // ==IEEE: coverage_spec_or_option + // // IEEE: coverage_spec + cover_point { $$ = $1; } + | cover_cross { $$ = $1; } + | coverage_option ';' { $$ = $1; } + | error { $$ = nullptr; } + ; -//UNSUPcoverage_option: // ==IEEE: coverage_option -//UNSUP // // option/type_option aren't really keywords -//UNSUP id/*yOPTION | yTYPE_OPTION*/ '.' idAny/*member_identifier*/ '=' expr { } -//UNSUP ; +coverage_option: // ==IEEE: coverage_option + // // option/type_option aren't really keywords + id/*yOPTION | yTYPE_OPTION*/ '.' idAny/*member_identifier*/ '=' expr + { // TODO: check that 'id' is 'option' or 'type_option' + $$ = nullptr; BBUNSUP($1, "Unsupported: coverage option"); } + ; -//UNSUPcover_point: // ==IEEE: cover_point -//UNSUP /**/ yCOVERPOINT expr iffE bins_or_empty { } -//UNSUP // // IEEE-2012: class_scope before an ID -//UNSUP | /**/ /**/ /**/ id ':' yCOVERPOINT expr iffE bins_or_empty { } -//UNSUP | class_scope_id ':' yCOVERPOINT expr iffE bins_or_empty { } -//UNSUP | class_scope_id id data_type id ':' yCOVERPOINT expr iffE bins_or_empty { } -//UNSUP | class_scope_id id /**/ id ':' yCOVERPOINT expr iffE bins_or_empty { } -//UNSUP | /**/ id /**/ id ':' yCOVERPOINT expr iffE bins_or_empty { } -//UNSUP // // IEEE-2012: -//UNSUP | bins_or_empty { $$ = $1; } -//UNSUP; +cover_point: // ==IEEE: cover_point + // // [ [ data_type_or_implicit ] cover_point_identifier ':' ] yCOVERPOINT + yCOVERPOINT expr iffE bins_or_empty + { $$ = nullptr; BBUNSUP($1, "Unsupported: cover point"); } + // // IEEE-2012: class_scope before an ID + | id/*cover_point_id*/ ':' yCOVERPOINT expr iffE bins_or_empty + { $$ = nullptr; BBUNSUP($3, "Unsupported: cover point"); } + // // data_type_or_implicit expansion + | data_type id/*cover_point_id*/ ':' yCOVERPOINT expr iffE bins_or_empty + { $$ = nullptr; BBUNSUP($4, "Unsupported: cover point"); } + | yVAR data_type id/*cover_point_id*/ ':' yCOVERPOINT expr iffE bins_or_empty + { $$ = nullptr; BBUNSUP($5, "Unsupported: cover point"); } + | yVAR implicit_typeE id/*cover_point_id*/ ':' yCOVERPOINT expr iffE bins_or_empty + { $$ = nullptr; BBUNSUP($5, "Unsupported: cover point"); } + | signingE rangeList id/*cover_point_id*/ ':' yCOVERPOINT expr iffE bins_or_empty + { $$ = nullptr; BBUNSUP($5, "Unsupported: cover point"); } + | signing id/*cover_point_id*/ ':' yCOVERPOINT expr iffE bins_or_empty + { $$ = nullptr; BBUNSUP($4, "Unsupported: cover point"); } + // // IEEE-2012: + | bins_or_empty { $$ = $1; } + ; -//UNSUPiffE: // IEEE: part of cover_point, others -//UNSUP /* empty */ { $$ = nullptr; } -//UNSUP | yIFF '(' expr ')' { } -//UNSUP ; +iffE: // IEEE: part of cover_point, others + /* empty */ { $$ = nullptr; } + | yIFF '(' expr ')' + { $$ = nullptr; BBUNSUP($1, "Unsupported: cover 'iff'"); } + ; -//UNSUPbins_or_empty: // ==IEEE: bins_or_empty -//UNSUP '{' bins_or_optionsList '}' { $$ = $2; } -//UNSUP | '{' '}' { $$ = nullptr; } -//UNSUP | ';' { $$ = nullptr; } -//UNSUP ; +bins_or_empty: // ==IEEE: bins_or_empty + '{' bins_or_optionsList '}' { $$ = $2; } + | '{' '}' { $$ = nullptr; } + | ';' { $$ = nullptr; } + ; -//UNSUPbins_or_optionsList: // IEEE: { bins_or_options ';' } -//UNSUP bins_or_options ';' { $$ = $1; } -//UNSUP | bins_or_optionsList bins_or_options ';' { $$ = addNextNull($1, $2); } -//UNSUP ; +bins_or_optionsList: // IEEE: { bins_or_options ';' } + bins_or_options ';' { $$ = $1; } + | bins_or_optionsList bins_or_options ';' { $$ = addNextNull($1, $2); } + ; -//UNSUPbins_or_options: // ==IEEE: bins_or_options -//UNSUP // // Superset of IEEE - we allow []'s in more places -//UNSUP coverage_option { $$ = $1; } -//UNSUP // // Can't use wildcardE as results in conflicts -//UNSUP | /**/ bins_keyword id/*bin_identifier*/ bins_orBraE '=' '{' open_range_list '}' iffE { } -//UNSUP | yWILDCARD bins_keyword id/*bin_identifier*/ bins_orBraE '=' '{' open_range_list '}' iffE { } -//UNSUP | /**/ bins_keyword id/*bin_identifier*/ bins_orBraE '=' '{' open_range_list '}' yWITH__CUR '{' cgexpr ')' iffE { } -//UNSUP | yWILDCARD bins_keyword id/*bin_identifier*/ bins_orBraE '=' '{' open_range_list '}' yWITH__CUR '{' cgexpr ')' iffE { } -//UNSUP // -//UNSUP // // cgexpr part of trans_list -//UNSUP // -//UNSUP | /**/ bins_keyword id/*bin_identifier*/ bins_orBraE '=' trans_list iffE { } -//UNSUP | yWILDCARD bins_keyword id/*bin_identifier*/ bins_orBraE '=' trans_list iffE { } -//UNSUP // -//UNSUP | bins_keyword id/*bin_identifier*/ bins_orBraE '=' yDEFAULT iffE { } -//UNSUP // -//UNSUP | bins_keyword id/*bin_identifier*/ bins_orBraE '=' yDEFAULT ySEQUENCE iffE { } -//UNSUP ; +bins_or_options: // ==IEEE: bins_or_options + // // Superset of IEEE - we allow []'s in more places + coverage_option { $$ = $1; } + // // Can't use wildcardE as results in conflicts + | bins_keyword id/*bin_identifier*/ bins_orBraE '=' '{' open_range_list '}' iffE + { $$ = nullptr; BBUNSUP($4, "Unsupported: cover bin specification"); } + | bins_keyword id/*bin_identifier*/ bins_orBraE '=' '{' open_range_list '}' yWITH__CUR '{' cgexpr '}' iffE + { $$ = nullptr; BBUNSUP($8, "Unsupported: cover bin 'with' specification"); } + | yWILDCARD bins_keyword id/*bin_identifier*/ bins_orBraE '=' '{' open_range_list '}' iffE + { $$ = nullptr; BBUNSUP($5, "Unsupported: cover bin 'wildcard' specification"); } + | yWILDCARD bins_keyword id/*bin_identifier*/ bins_orBraE '=' '{' open_range_list '}' yWITH__CUR '{' cgexpr '}' iffE + { $$ = nullptr; BBUNSUP($9, "Unsupported: cover bin 'wildcard' 'with' specification"); } + // + // // cgexpr part of trans_list + | bins_keyword id/*bin_identifier*/ bins_orBraE '=' trans_list iffE + { $$ = nullptr; BBUNSUP($4, "Unsupported: cover bin trans list"); } + | yWILDCARD bins_keyword id/*bin_identifier*/ bins_orBraE '=' trans_list iffE + { $$ = nullptr; BBUNSUP($1, "Unsupported: cover bin 'wildcard' trans list"); } + // + | bins_keyword id/*bin_identifier*/ bins_orBraE '=' yDEFAULT iffE + { $$ = nullptr; BBUNSUP($5, "Unsupported: cover bin 'default'"); } + | bins_keyword id/*bin_identifier*/ bins_orBraE '=' yDEFAULT ySEQUENCE iffE + { $$ = nullptr; BBUNSUP($6, "Unsupported: cover bin 'default' 'sequence'"); } + ; -//UNSUPbins_orBraE: // IEEE: part of bins_or_options: -//UNSUP /* empty */ { $$ = nullptr; } -//UNSUP | '[' ']' { } -//UNSUP | '[' cgexpr ']' { } -//UNSUP ; +bins_orBraE: // IEEE: part of bins_or_options: + /* empty */ { $$ = nullptr; } + | '[' ']' { $$ = nullptr; /*UNSUP*/ } + | '[' cgexpr ']' { $$ = nullptr; /*UNSUP*/ } + ; -//UNSUPbins_keyword: // ==IEEE: bins_keyword -//UNSUP yBINS { } -//UNSUP | yILLEGAL_BINS { } -//UNSUP | yIGNORE_BINS { } -//UNSUP ; +bins_keyword: // ==IEEE: bins_keyword + yBINS { $$ = $1; /*UNSUP*/ } + | yILLEGAL_BINS { $$ = $1; /*UNSUP*/ } + | yIGNORE_BINS { $$ = $1; /*UNSUP*/ } + ; -//UNSUPcovergroup_range_list: // ==IEEE: covergroup_range_list -//UNSUP covergroup_value_range { $$ = $1; } -//UNSUP | covergroup_range_list ',' covergroup_value_range { $$ = addNextNull($1, $3); } -//UNSUP ; +trans_list: // ==IEEE: trans_list + '(' trans_set ')' { $$ = $2; } + | trans_list ',' '(' trans_set ')' { $$ = addNextNull($1, $4); } + ; -//UNSUPtrans_list: // ==IEEE: trans_list -//UNSUP '(' trans_set ')' { $$ = $2; } -//UNSUP | trans_list ',' '(' trans_set ')' { } -//UNSUP ; +trans_set: // ==IEEE: trans_set + trans_range_list { $$ = $1; } + // // Note the { => } in the grammer, this is really a list + | trans_set yP_EQGT trans_range_list + { $$ = $1; BBUNSUP($2, "Unsupported: cover trans set '=>'"); } + ; -//UNSUPtrans_set: // ==IEEE: trans_set -//UNSUP trans_range_list { $$ = $1; } -//UNSUP // // Note the { => } in the grammer, this is really a list -//UNSUP | trans_set yP_EQGT trans_range_list { } -//UNSUP ; +trans_range_list: // ==IEEE: trans_range_list + trans_item { $$ = $1; } + | trans_item yP_BRASTAR cgexpr ']' + { $$ = nullptr; BBUNSUP($2, "Unsupported: cover '[*'"); } + | trans_item yP_BRASTAR cgexpr ':' cgexpr ']' + { $$ = nullptr; BBUNSUP($2, "Unsupported: cover '[*'"); } + | trans_item yP_BRAMINUSGT cgexpr ']' + { $$ = nullptr; BBUNSUP($2, "Unsupported: cover '[->'"); } + | trans_item yP_BRAMINUSGT cgexpr ':' cgexpr ']' + { $$ = nullptr; BBUNSUP($2, "Unsupported: cover '[->'"); } + | trans_item yP_BRAEQ cgexpr ']' + { $$ = nullptr; BBUNSUP($2, "Unsupported: cover '[='"); } + | trans_item yP_BRAEQ cgexpr ':' cgexpr ']' + { $$ = nullptr; BBUNSUP($2, "Unsupported: cover '[='"); } + ; -//UNSUPtrans_range_list: // ==IEEE: trans_range_list -//UNSUP trans_item { $$ = $1; } -//UNSUP | trans_item yP_BRASTAR repeat_range ']' { } -//UNSUP | trans_item yP_BRAMINUSGT repeat_range ']' { } -//UNSUP | trans_item yP_BRAEQ repeat_range ']' { } -//UNSUP ; +trans_item: // ==IEEE: range_list + covergroup_range_list { $$ = $1; } + ; -//UNSUPtrans_item: // ==IEEE: range_list -//UNSUP covergroup_range_list { $$ = $1; } -//UNSUP ; +covergroup_range_list: // ==IEEE: covergroup_range_list + covergroup_value_range { $$ = $1; } + | covergroup_range_list ',' covergroup_value_range { $$ = addNextNull($1, $3); } + ; -//UNSUPrepeat_range: // ==IEEE: repeat_range -//UNSUP cgexpr { $$ = $1; } -//UNSUP | cgexpr ':' cgexpr { $$ = addNextNull($1, $3); } -//UNSUP ; -//UNSUPcover_cross: // ==IEEE: cover_cross -//UNSUP id/*cover_point_identifier*/ ':' yCROSS list_of_cross_items iffE cross_body { } -//UNSUP | /**/ yCROSS list_of_cross_items iffE cross_body { } -//UNSUP ; +cover_cross: // ==IEEE: cover_cross + id/*cover_point_identifier*/ ':' yCROSS list_of_cross_items iffE cross_body + { $$ = nullptr; BBUNSUP($3, "Unsupported: cross"); } + | yCROSS list_of_cross_items iffE cross_body + { $$ = nullptr; BBUNSUP($1, "Unsupported: cross"); } + ; -//UNSUPlist_of_cross_items: // ==IEEE: list_of_cross_items -//UNSUP cross_item ',' cross_item { $$ = addNextNull($1, $3); } -//UNSUP | cross_item ',' cross_item ',' cross_itemList -//UNSUP { $$ = addNextNull(addNextNull($1, $3), $5); } -//UNSUP ; +list_of_cross_items: // ==IEEE: list_of_cross_items + cross_item ',' cross_item { $$ = addNextNull($1, $3); } + | cross_item ',' cross_item ',' cross_itemList + { $$ = addNextNull(addNextNull($1, $3), $5); } + ; -//UNSUPcross_itemList: // IEEE: part of list_of_cross_items -//UNSUP cross_item { $$ = nullptr; } -//UNSUP | cross_itemList ',' cross_item { $$ = addNextNull($1, $3); } -//UNSUP ; +cross_itemList: // IEEE: part of list_of_cross_items + cross_item { $$ = $1; } + | cross_itemList ',' cross_item { $$ = addNextNull($1, $3); } + ; -//UNSUPcross_item: // ==IEEE: cross_item -//UNSUP idAny/*cover_point_identifier or variable_identifier*/ { $$ = $1; } -//UNSUP ; +cross_item: // ==IEEE: cross_item + idAny/*cover_point_identifier or variable_identifier*/ { $$ = nullptr; /*UNSUP*/ } + ; -//UNSUPcross_body: // ==IEEE: cross_body -//UNSUP '{' '}' { $$ = nullptr; } -//UNSUP // // IEEE-2012: No semicolon here, mistake in spec -//UNSUP | '{' cross_body_itemSemiList '}' { $$ = $1; } -//UNSUP | ';' { $$ = nullptr; } -//UNSUP ; +cross_body: // ==IEEE: cross_body + '{' '}' { $$ = nullptr; } + // // IEEE-2012: No semicolon here, mistake in spec + | '{' cross_body_itemSemiList '}' { $$ = $2; } + | ';' { $$ = nullptr; } + ; -//UNSUPcross_body_itemSemiList: // IEEE: part of cross_body -//UNSUP cross_body_item ';' { $$ = $1; } -//UNSUP | cross_body_itemSemiList cross_body_item ';' { $$ = addNextNull($1, $2); } -//UNSUP ; +cross_body_itemSemiList: // IEEE: part of cross_body + cross_body_item ';' { $$ = $1; } + | cross_body_itemSemiList cross_body_item ';' { $$ = addNextNull($1, $2); } + ; -//UNSUPcross_body_item: // ==IEEE: cross_body_item -//UNSUP // // IEEE: our semicolon is in the list -//UNSUP bins_selection_or_option { $$ = $1; } -//UNSUP | function_declaration { $$ = $1; } -//UNSUP ; +cross_body_item: // ==IEEE: cross_body_item + // // IEEE: our semicolon is in the list + // // IEEE: bins_selection_or_option + coverage_option { $$ = $1; } + // // IEEE: bins_selection + | function_declaration + { $$ = $1; BBUNSUP($1->fileline(), "Unsupported: coverage cross 'function' declaration"); } + | bins_keyword idAny/*new-bin_identifier*/ '=' select_expression iffE + { $$ = nullptr; BBUNSUP($1, "Unsupported: coverage cross bin"); } + ; -//UNSUPbins_selection_or_option: // ==IEEE: bins_selection_or_option -//UNSUP coverage_option { $$ = $1; } -//UNSUP | bins_selection { $$ = $1; } -//UNSUP ; +select_expression: // ==IEEE: select_expression + // // IEEE: select_condition expanded here + yBINSOF '(' bins_expression ')' + { $$ = nullptr; BBUNSUP($1, "Unsupported: coverage select expression 'binsof'"); } + | '!' yBINSOF '(' bins_expression ')' + { $$ = nullptr; BBUNSUP($1, "Unsupported: coverage select expression 'binsof'"); } + | yBINSOF '(' bins_expression ')' yINTERSECT '{' covergroup_range_list '}' + { $$ = nullptr; BBUNSUP($5, "Unsupported: coverage select expression 'intersect'"); } + | '!' yBINSOF '(' bins_expression ')' yINTERSECT '{' covergroup_range_list '}' { } + { $$ = nullptr; BBUNSUP($5, "Unsupported: coverage select expression 'intersect'"); } + | yWITH__PAREN '(' cgexpr ')' + { $$ = nullptr; BBUNSUP($1, "Unsupported: coverage select expression with"); } + | '!' yWITH__PAREN '(' cgexpr ')' + { $$ = nullptr; BBUNSUP($1, "Unsupported: coverage select expression with"); } + // // 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; BBUNSUP($2, "Unsupported: coverage select expression '&&'"); } + | select_expression yP_OROR select_expression + { $$ = nullptr; BBUNSUP($2, "Unsupported: coverage select expression '||'"); } + // // IEEE-2012: cross_identifier + // // Part of covergroup_expression - generic identifier + // // IEEE-2012: Need clarification as to precedence + //UNSUP cgexpr { $$ = nullptr; BBUNSUP($1, "Unsupported: coverage select expression"); } + // + // // Need precedence fix + //UNSUP cgexpr yMATCHES cgexpr {..} + ; -//UNSUPbins_selection: // ==IEEE: bins_selection -//UNSUP bins_keyword idAny/*new-bin_identifier*/ '=' select_expression iffE { } -//UNSUP ; +bins_expression: // ==IEEE: bins_expression + // // "cover_point_identifier" and "variable_identifier" look identical + id/*variable_identifier or cover_point_identifier*/ { $$ = nullptr; /*UNSUP*/ } + | id/*cover_point_identifier*/ '.' idAny/*bins_identifier*/ { $$ = nullptr; /*UNSUP*/ } + ; -//UNSUPselect_expression: // ==IEEE: select_expression -//UNSUP // // IEEE: select_condition expanded here -//UNSUP yBINSOF '(' bins_expression ')' { } -//UNSUP | yBINSOF '(' bins_expression ')' yINTERSECT '{' covergroup_range_list '}' { } -//UNSUP | yWITH__PAREN '(' cgexpr ')' { } -//UNSUP // // IEEE-2012: Need clarification as to precedence -//UNSUP //UNSUP yWITH__PAREN '(' cgexpr ')' yMATCHES cgexpr { } -//UNSUP | '!' yBINSOF '(' bins_expression ')' { } -//UNSUP | '!' yBINSOF '(' bins_expression ')' yINTERSECT '{' covergroup_range_list '}' { } -//UNSUP | '!' yWITH__PAREN '(' cgexpr ')' { } -//UNSUP // // IEEE-2012: Need clarification as to precedence -//UNSUP //UNSUP '!' yWITH__PAREN '(' cgexpr ')' yMATCHES cgexpr { } -//UNSUP | select_expression yP_ANDAND select_expression { } -//UNSUP | select_expression yP_OROR select_expression { } -//UNSUP | '(' select_expression ')' { $$ = $2; } -//UNSUP // // IEEE-2012: cross_identifier -//UNSUP // // Part of covergroup_expression - generic identifier -//UNSUP // // IEEE-2012: Need clarification as to precedence -//UNSUP //UNSUP covergroup_expression [ yMATCHES covergroup_expression ] -//UNSUP ; +coverage_eventE: // IEEE: [ coverage_event ] + /* empty */ { $$ = nullptr; } + | clocking_event + { $$ = nullptr; BBUNSUP($1, "Unsupported: coverage clocking event"); } + | yWITH__ETC yFUNCTION idAny/*"sample"*/ '(' tf_port_listE ')' + { $$ = nullptr; BBUNSUP($1, "Unsupported: coverage 'with' 'function'"); } + | yP_ATAT '(' block_event_expression ')' + { $$ = nullptr; BBUNSUP($1, "Unsupported: coverage '@@' events"); } + ; -//UNSUPbins_expression: // ==IEEE: bins_expression -//UNSUP // // "cover_point_identifier" and "variable_identifier" look identical -//UNSUP id/*variable_identifier or cover_point_identifier*/ { $$ = $1; } -//UNSUP | id/*cover_point_identifier*/ '.' idAny/*bins_identifier*/ { } -//UNSUP ; +block_event_expression: // ==IEEE: block_event_expression + block_event_expressionTerm { $$ = nullptr; /*UNSUP @@*/ } + | block_event_expression yOR block_event_expressionTerm { $$ = nullptr; /*UNSUP @@*/ } + ; -//UNSUPcoverage_eventE: // IEEE: [ coverage_event ] -//UNSUP /* empty */ { $$ = nullptr; } -//UNSUP | clocking_event { $$ = $1; } -//UNSUP | yWITH__ETC function idAny/*"sample"*/ '(' tf_port_listE ')' { } -//UNSUP | yP_ATAT '(' block_event_expression ')' { } -//UNSUP ; +block_event_expressionTerm: // IEEE: part of block_event_expression + yBEGIN hierarchical_btf_identifier { $$ = nullptr; /*UNSUP @@*/ } + | yEND hierarchical_btf_identifier { $$ = nullptr; /*UNSUP @@*/ } + ; -//UNSUPblock_event_expression: // ==IEEE: block_event_expression -//UNSUP block_event_expressionTerm { $$ = $1; } -//UNSUP | block_event_expression yOR block_event_expressionTerm { } -//UNSUP ; - -//UNSUPblock_event_expressionTerm: // IEEE: part of block_event_expression -//UNSUP yBEGIN hierarchical_btf_identifier { } -//UNSUP | yEND hierarchical_btf_identifier { } -//UNSUP ; - -//UNSUPhierarchical_btf_identifier: // ==IEEE: hierarchical_btf_identifier -//UNSUP // // hierarchical_tf_identifier + hierarchical_block_identifier -//UNSUP hierarchical_identifier/*tf_or_block*/ { $$ = $1; } -//UNSUP // // method_identifier -//UNSUP | hierarchical_identifier class_scope_id { } -//UNSUP | hierarchical_identifier id { } -//UNSUP ; +hierarchical_btf_identifier: // ==IEEE: hierarchical_btf_identifier + // // hierarchical_tf_identifier + hierarchical_block_identifier + // // method_identifier + packageClassScopeE idAny { $$ = nullptr; /*UNSUP*/ } + ; //********************************************************************** // Randsequence @@ -6638,7 +6666,7 @@ checker_or_generate_item_declaration: // ==IEEE: checker_or_generate_ite | checker_declaration { $$ = nullptr; BBUNSUP($1, "Unsupported: recursive checker"); } | assertion_item_declaration { $$ = $1; } - //UNSUP covergroup_declaration { $$ = $1; } + | covergroup_declaration { $$ = $1; } // // IEEE deprecated: overload_declaration | genvar_declaration { $$ = $1; } | clocking_declaration { $$ = $1; } @@ -6879,7 +6907,8 @@ class_item: // ==IEEE: class_item | class_declaration { $$ = nullptr; BBUNSUP($1, "Unsupported: class within class"); } | timeunits_declaration { $$ = $1; } - //UNSUP covergroup_declaration { $$ = $1; } + | covergroup_declaration + { $$ = nullptr; BBUNSUP($1, "Unsupported: covergroup within class"); } // // local_parameter_declaration under parameter_declaration | parameter_declaration ';' { $$ = $1; } | ';' { $$ = nullptr; } diff --git a/test_regress/t/t_covergroup_unsup.out b/test_regress/t/t_covergroup_unsup.out new file mode 100644 index 000000000..6a6747e11 --- /dev/null +++ b/test_regress/t/t_covergroup_unsup.out @@ -0,0 +1,380 @@ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:25:4: Unsupported: covergroup + 25 | covergroup cg_empty; + | ^~~~~~~~~~ + ... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:28:4: Unsupported: covergroup + 28 | covergroup cg_opt; + | ^~~~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:29:7: Unsupported: coverage option + 29 | type_option.weight = 1; + | ^~~~~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:30:7: Unsupported: coverage option + 30 | type_option.goal = 99; + | ^~~~~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:31:7: Unsupported: coverage option + 31 | type_option.comment = "type_option_comment"; + | ^~~~~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:32:7: Unsupported: coverage option + 32 | type_option.strobe = 0; + | ^~~~~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:33:7: Unsupported: coverage option + 33 | type_option.merge_instances = 1; + | ^~~~~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:34:7: Unsupported: coverage option + 34 | type_option.distribuge_first = 1; + | ^~~~~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:35:7: Unsupported: coverage option + 35 | option.name = "the_name"; + | ^~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:36:7: Unsupported: coverage option + 36 | option.weight = 1; + | ^~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:37:7: Unsupported: coverage option + 37 | option.goal = 98; + | ^~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:38:7: Unsupported: coverage option + 38 | option.comment = "option_comment"; + | ^~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:39:7: Unsupported: coverage option + 39 | option.at_least = 20; + | ^~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:40:7: Unsupported: coverage option + 40 | option.auto_bin_max = 10; + | ^~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:41:7: Unsupported: coverage option + 41 | option.cross_num_print_missing = 2; + | ^~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:42:7: Unsupported: coverage option + 42 | option.detect_overlap = 1; + | ^~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:43:7: Unsupported: coverage option + 43 | option.per_instance = 1; + | ^~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:44:7: Unsupported: coverage option + 44 | option.get_inst_coverage = 1; + | ^~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:47:4: Unsupported: covergroup + 47 | covergroup cg_clockingevent() @(posedge clk); + | ^~~~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:47:34: Unsupported: coverage clocking event + 47 | covergroup cg_clockingevent() @(posedge clk); + | ^ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:49:4: Unsupported: covergroup + 49 | covergroup cg_withfunction() with function sample (a); + | ^~~~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:49:33: Unsupported: coverage 'with' 'function' + 49 | covergroup cg_withfunction() with function sample (a); + | ^~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:51:4: Unsupported: covergroup + 51 | covergroup cg_atat() @@ (begin funca or end funcb); + | ^~~~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:51:25: Unsupported: coverage '@@' events + 51 | covergroup cg_atat() @@ (begin funca or end funcb); + | ^~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:53:4: Unsupported: covergroup + 53 | covergroup cg_bracket; + | ^~~~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:56:4: Unsupported: covergroup + 56 | covergroup cg_bracket; + | ^~~~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:57:9: Unsupported: coverage option + 57 | { option.name = "option"; } + | ^~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:59:4: Unsupported: covergroup + 59 | covergroup cg_cp; + | ^~~~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:60:7: Unsupported: cover point + 60 | coverpoint a; + | ^~~~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:62:4: Unsupported: covergroup + 62 | covergroup cg_cp_iff; + | ^~~~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:63:20: Unsupported: cover 'iff' + 63 | coverpoint a iff (b); + | ^~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:63:7: Unsupported: cover point + 63 | coverpoint a iff (b); + | ^~~~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:65:4: Unsupported: covergroup + 65 | covergroup cg_id_cp_iff; + | ^~~~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:66:24: Unsupported: cover 'iff' + 66 | id: coverpoint a iff (b); + | ^~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:66:11: Unsupported: cover point + 66 | id: coverpoint a iff (b); + | ^~~~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:68:4: Unsupported: covergroup + 68 | covergroup cg_id_cp_id1; + | ^~~~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:69:28: Unsupported: cover 'iff' + 69 | int id: coverpoint a iff (b); + | ^~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:69:15: Unsupported: cover point + 69 | int id: coverpoint a iff (b); + | ^~~~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:71:4: Unsupported: covergroup + 71 | covergroup cg_id_cp_id2; + | ^~~~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:72:32: Unsupported: cover 'iff' + 72 | var int id: coverpoint a iff (b); + | ^~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:72:19: Unsupported: cover point + 72 | var int id: coverpoint a iff (b); + | ^~~~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:74:4: Unsupported: covergroup + 74 | covergroup cg_id_cp_id3; + | ^~~~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:75:34: Unsupported: cover 'iff' + 75 | var [3:0] id: coverpoint a iff (b); + | ^~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:75:21: Unsupported: cover point + 75 | var [3:0] id: coverpoint a iff (b); + | ^~~~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:77:4: Unsupported: covergroup + 77 | covergroup cg_id_cp_id4; + | ^~~~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:78:30: Unsupported: cover 'iff' + 78 | [3:0] id: coverpoint a iff (b); + | ^~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:78:17: Unsupported: cover point + 78 | [3:0] id: coverpoint a iff (b); + | ^~~~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:80:4: Unsupported: covergroup + 80 | covergroup cg_id_cp_id5; + | ^~~~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:81:31: Unsupported: cover 'iff' + 81 | signed id: coverpoint a iff (b); + | ^~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:81:18: Unsupported: cover point + 81 | signed id: coverpoint a iff (b); + | ^~~~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:84:4: Unsupported: covergroup + 84 | covergroup cg_cross; + | ^~~~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:85:18: Unsupported: cover 'iff' + 85 | cross a, b iff (!rst); + | ^~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:85:7: Unsupported: cross + 85 | cross a, b iff (!rst); + | ^~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:87:4: Unsupported: covergroup + 87 | covergroup cg_cross2; + | ^~~~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:88:18: Unsupported: cover 'iff' + 88 | cross a, b iff (!rst) {} + | ^~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:88:7: Unsupported: cross + 88 | cross a, b iff (!rst) {} + | ^~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:90:4: Unsupported: covergroup + 90 | covergroup cg_cross3; + | ^~~~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:91:20: Unsupported: coverage option + 91 | cross a, b { option.comment = "cross"; option.weight = 12; } + | ^~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:91:46: Unsupported: coverage option + 91 | cross a, b { option.comment = "cross"; option.weight = 12; } + | ^~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:91:7: Unsupported: cross + 91 | cross a, b { option.comment = "cross"; option.weight = 12; } + | ^~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:93:4: Unsupported: covergroup + 93 | covergroup cg_cross3; + | ^~~~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:94:34: Unsupported: coverage cross 'function' declaration + 94 | cross a, b { function void crossfunc; endfunction; } + | ^~~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:94:7: Unsupported: cross + 94 | cross a, b { function void crossfunc; endfunction; } + | ^~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:96:4: Unsupported: covergroup + 96 | covergroup cg_cross_id; + | ^~~~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:97:28: Unsupported: cover 'iff' + 97 | my_cg_id: cross a, b iff (!rst); + | ^~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:97:17: Unsupported: cross + 97 | my_cg_id: cross a, b iff (!rst); + | ^~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:100:4: Unsupported: covergroup + 100 | covergroup cg_binsoroptions_bk1; + | ^~~~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:102:17: Unsupported: cover bin specification + 102 | { bins ba = {a}; } + | ^ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:103:24: Unsupported: cover 'iff' + 103 | { bins bar = {a} iff (!rst); } + | ^~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:103:18: Unsupported: cover bin specification + 103 | { bins bar = {a} iff (!rst); } + | ^ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:104:26: Unsupported: cover bin specification + 104 | { illegal_bins ila = {a}; } + | ^ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:105:25: Unsupported: cover bin specification + 105 | { ignore_bins iga = {a}; } + | ^ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:107:19: Unsupported: cover bin specification + 107 | { bins ba[] = {a}; } + | ^ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:108:20: Unsupported: cover bin specification + 108 | { bins ba[2] = {a}; } + | ^ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:110:23: Unsupported: cover bin 'with' specification + 110 | { bins ba = {a} with { b }; } + | ^~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:112:27: Unsupported: cover bin 'wildcard' specification + 112 | { wildcard bins bwa = {a}; } + | ^ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:113:34: Unsupported: cover bin 'wildcard' 'with' specification + 113 | { wildcard bins bwaw = {a} with { b }; } + | ^~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:115:20: Unsupported: cover bin 'default' + 115 | { bins def = default; } + | ^~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:116:29: Unsupported: cover bin 'default' 'sequence' + 116 | { bins defs = default sequence; } + | ^~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:118:18: Unsupported: cover bin trans list + 118 | { bins bts = ( 1, 2 ); } + | ^ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:119:9: Unsupported: cover bin 'wildcard' trans list + 119 | { wildcard bins wbts = ( 1, 2 ); } + | ^~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:120:33: Unsupported: covergroup value range + 120 | { bins bts2 = ( 2, 3 ), ( [5:6] ) ; } + | ^ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:120:19: Unsupported: cover bin trans list + 120 | { bins bts2 = ( 2, 3 ), ( [5:6] ) ; } + | ^ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:122:27: Unsupported: cover trans set '=>' + 122 | { bins bts2 = ( 1,5 => 6,7 ) ; } + | ^~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:122:19: Unsupported: cover bin trans list + 122 | { bins bts2 = ( 1,5 => 6,7 ) ; } + | ^ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:123:25: Unsupported: cover '[*' + 123 | { bins bts2 = ( 3 [*5] ) ; } + | ^~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:123:19: Unsupported: cover bin trans list + 123 | { bins bts2 = ( 3 [*5] ) ; } + | ^ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:124:25: Unsupported: cover '[*' + 124 | { bins bts2 = ( 3 [*5:6] ) ; } + | ^~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:124:19: Unsupported: cover bin trans list + 124 | { bins bts2 = ( 3 [*5:6] ) ; } + | ^ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:125:25: Unsupported: cover '[->' + 125 | { bins bts2 = ( 3 [->5] ) ; } + | ^~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:125:19: Unsupported: cover bin trans list + 125 | { bins bts2 = ( 3 [->5] ) ; } + | ^ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:126:25: Unsupported: cover '[->' + 126 | { bins bts2 = ( 3 [->5:6] ) ; } + | ^~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:126:19: Unsupported: cover bin trans list + 126 | { bins bts2 = ( 3 [->5:6] ) ; } + | ^ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:127:25: Unsupported: cover '[=' + 127 | { bins bts2 = ( 3 [=5] ) ; } + | ^~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:127:19: Unsupported: cover bin trans list + 127 | { bins bts2 = ( 3 [=5] ) ; } + | ^ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:128:25: Unsupported: cover '[=' + 128 | { bins bts2 = ( 3 [=5:6] ) ; } + | ^~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:128:19: Unsupported: cover bin trans list + 128 | { bins bts2 = ( 3 [=5:6] ) ; } + | ^ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:132:4: Unsupported: covergroup + 132 | covergroup cg_cross_bins; + | ^~~~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:134:23: Unsupported: coverage select expression 'binsof' + 134 | bins bin_a = binsof(a); + | ^~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:134:10: Unsupported: coverage cross bin + 134 | bins bin_a = binsof(a); + | ^~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:135:24: Unsupported: coverage select expression 'binsof' + 135 | bins bin_ai = binsof(a) iff (!rst); + | ^~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:135:34: Unsupported: cover 'iff' + 135 | bins bin_ai = binsof(a) iff (!rst); + | ^~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:135:10: Unsupported: coverage cross bin + 135 | bins bin_ai = binsof(a) iff (!rst); + | ^~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:136:23: Unsupported: coverage select expression 'binsof' + 136 | bins bin_c = binsof(cp.x); + | ^~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:136:10: Unsupported: coverage cross bin + 136 | bins bin_c = binsof(cp.x); + | ^~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:137:24: Unsupported: coverage select expression 'binsof' + 137 | bins bin_na = ! binsof(a); + | ^ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:137:10: Unsupported: coverage cross bin + 137 | bins bin_na = ! binsof(a); + | ^~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:139:33: Unsupported: coverage select expression 'intersect' + 139 | bins bin_d = binsof(a) intersect { b }; + | ^~~~~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:139:10: Unsupported: coverage cross bin + 139 | bins bin_d = binsof(a) intersect { b }; + | ^~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:140:34: Unsupported: coverage select expression 'intersect' + 140 | bins bin_nd = ! binsof(a) intersect { b }; + | ^ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:140:10: Unsupported: coverage cross bin + 140 | bins bin_nd = ! binsof(a) intersect { b }; + | ^~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:142:23: Unsupported: coverage select expression with + 142 | bins bin_e = with (a); + | ^~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:142:10: Unsupported: coverage cross bin + 142 | bins bin_e = with (a); + | ^~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:143:23: Unsupported: coverage select expression with + 143 | bins bin_e = ! with (a); + | ^ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:143:10: Unsupported: coverage cross bin + 143 | bins bin_e = ! with (a); + | ^~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:145:26: Unsupported: coverage select expression 'binsof' + 145 | bins bin_par = (binsof(a)); + | ^~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:145:10: Unsupported: coverage cross bin + 145 | bins bin_par = (binsof(a)); + | ^~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:146:25: Unsupported: coverage select expression 'binsof' + 146 | bins bin_and = binsof(a) && binsof(b); + | ^~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:146:38: Unsupported: coverage select expression 'binsof' + 146 | bins bin_and = binsof(a) && binsof(b); + | ^~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:146:35: Unsupported: coverage select expression '&&' + 146 | bins bin_and = binsof(a) && binsof(b); + | ^~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:146:10: Unsupported: coverage cross bin + 146 | bins bin_and = binsof(a) && binsof(b); + | ^~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:147:24: Unsupported: coverage select expression 'binsof' + 147 | bins bin_or = binsof(a) || binsof(b); + | ^~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:147:37: Unsupported: coverage select expression 'binsof' + 147 | bins bin_or = binsof(a) || binsof(b); + | ^~~~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:147:34: Unsupported: coverage select expression '||' + 147 | bins bin_or = binsof(a) || binsof(b); + | ^~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:147:10: Unsupported: coverage cross bin + 147 | bins bin_or = binsof(a) || binsof(b); + | ^~~~ +%Error-UNSUPPORTED: t/t_covergroup_unsup.v:133:7: Unsupported: cross + 133 | cross a, b { + | ^~~~~ +%Error: Exiting due to diff --git a/test_regress/t/t_covergroup_unsup.pl b/test_regress/t/t_covergroup_unsup.pl new file mode 100755 index 000000000..c9ca914d8 --- /dev/null +++ b/test_regress/t/t_covergroup_unsup.pl @@ -0,0 +1,20 @@ +#!/usr/bin/env perl +if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; } +# DESCRIPTION: Verilator: Verilog Test driver/expect definition +# +# Copyright 2022 by Wilson Snyder. This program is free software; you +# can redistribute it and/or modify it under the terms of either the GNU +# Lesser General Public License Version 3 or the Perl Artistic License +# Version 2.0. +# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 + +scenarios(vlt => 1); + +compile( + expect_filename => $Self->{golden_filename}, + verilator_flags2 => ['--assert --error-limit 1000'], + fails => 1, + ); + +ok(1); +1; diff --git a/test_regress/t/t_covergroup_unsup.v b/test_regress/t/t_covergroup_unsup.v new file mode 100644 index 000000000..6fed272bc --- /dev/null +++ b/test_regress/t/t_covergroup_unsup.v @@ -0,0 +1,157 @@ +// DESCRIPTION: Verilator: Verilog Test module +// +// This file ONLY is placed under the Creative Commons Public Domain, for +// any use, without warranty, 2023 by Wilson Snyder. +// SPDX-License-Identifier: CC0-1.0 + +module t (/*AUTOARG*/ + // Inputs + clk + ); + + input clk; + int a; + int b; + logic c; + int cyc = 0; + + always @(posedge clk) begin + cyc <= cyc + 1; + end + + // NOTE this grammar hasn't been checked with other simulators, + // is here just to avoid uncovered code lines in the grammar. + + covergroup cg_empty; + endgroup + + covergroup cg_opt; + type_option.weight = 1; // cg, cp, cross + type_option.goal = 99; // cg, cp, cross + type_option.comment = "type_option_comment"; // cg, cp, cross + type_option.strobe = 0; // cg + type_option.merge_instances = 1; // cg + type_option.distribuge_first = 1; // cg + option.name = "the_name"; // cg + option.weight = 1; // cg, cp, cross + option.goal = 98; // cg, cp, cross + option.comment = "option_comment"; // cg, cp, cross + option.at_least = 20; // cg, cp, cross + option.auto_bin_max = 10; // cg, cp + option.cross_num_print_missing = 2; // cg, cross + option.detect_overlap = 1; // cg, cp + option.per_instance = 1; // cg + option.get_inst_coverage = 1; // cg + endgroup + + covergroup cg_clockingevent() @(posedge clk); + endgroup + covergroup cg_withfunction() with function sample (a); + endgroup + covergroup cg_atat() @@ (begin funca or end funcb); + endgroup + covergroup cg_bracket; + {} + endgroup + covergroup cg_bracket; + { option.name = "option"; } + endgroup + covergroup cg_cp; + coverpoint a; + endgroup + covergroup cg_cp_iff; + coverpoint a iff (b); + endgroup + covergroup cg_id_cp_iff; + id: coverpoint a iff (b); + endgroup + covergroup cg_id_cp_id1; + int id: coverpoint a iff (b); + endgroup + covergroup cg_id_cp_id2; + var int id: coverpoint a iff (b); + endgroup + covergroup cg_id_cp_id3; + var [3:0] id: coverpoint a iff (b); + endgroup + covergroup cg_id_cp_id4; + [3:0] id: coverpoint a iff (b); + endgroup + covergroup cg_id_cp_id5; + signed id: coverpoint a iff (b); + endgroup + + covergroup cg_cross; + cross a, b iff (!rst); + endgroup + covergroup cg_cross2; + cross a, b iff (!rst) {} + endgroup + covergroup cg_cross3; + cross a, b { option.comment = "cross"; option.weight = 12; } + endgroup + covergroup cg_cross3; + cross a, b { function void crossfunc; endfunction; } + endgroup + covergroup cg_cross_id; + my_cg_id: cross a, b iff (!rst); + endgroup + + covergroup cg_binsoroptions_bk1; + // bins_keyword id/*bin_identifier*/ bins_orBraE '=' '{' open_range_list '}' iffE + { bins ba = {a}; } + { bins bar = {a} iff (!rst); } + { illegal_bins ila = {a}; } + { ignore_bins iga = {a}; } + + { bins ba[] = {a}; } + { bins ba[2] = {a}; } + + { bins ba = {a} with { b }; } + + { wildcard bins bwa = {a}; } + { wildcard bins bwaw = {a} with { b }; } + + { bins def = default; } + { bins defs = default sequence; } + + { bins bts = ( 1, 2 ); } + { wildcard bins wbts = ( 1, 2 ); } + { bins bts2 = ( 2, 3 ), ( [5:6] ) ; } + + { bins bts2 = ( 1,5 => 6,7 ) ; } + { bins bts2 = ( 3 [*5] ) ; } + { bins bts2 = ( 3 [*5:6] ) ; } + { bins bts2 = ( 3 [->5] ) ; } + { bins bts2 = ( 3 [->5:6] ) ; } + { bins bts2 = ( 3 [=5] ) ; } + { bins bts2 = ( 3 [=5:6] ) ; } + + endgroup + + covergroup cg_cross_bins; + cross a, b { + bins bin_a = binsof(a); + bins bin_ai = binsof(a) iff (!rst); + bins bin_c = binsof(cp.x); + bins bin_na = ! binsof(a); + + bins bin_d = binsof(a) intersect { b }; + bins bin_nd = ! binsof(a) intersect { b }; + + bins bin_e = with (a); + bins bin_e = ! with (a); + + bins bin_par = (binsof(a)); + bins bin_and = binsof(a) && binsof(b); + bins bin_or = binsof(a) || binsof(b); + } + endgroup + + always @(posedge clk) begin + if (cyc == 10) begin + $write("*-* All Finished *-*\n"); + $finish; + end + end +endmodule