mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 10:03:44 +02:00
Support disable dotted references (#6154)
This commit is contained in:
+28
-20
@@ -337,33 +337,41 @@ class LinkJumpVisitor final : public VNVisitor {
|
||||
}
|
||||
void visit(AstDisable* nodep) override {
|
||||
UINFO(8, " DISABLE " << nodep);
|
||||
iterateChildren(nodep);
|
||||
AstNodeBlock* blockp = nullptr;
|
||||
for (AstNodeBlock* const stackp : vlstd::reverse_view(m_blockStack)) {
|
||||
UINFO(9, " UNDERBLK " << stackp);
|
||||
if (stackp->name() == nodep->name()) {
|
||||
blockp = stackp;
|
||||
break;
|
||||
AstNode* const targetp = nodep->targetp();
|
||||
UASSERT_OBJ(targetp, nodep, "Unlinked disable statement");
|
||||
if (VN_IS(targetp, Task)) {
|
||||
nodep->v3warn(E_UNSUPPORTED, "Unsupported: disabling task by name");
|
||||
} else if (VN_IS(targetp, Fork)) {
|
||||
nodep->v3warn(E_UNSUPPORTED, "Unsupported: disabling fork by name");
|
||||
} else if (AstBegin* const beginp = VN_CAST(targetp, Begin)) {
|
||||
const std::string targetName = beginp->name();
|
||||
bool aboveBlock = false;
|
||||
for (AstNodeBlock* const stackp : vlstd::reverse_view(m_blockStack)) {
|
||||
UINFO(9, " UNDERBLK " << stackp);
|
||||
if (stackp->name() == targetName) {
|
||||
aboveBlock = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (debug() >= 9) { UINFO(0, "\n"); blockp->dumpTree("- labeli: "); }
|
||||
if (!blockp) {
|
||||
nodep->v3warn(E_UNSUPPORTED,
|
||||
"disable isn't underneath a begin with name: " << nodep->prettyNameQ());
|
||||
} else if (AstBegin* const beginp = VN_CAST(blockp, Begin)) {
|
||||
if (beginp->user3()) {
|
||||
nodep->v3warn(E_UNSUPPORTED, "Unsupported: disabling block that contains a fork");
|
||||
if (aboveBlock) {
|
||||
if (beginp->user3()) {
|
||||
nodep->v3warn(E_UNSUPPORTED,
|
||||
"Unsupported: disabling block that contains a fork");
|
||||
} else {
|
||||
// Jump to the end of the named block
|
||||
AstJumpLabel* const labelp = findAddLabel(beginp, false);
|
||||
nodep->addNextHere(new AstJumpGo{nodep->fileline(), labelp});
|
||||
}
|
||||
} else {
|
||||
// Jump to the end of the named block
|
||||
AstJumpLabel* const labelp = findAddLabel(beginp, false);
|
||||
nodep->addNextHere(new AstJumpGo{nodep->fileline(), labelp});
|
||||
nodep->v3warn(E_UNSUPPORTED, "disable isn't underneath a begin with name: '"
|
||||
<< targetName << "'");
|
||||
}
|
||||
} else {
|
||||
nodep->v3warn(E_UNSUPPORTED, "Unsupported: disabling fork by name");
|
||||
nodep->v3fatalSrc("Disable linked with node of unhandled type "
|
||||
<< targetp->prettyTypeName());
|
||||
}
|
||||
nodep->unlinkFrBack();
|
||||
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||
// if (debug() >= 9) { UINFO(0, "\n"); beginp->dumpTree("- labelo: "); }
|
||||
}
|
||||
void visit(AstVarRef* nodep) override {
|
||||
if (m_loopInc && nodep->varp()) nodep->varp()->usedLoopIdx(true);
|
||||
|
||||
Reference in New Issue
Block a user