Fix DFG removing forceable signals (#4942)

DFG could remove forceable signals by replacing them with their
in-design driver. This is a bit of a pain to prevent, and ideally the
forcing transform should happen before DFG, but implementing it there is
a pain due to having to rewrite ports based on direction.  This is an
attempted fix in DFG. More cases might remain.
This commit is contained in:
Geza Lore
2024-03-03 16:22:41 +00:00
committed by GitHub
parent 0fbd4313b2
commit 745605efe3
7 changed files with 137 additions and 61 deletions
+7 -2
View File
@@ -167,9 +167,14 @@ void V3DfgPasses::inlineVars(const DfgGraph& dfg) {
if (varp->hasSinks() && varp->isDrivenFullyByDfg() && !varp->varp()->isSc()) {
DfgVertex* const driverp = varp->source(0);
// If driven from a SystemC variable, don't inline this variable
// We must keep the original driver in certain cases, when swapping them would
// not be functionally or technically (implementation reasons) equivalent
if (DfgVertexVar* const driverVarp = driverp->cast<DfgVarPacked>()) {
if (driverVarp->varp()->isSc()) continue;
const AstVar* const varp = driverVarp->varp();
// If driven from a SystemC variable
if (varp->isSc()) continue;
// If the variable is forceable
if (varp->isForceable()) continue;
}
varp->forEachSinkEdge([=](DfgEdge& edge) {