Support clocking blocks in virtual interfaces (#5235)

This commit is contained in:
Arkadiusz Kozdra
2024-07-09 18:31:58 -04:00
committed by GitHub
parent e3e7b3f2b5
commit 2cfec0ecc3
19 changed files with 423 additions and 77 deletions
+17 -8
View File
@@ -2209,9 +2209,10 @@ class LinkDotResolveVisitor final : public VNVisitor {
new AstVarRef{clockingp->fileline(), eventp, VAccess::WRITE},
false}});
v3Global.setHasEvents();
eventp->user1p(new VSymEnt{m_statep->symsp(), eventp});
}
return reinterpret_cast<VSymEnt*>(clockingp->eventp()->user1p());
AstVar* const eventp = clockingp->eventp();
if (!eventp->user1p()) eventp->user1p(new VSymEnt{m_statep->symsp(), eventp});
return reinterpret_cast<VSymEnt*>(eventp->user1p());
}
bool isParamedClassRefDType(const AstNode* classp) {
@@ -3045,7 +3046,12 @@ class LinkDotResolveVisitor final : public VNVisitor {
dotSymp = m_statep->findDotted(nodep->fileline(), dotSymp, nodep->dotted(), baddot,
okSymp); // Maybe nullptr
if (!m_statep->forScopeCreation()) {
VSymEnt* const foundp = m_statep->findSymPrefixed(dotSymp, nodep->name(), baddot);
VSymEnt* foundp = m_statep->findSymPrefixed(dotSymp, nodep->name(), baddot);
if (m_inSens && foundp) {
if (AstClocking* const clockingp = VN_CAST(foundp->nodep(), Clocking)) {
foundp = getCreateClockingEventSymEnt(clockingp);
}
}
AstVar* const varp
= foundp ? foundToVarp(foundp, nodep, nodep->access()) : nullptr;
nodep->varp(varp);
@@ -3062,11 +3068,14 @@ class LinkDotResolveVisitor final : public VNVisitor {
// AstVarXRef's even though they are in the same module detect
// this and convert to normal VarRefs
if (!m_statep->forPrearray() && !m_statep->forScopeCreation()) {
if (VN_IS(nodep->dtypep(), IfaceRefDType)) {
AstVarRef* const newrefp
= new AstVarRef{nodep->fileline(), nodep->varp(), nodep->access()};
nodep->replaceWith(newrefp);
VL_DO_DANGLING(nodep->deleteTree(), nodep);
if (const AstIfaceRefDType* const ifaceDtp
= VN_CAST(nodep->dtypep(), IfaceRefDType)) {
if (!ifaceDtp->isVirtual()) {
AstVarRef* const newrefp
= new AstVarRef{nodep->fileline(), nodep->varp(), nodep->access()};
nodep->replaceWith(newrefp);
VL_DO_DANGLING(nodep->deleteTree(), nodep);
}
}
}
} else {