Fix vlSelf error on fork repeats (#5927).

This commit is contained in:
Wilson Snyder
2025-04-26 09:52:44 -04:00
parent e7adae6f81
commit c3d1c3b952
4 changed files with 81 additions and 1 deletions
+2 -1
View File
@@ -610,9 +610,10 @@ void EmitCFunc::emitSetVarConstant(const string& assignString, AstConst* constp)
void EmitCFunc::emitVarReset(AstVar* varp, bool constructing) {
// 'constructing' indicates that the object was just constructed, so no need to clear it also
AstNodeDType* const dtypep = varp->dtypep()->skipRefp();
const string vlSelf = VSelfPointerText::replaceThis(m_useSelfForThis, "this->");
const string varNameProtected = (VN_IS(m_modp, Class) || varp->isFuncLocal())
? varp->nameProtect()
: "vlSelf->" + varp->nameProtect();
: vlSelf + varp->nameProtect();
if (varp->isIO() && m_modp->isTop() && optSystemC()) {
// System C top I/O doesn't need loading, as the lower level subinst code does it.}
} else if (varp->isParam()) {