From f0a6e4c2b29eec2bed8441fcd32c97849ca43268 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sat, 11 Jul 2020 19:11:58 -0400 Subject: [PATCH] Parser: Move scoped id unsupported messages down out of parser --- src/V3LinkDot.cpp | 2 ++ src/verilog.y | 11 ++++++----- test_regress/t/t_class_param.out | 7 +++++-- test_regress/t/t_class_vparam_unsup.out | 4 ++-- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/V3LinkDot.cpp b/src/V3LinkDot.cpp index b697f67d3..53a40ee1d 100644 --- a/src/V3LinkDot.cpp +++ b/src/V3LinkDot.cpp @@ -2697,6 +2697,8 @@ private: "Unsupported: Multiple '::' package/class reference"); } VL_DO_DANGLING(cpackagep->unlinkFrBack()->deleteTree(), cpackagep); + } else if (nodep->paramsp()) { + nodep->v3warn(E_UNSUPPORTED, "Unsupported: parameterized packages"); } if (m_ds.m_dotp && m_ds.m_dotPos == DP_PACKAGE) { UASSERT_OBJ(VN_IS(m_ds.m_dotp->lhsp(), ClassOrPackageRef), m_ds.m_dotp->lhsp(), diff --git a/src/verilog.y b/src/verilog.y index 23659e757..54ce11424 100644 --- a/src/verilog.y +++ b/src/verilog.y @@ -1794,7 +1794,6 @@ data_type: // ==IEEE: data_type $$ = GRAMMARP->createArray(refp, $3, true); } | packageClassScopeE idType parameter_value_assignmentClass packed_dimensionListE { AstRefDType* refp = new AstRefDType($2, *$2, $1, $3); - BBUNSUP($3->fileline(), "Unsupported: Parameter classes"); $$ = GRAMMARP->createArray(refp, $4, true); } ; @@ -4729,7 +4728,7 @@ idClassSel: // Misc Ref to dotted, and/or arrayed, and/or bit-ranged va { $$ = new AstDot($2, false, new AstParseRef($1, VParseRefExp::PX_ROOT, "super"), $3); } | yTHIS '.' ySUPER '.' idDotted { $$ = $5; BBUNSUP($1, "Unsupported: this.super"); } // // Expanded: package_scope idDotted - | packageClassScope idDotted { $$ = $2; BBUNSUP($2, "Unsupported: package scoped id"); } + | packageClassScope idDotted { $$ = new AstDot($2, true, $1, $2); } ; idClassSelForeach: @@ -4741,7 +4740,7 @@ idClassSelForeach: { $$ = new AstDot($2, false, new AstParseRef($1, VParseRefExp::PX_ROOT, "super"), $3); } | yTHIS '.' ySUPER '.' idDottedForeach { $$ = $5; BBUNSUP($1, "Unsupported: this.super"); } // // Expanded: package_scope idForeach - | packageClassScope idDottedForeach { $$ = $2; BBUNSUP($2, "Unsupported: package/class scoped id"); } + | packageClassScope idDottedForeach { $$ = new AstDot($2, true, $1, $2); } ; idDotted: @@ -4772,7 +4771,8 @@ idDottedMoreForeach: // id below includes: // enum_identifier idArrayed: // IEEE: id + select - id { $$ = new AstParseRef($1, VParseRefExp::PX_TEXT, *$1, NULL, NULL); } + id + { $$ = new AstParseRef($1, VParseRefExp::PX_TEXT, *$1, NULL, NULL); } // // IEEE: id + part_select_range/constant_part_select_range | idArrayed '[' expr ']' { $$ = new AstSelBit($2, $1, $3); } // Or AstArraySel, don't know yet. | idArrayed '[' constExpr ':' constExpr ']' { $$ = new AstSelExtract($2, $1, $3, $5); } @@ -4782,7 +4782,8 @@ idArrayed: // IEEE: id + select ; idArrayedForeach: // IEEE: id + select (under foreach expression) - id { $$ = new AstParseRef($1, VParseRefExp::PX_TEXT, *$1, NULL, NULL); } + id + { $$ = new AstParseRef($1, VParseRefExp::PX_TEXT, *$1, NULL, NULL); } // // IEEE: id + part_select_range/constant_part_select_range | idArrayed '[' expr ']' { $$ = new AstSelBit($2, $1, $3); } // Or AstArraySel, don't know yet. | idArrayed '[' constExpr ':' constExpr ']' { $$ = new AstSelExtract($2, $1, $3, $5); } diff --git a/test_regress/t/t_class_param.out b/test_regress/t/t_class_param.out index f4aba8765..53cdad86a 100644 --- a/test_regress/t/t_class_param.out +++ b/test_regress/t/t_class_param.out @@ -1,4 +1,7 @@ -%Error-UNSUPPORTED: t/t_class_param.v:20:11: Unsupported: Parameter classes +%Error-UNSUPPORTED: t/t_class_param.v:20:4: Unsupported: parameterized packages 20 | Cls #(.P(4)) c4; - | ^ + | ^~~ +%Error-UNSUPPORTED: t/t_class_param.v:9:23: Unsupported: class parameter + 9 | class Cls #(parameter P = 12); + | ^ %Error: Exiting due to diff --git a/test_regress/t/t_class_vparam_unsup.out b/test_regress/t/t_class_vparam_unsup.out index 66f55b199..b0b72a8c4 100644 --- a/test_regress/t/t_class_vparam_unsup.out +++ b/test_regress/t/t_class_vparam_unsup.out @@ -1,4 +1,4 @@ -%Error-UNSUPPORTED: t/t_class_vparam_unsup.v:13:58: Unsupported: Parameter classes +%Error-UNSUPPORTED: t/t_class_vparam_unsup.v:13:40: Unsupported: parameterized packages 13 | pure virtual function void funcname(paramed_class_t #(CTYPE_t) v); - | ^~~~~~~ + | ^~~~~~~~~~~~~~~ %Error: Exiting due to