From 99e7dbc82ba2a6c7458fe1e9378d13d70c34329d Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sat, 9 Nov 2024 17:15:41 -0500 Subject: [PATCH] Internals: Put unsupported nettypes into symbol table, so parse as idType --- src/verilog.y | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/verilog.y b/src/verilog.y index cb8883b89..acee2bb3b 100644 --- a/src/verilog.y +++ b/src/verilog.y @@ -184,6 +184,14 @@ public: AstSenTree* createGlobalClockSenTree(FileLine* fl) { return createClockSenTree(fl, createGlobalClockParseRef(fl)); } + AstNode* createNettype(FileLine* fl, const string& name) { + // As nettypes are unsupported, we just alias to logic + AstTypedef* const nodep = new AstTypedef{fl, name, nullptr, VFlagChildDType{}, + new AstBasicDType{fl, VFlagLogicPacked{}, 1}}; + SYMP->reinsert(nodep); + PARSEP->tagNodep(nodep); + return nodep; + } AstNode* createTypedef(FileLine* fl, const string& name, AstNode* attrsp, AstNodeDType* basep, AstNodeRange* rangep) { AstTypedef* const nodep = new AstTypedef{fl, name, attrsp, VFlagChildDType{}, @@ -2572,25 +2580,25 @@ nettype_declaration: // IEEE: nettype_declaration/net_type_declaration // // Union of data_typeAny and nettype_identifier matching yNETTYPE data_typeNoRef /*cont*/ idAny/*nettype_identifier*/ ';' - { $$ = nullptr; BBUNSUP($1, "Unsupported: nettype"); } + { $$ = GRAMMARP->createNettype($3, *$3); BBUNSUP($1, "Unsupported: nettype"); } | yNETTYPE data_typeNoRef /*cont*/ idAny/*nettype_identifier*/ /*cont*/ yWITH__ETC packageClassScopeE id/*tf_identifier*/ ';' - { $$ = nullptr; BBUNSUP($1, "Unsupported: nettype with"); } + { $$ = GRAMMARP->createNettype($3, *$3); BBUNSUP($1, "Unsupported: nettype with"); } | yNETTYPE packageClassScopeE idAny packed_dimensionListE /*cont*/ idAny/*nettype_identifier*/ ';' - { $$ = nullptr; BBUNSUP($1, "Unsupported: nettype"); } + { $$ = GRAMMARP->createNettype($5, *$5); BBUNSUP($1, "Unsupported: nettype"); } | yNETTYPE packageClassScopeE idAny packed_dimensionListE /*cont*/ idAny/*nettype_identifier*/ /*cont*/ yWITH__ETC packageClassScopeE id/*tf_identifier*/ ';' - { $$ = nullptr; BBUNSUP($1, "Unsupported: nettype with"); } + { $$ = GRAMMARP->createNettype($5, *$5); BBUNSUP($1, "Unsupported: nettype with"); } | yNETTYPE packageClassScopeE idAny parameter_value_assignmentClass packed_dimensionListE /*cont*/ idAny/*nettype_identifier*/ ';' - { $$ = nullptr; BBUNSUP($1, "Unsupported: nettype"); } + { $$ = GRAMMARP->createNettype($6, *$6); BBUNSUP($1, "Unsupported: nettype"); } | yNETTYPE packageClassScopeE idAny parameter_value_assignmentClass packed_dimensionListE /*cont*/ idAny/*nettype_identifier*/ /*cont*/ yWITH__ETC packageClassScopeE id/*tf_identifier*/ ';' - { $$ = nullptr; BBUNSUP($1, "Unsupported: nettype with"); } + { $$ = GRAMMARP->createNettype($6, *$6); BBUNSUP($1, "Unsupported: nettype with"); } ; implicit_typeE: // IEEE: part of *data_type_or_implicit