Internals: Identify $unit package by netlist pointer

This commit is contained in:
Geza Lore
2026-09-26 07:48:56 +01:00
parent 435af6afe6
commit 33d63ac0b0
6 changed files with 8 additions and 10 deletions
+2 -4
View File
@@ -670,7 +670,7 @@ class DeadVisitor final : public VNVisitor {
nextmodp = VN_AS(modp->nextp(), NodeModule);
// Keep $unit until m_elimCells stages. Note v3Global.opt.serializeOnly()
// won't reach this stage, and will always have an empty $unit. That's ok.
const bool keep = !m_elimCells && modp == v3Global.rootp()->dollarUnitPkgp();
const bool keep = !m_elimCells && modp->isDollarUnit();
if (modp->dead() || (!modp->isTop() && modp->user1() == 0 && !keep)) {
// > 2 because L1 is the wrapper, L2 is the top user module
UINFO(4, " Dead module " << modp);
@@ -681,9 +681,7 @@ class DeadVisitor final : public VNVisitor {
cellp->modp()->user1Inc(-1);
});
}
if (modp == v3Global.rootp()->dollarUnitPkgp()) {
v3Global.rootp()->dollarUnitPkgp(nullptr);
}
if (modp->isDollarUnit()) v3Global.rootp()->dollarUnitPkgp(nullptr);
deleting(modp);
retry = true;
}