mirror of
https://github.com/verilator/verilator.git
synced 2026-10-08 02:53:12 +02:00
Optimize instance port connections by aliasing rather than by assignment (#8427)
Use AstAlias instead of AstAssignW in V3Inst port connection lowering, the same way as V3Inline would do if the instance is inlined. This closes some of the gap between -finline and -fno-inline behaviour, and is also required for moving V3Inline post scope, where it could not create aliases anymore (hence required for future patch to maintain current behaviour). This is also a partial fix to #4698 (only when the connected expression is a plain VarRef)
This commit is contained in:
+3
-4
@@ -599,8 +599,9 @@ class FsmDetectVisitor final : public VNVisitor {
|
||||
if (!fsmRegisterWrapperDesc(cellp)) return;
|
||||
UASSERT_OBJ(lhsVscp->varp()->isInput(), nodep,
|
||||
"Child-side port alias lhs should be an input");
|
||||
UASSERT_OBJ(rhsVscp->scopep() == m_scopep, nodep,
|
||||
"Child input port alias should connect from the parent scope");
|
||||
// Note the connected variable can live in a scope further up, as V3Inst
|
||||
// aliases a port connection, merging the port variable of an instance into
|
||||
// whatever it is connected to
|
||||
m_cellPortAliases[cellp][lhsVscp->varp()->name()] = rhsVscp;
|
||||
m_cellPortChildAliases[cellp][lhsVscp->varp()->name()] = lhsVscp;
|
||||
addWrapperCell(m_scopep, cellp);
|
||||
@@ -608,8 +609,6 @@ class FsmDetectVisitor final : public VNVisitor {
|
||||
if (!fsmRegisterWrapperDesc(cellp)) return;
|
||||
UASSERT_OBJ(rhsVscp->varp()->isWritable(), nodep,
|
||||
"Child-side port alias rhs should be writable");
|
||||
UASSERT_OBJ(lhsVscp->scopep() == m_scopep, nodep,
|
||||
"Child output port alias should connect into the parent scope");
|
||||
m_cellPortAliases[cellp][rhsVscp->varp()->name()] = lhsVscp;
|
||||
m_cellPortChildAliases[cellp][rhsVscp->varp()->name()] = rhsVscp;
|
||||
addWrapperCell(m_scopep, cellp);
|
||||
|
||||
Reference in New Issue
Block a user