mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 01:54:01 +02:00
Fix incorrect Non-ANSI I/O declaration conflict error (#6258) broke with #bd1ac038
This commit is contained in:
+2
-1
@@ -514,6 +514,7 @@ public:
|
||||
VAR_BASE, // V3LinkResolve creates for AstPreSel, V3LinkParam removes
|
||||
VAR_CLOCK_ENABLE, // Ignored, accepted for compatibility
|
||||
VAR_FORCEABLE, // V3LinkParse moves to AstVar::isForceable
|
||||
VAR_PORT_DTYPE, // V3LinkDot for V3Width to check port dtype
|
||||
VAR_PUBLIC, // V3LinkParse moves to AstVar::sigPublic
|
||||
VAR_PUBLIC_FLAT, // V3LinkParse moves to AstVar::sigPublic
|
||||
VAR_PUBLIC_FLAT_RD, // V3LinkParse moves to AstVar::sigPublic
|
||||
@@ -538,7 +539,7 @@ public:
|
||||
"ENUM_FIRST", "ENUM_LAST", "ENUM_NUM",
|
||||
"ENUM_NEXT", "ENUM_PREV", "ENUM_NAME", "ENUM_VALID",
|
||||
"TYPEID", "TYPENAME",
|
||||
"VAR_BASE", "VAR_CLOCK_ENABLE", "VAR_FORCEABLE", "VAR_PUBLIC",
|
||||
"VAR_BASE", "VAR_CLOCK_ENABLE", "VAR_FORCEABLE", "VAR_PORT_DTYPE", "VAR_PUBLIC",
|
||||
"VAR_PUBLIC_FLAT", "VAR_PUBLIC_FLAT_RD", "VAR_PUBLIC_FLAT_RW",
|
||||
"VAR_ISOLATE_ASSIGNMENTS", "VAR_SC_BV", "VAR_SFORMAT", "VAR_CLOCKER",
|
||||
"VAR_NO_CLOCKER", "VAR_SPLIT_VAR"
|
||||
|
||||
+18
-19
@@ -1512,33 +1512,32 @@ class LinkDotFindVisitor final : public VNVisitor {
|
||||
&& !findvarp->subDTypep()->numeric().isSigned()) {
|
||||
findvarp->subDTypep()->numeric(VSigning{true});
|
||||
}
|
||||
AstBasicDType* const bdtypep
|
||||
= VN_CAST(findvarp->childDTypep(), BasicDType);
|
||||
AstNodeDType* varDtp = findvarp->subDTypep();
|
||||
AstNodeDType* otherDtp = nodep->subDTypep();
|
||||
AstBasicDType* const bdtypep = VN_CAST(varDtp, BasicDType);
|
||||
if (bdtypep && bdtypep->implicit()) {
|
||||
// Then have "input foo" and "real foo" so the
|
||||
// dtype comes from the other side.
|
||||
AstNodeDType* const newdtypep = nodep->subDTypep();
|
||||
UASSERT_OBJ(newdtypep && nodep->childDTypep(), findvarp,
|
||||
"No child type?");
|
||||
AstNodeDType* const newdtypep = otherDtp;
|
||||
otherDtp = varDtp;
|
||||
varDtp = newdtypep;
|
||||
VL_DO_DANGLING(bdtypep->unlinkFrBack()->deleteTree(), bdtypep);
|
||||
newdtypep->unlinkFrBack();
|
||||
findvarp->childDTypep(newdtypep);
|
||||
}
|
||||
if (nodep->childDTypep() && findvarp->childDTypep()
|
||||
&& !(VN_IS(nodep->childDTypep(), BasicDType)
|
||||
&& VN_AS(nodep->childDTypep(), BasicDType)->keyword()
|
||||
if (otherDtp && varDtp
|
||||
&& !(VN_IS(otherDtp, BasicDType)
|
||||
&& VN_AS(otherDtp, BasicDType)->keyword()
|
||||
== VBasicDTypeKwd::LOGIC_IMPLICIT)
|
||||
&& !(VN_IS(findvarp->childDTypep(), BasicDType)
|
||||
&& VN_AS(findvarp->childDTypep(), BasicDType)->keyword()
|
||||
== VBasicDTypeKwd::LOGIC_IMPLICIT)
|
||||
&& !nodep->sameTree(findvarp)) {
|
||||
nodep->v3error("Non-ANSI I/O declaration of signal "
|
||||
"conflicts with type declaration: "
|
||||
<< nodep->prettyNameQ() << '\n'
|
||||
<< nodep->warnContextPrimary() << '\n'
|
||||
<< findvarp->warnOther()
|
||||
<< "... Location of other declaration\n"
|
||||
<< findvarp->warnContextSecondary());
|
||||
&& !(VN_IS(varDtp, BasicDType)
|
||||
&& VN_AS(varDtp, BasicDType)->keyword()
|
||||
== VBasicDTypeKwd::LOGIC_IMPLICIT)) {
|
||||
// Can't compare dtypes now as might contain parameters,
|
||||
// defer to V3Width
|
||||
AstAttrOf* const newp
|
||||
= new AstAttrOf{otherDtp->fileline(), VAttrType::VAR_PORT_DTYPE,
|
||||
otherDtp->unlinkFrBack()};
|
||||
findvarp->addAttrsp(newp);
|
||||
}
|
||||
}
|
||||
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||
|
||||
@@ -2356,6 +2356,23 @@ class WidthVisitor final : public VNVisitor {
|
||||
// Make sure dtype is sized
|
||||
nodep->dtypep(iterateEditMoveDTypep(nodep, nodep->subDTypep()));
|
||||
UASSERT_OBJ(nodep->dtypep(), nodep, "No dtype determined for var");
|
||||
if (nodep->attrsp()) {
|
||||
nodep->attrsp()->foreach([this, nodep](AstAttrOf* attrp) {
|
||||
if (attrp->attrType() == VAttrType::VAR_PORT_DTYPE) {
|
||||
V3Const::constifyParamsEdit(attrp->fromp()); // fromp may change
|
||||
if (!similarDTypeRecurse(nodep->dtypep(), VN_AS(attrp->fromp(), NodeDType))) {
|
||||
nodep->dtypep()->v3error("Non-ANSI I/O declaration of signal "
|
||||
"conflicts with type declaration: "
|
||||
<< nodep->prettyNameQ() << '\n'
|
||||
<< nodep->dtypep()->warnContextPrimary() << '\n'
|
||||
<< attrp->warnOther()
|
||||
<< "... Location of other declaration\n"
|
||||
<< attrp->warnContextSecondary());
|
||||
}
|
||||
VL_DO_DANGLING(pushDeletep(attrp->unlinkFrBack()), attrp);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (m_ftaskp && m_ftaskp->dpiImport()) {
|
||||
AstNodeDType* dtp = nodep->dtypep();
|
||||
AstNodeDType* np = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user