mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 01:54:01 +02:00
Use VAR_BASE as attr type if a select's base is a ref (#3943)
Signed-off-by: Ryszard Rozak <[email protected]>
This commit is contained in:
+1
-5
@@ -371,7 +371,6 @@ 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
|
||||
@@ -380,8 +379,6 @@ public:
|
||||
ENUM_NAME, // V3Width processes
|
||||
ENUM_VALID, // V3Width processes
|
||||
//
|
||||
MEMBER_BASE, // V3LinkResolve creates for AstPreSel, V3LinkParam removes
|
||||
//
|
||||
TYPENAME, // V3Width processes
|
||||
//
|
||||
VAR_BASE, // V3LinkResolve creates for AstPreSel, V3LinkParam removes
|
||||
@@ -407,9 +404,8 @@ public:
|
||||
"DIM_BITS", "DIM_DIMENSIONS", "DIM_HIGH", "DIM_INCREMENT", "DIM_LEFT",
|
||||
"DIM_LOW", "DIM_RIGHT", "DIM_SIZE", "DIM_UNPK_DIMENSIONS",
|
||||
"DT_PUBLIC",
|
||||
"ENUM_BASE", "ENUM_FIRST", "ENUM_LAST", "ENUM_NUM",
|
||||
"ENUM_FIRST", "ENUM_LAST", "ENUM_NUM",
|
||||
"ENUM_NEXT", "ENUM_PREV", "ENUM_NAME", "ENUM_VALID",
|
||||
"MEMBER_BASE",
|
||||
"TYPENAME",
|
||||
"VAR_BASE", "VAR_CLOCK_ENABLE", "VAR_FORCEABLE", "VAR_PUBLIC",
|
||||
"VAR_PUBLIC_FLAT", "VAR_PUBLIC_FLAT_RD", "VAR_PUBLIC_FLAT_RW",
|
||||
|
||||
+1
-1
@@ -869,7 +869,7 @@ AstNode* AstArraySel::baseFromp(AstNode* nodep, bool overMembers) {
|
||||
continue;
|
||||
}
|
||||
// AstNodeSelPre stashes the associated variable under an ATTROF
|
||||
// of VAttrType::VAR_BASE/MEMBER_BASE so it isn't constified
|
||||
// of VAttrType::VAR_BASE so it isn't constified
|
||||
else if (VN_IS(nodep, AttrOf)) {
|
||||
nodep = VN_AS(nodep, AttrOf)->fromp();
|
||||
continue;
|
||||
|
||||
+3
-24
@@ -145,34 +145,13 @@ private:
|
||||
void visit(AstNodePreSel* nodep) override {
|
||||
if (!nodep->attrp()) {
|
||||
iterateChildren(nodep);
|
||||
// Constification may change the fromp() to a constant, which will lose the
|
||||
// variable we're extracting from (to determine MSB/LSB/endianness/etc.)
|
||||
// So we replicate it in another node
|
||||
// Note that V3Param knows not to replace AstVarRef's under AstAttrOf's
|
||||
AstNode* const basefromp = AstArraySel::baseFromp(nodep, false);
|
||||
if (AstNodeVarRef* const varrefp
|
||||
= VN_CAST(basefromp, NodeVarRef)) { // Maybe varxref - so need to clone
|
||||
nodep->attrp(new AstAttrOf{nodep->fileline(), VAttrType::VAR_BASE,
|
||||
varrefp->cloneTree(false)});
|
||||
} else if (AstUnlinkedRef* const uvxrp
|
||||
= VN_CAST(basefromp, UnlinkedRef)) { // Maybe unlinked - so need to clone
|
||||
nodep->attrp(new AstAttrOf{nodep->fileline(), VAttrType::VAR_BASE,
|
||||
uvxrp->cloneTree(false)});
|
||||
} else if (auto* const fromp = VN_CAST(basefromp, LambdaArgRef)) {
|
||||
nodep->attrp(new AstAttrOf{nodep->fileline(), VAttrType::VAR_BASE,
|
||||
fromp->cloneTree(false)});
|
||||
} else if (AstMemberSel* const fromp = VN_CAST(basefromp, MemberSel)) {
|
||||
nodep->attrp(new AstAttrOf{nodep->fileline(), VAttrType::MEMBER_BASE,
|
||||
fromp->cloneTree(false)});
|
||||
} else if (AstEnumItemRef* const fromp = VN_CAST(basefromp, EnumItemRef)) {
|
||||
nodep->attrp(new AstAttrOf{nodep->fileline(), VAttrType::ENUM_BASE,
|
||||
fromp->cloneTree(false)});
|
||||
} else if (VN_IS(basefromp, Replicate)) {
|
||||
if (VN_IS(basefromp, Replicate)) {
|
||||
// From {...}[...] syntax in IEEE 2017
|
||||
if (basefromp) UINFO(1, " Related node: " << basefromp << endl);
|
||||
} else {
|
||||
if (basefromp) UINFO(1, " Related node: " << basefromp << endl);
|
||||
nodep->v3fatalSrc("Illegal bit select; no signal/member being extracted from");
|
||||
nodep->attrp(new AstAttrOf{nodep->fileline(), VAttrType::VAR_BASE,
|
||||
basefromp->cloneTree(false)});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1452,8 +1452,6 @@ private:
|
||||
// Don't iterate children, don't want to lose VarRef.
|
||||
switch (nodep->attrType()) {
|
||||
case VAttrType::VAR_BASE:
|
||||
case VAttrType::MEMBER_BASE:
|
||||
case VAttrType::ENUM_BASE:
|
||||
// Soon to be handled in V3LinkWidth SEL generation, under attrp() and newSubLsbOf
|
||||
break;
|
||||
case VAttrType::DIM_DIMENSIONS:
|
||||
|
||||
Reference in New Issue
Block a user