diff --git a/Changes b/Changes index 86aece810..d85734c21 100644 --- a/Changes +++ b/Changes @@ -7,6 +7,8 @@ indicates the contributor was also the author of the fix; Thanks! *** Add tracing_on, etc to vlt files, bug932. [Frederic Requin] +**** Support extraction of enum bits, bug951. [Jonathon Donaldson] + **** Fix MinGW compiler error, bug927, bug929. [Hans Tichelaar] **** Fix .c files to be treated as .cpp, bug930. [Jonathon Donaldson] diff --git a/src/V3Ast.h b/src/V3Ast.h index ee970a585..2560fd026 100644 --- a/src/V3Ast.h +++ b/src/V3Ast.h @@ -239,6 +239,7 @@ public: // DT_PUBLIC, // V3LinkParse moves to AstTypedef::attrPublic // + ENUM_BASE, // V3LinkResolve creates for AstPreSel, V3LinkParam removes ENUM_FIRST, // V3Width processes ENUM_LAST, // V3Width processes ENUM_NUM, // V3Width processes @@ -268,7 +269,7 @@ public: "DIM_BITS", "DIM_DIMENSIONS", "DIM_HIGH", "DIM_INCREMENT", "DIM_LEFT", "DIM_LOW", "DIM_RIGHT", "DIM_SIZE", "DIM_UNPK_DIMENSIONS", "DT_PUBLIC", - "ENUM_FIRST", "ENUM_LAST", "ENUM_NUM", "ENUM_NEXT", "ENUM_PREV", "ENUM_NAME", + "ENUM_BASE", "ENUM_FIRST", "ENUM_LAST", "ENUM_NUM", "ENUM_NEXT", "ENUM_PREV", "ENUM_NAME", "MEMBER_BASE", "VAR_BASE", "VAR_CLOCK", "VAR_CLOCK_ENABLE", "VAR_PUBLIC", "VAR_PUBLIC_FLAT", "VAR_PUBLIC_FLAT_RD","VAR_PUBLIC_FLAT_RW", diff --git a/src/V3LinkResolve.cpp b/src/V3LinkResolve.cpp index 5d229fc6f..90ae80ce7 100644 --- a/src/V3LinkResolve.cpp +++ b/src/V3LinkResolve.cpp @@ -207,7 +207,11 @@ private: } else if (AstMemberSel* fromp = basefromp->castMemberSel()) { nodep->attrp(new AstAttrOf(nodep->fileline(), AstAttrType::MEMBER_BASE, fromp->cloneTree(false))); + } else if (AstEnumItemRef* fromp = basefromp->castEnumItemRef()) { + nodep->attrp(new AstAttrOf(nodep->fileline(), AstAttrType::ENUM_BASE, + fromp->cloneTree(false))); } else { + if (basefromp) { UINFO(1," Related node: "<v3fatalSrc("Illegal bit select; no signal/member being extracted from"); } } diff --git a/src/V3Width.cpp b/src/V3Width.cpp index 51e2ef489..8a6757740 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -834,9 +834,8 @@ private: // Don't iterate children, don't want to lose VarRef. switch (nodep->attrType()) { case AstAttrType::VAR_BASE: - // Soon to be handled in V3LinkWidth SEL generation, under attrp() and newSubLsbOf - break; case AstAttrType::MEMBER_BASE: + case AstAttrType::ENUM_BASE: // Soon to be handled in V3LinkWidth SEL generation, under attrp() and newSubLsbOf break; case AstAttrType::DIM_DIMENSIONS: diff --git a/test_regress/t/t_bitsel_enum.pl b/test_regress/t/t_bitsel_enum.pl index de004ca71..f91289753 100755 --- a/test_regress/t/t_bitsel_enum.pl +++ b/test_regress/t/t_bitsel_enum.pl @@ -7,8 +7,6 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di # Lesser General Public License Version 3 or the Perl Artistic License # Version 2.0. -$Self->skip("Not supported by commercial simulators"); - compile ( );