mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 01:54:01 +02:00
Fix fork scheduling semantics (#6730)
Signed-off-by: Artur Bieniek <[email protected]>
This commit is contained in:
+32
-6
@@ -622,6 +622,29 @@ private:
|
||||
return findp;
|
||||
}
|
||||
|
||||
VSymEnt* findForkParentAlias(VSymEnt* symp, const string& ident) {
|
||||
static const string suffix = "__VgetForkParent";
|
||||
VSymEnt* const wrapperp = symp->findIdFlat(ident + suffix);
|
||||
if (!wrapperp) return nullptr;
|
||||
if (!VN_IS(wrapperp->nodep(), Begin)) return nullptr;
|
||||
if (VSymEnt* const forkSymp = wrapperp->findIdFlat(ident)) {
|
||||
if (VN_IS(forkSymp->nodep(), Fork)) return forkSymp;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
VSymEnt* unwrapForkParent(VSymEnt* symp, const string& ident) {
|
||||
static const string suffix = "__VgetForkParent";
|
||||
if (AstBegin* const beginp = VN_CAST(symp->nodep(), Begin)) {
|
||||
if (VString::endsWith(beginp->name(), suffix)) {
|
||||
if (VSymEnt* const forkSymp = symp->findIdFlat(ident)) {
|
||||
if (VN_IS(forkSymp->nodep(), Fork)) return forkSymp;
|
||||
}
|
||||
}
|
||||
}
|
||||
return symp;
|
||||
}
|
||||
|
||||
VSymEnt* findWithAltFlat(VSymEnt* symp, const string& name, const string& altname) {
|
||||
VSymEnt* findp = symp->findIdFlat(name);
|
||||
if (findp) return findp;
|
||||
@@ -672,9 +695,10 @@ public:
|
||||
const AstCellInline* inlinep = lookupSymp
|
||||
? VN_CAST(lookupSymp->nodep(), CellInline)
|
||||
: nullptr; // Replicated below
|
||||
if (VSymEnt* const findSymp = findWithAltFallback(lookupSymp, ident, altIdent)) {
|
||||
lookupSymp = findSymp;
|
||||
}
|
||||
VSymEnt* findSymp = findWithAltFallback(lookupSymp, ident, altIdent);
|
||||
if (!findSymp) findSymp = findForkParentAlias(lookupSymp, ident);
|
||||
if (findSymp) lookupSymp = unwrapForkParent(findSymp, ident);
|
||||
|
||||
// Check this module - cur modname
|
||||
else if ((cellp && cellp->modp()->origName() == ident)
|
||||
|| (inlinep && inlinep->origModName() == ident)) {
|
||||
@@ -720,9 +744,11 @@ public:
|
||||
if (!lookupSymp) return nullptr; // Not found
|
||||
}
|
||||
} else { // Searching for middle submodule, must be a cell name
|
||||
if (VSymEnt* const findSymp = findWithAltFlat(lookupSymp, ident, altIdent)) {
|
||||
lookupSymp = findSymp;
|
||||
} else {
|
||||
VSymEnt* findSymp = findWithAltFlat(lookupSymp, ident, altIdent);
|
||||
if (!findSymp) findSymp = findForkParentAlias(lookupSymp, ident);
|
||||
if (findSymp)
|
||||
lookupSymp = unwrapForkParent(findSymp, ident);
|
||||
else {
|
||||
return nullptr; // Not found
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user