Fix V3Gate assertion on eliminated circular logic (#5889) (#5898)

Fixes #5889
This commit is contained in:
Geza Lore
2025-03-28 17:04:09 +00:00
committed by GitHub
parent b6bcbd5660
commit 39c3e79a3c
3 changed files with 63 additions and 2 deletions
+14 -2
View File
@@ -869,8 +869,20 @@ class GateInline final {
if (debug() >= 9) dstVtxp->nodep()->dumpTree(" inside: ");
UASSERT_OBJ(logicp != dstVtxp->nodep(), logicp,
"Circular logic should have been rejected by okVisitor");
if (logicp == dstVtxp->nodep()) {
// This is a bit involved. The graph tells us that the logic is circular
// (driver is same as sink), however, okVisitor rejects a circular driver
// and we would not reach here if the driver logic was actually circular.
// The reason we end up here is because during graph building, the driver
// was ciruclar, however, after committing some substituions to it, it
// has become non-circualr due to V3Const being applied inside
// 'commitSubstitutions'. We will trust GateOkVisitor telling the truth
// that the logic is not actually circular, meaning this edge is not
// actually needed, can just delete it and move on.
VL_DO_DANGLING(edgep->unlinkDelete(), edgep);
continue;
}
recordSubstitution(vscp, substp, dstVtxp->nodep());
// If the new replacement referred to a signal,