parent
4f1d8a1b15
commit
2ac7cf51a9
|
|
@ -1277,12 +1277,12 @@ class ParamVisitor final : public VNVisitor {
|
||||||
string m_unlinkedTxt; // Text for AstUnlinkedRef
|
string m_unlinkedTxt; // Text for AstUnlinkedRef
|
||||||
std::multimap<bool, AstNode*> m_cellps; // Cells left to process (in current module)
|
std::multimap<bool, AstNode*> m_cellps; // Cells left to process (in current module)
|
||||||
std::deque<std::string> m_strings; // Allocator for temporary strings
|
std::deque<std::string> m_strings; // Allocator for temporary strings
|
||||||
|
std::map<const AstRefDType*, bool>
|
||||||
|
m_isCircular; // Stores information whether `AstRefDType` is circular
|
||||||
|
|
||||||
// STATE - for current visit position (use VL_RESTORER)
|
// STATE - for current visit position (use VL_RESTORER)
|
||||||
AstNodeModule* m_modp; // Module iterating
|
AstNodeModule* m_modp; // Module iterating
|
||||||
string m_generateHierName; // Generate portion of hierarchy name
|
string m_generateHierName; // Generate portion of hierarchy name
|
||||||
std::map<const AstRefDType*, bool>
|
|
||||||
m_isCircularTypeCache; // Caches return values of `V3Width::isCircularType` calls
|
|
||||||
|
|
||||||
// METHODS
|
// METHODS
|
||||||
|
|
||||||
|
|
@ -1417,16 +1417,21 @@ class ParamVisitor final : public VNVisitor {
|
||||||
processWorkQ();
|
processWorkQ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void visit(AstRefDType* nodep) override {
|
|
||||||
const auto iter = m_isCircularTypeCache.find(nodep);
|
bool isCircularType(const AstRefDType* nodep) {
|
||||||
bool isCircular;
|
const auto iter = m_isCircular.emplace(nodep, true);
|
||||||
if (iter != m_isCircularTypeCache.end()) {
|
if (!iter.second) return iter.first->second;
|
||||||
isCircular = iter->second;
|
if (const AstRefDType* const subDTypep = VN_CAST(nodep->subDTypep(), RefDType)) {
|
||||||
} else {
|
const bool ret = isCircularType(subDTypep);
|
||||||
isCircular = V3Width::isCircularType(nodep);
|
iter.first->second = ret;
|
||||||
m_isCircularTypeCache.emplace(nodep, isCircular);
|
return ret;
|
||||||
}
|
}
|
||||||
if (isCircular) {
|
iter.first->second = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void visit(AstRefDType* nodep) override {
|
||||||
|
if (isCircularType(nodep)) {
|
||||||
nodep->v3error("Typedef's type is circular: " << nodep->prettyName());
|
nodep->v3error("Typedef's type is circular: " << nodep->prettyName());
|
||||||
} else if (nodep->typedefp() && nodep->subDTypep()
|
} else if (nodep->typedefp() && nodep->subDTypep()
|
||||||
&& (VN_IS(nodep->subDTypep()->skipRefOrNullp(), IfaceRefDType)
|
&& (VN_IS(nodep->subDTypep()->skipRefOrNullp(), IfaceRefDType)
|
||||||
|
|
|
||||||
|
|
@ -8952,12 +8952,3 @@ AstNode* V3Width::widthGenerateParamsEdit(
|
||||||
// No WidthRemoveVisitor, as don't want to drop $signed etc inside gen blocks
|
// No WidthRemoveVisitor, as don't want to drop $signed etc inside gen blocks
|
||||||
return nodep;
|
return nodep;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool V3Width::isCircularType(const AstRefDType* nodep) {
|
|
||||||
std::set<const AstRefDType*> visited;
|
|
||||||
while (nodep) {
|
|
||||||
if (!visited.insert(nodep).second) return true;
|
|
||||||
nodep = VN_CAST(nodep->subDTypep(), RefDType);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@
|
||||||
class AstNetlist;
|
class AstNetlist;
|
||||||
class AstNode;
|
class AstNode;
|
||||||
class AstNodeDType;
|
class AstNodeDType;
|
||||||
class AstRefDType;
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
|
|
@ -37,8 +36,6 @@ public:
|
||||||
// Replace AstSelBit, etc with AstSel/AstArraySel
|
// Replace AstSelBit, etc with AstSel/AstArraySel
|
||||||
// Returns replacement node if nodep was deleted, or null if none.
|
// Returns replacement node if nodep was deleted, or null if none.
|
||||||
static AstNode* widthSelNoIterEdit(AstNode* nodep) VL_MT_DISABLED;
|
static AstNode* widthSelNoIterEdit(AstNode* nodep) VL_MT_DISABLED;
|
||||||
|
|
||||||
static bool isCircularType(const AstRefDType* nodep);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // Guard
|
#endif // Guard
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue