Fix JSON dump missing output ports (#6751) (#6831)

This commit is contained in:
Oleh Maksymenko
2025-12-19 07:30:33 -05:00
committed by GitHub
parent be08862109
commit a098e4894f
19 changed files with 334 additions and 56 deletions
+35
View File
@@ -414,3 +414,38 @@ void V3LinkLevel::wrapTopCell(AstNetlist* rootp) {
}
}
}
void V3LinkLevel::nonWrapTop(AstNetlist* rootp) {
// Perform variable setting step for top modules to prevent
// optimizing away primary ports when only serializing input
if (!rootp->modulesp()) { // Later V3LinkDot will warn
UINFO(1, "No module found");
return;
}
// For all top modules
for (AstNodeModule* modp = rootp->modulesp(); modp && modp->isTop();
modp = VN_AS(modp->nextp(), NodeModule)) {
if (VN_IS(modp, Package)) continue;
UINFO(5, "LOOP " << modp);
for (AstNode* subnodep = modp->stmtsp(); subnodep; subnodep = subnodep->nextp()) {
if (AstVar* const varp = VN_CAST(subnodep, Var)) {
UINFO(8, "VARWRAP " << varp);
if (varp->isIO()) {
varp->protect(false);
varp->sigPublic(true);
varp->primaryIO(true);
if (varp->isRef() || varp->isConstRef()) {
varp->v3warn(E_UNSUPPORTED,
"Unsupported: ref/const ref as primary input/output: "
<< varp->prettyNameQ());
}
if (v3Global.opt.systemC()) varp->sc(true);
if (v3Global.opt.noTraceTop()) varp->trace(false);
}
}
}
}
}